From 114a878c64ce6f8223cfd22d76a20eb16d177e5e 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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- AUTHORS | 88 + COPYING | 340 + COPYING.LIB | 481 + ChangeLog | 2846 +++++ ConfigureChecks.cmake | 27 + Doxyfile | 274 + Doxyfile.am | 186 + Doxyfile_full.am | 215 + HACKING | 9 + HACKING.language | 12 + INSTALL | 175 + Makefile.am | 54 + Makefile.cvs | 14 + NEWS | 0 README | 25 + TODO | 1 + buildtools/Makefile.am | 48 + buildtools/ada/Makefile.am | 18 + buildtools/ada/README.dox | 17 + buildtools/ada/adaglobaloptionsdlg.cpp | 129 + buildtools/ada/adaglobaloptionsdlg.h | 50 + buildtools/ada/adaproject_optionsdlgbase.ui | 472 + buildtools/ada/adaproject_part.cpp | 465 + buildtools/ada/adaproject_part.h | 93 + buildtools/ada/adaproject_widget.cpp | 24 + buildtools/ada/adaproject_widget.h | 21 + buildtools/ada/adaprojectoptionsdlg.cpp | 208 + buildtools/ada/adaprojectoptionsdlg.h | 57 + buildtools/ada/kdevadaproject.desktop | 100 + buildtools/ada/kdevadaproject.rc | 14 + buildtools/ada/service.cpp | 75 + buildtools/ada/service.h | 27 + buildtools/ant/Makefile.am | 21 + buildtools/ant/README.dox | 8 + buildtools/ant/antoptionswidget.ui | 173 + buildtools/ant/antprojectpart.cpp | 608 + buildtools/ant/antprojectpart.h | 117 + buildtools/ant/classpathwidget.ui | 39 + buildtools/ant/kdevantproject.desktop | 96 + buildtools/ant/kdevantproject.rc | 14 + buildtools/autotools/Makefile.am | 38 + buildtools/autotools/README | 1 + buildtools/autotools/README.dox | 39 + buildtools/autotools/addapplicationdlg.cpp | 207 + buildtools/autotools/addapplicationdlg.h | 45 + buildtools/autotools/addapplicationdlgbase.ui | 552 + buildtools/autotools/addexistingdirectoriesdlg.cpp | 388 + buildtools/autotools/addexistingdirectoriesdlg.h | 74 + buildtools/autotools/addexistingdlgbase.ui | 459 + buildtools/autotools/addexistingfilesdlg.cpp | 451 + buildtools/autotools/addexistingfilesdlg.h | 77 + buildtools/autotools/addfiledlg.cpp | 135 + buildtools/autotools/addfiledlg.h | 47 + buildtools/autotools/addfiledlgbase.ui | 289 + buildtools/autotools/addicondlg.cpp | 115 + buildtools/autotools/addicondlg.h | 44 + buildtools/autotools/addicondlgbase.ui | 273 + buildtools/autotools/addprefixdlg.cpp | 76 + buildtools/autotools/addprefixdlg.h | 45 + buildtools/autotools/addservicedlg.cpp | 233 + buildtools/autotools/addservicedlg.h | 46 + buildtools/autotools/addservicedlgbase.ui | 544 + buildtools/autotools/addsubprojectdlg.cpp | 198 + buildtools/autotools/addsubprojectdlg.h | 44 + buildtools/autotools/addsubprojectdlgbase.ui | 198 + buildtools/autotools/addtargetdlg.cpp | 226 + buildtools/autotools/addtargetdlg.h | 43 + buildtools/autotools/addtargetdlgbase.ui | 348 + buildtools/autotools/addtranslationdlg.cpp | 109 + buildtools/autotools/addtranslationdlg.h | 36 + buildtools/autotools/autodetailsview.cpp | 728 ++ buildtools/autotools/autodetailsview.h | 88 + buildtools/autotools/autolistviewitems.cpp | 181 + buildtools/autotools/autolistviewitems.h | 143 + buildtools/autotools/autoprojectpart.cpp | 1474 +++ buildtools/autotools/autoprojectpart.h | 153 + buildtools/autotools/autoprojectviewbase.ui | 123 + buildtools/autotools/autoprojectwidget.cpp | 748 ++ buildtools/autotools/autoprojectwidget.h | 229 + buildtools/autotools/autosubprojectview.cpp | 1137 ++ buildtools/autotools/autosubprojectview.h | 130 + buildtools/autotools/autotoolsaction.cpp | 156 + buildtools/autotools/autotoolsaction.h | 70 + buildtools/autotools/choosetargetdialog.cpp | 348 + buildtools/autotools/choosetargetdialog.h | 57 + buildtools/autotools/choosetargetdlgbase.ui | 222 + buildtools/autotools/configureoptionswidget.cpp | 431 + buildtools/autotools/configureoptionswidget.h | 69 + buildtools/autotools/configureoptionswidgetbase.ui | 1040 ++ buildtools/autotools/fileselectorwidget.cpp | 243 + buildtools/autotools/fileselectorwidget.h | 96 + buildtools/autotools/kdevautoproject.desktop | 97 + buildtools/autotools/kdevautoproject.rc | 30 + buildtools/autotools/kdevkdeautoproject.desktop | 92 + buildtools/autotools/kfilednddetailview.cpp | 212 + buildtools/autotools/kfilednddetailview.h | 136 + buildtools/autotools/kfiledndiconview.cpp | 194 + buildtools/autotools/kfiledndiconview.h | 128 + buildtools/autotools/kimporticonview.cpp | 87 + buildtools/autotools/kimporticonview.h | 44 + buildtools/autotools/makefilehandler.cpp | 166 + buildtools/autotools/makefilehandler.h | 76 + buildtools/autotools/managecustomcommand.cpp | 49 + buildtools/autotools/managecustomcommand.h | 37 + buildtools/autotools/managecustomcommandsbase.ui | 125 + buildtools/autotools/misc.cpp | 999 ++ buildtools/autotools/misc.h | 65 + buildtools/autotools/removefiledlg.cpp | 182 + buildtools/autotools/removefiledlg.h | 51 + buildtools/autotools/removefiledlgbase.ui | 233 + buildtools/autotools/removetargetdlg.cpp | 279 + buildtools/autotools/removetargetdlg.h | 55 + buildtools/autotools/removetargetdlgbase.ui | 264 + buildtools/autotools/subprojectoptionsdlg.cpp | 404 + buildtools/autotools/subprojectoptionsdlg.h | 63 + buildtools/autotools/subprojectoptionsdlgbase.ui | 989 ++ buildtools/autotools/targetoptionsdlg.cpp | 357 + buildtools/autotools/targetoptionsdlg.h | 49 + buildtools/autotools/targetoptionsdlgbase.ui | 726 ++ buildtools/custommakefiles/Makefile.am | 26 + buildtools/custommakefiles/README.dox | 47 + .../custommakefiles/custombuildoptionswidget.cpp | 99 + .../custommakefiles/custombuildoptionswidget.h | 46 + .../custombuildoptionswidgetbase.ui | 164 + .../custommakefiles/custommakeconfigwidget.cpp | 134 + .../custommakefiles/custommakeconfigwidget.h | 54 + .../custommakefiles/custommakeconfigwidgetbase.ui | 395 + buildtools/custommakefiles/custommanagerwidget.cpp | 80 + buildtools/custommakefiles/custommanagerwidget.h | 41 + .../custommakefiles/custommanagerwidgetbase.ui | 74 + .../custommakefiles/customotherconfigwidget.cpp | 125 + .../custommakefiles/customotherconfigwidget.h | 57 + .../custommakefiles/customotherconfigwidgetbase.ui | 288 + buildtools/custommakefiles/customprojectpart.cpp | 1669 +++ buildtools/custommakefiles/customprojectpart.h | 158 + .../custommakefiles/kdevcustomproject.desktop | 91 + buildtools/custommakefiles/kdevcustomproject.rc | 30 + .../custommakefiles/selectnewfilesdialog.cpp | 131 + buildtools/custommakefiles/selectnewfilesdialog.h | 53 + .../custommakefiles/selectnewfilesdialogbase.ui | 50 + buildtools/lib/Makefile.am | 8 + buildtools/lib/base/Mainpage.dox | 19 + buildtools/lib/base/Makefile.am | 15 + buildtools/lib/base/kdevbuildtool.cpp | 38 + buildtools/lib/base/kdevbuildtool.h | 41 + buildtools/lib/parsers/Makefile.am | 8 + buildtools/lib/parsers/autotools/Mainpage.dox | 11 + buildtools/lib/parsers/autotools/Makefile.am | 24 + buildtools/lib/parsers/autotools/autotools.ll | 136 + buildtools/lib/parsers/autotools/autotools.yy | 323 + buildtools/lib/parsers/autotools/autotools_lex.cpp | 1894 +++ .../lib/parsers/autotools/autotools_yacc.cpp | 1631 +++ buildtools/lib/parsers/autotools/autotools_yacc.h | 100 + buildtools/lib/parsers/autotools/autotoolsast.cpp | 117 + buildtools/lib/parsers/autotools/autotoolsast.h | 269 + .../lib/parsers/autotools/autotoolsdriver.cpp | 70 + buildtools/lib/parsers/autotools/autotoolsdriver.h | 76 + buildtools/lib/parsers/autotools/tests/Makefile.am | 21 + buildtools/lib/parsers/autotools/tests/runner.cpp | 33 + buildtools/lib/parsers/autotools/tests/viewer.cpp | 162 + buildtools/lib/parsers/autotools/tests/viewer.h | 46 + .../lib/parsers/autotools/tests/viewer_main.cpp | 34 + .../lib/parsers/autotools/tests/viewerbase.ui | 220 + buildtools/lib/parsers/qmake/FlexLexer.h | 205 + buildtools/lib/parsers/qmake/Mainpage.dox | 16 + buildtools/lib/parsers/qmake/Makefile.am | 31 + buildtools/lib/parsers/qmake/location.hh | 145 + buildtools/lib/parsers/qmake/position.hh | 142 + buildtools/lib/parsers/qmake/qmake.ll | 237 + buildtools/lib/parsers/qmake/qmake.yy | 430 + buildtools/lib/parsers/qmake/qmake_lex.cpp | 2239 ++++ buildtools/lib/parsers/qmake/qmake_lex.h | 49 + buildtools/lib/parsers/qmake/qmake_yacc.cpp | 1243 ++ buildtools/lib/parsers/qmake/qmake_yacc.hpp | 418 + buildtools/lib/parsers/qmake/qmakeast.cpp | 170 + buildtools/lib/parsers/qmake/qmakeast.h | 236 + buildtools/lib/parsers/qmake/qmakeastvisitor.cpp | 68 + buildtools/lib/parsers/qmake/qmakeastvisitor.h | 46 + buildtools/lib/parsers/qmake/qmakedriver.cpp | 113 + buildtools/lib/parsers/qmake/qmakedriver.h | 55 + buildtools/lib/parsers/qmake/stack.hh | 129 + buildtools/lib/parsers/qmake/tests/Makefile.am | 21 + buildtools/lib/parsers/qmake/tests/runner.cpp | 169 + buildtools/lib/parsers/qmake/tests/viewer.cpp | 182 + buildtools/lib/parsers/qmake/tests/viewer.h | 48 + buildtools/lib/parsers/qmake/tests/viewer_main.cpp | 33 + buildtools/lib/parsers/qmake/tests/viewerbase.ui | 250 + buildtools/lib/widgets/Mainpage.dox | 10 + buildtools/lib/widgets/Makefile.am | 30 + buildtools/lib/widgets/addenvvardlg.cpp | 84 + buildtools/lib/widgets/addenvvardlg.h | 54 + buildtools/lib/widgets/addfilesdialog.cpp | 78 + buildtools/lib/widgets/addfilesdialog.h | 57 + .../lib/widgets/environmentdisplaydialog.cpp | 54 + buildtools/lib/widgets/environmentdisplaydialog.h | 35 + .../lib/widgets/environmentdisplaydialogbase.ui | 111 + .../lib/widgets/environmentvariableswidget.cpp | 126 + .../lib/widgets/environmentvariableswidget.h | 59 + .../lib/widgets/environmentvariableswidgetbase.ui | 200 + buildtools/lib/widgets/envvartools.cpp | 31 + buildtools/lib/widgets/envvartools.h | 28 + buildtools/lib/widgets/makeoptionswidget.cpp | 64 + buildtools/lib/widgets/makeoptionswidget.h | 50 + buildtools/lib/widgets/makeoptionswidgetbase.ui | 194 + buildtools/lib/widgets/removesubprojectdialog.cpp | 52 + buildtools/lib/widgets/removesubprojectdialog.h | 52 + buildtools/lib/widgets/removesubprojectdlgbase.ui | 154 + buildtools/lib/widgets/runoptionswidget.cpp | 138 + buildtools/lib/widgets/runoptionswidget.h | 57 + buildtools/lib/widgets/runoptionswidgetbase.ui | 257 + buildtools/lib/widgets/subclassesdlg.cpp | 122 + buildtools/lib/widgets/subclassesdlg.h | 58 + buildtools/lib/widgets/subclassesdlgbase.ui | 224 + buildtools/pascal/Makefile.am | 24 + buildtools/pascal/README.dox | 13 + buildtools/pascal/kdevpascalproject.desktop | 93 + buildtools/pascal/kdevpascalproject.rc | 14 + buildtools/pascal/pascalglobaloptionsdlg.cpp | 132 + buildtools/pascal/pascalglobaloptionsdlg.h | 52 + buildtools/pascal/pascalproject_optionsdlgbase.ui | 474 + buildtools/pascal/pascalproject_part.cpp | 493 + buildtools/pascal/pascalproject_part.h | 95 + buildtools/pascal/pascalproject_widget.cpp | 26 + buildtools/pascal/pascalproject_widget.h | 25 + buildtools/pascal/pascalprojectoptionsdlg.cpp | 210 + buildtools/pascal/pascalprojectoptionsdlg.h | 59 + buildtools/pascal/service.cpp | 77 + buildtools/pascal/service.h | 29 + buildtools/qmake/Makefile.am | 34 + buildtools/qmake/README | 1 + buildtools/qmake/README.dox | 39 + buildtools/qmake/choosesubprojectdlg.cpp | 114 + buildtools/qmake/choosesubprojectdlg.h | 64 + buildtools/qmake/choosesubprojectdlgbase.ui | 134 + buildtools/qmake/createscopedlg.cpp | 100 + buildtools/qmake/createscopedlg.h | 45 + buildtools/qmake/createscopedlgbase.ui | 329 + buildtools/qmake/disablesubprojectdlg.cpp | 50 + buildtools/qmake/disablesubprojectdlg.h | 42 + buildtools/qmake/disablesubprojectdlgbase.ui | 126 + buildtools/qmake/kdevtmakeproject.desktop | 91 + buildtools/qmake/kdevtrollproject.desktop | 95 + buildtools/qmake/kdevtrollproject.rc | 33 + buildtools/qmake/newwidgetdlg.cpp | 80 + buildtools/qmake/newwidgetdlg.h | 38 + buildtools/qmake/newwidgetdlgbase.ui | 229 + buildtools/qmake/projectconfigurationdlg.cpp | 2174 ++++ buildtools/qmake/projectconfigurationdlg.h | 145 + buildtools/qmake/projectconfigurationdlgbase.ui | 2897 +++++ buildtools/qmake/qmakedefaultopts.cpp | 91 + buildtools/qmake/qmakedefaultopts.h | 49 + buildtools/qmake/qmakeoptionswidget.cpp | 63 + buildtools/qmake/qmakeoptionswidget.h | 39 + buildtools/qmake/qmakeoptionswidgetbase.ui | 217 + buildtools/qmake/qmakescopeitem.cpp | 928 ++ buildtools/qmake/qmakescopeitem.h | 128 + buildtools/qmake/scope.cpp | 1710 +++ buildtools/qmake/scope.h | 308 + buildtools/qmake/trolllistview.cpp | 38 + buildtools/qmake/trolllistview.h | 41 + buildtools/qmake/trollprojectpart.cpp | 931 ++ buildtools/qmake/trollprojectpart.h | 105 + buildtools/qmake/trollprojectwidget.cpp | 2547 ++++ buildtools/qmake/trollprojectwidget.h | 218 + buildtools/script/Makefile.am | 26 + buildtools/script/README.dox | 48 + buildtools/script/kdevscriptproject.desktop | 87 + buildtools/script/kdevscriptproject.rc | 12 + buildtools/script/scriptnewfiledlg.cpp | 119 + buildtools/script/scriptnewfiledlg.h | 39 + buildtools/script/scriptoptionswidget.cpp | 69 + buildtools/script/scriptoptionswidget.h | 35 + buildtools/script/scriptoptionswidgetbase.ui | 155 + buildtools/script/scriptprojectpart.cpp | 446 + buildtools/script/scriptprojectpart.h | 69 + config.h.cmake | 22 + configure.in.bot | 24 + configure.in.in | 127 + doc/Makefile.am | 2 + doc/api/Architecture.dox | 315 + doc/api/Architecture.png | Bin 0 -> 71707 bytes doc/api/Architecture.sxd | Bin 0 -> 7581 bytes doc/api/Development.png | Bin 0 -> 71400 bytes doc/api/Development.sxd | Bin 0 -> 8396 bytes doc/api/EditorsSupportStatus.dox | 189 + doc/api/FutureTasks.dox | 136 + doc/api/HighPriTasks.dox | 36 + doc/api/HowToAddApplicationTemplates.dox | 285 + doc/api/HowToAddFileTemplates.dox | 30 + doc/api/HowToAddGenericBuildTools.dox | 21 + doc/api/HowToAddPlugins.dox | 204 + doc/api/HowToAddProgrammingLanguages.dox | 252 + doc/api/HowToDocument.dox | 39 + doc/api/LangSupportStatus.dox | 330 + doc/api/Mainpage.dox | 91 + doc/api/PropEditor.dox | 108 + doc/api/propeditor1.png | Bin 0 -> 3937 bytes doc/api/propeditor2.png | Bin 0 -> 3697 bytes doc/extras/Makefile.am | 8 + doc/extras/opengl.toc | 267 + doc/extras/sdl.toc | 219 + doc/extras/w3c/Makefile.am | 3 + doc/extras/w3c/w3c-dom-level2-html.toc | 70 + doc/extras/w3c/w3c-svg.toc | 1446 +++ doc/extras/w3c/w3c-uaag10.toc | 69 + doc/kde_app_devel/Makefile.am | 3 + doc/kde_app_devel/appwizard.png | Bin 0 -> 46091 bytes doc/kde_app_devel/index.docbook | 1549 +++ doc/kde_app_devel/kscribblefiles.png | Bin 0 -> 16708 bytes doc/kdearch/Makefile.am | 2 + doc/kdearch/affine-general.png | Bin 0 -> 3182 bytes doc/kdearch/affine-rotate.png | Bin 0 -> 1941 bytes doc/kdearch/affine-scale.png | Bin 0 -> 1419 bytes doc/kdearch/affine-shear.png | Bin 0 -> 1422 bytes doc/kdearch/affine-translate.png | Bin 0 -> 1444 bytes doc/kdearch/brushstyles.png | Bin 0 -> 9874 bytes doc/kdearch/canvas.png | Bin 0 -> 24979 bytes doc/kdearch/capflat.png | Bin 0 -> 267 bytes doc/kdearch/capround.png | Bin 0 -> 441 bytes doc/kdearch/capsquare.png | Bin 0 -> 185 bytes doc/kdearch/index.docbook | 3337 +++++ doc/kdearch/joinbevel.png | Bin 0 -> 529 bytes doc/kdearch/joinmiter.png | Bin 0 -> 569 bytes doc/kdearch/joinround.png | Bin 0 -> 597 bytes doc/kdearch/konqi-mirrored.png | Bin 0 -> 27633 bytes doc/kdearch/konqi-normal.png | Bin 0 -> 27757 bytes doc/kdearch/konqi-rotated.png | Bin 0 -> 28953 bytes doc/kdearch/konqi-sheared.png | Bin 0 -> 25644 bytes doc/kdearch/kview-menu.png | Bin 0 -> 4204 bytes doc/kdearch/opengl.png | Bin 0 -> 4818 bytes doc/kdearch/penstyles.png | Bin 0 -> 2854 bytes doc/kdearch/whatsthis.png | Bin 0 -> 3509 bytes doc/kdevelop/Makefile.am | 3 + doc/kdevelop/SF-general.png | Bin 0 -> 13488 bytes doc/kdevelop/SF-indent.png | Bin 0 -> 19392 bytes doc/kdevelop/SF-other.png | Bin 0 -> 15840 bytes doc/kdevelop/adv-build-management.docbook | 128 + doc/kdevelop/app-changelog.docbook | 69 + doc/kdevelop/app-files.docbook | 425 + doc/kdevelop/app-menu.docbook | 61 + doc/kdevelop/app-misc-info.docbook | 24 + doc/kdevelop/app-uimodes-examples.docbook | 125 + doc/kdevelop/applicationwizard.docbook | 820 ++ doc/kdevelop/automake-file-popup.png | Bin 0 -> 24236 bytes doc/kdevelop/automake-manager.png | Bin 0 -> 18841 bytes doc/kdevelop/automake-subproject-popup.png | Bin 0 -> 13626 bytes doc/kdevelop/automake-target-popup.png | Bin 0 -> 21258 bytes doc/kdevelop/automakemanager.png | Bin 0 -> 38739 bytes doc/kdevelop/build-commands.png | Bin 0 -> 5263 bytes doc/kdevelop/build-configurations.png | Bin 0 -> 28299 bytes doc/kdevelop/build-menu-automake.png | Bin 0 -> 7307 bytes doc/kdevelop/build-menu.png | Bin 0 -> 18774 bytes doc/kdevelop/class-browsers.docbook | 90 + doc/kdevelop/classview.png | Bin 0 -> 17523 bytes doc/kdevelop/commands.docbook | 1989 +++ doc/kdevelop/configure-adddialog-baselibs.png | Bin 0 -> 13434 bytes doc/kdevelop/configure-adddialog-qt.png | Bin 0 -> 19096 bytes doc/kdevelop/configure-adddialog.png | Bin 0 -> 19578 bytes doc/kdevelop/configure-doctree-DevHelp.png | Bin 0 -> 58057 bytes doc/kdevelop/configure-doctree-TOC.png | Bin 0 -> 76680 bytes doc/kdevelop/configure-doctree-bookmark.png | Bin 0 -> 34257 bytes doc/kdevelop/configure-doctree-general.png | Bin 0 -> 56208 bytes doc/kdevelop/configure-doctree-textsearch.png | Bin 0 -> 42655 bytes doc/kdevelop/configure-docu-chm.png | Bin 0 -> 26368 bytes doc/kdevelop/configure-docu-custom.png | Bin 0 -> 28116 bytes doc/kdevelop/configure-docu-devhelp.png | Bin 0 -> 41947 bytes doc/kdevelop/configure-docu-dox.png | Bin 0 -> 31091 bytes doc/kdevelop/configure-docu-edit.png | Bin 0 -> 12783 bytes doc/kdevelop/configure-docu-general.png | Bin 0 -> 31183 bytes doc/kdevelop/configure-docu-indexgen.png | Bin 0 -> 14162 bytes doc/kdevelop/configure-docu-toc.png | Bin 0 -> 40144 bytes doc/kdevelop/configure-editor.png | Bin 0 -> 8479 bytes doc/kdevelop/configure-file-selector.png | Bin 0 -> 27872 bytes doc/kdevelop/configure-file-templates.png | Bin 0 -> 43131 bytes doc/kdevelop/configure-general.png | Bin 0 -> 36474 bytes doc/kdevelop/configure-project-buildconfig.png | Bin 0 -> 4785 bytes doc/kdevelop/configure-project-configure.png | Bin 0 -> 33246 bytes doc/kdevelop/configure-project-cpp.png | Bin 0 -> 17444 bytes doc/kdevelop/configure-project-cppoptions.png | Bin 0 -> 30254 bytes doc/kdevelop/configure-project-doc.png | Bin 0 -> 69953 bytes doc/kdevelop/configure-project-make.png | Bin 0 -> 24739 bytes doc/kdevelop/configure-project-run.png | Bin 0 -> 33653 bytes doc/kdevelop/configure-select.png | Bin 0 -> 34978 bytes doc/kdevelop/configure-snippets.png | Bin 0 -> 19436 bytes doc/kdevelop/create-new-project-cvs.png | Bin 0 -> 29197 bytes doc/kdevelop/create-new-project.png | Bin 0 -> 44427 bytes doc/kdevelop/createnewproject.png | Bin 0 -> 82772 bytes doc/kdevelop/createnewprojectoptions.png | Bin 0 -> 20860 bytes doc/kdevelop/credits.docbook | 24 + doc/kdevelop/cvs.docbook | 139 + doc/kdevelop/debugger.docbook | 242 + doc/kdevelop/doctree-add-bookmark.png | Bin 0 -> 34194 bytes doc/kdevelop/doctree-reduced.png | Bin 0 -> 24702 bytes doc/kdevelop/doctree.png | Bin 0 -> 20086 bytes doc/kdevelop/doctreeview.png | Bin 0 -> 10196 bytes doc/kdevelop/documentation.docbook | 57 + doc/kdevelop/documents-contents.png | Bin 0 -> 20872 bytes doc/kdevelop/documents-search.png | Bin 0 -> 12259 bytes doc/kdevelop/edit-doctree-TOC-entry.png | Bin 0 -> 23762 bytes doc/kdevelop/editing.docbook | 401 + doc/kdevelop/editor-ctags-lookup.png | Bin 0 -> 8557 bytes doc/kdevelop/editor-ctags-menu.png | Bin 0 -> 10880 bytes doc/kdevelop/editor-ctags-regenerate.png | Bin 0 -> 7758 bytes doc/kdevelop/editor-find-menu.png | Bin 0 -> 5588 bytes doc/kdevelop/editor-search-doc.png | Bin 0 -> 114190 bytes doc/kdevelop/editor-switch-header.png | Bin 0 -> 22431 bytes doc/kdevelop/empty-ide.png | Bin 0 -> 36414 bytes doc/kdevelop/file-browsers.docbook | 79 + doc/kdevelop/file-list-close-selected.png | Bin 0 -> 36603 bytes doc/kdevelop/file-list-session-create.png | Bin 0 -> 35031 bytes doc/kdevelop/file-list-session-default.png | Bin 0 -> 3879 bytes doc/kdevelop/file-selector.png | Bin 0 -> 44050 bytes doc/kdevelop/filetree.png | Bin 0 -> 10689 bytes doc/kdevelop/find-in-files.png | Bin 0 -> 24609 bytes doc/kdevelop/folded-tabs.png | Bin 0 -> 8287 bytes doc/kdevelop/getting-started.docbook | 3221 +++++ doc/kdevelop/hello-world-app.png | Bin 0 -> 3548 bytes doc/kdevelop/importdirectory.png | Bin 0 -> 12452 bytes doc/kdevelop/index.docbook | 372 + doc/kdevelop/kdcop_browsing.png | Bin 0 -> 37258 bytes doc/kdevelop/kdevdesigner.png | Bin 0 -> 69839 bytes doc/kdevelop/kdevelop-ideal-mode-0.png | Bin 0 -> 107904 bytes doc/kdevelop/kdevelop-ideal-mode.png | Bin 0 -> 163776 bytes doc/kdevelop/kdevelop-install.docbook | 754 ++ doc/kdevelop/kdevelop-mdi-mode.png | Bin 0 -> 163219 bytes doc/kdevelop/kdevelop-scripting.docbook | 56 + doc/kdevelop/kdevelop-survey.docbook | 489 + doc/kdevelop/kdevelop-tabbed-mode.png | Bin 0 -> 160823 bytes doc/kdevelop/kdevelop-toplevel-mode.png | Bin 0 -> 173323 bytes doc/kdevelop/listplugins.sh | 43 + doc/kdevelop/loading-progress-bar.png | Bin 0 -> 7813 bytes doc/kdevelop/nutshell.docbook | 242 + doc/kdevelop/open-project.png | Bin 0 -> 55212 bytes doc/kdevelop/open-recent-project.png | Bin 0 -> 24043 bytes doc/kdevelop/plugin-tools.docbook | 433 + doc/kdevelop/problem-report-all-todos.png | Bin 0 -> 11407 bytes doc/kdevelop/problem-report-marks.png | Bin 0 -> 9438 bytes doc/kdevelop/problem-report-todo.png | Bin 0 -> 28006 bytes doc/kdevelop/project-advanced.docbook | 83 + doc/kdevelop/project-management.docbook | 751 ++ doc/kdevelop/raw-project-warning.png | Bin 0 -> 17848 bytes doc/kdevelop/run-button.png | Bin 0 -> 4867 bytes doc/kdevelop/script_location.png | Bin 0 -> 33687 bytes doc/kdevelop/select-user-interface-0.png | Bin 0 -> 40919 bytes doc/kdevelop/select-user-interface.png | Bin 0 -> 64121 bytes doc/kdevelop/setup.docbook | 1990 +++ doc/kdevelop/split-source-header-navigate.png | Bin 0 -> 8696 bytes doc/kdevelop/split-source-header.png | Bin 0 -> 11044 bytes doc/kdevelop/split-windows.png | Bin 0 -> 15424 bytes doc/kdevelop/split-workspace.png | Bin 0 -> 7382 bytes doc/kdevelop/survey-manual.docbook | 228 + doc/kdevelop/tutorial-debug-tree.png | Bin 0 -> 15622 bytes doc/kdevelop/tutorial-hello-new.png | Bin 0 -> 221583 bytes doc/kdevelop/tutorial-hello-options.png | Bin 0 -> 6818 bytes doc/kdevelop/tutorial-new-project.png | Bin 0 -> 61543 bytes doc/kdevelop/unixdev.docbook | 386 + doc/kdevelop/wrong-project-location.png | Bin 0 -> 11847 bytes doc/platform/Mainpage.dox | 148 + doc/std/Makefile.am | 7 + doc/std/kdev3api.toc | 45 + doc/tools/Makefile.am | 4 + doc/tools/index-python | 52 + doc/tools/index-texi | 60 + doc/tools/index.xsl | 34 + doc/tools/toc-docbook | 71 + doc/tools/toc-gsdoc | 24 + doc/tools/toc-python | 57 + doc/tools/toc-texi | 47 + editors/Makefile.am | 1 + editors/editor-chooser/Makefile.am | 13 + editors/editor-chooser/README.dox | 8 + editors/editor-chooser/editchooser.ui | 130 + editors/editor-chooser/editorchooser_part.cpp | 42 + editors/editor-chooser/editorchooser_part.h | 33 + editors/editor-chooser/editorchooser_widget.cpp | 132 + editors/editor-chooser/editorchooser_widget.h | 39 + editors/editor-chooser/kdeveditorchooser.desktop | 91 + embedded/Makefile.am | 13 + embedded/visualboyadvance/Makefile.am | 17 + .../visualboyadvance/kdevpart_visualboyadvance.rc | 11 + .../visualboyadvance/kdevvisualboyadvance.desktop | 86 + embedded/visualboyadvance/vbaconfigwidget.cpp | 144 + embedded/visualboyadvance/vbaconfigwidget.h | 42 + embedded/visualboyadvance/vbaconfigwidgetbase.ui | 249 + .../visualboyadvance/visualboyadvance_part.cpp | 77 + embedded/visualboyadvance/visualboyadvance_part.h | 29 + kde-development-kdevelop.directory | 5 + kdevassistant.desktop | 74 + kdevdesigner/AUTHORS | 4 + kdevdesigner/LICENSE.GPL | 340 + kdevdesigner/Makefile.am | 4 + kdevdesigner/NEWS | 1 + kdevdesigner/README | 25 + kdevdesigner/TODO | 1 + kdevdesigner/designer/Makefile.am | 21 + kdevdesigner/designer/about.ui | 219 + kdevdesigner/designer/actiondnd.cpp | 726 ++ kdevdesigner/designer/actiondnd.h | 247 + kdevdesigner/designer/actioneditor.ui | 227 + kdevdesigner/designer/actioneditorimpl.cpp | 320 + kdevdesigner/designer/actioneditorimpl.h | 79 + kdevdesigner/designer/actionlistview.cpp | 110 + kdevdesigner/designer/actionlistview.h | 81 + kdevdesigner/designer/asciivalidator.cpp | 94 + kdevdesigner/designer/asciivalidator.h | 52 + kdevdesigner/designer/command.cpp | 2473 ++++ kdevdesigner/designer/command.h | 1259 ++ kdevdesigner/designer/configtoolboxdialog.ui | 326 + kdevdesigner/designer/configtoolboxdialog.ui.h | 215 + kdevdesigner/designer/connectiondialog.ui | 219 + kdevdesigner/designer/connectiondialog.ui.h | 318 + kdevdesigner/designer/connectionitems.cpp | 517 + kdevdesigner/designer/connectionitems.h | 220 + kdevdesigner/designer/connectiontable.cpp | 56 + kdevdesigner/designer/connectiontable.h | 46 + kdevdesigner/designer/createtemplate.ui | 195 + kdevdesigner/designer/customwidgeteditor.ui | 1378 +++ kdevdesigner/designer/customwidgeteditorimpl.cpp | 842 ++ kdevdesigner/designer/customwidgeteditorimpl.h | 98 + kdevdesigner/designer/database.cpp | 122 + kdevdesigner/designer/database.h | 83 + kdevdesigner/designer/dbconnection.ui | 222 + kdevdesigner/designer/dbconnectioneditor.ui | 147 + kdevdesigner/designer/dbconnectionimpl.cpp | 80 + kdevdesigner/designer/dbconnectionimpl.h | 57 + kdevdesigner/designer/dbconnections.ui | 321 + kdevdesigner/designer/dbconnectionsimpl.cpp | 196 + kdevdesigner/designer/dbconnectionsimpl.h | 60 + kdevdesigner/designer/defs.cpp | 84 + kdevdesigner/designer/defs.h | 42 + kdevdesigner/designer/designer_pch.h | 44 + kdevdesigner/designer/designeraction.cpp | 48 + kdevdesigner/designer/designeraction.h | 54 + kdevdesigner/designer/designerapp.cpp | 176 + kdevdesigner/designer/designerapp.h | 58 + kdevdesigner/designer/designerappiface.cpp | 1093 ++ kdevdesigner/designer/designerappiface.h | 277 + kdevdesigner/designer/editfunctions.ui | 714 ++ kdevdesigner/designer/editfunctionsimpl.cpp | 534 + kdevdesigner/designer/editfunctionsimpl.h | 94 + kdevdesigner/designer/filechooser.cpp | 90 + kdevdesigner/designer/filechooser.h | 68 + kdevdesigner/designer/finddialog.ui | 274 + kdevdesigner/designer/finddialog.ui.h | 61 + kdevdesigner/designer/formfile.cpp | 905 ++ kdevdesigner/designer/formfile.h | 145 + kdevdesigner/designer/formsettings.ui | 549 + kdevdesigner/designer/formsettingsimpl.cpp | 118 + kdevdesigner/designer/formsettingsimpl.h | 49 + kdevdesigner/designer/formwindow.cpp | 2775 +++++ kdevdesigner/designer/formwindow.h | 322 + kdevdesigner/designer/gotolinedialog.ui | 169 + kdevdesigner/designer/gotolinedialog.ui.h | 50 + kdevdesigner/designer/hierarchyview.cpp | 1508 +++ kdevdesigner/designer/hierarchyview.h | 249 + kdevdesigner/designer/iconvieweditor.ui | 461 + kdevdesigner/designer/iconvieweditorimpl.cpp | 165 + kdevdesigner/designer/iconvieweditorimpl.h | 58 + kdevdesigner/designer/kdevdesigner_part.cpp | 565 + kdevdesigner/designer/kdevdesigner_part.desktop | 16 + kdevdesigner/designer/kdevdesigner_part.h | 146 + kdevdesigner/designer/kdevdesigner_part.rc | 121 + kdevdesigner/designer/kdevdesigner_part_sh.rc | 116 + kdevdesigner/designer/layout.cpp | 1017 ++ kdevdesigner/designer/layout.h | 188 + kdevdesigner/designer/listboxdnd.cpp | 305 + kdevdesigner/designer/listboxdnd.h | 63 + kdevdesigner/designer/listboxeditor.ui | 457 + kdevdesigner/designer/listboxeditorimpl.cpp | 245 + kdevdesigner/designer/listboxeditorimpl.h | 61 + kdevdesigner/designer/listboxrename.cpp | 157 + kdevdesigner/designer/listboxrename.h | 57 + kdevdesigner/designer/listdnd.cpp | 142 + kdevdesigner/designer/listdnd.h | 63 + kdevdesigner/designer/listeditor.ui | 179 + kdevdesigner/designer/listeditor.ui.h | 72 + kdevdesigner/designer/listviewdnd.cpp | 432 + kdevdesigner/designer/listviewdnd.h | 66 + kdevdesigner/designer/listvieweditor.ui | 935 ++ kdevdesigner/designer/listvieweditorimpl.cpp | 650 + kdevdesigner/designer/listvieweditorimpl.h | 102 + kdevdesigner/designer/mainwindow.cpp | 3784 ++++++ kdevdesigner/designer/mainwindow.h | 511 + kdevdesigner/designer/mainwindowactions.cpp | 2067 ++++ kdevdesigner/designer/menubareditor.cpp | 1129 ++ kdevdesigner/designer/menubareditor.h | 198 + kdevdesigner/designer/metadatabase.cpp | 1692 +++ kdevdesigner/designer/metadatabase.h | 269 + kdevdesigner/designer/multilineeditor.ui | 181 + kdevdesigner/designer/multilineeditorimpl.cpp | 415 + kdevdesigner/designer/multilineeditorimpl.h | 109 + kdevdesigner/designer/myiconloader.cpp | 32 + kdevdesigner/designer/myiconloader.h | 32 + kdevdesigner/designer/newform.ui | 238 + kdevdesigner/designer/newformimpl.cpp | 414 + kdevdesigner/designer/newformimpl.h | 164 + kdevdesigner/designer/orderindicator.cpp | 112 + kdevdesigner/designer/orderindicator.h | 57 + kdevdesigner/designer/outputwindow.cpp | 209 + kdevdesigner/designer/outputwindow.h | 98 + kdevdesigner/designer/paletteeditor.ui | 496 + kdevdesigner/designer/paletteeditoradvanced.ui | 748 ++ .../designer/paletteeditoradvancedimpl.cpp | 643 + kdevdesigner/designer/paletteeditoradvancedimpl.h | 96 + kdevdesigner/designer/paletteeditorimpl.cpp | 304 + kdevdesigner/designer/paletteeditorimpl.h | 76 + kdevdesigner/designer/pics/Makefile.am | 2 + kdevdesigner/designer/pics/designer_adjustsize.png | Bin 0 -> 495 bytes kdevdesigner/designer/pics/designer_appicon.png | Bin 0 -> 2341 bytes kdevdesigner/designer/pics/designer_arrow.png | Bin 0 -> 217 bytes kdevdesigner/designer/pics/designer_background.png | Bin 0 -> 6724 bytes kdevdesigner/designer/pics/designer_book.png | Bin 0 -> 825 bytes .../designer/pics/designer_buttongroup.png | Bin 0 -> 648 bytes kdevdesigner/designer/pics/designer_checkbox.png | Bin 0 -> 817 bytes kdevdesigner/designer/pics/designer_combobox.png | Bin 0 -> 549 bytes .../designer/pics/designer_connecttool.png | Bin 0 -> 553 bytes kdevdesigner/designer/pics/designer_cross.png | Bin 0 -> 164 bytes .../designer/pics/designer_customwidget.png | Bin 0 -> 1133 bytes .../designer/pics/designer_d_adjustsize.png | Bin 0 -> 529 bytes kdevdesigner/designer/pics/designer_d_book.png | Bin 0 -> 561 bytes .../designer/pics/designer_d_buttongroup.png | Bin 0 -> 482 bytes kdevdesigner/designer/pics/designer_d_checkbox.png | Bin 0 -> 547 bytes kdevdesigner/designer/pics/designer_d_combobox.png | Bin 0 -> 420 bytes .../designer/pics/designer_d_connecttool.png | Bin 0 -> 450 bytes .../designer/pics/designer_d_customwidget.png | Bin 0 -> 629 bytes .../designer/pics/designer_d_databrowser.png | Bin 0 -> 603 bytes .../designer/pics/designer_d_datatable.png | Bin 0 -> 592 bytes kdevdesigner/designer/pics/designer_d_dataview.png | Bin 0 -> 663 bytes kdevdesigner/designer/pics/designer_d_dateedit.png | Bin 0 -> 452 bytes .../designer/pics/designer_d_datetimeedit.png | Bin 0 -> 669 bytes kdevdesigner/designer/pics/designer_d_dial.png | Bin 0 -> 706 bytes kdevdesigner/designer/pics/designer_d_down.png | Bin 0 -> 441 bytes .../designer/pics/designer_d_editbreaklayout.png | Bin 0 -> 635 bytes kdevdesigner/designer/pics/designer_d_editcopy.png | Bin 0 -> 517 bytes kdevdesigner/designer/pics/designer_d_editcut.png | Bin 0 -> 800 bytes .../designer/pics/designer_d_editdelete.png | Bin 0 -> 684 bytes kdevdesigner/designer/pics/designer_d_editgrid.png | Bin 0 -> 425 bytes .../designer/pics/designer_d_edithlayout.png | Bin 0 -> 272 bytes .../designer/pics/designer_d_edithlayoutsplit.png | Bin 0 -> 328 bytes .../designer/pics/designer_d_editlower.png | Bin 0 -> 453 bytes .../designer/pics/designer_d_editpaste.png | Bin 0 -> 599 bytes .../designer/pics/designer_d_editraise.png | Bin 0 -> 454 bytes .../designer/pics/designer_d_editslots.png | Bin 0 -> 535 bytes .../designer/pics/designer_d_editvlayout.png | Bin 0 -> 272 bytes .../designer/pics/designer_d_editvlayoutsplit.png | Bin 0 -> 333 bytes kdevdesigner/designer/pics/designer_d_filenew.png | Bin 0 -> 298 bytes kdevdesigner/designer/pics/designer_d_fileopen.png | Bin 0 -> 407 bytes kdevdesigner/designer/pics/designer_d_filesave.png | Bin 0 -> 267 bytes kdevdesigner/designer/pics/designer_d_folder.png | Bin 0 -> 841 bytes kdevdesigner/designer/pics/designer_d_form.png | Bin 0 -> 274 bytes kdevdesigner/designer/pics/designer_d_frame.png | Bin 0 -> 427 bytes kdevdesigner/designer/pics/designer_d_groupbox.png | Bin 0 -> 465 bytes kdevdesigner/designer/pics/designer_d_help.png | Bin 0 -> 786 bytes kdevdesigner/designer/pics/designer_d_home.png | Bin 0 -> 743 bytes kdevdesigner/designer/pics/designer_d_iconview.png | Bin 0 -> 548 bytes kdevdesigner/designer/pics/designer_d_image.png | Bin 0 -> 482 bytes kdevdesigner/designer/pics/designer_d_label.png | Bin 0 -> 670 bytes kdevdesigner/designer/pics/designer_d_layout.png | Bin 0 -> 497 bytes .../designer/pics/designer_d_lcdnumber.png | Bin 0 -> 452 bytes kdevdesigner/designer/pics/designer_d_left.png | Bin 0 -> 422 bytes kdevdesigner/designer/pics/designer_d_line.png | Bin 0 -> 327 bytes kdevdesigner/designer/pics/designer_d_lineedit.png | Bin 0 -> 445 bytes kdevdesigner/designer/pics/designer_d_listbox.png | Bin 0 -> 410 bytes kdevdesigner/designer/pics/designer_d_listview.png | Bin 0 -> 640 bytes .../designer/pics/designer_d_multilineedit.png | Bin 0 -> 482 bytes kdevdesigner/designer/pics/designer_d_newform.png | Bin 0 -> 443 bytes .../designer/pics/designer_d_ordertool.png | Bin 0 -> 533 bytes kdevdesigner/designer/pics/designer_d_pixlabel.png | Bin 0 -> 619 bytes kdevdesigner/designer/pics/designer_d_pointer.png | Bin 0 -> 476 bytes kdevdesigner/designer/pics/designer_d_print.png | Bin 0 -> 593 bytes kdevdesigner/designer/pics/designer_d_progress.png | Bin 0 -> 375 bytes kdevdesigner/designer/pics/designer_d_project.png | Bin 0 -> 915 bytes .../designer/pics/designer_d_pushbutton.png | Bin 0 -> 445 bytes .../designer/pics/designer_d_radiobutton.png | Bin 0 -> 605 bytes kdevdesigner/designer/pics/designer_d_redo.png | Bin 0 -> 465 bytes .../designer/pics/designer_d_richtextedit.png | Bin 0 -> 562 bytes kdevdesigner/designer/pics/designer_d_right.png | Bin 0 -> 425 bytes .../designer/pics/designer_d_scrollbar.png | Bin 0 -> 364 bytes .../designer/pics/designer_d_searchfind.png | Bin 0 -> 501 bytes kdevdesigner/designer/pics/designer_d_setbuddy.png | Bin 0 -> 427 bytes kdevdesigner/designer/pics/designer_d_slider.png | Bin 0 -> 548 bytes kdevdesigner/designer/pics/designer_d_spacer.png | Bin 0 -> 519 bytes kdevdesigner/designer/pics/designer_d_spinbox.png | Bin 0 -> 477 bytes kdevdesigner/designer/pics/designer_d_table.png | Bin 0 -> 512 bytes .../designer/pics/designer_d_tabwidget.png | Bin 0 -> 404 bytes kdevdesigner/designer/pics/designer_d_textbold.png | Bin 0 -> 519 bytes .../designer/pics/designer_d_textbrowser.png | Bin 0 -> 534 bytes .../designer/pics/designer_d_textcenter.png | Bin 0 -> 453 bytes kdevdesigner/designer/pics/designer_d_textedit.png | Bin 0 -> 526 bytes kdevdesigner/designer/pics/designer_d_textfont.png | Bin 0 -> 412 bytes kdevdesigner/designer/pics/designer_d_texth1.png | Bin 0 -> 476 bytes kdevdesigner/designer/pics/designer_d_texth2.png | Bin 0 -> 537 bytes kdevdesigner/designer/pics/designer_d_texth3.png | Bin 0 -> 509 bytes .../designer/pics/designer_d_textitalic.png | Bin 0 -> 454 bytes .../designer/pics/designer_d_textjustify.png | Bin 0 -> 442 bytes .../designer/pics/designer_d_textlarger.png | Bin 0 -> 537 bytes kdevdesigner/designer/pics/designer_d_textleft.png | Bin 0 -> 443 bytes .../designer/pics/designer_d_textlinebreak.png | Bin 0 -> 528 bytes .../designer/pics/designer_d_textparagraph.png | Bin 0 -> 543 bytes .../designer/pics/designer_d_textright.png | Bin 0 -> 445 bytes .../designer/pics/designer_d_textsmaller.png | Bin 0 -> 513 bytes .../designer/pics/designer_d_textteletext.png | Bin 0 -> 463 bytes .../designer/pics/designer_d_textunderline.png | Bin 0 -> 498 bytes kdevdesigner/designer/pics/designer_d_textview.png | Bin 0 -> 529 bytes kdevdesigner/designer/pics/designer_d_timeedit.png | Bin 0 -> 827 bytes kdevdesigner/designer/pics/designer_d_toolbox.png | Bin 0 -> 465 bytes .../designer/pics/designer_d_toolbutton.png | Bin 0 -> 670 bytes kdevdesigner/designer/pics/designer_d_undo.png | Bin 0 -> 471 bytes kdevdesigner/designer/pics/designer_d_up.png | Bin 0 -> 444 bytes .../designer/pics/designer_d_widgetstack.png | Bin 0 -> 558 bytes .../designer/pics/designer_d_wizarddata.png | Bin 0 -> 294 bytes .../designer/pics/designer_d_wizarddialog.png | Bin 0 -> 421 bytes kdevdesigner/designer/pics/designer_d_wordwrap.png | Bin 0 -> 507 bytes .../designer/pics/designer_databrowser.png | Bin 0 -> 907 bytes kdevdesigner/designer/pics/designer_datatable.png | Bin 0 -> 923 bytes kdevdesigner/designer/pics/designer_dataview.png | Bin 0 -> 1039 bytes kdevdesigner/designer/pics/designer_dateedit.png | Bin 0 -> 505 bytes .../designer/pics/designer_datetimeedit.png | Bin 0 -> 1074 bytes kdevdesigner/designer/pics/designer_dial.png | Bin 0 -> 1024 bytes kdevdesigner/designer/pics/designer_down.png | Bin 0 -> 595 bytes .../designer/pics/designer_editbreaklayout.png | Bin 0 -> 744 bytes kdevdesigner/designer/pics/designer_editcopy.png | Bin 0 -> 485 bytes kdevdesigner/designer/pics/designer_editcut.png | Bin 0 -> 649 bytes kdevdesigner/designer/pics/designer_editdelete.png | Bin 0 -> 833 bytes kdevdesigner/designer/pics/designer_editgrid.png | Bin 0 -> 520 bytes .../designer/pics/designer_edithlayout.png | Bin 0 -> 295 bytes .../designer/pics/designer_edithlayoutsplit.png | Bin 0 -> 344 bytes kdevdesigner/designer/pics/designer_editlower.png | Bin 0 -> 609 bytes kdevdesigner/designer/pics/designer_editpaste.png | Bin 0 -> 907 bytes kdevdesigner/designer/pics/designer_editraise.png | Bin 0 -> 614 bytes kdevdesigner/designer/pics/designer_editslots.png | Bin 0 -> 690 bytes .../designer/pics/designer_editvlayout.png | Bin 0 -> 289 bytes .../designer/pics/designer_editvlayoutsplit.png | Bin 0 -> 355 bytes kdevdesigner/designer/pics/designer_filenew.png | Bin 0 -> 313 bytes kdevdesigner/designer/pics/designer_fileopen.png | Bin 0 -> 681 bytes kdevdesigner/designer/pics/designer_filesave.png | Bin 0 -> 328 bytes kdevdesigner/designer/pics/designer_folder.png | Bin 0 -> 1368 bytes kdevdesigner/designer/pics/designer_form.png | Bin 0 -> 301 bytes kdevdesigner/designer/pics/designer_frame.png | Bin 0 -> 400 bytes kdevdesigner/designer/pics/designer_groupbox.png | Bin 0 -> 439 bytes kdevdesigner/designer/pics/designer_hand.png | Bin 0 -> 198 bytes kdevdesigner/designer/pics/designer_help.png | Bin 0 -> 1561 bytes kdevdesigner/designer/pics/designer_home.png | Bin 0 -> 1083 bytes kdevdesigner/designer/pics/designer_hsplit.png | Bin 0 -> 203 bytes kdevdesigner/designer/pics/designer_ibeam.png | Bin 0 -> 162 bytes kdevdesigner/designer/pics/designer_iconview.png | Bin 0 -> 613 bytes kdevdesigner/designer/pics/designer_image.png | Bin 0 -> 769 bytes kdevdesigner/designer/pics/designer_label.png | Bin 0 -> 953 bytes kdevdesigner/designer/pics/designer_layout.png | Bin 0 -> 706 bytes kdevdesigner/designer/pics/designer_lcdnumber.png | Bin 0 -> 558 bytes kdevdesigner/designer/pics/designer_left.png | Bin 0 -> 678 bytes kdevdesigner/designer/pics/designer_line.png | Bin 0 -> 287 bytes kdevdesigner/designer/pics/designer_lineedit.png | Bin 0 -> 405 bytes kdevdesigner/designer/pics/designer_listbox.png | Bin 0 -> 386 bytes kdevdesigner/designer/pics/designer_listview.png | Bin 0 -> 759 bytes .../designer/pics/designer_multilineedit.png | Bin 0 -> 454 bytes kdevdesigner/designer/pics/designer_newform.png | Bin 0 -> 531 bytes kdevdesigner/designer/pics/designer_no.png | Bin 0 -> 230 bytes kdevdesigner/designer/pics/designer_object.png | Bin 0 -> 1065 bytes kdevdesigner/designer/pics/designer_ordertool.png | Bin 0 -> 587 bytes kdevdesigner/designer/pics/designer_pixlabel.png | Bin 0 -> 1229 bytes kdevdesigner/designer/pics/designer_pointer.png | Bin 0 -> 586 bytes kdevdesigner/designer/pics/designer_print.png | Bin 0 -> 742 bytes kdevdesigner/designer/pics/designer_progress.png | Bin 0 -> 559 bytes kdevdesigner/designer/pics/designer_project.png | Bin 0 -> 1275 bytes kdevdesigner/designer/pics/designer_pushbutton.png | Bin 0 -> 408 bytes kdevdesigner/designer/pics/designer_qtlogo.png | Bin 0 -> 12615 bytes .../designer/pics/designer_radiobutton.png | Bin 0 -> 586 bytes kdevdesigner/designer/pics/designer_redo.png | Bin 0 -> 592 bytes .../designer/pics/designer_resetproperty.png | Bin 0 -> 184 bytes .../designer/pics/designer_richtextedit.png | Bin 0 -> 834 bytes kdevdesigner/designer/pics/designer_right.png | Bin 0 -> 656 bytes kdevdesigner/designer/pics/designer_s_down.png | Bin 0 -> 574 bytes kdevdesigner/designer/pics/designer_s_editcut.png | Bin 0 -> 444 bytes kdevdesigner/designer/pics/designer_s_left.png | Bin 0 -> 564 bytes kdevdesigner/designer/pics/designer_s_right.png | Bin 0 -> 557 bytes kdevdesigner/designer/pics/designer_s_up.png | Bin 0 -> 586 bytes kdevdesigner/designer/pics/designer_scrollbar.png | Bin 0 -> 408 bytes kdevdesigner/designer/pics/designer_searchfind.png | Bin 0 -> 843 bytes kdevdesigner/designer/pics/designer_setbuddy.png | Bin 0 -> 428 bytes kdevdesigner/designer/pics/designer_sizeall.png | Bin 0 -> 208 bytes kdevdesigner/designer/pics/designer_sizeb.png | Bin 0 -> 203 bytes kdevdesigner/designer/pics/designer_sizef.png | Bin 0 -> 203 bytes kdevdesigner/designer/pics/designer_sizeh.png | Bin 0 -> 179 bytes kdevdesigner/designer/pics/designer_sizev.png | Bin 0 -> 177 bytes kdevdesigner/designer/pics/designer_slider.png | Bin 0 -> 729 bytes kdevdesigner/designer/pics/designer_spacer.png | Bin 0 -> 715 bytes kdevdesigner/designer/pics/designer_spinbox.png | Bin 0 -> 455 bytes kdevdesigner/designer/pics/designer_splash.png | Bin 0 -> 123917 bytes kdevdesigner/designer/pics/designer_table.png | Bin 0 -> 483 bytes kdevdesigner/designer/pics/designer_tabwidget.png | Bin 0 -> 572 bytes kdevdesigner/designer/pics/designer_textbold.png | Bin 0 -> 498 bytes .../designer/pics/designer_textbrowser.png | Bin 0 -> 514 bytes kdevdesigner/designer/pics/designer_textcenter.png | Bin 0 -> 429 bytes kdevdesigner/designer/pics/designer_textedit.png | Bin 0 -> 497 bytes kdevdesigner/designer/pics/designer_textfont.png | Bin 0 -> 494 bytes kdevdesigner/designer/pics/designer_texth1.png | Bin 0 -> 462 bytes kdevdesigner/designer/pics/designer_texth2.png | Bin 0 -> 512 bytes kdevdesigner/designer/pics/designer_texth3.png | Bin 0 -> 486 bytes kdevdesigner/designer/pics/designer_textitalic.png | Bin 0 -> 442 bytes .../designer/pics/designer_textjustify.png | Bin 0 -> 409 bytes kdevdesigner/designer/pics/designer_textlarger.png | Bin 0 -> 733 bytes kdevdesigner/designer/pics/designer_textleft.png | Bin 0 -> 411 bytes .../designer/pics/designer_textlinebreak.png | Bin 0 -> 509 bytes .../designer/pics/designer_textparagraph.png | Bin 0 -> 527 bytes kdevdesigner/designer/pics/designer_textright.png | Bin 0 -> 410 bytes .../designer/pics/designer_textsmaller.png | Bin 0 -> 677 bytes .../designer/pics/designer_textteletext.png | Bin 0 -> 445 bytes .../designer/pics/designer_textunderline.png | Bin 0 -> 471 bytes kdevdesigner/designer/pics/designer_textview.png | Bin 0 -> 498 bytes kdevdesigner/designer/pics/designer_timeedit.png | Bin 0 -> 1520 bytes kdevdesigner/designer/pics/designer_toolbox.png | Bin 0 -> 783 bytes kdevdesigner/designer/pics/designer_toolbutton.png | Bin 0 -> 1262 bytes kdevdesigner/designer/pics/designer_undo.png | Bin 0 -> 572 bytes kdevdesigner/designer/pics/designer_up.png | Bin 0 -> 692 bytes kdevdesigner/designer/pics/designer_uparrow.png | Bin 0 -> 169 bytes kdevdesigner/designer/pics/designer_vsplit.png | Bin 0 -> 192 bytes kdevdesigner/designer/pics/designer_wait.png | Bin 0 -> 216 bytes .../designer/pics/designer_widgetstack.png | Bin 0 -> 831 bytes kdevdesigner/designer/pics/designer_wizarddata.png | Bin 0 -> 323 bytes .../designer/pics/designer_wizarddialog.png | Bin 0 -> 632 bytes kdevdesigner/designer/pics/designer_wordwrap.png | Bin 0 -> 643 bytes kdevdesigner/designer/pixmapchooser.cpp | 231 + kdevdesigner/designer/pixmapchooser.h | 72 + kdevdesigner/designer/pixmapcollection.cpp | 180 + kdevdesigner/designer/pixmapcollection.h | 80 + kdevdesigner/designer/pixmapcollectioneditor.ui | 218 + kdevdesigner/designer/pixmapcollectioneditor.ui.h | 150 + kdevdesigner/designer/pixmapfunction.ui | 976 ++ kdevdesigner/designer/popupmenueditor.cpp | 1469 +++ kdevdesigner/designer/popupmenueditor.h | 235 + kdevdesigner/designer/preferences.ui | 648 + kdevdesigner/designer/previewframe.cpp | 57 + kdevdesigner/designer/previewframe.h | 59 + kdevdesigner/designer/previewwidget.ui | 304 + kdevdesigner/designer/previewwidgetimpl.cpp | 65 + kdevdesigner/designer/previewwidgetimpl.h | 43 + kdevdesigner/designer/project.cpp | 1558 +++ kdevdesigner/designer/project.h | 273 + kdevdesigner/designer/projectsettings.ui | 301 + kdevdesigner/designer/projectsettingsimpl.cpp | 126 + kdevdesigner/designer/projectsettingsimpl.h | 56 + kdevdesigner/designer/propertyeditor.cpp | 4332 +++++++ kdevdesigner/designer/propertyeditor.h | 867 ++ kdevdesigner/designer/propertyobject.cpp | 158 + kdevdesigner/designer/propertyobject.h | 43 + kdevdesigner/designer/qcompletionedit.cpp | 210 + kdevdesigner/designer/qcompletionedit.h | 79 + kdevdesigner/designer/replacedialog.ui | 318 + kdevdesigner/designer/replacedialog.ui.h | 75 + kdevdesigner/designer/resource.cpp | 3327 +++++ kdevdesigner/designer/resource.h | 165 + kdevdesigner/designer/richtextfontdialog.ui | 347 + kdevdesigner/designer/richtextfontdialog.ui.h | 49 + kdevdesigner/designer/sizehandle.cpp | 388 + kdevdesigner/designer/sizehandle.h | 97 + kdevdesigner/designer/sourceeditor.cpp | 320 + kdevdesigner/designer/sourceeditor.h | 106 + kdevdesigner/designer/sourcefile.cpp | 298 + kdevdesigner/designer/sourcefile.h | 86 + kdevdesigner/designer/startdialog.ui | 324 + kdevdesigner/designer/startdialogimpl.cpp | 182 + kdevdesigner/designer/startdialogimpl.h | 80 + kdevdesigner/designer/styledbutton.cpp | 295 + kdevdesigner/designer/styledbutton.h | 103 + kdevdesigner/designer/syntaxhighlighter_html.cpp | 160 + kdevdesigner/designer/syntaxhighlighter_html.h | 57 + kdevdesigner/designer/tableeditor.ui | 828 ++ kdevdesigner/designer/tableeditorimpl.cpp | 494 + kdevdesigner/designer/tableeditorimpl.h | 82 + kdevdesigner/designer/timestamp.cpp | 86 + kdevdesigner/designer/timestamp.h | 63 + kdevdesigner/designer/variabledialog.ui | 294 + kdevdesigner/designer/variabledialogimpl.cpp | 180 + kdevdesigner/designer/variabledialogimpl.h | 56 + kdevdesigner/designer/widgetaction.cpp | 58 + kdevdesigner/designer/widgetaction.h | 65 + kdevdesigner/designer/widgetfactory.cpp | 1797 +++ kdevdesigner/designer/widgetfactory.h | 501 + kdevdesigner/designer/wizardeditor.ui | 342 + kdevdesigner/designer/wizardeditorimpl.cpp | 253 + kdevdesigner/designer/wizardeditorimpl.h | 74 + kdevdesigner/designer/workspace.cpp | 711 ++ kdevdesigner/designer/workspace.h | 151 + kdevdesigner/interfaces/actioninterface.h | 78 + kdevdesigner/interfaces/classbrowserinterface.h | 63 + kdevdesigner/interfaces/designerinterface.h | 261 + kdevdesigner/interfaces/editorinterface.h | 102 + kdevdesigner/interfaces/filterinterface.h | 68 + kdevdesigner/interfaces/interpreterinterface.h | 59 + kdevdesigner/interfaces/languageinterface.h | 131 + kdevdesigner/interfaces/preferenceinterface.h | 68 + kdevdesigner/interfaces/projectsettingsiface.h | 69 + kdevdesigner/interfaces/sourcetemplateiface.h | 65 + kdevdesigner/interfaces/templatewizardiface.h | 60 + kdevdesigner/interfaces/widgetinterface.h | 35 + kdevdesigner/plugins/Makefile.am | 8 + kdevdesigner/plugins/languageinterfaceimpl.cpp | 237 + kdevdesigner/plugins/languageinterfaceimpl.h | 83 + kdevdesigner/shared/Makefile.am | 6 + kdevdesigner/shared/domtool.cpp | 453 + kdevdesigner/shared/domtool.h | 53 + kdevdesigner/shared/globaldefs.h | 62 + kdevdesigner/shared/parser.cpp | 72 + kdevdesigner/shared/parser.h | 39 + kdevdesigner/shared/ui2uib.cpp | 893 ++ kdevdesigner/shared/ui2uib.h | 35 + kdevdesigner/shared/uib.cpp | 42 + kdevdesigner/shared/uib.h | 152 + kdevdesigner/shared/widgetdatabase.cpp | 960 ++ kdevdesigner/shared/widgetdatabase.h | 96 + kdevdesigner/src/Makefile.am | 47 + kdevdesigner/src/kdevdesigner.cpp | 216 + kdevdesigner/src/kdevdesigner.desktop | 96 + kdevdesigner/src/kdevdesigner.h | 96 + kdevdesigner/src/kdevdesigner_shell.rc | 37 + kdevdesigner/src/main.cpp | 94 + kdevdesigner/uilib/Makefile.am | 9 + kdevdesigner/uilib/database.cpp | 122 + kdevdesigner/uilib/database2.h | 88 + kdevdesigner/uilib/qwidgetfactory.cpp | 2606 ++++ kdevdesigner/uilib/qwidgetfactory.h | 180 + kdevelop.desktop | 52 + kdevelop.lsm | 11 + kdevelop.m4.in | 501 + kdevelop_c_cpp.desktop | 49 + kdevelop_kde_cpp.desktop | 48 + kdevelop_ruby.desktop | 51 + kdevelop_scripting.desktop | 69 + kdevprj2kdevelop | 299 + languages/Makefile.am | 74 + languages/ada/AdaAST.hpp | 77 + languages/ada/AdaLexer.cpp | 1507 +++ languages/ada/AdaLexer.hpp | 86 + languages/ada/AdaParser.cpp | 12283 +++++++++++++++++++ languages/ada/AdaParser.hpp | 389 + languages/ada/AdaStoreWalker.cpp | 9439 ++++++++++++++ languages/ada/AdaStoreWalker.hpp | 350 + languages/ada/AdaStoreWalkerTokenTypes.hpp | 307 + languages/ada/AdaStoreWalkerTokenTypes.txt | 289 + languages/ada/AdaTokenTypes.hpp | 306 + languages/ada/AdaTokenTypes.txt | 288 + languages/ada/AdaTreeParserSuper.cpp | 9050 ++++++++++++++ languages/ada/AdaTreeParserSuper.hpp | 241 + languages/ada/AdaTreeParserSuperTokenTypes.hpp | 307 + languages/ada/AdaTreeParserSuperTokenTypes.txt | 289 + languages/ada/Makefile.am | 41 + languages/ada/README | 1 + languages/ada/README.dox | 31 + languages/ada/ada.g | 1982 +++ languages/ada/ada.store.g | 610 + languages/ada/ada.tree.g | 964 ++ languages/ada/ada_utils.cpp | 69 + languages/ada/ada_utils.hpp | 15 + languages/ada/adasupport.cpp | 168 + languages/ada/adasupport.hpp | 13 + languages/ada/adasupportpart.cpp | 376 + languages/ada/adasupportpart.h | 50 + languages/ada/addclass.cpp | 351 + languages/ada/addclass.h | 55 + languages/ada/addclassdlg.ui | 434 + languages/ada/app_templates/Makefile.am | 5 + languages/ada/app_templates/ada.appwizard | 2 + languages/ada/app_templates/adahello/.kdev_ignore | 0 languages/ada/app_templates/adahello/Makefile.am | 16 + languages/ada/app_templates/adahello/ada-Makefile | 2 + .../ada/app_templates/adahello/ada-Makefile.am | 5 + .../ada/app_templates/adahello/ada-Makefile.cvs | 8 + languages/ada/app_templates/adahello/adahello | 10 + .../app_templates/adahello/adahello.kdevtemplate | 132 + languages/ada/app_templates/adahello/adahello.png | Bin 0 -> 10118 bytes languages/ada/app_templates/adahello/app.kdevelop | 84 + .../app_templates/adahello/app.kdevelop.filelist | 1 + languages/ada/app_templates/adahello/configure.in | 10 + languages/ada/app_templates/adahello/main.adb | 8 + .../ada/app_templates/adahello/src-Makefile.am | 8 + languages/ada/backgroundparser.cpp | 77 + languages/ada/backgroundparser.h | 37 + languages/ada/configproblemreporter.ui | 89 + languages/ada/configproblemreporter.ui.h | 39 + languages/ada/configure.in.in | 4 + languages/ada/doc/Makefile.am | 6 + languages/ada/doc/ada.toc | 130 + languages/ada/doc/ada_bugs_gcc.toc | 7 + languages/ada/file_templates/Makefile.am | 3 + languages/ada/file_templates/adb | 12 + languages/ada/file_templates/ads | 12 + languages/ada/kdevadasupport.desktop | 87 + languages/ada/kdevadasupport.rc | 11 + languages/ada/preambles.h | 89 + languages/ada/problemreporter.cpp | 282 + languages/ada/problemreporter.h | 79 + languages/bash/Makefile.am | 20 + languages/bash/README.dox | 15 + languages/bash/app_templates/Makefile.am | 3 + languages/bash/app_templates/bash.appwizard | 2 + .../bash/app_templates/bashhello/.kdev_ignore | 0 languages/bash/app_templates/bashhello/Makefile.am | 16 + .../bash/app_templates/bashhello/app.kdevelop | 82 + languages/bash/app_templates/bashhello/app.sh | 17 + languages/bash/app_templates/bashhello/bashhello | 10 + .../app_templates/bashhello/bashhello.kdevtemplate | 111 + .../bash/app_templates/bashhello/bashhello.png | Bin 0 -> 483 bytes languages/bash/bashsupport_part.cpp | 442 + languages/bash/bashsupport_part.h | 81 + languages/bash/doc/Makefile.am | 6 + languages/bash/doc/bash.toc | 80 + languages/bash/doc/bash_bugs.toc | 7 + languages/bash/kdevbashsupport.desktop | 85 + languages/bash/kdevbashsupport.rc | 11 + languages/cpp/KDevCppSupportIface.cpp | 24 + languages/cpp/KDevCppSupportIface.h | 27 + languages/cpp/Makefile.am | 59 + languages/cpp/README.dox | 34 + languages/cpp/addattributedialog.cpp | 265 + languages/cpp/addattributedialog.h | 60 + languages/cpp/addattributedialogbase.ui | 375 + languages/cpp/addmethoddialog.cpp | 420 + languages/cpp/addmethoddialog.h | 62 + languages/cpp/addmethoddialogbase.ui | 459 + languages/cpp/app_templates/Makefile.am | 10 + .../cpp/app_templates/automakeempty/Makefile.am | 17 + .../cpp/app_templates/automakeempty/app.kdevelop | 101 + .../automakeempty/automakeempty-Makefile.am | 1 + .../automakeempty/automakeempty-Makefile.cvs | 8 + .../automakeempty/automakeempty.kdevtemplate | 99 + .../app_templates/automakeempty/automakeempty.png | Bin 0 -> 8621 bytes .../cpp/app_templates/automakeempty/configure.in | 10 + languages/cpp/app_templates/c.appwizard | 2 + languages/cpp/app_templates/chello/.kdev_ignore | 0 languages/cpp/app_templates/chello/Makefile.am | 18 + languages/cpp/app_templates/chello/app.kdevelop | 107 + languages/cpp/app_templates/chello/c-Makefile.am | 5 + languages/cpp/app_templates/chello/c-Makefile.cvs | 8 + .../cpp/app_templates/chello/chello.kdevtemplate | 253 + languages/cpp/app_templates/chello/chello.png | Bin 0 -> 10118 bytes languages/cpp/app_templates/chello/configure.in | 10 + languages/cpp/app_templates/chello/main.c | 15 + languages/cpp/app_templates/chello/src-Makefile.am | 8 + .../cpp/app_templates/chello_gba/.kdev_ignore | 0 languages/cpp/app_templates/chello_gba/Makefile.am | 18 + .../cpp/app_templates/chello_gba/README.devel | 30 + .../cpp/app_templates/chello_gba/app.kdevelop | 100 + .../cpp/app_templates/chello_gba/c-Makefile.am | 5 + .../cpp/app_templates/chello_gba/c-Makefile.cvs | 8 + .../chello_gba/chellogba.kdevtemplate | 173 + .../cpp/app_templates/chello_gba/chellogba.png | Bin 0 -> 5041 bytes .../cpp/app_templates/chello_gba/configure.in | 10 + languages/cpp/app_templates/chello_gba/font.bmp | Bin 0 -> 1026 bytes languages/cpp/app_templates/chello_gba/font.raw.c | 123 + languages/cpp/app_templates/chello_gba/gba.h | 204 + languages/cpp/app_templates/chello_gba/main.c | 50 + languages/cpp/app_templates/chello_gba/main.h | 12 + .../cpp/app_templates/chello_gba/master.pal.c | 35 + .../cpp/app_templates/chello_gba/src-Makefile.am | 13 + languages/cpp/app_templates/clanlib/.kdev_ignore | 0 languages/cpp/app_templates/clanlib/Makefile.am | 17 + .../cpp/app_templates/clanlib/app-Makefile.am | 1 + languages/cpp/app_templates/clanlib/app-autogen.sh | 2 + .../cpp/app_templates/clanlib/app-configure.in | 22 + languages/cpp/app_templates/clanlib/app.kdevelop | 106 + .../cpp/app_templates/clanlib/clanlib.kdevtemplate | 138 + languages/cpp/app_templates/clanlib/clanlib.png | Bin 0 -> 483 bytes languages/cpp/app_templates/clanlib/main.cpp | 29 + .../cpp/app_templates/clanlib/src-Makefile.am | 4 + .../cpp/app_templates/cmakelibc/CMakeLists.txt | 7 + .../cpp/app_templates/cmakelibc/CMakeLists.txt.src | 19 + languages/cpp/app_templates/cmakelibc/Makefile.am | 16 + languages/cpp/app_templates/cmakelibc/cmakelibc | 7 + .../app_templates/cmakelibc/cmakelibc.kdevtemplate | 139 + .../cpp/app_templates/cmakelibc/cmakelibc.png | Bin 0 -> 10060 bytes languages/cpp/app_templates/cmakelibc/lib.c | 13 + languages/cpp/app_templates/cmakelibc/lib.h | 7 + languages/cpp/app_templates/cmakelibc/test.c | 8 + .../cpp/app_templates/cmakelibcpp/CMakeLists.txt | 8 + .../app_templates/cmakelibcpp/CMakeLists.txt.src | 19 + .../cpp/app_templates/cmakelibcpp/Makefile.am | 16 + .../cpp/app_templates/cmakelibcpp/cmakelibcpp | 7 + .../cmakelibcpp/cmakelibcpp.kdevtemplate | 139 + .../cpp/app_templates/cmakelibcpp/cmakelibcpp.png | Bin 0 -> 10060 bytes languages/cpp/app_templates/cmakelibcpp/lib.cpp | 17 + languages/cpp/app_templates/cmakelibcpp/lib.h | 12 + languages/cpp/app_templates/cmakelibcpp/test.cpp | 9 + .../cpp/app_templates/cmakeqt3app/CMakeLists.txt | 14 + .../app_templates/cmakeqt3app/CMakeLists.txt.src | 28 + .../cpp/app_templates/cmakeqt3app/Makefile.am | 18 + .../cpp/app_templates/cmakeqt3app/cmakeqt3app | 8 + .../cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp | 283 + .../cpp/app_templates/cmakeqt3app/cmakeqt3app.h | 39 + .../cmakeqt3app/cmakeqt3app.kdevtemplate | 126 + .../cpp/app_templates/cmakeqt3app/cmakeqt3app.png | Bin 0 -> 5034 bytes .../cpp/app_templates/cmakeqt3app/fileopen.xpm | 22 + .../cpp/app_templates/cmakeqt3app/fileprint.xpm | 24 + .../cpp/app_templates/cmakeqt3app/filesave.xpm | 22 + languages/cpp/app_templates/cmakeqt3app/main.cpp | 13 + .../cpp/app_templates/cmakesimple/CMakeLists.txt | 15 + .../cpp/app_templates/cmakesimple/Makefile.am | 16 + languages/cpp/app_templates/cmakesimple/README | 30 + .../cpp/app_templates/cmakesimple/cmakesimple | 7 + .../cmakesimple/cmakesimple.kdevtemplate | 112 + .../cpp/app_templates/cmakesimple/cmakesimple.png | Bin 0 -> 12197 bytes languages/cpp/app_templates/cmakesimple/main.cpp | 14 + .../cpp/app_templates/cmakesimplec/CMakeLists.txt | 14 + .../cpp/app_templates/cmakesimplec/Makefile.am | 16 + .../cpp/app_templates/cmakesimplec/cmakesimplec | 7 + .../cmakesimplec/cmakesimplec.kdevtemplate | 115 + .../app_templates/cmakesimplec/cmakesimplec.png | Bin 0 -> 10060 bytes languages/cpp/app_templates/cmakesimplec/main.c | 14 + languages/cpp/app_templates/cpp.appwizard | 2 + .../cpp/app_templates/cppcurseshello/.kdev_ignore | 0 .../cpp/app_templates/cppcurseshello/Makefile.am | 17 + .../app_templates/cppcurseshello/app-configure.in | 21 + .../cpp/app_templates/cppcurseshello/app.kdevelop | 105 + .../app_templates/cppcurseshello/cpp-Makefile.am | 5 + .../app_templates/cppcurseshello/cpp-Makefile.cvs | 7 + .../app_templates/cppcurseshello/cppcurseshello | 10 + .../cppcurseshello/cppcurseshello.kdevtemplate | 143 + .../cppcurseshello/cppcurseshello.png | Bin 0 -> 483 bytes .../cpp/app_templates/cppcurseshello/main.cpp | 49 + .../app_templates/cppcurseshello/src-Makefile.am | 8 + languages/cpp/app_templates/cpphello/.kdev_ignore | 0 languages/cpp/app_templates/cpphello/Makefile.am | 17 + languages/cpp/app_templates/cpphello/app.kdevelop | 105 + languages/cpp/app_templates/cpphello/configure.in | 10 + .../cpp/app_templates/cpphello/cpp-Makefile.am | 5 + .../cpp/app_templates/cpphello/cpp-Makefile.cvs | 8 + .../app_templates/cpphello/cpphello.kdevtemplate | 145 + languages/cpp/app_templates/cpphello/cpphello.png | Bin 0 -> 8621 bytes languages/cpp/app_templates/cpphello/main.cpp | 17 + .../cpp/app_templates/cpphello/src-Makefile.am | 8 + .../cpp/app_templates/cppsdlhello/.kdev_ignore | 0 .../cpp/app_templates/cppsdlhello/Makefile.am | 16 + languages/cpp/app_templates/cppsdlhello/README | 11 + .../cpp/app_templates/cppsdlhello/acinclude.m4 | 167 + .../cpp/app_templates/cppsdlhello/app.kdevelop | 103 + .../cpp/app_templates/cppsdlhello/configure.in | 90 + .../cpp/app_templates/cppsdlhello/cpp-Makefile.am | 5 + .../cpp/app_templates/cppsdlhello/cpp-Makefile.cvs | 8 + .../cpp/app_templates/cppsdlhello/cppsdlhello | 10 + .../cppsdlhello/cppsdlhello.kdevtemplate | 150 + .../cpp/app_templates/cppsdlhello/cppsdlhello.png | Bin 0 -> 10118 bytes languages/cpp/app_templates/cppsdlhello/main.cpp | 29 + .../cpp/app_templates/cppsdlhello/src-Makefile.am | 9 + .../cpp/app_templates/dcopservice/.kdev_ignore | 0 .../cpp/app_templates/dcopservice/Makefile.am | 18 + .../cpp/app_templates/dcopservice/dcopservice | 10 + .../cpp/app_templates/dcopservice/dcopservice.cpp | 49 + .../app_templates/dcopservice/dcopservice.desktop | 43 + .../cpp/app_templates/dcopservice/dcopservice.h | 35 + .../app_templates/dcopservice/dcopservice.kdevelop | 109 + .../dcopservice/dcopservice.kdevtemplate | 202 + .../cpp/app_templates/dcopservice/dcopservice.png | Bin 0 -> 23880 bytes languages/cpp/app_templates/dcopservice/main.cpp | 47 + .../cpp/app_templates/dcopservice/src-Makefile.am | 17 + languages/cpp/app_templates/dcopservice/subdirs | 3 + .../cpp/app_templates/generichello/.kdev_ignore | 0 .../cpp/app_templates/generichello/Makefile.am | 19 + .../cpp/app_templates/generichello/app.kdevelop | 61 + languages/cpp/app_templates/generichello/app.prj | 8 + .../cpp/app_templates/generichello/cpphello.png | Bin 0 -> 10118 bytes .../generichello/generichello.kdevtemplate | 92 + languages/cpp/app_templates/generichello/main.cpp | 17 + .../cpp/app_templates/gnome2mmapp/.kdev_ignore | 0 .../cpp/app_templates/gnome2mmapp/Makefile.am | 21 + languages/cpp/app_templates/gnome2mmapp/acconfig.h | 23 + .../cpp/app_templates/gnome2mmapp/app-Makefile.am | 4 + .../cpp/app_templates/gnome2mmapp/app.kdevelop | 69 + languages/cpp/app_templates/gnome2mmapp/autogen.sh | 40 + languages/cpp/app_templates/gnome2mmapp/config.h | 0 .../cpp/app_templates/gnome2mmapp/configure.in | 57 + .../cpp/app_templates/gnome2mmapp/gnome2mm.cc | 22 + .../cpp/app_templates/gnome2mmapp/gnome2mm.glade | 24 + .../cpp/app_templates/gnome2mmapp/gnome2mm.gladep | 8 + .../cpp/app_templates/gnome2mmapp/gnome2mmapp | 8 + .../gnome2mmapp/gnome2mmapp.kdevtemplate | 186 + .../cpp/app_templates/gnome2mmapp/gnome2mmapp.png | Bin 0 -> 2750 bytes .../cpp/app_templates/gnome2mmapp/main_window.cc | 16 + .../cpp/app_templates/gnome2mmapp/main_window.hh | 19 + .../app_templates/gnome2mmapp/main_window_glade.cc | 30 + .../app_templates/gnome2mmapp/main_window_glade.hh | 49 + .../cpp/app_templates/gnome2mmapp/src-Makefile.am | 14 + languages/cpp/app_templates/gtk2mmapp/.kdev_ignore | 0 languages/cpp/app_templates/gtk2mmapp/Makefile.am | 21 + languages/cpp/app_templates/gtk2mmapp/acconfig.h | 10 + .../cpp/app_templates/gtk2mmapp/app-Makefile.am | 4 + languages/cpp/app_templates/gtk2mmapp/app.kdevelop | 113 + languages/cpp/app_templates/gtk2mmapp/autogen.sh | 33 + languages/cpp/app_templates/gtk2mmapp/config.h | 0 languages/cpp/app_templates/gtk2mmapp/configure.in | 19 + languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc | 15 + languages/cpp/app_templates/gtk2mmapp/gtk2mm.glade | 30 + .../cpp/app_templates/gtk2mmapp/gtk2mm.gladep | 10 + .../app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate | 174 + .../cpp/app_templates/gtk2mmapp/gtk2mmapp.png | Bin 0 -> 2750 bytes .../cpp/app_templates/gtk2mmapp/main_window.cc | 12 + .../cpp/app_templates/gtk2mmapp/main_window.hh | 19 + .../app_templates/gtk2mmapp/main_window_glade.cc | 40 + .../app_templates/gtk2mmapp/main_window_glade.hh | 48 + .../cpp/app_templates/gtk2mmapp/src-Makefile.am | 14 + languages/cpp/app_templates/kapp/.kdev_ignore | 0 languages/cpp/app_templates/kapp/Makefile.am | 19 + languages/cpp/app_templates/kapp/README | 81 + languages/cpp/app_templates/kapp/app.cpp | 247 + languages/cpp/app_templates/kapp/app.desktop | 44 + languages/cpp/app_templates/kapp/app.h | 89 + languages/cpp/app_templates/kapp/app.kdevelop | 168 + languages/cpp/app_templates/kapp/app.kdevses | 13 + languages/cpp/app_templates/kapp/app_client.cpp | 26 + languages/cpp/app_templates/kapp/appiface.h | 17 + languages/cpp/app_templates/kapp/appui.rc | 8 + languages/cpp/app_templates/kapp/appview.cpp | 107 + languages/cpp/app_templates/kapp/appview.h | 77 + languages/cpp/app_templates/kapp/kapp.kdevtemplate | 253 + languages/cpp/app_templates/kapp/kapp.png | Bin 0 -> 6320 bytes languages/cpp/app_templates/kapp/main.cpp | 61 + languages/cpp/app_templates/kapp/pref.cpp | 42 + languages/cpp/app_templates/kapp/pref.h | 37 + languages/cpp/app_templates/kapp/src-Makefile.am | 43 + languages/cpp/app_templates/kapp/subdirs | 3 + .../cpp/app_templates/kateplugin/.kdev_ignore | 0 languages/cpp/app_templates/kateplugin/Makefile.am | 19 + .../kateplugin/hi16-action-plugin.png | Bin 0 -> 292 bytes .../kateplugin/hi22-action-plugin.png | Bin 0 -> 1151 bytes .../kateplugin/kateplugin.kdevtemplate | 213 + .../cpp/app_templates/kateplugin/kateplugin.png | Bin 0 -> 12901 bytes .../cpp/app_templates/kateplugin/plugin.desktop | 76 + .../cpp/app_templates/kateplugin/plugin.kdevelop | 113 + .../cpp/app_templates/kateplugin/plugin_app.cpp | 89 + .../cpp/app_templates/kateplugin/plugin_app.h | 49 + .../cpp/app_templates/kateplugin/plugin_app.rc | 11 + .../cpp/app_templates/kateplugin/src-Makefile.am | 20 + languages/cpp/app_templates/kateplugin/subdirs | 3 + .../cpp/app_templates/kateplugin2/.kdev_ignore | 0 .../cpp/app_templates/kateplugin2/Makefile.am | 19 + .../kateplugin2/hi16-action-plugin.png | Bin 0 -> 292 bytes .../kateplugin2/hi22-action-plugin.png | Bin 0 -> 1151 bytes .../kateplugin2/kateplugin2.kdevtemplate | 214 + .../cpp/app_templates/kateplugin2/kateplugin2.png | Bin 0 -> 12901 bytes .../cpp/app_templates/kateplugin2/plugin.desktop | 76 + .../cpp/app_templates/kateplugin2/plugin.kdevelop | 114 + .../cpp/app_templates/kateplugin2/plugin_app.cpp | 140 + .../cpp/app_templates/kateplugin2/plugin_app.h | 91 + .../cpp/app_templates/kateplugin2/plugin_app.rc | 11 + .../cpp/app_templates/kateplugin2/src-Makefile.am | 21 + languages/cpp/app_templates/kateplugin2/subdirs | 3 + languages/cpp/app_templates/kcmodule/.kdev_ignore | 0 languages/cpp/app_templates/kcmodule/Makefile.am | 17 + .../app_templates/kcmodule/kcmodule.kdevtemplate | 197 + languages/cpp/app_templates/kcmodule/kcmodule.png | Bin 0 -> 16691 bytes languages/cpp/app_templates/kcmodule/module.cpp | 66 + .../cpp/app_templates/kcmodule/module.desktop | 81 + languages/cpp/app_templates/kcmodule/module.h | 32 + .../cpp/app_templates/kcmodule/module.kdevelop | 113 + .../cpp/app_templates/kcmodule/src-Makefile.am | 17 + languages/cpp/app_templates/kcmodule/subdirs | 3 + languages/cpp/app_templates/kconfig35/Makefile.am | 19 + languages/cpp/app_templates/kconfig35/README | 90 + languages/cpp/app_templates/kconfig35/app.cpp | 105 + languages/cpp/app_templates/kconfig35/app.desktop | 40 + languages/cpp/app_templates/kconfig35/app.h | 60 + languages/cpp/app_templates/kconfig35/app.kcfg | 21 + languages/cpp/app_templates/kconfig35/app.kdevelop | 168 + languages/cpp/app_templates/kconfig35/appui.rc | 8 + languages/cpp/app_templates/kconfig35/appview.cpp | 41 + languages/cpp/app_templates/kconfig35/appview.h | 52 + .../cpp/app_templates/kconfig35/appview_base.ui | 33 + .../app_templates/kconfig35/kconfig35.kdevtemplate | 245 + .../cpp/app_templates/kconfig35/kconfig35.png | Bin 0 -> 6975 bytes languages/cpp/app_templates/kconfig35/kxt35.png | Bin 0 -> 6975 bytes languages/cpp/app_templates/kconfig35/main.cpp | 57 + .../cpp/app_templates/kconfig35/prefs-base.ui | 127 + languages/cpp/app_templates/kconfig35/prefs.cpp | 12 + languages/cpp/app_templates/kconfig35/prefs.h | 11 + .../cpp/app_templates/kconfig35/settings.kcfgc | 6 + .../cpp/app_templates/kconfig35/src-Makefile.am | 41 + .../app_templates/kconfig35/src-configure.in.in | 7 + languages/cpp/app_templates/kconfig35/subdirs | 3 + languages/cpp/app_templates/kde4app/CMakeLists.txt | 31 + languages/cpp/app_templates/kde4app/Makefile.am | 19 + languages/cpp/app_templates/kde4app/README | 15 + languages/cpp/app_templates/kde4app/kapp4.cpp | 90 + languages/cpp/app_templates/kde4app/kapp4.desktop | 30 + languages/cpp/app_templates/kde4app/kapp4.h | 53 + languages/cpp/app_templates/kde4app/kapp4.kcfg | 21 + languages/cpp/app_templates/kde4app/kapp4view.cpp | 42 + languages/cpp/app_templates/kde4app/kapp4view.h | 55 + .../cpp/app_templates/kde4app/kapp4view_base.ui | 213 + .../cpp/app_templates/kde4app/kde4app.kdevelop | 205 + .../kde4app/kde4app.kdevelop.filelist | 13 + .../cpp/app_templates/kde4app/kde4app.kdevtemplate | 155 + languages/cpp/app_templates/kde4app/kde4app.png | Bin 0 -> 6320 bytes languages/cpp/app_templates/kde4app/kde4appui.rc | 8 + languages/cpp/app_templates/kde4app/main.cpp | 55 + languages/cpp/app_templates/kde4app/prefs_base.ui | 155 + languages/cpp/app_templates/kde4app/settings.kcfgc | 6 + languages/cpp/app_templates/kdecpp.appwizard | 2 + languages/cpp/app_templates/kdedcop/.kdev_ignore | 0 languages/cpp/app_templates/kdedcop/Makefile.am | 18 + languages/cpp/app_templates/kdedcop/app.cpp | 21 + languages/cpp/app_templates/kdedcop/app.h | 36 + languages/cpp/app_templates/kdedcop/app.kdevelop | 116 + languages/cpp/app_templates/kdedcop/app_iface.h | 19 + .../cpp/app_templates/kdedcop/kdedcop.kdevtemplate | 227 + languages/cpp/app_templates/kdedcop/kdedcop.png | Bin 0 -> 2127 bytes languages/cpp/app_templates/kdedcop/main.cpp | 52 + languages/cpp/app_templates/kdedcop/mainclass.cpp | 31 + languages/cpp/app_templates/kdedcop/mainclass.h | 32 + .../cpp/app_templates/kdedcop/src-Makefile.am | 23 + languages/cpp/app_templates/kdedcop/subdirs | 3 + languages/cpp/app_templates/kdevlang/.kdev_ignore | 0 languages/cpp/app_templates/kdevlang/Makefile.am | 17 + languages/cpp/app_templates/kdevlang/README.dox | 55 + languages/cpp/app_templates/kdevlang/app.kdevelop | 115 + .../kdevlang/kdevlang-configure.in.in | 10 + .../cpp/app_templates/kdevlang/kdevlang.desktop | 14 + .../app_templates/kdevlang/kdevlang.kdevtemplate | 157 + languages/cpp/app_templates/kdevlang/kdevlang.png | Bin 0 -> 483 bytes languages/cpp/app_templates/kdevlang/kdevlang.rc | 11 + .../cpp/app_templates/kdevlang/kdevlang_part.cpp | 154 + .../cpp/app_templates/kdevlang/kdevlang_part.h | 43 + .../cpp/app_templates/kdevlang/src-Makefile.am | 14 + languages/cpp/app_templates/kdevpart/.kdev_ignore | 0 languages/cpp/app_templates/kdevpart/Makefile.am | 19 + languages/cpp/app_templates/kdevpart/README.dox | 55 + languages/cpp/app_templates/kdevpart/app.kdevelop | 116 + .../cpp/app_templates/kdevpart/globalconfig.cpp | 15 + .../cpp/app_templates/kdevpart/globalconfig.h | 22 + .../cpp/app_templates/kdevpart/globalconfigbase.ui | 20 + .../cpp/app_templates/kdevpart/kdevpart.desktop | 83 + .../app_templates/kdevpart/kdevpart.kdevtemplate | 242 + languages/cpp/app_templates/kdevpart/kdevpart.png | Bin 0 -> 483 bytes .../cpp/app_templates/kdevpart/kdevpart_part.cpp | 183 + .../cpp/app_templates/kdevpart/kdevpart_part.h | 45 + .../cpp/app_templates/kdevpart/kdevpart_part.rc | 11 + .../cpp/app_templates/kdevpart/kdevpart_widget.cpp | 21 + .../cpp/app_templates/kdevpart/kdevpart_widget.h | 23 + .../cpp/app_templates/kdevpart/projectconfig.cpp | 15 + .../cpp/app_templates/kdevpart/projectconfig.h | 22 + .../app_templates/kdevpart/projectconfigbase.ui | 20 + .../cpp/app_templates/kdevpart/src-Makefile.am | 20 + languages/cpp/app_templates/kdevpart2/.kdev_ignore | 0 languages/cpp/app_templates/kdevpart2/Makefile.am | 21 + languages/cpp/app_templates/kdevpart2/README.dox | 55 + languages/cpp/app_templates/kdevpart2/app.kdevelop | 148 + .../cpp/app_templates/kdevpart2/globalconfig.cpp | 15 + .../cpp/app_templates/kdevpart2/globalconfig.h | 22 + .../app_templates/kdevpart2/globalconfigbase.ui | 20 + .../kdevpart2/kdevpart-configure.in.in | 10 + .../cpp/app_templates/kdevpart2/kdevpart.desktop | 83 + .../app_templates/kdevpart2/kdevpart2.kdevtemplate | 276 + .../cpp/app_templates/kdevpart2/kdevpart2.png | Bin 0 -> 483 bytes .../cpp/app_templates/kdevpart2/kdevpart_part.cpp | 183 + .../cpp/app_templates/kdevpart2/kdevpart_part.h | 45 + .../cpp/app_templates/kdevpart2/kdevpart_part.rc | 11 + .../app_templates/kdevpart2/kdevpart_widget.cpp | 21 + .../cpp/app_templates/kdevpart2/kdevpart_widget.h | 23 + .../cpp/app_templates/kdevpart2/projectconfig.cpp | 15 + .../cpp/app_templates/kdevpart2/projectconfig.h | 22 + .../app_templates/kdevpart2/projectconfigbase.ui | 20 + .../cpp/app_templates/kdevpart2/src-Makefile.am | 17 + languages/cpp/app_templates/kdevpart2/subdirs | 3 + .../cpp/app_templates/kfileplugin/.kdev_ignore | 0 .../cpp/app_templates/kfileplugin/Makefile.am | 18 + .../cpp/app_templates/kfileplugin/README.devel | 9 + .../cpp/app_templates/kfileplugin/kfile_plugin.cpp | 55 + .../app_templates/kfileplugin/kfile_plugin.desktop | 39 + .../cpp/app_templates/kfileplugin/kfile_plugin.h | 24 + .../cpp/app_templates/kfileplugin/kfileplugin | 8 + .../kfileplugin/kfileplugin.kdevtemplate | 166 + .../cpp/app_templates/kfileplugin/kfileplugin.png | Bin 0 -> 11953 bytes .../cpp/app_templates/kfileplugin/plugin.kdevelop | 114 + .../cpp/app_templates/kfileplugin/src-Makefile.am | 22 + languages/cpp/app_templates/kfileplugin/subdirs | 3 + languages/cpp/app_templates/khello/.kdev_ignore | 0 languages/cpp/app_templates/khello/Makefile.am | 18 + languages/cpp/app_templates/khello/app.cpp | 23 + languages/cpp/app_templates/khello/app.desktop | 40 + languages/cpp/app_templates/khello/app.h | 32 + languages/cpp/app_templates/khello/app.kdevelop | 115 + languages/cpp/app_templates/khello/appui.rc | 8 + .../cpp/app_templates/khello/khello.kdevtemplate | 220 + languages/cpp/app_templates/khello/khello.png | Bin 0 -> 3573 bytes languages/cpp/app_templates/khello/main.cpp | 51 + languages/cpp/app_templates/khello/src-Makefile.am | 35 + languages/cpp/app_templates/khello/subdirs | 3 + languages/cpp/app_templates/khello2/.kdev_ignore | 0 languages/cpp/app_templates/khello2/Makefile.am | 18 + languages/cpp/app_templates/khello2/app.cpp | 19 + languages/cpp/app_templates/khello2/app.desktop | 40 + languages/cpp/app_templates/khello2/app.h | 32 + languages/cpp/app_templates/khello2/app.kdevelop | 115 + languages/cpp/app_templates/khello2/appui.rc | 8 + .../cpp/app_templates/khello2/khello2.kdevtemplate | 230 + languages/cpp/app_templates/khello2/khello2.png | Bin 0 -> 3155 bytes languages/cpp/app_templates/khello2/main.cpp | 51 + .../cpp/app_templates/khello2/src-Makefile.am | 35 + languages/cpp/app_templates/khello2/subdirs | 3 + languages/cpp/app_templates/khello2/widget.cpp | 30 + languages/cpp/app_templates/khello2/widget.h | 30 + languages/cpp/app_templates/khello2/widgetbase.ui | 52 + languages/cpp/app_templates/kicker/.kdev_ignore | 0 languages/cpp/app_templates/kicker/Makefile.am | 17 + languages/cpp/app_templates/kicker/applet.cpp | 72 + languages/cpp/app_templates/kicker/applet.desktop | 40 + languages/cpp/app_templates/kicker/applet.h | 107 + languages/cpp/app_templates/kicker/applet.kdevelop | 115 + .../cpp/app_templates/kicker/kicker.kdevtemplate | 194 + languages/cpp/app_templates/kicker/kicker.png | Bin 0 -> 8356 bytes languages/cpp/app_templates/kicker/src-Makefile.am | 15 + languages/cpp/app_templates/kicker/subdirs | 3 + languages/cpp/app_templates/kioslave/.kdev_ignore | 0 languages/cpp/app_templates/kioslave/Makefile.am | 17 + .../app_templates/kioslave/kioslave.kdevtemplate | 183 + languages/cpp/app_templates/kioslave/kioslave.png | Bin 0 -> 9524 bytes languages/cpp/app_templates/kioslave/slave.cpp | 88 + languages/cpp/app_templates/kioslave/slave.h | 23 + .../cpp/app_templates/kioslave/slave.kdevelop | 113 + .../cpp/app_templates/kioslave/slave.protocol | 39 + .../cpp/app_templates/kioslave/src-Makefile.am | 14 + languages/cpp/app_templates/kioslave/subdirs | 3 + languages/cpp/app_templates/kmake/Makefile.am | 16 + languages/cpp/app_templates/kmake/app.cpp | 33 + languages/cpp/app_templates/kmake/app.desktop | 44 + languages/cpp/app_templates/kmake/app.kdevelop | 111 + languages/cpp/app_templates/kmake/app.pro | 7 + languages/cpp/app_templates/kmake/appui.rc | 3 + .../cpp/app_templates/kmake/kmake.kdevtemplate | 148 + languages/cpp/app_templates/kmake/kmake.png | Bin 0 -> 5063 bytes languages/cpp/app_templates/kmake/mainview.ui | 76 + languages/cpp/app_templates/kmake/mainviewimp.cpp | 23 + languages/cpp/app_templates/kmake/mainviewimp.h | 19 + languages/cpp/app_templates/kmake/src.pro | 29 + languages/cpp/app_templates/kmod/.kdev_ignore | 0 languages/cpp/app_templates/kmod/Makefile.am | 17 + languages/cpp/app_templates/kmod/kmod-driver.c | 22 + languages/cpp/app_templates/kmod/kmod.kdevelop | 93 + languages/cpp/app_templates/kmod/kmod.kdevtemplate | 89 + languages/cpp/app_templates/kmod/kmod.png | Bin 0 -> 483 bytes languages/cpp/app_templates/kmod/src-Makefile | 30 + .../cpp/app_templates/kofficepart/.kdev_ignore | 0 .../cpp/app_templates/kofficepart/Makefile.am | 21 + .../app_templates/kofficepart/kde-configure.in.in | 42 + .../cpp/app_templates/kofficepart/kopart.desktop | 9 + .../cpp/app_templates/kofficepart/kopart.kdevelop | 113 + .../app_templates/kofficepart/kopart.kdevtemplate | 231 + languages/cpp/app_templates/kofficepart/kopart.png | Bin 0 -> 10017 bytes languages/cpp/app_templates/kofficepart/kopart.rc | 10 + .../app_templates/kofficepart/kopart_aboutdata.h | 24 + .../app_templates/kofficepart/kopart_factory.cpp | 76 + .../cpp/app_templates/kofficepart/kopart_factory.h | 33 + .../cpp/app_templates/kofficepart/kopart_part.cpp | 69 + .../cpp/app_templates/kofficepart/kopart_part.h | 30 + .../cpp/app_templates/kofficepart/kopart_view.cpp | 52 + .../cpp/app_templates/kofficepart/kopart_view.h | 34 + languages/cpp/app_templates/kofficepart/main.cpp | 33 + .../cpp/app_templates/kofficepart/src-Makefile.am | 41 + languages/cpp/app_templates/kofficepart/subdirs | 3 + .../cpp/app_templates/kofficepart/x-kopart.desktop | 40 + .../cpp/app_templates/konqnavpanel/.kdev_ignore | 0 .../cpp/app_templates/konqnavpanel/Makefile.am | 18 + .../app_templates/konqnavpanel/konqnavpanel.cpp | 34 + .../konqnavpanel/konqnavpanel.desktop | 39 + .../cpp/app_templates/konqnavpanel/konqnavpanel.h | 43 + .../konqnavpanel/konqnavpanel.kdevelop | 115 + .../konqnavpanel/konqnavpanel.kdevtemplate | 192 + .../app_templates/konqnavpanel/konqnavpanel.png | Bin 0 -> 19783 bytes .../cpp/app_templates/konqnavpanel/src-Makefile.am | 11 + languages/cpp/app_templates/konqnavpanel/subdirs | 3 + languages/cpp/app_templates/kpartapp/.kdev_ignore | 0 languages/cpp/app_templates/kpartapp/Makefile.am | 17 + languages/cpp/app_templates/kpartapp/app.cpp | 209 + languages/cpp/app_templates/kpartapp/app.desktop | 18 + languages/cpp/app_templates/kpartapp/app.h | 76 + languages/cpp/app_templates/kpartapp/app.kdevelop | 115 + languages/cpp/app_templates/kpartapp/app_part.cpp | 201 + languages/cpp/app_templates/kpartapp/app_part.h | 86 + languages/cpp/app_templates/kpartapp/app_part.rc | 17 + languages/cpp/app_templates/kpartapp/app_shell.rc | 28 + .../app_templates/kpartapp/kpartapp.kdevtemplate | 237 + languages/cpp/app_templates/kpartapp/kpartapp.png | Bin 0 -> 5041 bytes languages/cpp/app_templates/kpartapp/main.cpp | 57 + .../cpp/app_templates/kpartapp/src-Makefile.am | 53 + languages/cpp/app_templates/kpartapp/subdirs | 3 + .../cpp/app_templates/kpartplugin/.kdev_ignore | 0 .../cpp/app_templates/kpartplugin/Makefile.am | 19 + .../kpartplugin/hi16-action-plugin.png | Bin 0 -> 292 bytes .../kpartplugin/hi22-action-plugin.png | Bin 0 -> 1151 bytes .../kpartplugin/kpartplugin.kdevtemplate | 204 + .../cpp/app_templates/kpartplugin/kpartplugin.png | Bin 0 -> 16772 bytes .../cpp/app_templates/kpartplugin/plugin.kdevelop | 114 + .../cpp/app_templates/kpartplugin/plugin_app.cpp | 109 + .../cpp/app_templates/kpartplugin/plugin_app.h | 34 + .../cpp/app_templates/kpartplugin/plugin_app.rc | 11 + .../cpp/app_templates/kpartplugin/src-Makefile.am | 22 + languages/cpp/app_templates/kpartplugin/subdirs | 3 + languages/cpp/app_templates/kscons_kmdi/INSTALL | 83 + .../cpp/app_templates/kscons_kmdi/Makefile.am | 21 + languages/cpp/app_templates/kscons_kmdi/QUICKSTART | 164 + languages/cpp/app_templates/kscons_kmdi/README | 111 + .../cpp/app_templates/kscons_kmdi/SConscript-doc | 92 + .../cpp/app_templates/kscons_kmdi/SConscript-src | 60 + languages/cpp/app_templates/kscons_kmdi/SConstruct | 112 + languages/cpp/app_templates/kscons_kmdi/VERSION | 1 + languages/cpp/app_templates/kscons_kmdi/app.kcfg | 12 + .../cpp/app_templates/kscons_kmdi/app.kdevelop | 169 + .../cpp/app_templates/kscons_kmdi/app_part.cpp | 159 + languages/cpp/app_templates/kscons_kmdi/app_part.h | 74 + .../cpp/app_templates/kscons_kmdi/app_part.rc | 17 + .../cpp/app_templates/kscons_kmdi/app_shell.rc | 33 + .../cpp/app_templates/kscons_kmdi/appkmdi.cpp | 394 + languages/cpp/app_templates/kscons_kmdi/appkmdi.h | 82 + .../cpp/app_templates/kscons_kmdi/appkmdiView.cpp | 63 + .../cpp/app_templates/kscons_kmdi/appkmdiView.h | 29 + .../cpp/app_templates/kscons_kmdi/kmdikonsole.cpp | 76 + .../cpp/app_templates/kscons_kmdi/kmdikonsole.h | 32 + .../kscons_kmdi/kscons_kmdi.kdevtemplate | 271 + .../cpp/app_templates/kscons_kmdi/kscons_kmdi.png | Bin 0 -> 13151 bytes languages/cpp/app_templates/kscons_kmdi/main.cpp | 60 + .../cpp/app_templates/kscons_kmdi/messages.sh | 60 + languages/cpp/app_templates/kscons_kmdi/prefs.ui | 30 + .../cpp/app_templates/kscons_kmdi/settings.kcfgc | 6 + languages/cpp/app_templates/kscons_kmdi/tips | 6 + languages/cpp/app_templates/kscons_kxt/INSTALL | 83 + languages/cpp/app_templates/kscons_kxt/Makefile.am | 21 + languages/cpp/app_templates/kscons_kxt/QUICKSTART | 164 + languages/cpp/app_templates/kscons_kxt/README | 111 + .../cpp/app_templates/kscons_kxt/SConscript-doc | 92 + .../cpp/app_templates/kscons_kxt/SConscript-src | 72 + languages/cpp/app_templates/kscons_kxt/SConstruct | 112 + languages/cpp/app_templates/kscons_kxt/VERSION | 1 + languages/cpp/app_templates/kscons_kxt/app.cpp | 177 + languages/cpp/app_templates/kscons_kxt/app.h | 73 + languages/cpp/app_templates/kscons_kxt/app.kcfg | 21 + .../cpp/app_templates/kscons_kxt/app.kdevelop | 169 + languages/cpp/app_templates/kscons_kxt/appui.rc | 8 + languages/cpp/app_templates/kscons_kxt/appview.cpp | 41 + languages/cpp/app_templates/kscons_kxt/appview.h | 52 + .../cpp/app_templates/kscons_kxt/appview_base.ui | 35 + .../kscons_kxt/kscons_kxt.kdevtemplate | 253 + .../cpp/app_templates/kscons_kxt/kscons_kxt.png | Bin 0 -> 13698 bytes languages/cpp/app_templates/kscons_kxt/main.cpp | 57 + languages/cpp/app_templates/kscons_kxt/messages.sh | 60 + .../cpp/app_templates/kscons_kxt/prefs-base.ui | 129 + languages/cpp/app_templates/kscons_kxt/prefs.cpp | 12 + languages/cpp/app_templates/kscons_kxt/prefs.h | 11 + .../cpp/app_templates/kscons_kxt/settings.kcfgc | 6 + languages/cpp/app_templates/kscons_kxt/tips | 6 + .../cpp/app_templates/kscreensaver/.kdev_ignore | 0 .../cpp/app_templates/kscreensaver/Makefile.am | 19 + .../app_templates/kscreensaver/kscreensaver.cpp | 107 + .../kscreensaver/kscreensaver.desktop | 124 + .../cpp/app_templates/kscreensaver/kscreensaver.h | 35 + .../kscreensaver/kscreensaver.kdevelop | 113 + .../kscreensaver/kscreensaver.kdevtemplate | 203 + .../app_templates/kscreensaver/kscreensaver.png | Bin 0 -> 12032 bytes .../app_templates/kscreensaver/kscreensaverui.ui | 79 + .../cpp/app_templates/kscreensaver/src-Makefile.am | 24 + languages/cpp/app_templates/kscreensaver/subdirs | 3 + languages/cpp/app_templates/kxt/.kdev_ignore | 0 languages/cpp/app_templates/kxt/Makefile.am | 19 + languages/cpp/app_templates/kxt/README | 86 + languages/cpp/app_templates/kxt/app.cpp | 154 + languages/cpp/app_templates/kxt/app.desktop | 40 + languages/cpp/app_templates/kxt/app.h | 66 + languages/cpp/app_templates/kxt/app.kcfg | 21 + languages/cpp/app_templates/kxt/app.kdevelop | 169 + languages/cpp/app_templates/kxt/appui.rc | 8 + languages/cpp/app_templates/kxt/appview.cpp | 41 + languages/cpp/app_templates/kxt/appview.h | 52 + languages/cpp/app_templates/kxt/appview_base.ui | 33 + languages/cpp/app_templates/kxt/kxt.kdevtemplate | 269 + languages/cpp/app_templates/kxt/kxt.png | Bin 0 -> 3947 bytes languages/cpp/app_templates/kxt/main.cpp | 57 + languages/cpp/app_templates/kxt/prefs-base.ui | 127 + languages/cpp/app_templates/kxt/prefs.cpp | 12 + languages/cpp/app_templates/kxt/prefs.h | 11 + languages/cpp/app_templates/kxt/preview.png | Bin 0 -> 7712 bytes languages/cpp/app_templates/kxt/settings.kcfgc | 6 + languages/cpp/app_templates/kxt/src-Makefile.am | 41 + .../cpp/app_templates/kxt/src-configure.in.in | 7 + languages/cpp/app_templates/kxt/subdirs | 3 + .../cpp/app_templates/makefileempty/Makefile.am | 17 + .../cpp/app_templates/makefileempty/app.kdevelop | 101 + .../makefileempty/makefileempty-Makefile | 0 .../makefileempty/makefileempty.kdevtemplate | 85 + .../app_templates/makefileempty/makefileempty.png | Bin 0 -> 8621 bytes languages/cpp/app_templates/noatunui/.kdev_ignore | 0 languages/cpp/app_templates/noatunui/Makefile.am | 17 + languages/cpp/app_templates/noatunui/noatunui | 8 + .../app_templates/noatunui/noatunui.kdevtemplate | 195 + languages/cpp/app_templates/noatunui/noatunui.png | Bin 0 -> 5433 bytes .../cpp/app_templates/noatunui/plugin.kdevelop | 111 + languages/cpp/app_templates/noatunui/plugin.plugin | 8 + .../cpp/app_templates/noatunui/plugin_app.cpp | 15 + .../cpp/app_templates/noatunui/plugin_impl.cpp | 301 + languages/cpp/app_templates/noatunui/plugin_impl.h | 78 + .../cpp/app_templates/noatunui/src-Makefile.am | 24 + languages/cpp/app_templates/noatunui/subdirs | 3 + .../cpp/app_templates/noatunvisual/.kdev_ignore | 0 .../cpp/app_templates/noatunvisual/Makefile.am | 18 + .../cpp/app_templates/noatunvisual/noatunvisual | 8 + .../noatunvisual/noatunvisual-configure.in.in | 36 + .../noatunvisual/noatunvisual.kdevtemplate | 205 + .../app_templates/noatunvisual/noatunvisual.png | Bin 0 -> 68585 bytes .../cpp/app_templates/noatunvisual/plugin.kdevelop | 118 + .../cpp/app_templates/noatunvisual/plugin.plugin | 8 + .../cpp/app_templates/noatunvisual/plugin_app.cpp | 58 + .../cpp/app_templates/noatunvisual/plugin_app.h | 36 + .../cpp/app_templates/noatunvisual/plugin_impl.cpp | 276 + .../cpp/app_templates/noatunvisual/plugin_impl.h | 77 + .../cpp/app_templates/noatunvisual/src-Makefile.am | 19 + languages/cpp/app_templates/noatunvisual/subdirs | 3 + languages/cpp/app_templates/opieapp/.kdev_ignore | 0 languages/cpp/app_templates/opieapp/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opieapp/Makefile.am | 18 + languages/cpp/app_templates/opieapp/app.kdevelop | 143 + languages/cpp/app_templates/opieapp/app.pro | 38 + languages/cpp/app_templates/opieapp/example.cpp | 32 + .../cpp/app_templates/opieapp/example.desktop | 37 + languages/cpp/app_templates/opieapp/example.h | 20 + languages/cpp/app_templates/opieapp/examplebase.ui | 49 + .../cpp/app_templates/opieapp/opieapp.kdevtemplate | 149 + languages/cpp/app_templates/opieapp/opieapp.png | Bin 0 -> 483 bytes .../cpp/app_templates/opieapplet/.kdev_ignore | 0 languages/cpp/app_templates/opieapplet/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opieapplet/Makefile.am | 18 + .../cpp/app_templates/opieapplet/app.kdevelop | 158 + languages/cpp/app_templates/opieapplet/app.pro | 38 + .../opieapplet/opieapplet.kdevtemplate | 135 + .../cpp/app_templates/opieapplet/opieapplet.png | Bin 0 -> 483 bytes .../cpp/app_templates/opieapplet/simpleimpl.cpp | 162 + .../cpp/app_templates/opieapplet/simpleimpl.h | 75 + languages/cpp/app_templates/opieinput/.kdev_ignore | 0 languages/cpp/app_templates/opieinput/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opieinput/Makefile.am | 17 + languages/cpp/app_templates/opieinput/app.kdevelop | 159 + languages/cpp/app_templates/opieinput/app.pro | 38 + .../app_templates/opieinput/opieinput.kdevtemplate | 129 + .../cpp/app_templates/opieinput/opieinput.png | Bin 0 -> 483 bytes .../cpp/app_templates/opieinput/simpleimpl.cpp | 157 + languages/cpp/app_templates/opieinput/simpleimpl.h | 50 + languages/cpp/app_templates/opiemenu/.kdev_ignore | 0 languages/cpp/app_templates/opiemenu/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opiemenu/Makefile.am | 18 + languages/cpp/app_templates/opiemenu/app.kdevelop | 158 + languages/cpp/app_templates/opiemenu/app.pro | 38 + .../app_templates/opiemenu/opiemenu.kdevtemplate | 132 + languages/cpp/app_templates/opiemenu/opiemenu.png | Bin 0 -> 483 bytes .../cpp/app_templates/opiemenu/simpleimpl.cpp | 78 + languages/cpp/app_templates/opiemenu/simpleimpl.h | 32 + languages/cpp/app_templates/opienet/.kdev_ignore | 0 languages/cpp/app_templates/opienet/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opienet/Makefile.am | 19 + languages/cpp/app_templates/opienet/app.kdevelop | 143 + languages/cpp/app_templates/opienet/app.pro | 39 + .../cpp/app_templates/opienet/opienet.kdevtemplate | 142 + languages/cpp/app_templates/opienet/opienet.png | Bin 0 -> 483 bytes .../cpp/app_templates/opienet/simmplemodule.h | 36 + .../cpp/app_templates/opienet/simpleiface.cpp | 43 + languages/cpp/app_templates/opienet/simpleiface.h | 22 + .../cpp/app_templates/opienet/simplemodule.cpp | 71 + languages/cpp/app_templates/opienet/simplemodule.h | 36 + languages/cpp/app_templates/opietoday/.kdev_ignore | 0 languages/cpp/app_templates/opietoday/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opietoday/Makefile.am | 19 + languages/cpp/app_templates/opietoday/app.kdevelop | 143 + languages/cpp/app_templates/opietoday/app.pro | 38 + .../cpp/app_templates/opietoday/exampleplugin.cpp | 60 + .../cpp/app_templates/opietoday/exampleplugin.h | 34 + .../app_templates/opietoday/examplepluginimpl.cpp | 30 + .../app_templates/opietoday/examplepluginimpl.h | 23 + .../opietoday/examplepluginwidget.cpp | 55 + .../app_templates/opietoday/examplepluginwidget.h | 28 + .../app_templates/opietoday/opietoday.kdevtemplate | 151 + .../cpp/app_templates/opietoday/opietoday.png | Bin 0 -> 483 bytes languages/cpp/app_templates/prc-tool/.kdev_ignore | 0 languages/cpp/app_templates/prc-tool/Makefile.am | 17 + languages/cpp/app_templates/prc-tool/callback.h | 24 + languages/cpp/app_templates/prc-tool/palmhello.c | 117 + .../cpp/app_templates/prc-tool/palmhello.pbitm | 32 + languages/cpp/app_templates/prc-tool/palmhello.rcp | 11 + .../cpp/app_templates/prc-tool/palmhelloRsc.h | 1 + languages/cpp/app_templates/prc-tool/prc-tool | 11 + .../cpp/app_templates/prc-tool/prc-tool.kdevelop | 51 + .../app_templates/prc-tool/prc-tool.kdevtemplate | 136 + languages/cpp/app_templates/prc-tool/src-Makefile | 63 + languages/cpp/app_templates/qmakeapp/.kdev_ignore | 0 languages/cpp/app_templates/qmakeapp/Makefile.am | 18 + languages/cpp/app_templates/qmakeapp/fileopen.xpm | 22 + languages/cpp/app_templates/qmakeapp/fileprint.xpm | 24 + languages/cpp/app_templates/qmakeapp/filesave.xpm | 22 + languages/cpp/app_templates/qmakeapp/main.cpp | 13 + languages/cpp/app_templates/qmakeapp/qmakeapp | 11 + languages/cpp/app_templates/qmakeapp/qmakeapp.cpp | 283 + languages/cpp/app_templates/qmakeapp/qmakeapp.h | 39 + .../cpp/app_templates/qmakeapp/qmakeapp.kdevelop | 112 + .../app_templates/qmakeapp/qmakeapp.kdevtemplate | 182 + languages/cpp/app_templates/qmakeapp/qmakeapp.png | Bin 0 -> 5034 bytes languages/cpp/app_templates/qmakeapp/qmakeapp.pro | 6 + languages/cpp/app_templates/qmakeapp/src.pro | 10 + languages/cpp/app_templates/qmakeempty/Makefile.am | 18 + .../app_templates/qmakeempty/qmakeempty.kdevelop | 113 + .../qmakeempty/qmakeempty.kdevtemplate | 131 + .../cpp/app_templates/qmakeempty/qmakeempty.png | Bin 0 -> 26767 bytes .../cpp/app_templates/qmakeempty/qmakeempty.pro | 0 .../cpp/app_templates/qmakesimple/.kdev_ignore | 0 .../cpp/app_templates/qmakesimple/Makefile.am | 16 + .../cpp/app_templates/qmakesimple/app.kdevelop | 100 + languages/cpp/app_templates/qmakesimple/app.pro | 2 + languages/cpp/app_templates/qmakesimple/main.cpp | 15 + .../cpp/app_templates/qmakesimple/qmakesimple | 11 + .../qmakesimple/qmakesimple.kdevtemplate | 158 + .../cpp/app_templates/qmakesimple/qmakesimple.png | Bin 0 -> 12036 bytes languages/cpp/app_templates/qmakesimple/src.pro | 4 + languages/cpp/app_templates/qt4hello/Makefile.am | 18 + languages/cpp/app_templates/qt4hello/ReadMe | 11 + languages/cpp/app_templates/qt4hello/main.cpp | 11 + .../cpp/app_templates/qt4hello/qt4hello.kdevelop | 113 + .../app_templates/qt4hello/qt4hello.kdevtemplate | 160 + languages/cpp/app_templates/qt4hello/qt4hello.png | Bin 0 -> 26767 bytes languages/cpp/app_templates/qt4hello/qt4hello.pro | 5 + languages/cpp/app_templates/qt4hello/src.pro | 8 + languages/cpp/app_templates/qt4makeapp/Makefile.am | 19 + languages/cpp/app_templates/qt4makeapp/ReadMe | 11 + .../cpp/app_templates/qt4makeapp/application.qrc | 10 + .../cpp/app_templates/qt4makeapp/editcopy.xpm | 193 + languages/cpp/app_templates/qt4makeapp/editcut.xpm | 252 + .../cpp/app_templates/qt4makeapp/editpaste.xpm | 295 + languages/cpp/app_templates/qt4makeapp/filenew.xpm | 216 + .../cpp/app_templates/qt4makeapp/fileopen.xpm | 295 + .../cpp/app_templates/qt4makeapp/filesave.xpm | 295 + languages/cpp/app_templates/qt4makeapp/main.cpp | 14 + languages/cpp/app_templates/qt4makeapp/qt4makeapp | 11 + .../cpp/app_templates/qt4makeapp/qt4makeapp.cpp | 285 + .../cpp/app_templates/qt4makeapp/qt4makeapp.h | 65 + .../app_templates/qt4makeapp/qt4makeapp.kdevelop | 113 + .../qt4makeapp/qt4makeapp.kdevtemplate | 207 + .../cpp/app_templates/qt4makeapp/qt4makeapp.png | Bin 0 -> 16908 bytes .../cpp/app_templates/qt4makeapp/qt4makeapp.pro | 5 + languages/cpp/app_templates/qt4makeapp/src.pro | 10 + languages/cpp/app_templates/qtopia4app/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/qtopia4app/Makefile.am | 19 + .../cpp/app_templates/qtopia4app/app.kdevelop | 163 + languages/cpp/app_templates/qtopia4app/app.pro | 31 + languages/cpp/app_templates/qtopia4app/example.cpp | 40 + .../cpp/app_templates/qtopia4app/example.desktop | 37 + languages/cpp/app_templates/qtopia4app/example.h | 24 + .../cpp/app_templates/qtopia4app/example.html | 15 + .../cpp/app_templates/qtopia4app/examplebase.ui | 44 + languages/cpp/app_templates/qtopia4app/main.cpp | 7 + .../qtopia4app/qtopia4app.kdevtemplate | 193 + .../cpp/app_templates/qtopia4app/qtopia4app.png | Bin 0 -> 483 bytes languages/cpp/app_templates/qtopiaapp/.kdev_ignore | 0 languages/cpp/app_templates/qtopiaapp/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/qtopiaapp/Makefile.am | 19 + languages/cpp/app_templates/qtopiaapp/app.kdevelop | 131 + languages/cpp/app_templates/qtopiaapp/app.pro | 10 + .../cpp/app_templates/qtopiaapp/example.control | 11 + languages/cpp/app_templates/qtopiaapp/example.cpp | 29 + .../cpp/app_templates/qtopiaapp/example.desktop | 37 + languages/cpp/app_templates/qtopiaapp/example.h | 18 + languages/cpp/app_templates/qtopiaapp/example.html | 15 + .../cpp/app_templates/qtopiaapp/examplebase.ui | 49 + languages/cpp/app_templates/qtopiaapp/main.cpp | 13 + languages/cpp/app_templates/qtopiaapp/qtopiaapp | 11 + .../app_templates/qtopiaapp/qtopiaapp.kdevtemplate | 153 + .../cpp/app_templates/qtopiaapp/qtopiaapp.png | Bin 0 -> 483 bytes languages/cpp/app_templates/win32gui/.kdev_ignore | 0 languages/cpp/app_templates/win32gui/Makefile.am | 18 + languages/cpp/app_templates/win32gui/app.cpp | 12 + languages/cpp/app_templates/win32gui/app.kdevelop | 192 + .../cpp/app_templates/win32gui/src-Makefile.am | 8 + .../app_templates/win32gui/win32gui-Makefile.am | 5 + .../app_templates/win32gui/win32gui-Makefile.cvs | 8 + .../app_templates/win32gui/win32gui-configure.in | 10 + .../app_templates/win32gui/win32gui.kdevtemplate | 137 + languages/cpp/app_templates/win32gui/win32gui.png | Bin 0 -> 10082 bytes .../cpp/app_templates/win32hello/.kdev_ignore | 0 languages/cpp/app_templates/win32hello/Makefile.am | 18 + languages/cpp/app_templates/win32hello/app.cpp | 16 + .../cpp/app_templates/win32hello/app.kdevelop | 164 + .../cpp/app_templates/win32hello/src-Makefile.am | 8 + .../cpp/app_templates/win32hello/win32-Makefile.am | 5 + .../app_templates/win32hello/win32-Makefile.cvs | 8 + .../app_templates/win32hello/win32-configure.in | 10 + .../win32hello/win32hello.kdevtemplate | 136 + .../cpp/app_templates/win32hello/win32hello.png | Bin 0 -> 4991 bytes languages/cpp/app_templates/wxhello/.kdev_ignore | 0 languages/cpp/app_templates/wxhello/Makefile.am | 18 + languages/cpp/app_templates/wxhello/app.cpp | 52 + languages/cpp/app_templates/wxhello/app.desktop | 39 + languages/cpp/app_templates/wxhello/app.h | 36 + languages/cpp/app_templates/wxhello/app.kdevelop | 114 + .../cpp/app_templates/wxhello/src-Makefile.am | 14 + languages/cpp/app_templates/wxhello/subdirs | 1 + languages/cpp/app_templates/wxhello/wxhello | 105 + .../cpp/app_templates/wxhello/wxhello.kdevtemplate | 192 + languages/cpp/app_templates/wxhello/wxhello.png | Bin 0 -> 3894 bytes languages/cpp/ast_utils.cpp | 190 + languages/cpp/ast_utils.h | 34 + languages/cpp/backgroundparser.cpp | 552 + languages/cpp/backgroundparser.h | 122 + languages/cpp/bithelpers.h | 37 + languages/cpp/ccconfigwidget.cpp | 590 + languages/cpp/ccconfigwidget.h | 74 + languages/cpp/ccconfigwidgetbase.ui | 1798 +++ languages/cpp/classgeneratorconfig.cpp | 236 + languages/cpp/classgeneratorconfig.h | 81 + languages/cpp/classgeneratorconfigbase.ui | 261 + languages/cpp/codecompletionentry.h | 57 + languages/cpp/codeinformationrepository.cpp | 339 + languages/cpp/codeinformationrepository.h | 58 + languages/cpp/compiler/Makefile.am | 6 + languages/cpp/compiler/gccoptions/Makefile.am | 20 + .../cpp/compiler/gccoptions/gccoptionsplugin.cpp | 705 ++ .../cpp/compiler/gccoptions/gccoptionsplugin.h | 63 + .../cpp/compiler/gccoptions/kdevg77options.desktop | 56 + .../cpp/compiler/gccoptions/kdevgccoptions.desktop | 54 + .../cpp/compiler/gccoptions/kdevgppoptions.desktop | 56 + languages/cpp/completiondebug.cpp | 56 + languages/cpp/completiondebug.h | 221 + languages/cpp/computerecoverypoints.h | 190 + languages/cpp/configproblemreporter.ui | 189 + languages/cpp/configproblemreporter.ui.h | 98 + languages/cpp/configuration | 2 + languages/cpp/cpp_tags.h | 432 + languages/cpp/cppcodecompletion.cpp | 4492 +++++++ languages/cpp/cppcodecompletion.h | 324 + languages/cpp/cppcodecompletionconfig.cpp | 151 + languages/cpp/cppcodecompletionconfig.h | 310 + languages/cpp/cppevaluation.cpp | 483 + languages/cpp/cppevaluation.h | 367 + languages/cpp/cppimplementationwidget.cpp | 100 + languages/cpp/cppimplementationwidget.h | 43 + languages/cpp/cppnewclassdlg.cpp | 2242 ++++ languages/cpp/cppnewclassdlg.h | 292 + languages/cpp/cppnewclassdlgbase.ui | 1290 ++ languages/cpp/cppsplitheadersourceconfig.cpp | 82 + languages/cpp/cppsplitheadersourceconfig.h | 74 + languages/cpp/cppsupport_events.h | 75 + languages/cpp/cppsupport_utils.cpp | 139 + languages/cpp/cppsupport_utils.h | 28 + languages/cpp/cppsupportfactory.cpp | 42 + languages/cpp/cppsupportfactory.h | 33 + languages/cpp/cppsupportpart.cpp | 3186 +++++ languages/cpp/cppsupportpart.h | 661 + languages/cpp/cpptemplates | 22 + languages/cpp/creategettersetter.ui | 232 + languages/cpp/creategettersetterconfiguration.cpp | 62 + languages/cpp/creategettersetterconfiguration.h | 117 + languages/cpp/creategettersetterdialog.cpp | 122 + languages/cpp/creategettersetterdialog.h | 41 + languages/cpp/createpcsdialog.cpp | 358 + languages/cpp/createpcsdialog.h | 59 + languages/cpp/createpcsdialogbase.ui | 168 + languages/cpp/debugger/DESIGN.txt | 113 + languages/cpp/debugger/Makefile.am | 33 + languages/cpp/debugger/TODO.txt | 218 + languages/cpp/debugger/breakpoint.cpp | 719 ++ languages/cpp/debugger/breakpoint.h | 313 + languages/cpp/debugger/dbgcontroller.cpp | 40 + languages/cpp/debugger/dbgcontroller.h | 128 + languages/cpp/debugger/dbgpsdlg.cpp | 203 + languages/cpp/debugger/dbgpsdlg.h | 59 + languages/cpp/debugger/dbgtoolbar.cpp | 498 + languages/cpp/debugger/dbgtoolbar.h | 85 + languages/cpp/debugger/debuggerconfigwidget.cpp | 138 + languages/cpp/debugger/debuggerconfigwidget.h | 43 + languages/cpp/debugger/debuggerconfigwidgetbase.ui | 453 + languages/cpp/debugger/debuggerdcopinterface.h | 29 + languages/cpp/debugger/debuggerpart.cpp | 1272 ++ languages/cpp/debugger/debuggerpart.h | 164 + languages/cpp/debugger/debuggertracingdialog.cpp | 104 + languages/cpp/debugger/debuggertracingdialog.h | 42 + .../cpp/debugger/debuggertracingdialogbase.ui | 141 + languages/cpp/debugger/disassemblewidget.cpp | 173 + languages/cpp/debugger/disassemblewidget.h | 69 + languages/cpp/debugger/framestackwidget.cpp | 645 + languages/cpp/debugger/framestackwidget.h | 183 + languages/cpp/debugger/gdbbreakpointwidget.cpp | 1262 ++ languages/cpp/debugger/gdbbreakpointwidget.h | 174 + languages/cpp/debugger/gdbcommand.cpp | 142 + languages/cpp/debugger/gdbcommand.h | 271 + languages/cpp/debugger/gdbcontroller.cpp | 1860 +++ languages/cpp/debugger/gdbcontroller.h | 358 + languages/cpp/debugger/gdboutputwidget.cpp | 376 + languages/cpp/debugger/gdboutputwidget.h | 137 + languages/cpp/debugger/gdbparser.cpp | 432 + languages/cpp/debugger/gdbparser.h | 59 + languages/cpp/debugger/gdbtable.cpp | 55 + languages/cpp/debugger/gdbtable.h | 39 + .../cpp/debugger/hi16-action-breakpoint_add.png | Bin 0 -> 225 bytes .../cpp/debugger/hi16-action-breakpoint_delete.png | Bin 0 -> 239 bytes .../debugger/hi16-action-breakpoint_delete_all.png | Bin 0 -> 239 bytes .../cpp/debugger/hi16-action-breakpoint_edit.png | Bin 0 -> 277 bytes languages/cpp/debugger/kdevdebugger.desktop | 86 + languages/cpp/debugger/kdevdebugger.rc | 93 + languages/cpp/debugger/label_with_double_click.cpp | 14 + languages/cpp/debugger/label_with_double_click.h | 20 + languages/cpp/debugger/memviewdlg.cpp | 486 + languages/cpp/debugger/memviewdlg.h | 118 + languages/cpp/debugger/mi/Makefile.am | 12 + languages/cpp/debugger/mi/gdbmi.cpp | 128 + languages/cpp/debugger/mi/gdbmi.h | 221 + languages/cpp/debugger/mi/milexer.cpp | 290 + languages/cpp/debugger/mi/milexer.h | 147 + languages/cpp/debugger/mi/miparser.cpp | 345 + languages/cpp/debugger/mi/miparser.h | 82 + languages/cpp/debugger/mi/tokens.h | 34 + languages/cpp/debugger/stty.cpp | 386 + languages/cpp/debugger/stty.h | 72 + languages/cpp/debugger/tests/README.txt | 4 + languages/cpp/debugger/tests/breakpoints/Makefile | 4 + .../cpp/debugger/tests/breakpoints/README.txt | 2 + .../tests/breakpoints/breakpoints.kdevelop | 163 + languages/cpp/debugger/tests/breakpoints/foo.cpp | 10 + languages/cpp/debugger/tests/breakpoints/main.cpp | 38 + languages/cpp/debugger/tests/dll/Makefile | 8 + languages/cpp/debugger/tests/dll/README.txt | 3 + languages/cpp/debugger/tests/dll/dll.kdevelop | 158 + languages/cpp/debugger/tests/dll/helper.cpp | 6 + languages/cpp/debugger/tests/dll/main.cpp | 15 + .../cpp/debugger/tests/infinite_loop/Makefile | 4 + .../cpp/debugger/tests/infinite_loop/README.txt | 3 + .../debugger/tests/infinite_loop/infinite_loop.cpp | 17 + .../tests/infinite_loop/infinite_loop.kdevelop | 109 + .../cpp/debugger/tests/print_pointers/Makefile | 3 + .../tests/print_pointers/print_pointers.cpp | 95 + .../tests/print_pointers/print_pointers.kdevelop | 218 + languages/cpp/debugger/tests/segfault/Makefile | 4 + languages/cpp/debugger/tests/segfault/README.txt | 3 + languages/cpp/debugger/tests/segfault/segfault.cpp | 7 + .../cpp/debugger/tests/segfault/segfault.kdevelop | 163 + languages/cpp/debugger/tests/threads/Makefile | 4 + languages/cpp/debugger/tests/threads/README.txt | 4 + languages/cpp/debugger/tests/threads/threads.cpp | 26 + .../cpp/debugger/tests/threads/threads.kdevelop | 101 + languages/cpp/debugger/tests/tracing/Makefile | 4 + languages/cpp/debugger/tests/tracing/main.cpp | 15 + .../cpp/debugger/tests/tracing/tracing.kdevelop | 163 + languages/cpp/debugger/tests/two_module/Makefile | 4 + languages/cpp/debugger/tests/two_module/README.txt | 2 + languages/cpp/debugger/tests/two_module/main.cpp | 8 + .../cpp/debugger/tests/two_module/src/foo.cpp | 12 + .../debugger/tests/two_module/two_module.kdevelop | 163 + languages/cpp/debugger/variablewidget.cpp | 2002 +++ languages/cpp/debugger/variablewidget.h | 466 + languages/cpp/declarationinfo.h | 72 + languages/cpp/doc/Makefile.am | 7 + languages/cpp/doc/c++_bugs_gcc.toc | 7 + languages/cpp/doc/clanlib.toc | 384 + languages/cpp/doc/cppannotations.toc | 456 + languages/cpp/doc/gnome1.toc | 424 + languages/cpp/doc/gnustep.toc | 184 + languages/cpp/doc/gtk_bugs.toc | 7 + languages/cpp/doc/kde2book.toc | 2875 +++++ languages/cpp/doc/kdetemplates.toc | 9 + languages/cpp/doc/libc.toc | 858 ++ languages/cpp/doc/libstdc++.toc | 19 + languages/cpp/doc/qt-kdev3.toc | 39 + languages/cpp/doc/stl.toc | 487 + languages/cpp/doc/wxwidgets_bugs.toc | 7 + languages/cpp/doxydoc.cpp | 148 + languages/cpp/doxydoc.h | 59 + languages/cpp/expressioninfo.h | 99 + languages/cpp/file_templates/Makefile.am | 3 + languages/cpp/file_templates/c | 11 + languages/cpp/file_templates/cpp | 11 + languages/cpp/file_templates/h | 11 + languages/cpp/file_templates/l | 35 + languages/cpp/file_templates/ll | 42 + languages/cpp/file_templates/y | 40 + languages/cpp/file_templates/yy | 40 + languages/cpp/includefiles.cpp | 2 + languages/cpp/includefiles.h | 14 + languages/cpp/includepathresolver.cpp | 577 + languages/cpp/includepathresolver.h | 76 + languages/cpp/kdevcppsupport.desktop | 86 + languages/cpp/kdevcppsupport.rc | 30 + languages/cpp/kdevcsupport.desktop | 85 + languages/cpp/kdevdeepcopy.h | 14 + languages/cpp/kdevdriver.cpp | 206 + languages/cpp/kdevdriver.h | 58 + languages/cpp/main.cpp | 283 + languages/cpp/newclass_templates/Makefile.am | 4 + languages/cpp/newclass_templates/cpp_header | 31 + languages/cpp/newclass_templates/cpp_source | 9 + languages/cpp/newclass_templates/gtk_header | 24 + languages/cpp/newclass_templates/gtk_source | 35 + languages/cpp/newclass_templates/objc_header | 11 + languages/cpp/newclass_templates/objc_source | 4 + languages/cpp/pcsimporter/Makefile.am | 3 + .../cpp/pcsimporter/customimporter/Makefile.am | 12 + .../customimporter/kdevcustomimporter.cpp | 118 + .../customimporter/kdevcustomimporter.h | 40 + .../customimporter/kdevpcscustomimporter.desktop | 44 + .../pcsimporter/customimporter/settingsdialog.cpp | 107 + .../pcsimporter/customimporter/settingsdialog.h | 48 + .../customimporter/settingsdialogbase.ui | 62 + .../cpp/pcsimporter/kdelibsimporter/Makefile.am | 11 + .../kdelibsimporter/kdevkdelibsimporter.cpp | 119 + .../kdelibsimporter/kdevkdelibsimporter.desktop | 49 + .../kdelibsimporter/kdevkdelibsimporter.h | 40 + .../pcsimporter/kdelibsimporter/settingsdialog.cpp | 101 + .../pcsimporter/kdelibsimporter/settingsdialog.h | 44 + .../kdelibsimporter/settingsdialogbase.ui | 131 + languages/cpp/pcsimporter/qt4importer/Makefile.am | 11 + .../pcsimporter/qt4importer/kdevqt4importer.cpp | 107 + .../qt4importer/kdevqt4importer.desktop | 34 + .../cpp/pcsimporter/qt4importer/kdevqt4importer.h | 39 + .../cpp/pcsimporter/qt4importer/settingsdialog.cpp | 115 + .../cpp/pcsimporter/qt4importer/settingsdialog.h | 46 + .../pcsimporter/qt4importer/settingsdialogbase.ui | 79 + languages/cpp/pcsimporter/qtimporter/Makefile.am | 11 + .../cpp/pcsimporter/qtimporter/kdevqtimporter.cpp | 73 + .../pcsimporter/qtimporter/kdevqtimporter.desktop | 37 + .../cpp/pcsimporter/qtimporter/kdevqtimporter.h | 37 + .../cpp/pcsimporter/qtimporter/settingsdialog.cpp | 122 + .../cpp/pcsimporter/qtimporter/settingsdialog.h | 46 + .../pcsimporter/qtimporter/settingsdialogbase.ui | 139 + languages/cpp/problemreporter.cpp | 441 + languages/cpp/problemreporter.h | 156 + languages/cpp/qtbuildconfig.cpp | 216 + languages/cpp/qtbuildconfig.h | 90 + languages/cpp/qtdesignercppintegration.cpp | 218 + languages/cpp/qtdesignercppintegration.h | 40 + languages/cpp/safetycounter.h | 59 + languages/cpp/setuphelper.cpp | 91 + languages/cpp/setuphelper.h | 42 + languages/cpp/simplecontext.cpp | 68 + languages/cpp/simplecontext.h | 171 + languages/cpp/simpletype.cpp | 1051 ++ languages/cpp/simpletype.h | 819 ++ languages/cpp/simpletypecachebinder.h | 348 + languages/cpp/simpletypecatalog.cpp | 375 + languages/cpp/simpletypecatalog.h | 119 + languages/cpp/simpletypefunction.cpp | 726 ++ languages/cpp/simpletypefunction.h | 341 + languages/cpp/simpletypenamespace.cpp | 438 + languages/cpp/simpletypenamespace.h | 165 + languages/cpp/store_walker.cpp | 1081 ++ languages/cpp/store_walker.h | 141 + languages/cpp/storeconverter.cpp | 149 + languages/cpp/storeconverter.h | 48 + languages/cpp/stringhelpers.cpp | 299 + languages/cpp/stringhelpers.h | 118 + languages/cpp/subclassing_template/.kdev_ignore | 0 languages/cpp/subclassing_template/Makefile.am | 5 + .../subclassing_template/subclass_qt4_template.cpp | 16 + .../subclassing_template/subclass_qt4_template.h | 28 + .../cpp/subclassing_template/subclass_template.cpp | 15 + .../cpp/subclassing_template/subclass_template.h | 27 + languages/cpp/subclassingdlg.cpp | 536 + languages/cpp/subclassingdlg.h | 85 + languages/cpp/subclassingdlgbase.ui | 244 + languages/cpp/tag_creator.cpp | 884 ++ languages/cpp/tag_creator.h | 131 + languages/cpp/templates/Makefile.am | 2 + languages/cpp/templates/default.cpp | 12 + languages/cpp/templates/default.h | 12 + languages/cpp/typedecoration.h | 119 + languages/cpp/typedesc.cpp | 788 ++ languages/cpp/typedesc.h | 403 + languages/csharp/Makefile.am | 25 + languages/csharp/README.dox | 46 + languages/csharp/app_templates/Makefile.am | 3 + languages/csharp/app_templates/csharp.appwizard | 2 + languages/csharp/csharpconfigwidget.cpp | 38 + languages/csharp/csharpconfigwidget.h | 34 + languages/csharp/csharpconfigwidgetbase.ui | 101 + languages/csharp/csharpdoc.cpp | 133 + languages/csharp/csharpdoc.h | 25 + languages/csharp/csharpdoc.protocol | 9 + languages/csharp/csharpsupportpart.cpp | 331 + languages/csharp/csharpsupportpart.h | 59 + languages/csharp/doc/Makefile.am | 6 + languages/csharp/file_templates/Makefile.am | 4 + languages/csharp/kdevcsharpsupport.desktop | 57 + languages/csharp/kdevcsharpsupport.rc | 14 + languages/fortran/Makefile.am | 20 + languages/fortran/README.dox | 48 + languages/fortran/app_templates/Makefile.am | 3 + languages/fortran/app_templates/fortran.appwizard | 2 + .../app_templates/fortranhello/.kdev_ignore | 0 .../fortran/app_templates/fortranhello/Makefile.am | 17 + .../app_templates/fortranhello/app.kdevelop | 113 + .../app_templates/fortranhello/configure.in | 10 + .../app_templates/fortranhello/fortran-Makefile.am | 5 + .../fortranhello/fortran-Makefile.cvs | 8 + .../app_templates/fortranhello/fortranhello | 10 + .../fortranhello/fortranhello.kdevtemplate | 140 + .../app_templates/fortranhello/fortranhello.png | Bin 0 -> 10118 bytes .../fortran/app_templates/fortranhello/main.f | 7 + .../app_templates/fortranhello/src-Makefile.am | 8 + languages/fortran/compiler/Makefile.am | 6 + languages/fortran/compiler/pgioptions/Makefile.am | 18 + .../compiler/pgioptions/kdevpgf77options.desktop | 53 + .../compiler/pgioptions/kdevpghpfoptions.desktop | 50 + .../compiler/pgioptions/pgioptionsfactory.cpp | 69 + .../compiler/pgioptions/pgioptionsfactory.h | 34 + .../compiler/pgioptions/pgioptionsplugin.cpp | 324 + .../fortran/compiler/pgioptions/pgioptionsplugin.h | 55 + languages/fortran/doc/Makefile.am | 6 + languages/fortran/doc/fortran_bugs_gcc.toc | 7 + languages/fortran/file_templates/Makefile.am | 2 + languages/fortran/file_templates/f | 11 + languages/fortran/file_templates/f77 | 11 + languages/fortran/file_templates/f90 | 11 + languages/fortran/file_templates/f95 | 11 + languages/fortran/file_templates/for | 11 + languages/fortran/file_templates/fpp | 11 + languages/fortran/file_templates/ftn | 11 + languages/fortran/fixedformparser.cpp | 94 + languages/fortran/fixedformparser.h | 35 + languages/fortran/fortransupportpart.cpp | 287 + languages/fortran/fortransupportpart.h | 53 + languages/fortran/ftnchekconfigwidget.cpp | 290 + languages/fortran/ftnchekconfigwidget.h | 41 + languages/fortran/ftnchekconfigwidgetbase.ui | 584 + languages/fortran/kdevfortransupport.desktop | 80 + languages/fortran/kdevfortransupport.rc | 9 + languages/java/JavaAST.hpp | 77 + languages/java/JavaLexer.cpp | 2183 ++++ languages/java/JavaLexer.hpp | 132 + languages/java/JavaRecognizer.cpp | 6540 ++++++++++ languages/java/JavaRecognizer.hpp | 423 + languages/java/JavaStoreWalker.cpp | 3441 ++++++ languages/java/JavaStoreWalker.hpp | 164 + languages/java/JavaStoreWalkerTokenTypes.hpp | 169 + languages/java/JavaStoreWalkerTokenTypes.txt | 151 + languages/java/JavaTokenTypes.hpp | 168 + languages/java/JavaTokenTypes.txt | 150 + languages/java/KDevJavaSupportIface.cpp | 24 + languages/java/KDevJavaSupportIface.h | 26 + languages/java/Makefile.am | 37 + languages/java/README.dox | 48 + languages/java/app_templates/Makefile.am | 3 + languages/java/app_templates/java.appwizard | 2 + .../java/app_templates/javahello/.kdev_ignore | 0 languages/java/app_templates/javahello/Main.java | 7 + languages/java/app_templates/javahello/Makefile.am | 16 + languages/java/app_templates/javahello/build.xml | 37 + languages/java/app_templates/javahello/javahello | 11 + .../app_templates/javahello/javahello.filelist | 2 + .../app_templates/javahello/javahello.kdevelop | 69 + .../app_templates/javahello/javahello.kdevtemplate | 124 + .../java/app_templates/javahello/javahello.png | Bin 0 -> 483 bytes languages/java/app_templates/kappjava/.kdev_ignore | 0 languages/java/app_templates/kappjava/Makefile.am | 17 + languages/java/app_templates/kappjava/app.desktop | 41 + languages/java/app_templates/kappjava/app.java | 281 + languages/java/app_templates/kappjava/app.kdevelop | 88 + .../java/app_templates/kappjava/app_client.java | 28 + languages/java/app_templates/kappjava/appui.rc | 8 + languages/java/app_templates/kappjava/appview.java | 115 + languages/java/app_templates/kappjava/kappjava | 10 + .../app_templates/kappjava/kappjava.kdevtemplate | 163 + languages/java/app_templates/kappjava/kappjava.png | Bin 0 -> 5063 bytes languages/java/app_templates/kappjava/pref.java | 52 + .../java/app_templates/kappjava/src-Makefile.am | 18 + languages/java/app_templates/kappjava/subdirs | 3 + .../java/app_templates/superwaba/.kdev_ignore | 0 languages/java/app_templates/superwaba/Makefile.am | 16 + .../java/app_templates/superwaba/src-Makefile | 226 + languages/java/app_templates/superwaba/superwaba | 54 + .../app_templates/superwaba/superwaba.kdevtemplate | 166 + .../java/app_templates/superwaba/superwaba.png | Bin 0 -> 1100 bytes languages/java/app_templates/superwaba/sw.filelist | 1 + languages/java/app_templates/superwaba/sw.java | 97 + languages/java/app_templates/superwaba/sw.kdevelop | 94 + languages/java/backgroundparser.cpp | 363 + languages/java/backgroundparser.h | 86 + languages/java/configproblemreporter.ui | 257 + languages/java/configproblemreporter.ui.h | 74 + languages/java/doc/Makefile.am | 6 + languages/java/doc/java_bugs_gcc.toc | 7 + languages/java/doc/java_bugs_sun.toc | 7 + languages/java/doc/sw.toc | 146 + languages/java/driver.cpp | 227 + languages/java/driver.h | 139 + languages/java/file_templates/Makefile.am | 4 + languages/java/file_templates/java | 6 + languages/java/java.g | 1318 ++ languages/java/java.store.g | 521 + languages/java/java.tree.g | 331 + languages/java/javasupport_events.h | 60 + languages/java/javasupport_utils.cpp | 52 + languages/java/javasupport_utils.h | 21 + languages/java/javasupportfactory.cpp | 39 + languages/java/javasupportfactory.h | 31 + languages/java/javasupportpart.cpp | 908 ++ languages/java/javasupportpart.h | 165 + languages/java/javatemplates | 3 + languages/java/kdevdeepcopy.h | 12 + languages/java/kdevdriver.cpp | 44 + languages/java/kdevdriver.h | 30 + languages/java/kdevjavasupport.desktop | 85 + languages/java/kdevjavasupport.rc | 4 + languages/java/newclass_templates/Makefile.am | 4 + languages/java/newclass_templates/java_source | 9 + languages/java/problemreporter.cpp | 299 + languages/java/problemreporter.h | 74 + languages/kjssupport/Makefile.am | 22 + languages/kjssupport/jscodecompletion.cpp | 174 + languages/kjssupport/jscodecompletion.h | 53 + languages/kjssupport/kdevkjssupport.desktop | 54 + languages/kjssupport/kdevkjssupport.rc | 11 + languages/kjssupport/kjsproblems.cpp | 78 + languages/kjssupport/kjsproblems.h | 43 + languages/kjssupport/kjssupport_part.cpp | 448 + languages/kjssupport/kjssupport_part.h | 85 + .../kjssupport/subclassing_template/Makefile.am | 3 + .../subclassing_template/subclass_template.js | 2 + languages/kjssupport/subclassingdlg.cpp | 461 + languages/kjssupport/subclassingdlg.h | 85 + languages/kjssupport/subclassingdlgbase.ui | 253 + languages/kjssupport/template/Makefile.am | 20 + languages/kjssupport/template/app.js | 18 + languages/kjssupport/template/app.kdevelop | 45 + languages/kjssupport/template/jshello | 6 + languages/kjssupport/template/script | 13 + languages/kjssupport/x-javascript-source.desktop | 4 + languages/lib/Makefile.am | 6 + languages/lib/debugger/Mainpage.dox | 36 + languages/lib/debugger/Makefile.am | 13 + languages/lib/debugger/debugger.cpp | 209 + languages/lib/debugger/debugger.h | 132 + languages/lib/debugger/kdevdebugger.cpp | 182 + languages/lib/debugger/kdevdebugger.h | 88 + languages/lib/designer_integration/Mainpage.dox | 48 + languages/lib/designer_integration/Makefile.am | 16 + .../designer_integration/implementationwidget.cpp | 158 + .../designer_integration/implementationwidget.h | 86 + .../implementationwidgetbase.ui | 267 + .../designer_integration/qtdesignerintegration.cpp | 195 + .../designer_integration/qtdesignerintegration.h | 80 + languages/lib/interfaces/Mainpage.dox | 10 + languages/lib/interfaces/Makefile.am | 16 + .../lib/interfaces/kdeveloppcsimporter.desktop | 39 + languages/lib/interfaces/kdevpcsimporter.cpp | 36 + languages/lib/interfaces/kdevpcsimporter.h | 49 + languages/pascal/Makefile.am | 33 + languages/pascal/PascalAST.hpp | 51 + languages/pascal/PascalLexer.cpp | 1309 ++ languages/pascal/PascalLexer.hpp | 121 + languages/pascal/PascalParser.cpp | 9744 +++++++++++++++ languages/pascal/PascalParser.hpp | 422 + languages/pascal/PascalStoreWalker.cpp | 3409 +++++ languages/pascal/PascalStoreWalker.hpp | 172 + languages/pascal/PascalStoreWalkerTokenTypes.hpp | 206 + languages/pascal/PascalStoreWalkerTokenTypes.txt | 188 + languages/pascal/PascalTokenTypes.hpp | 206 + languages/pascal/PascalTokenTypes.txt | 188 + languages/pascal/README.dox | 26 + languages/pascal/app_templates/Makefile.am | 3 + languages/pascal/app_templates/fpcgtk/.kdev_ignore | 0 languages/pascal/app_templates/fpcgtk/Makefile.am | 16 + languages/pascal/app_templates/fpcgtk/app.kdevelop | 86 + languages/pascal/app_templates/fpcgtk/fpcgtk | 9 + .../app_templates/fpcgtk/fpcgtk.kdevtemplate | 114 + languages/pascal/app_templates/fpcgtk/fpcgtk.png | Bin 0 -> 483 bytes languages/pascal/app_templates/fpcgtk/main.pp | 84 + .../pascal/app_templates/fpchello/.kdev_ignore | 0 .../pascal/app_templates/fpchello/Makefile.am | 16 + .../pascal/app_templates/fpchello/app.kdevelop | 86 + languages/pascal/app_templates/fpchello/fpchello | 9 + .../app_templates/fpchello/fpchello.kdevtemplate | 115 + .../pascal/app_templates/fpchello/fpchello.png | Bin 0 -> 483 bytes languages/pascal/app_templates/fpchello/main.pp | 5 + .../pascal/app_templates/fpcsharedlib/.kdev_ignore | 0 .../pascal/app_templates/fpcsharedlib/Makefile.am | 16 + .../pascal/app_templates/fpcsharedlib/app.kdevelop | 86 + .../pascal/app_templates/fpcsharedlib/fpcsharedlib | 9 + .../fpcsharedlib/fpcsharedlib.kdevtemplate | 115 + .../app_templates/fpcsharedlib/fpcsharedlib.png | Bin 0 -> 483 bytes .../pascal/app_templates/fpcsharedlib/main.pp | 11 + languages/pascal/app_templates/pascal.appwizard | 2 + .../pascal/app_templates/pascalhello/.kdev_ignore | 0 .../pascal/app_templates/pascalhello/Makefile.am | 16 + .../pascal/app_templates/pascalhello/app.kdevelop | 83 + languages/pascal/app_templates/pascalhello/main.pp | 5 + .../pascal/app_templates/pascalhello/pascalhello | 10 + .../pascalhello/pascalhello.kdevtemplate | 116 + .../app_templates/pascalhello/pascalhello.png | Bin 0 -> 10118 bytes languages/pascal/backgroundparser.cpp | 95 + languages/pascal/backgroundparser.h | 35 + languages/pascal/compiler/Makefile.am | 6 + languages/pascal/compiler/dccoptions/Makefile.am | 16 + .../compiler/dccoptions/dccoptionsplugin.cpp | 114 + .../pascal/compiler/dccoptions/dccoptionsplugin.h | 56 + .../compiler/dccoptions/kdevdccoptions.desktop | 54 + .../pascal/compiler/dccoptions/optiontabs.cpp | 399 + languages/pascal/compiler/dccoptions/optiontabs.h | 116 + languages/pascal/compiler/fpcoptions/Makefile.am | 20 + .../compiler/fpcoptions/fpcoptionsplugin.cpp | 126 + .../pascal/compiler/fpcoptions/fpcoptionsplugin.h | 63 + .../compiler/fpcoptions/kdevfpcoptions.desktop | 55 + .../pascal/compiler/fpcoptions/optiontabs.cpp | 657 + languages/pascal/compiler/fpcoptions/optiontabs.h | 161 + languages/pascal/configproblemreporter.ui | 88 + languages/pascal/doc/Makefile.am | 6 + languages/pascal/doc/pascal_bugs_fp.toc | 7 + languages/pascal/file_templates/Makefile.am | 2 + languages/pascal/file_templates/dpr | 12 + languages/pascal/file_templates/pas-program | 12 + languages/pascal/file_templates/pas-unit | 19 + languages/pascal/file_templates/pp-program | 12 + languages/pascal/file_templates/pp-unit | 19 + languages/pascal/kdevpascalsupport.desktop | 84 + languages/pascal/kdevpascalsupport.rc | 3 + languages/pascal/pascal.g | 1212 ++ languages/pascal/pascal.tree.g | 468 + languages/pascal/pascalsupport_part.cpp | 323 + languages/pascal/pascalsupport_part.h | 62 + languages/pascal/pascaltemplates | 30 + languages/pascal/problemreporter.cpp | 289 + languages/pascal/problemreporter.h | 78 + languages/perl/Makefile.am | 25 + languages/perl/README.dox | 46 + languages/perl/app_templates/Makefile.am | 3 + languages/perl/app_templates/perl.appwizard | 2 + .../perl/app_templates/perlhello/.kdev_ignore | 0 languages/perl/app_templates/perlhello/Makefile.am | 16 + .../perl/app_templates/perlhello/app.kdevelop | 77 + languages/perl/app_templates/perlhello/app.pl | 43 + languages/perl/app_templates/perlhello/perlhello | 10 + .../app_templates/perlhello/perlhello.kdevtemplate | 108 + .../perl/app_templates/perlhello/perlhello.png | Bin 0 -> 17622 bytes languages/perl/doc/Makefile.am | 6 + languages/perl/doc/perl.toc | 54 + languages/perl/doc/perl_bugs.toc | 7 + languages/perl/file_templates/Makefile.am | 4 + languages/perl/file_templates/pl | 43 + languages/perl/file_templates/pm | 68 + languages/perl/kdevperlsupport.desktop | 85 + languages/perl/kdevperlsupport.rc | 14 + languages/perl/perlconfigwidget.cpp | 38 + languages/perl/perlconfigwidget.h | 34 + languages/perl/perlconfigwidgetbase.ui | 101 + languages/perl/perldoc.cpp | 133 + languages/perl/perldoc.h | 25 + languages/perl/perldoc.protocol | 9 + languages/perl/perlparser.cpp | 494 + languages/perl/perlparser.h | 87 + languages/perl/perlsupportpart.cpp | 330 + languages/perl/perlsupportpart.h | 59 + languages/php/Makefile.am | 24 + languages/php/README.dox | 32 + languages/php/app_templates/Makefile.am | 3 + languages/php/app_templates/php.appwizard | 2 + languages/php/app_templates/phphello/.kdev_ignore | 0 languages/php/app_templates/phphello/Makefile.am | 16 + languages/php/app_templates/phphello/app.kdevelop | 87 + languages/php/app_templates/phphello/app.php | 28 + languages/php/app_templates/phphello/phphello | 25 + .../app_templates/phphello/phphello.kdevtemplate | 108 + languages/php/app_templates/phphello/phphello.png | Bin 0 -> 483 bytes languages/php/data/Makefile.am | 6 + languages/php/data/phpfunctions | 1657 +++ languages/php/doc/Makefile.am | 6 + languages/php/doc/php.toc | 7069 +++++++++++ languages/php/doc/php_bugs.toc | 7 + languages/php/file_templates/Makefile.am | 4 + languages/php/file_templates/php | 12 + languages/php/kdevphpsupport.desktop | 86 + languages/php/kdevphpsupport.rc | 18 + languages/php/phpcodecompletion.cpp | 712 ++ languages/php/phpcodecompletion.h | 103 + languages/php/phpconfigdata.cpp | 88 + languages/php/phpconfigdata.h | 155 + languages/php/phpconfigwidget.cpp | 161 + languages/php/phpconfigwidget.h | 32 + languages/php/phpconfigwidgetbase.ui | 561 + languages/php/phperrorview.cpp | 422 + languages/php/phperrorview.h | 104 + languages/php/phpfile.cpp | 639 + languages/php/phpfile.h | 119 + languages/php/phphtmlview.cpp | 39 + languages/php/phphtmlview.h | 42 + languages/php/phpinfodlg.ui | 87 + languages/php/phpnewclassdlg.cpp | 123 + languages/php/phpnewclassdlg.h | 42 + languages/php/phpnewclassdlgbase.ui | 201 + languages/php/phpparser.cpp | 160 + languages/php/phpparser.h | 73 + languages/php/phpsupport_event.h | 110 + languages/php/phpsupportpart.cpp | 751 ++ languages/php/phpsupportpart.h | 133 + languages/php/phptemplates | 4 + languages/python/Makefile.am | 31 + languages/python/README.dox | 48 + languages/python/app_templates/Makefile.am | 3 + languages/python/app_templates/pyqt/.kdev_ignore | 0 languages/python/app_templates/pyqt/Makefile.am | 20 + .../python/app_templates/pyqt/app-Makefile.am | 14 + languages/python/app_templates/pyqt/app-autogen.sh | 10 + .../python/app_templates/pyqt/app-configure.ac | 32 + languages/python/app_templates/pyqt/app.kdevelop | 81 + languages/python/app_templates/pyqt/app.py | 271 + .../python/app_templates/pyqt/documentdetails.ui | 80 + languages/python/app_templates/pyqt/fileopen.pyxpm | 19 + .../python/app_templates/pyqt/fileprint.pyxpm | 21 + languages/python/app_templates/pyqt/filesave.pyxpm | 19 + languages/python/app_templates/pyqt/install-sh | 0 languages/python/app_templates/pyqt/missing | 0 languages/python/app_templates/pyqt/mkinstalldirs | 0 languages/python/app_templates/pyqt/pyqt | 10 + .../python/app_templates/pyqt/pyqt-am-preproc.py | 85 + .../python/app_templates/pyqt/pyqt.kdevtemplate | 168 + languages/python/app_templates/pyqt/pyqt.png | Bin 0 -> 8800 bytes .../python/app_templates/pyqt/templates-ui-dialog | 20 + .../python/app_templates/pyqt/templates-ui-mainwin | 436 + languages/python/app_templates/python.appwizard | 2 + .../python/app_templates/pythonhello/.kdev_ignore | 0 .../python/app_templates/pythonhello/Makefile.am | 15 + .../python/app_templates/pythonhello/app.kdevelop | 84 + languages/python/app_templates/pythonhello/app.py | 7 + .../python/app_templates/pythonhello/pythonhello | 12 + .../pythonhello/pythonhello.kdevtemplate | 107 + .../app_templates/pythonhello/pythonhello.png | Bin 0 -> 12443 bytes languages/python/app_templates/pytk/.kdev_ignore | 0 languages/python/app_templates/pytk/Makefile.am | 15 + languages/python/app_templates/pytk/app.kdevelop | 82 + languages/python/app_templates/pytk/app.py | 4 + languages/python/app_templates/pytk/pytk | 12 + .../python/app_templates/pytk/pytk.kdevtemplate | 107 + languages/python/app_templates/pytk/pytk.png | Bin 0 -> 2420 bytes languages/python/doc/Makefile.am | 6 + languages/python/doc/python.toc | 1571 +++ languages/python/doc/python_bugs.toc | 7 + languages/python/file_templates/Makefile.am | 4 + languages/python/file_templates/py | 7 + languages/python/kde_pydoc.py | 131 + languages/python/kdevpythonsupport.desktop | 85 + languages/python/kdevpythonsupport.rc | 16 + languages/python/pydoc.cpp | 113 + languages/python/pydoc.h | 30 + languages/python/pydoc.protocol | 9 + languages/python/pythonconfigwidget.cpp | 38 + languages/python/pythonconfigwidget.h | 34 + languages/python/pythonconfigwidgetbase.ui | 121 + languages/python/pythonimplementationwidget.cpp | 77 + languages/python/pythonimplementationwidget.h | 37 + languages/python/pythonsupportpart.cpp | 410 + languages/python/pythonsupportpart.h | 66 + languages/python/qtdesignerpythonintegration.cpp | 97 + languages/python/qtdesignerpythonintegration.h | 37 + languages/ruby/Makefile.am | 31 + languages/ruby/README | 3 + languages/ruby/README.dox | 43 + languages/ruby/app_templates/Makefile.am | 3 + .../ruby/app_templates/dcopservice/Makefile.am | 18 + .../app_templates/dcopservice/app-configure.in.in | 51 + languages/ruby/app_templates/dcopservice/app.cpp | 30 + .../app_templates/dcopservice/dcopservice.desktop | 43 + .../app_templates/dcopservice/dcopservice.kdevelop | 91 + .../ruby/app_templates/dcopservice/dcopservice.rb | 37 + .../dcopservice/dcopserviceruby.kdevtemplate | 199 + .../app_templates/dcopservice/dcopserviceruby.png | Bin 0 -> 23880 bytes languages/ruby/app_templates/dcopservice/main.rb | 30 + .../ruby/app_templates/dcopservice/src-Makefile.am | 15 + languages/ruby/app_templates/dcopservice/subdirs | 3 + languages/ruby/app_templates/kapp/Makefile.am | 19 + languages/ruby/app_templates/kapp/README | 81 + languages/ruby/app_templates/kapp/app-Makefile.am | 1 + .../ruby/app_templates/kapp/app-configure.in.in | 45 + languages/ruby/app_templates/kapp/app.cpp | 30 + languages/ruby/app_templates/kapp/app.desktop | 44 + languages/ruby/app_templates/kapp/app.kdevelop | 90 + languages/ruby/app_templates/kapp/app.rb | 216 + languages/ruby/app_templates/kapp/app_client.rb | 18 + languages/ruby/app_templates/kapp/appiface.rb | 14 + languages/ruby/app_templates/kapp/appui.rc | 8 + languages/ruby/app_templates/kapp/appview.rb | 103 + .../ruby/app_templates/kapp/kappruby.kdevtemplate | 238 + languages/ruby/app_templates/kapp/kappruby.png | Bin 0 -> 5063 bytes languages/ruby/app_templates/kapp/main.rb | 40 + languages/ruby/app_templates/kapp/pref.rb | 38 + languages/ruby/app_templates/kapp/src-Makefile.am | 43 + languages/ruby/app_templates/kapp/subdirs | 3 + languages/ruby/app_templates/kxt/Makefile.am | 20 + languages/ruby/app_templates/kxt/README | 38 + languages/ruby/app_templates/kxt/app-Makefile.am | 1 + .../ruby/app_templates/kxt/app-configure.in.in | 45 + languages/ruby/app_templates/kxt/app.cpp | 30 + languages/ruby/app_templates/kxt/app.desktop | 40 + languages/ruby/app_templates/kxt/app.kcfg | 21 + languages/ruby/app_templates/kxt/app.kdevelop | 90 + languages/ruby/app_templates/kxt/app.rb | 94 + languages/ruby/app_templates/kxt/appui.rc | 8 + languages/ruby/app_templates/kxt/appview.rb | 55 + languages/ruby/app_templates/kxt/appview_base.ui | 33 + .../ruby/app_templates/kxt/kxtruby.kdevtemplate | 251 + languages/ruby/app_templates/kxt/kxtruby.png | Bin 0 -> 7841 bytes languages/ruby/app_templates/kxt/main.rb | 41 + languages/ruby/app_templates/kxt/prefs-base.ui | 127 + languages/ruby/app_templates/kxt/prefs.rb | 7 + languages/ruby/app_templates/kxt/previewruby.png | Bin 0 -> 7712 bytes languages/ruby/app_templates/kxt/settings.kcfgc | 6 + languages/ruby/app_templates/kxt/src-Makefile.am | 48 + languages/ruby/app_templates/kxt/subdirs | 3 + languages/ruby/app_templates/qtruby/.kdev_ignore | 0 languages/ruby/app_templates/qtruby/Makefile.am | 16 + languages/ruby/app_templates/qtruby/README | 29 + languages/ruby/app_templates/qtruby/app-Makefile | 7 + languages/ruby/app_templates/qtruby/app.filelist | 2 + languages/ruby/app_templates/qtruby/app.kdevelop | 85 + languages/ruby/app_templates/qtruby/app.rb | 12 + .../ruby/app_templates/qtruby/qtruby.kdevtemplate | 114 + languages/ruby/app_templates/qtruby/qtruby.png | Bin 0 -> 3435 bytes .../ruby/app_templates/qtruby4app/Makefile.am | 20 + languages/ruby/app_templates/qtruby4app/ReadMe | 6 + .../ruby/app_templates/qtruby4app/app-Makefile | 18 + .../ruby/app_templates/qtruby4app/app.filelist | 3 + .../ruby/app_templates/qtruby4app/application.qrc | 10 + .../ruby/app_templates/qtruby4app/editcopy.xpm | 193 + .../ruby/app_templates/qtruby4app/editcut.xpm | 252 + .../ruby/app_templates/qtruby4app/editpaste.xpm | 295 + .../ruby/app_templates/qtruby4app/filenew.xpm | 216 + .../ruby/app_templates/qtruby4app/fileopen.xpm | 295 + .../ruby/app_templates/qtruby4app/filesave.xpm | 295 + languages/ruby/app_templates/qtruby4app/main.rb | 10 + .../app_templates/qtruby4app/qrc_application.rb | 2281 ++++ .../app_templates/qtruby4app/qtruby4app.kdevelop | 83 + .../qtruby4app/qtruby4app.kdevtemplate | 166 + .../ruby/app_templates/qtruby4app/qtruby4app.png | Bin 0 -> 16908 bytes .../ruby/app_templates/qtruby4app/qtruby4app.rb | 263 + languages/ruby/app_templates/qtrubyapp/Makefile.am | 18 + languages/ruby/app_templates/qtrubyapp/README | 29 + .../ruby/app_templates/qtrubyapp/app-Makefile | 7 + .../ruby/app_templates/qtrubyapp/app.filelist | 3 + .../ruby/app_templates/qtrubyapp/fileopen.xpm | 22 + .../ruby/app_templates/qtrubyapp/fileprint.xpm | 24 + .../ruby/app_templates/qtrubyapp/filesave.xpm | 22 + languages/ruby/app_templates/qtrubyapp/main.rb | 10 + .../app_templates/qtrubyapp/qtrubyapp.kdevelop | 83 + .../app_templates/qtrubyapp/qtrubyapp.kdevtemplate | 140 + .../ruby/app_templates/qtrubyapp/qtrubyapp.png | Bin 0 -> 5245 bytes .../ruby/app_templates/qtrubyapp/qtrubyapp.rb | 253 + languages/ruby/app_templates/rails/CMakeLists.txt | 20 + languages/ruby/app_templates/rails/Makefile.am | 16 + languages/ruby/app_templates/rails/app.kdevelop | 107 + .../ruby/app_templates/rails/rails.kdevtemplate | 72 + languages/ruby/app_templates/rails/rails.png | Bin 0 -> 12062 bytes languages/ruby/app_templates/ruby.appwizard | 2 + .../ruby/app_templates/rubyhello/.kdev_ignore | 0 languages/ruby/app_templates/rubyhello/Makefile.am | 16 + .../ruby/app_templates/rubyhello/app.kdevelop | 91 + languages/ruby/app_templates/rubyhello/app.rb | 3 + languages/ruby/app_templates/rubyhello/rubyhello | 9 + .../app_templates/rubyhello/rubyhello.kdevtemplate | 105 + .../ruby/app_templates/rubyhello/rubyhello.png | Bin 0 -> 483 bytes languages/ruby/debugger/Makefile.am | 25 + languages/ruby/debugger/breakpoint.cpp | 343 + languages/ruby/debugger/breakpoint.h | 214 + languages/ruby/debugger/dbgcommand.cpp | 47 + languages/ruby/debugger/dbgcommand.h | 64 + languages/ruby/debugger/dbgcontroller.cpp | 46 + languages/ruby/debugger/dbgcontroller.h | 161 + languages/ruby/debugger/dbgpsdlg.cpp | 170 + languages/ruby/debugger/dbgpsdlg.h | 60 + languages/ruby/debugger/dbgtoolbar.cpp | 483 + languages/ruby/debugger/dbgtoolbar.h | 90 + languages/ruby/debugger/debuggee.rb | 1214 ++ languages/ruby/debugger/debuggerpart.cpp | 785 ++ languages/ruby/debugger/debuggerpart.h | 110 + languages/ruby/debugger/framestackwidget.cpp | 272 + languages/ruby/debugger/framestackwidget.h | 115 + .../ruby/debugger/hi16-action-breakpoint_add.png | Bin 0 -> 225 bytes .../debugger/hi16-action-breakpoint_delete.png | Bin 0 -> 239 bytes .../debugger/hi16-action-breakpoint_delete_all.png | Bin 0 -> 239 bytes .../ruby/debugger/hi16-action-breakpoint_edit.png | Bin 0 -> 277 bytes languages/ruby/debugger/kdevrbdebugger.desktop | 73 + languages/ruby/debugger/kdevrbdebugger.rc | 68 + languages/ruby/debugger/rdbbreakpointwidget.cpp | 921 ++ languages/ruby/debugger/rdbbreakpointwidget.h | 120 + languages/ruby/debugger/rdbcommand.cpp | 81 + languages/ruby/debugger/rdbcommand.h | 99 + languages/ruby/debugger/rdbcontroller.cpp | 1414 +++ languages/ruby/debugger/rdbcontroller.h | 192 + languages/ruby/debugger/rdboutputwidget.cpp | 171 + languages/ruby/debugger/rdboutputwidget.h | 69 + languages/ruby/debugger/rdbparser.cpp | 350 + languages/ruby/debugger/rdbparser.h | 41 + languages/ruby/debugger/rdbtable.cpp | 62 + languages/ruby/debugger/rdbtable.h | 45 + languages/ruby/debugger/stty.cpp | 370 + languages/ruby/debugger/stty.h | 71 + languages/ruby/debugger/variablewidget.cpp | 1018 ++ languages/ruby/debugger/variablewidget.h | 348 + languages/ruby/doc/Makefile.am | 6 + languages/ruby/doc/qtruby.toc | 9 + languages/ruby/doc/rails.toc | 9 + languages/ruby/doc/ruby.toc | 1399 +++ languages/ruby/doc/ruby_bugs.toc | 7 + languages/ruby/file_templates/Makefile.am | 5 + languages/ruby/file_templates/css | 11 + languages/ruby/file_templates/html.erb | 4 + languages/ruby/file_templates/js | 11 + languages/ruby/file_templates/js.rjs | 7 + languages/ruby/file_templates/rb | 7 + languages/ruby/file_templates/rhtml | 4 + languages/ruby/file_templates/rjs | 7 + languages/ruby/file_templates/rxml | 7 + languages/ruby/file_templates/xml.builder | 7 + languages/ruby/kdevrubysupport.desktop | 84 + languages/ruby/kdevrubysupport.rc | 20 + languages/ruby/play_run.psd | Bin 0 -> 58270 bytes languages/ruby/qtdesignerrubyintegration.cpp | 93 + languages/ruby/qtdesignerrubyintegration.h | 35 + languages/ruby/ruby_config.png | Bin 0 -> 12433 bytes languages/ruby/ruby_config.psd | Bin 0 -> 55515 bytes languages/ruby/ruby_run.png | Bin 0 -> 6986 bytes languages/ruby/rubyconfigwidget.cpp | 53 + languages/ruby/rubyconfigwidget.h | 27 + languages/ruby/rubyconfigwidgetbase.ui | 363 + languages/ruby/rubyimplementationwidget.cpp | 70 + languages/ruby/rubyimplementationwidget.h | 35 + languages/ruby/rubysupport_part.cpp | 908 ++ languages/ruby/rubysupport_part.h | 74 + languages/ruby/rubytemplates | 101 + languages/sql/Makefile.am | 20 + languages/sql/README.dox | 40 + languages/sql/app_templates/Makefile.am | 3 + languages/sql/app_templates/sql.appwizard | 2 + languages/sql/app_templates/sqlsimple/.kdev_ignore | 0 languages/sql/app_templates/sqlsimple/Makefile.am | 16 + languages/sql/app_templates/sqlsimple/app.kdevelop | 84 + languages/sql/app_templates/sqlsimple/app.sql | 1 + languages/sql/app_templates/sqlsimple/sqlsimple | 7 + .../app_templates/sqlsimple/sqlsimple.kdevtemplate | 106 + .../sql/app_templates/sqlsimple/sqlsimple.png | Bin 0 -> 483 bytes languages/sql/doc/Makefile.am | 6 + languages/sql/kdevsqlsupport.desktop | 85 + languages/sql/kdevsqlsupport.rc | 14 + languages/sql/sqlactions.cpp | 103 + languages/sql/sqlactions.h | 41 + languages/sql/sqlconfigwidget.ui | 189 + languages/sql/sqlconfigwidget.ui.h | 244 + languages/sql/sqloutputwidget.cpp | 127 + languages/sql/sqloutputwidget.h | 43 + languages/sql/sqlsupport_part.cpp | 284 + languages/sql/sqlsupport_part.h | 55 + lib/Makefile.am | 23 + lib/antlr/AUTHORS | 2 + lib/antlr/COPYING | 32 + lib/antlr/ChangeLog | 293 + lib/antlr/INSTALL | 183 + lib/antlr/Makefile.am | 1 + lib/antlr/NEWS | 0 lib/antlr/README | 72 + lib/antlr/TODO | 34 + lib/antlr/antlr/ANTLRException.hpp | 59 + lib/antlr/antlr/ANTLRUtil.hpp | 53 + lib/antlr/antlr/AST.hpp | 166 + lib/antlr/antlr/ASTArray.hpp | 45 + lib/antlr/antlr/ASTFactory.hpp | 165 + lib/antlr/antlr/ASTNULLType.hpp | 64 + lib/antlr/antlr/ASTPair.hpp | 57 + lib/antlr/antlr/ASTRefCount.hpp | 98 + lib/antlr/antlr/BaseAST.hpp | 193 + lib/antlr/antlr/BitSet.hpp | 60 + lib/antlr/antlr/CharBuffer.hpp | 56 + lib/antlr/antlr/CharInputBuffer.hpp | 77 + lib/antlr/antlr/CharScanner.hpp | 575 + lib/antlr/antlr/CharStreamException.hpp | 29 + lib/antlr/antlr/CharStreamIOException.hpp | 31 + lib/antlr/antlr/CircularQueue.hpp | 100 + lib/antlr/antlr/CommonAST.hpp | 110 + lib/antlr/antlr/CommonASTWithHiddenTokens.hpp | 60 + lib/antlr/antlr/CommonHiddenStreamToken.hpp | 41 + lib/antlr/antlr/CommonToken.hpp | 83 + lib/antlr/antlr/IOException.hpp | 45 + lib/antlr/antlr/InputBuffer.hpp | 146 + lib/antlr/antlr/LLkParser.hpp | 67 + lib/antlr/antlr/LexerSharedInputState.hpp | 156 + lib/antlr/antlr/Makefile.am | 2 + lib/antlr/antlr/MismatchedCharException.hpp | 102 + lib/antlr/antlr/MismatchedTokenException.hpp | 144 + lib/antlr/antlr/NoViableAltException.hpp | 40 + lib/antlr/antlr/NoViableAltForCharException.hpp | 41 + lib/antlr/antlr/Parser.hpp | 319 + lib/antlr/antlr/ParserSharedInputState.hpp | 92 + lib/antlr/antlr/RecognitionException.hpp | 66 + lib/antlr/antlr/RefCount.hpp | 80 + lib/antlr/antlr/SemanticException.hpp | 40 + lib/antlr/antlr/String.hpp | 27 + lib/antlr/antlr/Token.hpp | 108 + lib/antlr/antlr/TokenBuffer.hpp | 121 + lib/antlr/antlr/TokenRefCount.hpp | 98 + lib/antlr/antlr/TokenStream.hpp | 34 + lib/antlr/antlr/TokenStreamBasicFilter.hpp | 46 + lib/antlr/antlr/TokenStreamException.hpp | 41 + lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp | 95 + lib/antlr/antlr/TokenStreamIOException.hpp | 40 + .../antlr/TokenStreamRecognitionException.hpp | 57 + lib/antlr/antlr/TokenStreamRetryException.hpp | 28 + lib/antlr/antlr/TokenStreamRewriteEngine.hpp | 439 + lib/antlr/antlr/TokenStreamSelector.hpp | 87 + lib/antlr/antlr/TokenWithIndex.hpp | 84 + lib/antlr/antlr/TreeParser.hpp | 155 + lib/antlr/antlr/TreeParserSharedInputState.hpp | 45 + lib/antlr/antlr/config.hpp | 290 + lib/antlr/src/ANTLRUtil.cpp | 163 + lib/antlr/src/ASTFactory.cpp | 504 + lib/antlr/src/ASTNULLType.cpp | 157 + lib/antlr/src/ASTRefCount.cpp | 41 + lib/antlr/src/BaseAST.cpp | 281 + lib/antlr/src/BitSet.cpp | 62 + lib/antlr/src/CharBuffer.cpp | 52 + lib/antlr/src/CharScanner.cpp | 108 + lib/antlr/src/CommonAST.cpp | 49 + lib/antlr/src/CommonASTWithHiddenTokens.cpp | 64 + lib/antlr/src/CommonHiddenStreamToken.cpp | 56 + lib/antlr/src/CommonToken.cpp | 45 + lib/antlr/src/InputBuffer.cpp | 81 + lib/antlr/src/LLkParser.cpp | 85 + lib/antlr/src/Makefile.am | 10 + lib/antlr/src/MismatchedCharException.cpp | 120 + lib/antlr/src/MismatchedTokenException.cpp | 196 + lib/antlr/src/NoViableAltException.cpp | 52 + lib/antlr/src/NoViableAltForCharException.cpp | 39 + lib/antlr/src/Parser.cpp | 113 + lib/antlr/src/RecognitionException.cpp | 71 + lib/antlr/src/String.cpp | 90 + lib/antlr/src/Token.cpp | 80 + lib/antlr/src/TokenBuffer.cpp | 96 + lib/antlr/src/TokenRefCount.cpp | 41 + lib/antlr/src/TokenStreamBasicFilter.cpp | 44 + lib/antlr/src/TokenStreamHiddenTokenFilter.cpp | 156 + lib/antlr/src/TokenStreamRewriteEngine.cpp | 214 + lib/antlr/src/TokenStreamSelector.cpp | 107 + lib/antlr/src/TreeParser.cpp | 72 + lib/astyle/ASBeautifier.cpp | 1933 +++ lib/astyle/ASEnhancer.cpp | 483 + lib/astyle/ASFormatter.cpp | 2197 ++++ lib/astyle/ASResource.cpp | 389 + lib/astyle/Makefile.am | 4 + lib/astyle/astyle.h | 497 + lib/astyle/compiler_defines.h | 49 + lib/catalog/Mainpage.dox | 10 + lib/catalog/Makefile.am | 13 + lib/catalog/catalog.cpp | 462 + lib/catalog/catalog.h | 80 + lib/catalog/tag.cpp | 127 + lib/catalog/tag.h | 309 + lib/cppparser/Makefile.am | 11 + lib/cppparser/ast.cpp | 1262 ++ lib/cppparser/ast.h | 1578 +++ lib/cppparser/cachemanager.cpp | 89 + lib/cppparser/cachemanager.h | 102 + lib/cppparser/driver.cpp | 965 ++ lib/cppparser/driver.h | 460 + lib/cppparser/errors.cpp | 25 + lib/cppparser/errors.h | 45 + lib/cppparser/keywords.h | 95 + lib/cppparser/lexer.cpp | 1032 ++ lib/cppparser/lexer.h | 867 ++ lib/cppparser/lexercache.cpp | 249 + lib/cppparser/lexercache.h | 162 + lib/cppparser/lookup.cpp | 42 + lib/cppparser/lookup.h | 45 + lib/cppparser/macro.h | 452 + lib/cppparser/parser.cpp | 4330 +++++++ lib/cppparser/parser.h | 459 + lib/cppparser/tree_parser.cpp | 212 + lib/cppparser/tree_parser.h | 60 + lib/dummy.cpp | 1 + lib/interfaces/KDevCoreIface.cpp | 59 + lib/interfaces/KDevCoreIface.h | 51 + lib/interfaces/KDevPartControllerIface.cpp | 95 + lib/interfaces/KDevPartControllerIface.h | 63 + lib/interfaces/Mainpage.dox | 10 + lib/interfaces/Makefile.am | 40 + lib/interfaces/codemodel.cpp | 1823 +++ lib/interfaces/codemodel.h | 1612 +++ lib/interfaces/codemodel_treeparser.cpp | 108 + lib/interfaces/codemodel_treeparser.h | 85 + lib/interfaces/codemodel_utils.cpp | 747 ++ lib/interfaces/codemodel_utils.h | 570 + lib/interfaces/extensions/Mainpage.dox | 61 + lib/interfaces/extensions/Makefile.am | 23 + lib/interfaces/extensions/codebrowserfrontend.h | 40 + .../extensions/dcop/KDevAppFrontendIface.cpp | 76 + .../extensions/dcop/KDevAppFrontendIface.h | 52 + .../extensions/dcop/KDevMakeFrontendIface.cpp | 46 + .../extensions/dcop/KDevMakeFrontendIface.h | 45 + lib/interfaces/extensions/dcop/Makefile.am | 10 + lib/interfaces/extensions/kdevappfrontend.cpp | 2 + lib/interfaces/extensions/kdevappfrontend.h | 115 + lib/interfaces/extensions/kdevcreatefile.h | 146 + lib/interfaces/extensions/kdevdifffrontend.cpp | 33 + lib/interfaces/extensions/kdevdifffrontend.h | 79 + .../extensions/kdevelopappfrontend.desktop | 38 + .../extensions/kdevelopcodebrowserfrontend.desktop | 28 + .../extensions/kdevelopcreatefile.desktop | 38 + .../extensions/kdevelopdifffrontend.desktop | 41 + .../extensions/kdevelopmakefrontend.desktop | 41 + .../extensions/kdevelopquickopen.desktop | 58 + .../extensions/kdevelopsourceformatter.desktop | 39 + .../extensions/kdevelopversioncontrol.desktop | 40 + lib/interfaces/extensions/kdevmakefrontend.cpp | 2 + lib/interfaces/extensions/kdevmakefrontend.h | 106 + lib/interfaces/extensions/kdevquickopen.h | 130 + lib/interfaces/extensions/kdevsourceformatter.h | 69 + lib/interfaces/extensions/kdevversioncontrol.h | 237 + lib/interfaces/external/Mainpage.dox | 57 + lib/interfaces/external/Makefile.am | 15 + lib/interfaces/external/designer.cpp | 30 + lib/interfaces/external/designer.h | 98 + lib/interfaces/extras/Mainpage.dox | 11 + lib/interfaces/extras/Makefile.am | 18 + lib/interfaces/extras/kdevcompileroptions.cpp | 6 + lib/interfaces/extras/kdevcompileroptions.h | 90 + .../extras/kdevelopcompileroptions.desktop | 48 + .../extras/kdevelopvcsintegrator.desktop | 45 + lib/interfaces/extras/kdevvcsintegrator.cpp | 26 + lib/interfaces/extras/kdevvcsintegrator.h | 76 + lib/interfaces/hashedstring.cpp | 362 + lib/interfaces/hashedstring.h | 155 + lib/interfaces/katedocumentmanagerinterface.cpp | 104 + lib/interfaces/katedocumentmanagerinterface.h | 58 + lib/interfaces/kdevapi.cpp | 93 + lib/interfaces/kdevapi.h | 103 + lib/interfaces/kdevcoderepository.cpp | 71 + lib/interfaces/kdevcoderepository.h | 94 + lib/interfaces/kdevcore.cpp | 298 + lib/interfaces/kdevcore.h | 387 + lib/interfaces/kdevdesignerintegration.cpp | 40 + lib/interfaces/kdevdesignerintegration.h | 97 + lib/interfaces/kdevdesignerintegrationiface.cpp | 63 + lib/interfaces/kdevdesignerintegrationiface.h | 49 + lib/interfaces/kdeveloplanguagesupport.desktop | 41 + lib/interfaces/kdevelopplugin.desktop | 75 + lib/interfaces/kdevelopproject.desktop | 40 + lib/interfaces/kdevgenericfactory.h | 91 + lib/interfaces/kdevlanguagesupport.cpp | 166 + lib/interfaces/kdevlanguagesupport.h | 260 + lib/interfaces/kdevmainwindow.cpp | 28 + lib/interfaces/kdevmainwindow.h | 101 + lib/interfaces/kdevpartcontroller.cpp | 30 + lib/interfaces/kdevpartcontroller.h | 175 + lib/interfaces/kdevplugin.cpp | 139 + lib/interfaces/kdevplugin.h | 200 + lib/interfaces/kdevplugincontroller.cpp | 49 + lib/interfaces/kdevplugincontroller.h | 118 + lib/interfaces/kdevplugininfo.cpp | 181 + lib/interfaces/kdevplugininfo.h | 111 + lib/interfaces/kdevproject.cpp | 164 + lib/interfaces/kdevproject.h | 218 + lib/interfaces/kdevprojectiface.cpp | 186 + lib/interfaces/kdevprojectiface.h | 81 + lib/util/Mainpage.dox | 10 + lib/util/Makefile.am | 21 + lib/util/blockingkprocess.cpp | 105 + lib/util/blockingkprocess.h | 92 + lib/util/configwidgetproxy.cpp | 105 + lib/util/configwidgetproxy.h | 129 + lib/util/domutil.cpp | 367 + lib/util/domutil.h | 226 + lib/util/execcommand.cpp | 101 + lib/util/execcommand.h | 70 + lib/util/filetemplate.cpp | 128 + lib/util/filetemplate.h | 88 + lib/util/kdeveditorutil.cpp | 89 + lib/util/kdeveditorutil.h | 67 + lib/util/kdevjobtimer.cpp | 39 + lib/util/kdevjobtimer.h | 39 + lib/util/kdevshellwidget.cpp | 125 + lib/util/kdevshellwidget.h | 100 + lib/util/kscriptactionmanager.cpp | 177 + lib/util/kscriptactionmanager.h | 139 + lib/util/rurl.cpp | 369 + lib/util/rurl.h | 182 + lib/util/settings.cpp | 63 + lib/util/settings.h | 26 + lib/util/urlutil.cpp | 319 + lib/util/urlutil.h | 190 + lib/widgets/Mainpage.dox | 10 + lib/widgets/Makefile.am | 30 + lib/widgets/fancylistviewitem.cpp | 203 + lib/widgets/fancylistviewitem.h | 162 + lib/widgets/flagboxes.cpp | 643 + lib/widgets/flagboxes.h | 283 + lib/widgets/kcomboview.cpp | 101 + lib/widgets/kcomboview.h | 80 + lib/widgets/kdevhtml_partui.rc | 18 + lib/widgets/kdevhtmlpart.cpp | 512 + lib/widgets/kdevhtmlpart.h | 111 + lib/widgets/kdevtabwidget.cpp | 66 + lib/widgets/klistviewaction.cpp | 86 + lib/widgets/klistviewaction.h | 56 + lib/widgets/ksavealldialog.cpp | 189 + lib/widgets/ksavealldialog.h | 83 + lib/widgets/processlinemaker.cpp | 93 + lib/widgets/processlinemaker.h | 67 + lib/widgets/processwidget.cpp | 283 + lib/widgets/processwidget.h | 127 + lib/widgets/propeditor/Mainpage.dox | 116 + lib/widgets/propeditor/Makefile.am | 18 + lib/widgets/propeditor/childproperty.cpp | 145 + lib/widgets/propeditor/childproperty.h | 83 + lib/widgets/propeditor/compat_tools.h | 6 + lib/widgets/propeditor/multiproperty.cpp | 273 + lib/widgets/propeditor/multiproperty.h | 126 + lib/widgets/propeditor/pcheckbox.cpp | 76 + lib/widgets/propeditor/pcheckbox.h | 54 + lib/widgets/propeditor/pcolorbutton.cpp | 120 + lib/widgets/propeditor/pcolorbutton.h | 62 + lib/widgets/propeditor/pcolorcombo.cpp | 78 + lib/widgets/propeditor/pcolorcombo.h | 54 + lib/widgets/propeditor/pcombobox.cpp | 110 + lib/widgets/propeditor/pcombobox.h | 72 + lib/widgets/propeditor/pcursoredit.cpp | 41 + lib/widgets/propeditor/pcursoredit.h | 42 + lib/widgets/propeditor/pdateedit.cpp | 70 + lib/widgets/propeditor/pdateedit.h | 51 + lib/widgets/propeditor/pdatetimeedit.cpp | 69 + lib/widgets/propeditor/pdatetimeedit.h | 52 + lib/widgets/propeditor/pdoublenuminput.cpp | 94 + lib/widgets/propeditor/pdoublenuminput.h | 64 + lib/widgets/propeditor/pdummywidget.cpp | 54 + lib/widgets/propeditor/pdummywidget.h | 60 + lib/widgets/propeditor/pfontbutton.cpp | 86 + lib/widgets/propeditor/pfontbutton.h | 52 + lib/widgets/propeditor/pfontcombo.cpp | 86 + lib/widgets/propeditor/pfontcombo.h | 56 + lib/widgets/propeditor/plineedit.cpp | 61 + lib/widgets/propeditor/plineedit.h | 52 + lib/widgets/propeditor/plinestyleedit.cpp | 205 + lib/widgets/propeditor/plinestyleedit.h | 50 + lib/widgets/propeditor/ppixmapedit.cpp | 149 + lib/widgets/propeditor/ppixmapedit.h | 57 + lib/widgets/propeditor/ppointedit.cpp | 64 + lib/widgets/propeditor/ppointedit.h | 50 + lib/widgets/propeditor/prectedit.cpp | 64 + lib/widgets/propeditor/prectedit.h | 50 + lib/widgets/propeditor/property.cpp | 129 + lib/widgets/propeditor/property.h | 181 + lib/widgets/propeditor/propertyeditor.cpp | 480 + lib/widgets/propeditor/propertyeditor.h | 129 + lib/widgets/propeditor/propertyeditor.pro | 40 + lib/widgets/propeditor/propertylist.cpp | 369 + lib/widgets/propeditor/propertylist.h | 200 + lib/widgets/propeditor/propertymachinefactory.cpp | 207 + lib/widgets/propeditor/propertymachinefactory.h | 97 + lib/widgets/propeditor/propertywidget.cpp | 64 + lib/widgets/propeditor/propertywidget.h | 88 + lib/widgets/propeditor/propertywidgetproxy.cpp | 106 + lib/widgets/propeditor/propertywidgetproxy.h | 81 + lib/widgets/propeditor/psizeedit.cpp | 65 + lib/widgets/propeditor/psizeedit.h | 51 + lib/widgets/propeditor/psizepolicyedit.cpp | 77 + lib/widgets/propeditor/psizepolicyedit.h | 54 + lib/widgets/propeditor/pspinbox.cpp | 73 + lib/widgets/propeditor/pspinbox.h | 53 + lib/widgets/propeditor/pstringlistedit.cpp | 121 + lib/widgets/propeditor/pstringlistedit.h | 62 + lib/widgets/propeditor/psymbolcombo.cpp | 131 + lib/widgets/propeditor/psymbolcombo.h | 62 + lib/widgets/propeditor/purledit.cpp | 97 + lib/widgets/propeditor/purledit.h | 70 + lib/widgets/propeditor/pyesnobutton.cpp | 76 + lib/widgets/propeditor/pyesnobutton.h | 51 + lib/widgets/propeditor/qeditlistbox.cpp | 401 + lib/widgets/propeditor/qeditlistbox.h | 255 + lib/widgets/propeditor/qfloatinput.cpp | 51 + lib/widgets/propeditor/qfloatinput.h | 48 + lib/widgets/propeditor/test.cpp | 86 + lib/widgets/propeditor/test.pro | 40 + lib/widgets/propeditor/undo.xpm | 44 + lib/widgets/qcomboview.cpp | 1505 +++ lib/widgets/qcomboview.h | 172 + lib/widgets/resizablecombo.cpp | 98 + lib/widgets/resizablecombo.h | 72 + lib/widgets/sticky.xpm | 13 + mimetypes/Makefile.am | 5 + mimetypes/chm.desktop | 33 + mimetypes/x-fortran.desktop | 46 + parts/Makefile.am | 11 + parts/abbrev/Makefile.am | 20 + parts/abbrev/README.dox | 20 + parts/abbrev/abbrevconfigwidget.cpp | 121 + parts/abbrev/abbrevconfigwidget.h | 43 + parts/abbrev/abbrevconfigwidgetbase.ui | 190 + parts/abbrev/abbrevpart.cpp | 696 ++ parts/abbrev/abbrevpart.h | 113 + parts/abbrev/addtemplatedlg.cpp | 59 + parts/abbrev/addtemplatedlg.h | 41 + parts/abbrev/addtemplatedlgbase.ui | 176 + parts/abbrev/cpp_keywords | 84 + parts/abbrev/kdevabbrev.desktop | 83 + parts/abbrev/kdevabbrev.rc | 10 + parts/abbrev/qt_classes | 409 + parts/appwizard/Makefile.am | 28 + parts/appwizard/README | 1 + parts/appwizard/README.dox | 80 + parts/appwizard/appwizarddlg.cpp | 1374 +++ parts/appwizard/appwizarddlg.h | 209 + parts/appwizard/appwizarddlgbase.ui | 659 + parts/appwizard/appwizardfactory.cpp | 41 + parts/appwizard/appwizardfactory.h | 32 + parts/appwizard/appwizardpart.cpp | 98 + parts/appwizard/appwizardpart.h | 45 + parts/appwizard/common/Artistic | 124 + parts/appwizard/common/COPYING | 340 + parts/appwizard/common/COPYING.LIB | 481 + parts/appwizard/common/LICENSE.BSD | 20 + parts/appwizard/common/LICENSE.QPL | 103 + parts/appwizard/common/Makefile.am | 46 + parts/appwizard/common/admin.kdevtemplate | 5 + parts/appwizard/common/dockbook.kdevtemplate | 64 + parts/appwizard/common/gnome-Makefile.am | 16 + parts/appwizard/common/gnome-Makefile.cvs | 5 + parts/appwizard/common/gnome-app.lsm | 15 + parts/appwizard/common/gnome-app.png | Bin 0 -> 3388 bytes parts/appwizard/common/gnome-pixmaps-Makefile.am | 8 + parts/appwizard/common/gnome/macros/ChangeLog | 859 ++ .../common/gnome/macros/aclocal-include.m4 | 16 + parts/appwizard/common/gnome/macros/autogen.sh | 145 + .../common/gnome/macros/compiler-flags.m4 | 109 + parts/appwizard/common/gnome/macros/curses.m4 | 318 + .../common/gnome/macros/gnome-Makefile.am | 40 + .../common/gnome/macros/gnome-bonobo-check.m4 | 150 + .../appwizard/common/gnome/macros/gnome-common.m4 | 14 + .../common/gnome/macros/gnome-fileutils.m4 | 414 + .../appwizard/common/gnome/macros/gnome-gettext.m4 | 336 + .../common/gnome/macros/gnome-ghttp-check.m4 | 14 + .../common/gnome/macros/gnome-gnorba-check.m4 | 35 + .../common/gnome/macros/gnome-guile-checks.m4 | 119 + .../common/gnome/macros/gnome-libgtop-check.m4 | 182 + .../common/gnome/macros/gnome-objc-checks.m4 | 79 + .../common/gnome/macros/gnome-orbit-check.m4 | 33 + .../common/gnome/macros/gnome-print-check.m4 | 171 + .../common/gnome/macros/gnome-pthread-check.m4 | 16 + .../appwizard/common/gnome/macros/gnome-support.m4 | 68 + .../appwizard/common/gnome/macros/gnome-undelfs.m4 | 20 + parts/appwizard/common/gnome/macros/gnome-vfs.m4 | 120 + .../common/gnome/macros/gnome-x-checks.m4 | 80 + .../common/gnome/macros/gnome-xml-check.m4 | 30 + parts/appwizard/common/gnome/macros/gnome.m4 | 124 + parts/appwizard/common/gnome/macros/linger.m4 | 28 + .../common/gnome/macros/need-declaration.m4 | 42 + parts/appwizard/common/gnome2.kdevtemplate | 5 + .../common/gnome2/macros/aclocal-include.m4 | 16 + parts/appwizard/common/gnome2/macros/autogen.sh | 384 + .../common/gnome2/macros/compiler-flags.m4 | 141 + parts/appwizard/common/gnome2/macros/curses.m4 | 318 + .../appwizard/common/gnome2/macros/gnome-common.m4 | 30 + .../gnome2/macros/gnome-deprecated-macros.m4 | 32 + .../common/gnome2/macros/gnome2-macros.dep | 1 + parts/appwizard/common/gnu.kdevtemplate | 5 + parts/appwizard/common/gnu/AUTHORS | 1 + parts/appwizard/common/gnu/COPYING | 340 + parts/appwizard/common/gnu/ChangeLog | 0 parts/appwizard/common/gnu/INSTALL | 167 + parts/appwizard/common/gnu/NEWS | 0 parts/appwizard/common/gnu/README | 0 parts/appwizard/common/gnu/TODO | 0 parts/appwizard/common/hi16-app-app.png | Bin 0 -> 1033 bytes parts/appwizard/common/hi32-app-app.png | Bin 0 -> 2749 bytes parts/appwizard/common/incadmin.kdevtemplate | 5 + parts/appwizard/common/incadmin/config.guess | 1363 ++ parts/appwizard/common/incadmin/config.sub | 1470 +++ parts/appwizard/common/incadmin/depcomp | 441 + parts/appwizard/common/incadmin/install-sh | 276 + parts/appwizard/common/incadmin/ltmain.sh | 6343 ++++++++++ parts/appwizard/common/incadmin/missing | 336 + parts/appwizard/common/incadmin/mkinstalldirs | 111 + parts/appwizard/common/kde-Makefile.am | 22 + parts/appwizard/common/kde-Makefile.cvs | 10 + parts/appwizard/common/kde-app.desktop | 44 + parts/appwizard/common/kde-app.lsm | 16 + parts/appwizard/common/kde-configure.in.in | 6 + parts/appwizard/common/kde-doc-Makefile.am | 6 + parts/appwizard/common/kde-doc-en-Makefile.am | 2 + parts/appwizard/common/kde-index.docbook | 555 + parts/appwizard/common/kde-part.desktop | 18 + parts/appwizard/common/kde-po-Makefile.am | 1 + parts/appwizard/common/scons.kdevtemplate | 5 + parts/appwizard/common/scons/admin/generic.py | 194 + parts/appwizard/common/scons/admin/kde.py | 856 ++ .../common/scons/admin/scons-mini.tar.bz2 | Bin 0 -> 58214 bytes parts/appwizard/common/scons/configure | 87 + parts/appwizard/common/wx-Makefile.am | 1 + parts/appwizard/common/wx-Makefile.cvs | 5 + parts/appwizard/common/wx-configure.in | 55 + parts/appwizard/common/wx/macros/autogen.sh | 6 + parts/appwizard/filepropspage.cpp | 88 + parts/appwizard/filepropspage.h | 42 + parts/appwizard/filepropspagebase.ui | 168 + parts/appwizard/importdlg.cpp | 582 + parts/appwizard/importdlg.h | 64 + parts/appwizard/importdlgbase.ui | 365 + parts/appwizard/imports/.kdev_ignore | 0 parts/appwizard/imports/Makefile.am | 7 + parts/appwizard/imports/ada | 5 + parts/appwizard/imports/ada.kdevelop | 73 + parts/appwizard/imports/c | 4 + parts/appwizard/imports/c-auto | 8 + parts/appwizard/imports/c-auto.kdevelop | 96 + parts/appwizard/imports/c.kdevelop | 76 + parts/appwizard/imports/cpp | 4 + parts/appwizard/imports/cpp-auto | 8 + parts/appwizard/imports/cpp-auto.kdevelop | 93 + parts/appwizard/imports/cpp.kdevelop | 75 + parts/appwizard/imports/fortran | 4 + parts/appwizard/imports/fortran-auto | 8 + parts/appwizard/imports/fortran-auto.kdevelop | 71 + parts/appwizard/imports/fortran.kdevelop | 75 + parts/appwizard/imports/gnome | 4 + parts/appwizard/imports/gnome.kdevelop | 100 + parts/appwizard/imports/java | 4 + parts/appwizard/imports/java-ant | 4 + parts/appwizard/imports/java-ant.kdevelop | 68 + parts/appwizard/imports/java-auto | 8 + parts/appwizard/imports/java-auto.kdevelop | 63 + parts/appwizard/imports/java.kdevelop | 63 + parts/appwizard/imports/kde | 5 + parts/appwizard/imports/kde.kdevelop | 73 + parts/appwizard/imports/pascal | 4 + parts/appwizard/imports/pascal.kdevelop | 75 + parts/appwizard/imports/perl | 4 + parts/appwizard/imports/perl.kdevelop | 69 + parts/appwizard/imports/php | 4 + parts/appwizard/imports/php.kdevelop | 84 + parts/appwizard/imports/python | 4 + parts/appwizard/imports/python.kdevelop | 69 + parts/appwizard/imports/qt | 4 + parts/appwizard/imports/qt-auto | 4 + parts/appwizard/imports/qt-auto.kdevelop | 43 + parts/appwizard/imports/qt.kdevelop | 38 + parts/appwizard/imports/qt4qmake | 4 + parts/appwizard/imports/qt4qmake.kdevelop | 80 + parts/appwizard/imports/qtqmake | 9 + parts/appwizard/imports/qtqmake.kdevelop | 79 + parts/appwizard/imports/qttmake | 4 + parts/appwizard/imports/qttmake.kdevelop | 74 + parts/appwizard/imports/ruby | 4 + parts/appwizard/imports/ruby.kdevelop | 82 + parts/appwizard/kdevappwizard.desktop | 87 + parts/appwizard/kdevappwizard.rc | 10 + parts/appwizard/kdevfile.cpp | 59 + parts/appwizard/kdevfile.h | 57 + parts/appwizard/kdevlicense.cpp | 116 + parts/appwizard/kdevlicense.h | 75 + parts/appwizard/licenses/BSD | 22 + parts/appwizard/licenses/GPL | 18 + parts/appwizard/licenses/GPL+Qt-Exception | 29 + parts/appwizard/licenses/LGPL | 18 + parts/appwizard/licenses/MIT | 21 + parts/appwizard/licenses/Makefile.am | 6 + parts/appwizard/licenses/NCSA | 24 + parts/appwizard/licenses/QPL | 11 + parts/appwizard/misc.cpp | 56 + parts/appwizard/misc.h | 23 + parts/appwizard/profilesupport.cpp | 44 + parts/appwizard/profilesupport.h | 34 + parts/appwizard/vcs_form.ui | 84 + parts/astyle/Makefile.am | 16 + parts/astyle/README.dox | 10 + parts/astyle/astyle_adaptor.cpp | 270 + parts/astyle/astyle_adaptor.h | 55 + parts/astyle/astyle_part.cpp | 541 + parts/astyle/astyle_part.h | 76 + parts/astyle/astyle_widget.cpp | 346 + parts/astyle/astyle_widget.h | 36 + parts/astyle/astyleconfig.ui | 1332 ++ parts/astyle/kdevastyle.desktop | 82 + parts/astyle/kdevpart_astyle.rc | 17 + parts/bookmarks/Makefile.am | 14 + parts/bookmarks/README | 1 + parts/bookmarks/README.dox | 20 + parts/bookmarks/bookmarks_config.cpp | 138 + parts/bookmarks/bookmarks_config.h | 53 + parts/bookmarks/bookmarks_part.cpp | 568 + parts/bookmarks/bookmarks_part.h | 109 + parts/bookmarks/bookmarks_settings.cpp | 66 + parts/bookmarks/bookmarks_settings.h | 41 + parts/bookmarks/bookmarks_settings_base.ui | 240 + parts/bookmarks/bookmarks_widget.cpp | 336 + parts/bookmarks/bookmarks_widget.h | 72 + parts/bookmarks/kdevbookmarks.desktop | 85 + parts/classview/Makefile.am | 27 + parts/classview/README.dox | 53 + parts/classview/classtooldlg.cpp | 373 + parts/classview/classtooldlg.h | 98 + parts/classview/classtoolwidget.cpp | 159 + parts/classview/classtoolwidget.h | 41 + parts/classview/classtreebase.cpp | 637 + parts/classview/classtreebase.h | 242 + parts/classview/classviewpart.cpp | 279 + parts/classview/classviewpart.h | 99 + parts/classview/classviewwidget.cpp | 1295 ++ parts/classview/classviewwidget.h | 414 + parts/classview/digraphview.cpp | 414 + parts/classview/digraphview.h | 66 + parts/classview/hierarchydlg.cpp | 276 + parts/classview/hierarchydlg.h | 61 + parts/classview/kdevclassview.desktop | 82 + parts/classview/kdevclassview.rc | 20 + parts/classview/navigator.cpp | 539 + parts/classview/navigator.h | 91 + parts/classview/viewcombos.cpp | 214 + parts/classview/viewcombos.h | 84 + parts/ctags2/Makefile.am | 22 + parts/ctags2/README.dox | 16 + parts/ctags2/ctags2_createtagfile.cpp | 53 + parts/ctags2/ctags2_createtagfile.h | 36 + parts/ctags2/ctags2_createtagfilebase.ui | 151 + parts/ctags2/ctags2_part.cpp | 371 + parts/ctags2/ctags2_part.h | 69 + parts/ctags2/ctags2_selecttagfile.cpp | 47 + parts/ctags2/ctags2_selecttagfile.h | 33 + parts/ctags2/ctags2_selecttagfilebase.ui | 128 + parts/ctags2/ctags2_settingswidget.cpp | 173 + parts/ctags2/ctags2_settingswidget.h | 69 + parts/ctags2/ctags2_settingswidgetbase.ui | 382 + parts/ctags2/ctags2_widget.cpp | 199 + parts/ctags2/ctags2_widget.h | 56 + parts/ctags2/ctags2_widgetbase.ui | 181 + parts/ctags2/ctagskinds.cpp | 306 + parts/ctags2/ctagskinds.h | 24 + parts/ctags2/kdevctags2.desktop | 82 + parts/ctags2/kdevpart_ctags2.rc | 12 + parts/ctags2/readtags.c | 960 ++ parts/ctags2/readtags.h | 251 + parts/ctags2/tagitem.cpp | 23 + parts/ctags2/tagitem.h | 29 + parts/ctags2/tags.cpp | 171 + parts/ctags2/tags.h | 74 + parts/diff/Makefile.am | 18 + parts/diff/README | 3 + parts/diff/README.dox | 20 + parts/diff/diffdlg.cpp | 48 + parts/diff/diffdlg.h | 41 + parts/diff/diffpart.cpp | 248 + parts/diff/diffpart.h | 59 + parts/diff/diffwidget.cpp | 348 + parts/diff/diffwidget.h | 107 + parts/diff/kdevdiff.desktop | 84 + parts/diff/kdevdiff.rc | 9 + parts/distpart/Makefile.am | 16 + parts/distpart/README | 3 + parts/distpart/README.dox | 24 + parts/distpart/distpart_part.cpp | 84 + parts/distpart/distpart_part.h | 55 + parts/distpart/distpart_ui.ui | 1243 ++ parts/distpart/distpart_widget.cpp | 605 + parts/distpart/distpart_widget.h | 210 + parts/distpart/kdevdistpart.desktop | 70 + parts/distpart/kdevpart_distpart.rc | 8 + parts/distpart/lsmsupport.cpp | 32 + parts/distpart/lsmsupport.h | 35 + parts/distpart/packagebase.cpp | 117 + parts/distpart/packagebase.h | 84 + parts/distpart/specsupport.cpp | 315 + parts/distpart/specsupport.h | 54 + parts/documentation/KDevDocumentationIface.cpp | 83 + parts/documentation/KDevDocumentationIface.h | 52 + parts/documentation/Makefile.am | 32 + parts/documentation/README.dox | 21 + parts/documentation/addcatalogdlg.cpp | 112 + parts/documentation/addcatalogdlg.h | 53 + parts/documentation/addcatalogdlgbase.ui | 209 + parts/documentation/bookmarkview.cpp | 285 + parts/documentation/bookmarkview.h | 82 + parts/documentation/contentsview.cpp | 92 + parts/documentation/contentsview.h | 53 + parts/documentation/data/Makefile.am | 6 + parts/documentation/data/checked.xpm | 23 + parts/documentation/data/htdig.png | Bin 0 -> 2857 bytes parts/documentation/data/long.html | 6 + parts/documentation/data/nomatch.html | 21 + parts/documentation/data/short.html | 1 + parts/documentation/data/star.png | Bin 0 -> 195 bytes parts/documentation/data/star_blank.png | Bin 0 -> 151 bytes parts/documentation/data/syntax.html | 19 + parts/documentation/data/unchecked.xpm | 22 + parts/documentation/data/wrapper.html | 16 + parts/documentation/docconfiglistview.cpp | 72 + parts/documentation/docconfiglistview.h | 36 + parts/documentation/docglobalconfigwidget.cpp | 259 + parts/documentation/docglobalconfigwidget.h | 67 + parts/documentation/docglobalconfigwidgetbase.ui | 572 + parts/documentation/docprojectconfigwidget.cpp | 146 + parts/documentation/docprojectconfigwidget.h | 41 + parts/documentation/docprojectconfigwidgetbase.ui | 152 + parts/documentation/documentation_part.cpp | 766 ++ parts/documentation/documentation_part.h | 121 + parts/documentation/documentation_widget.cpp | 142 + parts/documentation/documentation_widget.h | 75 + parts/documentation/docutils.cpp | 100 + parts/documentation/docutils.h | 51 + parts/documentation/editbookmarkdlg.ui | 165 + parts/documentation/editcatalogdlg.cpp | 79 + parts/documentation/editcatalogdlg.h | 56 + parts/documentation/editcatalogdlgbase.ui | 196 + parts/documentation/find_documentation.cpp | 347 + parts/documentation/find_documentation.h | 81 + parts/documentation/find_documentation_options.cpp | 192 + parts/documentation/find_documentation_options.h | 66 + .../find_documentation_optionsbase.ui | 218 + parts/documentation/find_documentationbase.ui | 167 + parts/documentation/indexview.cpp | 190 + parts/documentation/indexview.h | 64 + parts/documentation/interfaces/Mainpage.dox | 10 + parts/documentation/interfaces/Makefile.am | 16 + .../interfaces/kdevdocumentationplugin.cpp | 721 ++ .../interfaces/kdevdocumentationplugin.h | 421 + .../kdevelopdocumentationplugins.desktop | 36 + parts/documentation/kdevdocumentation.desktop | 82 + parts/documentation/kdevpart_documentation.rc | 19 + parts/documentation/plugins/Makefile.am | 3 + parts/documentation/plugins/chm/Makefile.am | 14 + parts/documentation/plugins/chm/docchmplugin.cpp | 198 + .../documentation/plugins/chm/docchmplugin.desktop | 44 + parts/documentation/plugins/chm/docchmplugin.h | 50 + parts/documentation/plugins/custom/Makefile.am | 10 + .../plugins/custom/doccustomplugin.cpp | 106 + .../plugins/custom/doccustomplugin.desktop | 44 + .../documentation/plugins/custom/doccustomplugin.h | 50 + parts/documentation/plugins/devhelp/Makefile.am | 14 + .../plugins/devhelp/docdevhelpplugin.cpp | 386 + .../plugins/devhelp/docdevhelpplugin.desktop | 44 + .../plugins/devhelp/docdevhelpplugin.h | 60 + parts/documentation/plugins/djvu/Makefile.am | 8 + parts/documentation/plugins/djvu/docdjvuplugin.cpp | 103 + .../plugins/djvu/docdjvuplugin.desktop | 44 + parts/documentation/plugins/djvu/docdjvuplugin.h | 50 + parts/documentation/plugins/doxygen/Makefile.am | 13 + .../plugins/doxygen/docdoxygenplugin.cpp | 529 + .../plugins/doxygen/docdoxygenplugin.desktop | 45 + .../plugins/doxygen/docdoxygenplugin.h | 75 + parts/documentation/plugins/kdevtoc/Makefile.am | 10 + .../plugins/kdevtoc/dockdevtocplugin.cpp | 277 + .../plugins/kdevtoc/dockdevtocplugin.desktop | 43 + .../plugins/kdevtoc/dockdevtocplugin.h | 54 + parts/documentation/plugins/pdb/Makefile.am | 8 + parts/documentation/plugins/pdb/docpdbplugin.cpp | 103 + .../documentation/plugins/pdb/docpdbplugin.desktop | 43 + parts/documentation/plugins/pdb/docpdbplugin.h | 50 + parts/documentation/plugins/pdf/Makefile.am | 8 + parts/documentation/plugins/pdf/docpdfplugin.cpp | 103 + .../documentation/plugins/pdf/docpdfplugin.desktop | 43 + parts/documentation/plugins/pdf/docpdfplugin.h | 50 + parts/documentation/plugins/qt/Makefile.am | 14 + parts/documentation/plugins/qt/docqtplugin.cpp | 339 + parts/documentation/plugins/qt/docqtplugin.desktop | 44 + parts/documentation/plugins/qt/docqtplugin.h | 56 + parts/documentation/protocols/Makefile.am | 4 + parts/documentation/protocols/chm/Makefile.am | 21 + parts/documentation/protocols/chm/chm.cpp | 362 + parts/documentation/protocols/chm/chm.h | 47 + parts/documentation/protocols/chm/chm.protocol | 36 + parts/documentation/protocols/chm/chmfile.cpp | 197 + parts/documentation/protocols/chm/chmfile.h | 53 + parts/documentation/protocols/chm/decompress.cpp | 796 ++ parts/documentation/protocols/chm/decompress.h | 43 + parts/documentation/protocols/chm/kchmpart.cpp | 123 + parts/documentation/protocols/chm/kchmpart.desktop | 46 + parts/documentation/protocols/chm/kchmpart.h | 82 + parts/documentation/searchview.cpp | 330 + parts/documentation/searchview.h | 75 + parts/documentation/selecttopic.cpp | 49 + parts/documentation/selecttopic.h | 40 + parts/documentation/selecttopicbase.ui | 142 + parts/documentation/tools/Makefile.am | 3 + parts/documentation/tools/htdig/Makefile.am | 6 + parts/documentation/tools/htdig/htdigindex.cpp | 491 + parts/documentation/tools/htdig/htdigindex.h | 68 + parts/doxygen/Makefile.am | 19 + parts/doxygen/README | 1 + parts/doxygen/README.dox | 75 + parts/doxygen/config.cpp | 5166 ++++++++ parts/doxygen/config.h | 579 + parts/doxygen/doxygenconfigwidget.cpp | 275 + parts/doxygen/doxygenconfigwidget.h | 54 + parts/doxygen/doxygenpart.cpp | 564 + parts/doxygen/doxygenpart.h | 113 + parts/doxygen/input.cpp | 499 + parts/doxygen/input.h | 173 + parts/doxygen/kdevdoxygen.desktop | 81 + parts/doxygen/kdevdoxygen.rc | 14 + parts/doxygen/lang_cfg.h | 34 + parts/doxygen/messages.cpp | 301 + parts/doxygen/messages.h | 11 + parts/doxygen/version.cpp | 1 + parts/doxygen/version.h | 23 + parts/filecreate/Makefile.am | 23 + parts/filecreate/README | 3 + parts/filecreate/README.dox | 76 + parts/filecreate/addglobaldlg.cpp | 106 + parts/filecreate/addglobaldlg.h | 44 + parts/filecreate/fcconfigwidget.cpp | 709 ++ parts/filecreate/fcconfigwidget.h | 72 + parts/filecreate/fcconfigwidgetbase.ui | 540 + parts/filecreate/fctemplateedit.cpp | 36 + parts/filecreate/fctemplateedit.h | 30 + parts/filecreate/fctemplateeditbase.ui | 193 + parts/filecreate/fctemplateeditbase.ui.h | 26 + parts/filecreate/fctypeedit.cpp | 40 + parts/filecreate/fctypeedit.h | 30 + parts/filecreate/fctypeeditbase.ui | 282 + parts/filecreate/fctypeeditbase.ui.h | 26 + parts/filecreate/file-templates/Makefile.am | 2 + parts/filecreate/file-templates/dox | 22 + parts/filecreate/file-templates/qrc | 5 + parts/filecreate/file-templates/ts | 2 + parts/filecreate/file-templates/ui | 20 + parts/filecreate/file-templates/ui-confdialog | 165 + parts/filecreate/file-templates/ui-dialog | 20 + parts/filecreate/file-templates/ui-dialog-qt4 | 22 + parts/filecreate/file-templates/ui-dialogb | 123 + parts/filecreate/file-templates/ui-dialogb-qt4 | 100 + parts/filecreate/file-templates/ui-dialogr | 123 + parts/filecreate/file-templates/ui-dialogr-qt4 | 100 + parts/filecreate/file-templates/ui-mainwin | 436 + parts/filecreate/file-templates/ui-mainwin-qt4 | 34 + parts/filecreate/file-templates/ui-tabdialog | 147 + parts/filecreate/file-templates/ui-widget | 20 + parts/filecreate/file-templates/ui-widget-qt4 | 22 + parts/filecreate/file-templates/ui-wizard | 28 + parts/filecreate/filecreate_filedialog.cpp | 65 + parts/filecreate/filecreate_filedialog.h | 46 + parts/filecreate/filecreate_filetype.cpp | 21 + parts/filecreate/filecreate_filetype.h | 63 + parts/filecreate/filecreate_listitem.cpp | 101 + parts/filecreate/filecreate_listitem.h | 49 + parts/filecreate/filecreate_newfile.cpp | 162 + parts/filecreate/filecreate_newfile.h | 59 + parts/filecreate/filecreate_part.cpp | 562 + parts/filecreate/filecreate_part.h | 144 + parts/filecreate/filecreate_typechooser.h | 47 + parts/filecreate/filecreate_typechoosersig.h | 28 + parts/filecreate/filecreate_widget2.cpp | 228 + parts/filecreate/filecreate_widget2.h | 113 + parts/filecreate/filecreate_widget3.cpp | 119 + parts/filecreate/filecreate_widget3.h | 50 + parts/filecreate/kdevfilecreate.desktop | 77 + parts/filecreate/kdevpart_filecreate.rc | 11 + parts/filecreate/template-info.xml | 181 + parts/filelist/Makefile.am | 20 + parts/filelist/README.dox | 13 + parts/filelist/fileinfo.h | 37 + parts/filelist/filelist_item.cpp | 104 + parts/filelist/filelist_item.h | 53 + parts/filelist/filelist_widget.cpp | 300 + parts/filelist/filelist_widget.h | 72 + parts/filelist/kdevfilelist.desktop | 76 + parts/filelist/kdevfilelist.rc | 24 + parts/filelist/projectviewconfig.cpp | 47 + parts/filelist/projectviewconfig.h | 38 + parts/filelist/projectviewconfigbase.ui | 93 + parts/filelist/projectviewpart.cpp | 585 + parts/filelist/projectviewpart.h | 169 + parts/filelist/projectviewprojectconfig.cpp | 41 + parts/filelist/projectviewprojectconfig.h | 41 + parts/filelist/projectviewprojectconfigbase.ui | 94 + parts/filelist/toolbarguibuilder.cpp | 59 + parts/filelist/toolbarguibuilder.h | 58 + parts/fileselector/Makefile.am | 18 + parts/fileselector/README.dox | 13 + parts/fileselector/fileselector_part.cpp | 108 + parts/fileselector/fileselector_part.h | 40 + parts/fileselector/fileselector_widget.cpp | 821 ++ parts/fileselector/fileselector_widget.h | 203 + parts/fileselector/kactionselector.cpp | 537 + parts/fileselector/kactionselector.h | 399 + parts/fileselector/kbookmarkhandler.cpp | 99 + parts/fileselector/kbookmarkhandler.h | 70 + parts/fileselector/kdevfileselector.desktop | 89 + parts/fileselector/kdevpart_fileselector.rc | 8 + parts/fileview/Makefile.am | 26 + parts/fileview/README.dox | 53 + parts/fileview/addfilegroupdlg.cpp | 73 + parts/fileview/addfilegroupdlg.h | 39 + parts/fileview/filegroupsconfigwidget.cpp | 133 + parts/fileview/filegroupsconfigwidget.h | 44 + parts/fileview/filegroupsconfigwidgetbase.ui | 229 + parts/fileview/filegroupspart.cpp | 97 + parts/fileview/filegroupspart.h | 43 + parts/fileview/filegroupswidget.cpp | 442 + parts/fileview/filegroupswidget.h | 54 + parts/fileview/fileitemfactory.cpp | 145 + parts/fileview/fileitemfactory.h | 89 + parts/fileview/filetreeviewwidgetimpl.cpp | 169 + parts/fileview/filetreeviewwidgetimpl.h | 105 + parts/fileview/filetreewidget.cpp | 387 + parts/fileview/filetreewidget.h | 111 + parts/fileview/fileviewpart.cpp | 161 + parts/fileview/fileviewpart.h | 49 + parts/fileview/kdevfilegroups.desktop | 86 + parts/fileview/kdevfileview.desktop | 85 + parts/fileview/partwidget.cpp | 144 + parts/fileview/partwidget.h | 45 + parts/fileview/stdfiletreewidgetimpl.cpp | 95 + parts/fileview/stdfiletreewidgetimpl.h | 36 + parts/fileview/vcscolorsconfigwidget.cpp | 109 + parts/fileview/vcscolorsconfigwidget.h | 68 + parts/fileview/vcscolorsconfigwidgetbase.ui | 267 + parts/fileview/vcsfiletreewidgetimpl.cpp | 353 + parts/fileview/vcsfiletreewidgetimpl.h | 67 + parts/filter/Makefile.am | 17 + parts/filter/README.dox | 52 + parts/filter/filterpart.cpp | 160 + parts/filter/filterpart.h | 41 + parts/filter/kdevfilter.desktop | 82 + parts/filter/kdevfilter.rc | 10 + parts/filter/kdevfilterIface.cpp | 35 + parts/filter/kdevfilterIface.h | 26 + parts/filter/shellfilterdlg.cpp | 128 + parts/filter/shellfilterdlg.h | 52 + parts/filter/shellinsertdlg.cpp | 125 + parts/filter/shellinsertdlg.h | 49 + parts/fullscreen/Makefile.am | 15 + parts/fullscreen/README.dox | 10 + parts/fullscreen/fullscreen_part.cpp | 72 + parts/fullscreen/fullscreen_part.h | 36 + parts/fullscreen/kdevfullscreen.desktop | 86 + parts/fullscreen/kdevpart_fullscreen.rc | 12 + parts/grepview/Makefile.am | 19 + parts/grepview/README.dox | 12 + parts/grepview/grepdlg.cpp | 381 + parts/grepview/grepdlg.h | 104 + parts/grepview/grepviewpart.cpp | 150 + parts/grepview/grepviewpart.h | 50 + parts/grepview/grepviewwidget.cpp | 535 + parts/grepview/grepviewwidget.h | 111 + parts/grepview/kdevgrepview.desktop | 86 + parts/grepview/kdevgrepview.rc | 9 + parts/konsole/Makefile.am | 16 + parts/konsole/README.dox | 49 + parts/konsole/kdevkonsoleview.desktop | 86 + parts/konsole/konsoleviewpart.cpp | 69 + parts/konsole/konsoleviewpart.h | 36 + parts/konsole/konsoleviewwidget.cpp | 124 + parts/konsole/konsoleviewwidget.h | 55 + parts/openwith/Makefile.am | 15 + parts/openwith/README.dox | 52 + parts/openwith/kdevopenwith.desktop | 82 + parts/openwith/openwithpart.cpp | 138 + parts/openwith/openwithpart.h | 36 + parts/outputviews/Makefile.am | 35 + parts/outputviews/README.dox | 16 + parts/outputviews/appoutputviewpart.cpp | 178 + parts/outputviews/appoutputviewpart.h | 56 + parts/outputviews/appoutputwidget.cpp | 355 + parts/outputviews/appoutputwidget.h | 69 + parts/outputviews/commandcontinuationfilter.cpp | 40 + parts/outputviews/commandcontinuationfilter.h | 29 + parts/outputviews/compileerrorfilter.cpp | 128 + parts/outputviews/compileerrorfilter.h | 48 + parts/outputviews/directorystatusmessagefilter.cpp | 187 + parts/outputviews/directorystatusmessagefilter.h | 39 + parts/outputviews/filterdlg.ui | 164 + parts/outputviews/kdevappoutputview.desktop | 84 + parts/outputviews/kdevmakeview.desktop | 87 + parts/outputviews/kdevmakeview.rc | 9 + parts/outputviews/makeactionfilter.cpp | 319 + parts/outputviews/makeactionfilter.h | 62 + parts/outputviews/makeitem.cpp | 166 + parts/outputviews/makeitem.h | 164 + parts/outputviews/makeviewpart.cpp | 105 + parts/outputviews/makeviewpart.h | 46 + parts/outputviews/makewidget.cpp | 847 ++ parts/outputviews/makewidget.h | 129 + parts/outputviews/otherfilter.cpp | 26 + parts/outputviews/otherfilter.h | 34 + parts/outputviews/outputfilter.cpp | 24 + parts/outputviews/outputfilter.h | 29 + parts/outputviews/outputviewsfactory.cpp | 21 + parts/outputviews/outputviewsfactory.h | 27 + parts/partexplorer/Makefile.am | 17 + parts/partexplorer/README | 3 + parts/partexplorer/README.dox | 24 + parts/partexplorer/kdevpartexplorer.desktop | 76 + parts/partexplorer/kdevpartexplorer.rc | 8 + parts/partexplorer/partexplorer_plugin.cpp | 65 + parts/partexplorer/partexplorer_plugin.h | 48 + parts/partexplorer/partexplorerform.cpp | 231 + parts/partexplorer/partexplorerform.h | 49 + parts/partexplorer/partexplorerformbase.ui | 139 + parts/quickopen/Makefile.am | 17 + parts/quickopen/README.dox | 52 + parts/quickopen/kdevpart_quickopen.rc | 15 + parts/quickopen/kdevquickopen.desktop | 80 + parts/quickopen/quickopen_part.cpp | 139 + parts/quickopen/quickopen_part.h | 57 + parts/quickopen/quickopenbase.ui | 178 + parts/quickopen/quickopenclassdialog.cpp | 219 + parts/quickopen/quickopenclassdialog.h | 56 + parts/quickopen/quickopendialog.cpp | 155 + parts/quickopen/quickopendialog.h | 63 + parts/quickopen/quickopenfiledialog.cpp | 121 + parts/quickopen/quickopenfiledialog.h | 49 + parts/quickopen/quickopenfunctionchooseform.cpp | 56 + parts/quickopen/quickopenfunctionchooseform.h | 48 + parts/quickopen/quickopenfunctionchooseformbase.ui | 231 + parts/quickopen/quickopenfunctiondialog.cpp | 229 + parts/quickopen/quickopenfunctiondialog.h | 60 + parts/regexptest/Makefile.am | 17 + parts/regexptest/README.dox | 49 + parts/regexptest/kdevregexptest.desktop | 82 + parts/regexptest/kdevregexptest.rc | 9 + parts/regexptest/regexptestdlg.cpp | 263 + parts/regexptest/regexptestdlg.h | 46 + parts/regexptest/regexptestdlgbase.ui | 352 + parts/regexptest/regexptestpart.cpp | 63 + parts/regexptest/regexptestpart.h | 37 + parts/replace/Makefile.am | 16 + parts/replace/README | 3 + parts/replace/README.dox | 24 + parts/replace/kdevpart_replace.rc | 8 + parts/replace/kdevreplace.desktop | 80 + parts/replace/replace_part.cpp | 110 + parts/replace/replace_part.h | 46 + parts/replace/replace_widget.cpp | 486 + parts/replace/replace_widget.h | 81 + parts/replace/replacedlg.ui | 385 + parts/replace/replacedlgimpl.cpp | 188 + parts/replace/replacedlgimpl.h | 38 + parts/replace/replaceitem.cpp | 147 + parts/replace/replaceitem.h | 113 + parts/replace/replaceview.cpp | 141 + parts/replace/replaceview.h | 54 + parts/scripting/Makefile.am | 20 + parts/scripting/README | 18 + parts/scripting/kdevscripting.desktop | 77 + parts/scripting/kdevscripting.rc | 8 + parts/scripting/scriptingglobalconfig.cpp | 48 + parts/scripting/scriptingglobalconfig.h | 41 + parts/scripting/scriptingglobalconfigbase.ui | 51 + parts/scripting/scriptingpart.cpp | 108 + parts/scripting/scriptingpart.h | 57 + parts/snippet/COPYING | 340 + parts/snippet/Makefile.am | 17 + parts/snippet/README | 3 + parts/snippet/README.dox | 16 + parts/snippet/kdevpart_snippet.rc | 8 + parts/snippet/kdevsnippet.desktop | 102 + parts/snippet/snippet_part.cpp | 155 + parts/snippet/snippet_part.h | 50 + parts/snippet/snippet_widget.cpp | 970 ++ parts/snippet/snippet_widget.h | 90 + parts/snippet/snippetconfig.cpp | 20 + parts/snippet/snippetconfig.h | 56 + parts/snippet/snippetdlg.ui | 214 + parts/snippet/snippetdlg.ui.h | 21 + parts/snippet/snippetitem.cpp | 127 + parts/snippet/snippetitem.h | 70 + parts/snippet/snippetsettings.cpp | 52 + parts/snippet/snippetsettings.h | 41 + parts/snippet/snippetsettingsbase.ui | 228 + parts/texttools/Makefile.am | 18 + parts/texttools/README.dox | 49 + parts/texttools/kdevtexttools.desktop | 84 + parts/texttools/texttoolspart.cpp | 99 + parts/texttools/texttoolspart.h | 39 + parts/texttools/texttoolswidget.cpp | 400 + parts/texttools/texttoolswidget.h | 54 + parts/tipofday/Makefile.am | 24 + parts/tipofday/README.dox | 8 + parts/tipofday/hi16-action-ktip.png | Bin 0 -> 496 bytes parts/tipofday/hi32-action-ktip.png | Bin 0 -> 1300 bytes parts/tipofday/hi48-action-ktip.png | Bin 0 -> 1825 bytes parts/tipofday/kdevpart_tipofday.rc | 8 + parts/tipofday/kdevtipofday.desktop | 94 + parts/tipofday/lo16-action-kdevelop_tip.png | Bin 0 -> 273 bytes parts/tipofday/lo32-action-kdevelop_tip.png | Bin 0 -> 372 bytes parts/tipofday/tipofday_part.cpp | 67 + parts/tipofday/tipofday_part.h | 33 + parts/tipofday/tips | 203 + parts/tools/Makefile.am | 16 + parts/tools/README.dox | 12 + parts/tools/addtooldlg.ui | 245 + parts/tools/addtooldlg.ui.h | 31 + parts/tools/kapplicationtree.cpp | 258 + parts/tools/kapplicationtree.h | 102 + parts/tools/kdevpart_tools.rc | 14 + parts/tools/kdevtools.desktop | 82 + parts/tools/tools_part.cpp | 272 + parts/tools/tools_part.h | 55 + parts/tools/toolsconfig.cpp | 169 + parts/tools/toolsconfig.h | 71 + parts/tools/toolsconfigwidget.cpp | 284 + parts/tools/toolsconfigwidget.h | 60 + parts/tools/toolsconfigwidgetbase.ui | 410 + parts/uimode/Makefile.am | 13 + parts/uimode/README.dox | 8 + parts/uimode/kdevuichooser.desktop | 87 + parts/uimode/uichooser.ui | 250 + parts/uimode/uichooser_part.cpp | 52 + parts/uimode/uichooser_part.h | 32 + parts/uimode/uichooser_widget.cpp | 153 + parts/uimode/uichooser_widget.h | 42 + parts/valgrind/Makefile.am | 15 + parts/valgrind/README.dox | 45 + parts/valgrind/dialog_widget.ui | 360 + parts/valgrind/dialog_widget.ui.h | 21 + parts/valgrind/kdevpart_valgrind.rc | 9 + parts/valgrind/kdevvalgrind.desktop | 74 + parts/valgrind/valgrind_dialog.cpp | 206 + parts/valgrind/valgrind_dialog.h | 62 + parts/valgrind/valgrind_part.cpp | 366 + parts/valgrind/valgrind_part.h | 62 + parts/valgrind/valgrind_widget.cpp | 205 + parts/valgrind/valgrind_widget.h | 44 + parts/valgrind/valgrinditem.cpp | 71 + parts/valgrind/valgrinditem.h | 50 + parts/vcsmanager/Makefile.am | 19 + parts/vcsmanager/README.dox | 55 + parts/vcsmanager/kdevvcsmanager.desktop | 65 + parts/vcsmanager/vcsmanagerpart.cpp | 115 + parts/vcsmanager/vcsmanagerpart.h | 57 + parts/vcsmanager/vcsmanagerprojectconfig.cpp | 69 + parts/vcsmanager/vcsmanagerprojectconfig.h | 45 + parts/vcsmanager/vcsmanagerprojectconfigbase.ui | 58 + pics/Makefile.am | 2 + pics/hi16-app-kdevassistant.png | Bin 0 -> 1285 bytes pics/hi16-app-kdevdesigner.png | Bin 0 -> 1372 bytes pics/hi16-app-kdevelop.png | Bin 0 -> 894 bytes pics/hi32-app-kdevassistant.png | Bin 0 -> 1970 bytes pics/hi32-app-kdevdesigner.png | Bin 0 -> 2060 bytes pics/hi32-app-kdevelop.png | Bin 0 -> 2456 bytes pics/hi48-app-kdevassistant.png | Bin 0 -> 2654 bytes pics/hi48-app-kdevdesigner.png | Bin 0 -> 2853 bytes pics/hi48-app-kdevelop.png | Bin 0 -> 4631 bytes pics/mini/CTchildren.png | Bin 0 -> 276 bytes pics/mini/CTclients.png | Bin 0 -> 295 bytes pics/mini/CTparents.png | Bin 0 -> 281 bytes pics/mini/CTsuppliers.png | Bin 0 -> 295 bytes pics/mini/CTvirtuals.png | Bin 0 -> 319 bytes pics/mini/CVclass.png | Bin 0 -> 367 bytes pics/mini/CVglobal_meth.png | Bin 0 -> 342 bytes pics/mini/CVglobal_var.png | Bin 0 -> 313 bytes pics/mini/CVnamespace.png | Bin 0 -> 310 bytes pics/mini/CVpackage_meth.png | Bin 0 -> 332 bytes pics/mini/CVpackage_var.png | Bin 0 -> 295 bytes pics/mini/CVprivate_meth.png | Bin 0 -> 347 bytes pics/mini/CVprivate_signal.png | Bin 0 -> 354 bytes pics/mini/CVprivate_slot.png | Bin 0 -> 356 bytes pics/mini/CVprivate_var.png | Bin 0 -> 314 bytes pics/mini/CVprotected_meth.png | Bin 0 -> 346 bytes pics/mini/CVprotected_signal.png | Bin 0 -> 352 bytes pics/mini/CVprotected_slot.png | Bin 0 -> 353 bytes pics/mini/CVprotected_var.png | Bin 0 -> 321 bytes pics/mini/CVpublic_meth.png | Bin 0 -> 320 bytes pics/mini/CVpublic_signal.png | Bin 0 -> 327 bytes pics/mini/CVpublic_slot.png | Bin 0 -> 329 bytes pics/mini/CVpublic_var.png | Bin 0 -> 293 bytes pics/mini/CVstruct.png | Bin 0 -> 355 bytes pics/mini/CVtypedef.png | Bin 0 -> 287 bytes pics/mini/Makefile.am | 8 + pics/mini/indicator_connect.png | Bin 0 -> 244 bytes pics/mini/indicator_noconnect.png | Bin 0 -> 157 bytes pics/misc/Makefile.am | 3 + pics/misc/kdevassistant-splash.png | Bin 0 -> 24776 bytes pics/misc/kdevdesigner-splash.png | Bin 0 -> 22232 bytes pics/misc/kdevelop-splash.png | Bin 0 -> 21003 bytes pics/toolbar/Makefile.am | 14 + pics/toolbar/hi16-action-classnew.png | Bin 0 -> 415 bytes pics/toolbar/hi16-action-dbgwatchvar.png | Bin 0 -> 192 bytes pics/toolbar/hi16-action-dirsynch.png | Bin 0 -> 653 bytes pics/toolbar/hi16-action-make_kdevelop.png | Bin 0 -> 454 bytes pics/toolbar/hi16-action-methodnew.png | Bin 0 -> 369 bytes pics/toolbar/hi16-action-newwidget.png | Bin 0 -> 441 bytes pics/toolbar/hi16-action-project_open.png | Bin 0 -> 574 bytes pics/toolbar/hi16-action-qmake_app.png | Bin 0 -> 504 bytes pics/toolbar/hi16-action-qmake_app_disabled.png | Bin 0 -> 564 bytes pics/toolbar/hi16-action-qmake_func_scope.png | Bin 0 -> 299 bytes pics/toolbar/hi16-action-qmake_inc_scope.png | Bin 0 -> 291 bytes pics/toolbar/hi16-action-qmake_lib.png | Bin 0 -> 211 bytes pics/toolbar/hi16-action-qmake_lib_disabled.png | Bin 0 -> 276 bytes pics/toolbar/hi16-action-qmake_scope.png | Bin 0 -> 310 bytes pics/toolbar/hi16-action-qmake_scopenew.png | Bin 0 -> 591 bytes pics/toolbar/hi16-action-qmake_sub.png | Bin 0 -> 733 bytes pics/toolbar/hi16-action-qmake_sub_disabled.png | Bin 0 -> 686 bytes pics/toolbar/hi16-action-qmake_subclass.png | Bin 0 -> 259 bytes pics/toolbar/hi16-action-qmake_ui_h.png | Bin 0 -> 194 bytes pics/toolbar/hi16-action-qmakerun.png | Bin 0 -> 961 bytes pics/toolbar/hi16-action-qtdesigner.png | Bin 0 -> 542 bytes pics/toolbar/hi16-action-rebuild.png | Bin 0 -> 495 bytes pics/toolbar/hi16-action-reload_page.png | Bin 0 -> 715 bytes pics/toolbar/hi16-action-remove_subdir.png | Bin 0 -> 873 bytes pics/toolbar/hi16-action-servicenew_kdevelop.png | Bin 0 -> 957 bytes pics/toolbar/hi16-action-target_kdevelop.png | Bin 0 -> 266 bytes pics/toolbar/hi16-action-targetnew_kdevelop.png | Bin 0 -> 393 bytes pics/toolbar/hi16-action-variablenew.png | Bin 0 -> 343 bytes pics/toolbar/hi22-action-classnew.png | Bin 0 -> 908 bytes pics/toolbar/hi22-action-classwiz.png | Bin 0 -> 334 bytes pics/toolbar/hi22-action-configure_file.png | Bin 0 -> 1353 bytes pics/toolbar/hi22-action-dbgjumpto.png | Bin 0 -> 353 bytes pics/toolbar/hi22-action-dbgmemview.png | Bin 0 -> 154 bytes pics/toolbar/hi22-action-dbgnext.png | Bin 0 -> 187 bytes pics/toolbar/hi22-action-dbgnextinst.png | Bin 0 -> 207 bytes pics/toolbar/hi22-action-dbgparam.png | Bin 0 -> 154 bytes pics/toolbar/hi22-action-dbgrestart.png | Bin 0 -> 222 bytes pics/toolbar/hi22-action-dbgrun.png | Bin 0 -> 244 bytes pics/toolbar/hi22-action-dbgrunto.png | Bin 0 -> 275 bytes pics/toolbar/hi22-action-dbgstep.png | Bin 0 -> 182 bytes pics/toolbar/hi22-action-dbgstepinst.png | Bin 0 -> 202 bytes pics/toolbar/hi22-action-dbgstepout.png | Bin 0 -> 204 bytes pics/toolbar/hi22-action-dbgvar.png | Bin 0 -> 141 bytes pics/toolbar/hi22-action-debugger.png | Bin 0 -> 1216 bytes pics/toolbar/hi22-action-grep.png | Bin 0 -> 357 bytes pics/toolbar/hi22-action-make_kdevelop.png | Bin 0 -> 425 bytes pics/toolbar/hi22-action-newwidget.png | Bin 0 -> 525 bytes pics/toolbar/hi22-action-output_win.png | Bin 0 -> 975 bytes pics/toolbar/hi22-action-project_open.png | Bin 0 -> 814 bytes pics/toolbar/hi22-action-qmake_scopenew.png | Bin 0 -> 821 bytes pics/toolbar/hi22-action-qmakerun.png | Bin 0 -> 1553 bytes pics/toolbar/hi22-action-rebuild.png | Bin 0 -> 851 bytes pics/toolbar/hi22-action-reload_page.png | Bin 0 -> 1260 bytes pics/toolbar/hi22-action-save_all.png | Bin 0 -> 436 bytes pics/toolbar/hi22-action-tree_win.png | Bin 0 -> 575 bytes pics/toolbar/hi32-action-classnew.png | Bin 0 -> 1266 bytes pics/toolbar/hi32-mime-kdevelop_project.png | Bin 0 -> 687 bytes src/Mainpage.dox | 118 + src/Makefile.am | 57 + src/api.cpp | 60 + src/api.h | 41 + src/core.cpp | 118 + src/core.h | 71 + src/documentationpart.cpp | 21 + src/documentationpart.h | 25 + src/editorproxy.cpp | 297 + src/editorproxy.h | 67 + src/eventsrc | 147 + src/generalinfowidget.cpp | 292 + src/generalinfowidget.h | 53 + src/generalinfowidgetbase.ui | 245 + src/kconf_update/Makefile.am | 18 + .../kdev-gen-settings-kconf_update.cpp | 113 + src/kconf_update/kdev-gen-settings.upd | 8 + src/kdevassistantextension.cpp | 40 + src/kdevassistantextension.h | 41 + src/kdevassistantrc | 14 + src/kdevassistantui.rc | 168 + src/kdeveloprc | 70 + src/kdevelopui.rc | 191 + src/kdevideextension.cpp | 129 + src/kdevideextension.h | 45 + src/kdevpluginprofilerc | 52 + src/languageselectwidget.cpp | 165 + src/languageselectwidget.h | 51 + src/main.cpp | 153 + src/main_assistant.cpp | 115 + src/mainwindowshare.cpp | 451 + src/mainwindowshare.h | 88 + src/mimewarningdialog.ui | 254 + src/multibuffer.cpp | 303 + src/multibuffer.h | 89 + src/newui/Makefile.am | 14 + src/newui/button.cpp | 350 + src/newui/button.h | 108 + src/newui/buttonbar.cpp | 346 + src/newui/buttonbar.h | 112 + src/newui/comdefs.h | 30 + src/newui/ddockwindow.cpp | 413 + src/newui/ddockwindow.h | 114 + src/newui/dmainwindow.cpp | 309 + src/newui/dmainwindow.h | 113 + src/newui/docksplitter.cpp | 175 + src/newui/docksplitter.h | 62 + src/newui/dtabwidget.cpp | 106 + src/newui/dtabwidget.h | 58 + src/partcontroller.cpp | 1867 +++ src/partcontroller.h | 232 + src/plugincontroller.cpp | 391 + src/plugincontroller.h | 96 + src/pluginselectdialog.cpp | 181 + src/pluginselectdialog.h | 42 + src/pluginselectdialogbase.ui | 179 + src/profileengine/Makefile.am | 3 + src/profileengine/editor/Makefile.am | 22 + src/profileengine/editor/addprofilewidget.ui | 121 + src/profileengine/editor/main.cpp | 45 + src/profileengine/editor/profileeditor.cpp | 400 + src/profileengine/editor/profileeditor.h | 69 + src/profileengine/editor/profileeditorbase.ui | 680 + src/profileengine/lib/Mainpage.dox | 10 + src/profileengine/lib/Makefile.am | 16 + src/profileengine/lib/profile.cpp | 205 + src/profileengine/lib/profile.h | 96 + src/profileengine/lib/profileengine.cpp | 264 + src/profileengine/lib/profileengine.h | 272 + .../IDE/CompiledLanguageIDE/AdaIDE/Makefile.am | 3 + .../IDE/CompiledLanguageIDE/AdaIDE/profile.config | 12 + .../CandCppIDE/CIDE/Makefile.am | 3 + .../CandCppIDE/CIDE/profile.config | 12 + .../CandCppIDE/CppIDE/KDECppIDE/Makefile.am | 3 + .../CandCppIDE/CppIDE/KDECppIDE/profile.config | 12 + .../CandCppIDE/CppIDE/Makefile.am | 3 + .../CandCppIDE/CppIDE/profile.config | 12 + .../IDE/CompiledLanguageIDE/CandCppIDE/Makefile.am | 4 + .../CompiledLanguageIDE/CandCppIDE/profile.config | 12 + .../IDE/CompiledLanguageIDE/FortranIDE/Makefile.am | 3 + .../CompiledLanguageIDE/FortranIDE/profile.config | 12 + .../IDE/CompiledLanguageIDE/HaskellIDE/Makefile.am | 3 + .../CompiledLanguageIDE/HaskellIDE/profile.config | 12 + .../IDE/CompiledLanguageIDE/JavaIDE/Makefile.am | 3 + .../IDE/CompiledLanguageIDE/JavaIDE/profile.config | 12 + src/profiles/IDE/CompiledLanguageIDE/Makefile.am | 4 + .../IDE/CompiledLanguageIDE/PascalIDE/Makefile.am | 3 + .../CompiledLanguageIDE/PascalIDE/profile.config | 12 + .../IDE/CompiledLanguageIDE/profile.config | 12 + src/profiles/IDE/DatabaseIDE/Makefile.am | 3 + src/profiles/IDE/DatabaseIDE/profile.config | 12 + src/profiles/IDE/Makefile.am | 3 + src/profiles/IDE/ScriptingLanguageIDE/Makefile.am | 4 + .../IDE/ScriptingLanguageIDE/PHPIDE/Makefile.am | 3 + .../IDE/ScriptingLanguageIDE/PHPIDE/profile.config | 12 + .../IDE/ScriptingLanguageIDE/PerlIDE/Makefile.am | 3 + .../ScriptingLanguageIDE/PerlIDE/profile.config | 12 + .../IDE/ScriptingLanguageIDE/PythonIDE/Makefile.am | 3 + .../ScriptingLanguageIDE/PythonIDE/profile.config | 12 + .../IDE/ScriptingLanguageIDE/RubyIDE/Makefile.am | 3 + .../ScriptingLanguageIDE/RubyIDE/profile.config | 12 + .../IDE/ScriptingLanguageIDE/ShellIDE/Makefile.am | 3 + .../ScriptingLanguageIDE/ShellIDE/profile.config | 12 + .../IDE/ScriptingLanguageIDE/profile.config | 12 + src/profiles/IDE/profile.config | 12 + src/profiles/KDevAssistant/Makefile.am | 3 + src/profiles/KDevAssistant/profile.config | 12 + src/profiles/Makefile.am | 3 + src/profiles/profile.config | 3 + src/projectmanager.cpp | 668 + src/projectmanager.h | 111 + src/projectprofiles | 39 + src/projectsession.cpp | 450 + src/projectsession.h | 89 + src/settingswidget.ui | 528 + src/shellextension.cpp | 26 + src/shellextension.h | 62 + src/simplemainwindow.cpp | 1011 ++ src/simplemainwindow.h | 140 + src/splashscreen.cpp | 85 + src/splashscreen.h | 38 + src/statusbar.cpp | 112 + src/statusbar.h | 51 + src/toplevel.cpp | 35 + src/toplevel.h | 27 + vcs/Makefile.am | 39 + vcs/clearcase/Makefile.am | 18 + vcs/clearcase/README | 3 + vcs/clearcase/README.dox | 42 + vcs/clearcase/clearcasefileinfoprovider.cpp | 66 + vcs/clearcase/clearcasefileinfoprovider.h | 50 + vcs/clearcase/clearcasemanipulator.cpp | 133 + vcs/clearcase/clearcasemanipulator.h | 49 + vcs/clearcase/clearcasepart.cpp | 363 + vcs/clearcase/clearcasepart.h | 65 + vcs/clearcase/commentdlg.cpp | 61 + vcs/clearcase/commentdlg.h | 32 + vcs/clearcase/integrator/Makefile.am | 13 + vcs/clearcase/integrator/ccintegratordlg.cpp | 40 + vcs/clearcase/integrator/ccintegratordlg.h | 36 + vcs/clearcase/integrator/ccintegratordlgbase.ui | 47 + vcs/clearcase/integrator/clearcaseintegrator.cpp | 54 + vcs/clearcase/integrator/clearcaseintegrator.h | 39 + .../integrator/kdevclearcaseintegrator.desktop | 44 + vcs/clearcase/kdevclearcase.desktop | 82 + vcs/cvsservice/Makefile.am | 40 + vcs/cvsservice/README | 1 + vcs/cvsservice/README.dox | 82 + vcs/cvsservice/annotatedialog.cpp | 68 + vcs/cvsservice/annotatedialog.h | 65 + vcs/cvsservice/annotatepage.cpp | 257 + vcs/cvsservice/annotatepage.h | 125 + vcs/cvsservice/annotateview.cpp | 221 + vcs/cvsservice/annotateview.h | 55 + vcs/cvsservice/bufferedstringreader.cpp | 47 + vcs/cvsservice/bufferedstringreader.h | 44 + vcs/cvsservice/buildcvs.sh | 25 + vcs/cvsservice/changelog.cpp | 114 + vcs/cvsservice/changelog.h | 45 + vcs/cvsservice/checkoutdialog.cpp | 276 + vcs/cvsservice/checkoutdialog.h | 90 + vcs/cvsservice/checkoutdialogbase.ui | 312 + vcs/cvsservice/commitdialogbase.ui | 161 + vcs/cvsservice/commitdlg.cpp | 92 + vcs/cvsservice/commitdlg.h | 45 + vcs/cvsservice/cvsdiffpage.cpp | 134 + vcs/cvsservice/cvsdiffpage.h | 55 + vcs/cvsservice/cvsdir.cpp | 321 + vcs/cvsservice/cvsdir.h | 103 + vcs/cvsservice/cvsentry.cpp | 187 + vcs/cvsservice/cvsentry.h | 56 + vcs/cvsservice/cvsfileinfoprovider.cpp | 314 + vcs/cvsservice/cvsfileinfoprovider.h | 79 + vcs/cvsservice/cvsform.cpp | 83 + vcs/cvsservice/cvsform.h | 37 + vcs/cvsservice/cvsformbase.ui | 223 + vcs/cvsservice/cvslogdialog.cpp | 113 + vcs/cvsservice/cvslogdialog.h | 50 + vcs/cvsservice/cvslogpage.cpp | 212 + vcs/cvsservice/cvslogpage.h | 63 + vcs/cvsservice/cvsoptions.cpp | 288 + vcs/cvsservice/cvsoptions.h | 102 + vcs/cvsservice/cvsoptionswidget.cpp | 190 + vcs/cvsservice/cvsoptionswidget.h | 62 + vcs/cvsservice/cvsoptionswidgetbase.ui | 230 + vcs/cvsservice/cvspart.cpp | 780 ++ vcs/cvsservice/cvspart.h | 173 + vcs/cvsservice/cvspartimpl.cpp | 1012 ++ vcs/cvsservice/cvspartimpl.h | 354 + vcs/cvsservice/cvsprocesswidget.cpp | 288 + vcs/cvsservice/cvsprocesswidget.h | 77 + vcs/cvsservice/cvsservicedcopIface.h | 29 + vcs/cvsservice/diffdialog.cpp | 89 + vcs/cvsservice/diffdialog.h | 42 + vcs/cvsservice/diffdialogbase.ui | 275 + vcs/cvsservice/diffwidget.cpp | 331 + vcs/cvsservice/diffwidget.h | 103 + vcs/cvsservice/editorsdialog.cpp | 134 + vcs/cvsservice/editorsdialog.h | 43 + vcs/cvsservice/editorsdialogbase.ui | 88 + vcs/cvsservice/integrator/Makefile.am | 12 + vcs/cvsservice/integrator/cvsserviceintegrator.cpp | 52 + vcs/cvsservice/integrator/cvsserviceintegrator.h | 38 + vcs/cvsservice/integrator/fetcherdlgbase.ui | 153 + vcs/cvsservice/integrator/initdlg.ui | 71 + vcs/cvsservice/integrator/integratordlg.cpp | 191 + vcs/cvsservice/integrator/integratordlg.h | 48 + vcs/cvsservice/integrator/integratordlgbase.ui | 398 + .../integrator/kdevcvsserviceintegrator.desktop | 45 + vcs/cvsservice/jobscheduler.cpp | 55 + vcs/cvsservice/jobscheduler.h | 51 + vcs/cvsservice/kdev_cvs.png | Bin 0 -> 721 bytes vcs/cvsservice/kdev_cvs.xcf | Bin 0 -> 18033 bytes vcs/cvsservice/kdevcvsservice.desktop | 77 + vcs/cvsservice/kdevcvsservicepart.rc | 36 + vcs/cvsservice/releaseinputdialog.cpp | 66 + vcs/cvsservice/releaseinputdialog.h | 55 + vcs/cvsservice/releaseinputdialogbase.ui | 246 + vcs/cvsservice/tagdialog.cpp | 74 + vcs/cvsservice/tagdialog.h | 51 + vcs/cvsservice/tagdialogbase.ui | 159 + vcs/perforce/Makefile.am | 19 + vcs/perforce/README | 3 + vcs/perforce/README.dox | 15 + vcs/perforce/commitdlg.cpp | 161 + vcs/perforce/commitdlg.h | 57 + vcs/perforce/integrator/Makefile.am | 13 + .../integrator/kdevperforceintegrator.desktop | 44 + vcs/perforce/integrator/perforceintegrator.cpp | 54 + vcs/perforce/integrator/perforceintegrator.h | 39 + vcs/perforce/integrator/pfintegratordlg.cpp | 40 + vcs/perforce/integrator/pfintegratordlg.h | 36 + vcs/perforce/integrator/pfintegratordlgbase.ui | 47 + vcs/perforce/kdevperforce.desktop | 82 + vcs/perforce/kdevperforcepart.rc | 23 + vcs/perforce/perforcepart.cpp | 364 + vcs/perforce/perforcepart.h | 79 + vcs/subversion/Makefile.am | 38 + vcs/subversion/README.dox | 13 + vcs/subversion/commitdlg.cpp | 47 + vcs/subversion/commitdlg.h | 37 + vcs/subversion/commitdlgbase.ui | 111 + vcs/subversion/configure.in.bot | 9 + vcs/subversion/configure.in.in | 134 + vcs/subversion/integrator/Makefile.am | 14 + .../integrator/kdevsubversionintegrator.desktop | 45 + vcs/subversion/integrator/subversionintegrator.cpp | 54 + vcs/subversion/integrator/subversionintegrator.h | 39 + vcs/subversion/integrator/svnintegratordlg.cpp | 122 + vcs/subversion/integrator/svnintegratordlg.h | 39 + vcs/subversion/integrator/svnintegratordlgbase.ui | 190 + vcs/subversion/kdevpart_subversion.rc | 31 + vcs/subversion/kdevsubversion.desktop | 34 + vcs/subversion/kdevsvn+file.protocol | 39 + vcs/subversion/kdevsvn+http.protocol | 39 + vcs/subversion/kdevsvn+https.protocol | 39 + vcs/subversion/kdevsvn+ssh.protocol | 39 + vcs/subversion/kdevsvn+svn.protocol | 39 + vcs/subversion/kdevsvnd.cpp | 394 + vcs/subversion/kdevsvnd.desktop | 31 + vcs/subversion/kdevsvnd.h | 50 + vcs/subversion/kdevsvnd_widgets.cpp | 70 + vcs/subversion/kdevsvnd_widgets.h | 41 + vcs/subversion/subversion_core.cpp | 738 ++ vcs/subversion/subversion_core.h | 105 + vcs/subversion/subversion_fileinfo.cpp | 507 + vcs/subversion/subversion_fileinfo.h | 73 + vcs/subversion/subversion_global.h | 56 + vcs/subversion/subversion_part.cpp | 569 + vcs/subversion/subversion_part.h | 119 + vcs/subversion/subversion_widget.cpp | 136 + vcs/subversion/subversion_widget.h | 95 + vcs/subversion/subversiondiff.ui | 100 + vcs/subversion/subversionprojectwidget.ui | 89 + vcs/subversion/svn_blamewidget.cpp | 135 + vcs/subversion/svn_blamewidget.h | 77 + vcs/subversion/svn_co.ui | 335 + vcs/subversion/svn_commitdlgbase.ui | 131 + vcs/subversion/svn_copydlgwidget.ui | 238 + vcs/subversion/svn_copywidget.cpp | 75 + vcs/subversion/svn_copywidget.h | 32 + vcs/subversion/svn_fileselectdlg_commit.cpp | 163 + vcs/subversion/svn_fileselectdlg_commit.h | 52 + vcs/subversion/svn_kio.cpp | 2155 ++++ vcs/subversion/svn_kio.h | 163 + vcs/subversion/svn_logviewoptiondlgbase.ui | 156 + vcs/subversion/svn_logviewwidget.cpp | 273 + vcs/subversion/svn_logviewwidget.h | 93 + vcs/subversion/svn_mergeoptiondlgbase.ui | 374 + vcs/subversion/svn_mergewidget.cpp | 99 + vcs/subversion/svn_mergewidget.h | 50 + vcs/subversion/svn_switchdlgbase.ui | 213 + vcs/subversion/svn_switchwidget.cpp | 60 + vcs/subversion/svn_switchwidget.h | 31 + vcs/subversion/svnssltrustpromptbase.ui | 116 + x-kdevelop.desktop | 41 + 4114 files changed, 596955 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 COPYING.LIB create mode 100644 ChangeLog create mode 100644 ConfigureChecks.cmake create mode 100644 Doxyfile create mode 100644 Doxyfile.am create mode 100644 Doxyfile_full.am create mode 100644 HACKING create mode 100644 HACKING.language create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.cvs create mode 100644 NEWS create mode 100644 README create mode 100644 TODO create mode 100644 buildtools/Makefile.am create mode 100644 buildtools/ada/Makefile.am create mode 100644 buildtools/ada/README.dox create mode 100644 buildtools/ada/adaglobaloptionsdlg.cpp create mode 100644 buildtools/ada/adaglobaloptionsdlg.h create mode 100644 buildtools/ada/adaproject_optionsdlgbase.ui create mode 100644 buildtools/ada/adaproject_part.cpp create mode 100644 buildtools/ada/adaproject_part.h create mode 100644 buildtools/ada/adaproject_widget.cpp create mode 100644 buildtools/ada/adaproject_widget.h create mode 100644 buildtools/ada/adaprojectoptionsdlg.cpp create mode 100644 buildtools/ada/adaprojectoptionsdlg.h create mode 100644 buildtools/ada/kdevadaproject.desktop create mode 100644 buildtools/ada/kdevadaproject.rc create mode 100644 buildtools/ada/service.cpp create mode 100644 buildtools/ada/service.h create mode 100644 buildtools/ant/Makefile.am create mode 100644 buildtools/ant/README.dox create mode 100644 buildtools/ant/antoptionswidget.ui create mode 100644 buildtools/ant/antprojectpart.cpp create mode 100644 buildtools/ant/antprojectpart.h create mode 100644 buildtools/ant/classpathwidget.ui create mode 100644 buildtools/ant/kdevantproject.desktop create mode 100644 buildtools/ant/kdevantproject.rc create mode 100644 buildtools/autotools/Makefile.am create mode 100644 buildtools/autotools/README create mode 100644 buildtools/autotools/README.dox create mode 100644 buildtools/autotools/addapplicationdlg.cpp create mode 100644 buildtools/autotools/addapplicationdlg.h create mode 100644 buildtools/autotools/addapplicationdlgbase.ui create mode 100644 buildtools/autotools/addexistingdirectoriesdlg.cpp create mode 100644 buildtools/autotools/addexistingdirectoriesdlg.h create mode 100644 buildtools/autotools/addexistingdlgbase.ui create mode 100644 buildtools/autotools/addexistingfilesdlg.cpp create mode 100644 buildtools/autotools/addexistingfilesdlg.h create mode 100644 buildtools/autotools/addfiledlg.cpp create mode 100644 buildtools/autotools/addfiledlg.h create mode 100644 buildtools/autotools/addfiledlgbase.ui create mode 100644 buildtools/autotools/addicondlg.cpp create mode 100644 buildtools/autotools/addicondlg.h create mode 100644 buildtools/autotools/addicondlgbase.ui create mode 100644 buildtools/autotools/addprefixdlg.cpp create mode 100644 buildtools/autotools/addprefixdlg.h create mode 100644 buildtools/autotools/addservicedlg.cpp create mode 100644 buildtools/autotools/addservicedlg.h create mode 100644 buildtools/autotools/addservicedlgbase.ui create mode 100644 buildtools/autotools/addsubprojectdlg.cpp create mode 100644 buildtools/autotools/addsubprojectdlg.h create mode 100644 buildtools/autotools/addsubprojectdlgbase.ui create mode 100644 buildtools/autotools/addtargetdlg.cpp create mode 100644 buildtools/autotools/addtargetdlg.h create mode 100644 buildtools/autotools/addtargetdlgbase.ui create mode 100644 buildtools/autotools/addtranslationdlg.cpp create mode 100644 buildtools/autotools/addtranslationdlg.h create mode 100644 buildtools/autotools/autodetailsview.cpp create mode 100644 buildtools/autotools/autodetailsview.h create mode 100644 buildtools/autotools/autolistviewitems.cpp create mode 100644 buildtools/autotools/autolistviewitems.h create mode 100644 buildtools/autotools/autoprojectpart.cpp create mode 100644 buildtools/autotools/autoprojectpart.h create mode 100644 buildtools/autotools/autoprojectviewbase.ui create mode 100644 buildtools/autotools/autoprojectwidget.cpp create mode 100644 buildtools/autotools/autoprojectwidget.h create mode 100644 buildtools/autotools/autosubprojectview.cpp create mode 100644 buildtools/autotools/autosubprojectview.h create mode 100644 buildtools/autotools/autotoolsaction.cpp create mode 100644 buildtools/autotools/autotoolsaction.h create mode 100644 buildtools/autotools/choosetargetdialog.cpp create mode 100644 buildtools/autotools/choosetargetdialog.h create mode 100644 buildtools/autotools/choosetargetdlgbase.ui create mode 100644 buildtools/autotools/configureoptionswidget.cpp create mode 100644 buildtools/autotools/configureoptionswidget.h create mode 100644 buildtools/autotools/configureoptionswidgetbase.ui create mode 100644 buildtools/autotools/fileselectorwidget.cpp create mode 100644 buildtools/autotools/fileselectorwidget.h create mode 100644 buildtools/autotools/kdevautoproject.desktop create mode 100644 buildtools/autotools/kdevautoproject.rc create mode 100644 buildtools/autotools/kdevkdeautoproject.desktop create mode 100644 buildtools/autotools/kfilednddetailview.cpp create mode 100644 buildtools/autotools/kfilednddetailview.h create mode 100644 buildtools/autotools/kfiledndiconview.cpp create mode 100644 buildtools/autotools/kfiledndiconview.h create mode 100644 buildtools/autotools/kimporticonview.cpp create mode 100644 buildtools/autotools/kimporticonview.h create mode 100644 buildtools/autotools/makefilehandler.cpp create mode 100644 buildtools/autotools/makefilehandler.h create mode 100644 buildtools/autotools/managecustomcommand.cpp create mode 100644 buildtools/autotools/managecustomcommand.h create mode 100644 buildtools/autotools/managecustomcommandsbase.ui create mode 100644 buildtools/autotools/misc.cpp create mode 100644 buildtools/autotools/misc.h create mode 100644 buildtools/autotools/removefiledlg.cpp create mode 100644 buildtools/autotools/removefiledlg.h create mode 100644 buildtools/autotools/removefiledlgbase.ui create mode 100644 buildtools/autotools/removetargetdlg.cpp create mode 100644 buildtools/autotools/removetargetdlg.h create mode 100644 buildtools/autotools/removetargetdlgbase.ui create mode 100644 buildtools/autotools/subprojectoptionsdlg.cpp create mode 100644 buildtools/autotools/subprojectoptionsdlg.h create mode 100644 buildtools/autotools/subprojectoptionsdlgbase.ui create mode 100644 buildtools/autotools/targetoptionsdlg.cpp create mode 100644 buildtools/autotools/targetoptionsdlg.h create mode 100644 buildtools/autotools/targetoptionsdlgbase.ui create mode 100644 buildtools/custommakefiles/Makefile.am create mode 100644 buildtools/custommakefiles/README.dox create mode 100644 buildtools/custommakefiles/custombuildoptionswidget.cpp create mode 100644 buildtools/custommakefiles/custombuildoptionswidget.h create mode 100644 buildtools/custommakefiles/custombuildoptionswidgetbase.ui create mode 100644 buildtools/custommakefiles/custommakeconfigwidget.cpp create mode 100644 buildtools/custommakefiles/custommakeconfigwidget.h create mode 100644 buildtools/custommakefiles/custommakeconfigwidgetbase.ui create mode 100644 buildtools/custommakefiles/custommanagerwidget.cpp create mode 100644 buildtools/custommakefiles/custommanagerwidget.h create mode 100644 buildtools/custommakefiles/custommanagerwidgetbase.ui create mode 100644 buildtools/custommakefiles/customotherconfigwidget.cpp create mode 100644 buildtools/custommakefiles/customotherconfigwidget.h create mode 100644 buildtools/custommakefiles/customotherconfigwidgetbase.ui create mode 100644 buildtools/custommakefiles/customprojectpart.cpp create mode 100644 buildtools/custommakefiles/customprojectpart.h create mode 100644 buildtools/custommakefiles/kdevcustomproject.desktop create mode 100644 buildtools/custommakefiles/kdevcustomproject.rc create mode 100644 buildtools/custommakefiles/selectnewfilesdialog.cpp create mode 100644 buildtools/custommakefiles/selectnewfilesdialog.h create mode 100644 buildtools/custommakefiles/selectnewfilesdialogbase.ui create mode 100644 buildtools/lib/Makefile.am create mode 100644 buildtools/lib/base/Mainpage.dox create mode 100644 buildtools/lib/base/Makefile.am create mode 100644 buildtools/lib/base/kdevbuildtool.cpp create mode 100644 buildtools/lib/base/kdevbuildtool.h create mode 100644 buildtools/lib/parsers/Makefile.am create mode 100644 buildtools/lib/parsers/autotools/Mainpage.dox create mode 100644 buildtools/lib/parsers/autotools/Makefile.am create mode 100644 buildtools/lib/parsers/autotools/autotools.ll create mode 100644 buildtools/lib/parsers/autotools/autotools.yy create mode 100644 buildtools/lib/parsers/autotools/autotools_lex.cpp create mode 100644 buildtools/lib/parsers/autotools/autotools_yacc.cpp create mode 100644 buildtools/lib/parsers/autotools/autotools_yacc.h create mode 100644 buildtools/lib/parsers/autotools/autotoolsast.cpp create mode 100644 buildtools/lib/parsers/autotools/autotoolsast.h create mode 100644 buildtools/lib/parsers/autotools/autotoolsdriver.cpp create mode 100644 buildtools/lib/parsers/autotools/autotoolsdriver.h create mode 100644 buildtools/lib/parsers/autotools/tests/Makefile.am create mode 100644 buildtools/lib/parsers/autotools/tests/runner.cpp create mode 100644 buildtools/lib/parsers/autotools/tests/viewer.cpp create mode 100644 buildtools/lib/parsers/autotools/tests/viewer.h create mode 100644 buildtools/lib/parsers/autotools/tests/viewer_main.cpp create mode 100644 buildtools/lib/parsers/autotools/tests/viewerbase.ui create mode 100644 buildtools/lib/parsers/qmake/FlexLexer.h create mode 100644 buildtools/lib/parsers/qmake/Mainpage.dox create mode 100644 buildtools/lib/parsers/qmake/Makefile.am create mode 100644 buildtools/lib/parsers/qmake/location.hh create mode 100644 buildtools/lib/parsers/qmake/position.hh create mode 100644 buildtools/lib/parsers/qmake/qmake.ll create mode 100644 buildtools/lib/parsers/qmake/qmake.yy create mode 100644 buildtools/lib/parsers/qmake/qmake_lex.cpp create mode 100644 buildtools/lib/parsers/qmake/qmake_lex.h create mode 100644 buildtools/lib/parsers/qmake/qmake_yacc.cpp create mode 100644 buildtools/lib/parsers/qmake/qmake_yacc.hpp create mode 100644 buildtools/lib/parsers/qmake/qmakeast.cpp create mode 100644 buildtools/lib/parsers/qmake/qmakeast.h create mode 100644 buildtools/lib/parsers/qmake/qmakeastvisitor.cpp create mode 100644 buildtools/lib/parsers/qmake/qmakeastvisitor.h create mode 100644 buildtools/lib/parsers/qmake/qmakedriver.cpp create mode 100644 buildtools/lib/parsers/qmake/qmakedriver.h create mode 100644 buildtools/lib/parsers/qmake/stack.hh create mode 100644 buildtools/lib/parsers/qmake/tests/Makefile.am create mode 100644 buildtools/lib/parsers/qmake/tests/runner.cpp create mode 100644 buildtools/lib/parsers/qmake/tests/viewer.cpp create mode 100644 buildtools/lib/parsers/qmake/tests/viewer.h create mode 100644 buildtools/lib/parsers/qmake/tests/viewer_main.cpp create mode 100644 buildtools/lib/parsers/qmake/tests/viewerbase.ui create mode 100644 buildtools/lib/widgets/Mainpage.dox create mode 100644 buildtools/lib/widgets/Makefile.am create mode 100644 buildtools/lib/widgets/addenvvardlg.cpp create mode 100644 buildtools/lib/widgets/addenvvardlg.h create mode 100644 buildtools/lib/widgets/addfilesdialog.cpp create mode 100644 buildtools/lib/widgets/addfilesdialog.h create mode 100644 buildtools/lib/widgets/environmentdisplaydialog.cpp create mode 100644 buildtools/lib/widgets/environmentdisplaydialog.h create mode 100644 buildtools/lib/widgets/environmentdisplaydialogbase.ui create mode 100644 buildtools/lib/widgets/environmentvariableswidget.cpp create mode 100644 buildtools/lib/widgets/environmentvariableswidget.h create mode 100644 buildtools/lib/widgets/environmentvariableswidgetbase.ui create mode 100644 buildtools/lib/widgets/envvartools.cpp create mode 100644 buildtools/lib/widgets/envvartools.h create mode 100644 buildtools/lib/widgets/makeoptionswidget.cpp create mode 100644 buildtools/lib/widgets/makeoptionswidget.h create mode 100644 buildtools/lib/widgets/makeoptionswidgetbase.ui create mode 100644 buildtools/lib/widgets/removesubprojectdialog.cpp create mode 100644 buildtools/lib/widgets/removesubprojectdialog.h create mode 100644 buildtools/lib/widgets/removesubprojectdlgbase.ui create mode 100644 buildtools/lib/widgets/runoptionswidget.cpp create mode 100644 buildtools/lib/widgets/runoptionswidget.h create mode 100644 buildtools/lib/widgets/runoptionswidgetbase.ui create mode 100644 buildtools/lib/widgets/subclassesdlg.cpp create mode 100644 buildtools/lib/widgets/subclassesdlg.h create mode 100644 buildtools/lib/widgets/subclassesdlgbase.ui create mode 100644 buildtools/pascal/Makefile.am create mode 100644 buildtools/pascal/README.dox create mode 100644 buildtools/pascal/kdevpascalproject.desktop create mode 100644 buildtools/pascal/kdevpascalproject.rc create mode 100644 buildtools/pascal/pascalglobaloptionsdlg.cpp create mode 100644 buildtools/pascal/pascalglobaloptionsdlg.h create mode 100644 buildtools/pascal/pascalproject_optionsdlgbase.ui create mode 100644 buildtools/pascal/pascalproject_part.cpp create mode 100644 buildtools/pascal/pascalproject_part.h create mode 100644 buildtools/pascal/pascalproject_widget.cpp create mode 100644 buildtools/pascal/pascalproject_widget.h create mode 100644 buildtools/pascal/pascalprojectoptionsdlg.cpp create mode 100644 buildtools/pascal/pascalprojectoptionsdlg.h create mode 100644 buildtools/pascal/service.cpp create mode 100644 buildtools/pascal/service.h create mode 100644 buildtools/qmake/Makefile.am create mode 100644 buildtools/qmake/README create mode 100644 buildtools/qmake/README.dox create mode 100644 buildtools/qmake/choosesubprojectdlg.cpp create mode 100644 buildtools/qmake/choosesubprojectdlg.h create mode 100644 buildtools/qmake/choosesubprojectdlgbase.ui create mode 100644 buildtools/qmake/createscopedlg.cpp create mode 100644 buildtools/qmake/createscopedlg.h create mode 100644 buildtools/qmake/createscopedlgbase.ui create mode 100644 buildtools/qmake/disablesubprojectdlg.cpp create mode 100644 buildtools/qmake/disablesubprojectdlg.h create mode 100644 buildtools/qmake/disablesubprojectdlgbase.ui create mode 100644 buildtools/qmake/kdevtmakeproject.desktop create mode 100644 buildtools/qmake/kdevtrollproject.desktop create mode 100644 buildtools/qmake/kdevtrollproject.rc create mode 100644 buildtools/qmake/newwidgetdlg.cpp create mode 100644 buildtools/qmake/newwidgetdlg.h create mode 100644 buildtools/qmake/newwidgetdlgbase.ui create mode 100644 buildtools/qmake/projectconfigurationdlg.cpp create mode 100644 buildtools/qmake/projectconfigurationdlg.h create mode 100644 buildtools/qmake/projectconfigurationdlgbase.ui create mode 100644 buildtools/qmake/qmakedefaultopts.cpp create mode 100644 buildtools/qmake/qmakedefaultopts.h create mode 100644 buildtools/qmake/qmakeoptionswidget.cpp create mode 100644 buildtools/qmake/qmakeoptionswidget.h create mode 100644 buildtools/qmake/qmakeoptionswidgetbase.ui create mode 100644 buildtools/qmake/qmakescopeitem.cpp create mode 100644 buildtools/qmake/qmakescopeitem.h create mode 100644 buildtools/qmake/scope.cpp create mode 100644 buildtools/qmake/scope.h create mode 100644 buildtools/qmake/trolllistview.cpp create mode 100644 buildtools/qmake/trolllistview.h create mode 100644 buildtools/qmake/trollprojectpart.cpp create mode 100644 buildtools/qmake/trollprojectpart.h create mode 100644 buildtools/qmake/trollprojectwidget.cpp create mode 100644 buildtools/qmake/trollprojectwidget.h create mode 100644 buildtools/script/Makefile.am create mode 100644 buildtools/script/README.dox create mode 100644 buildtools/script/kdevscriptproject.desktop create mode 100644 buildtools/script/kdevscriptproject.rc create mode 100644 buildtools/script/scriptnewfiledlg.cpp create mode 100644 buildtools/script/scriptnewfiledlg.h create mode 100644 buildtools/script/scriptoptionswidget.cpp create mode 100644 buildtools/script/scriptoptionswidget.h create mode 100644 buildtools/script/scriptoptionswidgetbase.ui create mode 100644 buildtools/script/scriptprojectpart.cpp create mode 100644 buildtools/script/scriptprojectpart.h create mode 100644 config.h.cmake create mode 100644 configure.in.bot create mode 100644 configure.in.in create mode 100644 doc/Makefile.am create mode 100644 doc/api/Architecture.dox create mode 100644 doc/api/Architecture.png create mode 100644 doc/api/Architecture.sxd create mode 100644 doc/api/Development.png create mode 100644 doc/api/Development.sxd create mode 100644 doc/api/EditorsSupportStatus.dox create mode 100644 doc/api/FutureTasks.dox create mode 100644 doc/api/HighPriTasks.dox create mode 100644 doc/api/HowToAddApplicationTemplates.dox create mode 100644 doc/api/HowToAddFileTemplates.dox create mode 100644 doc/api/HowToAddGenericBuildTools.dox create mode 100644 doc/api/HowToAddPlugins.dox create mode 100644 doc/api/HowToAddProgrammingLanguages.dox create mode 100644 doc/api/HowToDocument.dox create mode 100644 doc/api/LangSupportStatus.dox create mode 100644 doc/api/Mainpage.dox create mode 100644 doc/api/PropEditor.dox create mode 100644 doc/api/propeditor1.png create mode 100644 doc/api/propeditor2.png create mode 100644 doc/extras/Makefile.am create mode 100644 doc/extras/opengl.toc create mode 100644 doc/extras/sdl.toc create mode 100644 doc/extras/w3c/Makefile.am create mode 100644 doc/extras/w3c/w3c-dom-level2-html.toc create mode 100644 doc/extras/w3c/w3c-svg.toc create mode 100644 doc/extras/w3c/w3c-uaag10.toc create mode 100644 doc/kde_app_devel/Makefile.am create mode 100644 doc/kde_app_devel/appwizard.png create mode 100644 doc/kde_app_devel/index.docbook create mode 100644 doc/kde_app_devel/kscribblefiles.png create mode 100644 doc/kdearch/Makefile.am create mode 100644 doc/kdearch/affine-general.png create mode 100644 doc/kdearch/affine-rotate.png create mode 100644 doc/kdearch/affine-scale.png create mode 100644 doc/kdearch/affine-shear.png create mode 100644 doc/kdearch/affine-translate.png create mode 100644 doc/kdearch/brushstyles.png create mode 100644 doc/kdearch/canvas.png create mode 100644 doc/kdearch/capflat.png create mode 100644 doc/kdearch/capround.png create mode 100644 doc/kdearch/capsquare.png create mode 100644 doc/kdearch/index.docbook create mode 100644 doc/kdearch/joinbevel.png create mode 100644 doc/kdearch/joinmiter.png create mode 100644 doc/kdearch/joinround.png create mode 100644 doc/kdearch/konqi-mirrored.png create mode 100644 doc/kdearch/konqi-normal.png create mode 100644 doc/kdearch/konqi-rotated.png create mode 100644 doc/kdearch/konqi-sheared.png create mode 100644 doc/kdearch/kview-menu.png create mode 100644 doc/kdearch/opengl.png create mode 100644 doc/kdearch/penstyles.png create mode 100644 doc/kdearch/whatsthis.png create mode 100644 doc/kdevelop/Makefile.am create mode 100644 doc/kdevelop/SF-general.png create mode 100644 doc/kdevelop/SF-indent.png create mode 100644 doc/kdevelop/SF-other.png create mode 100644 doc/kdevelop/adv-build-management.docbook create mode 100644 doc/kdevelop/app-changelog.docbook create mode 100644 doc/kdevelop/app-files.docbook create mode 100644 doc/kdevelop/app-menu.docbook create mode 100644 doc/kdevelop/app-misc-info.docbook create mode 100644 doc/kdevelop/app-uimodes-examples.docbook create mode 100644 doc/kdevelop/applicationwizard.docbook create mode 100644 doc/kdevelop/automake-file-popup.png create mode 100644 doc/kdevelop/automake-manager.png create mode 100644 doc/kdevelop/automake-subproject-popup.png create mode 100644 doc/kdevelop/automake-target-popup.png create mode 100644 doc/kdevelop/automakemanager.png create mode 100644 doc/kdevelop/build-commands.png create mode 100644 doc/kdevelop/build-configurations.png create mode 100644 doc/kdevelop/build-menu-automake.png create mode 100644 doc/kdevelop/build-menu.png create mode 100644 doc/kdevelop/class-browsers.docbook create mode 100644 doc/kdevelop/classview.png create mode 100644 doc/kdevelop/commands.docbook create mode 100644 doc/kdevelop/configure-adddialog-baselibs.png create mode 100644 doc/kdevelop/configure-adddialog-qt.png create mode 100644 doc/kdevelop/configure-adddialog.png create mode 100644 doc/kdevelop/configure-doctree-DevHelp.png create mode 100644 doc/kdevelop/configure-doctree-TOC.png create mode 100644 doc/kdevelop/configure-doctree-bookmark.png create mode 100644 doc/kdevelop/configure-doctree-general.png create mode 100644 doc/kdevelop/configure-doctree-textsearch.png create mode 100644 doc/kdevelop/configure-docu-chm.png create mode 100644 doc/kdevelop/configure-docu-custom.png create mode 100644 doc/kdevelop/configure-docu-devhelp.png create mode 100644 doc/kdevelop/configure-docu-dox.png create mode 100644 doc/kdevelop/configure-docu-edit.png create mode 100644 doc/kdevelop/configure-docu-general.png create mode 100644 doc/kdevelop/configure-docu-indexgen.png create mode 100644 doc/kdevelop/configure-docu-toc.png create mode 100644 doc/kdevelop/configure-editor.png create mode 100644 doc/kdevelop/configure-file-selector.png create mode 100644 doc/kdevelop/configure-file-templates.png create mode 100644 doc/kdevelop/configure-general.png create mode 100644 doc/kdevelop/configure-project-buildconfig.png create mode 100644 doc/kdevelop/configure-project-configure.png create mode 100644 doc/kdevelop/configure-project-cpp.png create mode 100644 doc/kdevelop/configure-project-cppoptions.png create mode 100644 doc/kdevelop/configure-project-doc.png create mode 100644 doc/kdevelop/configure-project-make.png create mode 100644 doc/kdevelop/configure-project-run.png create mode 100644 doc/kdevelop/configure-select.png create mode 100644 doc/kdevelop/configure-snippets.png create mode 100644 doc/kdevelop/create-new-project-cvs.png create mode 100644 doc/kdevelop/create-new-project.png create mode 100644 doc/kdevelop/createnewproject.png create mode 100644 doc/kdevelop/createnewprojectoptions.png create mode 100644 doc/kdevelop/credits.docbook create mode 100644 doc/kdevelop/cvs.docbook create mode 100644 doc/kdevelop/debugger.docbook create mode 100644 doc/kdevelop/doctree-add-bookmark.png create mode 100644 doc/kdevelop/doctree-reduced.png create mode 100644 doc/kdevelop/doctree.png create mode 100644 doc/kdevelop/doctreeview.png create mode 100644 doc/kdevelop/documentation.docbook create mode 100644 doc/kdevelop/documents-contents.png create mode 100644 doc/kdevelop/documents-search.png create mode 100644 doc/kdevelop/edit-doctree-TOC-entry.png create mode 100644 doc/kdevelop/editing.docbook create mode 100644 doc/kdevelop/editor-ctags-lookup.png create mode 100644 doc/kdevelop/editor-ctags-menu.png create mode 100644 doc/kdevelop/editor-ctags-regenerate.png create mode 100644 doc/kdevelop/editor-find-menu.png create mode 100644 doc/kdevelop/editor-search-doc.png create mode 100644 doc/kdevelop/editor-switch-header.png create mode 100644 doc/kdevelop/empty-ide.png create mode 100644 doc/kdevelop/file-browsers.docbook create mode 100644 doc/kdevelop/file-list-close-selected.png create mode 100644 doc/kdevelop/file-list-session-create.png create mode 100644 doc/kdevelop/file-list-session-default.png create mode 100644 doc/kdevelop/file-selector.png create mode 100644 doc/kdevelop/filetree.png create mode 100644 doc/kdevelop/find-in-files.png create mode 100644 doc/kdevelop/folded-tabs.png create mode 100644 doc/kdevelop/getting-started.docbook create mode 100644 doc/kdevelop/hello-world-app.png create mode 100644 doc/kdevelop/importdirectory.png create mode 100644 doc/kdevelop/index.docbook create mode 100644 doc/kdevelop/kdcop_browsing.png create mode 100644 doc/kdevelop/kdevdesigner.png create mode 100644 doc/kdevelop/kdevelop-ideal-mode-0.png create mode 100644 doc/kdevelop/kdevelop-ideal-mode.png create mode 100644 doc/kdevelop/kdevelop-install.docbook create mode 100644 doc/kdevelop/kdevelop-mdi-mode.png create mode 100644 doc/kdevelop/kdevelop-scripting.docbook create mode 100644 doc/kdevelop/kdevelop-survey.docbook create mode 100644 doc/kdevelop/kdevelop-tabbed-mode.png create mode 100644 doc/kdevelop/kdevelop-toplevel-mode.png create mode 100755 doc/kdevelop/listplugins.sh create mode 100644 doc/kdevelop/loading-progress-bar.png create mode 100644 doc/kdevelop/nutshell.docbook create mode 100644 doc/kdevelop/open-project.png create mode 100644 doc/kdevelop/open-recent-project.png create mode 100644 doc/kdevelop/plugin-tools.docbook create mode 100644 doc/kdevelop/problem-report-all-todos.png create mode 100644 doc/kdevelop/problem-report-marks.png create mode 100644 doc/kdevelop/problem-report-todo.png create mode 100644 doc/kdevelop/project-advanced.docbook create mode 100644 doc/kdevelop/project-management.docbook create mode 100644 doc/kdevelop/raw-project-warning.png create mode 100644 doc/kdevelop/run-button.png create mode 100644 doc/kdevelop/script_location.png create mode 100644 doc/kdevelop/select-user-interface-0.png create mode 100644 doc/kdevelop/select-user-interface.png create mode 100644 doc/kdevelop/setup.docbook create mode 100644 doc/kdevelop/split-source-header-navigate.png create mode 100644 doc/kdevelop/split-source-header.png create mode 100644 doc/kdevelop/split-windows.png create mode 100644 doc/kdevelop/split-workspace.png create mode 100644 doc/kdevelop/survey-manual.docbook create mode 100644 doc/kdevelop/tutorial-debug-tree.png create mode 100644 doc/kdevelop/tutorial-hello-new.png create mode 100644 doc/kdevelop/tutorial-hello-options.png create mode 100644 doc/kdevelop/tutorial-new-project.png create mode 100644 doc/kdevelop/unixdev.docbook create mode 100644 doc/kdevelop/wrong-project-location.png create mode 100644 doc/platform/Mainpage.dox create mode 100644 doc/std/Makefile.am create mode 100644 doc/std/kdev3api.toc create mode 100644 doc/tools/Makefile.am create mode 100644 doc/tools/index-python create mode 100755 doc/tools/index-texi create mode 100644 doc/tools/index.xsl create mode 100644 doc/tools/toc-docbook create mode 100644 doc/tools/toc-gsdoc create mode 100644 doc/tools/toc-python create mode 100755 doc/tools/toc-texi create mode 100644 editors/Makefile.am create mode 100644 editors/editor-chooser/Makefile.am create mode 100644 editors/editor-chooser/README.dox create mode 100644 editors/editor-chooser/editchooser.ui create mode 100644 editors/editor-chooser/editorchooser_part.cpp create mode 100644 editors/editor-chooser/editorchooser_part.h create mode 100644 editors/editor-chooser/editorchooser_widget.cpp create mode 100644 editors/editor-chooser/editorchooser_widget.h create mode 100644 editors/editor-chooser/kdeveditorchooser.desktop create mode 100644 embedded/Makefile.am create mode 100644 embedded/visualboyadvance/Makefile.am create mode 100644 embedded/visualboyadvance/kdevpart_visualboyadvance.rc create mode 100644 embedded/visualboyadvance/kdevvisualboyadvance.desktop create mode 100644 embedded/visualboyadvance/vbaconfigwidget.cpp create mode 100644 embedded/visualboyadvance/vbaconfigwidget.h create mode 100644 embedded/visualboyadvance/vbaconfigwidgetbase.ui create mode 100644 embedded/visualboyadvance/visualboyadvance_part.cpp create mode 100644 embedded/visualboyadvance/visualboyadvance_part.h create mode 100644 kde-development-kdevelop.directory create mode 100644 kdevassistant.desktop create mode 100644 kdevdesigner/AUTHORS create mode 100644 kdevdesigner/LICENSE.GPL create mode 100644 kdevdesigner/Makefile.am create mode 100644 kdevdesigner/NEWS create mode 100644 kdevdesigner/README create mode 100644 kdevdesigner/TODO create mode 100644 kdevdesigner/designer/Makefile.am create mode 100644 kdevdesigner/designer/about.ui create mode 100644 kdevdesigner/designer/actiondnd.cpp create mode 100644 kdevdesigner/designer/actiondnd.h create mode 100644 kdevdesigner/designer/actioneditor.ui create mode 100644 kdevdesigner/designer/actioneditorimpl.cpp create mode 100644 kdevdesigner/designer/actioneditorimpl.h create mode 100644 kdevdesigner/designer/actionlistview.cpp create mode 100644 kdevdesigner/designer/actionlistview.h create mode 100644 kdevdesigner/designer/asciivalidator.cpp create mode 100644 kdevdesigner/designer/asciivalidator.h create mode 100644 kdevdesigner/designer/command.cpp create mode 100644 kdevdesigner/designer/command.h create mode 100644 kdevdesigner/designer/configtoolboxdialog.ui create mode 100644 kdevdesigner/designer/configtoolboxdialog.ui.h create mode 100644 kdevdesigner/designer/connectiondialog.ui create mode 100644 kdevdesigner/designer/connectiondialog.ui.h create mode 100644 kdevdesigner/designer/connectionitems.cpp create mode 100644 kdevdesigner/designer/connectionitems.h create mode 100644 kdevdesigner/designer/connectiontable.cpp create mode 100644 kdevdesigner/designer/connectiontable.h create mode 100644 kdevdesigner/designer/createtemplate.ui create mode 100644 kdevdesigner/designer/customwidgeteditor.ui create mode 100644 kdevdesigner/designer/customwidgeteditorimpl.cpp create mode 100644 kdevdesigner/designer/customwidgeteditorimpl.h create mode 100644 kdevdesigner/designer/database.cpp create mode 100644 kdevdesigner/designer/database.h create mode 100644 kdevdesigner/designer/dbconnection.ui create mode 100644 kdevdesigner/designer/dbconnectioneditor.ui create mode 100644 kdevdesigner/designer/dbconnectionimpl.cpp create mode 100644 kdevdesigner/designer/dbconnectionimpl.h create mode 100644 kdevdesigner/designer/dbconnections.ui create mode 100644 kdevdesigner/designer/dbconnectionsimpl.cpp create mode 100644 kdevdesigner/designer/dbconnectionsimpl.h create mode 100644 kdevdesigner/designer/defs.cpp create mode 100644 kdevdesigner/designer/defs.h create mode 100644 kdevdesigner/designer/designer_pch.h create mode 100644 kdevdesigner/designer/designeraction.cpp create mode 100644 kdevdesigner/designer/designeraction.h create mode 100644 kdevdesigner/designer/designerapp.cpp create mode 100644 kdevdesigner/designer/designerapp.h create mode 100644 kdevdesigner/designer/designerappiface.cpp create mode 100644 kdevdesigner/designer/designerappiface.h create mode 100644 kdevdesigner/designer/editfunctions.ui create mode 100644 kdevdesigner/designer/editfunctionsimpl.cpp create mode 100644 kdevdesigner/designer/editfunctionsimpl.h create mode 100644 kdevdesigner/designer/filechooser.cpp create mode 100644 kdevdesigner/designer/filechooser.h create mode 100644 kdevdesigner/designer/finddialog.ui create mode 100644 kdevdesigner/designer/finddialog.ui.h create mode 100644 kdevdesigner/designer/formfile.cpp create mode 100644 kdevdesigner/designer/formfile.h create mode 100644 kdevdesigner/designer/formsettings.ui create mode 100644 kdevdesigner/designer/formsettingsimpl.cpp create mode 100644 kdevdesigner/designer/formsettingsimpl.h create mode 100644 kdevdesigner/designer/formwindow.cpp create mode 100644 kdevdesigner/designer/formwindow.h create mode 100644 kdevdesigner/designer/gotolinedialog.ui create mode 100644 kdevdesigner/designer/gotolinedialog.ui.h create mode 100644 kdevdesigner/designer/hierarchyview.cpp create mode 100644 kdevdesigner/designer/hierarchyview.h create mode 100644 kdevdesigner/designer/iconvieweditor.ui create mode 100644 kdevdesigner/designer/iconvieweditorimpl.cpp create mode 100644 kdevdesigner/designer/iconvieweditorimpl.h create mode 100644 kdevdesigner/designer/kdevdesigner_part.cpp create mode 100644 kdevdesigner/designer/kdevdesigner_part.desktop create mode 100644 kdevdesigner/designer/kdevdesigner_part.h create mode 100644 kdevdesigner/designer/kdevdesigner_part.rc create mode 100644 kdevdesigner/designer/kdevdesigner_part_sh.rc create mode 100644 kdevdesigner/designer/layout.cpp create mode 100644 kdevdesigner/designer/layout.h create mode 100644 kdevdesigner/designer/listboxdnd.cpp create mode 100644 kdevdesigner/designer/listboxdnd.h create mode 100644 kdevdesigner/designer/listboxeditor.ui create mode 100644 kdevdesigner/designer/listboxeditorimpl.cpp create mode 100644 kdevdesigner/designer/listboxeditorimpl.h create mode 100644 kdevdesigner/designer/listboxrename.cpp create mode 100644 kdevdesigner/designer/listboxrename.h create mode 100644 kdevdesigner/designer/listdnd.cpp create mode 100644 kdevdesigner/designer/listdnd.h create mode 100644 kdevdesigner/designer/listeditor.ui create mode 100644 kdevdesigner/designer/listeditor.ui.h create mode 100644 kdevdesigner/designer/listviewdnd.cpp create mode 100644 kdevdesigner/designer/listviewdnd.h create mode 100644 kdevdesigner/designer/listvieweditor.ui create mode 100644 kdevdesigner/designer/listvieweditorimpl.cpp create mode 100644 kdevdesigner/designer/listvieweditorimpl.h create mode 100644 kdevdesigner/designer/mainwindow.cpp create mode 100644 kdevdesigner/designer/mainwindow.h create mode 100644 kdevdesigner/designer/mainwindowactions.cpp create mode 100644 kdevdesigner/designer/menubareditor.cpp create mode 100644 kdevdesigner/designer/menubareditor.h create mode 100644 kdevdesigner/designer/metadatabase.cpp create mode 100644 kdevdesigner/designer/metadatabase.h create mode 100644 kdevdesigner/designer/multilineeditor.ui create mode 100644 kdevdesigner/designer/multilineeditorimpl.cpp create mode 100644 kdevdesigner/designer/multilineeditorimpl.h create mode 100644 kdevdesigner/designer/myiconloader.cpp create mode 100644 kdevdesigner/designer/myiconloader.h create mode 100644 kdevdesigner/designer/newform.ui create mode 100644 kdevdesigner/designer/newformimpl.cpp create mode 100644 kdevdesigner/designer/newformimpl.h create mode 100644 kdevdesigner/designer/orderindicator.cpp create mode 100644 kdevdesigner/designer/orderindicator.h create mode 100644 kdevdesigner/designer/outputwindow.cpp create mode 100644 kdevdesigner/designer/outputwindow.h create mode 100644 kdevdesigner/designer/paletteeditor.ui create mode 100644 kdevdesigner/designer/paletteeditoradvanced.ui create mode 100644 kdevdesigner/designer/paletteeditoradvancedimpl.cpp create mode 100644 kdevdesigner/designer/paletteeditoradvancedimpl.h create mode 100644 kdevdesigner/designer/paletteeditorimpl.cpp create mode 100644 kdevdesigner/designer/paletteeditorimpl.h create mode 100644 kdevdesigner/designer/pics/Makefile.am create mode 100644 kdevdesigner/designer/pics/designer_adjustsize.png create mode 100644 kdevdesigner/designer/pics/designer_appicon.png create mode 100644 kdevdesigner/designer/pics/designer_arrow.png create mode 100644 kdevdesigner/designer/pics/designer_background.png create mode 100644 kdevdesigner/designer/pics/designer_book.png create mode 100644 kdevdesigner/designer/pics/designer_buttongroup.png create mode 100644 kdevdesigner/designer/pics/designer_checkbox.png create mode 100644 kdevdesigner/designer/pics/designer_combobox.png create mode 100644 kdevdesigner/designer/pics/designer_connecttool.png create mode 100644 kdevdesigner/designer/pics/designer_cross.png create mode 100644 kdevdesigner/designer/pics/designer_customwidget.png create mode 100644 kdevdesigner/designer/pics/designer_d_adjustsize.png create mode 100644 kdevdesigner/designer/pics/designer_d_book.png create mode 100644 kdevdesigner/designer/pics/designer_d_buttongroup.png create mode 100644 kdevdesigner/designer/pics/designer_d_checkbox.png create mode 100644 kdevdesigner/designer/pics/designer_d_combobox.png create mode 100644 kdevdesigner/designer/pics/designer_d_connecttool.png create mode 100644 kdevdesigner/designer/pics/designer_d_customwidget.png create mode 100644 kdevdesigner/designer/pics/designer_d_databrowser.png create mode 100644 kdevdesigner/designer/pics/designer_d_datatable.png create mode 100644 kdevdesigner/designer/pics/designer_d_dataview.png create mode 100644 kdevdesigner/designer/pics/designer_d_dateedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_datetimeedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_dial.png create mode 100644 kdevdesigner/designer/pics/designer_d_down.png create mode 100644 kdevdesigner/designer/pics/designer_d_editbreaklayout.png create mode 100644 kdevdesigner/designer/pics/designer_d_editcopy.png create mode 100644 kdevdesigner/designer/pics/designer_d_editcut.png create mode 100644 kdevdesigner/designer/pics/designer_d_editdelete.png create mode 100644 kdevdesigner/designer/pics/designer_d_editgrid.png create mode 100644 kdevdesigner/designer/pics/designer_d_edithlayout.png create mode 100644 kdevdesigner/designer/pics/designer_d_edithlayoutsplit.png create mode 100644 kdevdesigner/designer/pics/designer_d_editlower.png create mode 100644 kdevdesigner/designer/pics/designer_d_editpaste.png create mode 100644 kdevdesigner/designer/pics/designer_d_editraise.png create mode 100644 kdevdesigner/designer/pics/designer_d_editslots.png create mode 100644 kdevdesigner/designer/pics/designer_d_editvlayout.png create mode 100644 kdevdesigner/designer/pics/designer_d_editvlayoutsplit.png create mode 100644 kdevdesigner/designer/pics/designer_d_filenew.png create mode 100644 kdevdesigner/designer/pics/designer_d_fileopen.png create mode 100644 kdevdesigner/designer/pics/designer_d_filesave.png create mode 100644 kdevdesigner/designer/pics/designer_d_folder.png create mode 100644 kdevdesigner/designer/pics/designer_d_form.png create mode 100644 kdevdesigner/designer/pics/designer_d_frame.png create mode 100644 kdevdesigner/designer/pics/designer_d_groupbox.png create mode 100644 kdevdesigner/designer/pics/designer_d_help.png create mode 100644 kdevdesigner/designer/pics/designer_d_home.png create mode 100644 kdevdesigner/designer/pics/designer_d_iconview.png create mode 100644 kdevdesigner/designer/pics/designer_d_image.png create mode 100644 kdevdesigner/designer/pics/designer_d_label.png create mode 100644 kdevdesigner/designer/pics/designer_d_layout.png create mode 100644 kdevdesigner/designer/pics/designer_d_lcdnumber.png create mode 100644 kdevdesigner/designer/pics/designer_d_left.png create mode 100644 kdevdesigner/designer/pics/designer_d_line.png create mode 100644 kdevdesigner/designer/pics/designer_d_lineedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_listbox.png create mode 100644 kdevdesigner/designer/pics/designer_d_listview.png create mode 100644 kdevdesigner/designer/pics/designer_d_multilineedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_newform.png create mode 100644 kdevdesigner/designer/pics/designer_d_ordertool.png create mode 100644 kdevdesigner/designer/pics/designer_d_pixlabel.png create mode 100644 kdevdesigner/designer/pics/designer_d_pointer.png create mode 100644 kdevdesigner/designer/pics/designer_d_print.png create mode 100644 kdevdesigner/designer/pics/designer_d_progress.png create mode 100644 kdevdesigner/designer/pics/designer_d_project.png create mode 100644 kdevdesigner/designer/pics/designer_d_pushbutton.png create mode 100644 kdevdesigner/designer/pics/designer_d_radiobutton.png create mode 100644 kdevdesigner/designer/pics/designer_d_redo.png create mode 100644 kdevdesigner/designer/pics/designer_d_richtextedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_right.png create mode 100644 kdevdesigner/designer/pics/designer_d_scrollbar.png create mode 100644 kdevdesigner/designer/pics/designer_d_searchfind.png create mode 100644 kdevdesigner/designer/pics/designer_d_setbuddy.png create mode 100644 kdevdesigner/designer/pics/designer_d_slider.png create mode 100644 kdevdesigner/designer/pics/designer_d_spacer.png create mode 100644 kdevdesigner/designer/pics/designer_d_spinbox.png create mode 100644 kdevdesigner/designer/pics/designer_d_table.png create mode 100644 kdevdesigner/designer/pics/designer_d_tabwidget.png create mode 100644 kdevdesigner/designer/pics/designer_d_textbold.png create mode 100644 kdevdesigner/designer/pics/designer_d_textbrowser.png create mode 100644 kdevdesigner/designer/pics/designer_d_textcenter.png create mode 100644 kdevdesigner/designer/pics/designer_d_textedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_textfont.png create mode 100644 kdevdesigner/designer/pics/designer_d_texth1.png create mode 100644 kdevdesigner/designer/pics/designer_d_texth2.png create mode 100644 kdevdesigner/designer/pics/designer_d_texth3.png create mode 100644 kdevdesigner/designer/pics/designer_d_textitalic.png create mode 100644 kdevdesigner/designer/pics/designer_d_textjustify.png create mode 100644 kdevdesigner/designer/pics/designer_d_textlarger.png create mode 100644 kdevdesigner/designer/pics/designer_d_textleft.png create mode 100644 kdevdesigner/designer/pics/designer_d_textlinebreak.png create mode 100644 kdevdesigner/designer/pics/designer_d_textparagraph.png create mode 100644 kdevdesigner/designer/pics/designer_d_textright.png create mode 100644 kdevdesigner/designer/pics/designer_d_textsmaller.png create mode 100644 kdevdesigner/designer/pics/designer_d_textteletext.png create mode 100644 kdevdesigner/designer/pics/designer_d_textunderline.png create mode 100644 kdevdesigner/designer/pics/designer_d_textview.png create mode 100644 kdevdesigner/designer/pics/designer_d_timeedit.png create mode 100644 kdevdesigner/designer/pics/designer_d_toolbox.png create mode 100644 kdevdesigner/designer/pics/designer_d_toolbutton.png create mode 100644 kdevdesigner/designer/pics/designer_d_undo.png create mode 100644 kdevdesigner/designer/pics/designer_d_up.png create mode 100644 kdevdesigner/designer/pics/designer_d_widgetstack.png create mode 100644 kdevdesigner/designer/pics/designer_d_wizarddata.png create mode 100644 kdevdesigner/designer/pics/designer_d_wizarddialog.png create mode 100644 kdevdesigner/designer/pics/designer_d_wordwrap.png create mode 100644 kdevdesigner/designer/pics/designer_databrowser.png create mode 100644 kdevdesigner/designer/pics/designer_datatable.png create mode 100644 kdevdesigner/designer/pics/designer_dataview.png create mode 100644 kdevdesigner/designer/pics/designer_dateedit.png create mode 100644 kdevdesigner/designer/pics/designer_datetimeedit.png create mode 100644 kdevdesigner/designer/pics/designer_dial.png create mode 100644 kdevdesigner/designer/pics/designer_down.png create mode 100644 kdevdesigner/designer/pics/designer_editbreaklayout.png create mode 100644 kdevdesigner/designer/pics/designer_editcopy.png create mode 100644 kdevdesigner/designer/pics/designer_editcut.png create mode 100644 kdevdesigner/designer/pics/designer_editdelete.png create mode 100644 kdevdesigner/designer/pics/designer_editgrid.png create mode 100644 kdevdesigner/designer/pics/designer_edithlayout.png create mode 100644 kdevdesigner/designer/pics/designer_edithlayoutsplit.png create mode 100644 kdevdesigner/designer/pics/designer_editlower.png create mode 100644 kdevdesigner/designer/pics/designer_editpaste.png create mode 100644 kdevdesigner/designer/pics/designer_editraise.png create mode 100644 kdevdesigner/designer/pics/designer_editslots.png create mode 100644 kdevdesigner/designer/pics/designer_editvlayout.png create mode 100644 kdevdesigner/designer/pics/designer_editvlayoutsplit.png create mode 100644 kdevdesigner/designer/pics/designer_filenew.png create mode 100644 kdevdesigner/designer/pics/designer_fileopen.png create mode 100644 kdevdesigner/designer/pics/designer_filesave.png create mode 100644 kdevdesigner/designer/pics/designer_folder.png create mode 100644 kdevdesigner/designer/pics/designer_form.png create mode 100644 kdevdesigner/designer/pics/designer_frame.png create mode 100644 kdevdesigner/designer/pics/designer_groupbox.png create mode 100644 kdevdesigner/designer/pics/designer_hand.png create mode 100644 kdevdesigner/designer/pics/designer_help.png create mode 100644 kdevdesigner/designer/pics/designer_home.png create mode 100644 kdevdesigner/designer/pics/designer_hsplit.png create mode 100644 kdevdesigner/designer/pics/designer_ibeam.png create mode 100644 kdevdesigner/designer/pics/designer_iconview.png create mode 100644 kdevdesigner/designer/pics/designer_image.png create mode 100644 kdevdesigner/designer/pics/designer_label.png create mode 100644 kdevdesigner/designer/pics/designer_layout.png create mode 100644 kdevdesigner/designer/pics/designer_lcdnumber.png create mode 100644 kdevdesigner/designer/pics/designer_left.png create mode 100644 kdevdesigner/designer/pics/designer_line.png create mode 100644 kdevdesigner/designer/pics/designer_lineedit.png create mode 100644 kdevdesigner/designer/pics/designer_listbox.png create mode 100644 kdevdesigner/designer/pics/designer_listview.png create mode 100644 kdevdesigner/designer/pics/designer_multilineedit.png create mode 100644 kdevdesigner/designer/pics/designer_newform.png create mode 100644 kdevdesigner/designer/pics/designer_no.png create mode 100644 kdevdesigner/designer/pics/designer_object.png create mode 100644 kdevdesigner/designer/pics/designer_ordertool.png create mode 100644 kdevdesigner/designer/pics/designer_pixlabel.png create mode 100644 kdevdesigner/designer/pics/designer_pointer.png create mode 100644 kdevdesigner/designer/pics/designer_print.png create mode 100644 kdevdesigner/designer/pics/designer_progress.png create mode 100644 kdevdesigner/designer/pics/designer_project.png create mode 100644 kdevdesigner/designer/pics/designer_pushbutton.png create mode 100644 kdevdesigner/designer/pics/designer_qtlogo.png create mode 100644 kdevdesigner/designer/pics/designer_radiobutton.png create mode 100644 kdevdesigner/designer/pics/designer_redo.png create mode 100644 kdevdesigner/designer/pics/designer_resetproperty.png create mode 100644 kdevdesigner/designer/pics/designer_richtextedit.png create mode 100644 kdevdesigner/designer/pics/designer_right.png create mode 100644 kdevdesigner/designer/pics/designer_s_down.png create mode 100644 kdevdesigner/designer/pics/designer_s_editcut.png create mode 100644 kdevdesigner/designer/pics/designer_s_left.png create mode 100644 kdevdesigner/designer/pics/designer_s_right.png create mode 100644 kdevdesigner/designer/pics/designer_s_up.png create mode 100644 kdevdesigner/designer/pics/designer_scrollbar.png create mode 100644 kdevdesigner/designer/pics/designer_searchfind.png create mode 100644 kdevdesigner/designer/pics/designer_setbuddy.png create mode 100644 kdevdesigner/designer/pics/designer_sizeall.png create mode 100644 kdevdesigner/designer/pics/designer_sizeb.png create mode 100644 kdevdesigner/designer/pics/designer_sizef.png create mode 100644 kdevdesigner/designer/pics/designer_sizeh.png create mode 100644 kdevdesigner/designer/pics/designer_sizev.png create mode 100644 kdevdesigner/designer/pics/designer_slider.png create mode 100644 kdevdesigner/designer/pics/designer_spacer.png create mode 100644 kdevdesigner/designer/pics/designer_spinbox.png create mode 100644 kdevdesigner/designer/pics/designer_splash.png create mode 100644 kdevdesigner/designer/pics/designer_table.png create mode 100644 kdevdesigner/designer/pics/designer_tabwidget.png create mode 100644 kdevdesigner/designer/pics/designer_textbold.png create mode 100644 kdevdesigner/designer/pics/designer_textbrowser.png create mode 100644 kdevdesigner/designer/pics/designer_textcenter.png create mode 100644 kdevdesigner/designer/pics/designer_textedit.png create mode 100644 kdevdesigner/designer/pics/designer_textfont.png create mode 100644 kdevdesigner/designer/pics/designer_texth1.png create mode 100644 kdevdesigner/designer/pics/designer_texth2.png create mode 100644 kdevdesigner/designer/pics/designer_texth3.png create mode 100644 kdevdesigner/designer/pics/designer_textitalic.png create mode 100644 kdevdesigner/designer/pics/designer_textjustify.png create mode 100644 kdevdesigner/designer/pics/designer_textlarger.png create mode 100644 kdevdesigner/designer/pics/designer_textleft.png create mode 100644 kdevdesigner/designer/pics/designer_textlinebreak.png create mode 100644 kdevdesigner/designer/pics/designer_textparagraph.png create mode 100644 kdevdesigner/designer/pics/designer_textright.png create mode 100644 kdevdesigner/designer/pics/designer_textsmaller.png create mode 100644 kdevdesigner/designer/pics/designer_textteletext.png create mode 100644 kdevdesigner/designer/pics/designer_textunderline.png create mode 100644 kdevdesigner/designer/pics/designer_textview.png create mode 100644 kdevdesigner/designer/pics/designer_timeedit.png create mode 100644 kdevdesigner/designer/pics/designer_toolbox.png create mode 100644 kdevdesigner/designer/pics/designer_toolbutton.png create mode 100644 kdevdesigner/designer/pics/designer_undo.png create mode 100644 kdevdesigner/designer/pics/designer_up.png create mode 100644 kdevdesigner/designer/pics/designer_uparrow.png create mode 100644 kdevdesigner/designer/pics/designer_vsplit.png create mode 100644 kdevdesigner/designer/pics/designer_wait.png create mode 100644 kdevdesigner/designer/pics/designer_widgetstack.png create mode 100644 kdevdesigner/designer/pics/designer_wizarddata.png create mode 100644 kdevdesigner/designer/pics/designer_wizarddialog.png create mode 100644 kdevdesigner/designer/pics/designer_wordwrap.png create mode 100644 kdevdesigner/designer/pixmapchooser.cpp create mode 100644 kdevdesigner/designer/pixmapchooser.h create mode 100644 kdevdesigner/designer/pixmapcollection.cpp create mode 100644 kdevdesigner/designer/pixmapcollection.h create mode 100644 kdevdesigner/designer/pixmapcollectioneditor.ui create mode 100644 kdevdesigner/designer/pixmapcollectioneditor.ui.h create mode 100644 kdevdesigner/designer/pixmapfunction.ui create mode 100644 kdevdesigner/designer/popupmenueditor.cpp create mode 100644 kdevdesigner/designer/popupmenueditor.h create mode 100644 kdevdesigner/designer/preferences.ui create mode 100644 kdevdesigner/designer/previewframe.cpp create mode 100644 kdevdesigner/designer/previewframe.h create mode 100644 kdevdesigner/designer/previewwidget.ui create mode 100644 kdevdesigner/designer/previewwidgetimpl.cpp create mode 100644 kdevdesigner/designer/previewwidgetimpl.h create mode 100644 kdevdesigner/designer/project.cpp create mode 100644 kdevdesigner/designer/project.h create mode 100644 kdevdesigner/designer/projectsettings.ui create mode 100644 kdevdesigner/designer/projectsettingsimpl.cpp create mode 100644 kdevdesigner/designer/projectsettingsimpl.h create mode 100644 kdevdesigner/designer/propertyeditor.cpp create mode 100644 kdevdesigner/designer/propertyeditor.h create mode 100644 kdevdesigner/designer/propertyobject.cpp create mode 100644 kdevdesigner/designer/propertyobject.h create mode 100644 kdevdesigner/designer/qcompletionedit.cpp create mode 100644 kdevdesigner/designer/qcompletionedit.h create mode 100644 kdevdesigner/designer/replacedialog.ui create mode 100644 kdevdesigner/designer/replacedialog.ui.h create mode 100644 kdevdesigner/designer/resource.cpp create mode 100644 kdevdesigner/designer/resource.h create mode 100644 kdevdesigner/designer/richtextfontdialog.ui create mode 100644 kdevdesigner/designer/richtextfontdialog.ui.h create mode 100644 kdevdesigner/designer/sizehandle.cpp create mode 100644 kdevdesigner/designer/sizehandle.h create mode 100644 kdevdesigner/designer/sourceeditor.cpp create mode 100644 kdevdesigner/designer/sourceeditor.h create mode 100644 kdevdesigner/designer/sourcefile.cpp create mode 100644 kdevdesigner/designer/sourcefile.h create mode 100644 kdevdesigner/designer/startdialog.ui create mode 100644 kdevdesigner/designer/startdialogimpl.cpp create mode 100644 kdevdesigner/designer/startdialogimpl.h create mode 100644 kdevdesigner/designer/styledbutton.cpp create mode 100644 kdevdesigner/designer/styledbutton.h create mode 100644 kdevdesigner/designer/syntaxhighlighter_html.cpp create mode 100644 kdevdesigner/designer/syntaxhighlighter_html.h create mode 100644 kdevdesigner/designer/tableeditor.ui create mode 100644 kdevdesigner/designer/tableeditorimpl.cpp create mode 100644 kdevdesigner/designer/tableeditorimpl.h create mode 100644 kdevdesigner/designer/timestamp.cpp create mode 100644 kdevdesigner/designer/timestamp.h create mode 100644 kdevdesigner/designer/variabledialog.ui create mode 100644 kdevdesigner/designer/variabledialogimpl.cpp create mode 100644 kdevdesigner/designer/variabledialogimpl.h create mode 100644 kdevdesigner/designer/widgetaction.cpp create mode 100644 kdevdesigner/designer/widgetaction.h create mode 100644 kdevdesigner/designer/widgetfactory.cpp create mode 100644 kdevdesigner/designer/widgetfactory.h create mode 100644 kdevdesigner/designer/wizardeditor.ui create mode 100644 kdevdesigner/designer/wizardeditorimpl.cpp create mode 100644 kdevdesigner/designer/wizardeditorimpl.h create mode 100644 kdevdesigner/designer/workspace.cpp create mode 100644 kdevdesigner/designer/workspace.h create mode 100644 kdevdesigner/interfaces/actioninterface.h create mode 100644 kdevdesigner/interfaces/classbrowserinterface.h create mode 100644 kdevdesigner/interfaces/designerinterface.h create mode 100644 kdevdesigner/interfaces/editorinterface.h create mode 100644 kdevdesigner/interfaces/filterinterface.h create mode 100644 kdevdesigner/interfaces/interpreterinterface.h create mode 100644 kdevdesigner/interfaces/languageinterface.h create mode 100644 kdevdesigner/interfaces/preferenceinterface.h create mode 100644 kdevdesigner/interfaces/projectsettingsiface.h create mode 100644 kdevdesigner/interfaces/sourcetemplateiface.h create mode 100644 kdevdesigner/interfaces/templatewizardiface.h create mode 100644 kdevdesigner/interfaces/widgetinterface.h create mode 100644 kdevdesigner/plugins/Makefile.am create mode 100644 kdevdesigner/plugins/languageinterfaceimpl.cpp create mode 100644 kdevdesigner/plugins/languageinterfaceimpl.h create mode 100644 kdevdesigner/shared/Makefile.am create mode 100644 kdevdesigner/shared/domtool.cpp create mode 100644 kdevdesigner/shared/domtool.h create mode 100644 kdevdesigner/shared/globaldefs.h create mode 100644 kdevdesigner/shared/parser.cpp create mode 100644 kdevdesigner/shared/parser.h create mode 100644 kdevdesigner/shared/ui2uib.cpp create mode 100644 kdevdesigner/shared/ui2uib.h create mode 100644 kdevdesigner/shared/uib.cpp create mode 100644 kdevdesigner/shared/uib.h create mode 100644 kdevdesigner/shared/widgetdatabase.cpp create mode 100644 kdevdesigner/shared/widgetdatabase.h create mode 100644 kdevdesigner/src/Makefile.am create mode 100644 kdevdesigner/src/kdevdesigner.cpp create mode 100644 kdevdesigner/src/kdevdesigner.desktop create mode 100644 kdevdesigner/src/kdevdesigner.h create mode 100644 kdevdesigner/src/kdevdesigner_shell.rc create mode 100644 kdevdesigner/src/main.cpp create mode 100644 kdevdesigner/uilib/Makefile.am create mode 100644 kdevdesigner/uilib/database.cpp create mode 100644 kdevdesigner/uilib/database2.h create mode 100644 kdevdesigner/uilib/qwidgetfactory.cpp create mode 100644 kdevdesigner/uilib/qwidgetfactory.h create mode 100644 kdevelop.desktop create mode 100644 kdevelop.lsm create mode 100644 kdevelop.m4.in create mode 100644 kdevelop_c_cpp.desktop create mode 100644 kdevelop_kde_cpp.desktop create mode 100644 kdevelop_ruby.desktop create mode 100644 kdevelop_scripting.desktop create mode 100755 kdevprj2kdevelop create mode 100644 languages/Makefile.am create mode 100644 languages/ada/AdaAST.hpp create mode 100644 languages/ada/AdaLexer.cpp create mode 100644 languages/ada/AdaLexer.hpp create mode 100644 languages/ada/AdaParser.cpp create mode 100644 languages/ada/AdaParser.hpp create mode 100644 languages/ada/AdaStoreWalker.cpp create mode 100644 languages/ada/AdaStoreWalker.hpp create mode 100644 languages/ada/AdaStoreWalkerTokenTypes.hpp create mode 100644 languages/ada/AdaStoreWalkerTokenTypes.txt create mode 100644 languages/ada/AdaTokenTypes.hpp create mode 100644 languages/ada/AdaTokenTypes.txt create mode 100644 languages/ada/AdaTreeParserSuper.cpp create mode 100644 languages/ada/AdaTreeParserSuper.hpp create mode 100644 languages/ada/AdaTreeParserSuperTokenTypes.hpp create mode 100644 languages/ada/AdaTreeParserSuperTokenTypes.txt create mode 100644 languages/ada/Makefile.am create mode 100644 languages/ada/README create mode 100644 languages/ada/README.dox create mode 100644 languages/ada/ada.g create mode 100644 languages/ada/ada.store.g create mode 100644 languages/ada/ada.tree.g create mode 100644 languages/ada/ada_utils.cpp create mode 100644 languages/ada/ada_utils.hpp create mode 100644 languages/ada/adasupport.cpp create mode 100644 languages/ada/adasupport.hpp create mode 100644 languages/ada/adasupportpart.cpp create mode 100644 languages/ada/adasupportpart.h create mode 100644 languages/ada/addclass.cpp create mode 100644 languages/ada/addclass.h create mode 100644 languages/ada/addclassdlg.ui create mode 100644 languages/ada/app_templates/Makefile.am create mode 100644 languages/ada/app_templates/ada.appwizard create mode 100644 languages/ada/app_templates/adahello/.kdev_ignore create mode 100644 languages/ada/app_templates/adahello/Makefile.am create mode 100644 languages/ada/app_templates/adahello/ada-Makefile create mode 100644 languages/ada/app_templates/adahello/ada-Makefile.am create mode 100644 languages/ada/app_templates/adahello/ada-Makefile.cvs create mode 100644 languages/ada/app_templates/adahello/adahello create mode 100644 languages/ada/app_templates/adahello/adahello.kdevtemplate create mode 100644 languages/ada/app_templates/adahello/adahello.png create mode 100644 languages/ada/app_templates/adahello/app.kdevelop create mode 100644 languages/ada/app_templates/adahello/app.kdevelop.filelist create mode 100644 languages/ada/app_templates/adahello/configure.in create mode 100644 languages/ada/app_templates/adahello/main.adb create mode 100644 languages/ada/app_templates/adahello/src-Makefile.am create mode 100644 languages/ada/backgroundparser.cpp create mode 100644 languages/ada/backgroundparser.h create mode 100644 languages/ada/configproblemreporter.ui create mode 100644 languages/ada/configproblemreporter.ui.h create mode 100644 languages/ada/configure.in.in create mode 100644 languages/ada/doc/Makefile.am create mode 100644 languages/ada/doc/ada.toc create mode 100644 languages/ada/doc/ada_bugs_gcc.toc create mode 100644 languages/ada/file_templates/Makefile.am create mode 100644 languages/ada/file_templates/adb create mode 100644 languages/ada/file_templates/ads create mode 100644 languages/ada/kdevadasupport.desktop create mode 100644 languages/ada/kdevadasupport.rc create mode 100644 languages/ada/preambles.h create mode 100644 languages/ada/problemreporter.cpp create mode 100644 languages/ada/problemreporter.h create mode 100644 languages/bash/Makefile.am create mode 100644 languages/bash/README.dox create mode 100644 languages/bash/app_templates/Makefile.am create mode 100644 languages/bash/app_templates/bash.appwizard create mode 100644 languages/bash/app_templates/bashhello/.kdev_ignore create mode 100644 languages/bash/app_templates/bashhello/Makefile.am create mode 100644 languages/bash/app_templates/bashhello/app.kdevelop create mode 100644 languages/bash/app_templates/bashhello/app.sh create mode 100644 languages/bash/app_templates/bashhello/bashhello create mode 100644 languages/bash/app_templates/bashhello/bashhello.kdevtemplate create mode 100644 languages/bash/app_templates/bashhello/bashhello.png create mode 100644 languages/bash/bashsupport_part.cpp create mode 100644 languages/bash/bashsupport_part.h create mode 100644 languages/bash/doc/Makefile.am create mode 100644 languages/bash/doc/bash.toc create mode 100644 languages/bash/doc/bash_bugs.toc create mode 100644 languages/bash/kdevbashsupport.desktop create mode 100644 languages/bash/kdevbashsupport.rc create mode 100644 languages/cpp/KDevCppSupportIface.cpp create mode 100644 languages/cpp/KDevCppSupportIface.h create mode 100644 languages/cpp/Makefile.am create mode 100644 languages/cpp/README.dox create mode 100644 languages/cpp/addattributedialog.cpp create mode 100644 languages/cpp/addattributedialog.h create mode 100644 languages/cpp/addattributedialogbase.ui create mode 100644 languages/cpp/addmethoddialog.cpp create mode 100644 languages/cpp/addmethoddialog.h create mode 100644 languages/cpp/addmethoddialogbase.ui create mode 100644 languages/cpp/app_templates/Makefile.am create mode 100644 languages/cpp/app_templates/automakeempty/Makefile.am create mode 100644 languages/cpp/app_templates/automakeempty/app.kdevelop create mode 100644 languages/cpp/app_templates/automakeempty/automakeempty-Makefile.am create mode 100644 languages/cpp/app_templates/automakeempty/automakeempty-Makefile.cvs create mode 100644 languages/cpp/app_templates/automakeempty/automakeempty.kdevtemplate create mode 100644 languages/cpp/app_templates/automakeempty/automakeempty.png create mode 100644 languages/cpp/app_templates/automakeempty/configure.in create mode 100644 languages/cpp/app_templates/c.appwizard create mode 100644 languages/cpp/app_templates/chello/.kdev_ignore create mode 100644 languages/cpp/app_templates/chello/Makefile.am create mode 100644 languages/cpp/app_templates/chello/app.kdevelop create mode 100644 languages/cpp/app_templates/chello/c-Makefile.am create mode 100644 languages/cpp/app_templates/chello/c-Makefile.cvs create mode 100644 languages/cpp/app_templates/chello/chello.kdevtemplate create mode 100644 languages/cpp/app_templates/chello/chello.png create mode 100644 languages/cpp/app_templates/chello/configure.in create mode 100644 languages/cpp/app_templates/chello/main.c create mode 100644 languages/cpp/app_templates/chello/src-Makefile.am create mode 100644 languages/cpp/app_templates/chello_gba/.kdev_ignore create mode 100644 languages/cpp/app_templates/chello_gba/Makefile.am create mode 100644 languages/cpp/app_templates/chello_gba/README.devel create mode 100644 languages/cpp/app_templates/chello_gba/app.kdevelop create mode 100644 languages/cpp/app_templates/chello_gba/c-Makefile.am create mode 100644 languages/cpp/app_templates/chello_gba/c-Makefile.cvs create mode 100644 languages/cpp/app_templates/chello_gba/chellogba.kdevtemplate create mode 100644 languages/cpp/app_templates/chello_gba/chellogba.png create mode 100644 languages/cpp/app_templates/chello_gba/configure.in create mode 100644 languages/cpp/app_templates/chello_gba/font.bmp create mode 100644 languages/cpp/app_templates/chello_gba/font.raw.c create mode 100644 languages/cpp/app_templates/chello_gba/gba.h create mode 100644 languages/cpp/app_templates/chello_gba/main.c create mode 100644 languages/cpp/app_templates/chello_gba/main.h create mode 100644 languages/cpp/app_templates/chello_gba/master.pal.c create mode 100644 languages/cpp/app_templates/chello_gba/src-Makefile.am create mode 100644 languages/cpp/app_templates/clanlib/.kdev_ignore create mode 100644 languages/cpp/app_templates/clanlib/Makefile.am create mode 100644 languages/cpp/app_templates/clanlib/app-Makefile.am create mode 100644 languages/cpp/app_templates/clanlib/app-autogen.sh create mode 100644 languages/cpp/app_templates/clanlib/app-configure.in create mode 100644 languages/cpp/app_templates/clanlib/app.kdevelop create mode 100644 languages/cpp/app_templates/clanlib/clanlib.kdevtemplate create mode 100644 languages/cpp/app_templates/clanlib/clanlib.png create mode 100644 languages/cpp/app_templates/clanlib/main.cpp create mode 100644 languages/cpp/app_templates/clanlib/src-Makefile.am create mode 100644 languages/cpp/app_templates/cmakelibc/CMakeLists.txt create mode 100644 languages/cpp/app_templates/cmakelibc/CMakeLists.txt.src create mode 100644 languages/cpp/app_templates/cmakelibc/Makefile.am create mode 100644 languages/cpp/app_templates/cmakelibc/cmakelibc create mode 100644 languages/cpp/app_templates/cmakelibc/cmakelibc.kdevtemplate create mode 100644 languages/cpp/app_templates/cmakelibc/cmakelibc.png create mode 100644 languages/cpp/app_templates/cmakelibc/lib.c create mode 100644 languages/cpp/app_templates/cmakelibc/lib.h create mode 100644 languages/cpp/app_templates/cmakelibc/test.c create mode 100644 languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt create mode 100644 languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt.src create mode 100644 languages/cpp/app_templates/cmakelibcpp/Makefile.am create mode 100644 languages/cpp/app_templates/cmakelibcpp/cmakelibcpp create mode 100644 languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.kdevtemplate create mode 100644 languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.png create mode 100644 languages/cpp/app_templates/cmakelibcpp/lib.cpp create mode 100644 languages/cpp/app_templates/cmakelibcpp/lib.h create mode 100644 languages/cpp/app_templates/cmakelibcpp/test.cpp create mode 100644 languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt create mode 100644 languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt.src create mode 100644 languages/cpp/app_templates/cmakeqt3app/Makefile.am create mode 100644 languages/cpp/app_templates/cmakeqt3app/cmakeqt3app create mode 100644 languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp create mode 100644 languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.h create mode 100644 languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.kdevtemplate create mode 100644 languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.png create mode 100644 languages/cpp/app_templates/cmakeqt3app/fileopen.xpm create mode 100644 languages/cpp/app_templates/cmakeqt3app/fileprint.xpm create mode 100644 languages/cpp/app_templates/cmakeqt3app/filesave.xpm create mode 100644 languages/cpp/app_templates/cmakeqt3app/main.cpp create mode 100644 languages/cpp/app_templates/cmakesimple/CMakeLists.txt create mode 100644 languages/cpp/app_templates/cmakesimple/Makefile.am create mode 100644 languages/cpp/app_templates/cmakesimple/README create mode 100644 languages/cpp/app_templates/cmakesimple/cmakesimple create mode 100644 languages/cpp/app_templates/cmakesimple/cmakesimple.kdevtemplate create mode 100644 languages/cpp/app_templates/cmakesimple/cmakesimple.png create mode 100644 languages/cpp/app_templates/cmakesimple/main.cpp create mode 100644 languages/cpp/app_templates/cmakesimplec/CMakeLists.txt create mode 100644 languages/cpp/app_templates/cmakesimplec/Makefile.am create mode 100644 languages/cpp/app_templates/cmakesimplec/cmakesimplec create mode 100644 languages/cpp/app_templates/cmakesimplec/cmakesimplec.kdevtemplate create mode 100644 languages/cpp/app_templates/cmakesimplec/cmakesimplec.png create mode 100644 languages/cpp/app_templates/cmakesimplec/main.c create mode 100644 languages/cpp/app_templates/cpp.appwizard create mode 100644 languages/cpp/app_templates/cppcurseshello/.kdev_ignore create mode 100644 languages/cpp/app_templates/cppcurseshello/Makefile.am create mode 100644 languages/cpp/app_templates/cppcurseshello/app-configure.in create mode 100644 languages/cpp/app_templates/cppcurseshello/app.kdevelop create mode 100644 languages/cpp/app_templates/cppcurseshello/cpp-Makefile.am create mode 100644 languages/cpp/app_templates/cppcurseshello/cpp-Makefile.cvs create mode 100644 languages/cpp/app_templates/cppcurseshello/cppcurseshello create mode 100644 languages/cpp/app_templates/cppcurseshello/cppcurseshello.kdevtemplate create mode 100644 languages/cpp/app_templates/cppcurseshello/cppcurseshello.png create mode 100644 languages/cpp/app_templates/cppcurseshello/main.cpp create mode 100644 languages/cpp/app_templates/cppcurseshello/src-Makefile.am create mode 100644 languages/cpp/app_templates/cpphello/.kdev_ignore create mode 100644 languages/cpp/app_templates/cpphello/Makefile.am create mode 100644 languages/cpp/app_templates/cpphello/app.kdevelop create mode 100644 languages/cpp/app_templates/cpphello/configure.in create mode 100644 languages/cpp/app_templates/cpphello/cpp-Makefile.am create mode 100644 languages/cpp/app_templates/cpphello/cpp-Makefile.cvs create mode 100644 languages/cpp/app_templates/cpphello/cpphello.kdevtemplate create mode 100644 languages/cpp/app_templates/cpphello/cpphello.png create mode 100644 languages/cpp/app_templates/cpphello/main.cpp create mode 100644 languages/cpp/app_templates/cpphello/src-Makefile.am create mode 100644 languages/cpp/app_templates/cppsdlhello/.kdev_ignore create mode 100644 languages/cpp/app_templates/cppsdlhello/Makefile.am create mode 100644 languages/cpp/app_templates/cppsdlhello/README create mode 100644 languages/cpp/app_templates/cppsdlhello/acinclude.m4 create mode 100644 languages/cpp/app_templates/cppsdlhello/app.kdevelop create mode 100644 languages/cpp/app_templates/cppsdlhello/configure.in create mode 100644 languages/cpp/app_templates/cppsdlhello/cpp-Makefile.am create mode 100644 languages/cpp/app_templates/cppsdlhello/cpp-Makefile.cvs create mode 100644 languages/cpp/app_templates/cppsdlhello/cppsdlhello create mode 100644 languages/cpp/app_templates/cppsdlhello/cppsdlhello.kdevtemplate create mode 100644 languages/cpp/app_templates/cppsdlhello/cppsdlhello.png create mode 100644 languages/cpp/app_templates/cppsdlhello/main.cpp create mode 100644 languages/cpp/app_templates/cppsdlhello/src-Makefile.am create mode 100644 languages/cpp/app_templates/dcopservice/.kdev_ignore create mode 100644 languages/cpp/app_templates/dcopservice/Makefile.am create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice.cpp create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice.desktop create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice.h create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice.kdevelop create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice.kdevtemplate create mode 100644 languages/cpp/app_templates/dcopservice/dcopservice.png create mode 100644 languages/cpp/app_templates/dcopservice/main.cpp create mode 100644 languages/cpp/app_templates/dcopservice/src-Makefile.am create mode 100644 languages/cpp/app_templates/dcopservice/subdirs create mode 100644 languages/cpp/app_templates/generichello/.kdev_ignore create mode 100644 languages/cpp/app_templates/generichello/Makefile.am create mode 100644 languages/cpp/app_templates/generichello/app.kdevelop create mode 100644 languages/cpp/app_templates/generichello/app.prj create mode 100644 languages/cpp/app_templates/generichello/cpphello.png create mode 100644 languages/cpp/app_templates/generichello/generichello.kdevtemplate create mode 100644 languages/cpp/app_templates/generichello/main.cpp create mode 100644 languages/cpp/app_templates/gnome2mmapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/gnome2mmapp/Makefile.am create mode 100644 languages/cpp/app_templates/gnome2mmapp/acconfig.h create mode 100644 languages/cpp/app_templates/gnome2mmapp/app-Makefile.am create mode 100644 languages/cpp/app_templates/gnome2mmapp/app.kdevelop create mode 100755 languages/cpp/app_templates/gnome2mmapp/autogen.sh create mode 100644 languages/cpp/app_templates/gnome2mmapp/config.h create mode 100644 languages/cpp/app_templates/gnome2mmapp/configure.in create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mm.glade create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mm.gladep create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mmapp create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.png create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window.cc create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window.hh create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh create mode 100644 languages/cpp/app_templates/gnome2mmapp/src-Makefile.am create mode 100644 languages/cpp/app_templates/gtk2mmapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/gtk2mmapp/Makefile.am create mode 100644 languages/cpp/app_templates/gtk2mmapp/acconfig.h create mode 100644 languages/cpp/app_templates/gtk2mmapp/app-Makefile.am create mode 100644 languages/cpp/app_templates/gtk2mmapp/app.kdevelop create mode 100755 languages/cpp/app_templates/gtk2mmapp/autogen.sh create mode 100644 languages/cpp/app_templates/gtk2mmapp/config.h create mode 100644 languages/cpp/app_templates/gtk2mmapp/configure.in create mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc create mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mm.glade create mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mm.gladep create mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate create mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.png create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window.cc create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window.hh create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh create mode 100644 languages/cpp/app_templates/gtk2mmapp/src-Makefile.am create mode 100644 languages/cpp/app_templates/kapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/kapp/Makefile.am create mode 100644 languages/cpp/app_templates/kapp/README create mode 100644 languages/cpp/app_templates/kapp/app.cpp create mode 100644 languages/cpp/app_templates/kapp/app.desktop create mode 100644 languages/cpp/app_templates/kapp/app.h create mode 100644 languages/cpp/app_templates/kapp/app.kdevelop create mode 100644 languages/cpp/app_templates/kapp/app.kdevses create mode 100644 languages/cpp/app_templates/kapp/app_client.cpp create mode 100644 languages/cpp/app_templates/kapp/appiface.h create mode 100644 languages/cpp/app_templates/kapp/appui.rc create mode 100644 languages/cpp/app_templates/kapp/appview.cpp create mode 100644 languages/cpp/app_templates/kapp/appview.h create mode 100644 languages/cpp/app_templates/kapp/kapp.kdevtemplate create mode 100644 languages/cpp/app_templates/kapp/kapp.png create mode 100644 languages/cpp/app_templates/kapp/main.cpp create mode 100644 languages/cpp/app_templates/kapp/pref.cpp create mode 100644 languages/cpp/app_templates/kapp/pref.h create mode 100644 languages/cpp/app_templates/kapp/src-Makefile.am create mode 100644 languages/cpp/app_templates/kapp/subdirs create mode 100644 languages/cpp/app_templates/kateplugin/.kdev_ignore create mode 100644 languages/cpp/app_templates/kateplugin/Makefile.am create mode 100644 languages/cpp/app_templates/kateplugin/hi16-action-plugin.png create mode 100644 languages/cpp/app_templates/kateplugin/hi22-action-plugin.png create mode 100644 languages/cpp/app_templates/kateplugin/kateplugin.kdevtemplate create mode 100644 languages/cpp/app_templates/kateplugin/kateplugin.png create mode 100644 languages/cpp/app_templates/kateplugin/plugin.desktop create mode 100644 languages/cpp/app_templates/kateplugin/plugin.kdevelop create mode 100644 languages/cpp/app_templates/kateplugin/plugin_app.cpp create mode 100644 languages/cpp/app_templates/kateplugin/plugin_app.h create mode 100644 languages/cpp/app_templates/kateplugin/plugin_app.rc create mode 100644 languages/cpp/app_templates/kateplugin/src-Makefile.am create mode 100644 languages/cpp/app_templates/kateplugin/subdirs create mode 100644 languages/cpp/app_templates/kateplugin2/.kdev_ignore create mode 100644 languages/cpp/app_templates/kateplugin2/Makefile.am create mode 100644 languages/cpp/app_templates/kateplugin2/hi16-action-plugin.png create mode 100644 languages/cpp/app_templates/kateplugin2/hi22-action-plugin.png create mode 100644 languages/cpp/app_templates/kateplugin2/kateplugin2.kdevtemplate create mode 100644 languages/cpp/app_templates/kateplugin2/kateplugin2.png create mode 100644 languages/cpp/app_templates/kateplugin2/plugin.desktop create mode 100644 languages/cpp/app_templates/kateplugin2/plugin.kdevelop create mode 100644 languages/cpp/app_templates/kateplugin2/plugin_app.cpp create mode 100644 languages/cpp/app_templates/kateplugin2/plugin_app.h create mode 100644 languages/cpp/app_templates/kateplugin2/plugin_app.rc create mode 100644 languages/cpp/app_templates/kateplugin2/src-Makefile.am create mode 100644 languages/cpp/app_templates/kateplugin2/subdirs create mode 100644 languages/cpp/app_templates/kcmodule/.kdev_ignore create mode 100644 languages/cpp/app_templates/kcmodule/Makefile.am create mode 100644 languages/cpp/app_templates/kcmodule/kcmodule.kdevtemplate create mode 100644 languages/cpp/app_templates/kcmodule/kcmodule.png create mode 100644 languages/cpp/app_templates/kcmodule/module.cpp create mode 100644 languages/cpp/app_templates/kcmodule/module.desktop create mode 100644 languages/cpp/app_templates/kcmodule/module.h create mode 100644 languages/cpp/app_templates/kcmodule/module.kdevelop create mode 100644 languages/cpp/app_templates/kcmodule/src-Makefile.am create mode 100644 languages/cpp/app_templates/kcmodule/subdirs create mode 100644 languages/cpp/app_templates/kconfig35/Makefile.am create mode 100644 languages/cpp/app_templates/kconfig35/README create mode 100644 languages/cpp/app_templates/kconfig35/app.cpp create mode 100644 languages/cpp/app_templates/kconfig35/app.desktop create mode 100644 languages/cpp/app_templates/kconfig35/app.h create mode 100644 languages/cpp/app_templates/kconfig35/app.kcfg create mode 100644 languages/cpp/app_templates/kconfig35/app.kdevelop create mode 100644 languages/cpp/app_templates/kconfig35/appui.rc create mode 100644 languages/cpp/app_templates/kconfig35/appview.cpp create mode 100644 languages/cpp/app_templates/kconfig35/appview.h create mode 100644 languages/cpp/app_templates/kconfig35/appview_base.ui create mode 100644 languages/cpp/app_templates/kconfig35/kconfig35.kdevtemplate create mode 100644 languages/cpp/app_templates/kconfig35/kconfig35.png create mode 100644 languages/cpp/app_templates/kconfig35/kxt35.png create mode 100644 languages/cpp/app_templates/kconfig35/main.cpp create mode 100644 languages/cpp/app_templates/kconfig35/prefs-base.ui create mode 100644 languages/cpp/app_templates/kconfig35/prefs.cpp create mode 100644 languages/cpp/app_templates/kconfig35/prefs.h create mode 100644 languages/cpp/app_templates/kconfig35/settings.kcfgc create mode 100644 languages/cpp/app_templates/kconfig35/src-Makefile.am create mode 100644 languages/cpp/app_templates/kconfig35/src-configure.in.in create mode 100644 languages/cpp/app_templates/kconfig35/subdirs create mode 100644 languages/cpp/app_templates/kde4app/CMakeLists.txt create mode 100644 languages/cpp/app_templates/kde4app/Makefile.am create mode 100644 languages/cpp/app_templates/kde4app/README create mode 100644 languages/cpp/app_templates/kde4app/kapp4.cpp create mode 100644 languages/cpp/app_templates/kde4app/kapp4.desktop create mode 100644 languages/cpp/app_templates/kde4app/kapp4.h create mode 100644 languages/cpp/app_templates/kde4app/kapp4.kcfg create mode 100644 languages/cpp/app_templates/kde4app/kapp4view.cpp create mode 100644 languages/cpp/app_templates/kde4app/kapp4view.h create mode 100644 languages/cpp/app_templates/kde4app/kapp4view_base.ui create mode 100644 languages/cpp/app_templates/kde4app/kde4app.kdevelop create mode 100644 languages/cpp/app_templates/kde4app/kde4app.kdevelop.filelist create mode 100644 languages/cpp/app_templates/kde4app/kde4app.kdevtemplate create mode 100644 languages/cpp/app_templates/kde4app/kde4app.png create mode 100644 languages/cpp/app_templates/kde4app/kde4appui.rc create mode 100644 languages/cpp/app_templates/kde4app/main.cpp create mode 100644 languages/cpp/app_templates/kde4app/prefs_base.ui create mode 100644 languages/cpp/app_templates/kde4app/settings.kcfgc create mode 100644 languages/cpp/app_templates/kdecpp.appwizard create mode 100644 languages/cpp/app_templates/kdedcop/.kdev_ignore create mode 100644 languages/cpp/app_templates/kdedcop/Makefile.am create mode 100644 languages/cpp/app_templates/kdedcop/app.cpp create mode 100644 languages/cpp/app_templates/kdedcop/app.h create mode 100644 languages/cpp/app_templates/kdedcop/app.kdevelop create mode 100644 languages/cpp/app_templates/kdedcop/app_iface.h create mode 100644 languages/cpp/app_templates/kdedcop/kdedcop.kdevtemplate create mode 100644 languages/cpp/app_templates/kdedcop/kdedcop.png create mode 100644 languages/cpp/app_templates/kdedcop/main.cpp create mode 100644 languages/cpp/app_templates/kdedcop/mainclass.cpp create mode 100644 languages/cpp/app_templates/kdedcop/mainclass.h create mode 100644 languages/cpp/app_templates/kdedcop/src-Makefile.am create mode 100644 languages/cpp/app_templates/kdedcop/subdirs create mode 100644 languages/cpp/app_templates/kdevlang/.kdev_ignore create mode 100644 languages/cpp/app_templates/kdevlang/Makefile.am create mode 100644 languages/cpp/app_templates/kdevlang/README.dox create mode 100644 languages/cpp/app_templates/kdevlang/app.kdevelop create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang-configure.in.in create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang.desktop create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang.kdevtemplate create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang.png create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang.rc create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang_part.cpp create mode 100644 languages/cpp/app_templates/kdevlang/kdevlang_part.h create mode 100644 languages/cpp/app_templates/kdevlang/src-Makefile.am create mode 100644 languages/cpp/app_templates/kdevpart/.kdev_ignore create mode 100644 languages/cpp/app_templates/kdevpart/Makefile.am create mode 100644 languages/cpp/app_templates/kdevpart/README.dox create mode 100644 languages/cpp/app_templates/kdevpart/app.kdevelop create mode 100644 languages/cpp/app_templates/kdevpart/globalconfig.cpp create mode 100644 languages/cpp/app_templates/kdevpart/globalconfig.h create mode 100644 languages/cpp/app_templates/kdevpart/globalconfigbase.ui create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart.desktop create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart.kdevtemplate create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart.png create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart_part.cpp create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart_part.h create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart_part.rc create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart_widget.cpp create mode 100644 languages/cpp/app_templates/kdevpart/kdevpart_widget.h create mode 100644 languages/cpp/app_templates/kdevpart/projectconfig.cpp create mode 100644 languages/cpp/app_templates/kdevpart/projectconfig.h create mode 100644 languages/cpp/app_templates/kdevpart/projectconfigbase.ui create mode 100644 languages/cpp/app_templates/kdevpart/src-Makefile.am create mode 100644 languages/cpp/app_templates/kdevpart2/.kdev_ignore create mode 100644 languages/cpp/app_templates/kdevpart2/Makefile.am create mode 100644 languages/cpp/app_templates/kdevpart2/README.dox create mode 100644 languages/cpp/app_templates/kdevpart2/app.kdevelop create mode 100644 languages/cpp/app_templates/kdevpart2/globalconfig.cpp create mode 100644 languages/cpp/app_templates/kdevpart2/globalconfig.h create mode 100644 languages/cpp/app_templates/kdevpart2/globalconfigbase.ui create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart-configure.in.in create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart.desktop create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart2.kdevtemplate create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart2.png create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart_part.cpp create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart_part.h create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart_part.rc create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart_widget.cpp create mode 100644 languages/cpp/app_templates/kdevpart2/kdevpart_widget.h create mode 100644 languages/cpp/app_templates/kdevpart2/projectconfig.cpp create mode 100644 languages/cpp/app_templates/kdevpart2/projectconfig.h create mode 100644 languages/cpp/app_templates/kdevpart2/projectconfigbase.ui create mode 100644 languages/cpp/app_templates/kdevpart2/src-Makefile.am create mode 100644 languages/cpp/app_templates/kdevpart2/subdirs create mode 100644 languages/cpp/app_templates/kfileplugin/.kdev_ignore create mode 100644 languages/cpp/app_templates/kfileplugin/Makefile.am create mode 100644 languages/cpp/app_templates/kfileplugin/README.devel create mode 100644 languages/cpp/app_templates/kfileplugin/kfile_plugin.cpp create mode 100644 languages/cpp/app_templates/kfileplugin/kfile_plugin.desktop create mode 100644 languages/cpp/app_templates/kfileplugin/kfile_plugin.h create mode 100644 languages/cpp/app_templates/kfileplugin/kfileplugin create mode 100644 languages/cpp/app_templates/kfileplugin/kfileplugin.kdevtemplate create mode 100644 languages/cpp/app_templates/kfileplugin/kfileplugin.png create mode 100644 languages/cpp/app_templates/kfileplugin/plugin.kdevelop create mode 100644 languages/cpp/app_templates/kfileplugin/src-Makefile.am create mode 100644 languages/cpp/app_templates/kfileplugin/subdirs create mode 100644 languages/cpp/app_templates/khello/.kdev_ignore create mode 100644 languages/cpp/app_templates/khello/Makefile.am create mode 100644 languages/cpp/app_templates/khello/app.cpp create mode 100644 languages/cpp/app_templates/khello/app.desktop create mode 100644 languages/cpp/app_templates/khello/app.h create mode 100644 languages/cpp/app_templates/khello/app.kdevelop create mode 100644 languages/cpp/app_templates/khello/appui.rc create mode 100644 languages/cpp/app_templates/khello/khello.kdevtemplate create mode 100644 languages/cpp/app_templates/khello/khello.png create mode 100644 languages/cpp/app_templates/khello/main.cpp create mode 100644 languages/cpp/app_templates/khello/src-Makefile.am create mode 100644 languages/cpp/app_templates/khello/subdirs create mode 100644 languages/cpp/app_templates/khello2/.kdev_ignore create mode 100644 languages/cpp/app_templates/khello2/Makefile.am create mode 100644 languages/cpp/app_templates/khello2/app.cpp create mode 100644 languages/cpp/app_templates/khello2/app.desktop create mode 100644 languages/cpp/app_templates/khello2/app.h create mode 100644 languages/cpp/app_templates/khello2/app.kdevelop create mode 100644 languages/cpp/app_templates/khello2/appui.rc create mode 100644 languages/cpp/app_templates/khello2/khello2.kdevtemplate create mode 100644 languages/cpp/app_templates/khello2/khello2.png create mode 100644 languages/cpp/app_templates/khello2/main.cpp create mode 100644 languages/cpp/app_templates/khello2/src-Makefile.am create mode 100644 languages/cpp/app_templates/khello2/subdirs create mode 100644 languages/cpp/app_templates/khello2/widget.cpp create mode 100644 languages/cpp/app_templates/khello2/widget.h create mode 100644 languages/cpp/app_templates/khello2/widgetbase.ui create mode 100644 languages/cpp/app_templates/kicker/.kdev_ignore create mode 100644 languages/cpp/app_templates/kicker/Makefile.am create mode 100644 languages/cpp/app_templates/kicker/applet.cpp create mode 100644 languages/cpp/app_templates/kicker/applet.desktop create mode 100644 languages/cpp/app_templates/kicker/applet.h create mode 100644 languages/cpp/app_templates/kicker/applet.kdevelop create mode 100644 languages/cpp/app_templates/kicker/kicker.kdevtemplate create mode 100644 languages/cpp/app_templates/kicker/kicker.png create mode 100644 languages/cpp/app_templates/kicker/src-Makefile.am create mode 100644 languages/cpp/app_templates/kicker/subdirs create mode 100644 languages/cpp/app_templates/kioslave/.kdev_ignore create mode 100644 languages/cpp/app_templates/kioslave/Makefile.am create mode 100644 languages/cpp/app_templates/kioslave/kioslave.kdevtemplate create mode 100644 languages/cpp/app_templates/kioslave/kioslave.png create mode 100644 languages/cpp/app_templates/kioslave/slave.cpp create mode 100644 languages/cpp/app_templates/kioslave/slave.h create mode 100644 languages/cpp/app_templates/kioslave/slave.kdevelop create mode 100644 languages/cpp/app_templates/kioslave/slave.protocol create mode 100644 languages/cpp/app_templates/kioslave/src-Makefile.am create mode 100644 languages/cpp/app_templates/kioslave/subdirs create mode 100644 languages/cpp/app_templates/kmake/Makefile.am create mode 100644 languages/cpp/app_templates/kmake/app.cpp create mode 100644 languages/cpp/app_templates/kmake/app.desktop create mode 100644 languages/cpp/app_templates/kmake/app.kdevelop create mode 100644 languages/cpp/app_templates/kmake/app.pro create mode 100644 languages/cpp/app_templates/kmake/appui.rc create mode 100644 languages/cpp/app_templates/kmake/kmake.kdevtemplate create mode 100644 languages/cpp/app_templates/kmake/kmake.png create mode 100644 languages/cpp/app_templates/kmake/mainview.ui create mode 100644 languages/cpp/app_templates/kmake/mainviewimp.cpp create mode 100644 languages/cpp/app_templates/kmake/mainviewimp.h create mode 100644 languages/cpp/app_templates/kmake/src.pro create mode 100644 languages/cpp/app_templates/kmod/.kdev_ignore create mode 100644 languages/cpp/app_templates/kmod/Makefile.am create mode 100644 languages/cpp/app_templates/kmod/kmod-driver.c create mode 100644 languages/cpp/app_templates/kmod/kmod.kdevelop create mode 100644 languages/cpp/app_templates/kmod/kmod.kdevtemplate create mode 100644 languages/cpp/app_templates/kmod/kmod.png create mode 100644 languages/cpp/app_templates/kmod/src-Makefile create mode 100644 languages/cpp/app_templates/kofficepart/.kdev_ignore create mode 100644 languages/cpp/app_templates/kofficepart/Makefile.am create mode 100644 languages/cpp/app_templates/kofficepart/kde-configure.in.in create mode 100644 languages/cpp/app_templates/kofficepart/kopart.desktop create mode 100644 languages/cpp/app_templates/kofficepart/kopart.kdevelop create mode 100644 languages/cpp/app_templates/kofficepart/kopart.kdevtemplate create mode 100644 languages/cpp/app_templates/kofficepart/kopart.png create mode 100644 languages/cpp/app_templates/kofficepart/kopart.rc create mode 100644 languages/cpp/app_templates/kofficepart/kopart_aboutdata.h create mode 100644 languages/cpp/app_templates/kofficepart/kopart_factory.cpp create mode 100644 languages/cpp/app_templates/kofficepart/kopart_factory.h create mode 100644 languages/cpp/app_templates/kofficepart/kopart_part.cpp create mode 100644 languages/cpp/app_templates/kofficepart/kopart_part.h create mode 100644 languages/cpp/app_templates/kofficepart/kopart_view.cpp create mode 100644 languages/cpp/app_templates/kofficepart/kopart_view.h create mode 100644 languages/cpp/app_templates/kofficepart/main.cpp create mode 100644 languages/cpp/app_templates/kofficepart/src-Makefile.am create mode 100644 languages/cpp/app_templates/kofficepart/subdirs create mode 100644 languages/cpp/app_templates/kofficepart/x-kopart.desktop create mode 100644 languages/cpp/app_templates/konqnavpanel/.kdev_ignore create mode 100644 languages/cpp/app_templates/konqnavpanel/Makefile.am create mode 100644 languages/cpp/app_templates/konqnavpanel/konqnavpanel.cpp create mode 100644 languages/cpp/app_templates/konqnavpanel/konqnavpanel.desktop create mode 100644 languages/cpp/app_templates/konqnavpanel/konqnavpanel.h create mode 100644 languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevelop create mode 100644 languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevtemplate create mode 100644 languages/cpp/app_templates/konqnavpanel/konqnavpanel.png create mode 100644 languages/cpp/app_templates/konqnavpanel/src-Makefile.am create mode 100644 languages/cpp/app_templates/konqnavpanel/subdirs create mode 100644 languages/cpp/app_templates/kpartapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/kpartapp/Makefile.am create mode 100644 languages/cpp/app_templates/kpartapp/app.cpp create mode 100644 languages/cpp/app_templates/kpartapp/app.desktop create mode 100644 languages/cpp/app_templates/kpartapp/app.h create mode 100644 languages/cpp/app_templates/kpartapp/app.kdevelop create mode 100644 languages/cpp/app_templates/kpartapp/app_part.cpp create mode 100644 languages/cpp/app_templates/kpartapp/app_part.h create mode 100644 languages/cpp/app_templates/kpartapp/app_part.rc create mode 100644 languages/cpp/app_templates/kpartapp/app_shell.rc create mode 100644 languages/cpp/app_templates/kpartapp/kpartapp.kdevtemplate create mode 100644 languages/cpp/app_templates/kpartapp/kpartapp.png create mode 100644 languages/cpp/app_templates/kpartapp/main.cpp create mode 100644 languages/cpp/app_templates/kpartapp/src-Makefile.am create mode 100644 languages/cpp/app_templates/kpartapp/subdirs create mode 100644 languages/cpp/app_templates/kpartplugin/.kdev_ignore create mode 100644 languages/cpp/app_templates/kpartplugin/Makefile.am create mode 100644 languages/cpp/app_templates/kpartplugin/hi16-action-plugin.png create mode 100644 languages/cpp/app_templates/kpartplugin/hi22-action-plugin.png create mode 100644 languages/cpp/app_templates/kpartplugin/kpartplugin.kdevtemplate create mode 100644 languages/cpp/app_templates/kpartplugin/kpartplugin.png create mode 100644 languages/cpp/app_templates/kpartplugin/plugin.kdevelop create mode 100644 languages/cpp/app_templates/kpartplugin/plugin_app.cpp create mode 100644 languages/cpp/app_templates/kpartplugin/plugin_app.h create mode 100644 languages/cpp/app_templates/kpartplugin/plugin_app.rc create mode 100644 languages/cpp/app_templates/kpartplugin/src-Makefile.am create mode 100644 languages/cpp/app_templates/kpartplugin/subdirs create mode 100644 languages/cpp/app_templates/kscons_kmdi/INSTALL create mode 100644 languages/cpp/app_templates/kscons_kmdi/Makefile.am create mode 100644 languages/cpp/app_templates/kscons_kmdi/QUICKSTART create mode 100644 languages/cpp/app_templates/kscons_kmdi/README create mode 100644 languages/cpp/app_templates/kscons_kmdi/SConscript-doc create mode 100644 languages/cpp/app_templates/kscons_kmdi/SConscript-src create mode 100644 languages/cpp/app_templates/kscons_kmdi/SConstruct create mode 100644 languages/cpp/app_templates/kscons_kmdi/VERSION create mode 100644 languages/cpp/app_templates/kscons_kmdi/app.kcfg create mode 100644 languages/cpp/app_templates/kscons_kmdi/app.kdevelop create mode 100644 languages/cpp/app_templates/kscons_kmdi/app_part.cpp create mode 100644 languages/cpp/app_templates/kscons_kmdi/app_part.h create mode 100644 languages/cpp/app_templates/kscons_kmdi/app_part.rc create mode 100644 languages/cpp/app_templates/kscons_kmdi/app_shell.rc create mode 100644 languages/cpp/app_templates/kscons_kmdi/appkmdi.cpp create mode 100644 languages/cpp/app_templates/kscons_kmdi/appkmdi.h create mode 100644 languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp create mode 100644 languages/cpp/app_templates/kscons_kmdi/appkmdiView.h create mode 100644 languages/cpp/app_templates/kscons_kmdi/kmdikonsole.cpp create mode 100644 languages/cpp/app_templates/kscons_kmdi/kmdikonsole.h create mode 100644 languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.kdevtemplate create mode 100644 languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.png create mode 100644 languages/cpp/app_templates/kscons_kmdi/main.cpp create mode 100755 languages/cpp/app_templates/kscons_kmdi/messages.sh create mode 100644 languages/cpp/app_templates/kscons_kmdi/prefs.ui create mode 100644 languages/cpp/app_templates/kscons_kmdi/settings.kcfgc create mode 100644 languages/cpp/app_templates/kscons_kmdi/tips create mode 100644 languages/cpp/app_templates/kscons_kxt/INSTALL create mode 100644 languages/cpp/app_templates/kscons_kxt/Makefile.am create mode 100644 languages/cpp/app_templates/kscons_kxt/QUICKSTART create mode 100644 languages/cpp/app_templates/kscons_kxt/README create mode 100644 languages/cpp/app_templates/kscons_kxt/SConscript-doc create mode 100644 languages/cpp/app_templates/kscons_kxt/SConscript-src create mode 100644 languages/cpp/app_templates/kscons_kxt/SConstruct create mode 100644 languages/cpp/app_templates/kscons_kxt/VERSION create mode 100644 languages/cpp/app_templates/kscons_kxt/app.cpp create mode 100644 languages/cpp/app_templates/kscons_kxt/app.h create mode 100644 languages/cpp/app_templates/kscons_kxt/app.kcfg create mode 100644 languages/cpp/app_templates/kscons_kxt/app.kdevelop create mode 100644 languages/cpp/app_templates/kscons_kxt/appui.rc create mode 100644 languages/cpp/app_templates/kscons_kxt/appview.cpp create mode 100644 languages/cpp/app_templates/kscons_kxt/appview.h create mode 100644 languages/cpp/app_templates/kscons_kxt/appview_base.ui create mode 100644 languages/cpp/app_templates/kscons_kxt/kscons_kxt.kdevtemplate create mode 100644 languages/cpp/app_templates/kscons_kxt/kscons_kxt.png create mode 100644 languages/cpp/app_templates/kscons_kxt/main.cpp create mode 100755 languages/cpp/app_templates/kscons_kxt/messages.sh create mode 100644 languages/cpp/app_templates/kscons_kxt/prefs-base.ui create mode 100644 languages/cpp/app_templates/kscons_kxt/prefs.cpp create mode 100644 languages/cpp/app_templates/kscons_kxt/prefs.h create mode 100644 languages/cpp/app_templates/kscons_kxt/settings.kcfgc create mode 100644 languages/cpp/app_templates/kscons_kxt/tips create mode 100644 languages/cpp/app_templates/kscreensaver/.kdev_ignore create mode 100644 languages/cpp/app_templates/kscreensaver/Makefile.am create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaver.cpp create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaver.desktop create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaver.h create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaver.kdevelop create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaver.kdevtemplate create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaver.png create mode 100644 languages/cpp/app_templates/kscreensaver/kscreensaverui.ui create mode 100644 languages/cpp/app_templates/kscreensaver/src-Makefile.am create mode 100644 languages/cpp/app_templates/kscreensaver/subdirs create mode 100644 languages/cpp/app_templates/kxt/.kdev_ignore create mode 100644 languages/cpp/app_templates/kxt/Makefile.am create mode 100644 languages/cpp/app_templates/kxt/README create mode 100644 languages/cpp/app_templates/kxt/app.cpp create mode 100644 languages/cpp/app_templates/kxt/app.desktop create mode 100644 languages/cpp/app_templates/kxt/app.h create mode 100644 languages/cpp/app_templates/kxt/app.kcfg create mode 100644 languages/cpp/app_templates/kxt/app.kdevelop create mode 100644 languages/cpp/app_templates/kxt/appui.rc create mode 100644 languages/cpp/app_templates/kxt/appview.cpp create mode 100644 languages/cpp/app_templates/kxt/appview.h create mode 100644 languages/cpp/app_templates/kxt/appview_base.ui create mode 100644 languages/cpp/app_templates/kxt/kxt.kdevtemplate create mode 100644 languages/cpp/app_templates/kxt/kxt.png create mode 100644 languages/cpp/app_templates/kxt/main.cpp create mode 100644 languages/cpp/app_templates/kxt/prefs-base.ui create mode 100644 languages/cpp/app_templates/kxt/prefs.cpp create mode 100644 languages/cpp/app_templates/kxt/prefs.h create mode 100644 languages/cpp/app_templates/kxt/preview.png create mode 100644 languages/cpp/app_templates/kxt/settings.kcfgc create mode 100644 languages/cpp/app_templates/kxt/src-Makefile.am create mode 100644 languages/cpp/app_templates/kxt/src-configure.in.in create mode 100644 languages/cpp/app_templates/kxt/subdirs create mode 100644 languages/cpp/app_templates/makefileempty/Makefile.am create mode 100644 languages/cpp/app_templates/makefileempty/app.kdevelop create mode 100644 languages/cpp/app_templates/makefileempty/makefileempty-Makefile create mode 100644 languages/cpp/app_templates/makefileempty/makefileempty.kdevtemplate create mode 100644 languages/cpp/app_templates/makefileempty/makefileempty.png create mode 100644 languages/cpp/app_templates/noatunui/.kdev_ignore create mode 100644 languages/cpp/app_templates/noatunui/Makefile.am create mode 100644 languages/cpp/app_templates/noatunui/noatunui create mode 100644 languages/cpp/app_templates/noatunui/noatunui.kdevtemplate create mode 100644 languages/cpp/app_templates/noatunui/noatunui.png create mode 100644 languages/cpp/app_templates/noatunui/plugin.kdevelop create mode 100644 languages/cpp/app_templates/noatunui/plugin.plugin create mode 100644 languages/cpp/app_templates/noatunui/plugin_app.cpp create mode 100644 languages/cpp/app_templates/noatunui/plugin_impl.cpp create mode 100644 languages/cpp/app_templates/noatunui/plugin_impl.h create mode 100644 languages/cpp/app_templates/noatunui/src-Makefile.am create mode 100644 languages/cpp/app_templates/noatunui/subdirs create mode 100644 languages/cpp/app_templates/noatunvisual/.kdev_ignore create mode 100644 languages/cpp/app_templates/noatunvisual/Makefile.am create mode 100644 languages/cpp/app_templates/noatunvisual/noatunvisual create mode 100644 languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in create mode 100644 languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate create mode 100644 languages/cpp/app_templates/noatunvisual/noatunvisual.png create mode 100644 languages/cpp/app_templates/noatunvisual/plugin.kdevelop create mode 100644 languages/cpp/app_templates/noatunvisual/plugin.plugin create mode 100644 languages/cpp/app_templates/noatunvisual/plugin_app.cpp create mode 100644 languages/cpp/app_templates/noatunvisual/plugin_app.h create mode 100644 languages/cpp/app_templates/noatunvisual/plugin_impl.cpp create mode 100644 languages/cpp/app_templates/noatunvisual/plugin_impl.h create mode 100644 languages/cpp/app_templates/noatunvisual/src-Makefile.am create mode 100644 languages/cpp/app_templates/noatunvisual/subdirs create mode 100644 languages/cpp/app_templates/opieapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/opieapp/Example.png create mode 100644 languages/cpp/app_templates/opieapp/Makefile.am create mode 100644 languages/cpp/app_templates/opieapp/app.kdevelop create mode 100644 languages/cpp/app_templates/opieapp/app.pro create mode 100644 languages/cpp/app_templates/opieapp/example.cpp create mode 100644 languages/cpp/app_templates/opieapp/example.desktop create mode 100644 languages/cpp/app_templates/opieapp/example.h create mode 100644 languages/cpp/app_templates/opieapp/examplebase.ui create mode 100644 languages/cpp/app_templates/opieapp/opieapp.kdevtemplate create mode 100644 languages/cpp/app_templates/opieapp/opieapp.png create mode 100644 languages/cpp/app_templates/opieapplet/.kdev_ignore create mode 100644 languages/cpp/app_templates/opieapplet/Example.png create mode 100644 languages/cpp/app_templates/opieapplet/Makefile.am create mode 100644 languages/cpp/app_templates/opieapplet/app.kdevelop create mode 100644 languages/cpp/app_templates/opieapplet/app.pro create mode 100644 languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate create mode 100644 languages/cpp/app_templates/opieapplet/opieapplet.png create mode 100644 languages/cpp/app_templates/opieapplet/simpleimpl.cpp create mode 100644 languages/cpp/app_templates/opieapplet/simpleimpl.h create mode 100644 languages/cpp/app_templates/opieinput/.kdev_ignore create mode 100644 languages/cpp/app_templates/opieinput/Example.png create mode 100644 languages/cpp/app_templates/opieinput/Makefile.am create mode 100644 languages/cpp/app_templates/opieinput/app.kdevelop create mode 100644 languages/cpp/app_templates/opieinput/app.pro create mode 100644 languages/cpp/app_templates/opieinput/opieinput.kdevtemplate create mode 100644 languages/cpp/app_templates/opieinput/opieinput.png create mode 100644 languages/cpp/app_templates/opieinput/simpleimpl.cpp create mode 100644 languages/cpp/app_templates/opieinput/simpleimpl.h create mode 100644 languages/cpp/app_templates/opiemenu/.kdev_ignore create mode 100644 languages/cpp/app_templates/opiemenu/Example.png create mode 100644 languages/cpp/app_templates/opiemenu/Makefile.am create mode 100644 languages/cpp/app_templates/opiemenu/app.kdevelop create mode 100644 languages/cpp/app_templates/opiemenu/app.pro create mode 100644 languages/cpp/app_templates/opiemenu/opiemenu.kdevtemplate create mode 100644 languages/cpp/app_templates/opiemenu/opiemenu.png create mode 100644 languages/cpp/app_templates/opiemenu/simpleimpl.cpp create mode 100644 languages/cpp/app_templates/opiemenu/simpleimpl.h create mode 100644 languages/cpp/app_templates/opienet/.kdev_ignore create mode 100644 languages/cpp/app_templates/opienet/Example.png create mode 100644 languages/cpp/app_templates/opienet/Makefile.am create mode 100644 languages/cpp/app_templates/opienet/app.kdevelop create mode 100644 languages/cpp/app_templates/opienet/app.pro create mode 100644 languages/cpp/app_templates/opienet/opienet.kdevtemplate create mode 100644 languages/cpp/app_templates/opienet/opienet.png create mode 100644 languages/cpp/app_templates/opienet/simmplemodule.h create mode 100644 languages/cpp/app_templates/opienet/simpleiface.cpp create mode 100644 languages/cpp/app_templates/opienet/simpleiface.h create mode 100644 languages/cpp/app_templates/opienet/simplemodule.cpp create mode 100644 languages/cpp/app_templates/opienet/simplemodule.h create mode 100644 languages/cpp/app_templates/opietoday/.kdev_ignore create mode 100644 languages/cpp/app_templates/opietoday/Example.png create mode 100644 languages/cpp/app_templates/opietoday/Makefile.am create mode 100644 languages/cpp/app_templates/opietoday/app.kdevelop create mode 100644 languages/cpp/app_templates/opietoday/app.pro create mode 100644 languages/cpp/app_templates/opietoday/exampleplugin.cpp create mode 100644 languages/cpp/app_templates/opietoday/exampleplugin.h create mode 100644 languages/cpp/app_templates/opietoday/examplepluginimpl.cpp create mode 100644 languages/cpp/app_templates/opietoday/examplepluginimpl.h create mode 100644 languages/cpp/app_templates/opietoday/examplepluginwidget.cpp create mode 100644 languages/cpp/app_templates/opietoday/examplepluginwidget.h create mode 100644 languages/cpp/app_templates/opietoday/opietoday.kdevtemplate create mode 100644 languages/cpp/app_templates/opietoday/opietoday.png create mode 100644 languages/cpp/app_templates/prc-tool/.kdev_ignore create mode 100644 languages/cpp/app_templates/prc-tool/Makefile.am create mode 100644 languages/cpp/app_templates/prc-tool/callback.h create mode 100644 languages/cpp/app_templates/prc-tool/palmhello.c create mode 100644 languages/cpp/app_templates/prc-tool/palmhello.pbitm create mode 100644 languages/cpp/app_templates/prc-tool/palmhello.rcp create mode 100644 languages/cpp/app_templates/prc-tool/palmhelloRsc.h create mode 100644 languages/cpp/app_templates/prc-tool/prc-tool create mode 100644 languages/cpp/app_templates/prc-tool/prc-tool.kdevelop create mode 100644 languages/cpp/app_templates/prc-tool/prc-tool.kdevtemplate create mode 100644 languages/cpp/app_templates/prc-tool/src-Makefile create mode 100644 languages/cpp/app_templates/qmakeapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/qmakeapp/Makefile.am create mode 100644 languages/cpp/app_templates/qmakeapp/fileopen.xpm create mode 100644 languages/cpp/app_templates/qmakeapp/fileprint.xpm create mode 100644 languages/cpp/app_templates/qmakeapp/filesave.xpm create mode 100644 languages/cpp/app_templates/qmakeapp/main.cpp create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp.cpp create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp.h create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp.kdevelop create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp.kdevtemplate create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp.png create mode 100644 languages/cpp/app_templates/qmakeapp/qmakeapp.pro create mode 100644 languages/cpp/app_templates/qmakeapp/src.pro create mode 100644 languages/cpp/app_templates/qmakeempty/Makefile.am create mode 100644 languages/cpp/app_templates/qmakeempty/qmakeempty.kdevelop create mode 100644 languages/cpp/app_templates/qmakeempty/qmakeempty.kdevtemplate create mode 100644 languages/cpp/app_templates/qmakeempty/qmakeempty.png create mode 100644 languages/cpp/app_templates/qmakeempty/qmakeempty.pro create mode 100644 languages/cpp/app_templates/qmakesimple/.kdev_ignore create mode 100644 languages/cpp/app_templates/qmakesimple/Makefile.am create mode 100644 languages/cpp/app_templates/qmakesimple/app.kdevelop create mode 100644 languages/cpp/app_templates/qmakesimple/app.pro create mode 100644 languages/cpp/app_templates/qmakesimple/main.cpp create mode 100644 languages/cpp/app_templates/qmakesimple/qmakesimple create mode 100644 languages/cpp/app_templates/qmakesimple/qmakesimple.kdevtemplate create mode 100644 languages/cpp/app_templates/qmakesimple/qmakesimple.png create mode 100644 languages/cpp/app_templates/qmakesimple/src.pro create mode 100644 languages/cpp/app_templates/qt4hello/Makefile.am create mode 100644 languages/cpp/app_templates/qt4hello/ReadMe create mode 100644 languages/cpp/app_templates/qt4hello/main.cpp create mode 100644 languages/cpp/app_templates/qt4hello/qt4hello.kdevelop create mode 100644 languages/cpp/app_templates/qt4hello/qt4hello.kdevtemplate create mode 100644 languages/cpp/app_templates/qt4hello/qt4hello.png create mode 100644 languages/cpp/app_templates/qt4hello/qt4hello.pro create mode 100644 languages/cpp/app_templates/qt4hello/src.pro create mode 100644 languages/cpp/app_templates/qt4makeapp/Makefile.am create mode 100644 languages/cpp/app_templates/qt4makeapp/ReadMe create mode 100644 languages/cpp/app_templates/qt4makeapp/application.qrc create mode 100644 languages/cpp/app_templates/qt4makeapp/editcopy.xpm create mode 100644 languages/cpp/app_templates/qt4makeapp/editcut.xpm create mode 100644 languages/cpp/app_templates/qt4makeapp/editpaste.xpm create mode 100644 languages/cpp/app_templates/qt4makeapp/filenew.xpm create mode 100644 languages/cpp/app_templates/qt4makeapp/fileopen.xpm create mode 100644 languages/cpp/app_templates/qt4makeapp/filesave.xpm create mode 100644 languages/cpp/app_templates/qt4makeapp/main.cpp create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp.cpp create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp.h create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevelop create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevtemplate create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp.png create mode 100644 languages/cpp/app_templates/qt4makeapp/qt4makeapp.pro create mode 100644 languages/cpp/app_templates/qt4makeapp/src.pro create mode 100644 languages/cpp/app_templates/qtopia4app/Example.png create mode 100644 languages/cpp/app_templates/qtopia4app/Makefile.am create mode 100644 languages/cpp/app_templates/qtopia4app/app.kdevelop create mode 100644 languages/cpp/app_templates/qtopia4app/app.pro create mode 100644 languages/cpp/app_templates/qtopia4app/example.cpp create mode 100644 languages/cpp/app_templates/qtopia4app/example.desktop create mode 100644 languages/cpp/app_templates/qtopia4app/example.h create mode 100644 languages/cpp/app_templates/qtopia4app/example.html create mode 100644 languages/cpp/app_templates/qtopia4app/examplebase.ui create mode 100644 languages/cpp/app_templates/qtopia4app/main.cpp create mode 100644 languages/cpp/app_templates/qtopia4app/qtopia4app.kdevtemplate create mode 100644 languages/cpp/app_templates/qtopia4app/qtopia4app.png create mode 100644 languages/cpp/app_templates/qtopiaapp/.kdev_ignore create mode 100644 languages/cpp/app_templates/qtopiaapp/Example.png create mode 100644 languages/cpp/app_templates/qtopiaapp/Makefile.am create mode 100644 languages/cpp/app_templates/qtopiaapp/app.kdevelop create mode 100644 languages/cpp/app_templates/qtopiaapp/app.pro create mode 100644 languages/cpp/app_templates/qtopiaapp/example.control create mode 100644 languages/cpp/app_templates/qtopiaapp/example.cpp create mode 100644 languages/cpp/app_templates/qtopiaapp/example.desktop create mode 100644 languages/cpp/app_templates/qtopiaapp/example.h create mode 100644 languages/cpp/app_templates/qtopiaapp/example.html create mode 100644 languages/cpp/app_templates/qtopiaapp/examplebase.ui create mode 100644 languages/cpp/app_templates/qtopiaapp/main.cpp create mode 100644 languages/cpp/app_templates/qtopiaapp/qtopiaapp create mode 100644 languages/cpp/app_templates/qtopiaapp/qtopiaapp.kdevtemplate create mode 100644 languages/cpp/app_templates/qtopiaapp/qtopiaapp.png create mode 100644 languages/cpp/app_templates/win32gui/.kdev_ignore create mode 100644 languages/cpp/app_templates/win32gui/Makefile.am create mode 100644 languages/cpp/app_templates/win32gui/app.cpp create mode 100644 languages/cpp/app_templates/win32gui/app.kdevelop create mode 100644 languages/cpp/app_templates/win32gui/src-Makefile.am create mode 100644 languages/cpp/app_templates/win32gui/win32gui-Makefile.am create mode 100644 languages/cpp/app_templates/win32gui/win32gui-Makefile.cvs create mode 100644 languages/cpp/app_templates/win32gui/win32gui-configure.in create mode 100644 languages/cpp/app_templates/win32gui/win32gui.kdevtemplate create mode 100644 languages/cpp/app_templates/win32gui/win32gui.png create mode 100644 languages/cpp/app_templates/win32hello/.kdev_ignore create mode 100644 languages/cpp/app_templates/win32hello/Makefile.am create mode 100644 languages/cpp/app_templates/win32hello/app.cpp create mode 100644 languages/cpp/app_templates/win32hello/app.kdevelop create mode 100644 languages/cpp/app_templates/win32hello/src-Makefile.am create mode 100644 languages/cpp/app_templates/win32hello/win32-Makefile.am create mode 100644 languages/cpp/app_templates/win32hello/win32-Makefile.cvs create mode 100644 languages/cpp/app_templates/win32hello/win32-configure.in create mode 100644 languages/cpp/app_templates/win32hello/win32hello.kdevtemplate create mode 100644 languages/cpp/app_templates/win32hello/win32hello.png create mode 100644 languages/cpp/app_templates/wxhello/.kdev_ignore create mode 100644 languages/cpp/app_templates/wxhello/Makefile.am create mode 100644 languages/cpp/app_templates/wxhello/app.cpp create mode 100644 languages/cpp/app_templates/wxhello/app.desktop create mode 100644 languages/cpp/app_templates/wxhello/app.h create mode 100644 languages/cpp/app_templates/wxhello/app.kdevelop create mode 100644 languages/cpp/app_templates/wxhello/src-Makefile.am create mode 100644 languages/cpp/app_templates/wxhello/subdirs create mode 100644 languages/cpp/app_templates/wxhello/wxhello create mode 100644 languages/cpp/app_templates/wxhello/wxhello.kdevtemplate create mode 100644 languages/cpp/app_templates/wxhello/wxhello.png create mode 100644 languages/cpp/ast_utils.cpp create mode 100644 languages/cpp/ast_utils.h create mode 100644 languages/cpp/backgroundparser.cpp create mode 100644 languages/cpp/backgroundparser.h create mode 100644 languages/cpp/bithelpers.h create mode 100644 languages/cpp/ccconfigwidget.cpp create mode 100644 languages/cpp/ccconfigwidget.h create mode 100644 languages/cpp/ccconfigwidgetbase.ui create mode 100644 languages/cpp/classgeneratorconfig.cpp create mode 100644 languages/cpp/classgeneratorconfig.h create mode 100644 languages/cpp/classgeneratorconfigbase.ui create mode 100644 languages/cpp/codecompletionentry.h create mode 100644 languages/cpp/codeinformationrepository.cpp create mode 100644 languages/cpp/codeinformationrepository.h create mode 100644 languages/cpp/compiler/Makefile.am create mode 100644 languages/cpp/compiler/gccoptions/Makefile.am create mode 100644 languages/cpp/compiler/gccoptions/gccoptionsplugin.cpp create mode 100644 languages/cpp/compiler/gccoptions/gccoptionsplugin.h create mode 100644 languages/cpp/compiler/gccoptions/kdevg77options.desktop create mode 100644 languages/cpp/compiler/gccoptions/kdevgccoptions.desktop create mode 100644 languages/cpp/compiler/gccoptions/kdevgppoptions.desktop create mode 100644 languages/cpp/completiondebug.cpp create mode 100644 languages/cpp/completiondebug.h create mode 100644 languages/cpp/computerecoverypoints.h create mode 100644 languages/cpp/configproblemreporter.ui create mode 100644 languages/cpp/configproblemreporter.ui.h create mode 100644 languages/cpp/configuration create mode 100644 languages/cpp/cpp_tags.h create mode 100644 languages/cpp/cppcodecompletion.cpp create mode 100644 languages/cpp/cppcodecompletion.h create mode 100644 languages/cpp/cppcodecompletionconfig.cpp create mode 100644 languages/cpp/cppcodecompletionconfig.h create mode 100644 languages/cpp/cppevaluation.cpp create mode 100644 languages/cpp/cppevaluation.h create mode 100644 languages/cpp/cppimplementationwidget.cpp create mode 100644 languages/cpp/cppimplementationwidget.h create mode 100644 languages/cpp/cppnewclassdlg.cpp create mode 100644 languages/cpp/cppnewclassdlg.h create mode 100644 languages/cpp/cppnewclassdlgbase.ui create mode 100644 languages/cpp/cppsplitheadersourceconfig.cpp create mode 100644 languages/cpp/cppsplitheadersourceconfig.h create mode 100644 languages/cpp/cppsupport_events.h create mode 100644 languages/cpp/cppsupport_utils.cpp create mode 100644 languages/cpp/cppsupport_utils.h create mode 100644 languages/cpp/cppsupportfactory.cpp create mode 100644 languages/cpp/cppsupportfactory.h create mode 100644 languages/cpp/cppsupportpart.cpp create mode 100644 languages/cpp/cppsupportpart.h create mode 100644 languages/cpp/cpptemplates create mode 100644 languages/cpp/creategettersetter.ui create mode 100644 languages/cpp/creategettersetterconfiguration.cpp create mode 100644 languages/cpp/creategettersetterconfiguration.h create mode 100644 languages/cpp/creategettersetterdialog.cpp create mode 100644 languages/cpp/creategettersetterdialog.h create mode 100644 languages/cpp/createpcsdialog.cpp create mode 100644 languages/cpp/createpcsdialog.h create mode 100644 languages/cpp/createpcsdialogbase.ui create mode 100644 languages/cpp/debugger/DESIGN.txt create mode 100644 languages/cpp/debugger/Makefile.am create mode 100644 languages/cpp/debugger/TODO.txt create mode 100644 languages/cpp/debugger/breakpoint.cpp create mode 100644 languages/cpp/debugger/breakpoint.h create mode 100644 languages/cpp/debugger/dbgcontroller.cpp create mode 100644 languages/cpp/debugger/dbgcontroller.h create mode 100644 languages/cpp/debugger/dbgpsdlg.cpp create mode 100644 languages/cpp/debugger/dbgpsdlg.h create mode 100644 languages/cpp/debugger/dbgtoolbar.cpp create mode 100644 languages/cpp/debugger/dbgtoolbar.h create mode 100644 languages/cpp/debugger/debuggerconfigwidget.cpp create mode 100644 languages/cpp/debugger/debuggerconfigwidget.h create mode 100644 languages/cpp/debugger/debuggerconfigwidgetbase.ui create mode 100644 languages/cpp/debugger/debuggerdcopinterface.h create mode 100644 languages/cpp/debugger/debuggerpart.cpp create mode 100644 languages/cpp/debugger/debuggerpart.h create mode 100644 languages/cpp/debugger/debuggertracingdialog.cpp create mode 100644 languages/cpp/debugger/debuggertracingdialog.h create mode 100644 languages/cpp/debugger/debuggertracingdialogbase.ui create mode 100644 languages/cpp/debugger/disassemblewidget.cpp create mode 100644 languages/cpp/debugger/disassemblewidget.h create mode 100644 languages/cpp/debugger/framestackwidget.cpp create mode 100644 languages/cpp/debugger/framestackwidget.h create mode 100644 languages/cpp/debugger/gdbbreakpointwidget.cpp create mode 100644 languages/cpp/debugger/gdbbreakpointwidget.h create mode 100644 languages/cpp/debugger/gdbcommand.cpp create mode 100644 languages/cpp/debugger/gdbcommand.h create mode 100644 languages/cpp/debugger/gdbcontroller.cpp create mode 100644 languages/cpp/debugger/gdbcontroller.h create mode 100644 languages/cpp/debugger/gdboutputwidget.cpp create mode 100644 languages/cpp/debugger/gdboutputwidget.h create mode 100644 languages/cpp/debugger/gdbparser.cpp create mode 100644 languages/cpp/debugger/gdbparser.h create mode 100644 languages/cpp/debugger/gdbtable.cpp create mode 100644 languages/cpp/debugger/gdbtable.h create mode 100644 languages/cpp/debugger/hi16-action-breakpoint_add.png create mode 100644 languages/cpp/debugger/hi16-action-breakpoint_delete.png create mode 100644 languages/cpp/debugger/hi16-action-breakpoint_delete_all.png create mode 100644 languages/cpp/debugger/hi16-action-breakpoint_edit.png create mode 100644 languages/cpp/debugger/kdevdebugger.desktop create mode 100644 languages/cpp/debugger/kdevdebugger.rc create mode 100644 languages/cpp/debugger/label_with_double_click.cpp create mode 100644 languages/cpp/debugger/label_with_double_click.h create mode 100644 languages/cpp/debugger/memviewdlg.cpp create mode 100644 languages/cpp/debugger/memviewdlg.h create mode 100644 languages/cpp/debugger/mi/Makefile.am create mode 100644 languages/cpp/debugger/mi/gdbmi.cpp create mode 100644 languages/cpp/debugger/mi/gdbmi.h create mode 100644 languages/cpp/debugger/mi/milexer.cpp create mode 100644 languages/cpp/debugger/mi/milexer.h create mode 100644 languages/cpp/debugger/mi/miparser.cpp create mode 100644 languages/cpp/debugger/mi/miparser.h create mode 100644 languages/cpp/debugger/mi/tokens.h create mode 100644 languages/cpp/debugger/stty.cpp create mode 100644 languages/cpp/debugger/stty.h create mode 100644 languages/cpp/debugger/tests/README.txt create mode 100644 languages/cpp/debugger/tests/breakpoints/Makefile create mode 100644 languages/cpp/debugger/tests/breakpoints/README.txt create mode 100644 languages/cpp/debugger/tests/breakpoints/breakpoints.kdevelop create mode 100644 languages/cpp/debugger/tests/breakpoints/foo.cpp create mode 100644 languages/cpp/debugger/tests/breakpoints/main.cpp create mode 100644 languages/cpp/debugger/tests/dll/Makefile create mode 100644 languages/cpp/debugger/tests/dll/README.txt create mode 100644 languages/cpp/debugger/tests/dll/dll.kdevelop create mode 100644 languages/cpp/debugger/tests/dll/helper.cpp create mode 100644 languages/cpp/debugger/tests/dll/main.cpp create mode 100644 languages/cpp/debugger/tests/infinite_loop/Makefile create mode 100644 languages/cpp/debugger/tests/infinite_loop/README.txt create mode 100644 languages/cpp/debugger/tests/infinite_loop/infinite_loop.cpp create mode 100644 languages/cpp/debugger/tests/infinite_loop/infinite_loop.kdevelop create mode 100644 languages/cpp/debugger/tests/print_pointers/Makefile create mode 100644 languages/cpp/debugger/tests/print_pointers/print_pointers.cpp create mode 100644 languages/cpp/debugger/tests/print_pointers/print_pointers.kdevelop create mode 100644 languages/cpp/debugger/tests/segfault/Makefile create mode 100644 languages/cpp/debugger/tests/segfault/README.txt create mode 100644 languages/cpp/debugger/tests/segfault/segfault.cpp create mode 100644 languages/cpp/debugger/tests/segfault/segfault.kdevelop create mode 100644 languages/cpp/debugger/tests/threads/Makefile create mode 100644 languages/cpp/debugger/tests/threads/README.txt create mode 100644 languages/cpp/debugger/tests/threads/threads.cpp create mode 100644 languages/cpp/debugger/tests/threads/threads.kdevelop create mode 100644 languages/cpp/debugger/tests/tracing/Makefile create mode 100644 languages/cpp/debugger/tests/tracing/main.cpp create mode 100644 languages/cpp/debugger/tests/tracing/tracing.kdevelop create mode 100644 languages/cpp/debugger/tests/two_module/Makefile create mode 100644 languages/cpp/debugger/tests/two_module/README.txt create mode 100644 languages/cpp/debugger/tests/two_module/main.cpp create mode 100644 languages/cpp/debugger/tests/two_module/src/foo.cpp create mode 100644 languages/cpp/debugger/tests/two_module/two_module.kdevelop create mode 100644 languages/cpp/debugger/variablewidget.cpp create mode 100644 languages/cpp/debugger/variablewidget.h create mode 100644 languages/cpp/declarationinfo.h create mode 100644 languages/cpp/doc/Makefile.am create mode 100644 languages/cpp/doc/c++_bugs_gcc.toc create mode 100644 languages/cpp/doc/clanlib.toc create mode 100644 languages/cpp/doc/cppannotations.toc create mode 100644 languages/cpp/doc/gnome1.toc create mode 100644 languages/cpp/doc/gnustep.toc create mode 100644 languages/cpp/doc/gtk_bugs.toc create mode 100644 languages/cpp/doc/kde2book.toc create mode 100644 languages/cpp/doc/kdetemplates.toc create mode 100644 languages/cpp/doc/libc.toc create mode 100644 languages/cpp/doc/libstdc++.toc create mode 100644 languages/cpp/doc/qt-kdev3.toc create mode 100644 languages/cpp/doc/stl.toc create mode 100644 languages/cpp/doc/wxwidgets_bugs.toc create mode 100644 languages/cpp/doxydoc.cpp create mode 100644 languages/cpp/doxydoc.h create mode 100644 languages/cpp/expressioninfo.h create mode 100644 languages/cpp/file_templates/Makefile.am create mode 100644 languages/cpp/file_templates/c create mode 100644 languages/cpp/file_templates/cpp create mode 100644 languages/cpp/file_templates/h create mode 100644 languages/cpp/file_templates/l create mode 100644 languages/cpp/file_templates/ll create mode 100644 languages/cpp/file_templates/y create mode 100644 languages/cpp/file_templates/yy create mode 100644 languages/cpp/includefiles.cpp create mode 100644 languages/cpp/includefiles.h create mode 100644 languages/cpp/includepathresolver.cpp create mode 100644 languages/cpp/includepathresolver.h create mode 100644 languages/cpp/kdevcppsupport.desktop create mode 100644 languages/cpp/kdevcppsupport.rc create mode 100644 languages/cpp/kdevcsupport.desktop create mode 100644 languages/cpp/kdevdeepcopy.h create mode 100644 languages/cpp/kdevdriver.cpp create mode 100644 languages/cpp/kdevdriver.h create mode 100644 languages/cpp/main.cpp create mode 100644 languages/cpp/newclass_templates/Makefile.am create mode 100644 languages/cpp/newclass_templates/cpp_header create mode 100644 languages/cpp/newclass_templates/cpp_source create mode 100644 languages/cpp/newclass_templates/gtk_header create mode 100644 languages/cpp/newclass_templates/gtk_source create mode 100644 languages/cpp/newclass_templates/objc_header create mode 100644 languages/cpp/newclass_templates/objc_source create mode 100644 languages/cpp/pcsimporter/Makefile.am create mode 100644 languages/cpp/pcsimporter/customimporter/Makefile.am create mode 100644 languages/cpp/pcsimporter/customimporter/kdevcustomimporter.cpp create mode 100644 languages/cpp/pcsimporter/customimporter/kdevcustomimporter.h create mode 100644 languages/cpp/pcsimporter/customimporter/kdevpcscustomimporter.desktop create mode 100644 languages/cpp/pcsimporter/customimporter/settingsdialog.cpp create mode 100644 languages/cpp/pcsimporter/customimporter/settingsdialog.h create mode 100644 languages/cpp/pcsimporter/customimporter/settingsdialogbase.ui create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/Makefile.am create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h create mode 100644 languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui create mode 100644 languages/cpp/pcsimporter/qt4importer/Makefile.am create mode 100644 languages/cpp/pcsimporter/qt4importer/kdevqt4importer.cpp create mode 100644 languages/cpp/pcsimporter/qt4importer/kdevqt4importer.desktop create mode 100644 languages/cpp/pcsimporter/qt4importer/kdevqt4importer.h create mode 100644 languages/cpp/pcsimporter/qt4importer/settingsdialog.cpp create mode 100644 languages/cpp/pcsimporter/qt4importer/settingsdialog.h create mode 100644 languages/cpp/pcsimporter/qt4importer/settingsdialogbase.ui create mode 100644 languages/cpp/pcsimporter/qtimporter/Makefile.am create mode 100644 languages/cpp/pcsimporter/qtimporter/kdevqtimporter.cpp create mode 100644 languages/cpp/pcsimporter/qtimporter/kdevqtimporter.desktop create mode 100644 languages/cpp/pcsimporter/qtimporter/kdevqtimporter.h create mode 100644 languages/cpp/pcsimporter/qtimporter/settingsdialog.cpp create mode 100644 languages/cpp/pcsimporter/qtimporter/settingsdialog.h create mode 100644 languages/cpp/pcsimporter/qtimporter/settingsdialogbase.ui create mode 100644 languages/cpp/problemreporter.cpp create mode 100644 languages/cpp/problemreporter.h create mode 100644 languages/cpp/qtbuildconfig.cpp create mode 100644 languages/cpp/qtbuildconfig.h create mode 100644 languages/cpp/qtdesignercppintegration.cpp create mode 100644 languages/cpp/qtdesignercppintegration.h create mode 100644 languages/cpp/safetycounter.h create mode 100644 languages/cpp/setuphelper.cpp create mode 100644 languages/cpp/setuphelper.h create mode 100644 languages/cpp/simplecontext.cpp create mode 100644 languages/cpp/simplecontext.h create mode 100644 languages/cpp/simpletype.cpp create mode 100644 languages/cpp/simpletype.h create mode 100644 languages/cpp/simpletypecachebinder.h create mode 100644 languages/cpp/simpletypecatalog.cpp create mode 100644 languages/cpp/simpletypecatalog.h create mode 100644 languages/cpp/simpletypefunction.cpp create mode 100644 languages/cpp/simpletypefunction.h create mode 100644 languages/cpp/simpletypenamespace.cpp create mode 100644 languages/cpp/simpletypenamespace.h create mode 100644 languages/cpp/store_walker.cpp create mode 100644 languages/cpp/store_walker.h create mode 100644 languages/cpp/storeconverter.cpp create mode 100644 languages/cpp/storeconverter.h create mode 100644 languages/cpp/stringhelpers.cpp create mode 100644 languages/cpp/stringhelpers.h create mode 100644 languages/cpp/subclassing_template/.kdev_ignore create mode 100644 languages/cpp/subclassing_template/Makefile.am create mode 100644 languages/cpp/subclassing_template/subclass_qt4_template.cpp create mode 100644 languages/cpp/subclassing_template/subclass_qt4_template.h create mode 100644 languages/cpp/subclassing_template/subclass_template.cpp create mode 100644 languages/cpp/subclassing_template/subclass_template.h create mode 100644 languages/cpp/subclassingdlg.cpp create mode 100644 languages/cpp/subclassingdlg.h create mode 100644 languages/cpp/subclassingdlgbase.ui create mode 100644 languages/cpp/tag_creator.cpp create mode 100644 languages/cpp/tag_creator.h create mode 100644 languages/cpp/templates/Makefile.am create mode 100644 languages/cpp/templates/default.cpp create mode 100644 languages/cpp/templates/default.h create mode 100644 languages/cpp/typedecoration.h create mode 100644 languages/cpp/typedesc.cpp create mode 100644 languages/cpp/typedesc.h create mode 100644 languages/csharp/Makefile.am create mode 100644 languages/csharp/README.dox create mode 100644 languages/csharp/app_templates/Makefile.am create mode 100644 languages/csharp/app_templates/csharp.appwizard create mode 100644 languages/csharp/csharpconfigwidget.cpp create mode 100644 languages/csharp/csharpconfigwidget.h create mode 100644 languages/csharp/csharpconfigwidgetbase.ui create mode 100644 languages/csharp/csharpdoc.cpp create mode 100644 languages/csharp/csharpdoc.h create mode 100644 languages/csharp/csharpdoc.protocol create mode 100644 languages/csharp/csharpsupportpart.cpp create mode 100644 languages/csharp/csharpsupportpart.h create mode 100644 languages/csharp/doc/Makefile.am create mode 100644 languages/csharp/file_templates/Makefile.am create mode 100644 languages/csharp/kdevcsharpsupport.desktop create mode 100644 languages/csharp/kdevcsharpsupport.rc create mode 100644 languages/fortran/Makefile.am create mode 100644 languages/fortran/README.dox create mode 100644 languages/fortran/app_templates/Makefile.am create mode 100644 languages/fortran/app_templates/fortran.appwizard create mode 100644 languages/fortran/app_templates/fortranhello/.kdev_ignore create mode 100644 languages/fortran/app_templates/fortranhello/Makefile.am create mode 100644 languages/fortran/app_templates/fortranhello/app.kdevelop create mode 100644 languages/fortran/app_templates/fortranhello/configure.in create mode 100644 languages/fortran/app_templates/fortranhello/fortran-Makefile.am create mode 100644 languages/fortran/app_templates/fortranhello/fortran-Makefile.cvs create mode 100644 languages/fortran/app_templates/fortranhello/fortranhello create mode 100644 languages/fortran/app_templates/fortranhello/fortranhello.kdevtemplate create mode 100644 languages/fortran/app_templates/fortranhello/fortranhello.png create mode 100644 languages/fortran/app_templates/fortranhello/main.f create mode 100644 languages/fortran/app_templates/fortranhello/src-Makefile.am create mode 100644 languages/fortran/compiler/Makefile.am create mode 100644 languages/fortran/compiler/pgioptions/Makefile.am create mode 100644 languages/fortran/compiler/pgioptions/kdevpgf77options.desktop create mode 100644 languages/fortran/compiler/pgioptions/kdevpghpfoptions.desktop create mode 100644 languages/fortran/compiler/pgioptions/pgioptionsfactory.cpp create mode 100644 languages/fortran/compiler/pgioptions/pgioptionsfactory.h create mode 100644 languages/fortran/compiler/pgioptions/pgioptionsplugin.cpp create mode 100644 languages/fortran/compiler/pgioptions/pgioptionsplugin.h create mode 100644 languages/fortran/doc/Makefile.am create mode 100644 languages/fortran/doc/fortran_bugs_gcc.toc create mode 100644 languages/fortran/file_templates/Makefile.am create mode 100644 languages/fortran/file_templates/f create mode 100644 languages/fortran/file_templates/f77 create mode 100644 languages/fortran/file_templates/f90 create mode 100644 languages/fortran/file_templates/f95 create mode 100644 languages/fortran/file_templates/for create mode 100644 languages/fortran/file_templates/fpp create mode 100644 languages/fortran/file_templates/ftn create mode 100644 languages/fortran/fixedformparser.cpp create mode 100644 languages/fortran/fixedformparser.h create mode 100644 languages/fortran/fortransupportpart.cpp create mode 100644 languages/fortran/fortransupportpart.h create mode 100644 languages/fortran/ftnchekconfigwidget.cpp create mode 100644 languages/fortran/ftnchekconfigwidget.h create mode 100644 languages/fortran/ftnchekconfigwidgetbase.ui create mode 100644 languages/fortran/kdevfortransupport.desktop create mode 100644 languages/fortran/kdevfortransupport.rc create mode 100644 languages/java/JavaAST.hpp create mode 100644 languages/java/JavaLexer.cpp create mode 100644 languages/java/JavaLexer.hpp create mode 100644 languages/java/JavaRecognizer.cpp create mode 100644 languages/java/JavaRecognizer.hpp create mode 100644 languages/java/JavaStoreWalker.cpp create mode 100644 languages/java/JavaStoreWalker.hpp create mode 100644 languages/java/JavaStoreWalkerTokenTypes.hpp create mode 100644 languages/java/JavaStoreWalkerTokenTypes.txt create mode 100644 languages/java/JavaTokenTypes.hpp create mode 100644 languages/java/JavaTokenTypes.txt create mode 100644 languages/java/KDevJavaSupportIface.cpp create mode 100644 languages/java/KDevJavaSupportIface.h create mode 100644 languages/java/Makefile.am create mode 100644 languages/java/README.dox create mode 100644 languages/java/app_templates/Makefile.am create mode 100644 languages/java/app_templates/java.appwizard create mode 100644 languages/java/app_templates/javahello/.kdev_ignore create mode 100644 languages/java/app_templates/javahello/Main.java create mode 100644 languages/java/app_templates/javahello/Makefile.am create mode 100644 languages/java/app_templates/javahello/build.xml create mode 100644 languages/java/app_templates/javahello/javahello create mode 100644 languages/java/app_templates/javahello/javahello.filelist create mode 100644 languages/java/app_templates/javahello/javahello.kdevelop create mode 100644 languages/java/app_templates/javahello/javahello.kdevtemplate create mode 100644 languages/java/app_templates/javahello/javahello.png create mode 100644 languages/java/app_templates/kappjava/.kdev_ignore create mode 100644 languages/java/app_templates/kappjava/Makefile.am create mode 100644 languages/java/app_templates/kappjava/app.desktop create mode 100644 languages/java/app_templates/kappjava/app.java create mode 100644 languages/java/app_templates/kappjava/app.kdevelop create mode 100644 languages/java/app_templates/kappjava/app_client.java create mode 100644 languages/java/app_templates/kappjava/appui.rc create mode 100644 languages/java/app_templates/kappjava/appview.java create mode 100644 languages/java/app_templates/kappjava/kappjava create mode 100644 languages/java/app_templates/kappjava/kappjava.kdevtemplate create mode 100644 languages/java/app_templates/kappjava/kappjava.png create mode 100644 languages/java/app_templates/kappjava/pref.java create mode 100644 languages/java/app_templates/kappjava/src-Makefile.am create mode 100644 languages/java/app_templates/kappjava/subdirs create mode 100644 languages/java/app_templates/superwaba/.kdev_ignore create mode 100644 languages/java/app_templates/superwaba/Makefile.am create mode 100644 languages/java/app_templates/superwaba/src-Makefile create mode 100644 languages/java/app_templates/superwaba/superwaba create mode 100644 languages/java/app_templates/superwaba/superwaba.kdevtemplate create mode 100644 languages/java/app_templates/superwaba/superwaba.png create mode 100644 languages/java/app_templates/superwaba/sw.filelist create mode 100644 languages/java/app_templates/superwaba/sw.java create mode 100644 languages/java/app_templates/superwaba/sw.kdevelop create mode 100644 languages/java/backgroundparser.cpp create mode 100644 languages/java/backgroundparser.h create mode 100644 languages/java/configproblemreporter.ui create mode 100644 languages/java/configproblemreporter.ui.h create mode 100644 languages/java/doc/Makefile.am create mode 100644 languages/java/doc/java_bugs_gcc.toc create mode 100644 languages/java/doc/java_bugs_sun.toc create mode 100644 languages/java/doc/sw.toc create mode 100644 languages/java/driver.cpp create mode 100644 languages/java/driver.h create mode 100644 languages/java/file_templates/Makefile.am create mode 100644 languages/java/file_templates/java create mode 100644 languages/java/java.g create mode 100644 languages/java/java.store.g create mode 100644 languages/java/java.tree.g create mode 100644 languages/java/javasupport_events.h create mode 100644 languages/java/javasupport_utils.cpp create mode 100644 languages/java/javasupport_utils.h create mode 100644 languages/java/javasupportfactory.cpp create mode 100644 languages/java/javasupportfactory.h create mode 100644 languages/java/javasupportpart.cpp create mode 100644 languages/java/javasupportpart.h create mode 100644 languages/java/javatemplates create mode 100644 languages/java/kdevdeepcopy.h create mode 100644 languages/java/kdevdriver.cpp create mode 100644 languages/java/kdevdriver.h create mode 100644 languages/java/kdevjavasupport.desktop create mode 100644 languages/java/kdevjavasupport.rc create mode 100644 languages/java/newclass_templates/Makefile.am create mode 100644 languages/java/newclass_templates/java_source create mode 100644 languages/java/problemreporter.cpp create mode 100644 languages/java/problemreporter.h create mode 100644 languages/kjssupport/Makefile.am create mode 100644 languages/kjssupport/jscodecompletion.cpp create mode 100644 languages/kjssupport/jscodecompletion.h create mode 100644 languages/kjssupport/kdevkjssupport.desktop create mode 100644 languages/kjssupport/kdevkjssupport.rc create mode 100644 languages/kjssupport/kjsproblems.cpp create mode 100644 languages/kjssupport/kjsproblems.h create mode 100644 languages/kjssupport/kjssupport_part.cpp create mode 100644 languages/kjssupport/kjssupport_part.h create mode 100644 languages/kjssupport/subclassing_template/Makefile.am create mode 100644 languages/kjssupport/subclassing_template/subclass_template.js create mode 100644 languages/kjssupport/subclassingdlg.cpp create mode 100644 languages/kjssupport/subclassingdlg.h create mode 100644 languages/kjssupport/subclassingdlgbase.ui create mode 100644 languages/kjssupport/template/Makefile.am create mode 100644 languages/kjssupport/template/app.js create mode 100644 languages/kjssupport/template/app.kdevelop create mode 100644 languages/kjssupport/template/jshello create mode 100644 languages/kjssupport/template/script create mode 100644 languages/kjssupport/x-javascript-source.desktop create mode 100644 languages/lib/Makefile.am create mode 100644 languages/lib/debugger/Mainpage.dox create mode 100644 languages/lib/debugger/Makefile.am create mode 100644 languages/lib/debugger/debugger.cpp create mode 100644 languages/lib/debugger/debugger.h create mode 100644 languages/lib/debugger/kdevdebugger.cpp create mode 100644 languages/lib/debugger/kdevdebugger.h create mode 100644 languages/lib/designer_integration/Mainpage.dox create mode 100644 languages/lib/designer_integration/Makefile.am create mode 100644 languages/lib/designer_integration/implementationwidget.cpp create mode 100644 languages/lib/designer_integration/implementationwidget.h create mode 100644 languages/lib/designer_integration/implementationwidgetbase.ui create mode 100644 languages/lib/designer_integration/qtdesignerintegration.cpp create mode 100644 languages/lib/designer_integration/qtdesignerintegration.h create mode 100644 languages/lib/interfaces/Mainpage.dox create mode 100644 languages/lib/interfaces/Makefile.am create mode 100644 languages/lib/interfaces/kdeveloppcsimporter.desktop create mode 100644 languages/lib/interfaces/kdevpcsimporter.cpp create mode 100644 languages/lib/interfaces/kdevpcsimporter.h create mode 100644 languages/pascal/Makefile.am create mode 100644 languages/pascal/PascalAST.hpp create mode 100644 languages/pascal/PascalLexer.cpp create mode 100644 languages/pascal/PascalLexer.hpp create mode 100644 languages/pascal/PascalParser.cpp create mode 100644 languages/pascal/PascalParser.hpp create mode 100644 languages/pascal/PascalStoreWalker.cpp create mode 100644 languages/pascal/PascalStoreWalker.hpp create mode 100644 languages/pascal/PascalStoreWalkerTokenTypes.hpp create mode 100644 languages/pascal/PascalStoreWalkerTokenTypes.txt create mode 100644 languages/pascal/PascalTokenTypes.hpp create mode 100644 languages/pascal/PascalTokenTypes.txt create mode 100644 languages/pascal/README.dox create mode 100644 languages/pascal/app_templates/Makefile.am create mode 100644 languages/pascal/app_templates/fpcgtk/.kdev_ignore create mode 100644 languages/pascal/app_templates/fpcgtk/Makefile.am create mode 100644 languages/pascal/app_templates/fpcgtk/app.kdevelop create mode 100644 languages/pascal/app_templates/fpcgtk/fpcgtk create mode 100644 languages/pascal/app_templates/fpcgtk/fpcgtk.kdevtemplate create mode 100644 languages/pascal/app_templates/fpcgtk/fpcgtk.png create mode 100644 languages/pascal/app_templates/fpcgtk/main.pp create mode 100644 languages/pascal/app_templates/fpchello/.kdev_ignore create mode 100644 languages/pascal/app_templates/fpchello/Makefile.am create mode 100644 languages/pascal/app_templates/fpchello/app.kdevelop create mode 100644 languages/pascal/app_templates/fpchello/fpchello create mode 100644 languages/pascal/app_templates/fpchello/fpchello.kdevtemplate create mode 100644 languages/pascal/app_templates/fpchello/fpchello.png create mode 100644 languages/pascal/app_templates/fpchello/main.pp create mode 100644 languages/pascal/app_templates/fpcsharedlib/.kdev_ignore create mode 100644 languages/pascal/app_templates/fpcsharedlib/Makefile.am create mode 100644 languages/pascal/app_templates/fpcsharedlib/app.kdevelop create mode 100644 languages/pascal/app_templates/fpcsharedlib/fpcsharedlib create mode 100644 languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.kdevtemplate create mode 100644 languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.png create mode 100644 languages/pascal/app_templates/fpcsharedlib/main.pp create mode 100644 languages/pascal/app_templates/pascal.appwizard create mode 100644 languages/pascal/app_templates/pascalhello/.kdev_ignore create mode 100644 languages/pascal/app_templates/pascalhello/Makefile.am create mode 100644 languages/pascal/app_templates/pascalhello/app.kdevelop create mode 100644 languages/pascal/app_templates/pascalhello/main.pp create mode 100644 languages/pascal/app_templates/pascalhello/pascalhello create mode 100644 languages/pascal/app_templates/pascalhello/pascalhello.kdevtemplate create mode 100644 languages/pascal/app_templates/pascalhello/pascalhello.png create mode 100644 languages/pascal/backgroundparser.cpp create mode 100644 languages/pascal/backgroundparser.h create mode 100644 languages/pascal/compiler/Makefile.am create mode 100644 languages/pascal/compiler/dccoptions/Makefile.am create mode 100644 languages/pascal/compiler/dccoptions/dccoptionsplugin.cpp create mode 100644 languages/pascal/compiler/dccoptions/dccoptionsplugin.h create mode 100644 languages/pascal/compiler/dccoptions/kdevdccoptions.desktop create mode 100644 languages/pascal/compiler/dccoptions/optiontabs.cpp create mode 100644 languages/pascal/compiler/dccoptions/optiontabs.h create mode 100644 languages/pascal/compiler/fpcoptions/Makefile.am create mode 100644 languages/pascal/compiler/fpcoptions/fpcoptionsplugin.cpp create mode 100644 languages/pascal/compiler/fpcoptions/fpcoptionsplugin.h create mode 100644 languages/pascal/compiler/fpcoptions/kdevfpcoptions.desktop create mode 100644 languages/pascal/compiler/fpcoptions/optiontabs.cpp create mode 100644 languages/pascal/compiler/fpcoptions/optiontabs.h create mode 100644 languages/pascal/configproblemreporter.ui create mode 100644 languages/pascal/doc/Makefile.am create mode 100644 languages/pascal/doc/pascal_bugs_fp.toc create mode 100644 languages/pascal/file_templates/Makefile.am create mode 100644 languages/pascal/file_templates/dpr create mode 100644 languages/pascal/file_templates/pas-program create mode 100644 languages/pascal/file_templates/pas-unit create mode 100644 languages/pascal/file_templates/pp-program create mode 100644 languages/pascal/file_templates/pp-unit create mode 100644 languages/pascal/kdevpascalsupport.desktop create mode 100644 languages/pascal/kdevpascalsupport.rc create mode 100644 languages/pascal/pascal.g create mode 100644 languages/pascal/pascal.tree.g create mode 100644 languages/pascal/pascalsupport_part.cpp create mode 100644 languages/pascal/pascalsupport_part.h create mode 100644 languages/pascal/pascaltemplates create mode 100644 languages/pascal/problemreporter.cpp create mode 100644 languages/pascal/problemreporter.h create mode 100644 languages/perl/Makefile.am create mode 100644 languages/perl/README.dox create mode 100644 languages/perl/app_templates/Makefile.am create mode 100644 languages/perl/app_templates/perl.appwizard create mode 100644 languages/perl/app_templates/perlhello/.kdev_ignore create mode 100644 languages/perl/app_templates/perlhello/Makefile.am create mode 100644 languages/perl/app_templates/perlhello/app.kdevelop create mode 100755 languages/perl/app_templates/perlhello/app.pl create mode 100644 languages/perl/app_templates/perlhello/perlhello create mode 100644 languages/perl/app_templates/perlhello/perlhello.kdevtemplate create mode 100644 languages/perl/app_templates/perlhello/perlhello.png create mode 100644 languages/perl/doc/Makefile.am create mode 100644 languages/perl/doc/perl.toc create mode 100644 languages/perl/doc/perl_bugs.toc create mode 100644 languages/perl/file_templates/Makefile.am create mode 100644 languages/perl/file_templates/pl create mode 100644 languages/perl/file_templates/pm create mode 100644 languages/perl/kdevperlsupport.desktop create mode 100644 languages/perl/kdevperlsupport.rc create mode 100644 languages/perl/perlconfigwidget.cpp create mode 100644 languages/perl/perlconfigwidget.h create mode 100644 languages/perl/perlconfigwidgetbase.ui create mode 100644 languages/perl/perldoc.cpp create mode 100644 languages/perl/perldoc.h create mode 100644 languages/perl/perldoc.protocol create mode 100644 languages/perl/perlparser.cpp create mode 100644 languages/perl/perlparser.h create mode 100644 languages/perl/perlsupportpart.cpp create mode 100644 languages/perl/perlsupportpart.h create mode 100644 languages/php/Makefile.am create mode 100644 languages/php/README.dox create mode 100644 languages/php/app_templates/Makefile.am create mode 100644 languages/php/app_templates/php.appwizard create mode 100644 languages/php/app_templates/phphello/.kdev_ignore create mode 100644 languages/php/app_templates/phphello/Makefile.am create mode 100644 languages/php/app_templates/phphello/app.kdevelop create mode 100644 languages/php/app_templates/phphello/app.php create mode 100644 languages/php/app_templates/phphello/phphello create mode 100644 languages/php/app_templates/phphello/phphello.kdevtemplate create mode 100644 languages/php/app_templates/phphello/phphello.png create mode 100644 languages/php/data/Makefile.am create mode 100644 languages/php/data/phpfunctions create mode 100644 languages/php/doc/Makefile.am create mode 100644 languages/php/doc/php.toc create mode 100644 languages/php/doc/php_bugs.toc create mode 100644 languages/php/file_templates/Makefile.am create mode 100644 languages/php/file_templates/php create mode 100644 languages/php/kdevphpsupport.desktop create mode 100644 languages/php/kdevphpsupport.rc create mode 100644 languages/php/phpcodecompletion.cpp create mode 100644 languages/php/phpcodecompletion.h create mode 100644 languages/php/phpconfigdata.cpp create mode 100644 languages/php/phpconfigdata.h create mode 100644 languages/php/phpconfigwidget.cpp create mode 100644 languages/php/phpconfigwidget.h create mode 100644 languages/php/phpconfigwidgetbase.ui create mode 100644 languages/php/phperrorview.cpp create mode 100644 languages/php/phperrorview.h create mode 100644 languages/php/phpfile.cpp create mode 100644 languages/php/phpfile.h create mode 100644 languages/php/phphtmlview.cpp create mode 100644 languages/php/phphtmlview.h create mode 100644 languages/php/phpinfodlg.ui create mode 100644 languages/php/phpnewclassdlg.cpp create mode 100644 languages/php/phpnewclassdlg.h create mode 100644 languages/php/phpnewclassdlgbase.ui create mode 100644 languages/php/phpparser.cpp create mode 100644 languages/php/phpparser.h create mode 100644 languages/php/phpsupport_event.h create mode 100644 languages/php/phpsupportpart.cpp create mode 100644 languages/php/phpsupportpart.h create mode 100644 languages/php/phptemplates create mode 100644 languages/python/Makefile.am create mode 100644 languages/python/README.dox create mode 100644 languages/python/app_templates/Makefile.am create mode 100644 languages/python/app_templates/pyqt/.kdev_ignore create mode 100644 languages/python/app_templates/pyqt/Makefile.am create mode 100644 languages/python/app_templates/pyqt/app-Makefile.am create mode 100644 languages/python/app_templates/pyqt/app-autogen.sh create mode 100644 languages/python/app_templates/pyqt/app-configure.ac create mode 100644 languages/python/app_templates/pyqt/app.kdevelop create mode 100644 languages/python/app_templates/pyqt/app.py create mode 100644 languages/python/app_templates/pyqt/documentdetails.ui create mode 100644 languages/python/app_templates/pyqt/fileopen.pyxpm create mode 100644 languages/python/app_templates/pyqt/fileprint.pyxpm create mode 100644 languages/python/app_templates/pyqt/filesave.pyxpm create mode 100644 languages/python/app_templates/pyqt/install-sh create mode 100644 languages/python/app_templates/pyqt/missing create mode 100644 languages/python/app_templates/pyqt/mkinstalldirs create mode 100644 languages/python/app_templates/pyqt/pyqt create mode 100644 languages/python/app_templates/pyqt/pyqt-am-preproc.py create mode 100644 languages/python/app_templates/pyqt/pyqt.kdevtemplate create mode 100644 languages/python/app_templates/pyqt/pyqt.png create mode 100644 languages/python/app_templates/pyqt/templates-ui-dialog create mode 100644 languages/python/app_templates/pyqt/templates-ui-mainwin create mode 100644 languages/python/app_templates/python.appwizard create mode 100644 languages/python/app_templates/pythonhello/.kdev_ignore create mode 100644 languages/python/app_templates/pythonhello/Makefile.am create mode 100644 languages/python/app_templates/pythonhello/app.kdevelop create mode 100644 languages/python/app_templates/pythonhello/app.py create mode 100644 languages/python/app_templates/pythonhello/pythonhello create mode 100644 languages/python/app_templates/pythonhello/pythonhello.kdevtemplate create mode 100644 languages/python/app_templates/pythonhello/pythonhello.png create mode 100644 languages/python/app_templates/pytk/.kdev_ignore create mode 100644 languages/python/app_templates/pytk/Makefile.am create mode 100644 languages/python/app_templates/pytk/app.kdevelop create mode 100644 languages/python/app_templates/pytk/app.py create mode 100644 languages/python/app_templates/pytk/pytk create mode 100644 languages/python/app_templates/pytk/pytk.kdevtemplate create mode 100644 languages/python/app_templates/pytk/pytk.png create mode 100644 languages/python/doc/Makefile.am create mode 100644 languages/python/doc/python.toc create mode 100644 languages/python/doc/python_bugs.toc create mode 100644 languages/python/file_templates/Makefile.am create mode 100644 languages/python/file_templates/py create mode 100755 languages/python/kde_pydoc.py create mode 100644 languages/python/kdevpythonsupport.desktop create mode 100644 languages/python/kdevpythonsupport.rc create mode 100644 languages/python/pydoc.cpp create mode 100644 languages/python/pydoc.h create mode 100644 languages/python/pydoc.protocol create mode 100644 languages/python/pythonconfigwidget.cpp create mode 100644 languages/python/pythonconfigwidget.h create mode 100644 languages/python/pythonconfigwidgetbase.ui create mode 100644 languages/python/pythonimplementationwidget.cpp create mode 100644 languages/python/pythonimplementationwidget.h create mode 100644 languages/python/pythonsupportpart.cpp create mode 100644 languages/python/pythonsupportpart.h create mode 100644 languages/python/qtdesignerpythonintegration.cpp create mode 100644 languages/python/qtdesignerpythonintegration.h create mode 100644 languages/ruby/Makefile.am create mode 100644 languages/ruby/README create mode 100644 languages/ruby/README.dox create mode 100644 languages/ruby/app_templates/Makefile.am create mode 100644 languages/ruby/app_templates/dcopservice/Makefile.am create mode 100644 languages/ruby/app_templates/dcopservice/app-configure.in.in create mode 100644 languages/ruby/app_templates/dcopservice/app.cpp create mode 100644 languages/ruby/app_templates/dcopservice/dcopservice.desktop create mode 100644 languages/ruby/app_templates/dcopservice/dcopservice.kdevelop create mode 100644 languages/ruby/app_templates/dcopservice/dcopservice.rb create mode 100644 languages/ruby/app_templates/dcopservice/dcopserviceruby.kdevtemplate create mode 100644 languages/ruby/app_templates/dcopservice/dcopserviceruby.png create mode 100644 languages/ruby/app_templates/dcopservice/main.rb create mode 100644 languages/ruby/app_templates/dcopservice/src-Makefile.am create mode 100644 languages/ruby/app_templates/dcopservice/subdirs create mode 100644 languages/ruby/app_templates/kapp/Makefile.am create mode 100644 languages/ruby/app_templates/kapp/README create mode 100644 languages/ruby/app_templates/kapp/app-Makefile.am create mode 100644 languages/ruby/app_templates/kapp/app-configure.in.in create mode 100644 languages/ruby/app_templates/kapp/app.cpp create mode 100644 languages/ruby/app_templates/kapp/app.desktop create mode 100644 languages/ruby/app_templates/kapp/app.kdevelop create mode 100644 languages/ruby/app_templates/kapp/app.rb create mode 100644 languages/ruby/app_templates/kapp/app_client.rb create mode 100644 languages/ruby/app_templates/kapp/appiface.rb create mode 100644 languages/ruby/app_templates/kapp/appui.rc create mode 100644 languages/ruby/app_templates/kapp/appview.rb create mode 100644 languages/ruby/app_templates/kapp/kappruby.kdevtemplate create mode 100644 languages/ruby/app_templates/kapp/kappruby.png create mode 100644 languages/ruby/app_templates/kapp/main.rb create mode 100644 languages/ruby/app_templates/kapp/pref.rb create mode 100644 languages/ruby/app_templates/kapp/src-Makefile.am create mode 100644 languages/ruby/app_templates/kapp/subdirs create mode 100644 languages/ruby/app_templates/kxt/Makefile.am create mode 100644 languages/ruby/app_templates/kxt/README create mode 100644 languages/ruby/app_templates/kxt/app-Makefile.am create mode 100644 languages/ruby/app_templates/kxt/app-configure.in.in create mode 100644 languages/ruby/app_templates/kxt/app.cpp create mode 100644 languages/ruby/app_templates/kxt/app.desktop create mode 100644 languages/ruby/app_templates/kxt/app.kcfg create mode 100644 languages/ruby/app_templates/kxt/app.kdevelop create mode 100644 languages/ruby/app_templates/kxt/app.rb create mode 100644 languages/ruby/app_templates/kxt/appui.rc create mode 100644 languages/ruby/app_templates/kxt/appview.rb create mode 100644 languages/ruby/app_templates/kxt/appview_base.ui create mode 100644 languages/ruby/app_templates/kxt/kxtruby.kdevtemplate create mode 100644 languages/ruby/app_templates/kxt/kxtruby.png create mode 100644 languages/ruby/app_templates/kxt/main.rb create mode 100644 languages/ruby/app_templates/kxt/prefs-base.ui create mode 100644 languages/ruby/app_templates/kxt/prefs.rb create mode 100644 languages/ruby/app_templates/kxt/previewruby.png create mode 100644 languages/ruby/app_templates/kxt/settings.kcfgc create mode 100644 languages/ruby/app_templates/kxt/src-Makefile.am create mode 100644 languages/ruby/app_templates/kxt/subdirs create mode 100644 languages/ruby/app_templates/qtruby/.kdev_ignore create mode 100644 languages/ruby/app_templates/qtruby/Makefile.am create mode 100644 languages/ruby/app_templates/qtruby/README create mode 100644 languages/ruby/app_templates/qtruby/app-Makefile create mode 100644 languages/ruby/app_templates/qtruby/app.filelist create mode 100644 languages/ruby/app_templates/qtruby/app.kdevelop create mode 100755 languages/ruby/app_templates/qtruby/app.rb create mode 100644 languages/ruby/app_templates/qtruby/qtruby.kdevtemplate create mode 100644 languages/ruby/app_templates/qtruby/qtruby.png create mode 100644 languages/ruby/app_templates/qtruby4app/Makefile.am create mode 100644 languages/ruby/app_templates/qtruby4app/ReadMe create mode 100644 languages/ruby/app_templates/qtruby4app/app-Makefile create mode 100644 languages/ruby/app_templates/qtruby4app/app.filelist create mode 100644 languages/ruby/app_templates/qtruby4app/application.qrc create mode 100644 languages/ruby/app_templates/qtruby4app/editcopy.xpm create mode 100644 languages/ruby/app_templates/qtruby4app/editcut.xpm create mode 100644 languages/ruby/app_templates/qtruby4app/editpaste.xpm create mode 100644 languages/ruby/app_templates/qtruby4app/filenew.xpm create mode 100644 languages/ruby/app_templates/qtruby4app/fileopen.xpm create mode 100644 languages/ruby/app_templates/qtruby4app/filesave.xpm create mode 100644 languages/ruby/app_templates/qtruby4app/main.rb create mode 100644 languages/ruby/app_templates/qtruby4app/qrc_application.rb create mode 100644 languages/ruby/app_templates/qtruby4app/qtruby4app.kdevelop create mode 100644 languages/ruby/app_templates/qtruby4app/qtruby4app.kdevtemplate create mode 100644 languages/ruby/app_templates/qtruby4app/qtruby4app.png create mode 100644 languages/ruby/app_templates/qtruby4app/qtruby4app.rb create mode 100644 languages/ruby/app_templates/qtrubyapp/Makefile.am create mode 100644 languages/ruby/app_templates/qtrubyapp/README create mode 100644 languages/ruby/app_templates/qtrubyapp/app-Makefile create mode 100644 languages/ruby/app_templates/qtrubyapp/app.filelist create mode 100644 languages/ruby/app_templates/qtrubyapp/fileopen.xpm create mode 100644 languages/ruby/app_templates/qtrubyapp/fileprint.xpm create mode 100644 languages/ruby/app_templates/qtrubyapp/filesave.xpm create mode 100644 languages/ruby/app_templates/qtrubyapp/main.rb create mode 100644 languages/ruby/app_templates/qtrubyapp/qtrubyapp.kdevelop create mode 100644 languages/ruby/app_templates/qtrubyapp/qtrubyapp.kdevtemplate create mode 100644 languages/ruby/app_templates/qtrubyapp/qtrubyapp.png create mode 100644 languages/ruby/app_templates/qtrubyapp/qtrubyapp.rb create mode 100644 languages/ruby/app_templates/rails/CMakeLists.txt create mode 100644 languages/ruby/app_templates/rails/Makefile.am create mode 100644 languages/ruby/app_templates/rails/app.kdevelop create mode 100644 languages/ruby/app_templates/rails/rails.kdevtemplate create mode 100644 languages/ruby/app_templates/rails/rails.png create mode 100644 languages/ruby/app_templates/ruby.appwizard create mode 100644 languages/ruby/app_templates/rubyhello/.kdev_ignore create mode 100644 languages/ruby/app_templates/rubyhello/Makefile.am create mode 100644 languages/ruby/app_templates/rubyhello/app.kdevelop create mode 100644 languages/ruby/app_templates/rubyhello/app.rb create mode 100644 languages/ruby/app_templates/rubyhello/rubyhello create mode 100644 languages/ruby/app_templates/rubyhello/rubyhello.kdevtemplate create mode 100644 languages/ruby/app_templates/rubyhello/rubyhello.png create mode 100644 languages/ruby/debugger/Makefile.am create mode 100644 languages/ruby/debugger/breakpoint.cpp create mode 100644 languages/ruby/debugger/breakpoint.h create mode 100644 languages/ruby/debugger/dbgcommand.cpp create mode 100644 languages/ruby/debugger/dbgcommand.h create mode 100644 languages/ruby/debugger/dbgcontroller.cpp create mode 100644 languages/ruby/debugger/dbgcontroller.h create mode 100644 languages/ruby/debugger/dbgpsdlg.cpp create mode 100644 languages/ruby/debugger/dbgpsdlg.h create mode 100644 languages/ruby/debugger/dbgtoolbar.cpp create mode 100644 languages/ruby/debugger/dbgtoolbar.h create mode 100644 languages/ruby/debugger/debuggee.rb create mode 100644 languages/ruby/debugger/debuggerpart.cpp create mode 100644 languages/ruby/debugger/debuggerpart.h create mode 100644 languages/ruby/debugger/framestackwidget.cpp create mode 100644 languages/ruby/debugger/framestackwidget.h create mode 100644 languages/ruby/debugger/hi16-action-breakpoint_add.png create mode 100644 languages/ruby/debugger/hi16-action-breakpoint_delete.png create mode 100644 languages/ruby/debugger/hi16-action-breakpoint_delete_all.png create mode 100644 languages/ruby/debugger/hi16-action-breakpoint_edit.png create mode 100644 languages/ruby/debugger/kdevrbdebugger.desktop create mode 100644 languages/ruby/debugger/kdevrbdebugger.rc create mode 100644 languages/ruby/debugger/rdbbreakpointwidget.cpp create mode 100644 languages/ruby/debugger/rdbbreakpointwidget.h create mode 100644 languages/ruby/debugger/rdbcommand.cpp create mode 100644 languages/ruby/debugger/rdbcommand.h create mode 100644 languages/ruby/debugger/rdbcontroller.cpp create mode 100644 languages/ruby/debugger/rdbcontroller.h create mode 100644 languages/ruby/debugger/rdboutputwidget.cpp create mode 100644 languages/ruby/debugger/rdboutputwidget.h create mode 100644 languages/ruby/debugger/rdbparser.cpp create mode 100644 languages/ruby/debugger/rdbparser.h create mode 100644 languages/ruby/debugger/rdbtable.cpp create mode 100644 languages/ruby/debugger/rdbtable.h create mode 100644 languages/ruby/debugger/stty.cpp create mode 100644 languages/ruby/debugger/stty.h create mode 100644 languages/ruby/debugger/variablewidget.cpp create mode 100644 languages/ruby/debugger/variablewidget.h create mode 100644 languages/ruby/doc/Makefile.am create mode 100644 languages/ruby/doc/qtruby.toc create mode 100644 languages/ruby/doc/rails.toc create mode 100644 languages/ruby/doc/ruby.toc create mode 100644 languages/ruby/doc/ruby_bugs.toc create mode 100644 languages/ruby/file_templates/Makefile.am create mode 100644 languages/ruby/file_templates/css create mode 100644 languages/ruby/file_templates/html.erb create mode 100644 languages/ruby/file_templates/js create mode 100644 languages/ruby/file_templates/js.rjs create mode 100644 languages/ruby/file_templates/rb create mode 100644 languages/ruby/file_templates/rhtml create mode 100644 languages/ruby/file_templates/rjs create mode 100644 languages/ruby/file_templates/rxml create mode 100644 languages/ruby/file_templates/xml.builder create mode 100644 languages/ruby/kdevrubysupport.desktop create mode 100644 languages/ruby/kdevrubysupport.rc create mode 100644 languages/ruby/play_run.psd create mode 100644 languages/ruby/qtdesignerrubyintegration.cpp create mode 100644 languages/ruby/qtdesignerrubyintegration.h create mode 100644 languages/ruby/ruby_config.png create mode 100644 languages/ruby/ruby_config.psd create mode 100644 languages/ruby/ruby_run.png create mode 100644 languages/ruby/rubyconfigwidget.cpp create mode 100644 languages/ruby/rubyconfigwidget.h create mode 100644 languages/ruby/rubyconfigwidgetbase.ui create mode 100644 languages/ruby/rubyimplementationwidget.cpp create mode 100644 languages/ruby/rubyimplementationwidget.h create mode 100644 languages/ruby/rubysupport_part.cpp create mode 100644 languages/ruby/rubysupport_part.h create mode 100644 languages/ruby/rubytemplates create mode 100644 languages/sql/Makefile.am create mode 100644 languages/sql/README.dox create mode 100644 languages/sql/app_templates/Makefile.am create mode 100644 languages/sql/app_templates/sql.appwizard create mode 100644 languages/sql/app_templates/sqlsimple/.kdev_ignore create mode 100644 languages/sql/app_templates/sqlsimple/Makefile.am create mode 100644 languages/sql/app_templates/sqlsimple/app.kdevelop create mode 100644 languages/sql/app_templates/sqlsimple/app.sql create mode 100644 languages/sql/app_templates/sqlsimple/sqlsimple create mode 100644 languages/sql/app_templates/sqlsimple/sqlsimple.kdevtemplate create mode 100644 languages/sql/app_templates/sqlsimple/sqlsimple.png create mode 100644 languages/sql/doc/Makefile.am create mode 100644 languages/sql/kdevsqlsupport.desktop create mode 100644 languages/sql/kdevsqlsupport.rc create mode 100644 languages/sql/sqlactions.cpp create mode 100644 languages/sql/sqlactions.h create mode 100644 languages/sql/sqlconfigwidget.ui create mode 100644 languages/sql/sqlconfigwidget.ui.h create mode 100644 languages/sql/sqloutputwidget.cpp create mode 100644 languages/sql/sqloutputwidget.h create mode 100644 languages/sql/sqlsupport_part.cpp create mode 100644 languages/sql/sqlsupport_part.h create mode 100644 lib/Makefile.am create mode 100644 lib/antlr/AUTHORS create mode 100644 lib/antlr/COPYING create mode 100644 lib/antlr/ChangeLog create mode 100644 lib/antlr/INSTALL create mode 100644 lib/antlr/Makefile.am create mode 100644 lib/antlr/NEWS create mode 100644 lib/antlr/README create mode 100644 lib/antlr/TODO create mode 100644 lib/antlr/antlr/ANTLRException.hpp create mode 100644 lib/antlr/antlr/ANTLRUtil.hpp create mode 100644 lib/antlr/antlr/AST.hpp create mode 100644 lib/antlr/antlr/ASTArray.hpp create mode 100644 lib/antlr/antlr/ASTFactory.hpp create mode 100644 lib/antlr/antlr/ASTNULLType.hpp create mode 100644 lib/antlr/antlr/ASTPair.hpp create mode 100644 lib/antlr/antlr/ASTRefCount.hpp create mode 100644 lib/antlr/antlr/BaseAST.hpp create mode 100644 lib/antlr/antlr/BitSet.hpp create mode 100644 lib/antlr/antlr/CharBuffer.hpp create mode 100644 lib/antlr/antlr/CharInputBuffer.hpp create mode 100644 lib/antlr/antlr/CharScanner.hpp create mode 100644 lib/antlr/antlr/CharStreamException.hpp create mode 100644 lib/antlr/antlr/CharStreamIOException.hpp create mode 100644 lib/antlr/antlr/CircularQueue.hpp create mode 100644 lib/antlr/antlr/CommonAST.hpp create mode 100644 lib/antlr/antlr/CommonASTWithHiddenTokens.hpp create mode 100644 lib/antlr/antlr/CommonHiddenStreamToken.hpp create mode 100644 lib/antlr/antlr/CommonToken.hpp create mode 100644 lib/antlr/antlr/IOException.hpp create mode 100644 lib/antlr/antlr/InputBuffer.hpp create mode 100644 lib/antlr/antlr/LLkParser.hpp create mode 100644 lib/antlr/antlr/LexerSharedInputState.hpp create mode 100644 lib/antlr/antlr/Makefile.am create mode 100644 lib/antlr/antlr/MismatchedCharException.hpp create mode 100644 lib/antlr/antlr/MismatchedTokenException.hpp create mode 100644 lib/antlr/antlr/NoViableAltException.hpp create mode 100644 lib/antlr/antlr/NoViableAltForCharException.hpp create mode 100644 lib/antlr/antlr/Parser.hpp create mode 100644 lib/antlr/antlr/ParserSharedInputState.hpp create mode 100644 lib/antlr/antlr/RecognitionException.hpp create mode 100644 lib/antlr/antlr/RefCount.hpp create mode 100644 lib/antlr/antlr/SemanticException.hpp create mode 100644 lib/antlr/antlr/String.hpp create mode 100644 lib/antlr/antlr/Token.hpp create mode 100644 lib/antlr/antlr/TokenBuffer.hpp create mode 100644 lib/antlr/antlr/TokenRefCount.hpp create mode 100644 lib/antlr/antlr/TokenStream.hpp create mode 100644 lib/antlr/antlr/TokenStreamBasicFilter.hpp create mode 100644 lib/antlr/antlr/TokenStreamException.hpp create mode 100644 lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp create mode 100644 lib/antlr/antlr/TokenStreamIOException.hpp create mode 100644 lib/antlr/antlr/TokenStreamRecognitionException.hpp create mode 100644 lib/antlr/antlr/TokenStreamRetryException.hpp create mode 100644 lib/antlr/antlr/TokenStreamRewriteEngine.hpp create mode 100644 lib/antlr/antlr/TokenStreamSelector.hpp create mode 100644 lib/antlr/antlr/TokenWithIndex.hpp create mode 100644 lib/antlr/antlr/TreeParser.hpp create mode 100644 lib/antlr/antlr/TreeParserSharedInputState.hpp create mode 100644 lib/antlr/antlr/config.hpp create mode 100644 lib/antlr/src/ANTLRUtil.cpp create mode 100644 lib/antlr/src/ASTFactory.cpp create mode 100644 lib/antlr/src/ASTNULLType.cpp create mode 100644 lib/antlr/src/ASTRefCount.cpp create mode 100644 lib/antlr/src/BaseAST.cpp create mode 100644 lib/antlr/src/BitSet.cpp create mode 100644 lib/antlr/src/CharBuffer.cpp create mode 100644 lib/antlr/src/CharScanner.cpp create mode 100644 lib/antlr/src/CommonAST.cpp create mode 100644 lib/antlr/src/CommonASTWithHiddenTokens.cpp create mode 100644 lib/antlr/src/CommonHiddenStreamToken.cpp create mode 100644 lib/antlr/src/CommonToken.cpp create mode 100644 lib/antlr/src/InputBuffer.cpp create mode 100644 lib/antlr/src/LLkParser.cpp create mode 100644 lib/antlr/src/Makefile.am create mode 100644 lib/antlr/src/MismatchedCharException.cpp create mode 100644 lib/antlr/src/MismatchedTokenException.cpp create mode 100644 lib/antlr/src/NoViableAltException.cpp create mode 100644 lib/antlr/src/NoViableAltForCharException.cpp create mode 100644 lib/antlr/src/Parser.cpp create mode 100644 lib/antlr/src/RecognitionException.cpp create mode 100644 lib/antlr/src/String.cpp create mode 100644 lib/antlr/src/Token.cpp create mode 100644 lib/antlr/src/TokenBuffer.cpp create mode 100644 lib/antlr/src/TokenRefCount.cpp create mode 100644 lib/antlr/src/TokenStreamBasicFilter.cpp create mode 100644 lib/antlr/src/TokenStreamHiddenTokenFilter.cpp create mode 100644 lib/antlr/src/TokenStreamRewriteEngine.cpp create mode 100644 lib/antlr/src/TokenStreamSelector.cpp create mode 100644 lib/antlr/src/TreeParser.cpp create mode 100644 lib/astyle/ASBeautifier.cpp create mode 100644 lib/astyle/ASEnhancer.cpp create mode 100644 lib/astyle/ASFormatter.cpp create mode 100644 lib/astyle/ASResource.cpp create mode 100644 lib/astyle/Makefile.am create mode 100644 lib/astyle/astyle.h create mode 100644 lib/astyle/compiler_defines.h create mode 100644 lib/catalog/Mainpage.dox create mode 100644 lib/catalog/Makefile.am create mode 100644 lib/catalog/catalog.cpp create mode 100644 lib/catalog/catalog.h create mode 100644 lib/catalog/tag.cpp create mode 100644 lib/catalog/tag.h create mode 100644 lib/cppparser/Makefile.am create mode 100644 lib/cppparser/ast.cpp create mode 100644 lib/cppparser/ast.h create mode 100644 lib/cppparser/cachemanager.cpp create mode 100644 lib/cppparser/cachemanager.h create mode 100644 lib/cppparser/driver.cpp create mode 100644 lib/cppparser/driver.h create mode 100644 lib/cppparser/errors.cpp create mode 100644 lib/cppparser/errors.h create mode 100644 lib/cppparser/keywords.h create mode 100644 lib/cppparser/lexer.cpp create mode 100644 lib/cppparser/lexer.h create mode 100644 lib/cppparser/lexercache.cpp create mode 100644 lib/cppparser/lexercache.h create mode 100644 lib/cppparser/lookup.cpp create mode 100644 lib/cppparser/lookup.h create mode 100644 lib/cppparser/macro.h create mode 100644 lib/cppparser/parser.cpp create mode 100644 lib/cppparser/parser.h create mode 100644 lib/cppparser/tree_parser.cpp create mode 100644 lib/cppparser/tree_parser.h create mode 100644 lib/dummy.cpp create mode 100644 lib/interfaces/KDevCoreIface.cpp create mode 100644 lib/interfaces/KDevCoreIface.h create mode 100644 lib/interfaces/KDevPartControllerIface.cpp create mode 100644 lib/interfaces/KDevPartControllerIface.h create mode 100644 lib/interfaces/Mainpage.dox create mode 100644 lib/interfaces/Makefile.am create mode 100644 lib/interfaces/codemodel.cpp create mode 100644 lib/interfaces/codemodel.h create mode 100644 lib/interfaces/codemodel_treeparser.cpp create mode 100644 lib/interfaces/codemodel_treeparser.h create mode 100644 lib/interfaces/codemodel_utils.cpp create mode 100644 lib/interfaces/codemodel_utils.h create mode 100644 lib/interfaces/extensions/Mainpage.dox create mode 100644 lib/interfaces/extensions/Makefile.am create mode 100644 lib/interfaces/extensions/codebrowserfrontend.h create mode 100644 lib/interfaces/extensions/dcop/KDevAppFrontendIface.cpp create mode 100644 lib/interfaces/extensions/dcop/KDevAppFrontendIface.h create mode 100644 lib/interfaces/extensions/dcop/KDevMakeFrontendIface.cpp create mode 100644 lib/interfaces/extensions/dcop/KDevMakeFrontendIface.h create mode 100644 lib/interfaces/extensions/dcop/Makefile.am create mode 100644 lib/interfaces/extensions/kdevappfrontend.cpp create mode 100644 lib/interfaces/extensions/kdevappfrontend.h create mode 100644 lib/interfaces/extensions/kdevcreatefile.h create mode 100644 lib/interfaces/extensions/kdevdifffrontend.cpp create mode 100644 lib/interfaces/extensions/kdevdifffrontend.h create mode 100644 lib/interfaces/extensions/kdevelopappfrontend.desktop create mode 100644 lib/interfaces/extensions/kdevelopcodebrowserfrontend.desktop create mode 100644 lib/interfaces/extensions/kdevelopcreatefile.desktop create mode 100644 lib/interfaces/extensions/kdevelopdifffrontend.desktop create mode 100644 lib/interfaces/extensions/kdevelopmakefrontend.desktop create mode 100644 lib/interfaces/extensions/kdevelopquickopen.desktop create mode 100644 lib/interfaces/extensions/kdevelopsourceformatter.desktop create mode 100644 lib/interfaces/extensions/kdevelopversioncontrol.desktop create mode 100644 lib/interfaces/extensions/kdevmakefrontend.cpp create mode 100644 lib/interfaces/extensions/kdevmakefrontend.h create mode 100644 lib/interfaces/extensions/kdevquickopen.h create mode 100644 lib/interfaces/extensions/kdevsourceformatter.h create mode 100644 lib/interfaces/extensions/kdevversioncontrol.h create mode 100644 lib/interfaces/external/Mainpage.dox create mode 100644 lib/interfaces/external/Makefile.am create mode 100644 lib/interfaces/external/designer.cpp create mode 100644 lib/interfaces/external/designer.h create mode 100644 lib/interfaces/extras/Mainpage.dox create mode 100644 lib/interfaces/extras/Makefile.am create mode 100644 lib/interfaces/extras/kdevcompileroptions.cpp create mode 100644 lib/interfaces/extras/kdevcompileroptions.h create mode 100644 lib/interfaces/extras/kdevelopcompileroptions.desktop create mode 100644 lib/interfaces/extras/kdevelopvcsintegrator.desktop create mode 100644 lib/interfaces/extras/kdevvcsintegrator.cpp create mode 100644 lib/interfaces/extras/kdevvcsintegrator.h create mode 100644 lib/interfaces/hashedstring.cpp create mode 100644 lib/interfaces/hashedstring.h create mode 100644 lib/interfaces/katedocumentmanagerinterface.cpp create mode 100644 lib/interfaces/katedocumentmanagerinterface.h create mode 100644 lib/interfaces/kdevapi.cpp create mode 100644 lib/interfaces/kdevapi.h create mode 100644 lib/interfaces/kdevcoderepository.cpp create mode 100644 lib/interfaces/kdevcoderepository.h create mode 100644 lib/interfaces/kdevcore.cpp create mode 100644 lib/interfaces/kdevcore.h create mode 100644 lib/interfaces/kdevdesignerintegration.cpp create mode 100644 lib/interfaces/kdevdesignerintegration.h create mode 100644 lib/interfaces/kdevdesignerintegrationiface.cpp create mode 100644 lib/interfaces/kdevdesignerintegrationiface.h create mode 100644 lib/interfaces/kdeveloplanguagesupport.desktop create mode 100644 lib/interfaces/kdevelopplugin.desktop create mode 100644 lib/interfaces/kdevelopproject.desktop create mode 100644 lib/interfaces/kdevgenericfactory.h create mode 100644 lib/interfaces/kdevlanguagesupport.cpp create mode 100644 lib/interfaces/kdevlanguagesupport.h create mode 100644 lib/interfaces/kdevmainwindow.cpp create mode 100644 lib/interfaces/kdevmainwindow.h create mode 100644 lib/interfaces/kdevpartcontroller.cpp create mode 100644 lib/interfaces/kdevpartcontroller.h create mode 100644 lib/interfaces/kdevplugin.cpp create mode 100644 lib/interfaces/kdevplugin.h create mode 100644 lib/interfaces/kdevplugincontroller.cpp create mode 100644 lib/interfaces/kdevplugincontroller.h create mode 100644 lib/interfaces/kdevplugininfo.cpp create mode 100644 lib/interfaces/kdevplugininfo.h create mode 100644 lib/interfaces/kdevproject.cpp create mode 100644 lib/interfaces/kdevproject.h create mode 100644 lib/interfaces/kdevprojectiface.cpp create mode 100644 lib/interfaces/kdevprojectiface.h create mode 100644 lib/util/Mainpage.dox create mode 100644 lib/util/Makefile.am create mode 100644 lib/util/blockingkprocess.cpp create mode 100644 lib/util/blockingkprocess.h create mode 100644 lib/util/configwidgetproxy.cpp create mode 100644 lib/util/configwidgetproxy.h create mode 100644 lib/util/domutil.cpp create mode 100644 lib/util/domutil.h create mode 100644 lib/util/execcommand.cpp create mode 100644 lib/util/execcommand.h create mode 100644 lib/util/filetemplate.cpp create mode 100644 lib/util/filetemplate.h create mode 100644 lib/util/kdeveditorutil.cpp create mode 100644 lib/util/kdeveditorutil.h create mode 100644 lib/util/kdevjobtimer.cpp create mode 100644 lib/util/kdevjobtimer.h create mode 100644 lib/util/kdevshellwidget.cpp create mode 100644 lib/util/kdevshellwidget.h create mode 100644 lib/util/kscriptactionmanager.cpp create mode 100644 lib/util/kscriptactionmanager.h create mode 100644 lib/util/rurl.cpp create mode 100644 lib/util/rurl.h create mode 100644 lib/util/settings.cpp create mode 100644 lib/util/settings.h create mode 100644 lib/util/urlutil.cpp create mode 100644 lib/util/urlutil.h create mode 100644 lib/widgets/Mainpage.dox create mode 100644 lib/widgets/Makefile.am create mode 100644 lib/widgets/fancylistviewitem.cpp create mode 100644 lib/widgets/fancylistviewitem.h create mode 100644 lib/widgets/flagboxes.cpp create mode 100644 lib/widgets/flagboxes.h create mode 100644 lib/widgets/kcomboview.cpp create mode 100644 lib/widgets/kcomboview.h create mode 100644 lib/widgets/kdevhtml_partui.rc create mode 100644 lib/widgets/kdevhtmlpart.cpp create mode 100644 lib/widgets/kdevhtmlpart.h create mode 100644 lib/widgets/kdevtabwidget.cpp create mode 100644 lib/widgets/klistviewaction.cpp create mode 100644 lib/widgets/klistviewaction.h create mode 100644 lib/widgets/ksavealldialog.cpp create mode 100644 lib/widgets/ksavealldialog.h create mode 100644 lib/widgets/processlinemaker.cpp create mode 100644 lib/widgets/processlinemaker.h create mode 100644 lib/widgets/processwidget.cpp create mode 100644 lib/widgets/processwidget.h create mode 100644 lib/widgets/propeditor/Mainpage.dox create mode 100644 lib/widgets/propeditor/Makefile.am create mode 100644 lib/widgets/propeditor/childproperty.cpp create mode 100644 lib/widgets/propeditor/childproperty.h create mode 100644 lib/widgets/propeditor/compat_tools.h create mode 100644 lib/widgets/propeditor/multiproperty.cpp create mode 100644 lib/widgets/propeditor/multiproperty.h create mode 100644 lib/widgets/propeditor/pcheckbox.cpp create mode 100644 lib/widgets/propeditor/pcheckbox.h create mode 100644 lib/widgets/propeditor/pcolorbutton.cpp create mode 100644 lib/widgets/propeditor/pcolorbutton.h create mode 100644 lib/widgets/propeditor/pcolorcombo.cpp create mode 100644 lib/widgets/propeditor/pcolorcombo.h create mode 100644 lib/widgets/propeditor/pcombobox.cpp create mode 100644 lib/widgets/propeditor/pcombobox.h create mode 100644 lib/widgets/propeditor/pcursoredit.cpp create mode 100644 lib/widgets/propeditor/pcursoredit.h create mode 100644 lib/widgets/propeditor/pdateedit.cpp create mode 100644 lib/widgets/propeditor/pdateedit.h create mode 100644 lib/widgets/propeditor/pdatetimeedit.cpp create mode 100644 lib/widgets/propeditor/pdatetimeedit.h create mode 100644 lib/widgets/propeditor/pdoublenuminput.cpp create mode 100644 lib/widgets/propeditor/pdoublenuminput.h create mode 100644 lib/widgets/propeditor/pdummywidget.cpp create mode 100644 lib/widgets/propeditor/pdummywidget.h create mode 100644 lib/widgets/propeditor/pfontbutton.cpp create mode 100644 lib/widgets/propeditor/pfontbutton.h create mode 100644 lib/widgets/propeditor/pfontcombo.cpp create mode 100644 lib/widgets/propeditor/pfontcombo.h create mode 100644 lib/widgets/propeditor/plineedit.cpp create mode 100644 lib/widgets/propeditor/plineedit.h create mode 100644 lib/widgets/propeditor/plinestyleedit.cpp create mode 100644 lib/widgets/propeditor/plinestyleedit.h create mode 100644 lib/widgets/propeditor/ppixmapedit.cpp create mode 100644 lib/widgets/propeditor/ppixmapedit.h create mode 100644 lib/widgets/propeditor/ppointedit.cpp create mode 100644 lib/widgets/propeditor/ppointedit.h create mode 100644 lib/widgets/propeditor/prectedit.cpp create mode 100644 lib/widgets/propeditor/prectedit.h create mode 100644 lib/widgets/propeditor/property.cpp create mode 100644 lib/widgets/propeditor/property.h create mode 100644 lib/widgets/propeditor/propertyeditor.cpp create mode 100644 lib/widgets/propeditor/propertyeditor.h create mode 100644 lib/widgets/propeditor/propertyeditor.pro create mode 100644 lib/widgets/propeditor/propertylist.cpp create mode 100644 lib/widgets/propeditor/propertylist.h create mode 100644 lib/widgets/propeditor/propertymachinefactory.cpp create mode 100644 lib/widgets/propeditor/propertymachinefactory.h create mode 100644 lib/widgets/propeditor/propertywidget.cpp create mode 100644 lib/widgets/propeditor/propertywidget.h create mode 100644 lib/widgets/propeditor/propertywidgetproxy.cpp create mode 100644 lib/widgets/propeditor/propertywidgetproxy.h create mode 100644 lib/widgets/propeditor/psizeedit.cpp create mode 100644 lib/widgets/propeditor/psizeedit.h create mode 100644 lib/widgets/propeditor/psizepolicyedit.cpp create mode 100644 lib/widgets/propeditor/psizepolicyedit.h create mode 100644 lib/widgets/propeditor/pspinbox.cpp create mode 100644 lib/widgets/propeditor/pspinbox.h create mode 100644 lib/widgets/propeditor/pstringlistedit.cpp create mode 100644 lib/widgets/propeditor/pstringlistedit.h create mode 100644 lib/widgets/propeditor/psymbolcombo.cpp create mode 100644 lib/widgets/propeditor/psymbolcombo.h create mode 100644 lib/widgets/propeditor/purledit.cpp create mode 100644 lib/widgets/propeditor/purledit.h create mode 100644 lib/widgets/propeditor/pyesnobutton.cpp create mode 100644 lib/widgets/propeditor/pyesnobutton.h create mode 100644 lib/widgets/propeditor/qeditlistbox.cpp create mode 100644 lib/widgets/propeditor/qeditlistbox.h create mode 100644 lib/widgets/propeditor/qfloatinput.cpp create mode 100644 lib/widgets/propeditor/qfloatinput.h create mode 100644 lib/widgets/propeditor/test.cpp create mode 100755 lib/widgets/propeditor/test.pro create mode 100644 lib/widgets/propeditor/undo.xpm create mode 100644 lib/widgets/qcomboview.cpp create mode 100644 lib/widgets/qcomboview.h create mode 100644 lib/widgets/resizablecombo.cpp create mode 100644 lib/widgets/resizablecombo.h create mode 100644 lib/widgets/sticky.xpm create mode 100644 mimetypes/Makefile.am create mode 100644 mimetypes/chm.desktop create mode 100644 mimetypes/x-fortran.desktop create mode 100644 parts/Makefile.am create mode 100644 parts/abbrev/Makefile.am create mode 100644 parts/abbrev/README.dox create mode 100644 parts/abbrev/abbrevconfigwidget.cpp create mode 100644 parts/abbrev/abbrevconfigwidget.h create mode 100644 parts/abbrev/abbrevconfigwidgetbase.ui create mode 100644 parts/abbrev/abbrevpart.cpp create mode 100644 parts/abbrev/abbrevpart.h create mode 100644 parts/abbrev/addtemplatedlg.cpp create mode 100644 parts/abbrev/addtemplatedlg.h create mode 100644 parts/abbrev/addtemplatedlgbase.ui create mode 100644 parts/abbrev/cpp_keywords create mode 100644 parts/abbrev/kdevabbrev.desktop create mode 100644 parts/abbrev/kdevabbrev.rc create mode 100644 parts/abbrev/qt_classes create mode 100644 parts/appwizard/Makefile.am create mode 100644 parts/appwizard/README create mode 100644 parts/appwizard/README.dox create mode 100644 parts/appwizard/appwizarddlg.cpp create mode 100644 parts/appwizard/appwizarddlg.h create mode 100644 parts/appwizard/appwizarddlgbase.ui create mode 100644 parts/appwizard/appwizardfactory.cpp create mode 100644 parts/appwizard/appwizardfactory.h create mode 100644 parts/appwizard/appwizardpart.cpp create mode 100644 parts/appwizard/appwizardpart.h create mode 100644 parts/appwizard/common/Artistic create mode 100644 parts/appwizard/common/COPYING create mode 100644 parts/appwizard/common/COPYING.LIB create mode 100644 parts/appwizard/common/LICENSE.BSD create mode 100644 parts/appwizard/common/LICENSE.QPL create mode 100644 parts/appwizard/common/Makefile.am create mode 100644 parts/appwizard/common/admin.kdevtemplate create mode 100644 parts/appwizard/common/dockbook.kdevtemplate create mode 100644 parts/appwizard/common/gnome-Makefile.am create mode 100644 parts/appwizard/common/gnome-Makefile.cvs create mode 100644 parts/appwizard/common/gnome-app.lsm create mode 100644 parts/appwizard/common/gnome-app.png create mode 100644 parts/appwizard/common/gnome-pixmaps-Makefile.am create mode 100644 parts/appwizard/common/gnome/macros/ChangeLog create mode 100644 parts/appwizard/common/gnome/macros/aclocal-include.m4 create mode 100644 parts/appwizard/common/gnome/macros/autogen.sh create mode 100644 parts/appwizard/common/gnome/macros/compiler-flags.m4 create mode 100644 parts/appwizard/common/gnome/macros/curses.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-Makefile.am create mode 100644 parts/appwizard/common/gnome/macros/gnome-bonobo-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-common.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-fileutils.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-gettext.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-ghttp-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-gnorba-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-guile-checks.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-libgtop-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-objc-checks.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-orbit-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-print-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-pthread-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-support.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-undelfs.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-vfs.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-x-checks.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome-xml-check.m4 create mode 100644 parts/appwizard/common/gnome/macros/gnome.m4 create mode 100644 parts/appwizard/common/gnome/macros/linger.m4 create mode 100644 parts/appwizard/common/gnome/macros/need-declaration.m4 create mode 100644 parts/appwizard/common/gnome2.kdevtemplate create mode 100644 parts/appwizard/common/gnome2/macros/aclocal-include.m4 create mode 100755 parts/appwizard/common/gnome2/macros/autogen.sh create mode 100644 parts/appwizard/common/gnome2/macros/compiler-flags.m4 create mode 100644 parts/appwizard/common/gnome2/macros/curses.m4 create mode 100644 parts/appwizard/common/gnome2/macros/gnome-common.m4 create mode 100644 parts/appwizard/common/gnome2/macros/gnome-deprecated-macros.m4 create mode 100644 parts/appwizard/common/gnome2/macros/gnome2-macros.dep create mode 100644 parts/appwizard/common/gnu.kdevtemplate create mode 100644 parts/appwizard/common/gnu/AUTHORS create mode 100644 parts/appwizard/common/gnu/COPYING create mode 100644 parts/appwizard/common/gnu/ChangeLog create mode 100644 parts/appwizard/common/gnu/INSTALL create mode 100644 parts/appwizard/common/gnu/NEWS create mode 100644 parts/appwizard/common/gnu/README create mode 100644 parts/appwizard/common/gnu/TODO create mode 100644 parts/appwizard/common/hi16-app-app.png create mode 100644 parts/appwizard/common/hi32-app-app.png create mode 100644 parts/appwizard/common/incadmin.kdevtemplate create mode 100755 parts/appwizard/common/incadmin/config.guess create mode 100755 parts/appwizard/common/incadmin/config.sub create mode 100755 parts/appwizard/common/incadmin/depcomp create mode 100755 parts/appwizard/common/incadmin/install-sh create mode 100644 parts/appwizard/common/incadmin/ltmain.sh create mode 100755 parts/appwizard/common/incadmin/missing create mode 100755 parts/appwizard/common/incadmin/mkinstalldirs create mode 100644 parts/appwizard/common/kde-Makefile.am create mode 100644 parts/appwizard/common/kde-Makefile.cvs create mode 100644 parts/appwizard/common/kde-app.desktop create mode 100644 parts/appwizard/common/kde-app.lsm create mode 100644 parts/appwizard/common/kde-configure.in.in create mode 100644 parts/appwizard/common/kde-doc-Makefile.am create mode 100644 parts/appwizard/common/kde-doc-en-Makefile.am create mode 100644 parts/appwizard/common/kde-index.docbook create mode 100644 parts/appwizard/common/kde-part.desktop create mode 100644 parts/appwizard/common/kde-po-Makefile.am create mode 100644 parts/appwizard/common/scons.kdevtemplate create mode 100644 parts/appwizard/common/scons/admin/generic.py create mode 100644 parts/appwizard/common/scons/admin/kde.py create mode 100644 parts/appwizard/common/scons/admin/scons-mini.tar.bz2 create mode 100755 parts/appwizard/common/scons/configure create mode 100644 parts/appwizard/common/wx-Makefile.am create mode 100644 parts/appwizard/common/wx-Makefile.cvs create mode 100644 parts/appwizard/common/wx-configure.in create mode 100755 parts/appwizard/common/wx/macros/autogen.sh create mode 100644 parts/appwizard/filepropspage.cpp create mode 100644 parts/appwizard/filepropspage.h create mode 100644 parts/appwizard/filepropspagebase.ui create mode 100644 parts/appwizard/importdlg.cpp create mode 100644 parts/appwizard/importdlg.h create mode 100644 parts/appwizard/importdlgbase.ui create mode 100644 parts/appwizard/imports/.kdev_ignore create mode 100644 parts/appwizard/imports/Makefile.am create mode 100644 parts/appwizard/imports/ada create mode 100644 parts/appwizard/imports/ada.kdevelop create mode 100644 parts/appwizard/imports/c create mode 100644 parts/appwizard/imports/c-auto create mode 100644 parts/appwizard/imports/c-auto.kdevelop create mode 100644 parts/appwizard/imports/c.kdevelop create mode 100644 parts/appwizard/imports/cpp create mode 100644 parts/appwizard/imports/cpp-auto create mode 100644 parts/appwizard/imports/cpp-auto.kdevelop create mode 100644 parts/appwizard/imports/cpp.kdevelop create mode 100644 parts/appwizard/imports/fortran create mode 100644 parts/appwizard/imports/fortran-auto create mode 100644 parts/appwizard/imports/fortran-auto.kdevelop create mode 100644 parts/appwizard/imports/fortran.kdevelop create mode 100644 parts/appwizard/imports/gnome create mode 100644 parts/appwizard/imports/gnome.kdevelop create mode 100644 parts/appwizard/imports/java create mode 100644 parts/appwizard/imports/java-ant create mode 100644 parts/appwizard/imports/java-ant.kdevelop create mode 100644 parts/appwizard/imports/java-auto create mode 100644 parts/appwizard/imports/java-auto.kdevelop create mode 100644 parts/appwizard/imports/java.kdevelop create mode 100644 parts/appwizard/imports/kde create mode 100644 parts/appwizard/imports/kde.kdevelop create mode 100644 parts/appwizard/imports/pascal create mode 100644 parts/appwizard/imports/pascal.kdevelop create mode 100644 parts/appwizard/imports/perl create mode 100644 parts/appwizard/imports/perl.kdevelop create mode 100644 parts/appwizard/imports/php create mode 100644 parts/appwizard/imports/php.kdevelop create mode 100644 parts/appwizard/imports/python create mode 100644 parts/appwizard/imports/python.kdevelop create mode 100644 parts/appwizard/imports/qt create mode 100644 parts/appwizard/imports/qt-auto create mode 100644 parts/appwizard/imports/qt-auto.kdevelop create mode 100644 parts/appwizard/imports/qt.kdevelop create mode 100644 parts/appwizard/imports/qt4qmake create mode 100644 parts/appwizard/imports/qt4qmake.kdevelop create mode 100644 parts/appwizard/imports/qtqmake create mode 100644 parts/appwizard/imports/qtqmake.kdevelop create mode 100644 parts/appwizard/imports/qttmake create mode 100644 parts/appwizard/imports/qttmake.kdevelop create mode 100644 parts/appwizard/imports/ruby create mode 100644 parts/appwizard/imports/ruby.kdevelop create mode 100644 parts/appwizard/kdevappwizard.desktop create mode 100644 parts/appwizard/kdevappwizard.rc create mode 100644 parts/appwizard/kdevfile.cpp create mode 100644 parts/appwizard/kdevfile.h create mode 100644 parts/appwizard/kdevlicense.cpp create mode 100644 parts/appwizard/kdevlicense.h create mode 100644 parts/appwizard/licenses/BSD create mode 100644 parts/appwizard/licenses/GPL create mode 100644 parts/appwizard/licenses/GPL+Qt-Exception create mode 100644 parts/appwizard/licenses/LGPL create mode 100644 parts/appwizard/licenses/MIT create mode 100644 parts/appwizard/licenses/Makefile.am create mode 100644 parts/appwizard/licenses/NCSA create mode 100644 parts/appwizard/licenses/QPL create mode 100644 parts/appwizard/misc.cpp create mode 100644 parts/appwizard/misc.h create mode 100644 parts/appwizard/profilesupport.cpp create mode 100644 parts/appwizard/profilesupport.h create mode 100644 parts/appwizard/vcs_form.ui create mode 100644 parts/astyle/Makefile.am create mode 100644 parts/astyle/README.dox create mode 100644 parts/astyle/astyle_adaptor.cpp create mode 100644 parts/astyle/astyle_adaptor.h create mode 100644 parts/astyle/astyle_part.cpp create mode 100644 parts/astyle/astyle_part.h create mode 100644 parts/astyle/astyle_widget.cpp create mode 100644 parts/astyle/astyle_widget.h create mode 100644 parts/astyle/astyleconfig.ui create mode 100644 parts/astyle/kdevastyle.desktop create mode 100644 parts/astyle/kdevpart_astyle.rc create mode 100644 parts/bookmarks/Makefile.am create mode 100644 parts/bookmarks/README create mode 100644 parts/bookmarks/README.dox create mode 100644 parts/bookmarks/bookmarks_config.cpp create mode 100644 parts/bookmarks/bookmarks_config.h create mode 100644 parts/bookmarks/bookmarks_part.cpp create mode 100644 parts/bookmarks/bookmarks_part.h create mode 100644 parts/bookmarks/bookmarks_settings.cpp create mode 100644 parts/bookmarks/bookmarks_settings.h create mode 100644 parts/bookmarks/bookmarks_settings_base.ui create mode 100644 parts/bookmarks/bookmarks_widget.cpp create mode 100644 parts/bookmarks/bookmarks_widget.h create mode 100644 parts/bookmarks/kdevbookmarks.desktop create mode 100644 parts/classview/Makefile.am create mode 100644 parts/classview/README.dox create mode 100644 parts/classview/classtooldlg.cpp create mode 100644 parts/classview/classtooldlg.h create mode 100644 parts/classview/classtoolwidget.cpp create mode 100644 parts/classview/classtoolwidget.h create mode 100644 parts/classview/classtreebase.cpp create mode 100644 parts/classview/classtreebase.h create mode 100644 parts/classview/classviewpart.cpp create mode 100644 parts/classview/classviewpart.h create mode 100644 parts/classview/classviewwidget.cpp create mode 100644 parts/classview/classviewwidget.h create mode 100644 parts/classview/digraphview.cpp create mode 100644 parts/classview/digraphview.h create mode 100644 parts/classview/hierarchydlg.cpp create mode 100644 parts/classview/hierarchydlg.h create mode 100644 parts/classview/kdevclassview.desktop create mode 100644 parts/classview/kdevclassview.rc create mode 100644 parts/classview/navigator.cpp create mode 100644 parts/classview/navigator.h create mode 100644 parts/classview/viewcombos.cpp create mode 100644 parts/classview/viewcombos.h create mode 100644 parts/ctags2/Makefile.am create mode 100644 parts/ctags2/README.dox create mode 100644 parts/ctags2/ctags2_createtagfile.cpp create mode 100644 parts/ctags2/ctags2_createtagfile.h create mode 100644 parts/ctags2/ctags2_createtagfilebase.ui create mode 100644 parts/ctags2/ctags2_part.cpp create mode 100644 parts/ctags2/ctags2_part.h create mode 100644 parts/ctags2/ctags2_selecttagfile.cpp create mode 100644 parts/ctags2/ctags2_selecttagfile.h create mode 100644 parts/ctags2/ctags2_selecttagfilebase.ui create mode 100644 parts/ctags2/ctags2_settingswidget.cpp create mode 100644 parts/ctags2/ctags2_settingswidget.h create mode 100644 parts/ctags2/ctags2_settingswidgetbase.ui create mode 100644 parts/ctags2/ctags2_widget.cpp create mode 100644 parts/ctags2/ctags2_widget.h create mode 100644 parts/ctags2/ctags2_widgetbase.ui create mode 100644 parts/ctags2/ctagskinds.cpp create mode 100644 parts/ctags2/ctagskinds.h create mode 100644 parts/ctags2/kdevctags2.desktop create mode 100644 parts/ctags2/kdevpart_ctags2.rc create mode 100644 parts/ctags2/readtags.c create mode 100644 parts/ctags2/readtags.h create mode 100644 parts/ctags2/tagitem.cpp create mode 100644 parts/ctags2/tagitem.h create mode 100644 parts/ctags2/tags.cpp create mode 100644 parts/ctags2/tags.h create mode 100644 parts/diff/Makefile.am create mode 100644 parts/diff/README create mode 100644 parts/diff/README.dox create mode 100644 parts/diff/diffdlg.cpp create mode 100644 parts/diff/diffdlg.h create mode 100644 parts/diff/diffpart.cpp create mode 100644 parts/diff/diffpart.h create mode 100644 parts/diff/diffwidget.cpp create mode 100644 parts/diff/diffwidget.h create mode 100644 parts/diff/kdevdiff.desktop create mode 100644 parts/diff/kdevdiff.rc create mode 100644 parts/distpart/Makefile.am create mode 100644 parts/distpart/README create mode 100644 parts/distpart/README.dox create mode 100644 parts/distpart/distpart_part.cpp create mode 100644 parts/distpart/distpart_part.h create mode 100644 parts/distpart/distpart_ui.ui create mode 100644 parts/distpart/distpart_widget.cpp create mode 100644 parts/distpart/distpart_widget.h create mode 100644 parts/distpart/kdevdistpart.desktop create mode 100644 parts/distpart/kdevpart_distpart.rc create mode 100644 parts/distpart/lsmsupport.cpp create mode 100644 parts/distpart/lsmsupport.h create mode 100644 parts/distpart/packagebase.cpp create mode 100644 parts/distpart/packagebase.h create mode 100644 parts/distpart/specsupport.cpp create mode 100644 parts/distpart/specsupport.h create mode 100644 parts/documentation/KDevDocumentationIface.cpp create mode 100644 parts/documentation/KDevDocumentationIface.h create mode 100644 parts/documentation/Makefile.am create mode 100644 parts/documentation/README.dox create mode 100644 parts/documentation/addcatalogdlg.cpp create mode 100644 parts/documentation/addcatalogdlg.h create mode 100644 parts/documentation/addcatalogdlgbase.ui create mode 100644 parts/documentation/bookmarkview.cpp create mode 100644 parts/documentation/bookmarkview.h create mode 100644 parts/documentation/contentsview.cpp create mode 100644 parts/documentation/contentsview.h create mode 100644 parts/documentation/data/Makefile.am create mode 100644 parts/documentation/data/checked.xpm create mode 100644 parts/documentation/data/htdig.png create mode 100644 parts/documentation/data/long.html create mode 100644 parts/documentation/data/nomatch.html create mode 100644 parts/documentation/data/short.html create mode 100644 parts/documentation/data/star.png create mode 100644 parts/documentation/data/star_blank.png create mode 100644 parts/documentation/data/syntax.html create mode 100644 parts/documentation/data/unchecked.xpm create mode 100644 parts/documentation/data/wrapper.html create mode 100644 parts/documentation/docconfiglistview.cpp create mode 100644 parts/documentation/docconfiglistview.h create mode 100644 parts/documentation/docglobalconfigwidget.cpp create mode 100644 parts/documentation/docglobalconfigwidget.h create mode 100644 parts/documentation/docglobalconfigwidgetbase.ui create mode 100644 parts/documentation/docprojectconfigwidget.cpp create mode 100644 parts/documentation/docprojectconfigwidget.h create mode 100644 parts/documentation/docprojectconfigwidgetbase.ui create mode 100644 parts/documentation/documentation_part.cpp create mode 100644 parts/documentation/documentation_part.h create mode 100644 parts/documentation/documentation_widget.cpp create mode 100644 parts/documentation/documentation_widget.h create mode 100644 parts/documentation/docutils.cpp create mode 100644 parts/documentation/docutils.h create mode 100644 parts/documentation/editbookmarkdlg.ui create mode 100644 parts/documentation/editcatalogdlg.cpp create mode 100644 parts/documentation/editcatalogdlg.h create mode 100644 parts/documentation/editcatalogdlgbase.ui create mode 100644 parts/documentation/find_documentation.cpp create mode 100644 parts/documentation/find_documentation.h create mode 100644 parts/documentation/find_documentation_options.cpp create mode 100644 parts/documentation/find_documentation_options.h create mode 100644 parts/documentation/find_documentation_optionsbase.ui create mode 100644 parts/documentation/find_documentationbase.ui create mode 100644 parts/documentation/indexview.cpp create mode 100644 parts/documentation/indexview.h create mode 100644 parts/documentation/interfaces/Mainpage.dox create mode 100644 parts/documentation/interfaces/Makefile.am create mode 100644 parts/documentation/interfaces/kdevdocumentationplugin.cpp create mode 100644 parts/documentation/interfaces/kdevdocumentationplugin.h create mode 100644 parts/documentation/interfaces/kdevelopdocumentationplugins.desktop create mode 100644 parts/documentation/kdevdocumentation.desktop create mode 100644 parts/documentation/kdevpart_documentation.rc create mode 100644 parts/documentation/plugins/Makefile.am create mode 100644 parts/documentation/plugins/chm/Makefile.am create mode 100644 parts/documentation/plugins/chm/docchmplugin.cpp create mode 100644 parts/documentation/plugins/chm/docchmplugin.desktop create mode 100644 parts/documentation/plugins/chm/docchmplugin.h create mode 100644 parts/documentation/plugins/custom/Makefile.am create mode 100644 parts/documentation/plugins/custom/doccustomplugin.cpp create mode 100644 parts/documentation/plugins/custom/doccustomplugin.desktop create mode 100644 parts/documentation/plugins/custom/doccustomplugin.h create mode 100644 parts/documentation/plugins/devhelp/Makefile.am create mode 100644 parts/documentation/plugins/devhelp/docdevhelpplugin.cpp create mode 100644 parts/documentation/plugins/devhelp/docdevhelpplugin.desktop create mode 100644 parts/documentation/plugins/devhelp/docdevhelpplugin.h create mode 100644 parts/documentation/plugins/djvu/Makefile.am create mode 100644 parts/documentation/plugins/djvu/docdjvuplugin.cpp create mode 100644 parts/documentation/plugins/djvu/docdjvuplugin.desktop create mode 100644 parts/documentation/plugins/djvu/docdjvuplugin.h create mode 100644 parts/documentation/plugins/doxygen/Makefile.am create mode 100644 parts/documentation/plugins/doxygen/docdoxygenplugin.cpp create mode 100644 parts/documentation/plugins/doxygen/docdoxygenplugin.desktop create mode 100644 parts/documentation/plugins/doxygen/docdoxygenplugin.h create mode 100644 parts/documentation/plugins/kdevtoc/Makefile.am create mode 100644 parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp create mode 100644 parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop create mode 100644 parts/documentation/plugins/kdevtoc/dockdevtocplugin.h create mode 100644 parts/documentation/plugins/pdb/Makefile.am create mode 100644 parts/documentation/plugins/pdb/docpdbplugin.cpp create mode 100644 parts/documentation/plugins/pdb/docpdbplugin.desktop create mode 100644 parts/documentation/plugins/pdb/docpdbplugin.h create mode 100644 parts/documentation/plugins/pdf/Makefile.am create mode 100644 parts/documentation/plugins/pdf/docpdfplugin.cpp create mode 100644 parts/documentation/plugins/pdf/docpdfplugin.desktop create mode 100644 parts/documentation/plugins/pdf/docpdfplugin.h create mode 100644 parts/documentation/plugins/qt/Makefile.am create mode 100644 parts/documentation/plugins/qt/docqtplugin.cpp create mode 100644 parts/documentation/plugins/qt/docqtplugin.desktop create mode 100644 parts/documentation/plugins/qt/docqtplugin.h create mode 100644 parts/documentation/protocols/Makefile.am create mode 100644 parts/documentation/protocols/chm/Makefile.am create mode 100644 parts/documentation/protocols/chm/chm.cpp create mode 100644 parts/documentation/protocols/chm/chm.h create mode 100644 parts/documentation/protocols/chm/chm.protocol create mode 100644 parts/documentation/protocols/chm/chmfile.cpp create mode 100644 parts/documentation/protocols/chm/chmfile.h create mode 100644 parts/documentation/protocols/chm/decompress.cpp create mode 100644 parts/documentation/protocols/chm/decompress.h create mode 100644 parts/documentation/protocols/chm/kchmpart.cpp create mode 100644 parts/documentation/protocols/chm/kchmpart.desktop create mode 100644 parts/documentation/protocols/chm/kchmpart.h create mode 100644 parts/documentation/searchview.cpp create mode 100644 parts/documentation/searchview.h create mode 100644 parts/documentation/selecttopic.cpp create mode 100644 parts/documentation/selecttopic.h create mode 100644 parts/documentation/selecttopicbase.ui create mode 100644 parts/documentation/tools/Makefile.am create mode 100644 parts/documentation/tools/htdig/Makefile.am create mode 100644 parts/documentation/tools/htdig/htdigindex.cpp create mode 100644 parts/documentation/tools/htdig/htdigindex.h create mode 100644 parts/doxygen/Makefile.am create mode 100644 parts/doxygen/README create mode 100644 parts/doxygen/README.dox create mode 100644 parts/doxygen/config.cpp create mode 100644 parts/doxygen/config.h create mode 100644 parts/doxygen/doxygenconfigwidget.cpp create mode 100644 parts/doxygen/doxygenconfigwidget.h create mode 100644 parts/doxygen/doxygenpart.cpp create mode 100644 parts/doxygen/doxygenpart.h create mode 100644 parts/doxygen/input.cpp create mode 100644 parts/doxygen/input.h create mode 100644 parts/doxygen/kdevdoxygen.desktop create mode 100644 parts/doxygen/kdevdoxygen.rc create mode 100644 parts/doxygen/lang_cfg.h create mode 100644 parts/doxygen/messages.cpp create mode 100644 parts/doxygen/messages.h create mode 100644 parts/doxygen/version.cpp create mode 100644 parts/doxygen/version.h create mode 100644 parts/filecreate/Makefile.am create mode 100644 parts/filecreate/README create mode 100644 parts/filecreate/README.dox create mode 100644 parts/filecreate/addglobaldlg.cpp create mode 100644 parts/filecreate/addglobaldlg.h create mode 100644 parts/filecreate/fcconfigwidget.cpp create mode 100644 parts/filecreate/fcconfigwidget.h create mode 100644 parts/filecreate/fcconfigwidgetbase.ui create mode 100644 parts/filecreate/fctemplateedit.cpp create mode 100644 parts/filecreate/fctemplateedit.h create mode 100644 parts/filecreate/fctemplateeditbase.ui create mode 100644 parts/filecreate/fctemplateeditbase.ui.h create mode 100644 parts/filecreate/fctypeedit.cpp create mode 100644 parts/filecreate/fctypeedit.h create mode 100644 parts/filecreate/fctypeeditbase.ui create mode 100644 parts/filecreate/fctypeeditbase.ui.h create mode 100644 parts/filecreate/file-templates/Makefile.am create mode 100644 parts/filecreate/file-templates/dox create mode 100644 parts/filecreate/file-templates/qrc create mode 100644 parts/filecreate/file-templates/ts create mode 100644 parts/filecreate/file-templates/ui create mode 100644 parts/filecreate/file-templates/ui-confdialog create mode 100644 parts/filecreate/file-templates/ui-dialog create mode 100644 parts/filecreate/file-templates/ui-dialog-qt4 create mode 100644 parts/filecreate/file-templates/ui-dialogb create mode 100644 parts/filecreate/file-templates/ui-dialogb-qt4 create mode 100644 parts/filecreate/file-templates/ui-dialogr create mode 100644 parts/filecreate/file-templates/ui-dialogr-qt4 create mode 100644 parts/filecreate/file-templates/ui-mainwin create mode 100644 parts/filecreate/file-templates/ui-mainwin-qt4 create mode 100644 parts/filecreate/file-templates/ui-tabdialog create mode 100644 parts/filecreate/file-templates/ui-widget create mode 100644 parts/filecreate/file-templates/ui-widget-qt4 create mode 100644 parts/filecreate/file-templates/ui-wizard create mode 100644 parts/filecreate/filecreate_filedialog.cpp create mode 100644 parts/filecreate/filecreate_filedialog.h create mode 100644 parts/filecreate/filecreate_filetype.cpp create mode 100644 parts/filecreate/filecreate_filetype.h create mode 100644 parts/filecreate/filecreate_listitem.cpp create mode 100644 parts/filecreate/filecreate_listitem.h create mode 100644 parts/filecreate/filecreate_newfile.cpp create mode 100644 parts/filecreate/filecreate_newfile.h create mode 100644 parts/filecreate/filecreate_part.cpp create mode 100644 parts/filecreate/filecreate_part.h create mode 100644 parts/filecreate/filecreate_typechooser.h create mode 100644 parts/filecreate/filecreate_typechoosersig.h create mode 100644 parts/filecreate/filecreate_widget2.cpp create mode 100644 parts/filecreate/filecreate_widget2.h create mode 100644 parts/filecreate/filecreate_widget3.cpp create mode 100644 parts/filecreate/filecreate_widget3.h create mode 100644 parts/filecreate/kdevfilecreate.desktop create mode 100644 parts/filecreate/kdevpart_filecreate.rc create mode 100644 parts/filecreate/template-info.xml create mode 100644 parts/filelist/Makefile.am create mode 100644 parts/filelist/README.dox create mode 100644 parts/filelist/fileinfo.h create mode 100644 parts/filelist/filelist_item.cpp create mode 100644 parts/filelist/filelist_item.h create mode 100644 parts/filelist/filelist_widget.cpp create mode 100644 parts/filelist/filelist_widget.h create mode 100644 parts/filelist/kdevfilelist.desktop create mode 100644 parts/filelist/kdevfilelist.rc create mode 100644 parts/filelist/projectviewconfig.cpp create mode 100644 parts/filelist/projectviewconfig.h create mode 100644 parts/filelist/projectviewconfigbase.ui create mode 100644 parts/filelist/projectviewpart.cpp create mode 100644 parts/filelist/projectviewpart.h create mode 100644 parts/filelist/projectviewprojectconfig.cpp create mode 100644 parts/filelist/projectviewprojectconfig.h create mode 100644 parts/filelist/projectviewprojectconfigbase.ui create mode 100644 parts/filelist/toolbarguibuilder.cpp create mode 100644 parts/filelist/toolbarguibuilder.h create mode 100644 parts/fileselector/Makefile.am create mode 100644 parts/fileselector/README.dox create mode 100644 parts/fileselector/fileselector_part.cpp create mode 100644 parts/fileselector/fileselector_part.h create mode 100644 parts/fileselector/fileselector_widget.cpp create mode 100644 parts/fileselector/fileselector_widget.h create mode 100644 parts/fileselector/kactionselector.cpp create mode 100644 parts/fileselector/kactionselector.h create mode 100644 parts/fileselector/kbookmarkhandler.cpp create mode 100644 parts/fileselector/kbookmarkhandler.h create mode 100644 parts/fileselector/kdevfileselector.desktop create mode 100644 parts/fileselector/kdevpart_fileselector.rc create mode 100644 parts/fileview/Makefile.am create mode 100644 parts/fileview/README.dox create mode 100644 parts/fileview/addfilegroupdlg.cpp create mode 100644 parts/fileview/addfilegroupdlg.h create mode 100644 parts/fileview/filegroupsconfigwidget.cpp create mode 100644 parts/fileview/filegroupsconfigwidget.h create mode 100644 parts/fileview/filegroupsconfigwidgetbase.ui create mode 100644 parts/fileview/filegroupspart.cpp create mode 100644 parts/fileview/filegroupspart.h create mode 100644 parts/fileview/filegroupswidget.cpp create mode 100644 parts/fileview/filegroupswidget.h create mode 100644 parts/fileview/fileitemfactory.cpp create mode 100644 parts/fileview/fileitemfactory.h create mode 100644 parts/fileview/filetreeviewwidgetimpl.cpp create mode 100644 parts/fileview/filetreeviewwidgetimpl.h create mode 100644 parts/fileview/filetreewidget.cpp create mode 100644 parts/fileview/filetreewidget.h create mode 100644 parts/fileview/fileviewpart.cpp create mode 100644 parts/fileview/fileviewpart.h create mode 100644 parts/fileview/kdevfilegroups.desktop create mode 100644 parts/fileview/kdevfileview.desktop create mode 100644 parts/fileview/partwidget.cpp create mode 100644 parts/fileview/partwidget.h create mode 100644 parts/fileview/stdfiletreewidgetimpl.cpp create mode 100644 parts/fileview/stdfiletreewidgetimpl.h create mode 100644 parts/fileview/vcscolorsconfigwidget.cpp create mode 100644 parts/fileview/vcscolorsconfigwidget.h create mode 100644 parts/fileview/vcscolorsconfigwidgetbase.ui create mode 100644 parts/fileview/vcsfiletreewidgetimpl.cpp create mode 100644 parts/fileview/vcsfiletreewidgetimpl.h create mode 100644 parts/filter/Makefile.am create mode 100644 parts/filter/README.dox create mode 100644 parts/filter/filterpart.cpp create mode 100644 parts/filter/filterpart.h create mode 100644 parts/filter/kdevfilter.desktop create mode 100644 parts/filter/kdevfilter.rc create mode 100644 parts/filter/kdevfilterIface.cpp create mode 100644 parts/filter/kdevfilterIface.h create mode 100644 parts/filter/shellfilterdlg.cpp create mode 100644 parts/filter/shellfilterdlg.h create mode 100644 parts/filter/shellinsertdlg.cpp create mode 100644 parts/filter/shellinsertdlg.h create mode 100644 parts/fullscreen/Makefile.am create mode 100644 parts/fullscreen/README.dox create mode 100644 parts/fullscreen/fullscreen_part.cpp create mode 100644 parts/fullscreen/fullscreen_part.h create mode 100644 parts/fullscreen/kdevfullscreen.desktop create mode 100644 parts/fullscreen/kdevpart_fullscreen.rc create mode 100644 parts/grepview/Makefile.am create mode 100644 parts/grepview/README.dox create mode 100644 parts/grepview/grepdlg.cpp create mode 100644 parts/grepview/grepdlg.h create mode 100644 parts/grepview/grepviewpart.cpp create mode 100644 parts/grepview/grepviewpart.h create mode 100644 parts/grepview/grepviewwidget.cpp create mode 100644 parts/grepview/grepviewwidget.h create mode 100644 parts/grepview/kdevgrepview.desktop create mode 100644 parts/grepview/kdevgrepview.rc create mode 100644 parts/konsole/Makefile.am create mode 100644 parts/konsole/README.dox create mode 100644 parts/konsole/kdevkonsoleview.desktop create mode 100644 parts/konsole/konsoleviewpart.cpp create mode 100644 parts/konsole/konsoleviewpart.h create mode 100644 parts/konsole/konsoleviewwidget.cpp create mode 100644 parts/konsole/konsoleviewwidget.h create mode 100644 parts/openwith/Makefile.am create mode 100644 parts/openwith/README.dox create mode 100644 parts/openwith/kdevopenwith.desktop create mode 100644 parts/openwith/openwithpart.cpp create mode 100644 parts/openwith/openwithpart.h create mode 100644 parts/outputviews/Makefile.am create mode 100644 parts/outputviews/README.dox create mode 100644 parts/outputviews/appoutputviewpart.cpp create mode 100644 parts/outputviews/appoutputviewpart.h create mode 100644 parts/outputviews/appoutputwidget.cpp create mode 100644 parts/outputviews/appoutputwidget.h create mode 100644 parts/outputviews/commandcontinuationfilter.cpp create mode 100644 parts/outputviews/commandcontinuationfilter.h create mode 100644 parts/outputviews/compileerrorfilter.cpp create mode 100644 parts/outputviews/compileerrorfilter.h create mode 100644 parts/outputviews/directorystatusmessagefilter.cpp create mode 100644 parts/outputviews/directorystatusmessagefilter.h create mode 100644 parts/outputviews/filterdlg.ui create mode 100644 parts/outputviews/kdevappoutputview.desktop create mode 100644 parts/outputviews/kdevmakeview.desktop create mode 100644 parts/outputviews/kdevmakeview.rc create mode 100644 parts/outputviews/makeactionfilter.cpp create mode 100644 parts/outputviews/makeactionfilter.h create mode 100644 parts/outputviews/makeitem.cpp create mode 100644 parts/outputviews/makeitem.h create mode 100644 parts/outputviews/makeviewpart.cpp create mode 100644 parts/outputviews/makeviewpart.h create mode 100644 parts/outputviews/makewidget.cpp create mode 100644 parts/outputviews/makewidget.h create mode 100644 parts/outputviews/otherfilter.cpp create mode 100644 parts/outputviews/otherfilter.h create mode 100644 parts/outputviews/outputfilter.cpp create mode 100644 parts/outputviews/outputfilter.h create mode 100644 parts/outputviews/outputviewsfactory.cpp create mode 100644 parts/outputviews/outputviewsfactory.h create mode 100644 parts/partexplorer/Makefile.am create mode 100644 parts/partexplorer/README create mode 100644 parts/partexplorer/README.dox create mode 100644 parts/partexplorer/kdevpartexplorer.desktop create mode 100644 parts/partexplorer/kdevpartexplorer.rc create mode 100644 parts/partexplorer/partexplorer_plugin.cpp create mode 100644 parts/partexplorer/partexplorer_plugin.h create mode 100644 parts/partexplorer/partexplorerform.cpp create mode 100644 parts/partexplorer/partexplorerform.h create mode 100644 parts/partexplorer/partexplorerformbase.ui create mode 100644 parts/quickopen/Makefile.am create mode 100644 parts/quickopen/README.dox create mode 100644 parts/quickopen/kdevpart_quickopen.rc create mode 100644 parts/quickopen/kdevquickopen.desktop create mode 100644 parts/quickopen/quickopen_part.cpp create mode 100644 parts/quickopen/quickopen_part.h create mode 100644 parts/quickopen/quickopenbase.ui create mode 100644 parts/quickopen/quickopenclassdialog.cpp create mode 100644 parts/quickopen/quickopenclassdialog.h create mode 100644 parts/quickopen/quickopendialog.cpp create mode 100644 parts/quickopen/quickopendialog.h create mode 100644 parts/quickopen/quickopenfiledialog.cpp create mode 100644 parts/quickopen/quickopenfiledialog.h create mode 100644 parts/quickopen/quickopenfunctionchooseform.cpp create mode 100644 parts/quickopen/quickopenfunctionchooseform.h create mode 100644 parts/quickopen/quickopenfunctionchooseformbase.ui create mode 100644 parts/quickopen/quickopenfunctiondialog.cpp create mode 100644 parts/quickopen/quickopenfunctiondialog.h create mode 100644 parts/regexptest/Makefile.am create mode 100644 parts/regexptest/README.dox create mode 100644 parts/regexptest/kdevregexptest.desktop create mode 100644 parts/regexptest/kdevregexptest.rc create mode 100644 parts/regexptest/regexptestdlg.cpp create mode 100644 parts/regexptest/regexptestdlg.h create mode 100644 parts/regexptest/regexptestdlgbase.ui create mode 100644 parts/regexptest/regexptestpart.cpp create mode 100644 parts/regexptest/regexptestpart.h create mode 100644 parts/replace/Makefile.am create mode 100644 parts/replace/README create mode 100644 parts/replace/README.dox create mode 100644 parts/replace/kdevpart_replace.rc create mode 100644 parts/replace/kdevreplace.desktop create mode 100644 parts/replace/replace_part.cpp create mode 100644 parts/replace/replace_part.h create mode 100644 parts/replace/replace_widget.cpp create mode 100644 parts/replace/replace_widget.h create mode 100644 parts/replace/replacedlg.ui create mode 100644 parts/replace/replacedlgimpl.cpp create mode 100644 parts/replace/replacedlgimpl.h create mode 100644 parts/replace/replaceitem.cpp create mode 100644 parts/replace/replaceitem.h create mode 100644 parts/replace/replaceview.cpp create mode 100644 parts/replace/replaceview.h create mode 100644 parts/scripting/Makefile.am create mode 100644 parts/scripting/README create mode 100644 parts/scripting/kdevscripting.desktop create mode 100644 parts/scripting/kdevscripting.rc create mode 100644 parts/scripting/scriptingglobalconfig.cpp create mode 100644 parts/scripting/scriptingglobalconfig.h create mode 100644 parts/scripting/scriptingglobalconfigbase.ui create mode 100644 parts/scripting/scriptingpart.cpp create mode 100644 parts/scripting/scriptingpart.h create mode 100644 parts/snippet/COPYING create mode 100644 parts/snippet/Makefile.am create mode 100644 parts/snippet/README create mode 100644 parts/snippet/README.dox create mode 100644 parts/snippet/kdevpart_snippet.rc create mode 100644 parts/snippet/kdevsnippet.desktop create mode 100644 parts/snippet/snippet_part.cpp create mode 100644 parts/snippet/snippet_part.h create mode 100644 parts/snippet/snippet_widget.cpp create mode 100644 parts/snippet/snippet_widget.h create mode 100644 parts/snippet/snippetconfig.cpp create mode 100644 parts/snippet/snippetconfig.h create mode 100644 parts/snippet/snippetdlg.ui create mode 100644 parts/snippet/snippetdlg.ui.h create mode 100644 parts/snippet/snippetitem.cpp create mode 100644 parts/snippet/snippetitem.h create mode 100644 parts/snippet/snippetsettings.cpp create mode 100644 parts/snippet/snippetsettings.h create mode 100644 parts/snippet/snippetsettingsbase.ui create mode 100644 parts/texttools/Makefile.am create mode 100644 parts/texttools/README.dox create mode 100644 parts/texttools/kdevtexttools.desktop create mode 100644 parts/texttools/texttoolspart.cpp create mode 100644 parts/texttools/texttoolspart.h create mode 100644 parts/texttools/texttoolswidget.cpp create mode 100644 parts/texttools/texttoolswidget.h create mode 100644 parts/tipofday/Makefile.am create mode 100644 parts/tipofday/README.dox create mode 100644 parts/tipofday/hi16-action-ktip.png create mode 100644 parts/tipofday/hi32-action-ktip.png create mode 100644 parts/tipofday/hi48-action-ktip.png create mode 100644 parts/tipofday/kdevpart_tipofday.rc create mode 100644 parts/tipofday/kdevtipofday.desktop create mode 100644 parts/tipofday/lo16-action-kdevelop_tip.png create mode 100644 parts/tipofday/lo32-action-kdevelop_tip.png create mode 100644 parts/tipofday/tipofday_part.cpp create mode 100644 parts/tipofday/tipofday_part.h create mode 100644 parts/tipofday/tips create mode 100644 parts/tools/Makefile.am create mode 100644 parts/tools/README.dox create mode 100644 parts/tools/addtooldlg.ui create mode 100644 parts/tools/addtooldlg.ui.h create mode 100644 parts/tools/kapplicationtree.cpp create mode 100644 parts/tools/kapplicationtree.h create mode 100644 parts/tools/kdevpart_tools.rc create mode 100644 parts/tools/kdevtools.desktop create mode 100644 parts/tools/tools_part.cpp create mode 100644 parts/tools/tools_part.h create mode 100644 parts/tools/toolsconfig.cpp create mode 100644 parts/tools/toolsconfig.h create mode 100644 parts/tools/toolsconfigwidget.cpp create mode 100644 parts/tools/toolsconfigwidget.h create mode 100644 parts/tools/toolsconfigwidgetbase.ui create mode 100644 parts/uimode/Makefile.am create mode 100644 parts/uimode/README.dox create mode 100644 parts/uimode/kdevuichooser.desktop create mode 100644 parts/uimode/uichooser.ui create mode 100644 parts/uimode/uichooser_part.cpp create mode 100644 parts/uimode/uichooser_part.h create mode 100644 parts/uimode/uichooser_widget.cpp create mode 100644 parts/uimode/uichooser_widget.h create mode 100644 parts/valgrind/Makefile.am create mode 100644 parts/valgrind/README.dox create mode 100644 parts/valgrind/dialog_widget.ui create mode 100644 parts/valgrind/dialog_widget.ui.h create mode 100644 parts/valgrind/kdevpart_valgrind.rc create mode 100644 parts/valgrind/kdevvalgrind.desktop create mode 100644 parts/valgrind/valgrind_dialog.cpp create mode 100644 parts/valgrind/valgrind_dialog.h create mode 100644 parts/valgrind/valgrind_part.cpp create mode 100644 parts/valgrind/valgrind_part.h create mode 100644 parts/valgrind/valgrind_widget.cpp create mode 100644 parts/valgrind/valgrind_widget.h create mode 100644 parts/valgrind/valgrinditem.cpp create mode 100644 parts/valgrind/valgrinditem.h create mode 100644 parts/vcsmanager/Makefile.am create mode 100644 parts/vcsmanager/README.dox create mode 100644 parts/vcsmanager/kdevvcsmanager.desktop create mode 100644 parts/vcsmanager/vcsmanagerpart.cpp create mode 100644 parts/vcsmanager/vcsmanagerpart.h create mode 100644 parts/vcsmanager/vcsmanagerprojectconfig.cpp create mode 100644 parts/vcsmanager/vcsmanagerprojectconfig.h create mode 100644 parts/vcsmanager/vcsmanagerprojectconfigbase.ui create mode 100644 pics/Makefile.am create mode 100644 pics/hi16-app-kdevassistant.png create mode 100644 pics/hi16-app-kdevdesigner.png create mode 100644 pics/hi16-app-kdevelop.png create mode 100644 pics/hi32-app-kdevassistant.png create mode 100644 pics/hi32-app-kdevdesigner.png create mode 100644 pics/hi32-app-kdevelop.png create mode 100644 pics/hi48-app-kdevassistant.png create mode 100644 pics/hi48-app-kdevdesigner.png create mode 100644 pics/hi48-app-kdevelop.png create mode 100644 pics/mini/CTchildren.png create mode 100644 pics/mini/CTclients.png create mode 100644 pics/mini/CTparents.png create mode 100644 pics/mini/CTsuppliers.png create mode 100644 pics/mini/CTvirtuals.png create mode 100644 pics/mini/CVclass.png create mode 100644 pics/mini/CVglobal_meth.png create mode 100644 pics/mini/CVglobal_var.png create mode 100644 pics/mini/CVnamespace.png create mode 100644 pics/mini/CVpackage_meth.png create mode 100644 pics/mini/CVpackage_var.png create mode 100644 pics/mini/CVprivate_meth.png create mode 100644 pics/mini/CVprivate_signal.png create mode 100644 pics/mini/CVprivate_slot.png create mode 100644 pics/mini/CVprivate_var.png create mode 100644 pics/mini/CVprotected_meth.png create mode 100644 pics/mini/CVprotected_signal.png create mode 100644 pics/mini/CVprotected_slot.png create mode 100644 pics/mini/CVprotected_var.png create mode 100644 pics/mini/CVpublic_meth.png create mode 100644 pics/mini/CVpublic_signal.png create mode 100644 pics/mini/CVpublic_slot.png create mode 100644 pics/mini/CVpublic_var.png create mode 100644 pics/mini/CVstruct.png create mode 100644 pics/mini/CVtypedef.png create mode 100644 pics/mini/Makefile.am create mode 100644 pics/mini/indicator_connect.png create mode 100644 pics/mini/indicator_noconnect.png create mode 100644 pics/misc/Makefile.am create mode 100644 pics/misc/kdevassistant-splash.png create mode 100644 pics/misc/kdevdesigner-splash.png create mode 100644 pics/misc/kdevelop-splash.png create mode 100644 pics/toolbar/Makefile.am create mode 100644 pics/toolbar/hi16-action-classnew.png create mode 100644 pics/toolbar/hi16-action-dbgwatchvar.png create mode 100644 pics/toolbar/hi16-action-dirsynch.png create mode 100644 pics/toolbar/hi16-action-make_kdevelop.png create mode 100644 pics/toolbar/hi16-action-methodnew.png create mode 100644 pics/toolbar/hi16-action-newwidget.png create mode 100644 pics/toolbar/hi16-action-project_open.png create mode 100644 pics/toolbar/hi16-action-qmake_app.png create mode 100644 pics/toolbar/hi16-action-qmake_app_disabled.png create mode 100644 pics/toolbar/hi16-action-qmake_func_scope.png create mode 100644 pics/toolbar/hi16-action-qmake_inc_scope.png create mode 100644 pics/toolbar/hi16-action-qmake_lib.png create mode 100644 pics/toolbar/hi16-action-qmake_lib_disabled.png create mode 100644 pics/toolbar/hi16-action-qmake_scope.png create mode 100644 pics/toolbar/hi16-action-qmake_scopenew.png create mode 100644 pics/toolbar/hi16-action-qmake_sub.png create mode 100644 pics/toolbar/hi16-action-qmake_sub_disabled.png create mode 100644 pics/toolbar/hi16-action-qmake_subclass.png create mode 100644 pics/toolbar/hi16-action-qmake_ui_h.png create mode 100644 pics/toolbar/hi16-action-qmakerun.png create mode 100644 pics/toolbar/hi16-action-qtdesigner.png create mode 100644 pics/toolbar/hi16-action-rebuild.png create mode 100644 pics/toolbar/hi16-action-reload_page.png create mode 100644 pics/toolbar/hi16-action-remove_subdir.png create mode 100644 pics/toolbar/hi16-action-servicenew_kdevelop.png create mode 100644 pics/toolbar/hi16-action-target_kdevelop.png create mode 100644 pics/toolbar/hi16-action-targetnew_kdevelop.png create mode 100644 pics/toolbar/hi16-action-variablenew.png create mode 100644 pics/toolbar/hi22-action-classnew.png create mode 100644 pics/toolbar/hi22-action-classwiz.png create mode 100644 pics/toolbar/hi22-action-configure_file.png create mode 100644 pics/toolbar/hi22-action-dbgjumpto.png create mode 100644 pics/toolbar/hi22-action-dbgmemview.png create mode 100644 pics/toolbar/hi22-action-dbgnext.png create mode 100644 pics/toolbar/hi22-action-dbgnextinst.png create mode 100644 pics/toolbar/hi22-action-dbgparam.png create mode 100644 pics/toolbar/hi22-action-dbgrestart.png create mode 100644 pics/toolbar/hi22-action-dbgrun.png create mode 100644 pics/toolbar/hi22-action-dbgrunto.png create mode 100644 pics/toolbar/hi22-action-dbgstep.png create mode 100644 pics/toolbar/hi22-action-dbgstepinst.png create mode 100644 pics/toolbar/hi22-action-dbgstepout.png create mode 100644 pics/toolbar/hi22-action-dbgvar.png create mode 100644 pics/toolbar/hi22-action-debugger.png create mode 100644 pics/toolbar/hi22-action-grep.png create mode 100644 pics/toolbar/hi22-action-make_kdevelop.png create mode 100644 pics/toolbar/hi22-action-newwidget.png create mode 100644 pics/toolbar/hi22-action-output_win.png create mode 100644 pics/toolbar/hi22-action-project_open.png create mode 100644 pics/toolbar/hi22-action-qmake_scopenew.png create mode 100644 pics/toolbar/hi22-action-qmakerun.png create mode 100644 pics/toolbar/hi22-action-rebuild.png create mode 100644 pics/toolbar/hi22-action-reload_page.png create mode 100644 pics/toolbar/hi22-action-save_all.png create mode 100644 pics/toolbar/hi22-action-tree_win.png create mode 100644 pics/toolbar/hi32-action-classnew.png create mode 100644 pics/toolbar/hi32-mime-kdevelop_project.png create mode 100644 src/Mainpage.dox create mode 100644 src/Makefile.am create mode 100644 src/api.cpp create mode 100644 src/api.h create mode 100644 src/core.cpp create mode 100644 src/core.h create mode 100644 src/documentationpart.cpp create mode 100644 src/documentationpart.h create mode 100644 src/editorproxy.cpp create mode 100644 src/editorproxy.h create mode 100644 src/eventsrc create mode 100644 src/generalinfowidget.cpp create mode 100644 src/generalinfowidget.h create mode 100644 src/generalinfowidgetbase.ui create mode 100644 src/kconf_update/Makefile.am create mode 100644 src/kconf_update/kdev-gen-settings-kconf_update.cpp create mode 100644 src/kconf_update/kdev-gen-settings.upd create mode 100644 src/kdevassistantextension.cpp create mode 100644 src/kdevassistantextension.h create mode 100644 src/kdevassistantrc create mode 100644 src/kdevassistantui.rc create mode 100644 src/kdeveloprc create mode 100644 src/kdevelopui.rc create mode 100644 src/kdevideextension.cpp create mode 100644 src/kdevideextension.h create mode 100644 src/kdevpluginprofilerc create mode 100644 src/languageselectwidget.cpp create mode 100644 src/languageselectwidget.h create mode 100644 src/main.cpp create mode 100644 src/main_assistant.cpp create mode 100644 src/mainwindowshare.cpp create mode 100644 src/mainwindowshare.h create mode 100644 src/mimewarningdialog.ui create mode 100644 src/multibuffer.cpp create mode 100644 src/multibuffer.h create mode 100644 src/newui/Makefile.am create mode 100644 src/newui/button.cpp create mode 100644 src/newui/button.h create mode 100644 src/newui/buttonbar.cpp create mode 100644 src/newui/buttonbar.h create mode 100644 src/newui/comdefs.h create mode 100644 src/newui/ddockwindow.cpp create mode 100644 src/newui/ddockwindow.h create mode 100644 src/newui/dmainwindow.cpp create mode 100644 src/newui/dmainwindow.h create mode 100644 src/newui/docksplitter.cpp create mode 100644 src/newui/docksplitter.h create mode 100644 src/newui/dtabwidget.cpp create mode 100644 src/newui/dtabwidget.h create mode 100644 src/partcontroller.cpp create mode 100644 src/partcontroller.h create mode 100644 src/plugincontroller.cpp create mode 100644 src/plugincontroller.h create mode 100644 src/pluginselectdialog.cpp create mode 100644 src/pluginselectdialog.h create mode 100644 src/pluginselectdialogbase.ui create mode 100644 src/profileengine/Makefile.am create mode 100644 src/profileengine/editor/Makefile.am create mode 100644 src/profileengine/editor/addprofilewidget.ui create mode 100644 src/profileengine/editor/main.cpp create mode 100644 src/profileengine/editor/profileeditor.cpp create mode 100644 src/profileengine/editor/profileeditor.h create mode 100644 src/profileengine/editor/profileeditorbase.ui create mode 100644 src/profileengine/lib/Mainpage.dox create mode 100644 src/profileengine/lib/Makefile.am create mode 100644 src/profileengine/lib/profile.cpp create mode 100644 src/profileengine/lib/profile.h create mode 100644 src/profileengine/lib/profileengine.cpp create mode 100644 src/profileengine/lib/profileengine.h create mode 100644 src/profiles/IDE/CompiledLanguageIDE/AdaIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/AdaIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CppIDE/KDECppIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CppIDE/KDECppIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CppIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CppIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/CandCppIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/FortranIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/FortranIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/HaskellIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/HaskellIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/JavaIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/JavaIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/PascalIDE/Makefile.am create mode 100644 src/profiles/IDE/CompiledLanguageIDE/PascalIDE/profile.config create mode 100644 src/profiles/IDE/CompiledLanguageIDE/profile.config create mode 100644 src/profiles/IDE/DatabaseIDE/Makefile.am create mode 100644 src/profiles/IDE/DatabaseIDE/profile.config create mode 100644 src/profiles/IDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/PHPIDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/PHPIDE/profile.config create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/PerlIDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/PerlIDE/profile.config create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/PythonIDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/PythonIDE/profile.config create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/RubyIDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/RubyIDE/profile.config create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/ShellIDE/Makefile.am create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/ShellIDE/profile.config create mode 100644 src/profiles/IDE/ScriptingLanguageIDE/profile.config create mode 100644 src/profiles/IDE/profile.config create mode 100644 src/profiles/KDevAssistant/Makefile.am create mode 100644 src/profiles/KDevAssistant/profile.config create mode 100644 src/profiles/Makefile.am create mode 100644 src/profiles/profile.config create mode 100644 src/projectmanager.cpp create mode 100644 src/projectmanager.h create mode 100644 src/projectprofiles create mode 100644 src/projectsession.cpp create mode 100644 src/projectsession.h create mode 100644 src/settingswidget.ui create mode 100644 src/shellextension.cpp create mode 100644 src/shellextension.h create mode 100644 src/simplemainwindow.cpp create mode 100644 src/simplemainwindow.h create mode 100644 src/splashscreen.cpp create mode 100644 src/splashscreen.h create mode 100644 src/statusbar.cpp create mode 100644 src/statusbar.h create mode 100644 src/toplevel.cpp create mode 100644 src/toplevel.h create mode 100644 vcs/Makefile.am create mode 100644 vcs/clearcase/Makefile.am create mode 100644 vcs/clearcase/README create mode 100644 vcs/clearcase/README.dox create mode 100644 vcs/clearcase/clearcasefileinfoprovider.cpp create mode 100644 vcs/clearcase/clearcasefileinfoprovider.h create mode 100644 vcs/clearcase/clearcasemanipulator.cpp create mode 100644 vcs/clearcase/clearcasemanipulator.h create mode 100644 vcs/clearcase/clearcasepart.cpp create mode 100644 vcs/clearcase/clearcasepart.h create mode 100644 vcs/clearcase/commentdlg.cpp create mode 100644 vcs/clearcase/commentdlg.h create mode 100644 vcs/clearcase/integrator/Makefile.am create mode 100644 vcs/clearcase/integrator/ccintegratordlg.cpp create mode 100644 vcs/clearcase/integrator/ccintegratordlg.h create mode 100644 vcs/clearcase/integrator/ccintegratordlgbase.ui create mode 100644 vcs/clearcase/integrator/clearcaseintegrator.cpp create mode 100644 vcs/clearcase/integrator/clearcaseintegrator.h create mode 100644 vcs/clearcase/integrator/kdevclearcaseintegrator.desktop create mode 100644 vcs/clearcase/kdevclearcase.desktop create mode 100644 vcs/cvsservice/Makefile.am create mode 100644 vcs/cvsservice/README create mode 100644 vcs/cvsservice/README.dox create mode 100644 vcs/cvsservice/annotatedialog.cpp create mode 100644 vcs/cvsservice/annotatedialog.h create mode 100644 vcs/cvsservice/annotatepage.cpp create mode 100644 vcs/cvsservice/annotatepage.h create mode 100644 vcs/cvsservice/annotateview.cpp create mode 100644 vcs/cvsservice/annotateview.h create mode 100644 vcs/cvsservice/bufferedstringreader.cpp create mode 100644 vcs/cvsservice/bufferedstringreader.h create mode 100644 vcs/cvsservice/buildcvs.sh create mode 100644 vcs/cvsservice/changelog.cpp create mode 100644 vcs/cvsservice/changelog.h create mode 100644 vcs/cvsservice/checkoutdialog.cpp create mode 100644 vcs/cvsservice/checkoutdialog.h create mode 100644 vcs/cvsservice/checkoutdialogbase.ui create mode 100644 vcs/cvsservice/commitdialogbase.ui create mode 100644 vcs/cvsservice/commitdlg.cpp create mode 100644 vcs/cvsservice/commitdlg.h create mode 100644 vcs/cvsservice/cvsdiffpage.cpp create mode 100644 vcs/cvsservice/cvsdiffpage.h create mode 100644 vcs/cvsservice/cvsdir.cpp create mode 100644 vcs/cvsservice/cvsdir.h create mode 100644 vcs/cvsservice/cvsentry.cpp create mode 100644 vcs/cvsservice/cvsentry.h create mode 100644 vcs/cvsservice/cvsfileinfoprovider.cpp create mode 100644 vcs/cvsservice/cvsfileinfoprovider.h create mode 100644 vcs/cvsservice/cvsform.cpp create mode 100644 vcs/cvsservice/cvsform.h create mode 100644 vcs/cvsservice/cvsformbase.ui create mode 100644 vcs/cvsservice/cvslogdialog.cpp create mode 100644 vcs/cvsservice/cvslogdialog.h create mode 100644 vcs/cvsservice/cvslogpage.cpp create mode 100644 vcs/cvsservice/cvslogpage.h create mode 100644 vcs/cvsservice/cvsoptions.cpp create mode 100644 vcs/cvsservice/cvsoptions.h create mode 100644 vcs/cvsservice/cvsoptionswidget.cpp create mode 100644 vcs/cvsservice/cvsoptionswidget.h create mode 100644 vcs/cvsservice/cvsoptionswidgetbase.ui create mode 100644 vcs/cvsservice/cvspart.cpp create mode 100644 vcs/cvsservice/cvspart.h create mode 100644 vcs/cvsservice/cvspartimpl.cpp create mode 100644 vcs/cvsservice/cvspartimpl.h create mode 100644 vcs/cvsservice/cvsprocesswidget.cpp create mode 100644 vcs/cvsservice/cvsprocesswidget.h create mode 100644 vcs/cvsservice/cvsservicedcopIface.h create mode 100644 vcs/cvsservice/diffdialog.cpp create mode 100644 vcs/cvsservice/diffdialog.h create mode 100644 vcs/cvsservice/diffdialogbase.ui create mode 100644 vcs/cvsservice/diffwidget.cpp create mode 100644 vcs/cvsservice/diffwidget.h create mode 100644 vcs/cvsservice/editorsdialog.cpp create mode 100644 vcs/cvsservice/editorsdialog.h create mode 100644 vcs/cvsservice/editorsdialogbase.ui create mode 100644 vcs/cvsservice/integrator/Makefile.am create mode 100644 vcs/cvsservice/integrator/cvsserviceintegrator.cpp create mode 100644 vcs/cvsservice/integrator/cvsserviceintegrator.h create mode 100644 vcs/cvsservice/integrator/fetcherdlgbase.ui create mode 100644 vcs/cvsservice/integrator/initdlg.ui create mode 100644 vcs/cvsservice/integrator/integratordlg.cpp create mode 100644 vcs/cvsservice/integrator/integratordlg.h create mode 100644 vcs/cvsservice/integrator/integratordlgbase.ui create mode 100644 vcs/cvsservice/integrator/kdevcvsserviceintegrator.desktop create mode 100644 vcs/cvsservice/jobscheduler.cpp create mode 100644 vcs/cvsservice/jobscheduler.h create mode 100644 vcs/cvsservice/kdev_cvs.png create mode 100644 vcs/cvsservice/kdev_cvs.xcf create mode 100644 vcs/cvsservice/kdevcvsservice.desktop create mode 100644 vcs/cvsservice/kdevcvsservicepart.rc create mode 100644 vcs/cvsservice/releaseinputdialog.cpp create mode 100644 vcs/cvsservice/releaseinputdialog.h create mode 100644 vcs/cvsservice/releaseinputdialogbase.ui create mode 100644 vcs/cvsservice/tagdialog.cpp create mode 100644 vcs/cvsservice/tagdialog.h create mode 100644 vcs/cvsservice/tagdialogbase.ui create mode 100644 vcs/perforce/Makefile.am create mode 100644 vcs/perforce/README create mode 100644 vcs/perforce/README.dox create mode 100644 vcs/perforce/commitdlg.cpp create mode 100644 vcs/perforce/commitdlg.h create mode 100644 vcs/perforce/integrator/Makefile.am create mode 100644 vcs/perforce/integrator/kdevperforceintegrator.desktop create mode 100644 vcs/perforce/integrator/perforceintegrator.cpp create mode 100644 vcs/perforce/integrator/perforceintegrator.h create mode 100644 vcs/perforce/integrator/pfintegratordlg.cpp create mode 100644 vcs/perforce/integrator/pfintegratordlg.h create mode 100644 vcs/perforce/integrator/pfintegratordlgbase.ui create mode 100644 vcs/perforce/kdevperforce.desktop create mode 100644 vcs/perforce/kdevperforcepart.rc create mode 100644 vcs/perforce/perforcepart.cpp create mode 100644 vcs/perforce/perforcepart.h create mode 100644 vcs/subversion/Makefile.am create mode 100644 vcs/subversion/README.dox create mode 100644 vcs/subversion/commitdlg.cpp create mode 100644 vcs/subversion/commitdlg.h create mode 100644 vcs/subversion/commitdlgbase.ui create mode 100644 vcs/subversion/configure.in.bot create mode 100644 vcs/subversion/configure.in.in create mode 100644 vcs/subversion/integrator/Makefile.am create mode 100644 vcs/subversion/integrator/kdevsubversionintegrator.desktop create mode 100644 vcs/subversion/integrator/subversionintegrator.cpp create mode 100644 vcs/subversion/integrator/subversionintegrator.h create mode 100644 vcs/subversion/integrator/svnintegratordlg.cpp create mode 100644 vcs/subversion/integrator/svnintegratordlg.h create mode 100644 vcs/subversion/integrator/svnintegratordlgbase.ui create mode 100644 vcs/subversion/kdevpart_subversion.rc create mode 100644 vcs/subversion/kdevsubversion.desktop create mode 100644 vcs/subversion/kdevsvn+file.protocol create mode 100644 vcs/subversion/kdevsvn+http.protocol create mode 100644 vcs/subversion/kdevsvn+https.protocol create mode 100644 vcs/subversion/kdevsvn+ssh.protocol create mode 100644 vcs/subversion/kdevsvn+svn.protocol create mode 100644 vcs/subversion/kdevsvnd.cpp create mode 100644 vcs/subversion/kdevsvnd.desktop create mode 100644 vcs/subversion/kdevsvnd.h create mode 100644 vcs/subversion/kdevsvnd_widgets.cpp create mode 100644 vcs/subversion/kdevsvnd_widgets.h create mode 100644 vcs/subversion/subversion_core.cpp create mode 100644 vcs/subversion/subversion_core.h create mode 100644 vcs/subversion/subversion_fileinfo.cpp create mode 100644 vcs/subversion/subversion_fileinfo.h create mode 100644 vcs/subversion/subversion_global.h create mode 100644 vcs/subversion/subversion_part.cpp create mode 100644 vcs/subversion/subversion_part.h create mode 100644 vcs/subversion/subversion_widget.cpp create mode 100644 vcs/subversion/subversion_widget.h create mode 100644 vcs/subversion/subversiondiff.ui create mode 100644 vcs/subversion/subversionprojectwidget.ui create mode 100644 vcs/subversion/svn_blamewidget.cpp create mode 100644 vcs/subversion/svn_blamewidget.h create mode 100644 vcs/subversion/svn_co.ui create mode 100644 vcs/subversion/svn_commitdlgbase.ui create mode 100644 vcs/subversion/svn_copydlgwidget.ui create mode 100644 vcs/subversion/svn_copywidget.cpp create mode 100644 vcs/subversion/svn_copywidget.h create mode 100644 vcs/subversion/svn_fileselectdlg_commit.cpp create mode 100644 vcs/subversion/svn_fileselectdlg_commit.h create mode 100644 vcs/subversion/svn_kio.cpp create mode 100644 vcs/subversion/svn_kio.h create mode 100644 vcs/subversion/svn_logviewoptiondlgbase.ui create mode 100644 vcs/subversion/svn_logviewwidget.cpp create mode 100644 vcs/subversion/svn_logviewwidget.h create mode 100644 vcs/subversion/svn_mergeoptiondlgbase.ui create mode 100644 vcs/subversion/svn_mergewidget.cpp create mode 100644 vcs/subversion/svn_mergewidget.h create mode 100644 vcs/subversion/svn_switchdlgbase.ui create mode 100644 vcs/subversion/svn_switchwidget.cpp create mode 100644 vcs/subversion/svn_switchwidget.h create mode 100644 vcs/subversion/svnssltrustpromptbase.ui create mode 100644 x-kdevelop.desktop diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..b2a4a628 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,88 @@ +Bernd Gehrmann + +Debugger frontend: + John Birch + +C++ source parser: + Jonas Nordin + +Java support: + Richard Dale + +Framework, dialogs, PHP support: + Sandy Meier + +Several parts, htdig searching & indexing: + Matthias Hoelzer-Kluepfel + +Help with Automake manager: + Victor Roeder + +KDE application templates: + Kurth Granroth + +editing component: + The KWrite authors + +QEditor part, help for code-completion, abbrev part: + Roberto Raggi + +Qt 3 port, various patches: + Harald Fernengel + +Help with KParts, KGenericFactory and other KDE infrastructure: + Simon Hausmann + +Subversion KPart: + Mickael Marchand + +Patches: + Dominic Seichter + Yann Hodique + Heinz Hornung + +SplashScreens: + Marion Klein + Ram� Lamana Villar + +KDevTabBar, bug fixes, Gideon Release: + Caleb Tennis + +PartExplorer, (bugs for) CvsPart: + Mario Scalas + +Pascal support and project parts, Filecreate GUI, +Documentation viewer improvements + Alexander Dymo + +Application wizard improvementes, application templates, documentation, bug fixes: + Dominik Haumann + +DistPart, Bash Shell Support: + Ian Reinhart Geiser + +API Documentation, Run Options, code reorganization. Fixes for project templates, autotools and doxygen. + Amilcar Lucas + +Replace plugin, Bookmarks plugin, FileList plugin, CTags2 plugin, Overall improvements and patches + Jens Dagerbo + +SnippetPart, debugger and usability patches + Robert Gruber + + +Other software included in the source package: + +* KDE 2.0 Development Book + David Sweet, et al. + Copyright notices see in doc/kde2book + +* GNU libc documentation + Sandra Loosemore, Richard M. Stallman, Roland McGrath, + Andrew Oram, and Ulrich Drepper + Copyright notices see in doc/libc + +* STL documentation + SGI, Inc. + Copyright notices see in doc/stl + diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..5b6e7c66 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYING.LIB b/COPYING.LIB new file mode 100644 index 00000000..e38ffa83 --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..7f6393db --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2846 @@ +2007-12-03 Richard Dale +* Added a QtRuby4 project based on the C++ Qt4 one + +2007-10-16 Richard Dale +* Added Rails 2.0 file type suffixes; .html.erb, .js.rjs and .xml.builder + +2006-12-13 Matt Rogers + * KDevelop 3.4 RC 2 (with many more things than listed here) + +2006-11-08 Matt Rogers + * KDevelop 3.4 RC 1 (with many more things than listed here) + +2006-08-06 Andreas Pakulat +* Implemented Support for Qt4 qmake in the qmake buildsystem + # Recognize the QT option + # Support RESOURCES variable + # cleanup the configuration + # provide an import configuration for Qt4 projects + +2006-04-26 Jens Dagerbo +* Made the ClassView restore it's state after a refresh. It will no + longer close up after each successful build. + +2006-04-24 Jens Dagerbo +* Added "Goto Last Edit Position" action. A regular menu/toolbar/shortcut + action to open the file and position the cursor at the point of the + last edit. + +2006-04-14 Jens Dagerbo +* Improved support for encodings + # KDevelop will now obey the selected encoding in the File Open dialog + # The OpenWith plugin now offers all available encodings in "Open As" + # The encoding for each open file is saved with the session, and will + be used to open that file the next time the project is loaded + # Default encoding can be set per project in the Project Options - + this will be the default when opening a file + # File Open encoding will default to the open project's default + +2006-04-07 Jens Dagerbo +* Added KDevShellWidget - a thin wrapper around konsolepart, aimed at + executing shell type applications. + +2006-03-25 Jens Dagerbo +* Added support for multiple tags files for Ctags2 plugin, enabling + it to optionally cover external libraries in addition to the active + project. Work based on patch by Etay Meiri. + +2006-03-15 Richard Dale +* Added a 'sync terminal' option to the configuration settings to + disable the 'cd' commands in the konsole by default. + +2006-02-21 Richard Dale +* Disable the new file sidetab by default + +2006-02-21 Richard Dale +* Add the pid to the filename of the Unix domain socket used by the ruby + debugger so that more than one instance of KDevelop can be run on a + machine. + +2006-02-21 Richard Dale +* The Full Screen mode menu option is under the Settings menu in both + Kate and Konqueror, and they arguably have it in the wrong place. + But it's probably better to make KDevelop consistent with other KDE + apps even if they're slighty wrong. So move the menu under settings + +2006-02-17 Richard Dale +* Removed the 'Type' column from the Ruby debugger as the C++ + debugger no longer has one + +2006-01-30 Richard Dale +* Added a minimal C# language project type based on the perl one. + +2006-01-30 Richard Dale +* Added file templates for Rails projects; rhtml, rxml, css and js +* Fixed documentation links for QtRuby/Korundum, added some + links for Rails + +2006-01-19 Richard Dale +* Added a Rails project template +* Use the Run menu option to start WEBrick. If the Rails project doesn't + exist it will be created. +* The script/console runs in the Terminal instead of irb + +2006-01-16 Richard Dale +* Added .ocl extension for Onboard Control Language sources used for + C files in some satellites + +2005-08-17 Richard Dale +* The $SHELL environment variable is set to 'irb' for ruby projects. +* Added a project option to customise the ruby shell +* A 'def cd(dir) Dir.chdir dir end' line must be added to your + .irbrc file to prevent syntax errors when konsole changes directory + +2005-06-28 Richard Dale + * Fixed bug in 'run main program' project option where the .ui file was out of + sync with the code + * Add a 'show constants in debugger' project option. This is needed because there + are so many constants in the qtruby/korundum classes that it slows the debugger + right down and clutters the variables view. + * Added a 'Trace into Ruby' project option to show ruby code from installed libraries + in the debugger. + * The debugger can now expand instance variables nested within instance variables + using get_instance_variable(). + * Improved the parsing of pretty printed items that are all on one line, as opposed to + one line per name=value pair. + +2005-06-25 Pieter Pareit + * Added ruby_{run,config} icons, the .png files are used by kdevelop, + the .psd files can be used by artists when icons need to be changed + Thanks Zoran Karavla for the artwork! + +2005-05-26 Tobias Erbsland + * Added new class QtBuildConfig. This class stores the configuration + about the used Qt library. Is Qt used, which major version and + where the Qt library path (QTDIR) for this project is. + In a later step, it's possible to use different qt installations + for each project. E.g. you develop on a KDE4.x programm under KDE3.x. + * Added a new tab in the C++ options dialog (CCConfigWidget). + The user can edit the configuration QtBuildConfig in this tab. + * New class wizard: + - Qt checkboxes are disabled (hide them?) on non-qt projects. + - Different code is generated for Qt3.x and Qt4.x projects. + - Includes of classes that starting with "Q" bypasses the + normal template settings. In Qt3.x the include file has always + a lowercase include name with a ".h" suffix, and Qt4.x has + a mixed case include name without any suffix. + - Added the email address to the author's name if it exists. + +2005-05-26 Tobias Erbsland + * Replaced static hash table in lexer by a QMap + I found no performance impacts by this replacement, but the code + was getting much smaller and cleaner. + * Added Q_DECLARE_FLAGS and Q_DECLARE_OPERATORS_FOR_FLAGS macros + that are used in Qt4 for the special QFlags template. + * Added the keyword (macro) "foreach" to the lexer and parser that + is introduced by Qt4. + In a later step I will add the correct parsing, that the initial + variable is identified by the parser that code completion works. + +2005-04-05 Robert Gruber + * Added support for CVS' annotate command + +2005-03-24 Richard Dale + * Added missing ruby debugger icons installation + +2005-03-01 Matt Rogers + * Fix bug 71926 by not using beautifyToolTip since it breaks i18n + * Fix bug 71708 by giving the environment variable dialogs a parent + so they can't get hidden behind other windows + +2005-02-23 Alexander Dymo + * Fix compilation on KDE 3.2 + +2005-02-22 Alexander Neundorf + * Added partial support for building kdevelop with cmake + +2005-02-22 Alexander Dymo + * Added a qmake parser to help implementing a much better qmake project + manager + +2005-02-17 Jens Dagerbo + * Add the 'Configure Toolbox' and 'Edit Custom Widget' menu items back to + the tools menu when designer intergration is activated. + +2005-02-07 Matt Rogers + * Pull information from the CVS/Entries file to populate version control + information in the file tree on first load. This eliminates the need to + use 'Sync with Repository' when KDevelop is first loaded, but it is needed + to update the version control info. + +2005-02-02 Richard Dale + * Fixed Java KDE app framework template so it compiles + +2005-02-01 Jens Dagerbo + * Implemented a fix for BR 91757 which also removes the silly runtime dependency we had on kdebase + +2005-01-28 Richard Dale + * Added a Ruby KConfig XT project template + +2005-01-25 Jens Dagerbo + * Reimplemented "Forward" for source navigation history + +2005-01-23 Amilcar Lucas + * Updated support for Doxygen up to 1.4.1 + +2005-01-22 Jens Dagerbo + * Global scope plugins are once again optional. + * Fixed source navigation history (by reducing the ambition to something that can work). + * Added the Version Control Manager plugin. Now we can decide which VCS system to use again. :) + +2005-01-20 Jens Dagerbo + * Further cleanup of plugin handling in PluginController/ProjectManager. + * Removed the last traces of in-project language switching. + +2005-01-09 Jens Dagerbo + * Finished the new CTags frontend. + +2005-01-08 Jens Dagerbo + * Made it possible to finally remove Code Completion databases via the GUI + * Cleaned up the context menu mess (at least it's optional now, and the code + is cleaner). + +2005-01-03 Robert Gruber + * Added support for CVS commands edit, unedit and editors + +2004-12-19 Alexander Dymo + * Made it possible to add custom build commands (like make install-exec) + for the subproject context menu in automake manager. + +2004-12-17 Alexander Dymo + * Advanced subclassing option in C++ New Class Wizard can be used + for classes in the persistant class store. This means that if + the PCS for Qt library is built then advanced subclassing from + Qt classes is possible in the wizard. + +2004-12-15 Alexander Dymo + * Finished the implementation of plugin profiles for KDevelop shell + and shell extension architecture. + This means that KDevelop IDE becomes a KDevelop Platform now. And + KDevelop IDE is now only a program built on KDevelop Platform. + * Made KDevelop Assistant to use KDevelop Platfrom. + * Implemented profile detection for projects. Now, for example, when you open + C++ language project KDevelop loads "CppIDE" profile. If a project file + has KDE keyword set then KDevelop loads "KDECppIDE" profile (profile defines + a list of plugins to be loaded and unloaded). kdevprofileeditor will show + all information related to the profile. + +2004-11-23 Richard Dale + + * Added some ruby project options which are used for both debugging and an + ordinary run. + - Main program (this is in addition to the automake project main program) + - Program arguments + - Run main program or run selected window options + * The '-K' character coding project option is now passed to the debugger too + +2004-11-22 Alexander Dymo + * Implemented simple VCS integrators for Clearcase, Perforce and Subversion. + * Reenabled subversion support plugin. + * Imported svn kioslave from kdesdk HEAD into a compat library therefore svn + will work on KDE<3.3.90 too. + +2004-11-21 Alexander Dymo + * Added KDevVCSIntegrator extra interface. VCS Integrator is a plugin which is used by + application wizard to select a version control and possibly import newly created project + into the VCS. + * Implemented VCS integrator for CVS (Cervisia). + * Patched ProjectManager to load selected VCS plugin. + +2004-11-20 Richard Dale + + * Ruby Source Code Debugger initial checkin + * Based on John Birch's gdb front end, the UI is very similar. There are no + assembly language step options or disassembly viewers, but pretty much + everything else is much the same in ruby as for gdb/C++. + * You can set breakpoints on file/line or file/method, watchpoints to break when + a ruby expression is valid and catchpoints to break when an exception is thrown. + * The Watch variable viewer allows ruby expressions to be watched, and they are + updated on program pause. + * A configuration option was added to enable/disable the debugger floating toolbar. + * The debugger backend is written in pure ruby using the code from the 'debug.rb', + source included with the ruby distribution. It is started via KProcess which handles + redirection of stdout and stderr. The idea came from the way Laurent Julliard + implemented the FreeRIDE ruby debugger - it uses Distributed Ruby (like DCOP) + for messaging. DRuby is ruby-specific and couldn't be used though. + * The debugger communicates with the backend via a Unix domain socket; + commands are sent, and the replies are parsed in KDevelop in much the same way + as the gdb debugger uses stdin and stdout to send and receive. + +2004-11-17 Alexander Dymo + * KDevelop interfaces cleanup and enchancements. Interfaces are now smaller, additional, not so important + interfaces are available through extension mechanism (see KDevPlugin::extension() methods). + Also added a lot of API documentation. + +2004-10-30 Robert Gruber + * Implemented "grouping of snippets" feature for SnippetPart + +2004-10-30 Richard Dale + + * Fixed ruby class and instance variable type matching bugs + * Added error message if the ruby code to run can't be located by the top level C++ stub + * The default character coding for KDE ruby projects is UTF-8 + * If a class is declared several times in a file, the line number of the first instance + is used in the class browser, and not the last one. + +2004-10-29 Richard Dale + + * Added the 'qmakeapp' project template translated to QtRuby + +2004-10-28 Richard Dale + + * Fixed Ruby KDE app and DCOP service templates so they work again. + * Implemented a 'Character Coding' ruby project option + +2004-10-27 Richard Dale + + * Implemented ruby class '@@' and '@' instance variables in the class browser. + + * Ruby doesn't have declarations for class or instance variables, and so a variable is 'declared' + when it is first assigned to. So the first assignment encountered in the ruby source is used, + unless the variable is set in the iniitaiize() method when that is considered as the 'first'. + + * The type of the variable is inferred from the type of the thing on the rhs of the assignment to it. + +2004-10-27 Amilcar Lucas + Exclude non API classes from the doxygen API documentation. + Please use the "doxygen doxyfile" command to test it. + +2004-10-27 Alexander Dymo + The first step in creating RubyQt/Korundum RAD environment - + started to implement KDevDesigner integration for Ruby: + works: automatic and manual subclass creation; + doesn't work: function adding, editing and removing. + +2004-10-25 Richard Dale + + * Added a ruby DCOP service project template + * Improved the kapp Korundum application framework. It configures, builds and installs + a C++ top level stub, that starts the ruby app. The ruby scripts are located via the + KStandardDirs/KInstance mechanism, in directory ..share/apps/ + * k_dcop and k_dcop_signals declarations are shown as slot and signal declarations in + the class parser. + * =begin to =end comments are ignored + * Added icons for Ruby configure and run options. The Run button now starts the main program + with the ruby '-C' option to switch to the main program's directory. + * Added missing scope attribute to the class parser methods + + +2004-10-23 Richard Dale + + * Implemented ruby slots/signals declaration navigation in the class browser + * Atrr accessor and access control method lists can span multiple lines + +2004-10-23 Alexander Dymo + * KDevelop documentation viewer and KDevAssistant: + - implemented font configuration options; + - disabled loading of KHTML plugins. + +2004-10-21 Alexander Dymo + * KDevelop Platform: + - implemented profiles library and editor engine; + - implemented profiles editor (kdevprofileeditor application); + - set up X-KDevelop-Property properties in .desktop files of KDevelop parts. + +2004-10-21 Richard Dale + + * Added a KDE Korundum Ruby application framework based on the languages/cpp/app_templates/kapp + C++ project template + * Improved the Ruby class parser + * Both classes and modules are shown in the class browser + * Class or 'singleton' methods supported and appear as 'static' methods + * Access types of 'public', 'protected' and 'private' supported + * attr_accessor, attr_reader and attr_writer method definitions supported. For attr_accessor or + attr_writer a 'foo=' method is shown. + * Operator methods are shown in the class browser too + +2004-10-13 Alexander Neundorf + *buildtools/custommakefiles/: + -add two submenus "Object Files" and "Other Files" to the "Build Targets" menu + -add new tag so that the filelist file can be + located outside the source directory. This is currently only written + by the cmake kdevelop3 project file generator + +2004-08-27 Amilcar Lucas + * Updated support for Doxygen 1.3.8 + +2004-06-21 Robert Gruber + * Added drag and drop support to SnippetPart + * Added filter support to AppOutputView + +2004-06-17 Jens Dagerbo + * Added optional automatic reload on external file modification. This is only available with katepart. + * Added CopyTo plugin. A small utility to do network transparent file copying using KIO. + * Disabled VCS repository creation in the appwizard (doesn't work and the implementation broke the + plugin handling) and import (to be reimplemented using KTrader). + * Added the simple basics of Plugin Profiles. Will finish this the coming days. + +2004-06-14 Alexander Dymo + * Documentation plugin can show methods in index for Qt and Doxygen documentation catalogs. + * Implemented a dialog to run profiler (calltree + kcachegrind). + +2004-06-05 Jens Dagerbo + * Fixed several ToolView related issues. Among other things, they should now + automatically restore their last position after a restart. + +2004-05-31 Alexander Dymo + * KDevelop has made a large step towards being the RAD tool for KDE. + Qt Designer is ported to KParts and KXMLGUI technology and can now + be embedded into KDevelop and integrated with it. It consists of + KDevDesignerPart and KDevDesigner shell program. Part is embeddable + everywhere and shell can be launched as standalone designer (run kdevdesigner). + * The first step to integration between KDevDesigner and KDevelop is done. + CppSupport can now automatically create implementation files (subclasses) for forms + and automatically add slot implementations. + +2004-05-27 Sascha Cunz + * Change "New File" in the toolbar to popup a menu with all available file templates, + if one clicks on it. + +2004-05-26 Robert Gruber + * Added possibility to set the priority of the make-process + * Added possibility to search case insensitive + +2004-05-21 Sascha Cunz + * Added a ncurses template + +2004-05-10 Andras Mantia + * Add possibility to define environment variables for the configure stage. + +2004-05-08 Alexander Dymo + * Devhelp and KDevelopTOC documentation plugins are implemented. Indexes that exist + in devhelp and kdeveloptoc files are now taken into account. + +2004-05-04 Alexander Dymo + * Doxygen documentation plugin (toc and index) is implemented. + This means that kdevassistant can browse KDE API docs and has table of contents and index! + kdevassistant (and kdevelop itself) is now the first documentation browser where you can + look for Qt and KDE classes at the same time (using one index). + +2004-04-30 Sascha Cunz + * Added Paul Drummond's patch for having "favourites" in appwizard. + +2004-04-25 Sascha Cunz + * Added support for reading the licenses that appwizard uses dynamically. Install all current licenses + to $prefix/share/apps/kdevelop/licenses + +2004-04-22 Alexander Dymo + * Added brand new "Look in documentation" function that puts the term under the cursor into the + documentation index tab and looks up for this term in the index. + * Added "Search in Documentation" and "Look in Documentation" menu items into the "Help" menu + with shortcuts and respectively. + * Implemented "Goto manpage" and added "Goto infopage" function in the "Help" and editor context menus. + * Improved "Add bookmark" function - it now recognizes embedded html part and sets the bookmark title + to the title of an opened document. + * Use also a default KDE shortcut for popup menu to open editor context menu. + +2004-04-21 Alexander Dymo + * Added Gtk-- application template by Andrew Patterson. + +2004-04-20 Jens Dagerbo + * Wired up katepart's editor context menu - we now finally have copy/paste in the context menu. + * Added a keyboard shortcut to open the editor context menu. (CTRL+Return) + +2004-04-16 Jens Dagerbo + * Added MimeWarningDialog - KDevelop will now ask the user what to do when an unknown mimetype is encountered. + +2004-04-15 Jens Dagerbo + * Added Thomas Nagy's KConfig XT based apptemplate. + +2004-04-14 Jens Dagerbo + * Rewrote and documented the KDevPartController interface to reduce the duplication of a lot of common but + trivial code all over the codebase. + * Moved the documentation history out of the PartController and into the docviewer part. + * Moved source navigation history into the PartController and disabled the HistoryPart. + +2004-04-14 Alexander Dymo + * Here is my gift for all Qt Designer fans! A KDevelop Assistant program is now available (run kdevassistant + from a command line). KDevelop Assistant is a lightweight version of KDevelop with only documentation + and file selector parts enabled. + +2004-04-12 Alexander Dymo + * Full text search in new documentation part now functional. Search results are presented in html page + and in listview as well. + +2004-04-09 Alexander Dymo + * Commited new documentation part for KDevelop. It features documentation plugin system, + it's easy now to add support for a new documentation format by implementing DocumentationPlugin interface. + Index is now loading faster, index caching mechanism is used. Configuration dialog became more clean and convenient. + +2004-03-22 Jens Dagerbo + * Restructured CppSupportPart::parseProject() + +2004-03-17 Jens Dagerbo + * Extended diffpart to also handle FileContext and dirty files. + * Updated FileList. Now supports filestate feedback and has a context menu for file operations. + * More cleanups in Core. Filestate is now emitted from PartController for the receivers to implement. + +2004-03-15 Jens Dagerbo + * NewMainWindow is now enabled by default + * Added settings in "User Interface" for TabWidget visibility and IDEAl mode button layout + +2004-03-12 Jens Dagerbo + * Added NewMainWindow - a new MainWindow implementation - enable in toplevel.cpp to try it out. + * Major cleanup of PartController::editDocument() + * A few other minor improvements to the core. + +2004-03-05 Jens Dagerbo + * Reimplemented how FileTree finds selected items. Fixes crash when a file changes name from an external event. + +2004-02-24 Jens Dagerbo + * Added FileList plugin + * Added CTags2 plugin + +2004-02-23 Alexander Dymo + * Added Opie application templates for C++/Embedded development. Templates by Holger Freyther. + +2004-02-19 jbb + * Robert Gruber's patch + - fix printing member variable when a /x modifier is added + +2004-02-18 Jens Dagerbo + * Added function lookup to QuickOpen plugin. Patch by Ahn, Duk J. + +2004-02-15 Amilcar Lucas + * Updated support for Doxygen 1.3.6 + +2004-02-07 jbb + * Robert Gruber's patch + - fix whatis when toggling to hex display + - fix refresh display setting global output radix. + +2004-02-07 Jens Dagerbo + * Moved all of the plugin loading logic to PluginController + * Moved FileCreatePart to the globally loaded "default parts" + +2004-02-06 jbb + * Add (global) Output radix to debugger options. + * Robert Gruber's patch to add hex/dec toggle to watch window items + +2004-01-28 Jens Dagerbo + * Ported Doxygen plugin, autotools part, FileTree and FileGroups to demand loaded config page + +2004-01-26 Dominik Haumann + * src/projectmanager.cpp: ask if user tries to reload the already opened project + +2004-01-26 Alexander Dymo + * Added snippet part by Robert Gruber. + +2004-01-24 Jens Dagerbo + * Updated Bookmarks Plugin. Various improvements and fixes. + +2004-01-21 Andras Mantia + * Fix clear all breakpoints functionality + +2004-01-21 Jens Dagerbo + * Added ConfigWidgetProxy class to lib/util and initially implemented demand loading of config pages for DocTreeViewPart. + +2004-01-09 Amilcar Lucas + * Easy access to bug reports of every supported language in the documentation browser (except SQL) + +2004-01-07 Amilcar Lucas + * Updated support for Doxygen 1.3.5 cvs HEAD + +2003-11-28 F@lk Brettschneider + * old IDEAl look for toolview-buttons is back in IDEAl mode + +2003-11-20 F@lk Brettschneider + * latest sync with KMdi of kdelibs-cvsHead (fixes some crashes) + * enabled kmdiguiclient.h/cpp for KDE less version 3.2 too + (-> this introduces KDE-accels Ctrl+Shift+Alt+L/R/B/T for IDEAl-docks and Ctrl+Alt+CursorLeft/CursorRight for cycling IDEAl-toolviews) + * bugfix: proper names of View menu + * now save the docking state to another section of kdeveloprc (to let people (who tried KMdi alpha versions) escape a vicious cycle) + +2003-11-16 Mario Scalas + * Version control color feedback for the file view (currently implemented + by vcs/cvsservice plugin only). + +2003-11-13 Amilcar Lucas + * Readded a even cleaner kdevelop.kdevelop file. + PLEASE do _not_ commit changes to this file. + We have until mid January 2004 to make the necessary code changes that create a more "cvs friendly" file by moving some of the options to the .kdevses file. + For info on how to do it, read: + http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/howToAddPlugins.html + I think this is very important fo the success of KDevelop3 in for developer teams (no man is an island!). + Alexander and F@lk seam to agree with me on this one. + +2003-11-09 F@lk Brettschneider + * as planned and decided months ago, now I + removed KDevelop's own special implementation of IDEAl UI mode. + This has been replaced by KDE's IDEAl UI mode, globally implemented in kdelibs/kmdi. + Now we increase maintainance, KDE-comformity and can switch all KDevelop UI modes on the fly. + +2003-10-29 Alexander Dymo + * Imported updated pascal parser, it isn't restricted now to pascal-78. + Most object pascal/delphi extensions are supported. + +2003-10-17 Dominik Haumann + * new Application templates in cpp: kateplugin2, noatunvisual, + noatunui, kbearimportfilter, kbearplugin, kfileplugin + * fixed 53943, 64028 + * parts/appwizard: Now you can add "ShowFilesAfterGeneration=file1,file2" + to the app_tamplate's information-file (example: khello/khello) so that + file1 and file2 are shown after project generation - usually a README.devel + and/or source code files the user has to modify. + ShowFilesAfterGeneration= takes a comma separated list of files regarding to + the project root directory wheras + - APPNAMEUC will be replaced with the projectname.upper() + - APPNAMELC will be replaced with the projectname.lower() + - APPNAME will be replaced with the projectname. + Function 'openMainFile()'is now deprecated and therefore removed. + * updated documentation for this stuff. + * new in New-Project-Dialog: Getting the Project location with "..." asks + if it should set tht directory to the DefaultProjectsDir. + +2003-10-13 Amilcar Lucas + * Moved the language specific documentation to the languages/xxx/doc directories + +2003-10-12 Mickael Marchand + * New subversion part added to replace the old svn one + +2003-10-11 F@lk Brettschneider + * now I've started again fixing the MDI user interfaces which are quite broken at present + +2003-10-08 Tilman Vogel + - added auto completion to the namespace field + - added classes from all namespaces to the auto completion of the base + class field, add classes from specified namespace without qualifier + - lookup classes for parsing in the correct namespace, not only the global namespace + - fixed bug causing crash when changing inheritance mode + +2003-10-04 Alexander Dymo + * Reenabled Ada language support (ported it to code model and reenabled + background parsing). + +2003-10-04 Amilcar Lucas + * On-line, automaticaly updated every 24H, KDevelop API Documentation can be viewed with the doctreeview. + +2003-10-02 Amilcar Lucas + * Renamed KDevelop executable from gideon to kdevelop. + * This makes KDevelop3 OVERWRITE KDevelop 2.x instalations. + * Restructured the directories acording to the API documentation + buildtools -> has the old Project managers + languages -> language support (includes app_templates, file_templates, compilerplugin, pcsimporter and debugger) + editors -> editors support + vcs -> Version control systems (clearcase, cvs, perforce, svn, cvsservice and cervisia) + +2003-09-26 Amilcar Lucas + * Added per target run arguments to the automake manager. + These arguments are used when no Main program (Project Options...-> Run Options) is selected and the Program arguments (Project Options...-> Run Options) are left empty. + +2003-09-22 Alexander Dymo + * Finished GUI for enabling and disabling documentation topics in a project configuration + dialog. Thanks to Amilcar Lucas for original idea and implementation. + * Added popup menu for the documentation viewer. It contains "Open in New Window", "Reload", + "Stop" and "Set Encoding" actions. + * Created mimetypes directory in KDevelop source tree. Here we can put all mimetypes necessary + for KDevelop that are not available in kdelibs. + * Added x-fortran, x-pascal and chm (HTML Help) mime types. + +2003-09-10 Alexander Dymo + * Added the GUI to create custom code completion databases + based on user selected directories. + * Imported Kugar property editor library. Modified generic project manager + to use it for editing properties in build item configuration dialog. + +2003-09-09 Dominik Haumann + * parts/appwizard/appwizarddlg[base.ui,.cpp]: fixed bugs 45719, 63930, 63929 + +2003-09-08 Roberto Raggi + * Added the GUI for create the code completion databases for + external libraries like Qt and KDE + +2003-09-06 Bernd Pol + * Some updates on the "KDevelop 3.0 users's manual" (docbook) + +2003-08-29 Alexander Dymo + * Added the initial version of generic project manager. + It is the replacement of script/custom/pascal/ada/haskell/etc. project managers. + Extensible with plugins. Currently available project manager based on shell scripts. + +2003-08-28 Harald Fernengel + * SQL support now displays tables and fields in the classbrowser + +2003-08-27 Harald Fernengel + * Added language support on the fly - you can switch to + SQL mode from a CPP project, or to Perl if you have scripts + +2003-08-26 Harald Fernengel + * Added version information for plugins to prevent opening + binary incompatible plugins from old versions. + +2003-08-10 jbb + * Roger Larsson's patch that adds remote debugging. + +2003-08-03 jbb + * fixes for debugger startup problems + * fixes for debugger shutdown + A significant change in this patch is that we no longer attempt to + shutdown gdb from information that gdb supplies. This must now be done by + the user via the stop button. + A reproductable crash after the client program segfaulted and the user + tried to continue, shutdown and then restarted has been fixed. + I suspect that this was the major cause of the reported crashes judging + from the few backtraces supplied. + +2003-07-28 Mario Scalas + * PartExplorer is now shown in the embedded SelectView because the dialog-based interface was hardly useful! + * Results list will now use tooltips to show available services' properties. + * Several bugfixes in GUI code + +2003-07-28 Amilcar Lucas + * Full support for Doxygen 1.3.3 + +2003-07-25 Gael de Chalendar + * Added "Edit" buttons to the "Includions" and "Prefixes" tabs of the + automake subproject options dialog and to the "Libraries" tab of the + automake target options dialog. + +2003-07-25 Alexander Dymo + * Added "Force Reedit", "Install" and "Install (as root user)" actions into the subproject + menu for Automake Manager. Force Reedit is only available for KDE projects. + * Quote environment variables with double quotes to allow shell expansion when + launching make from the project manager. + +2003-07-19 Harald Fernengel + * QEdtior can now Reload files + +2003-07-19 Andras Mantia + * apply the editor settings to the opened files + * don't crash on exit [#60658] + * fasten documentation indexing + +2003-07-15 Andras Mantia + * resolve links before opening a local file + * add "-follow" as a switch for "find" to successfully grep even in symlinked directories + +2003-07-14 Amilcar Lucas + * If no Main Program was selected in Project Options...-> Run Options, then use the + currently selected active target. This is valid for execution and for debugging. + So no more need to goto the menu every time you want to debug a new target! Just + activate it and you're done! :) + Currently only in Automake based project because AFAIK it the only one that has + the concept of active targets. Correct me if I'm wrong. + +2003-07-13 Andras Mantia + * don't treat libtool link messages for modules as errors. + * recognize libtool warning messages. + +2003-07-12 F@lk Brettschneider + * compiles and runs on KDE-3.0.3/Qt-3.0.5 again + +2003-07-07 Mario Scalas + * Added tag/branching feature to legacy CVS integration. + +2003-07-06 Alexander Dymo + * Implemented Delphi compiler plugin + +2003-07-04 Amilcar do Carmo Lucas + Added debug and optimized build configurations to all C and C++ autoproject based templates + +2003-07-04 Andras Mantia + * Restore search in documentation functionality + +2003-06-26 Alexander Dymo + * New QComboView widget is added to lib/widgets. It is the modified version + of QComboBox with QListView object in place of QListBox. + * Make classbrowser use comboviews (QComboView) in namespace, class and method + selectors on the toolbar. + +2003-06-23 Amilcar Lucas + * Replaced all TODO occurencies with @todo so that they show up in the + Doxygen generated documentation under "Related Pages > Todo List" + * Make Doxygen generate XML files for the codecompletion tooltips + +2003-06-18 Mario Scalas + * (CvsPart) New features added: + - It is now possible to add to/remove files from .cvsignore file + - When adding/removing files to project, part will now ask for user action + * (CvsPart) Code has been restructured. + * (lib) Modified FileContext in kdevecore.{h,cpp} so it can handle KURL::List. + (This is just an addition: old code should work as before). + * (FileView) FileTreeWidget supports multiple files selections now. Removed + drag support because it needs to be fixed by TT (seems a bug from qt-3.1.2 + onward). + +2003-06-15 Harald Fernengel + * Added notification if a file has been modified outside the IDE + (IDEAl mode only for now). + +2003-06-14 Harald Fernengel + * Added perforce to the main menu, also uses KActions now so you can + assign your favourite keybinding to the commands. + +2003-06-14 Hamish Rodda + * Warn if another process is running on execution and allow a restart. + * Make automake deal with METASOURCES=AUTO + * Remember position in document for compile warning/errors so that you can + edit the document and still be taken to the correct location + (work in progress, commented out, requires up-to-date katepart) + * Separate highlighting for errors and warnings (work in progress) + +2003-06-12 Alexander Dymo + * Trollproject: + - Existing files could be added to a project with a relative path or + they could be symlinked instead of just copying + - Implemented removing files from IMAGES and IDLS groups + - Set run environment variables and program arguments when launching + the executable (thanks to Mario Scalas for the patch) + - Correct "Link convenience library inside project" functionality (thanks to + Mario Scalas for the patch) + +2003-06-11 Hamish Rodda + * Implemented "Debug in KDevelop" hook into drkonqi (the KDE crash + handler). Press the button and kdevelop attaches to the process + and brings up the frame stack, as long as the binary name of the + process is the same as your binary. Requires an update to + kdebase/drkonqi to work (runtime dependency). + +2003-06-07 Mario Scalas + * Stepped back from using Pimpl in part design since it does only complicate code without any of its + advantages in this case + * Added an option for adding the message for the commit operation to the master ChangeLog + (located in /ChangeLog): await for comments for further changes. + * CommitDlg now uses QTextEdit instead of (deprecated) QMultiLineEdit + * This log was written using the CvsPart! :) + +2003-05-27 F@lk Brettschneider + * compiles and runs on KDE-3.0 again + +2003-05-26 Roberto Raggi + * New Java support + +2003-05-24 Roberto Raggi + * Added full-screen mode + +2003-05-22 Mario Scalas + * Added tooltips to the watch variable list view so no widget resize is needed + * Added a copy to clipboard feature for watched variables so their data is available + for other uses. + +2003-05-21 Roberto Raggi + * implemented the support for profiles + * ported kate file selector to kdevelop + * added documentation hint to c++ support, patch provided + by Jonas B. Jacobi + +2003-05-18 Alexander Dymo + * Reformat source option is now available in the "Subclassing" wizard + * Trollproject: + - recognizes MAKEFILE option in qmake configuration files + - uses make options specified in project options dialog + - uses makefiles specified by MAKEFILE option to run make + +2003-05-18 Jens Dagerbo + * Updated BookmarksPart - now bookmarks are saved to session file. + +2003-05-17 F@lk Brettschneider + * renamed QextMdi classes and files to KMdi + +2003-05-16 Alexander Dymo + * Added sourceFormatter() method to KDevPlugin interface and corrected AStylePart to be + the default source formatter part. Astyle library is separated from the part. + * Added "Format Source" option to the "C++ New Class" wizard. + * Added an index system to the doctreeview - thanks to Marcel Turino . + +2003-05-16 Jakob Simon-Gaarde + * Trollproject: Support for custom installation groups or qmake install objects + Each install object tells "make install" to copy user specified filesgroups to + a certain location. + example: + doxy.files += docs/*.html \ + docs/*.css + doxy.path = /usr/doc/appname + INSTALLS += doxy + +2003-05-15 Jens Dagerbo + * Updated BookmarksPart - added tooltips && RMB actions + +2003-05-14 Jakob Simon-Gaarde + * Trollproject target.path reimplementation + +2003-05-14 Mario Scalas + * (lib/interface) Merged KDevGlobalVersionControl in KDevGlobalVersionControl + * (lib/interface) removed KDevGlobalVersion + * (lib/interface) Updated Makefile.am + * (parts/appwizard) changed code for retrieving the available VCS (lookt at loadVCS()) + * (parts/cvs) Merged GlobalCvs in CvsPart + * (parts/cvs) removed parts/cvs/globalcvs + * (parts/cvs) added common cvs options as #define in new cvs_commonoptions.h + * (parts/cvs) updated Makefile.am + +2003-05-14 Jens Dagerbo + * Added BookmarksPart + +2003-05-12 Roberto Raggi + * replaces KDevLanguageSupport::fileFilters() with + KDevLanguageSupport::mimeTypes() + +2003-05-11 Roberto Raggi + * autoproject: don't write empty variables in Makefile.am + * autoproject: implemented the remove subproject feature + * autoproject: improved add subprojects + * autoproject: create a (default) noinst_HEADERS target + +2003-05-05 Alexander Dymo + * parts/trollproject + MOC_DIR, UI_DIR, OBJECTS_DIR variables support in configuration dialog is back again. + Fixed incorrect program path generation that prevented from running the application. + Put correct actions into the Build menu and the Build toolbar. + * parts/clearcase + Applied further modifications by Ajay Guleria . + +2003-04-18 Oliver Kellogg + * Implemented Ada language support including adasupport part, adaproject + part, filecreate templates, application wizard template, syntax + highlighting and indentation in qeditor. + Kudos to Alex Dymo (pascalsupport) and Robe Raggi (javasupport), on + whose work this is based. + +2003-05-01 Jens Dagerbo + * Changed closerpart to work on KURLs. Also moved it into Core scope. + +2003-04-30 Jens Dagerbo + * Added "Core" scope plugins alternative + * Updated the plugin selection to be more userfriendly + +2003-04-29 Amilcar Lucas + * Made the Working Directory of the debugged executable configurable + (Finally you can run your application on it's directory, instead of $HOME) + +2003-04-27 Alexander Dymo + * Regexp tester now has "Edit" button that uses KRegExpEditor + * Added free pascal oriented templates - GTK+ application and shared library + * Implemented "Run options" (envvars, program arguments) for pascal project manager + +2003-04-26 Alexander Dymo + * Implemented all documented compiler options in free pascal compiler plugin. + +2003-04-25 Jens Dagerbo + * Added KTextEditor::ConfigInterface to QEditor + * Made changed editor settings apply to all open editors + +2003-04-23 Roberto Raggi + * fixed the deadlock in the background parser + +2003-04-23 Harald Fernengel + * added SQL support part, including support for multiple connections, + sending queries and browsing their results + +2003-04-22 F@lk Brettschneider + * compiles and works on KDE-3.0 again + +2003-04-18 Alexander Dymo + * Implemented Pascal language support including + pascalsupport part, pascalproject part, filecreate templates, + application wizard template, syntax highlighting and indentation in qeditor, + compiler plugins for Free Pascal compiler and (very basic) for Borland Delphi Compiler. + +2003-04-18 Roberto Raggi + * started to implement the recovery support, this is the first + step to implement the incremental parser + +2003-04-17 Roberto Raggi + * Reduced the size of the generated pcs database(you must regenerate your + database using r++ to take advantage of it) + * Added the AST node for variable function arguments + * Added option "--fast" to the r++ + +2003-04-16 Roberto Raggi + * Implemented the support for class inheritance in the new pcs + * Moved the c++ parser into kdevelop/lib/cppparser, so other + projects like kate and umbrello can use it + +2003-04-15 Roberto Raggi + * Added the new persistant class store + +2003-04-15 Harald Fernengel + * The stop-button is now able to stop single parts via drop-down menu. + If you grep, build, debug and valgrind at the same time, you can terminate + one part only. Single-clicking the stop-button will terminate all active + jobs as it did before. + * Switch syntax highlighting on/off on the fly in diff-part's raw output + +2003-04-14 Jens Dagerbo + * Replace part refinements and bugfixes + Tooltips, regexp validation feedback, colorization & gui redraw. + shortcut changed to alt-ctrl-R + +2003-04-14 Harald Fernengel + * Diff part is now able to use any kpart that can display 'text/x-diff' + * Diff part can display raw output on the fly (if the kpart is too silly to parse the diff) + +2003-04-14 Amilcar Lucas + * Updated integrated Doxywizard (Doxygen Configuration GUI) to 1.3 version. + This maintains full backward compatibility with previous Doxygen versions. + +2003-04-11 Alexander Dymo + * Applied rubysupport part, including application and filecreate templates + Ruby support is created by Marek Janukowicz . + * Implemented CPPFLAGS and LDFLAGS input fields in "Configure Options" + dialog for Automake Manager. + * plugins/gccoptions: + "Compiler Options" dialog now honors unrecognized user-defined options, + more predefined compiler warnings are available. + +2003-04-10 luc willems + * add support for perl filecreate templates + * make sure declaredinfile is set correctly after adding an item to classstore so removeWithReferences() will work correctly + * add parsing of "use" file after saveFile() + +2003-04-09 Harald Fernengel + * Applied ClearCase part from Ajay Guleria + * Goto error now works again + +2003-04-08 Caleb Tennis + * Retag Alpha 4 + +2003-04-05 Alexander Dymo + Applied patch from Luc Willems : + Classview: + - add support for scripts folder in classviewer + Pelrsupportpart: + - add support for namespaces and scripts in classviewer + - parsing of "use ...." libraries + - get list of INC path in local installed perl to allow parsing of perl + libraries outside the project directory + +2003-04-05 Amilcar Lucas + - Simplified the "Inteligent messages auto-hide" code a lot + - Now it also works for AutoMake&friends and configure + +2003-04-01 Alexander Dymo + * C/C++ "New class" dialog improvements: + - Nested namespace support + +2003-03-30 Julian Rockey + * parts/appwizard + - added proposed replacement for highly broken dcopservice template + +2003-03-29 Alexander Dymo + * C/C++ "New class" dialog improvements: + - Editor for base class file names + - Base class include files can be set as global or local + - Customizable templates for c++, objective-c, gtk classes + - Various global generation options (uppercase and lowercase names, etc.) + +2003-03-29 F@lk Brettschneider + * applied patch of Luc Willems + that highly improves the class tool-view for Perl projects + (classes, global functions and variables support) + +2003-03-29 Amilcar Lucas + * Implemented intelegent bottom view autohide. + +2003-03-26 Roland Krause + * Renamed main.f77 to main.f and adopted the various files. + The simple hello world fortran application now works. + +2003-03-26 Roberto Raggi + * added showPart() to KDevPlugin + * added KNotes plugin (ported from Kontact plugin) + +2003-03-25 Roberto Raggi + * improved the plugin framework + * added DCOP interfaces for FilterPart and CppSupportPart + +2003-03-21 Roberto Raggi + * better support for namespace and inner classes + +2003-03-21 jbb + * src/debugger.* + - Finally, after many years, the "sliding" breakpoint problem + has been solved thanks to the initial efforts of + Andras Mantia (Mantia Andras ) + See bug 48732. + +2003-03-20 Roberto Raggi + * improved code completion + +2003-03-19 Caleb Tennis + * Tagged Alpha 4 + +2003-03-18 Caleb Tennis + * Modified IDEAl panel layouts to be a little smarter (hopefully) + * Committed patches by Amilcar do Carmo Lucas + +2003-03-18 Roberto Raggi + * added the new "Add Methods" wizard + * added the new "Add Attributes" wizard + +2003-03-15 F@lk Brettschneider + * applied patch of Jens Zurheide (jens.zurheide@gmx.de) that fixes some bugs + +2003-03-13 Alexander Dymo + * DevHelp documentation support for KDevelop. + All documentation collections for GNU/GNOME developers from + http://lidn.sourceforge.net/ are supported. Existing DevHelp + installation can also be scanned for documentation. + +2003-03-13 Julian Rockey + * CTRL-/ does buffer switching, emacs-style + +2003-03-11 Julian Rockey + * parts/filecreate + - finally got round to replacing file dialog with smaller, leaner widget + +2003-03-11 Caleb Tennis + * added library version number support for QMake project + +2003-03-10 Caleb Tennis + * added "staticlib" support for QMake projects + +2003-03-09 Roberto Raggi + * added back/forward actions for the documentation browser + +2003-03-07 Alexander Dymo + * New configuration options for the documentation browser. + It is now capable of using any doxygen and kdoc documentation, + not only kdelibs documentation. + +2003-03-07 F@lk Brettschneider + * added third level called "Very short compiler output" + * now you can switch between the output versions without recompiling + +2003-03-06 Stephane ANCELOT + * enhanced grepview, there is no need to display the filename in each line + +2003-03-06 Roberto Raggi + * Added support for tmake projects + * Added template for QTopia 1.6 + +2003-03-05 Alexander Dymo + * Documentation browser is now able to handle all Qt documentation including + custom *.xml documentation. Configuration options are also available. + * GTK tocs renamed to GNOME 1.0 API Reference. Incorrect links fixed, Bonobo + chapter included. More to come. + * Started adding W3C TR tocs to the documentation browser. + +2003-03-02 F@lk Brettschneider + * completed the new behaviour of the make-output view + (can be configured via contextmenu or Gideon settings dialog) + +2003-03-01 Roberto Raggi + * added javahello template to appwizard + +2003-02-28 Roberto Raggi + * reenabled java support + * removed obsolete kdevelop java plugin template + +2003-02-27 Victor Rder +* Started to restructure the Autoproject part + -> Splitted AutoProjectWidget in + * AutoSubprojectView + * AutoDetailsView + * AutoListViewItems + * AutomakeManager (not finished) + -> More to come + -> However, an auto-tools expert would be nice now +* Made the "C++ new class dialog" a little bit nicer + +2003-02-27 F@lk Brettschneider + * make-outputview: now context menu allows to disable line wrapping, to set a short and smart compiler output (good for novices) and to suppress directory navigation messages. (TODO: save this to KConfig) + +2003-02-26 Eray Ozkural (exa) + * parts/cppsupport: fix nasty inner class bug (part of bug 45998). Determine + whether we are at global scope, and then insert class/struct accordingly to + class store. This one goes for you Roberto ;) + +2003-02-26 jbb + * parts/debugger + - Fix display of function parameters. + +2003-02-25 F@lk Brettschneider + * KDE-3.0 compile fixes + * some (runtime) warning output removed + * make-outputview: scrolling during compiling possible without immediate auto-scrolling to the bottom + +2003-02-24 Roberto Raggi + * improved the background parser + * better syncronization between background parser and cppsupport part + +2003-02-23 Roberto Raggi + * use the new c++ parser to fill the class browser + * remove ParsedStruct + +2003-02-23 Caleb Tennis + * Bug and Compilation Fixes + +2003-02-21 Alexander Dymo + * Subclassing widgets based on ui-files is now available in automake project manager too. + * Iterative subclassing for existing subclasses is available too. + * Subclassing is moved to cppsupport. + +2003-02-20 Roberto Raggi + * Added Make-member feature to c++ support. + * Added Realtime class browser + +2003-02-19 F@lk Brettschneider + * QEditor find dialog improved: + - don't stop at end of file but loop to begin (makes much sense when starting from cursor) + - use text selection as search string + +2003-02-17 Hamish Rodda + * parts/outputviews + - added detection of k_lineinfo output to application output view + +2003-02-13 Eray Ozkural (exa) + * lib/structure: + - fix: Trie_Impl apply() should apply only to non_empty + components + - update docs, planning to take over the world again + +2003-02-12 jbb + * parts/debugger + - Sync source with thread patch in kdevelop2.1.x. Some bits were missed + from a previous merge. This should fix some thread issues. + - Fixed: In some situations locals were not displayed. + Note: Parameters may still be missing depending on the fn sig. + - Fixed: Can't find source problem due to QRegExp too greedy. + Note: The "finish" command can still have some odd behaviour + due to an extra line output (which may be gdb version dependent). + +2003-02-11 Eray Ozkural (exa) + * lib/structure: + - implemented take(), I wonder why I left it like that + - fix: size() returns number of components + +2003-02-11 Mickael Marchand + * parts/svn: + - added an output window for subversion (just like CVS) + - removed i18n("Subversion") so that translators does not translate it + anymore :) + +2003-02-11 Eray Ozkural (exa) + * lib/structure: + - Trie: implemented higher order application function + - KDict: implement setAutoDelete interface of QDict + - don't install test binary + * lib/qextmdi: + - use KDict instead of QDict, more to come ;) + * parts/filecreate: + - fix: Add cpp and h types by default when there is + no template directory in project + +2003-02-11 F@lk Brettschneider + * took the patch of Jens Zurheide (Thanks jens.zurheide@gmx.de!) and modified it a bit. + Additionally to the already existing ALT+Left/Right switching (which switches the views + in the order of they were opened), now there is also ALT+Up for switching between views + in the order of how they were last accessed, and ALT+Down for the opposite. Hold ALT + pressed and repeat Up or Down to cycle through the views. + +2003-02-11 Alexander Dymo + * parts/filecreate: + - GUI for both global and project level configuration added. + +2003-02-09 Jakob Simon-Gaarde + * trollprojectpart: The dialog for subclassing widgets based on ui-files now works + iteratively, so you can update your subclasses according to the changes made in + the ui-files. + +2003-02-09 F@lk Brettschneider + * bugfix: classview now alphabetically sorted again + * KDevPlugin interface extended with 'KDevMakeFrontend* makeFrontend()' which made it + possible to raise the messages view on 'Build' + +2003-02-05 F@lk Brettschneider + * now it compiles and runs on KDE-3.0.x again + +2003-02-04 Mickael Marchand + * parts/svn: + - update to subversion 0.17, minor API changes + +2003-02-04 Roberto Raggi + * added text hints support to qeditor + +2003-02-04 F@lk Brettschneider + * interface changed: KDevTopLevel renamed to KDevMainWindow, topLevel() renamed to mainWindow() + * bugfix: proper work of session restoring of maximized views in Childframe mode + * bugfix: avoid doubled menu entries for switch for showing/hiding of toolbars + +2003-02-03 F@lk Brettschneider + * bugfix: env vars now possible for URL of documentation views, means Qt docu works again + * bugfix: show full filename in view caption (Childframe UI mode) + * bugfix: use default icon for views in case that an icon wasn't assigned + * bugfix: use 16x16 size for view icons (Childframe UI mode) + +2003-02-01 Alexander Dymo + * parts/cppsupport: + - Advanced Inheritance feature in "New Class" dialog: + automated constructor creation, method overriding + and access modifiers upgrading using base class + descriptions from the project class store + - Class is O_OBJECT option in "New Class dialog" + - Generate GTK class option in "New Class dialog" + +2003-01-30 Julian Rockey + * lib/interfaces, src: + - Make CreateFile interface available globally. + * parts/autoproject: + - Use CreateFile interface if available for creating new files + +2003-01-27 F@lk Brettschneider + * QEditor-Plugin: Ctrl+Left, Ctrl+Right, Ctrl+Del and Ctrl+Backspace much more better now + +2003-01-24 Harald Fernengel + * default keys to move to next/prev window are now + ALT-Right / ALT-Left (as in kate) + +2003-01-18 Alexander Dymo + * cppsupport: + - improve new class dialog + - support multiple inheritance for c++ classes + - cosmetic improvements + +2003-01-17 Harald Fernengel + * made CVS shell configurable, you can now use CVS via ssh. + Note that only password-less logins are supported, + so generate your public/private key today! + +2003-01-15 Mickael Marchand + * made "Close Others" (tabs) work + +2003-01-15 Julian Rockey + * parts/filecreate + - added "New" option into Gideon's "File" menu + +2003-01-14 Mickael Marchand + * repaired subversion part + * added svn diff support (trough the diff viewer) + +2003-01-14 Harald Fernengel + * added KDE simple application template (khello) + * the copyright year for auto-generated files is now the current + year instead of the hard coded "2001". + +2003-01-12 Julian Rockey + * parts/filecreate + - prettier file creation widget + - support for global file templates + +2003-01-11 F@lk Brettschneider + * parts/fileview (called 'view on the project directory'): + like used from KDevelop-2, directories now sorted above the files + +2003-01-10 Julian Rockey + * parts/autoproject: + - be a bit smarter when adding files to directories that have only one target + - be a bit nicer to files in the project root directory + * parts/filecreate + - add some global file templates to be stored in $datadir/kdevfilecreate/file-templates + * lib/util/filetemplate + - look in global directory for templates if not found in project directory + +2003-01-09 Eray Ozkural (exa) + * revived lib/structure: + - has a working Trie class now (tested with g++-3.2) + - add an adaptor called KDict which is supposed to be + a drop-in replacement for QDict + +2003-01-08 Julian Rockey + * parts: + - added new part to assist with creation of new files + * lib/interfaces: + - added interface for new file creation + * lib/util: + - added urlutil, general URL manipulation utilities + +2003-01-07 Jakob Simon-Gaarde + * Append to libpath in subproject configuration dialog + +2003-01-07 Eray Ozkural (exa) + * cppsupport: + - improve new class dialog + - refactor and improve class generation code + - support file templates + - cosmetic improvements + - layout improvements + - add option for objective-c + - add new file templates + * lib/util: + - enhance FileTemplate + - start a Locate facility + * doctreeview: improve library doc dialog + +2003-01-07 Julian Rockey + * Added PyQT template (QT application framework for Python) to appwizard + +2003-01-06 Victor Rder + * Applied patch of Richard L�k�g for top source directory support (only in Autoprojectpart yet!) + * Applied patch of Hamish Rodda for a more stable PartController::editDocument(...) + * Minor changes to Autoprojectpart + +2003-01-05 F@lk Brettschneider + * MDI taskbar is back as Viewbar (TODO: read config if on/off on startup) + * switching the QextMDI user-interface modes now immediately and properly via Options dialog again (extended KDevTopLevel interface therefore), fixed names in the ui mode chooser dialog + * accept perl scripts for the loading in the text editor + * problem reporter accepts import/export macro in class declaration (patch by Roberto Raggi) + +2003-01-04 Jakob Simon-Gaarde + * UI-subclassing finnished in qmake manager. + (activate by rightclicking on a ui-file) + +2003-01-04 Roberto Raggi + * Added Auto Expand mode + +2003-01-01 Caleb Tennis + * Add linebreaks for data being copied from make output window + to clipboard + +2002-12-31 Caleb Tennis + * Fix keyboard accelerator keys for File menu..no conflicts + * Fix broken signal/slot connections in code + * Add RMB context menu to ideal mode tabs to allow file closing + * Add ability to configure output window fonts + * Make classview show struct information + +2002-12-29 Harald Fernengel + * Added valgrind part, requires installed valgrind + parses and displays valgrind's output in a listview, + tries to auto-guess the location of the memory leaks in + the project + +2002-12-18 Caleb Tennis + * Hack to fix KTabZoomFrame from going smaller than the + sizeHint() of the part it is loading. This needs more work, + but is a start + * Close the KTabZoomFrame if the current loaded part is closed + +2002-12-26 Caleb Tennis + * Get AppWizard name and email settings from KDE emaildefaults + file if it's available + * Applied fix to KTabZoomWidget to enable hide button when docked + and set minimum size to 175 (by Dominic Battre) + * Applied patch to fileselector to store filter history + (also by Dominic Battre) + * Added ability to select filename settings (lowercase, + uppercase, mixedcase) when using the Add Class dialog + +2002-12-23 Caleb Tennis + * Fixed bugs with python support; patches by Julian Rockney + (linux@jrockney.com) + +2002-12-22 F@lk Brettschneider + * QEditor: double click selection improved + * renaming of main window classes, the names were confusing + +2002-12-18 F@lk Brettschneider + * QEditor: can now delete words via Ctrl+Backspace and Ctrl+Del + * new class TopLevelShare, moved doubled stuff to it from the 2 main widget classes + * implemented tool-/status-/view-bar on/off actions in 'Settings' menu + +2002-12-18 Victor Rder + * Added "Choose Target Dialog" + * Added SLOTS for removing/adding many files + to KDevProject + -> Now KDevProject handles files with relative + paths (to project directory) + * Replaced SIGNALS for removing/adding a single file + -> Adapted this to the other parts + * Fixed a "Add Subproject" bug + * Found other bugs to be fixed + * Minor improvments on Automake Manager + -> More to come + +2002-12-17 Jakob Simon-Gaarde + * Still working on extended DOM path/automatic subclassing from ui-templates in qmake-projects + +2002-12-17 F@lk Brettschneider + * Childframe UI mode (not maximized): opening of new views fixed concerning the positioning and resizing + +2002-12-16 Roberto Raggi + * bugfix: useless "()" string is attached to the method declaration patch from Andreas Wuest + * added emacs like wordwrap mode to qeditor + * added ocaml colorizer to qeditor + +2002-12-16 F@lk Brettschneider + * bugfix: now Partloader loads editor part exactly as set in common Gideon editor settings + * this makes the Kate editor now also availabe for the KDE-3.0.x-compiled Gideon. + +2002-12-15 Harald Fernengel + * added new RMB menu item for text documents: difference to saved file + that will show you the modifications since your last save. + +2002-12-15 F@lk Brettschneider + * breakpoint support in QEditor completed + +2002-12-13 F@lk Brettschneider + * added breakpoint support in QEditor (not yet finished) + +2002-12-12 Jakob Simon-Gaarde + * Added a new extended path ability to DomUtil so that the path can be qualified on attributes + and multiple matches can be addressed with a zero-based index + +2002-12-12 F@lk Brettschneider + * compiles/runs on KDE-3.0 as well again + * backported KWidgetAction and KTextEditor::MarkInterfaceExtension from KDE-3.1 to KDE-3.0-compiled Gideon + +2002-12-07 Jakob Simon-Gaarde + * getActivedir() corrected in trollproject + +2002-12-07 Jakob Simon-Gaarde + * Altered the Appname/location confusion in appwizard + +2002-12-05 F@lk Brettschneider + * now also parts can load/save the project-related session by overriding the base class method in KDevPlugin + * as an example, I moved changed some c++-debugger stuff to write to .kdevses instead of .kdevelop + (since every user has its own settings and the .kdevelop file would conflict in CVS) + +2002-12-04 Caleb Tennis + * Added ability to open ui.h files easily in QMake Manager with right click popupmenu. + +2002-12-03 F@lk Brettschneider + * now session saves/loads cursor position; + and view geometries in Childframe UI mode + +2002-12-02 Caleb Tennis + * Added configuration option to set environment variables before + running "Automake & Friends". Patch provided by Hannes Mehnert + (hannes@gentoo.org). + +2002-12-01 Sebastian Kratzert + * New configuration for external documentation (toc docs) + +2002-12-01 F@lk Brettschneider + * ported KDevSession (.kdevses) over from KDevelop-2, now called ProjectSession. + Not finished but already does what removed ProjectWorkspace did. More to come... + +2002-11-28 Victor Rder + * Added "Remove target" to Automake Manager + * Minor fixes + +2002-11-28 F@lk Brettschneider + * QEditor defaults to KDevelop-2 syntax highlighting colours + * some bugfixes for the QextMDI-based UI modes + * properly installs and loads the toolbar icons also when compiling Gideon on KDE-3.0.x + +2002-11-26 Caleb Tennis + * bugfixes in TopLevelMDI; Remove the docking section from gideonrc! + Then the state of tool-views should be properly restored when starting + +2002-11-24 Harald Fernengel + * Added QRegExp and KRegExp to RegExpTester + +2002-11-23 F@lk Brettschneider + * now QextMDI-based mainframe loads/saves its docking state, extended KDevTopLevel interface therefore + +2002-11-19 Caleb Tennis + * Prepped for Alpha 2 Release - KDEVELOP_3_0_ALPHA_2 + +2002-11-16 Harald Fernengel + * Added ability to raise the left/right/bottom toolviews in IDEAl mode + * Added tooltips for IDEAl buttons + * appwizard now handles special characters better + +2002-11-09 August Hrandl + * cppsupport: addclassattributedlg, cppaddmethoddlg und cclonefunctiondlg use + the classstore (project and pre-parsed libraries) for completion of type names + +2002-11-08 Sebastian Kratzert + * Reenabled KDELibsKDoc folder and made it removable + +2002-11-07 F@lk Brettschneider + * extended interface class KDevTopLevel in a way that parts can specify view icons and tab-tooltips + * adapted all parts to use this feature, now KDevelop in one of the 3 MDI modes looks more like KDevelop-2 + +2002-11-05 Yann Hodique + * new interface for global vcs actions + * new page for appwizard : vcs system choice + * global cvs part + +2002-11-05 F@lk Brettschneider + * adaption to KDevelop-2 behaviour: only show c++-debugger views when debugging + * and applied new patch of Heinz Hornung + that introduces View-->TreeToolViews and View-->OutputToolViews again + +2002-11-03 Sebastian Kratzert + * qt documentation-tree now is generated with informations from QT_DOCDIR/html/qt.xml + * disabled DocIndexDlg + * results.html of htdig now shows all pics + * made location of project documentation configurable + +2002-11-02 Sebastian Kratzert + * Merged DoctreeConfig widget into one. + * Removed KDoc folder + * Use KURLRequester instead of LineEdits + +2002-11-01 Sebastian Kratzert + * added "Search in documentation" to editor contextmenu + * index kdoc folder on selection + +2002-11-01 F@lk Brettschneider + * fix in parts/doctreeview: if the Qt docu isn't available via doxygen books, + fall back to the using of the Qt docu path set in the + Gideon options "Documentation tree I" + +2002-10-31 Bernd Gehrmann + + * Since khelpcenter/htmlsearch is no more, put htdig configuration + options in doctreeview config widget; ship html and pic files + for htdig + +2002-10-29 Victor Rder + * applied Sebastian Kratzert's search improvements + for the docViewPart + +2002-10-28 F@lk Brettschneider + * compiles with KDE-3.0.3 again + +2002-10-21 Harald Fernengel + * show modified flag in sdi-mode if a file has + been modified + * added KSaveAllDialog that is shown if more than + one file is modified and needs to be saved. + * Display a nice error message if gideon cannot + find its plugins. + +2002-10-14 Victor Rder + * beautified some dialogs + - cppsupport/cppaddmethoddlgbase.ui + - tools/addtooldlg.ui (again) + - autoproject/addaplicationdlgbase.ui + - autoproject/addservicedlgbase.ui + - autoproject/addsubprojectdlgbase.ui + * added README to autoproject directory + +2002-10-11 Caleb Tennis + * modified the splashscreen to not stradle multiple screens + with Xinerama installed + +2002-10-11 Harald Fernengel + * added open recent files action + * beautified "add tool dialog" + * recognize "makefile" and "Makefile" as makefile + +2002-10-08 Harald Fernengel + * compile qEditor only if Qt >= 3.0.5 + * don't build sourcenav since it is obsoleted by history part + +2002-10-07 F@lk Brettschneider + * applied patch of Heinz Hornung + improved window menu, old windowmenu part removed + +2002-09-25 Yann Hodique + * Implemented some features in distpart + * Fixed a few bugs + +2002-09-20 Roberto Raggi + * Added statement rules to c++ parser + +2002-09-19 Roberto Raggi + * Improved code completion + +2002-09-17 Roberto Raggi + * Added problem reporter to c++ support + +2002-09-05 Harald Fernengel + * Added notification configuration dialog and notifications + for finished processes (off by default) + +2002-08-31 Jakob Simon-Gaarde + * Connected the last toolbar buttons + * I hereby declare trollprojectpart ready for alpha release :) + +2002-08-31 Jakob Simon-Gaarde + * trollproject - added compiler/linker flags, includepath + +2002-08-30 John Firebaugh + * Implemented dynamic loading/unloading of plugins. + Some project plugins need to be fixed; I guess they expect to + get a projectLoaded signal, but a project is already loaded. + Might want to eventually refactor plugin loading code in + projectmanager to plugincontroller. + +2002-08-30 Jakob Simon-Gaarde + * removed trollproject runoptionwidget using common lib/project/runoptionswidget + * added browse button to common runoptionwidget + +2002-08-29 Jakob Simon-Gaarde + * Trollproject Part + * added new project run options widget + +2002-08-28 Mickael Marchand + * Subversion kpart: + * Added log window to display retrieved logs from repositery + +2002-08-27 Mickael Marchand + * Subversion kpart: + * Notifications displayed in 'Application' view + * Prompt dialog (login/pass) added (untested yet) + * New SVN functions support : Revert, Status + * Removed "SVN:" stuff from logs + +2002-08-27 Harald Fernengel + * Added ability to edit toolbars in SDI and MDI mode + * fixed crash on exit (windowmenu part) + +2002-08-26 Mickael Marchand + * Added commit dialog to subversion part + * Prepared notification system + +2002-08-26 Harald Fernengel + * Better syntax highlighting for "cvs log", added ability to show diffs between versions + +2002-08-25 Mickael Marchand + * Imported first version of Subversion kpart + +2002-08-24 Jakob Simon-Gaarde + * Applied first simple QMake based project template in appwizard + +2002-08-22 Harald Fernengel + * applyed patches by Hornung-Heinz@t-online.de (Heinz Hornung): + don't crash on exit + * applyed patches by Yann Hodique (DocBrowser and FileTemplate updates) + * Since there is no right pane in MDI modes, add select views to the left + (Automake Manager and Documentation Browser are now available again in MDI mode) + +2002-08-19 Jakob Simon-Gaarde + * trollproject: + * File exclusion on qmake-scope-level now working + +2002-08-18 Victor Rder + * Applied Yann Hodique's cvspart patch + +2002-08-09 Jakob Simon-Gaarde + * trollproject: + * Added toolbar to file tree + +2002-08-13 Harald Fernengel + * Applied goto next / prev window patch by Yann Hodique + +2002-08-11 Victor Rder + * Applied Sebastian Kratzert's search-extension-diff<2> + +2002-08-09 Jakob Simon-Gaarde + * trollproject: + * Done implementing projectconfiguration dialog + * Added toolbarbuttons in the project tree + +2002-08-06 Harald Fernengel + * AppWizard fix, KDevelop plugin template ported to new architecture + +2002-08-05 Matthias Hlzer-Klpfel + * Removed kdevelop source, to prepare for an alpha release + +2002-08-04 Christian Couder + * Fix a few appwizard bugs. + +2002-08-03 Jakob Simon-Gaarde + * trollproject: + * Projectconfiguration dialog has been added + * Fileproperty dialog added for excluding files in subscopes + +2002-08-02 Harald Fernengel + * Changed the diff part from a modal dialog to an outputview + +2002-07-30 Harald Fernengel + * Added a "diff frontend" to allow other plugins use the diff part. + * Implemented it for CVS, so you can now view the differences to the + repository. + * Applied patch by "Caleb Tennis" : + ask whether a file should be removed from the recent project + list if it doesn't exist anymore + +2002-07-29 Harald Fernengel + * Added a part to show diffs either in the widget from Kompare (->KDESDK) + or in a QTextEdit if Kompare is not installed. + +2002-07-27 Matthias Hlzer-Klpfel + * Added a part for ant based projects. + +2002-07-24 Roberto Raggi + * added a new java parser based on ANTLR + +2002-07-23 Roberto Raggi + * updated qeditor to qt 3.0.5 + +2002-07-19 Daniel Engelschalt + * changes concerning the classstore are taking effect without restarting + * parsing of project directory works again without having persistance :) + * fixed some annoying bugs in ccconfigwidget + +2002-07-17 Victor Rder + * added a simple search mechanism to the Documentation Browser + -> but not really efficient :-( + -> TODO: Toy with a few ideas... + +2002-07-15 Jakob Simon-Gaarde + * trollproject: + * trollprojectwidget: + * The projectmanager now supports qmake scopes + ( very large step towards completion of the trollprojectpart ) + +2002-07-15 Matthias Hlzer-Klpfel + + * Exchanged old javasupport part with the beginnings of a new one, + * written entirely in C++. + +2002-07-07 Victor Rder + * repaired layouting of some Automake dialogs + * adapted the the look of all Automake dialogs + * add blue bullet to the make output view + +2002-07-01 Jakob Simon-Gaarde + * trollprojectpart: + * trollprojectwidget: + * Can now insert files and subdirs (.pro files are altered dynamically) + + * Simple qmake projects can now fully be created and maintained from kdevelop + Currently working on handling more complicated .pro files with scopes. + +2002-06-30 Victor Rder + * continued the import existing dialog + -> ONLY adding existing files works at the moment! + * add Bjrn Sahlstrm's drag 'n drop support to the FileSelector + -> see kfilednd*view.* for details + * added new bullets to the make outputview + * everything needs a little bit code clean-up, so don't worry :-) + +2002-06-29 Jakob Simon-Gaarde + * trollprojectpart: + * FileBuffer: + * added FileBuffer::removeValues() removes all values for a variable + in the .pro buffer + * added FileBuffer::setValues() alter buffer set qmake variable values. + This enables files and subdirs to be added and removed. + * added FileBuffer::saveBuffer() save buffer to file. + +2002-06-28 Jakob Simon-Gaarde + * trollprojectpart: + * filebufferclass added to buffer .pro files + (+filebuffer.cpp, +filebuffer.h) + * Caret pointer for FileBuffer class + (+caret.h, +caret.cpp) + * FileBuffer: + * added FileBuffer::findInBuffer(), find substring return Caret-pointer + * added FileBuffer::getValues() gets values for a qmake variable + handles '=' and '+=' operators (still to add '-=', '*=' and '~=') + return QString of space separated values + * trollprojectwidget: + * .pro file parser rewritten ( trollprojectwidget::parse() ) + * reads forms (.ui files) + +2002-06-28 Matthias Hlzer-Klpfel + * save and restore the dock mode in IDEAl + +2002-06-27 F@lk Brettschneider + * avoid library version clash between qextmdi of Gideon and KDevelop-2.1 + +2002-06-23 Matthias Hlzer-Klpfel + + * Made doxygen config widget "human readable" + * Preset doxygen configuration so it works out of the box + * Added a custom layout manager to the IDEAl buttons + unfortunately, only the horizontal ones stack. Someone + forgot a "widthForHeight" in QLayoutItem... + * added sticky mode for IDEAl ui mode + +2002-06-23 Bernd Gehrmann + + * jbb autoproject patch: Resolve $(VARIABLES) in SUBDIRS + declaration with the help of variables defined in Makefile.am + * Parse #kdevelop: lines in Makefile.am. This way, conditional + subdirs can be resolved. See parts/Makefile.am for an example + * Make documentation created with the configure option + --with-apidocs in kdelibs browsable + +2002-06-23 F@lk Brettschneider + * updated QextMDI copy with its upcoming version 3 + - drops Qt2 support + - adds view closebutton for TabPage mode + +2002-06-20 Bernd Gehrmann + + * Ported my KDE architecture documentation to + docbook; it's now in doc/kdearch. + * New kdeapi ioslave. This allows it to hyperlink + to Qt and kdelibs doxygen documentation in + DocBook documents without having to care for the + location of the docs. + * Settings widget for qt/kdelibs doxygen docs + location (autodetected by configure if it exists). + * Restore documentation windows in html part + instead of editor part. + +2002-06-13 John Firebaugh + * Debugger: be very smart about libtool. + +2002-06-14 Roberto Raggi + * qeditor: added keyboard macro support + +2002-06-13 Eray Ozkural (exa) + * classview: + - fix hierarchical view (It showed only a single + level of directories) + - make hierarchical view default (a la 2.x) + - don't use sort(), as suggested by Bernd + - remove obsolete sortFolder() <-- won't work anymore + * cppsupport: add file templates for .cpp and .h + * hack old kwrite-part a little to bring it up to date + (not finished) + * Add TODO items suggested by Falk + +2002-06-12 Matthias Hlzer-Klpfel + + * Improved buttons in IDEAl mode: added keyboard navigation + and styleability. + +2002-06-12 Bernd Gehrmann + + * Compiling of single files in auto and custom project parts + * Set waitCursor while ctags is running + * cvs log message quoting fix + * Bullets in make output view. + Based on a patch by Marcus Gruendler + +2002-06-11 John Firebaugh + Debugger bugfixes: + * Use core stop button and signal + * Actually shut down gdb when stopping + * Do the right thing when the program exits + * Load the config settings correctly + * Don't show application output in external konsole by default + * Use same menu item for start/continue + +2002-06-10 John Firebaugh + * New breakpoints widget. Uses KListView. + * Breakpoints should sync with document much better now. + +2002-06-10 Bernd Gehrmann + + * Made class display (flat list vs. directory hierarchy) configurable + +2002-06-09 John Firebaugh + * debugging breakpoints now work much more sensibly + * can use kate icon-border menu to enable/disable + * properly move execution point + +2002-06-09 Matthias Hlzer-Klpfel + * partcontroller now compares inodes instead of URLs + when the files are local + +2002-06-09 Eray Ozkural (exa) + * autoproject: get rid of symlinks in project directory + * classview: consider source dirs at any level, rather than 2 levels deep + * classview: show source dir hierarchy + +2002-06-07 Eray Ozkural (exa) + * add default support to DomUtil + * doctreeview: add configuration for Qt/KDE libs + * cppsupport: add configuration for file templates + +2002-05-31 Bernd Gehrmann + + * kdevprj2kdevelop for converting project files + and creating file lists + +2002-05-30 Bernd Gehrmann + + * In class view, arrange classes in folders if they + are more than one level below the project directory + +2002-05-29 John Firebaugh + * Added ProjectWorkspace. Save and restore opened files with project. + +2002-05-29 Harald Fernengel + * perforce part: implemented edit and revert + * perforce part: added submit dialog + +2002-05-28 Roberto Raggi + * qeditor: added find/replace dialogs + +2002-05-27 Harald Fernengel + * added perforce VCS part + +2002-05-27 Bernd Gehrmann + + * Show namespaced classes and structs in category mode + of the class view + +2002-05-26 Bernd Gehrmann + + * Implemented Goto ctags declaration and Goto ctags definition + +2002-05-25 John Firebaugh + * Add stop button. Core emits signal when processes begin/end. + TopLevel* connects and enables/disables stop button. + * Move project actions to ProjectManager. Removes much code + code duplication in toplevel_*.cpp. + * Allow opening project via command line/konqueror. + +2002-05-25 Roberto Raggi + * qeditor: Added code folding support + * qeditor: Added emacs-style indent mode + +2002-05-25 Harald Fernengel + * use KApplicationTree in tools-part to avoid code duplication + +2002-05-21 Roberto Raggi + * qeditor: Implemented markinterface + * qeditor: Implemented searchinterface + +2002-05-20 Matthias Hlzer-Klpfel + * Welcome in the 2000's: the Tools menu config + now uses ksycoca... + +2002-05-20 Harald Fernengel + * Outputviews: Uses bright font colors if widget background is dark + * Extended Tools Config: Show App-Tree to make it more comfortable + +2002-05-20 Roberto Raggi + * Ported qeditor to ktexteditor interface + * Fixed text insertion in abbreviation part + +2002-05-20 Bernd Gehrmann + + * Make sure headers are parsed before sources + * Big cleanup in cppcodecompletion. Generalized + some of the code and put it into classstore API. + More to come... + +2002-05-18 Bernd Gehrmann + + * Ported "Expand text" into abbrev part + +2002-05-16 Richard Dale + + * Fixed KDevelop compilation error by adding missing + PartController::setServiceType() method. + +2002-05-15 Bernd Gehrmann + * Big cleanup in class store, see my mail in kdevelop-devel + * Fixed persistant class store to not store + namespaced classes twice + * Fixed ClassStore::removeWithReferences() to delete + classes from all namespaces, not only the global one + * Class combo boxes can show global functions now + * Class combo boxes handle namespaced classes now +2002-05-13 Richard Dale + * Added .mm and .M source file extensions for Objective-C++ +2002-05-10 Bernd Gehrmann + * Put grep into editor context menu + * Put 'Lookup in Index' and 'Goto manpage' + into editor context menu + * Put 'Lookup in Index' and 'Search in docs' + into documentation context menu + * Implemented 'Run to cursor' in debugger part + and put 'Watch: foo' into editor context menu + * Removed lots of code duplication in tools config + * Tools can be added by DnD from kicker menu + * Some preparations for loading files with a + prescribed encoding +2002-05-06 Bernd Gehrmann + * Fixed history part crashing + * StatusBar cleanup + * Fixed ever-growing popup menu in editor + * Tool menu and the file and directory context + menus can now be populated with any shell + command. Output can be sent to the app output + art. %S, %D, %T and %W magic works like + in old KDevelop (I hope :-) +2002-05-03 Bernd Gehrmann + * Structure view for HTML, Docbook and LaTeX + * Perl part can exec programs and code snippets now + * Moved duplicated code for executing programs in + an external konsole into the app output part +2002-05-01 Bernd Gehrmann + * Limit size of class and method combo boxes + * Offer to rerun configure only if configuration + has changed +2002-04-30 Bernd Gehrmann + * Implemented fileFilters() for cppsupport + * Methods and classes can now be added when no file is loaded + * Don't parse headers twice, now that they are included in + AutoProjectPart::allFiles() + * Allow adding and removing files from custom project + * Do nothing if an organizer item in the class view is clicked on + * Bug fix in trollproject by Ludovic LANGE + to handle continuation lines in .pro files + * In trollproject, distinguish executed() and selectionChanged() + signals properly, improved context menus, started Remove File + implementation; made it possible to run qmake on any project + file; polishing +2002-04-29 Bernd Gehrmann + * Display header files in automake manager + * Add Icon dialog + * Allow to build index.cache.bz2 by context menu + * Multiple build configurations +2002-04-28 Sandy Meier + + * fixed some broken stuff (load project on startup,GBA support,php code completion) + * codeCompletion/realtimeparser is now configurable (GUI) + * readded gideonrc +2002-04-28 Bernd Gehrmann + * Renamed KDevProject::allSourceFiles() to allFiles(), as it isn't + restricted to sources. It doesn't contain duplicates anymore. + * Handle AUTODIRS + * Handle foo_ICON + * Handle KDE_DOCS +2002-04-28 Matthias Hlzer-Klpfel + + * Added a part providing a history, allowing you to go + back and forward + * Added splashscreen. Now we need an artist! :-) +2002-04-28 Harald Fernengel + * SourceNavPart now uses KToolBarPopupAction to display nifty + Konqueror-like drop down menus for source code navigation +2002-04-27 Bernd Gehrmann + * Context menu actions in auto project act on context + item, not active target + * Use selectionChanged() instead of executed() signal + in overview widget, so that the shown targets are + always those in the selected subproject + * Disable toolbuttons when subproject empty + * Data groups cannot be 'built' and they have no target options + * Replaced all usages of QCString in auto project + by QString and saved 35783 latin1 conversions ;-) + * Create popup menus with parent widget + * Made is possible to edit .desktop files +2002-04-26 Harald Fernengel + * Added first version of SourceNav Part which adds back/forward tool-buttons for code navigation. + * Allow user to open more than one file in KFileDialog +2002-04-25 Matthias Hlzer-Klpfel + * started support for debugger handling via the new + KTextEditor interfaces + * started with new documentation part handling + * added a workaround to open all text files with the + same editor plugin +2002-04-24 Victor Rder + * renamed Project view to Automake Manager + * reorganized Automake Manager + * added lowerAllViews() to KDevTopLevel + -> only implemented for TopLevelSDI! + * added some pixmaps + * Some dialogs done with QT Designer + -> RemoveFileDlg + -> AddFileDlg + -> AddExistingDlg (does not work, yet) +2002-04-24 F@lk Brettschneider + * bugfix for QFocusEvent::m_reason in QextMDI copy, it stabilizes the optimized focus mechanism +2002-04-23 Bernd Gehrmann + * Removed redundant loadparts property from project file + * Added isDirectory() to FileContext, so one can distinguish + between regular files and directories. + * Added "Insert quoted" button to regexp part +2002-04-22 Bernd Gehrmann + * Only program and library targets can be made active + * Sane resizeMode and allColumnsShowFocus settings for more list views +2002-04-21 Bernd Gehrmann + * Implemented setting active target in autoproject + part and set a default one in most app templates + * Set resize mode of some list views to LastColumn + * In auto project, open active directory at startup + * Implemented addFile in auto project +2002-04-20 Bernd Gehrmann + * If no compiler is set explicitly by the user, + use the options widget of the default compiler + (Property X-KDevelop-Default in the .desktop file) +2002-04-19 Bernd Gehrmann + * In script projects, scan the source file list + at loading time with configurable include + and exclude pattern lists + * New file dialog in script project + * Implemented KDevLanguageSupport::fileFilters() + for Python, Perl and PHP + * grep part shows the exit status of the sub process +2002-04-19 Harald Fernengel + * make outputwidget now locale aware +2002-04-18 Bernd Gehrmann + * filter plugin + * Added methods addFile() and removeFile() + to KDevProject interface, implemented + in script and custom project parts + * Add File dialog in auto project uses the + FileTemplate class now + * Fixed displayed symbol kinds in ctags + dialog when file name extension is unknown + * ctags result list is now updated when + any of the selected criteria is changed +2002-04-17 Matthias Hlzer-Klpfel + * introduced a facade to access the KTextEditor interfaces + * removed some code from PartController that is no longer + needed +2002-04-17 Bernd Gehrmann + * Populate Build->Build Target menu in CustomProject + with targets from Makefile, build.xml resp. + * Use kdDebug() more consequently +2002-04-16 Matthias Hlzer-Klpfel + * added a bit more context to the EditorContext +2002-04-15 Bernd Gehrmann + * Share code between project management parts by + moving stuff to lib/project + * Separated file tree from custom and scripting + project parts into file view part, so that the + project parts do not have widgets themselves. + Hierchical file tree is KDirWatch'ed + * Builddir and build tool can be configured in + custom project now + * Merged KDevProject::openProject() and setProjectName() + * Added the notion of an activeDirectory() in which + new files are stored + * cerr -> kdDebug +2002-04-15 Matthias Hlzer-Klpfel + + * moved window menu code from src to a plugin + +2002-04-15 Simon Hausmann + * Completed transition to KDevPlugin and KGenericFactory. +2002-04-14 Bernd Gehrmann + * Support for multiple file templates in app wizard + * More work on new class dialog + * Extended DomUtil to lists and pair lists +2992-94-14 Matthias Hlzer-Klpfel + * Added a new part that provides a "Open with" file menu entry + * Fixes for saving project settings on shutdown + * Properly enable menu entries when loading "last project" +2002-04-13 Daniel Engelschalt + * classstore config now in cppsupport + * code hinting really works now with KTextEditor + * update project pcs-file at projectClose( ) +2002-04-13 Bernd Gehrmann + * Import dialog rewritten with designer, added author + and email fields + * When directory is selected in the import dialog, make + some guess work based on legacy project files, AUTHORS + and configure.in files + * Set /general/author and /general/email variables in + project file when creating new projects + * More keywords in app wizard + * Load Java debugger only for JVM programs + (keyword to be set by app wizard) +2002-04-10 Matthias Hlzer-Klpfel + * implemented setting the execution point + * move execution point handling from core to part controller +2002-04-10 Simon Hausmann + * ported the appwizard to KDP/KGF +2002-04-09 Matthias Hlzer-Klpfel + * ask user to save modified files before quitting +2002-04-09 Roberto Raggi + * fixed crash in KDevDocTree + * removed qextmdi from kdevelop directory +2002-04-09 Simon Hausmann + * cleanups in the servicetype definitions. Added proper inheritance + and multiple defined propertyies + * some std:: namespace cleanups + * added KDevPlugin as successor of KDevPart + * ported the konsole plugin to KDevPlugin + * ported the editor chooser plugin to KDevPlugin + * ported the code abbreviation plugin to KDevPlugin + * ported the astyle plugin to KDevPlugin + * ported the classview plugin to KDevPlugin + * ported the ctags plugin to KDevPlugin + * extended gideon to load global KDevPlugin components + * centralized the trader queries for KDevelop/Part (Plugin) with + the additional constraint for the plugin scope into a static + PluginController::pluginServices method + * moved the duplicated code for extracting the X-KDevelop-Args + property of a service into a QStringList into a static private + method of PluginController + * install kdevelop components as KDE modules, not as libraries + * PluginController: don't bail out of loading of a kdevpart failed + * load kdevpart as well as kdevplugin components at the project + scope +2002-04-08 Matthias Hlzer-Klpfel + * emit loadedFile and savedFile again + * added DCOP interface for kdevpartcontroller +2002-04-08 Roberto Raggi + * Fixed text insertion in Multi-language code template +2002-04-07 Bernd Gehrmann + * Fixed existing and potential memory leaks in class store + with a more modern api. Big textual changes, no changes + in semantics + * New class dialog, to be finished + * Multi-language version of Roberto's code template stuff, + not tested much +2002-04-06 jbb + * Fixed some crashes, mainly to do with using .latin1() on + a null string. + * Replaced cout with kdDebug (in a lot of places - part of + the above fix for crashes) + * fixed gcc3.0 compiler clash with define of out() in dbg.h + * Added K_DCOP to tokenizer, which fixed one cause of the latin1() + crash. + +2002-04-06 Bernd Gehrmann + * Python part can execute scripts and strings now +2002-04-06 Harald Fernengel + * ported editor-chooser to KTextEditor and re-enabled it + * PartController now loads user's favourite editor +2002-04-06 Matthias Hlzer-Klpfel + * moved all part handling functions from KDevCore to + KDevPartController + * enabled context sensitve popup menus in the text editor + * various fixes and workarounds for QextMdi modes +2002-04-05 Matthias Hlzer-Klpfel + * commited some patches by Bernd for fixing layout issues + * commited a patch by Bernd for reenabling the floating + debug toolbar + * reenabled context menu entries comming from parts + * added tiny part to select the UI mode +2002-04-04 Matthias Hlzer-Klpfel + * reenabled the RMB menu + * fixed the widget deletion when parts are closed + * mark the active document in the menu + * renamed the "Buffer" menu "Window" + * removed the MDI window menu + +2002-04-01 Matthias Hlzer-Klpfel + * added qextmdi to gideon + * made UI model configurable + * smaller refactorings in lib/interfaces + * moved toplevel view handling out of KDevCore to KDevTopLevel +2002-03-29 Matthias Hlzer-Klpfel + * migrated all parts to KTextEditor + * removed all traces of KEditor + * reenabled Tip-of-the-day +2002-03-26 Matthias Hlzer-Klpfel + * refactored the core source completely + * sneaked in a new UI concept + (which Harald probably will replace with QextMDI soon) +2002-02-24 Roberto Raggi + * improved code completion + * added quick hack for configuring the fonts for qeditor +2002-16-02 Daniel Engelschalt + * added codecompletion-classstore + * added removeWidget( ) + * added config-dialogues for codecompletion/classstores + * improved codecompletion + * added cc-stuff from roberto raggi +2002-10-02 Harald Fernengel + * Fixed KWrite Part and reenabled it again + * Added the Qt Editor Part (Qt Designer's Editor) +2002-02-03 Christian Couder + * Bugfix : crash in classviewpart.cpp because languageSupport() + was null. +2002-01-16 Richard Dale + * Java plugin api regenerated +2001-12-22 Eray Ozkural (exa) + * generate docs in all source dirs in Doxyfile + and enable dot output + * kdevelop2 project: + - project type: normal + - don't modify Makefiles + - subdirs: lib src parts + +2001-12-20 Sandy Meier + * added "new class" dialog to the PHP support + incl. Basename completion and persistent class template + TODO: add class to the project after generation, (at the moment + KDevProject doesn't support it :-( ) + +2001-12-16 Roland Krause + * Reenabled the kwrite-part, + works now under KDE-3 with the KTextEditor interface. +2001-12-15 Victor Rder + * Added persistence functionality to the class store + - "cooperation" of Bernd, Daniel E. and me + - the class store is saved and loaded from a binary file + * In core.cpp projectClosed() is emitted first and then + store->wipeout() is called +2001-12-15 Sandy Meier + * added some new options to the Appwizard (see README) and make it more intuitive: name completion, + project loading after generation... + * added "void openProject(const QString& projectFileName)" to the KDevCore Interface, used by AppWizard + * fileselect part reacts now on signal KDevCore::projectOpen() +2001-12-12 August Hrandl + * Add method dialog rewritten using designer +2001-12-07 Eray Ozkural (exa) + * Added a preliminary Trie code to structure lib +2001-11-29 Sandy Meier + * added Gameboy Advance support including a "Hello World" template and + an emulator frontend +2001-11-21 Eray Ozkural (exa) + * Started lib/structure which will feature tree, + trie and graph structures + * Started a part called sourcebrowser which will facilitate + multiple UI's to browse source code +2001-10-23 Bernd Gehrmann + * Made sourceinfo serializing more modular by adding + stream operators to all relevant classes, + including ParsedItem, and using them in the higher + level ones +2001-10-14 Victor Rder + * new version of Daniel Engelschalt's CppCCParser + * KDevArgHint adapts now the font size of the editor +2001-10-13 Victor Rder + * added an additional signal textChanged with + + KEditor::Document* + + int line + + int col as params + * added a switch to (de)activate cc (done with #ifs) +2001-10-01 Bernd Gehrmann + * Smart error message box when parts cannot be + loaded + * QFile::encode() library name +2001-09-26 Bernd Gehrmann + * Added insertStdoutLine() and insertStderrLine() to + AppFrontend interface. This is e.g. needed by the + debugger frontend which maintains the complete communication + with the debugger *and* the application + * Big cleanup in libsourceinfo: Made internal variables + private, made accessors const-correct, return QStrings + now instead of references to them + * Changed ClassStore API to always use QStringLists instead + of QStrList + * Compiles with QT_NO_ASCII_CAST and QT_CLEAN_NAMESPACE now +2001-09-26 Victor Rder + * CppCCParser rewritten by Daniel Engelschalt + * The affected code for CC is saved in a temporary file now + * fixed some bugs in CppCodeCompletion + * This is still very very alpha +2001-08-22 Sandy Meier + * all 1500 php global functions are now available for code completion (incl. prototype) +2001-08-10 Victor Rder + * reimplemented CppCodeCompletion::getEntryListForClass() and + getEntryListForClassOfNamespace() + both work with the two recursive functions getParent...ListForClass() + multiple inheritance works now +2001-08-10 Harald Fernengel + * Polished the Grep Dialog. It now remembers the last searches and + search directories, search button is now default-button + * find now works on non-unix platforms, too +2001-08-08 Sandy Meier + * the code completion and arghint works now in many cases (PHP) + * added realtimeparser, so the classview is updated while you type :-) (PHP) + * fix some problems in arghintWidget + * added textChanged() signal to the editor interface + * phpsupport display the parsing progress in the statusbar (code from Matthias) +2001-08-06 Victor Rder + * Implemented several methods in CppCodeCompletionParser + getNode...(); + * Extended CppCodeCompletion + getEntryListFor...(); +2001-08-04 Victor Rder , Daniel Haberkorn + * Added CppCodeCompletionParser.cpp + .h (contains only interface definition) +2001-08-02 Matthias Hoelzer-Kluepfel + * Exposed the status bar through the kdevcore interface + * Made cppsupport display the parsing progress in the statusbar + +2001-08-02 Bernd Gehrmann + * Distpart: + - Fixed all layouts in distpart + - The relevant signal for check boxes is toggled(bool), not released() + - Use QDialog instead of QWidget and create it only on demand + - Okay -> OK + - Referring to generated names like Layout36 is a bad idea + * Put default binary name for compilers in their desktop files + This default is used for the CC/CXX/F77 setting when the + compiler has been changed by the user +2001-07-30 Eray Ozkural (exa) + * interfaces/keditor: moc files are compiled separately, #include's + removed from cpp files. + * fix: KEditor::Editor don't emit documentActivated when there + isn't one. + +2001-07-29 Victor Rder + * KDevArgHint improved, i.e. positioning, ui +2001-07-26 Victor Rder + * KDevArgHint added to KWrite-part (widget that shows the function + and its needed arguments) + Try it and type in 'test(' at the beginning of an empty line in a C++ project! + * showArgHint() added to CodeCompletionDocument + * added some code to CppCodeCompletion (cppsupport), but only for testing +2001-07-26 Sandy Meier + * kwrite CodeCompletionbox is now useable, maybe someone who want make it more colorful? + * php code completion supports (global methods,$this->xxx and $test = new xxx) now, + more will follow +2001-07-26 Eray Ozkural (exa) + * debian packaging for kdevelop-3.0 branch + * kwrite: add path kwriteeditor_part for locating syntax.xml +2001-07-22 Sandy Meier + * implemented initial codeCompletion interface for kwrite + * added codeCompletion parsing to the PHP supportpart + (everything is very alpha) + +2001-07-21 Bernd Gehrmann + * Canonicalize target name in TargetOptionsDialog. + Thanks to Ludovic LANGE for a patch + * Wait cursor while index dialog loads index files + * Configurable full text search in toc'ed documentation +2001-07-17 Bernd Gehrmann + * Added kdoc-generated Qt/KDE index to index dialog + * Destroy compiled-in factories at exit. Otherwise + their KConfig's don't get sync()ed +2001-07-16 Bernd Gehrmann + * Made doxygen config widget more KDE compliant, i.e. + KDE icons, KFileDialog instead of QFileDialog, + cleanup +2001-07-15 Bernd Gehrmann + * Elementary cvs support (add, remove, update, commit) + * doxygen plugin + * Added FileContext for context menus in the FileView. + This should be used for the project management widgets + later. +2001-07-13 Richard Dale + * Fixed bug causing 'precondition violated' messages in the C++ + class parser +2001-07-12 Bernd Gehrmann + * Store relative instead of absolute file names in custom project + * Use gotoFile() instead of gotoSourceFile() in custom and + script project + * Added Doxyfile for libkdevelop api +2001-07-12 Sandy Meier + * implemented extended plugin loading as discussed on Linuxtag 2001 + see HACKING how you can use it + +2001-07-11 Bernd Gehrmann + * Added CustomProject part for projects not based + on either automake or tmake/qmake + * Templates for C and C++ imports with custom Makefiles + * Fix in import dialog to substitute APPNAMELC correctly +2001-07-10 Matthias Hoelzer-Kluepfel + * Extended the KEditor::EditIface a bit + * started to implement it in the editor parts +2001-07-05 Richard Dale + * Fixed crash in class tool attribute display. Method and attribute + icons now displayed correctly + * Regenerated sources for Java plugin api + * References in the class store are cleared, before a source file + is parsed +2001-07-05 Bernd Gehrmann + * Quick hack for a tmake/qmake project management +2001-07-03 Bernd Gehrmann + * Make file views work for arbitrary mime types + * Switch header fix +2001-07-03 Richard Dale + * Added package visibility to the class browser for Java - denoted by a + green rectangle against an instance variable or method. +2001-07-03 Richard Dale + * Added accessor methods to the Class store/parser sources, so that + instance variables should no longer need to be accessed directly. + Java plugin api sources regenerated to use the new accessor method names +2001-07-02 Bernd Gehrmann + * Doc index dialog remembers checked indices and + categories per project + * GNUstep autoconf check, fixed directory + * Show 'Goto declaration' only for languages + with declarations + * Small toc and index DTD change +2001-07-01 Bernd Gehrmann + * Added TOCs for STL and Gtk libraries + * Removed General section in doc tree view, + as all its contents are covered elsewhere + * Added PHP identifier index + * Doc tree view configurable on a per-project basis, + currently preconfigured by the app wizard and + import dialog; no user interface +2001-06-29 Bernd Gehrmann + * TOCs for KDE2 development book and libc + plus Claudiu Costins scripts +2001-06-28 Bernd Gehrmann + * Added GNUStep documentation toc plus a script + for generating it from gsdoc files + * Full Python toc plus a script for generating it + * Full PHP toc made by Claudiu Costins script +2001-06-27 Bernd Gehrmann + * Implemented modification of build order of subprojects + * Fixed update of prefixes list + * Fixed update of include directory list + * Switch header/implementation +2001-06-26 Bernd Gehrmann + * Perldoc support + * Finished builddir support +2001-06-25 Bernd Gehrmann + * Implemented Add subproject + * Fix for autoproject: allow ldflags to be + added for programs, but disable libtool flags + * Popup menu contexts for classes, not yet used +2001-06-19 Matthias Hoelzer-Kluepfel + * let the user choose which editor part to load +2001-06-17 Bernd Gehrmann + * Separated project options widget in 4 separate widgets + instead of one tab widget and embedded them + into the general project options dialog. This is + more intuitive for the user and doesn't expose + KDevelop's internal structure so much + * App wizard fixes and improvements in the project file structure + * Configurable builddir (not used yet) + * Configurable environment variables for program run + * Implemented Execute program + * Implemented Make messages + * Menu structure cleanup + * Implemented Make install +2001-06-15 Bernd Gehrmann + * Implemented Add translation + * Implemented Execute program + * lex fix +2001-06-14 Sandy Meier + * phpsupport: configuration handling now in PHPConfigData + * phpsupport: web and shell invocation works now +2001-06-14 Bernd Gehrmann + * Implemented distclean + * Support for autogen.sh in addition to Makefile.cvs +2001-06-13 Bernd Gehrmann + * Rewritten Add target dialog. Supports additional + LDFLAGS now. Will add a context menu item 'Add KDE plugin' + later which will set KDE_PLUGIN stuff as default + * Added a special kde mode to autoproject part. +2001-06-12 Bernd Gehrmann + * New part regexptest for testing regular expressions + * Fixed make frontend to recognize ftnchek messages + correctly + * Changed make frontend api again so that the dir is + given as parameter. Necessary for finding the + directory of an erroneous file when only one + directory is built + * Rerun configure when project options have changed. +2001-06-11 Bernd Gehrmann + * Allow several commands for the make frontend to be queued + * Project management automatically runs configures if no + Makefile exists and Makefile.cvs if no configure script + exists +2001-06-10 Bernd Gehrmann + * Don't show Fortran options for gcc + * Enabled class view fixes from 06-05 :-) + * More import project types +2001-06-09 Matthias Hoelzer-Kluepfel + * Started to move the kwrite code from lib to the part. + * Added additional kwrite functions to the menues. +2001-06-05 Matthias Hoelzer-Kluepfel + * Reenabled the signals when files are loaded and + saved, so Bernd can test ;) + (This was a hotfix, I will do the real one later) +2001-06-05 Bernd Gehrmann + * Added Add application desktop file dialog + * Fixed Add service dialog + * Some fixes in class view that I can't test currently... +2001-06-04 Matthias Hoelzer-Kluepfel + * Added DCOP bindings to the editor interfaces, + so they are accessible for scripting. +2001-06-03 Bernd Gehrmann + * New add service dialog in project management + Not quite ready + * Bug fixes in sub project and target options dialog +2001-06-02 Bernd Gehrmann + * New sub project and target options dialogs. + These are much more user-friend wrt convenience + libraries and include directories within the + project. Furthermore, the libtool options are + presented in documented check boxes + * Put compiler options widget into the project + options framework +2001-06-01 Matthias Hoelzer-Kluepfel + * Reimplemented the modified-on-disk check with the new + editor-interface. + * Reimplemented the modified check before quitting. + * Added "Save all" and "Revert all" + * Added "Revert" to the editor interface. +2001-05-31 Bernd Gehrmann + * Made some dom writing code more robust by + creating non-existent nodes in the tree + * Rewrote the import dialog to allow the choice between + a number of import templates +2001-05-31 Matthias Hoelzer-Kluepfel + * switched to the new editor interface concept +2001-05-31 Sandy Meier + * added initial php webserver/shell preview and config dialog (phpsupport) + * added errormessage parser/view (phpsupport) + +2001-05-31 Richard Dale + * Added a Java JNI based plugin api, and a corresponding + project template for building a plugin. Java parts are + not built if a --without-java flag is used for configuration, + or if no suitable versions of javac, jar etc are found. +2001-05-31 Bernd Gehrmann + * Added a zillion other languages to ctags tag mappings + * Regular expression matching in ctags part + * Tell user about dot in configure +2001-05-30 Bernd Gehrmann + * Added a ctags part +2001-05-30 Thomas Fromm + * Added basic Highlighting for PHP +2001-05-29 Bernd Gehrmann + * Added a pydoc ioslave and a corresponding menu item to + the python support part + * Added a man page item to the help menu +2001-05-28 Bernd Gehrmann + * New scripting layer based on DCOP +2001-05-27 Bernd Gehrmann + * Added TOCs for perl, python and PHP to the + documentation tree + * Added python documentation index + * Made file view aware of files added to and + removed from the project + * Added 'subdirs' files to KDE app templates + * Fixed project management regexps for tabs + * Fixed project management to properly emit addedFile signals + * Fixed auto project behaviour for prefixes with underscores + * LIBADD is for libraries, LDADD for programs + * Implemented 'Add prefix' dialog + * Show progress dialog when parsing files + * Implemented Remove file dialog in project management. + Does not quite work yet :-( +2001-05-25 Bernd Gehrmann + * Added FORTRAN 77 parser + * Added plugins for g77 and the Portland Group's + f77 compiler and High Performance Fortran + compiler driver +2001-05-24 Sandy Meier + * added option (load last project on startup) + * saved mainview configuration on exit +2001-05-24 Bernd Gehrmann + * Added templates for GNOME app and simple automake- + based C and C++ programs +2001-05-23 Bernd Gehrmann + * Fixed file view and made it possible to add new + groups and change the order of matched patterns + * Added preliminary fortran support part with a + ftnchek configuration dialog. Parser follows later... +2001-05-22 Bernd Gehrmann + * Added a new part 'FileView' which shows all files of + a project sorted in groups like 'Sources' and + 'User Interface'. The groups can be configured + by the user. A default setting is provided by the + application wizard. +2001-05-20 Sandy Meier + * added initial PHP support including a simple php parser + * added "hello world" PHP template to AppWizard +2001-05-20 Matthias Hoelzer-Kluepfel + * Added a new editor interface for debugging + (breakpoints etc.) + * Added cast methods to the editor interfaces, so + you don't have to pass strings around any longer +2001-05-19 Bernd Gehrmann + * Added kicker, kioslave and kcmodule templates + * Each template can define an icon which is + shown in the app wizard + * The Big KInstance Cleanup +2001-05-19 Matthias Hoelzer-Kluepfel + * Added a plugin to provide and configure a + Tools menu. +2001-05-17 Bernd Gehrmann + * Categorized all parts into Global or Project, + so that they are either loaded at startup or + at project loading time + * Added part selector which allows to configure + the used parts both globally and on a per- + project basis +2001-05-14 Bernd Gehrmann + * Back to KDialogBase for configuration dialogs +2001-05-13 Bernd Gehrmann + * Added a project options dialog to which any + plugin can add a tab. + * Debugger configuration dialog + * Temporarily gone back to QTabDialog for these + configuration dialogs instead of KDialogBase. + Not sure if this is right... +2001-05-13 Matthias Hoelzer-Kluepfel + + * Added a status interface to the editor interfaces + * Implemented display of editor status in the main + statusbar +2001-05-12 Bernd Gehrmann + * Changed compiler frontend to use QTextView, instead of QListBox. + Now copy&paste are possible, and the view scrolls to the end of the + output (unless the user has clicked otherwise) + * Also fixed the shortcuts + * Fixed buffer menu for documentation parts +2001-05-11 Matthias Hoelzer-Kluepfel + * Commited the new editor framework + Note that it is not yet active, as it is not yet + complete. But it is evolving... +2001-05-10 Bernd Gehrmann + * Added Python Hello world template + * Fixed memory leaks + * Fixed project files in templates to include mainprogram variable + * Fixed script project to not show . and .. and to go to a source + file when it is clicked + * Implemented printing +2001-05-09 Bernd Gehrmann + * Implemented proper comparing of file identities: + Instead of the file name, now devno/inode are compared. + Important for NFS systems, where file names may have + a prefix like /tmp_mnt in some occasions + This was already implemented in the HEAD branch + before the old one ;-) + * Implemented KDevCore::gotoFile() as a generic method + to "go" to a file. Works for arbitrary mime types. + * Implemented KDevCore::revertAllFiles() + * Warning dialogs when modified files are closed or when + saved/loaded files were modified outside. + * Implemented searching html widget +2001-05-08 Bernd Gehrmann + * Use flex instead of $(LEX) + * Made function prototypes in tokenizer.l static. + Not making them 'static' explicitly makes them + 'extern' and causes a conflict + * Removed tokenizer.cpp from cvs, so it gets + generated at build time +2001-05-05 Matthias Hoelzer-Kluepfel + + * prepared the Tip-of-the-Day plugin to make use of the + KTipDialog class that will soon appear in kdelibs. +2001-05-01 Richard Dale + * Removed hard coded java classpaths, and classnames. They are derived + from the projectDirectory and mainProgram project attributes. + * Checked in jdb front end code from Oliver Strutynski. He comments: + 'I finished work on a first version of JDB Support. It is not at + all feature complete (setting breakpoints does not work yet, hangs + from time to time) but could serve as a starting point for further + development. The directory contains a README describing some of the + parsing in the jdbcontroller.' +2001-04-29 Sandy Meier + * some changes in appwizard gui (qtdesigner based), + templates can have a category property now +2001-04-27 Bernd Gehrmann + * Implemented a generic project part for scripting languages. + It essentially consists of a widget that displays all files + in all subdirectories. + * Changed the class view to respect the feature set of the used + language. I.e. for example for python the sections with + variables are not displayed, as in python variables are not + declared. + * Sanitized project loading: The user now chooses the project + file in a file dialog, not the directory. The kapp, kpart + and kpartplugin appwizard scripts install a project file now. + * Replaced the persistence stuff (which was not yet used) in the + classstore with serialization routines based on QDataStream. + In principle, we could now send them around via DCOP :-) + * Implemented a python support part with parser + * Implemented a perl support part with parser +2001-04-22 Bernd Gehrmann + * Made configure arguments configurable + Patch by Berndt Josef Wulf + * Don't link with libfl in cppsupport and javasupport + * Each part now uses its own instance and the corresponding + resource directory +2001-04-18 Richard Dale + * GDB debugger part sources copied to 'parts/javadebugger', and all names + changed to JDB ones. Ready to add jdb functionality. +2001-04-17 Matthias Hoelzer-Kluepfel + * Moved the splitter widget to lib/util, so it can be shared with parts + * Moved the editor part to lib/kwrite, to allow parts to access it. + * Added astyle part, a source code reformatter. +2001-04-13 Richard Dale + * Applied patch from Oliver Strutynski to fix bug in the Java tokenizer + with non US-ASCII identifiers in source files. +2001-04-11 Matthias Hoelzer-Kluepfel + * Added a plugin that let's you select the parts to load + on startup + * Added some code to core to only load the plugins selected. +2001-04-10 Bernd Gehrmann + * Added memory view widget + * Fixed disassemble widget to act only when it is visible + * Added examine core file and attach to process + * Cleaning widget after the debugger has finished + * Added status bar text and whats this + * Clear execution point mark when debugger has finished +2001-04-10 Matthias Hoelzer-Kluepfel + * added a part to display a "Tip of the day" + * moved over the tips from the previous HEAD branch, + which probably need a review +2001-04-09 Bernd Gehrmann + * Rewritten the icon border stuff from 1.x for use + with multiple views per document + * Ported the debugger frontend +2001-04-06 Richard Dale + * Added Java and Objective-C class browsing, and Java KDE project template and + automake support (ie the _JAVA primary). Fixed bug in class browser where a + method's arguments were not being displayed (was that a bug or a feature?). + Clicking on a class's instance variables in the class browser now works and + takes you to the source file. diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 00000000..c708db86 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,27 @@ +INCLUDE(CheckIncludeFiles) + +#check for libz using the cmake supplied FindZLIB.cmake +INCLUDE(FindZLIB) + +IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) +ELSE(ZLIB_FOUND) + SET(HAVE_LIBZ 0) +ENDIF(ZLIB_FOUND) + +#check for png +INCLUDE(FindPNG) +IF(PNG_FOUND) + SET(HAVE_LIBPNG 1) +ELSE(PNG_FOUND) + SET(HAVE_LIBPNG 0) +ENDIF(PNG_FOUND) + +#now check for dlfcn.h using the cmake supplied CHECK_INCLUDE_FILE() macro + +CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H) + +SET(CONFIG_QT_DOCDIR "\"/usr/lib/qt/doc/html/\"") +SET(CONFIG_KDELIBS_DOXYDIR "\"/tmp/\"") + +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_SOURCE_DIR}/config.h) diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 00000000..603b4e0b --- /dev/null +++ b/Doxyfile @@ -0,0 +1,274 @@ +# Doxyfile 1.3.5-KDevelop + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = KDevelop +PROJECT_NUMBER = "Version CVS" +OUTPUT_DIRECTORY = ./apidocs +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = $(PWD)/ +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 4 +ALIASES = obsolete=@deprecated \ + "feature=\xrefitem features \"Feature(s)\" \"Features\"" \ + "maintainer=\xrefitem maintainers \"Maintainer(s)\" \"Maintainers\"" \ + "unmaintained=\xrefitem unmaintained \"Unmaintained\" \"Unmaintained\"" \ + "requirement=\xrefitem requirements \"Requirement(s)\" \"Requirements\"" \ + "faq=\xrefitem FAQ \"F.A.Q.\" \"F.A.Q.\"" \ + "authors=\xrefitem authors \"Author(s)\" \"Authors\"" \ + "FIXME=\xrefitem fixme \"Fixme\" \"Fixme\"" +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = YES +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_FORMAT = +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = doc/api \ + lib \ + buildtools/projectmanager/interfaces +# src \ +# parts \ +# languages \ +# buildtools \ +# editors \ +# vcs +FILE_PATTERNS = *.h \ + *.cpp \ + *.cc \ + *.hpp \ + *.dox \ + *.c++ \ + *.cxx \ + *.h++ \ + *.hh +RECURSIVE = YES +EXCLUDE = languages/ada/app_templates \ + languages/cpp/app_templates \ + languages/cpp/file_templates \ + languages/cpp/subclassing_template \ + languages/fortran/app_templates \ + languages/haskell/app_templates \ + languages/java/app_templates \ + languages/pascal/app_templates \ + languages/perl/app_templates \ + languages/php/app_templates \ + languages/python/app_templates \ + languages/ruby/app_templates \ + languages/sql/app_templates \ + lib/qextmdi \ + vcs/cvsclient +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = *.moc.* \ + moc* \ + *.all_cpp.* \ + *unload.* \ + */test/* \ + */tests/* \ + *face_skel.cpp \ + *.ui.h +EXAMPLE_PATH = languages/cpp/app_templates/khello \ + languages/cpp/app_templates/kdevpart +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = ./doc/api +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 3 +IGNORE_PREFIX = K +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = ./html +HTML_FILE_EXTENSION = .html +HTML_HEADER = apidocs/common/header.html +HTML_FOOTER = apidocs/common/footer.html +HTML_STYLESHEET = apidocs/common/doxygen.css +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = ./latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = YES +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = YES +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = ./rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = ./man +MAN_EXTENSION = .kde3 +MAN_LINKS = YES +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = ANTLR_USE_NAMESPACE(_x_)=_x_:: +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/dcop/dcop.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/dcop/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/interfaces/interfaces.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/interfaces/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kdecore/kdecore.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kdecore/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kdefx/kdefx.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kdefx/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kdeui/kdeui.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kdeui/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/khtml/khtml.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/khtml/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kio/kio.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kio/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kjs/kjs.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kjs/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kparts/kparts.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kparts/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kmdi/kmdi.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kmdi/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kutils/kutils.tag=$(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/kutils/html/ \ + $(KDEDIR)/share/doc/HTML/en/kdelibs-apidocs/qt/qt.tag=$(QTDIR)/doc/html +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = NO +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 800 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/Doxyfile.am b/Doxyfile.am new file mode 100644 index 00000000..e35e931a --- /dev/null +++ b/Doxyfile.am @@ -0,0 +1,186 @@ +## generate API documentation with doxygen +apidox-am-yes: + @if test -z "$(DOXYGEN_EMPTY)"; then \ + if test "$(subdir)" != "."; then \ + docdir="$(DOXYGEN_DOCDIRPREFIX)"`basename "$(subdir)"`; \ + $(mkinstalldirs) $(top_builddir)/apidocs/$$docdir ;\ + if test ! -x $(top_builddir)/apidocs/common; then \ + if test -d $(top_srcdir)/doc/common; then \ + common_dir=`cd $(top_srcdir)/doc/common && pwd` ;\ + else \ + common_dir=$(kde_libs_htmldir)/en/common ;\ + fi ;\ + $(LN_S) $$common_dir $(top_builddir)/apidocs/common; \ + fi ;\ + cp $(top_srcdir)/admin/Doxyfile.global Doxyfile; \ + echo "PROJECT_NAME = \"$(DOXYGEN_PROJECTNAME)\"" >> Doxyfile; \ + echo "PROJECT_NUMBER = \"Version $(VERSION)\"" >> Doxyfile; \ + echo "INPUT = $(srcdir)" >> Doxyfile; \ + echo "IMAGE_PATH = $(top_srcdir)/doc/api" >> Doxyfile ;\ + echo "OUTPUT_DIRECTORY = $(top_builddir)/apidocs" >> Doxyfile; \ + echo "HTML_OUTPUT = $$docdir/html" >> Doxyfile; \ + echo "HTML_HEADER = $(top_builddir)/apidocs/common/header.html" >> Doxyfile;\ + echo "HTML_FOOTER = $(top_builddir)/apidocs/common/footer.html" >> Doxyfile;\ + echo "HTML_STYLESHEET = $(top_builddir)/apidocs/common/doxygen.css" >> Doxyfile;\ + echo "LATEX_OUTPUT = $$docdir/latex" >> Doxyfile; \ + echo "RTF_OUTPUT = $$docdir/rtf" >> Doxyfile; \ + echo "MAN_OUTPUT = $$docdir/man" >> Doxyfile; \ + echo "GENERATE_HTML = $(GENERATE_FLAG)" >> Doxyfile ;\ + echo "GENERATE_MAN = NO" >> Doxyfile ;\ + echo "GENERATE_LATEX = NO" >> Doxyfile ;\ + echo "RECURSIVE = NO" >> Doxyfile ;\ + if test -n "$(DOXYGEN_EXCLUDE)"; then \ + patterns= ;\ + dirs= ;\ + for item in `echo "$(DOXYGEN_EXCLUDE)"`; do \ + if test -d "$(srcdir)/$$item"; then \ + dirs="$$dirs $(srcdir)/$$item/" ;\ + else \ + patterns="$$patterns $$item" ;\ + fi ;\ + done ;\ + echo "EXCLUDE_PATTERNS += $$patterns" >> Doxyfile; \ + echo "EXCLUDE += $$dirs" >> Doxyfile ;\ + fi ;\ + echo "TAGFILES = \\" >> Doxyfile; \ + tags='$(DOXYGEN_REFERENCES) qt'; for tag in $$tags; do \ + tagpath= ;\ + path="../../$$tag" ;\ + if test -f $(top_builddir)/apidocs/$$tag/$$tag.tag; then \ + tagpath="$(top_builddir)/apidocs/$$tag/$$tag.tag" ;\ + else \ + tagpath=`ls -1 $(kde_htmldir)/en/*-apidocs/$$tag/$$tag.tag 2> /dev/null` ;\ + if test -n "$$tagpath"; then \ + path=`echo $$tagpath | sed -e "s,.*/\([^/]*-apidocs\)/$$tag/$$tag.tag,../../../\1/$$tag,"` ;\ + fi ;\ + fi ;\ + if test "$$tag" = qt; then \ + echo $$tagpath=$(QTDOCDIR) >> Doxyfile ;\ + else if test -n "$$tagpath"; then \ + echo "$$tagpath=$$path/html \\" >> Doxyfile ;\ + fi ;\ + fi ;\ + done ;\ + echo "GENERATE_TAGFILE = $(top_builddir)/apidocs/$$docdir/$$docdir.tag" >> Doxyfile ;\ + echo "HAVE_DOT = $(KDE_HAVE_DOT)" >> Doxyfile ;\ + $(DOXYGEN) Doxyfile ;\ + fi ;\ + fi + +apidox-am-no: + +install-data-local: install-apidox + +## install API documentation +install-apidox: + @if test "$(subdir)" != "."; then \ + $(mkinstalldirs) $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir)/html ; \ + if test -f $(top_builddir)/apidocs/$(subdir)/$(subdir).tag; then \ + echo $(INSTALL_DATA) $(top_builddir)/apidocs/$(subdir)/$(subdir).tag $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir); \ + $(INSTALL_DATA) $(top_builddir)/apidocs/$(subdir)/$(subdir).tag $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir); \ + fi; \ + if test -d $(top_builddir)/apidocs/$(subdir)/html; then \ + list=`ls $(top_builddir)/apidocs/$(subdir)/html`; \ + echo "installing $(top_builddir)/apidocs/$(subdir)/html" ;\ + for file in $$list; do \ + $(INSTALL_DATA) $(top_builddir)/apidocs/$(subdir)/html/$$file $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir)/html; \ + done; \ + fi; \ + rm -f $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/common; \ + $(LN_S) $(kde_libs_htmldir)/en/common $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/common; \ + else\ + if test -d $(top_builddir)/apidocs; then \ + $(mkinstalldirs) $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs ;\ + list=`cd $(top_builddir)/apidocs && ls -1`; \ + echo "installing $(top_builddir)/apidocs/$$file" ;\ + for file in $$list; do \ + if test -f $(top_builddir)/apidocs/$$file; then \ + $(INSTALL_DATA) $(top_builddir)/apidocs/$$file $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs; \ + fi; \ + done ; fi; \ + fi + +uninstall-local: uninstall-apidox + +## uninstall API documentation +uninstall-apidox: + @if test "$(subdir)" != "."; then \ + if test -d $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir); then \ + rm -rfv $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir); \ + fi\ + else\ + if test -d $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs; then \ + rm -rfv $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs; \ + fi\ + fi + +apidox: + @if test "$(subdir)" != "."; then \ + $(MAKE) apidox-am-@KDE_HAS_DOXYGEN@ ;\ + else \ + $(MAKE) apidox-am-toplevel-@KDE_HAS_DOXYGEN@ ;\ + fi + @set fnord $(MAKEFLAGS); amf=$$2; if test -n '$(SUBDIRS)'; then \ + list='$(SUBDIRS)'; \ + if test "$(GENERATE_FLAG)" = "no" -o "$(subdir)" = "."; then \ + for subdir in $$list; do \ + if grep '^include .*Doxyfile.am' $(srcdir)/$$subdir/Makefile.am; then \ + echo "Making apidox (tag) in $$subdir"; \ + if test "$$subdir" != "."; then \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) GENERATE_FLAG=no apidox) || exit 1; \ + fi ; fi ;\ + done; \ + fi; \ + if test "$(GENERATE_FLAG)" = "yes" -o "$(subdir)" = "."; then \ + for subdir in $$list; do \ + if grep '^include .*Doxyfile.am' $(srcdir)/$$subdir/Makefile.am; then \ + echo "Making apidox (html) in $$subdir"; \ + if test "$$subdir" != "."; then \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) GENERATE_FLAG=yes apidox) || exit 1; \ + fi ; fi ;\ + done; \ + fi; \ + fi + +apidox-am-toplevel-no: +apidox-am-toplevel-yes: + @echo "*** Creating API documentation main page"; \ + cp $(top_srcdir)/admin/Doxyfile.global Doxyfile; \ + echo "PROJECT_NAME = \"$(DOXYGEN_PROJECT_NAME)\"" >> Doxyfile ; \ + echo "PROJECT_NUMBER = \"$(DOXYGEN_PROJECT_NUMBER)\"" >> Doxyfile ; \ + echo "INPUT = $(top_srcdir)/doc/platform" >> Doxyfile ; \ + echo "OUTPUT_DIRECTORY = $(top_builddir)/apidocs" >> Doxyfile ; \ + echo "FILE_PATTERNS = *.dox" >> Doxyfile ; \ + echo "RECURSIVE = NO" >> Doxyfile ; \ + echo "SOURCE_BROWSER = NO" >> Doxyfile ; \ + echo "ALPHABETICAL_INDEX = NO" >> Doxyfile ; \ + echo "HTML_OUTPUT = ." >> Doxyfile ; \ + echo "HTML_HEADER = apidocs/common/mainheader.html" >> Doxyfile ; \ + echo "HTML_FOOTER = apidocs/common/mainfooter.html" >> Doxyfile ; \ + echo "HTML_STYLESHEET = apidocs/common/doxygen.css" >> Doxyfile ; \ + echo "GENERATE_LATEX = NO" >> Doxyfile ; \ + echo "GENERATE_RTF = NO" >> Doxyfile ; \ + echo "GENERATE_MAN = NO" >> Doxyfile ; \ + echo "GENERATE_XML = NO" >> Doxyfile ; \ + echo "GENERATE_AUTOGEN_DEF = NO" >> Doxyfile ; \ + echo "ENABLE_PREPROCESSING = NO" >> Doxyfile ; \ + echo "CLASS_DIAGRAMS = NO" >> Doxyfile ; \ + echo "HAVE_DOT = NO" >> Doxyfile ; \ + echo "GENERATE_HTML = YES" >> Doxyfile ;\ + $(mkinstalldirs) $(top_builddir)/apidocs ; \ + rm -f $(top_builddir)/apidocs/common ; \ + if test -d $(top_srcdir)/doc/common; then \ + common_dir=`cd $(top_srcdir)/doc/common && pwd` ;\ + else \ + common_dir=$(kde_libs_htmldir)/en/common ;\ + fi ;\ + $(LN_S) $$common_dir $(top_builddir)/apidocs/common ;\ + doxygen Doxyfile; \ + rm -f Doxyfile + +.PHONY: apidox-am-yes apidox-am-no install-data-local install-apidox install-apidox uninstall-local uninstall-apidox uninstall-apidox apidox apidox-am-toplevel-no apidox-am-toplevel-yes + + +# Local Variables: +# mode: makefile +# End: diff --git a/Doxyfile_full.am b/Doxyfile_full.am new file mode 100644 index 00000000..9d0262f9 --- /dev/null +++ b/Doxyfile_full.am @@ -0,0 +1,215 @@ +## generate API documentation with doxygen +apidox-am-yes: + @if test "$(subdir)" == "."; then \ + $(mkinstalldirs) $(top_builddir)/apidocs/$(subdir) ;\ + if test "$(DOXYGEN_LINK_WITH_KDE_QT_APIDOX)" == "YES"; then \ + if test ! -x $(top_builddir)/apidocs/common; then \ + if test -d $(top_srcdir)/doc/common; then \ + common_dir=`cd $(top_srcdir)/doc/common && pwd` ;\ + else \ + common_dir=$(kde_libs_htmldir)/en/common ;\ + fi ;\ + $(LN_S) $$common_dir $(top_builddir)/apidocs/common; \ + fi ;\ + fi ;\ + cp $(top_srcdir)/admin/Doxyfile.global Doxyfile; \ + echo "PROJECT_NAME = $(DOXYGEN_PROJECT_NAME)" >> Doxyfile; \ + echo "PROJECT_NUMBER = \"Version $(VERSION)\"" >> Doxyfile; \ + echo "OUTPUT_DIRECTORY = $(PWD)/apidocs/en" >> Doxyfile; \ + echo "BRIEF_MEMBER_DESC = NO" >> Doxyfile; \ + echo "FULL_PATH_NAMES = YES" >> Doxyfile; \ + echo "STRIP_FROM_PATH = $(top_srcdir)/" >> Doxyfile; \ + echo "ALIASES += \"feature=\xrefitem features \\\"Feature(s)\\\" \\\"Features\\\"\" " >> Doxyfile; \ + echo "ALIASES += \"maintainer=\xrefitem maintainers \\\"Maintainer(s)\\\" \\\"Maintainers\\\"\" " >> Doxyfile; \ + echo "ALIASES += \"unmaintained=\xrefitem unmaintained \\\"Unmaintained\\\" \\\"Unmaintained\\\"\" " >> Doxyfile; \ + echo "ALIASES += \"requirement=\xrefitem requirements \\\"Requirement(s)\\\" \\\"Requirements\\\"\" " >> Doxyfile; \ + echo "ALIASES += \"faq=\xrefitem FAQ \\\"F.A.Q.\\\" \\\"F.A.Q.\\\"\" " >> Doxyfile; \ + echo "ALIASES += \"authors=\xrefitem authors \\\"Author(s)\\\" \\\"Authors\\\"\" " >> Doxyfile; \ + echo "ALIASES += \"FIXME=\xrefitem fixme \\\"Fixme\\\" \\\"Fixme\\\"\" " >> Doxyfile; \ + echo "EXTRACT_ALL = NO" >> Doxyfile; \ + echo "EXTRACT_PRIVATE = NO" >> Doxyfile; \ + echo "EXTRACT_LOCAL_CLASSES = YES" >> Doxyfile; \ + echo "HIDE_UNDOC_CLASSES = NO" >> Doxyfile; \ + echo "HIDE_UNDOC_MEMBERS = NO" >> Doxyfile; \ + echo "SORT_MEMBER_DOCS = YES" >> Doxyfile; \ + echo "GENERATE_TODOLIST = YES" >> Doxyfile; \ + if test -n "$(DOXYGEN_INPUT)"; then \ + patterns= ;\ + dirs= ;\ + include_items='$(DOXYGEN_INPUT) '; for item in $$include_items; do \ + if test -d "$(top_srcdir)/$$item"; then \ + dirs="$$dirs $$item" ;\ + else \ + patterns="$$patterns $$item" ;\ + fi ;\ + done ;\ + echo "INPUT += $$dirs" >> Doxyfile ;\ + echo "FILE_PATTERNS += $$patterns" >> Doxyfile; \ + fi ;\ + if test -n "$(DOXYGEN_EXCLUDE)"; then \ + patterns= ;\ + dirs= ;\ + exclude_items='$(DOXYGEN_EXCLUDE) '; for item in $$exclude_items; do \ + if test -d "$(top_srcdir)/$$item"; then \ + dirs="$$dirs $$item" ;\ + else \ + patterns="$$patterns $$item" ;\ + fi ;\ + done ;\ + echo "EXCLUDE += $$dirs" >> Doxyfile ;\ + echo "EXCLUDE_PATTERNS += $$patterns" >> Doxyfile; \ + fi ;\ + echo "EXAMPLE_PATH = $(DOXYGEN_EXAMPLE_PATH)" >> Doxyfile; \ + echo "IMAGE_PATH = $(top_srcdir)/doc/api" >> Doxyfile ;\ + echo "VERBATIM_HEADERS = NO" >> Doxyfile ;\ + echo "IGNORE_PREFIX = K" >> Doxyfile ;\ + echo "GENERATE_HTML = $(GENERATE_FLAG)" >> Doxyfile ;\ + echo "HTML_OUTPUT = html" >> Doxyfile; \ + if test "$(DOXYGEN_LINK_WITH_KDE_QT_APIDOX)" == "YES"; then \ + if test "$(DOXYGEN_SEARCHENGINE)" == "YES"; then \ + echo "HTML_HEADER = $(PWD)/apidocs/common/appheader.html" >> Doxyfile ;\ + else \ + echo "HTML_HEADER = $(PWD)/apidocs/common/header.html" >> Doxyfile ;\ + fi ;\ + echo "HTML_FOOTER = $(PWD)/apidocs/common/footer.html" >> Doxyfile ;\ + echo "HTML_STYLESHEET = $(PWD)/apidocs/common/doxygen.css" >> Doxyfile ;\ + else \ + echo "HTML_HEADER = " >> Doxyfile ;\ + echo "HTML_FOOTER = " >> Doxyfile ;\ + echo "HTML_STYLESHEET = " >> Doxyfile ;\ + echo "DISABLE_INDEX = NO" >> Doxyfile ;\ + fi ;\ + echo "GENERATE_LATEX = NO" >> Doxyfile ; \ + echo "LATEX_OUTPUT = $(subdir)/latex" >> Doxyfile; \ + echo "RTF_OUTPUT = $(subdir)/rtf" >> Doxyfile; \ + echo "GENERATE_MAN = NO" >> Doxyfile ;\ + echo "MAN_OUTPUT = $(subdir)/man" >> Doxyfile; \ + echo "MACRO_EXPANSION = YES" >> Doxyfile ; \ + echo "PREDEFINED = ANTLR_USE_NAMESPACE(_x_)=_x_::" >> Doxyfile ; \ + if test "$(DOXYGEN_LINK_WITH_KDE_QT_APIDOX)" == "YES"; then \ + echo "TAGFILES = \\" >> Doxyfile; \ + tags='$(DOXYGEN_REFERENCES) qt'; for tag in $$tags; do \ + tagpath= ;\ + path="../../$$tag" ;\ + if test -f $(top_builddir)/apidocs/$$tag/$$tag.tag; then \ + tagpath="$(top_builddir)/apidocs/$$tag/$$tag.tag" ;\ + else \ + tagpath=`ls -1 $(kde_htmldir)/en/*-apidocs/$$tag/$$tag.tag 2> /dev/null` ;\ + if test -n "$$tagpath"; then \ + path=`echo $$tagpath | sed -e "s,.*/\([^/]*-apidocs\)/$$tag/$$tag.tag,../../\1/$$tag,"` ;\ + else \ + tagpath=`ls -1 $(kdelibs_doxydir)/$$tag/$$tag.tag 2> /dev/null` ;\ + if test -n "$$tagpath"; then \ + path=`echo $$tagpath | sed -e "s,.*/\([^/]*-apidocs\)/$$tag/$$tag.tag,$(kdelibs_doxydir)/$$tag,"` ;\ + else \ + tagpath=/home/apidox/public/cvs-api/$$tag/$$tag.tag ;\ + fi ;\ + fi ;\ + fi ;\ + if test "$$tag" = qt; then \ + echo $$tagpath=$(QTDOCDIR) >> Doxyfile ;\ + else if test -n "$$tagpath"; then \ + echo "$$tagpath=$$path/html \\" >> Doxyfile ;\ + fi ;\ + fi ;\ + done ;\ + fi ;\ + echo "HAVE_DOT = $(KDE_HAVE_DOT)" >> Doxyfile ; \ + echo "SEARCHENGINE = $(DOXYGEN_SEARCHENGINE)" >> Doxyfile ; \ + if test "$(DOXYGEN_LINK_WITH_KDE_QT_APIDOX)" == "YES"; then \ + rm -f $(top_builddir)/apidocs/common ; \ + if test -d $(top_srcdir)/doc/common; then \ + common_dir=`cd $(top_srcdir)/doc/common && pwd` ;\ + else \ + common_dir=$(kde_libs_htmldir)/en/common ;\ + fi ;\ + $(LN_S) $$common_dir $(top_builddir)/apidocs/common ;\ + fi ;\ + $(DOXYGEN) -s -u Doxyfile ; \ + cp Doxyfile Doxyfile.in ; \ + path_to_doxyfile=$(PWD) ;\ + cd $(top_srcdir) ;\ + $(DOXYGEN) $$path_to_doxyfile/Doxyfile ; \ + cd $$path_to_doxyfile ;\ + rm -f Doxyfile; \ + fi + +apidox-am-no: + +## Let's only install the API documentation if the user explicitly invokes it's instalation +##install-data-local: install-apidox + +## install API documentation +install-apidox: + $(mkinstalldirs) $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir)/html + @if test -f $(top_builddir)/apidocs/$(DOXYGEN_PROJECT_NAME).tag; then \ + echo $(INSTALL_DATA) $(top_builddir)/apidocs/$(DOXYGEN_PROJECT_NAME).tag $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir); \ + $(INSTALL_DATA) $(top_builddir)/apidocs/$(DOXYGEN_PROJECT_NAME).tag $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir); \ + fi; + @if test -d $(top_builddir)/apidocs/$(subdir)/html; then \ + list=`ls $(top_builddir)/apidocs/$(subdir)/html`; \ + echo "installing $(top_builddir)/apidocs/$(subdir)/html" ;\ + for file in $$list; do \ + $(INSTALL_DATA) $(top_builddir)/apidocs/$(subdir)/html/$$file $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/$(subdir)/html; \ + done; \ + fi; + @if test "$(DOXYGEN_LINK_WITH_KDE_QT_APIDOX)" == "YES"; then \ + rm -f $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/common; \ + $(LN_S) $(kde_libs_htmldir)/en/common $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/common; \ + fi; + @echo "" + @echo "" + @echo "************************* Important ***************************" + @echo "" + @echo "The $(PACKAGE) API documentation was successfuly installed at:" + @echo " $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/html" + @echo "" + +uninstall-local: uninstall-apidox + +## uninstall API documentation +uninstall-apidox: + @if test -d $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs; then \ + echo "*** Uninstaling $(PACKAGE) API documentation" ; \ + echo "rm -rfv $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs" ; \ + rm -rfv $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs; \ + fi + +apidox: + $(MAKE) apidox-am-@KDE_HAS_DOXYGEN@ + @set fnord $(MAKEFLAGS); amf=$$2; if test -n '$(SUBDIRS)'; then \ + list='$(SUBDIRS)'; \ + for subdir in $$list; do \ + if grep '^include .*Doxyfile.am' $(srcdir)/$$subdir/Makefile.am; then \ + echo "Making apidox in $$subdir"; \ + if test "$$subdir" != "."; then \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) GENERATE_FLAG=no apidox) || exit 1; \ + fi ; fi ;\ + done; \ + for subdir in $$list; do \ + if grep '^include .*Doxyfile.am' $(srcdir)/$$subdir/Makefile.am; then \ + echo "Making apidox in $$subdir"; \ + if test "$$subdir" != "."; then \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) GENERATE_FLAG=yes apidox) || exit 1; \ + fi ; fi ;\ + done; \ + if test "$(DOXYGEN_LINK_WITH_KDE_QT_APIDOX)" == "YES"; then \ + echo ""; \ + echo ""; \ + echo "******************* Important *********************"; \ + echo ""; \ + echo "Before you can browse the API documentation you MUST issue:"; \ + echo " make install-apidox (as root)"; \ + echo ""; \ + echo "The API documentation will then be installed at:"; \ + echo " $(DESTDIR)$(kde_htmldir)/en/$(PACKAGE)-apidocs/html"; \ + echo ""; \ + fi ;\ + fi + +.PHONY: apidox-am-yes apidox-am-no install-data-local install-apidox install-apidox uninstall-local uninstall-apidox uninstall-apidox apidox + + +# Local Variables: +# mode: makefile +# End: diff --git a/HACKING b/HACKING new file mode 100644 index 00000000..8727a4ac --- /dev/null +++ b/HACKING @@ -0,0 +1,9 @@ +To change KDevelop's code please read the API documentation generated by doxygen at: + +http://www.kdevelop.org + +or generate it yourself: + +make apidox ( the generated documentation will be at apidocs/html ) + +or read *.dox files in the doc/api/ directory. diff --git a/HACKING.language b/HACKING.language new file mode 100644 index 00000000..de80e530 --- /dev/null +++ b/HACKING.language @@ -0,0 +1,12 @@ +To find how to add support for a new programming language to KDevelop +please read the API documentation generated by doxygen at: + +http://www.kdevelop.org + +or generate it yourself: + +make apidox ( the generated documentation will be at apidocs/html ) + +or read the file: + +doc/api/HowToAddProgrammingLanguages.dox diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..68fda7fa --- /dev/null +++ b/INSTALL @@ -0,0 +1,175 @@ +To compile your own KDevelop you should follow the instructions at: + +http://www.kdevelop.org/index.html?filename=branches_compiling.html (latest stable version) +http://www.kdevelop.org/index.html?filename=HEAD/branches_compiling.html (latest development version) + +For more generic and not so detailed information, continue to read this file. + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..138c7692 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,54 @@ +COMPILE_FIRST = lib src parts + +EXTRA_DIST = AUTHORS COPYING COPYING.LIB NEWS ChangeLog INSTALL README TODO HACKING HACKING.language admin configure.in.bot + +xdg_apps_DATA = kdevelop.desktop kdevassistant.desktop kdevelop_ruby.desktop \ + kdevelop_c_cpp.desktop kdevelop_kde_cpp.desktop kdevelop_scripting.desktop +#appsdir = $(kde_appsdir)/Development + +xdg_directory_DATA = kde-development-kdevelop.directory + +mime_DATA = x-kdevelop.desktop +mimedir = $(kde_mimedir)/application + +kde_bin_SCRIPTS = kdevprj2kdevelop + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/kdevelop.m4.in + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + $(MAKE) -f $(top_srcdir)/admin/Makefile.common package-messages + $(MAKE) -C po merge + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs + +messages: + find . -type d | grep -v CVS | grep -v '\.svn' | sed -e 's,$$,/,' > dirs + mfs=`find . -name Makefile.am | xargs egrep -l '^messages:'` ;\ + for dir in $$mfs; do \ + if test ! "$$dir" = "./Makefile.am"; then \ + dir=`dirname $$dir` ;\ + egrep -v "^$$dir" dirs > dirs.new && mv dirs.new dirs ;\ + fi ;\ + done + dirs=`cat dirs` ;\ + find $$dirs -maxdepth 1 -name "*.cpp" -print > files ;\ + find $$dirs -maxdepth 1 -name "*.cc" -print >> files ;\ + find $$dirs -maxdepth 1 -name "*.h" -print >> files ;\ + $(EXTRACTRC) `find $$dirs -maxdepth 1 -name "*.rc"` > rc.cpp ;\ + $(EXTRACTRC) `find $$dirs -maxdepth 1 -name "*.ui"` >> rc.cpp ;\ + $(XGETTEXT) rc.cpp `cat files` -o $(podir)/kdevelop.pot + @rm -f rc.cpp dirs files + +$(top_srcdir)/Makefile.am.in: # faking +include admin/deps.am + +DOXYGEN_SEARCHENGINE = YES +DOXYGEN_EMPTY = YES +DOXYGEN_PROJECTNAME = KDevelop Platform API +include Doxyfile.am +SUBDIRS=$(TOPSUBDIRS) +#kdevelop: lib src parts buildtools doc editors embedded kdevdesigner languages mimetypes pics vcs diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 00000000..be59a869 --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,14 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + @if test ! -d admin; then \ + echo "Please recheckout this module!" ;\ + echo "for cvs: use checkout once and after that update again" ;\ + echo "for cvsup: checkout kde-common from cvsup and" ;\ + echo " link kde-common/admin to ./admin" ;\ + exit 1 ;\ + fi + $(MAKE) -f admin/Makefile.common cvs + +.SILENT: diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..e69de29b diff --git a/README b/README new file mode 100644 index 00000000..7e78da87 --- /dev/null +++ b/README @@ -0,0 +1,25 @@ +KDE API Documentation +--------------------------- +If the KDE API documentation does not exist, it can be created +as follows: + + Install doxygen and the kdelibs sources. Then + + make apidox + make install-apidox + +After that you should follow the instructions at: + +http://www.kdevelop.org/index.html?filename=branches_compiling.html + +to compile KDevelop + + +For the graphical classbrowser, you need the program 'dot' +from the graphviz package which can be downloaded from +www.graphviz.org. This is only a runtime dependency! + +If you are experiencing build problems related to .moc files, try + rm *.moc* + make force-reedit +in the source directory where the build system complains. diff --git a/TODO b/TODO new file mode 100644 index 00000000..234753db --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +Please read/update the doc/api/FutureTasks.dox file instead. diff --git a/buildtools/Makefile.am b/buildtools/Makefile.am new file mode 100644 index 00000000..1c61d027 --- /dev/null +++ b/buildtools/Makefile.am @@ -0,0 +1,48 @@ +## +## Do NOT remove the comments that start with "kdevelop:" +## They are actually directives to the kdevelop plugin system +## +## The include_xxxx variables are controlled by configure.in.in +## + +#kdevelop: ADA_BUILDTOOL = ada +if include_ada +ADA_BUILDTOOL = ada +endif + +#kdevelop: ANT_BUILDTOOL = ant +if include_ant +ANT_BUILDTOOL = ant +endif + +#kdevelop: AUTOTOOLS_BUILDTOOL = autotools +if include_autoproject +AUTOTOOLS_BUILDTOOL = autotools +endif + +#kdevelop: CUSTOMMAKEFILES_BUILDTOOL = custommakefiles +if include_customproject +CUSTOMMAKEFILES_BUILDTOOL = custommakefiles +endif + +#kdevelop: PASCAL_BUILDTOOL = pascal +if include_pascal +PASCAL_BUILDTOOL = pascal +endif + +#kdevelop: QMAKE_BUILDTOOL = qmake +if include_trollproject +QMAKE_BUILDTOOL = qmake +endif + +#kdevelop: SCRIPT_BUILDTOOL = script +if include_scriptproject +SCRIPT_BUILDTOOL = script +endif + +SUBDIRS = lib $(ADA_BUILDTOOL) $(ANT_BUILDTOOL) \ + $(AUTOTOOLS_BUILDTOOL) $(CUSTOMMAKEFILES_BUILDTOOL) $(PASCAL_BUILDTOOL) \ + $(QMAKE_BUILDTOOL) $(SCRIPT_BUILDTOOL) + +DOXYGEN_EMPTY = YES +include ../Doxyfile.am diff --git a/buildtools/ada/Makefile.am b/buildtools/ada/Makefile.am new file mode 100644 index 00000000..2de845ca --- /dev/null +++ b/buildtools/ada/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = -I$(top_srcdir)/buildtools/lib/base -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \ + -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevadaproject.la +libkdevadaproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevadaproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la + +libkdevadaproject_la_SOURCES = adaproject_part.cpp adaproject_widget.cpp adaproject_optionsdlgbase.ui adaprojectoptionsdlg.cpp adaglobaloptionsdlg.cpp service.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevadaproject.desktop + +rcdir = $(kde_datadir)/kdevadaproject +rc_DATA = kdevadaproject.rc diff --git a/buildtools/ada/README.dox b/buildtools/ada/README.dox new file mode 100644 index 00000000..24e0bd7e --- /dev/null +++ b/buildtools/ada/README.dox @@ -0,0 +1,17 @@ +/** \class AdaProjectPart +Ada Project: the common project part for all available ada +compilers (currently only gnat). +It holds the project file list and tries to abstract from their specifics. + +\authors Oliver Kellogg + +\unmaintained This part is currently un-maintained + +\deprecated This class is deprecated, use GenericProjectPart (buildtools/generic) instead. + +\feature supports gnat compiler +\feature Holds the project file list and tries to abstract from their specifics + +\requirement Ada gnat compiler + +*/ diff --git a/buildtools/ada/adaglobaloptionsdlg.cpp b/buildtools/ada/adaglobaloptionsdlg.cpp new file mode 100644 index 00000000..a8171c81 --- /dev/null +++ b/buildtools/ada/adaglobaloptionsdlg.cpp @@ -0,0 +1,129 @@ +/* Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include + +#include +#include +#include + +#include "kdevcompileroptions.h" + +#include "service.h" +#include "adaproject_part.h" +#include "adaglobaloptionsdlg.h" + +AdaGlobalOptionsDlg::AdaGlobalOptionsDlg(AdaProjectPart *part, QWidget* parent, const char* name, WFlags fl) + :AdaProjectOptionsDlgBase(parent,name,fl), m_part(part) +{ + delete config_label; + delete config_combo; + delete addconfig_button; + delete removeconfig_button; + delete compiler_label; + delete configuration_layout; + delete configuration_line; + delete exec_label; + delete exec_edit; + delete mainSourceLabel; + delete mainSourceUrl; + delete defaultopts_button; + + offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'"); + + ServiceComboBox::insertStringList(compiler_box, offers, &service_names, &service_execs); + + if (offers.isEmpty()) + options_button->setEnabled(false); + + currentCompiler = QString::null; + + /*kdDebug() << ServiceComboBox::defaultCompiler() << endl; + kdDebug() << ServiceComboBox::itemForText(ServiceComboBox::defaultCompiler(), service_names) << endl; + kdDebug() << compiler_box->text(ServiceComboBox::itemForText(ServiceComboBox::defaultCompiler(), service_names)) << endl; +*/ + ServiceComboBox::setCurrentText(compiler_box, ServiceComboBox::defaultCompiler(), service_names); + compiler_box_activated(compiler_box->currentText()); +} + +AdaGlobalOptionsDlg::~AdaGlobalOptionsDlg() +{ +} + +void AdaGlobalOptionsDlg::optionsButtonClicked() +{ + QString name = ServiceComboBox::currentText(compiler_box, service_names); + KDevCompilerOptions *plugin = m_part->createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, options_edit->text()); + options_edit->setText(flags); + delete plugin; + } +} + +void AdaGlobalOptionsDlg::compiler_box_activated(const QString& text) +{ + kdDebug() << "text changed from " << currentCompiler << " to " << text << endl; + if (currentCompiler == text) + return; + if (!currentCompiler.isEmpty()) + saveCompilerOpts(currentCompiler); + currentCompiler = text; + readCompilerOpts(currentCompiler); +} + +void AdaGlobalOptionsDlg::accept() +{ + saveCompilerOpts(currentCompiler); + + saveConfigCache(); +} + +void AdaGlobalOptionsDlg::saveCompilerOpts( QString compiler ) +{ + configCache[compiler] = options_edit->text(); +} + +void AdaGlobalOptionsDlg::readCompilerOpts( QString compiler ) +{ + QString settings = configCache[compiler]; + if (settings.isEmpty()) + { + KConfig *config = KGlobal::config(); + config->setGroup("Ada Compiler"); + settings = config->readPathEntry(compiler); + } + + options_edit->setText(settings); +} + +void AdaGlobalOptionsDlg::readConfigCache( ) +{ +/* KConfig *config = KGlobal::config(); + config->setGroup("Ada Compiler"); + + QMap settings = config->entryMap("Ada Compiler"); +*/ +} + +void AdaGlobalOptionsDlg::saveConfigCache( ) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Ada Compiler"); + + for (QMap::iterator it = configCache.begin(); it != configCache.end(); ++it) + { + config->writeEntry(it.key(), it.data()); + } +} + +#include "adaglobaloptionsdlg.moc" diff --git a/buildtools/ada/adaglobaloptionsdlg.h b/buildtools/ada/adaglobaloptionsdlg.h new file mode 100644 index 00000000..92001a1b --- /dev/null +++ b/buildtools/ada/adaglobaloptionsdlg.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef ADAGLOBALOPTIONSDLG_H +#define ADAGLOBALOPTIONSDLG_H + +#include + +#include + +#include "adaproject_optionsdlgbase.h" + +class AdaProjectPart; + +class AdaGlobalOptionsDlg : public AdaProjectOptionsDlgBase +{ + Q_OBJECT + +public: + AdaGlobalOptionsDlg(AdaProjectPart *part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~AdaGlobalOptionsDlg(); + +public slots: + virtual void accept(); + +protected slots: + virtual void optionsButtonClicked(); + virtual void compiler_box_activated(const QString& text); + +private: + AdaProjectPart *m_part; + KTrader::OfferList offers; + QString currentCompiler; + QStringList service_names; + QStringList service_execs; + QMap configCache; + + void saveCompilerOpts(QString compiler); + void readCompilerOpts(QString compiler); + + void readConfigCache(); + void saveConfigCache(); +}; + +#endif diff --git a/buildtools/ada/adaproject_optionsdlgbase.ui b/buildtools/ada/adaproject_optionsdlgbase.ui new file mode 100644 index 00000000..72e99f74 --- /dev/null +++ b/buildtools/ada/adaproject_optionsdlgbase.ui @@ -0,0 +1,472 @@ + +AdaProjectOptionsDlgBase + + + AdaProjectOptionsDlgBase + + + true + + + + 0 + 0 + 600 + 480 + + + + Ada Compiler + + + + unnamed + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 160 + + + + + + configuration_layout + + + + unnamed + + + + + config_label + + + + 1 + 5 + 0 + 0 + + + + Configuration: + + + + + config_combo + + + + 3 + 0 + 0 + 0 + + + + true + + + + + Spacer17_2 + + + Horizontal + + + Fixed + + + + 20 + 8 + + + + + + addconfig_button + + + Add + + + + + removeconfig_button + + + Remove + + + + + Spacer18_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + options_button + + + + 0 + 0 + 0 + 0 + + + + + 30 + 32767 + + + + ... + + + + + options_label + + + + 4 + 5 + 0 + 0 + + + + Compiler &options: + + + compiler_box + + + + + compiler_label + + + + 4 + 5 + 0 + 0 + + + + Ada &compiler: + + + compiler_box + + + + + exec_edit + + + + + options_edit + + + + + compiler_box + + + + + exec_label + + + + 4 + 5 + 0 + 0 + + + + Compiler co&mmand: + + + compiler_box + + + + + configuration_line + + + HLine + + + Sunken + + + Horizontal + + + + + spacer11 + + + Vertical + + + Fixed + + + + 20 + 16 + + + + + + spacer12 + + + Vertical + + + Fixed + + + + 20 + 16 + + + + + + mainSourceUrl + + + + 0 + 26 + + + + WheelFocus + + + + + mainSourceLabel + + + + 4 + 5 + 0 + 0 + + + + Main &source file: + + + compiler_box + + + + + spacer13 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 400 + 20 + + + + + + defaultopts_button + + + Load Default Compiler Options + + + + + + + compiler_box + activated(const QString&) + AdaProjectOptionsDlgBase + compiler_box_activated(const QString&) + + + removeconfig_button + clicked() + AdaProjectOptionsDlgBase + configRemoved() + + + config_combo + textChanged(const QString&) + AdaProjectOptionsDlgBase + configComboTextChanged(const QString&) + + + config_combo + activated(const QString&) + AdaProjectOptionsDlgBase + configChanged(const QString&) + + + addconfig_button + clicked() + AdaProjectOptionsDlgBase + configAdded() + + + options_button + clicked() + AdaProjectOptionsDlgBase + optionsButtonClicked() + + + exec_edit + textChanged(const QString&) + AdaProjectOptionsDlgBase + setDirty() + + + options_edit + textChanged(const QString&) + AdaProjectOptionsDlgBase + setDirty() + + + mainSourceUrl + textChanged(const QString&) + AdaProjectOptionsDlgBase + setDirty() + + + mainSourceUrl + urlSelected(const QString&) + AdaProjectOptionsDlgBase + setDirty() + + + compiler_box + activated(const QString&) + AdaProjectOptionsDlgBase + setDirty() + + + compiler_box + textChanged(const QString&) + AdaProjectOptionsDlgBase + setDirty() + + + defaultopts_button + clicked() + AdaProjectOptionsDlgBase + setDefaultOptions() + + + defaultopts_button + clicked() + AdaProjectOptionsDlgBase + setDirty() + + + + compiler_box + exec_edit + options_edit + options_button + mainSourceUrl + config_combo + addconfig_button + removeconfig_button + + + compiler_box_activated(const QString&) + addconfig_button_clicked() + configRemoved() + configComboTextChanged(const QString&) + configChanged(const QString&) + optionsButtonClicked() + configAdded() + setDirty() + setDefaultOptions() + + + kdialog.h + + + + + qwidget.h + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/ada/adaproject_part.cpp b/buildtools/ada/adaproject_part.cpp new file mode 100644 index 00000000..33ba166b --- /dev/null +++ b/buildtools/ada/adaproject_part.cpp @@ -0,0 +1,465 @@ +/* Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#include "adaproject_part.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevmakefrontend.h" +#include "kdevappfrontend.h" +#include "kdevpartcontroller.h" +#include "kdevlanguagesupport.h" +#include "kdevcompileroptions.h" +#include "kdevgenericfactory.h" +#include + +#include "adaproject_widget.h" +#include "adaprojectoptionsdlg.h" +#include "adaglobaloptionsdlg.h" + +typedef KDevGenericFactory AdaProjectFactory; +static const KDevPluginInfo data("kdevadaproject"); +K_EXPORT_COMPONENT_FACTORY( libkdevadaproject, AdaProjectFactory( data ) ) + +AdaProjectPart::AdaProjectPart(QObject *parent, const char *name, const QStringList& ) + :KDevBuildTool(&data, parent, name ? name : "AdaProjectPart" ) +{ + setInstance(AdaProjectFactory::instance()); + setXMLFile("kdevadaproject.rc"); + + KAction *action; + action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8, + this, SLOT(slotBuild()), + actionCollection(), "build_build" ); + action = new KAction( i18n("Execute Program"), "exec", 0, + this, SLOT(slotExecute()), + actionCollection(), "build_execute" ); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + + connect( core(), SIGNAL(configWidget(KDialogBase*)), + this, SLOT(configWidget(KDialogBase*)) ); + +// m_widget = new AdaProjectWidget(this); + +// QWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?")); + + // now you decide what should happen to the widget. Take a look at kdevcore.h + // or at other plugins how to embed it. + + // if you want to embed your widget as an outputview, simply uncomment + // the following line. + + // mainWindow()->embedOutputView( m_widget, "name that should appear", "enter a tooltip" ); + +} + +AdaProjectPart::~AdaProjectPart() +{ +// delete m_widget; +} + +/** + * This should really be merged with FileTreeWidget::matchesHidePattern() + * and put in its own class. Currently this is repeated in scriptprojectpart.cpp, pascalproject_part.cpp, adaproject_part.cpp + */ +static bool matchesPattern(const QString &fileName, const QStringList &patternList) +{ + QStringList::ConstIterator it; + for (it = patternList.begin(); it != patternList.end(); ++it) { + QRegExp re(*it, true, true); + if (re.search(fileName) == 0 && re.matchedLength() == (int)fileName.length()) + return true; + } + + return false; +} + +void AdaProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + m_buildDir = dirName; + m_projectDir = dirName; + m_projectName = projectName; + + QDomDocument &dom = *projectDom(); + // Set the default directory radio to "executable" + if (DomUtil::readEntry(dom, "/kdevadaproject/run/directoryradio") == "" ) { + DomUtil::writeEntry(dom, "/kdevadaproject/run/directoryradio", "executable"); + } + + loadProjectConfig(); + + // Put all files from all subdirectories into file list + QValueStack s; + int prefixlen = m_projectDir.length()+1; + s.push(m_projectDir); + + QStringList includepatternList; + + if ( languageSupport() ) + { + KMimeType::List list = languageSupport()->mimeTypes(); + KMimeType::List::Iterator it = list.begin(); + while( it != list.end() ){ + includepatternList += (*it)->patterns(); + ++it; + } + } + + QString excludepatterns = "*~"; + QStringList excludepatternList = QStringList::split(",", excludepatterns); + + QDir dir; + do { + dir.setPath(s.pop()); + kdDebug() << "AdaProjectPart::openProject examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + if( !dirEntries ) + break; + + QPtrListIterator it(*dirEntries); + for (; it.current(); ++it) { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + QString path = it.current()->absFilePath(); + if (it.current()->isDir()) { + kdDebug() << "AdaProjectPart::openProject pushing: " << path << endl; + s.push(path); + } + else { + if (matchesPattern(path, includepatternList) + && !matchesPattern(path, excludepatternList)) { + kdDebug() << "AdaProjectPart::openProject adding: " << path << endl; + m_sourceFiles.append(path.mid(prefixlen)); + } else { + kdDebug() << "AdaProjectPart::openProject ignoring: " << path << endl; + } + } + } + } while (!s.isEmpty()); + + KDevProject::openProject( dirName, projectName ); +} + +void AdaProjectPart::closeProject() +{ +} + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList AdaProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry(*projectDom(), "/kdevadaproject/run/envvars", "envvar", "name", "value"); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString AdaProjectPart::runDirectory() const +{ + QString cwd = defaultRunDirectory("kdevadaproject"); + if (cwd.isEmpty()) + cwd = buildDirectory(); + return cwd; +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ +QString AdaProjectPart::mainProgram() const +{ + QDomDocument * dom = projectDom(); + + if ( !dom ) return QString(); + + QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevadaproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + + return QString(); +} + +/** Retuns a QString with the run command line arguments */ +QString AdaProjectPart::debugArguments() const +{ + return DomUtil::readEntry(*projectDom(), "/kdevadaproject/run/globaldebugarguments"); +} + + +/** Retuns a QString with the run command line arguments */ +QString AdaProjectPart::runArguments() const +{ + return DomUtil::readEntry(*projectDom(), "/kdevadaproject/run/programargs"); +} + +QString AdaProjectPart::mainSource() const +{ + return projectDirectory() + "/" + m_mainSource; +} + +void AdaProjectPart::setMainSource(QString fullPath) +{ + QString olddir = activeDirectory(); + m_mainSource = fullPath.replace(QRegExp(QString(projectDirectory() + QString("/"))),""); + emit activeDirectoryChanged( olddir, activeDirectory() ); +} + +QString AdaProjectPart::projectDirectory() const +{ + return m_projectDir; +} + +QString AdaProjectPart::projectName() const +{ + return m_projectName; +} + +QString AdaProjectPart::activeDirectory() const +{ + QFileInfo fi(mainSource()); + return fi.dirPath(true).replace(QRegExp(projectDirectory()),""); +} + +QString AdaProjectPart::buildDirectory() const +{ + QFileInfo fi(mainSource()); + return fi.dirPath(true); +} + +void AdaProjectPart::listOfFiles(QStringList &result, QString path) const +{ + QDir d(path); + if (!d.exists()) + return; + + const QFileInfoList *entries = d.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden); + if( !entries ) + return; + + QFileInfoListIterator it( *entries ); + while( const QFileInfo* fileInfo = it.current() ) + { + ++it; + + if (fileInfo->isDir() && fileInfo->filePath() != path) + { + kdDebug() << "entering dir " << fileInfo->dirPath() << endl; + listOfFiles(result, fileInfo->dirPath()); + } + else + { + kdDebug() << "adding to result: " << fileInfo->filePath() << endl; + result << fileInfo->filePath(); + } + } +} + +QStringList AdaProjectPart::allFiles() const +{ +// QStringList files; + +// listOfFiles(files, projectDirectory()); + +// return files; + return m_sourceFiles; +} + +void AdaProjectPart::addFile(const QString& /*fileName*/) +{ +} + +void AdaProjectPart::addFiles(const QStringList& /*fileList*/) +{ +} + +void AdaProjectPart::removeFile(const QString& /*fileName*/) +{ +} + +void AdaProjectPart::removeFiles(const QStringList& /*fileList*/) +{ +} + +void AdaProjectPart::slotBuild() +{ + if (partController()->saveAllFiles()==false) + return; //user cancelled + + QString cmdline = m_compilerExec + " " + m_compilerOpts + " "; + + if (cmdline.isEmpty()) + { + KMessageBox::sorry(0, i18n("Could not find ada compiler.\nCheck if your compiler settings are correct.")); + return; + } + + QFileInfo fi(mainSource()); + cmdline += fi.fileName(); + + QString dircmd = "cd "; + dircmd += KProcess::quote(buildDirectory()); + dircmd += " && "; + + makeFrontend()->queueCommand(buildDirectory(), dircmd + cmdline); +} + +void AdaProjectPart::slotExecute() +{ + partController()->saveAllFiles(); + QString program = "./"; + appFrontend()->startAppCommand(buildDirectory(), mainProgram(), true); +} + +void AdaProjectPart::changedFiles( const QStringList & fileList ) +{ + KDevProject::changedFiles(fileList); +} + +void AdaProjectPart::changedFile( const QString & fileName ) +{ + KDevProject::changedFile(fileName); +} + +void AdaProjectPart::projectConfigWidget( KDialogBase * dlg ) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Ada Compiler")); + AdaProjectOptionsDlg *w = new AdaProjectOptionsDlg(this, vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); + connect( dlg, SIGNAL(okClicked()), this, SLOT(loadProjectConfig()) ); +} + +void AdaProjectPart::loadProjectConfig( ) +{ + QDomDocument &dom = *(projectDom()); + + QString config = DomUtil::readEntry(dom, "/kdevadaproject/general/useconfiguration", "default"); + m_mainSource = DomUtil::readEntry(dom, QString("/kdevadaproject/configurations/") + config + QString("/mainsource") ); + m_compilerOpts = DomUtil::readEntry(dom, QString("/kdevadaproject/configurations/") + config + QString("/compileroptions")); + m_compilerExec = DomUtil::readEntry(dom, QString("/kdevadaproject/configurations/") + config + QString("/compilerexec")); + + if (m_compilerExec.isEmpty()) + { + KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'"); + QValueList::ConstIterator it; + for (it = offers.begin(); it != offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + m_compilerExec = (*it)->exec(); + break; + } + } + } +} + +void AdaProjectPart::configWidget( KDialogBase * dlg ) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Ada Compiler")); + AdaGlobalOptionsDlg *w = new AdaGlobalOptionsDlg(this, vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + +KDevCompilerOptions *AdaProjectPart::createCompilerOptions(const QString &name) +{ + KService::Ptr service = KService::serviceByDesktopName(name); + if (!service) { + kdDebug() << "AdaProjectPart::createCompilerOptions can't find service " << name; + return 0; + } + + KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library())); + if (!factory) { + QString errorMessage = KLibLoader::self()->lastErrorMessage(); + KMessageBox::error(0, i18n("There was an error loading the module %1.\n" + "The diagnostics are:\n%2").arg(service->name()).arg(errorMessage)); + exit(1); + } + + QStringList args; + QVariant prop = service->property("X-KDevelop-Args"); + if (prop.isValid()) + args = QStringList::split(" ", prop.toString()); + + QObject *obj = factory->create(this, service->name().latin1(), + "KDevCompilerOptions", args); + + if (!obj->inherits("KDevCompilerOptions")) { + kdDebug() << "AdaProjectPart::createCompilerOptions: component does not inherit KDevCompilerOptions" << endl; + return 0; + } + KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj; + + return dlg; +} + +QString AdaProjectPart::defaultOptions( const QString compiler ) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Ada Compiler"); + return config->readPathEntry(compiler); +} + +#include "adaproject_part.moc" + + +/*! + \fn AdaProjectPart::distFiles() const + */ +QStringList AdaProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QDir dir(projectDir); + QStringList files = dir.entryList( "Makefile"); + return sourceList + files; +} diff --git a/buildtools/ada/adaproject_part.h b/buildtools/ada/adaproject_part.h new file mode 100644 index 00000000..88966ae2 --- /dev/null +++ b/buildtools/ada/adaproject_part.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef __KDEVPART_ADAPROJECT_H__ +#define __KDEVPART_ADAPROJECT_H__ + +#include + +#include "kdevbuildtool.h" + +class AdaProjectWidget; +class KDialogBase; +class KDevCompilerOptions; + +class AdaProjectPart : public KDevBuildTool +{ + Q_OBJECT +public: + AdaProjectPart(QObject *parent, const char *name, const QStringList &); + ~AdaProjectPart(); + + virtual void openProject(const QString &dirName, const QString &projectName); + virtual void closeProject(); + + /**Returns the name of the main source file without extension. + We assume that all Ada compilers call the binary that way. */ + virtual QString mainProgram() const; + /**Main source file (like src/main.adb)*/ + virtual QString mainSource() const; + virtual void setMainSource(QString fullPath); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString activeDirectory() const; + /**The location of the main source file*/ + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + + /**Returns everything in the project directory*/ + virtual QStringList allFiles() const; + /**This does absolutelly nothing*/ + virtual void addFile(const QString &fileName); + /**This does absolutelly nothing*/ + virtual void addFiles(const QStringList &fileList); + /**This does absolutelly nothing*/ + virtual void removeFile(const QString &fileName); + /**This does absolutelly nothing*/ + virtual void removeFiles(const QStringList &fileList); + + virtual void changedFiles( const QStringList & fileList ); + virtual void changedFile( const QString & fileName ); + + KDevCompilerOptions *createCompilerOptions(const QString &name); + + virtual QString defaultOptions(const QString compiler); + QStringList distFiles() const; + +public slots: + /**loads config from project file*/ + void loadProjectConfig(); + +private slots: + void slotBuild(); + void slotExecute(); + void projectConfigWidget(KDialogBase *dlg); + void configWidget(KDialogBase *dlg); + +private: + QGuardedPtr m_widget; + + void listOfFiles(QStringList &result, QString path) const; + + QString m_buildDir; + QString m_projectDir; + QString m_projectName; + + QString m_mainProg; + QString m_mainSource; + QString m_compilerExec; + QString m_compilerOpts; + + QStringList m_sourceFiles; +}; + +#endif diff --git a/buildtools/ada/adaproject_widget.cpp b/buildtools/ada/adaproject_widget.cpp new file mode 100644 index 00000000..d4bdf37b --- /dev/null +++ b/buildtools/ada/adaproject_widget.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +#include + +#include "adaproject_part.h" +#include "adaproject_widget.h" + + +AdaProjectWidget::AdaProjectWidget(AdaProjectPart *part) + : QWidget(0, "AdaProject widget") +{ + Q_UNUSED( part ); +} + + +AdaProjectWidget::~AdaProjectWidget() +{ +} + + +#include "adaproject_widget.moc" diff --git a/buildtools/ada/adaproject_widget.h b/buildtools/ada/adaproject_widget.h new file mode 100644 index 00000000..dc6b4ec4 --- /dev/null +++ b/buildtools/ada/adaproject_widget.h @@ -0,0 +1,21 @@ +#ifndef __ADAPROJECT_WIDGET_H__ +#define __ADAPROJECT_WIDGET_H__ + +#include +#include + +class KDevProject; +class AdaProjectPart; + +class AdaProjectWidget : public QWidget +{ + Q_OBJECT + +public: + + AdaProjectWidget(AdaProjectPart *part); + ~AdaProjectWidget(); + +}; + +#endif diff --git a/buildtools/ada/adaprojectoptionsdlg.cpp b/buildtools/ada/adaprojectoptionsdlg.cpp new file mode 100644 index 00000000..3eafb082 --- /dev/null +++ b/buildtools/ada/adaprojectoptionsdlg.cpp @@ -0,0 +1,208 @@ +/* Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "domutil.h" +#include "kdevcompileroptions.h" + +#include "service.h" +#include "adaproject_part.h" +#include "adaprojectoptionsdlg.h" + +AdaProjectOptionsDlg::AdaProjectOptionsDlg(AdaProjectPart *part, QWidget* parent, const char* name, WFlags fl) + : AdaProjectOptionsDlgBase(parent,name, fl), m_part(part) +{ + config_combo->setValidator(new QRegExpValidator(QRegExp("^\\D.*"), this)); + + offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'"); + + ServiceComboBox::insertStringList(compiler_box, offers, &service_names, &service_execs); + + if (offers.isEmpty()) + options_button->setEnabled(false); + + allConfigs = allBuildConfigs(); + config_combo->insertStringList(allConfigs); + + dirty = false; + + QDomDocument &dom = *(m_part->projectDom()); + currentConfig = QString::null; + configChanged(DomUtil::readEntry(dom, "/kdevadaproject/general/useconfiguration", "default")); +} + +AdaProjectOptionsDlg::~AdaProjectOptionsDlg() +{ +} + +QStringList AdaProjectOptionsDlg::allBuildConfigs() +{ + QDomDocument &dom = *(m_part->projectDom()); + + QStringList allConfigs; + allConfigs.append("default"); + + QDomNode node = dom.documentElement().namedItem("kdevadaproject").namedItem("configurations"); + QDomElement childEl = node.firstChild().toElement(); + while (!childEl.isNull()) { + QString config = childEl.tagName(); + kdDebug() << "Found config " << config << endl; + if (config != "default") + allConfigs.append(config); + childEl = childEl.nextSibling().toElement(); + } + + return allConfigs; +} + +void AdaProjectOptionsDlg::accept() +{ + DomUtil::writeEntry(*m_part->projectDom(), "/kdevadaproject/general/useconfiguration", currentConfig); + if (dirty) + { + saveConfig(currentConfig); + } +} + +void AdaProjectOptionsDlg::compiler_box_activated( const QString& /*s*/ ) +{ + QString exec = ServiceComboBox::currentText(compiler_box, service_execs); + exec_edit->setText(exec); +} + +void AdaProjectOptionsDlg::saveConfig( QString config ) +{ + QDomDocument dom = *m_part->projectDom(); + QString prefix = "/kdevadaproject/configurations/" + config + "/"; + + DomUtil::writeEntry(dom, prefix + "compiler", + ServiceComboBox::currentText(compiler_box, service_names)); + DomUtil::writeEntry(dom, prefix + "compileroptions", options_edit->text()); + DomUtil::writeEntry(dom, prefix + "compilerexec", exec_edit->text()); + DomUtil::writeEntry(dom, prefix + "mainsource", mainSourceUrl->url().replace(QRegExp(m_part->projectDirectory() + QString("/")),"")); +} + +void AdaProjectOptionsDlg::readConfig( QString config ) +{ + QDomDocument dom = *m_part->projectDom(); + QString prefix = "/kdevadaproject/configurations/" + config + "/"; + + QString compiler = DomUtil::readEntry(dom, prefix + "compiler", ""); + + if (compiler.isEmpty()) + { + offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'"); + QValueList::ConstIterator it; + for (it = offers.begin(); it != offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + compiler = (*it)->name(); + kdDebug() << "compiler is " << compiler << endl; + break; + } + } + } + ServiceComboBox::setCurrentText(compiler_box, compiler, service_names); + + QString exec = DomUtil::readEntry(dom, prefix + "compilerexec", ""); + if (exec.isEmpty()) + exec = ServiceComboBox::currentText(compiler_box, service_execs); + exec_edit->setText(exec); + options_edit->setText(DomUtil::readEntry(dom, prefix + "compileroptions")); + mainSourceUrl->setURL(m_part->projectDirectory() + "/" + DomUtil::readEntry(dom, prefix + "mainsource")); +} + +void AdaProjectOptionsDlg::configComboTextChanged(const QString &config) +{ + bool canAdd = !allConfigs.contains(config) && !config.contains("/") && !config.isEmpty(); + bool canRemove = allConfigs.contains(config) && config != "default"; + addconfig_button->setEnabled(canAdd); + removeconfig_button->setEnabled(canRemove); +} + + +void AdaProjectOptionsDlg::configChanged(const QString &config) +{ + if (config == currentConfig || !allConfigs.contains(config)) + return; + + if (!currentConfig.isNull() && dirty) + saveConfig(currentConfig); + + currentConfig = config; + readConfig(config); + dirty = false; + + config_combo->blockSignals(true); + config_combo->setEditText(config); + config_combo->blockSignals(false); +} + + +void AdaProjectOptionsDlg::configAdded() +{ + QString config = config_combo->currentText(); + + allConfigs.append(config); + + config_combo->clear(); + config_combo->insertStringList(allConfigs); + configChanged(config); + setDirty(); // force saving +} + + +void AdaProjectOptionsDlg::configRemoved() +{ + QString config = config_combo->currentText(); + + QDomDocument dom = *m_part->projectDom(); + QDomNode node = dom.documentElement().namedItem("kdevadaproject").namedItem("configurations"); + node.removeChild(node.namedItem(config)); + allConfigs.remove(config); + + config_combo->clear(); + config_combo->insertStringList(allConfigs); + + currentConfig = QString::null; + configChanged("default"); +} + +void AdaProjectOptionsDlg::optionsButtonClicked( ) +{ + QString name = ServiceComboBox::currentText(compiler_box, service_names); + KDevCompilerOptions *plugin = m_part->createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, options_edit->text()); + options_edit->setText(flags); + delete plugin; + } +} + +void AdaProjectOptionsDlg::setDirty( ) +{ + dirty = true; +} + +void AdaProjectOptionsDlg::setDefaultOptions( ) +{ + if (!compiler_box->currentText().isEmpty()) + options_edit->setText(m_part->defaultOptions(compiler_box->currentText())); +} + +#include "adaprojectoptionsdlg.moc" diff --git a/buildtools/ada/adaprojectoptionsdlg.h b/buildtools/ada/adaprojectoptionsdlg.h new file mode 100644 index 00000000..d91c5266 --- /dev/null +++ b/buildtools/ada/adaprojectoptionsdlg.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef ADAPROJECTOPTIONSDLG_H +#define ADAPROJECTOPTIONSDLG_H + +#include + +#include "adaproject_optionsdlgbase.h" + +class AdaProjectPart; +class KDevCompilerOptions; + +class AdaProjectOptionsDlg : public AdaProjectOptionsDlgBase +{ + Q_OBJECT + +public: + AdaProjectOptionsDlg(AdaProjectPart *part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~AdaProjectOptionsDlg(); + +public slots: + virtual void accept(); + +protected slots: + virtual void compiler_box_activated(const QString &s); + void configComboTextChanged(const QString &config); + void configChanged(const QString &config); + void configAdded(); + void configRemoved(); + void optionsButtonClicked(); + void setDirty(); + void setDefaultOptions(); + +private: + QStringList allConfigs; + QString currentConfig; + bool dirty; + + KTrader::OfferList offers; + QStringList service_names; + QStringList service_execs; + + AdaProjectPart *m_part; + + void saveConfig(QString config); + void readConfig(QString config); + QStringList allBuildConfigs(); +}; + +#endif + diff --git a/buildtools/ada/kdevadaproject.desktop b/buildtools/ada/kdevadaproject.desktop new file mode 100644 index 00000000..0e306f4b --- /dev/null +++ b/buildtools/ada/kdevadaproject.desktop @@ -0,0 +1,100 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Ada Project +Comment[br]=Raktres Ada +Comment[ca]=Projecte Ada +Comment[cs]=Ada projekt +Comment[da]=Ada-projekt +Comment[de]=Ada-Projekt für KDevelop +Comment[el]=Έργο Ada +Comment[es]=Proyecto Ada +Comment[et]=Ada projekt +Comment[eu]=Ada proiektua +Comment[fa]=پروژۀ آدا +Comment[fr]=Projet en Ada +Comment[ga]=Tionscadal Ada +Comment[gl]=Proxecto Ada +Comment[hi]=एडीए परियोजना +Comment[hu]=Ada-projekt +Comment[is]=Ada verkefni +Comment[it]=Progetto Ada +Comment[ja]=Ada プロジェクト +Comment[ms]=Projek Ada +Comment[nds]=Ada-Projekt +Comment[ne]=एडा परियोजना +Comment[nl]=Ada-project +Comment[pa]=Ada ਪ੍ਰੋਜੈਕਟ +Comment[pl]=Projekt: Ada +Comment[pt]=Projecto Ada +Comment[pt_BR]=Projeto Ada +Comment[ro]=Proiect Ada +Comment[ru]=Проект Ada +Comment[sk]=Ada projekt +Comment[sl]=Projekt Ada +Comment[sr]=Ada пројекат +Comment[sr@Latn]=Ada projekat +Comment[sv]=Ada-projekt +Comment[ta]=அடா பிராஜக்ட் +Comment[tg]=Лоиҳаи Ada +Comment[tr]=Ada Projesi +Comment[uz]=Ada loyihasi +Comment[uz@cyrillic]=Ada лойиҳаси +Comment[zh_CN]=Ada 工程 +Comment[zh_TW]=Ada 專案 +Name=KDevAdaProject +Name[da]=KDevelop Ada-projekt +Name[de]=Ada-Projekt (KDevelop) +Name[fr]=Projet Ada pour KDevelop +Name[hi]=के-डेव-एडीए-परियोजना +Name[nds]=Ada-Projekt (KDevelop) +Name[ne]=केडीई विकास एडा परियोजना +Name[pl]=KDevProjektAda +Name[sk]=KDevAdaProjekt +Name[sv]=KDevelop Ada-projekt +Name[ta]=கெடெவ் அடா பிராஜக்ட் +Name[tg]=Лоиҳаи KDevAda +Name[zh_TW]=KDevelop Ada 專案 +GenericName=Ada Project +GenericName[br]=Raktres Ada +GenericName[ca]=Projecte Ada +GenericName[da]=Ada-projekt +GenericName[de]=Ada-Projekt +GenericName[el]=Έργο Ada +GenericName[es]=Proyecto Ada +GenericName[et]=Ada projekt +GenericName[eu]=Ada proiektua +GenericName[fa]=پروژۀ آدا +GenericName[fr]=Projet en Ada +GenericName[ga]=Tionscadal Ada +GenericName[gl]=Proxecto Ada +GenericName[hi]=एडीए परियोजना +GenericName[hu]=Ada-projekt +GenericName[is]=Ada verkefni +GenericName[it]=Project con Ada +GenericName[ja]=Ada プロジェクト +GenericName[ms]=Projek Ada +GenericName[nds]=Ada-Projekt +GenericName[ne]=एडा परियोजना +GenericName[nl]=Ada-project +GenericName[pa]=Ada ਪ੍ਰੋਜੈਕਟ +GenericName[pl]=Projekt: Ada +GenericName[pt]=Projecto Ada +GenericName[pt_BR]=Projeto Ada +GenericName[ru]=Проект Ada +GenericName[sk]=Ada projekt +GenericName[sl]=Projekt Ada +GenericName[sr]=Ada пројекат +GenericName[sr@Latn]=Ada projekat +GenericName[sv]=Ada-projekt +GenericName[ta]=அடா பிராஜக்ட் +GenericName[tg]=Лоиҳаи Ada +GenericName[tr]=Ada Projesi +GenericName[uz]=Ada loyihasi +GenericName[uz@cyrillic]=Ada лойиҳаси +GenericName[zh_CN]=Ada 工程 +GenericName[zh_TW]=Ada 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevadaproject +X-KDevelop-Version=5 +X-KDevelop-Language=Ada diff --git a/buildtools/ada/kdevadaproject.rc b/buildtools/ada/kdevadaproject.rc new file mode 100644 index 00000000..d7f260e1 --- /dev/null +++ b/buildtools/ada/kdevadaproject.rc @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/buildtools/ada/service.cpp b/buildtools/ada/service.cpp new file mode 100644 index 00000000..02081a58 --- /dev/null +++ b/buildtools/ada/service.cpp @@ -0,0 +1,75 @@ +/* Copyright (C) 2001-2002 by Bernd Gehrmann + * bernd@kdevelop.org + * Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include + +#include +#include + +#include "service.h" + + +void ServiceComboBox::insertStringList(QComboBox *combo, const QValueList &list, + QStringList *names, QStringList *execs) +{ + QValueList::ConstIterator it; + for (it = list.begin(); it != list.end(); ++it) { + combo->insertItem((*it)->comment()); + (*names) << (*it)->desktopEntryName(); + (*execs) << (*it)->exec(); + kdDebug() << "insertStringList item " << (*it)->name() << "," << (*it)->exec() << endl; + } +} + +QString ServiceComboBox::currentText(QComboBox *combo, const QStringList &names) +{ + if (combo->currentItem() == -1) + return QString::null; + return names[combo->currentItem()]; +} + +void ServiceComboBox::setCurrentText(QComboBox *combo, const QString &str, const QStringList &names) +{ + QStringList::ConstIterator it; + int i = 0; + for (it = names.begin(); it != names.end(); ++it) { + if (*it == str) { + combo->setCurrentItem(i); + break; + } + ++i; + } +} + +int ServiceComboBox::itemForText(const QString &str, const QStringList &names) +{ + QStringList::ConstIterator it; + int i = 0; + for (it = names.begin(); it != names.end(); ++it) { + if (*it == str) { + return i; + } + ++i; + } + return 0; +} + +QString ServiceComboBox::defaultCompiler() +{ + KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'"); + QValueList::ConstIterator it; + for (it = offers.begin(); it != offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + return (*it)->name();; + } + } + return ""; +} diff --git a/buildtools/ada/service.h b/buildtools/ada/service.h new file mode 100644 index 00000000..f9671d0a --- /dev/null +++ b/buildtools/ada/service.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2001-2002 by Bernd Gehrmann + * bernd@kdevelop.org + * Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef SERVICE_H +#define SERVICE_H + +#include + +class ServiceComboBox +{ +public: + static void insertStringList(QComboBox *combo, const QValueList &list, + QStringList *names, QStringList *execs); + static QString currentText(QComboBox *combo, const QStringList &names); + static void setCurrentText(QComboBox *combo, const QString &str, const QStringList &names); + static int itemForText(const QString &str, const QStringList &names); + static QString defaultCompiler(); +}; + +#endif diff --git a/buildtools/ant/Makefile.am b/buildtools/ant/Makefile.am new file mode 100644 index 00000000..6a92a5b1 --- /dev/null +++ b/buildtools/ant/Makefile.am @@ -0,0 +1,21 @@ +# Here resides the ant project part. + +INCLUDES = -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_builddir)/buildtools/lib/widgets \ + $(all_includes) + +kde_module_LTLIBRARIES = libkdevantproject.la +libkdevantproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevantproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la + +libkdevantproject_la_SOURCES = antprojectpart.cpp antoptionswidget.ui classpathwidget.ui + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevantproject.desktop + +rcdir = $(kde_datadir)/kdevantproject +rc_DATA = kdevantproject.rc diff --git a/buildtools/ant/README.dox b/buildtools/ant/README.dox new file mode 100644 index 00000000..b4b8a7c9 --- /dev/null +++ b/buildtools/ant/README.dox @@ -0,0 +1,8 @@ +/** \class AntProjectPart +ant build tool part. + +\authors Matthias Hoelzer-Kluepfel + +\unmaintained This part is currently un-maintained + +*/ diff --git a/buildtools/ant/antoptionswidget.ui b/buildtools/ant/antoptionswidget.ui new file mode 100644 index 00000000..fa78e97f --- /dev/null +++ b/buildtools/ant/antoptionswidget.ui @@ -0,0 +1,173 @@ + +AntOptionsWidget + + + AntOptionsWidget + + + + 0 + 0 + 410 + 266 + + + + + unnamed + + + + + Quiet + + + + + Verbose + + + + + Debug + + + + Verbosity + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 16 + 86 + + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 16 + 86 + + + + + + TextLabel1 + + + &Build file: + + + BuildXML + + + + + TextLabel2 + + + &Verbosity: + + + Verbosity + + + + + TextLabel3 + + + &Properties: + + + AlignTop + + + Properties + + + + + + Property + + + + + Value + + + + Properties + + + 0 + + + 2 + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 240 + 16 + + + + + + BuildXML + + + + + + BuildXML + Verbosity + Properties + + + kcombobox.h + klineedit.h + kpushbutton.h + kdialog.h + + + + + kcombobox.h + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/ant/antprojectpart.cpp b/buildtools/ant/antprojectpart.cpp new file mode 100644 index 00000000..a7f0ea25 --- /dev/null +++ b/buildtools/ant/antprojectpart.cpp @@ -0,0 +1,608 @@ +#include "antprojectpart.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +#include "antoptionswidget.h" +#include "classpathwidget.h" + + + + +typedef KDevGenericFactory AntProjectFactory; +static const KDevPluginInfo data("kdevantproject"); +K_EXPORT_COMPONENT_FACTORY(libkdevantproject, AntProjectFactory( data )) + + +AntOptions::AntOptions() + : m_buildXML("build.xml"), m_verbosity(AntOptions::Quiet) +{ +} + + +AntProjectPart::AntProjectPart(QObject *parent, const char *name, const QStringList &) + : KDevBuildTool(&data, parent, name ? name : "AntProjectPart") +{ + setInstance(AntProjectFactory::instance()); + + setXMLFile("kdevantproject.rc"); + + m_buildProjectAction = new KAction(i18n("&Build Project"), "make_kdevelop", Key_F8, + this, SLOT(slotBuild()), + actionCollection(), "build_build" ); + m_buildProjectAction->setToolTip(i18n("Build project")); + m_buildProjectAction->setWhatsThis(i18n("Build project

Executes ant dist command to build the project.")); + + KActionMenu *menu = new KActionMenu(i18n("Build &Target"), + actionCollection(), "build_target" ); + menu->setToolTip(i18n("Build target")); + menu->setWhatsThis(i18n("Build target

Executes ant target_name command to build the specified target.")); + + m_targetMenu = menu->popupMenu(); + + connect(m_targetMenu, SIGNAL(activated(int)), this, SLOT(slotTargetMenuActivated(int))); + connect(core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*))); + connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *))); + + m_antOptionsWidget = 0; +} + + +AntProjectPart::~AntProjectPart() +{ +} + + +void AntProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + m_projectDirectory = dirName; + m_projectName = projectName; + + QDomDocument &dom = *projectDom(); + // Set the default directory radio to "executable" + /// \FIXME there is no kdevantproject so this will not work ! + if (DomUtil::readEntry(dom, "/kdevantproject/run/directoryradio") == "" ) { + DomUtil::writeEntry(dom, "/kdevantproject/run/directoryradio", "executable"); + } + + /// @todo read alternative build file from properties + m_antOptions.m_buildXML = "build.xml"; + + parseBuildXML(); + + fillMenu(); + + QFile f(dirName + "/" + projectName.lower() + ".kdevelop" + ".filelist"); + if (f.open(IO_ReadOnly)) + { + QTextStream stream(&f); + while (!stream.atEnd()) + { + QString s = stream.readLine(); + if (!s.startsWith("#")) + m_sourceFiles << s; + } + } + else + populateProject(); + + KDevProject::openProject( dirName, projectName ); +} + + +void AntProjectPart::populateProject() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + + QValueStack s; + int prefixlen = m_projectDirectory.length()+1; + s.push(m_projectDirectory); + + QDir dir; + do + { + dir.setPath(s.pop()); + kdDebug() << "Examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + QPtrListIterator it(*dirEntries); + for (; it.current(); ++it) + { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + QString path = it.current()->absFilePath(); + if (it.current()->isDir()) + { + kdDebug() << "Pushing: " << path << endl; + s.push(path); + } + else + { + kdDebug() << "Adding: " << path << endl; + m_sourceFiles.append(path.mid(prefixlen)); + } + } + } + while (!s.isEmpty()); + + QApplication::restoreOverrideCursor(); +} + + +void AntProjectPart::closeProject() +{ + m_projectDirectory = ""; + m_projectName = ""; + m_buildProjectAction->setEnabled(false); + + m_targetMenu->clear(); + + m_antOptions = AntOptions(); + + QFile f(m_projectDirectory + "/" + m_projectName.lower() + ".kdevelop" + ".filelist"); + if (!f.open(IO_WriteOnly)) + return; + + QTextStream stream(&f); + stream << "# KDevelop Ant Project File List" << endl; + + QStringList::ConstIterator it; + for (it = m_sourceFiles.begin(); it != m_sourceFiles.end(); ++it) + stream << (*it) << endl; + f.close(); +} + + +QString AntProjectPart::projectDirectory() const +{ + return m_projectDirectory; +} + + +QString AntProjectPart::buildDirectory() const +{ + return m_projectDirectory; +} + +QString AntProjectPart::projectName() const +{ + return m_projectName; +} + + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList AntProjectPart::runEnvironmentVars() const +{ + /// \FIXME there is no kdevantproject so this will not work ! + return DomUtil::readPairListEntry(*projectDom(), "/kdevantproject/run/envvars", "envvar", "name", "value"); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString AntProjectPart::runDirectory() const +{ + return buildDirectory(); + /// \FIXME put the code below into use! + + QDomDocument &dom = *projectDom(); + + /// \FIXME there is no kdevantproject so this will not work ! + QString directoryRadioString = DomUtil::readEntry(dom, "/kdevantproject/run/directoryradio"); + QString DomMainProgram = DomUtil::readEntry(dom, "/kdevantproject/run/mainprogram"); + + if ( directoryRadioString == "build" ) + return buildDirectory(); + + if ( directoryRadioString == "custom" ) + return DomUtil::readEntry(dom, "/kdevantproject/run/customdirectory"); + + int pos = DomMainProgram.findRev('/'); + if (pos != -1) + return buildDirectory() + "/" + DomMainProgram.left(pos); + + return buildDirectory() + "/" + DomMainProgram; + +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ +QString AntProjectPart::mainProgram() const +{ + QDomDocument * dom = projectDom(); + + if ( !dom ) return QString(); + + QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevantproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + + return QString(); +} + + +QString AntProjectPart::debugArguments() const +{ + return QString(""); +} + +/** Retuns a QString with the run command line arguments */ +QString AntProjectPart::runArguments() const +{ + /// \FIXME there is no kdevantproject so this will not work ! + return DomUtil::readEntry(*projectDom(), "/kdevantproject/run/programargs"); +} + + +QString AntProjectPart::activeDirectory() const +{ + /// \FIXME + +// return m_projectDirectory; + + // returning m_projectDirectory is wrong, the path returned should be _relative_ to the project dir + // returning an empty string until antproject supports the idea of an active directory + return QString(""); +} + + +QStringList AntProjectPart::allFiles() const +{ +/* QStringList res; + + QStringList::ConstIterator it; + for (it = m_sourceFiles.begin(); it != m_sourceFiles.end(); ++it) + { + QString fileName = *it; + if (!fileName.startsWith("/")) + { + fileName.prepend("/"); + fileName.prepend(m_projectDirectory); + } + res += fileName; + } + + return res;*/ + + // return all files relative to the project directory! + return m_sourceFiles; +} + + +void AntProjectPart::addFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->addFiles ( fileList ); +} + +void AntProjectPart::addFiles ( const QStringList& fileList ) +{ + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + m_sourceFiles.append (*it ); + } + + kdDebug() << "Emitting addedFilesToProject" << endl; + emit addedFilesToProject(fileList); +} + +void AntProjectPart::removeFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->removeFiles ( fileList ); +} + +void AntProjectPart::removeFiles ( const QStringList& fileList ) +{ + kdDebug() << "Emitting removedFilesFromProject" << endl; + emit removedFilesFromProject(fileList); + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + m_sourceFiles.remove ( *it ); + } +} + +void AntProjectPart::parseBuildXML() +{ + m_antOptions.m_targets.clear(); + m_antOptions.m_properties.clear(); + m_antOptions.m_defineProperties.clear(); + + // open build file + QFile bf(m_projectDirectory + "/" + m_antOptions.m_buildXML); + if (!bf.open(IO_ReadOnly)) + return; + + // parse build file + QDomDocument dom; + if (!dom.setContent(&bf)) + { + bf.close(); + return; + } + bf.close(); + + m_projectName = dom.documentElement().attribute("name", m_projectName); + m_antOptions.m_defaultTarget = dom.documentElement().attribute("default", ""); + + QDomNode node = dom.documentElement().firstChild(); + while (!node.isNull()) + { + if (node.toElement().tagName() == "target") + { + if (m_antOptions.m_defaultTarget.isEmpty()) + m_antOptions.m_defaultTarget = node.toElement().attribute("name"); + m_antOptions.m_targets.append(node.toElement().attribute("name")); + } + else if (node.toElement().tagName() == "property") + { + m_antOptions.m_properties.insert(node.toElement().attribute("name"), node.toElement().attribute("value")); + m_antOptions.m_defineProperties.insert(node.toElement().attribute("name"), false); + } + + /// @todo Handle property files + /// @todo evaluate properties' values + + node = node.nextSibling(); + } +} + + +void AntProjectPart::fillMenu() +{ + m_buildProjectAction->setEnabled(!m_antOptions.m_defaultTarget.isEmpty()); + + m_targetMenu->clear(); + int id = 0; + QStringList::ConstIterator it; + for (it = m_antOptions.m_targets.begin(); it != m_antOptions.m_targets.end(); ++it) + m_targetMenu->insertItem(*it, id++); +} + + +void AntProjectPart::slotBuild() +{ + ant(m_antOptions.m_defaultTarget); +} + + +void AntProjectPart::slotTargetMenuActivated(int id) +{ + ant(m_antOptions.m_targets[id]); +} + + +void AntProjectPart::ant(const QString &target) +{ + QString cmd = "%0 cd %1 && ant %2 -buildfile %3 %4 %5"; + + QString verb = ""; + switch (m_antOptions.m_verbosity) + { + case AntOptions::Quiet: + verb = "-quiet"; + break; + case AntOptions::Verbose: + verb = "-verbose"; + break; + default: + verb = "-debug"; + break; + } + + QString options = ""; + QMap::Iterator it; + for (it = m_antOptions.m_properties.begin(); it != m_antOptions.m_properties.end(); ++it) + if (m_antOptions.m_defineProperties[it.key()]) + options += "-D" + it.key() + "=\"" + it.data() + "\" "; + + QString cp; + if (!m_classPath.count() == 0) + cp = "CLASSPATH="+m_classPath.join(":"); + + makeFrontend()->queueCommand(m_projectDirectory, cmd.arg(cp).arg(m_projectDirectory).arg(target).arg(m_antOptions.m_buildXML).arg(verb).arg(options)); +} + + +void AntProjectPart::projectConfigWidget(KDialogBase *dlg) +{ + QVBox *vbox = dlg->addVBoxPage(i18n("Ant Options")); + m_antOptionsWidget = new AntOptionsWidget(vbox); + + m_antOptionsWidget->BuildXML->setURL(m_antOptions.m_buildXML); + + switch (m_antOptions.m_verbosity) + { + case AntOptions::Quiet: + m_antOptionsWidget->Verbosity->setCurrentItem(0); + break; + case AntOptions::Verbose: + m_antOptionsWidget->Verbosity->setCurrentItem(1); + break; + default: + m_antOptionsWidget->Verbosity->setCurrentItem(2); + break; + } + + m_antOptionsWidget->Properties->setNumRows(m_antOptions.m_properties.count()); + m_antOptionsWidget->Properties->setNumCols(2); + + QMap::Iterator it; + int i=0; + for (it = m_antOptions.m_properties.begin(); it != m_antOptions.m_properties.end(); ++it) + { + QCheckTableItem *citem = new QCheckTableItem(m_antOptionsWidget->Properties, it.key()); + citem->setChecked(m_antOptions.m_defineProperties[it.key()]); + m_antOptionsWidget->Properties->setItem(i,0, citem); + QTableItem *item = new QTableItem(m_antOptionsWidget->Properties, QTableItem::WhenCurrent, it.data()); + m_antOptionsWidget->Properties->setItem(i,1, item); + ++i; + } + + connect(dlg, SIGNAL(okClicked()), this, SLOT(optionsAccepted())); + + vbox = dlg->addVBoxPage(i18n("Classpath")); + m_classPathWidget = new ClassPathWidget(vbox); + + m_classPathWidget->ClassPath->insertStringList(m_classPath); +} + + +void AntProjectPart::optionsAccepted() +{ + if (!m_antOptionsWidget || !m_classPathWidget) + return; + + m_antOptions.m_buildXML = m_antOptionsWidget->BuildXML->url(); + + switch (m_antOptionsWidget->Verbosity->currentItem()) + { + case 1: + m_antOptions.m_verbosity = AntOptions::Verbose; + break; + case 2: + m_antOptions.m_verbosity = AntOptions::Debug; + break; + default: + m_antOptions.m_verbosity = AntOptions::Quiet; + break; + } + + for (int i=0; iProperties->numRows(); ++i) + { + QString key = m_antOptionsWidget->Properties->text(i,0); + m_antOptions.m_properties.replace(key, m_antOptionsWidget->Properties->text(i,1)); + kdDebug() << "PROP: " << key << " = " << m_antOptionsWidget->Properties->text(i,1); + + QCheckTableItem *item =(QCheckTableItem*) m_antOptionsWidget->Properties->item(i,0); + m_antOptions.m_defineProperties.replace(key, item->isChecked()); + } + + m_classPath = m_classPathWidget->ClassPath->items(); + + m_antOptionsWidget = 0; + m_classPathWidget = 0; +} + + +void AntProjectPart::contextMenu(QPopupMenu *popup, const Context *context) +{ + if (!context->hasType( Context::FileContext )) + return; + + const FileContext *fcontext = static_cast(context); + KURL url = fcontext->urls().first(); + if (URLUtil::isDirectory(url)) + return; + + m_contextFileName = url.fileName(); + bool inProject = project()->allFiles().contains(m_contextFileName.mid ( project()->projectDirectory().length() + 1 ) ); + QString popupstr = QFileInfo(m_contextFileName).fileName(); + if (m_contextFileName.startsWith(projectDirectory()+ "/")) + m_contextFileName.remove(0, projectDirectory().length()+1); + + popup->insertSeparator(); + if (inProject) + { + int id = popup->insertItem( i18n("Remove %1 From Project").arg(popupstr), + this, SLOT(slotRemoveFromProject()) ); + popup->setWhatsThis(id, i18n("Remove from project

Removes current file from the project.")); + } + else + { + int id = popup->insertItem( i18n("Add %1 to Project").arg(popupstr), + this, SLOT(slotAddToProject()) ); + popup->setWhatsThis(id, i18n("Add to project

Adds current file from the project.")); + } +} + + +void AntProjectPart::slotAddToProject() +{ + QStringList fileList; + fileList.append ( m_contextFileName ); + addFiles ( fileList ); +} + + +void AntProjectPart::slotRemoveFromProject() +{ + QStringList fileList; + fileList.append ( m_contextFileName ); + removeFiles ( fileList ); +} + + +#include "antprojectpart.moc" + + +/*! + \fn AntProjectPart::distFiles() const + */ +QStringList AntProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QDir dir(projectDir); + QStringList files = dir.entryList( "build.xml"); + return sourceList + files; +} diff --git a/buildtools/ant/antprojectpart.h b/buildtools/ant/antprojectpart.h new file mode 100644 index 00000000..d6540c48 --- /dev/null +++ b/buildtools/ant/antprojectpart.h @@ -0,0 +1,117 @@ +#ifndef _ANTPROJECTPART_H_ +#define _ANTPROJECTPART_H_ + + +#include +#include +#include + + +class QPopupMenu; + + +class KAction; +class KDialogBase; +class Context; +class ClassPathWidget; + + +#include "kdevbuildtool.h" + + +class AntOptionsWidget; + + +class AntOptions +{ +public: + + AntOptions(); + + enum Verbosity { Quiet, Verbose, Debug }; + + QString m_buildXML; + QString m_defaultTarget; + QStringList m_targets; + QMap m_properties; + QMap m_defineProperties; + Verbosity m_verbosity; + +}; + + +class AntProjectPart : public KDevBuildTool +{ + Q_OBJECT + +public: + + AntProjectPart(QObject *parent, const char *name, const QStringList &args); + ~AntProjectPart(); + QStringList distFiles() const; + + +protected: + + virtual void openProject(const QString &dirName, const QString &projectName); + virtual void closeProject(); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString mainProgram() const; + virtual QString activeDirectory() const; + virtual QStringList allFiles() const; + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString runArguments() const; + virtual QString debugArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + + virtual void addFile(const QString &fileName); + virtual void addFiles ( const QStringList &fileList ); + virtual void removeFile(const QString &fileName); + virtual void removeFiles ( const QStringList& fileList ); + + +private slots: + + void slotBuild(); + void slotTargetMenuActivated(int id); + + void projectConfigWidget(KDialogBase *dlg); + void contextMenu(QPopupMenu *popup, const Context *context); + + void optionsAccepted(); + + void slotAddToProject(); + void slotRemoveFromProject(); + + +private: + + void parseBuildXML(); + void fillMenu(); + void populateProject(); + + void ant(const QString &target); + + QString m_projectDirectory, m_projectName; + QStringList m_classPath; + + QStringList m_sourceFiles; + + AntOptions m_antOptions; + + KAction *m_buildProjectAction; + + QPopupMenu *m_targetMenu; + + AntOptionsWidget *m_antOptionsWidget; + ClassPathWidget *m_classPathWidget; + + QString m_contextFileName; + +}; + + +#endif diff --git a/buildtools/ant/classpathwidget.ui b/buildtools/ant/classpathwidget.ui new file mode 100644 index 00000000..8bfde971 --- /dev/null +++ b/buildtools/ant/classpathwidget.ui @@ -0,0 +1,39 @@ + +ClassPathWidget + + + ClassPathWidget + + + + 0 + 0 + 471 + 288 + + + + + unnamed + + + + ClassPath + + + Class&path + + + + + + keditlistbox.h + kdialog.h + + + + + keditlistbox.h + klineedit.h + + diff --git a/buildtools/ant/kdevantproject.desktop b/buildtools/ant/kdevantproject.desktop new file mode 100644 index 00000000..231339ea --- /dev/null +++ b/buildtools/ant/kdevantproject.desktop @@ -0,0 +1,96 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Ant Project +Comment[br]=Raktres Ant +Comment[ca]=Projecte Ant +Comment[cs]=Ant projekt +Comment[da]=Ant-projekt +Comment[de]=Ant-Projekt für KDevelop +Comment[el]=Έργο Ant +Comment[es]=Proyecto Ant +Comment[et]=Ant projekt +Comment[eu]=Ant proiektua +Comment[fa]=پروژۀ Ant +Comment[fr]=Projet avec Ant +Comment[ga]=Comhad tionscadail Ant +Comment[gl]=Proxecto Ant +Comment[hi]=एएनटी परियोजना +Comment[hu]=Ant-projekt +Comment[is]=Ant verkefni +Comment[it]=Progetto Ant +Comment[ja]=Ant プロジェクト +Comment[ms]=Projek Ant +Comment[nds]=Ant-Projekt +Comment[ne]=एन्ट परियोजना +Comment[nl]=Ant-project +Comment[pa]=Ant ਪ੍ਰੋਜੈਕਟ +Comment[pl]=Projekt: Ant +Comment[pt]=Projecto Ant +Comment[pt_BR]=Projeto Ant +Comment[ru]=Проект Ant +Comment[sk]=Ant projekt +Comment[sl]=Projekt Ant +Comment[sr]=Ant пројекат +Comment[sr@Latn]=Ant projekat +Comment[sv]=Ant-projekt +Comment[ta]=ஆன்ட்பிராஜக்ட் +Comment[tg]=Лоиҳаи Ant +Comment[tr]=Ant Projesi +Comment[uz]=Ant loyihasi +Comment[uz@cyrillic]=Ant лойиҳаси +Comment[zh_CN]=Ant 工程 +Comment[zh_TW]=Ant 專案 +Name=KDevAntProject +Name[da]=KDevelop Ant-projekt +Name[de]=Ant-Projekt (KDevelop) +Name[hi]=के-डेव-एएनटी-परियोजना +Name[nds]=Ant-Projekt (KDevelop) +Name[ne]=केडीई विकास एन्ट परियोजना +Name[pl]=KDevProjektAnt +Name[sk]=KDevAntProjekt +Name[sv]=KDevelop Ant-projekt +Name[ta]=கெடெவ்ஆன்ட் பிராஜக்ட் +Name[tg]=Лоиҳаи KDevAnt +Name[zh_TW]=KDevelop Ant 專案 +GenericName=Ant Project +GenericName[br]=Raktres Ant +GenericName[ca]=Projecte Ant +GenericName[da]=Ant-projekt +GenericName[de]=Ant-Projekt +GenericName[el]=Έργο Ant +GenericName[es]=Proyecto Ant +GenericName[et]=Ant projekt +GenericName[eu]=Ant proiektua +GenericName[fa]=پروژۀ Ant +GenericName[fr]=Projet avec Ant +GenericName[ga]=Comhad tionscadail Ant +GenericName[gl]=Proxecto Ant +GenericName[hi]=एएनटी परियोजना +GenericName[hu]=Ant-projekt +GenericName[it]=Project con Ant +GenericName[ja]=Ant プロジェクト +GenericName[ms]=Projek Ant +GenericName[nds]=Ant-Projekt +GenericName[ne]=एन्ट परियोजना +GenericName[nl]=Ant-project +GenericName[pl]=Projekt: Ant +GenericName[pt]=Projecto Ant +GenericName[pt_BR]=Projeto Ant +GenericName[ru]=Проект Ant +GenericName[sk]=Ant projekt +GenericName[sl]=Projekt Ant +GenericName[sr]=Ant пројекат +GenericName[sr@Latn]=Ant projekat +GenericName[sv]=Ant-projekt +GenericName[ta]=ஆன்ட்பிராஜக்ட் +GenericName[tg]=Лоиҳаи Ant +GenericName[tr]=Ant Projesi +GenericName[uz]=Ant loyihasi +GenericName[uz@cyrillic]=Ant лойиҳаси +GenericName[zh_CN]=Ant 工程 +GenericName[zh_TW]=Ant 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevantproject +X-KDevelop-Version=5 +X-KDevelop-Args= diff --git a/buildtools/ant/kdevantproject.rc b/buildtools/ant/kdevantproject.rc new file mode 100644 index 00000000..df892b3c --- /dev/null +++ b/buildtools/ant/kdevantproject.rc @@ -0,0 +1,14 @@ + + + +

+ + + + + + + + diff --git a/buildtools/autotools/Makefile.am b/buildtools/autotools/Makefile.am new file mode 100644 index 00000000..5972b662 --- /dev/null +++ b/buildtools/autotools/Makefile.am @@ -0,0 +1,38 @@ +# Here resides the automake project part. + +INCLUDES = -I$(top_srcdir)/buildtools/lib -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/parsers/autotools -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \ + -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util $(all_includes) \ + -I$(top_builddir)/buildtools/lib/widgets + + +kde_module_LTLIBRARIES = libkdevautoproject.la +libkdevautoproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevautoproject_la_LIBADD = \ + $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la \ + $(top_builddir)/buildtools/lib/parsers/autotools/libkdevautotoolsparser.la $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la \ + $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(top_builddir)/lib/libkdevelop.la + +libkdevautoproject_la_SOURCES = autoprojectpart.cpp autoprojectwidget.cpp \ + configureoptionswidget.cpp configureoptionswidgetbase.ui subprojectoptionsdlg.cpp \ + subprojectoptionsdlgbase.ui targetoptionsdlg.cpp targetoptionsdlgbase.ui addservicedlg.cpp \ + addservicedlgbase.ui addapplicationdlg.cpp addapplicationdlgbase.ui addtargetdlg.cpp \ + addtargetdlgbase.ui addsubprojectdlg.cpp addfiledlgbase.ui addfiledlg.cpp \ + removefiledlgbase.ui removefiledlg.cpp addicondlgbase.ui addicondlg.cpp \ + addtranslationdlg.cpp addprefixdlg.cpp kfilednddetailview.cpp kfiledndiconview.cpp \ + fileselectorwidget.cpp misc.cpp addsubprojectdlgbase.ui removetargetdlg.cpp \ + removetargetdlgbase.ui choosetargetdialog.cpp choosetargetdlgbase.ui addexistingdlgbase.ui \ + addexistingfilesdlg.cpp addexistingdirectoriesdlg.cpp kimporticonview.cpp \ + autosubprojectview.cpp autodetailsview.cpp autolistviewitems.cpp managecustomcommandsbase.ui \ + managecustomcommand.cpp autoprojectviewbase.ui autotoolsaction.cpp makefilehandler.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevautoproject.desktop kdevkdeautoproject.desktop + +rcdir = $(kde_datadir)/kdevautoproject +rc_DATA = kdevautoproject.rc + +noinst_HEADERS = managecustomcommand.h autotoolsaction.h makefilehandler.h diff --git a/buildtools/autotools/README b/buildtools/autotools/README new file mode 100644 index 00000000..487cec41 --- /dev/null +++ b/buildtools/autotools/README @@ -0,0 +1 @@ +Please read the README.dox file diff --git a/buildtools/autotools/README.dox b/buildtools/autotools/README.dox new file mode 100644 index 00000000..acad3e64 --- /dev/null +++ b/buildtools/autotools/README.dox @@ -0,0 +1,39 @@ +/** \class AutoProjectPart +Autoprojectpart is a projectmanager for Automake based projects. + +Loads and maintains Makefile.am files. + +\authors Bernd Gehrmann + +\maintainer Victor Rder +\maintainer Amilcar do Carmo Lucas + +\feature supports creating subprojects, targets, services (.desktop) and applications (.desktop). +\feature Automake projects can be configured on subprojects, targets (except DATA and HEADER targets). +\feature It will regenerate the projects Makefile.am files dynamically as you add or +reconfigure subprojects**. +\feature Unsupported automake features will be left unchanged +(hopefully), no major testing has been run yet (at least not by myself). + +\bug bugs in autoproject component at Bugzilla database +\bug Lower Automake Manager view does not update it's view when adding a subproject (and targets, etc to the new subproject) +\bug If removing the Active Target, update the .kdevelop file, too! + + +\note +If you want to change the default implemention for running/starting the binary +please add the following to your project file +\verbatim + + + true + + +\endverbatim +with this configuration the "Automake Manager" doesn't insert the menuentry "execute program" +and doesn't show the "Run Options" in the project configuration.
+Now you can implement this features with your own special plugin. +For an example please look at the projects generated for GBA using the VisualBoy Advance Plugin. +This plugin starts a GBA binary with an emulator. -- Sandy Meier + +*/ diff --git a/buildtools/autotools/addapplicationdlg.cpp b/buildtools/autotools/addapplicationdlg.cpp new file mode 100644 index 00000000..04e132dd --- /dev/null +++ b/buildtools/autotools/addapplicationdlg.cpp @@ -0,0 +1,207 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addapplicationdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "misc.h" +#include "autoprojectwidget.h" +#include "autoprojectpart.h" + + +AddApplicationDialog::AddApplicationDialog(AutoProjectWidget *widget, SubprojectItem *spitem, + QWidget *parent, const char *name) + : AddApplicationDialogBase(parent, name, true) +{ + filename_edit->setText(".desktop"); + filename_edit->home(false); + filename_edit->setFocus(); + chosentypes_listview->header()->hide(); + availtypes_listview->header()->hide(); + QString addApplication = add_button->text(); + QString removeApplication = remove_button->text(); + + add_button->setText( QApplication::reverseLayout() ? removeApplication : addApplication ); + remove_button->setText( QApplication::reverseLayout() ? addApplication : removeApplication ); + + m_widget = widget; + subProject = spitem; + + // Fill the combo box with program names in the directory + QPtrListIterator tit(spitem->targets); + for (; tit.current(); ++tit) { + if ((*tit)->primary == "PROGRAMS") + executable_combo->insertItem(QString((*tit)->name)); + } + + // Fill the list of available mime types + KMimeType::List l = KMimeType::allMimeTypes(); + KMimeType::List::Iterator it; + for (it = l.begin(); it != l.end(); ++it) + new QListViewItem(availtypes_listview, (*it)->name()); + + setIcon ( SmallIcon ( "window_new" ) ); +} + + +AddApplicationDialog::~AddApplicationDialog() +{} + + +void AddApplicationDialog::iconClicked() +{ + KIconLoader *loader = AutoProjectFactory::instance()->iconLoader(); + QString name = KIconDialog::getIcon(KIcon::Desktop); + if (!name.isNull()) { + iconName = name; + icon_button->setPixmap(loader->loadIcon(name, KIcon::Desktop)); + } +} + + +void AddApplicationDialog::addTypeClicked() +{ + QListViewItem *selitem = availtypes_listview->selectedItem(); + if (!selitem) + return; + + QListViewItem *olditem = chosentypes_listview->firstChild(); + while (olditem) { + if (selitem->text(0) == olditem->text(0)) + return; + olditem = olditem->nextSibling(); + } + new QListViewItem(chosentypes_listview, selitem->text(0)); +} + + +void AddApplicationDialog::removeTypeClicked() +{ + delete chosentypes_listview->currentItem(); +} + + +void AddApplicationDialog::accept() +{ + // Create list of mime types + QStringList mimeTypes; + QListViewItem *item = chosentypes_listview->firstChild(); + while (item) { + mimeTypes.append(item->text(0)); + item = item->nextSibling(); + } + + // Some plausibility tests + QString fileName = filename_edit->text(); + if (fileName.isEmpty() || fileName == ".desktop") { + KMessageBox::sorry(this, i18n("You have to enter a file name.")); + filename_edit->setFocus(); + return; + } + + QString executable = executable_combo->currentText(); + if (executable.isEmpty()) { + KMessageBox::sorry(this, i18n("You have to enter the file name of an executable program.")); + executable_combo->setFocus(); + return; + } + + QString name = name_edit->text(); + if (name.isEmpty()) { + KMessageBox::sorry(this, i18n("You have to enter an application name.")); + name_edit->setFocus(); + return; + } + + QFile f(subProject->path + "/" + fileName); + if (f.exists()) { + KMessageBox::sorry(this, i18n("A file with this name exists already.")); + filename_edit->setFocus(); + return; + } + if (!f.open(IO_WriteOnly)) { + KMessageBox::sorry(this, i18n("Could not open file for writing.")); + return; + } + + QTextStream stream(&f); + stream << "[Desktop Entry]" << endl; + stream << "Type=Application" << endl; + stream << "Name=" << name << endl; + stream << "Exec=" << (executable + " -caption \"%c\" %i %m %u") << endl; + stream << "Comment=" << comment_edit->text() << endl; + if (!iconName.isNull()) + stream << "Icon=" << iconName << endl; + stream << "MimeTypes=" << mimeTypes.join(";") << endl; + stream << "Terminal=" << (terminal_box->isChecked()? "true" : "false") << endl; + f.close(); + + // Find a prefix that points to the applnk directory. + // If there is none, use appslnksection + QString section = section_combo->currentText(); + QString appsdir = "$(kde_appsdir)/" + section; + QMap::ConstIterator it; + for (it = subProject->prefixes.begin(); it != subProject->prefixes.end(); ++it) + if (it.data() == appsdir) + break; + + QMap replaceMap; + QString prefix; + if (it == subProject->prefixes.end()) { + prefix = "applnk" + section; + replaceMap.insert(prefix + "dir", appsdir); + subProject->prefixes.insert(prefix, appsdir); + } else { + prefix = it.key(); + } + QString varname = prefix + "_DATA"; + + // Look if a list view item for this prefix exists already. + // Create a new one otherwise + TargetItem *titem = 0; + for (uint i=0; i < subProject->targets.count(); ++i) { + TargetItem *tmptitem = subProject->targets.at(i); + if ("DATA" == tmptitem->primary && prefix == tmptitem->prefix) { + titem = tmptitem; + break; + } + } + if (!titem) { + titem = m_widget->createTargetItem("", prefix, "DATA", false); + subProject->targets.append(titem); + } + // Add this file to the target + FileItem *fitem = m_widget->createFileItem(fileName, subProject); + titem->sources.append(fitem); + + subProject->variables[varname] += (" " + fileName); + replaceMap.insert(varname, subProject->variables[varname]); + AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap); + + QDialog::accept(); +} + +#include "addapplicationdlg.moc" diff --git a/buildtools/autotools/addapplicationdlg.h b/buildtools/autotools/addapplicationdlg.h new file mode 100644 index 00000000..d9f8e6fc --- /dev/null +++ b/buildtools/autotools/addapplicationdlg.h @@ -0,0 +1,45 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDAPPLICATIONDLG_H_ +#define _ADDAPPLICATIONDLG_H_ + +#include "addapplicationdlgbase.h" + +class AutoProjectWidget; +class SubprojectItem; +class TargetItem; + + +class AddApplicationDialog : public AddApplicationDialogBase +{ + Q_OBJECT + +public: + AddApplicationDialog( AutoProjectWidget *widget, SubprojectItem *spitem, + QWidget *parent = 0, const char *name = 0 ); + ~AddApplicationDialog(); + +protected: + virtual void iconClicked(); + virtual void addTypeClicked(); + virtual void removeTypeClicked(); + virtual void accept(); + +private: + AutoProjectWidget *m_widget; + SubprojectItem *subProject; + QString iconName; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/addapplicationdlgbase.ui b/buildtools/autotools/addapplicationdlgbase.ui new file mode 100644 index 00000000..5e6def81 --- /dev/null +++ b/buildtools/autotools/addapplicationdlgbase.ui @@ -0,0 +1,552 @@ + +AddApplicationDialogBase + + + add_application_dialog + + + + 0 + 0 + 586 + 425 + + + + Add New Application .desktop File + + + false + + + + unnamed + + + + GroupBox7 + + + &Application File + + + + unnamed + + + + terminal_box + + + Start in t&erminal + + + + + comment_edit + + + + + filename_edit + + + + + Layout2 + + + + unnamed + + + 0 + + + + icon_button + + + + 24 + 24 + + + + + + + false + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + executable_combo + + + true + + + + + name_edit + + + + + + Application + + + + + Games + + + + + Development + + + + + Editors + + + + + Graphics + + + + + Internet + + + + + Multimedia + + + + + Office + + + + + Settings + + + + + System + + + + + Toys + + + + + Utilities + + + + + WordProcessing + + + + section_combo + + + + + name_label_2 + + + + + + + E&xecutable: + + + AlignVCenter|AlignRight + + + executable_combo + + + + + icon_label + + + + + + + &Icon: + + + AlignVCenter|AlignRight + + + icon_button + + + + + section_label + + + + + + + &Section: + + + AlignVCenter|AlignRight + + + section_combo + + + + + filename_label + + + + + + + &File name: + + + AlignVCenter|AlignRight + + + filename_edit + + + + + name_label + + + + + + + &Name: + + + AlignVCenter|AlignRight + + + name_edit + + + + + comment_label + + + + + + + Co&mment: + + + AlignVCenter|AlignRight + + + comment_edit + + + + + + + Spacer11 + + + Vertical + + + Preferred + + + + 20 + 20 + + + + + + GroupBox6 + + + Mime &Types + + + + unnamed + + + + Layout5 + + + + unnamed + + + 0 + + + + + + + + true + + + true + + + + chosentypes_listview + + + LastColumn + + + + + Layout3 + + + + unnamed + + + 0 + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + add_button + + + <- + + + + + remove_button + + + -> + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + true + + + true + + + + availtypes_listview + + + LastColumn + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okbutton + + + &OK + + + true + + + true + + + + + cancelbutton + + + &Cancel + + + true + + + + + + + + + cancelbutton + clicked() + add_application_dialog + reject() + + + okbutton + clicked() + add_application_dialog + accept() + + + icon_button + clicked() + add_application_dialog + iconClicked() + + + add_button + clicked() + add_application_dialog + addTypeClicked() + + + remove_button + clicked() + add_application_dialog + removeTypeClicked() + + + + filename_edit + executable_combo + name_edit + icon_button + terminal_box + section_combo + comment_edit + chosentypes_listview + add_button + remove_button + availtypes_listview + okbutton + cancelbutton + + + kdialog.h + + + addTypeClicked() + iconClicked() + removeTypeClicked() + + + + diff --git a/buildtools/autotools/addexistingdirectoriesdlg.cpp b/buildtools/autotools/addexistingdirectoriesdlg.cpp new file mode 100644 index 00000000..625d6af1 --- /dev/null +++ b/buildtools/autotools/addexistingdirectoriesdlg.cpp @@ -0,0 +1,388 @@ +/*************************************************************************** + ------------------- + begin : 12/21/2002 + copyright : (C) 2002 by Victor R�er + email : victor_roeder@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include + +#include +#include +#include +#include + +#include "autolistviewitems.h" +#include "autosubprojectview.h" + +#include "autoprojectwidget.h" +#include "autoprojectpart.h" + +#include "kimporticonview.h" + +#include "urlutil.h" + +#include "addexistingdirectoriesdlg.h" + +AddExistingDirectoriesDialog::AddExistingDirectoriesDialog ( AutoProjectPart* part, AutoProjectWidget *widget, SubprojectItem* spitem, QWidget* parent, const char* name, bool modal, WFlags fl ) + : AddExistingDlgBase ( parent, name, modal, fl ) +{ + setIcon ( SmallIcon ( "fileimport.png" ) ); + + m_spitem = spitem; + + m_part = part; + m_widget = widget; + + KFile::Mode mode = KFile::Directory; + +// if ( spitem && spitem->type() == ProjectItem::Subproject ) +// { +// destStaticLabel->setText ( i18n ( "Subproject:" ) ); +// destLabel->setText ( spitem->subdir ); +// targetLabel->setText ( i18n ( "none" ) ); +// directoryLabel->setText ( i18n ( spitem->path ) ); +// } + + sourceSelector = new FileSelectorWidget ( part, mode, sourceGroupBox, "source file selector" ); + sourceGroupBoxLayout->addWidget ( sourceSelector ); + + importView = new KImportIconView ( i18n("Drag one or more directories with an existing Makefile.am from the left view and drop it here."), destGroupBox, "destination icon view" ); + destGroupBoxLayout->addWidget ( importView ); + + setIcon ( SmallIcon ( "fileimport.png" ) ); + + QWidget::setTabOrder(sourceSelector, addAllButton); + QWidget::setTabOrder(addAllButton, addSelectedButton); + QWidget::setTabOrder(addSelectedButton, importView); + QWidget::setTabOrder(importView, removeAllButton); + QWidget::setTabOrder(removeAllButton, removeSelectedButton); + QWidget::setTabOrder(removeSelectedButton, okButton); + QWidget::setTabOrder(okButton, cancelButton); + + sourceSelector->setFocus(); + + init(); +} + + +AddExistingDirectoriesDialog::~AddExistingDirectoriesDialog() +{ +} + +void AddExistingDirectoriesDialog::init() +{ + progressBar->hide(); + + importView->setMode ( KIconView::Select ); + importView->setItemsMovable ( false ); + + connect ( okButton, SIGNAL ( clicked () ), this, SLOT ( slotOk () ) ); + + connect ( addSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotAddSelected() ) ); + connect ( addAllButton, SIGNAL ( clicked () ), this, SLOT ( slotAddAll() ) ); + connect ( removeSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveSelected() ) ); + connect ( removeAllButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveAll() ) ); + + connect ( importView, SIGNAL ( dropped( QDropEvent* ) ), this, SLOT ( slotDropped ( QDropEvent* ) ) ); + + importView->setSelectionMode ( KFile::Multi ); + + sourceSelector->setDir ( m_spitem->path ); +} + +void AddExistingDirectoriesDialog::importItems() +{ + if( !importView->items() ) + return; + + // items added via button or drag 'n drop + KFileItemListIterator itemList ( m_importList ); + + // items already added to the importView + KFileItemListIterator importedList ( *importView->items() ); + + QStringList duplicateList; + + importedList.toFirst(); + + for ( ; importedList.current(); ++importedList ) + { + itemList.toFirst(); + + for ( ; itemList.current(); ++itemList ) + { + if ( ( *importedList )->name() == ( *itemList )->name() ) + { + m_importList.remove ( ( *itemList ) ); + + // to avoid that a item is added twice + if ( !duplicateList.remove ( ( *importedList )->name() ) ) + { + duplicateList.append ( ( *importedList )->name() ); + } + } + } + } + + itemList.toFirst(); + + for ( ; itemList.current(); ++itemList ) + { + KURL amURL = itemList.current()->url(); + amURL.addPath("Makefile.am"); + if (KIO::NetAccess::exists(amURL)) + { + importView->insertItem ( ( *itemList ) ); + } + } + + importView->somethingDropped ( true ); + + m_importList.clear(); + + importView->update (); +} + +void AddExistingDirectoriesDialog::slotOk() +{ + if ( importView->items()->count() == 0 ) QDialog::reject(); + + KFileItemListIterator items ( *importView->items() ); + + QStringList dirs; + + for ( ; items.current(); ++items ) + { + //if the directory is outside the project directory +// kdDebug( 9020 ) << "dir to add " << items.current()->url().path() << " subproject " << m_spitem->path << endl; + if (items.current()->url().path() != m_spitem->path) + { + //copy + //FIXME: check this after 3.0 release and add a possibility to link, not just copy + KProcess proc; + + proc << "cp"; + proc << "-r"; + proc << items.current()->url().path(); + proc << m_spitem->path; + proc.start(KProcess::Block); + } + dirs << items.current()->name(); + } + + for (QStringList::const_iterator it = dirs.begin(); it != dirs.end(); ++it) + { + QString name = *it; + + // Adjust SUBDIRS variable in containing Makefile.am + if (m_spitem->variables["SUBDIRS"].find("$(TOPSUBDIRS)") != -1) + { + QFile subdirsfile( m_spitem->path + "/subdirs" ); + if ( subdirsfile.open( IO_WriteOnly | IO_Append ) ) + { + QTextStream subdirsstream( &subdirsfile ); + subdirsstream << name << endl; + subdirsfile.close(); + } + } + else if (m_spitem->variables["SUBDIRS"].find("$(AUTODIRS)") != -1) + { + } + else + { + m_spitem->variables["SUBDIRS"] += (" " + name); + QMap replaceMap; + replaceMap.insert("SUBDIRS", m_spitem->variables["SUBDIRS"]); + AutoProjectTool::addToMakefileam(m_spitem->path + "/Makefile.am", replaceMap); + } + + // Create new item in tree view + SubprojectItem *newitem = new SubprojectItem(m_spitem, name); + newitem->subdir = name; + newitem->path = m_spitem->path + "/" + name; + newitem->variables["INCLUDES"] = m_spitem->variables["INCLUDES"]; + newitem->setOpen(true); + + // Move to the bottom of the list + QListViewItem *lastItem = m_spitem->firstChild(); + while (lastItem->nextSibling()) + lastItem = lastItem->nextSibling(); + if (lastItem != newitem) + newitem->moveItem(lastItem); + + // Create a Makefile in the new subdirectory + + QDir dir( m_spitem->path + "/" + name ); + QFile f( dir.filePath("Makefile.am") ); + if (f.exists()) { + m_widget->getSubprojectView()->parse( newitem ); + } else { + if (!f.open(IO_WriteOnly)) { +// KMessageBox::sorry(this, i18n("Could not create Makefile.am in subdirectory %1.").arg(name)); + continue; + } + QTextStream stream(&f); + stream << "INCLUDES = " << newitem->variables["INCLUDES"] << endl << "METASOURCES = AUTO" << endl; + f.close(); + } + + + + // if !isKDE: add the new sub-proj to configure.in or configure.ac + if ( !m_part->isKDE() ) { + QString projroot = m_part->projectDirectory() + "/"; + QString subdirectory = dir.path(); + QString relpath = subdirectory.replace(0, projroot.length(),""); + + QString configureFile = m_part->getAutoConfFile(projroot); + + QStringList list = AutoProjectTool::configureinLoadMakefiles(configureFile); + if ( !list.isEmpty() ) + { + list.push_back( relpath + "/Makefile" ); + AutoProjectTool::configureinSaveMakefiles(configureFile, list); + } + } + + m_part->needMakefileCvs(); + + } + QDialog::accept(); +} + +void AddExistingDirectoriesDialog::slotAddSelected() +{ + KFileItemListIterator it ( *sourceSelector->dirOperator()->selectedItems() ); + + for ( ; it.current(); ++it ) + { + QString relPath = URLUtil::extractPathNameRelative(m_part->projectDirectory(), ( *it )->url()); + if (relPath[relPath.length()-1] == '/') + relPath = relPath.left(relPath.length()-1); + if ( (relPath.isEmpty()) || (! m_widget->allSubprojects().contains( relPath )) ) + { + m_importList.append ( ( *it ) ); + } + } + + importItems(); +} + +void AddExistingDirectoriesDialog::slotAddAll() +{ + KFileItemListIterator it ( *sourceSelector->dirOperator()->view()->items() ); + + for ( ; it.current(); ++it ) + { + QString relPath = URLUtil::extractPathNameRelative(m_part->projectDirectory(), ( *it )->url()); + if (relPath[relPath.length()-1] == '/') + relPath = relPath.left(relPath.length()-1); + if ( (relPath.isEmpty()) || ( ! m_widget->allSubprojects().contains( relPath )) ) + { + m_importList.append ( ( *it ) ); + } + } + + importItems(); +} + +void AddExistingDirectoriesDialog::slotRemoveAll() +{ + KURL::List deletedFiles; + KFileItemListIterator it ( *importView->items() ); + + for ( ; it.current(); ++it ) + { + kdDebug ( 9020 ) << "AddExistingDirectoriesDialog::slotRemoveAll()" << endl; + //deletedFiles.append ( ( *it )->url() ); + if ( (*it ) ) importView->removeItem ( *it ); + } + + importView->somethingDropped ( false ); + + importView->viewport()->update(); +} + +void AddExistingDirectoriesDialog::slotRemoveSelected() +{ + KFileItemListIterator items ( *importView->items() ); + + KFileItemList* selectedList = (KFileItemList*) importView->selectedItems(); + + KFileItem * deleteItem = 0L; + + for ( ; items.current(); ++items ) + { + deleteItem = selectedList->first(); + + while ( deleteItem ) + { + if ( deleteItem == ( *items ) ) + { + importView->removeItem ( deleteItem ); + deleteItem = selectedList->current(); + } + else + { + deleteItem = selectedList->next(); + } + } + } + + if ( importView->items()->count() == 0 ) importView->somethingDropped ( false ); + + importView->viewport()->update(); +} + +void AddExistingDirectoriesDialog::slotDropped ( QDropEvent* ev ) +{ + kdDebug ( 9020 ) << "AddExistingDirectoriesDialog::dropped()" << endl; + + KURL::List urls; + + KURLDrag::decode( ev, urls ); + + KFileItem* item = 0L; + KMimeType::Ptr type = 0L; + + + for ( KURL::List::Iterator it = urls.begin(); it != urls.end(); ++it ) + { + //check if this subproject is already in project + QString relPath = URLUtil::extractPathNameRelative(m_part->projectDirectory(), *it); + if (relPath[relPath.length()-1] == '/') + relPath = relPath.left(relPath.length()-1); + if ( (relPath.isEmpty()) || ( ! m_widget->allSubprojects().contains( relPath )) ) + { + type = KMimeType::findByURL ( ( *it ) ); + + if ( type->name() != KMimeType::defaultMimeType() ) + { + item = new KFileItem ( ( *it ) , type->name(), 0 ); + } + else + { + item = new KFileItem ( ( *it ), "inode/directory", 0 ); + } + + m_importList.append ( item ); + } + } + + importItems(); +} + +#include "addexistingdirectoriesdlg.moc" + +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/buildtools/autotools/addexistingdirectoriesdlg.h b/buildtools/autotools/addexistingdirectoriesdlg.h new file mode 100644 index 00000000..c4dd048e --- /dev/null +++ b/buildtools/autotools/addexistingdirectoriesdlg.h @@ -0,0 +1,74 @@ +/*************************************************************************** + ------------------- + begin : 12/21/2002 + copyright : (C) 2002 by Victor R�er + email : victor_roeder@gmx.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _ADDEXISTINGDIRECTORIESDLG_H_ +#define _ADDEXISTINGDIRECTORIESDLG_H_ + +#include "addexistingdlgbase.h" + +#include +#include + +#include "misc.h" +#include "fileselectorwidget.h" + +class FileSelectorWidget; +class AutoProjectWidget; +class AutoProjectPart; +class SubprojectItem; +class TargetItem; +class KFileItem; +class KImportIconView; + +class AddExistingDirectoriesDialog : public AddExistingDlgBase +{ + Q_OBJECT + +public: + AddExistingDirectoriesDialog ( AutoProjectPart* part, AutoProjectWidget *widget, + SubprojectItem* spitem, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~AddExistingDirectoriesDialog(); + +private: + FileSelectorWidget* sourceSelector; + KImportIconView* importView; + + AutoProjectPart* m_part; + AutoProjectWidget* m_widget; + + TargetItem* m_titem; + SubprojectItem* m_spitem; + + KFileItemList m_importList; + +protected: + void init(); + void importItems (); + +protected slots: + void slotAddSelected(); + void slotAddAll(); + void slotRemoveAll(); + void slotRemoveSelected(); + void slotDropped ( QDropEvent* ev ); + + void slotOk(); +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/addexistingdlgbase.ui b/buildtools/autotools/addexistingdlgbase.ui new file mode 100644 index 00000000..cf73ee21 --- /dev/null +++ b/buildtools/autotools/addexistingdlgbase.ui @@ -0,0 +1,459 @@ + +AddExistingDlgBase + + + AddExistingDlgBase + + + + 0 + 0 + 592 + 445 + + + + + 5 + 5 + 0 + 0 + + + + ImportExistingDlgBase + + + + unnamed + + + + layout10 + + + + unnamed + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 317 + 20 + + + + + + okButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + progressBar + + + true + + + + + infoGroupBox + + + + 5 + 0 + 0 + 0 + + + + + 32767 + 32767 + + + + Box + + + Sunken + + + Subproject Information + + + + unnamed + + + + infoLayout1 + + + + unnamed + + + 0 + + + + directoryStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + + + + Directory: + + + + + targetStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + + + + Target: + + + + + + + infoLayout2 + + + + unnamed + + + 0 + + + + directoryLabel + + + + 5 + 5 + 0 + 0 + + + + [DIRECTORY] + + + + + targetLabel + + + [TARGET] + + + + + + + + + splitter2 + + + + 7 + 7 + 0 + 0 + + + + Horizontal + + + + layout12 + + + + unnamed + + + + layout10 + + + + unnamed + + + + arrowSpacer1 + + + Horizontal + + + Expanding + + + + 84 + 20 + + + + + + addAllButton + + + A&dd All + + + Import by creating symbolic links (recommended) + + + + + addSelectedButton + + + &Add Selected + + + Import by copying (not recommended) + + + + + arrowSpacer2 + + + Horizontal + + + Expanding + + + + 84 + 20 + + + + + + + + sourceGroupBox + + + + 240 + 250 + + + + + 32767 + 32767 + + + + &Source Directory + + + + + + + unnamed + + + + + + + + layout13 + + + + unnamed + + + + layout11 + + + + unnamed + + + + arrowSpacer1_2 + + + Horizontal + + + Expanding + + + + 21 + 20 + + + + + + removeAllButton + + + R&emove All + + + Removes all added files. + + + + + removeSelectedButton + + + &Remove Selected + + + Removes the selected files. + + + + + arrowSpacer2_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + destGroupBox + + + + 140 + 100 + + + + + 32767 + 32767 + + + + Add &Following + + + + unnamed + + + + + + + + + + + + + cancelButton + clicked() + AddExistingDlgBase + reject() + + + + addAllButton + addSelectedButton + removeAllButton + removeSelectedButton + okButton + cancelButton + + + ksqueezedtextlabel.h + kprogress.h + kdialog.h + + + + + kprogress.h + ksqueezedtextlabel.h + + diff --git a/buildtools/autotools/addexistingfilesdlg.cpp b/buildtools/autotools/addexistingfilesdlg.cpp new file mode 100644 index 00000000..00f3e61b --- /dev/null +++ b/buildtools/autotools/addexistingfilesdlg.cpp @@ -0,0 +1,451 @@ +/*************************************************************************** + ------------------- + begin : Frag' mich was leichteres + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/** Here resides the Import-existing-files-dialog of the Automake Manager (a KDevelop build tool part) **/ + +#include +#include +#include +//#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "urlutil.h" + +#include "autolistviewitems.h" + +#include "autoprojectwidget.h" +#include "autoprojectpart.h" + +#include "kimporticonview.h" + +#include "addexistingfilesdlg.h" + +/* + * Constructs a AddExistingFilesDialog which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ + +AddExistingFilesDialog::AddExistingFilesDialog ( AutoProjectPart* part, AutoProjectWidget *widget, SubprojectItem* spitem, TargetItem* titem, QWidget* parent, const char* name, bool modal, WFlags fl ) + : AddExistingDlgBase ( parent, name, modal, fl ) +{ + m_spitem = spitem; + m_titem = titem; + + m_part = part; + m_widget = widget; + + KFile::Mode mode = KFile::Files; + + if ( titem && spitem && titem->type() == ProjectItem::Target && spitem->type() == ProjectItem::Subproject ) + { + + if ( titem->name.isEmpty() ) + { + QString target = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ); + targetLabel->setText ( target ); + } + else + { + targetLabel->setText ( titem->name ); + } + directoryLabel->setText ( spitem->path ); + } + + sourceSelector = new FileSelectorWidget ( m_part, mode, sourceGroupBox, "source file selector" ); + sourceGroupBoxLayout->addWidget ( sourceSelector ); + + importView = new KImportIconView ( i18n ( "Drag one or more files from the left view and drop it here." ), destGroupBox, "destination icon view" ); + destGroupBoxLayout->addWidget ( importView ); + //destGroupBoxLayout->setStretchFactor(dir, 2); + + QWidget::setTabOrder(sourceSelector, addAllButton); + QWidget::setTabOrder(addAllButton, addSelectedButton); + QWidget::setTabOrder(addSelectedButton, importView); + QWidget::setTabOrder(importView, removeAllButton); + QWidget::setTabOrder(removeAllButton, removeSelectedButton); + QWidget::setTabOrder(removeSelectedButton, okButton); + QWidget::setTabOrder(okButton, cancelButton); + + sourceSelector->setFocus(); + + setIcon ( SmallIcon ( "fileimport.png" ) ); + + init(); +} + + +/* + * Destroys the object and frees any allocated resources + */ +AddExistingFilesDialog::~AddExistingFilesDialog() +{ + // no need to delete child widgets, Qt does it all for me +} + + +// void AddExistingFilesDialog::resizeEvent ( QResizeEvent* ev ) +// { +// AddExistingDlgBase::resizeEvent ( ev ); +// //importView->update(); +// } + + +void AddExistingFilesDialog::init() +{ + progressBar->hide(); + + importView->setMode ( KIconView::Select ); + importView->setItemsMovable ( false ); + + connect ( okButton, SIGNAL ( clicked () ), this, SLOT ( slotOk () ) ); + + connect ( addSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotAddSelected() ) ); + connect ( addAllButton, SIGNAL ( clicked () ), this, SLOT ( slotAddAll() ) ); + connect ( removeSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveSelected() ) ); + connect ( removeAllButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveAll() ) ); + + connect ( importView, SIGNAL ( dropped( QDropEvent* ) ), this, SLOT ( slotDropped ( QDropEvent* ) ) ); + + importView->setSelectionMode ( KFile::Multi ); + + Q_ASSERT( m_spitem ); + sourceSelector->setDir ( m_spitem->path ); +} + +void AddExistingFilesDialog::importItems() +{ + if( !importView->items() ) + return; + + // items added via button or drag 'n drop + KFileItemListIterator itemList ( m_importList ); + + // items already added to the importView + KFileItemListIterator importedList ( *importView->items() ); + + QListViewItem* child = m_titem->firstChild(); + + QStringList duplicateList; + + while ( child ) + { + FileItem* curItem = static_cast ( child ); + + itemList.toFirst(); + + for ( ; itemList.current(); ++itemList ) + { + if ( ( *itemList )->name() == curItem->name ) + { + duplicateList.append ( ( *itemList )->name() ); + m_importList.remove ( ( *itemList ) ); + } + } + + child = child->nextSibling(); + } + + importedList.toFirst(); + + for ( ; importedList.current(); ++importedList ) + { + itemList.toFirst(); + + for ( ; itemList.current(); ++itemList ) + { + if ( ( *importedList )->name() == ( *itemList )->name() ) + { + m_importList.remove ( ( *itemList ) ); + + // to avoid that a item is added twice + if ( !duplicateList.remove ( ( *importedList )->name() ) ) + { + duplicateList.append ( ( *importedList )->name() ); + } + } + } + } + + if ( duplicateList.count() > 0 ) + { + if ( KMessageBox::warningContinueCancelList ( this, i18n ( + "The following file(s) already exist(s) in the target!\n" + "Press Continue to import only the new files.\n" + "Press Cancel to abort the complete import." ), + duplicateList, "Warning", KGuiItem ( i18n ( "Continue" ) ) ) == KMessageBox::Cancel ) + { + m_importList.clear(); + return; + } + } + + itemList.toFirst(); + + for ( ; itemList.current(); ++itemList ) + { + if ( !( *itemList )->isDir() ) + { + importView->insertItem ( ( *itemList ) ); + } + } + + importView->somethingDropped ( true ); + + m_importList.clear(); + + importView->update (); +} + +void AddExistingFilesDialog::slotOk() +{ + if ( importView->items()->count() == 0 ) QDialog::reject(); + + progressBar->show(); + progressBar->setFormat ( i18n ( "Importing... %p%" ) ); + + qApp->processEvents(); + + KFileItemListIterator items ( *importView->items() ); + + // contains at the end only the imported files outside the subproject directory + KFileItemList outsideList; + + QStringList stringList; + + for ( ; items.current(); ++items ) + { + // kdDebug ( 9020 ) << " **** " << ( *items )->url().directory() << "***** " << m_spitem->path << endl; + if ( ( *items )->url().directory() != m_spitem->path ) + { + stringList.append ( ( *items )->name() ); + outsideList.append ( ( *items ) ); + } + } + + progressBar->setTotalSteps ( outsideList.count() + importView->items()->count() ); + + if ( outsideList.count() > 0 ) + { + if ( KMessageBox::questionYesNoList ( this, i18n ( + "The following file(s) are not in the Subproject directory.\n" + "Press Link to add the files by creating symbolic links.\n" + "Press Copy to copy the files into the directory." ), + stringList, i18n("Warning"), KGuiItem ( i18n ( "Link (recommended)" ) ), KGuiItem ( i18n ( "Copy (not recommended)" ) ) ) == KMessageBox::No ) + { + // Copy files into the Subproject directory + KFileItemListIterator it ( outsideList ) ; + + for ( ; it.current(); ++it ) + { + KProcess proc; + + proc << "cp"; + proc << ( *it )->url().path(); + proc << m_spitem->path; + proc.start(KProcess::DontCare); + + progressBar->setValue ( progressBar->value() + 1 ); + } + } + else + { + // Link them into the Subproject directory + KFileItemListIterator it ( outsideList ) ; + + for ( ; it.current(); ++it ) + { + KProcess proc; + + proc << "ln"; + proc << "-s"; + proc << URLUtil::relativePathToFile( m_spitem->path, ( *it )->url().path() ); + proc << m_spitem->path; + proc.start(KProcess::DontCare); + + progressBar->setValue ( progressBar->value() + 1 ); + } + } + } + + items.toFirst(); + + QString canontargetname = AutoProjectTool::canonicalize ( m_titem->name ); + QString varname; + if( m_titem->primary == "PROGRAMS" || m_titem->primary == "LIBRARIES" || m_titem->primary == "LTLIBRARIES" ) + varname = canontargetname + "_SOURCES"; + else + varname = m_titem->prefix + "_" + m_titem->primary; + + QMap replaceMap; + FileItem* fitem = 0L; + QStringList fileList; + + for ( ; items.current(); ++items ) + { + m_spitem->variables [ varname ] += ( " " + ( *items )->name() ); + replaceMap.insert ( varname, m_spitem->variables [ varname ] ); + + fitem = m_widget->createFileItem ( ( *items )->name(), m_spitem ); + m_titem->sources.append ( fitem ); + m_titem->insertItem ( fitem ); + + fileList.append ( m_spitem->path.mid ( m_part->projectDirectory().length() + 1 ) + "/" + ( *items )->name() ); + + progressBar->setValue ( progressBar->value() + 1 ); + } + + m_widget->emitAddedFiles ( fileList ); + + AutoProjectTool::addToMakefileam ( m_spitem->path + "/Makefile.am", replaceMap ); + + QDialog::accept(); + +} + +void AddExistingFilesDialog::slotAddSelected() +{ + KFileItemListIterator it ( *sourceSelector->dirOperator()->selectedItems() ); + + for ( ; it.current(); ++it ) + { + if ( ( *it )->url().isLocalFile() ) // maybe unnecessary + { + m_importList.append ( ( *it ) ); + } + } + + importItems(); +} + + +void AddExistingFilesDialog::slotAddAll() +{ + KFileItemListIterator it ( *sourceSelector->dirOperator()->view()->items() ); + + for ( ; it.current(); ++it ) + { + if ( ( *it )->url().isLocalFile() ) // maybe unnecessary + { + m_importList.append ( ( *it ) ); + } + } + + importItems(); +} + +void AddExistingFilesDialog::slotRemoveAll() +{ + KURL::List deletedFiles; + KFileItemListIterator it ( *importView->items() ); + + for ( ; it.current(); ++it ) + { + kdDebug ( 9020 ) << "AddExistingFilesDialog::slotRemoveAll()" << endl; + //deletedFiles.append ( ( *it )->url() ); + if ( (*it ) ) importView->removeItem ( *it ); + } + + importView->somethingDropped ( false ); + + importView->viewport()->update(); +} + +void AddExistingFilesDialog::slotRemoveSelected() +{ + KFileItemListIterator items ( *importView->items() ); + + KFileItemList* selectedList = (KFileItemList*) importView->selectedItems(); + + KFileItem * deleteItem = 0L; + + for ( ; items.current(); ++items ) + { + deleteItem = selectedList->first(); + + while ( deleteItem ) + { + if ( deleteItem == ( *items ) ) + { + importView->removeItem ( deleteItem ); + deleteItem = selectedList->current(); + } + else + { + deleteItem = selectedList->next(); + } + } + } + + if ( importView->items()->count() == 0 ) importView->somethingDropped ( false ); + + importView->viewport()->update(); +} + + +void AddExistingFilesDialog::slotDropped ( QDropEvent* ev ) +{ + kdDebug ( 9020 ) << "AddExistingFilesDialog::dropped()" << endl; + + KURL::List urls; + + KURLDrag::decode( ev, urls ); + + KFileItem* item = 0L; + KMimeType::Ptr type = 0L; + + + for ( KURL::List::Iterator it = urls.begin(); it != urls.end(); ++it ) + { + if ( ( *it ).isLocalFile() ) // maybe unnecessary + { + type = KMimeType::findByURL ( ( *it ) ); + + if ( type->name() != KMimeType::defaultMimeType() ) + { + item = new KFileItem ( ( *it ) , type->name(), 0 ); + } + else + { + // take a text-file-icon instead of the ugly question-mark-icon + item = new KFileItem ( ( *it ), "text/plain", 0 ); + } + + m_importList.append ( item ); + } + } + + importItems(); +} + +#include "addexistingfilesdlg.moc" diff --git a/buildtools/autotools/addexistingfilesdlg.h b/buildtools/autotools/addexistingfilesdlg.h new file mode 100644 index 00000000..5bee18b6 --- /dev/null +++ b/buildtools/autotools/addexistingfilesdlg.h @@ -0,0 +1,77 @@ +/*************************************************************************** + ------------------- + begin : Frag' mich was leichteres + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/** Here resides the Import-existing-files-dialog of the Automake Manager **/ +/** (a KDevelop build tool part) **/ + +#ifndef ADDEXISTINGFILESDLG_H +#define ADDEXISTINGFILESDLG_H + +#include +#include + +#include "addexistingdlgbase.h" +#include "fileselectorwidget.h" + +#include "misc.h" + +class KImportIconView; +class FileSelectorWidget; +class AutoProjectWidget; +class AutoProjectPart; +class SubprojectItem; +class TargetItem; +class KFileItem; + +class AddExistingFilesDialog : public AddExistingDlgBase +{ + Q_OBJECT + +public: + AddExistingFilesDialog( AutoProjectPart* part, AutoProjectWidget *widget, + SubprojectItem* spitem, TargetItem* titem, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~AddExistingFilesDialog(); + +private: + FileSelectorWidget* sourceSelector; + KImportIconView* importView; + + AutoProjectPart* m_part; + AutoProjectWidget* m_widget; + + TargetItem* m_titem; + SubprojectItem* m_spitem; + + KFileItemList m_importList; + +protected: + // virtual void resizeEvent ( QResizeEvent* ev ); + void init(); + void importItems (); + +protected slots: + void slotAddSelected(); + void slotAddAll(); + void slotRemoveAll(); + void slotRemoveSelected(); + void slotDropped ( QDropEvent* ev ); + + void slotOk(); +}; + +#endif // ADDEXISTINGFILESDLG_H +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/addfiledlg.cpp b/buildtools/autotools/addfiledlg.cpp new file mode 100644 index 00000000..46529086 --- /dev/null +++ b/buildtools/autotools/addfiledlg.cpp @@ -0,0 +1,135 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addfiledlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "filetemplate.h" +#include "misc.h" +#include "urlutil.h" +#include "autoprojectpart.h" +#include "autoprojectwidget.h" + +#include "kdevpartcontroller.h" + +AddFileDialog::AddFileDialog(AutoProjectPart *part, AutoProjectWidget *widget, + SubprojectItem *spitem, TargetItem *item, + QWidget *parent, const char *name) + : AddFileDlgBase(parent, name, true) +{ + connect ( createButton, SIGNAL ( clicked() ), this, SLOT ( accept() ) ); + connect ( cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) ); + + directoryLabel->setText ( spitem->path ); + if ( item->name.isEmpty() ) + targetLabel->setText ( i18n ( "%1 in %2" ).arg ( item->primary ).arg ( item->prefix ) ); + else + targetLabel->setText ( item->name ); + + setIcon ( SmallIcon ( "filenew.png" ) ); + + m_part = part; + m_widget = widget; + subProject = spitem; + target = item; +} + + +AddFileDialog::~AddFileDialog() +{} + + +void AddFileDialog::accept() +{ + QString name = fileEdit->text(); + if (name.find('/') != -1) { + KMessageBox::sorry(this, i18n("Please enter the file name without '/' and so on.")); + return; + } + + QListViewItem *child = target->firstChild(); + while (child) { + FileItem *item = static_cast(child); + if (name == item->name) { + KMessageBox::sorry(this, i18n("This file is already in the target.")); + return; + } + child = child->nextSibling(); + } + + if (templateCheckBox->isChecked()) { + QString srcdir = m_part->projectDirectory(); + QString destdir = subProject->path; + QString destpath = destdir + "/" + name; + if (QFileInfo(destpath).exists()) { + KMessageBox::sorry(this, i18n("A file with this name already exists.

Please use the \"Add existing file\" dialog.")); + return; + } + if( !FileTemplate::copy(m_part, QFileInfo(name).extension(), destpath) ) + kdDebug(9020) << "cannot create file " << destpath << endl; + } else { + // create an empty file + QString srcdir = m_part->projectDirectory(); + QString destdir = subProject->path; + QString destpath = destdir + "/" + name; + + if (QFileInfo(destpath).exists()) { + KMessageBox::sorry(this, i18n("A file with this name already exists.

Please use the \"Add existing file\" dialog.")); + return; + } + + QFile f( destpath ); + if( f.open(IO_WriteOnly) ) + f.close(); + } + + FileItem *fitem = m_widget->createFileItem(name, subProject); + target->sources.append(fitem); + target->insertItem(fitem); + + QString canontargetname = AutoProjectTool::canonicalize(target->name); + QString varname; + if( target->primary == "PROGRAMS" || target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES" ) + varname = canontargetname + "_SOURCES"; + else + varname = target->prefix + "_" + target->primary; + subProject->variables[varname] += (" " + name); + + QMap replaceMap; + replaceMap.insert(varname, subProject->variables[varname]); + + AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap); + + m_widget->emitAddedFile( subProject->path.mid ( m_part->project()->projectDirectory().length() + 1 ) + "/" + name ); + m_part->partController()->editDocument ( KURL ( subProject->path + "/" + name ) ); + + QDialog::accept(); +} + +#include "addfiledlg.moc" diff --git a/buildtools/autotools/addfiledlg.h b/buildtools/autotools/addfiledlg.h new file mode 100644 index 00000000..328e3593 --- /dev/null +++ b/buildtools/autotools/addfiledlg.h @@ -0,0 +1,47 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDFILEDLG_H_ +#define _ADDFILEDLG_H_ + +#include + +#include "addfiledlgbase.h" + +class QCheckBox; +class QLineEdit; +class AutoProjectPart; +class AutoProjectWidget; +class SubprojectItem; +class TargetItem; + + +class AddFileDialog : public AddFileDlgBase +{ + Q_OBJECT + +public: + AddFileDialog( AutoProjectPart *part, AutoProjectWidget *widget, + SubprojectItem *spitem, TargetItem *item, + QWidget *parent = 0, const char *name = 0 ); + ~AddFileDialog(); + +protected: + virtual void accept(); + +private: + AutoProjectPart *m_part; + AutoProjectWidget *m_widget; + SubprojectItem *subProject; + TargetItem *target; +}; + +#endif diff --git a/buildtools/autotools/addfiledlgbase.ui b/buildtools/autotools/addfiledlgbase.ui new file mode 100644 index 00000000..dc8e38b2 --- /dev/null +++ b/buildtools/autotools/addfiledlgbase.ui @@ -0,0 +1,289 @@ + +AddFileDlgBase + + + AddFileDlgBase + + + + 0 + 0 + 521 + 217 + + + + + 5 + 5 + 0 + 0 + + + + + 32767 + 32767 + + + + + 0 + 0 + + + + Add New Created File to Target + + + + unnamed + + + + targetBox + + + Box + + + Sunken + + + Subproject Information + + + + unnamed + + + + targetLayout + + + + unnamed + + + 0 + + + + directoryLabel + + + [TARGET DIRECTORY] + + + + + targetLabel + + + [TARGET NAME] + + + + + directoryStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + + + + Directory: + + + + + targetStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + + + + Target: + + + + + + + + + fileGroupBox + + + File Information + + + + unnamed + + + + fileEdit + + + + 5 + 5 + 0 + 0 + + + + + 0 + 0 + + + + + + templateCheckBox + + + + 1 + 0 + 0 + 0 + + + + &Use file template + + + true + + + + + fileStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + 0 + 0 + + + + + + + + New file &name (with extension): + + + fileEdit + + + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + buttonLayout + + + + unnamed + + + 0 + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + createButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + + ksqueezedtextlabel.h + klineedit.h + kdialog.h + + + + + ksqueezedtextlabel.h + klineedit.h + + diff --git a/buildtools/autotools/addicondlg.cpp b/buildtools/autotools/addicondlg.cpp new file mode 100644 index 00000000..251601f7 --- /dev/null +++ b/buildtools/autotools/addicondlg.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addicondlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include // fix me! + +#include "autolistviewitems.h" + +#include "autoprojectpart.h" +#include "autoprojectwidget.h" + + +const char *type_map[] = { + "app", "action", "device", "filesys", "mime" +}; + + +const char *size_map[] = { + "hi16", "hi22", "hi32", "hi48", "hi64", "hi128" +}; + + +AddIconDialog::AddIconDialog(AutoProjectPart *part, AutoProjectWidget *widget, + SubprojectItem *spitem, TargetItem *titem, + QWidget *parent, const char *name) + : AddIconDialogBase(parent, name, true) +{ + type_combo->insertItem(i18n("Application")); + type_combo->insertItem(i18n("Action")); + type_combo->insertItem(i18n("Device")); + type_combo->insertItem(i18n("File System")); + type_combo->insertItem(i18n("MIME Type")); + + size_combo->insertItem("16"); + size_combo->insertItem("22"); + size_combo->insertItem("32"); + size_combo->insertItem("48"); + size_combo->insertItem("64"); + size_combo->insertItem("128"); + + somethingChanged(); + + setIcon ( SmallIcon ( "iconadd_kdevelop" ) ); + + m_part = part; + m_widget = widget; + m_subProject = spitem; + m_target = titem; +} + + +AddIconDialog::~AddIconDialog() +{} + + +void AddIconDialog::somethingChanged() +{ + QString size = size_map[size_combo->currentItem()]; + QString type = type_map[type_combo->currentItem()]; + QString name = name_edit->text(); + + filename_edit->setText(size + "-" + type + "-" + name + ".png"); +} + + +void AddIconDialog::accept() +{ + QString name = filename_edit->text(); + + QString destdir = m_subProject->subdir; + QString destpath = destdir + "/" + name; + + QString size = size_combo->currentText(); + QString unknown = KIconTheme::defaultThemeName()+ "/" + size + "x" + size + "/mimetypes/unknown.png"; + + QString templateFileName = locate("icon", unknown); + kdDebug(9020) << "Unknown: " << unknown << ", template: " << templateFileName << endl; + + if (!templateFileName.isEmpty()) { + KProcess proc; + proc << "cp"; + proc << templateFileName; + proc << destpath; + proc.start(KProcess::DontCare); + } + + FileItem *fitem = m_widget->createFileItem(name, m_subProject); + m_target->sources.append(fitem); + m_target->insertItem(fitem); + + m_part->startMakeCommand(destdir, QString::fromLatin1("force-reedit")); + + m_widget->emitAddedFile(destpath); + + QDialog::accept(); +} + +#include "addicondlg.moc" diff --git a/buildtools/autotools/addicondlg.h b/buildtools/autotools/addicondlg.h new file mode 100644 index 00000000..64fac0a5 --- /dev/null +++ b/buildtools/autotools/addicondlg.h @@ -0,0 +1,44 @@ +/*************************************************************************** +* Copyright (C) 2002 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDICONDLG_H_ +#define _ADDICONDLG_H_ + +#include "addicondlgbase.h" + +class AutoProjectPart; +class AutoProjectWidget; +class SubprojectItem; +class TargetItem; + + +class AddIconDialog : public AddIconDialogBase +{ + Q_OBJECT + +public: + AddIconDialog( AutoProjectPart *part, AutoProjectWidget *widget, + SubprojectItem *spitem, TargetItem *titem, + QWidget *parent = 0, const char *name = 0 ); + ~AddIconDialog(); + + +private: + virtual void somethingChanged(); + virtual void accept(); + + AutoProjectPart *m_part; + AutoProjectWidget *m_widget; + SubprojectItem *m_subProject; + TargetItem *m_target; +}; + +#endif diff --git a/buildtools/autotools/addicondlgbase.ui b/buildtools/autotools/addicondlgbase.ui new file mode 100644 index 00000000..7fec5097 --- /dev/null +++ b/buildtools/autotools/addicondlgbase.ui @@ -0,0 +1,273 @@ + +AddIconDialogBase + + + add_icon_dialog + + + + 0 + 0 + 301 + 218 + + + + Add New Icon + + + false + + + + unnamed + + + + + type_label + + + + + + + &Type: + + + AlignVCenter|AlignRight + + + type_combo + + + + + size_label + + + + + + + &Size: + + + AlignVCenter|AlignRight + + + size_combo + + + + + size_combo + + + + + filename_label + + + + + + + File name: + + + AlignVCenter|AlignRight + + + filename_edit + + + + + name_label + + + + + + + &Name: + + + AlignVCenter|AlignRight + + + name_edit + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + Layout1 + + + + unnamed + + + 0 + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okbutton + + + &OK + + + true + + + true + + + + + cancelbutton + + + &Cancel + + + true + + + + + + + name_edit + + + unknown + + + + + type_combo + + + + + filename_edit + + + + 5 + 0 + 0 + 0 + + + + StyledPanel + + + Sunken + + + + + Spacer22 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + + + okbutton + clicked() + add_icon_dialog + accept() + + + cancelbutton + clicked() + add_icon_dialog + reject() + + + name_edit + textChanged(const QString&) + add_icon_dialog + somethingChanged() + + + type_combo + activated(int) + add_icon_dialog + somethingChanged() + + + size_combo + activated(int) + add_icon_dialog + somethingChanged() + + + + type_combo + size_combo + name_edit + okbutton + cancelbutton + + + somethingChanged() + + + kdialog.h + + + + + + diff --git a/buildtools/autotools/addprefixdlg.cpp b/buildtools/autotools/addprefixdlg.cpp new file mode 100644 index 00000000..d1557114 --- /dev/null +++ b/buildtools/autotools/addprefixdlg.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addprefixdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +AddPrefixDialog::AddPrefixDialog( const QString& nameEdit, const QString& pathEdit, + QWidget *parent, const char *name) + : QDialog(parent, name, true) +{ + setCaption(i18n("Add Prefix")); + + QLabel *name_label = new QLabel(i18n("&Name:"), this); + name_edit = new KLineEdit(nameEdit, this); + name_edit->setFocus(); + name_label->setBuddy(name_edit); + connect( name_edit, SIGNAL( textChanged ( const QString & ) ), SLOT( slotPrefixChanged() ) ); + + QLabel *path_label = new QLabel(i18n("&Path:"), this); + path_edit = new KLineEdit(pathEdit, this); + path_label->setBuddy(path_edit); + QFontMetrics fm(path_edit->fontMetrics()); + path_edit->setMinimumWidth(fm.width('X')*35); + connect( path_edit, SIGNAL( textChanged ( const QString & ) ), SLOT( slotPrefixChanged() ) ); + + QVBoxLayout *layout = new QVBoxLayout(this, 10); + + QGridLayout *grid = new QGridLayout(2, 2); + layout->addLayout(grid); + grid->addWidget(name_label, 0, 0); + grid->addWidget(name_edit, 0, 1); + grid->addWidget(path_label, 1, 0); + grid->addWidget(path_edit, 1, 1); + + QFrame *frame = new QFrame(this); + frame->setFrameStyle(QFrame::HLine | QFrame::Sunken); + layout->addWidget(frame, 0); + + KButtonBox *buttonbox = new KButtonBox(this); + buttonbox->addStretch(); + m_pOk = buttonbox->addButton(KStdGuiItem::ok()); + QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel()); + m_pOk->setDefault(true); + connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); + buttonbox->layout(); + layout->addWidget(buttonbox, 0); + slotPrefixChanged(); +} + + +AddPrefixDialog::~AddPrefixDialog() +{} + +void AddPrefixDialog::slotPrefixChanged() +{ + m_pOk->setEnabled( !name_edit->text().isEmpty() && !path_edit->text().isEmpty() ); +} + +#include "addprefixdlg.moc" diff --git a/buildtools/autotools/addprefixdlg.h b/buildtools/autotools/addprefixdlg.h new file mode 100644 index 00000000..a20bc63a --- /dev/null +++ b/buildtools/autotools/addprefixdlg.h @@ -0,0 +1,45 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDPREFIXDLG_H_ +#define _ADDPREFIXDLG_H_ + +#include +#include +class QPushButton; + +class AddPrefixDialog : public QDialog +{ + Q_OBJECT + +public: + AddPrefixDialog( const QString& nameEdit = "", const QString& pathEdit = "", + QWidget *parent = 0, const char *name = 0 ); + ~AddPrefixDialog(); + + QString name() const + { + return name_edit->text(); + } + QString path() const + { + return path_edit->text(); + } +private slots: + void slotPrefixChanged(); + +private: + KLineEdit *name_edit; + KLineEdit *path_edit; + QPushButton *m_pOk; +}; + +#endif diff --git a/buildtools/autotools/addservicedlg.cpp b/buildtools/autotools/addservicedlg.cpp new file mode 100644 index 00000000..2dc76e5e --- /dev/null +++ b/buildtools/autotools/addservicedlg.cpp @@ -0,0 +1,233 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addservicedlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "misc.h" +#include "autoprojectwidget.h" +#include "autoprojectpart.h" + + +AddServiceDialog::AddServiceDialog(AutoProjectWidget *widget, SubprojectItem *spitem, + QWidget *parent, const char *name) + : AddServiceDialogBase(parent, name, true) +{ + filename_edit->setText(".desktop"); + filename_edit->home(false); + filename_edit->setFocus(); + chosentypes_listview->header()->hide(); + availtypes_listview->header()->hide(); + + m_widget = widget; + subProject = spitem; + + // Fill the combo box with library names in the directory + QPtrListIterator tit(spitem->targets); + for (; tit.current(); ++tit) { + if ((*tit)->primary == "LTLIBRARIES") + library_combo->insertItem(QString((*tit)->name)); + } + + // Fill the list of available service types + KServiceType::List l = KServiceType::allServiceTypes(); + KServiceType::List::Iterator it; + for (it = l.begin(); it != l.end(); ++it) + if (!(*it)->isType(KST_KMimeType)) + new QListViewItem(availtypes_listview, (*it)->name()); + + setIcon ( SmallIcon ( "servicenew_kdevelop.png" ) ); +} + + +AddServiceDialog::~AddServiceDialog() +{} + + +void AddServiceDialog::updateProperties() +{ + QStringList props; + + QListViewItem *item = static_cast(chosentypes_listview->firstChild()); + while (item) { + KServiceType::Ptr type = KServiceType::serviceType(item->text(0)); + if (type) { + QStringList stprops = type->propertyDefNames(); + QStringList::ConstIterator stit; + for (stit = stprops.begin(); stit != stprops.end(); ++stit) + if (props.find(*stit) == props.end() && (*stit) != "Name" && (*stit) != "Comment" + && (*stit) != "Icon") + props.append(*stit); + } + item = item->nextSibling(); + } + + properties_listview->clear(); + QStringList::ConstIterator it; + for (it = props.begin(); it != props.end(); ++it) + new QListViewItem(properties_listview, *it); +} + + +void AddServiceDialog::iconClicked() +{ + KIconLoader *loader = AutoProjectFactory::instance()->iconLoader(); + QString name = KIconDialog::getIcon(KIcon::Desktop); + if (!name.isNull()) { + iconName = name; + icon_button->setPixmap(loader->loadIcon(name, KIcon::Desktop)); + } +} + + +void AddServiceDialog::addTypeClicked() +{ + QListViewItem *selitem = availtypes_listview->selectedItem(); + if (!selitem) + return; + + QListViewItem *olditem = chosentypes_listview->firstChild(); + while (olditem) { + if (selitem->text(0) == olditem->text(0)) + return; + olditem = olditem->nextSibling(); + } + new QListViewItem(chosentypes_listview, selitem->text(0)); + + updateProperties(); +} + + +void AddServiceDialog::removeTypeClicked() +{ + delete chosentypes_listview->currentItem(); + + updateProperties(); +} + + +void AddServiceDialog::propertyExecuted(QListViewItem *item) +{ + if (!item) + return; + + QString prop = item->text(0); + QString value = item->text(1); + bool ok; + value = KInputDialog::getText(i18n("Enter Value"), i18n("Property %1:").arg(prop), value, &ok, this); + if (!ok) + return; + + item->setText(1, value); +} + + +void AddServiceDialog::accept() +{ + // Create list of service types + QStringList serviceTypes; + QListViewItem *item = chosentypes_listview->firstChild(); + while (item) { + serviceTypes.append(item->text(0)); + item = item->nextSibling(); + } + + // Some plausibility tests + QString fileName = filename_edit->text(); + if (fileName.isEmpty() || fileName == ".desktop") { + KMessageBox::sorry(this, i18n("You have to enter a file name.")); + filename_edit->setFocus(); + return; + } + + QString name = name_edit->text(); + if (name.isEmpty()) { + KMessageBox::sorry(this, i18n("You have to enter a service name.")); + name_edit->setFocus(); + return; + } + + QFile f(subProject->path + "/" + fileName); + if (f.exists()) { + KMessageBox::sorry(this, i18n("A file with this name exists already.")); + filename_edit->setFocus(); + return; + } + if (!f.open(IO_WriteOnly)) { + KMessageBox::sorry(this, i18n("Could not open file for writing.")); + return; + } + + QTextStream stream(&f); + stream << "[Desktop Entry]" << endl; + stream << "Type=Service" << endl; + stream << "Name=" << name << endl; + stream << "Comment=" << comment_edit->text() << endl; + if (!iconName.isNull()) + stream << "Icon=" << iconName << endl; + stream << "ServiceTypes=" << serviceTypes.join(",") << endl; + item = properties_listview->firstChild(); + while (item) { + stream << item->text(0) << "=" << item->text(1) << endl; + item = item->nextSibling(); + } + f.close(); + + // Find a prefix that points to the services directory. + // If there is none, use kde_services + QMap::ConstIterator it; + for (it = subProject->prefixes.begin(); it != subProject->prefixes.end(); ++it) + if (it.data() == "$(kde_servicesdir)") + break; + QString prefix = (it == subProject->prefixes.end())? QString("kde_services") : it.key(); + QString varname = prefix + "_DATA"; + + // Look if a list view item for this prefix exists already. + // Create a new one otherwise + TargetItem *titem = 0; + for (uint i=0; i < subProject->targets.count(); ++i) { + TargetItem *tmptitem = subProject->targets.at(i); + if ("DATA" == tmptitem->primary && prefix == tmptitem->prefix) { + titem = tmptitem; + break; + } + } + if (!titem) { + titem = m_widget->createTargetItem("", prefix, "DATA", false); + subProject->targets.append(titem); + } + // Add this file to the target + FileItem *fitem = m_widget->createFileItem(fileName, subProject); + titem->sources.append(fitem); + + subProject->variables[varname] += (" " + fileName); + QMap replaceMap; + replaceMap.insert(varname, subProject->variables[varname]); + AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap); + + QDialog::accept(); +} + +#include "addservicedlg.moc" diff --git a/buildtools/autotools/addservicedlg.h b/buildtools/autotools/addservicedlg.h new file mode 100644 index 00000000..c8b694a5 --- /dev/null +++ b/buildtools/autotools/addservicedlg.h @@ -0,0 +1,46 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDSERVICEDLG_H_ +#define _ADDSERVICEDLG_H_ + +#include "addservicedlgbase.h" + +class AutoProjectWidget; +class SubprojectItem; +class TargetItem; + + +class AddServiceDialog : public AddServiceDialogBase +{ + Q_OBJECT + +public: + AddServiceDialog( AutoProjectWidget *widget, SubprojectItem *spitem, + QWidget *parent = 0, const char *name = 0 ); + ~AddServiceDialog(); + +protected: + virtual void iconClicked(); + virtual void addTypeClicked(); + virtual void removeTypeClicked(); + virtual void propertyExecuted( QListViewItem *item ); + virtual void accept(); + +private: + void updateProperties(); + + AutoProjectWidget *m_widget; + SubprojectItem *subProject; + QString iconName; +}; + +#endif diff --git a/buildtools/autotools/addservicedlgbase.ui b/buildtools/autotools/addservicedlgbase.ui new file mode 100644 index 00000000..050f8066 --- /dev/null +++ b/buildtools/autotools/addservicedlgbase.ui @@ -0,0 +1,544 @@ + +AddServiceDialogBase + + + add_service_dialog + + + + 0 + 0 + 602 + 422 + + + + Add New Service + + + false + + + + unnamed + + + + + GroupBox1 + + + &Service File + + + + unnamed + + + + + filename_edit + + + + + + + + icon_label + + + + + + + &Icon: + + + AlignVCenter|AlignRight + + + icon_button + + + + + Layout2 + + + + unnamed + + + 0 + + + + + icon_button + + + + 24 + 24 + + + + + + + false + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + comment_edit + + + + + name_edit + + + + + library_combo + + + true + + + + + library_label + + + + + + + &Library: + + + AlignVCenter|AlignRight + + + library_combo + + + + + filename_label + + + + + + + &File name: + + + AlignVCenter|AlignRight + + + filename_edit + + + + + name_label + + + + + + + &Name: + + + AlignVCenter|AlignRight + + + name_edit + + + + + comment_label + + + + + + + Co&mment: + + + AlignVCenter|AlignRight + + + comment_edit + + + + + + + GroupBox2 + + + Service &Types + + + + unnamed + + + + + Layout5 + + + + unnamed + + + 0 + + + + + + + + + true + + + true + + + + chosentypes_listview + + + + 7 + 7 + 0 + 0 + + + + LastColumn + + + + + Layout3 + + + + unnamed + + + 0 + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + add_button + + + <- + + + + + remove_button + + + -> + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + true + + + true + + + + availtypes_listview + + + + 7 + 7 + 0 + 0 + + + + LastColumn + + + + + + + + Property + + + true + + + true + + + + + Value + + + true + + + true + + + + properties_listview + + + + 7 + 5 + 0 + 0 + + + + true + + + AllColumns + + + + + properties_label + + + + 5 + 5 + 0 + 0 + + + + + + + + &Properties: + + + AlignTop|AlignRight + + + properties_listview + + + + + + + Layout1 + + + + unnamed + + + 0 + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okbutton + + + &OK + + + true + + + true + + + + + cancelbutton + + + &Cancel + + + true + + + + + + + + + okbutton + clicked() + add_service_dialog + accept() + + + cancelbutton + clicked() + add_service_dialog + reject() + + + remove_button + clicked() + add_service_dialog + removeTypeClicked() + + + properties_listview + doubleClicked(QListViewItem*) + add_service_dialog + propertyExecuted(QListViewItem*) + + + properties_listview + returnPressed(QListViewItem*) + add_service_dialog + propertyExecuted(QListViewItem*) + + + icon_button + clicked() + add_service_dialog + iconClicked() + + + add_button + clicked() + add_service_dialog + addTypeClicked() + + + + filename_edit + library_combo + name_edit + icon_button + comment_edit + chosentypes_listview + add_button + remove_button + availtypes_listview + properties_listview + okbutton + cancelbutton + + + iconClicked() + addTypeClicked() + propertyExecuted(QListViewItem*) + removeTypeClicked() + + + kdialog.h + + + + diff --git a/buildtools/autotools/addsubprojectdlg.cpp b/buildtools/autotools/addsubprojectdlg.cpp new file mode 100644 index 00000000..8011886b --- /dev/null +++ b/buildtools/autotools/addsubprojectdlg.cpp @@ -0,0 +1,198 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addsubprojectdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "kdevmakefrontend.h" +#include "misc.h" +#include "autoprojectpart.h" +#include "autosubprojectview.h" + + +AddSubprojectDialog::AddSubprojectDialog(AutoProjectPart *part, AutoSubprojectView *view, + SubprojectItem *item, QWidget *parent, const char *name) + : AddSubprojectDlgBase(parent, name, true) +{ + setIcon(SmallIcon("folder_new.png")); + + connect( createButton, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) ); + + m_subProject = item; + m_subprojectView = view; + m_part = part; +} + + +AddSubprojectDialog::~AddSubprojectDialog() +{} + + +void AddSubprojectDialog::accept() +{ + QString name = spEdit->text().stripWhiteSpace(); + + if (name.isEmpty()) { + KMessageBox::sorry(this, i18n("You have to give the subproject a name.")); + return; + } + + QListViewItem *childItem = m_subProject->firstChild(); + while (childItem) { + if (name == static_cast(childItem)->subdir) { + KMessageBox::sorry(this, i18n("A subproject with this name already exists.")); + return; + } + childItem = childItem->nextSibling(); + } + + +#if 0 + // check for config.status + if( !QFileInfo(m_part->projectDirectory(), "config.status").exists() ){ + KMessageBox::sorry(this, i18n("There is no config.status in the project root directory. Run 'Configure' first")); + QDialog::accept(); + return; + } +#endif + + QDir dir( m_subProject->path ); + QFileInfo file( dir, name ); + + if( file.exists() && !file.isDir() ) { + KMessageBox::sorry(this, i18n("A file named %1 already exists.").arg(name)); + QDialog::accept(); + return; + } else if( file.isDir() ) { + if( KMessageBox::warningContinueCancel(this, + i18n("A subdirectory %1 already exists. " + "Do you wish to add it as a subproject?").arg(name)) + == KMessageBox::Cancel ){ + QDialog::accept(); + return; + } + } else if (!dir.mkdir(name)) { + KMessageBox::sorry(this, i18n("Could not create subdirectory %1.").arg(name)); + QDialog::accept(); + return; + } + + if(!dir.cd(name)) { + KMessageBox::sorry(this, i18n("Could not access the subdirectory %1.").arg(name)); + QDialog::accept(); + return; + } + + // Adjust SUBDIRS variable in containing Makefile.am + if (m_subProject->variables["SUBDIRS"].find("$(TOPSUBDIRS)") != -1) + { + QFile subdirsfile( m_subProject->path + "/subdirs" ); + if ( subdirsfile.open( IO_WriteOnly | IO_Append ) ) + { + QTextStream subdirsstream( &subdirsfile ); + subdirsstream << name << endl; + subdirsfile.close(); + } + } + else if (m_subProject->variables["SUBDIRS"].find("$(AUTODIRS)") != -1) + { + } + else + { + m_subProject->variables["SUBDIRS"] += (" " + name); + QMap replaceMap; + replaceMap.insert("SUBDIRS", m_subProject->variables["SUBDIRS"]); + AutoProjectTool::addToMakefileam(m_subProject->path + "/Makefile.am", replaceMap); + } + + // Create new item in tree view + SubprojectItem *newitem = new SubprojectItem(m_subProject, name); + newitem->subdir = name; + newitem->path = m_subProject->path + "/" + name; + newitem->variables["INCLUDES"] = m_subProject->variables["INCLUDES"]; + newitem->setOpen(true); + + // Move to the bottom of the list + QListViewItem *lastItem = m_subProject->firstChild(); + while (lastItem->nextSibling()) + lastItem = lastItem->nextSibling(); + if (lastItem != newitem) + newitem->moveItem(lastItem); + + // Create a Makefile in the new subdirectory + + QFile f( dir.filePath("Makefile.am") ); + if (f.exists()) { + m_subprojectView->parse( newitem ); + } else { + if (!f.open(IO_WriteOnly)) { + KMessageBox::sorry(this, i18n("Could not create Makefile.am in subdirectory %1.").arg(name)); + return; + } + QTextStream stream(&f); + stream << "INCLUDES = " << newitem->variables["INCLUDES"] << endl << "METASOURCES = AUTO" << endl; + f.close(); + } + + + + // if !isKDE: add the new sub-proj to configure.in + if ( !m_part->isKDE() ) { + QString projroot = m_part->projectDirectory() + "/"; + QString subdirectory = dir.path(); + QString relpath = subdirectory.replace(0, projroot.length(),""); + + QString configureFile = m_part->getAutoConfFile(projroot); + + QStringList list = AutoProjectTool::configureinLoadMakefiles(configureFile); + if ( !list.isEmpty() ) + { + list.push_back( relpath + "/Makefile" ); + AutoProjectTool::configureinSaveMakefiles(configureFile, list); + } + } + +#if 0 + QString relmakefile = (m_subProject->path + "/" + name + "/Makefile").mid(m_part->projectDirectory().length()+1); + kdDebug(9020) << "Relative makefile path: " << relmakefile << endl; + + QString cmdline = "cd "; + cmdline += KProcess::quote(m_part->projectDirectory()); + cmdline += " && automake "; + cmdline += KProcess::quote(relmakefile); + cmdline += " && CONFIG_HEADERS=config.h CONFIG_FILES="; + cmdline += KProcess::quote(relmakefile); + cmdline += " ./config.status"; + + m_part->makeFrontend()->queueCommand( m_part->projectDirectory(), cmdline ); + m_part->makeFrontend()->queueCommand( m_part->projectDirectory(), m_part->configureCommand() ); +#endif + + m_part->needMakefileCvs(); + + QDialog::accept(); +} + +#include "addsubprojectdlg.moc" diff --git a/buildtools/autotools/addsubprojectdlg.h b/buildtools/autotools/addsubprojectdlg.h new file mode 100644 index 00000000..eabfc0e1 --- /dev/null +++ b/buildtools/autotools/addsubprojectdlg.h @@ -0,0 +1,44 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDSUBPROJECTDLG_H_ +#define _ADDSUBPROJECTDLG_H_ + +#include +#include + +#include "addsubprojectdlgbase.h" + +class AutoProjectPart; +class AutoSubprojectView; +class SubprojectItem; + + +class AddSubprojectDialog : public AddSubprojectDlgBase +{ + Q_OBJECT + +public: + AddSubprojectDialog( AutoProjectPart *part, AutoSubprojectView *widget, + SubprojectItem *item, QWidget *parent = 0, const char *name = 0 ); + ~AddSubprojectDialog(); + +private: + virtual void accept(); + + KLineEdit *name_edit; + + SubprojectItem *m_subProject; + AutoSubprojectView *m_subprojectView; + AutoProjectPart *m_part; +}; + +#endif diff --git a/buildtools/autotools/addsubprojectdlgbase.ui b/buildtools/autotools/addsubprojectdlgbase.ui new file mode 100644 index 00000000..b4c762b1 --- /dev/null +++ b/buildtools/autotools/addsubprojectdlgbase.ui @@ -0,0 +1,198 @@ + +AddSubprojectDlgBase + + + AddSubprojectDlgBase + + + + 0 + 0 + 445 + 126 + + + + + 5 + 5 + 0 + 0 + + + + + 32767 + 32767 + + + + + 0 + 0 + + + + Add New Subproject + + + + unnamed + + + + fileGroupBox + + + Subproject + + + + unnamed + + + + Layout3 + + + + unnamed + + + 0 + + + + spStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + 0 + 0 + + + + + + + + Subproject &name: + + + spEdit + + + + + spEdit + + + + 5 + 5 + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + buttonLayout + + + + unnamed + + + 0 + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + createButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + + spEdit + createButton + cancelButton + + + klineedit.h + kdialog.h + + + + + klineedit.h + + diff --git a/buildtools/autotools/addtargetdlg.cpp b/buildtools/autotools/addtargetdlg.cpp new file mode 100644 index 00000000..b01b5b82 --- /dev/null +++ b/buildtools/autotools/addtargetdlg.cpp @@ -0,0 +1,226 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addtargetdlg.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "misc.h" +#include "autodetailsview.h" +#include "autoprojectwidget.h" + + +AddTargetDialog::AddTargetDialog(AutoProjectWidget *widget, SubprojectItem *item, + QWidget *parent, const char *name) + : AddTargetDialogBase(parent, name, true) +{ + m_subproject = item; + m_widget = widget; +// m_detailsView = view; + + primary_combo->setFocus(); + primary_combo->insertItem(i18n("Program")); + primary_combo->insertItem(i18n("Library")); + primary_combo->insertItem(i18n("Libtool Library")); + primary_combo->insertItem(i18n("Script")); + primary_combo->insertItem(i18n("Header")); + primary_combo->insertItem(i18n("Data File")); + primary_combo->insertItem(i18n("Java")); + + primaryChanged(); // updates prefix combo + + if (widget->kdeMode()) + ldflagsother_edit->setText("$(all_libraries)"); + + connect( filename_edit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileNameChanged (const QString&) ) ); + + setIcon ( SmallIcon ( "targetnew_kdevelop.png" ) ); + + canonicalLabel->setText ( QString::null ); +} + + +AddTargetDialog::~AddTargetDialog() +{} + + +void AddTargetDialog::primaryChanged() +{ + QStringList list; + switch (primary_combo->currentItem()) { + case 0: // Program + list.append("bin"); + list.append("sbin"); + list.append("libexec"); + list.append("pkglib"); + list.append("noinst"); + break; + case 1: // Library + case 2: // Libtool library + list.append("lib"); + list.append("pkglib"); + list.append("noinst"); + if (m_widget->kdeMode()) + list.append("kde_module"); + break; + case 3: // Script + list.append("bin"); + list.append("sbin"); + list.append("libexec"); + list.append("pkgdata"); + list.append("noinst"); + break; + case 4: // Header + list.append("include"); + list.append("oldinclude"); + list.append("pkginclude"); + list.append("noinst"); + break; + case 5: // Data + list.append("bin"); + list.append("sbin"); + list.append("noinst"); + break; + case 6: // Java + list.append("java"); + list.append("noinst"); + break; + } + + prefix_combo->clear(); + + prefix_combo->insertStringList(list); + QStringList prefixes; + QMap::ConstIterator it; + for (it = m_subproject->prefixes.begin(); it != m_subproject->prefixes.end(); ++it) + prefix_combo->insertItem(it.key()); + + // Only enable ldflags stuff for libtool libraries + bool lt = primary_combo->currentItem() == 2; + bool prog = primary_combo->currentItem() == 0; + allstatic_box->setEnabled(lt); + avoidversion_box->setEnabled(lt); + module_box->setEnabled(lt); + noundefined_box->setEnabled(lt); + ldflagsother_edit->setEnabled(lt || prog); +} + + +void AddTargetDialog::accept() +{ + QString name = filename_edit->text().stripWhiteSpace(); + QString prefix = prefix_combo->currentText(); + + QString primary; + switch (primary_combo->currentItem()) { + case 0: primary = "PROGRAMS"; break; + case 1: primary = "LIBRARIES"; break; + case 2: primary = "LTLIBRARIES"; break; + case 3: primary = "SCRIPTS"; break; + case 4: primary = "HEADERS"; break; + case 5: primary = "DATA"; break; + case 6: primary = "JAVA"; break; + default: ; + } + + if (name.isEmpty()) { + KMessageBox::sorry(this, i18n("You have to give the target a name")); + return; + } + +#if 0 + if (primary == "LIBRARIES" && !name.startsWith("lib")) { + KMessageBox::sorry(this, i18n("Libraries must have a lib prefix.")); + return; + } + + if (primary == "LTLIBRARIES" && !name.startsWith("lib")) { + KMessageBox::sorry(this, i18n("Libtool libraries must have a lib prefix.")); + return; + } + + if (primary == "LTLIBRARIES" && name.right(3) != ".la") { + KMessageBox::sorry(this, i18n("Libtool libraries must have a .la suffix.")); + return; + } + +#endif + + if( primary.endsWith("LIBRARIES") && !name.startsWith("lib") && !module_box->isChecked() ) + name.prepend( QString::fromLatin1("lib") ); + + if( primary == "LTLIBRARIES" && !name.endsWith(".la") ) + name.append( QString::fromLatin1(".la") ); + + if ( primary == "LIBRARIES" && !name.endsWith(".a") ) + name.append ( QString::fromLatin1(".a") ); + + QPtrListIterator it(m_subproject->targets); + for (; it.current(); ++it) + if (name == (*it)->name) { + KMessageBox::sorry(this, i18n("A target with this name already exists.")); + return; + } + + QStringList flagslist; + if (primary == "LTLIBRARIES") { + if (allstatic_box->isChecked()) + flagslist.append("-all-static"); + if (avoidversion_box->isChecked()) + flagslist.append("-avoid-version"); + if (module_box->isChecked()) + flagslist.append("-module"); + if (noundefined_box->isChecked()) + flagslist.append("-no-undefined"); + } + flagslist.append(ldflagsother_edit->text()); + QString ldflags = flagslist.join( " " ); + + TargetItem *titem = m_widget->createTargetItem(name, prefix, primary, false); + // m_detailsView->insertItem ( titem ); + m_subproject->targets.append(titem); + + QString canonname = AutoProjectTool::canonicalize(name); + + QMap replaceMap; + + if( primary == "PROGRAMS" || primary == "LIBRARIES" || primary == "LTLIBRARIES" || primary == "DATA" ){ + QString varname = prefix + "_" + primary; + m_subproject->variables[varname] += (" " + name); + replaceMap.insert(varname, m_subproject->variables[varname]); + if ( primary != "DATA" ){ + replaceMap.insert(canonname + "_SOURCES", ""); + } + } + if (primary == "LTLIBRARIES" || primary == "PROGRAMS") + replaceMap.insert(canonname + "_LDFLAGS", ldflags); + + AutoProjectTool::addToMakefileam(m_subproject->path + "/Makefile.am", replaceMap); + + QDialog::accept(); +} + +void AddTargetDialog::slotFileNameChanged ( const QString& text ) +{ + canonicalLabel->setText ( AutoProjectTool::canonicalize ( text ) ); +} + +#include "addtargetdlg.moc" diff --git a/buildtools/autotools/addtargetdlg.h b/buildtools/autotools/addtargetdlg.h new file mode 100644 index 00000000..98708531 --- /dev/null +++ b/buildtools/autotools/addtargetdlg.h @@ -0,0 +1,43 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDTARGETDLG_H_ +#define _ADDTARGETDLG_H_ + +#include "addtargetdlgbase.h" + +class AutoDetailsView; +class AutoProjectWidget; +class SubprojectItem; + + +class AddTargetDialog : public AddTargetDialogBase +{ + Q_OBJECT + +public: + AddTargetDialog( AutoProjectWidget *widget, SubprojectItem *item, + QWidget *parent = 0, const char *name = 0 ); + ~AddTargetDialog(); + +protected slots: + virtual void slotFileNameChanged ( const QString& ); + +private: + virtual void primaryChanged(); + virtual void accept(); + + SubprojectItem *m_subproject; + AutoProjectWidget *m_widget; + AutoDetailsView* m_detailsView; +}; + +#endif diff --git a/buildtools/autotools/addtargetdlgbase.ui b/buildtools/autotools/addtargetdlgbase.ui new file mode 100644 index 00000000..25687563 --- /dev/null +++ b/buildtools/autotools/addtargetdlgbase.ui @@ -0,0 +1,348 @@ + +AddTargetDialogBase + + + add_target_dialog + + + + 0 + 0 + 585 + 356 + + + + Add New Target + + + false + + + + unnamed + + + + groupBox2 + + + &Target + + + + unnamed + + + + primary_label + + + + + + + &Primary: + + + AlignVCenter|AlignRight + + + primary_combo + + + + + primary_combo + + + + + prefix_label + + + + + + + Pre&fix: + + + AlignVCenter|AlignRight + + + prefix_combo + + + + + prefix_combo + + + + + filename_label + + + + + + + File &name: + + + AlignVCenter|AlignRight + + + filename_edit + + + + + filename_edit + + + + + Spacer21 + + + Horizontal + + + Expanding + + + + 246 + 20 + + + + + + canonicalLabel + + + [CANONICALIZED NAME] + + + + + textLabel1 + + + + 1 + + + + + + + image0 + + + + + + + Spacer22 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + ldflags_group + + + Linker Flags (&LDFLAGS) + + + + unnamed + + + + allstatic_box + + + Do not link against shared libraries (-all-static) + + + + + avoidversion_box + + + Do not assign version numbers to libraries (-avoid-version) + + + + + module_box + + + Create a library that can be dynamically loaded (-module) + + + + + noundefined_box + + + Library does not depend on external symbols (-no-undefined) + + + + + Layout11_2 + + + + unnamed + + + 0 + + + + ldflagsother_label + + + + + + + Ot&her: + + + ldflagsother_edit + + + + + ldflagsother_edit + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okbutton + + + &OK + + + true + + + true + + + + + cancelbutton + + + &Cancel + + + true + + + + + + + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022230543251d2e253d856405bffcbc54105b19c856360003b0141ac02ba68c4d4c199b98323631656c62cad8c494891423ce0ee2dc4c6418208bd55a7301009c7f45ef + + + + + okbutton + clicked() + add_target_dialog + accept() + + + cancelbutton + clicked() + add_target_dialog + reject() + + + primary_combo + activated(int) + add_target_dialog + primaryChanged() + + + + primary_combo + prefix_combo + filename_edit + allstatic_box + avoidversion_box + module_box + noundefined_box + ldflagsother_edit + okbutton + cancelbutton + + + kdialog.h + + + primaryChanged() + + + + + ksqueezedtextlabel.h + + diff --git a/buildtools/autotools/addtranslationdlg.cpp b/buildtools/autotools/addtranslationdlg.cpp new file mode 100644 index 00000000..993dee7d --- /dev/null +++ b/buildtools/autotools/addtranslationdlg.cpp @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "addtranslationdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "misc.h" +#include "autoprojectpart.h" + + +AddTranslationDialog::AddTranslationDialog(AutoProjectPart *part, QWidget *parent, const char *name) + : QDialog(parent, name, true) +{ + setCaption(i18n("Add Translation")); + + m_part = part; + + QHBox *hbox = new QHBox(this); + (void) new QLabel(i18n("Language:"), hbox); + lang_combo = new QComboBox(hbox); + + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->addWidget(hbox); + + QFrame *frame = new QFrame(this); + frame->setFrameStyle(QFrame::HLine | QFrame::Sunken); + layout->addWidget(frame, 0); + + KButtonBox *buttonbox = new KButtonBox(this); + buttonbox->addStretch(); + QPushButton *ok_button = buttonbox->addButton(KStdGuiItem::ok()); + QPushButton *cancel_button = buttonbox->addButton(KStdGuiItem::cancel()); + ok_button->setDefault(true); + connect( ok_button, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( cancel_button, SIGNAL(clicked()), this, SLOT(reject()) ); + buttonbox->layout(); + layout->addWidget(buttonbox, 0); + + QStringList rawlist, list; + rawlist << "af" << "ar" << "bg" << "bo" << "br" << "bs" << "ca" << "cs" << "cy" << "da" + << "de" << "el" << "en_GB" << "eo" << "es" << "et" << "eu" << "fi" << "fr"; + rawlist << "ga" << "gl" << "gu" << "he" << "hi" << "hu" << "id" << "is" << "it" << "ja" + << "km" << "ko" << "lt" << "lv" << "mi" << "mk" << "mr" << "nl" << "no" << "no_NY"; + rawlist << "oc" << "pl" << "pt" << "pt_BR" << "ro" << "ru" << "sk" << "sl" << "sr" << "sv" + << "ta" << "th" << "tr" << "uk" << "wa" << "zh_CN.GB2312" << "zh_TW.Big5"; + + // Remove already added languages + QStringList::ConstIterator it; + for (it = rawlist.begin(); it != rawlist.end(); ++it) { + QFileInfo fi(m_part->projectDirectory() + "/po/" + (*it) + ".po"); + if (!fi.exists()) + list.append(*it); + } + + if (list.isEmpty()) { + KMessageBox::information(this, i18n("Your sourcecode is already translated to all supported languages.")); + ok_button->setEnabled(false); + } + lang_combo->insertStringList(list); +} + + +AddTranslationDialog::~AddTranslationDialog() +{} + + +void AddTranslationDialog::accept() +{ + QString dir = m_part->projectDirectory() + "/po"; + QString fileName = dir + "/" + lang_combo->currentText() + ".po"; + + QFile f(fileName); + if (f.exists()) { + KMessageBox::information(this, i18n("A translation file for the language %1 exists already.")); + return; + } + f.open(IO_WriteOnly); + f.close(); + + dir = m_part->buildDirectory() + "/po"; + m_part->startMakeCommand(dir, QString::fromLatin1("force-reedit")); + + QDialog::accept(); +} + +#include "addtranslationdlg.moc" diff --git a/buildtools/autotools/addtranslationdlg.h b/buildtools/autotools/addtranslationdlg.h new file mode 100644 index 00000000..cd14ddf2 --- /dev/null +++ b/buildtools/autotools/addtranslationdlg.h @@ -0,0 +1,36 @@ +/*************************************************************************** +* Copyright (C) 1999 by Sandy Meier * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _ADDTRANSLATIONDLG_H_ +#define _ADDTRANSLATIONDLG_H_ + +#include + +class QComboBox; +class AutoProjectPart; + + +class AddTranslationDialog : public QDialog +{ + Q_OBJECT + +public: + AddTranslationDialog( AutoProjectPart *part, QWidget *parent = 0, const char *name = 0 ); + ~AddTranslationDialog(); + +private: + virtual void accept(); + + QComboBox *lang_combo; + AutoProjectPart *m_part; +}; + +#endif diff --git a/buildtools/autotools/autodetailsview.cpp b/buildtools/autotools/autodetailsview.cpp new file mode 100644 index 00000000..26255fd3 --- /dev/null +++ b/buildtools/autotools/autodetailsview.cpp @@ -0,0 +1,728 @@ +/* + KDevelop Autotools Support + Copyright (c) 2002 by Victor Roeder + Copyright (c) 2005 by Matt Rogers + + *************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + *************************************************************************** +*/ + +#include "autodetailsview.h" + +/** Qt */ +#include +#include +#include +#include +#include + + /** KDE Libs */ +#include +#include +#include +#include +#include +#include +#include + +/** KDevelop */ +#include "kdevappfrontend.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevpartcontroller.h" +#include "kdevcreatefile.h" +#include "kdevlanguagesupport.h" +#include "kdevmakefrontend.h" +#include "urlutil.h" + +#include "domutil.h" + +#include "targetoptionsdlg.h" +#include "addfiledlg.h" +#include "addicondlg.h" +#include "addexistingfilesdlg.h" +#include "removefiledlg.h" +#include "removetargetdlg.h" + +#include "autolistviewitems.h" +#include "autotoolsaction.h" +#include "autoprojectpart.h" +#include "autoprojectwidget.h" + +#include "subclassesdlg.h" + +AutoDetailsView::AutoDetailsView(AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name) + : AutoProjectViewBase(parent, name) +{ + m_widget = widget; + m_part = part; + + initActions(); + QDomDocument dom = *(m_part->projectDom()); + m_subclasslist = DomUtil::readPairListEntry(dom, "/kdevautoproject/subclassing", + "subclass","sourcefile", "uifile"); + + m_listView->setAllColumnsShowFocus( true ); + m_listView->setRootIsDecorated( true ); + m_listView->setResizeMode( QListView::LastColumn ); + m_listView->addColumn( QString::null ); + m_listView->header()->hide(); + targetOptionsAction->setEnabled( false ); + addNewFileAction->setEnabled( false ); + addExistingFileAction->setEnabled( false ); + buildTargetAction->setEnabled( false ); + executeTargetAction->setEnabled( false ); + removeDetailAction->setEnabled(false); + connect( m_listView, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotSelectionChanged( QListViewItem* ) ) ); + connect( m_listView, SIGNAL( selectionChanged() ), + this, SLOT( slotSelectionChanged( ) ) ); +} + + +AutoDetailsView::~AutoDetailsView() +{ +} + +/** + * If nothing selected, disable all the icons. + */ +void AutoDetailsView::slotSelectionChanged( ){ + + if ( m_listView->selectedItems().isEmpty()){ + targetOptionsAction->setEnabled( false ); + addNewFileAction->setEnabled( false ); + addExistingFileAction->setEnabled( false ); + buildTargetAction->setEnabled( false ); + executeTargetAction->setEnabled( false ); + removeDetailAction->setEnabled(false); + } +} + +/** + * Change the enabled icons depending on what is selected. + * This is never called if nothing is selected.. + * @param item + */ +void AutoDetailsView::slotSelectionChanged( QListViewItem* item ) +{ + bool isTarget = false; + bool isRegularTarget = false; + bool isFile = false; + bool isProgram = false; + + if ( item ) + { + // We assume here that ALL items in the detail list view + // are ProjectItem's + ProjectItem * pvitem = static_cast( item ); + TargetItem* titem = 0; + + if ( pvitem->type() == ProjectItem::File ) + { + titem = static_cast ( pvitem->parent() ); + + QString primary = titem->primary; + if ( primary == "PROGRAMS" || primary == "LIBRARIES" || + primary == "LTLIBRARIES" || primary == "JAVA" ) + { + isRegularTarget = true; // not a data group + isFile = true; + } + } + else + { + titem = static_cast ( pvitem ); + isTarget = true; + } + + QString primary = titem->primary; + if ( primary == "PROGRAMS" || primary == "LIBRARIES" || + primary == "LTLIBRARIES" || primary == "JAVA" ) + { + isRegularTarget = true; // not a data group + } + + if ( primary == "PROGRAMS" ) + isProgram = true; + } + + targetOptionsAction->setEnabled( isRegularTarget && !isFile ); + addNewFileAction->setEnabled( isTarget ); + addExistingFileAction->setEnabled( isTarget ); + removeDetailAction->setEnabled ( true ); + + if ( isRegularTarget && isFile || isRegularTarget ) + { + buildTargetAction->setEnabled ( true ); + if( isProgram ) + executeTargetAction->setEnabled ( true ); + } + else + { + buildTargetAction->setEnabled ( false ); + executeTargetAction->setEnabled ( false ); + } + emit selectionChanged( item ); +} + +void AutoDetailsView::initActions() +{ + KActionCollection * actions = new KActionCollection( this ); + + targetOptionsAction = new AutoToolsAction( i18n( "Options..." ), "configure", 0, + this, SLOT( slotTargetOptions() ), actions, + "target options" ); + targetOptionsAction->setWhatsThis(i18n("Options

Target options dialog that " + "provides settings for linker flags and lists " + "of dependencies and external libraries that " + "are used when compiling the target.")); + targetOptionsAction->plug( m_optionsButton ); + targetOptionsAction->setEnabled( false ); + + QToolTip::add( m_button1, tr2i18n( "Create New File..." ) ); + addNewFileAction = new AutoToolsAction( i18n( "Create New File..." ), "filenew", 0, + this, SLOT( slotAddNewFile() ), actions, + "add new file" ); + addNewFileAction->setWhatsThis(i18n("Create new file

Creates a new file and " + "adds it to a currently selected target.")); + addNewFileAction->plug( m_button1 ); + addNewFileAction->setEnabled( false ); + + QToolTip::add( m_button2, tr2i18n( "Add Existing Files..." ) ); + addExistingFileAction = new AutoToolsAction( i18n( "Add Existing Files..." ), "fileimport", 0, + this, SLOT( slotAddExistingFile() ), actions, + "add existing file" ); + addExistingFileAction->setWhatsThis(i18n("Add existing files

Adds existing " + "file to a currently selected target. Header " + "files will not be included in SOURCES list " + "of a target. They will be added to " + "noinst_HEADERS instead.")); + addExistingFileAction->plug( m_button2 ); + addExistingFileAction->setEnabled( false ); + + addIconAction = new KAction( i18n( "Add Icon..." ), "iconadd_kdevelop", 0, + this, SLOT( slotAddIcon() ), actions, "add icon" ); + addIconAction->setWhatsThis(i18n("Add icon

Adds an icon to a KDEICON target.")); + + QToolTip::add( m_button4, tr2i18n( "Build Target")); + buildTargetAction = new AutoToolsAction( i18n( "Build Target..." ), "launch", 0, + this, SLOT( slotBuildTarget() ), actions, + "build target" ); + buildTargetAction->setWhatsThis(i18n("Build target

Constructs a series of " + "make commands to build the selected target. " + "Also builds dependent targets.")); + buildTargetAction->plug( m_button4 ); + buildTargetAction->setEnabled( false ); + + QToolTip::add( m_button5, tr2i18n( "Execute Target...")); + executeTargetAction = new AutoToolsAction( i18n( "Execute Target..." ), "exec", 0, + this, SLOT( slotExecuteTarget() ), actions, + "execute target" ); + executeTargetAction->setWhatsThis(i18n("Execute target

Executes the target " + "and tries to build in case it is not built.")); + executeTargetAction->plug( m_button5 ); + executeTargetAction->setEnabled( false ); + + setActiveTargetAction = new KAction( i18n( "Make Target Active" ), "", 0, + this, SLOT( slotSetActiveTarget() ), actions, + "set active target" ); + setActiveTargetAction->setWhatsThis(i18n("Make target active

Marks the " + "currently selected target as 'active'. New " + "files and classes by default go to an active " + "target. " + "Using the Build Active Target menu " + "command builds it.")); + + QToolTip::add( m_button3, tr2i18n( "Remove")); + removeDetailAction = new AutoToolsAction( i18n( "Remove" ), "editdelete", 0, this, + SLOT( slotRemoveDetail() ), actions, + "remove detail" ); + removeDetailAction->setWhatsThis(i18n("Remove

Shows a list of targets " + "dependent on the selected target or file and " + "asks for removal. Also asks if the target or " + "file should be removed from disk.")); + removeDetailAction->plug( m_button3 ); + removeDetailAction->setEnabled( false ); + + connect( m_listView, SIGNAL( executed( QListViewItem* ) ), + this, SLOT( slotDetailsExecuted( QListViewItem* ) ) ); + connect( m_listView, SIGNAL( returnPressed( QListViewItem* ) ), + this, SLOT( slotDetailsExecuted( QListViewItem* ) ) ); + connect( m_listView, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), + this, SLOT( slotDetailsContextMenu( KListView*, QListViewItem*, const QPoint& ) ) ); +} + +QString AutoDetailsView::getUiFileLink(const QString& relpath, const QString& filename) +{ + DomUtil::PairList::iterator it; + + for (it=m_subclasslist.begin(); it != m_subclasslist.end(); ++it) + { + if ((*it).first == QString("/")+relpath+filename) + return (*it).second; + } + + return QString::null; +} + +void AutoDetailsView::slotTargetOptions() +{ + kdDebug( 9020 ) << "AutoDetailsView::slotTargetOptions()" << endl; + TargetItem *titem = dynamic_cast ( m_listView->selectedItem() ); + + if ( !titem ) + return; + + TargetOptionsDialog dlg( m_widget, titem, this, "target options dialog" ); + + dlg.setCaption ( i18n ( "Target Options for '%1'" ).arg ( titem->name ) ); + + dlg.exec(); +} + + +void AutoDetailsView::slotAddNewFile() +{ + TargetItem * titem = dynamic_cast ( m_listView->selectedItem() ); + if ( !titem ) + return; + + KDevCreateFile * createFileSupport = m_part->extension("KDevelop/CreateFile"); + if (createFileSupport) + { + KDevCreateFile::CreatedFile crFile = + createFileSupport->createNewFile(QString::null, + m_widget->selectedSubproject()->path); +/* if (crFile.status == KDevCreateFile::CreatedFile::STATUS_OK) + { + FileItem *fitem = m_widget->createFileItem(crFile.filename, m_widget->selectedSubproject()); + titem->sources.append(fitem); + titem->insertItem(fitem); + emit selectionChanged( titem ); // update list view + }*/ + } else { + AddFileDialog dlg( m_part, m_widget, m_widget->selectedSubproject(), titem, + this, "add file dialog" ); + QString caption; + if ( titem->name.isEmpty() ) + caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ); + else + caption = titem->name; + + dlg.setCaption ( i18n ( "Add New File to '%1'" ).arg ( caption ) ); + + if ( dlg.exec() ) + emit selectionChanged( titem ); // update list view + } +} + + +void AutoDetailsView::slotAddExistingFile() +{ + TargetItem * titem = dynamic_cast ( m_listView->selectedItem() ); + if ( !titem ) + return; + + AddExistingFilesDialog dlg( m_part, m_widget, m_widget->selectedSubproject(), titem, + this, "add existing files" ); + QString caption; + if ( titem->name.isEmpty() ) + caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ); + else + caption = titem->name; + + dlg.setCaption( i18n( "Add Existing Files to '%1'" ).arg ( caption ) ); + + dlg.exec(); +} + + +void AutoDetailsView::slotAddIcon() +{ + TargetItem * titem = dynamic_cast ( m_listView->selectedItem() ); + if ( !titem ) + return ; + + AddIconDialog dlg( m_part, m_widget, m_widget->selectedSubproject(), titem, + this, "add icon" ); + dlg.exec(); +} + + +void AutoDetailsView::slotBuildTarget() +{ + ProjectItem * pvitem = dynamic_cast( m_listView->selectedItem() ); + if ( !pvitem ) + return; + + TargetItem* titem = 0; + + if ( pvitem->type() == ProjectItem::File ) + titem = static_cast ( pvitem->parent() ); + else + titem = static_cast ( m_listView->selectedItem() ); + + QString relpath = URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + m_widget->selectedSubproject()->relativePath(); + + m_part->buildTarget(relpath, titem); +} + +void AutoDetailsView::slotExecuteTarget() +{ + ProjectItem * pvitem = dynamic_cast( m_listView->selectedItem() ); + if ( !pvitem ) + return; + + TargetItem* titem = 0; + + if ( pvitem->type() == ProjectItem::File ) + titem = static_cast ( pvitem->parent() ); + else + titem = static_cast ( m_listView->selectedItem() ); + + QString relpath = URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + m_part->activeDirectory(); + m_part->executeTarget(QDir( DomUtil::readEntry( *m_part->projectDom(), "/kdevautoproject/run/cwd/"+titem->name )), titem); +} + +void AutoDetailsView::slotRemoveDetail() +{ + ProjectItem * pvitem = dynamic_cast( m_listView->selectedItem() ); + + if ( pvitem && ( pvitem->type() == ProjectItem::File ) ) + { + FileItem * fitem = static_cast ( m_listView->selectedItem() ); + if(fitem && fitem->is_subst) + { + fitem->changeMakefileEntry(""); + return; + } + + QListViewItem* sibling = fitem->nextSibling(); + + if ( !fitem ) + return; + + TargetItem *titem = static_cast( fitem->parent() ); + + RemoveFileDialog dlg( m_widget, m_part, m_widget->selectedSubproject(), + titem, fitem->text( 0 ), this, "remove file dialog" ); + + QString caption; + if ( titem->name.isEmpty() ) + caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ); + else + caption = titem->name; + + dlg.setCaption ( i18n ( "Remove File From '%1'" ).arg ( caption ) ); + + if ( dlg.exec() ) + { + emit selectionChanged( titem ); + + if ( sibling) + { + m_listView->setSelected ( sibling, true ); + m_listView->ensureItemVisible ( sibling ); + } + } + + return; + } + + if ( pvitem && ( pvitem->type() == ProjectItem::Target ) ) + { + TargetItem* titem = static_cast ( m_listView->selectedItem() ); + QListViewItem* sibling = titem->nextSibling(); + + if ( !titem ) return; + + bool isactive = ( titem == m_widget->activeTarget() ); + RemoveTargetDialog dlg ( m_widget, m_part, m_widget->selectedSubproject(), + titem, this, "remove target dialog" ); + + dlg.setCaption ( i18n ( "Remove Target From '%1'" ).arg ( m_widget->selectedSubproject()->subdir ) ); + + if ( dlg.exec() ) + { + //details->takeItem ( titem ); + + m_widget->slotOverviewSelectionChanged ( m_widget->selectedSubproject() ); + + if( isactive ) + m_widget->setActiveTarget(""); + if ( sibling) + { + m_listView->setSelected ( sibling, true ); + m_listView->ensureItemVisible ( sibling ); + } + } + + return; + } +} + + +void AutoDetailsView::slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p ) +{ + if ( !item ) + return; + + ProjectItem *pvitem = dynamic_cast( item ); + if ( !pvitem ) + { + kdDebug(9020) << k_funcinfo << "Cast to type of ProjectItem* failed." + << "Details context menu will be empty!"; + return; + } + + if ( pvitem->type() == ProjectItem::Target ) + { + + TargetItem * titem = dynamic_cast( pvitem ); + if ( !titem ) + { + kdDebug(9020) << k_funcinfo << "Unable to populate target item menu" + << " due to failed cast. " << endl; + return; + } + + QString caption; + if ( titem->name.isEmpty() ) + caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ); + else + caption = titem->name; + + KPopupMenu popup( i18n( "Target: %1" ).arg( caption ), this ); + + if ( titem->primary == "PROGRAMS" || titem->primary == "LIBRARIES" + || titem->primary == "LTLIBRARIES" || titem->primary == "JAVA" ) + { + targetOptionsAction->plug( &popup ); + popup.insertSeparator(); + addNewFileAction->plug( &popup ); + addExistingFileAction->plug( &popup ); + popup.insertSeparator(); + removeDetailAction->plug( &popup ); + popup.insertSeparator(); + setActiveTargetAction->plug( &popup ); + popup.insertSeparator(); + buildTargetAction->plug( &popup ); + if( titem->primary == "PROGRAMS") + executeTargetAction->plug( &popup ); + } + else if ( titem->primary == "KDEDOCS" ) + { + addNewFileAction->plug( &popup ); + addExistingFileAction->plug( &popup ); + popup.insertSeparator(); + removeDetailAction->plug( &popup ); + popup.insertSeparator(); + buildTargetAction->plug( &popup ); + } + else if ( titem->primary == "KDEICON" ) + { + addIconAction->plug( &popup ); + popup.insertSeparator(); + removeDetailAction->plug( &popup ); + } + else + { + addNewFileAction->plug( &popup ); + addExistingFileAction->plug( &popup ); + popup.insertSeparator(); + removeDetailAction->plug( &popup ); + } + + popup.exec( p ); + + } + else if ( pvitem->type() == ProjectItem::File ) + { + + FileItem * fitem = dynamic_cast( pvitem ); + if ( !fitem ) + { + kdDebug(9020) << k_funcinfo << "Unable to populate file item menu" + << " due to failed cast. " << endl; + return; + } + + KPopupMenu popup( i18n( "File: %1" ).arg( fitem->name ), this ); + + removeDetailAction->plug( &popup ); + KURL::List urls; + urls.append(m_widget->selectedSubproject()->path + "/" + fitem->name); + FileContext context(urls); + + int idSubclassWidget = popup.insertItem(SmallIconSet("qmake_subclass"), + i18n("Subclassing Wizard...") ); + popup.setWhatsThis(idSubclassWidget, i18n("Subclass widget

Launches " + "Subclassing wizard. " + "It allows to create a subclass from the " + "class defined in .ui file. " + "There is also possibility to implement " + "slots and functions defined in the base " + "class.")); + int idUISubclasses = popup.insertItem(SmallIconSet("qmake_subclass"), + i18n("List of Subclasses...")); + popup.setWhatsThis(idUISubclasses, i18n("List of subclasses

Shows " + "subclasses list editor. " + "There is possibility to add or remove " + "subclasses from the list.")); + int idUpdateWidgetclass = popup.insertItem(SmallIconSet("qmake_subclass"), + i18n("Edit ui-Subclass...")); + popup.setWhatsThis(idUpdateWidgetclass, i18n("Edit ui-subclass

Launches " + "Subclassing wizard and prompts " + "to implement missing in childclass " + "slots and functions.")); + int idViewUIH = popup.insertItem(SmallIconSet("qmake_ui_h"), + i18n("Open ui.h File")); + popup.setWhatsThis(idViewUIH, i18n("Open ui.h file

Opens .ui.h file " + "associated with the selected .ui.")); + + if (!fitem->name.contains(QRegExp("ui$")) || fitem->is_subst == true) + { + popup.removeItem(idUISubclasses); + popup.removeItem(idViewUIH); + popup.removeItem(idSubclassWidget); + } + + if (fitem->uiFileLink.isEmpty()) + popup.removeItem(idUpdateWidgetclass); + + if(fitem->is_subst == false) + m_part->core()->fillContextMenu( &popup, &context ); + + int r = popup.exec( p ); + + if(r == idViewUIH) + { + m_part->partController()->editDocument(KURL(m_widget->selectedSubproject()->path + + "/" + QString(fitem->name + ".h"))); + } + else if (r == idSubclassWidget) + { + QStringList newFileNames; + newFileNames = m_part->languageSupport()->subclassWidget(m_widget->selectedSubproject()->path + "/" + fitem->name); + if (!newFileNames.empty()) + { + QDomDocument &dom = *(m_part->projectDom()); + for (uint i=0; iprojectDirectory().length()); + QString uifile_relpath = QString(m_widget->selectedSubproject()->path + "/" + fitem->name).remove(0,m_part->projectDirectory().length()); + DomUtil::PairList list = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing", + "subclass","sourcefile", "uifile"); + + list << DomUtil::Pair(srcfile_relpath,uifile_relpath); + DomUtil::writePairListEntry(dom, "/kdevautoproject/subclassing", + "subclass", "sourcefile", "uifile", list); + newFileNames[i] = newFileNames[i].replace(QRegExp(m_part->projectDirectory()+"/"),""); + } + m_subclasslist = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing", + "subclass","sourcefile", "uifile"); + m_part->addFiles(newFileNames); + } + } + else if (r == idUpdateWidgetclass) + { + QString noext = m_widget->selectedSubproject()->path + "/" + fitem->name; + + if (noext.findRev('.')>-1) + noext = noext.left(noext.findRev('.')); + + QStringList dummy; + QString uifile = fitem->uiFileLink; + + if (uifile.findRev('/')>-1) + { + QStringList uisplit = QStringList::split('/',uifile); + uifile=uisplit[uisplit.count()-1]; + } + + m_part->languageSupport()->updateWidget(m_widget->selectedSubproject()->path + + "/" + uifile, noext); + } + else if (r == idUISubclasses) + { + QDomDocument &dom = *(m_part->projectDom()); + DomUtil::PairList list = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing", + "subclass","sourcefile", "uifile"); + SubclassesDlg *sbdlg = new SubclassesDlg( QString(m_widget->selectedSubproject()->path + "/" +fitem->name).remove(0,m_part->projectDirectory().length()), + list, m_part->projectDirectory()); + + if (sbdlg->exec()) + { + QDomElement el = DomUtil::elementByPath( dom, "/kdevautoproject"); + QDomElement el2 = DomUtil::elementByPath( dom, "/kdevautoproject/subclassing"); + if ( (!el.isNull()) && (!el2.isNull()) ) + { + el.removeChild(el2); + } + + DomUtil::writePairListEntry(dom, "/kdevautoproject/subclassing", "subclass", + "sourcefile", "uifile", list); + + m_subclasslist = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing", + "subclass","sourcefile", "uifile"); + } + } + } +} + + +void AutoDetailsView::slotDetailsExecuted( QListViewItem *item ) +{ + if ( !item ) + return ; + + ProjectItem *pvitem = static_cast( item ); + if ( pvitem->type() != ProjectItem::File ) + return ; + + if ( !m_widget->selectedSubproject() ) + return; + + QString dirName = m_widget->selectedSubproject()->path; + FileItem *fitem = static_cast( item ); + if(fitem->is_subst) + { + fitem->changeSubstitution(); + return; + } + + m_part->partController()->editDocument( KURL( dirName + "/" + fitem->name ) ); +} + +void AutoDetailsView::slotSetActiveTarget() +{ + TargetItem * titem = static_cast( m_listView->selectedItem() ); + if ( !titem ) return ; + + SubprojectItem * subpitem = m_widget->selectedSubproject(); + if ( !subpitem ) return; + + QString targetPath = subpitem->path + "/" + titem->name; + targetPath = targetPath.mid( m_part->projectDirectory().length() + 1 ); + kdDebug( 9020 ) << "Setting active " << targetPath << endl; + m_widget->setActiveTarget( targetPath ); + QDomDocument &dom = *m_part->projectDom(); + DomUtil::writeEntry( dom, "/kdevautoproject/general/activetarget", targetPath ); +} + +void AutoDetailsView::focusOutEvent(QFocusEvent */*e*/) +{ + m_widget->setLastFocusedView(AutoProjectWidget::DetailsView); +} + +#include "autodetailsview.moc" + +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/buildtools/autotools/autodetailsview.h b/buildtools/autotools/autodetailsview.h new file mode 100644 index 00000000..ee67558d --- /dev/null +++ b/buildtools/autotools/autodetailsview.h @@ -0,0 +1,88 @@ +/* + KDevelop Autotools Support + Copyright (c) 2002 by Victor Roeder + Copyright (c) 2005 by Matt Rogers + +*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +*/ + +#ifndef AUTODETAILSVIEW_H +#define AUTODETAILSVIEW_H + +#include "autoprojectviewbase.h" + +#include "domutil.h" +#include "autolistviewitems.h" + +class KAction; + +class AutoProjectPart; +class AutoProjectWidget; +class AutoToolsAction; + +class AutoDetailsView : protected AutoProjectViewBase +{ + friend class RemoveFileDialog; + friend class FileItem; + Q_OBJECT + +public: + AutoDetailsView( AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name ); + virtual ~AutoDetailsView(); + + QString getUiFileLink( const QString &path, const QString& filename ); + KListView* listView() + { + return m_listView; + } + +public slots: + void slotSelectionChanged( QListViewItem* item ); + void slotSelectionChanged(); + +signals: + void selectionChanged( QListViewItem* ); + +protected: + void initActions (); + virtual void focusOutEvent( QFocusEvent *e ); + +private slots: + void slotDetailsExecuted( QListViewItem *item ); + void slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p ); + + void slotTargetOptions (); + void slotAddNewFile(); + void slotAddExistingFile(); + void slotAddIcon(); + void slotBuildTarget(); + void slotExecuteTarget(); + void slotRemoveDetail(); + void slotSetActiveTarget(); + +private: + AutoProjectWidget* m_widget; + AutoProjectPart* m_part; + + DomUtil::PairList m_subclasslist; + + AutoToolsAction* targetOptionsAction; + AutoToolsAction* addNewFileAction; + AutoToolsAction* addExistingFileAction; + KAction* addIconAction; + AutoToolsAction* buildTargetAction; + AutoToolsAction* executeTargetAction; + KAction* setActiveTargetAction; + AutoToolsAction* removeDetailAction; + +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/autolistviewitems.cpp b/buildtools/autotools/autolistviewitems.cpp new file mode 100644 index 00000000..454d12f5 --- /dev/null +++ b/buildtools/autotools/autolistviewitems.cpp @@ -0,0 +1,181 @@ +/*************************************************************************** +* Copyright (C) 2001-2002 by Bernd Gehrmann * +* bernd@kdevelop.org * +* * +* Copyright (C) 2002 by Victor Rder * +* victor_roeder@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include +#include +#include + +#include +#include "misc.h" +#include "autolistviewitems.h" +#include "autoprojectpart.h" +#include "autoprojectwidget.h" +#include "autodetailsview.h" + +/** +* Class ProjectItem +*/ + +ProjectItem::ProjectItem( Type type, QListView *parent, const QString &text ) + : QListViewItem( parent, text ), typ( type ) +{ + bld = false; +} + + +ProjectItem::ProjectItem( Type type, ProjectItem *parent, const QString &text ) + : QListViewItem( parent, text ), typ( type ) +{ + bld = false; +} + + +void ProjectItem::paintCell( QPainter *p, const QColorGroup &cg, + int column, int width, int alignment ) +{ + if ( isBold() ) + { + QFont font( p->font() ); + font.setBold( true ); + p->setFont( font ); + } + QListViewItem::paintCell( p, cg, column, width, alignment ); +} + + +/** +* Class SubprojectItem +*/ + +SubprojectItem::SubprojectItem( QListView *parent, const QString &text ) + : ProjectItem( Subproject, parent, text ) +{ + init(); +} + + +SubprojectItem::SubprojectItem( SubprojectItem *parent, const QString &text ) + : ProjectItem( Subproject, parent, text ) +{ + init(); +} + + +void SubprojectItem::init() +{ + targets.setAutoDelete( true ); + setPixmap( 0, SmallIcon( "folder" ) ); +} + + +QString SubprojectItem::relativePath() +{ + QString relpath = subdir; + + SubprojectItem *it = this; + while ( (it= dynamic_cast(it->parent())) ) + { + relpath.prepend(it->subdir + "/"); + } + relpath.remove(0, 2); + + return relpath; +} + + +/** +* Class TargetItem +*/ + +TargetItem::TargetItem( QListView *lv, bool group, const QString &text ) + : ProjectItem( Target, lv, text ) +{ + sources.setAutoDelete( true ); + setPixmap( 0, group ? SmallIcon( "tar" ) : SmallIcon( "binary" ) ); +} + + +/** +* Class FileItem +*/ + +FileItem::FileItem( QListView *lv, const QString &text, bool set_is_subst ) + : ProjectItem( File, lv, text ) , is_subst(set_is_subst) +{ + if(!is_subst) + { + setPixmap( 0, SmallIcon( "document" ) ); + } + else + { + setPixmap( 0, SmallIcon( "variablenew" ) ); + } +} + + +void FileItem::changeSubstitution() +{ +if(!is_subst) +return; + + bool ok; + QString text = QInputDialog::getText( + i18n("Edit Substitution"), i18n("Substitution:"), QLineEdit::Normal, + name, &ok ); + if ( ok && !text.isEmpty() ) + { + // user entered something and pressed OK + QString new_name = text; + if(new_name == name) + return; + setText(0,new_name); + changeMakefileEntry(new_name); + name = new_name; + } + else + { + // user entered nothing or pressed Cancel + + } +} + +void FileItem::changeMakefileEntry(const QString& new_name) +{ + TargetItem* target = dynamic_cast(parent()); + + QMap replaceMap; + + QString canontargetname = AutoProjectTool::canonicalize(target->name); + QString varname; + if( target->primary == "PROGRAMS" || target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES" ) + varname = canontargetname + "_SOURCES"; + else + varname = target->prefix + "_" + target->primary; + if( AutoDetailsView* lv = dynamic_cast(listView()) ) + { + if ( SubprojectItem* subProject = lv->m_part->m_widget->selectedSubproject() ) + { + QStringList sources = QStringList::split(QRegExp("[ \t\n]"), subProject->variables[varname]); + QStringList::iterator it = sources.find(name); + (*it) = new_name; + subProject->variables[varname] = sources.join(" "); + replaceMap.insert(varname, subProject->variables[varname]); + + AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap); + + if(new_name == "") + target->sources.remove(this); + } + } +} diff --git a/buildtools/autotools/autolistviewitems.h b/buildtools/autotools/autolistviewitems.h new file mode 100644 index 00000000..0dece2a2 --- /dev/null +++ b/buildtools/autotools/autolistviewitems.h @@ -0,0 +1,143 @@ +/*************************************************************************** +* Copyright (C) 2001-2002 by Bernd Gehrmann * +* bernd@kdevelop.org * +* * +* Copyright (C) 2002 by Victor Rder * +* victor_roeder@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef AUTOLISTVIEWITEMS_H +#define AUTOLISTVIEWITEMS_H + +#include + +#include + +class TargetItem; +class FileItem; +class AutoProjectPart; + +/** +* Base class for all items appearing in ProjectOverview and ProjectDetails. +*/ +class ProjectItem : public QListViewItem +{ +public: + enum Type { Subproject, Target, File }; + + ProjectItem( Type type, QListView *parent, const QString &text ); + ProjectItem( Type type, ProjectItem *parent, const QString &text ); + + void paintCell( QPainter *p, const QColorGroup &cg, + int column, int width, int alignment ); + void setBold( bool b ) + { + bld = b; + } + bool isBold() const + { + return bld; + } + Type type() + { + return typ; + } + +private: + Type typ; + bool bld; + +}; + + +/** +* Stores the content of one Makefile.am +*/ +class SubprojectItem : public ProjectItem +{ +public: + SubprojectItem( QListView *parent, const QString &text ); + SubprojectItem( SubprojectItem *parent, const QString &text ); + + /** name of the directory */ + QString subdir; + /** absolute path */ + QString path; + /** mapping from prefix to path */ + QMap prefixes; + /** mapping from variable name to value */ + QMap variables; + /** list of targets */ + QPtrList targets; + + QString relativePath(); + +private: + void init(); +}; + + +/** +* Stores one target +* For e.g. the line +* bin_LTLIBRARIES = foo.la +* generates a target with name 'foo.la', primary LTLIBRARIES and prefix 'bin' +* In order to make things not too simple ;-) headers and data are handled +* a bit different from programs, libraries and scripts: All headers for a +* certain prefix (analogously for data) are put in _one_ TargetItem object, +* and the names of the files are put in the sources variable. This avoids +* cluttering the list view with lots of header items. +*/ +class TargetItem : public ProjectItem +{ +public: + //enum TargetKind { Program, Library, DataGroup, IconGroup, DocGroup }; + + TargetItem( QListView *lv, bool group, const QString &text ); + + // Target kind - not used currently + //TargetKind kind; + //! Name of target, e.g. foo + QString name; + //! One of PROGRAMS, LIBRARIES, LTLIBRARIES, SCRIPTS, HEADERS, DATA, JAVA + //! In addition to these automake primaries, we use KDEICON and KDEDOCS + //! for am_edit magic + QString primary; + //! May be bin, pkglib, noinst, check, sbin, pkgdata, java... + QString prefix; + //! Content of foo_SOURCES (or java_JAVA) assignment + QPtrList sources; + //! Content of foo_LDFLAGS assignment + QString ldflags; + //! Content of foo_LDADD assignment + QString ldadd; + //! Content of foo_LIBADD assignment + QString libadd; + //! Content of foo_DEPENDENCIES assignment + QString dependencies; +}; + + +// Not sure if this complexity is really necessary... +class FileItem : public ProjectItem +{ + +public: + FileItem( QListView *lv, const QString &text, bool set_is_subst = false ); + void changeSubstitution(); + void changeMakefileEntry( const QString& ); + + QString name; + QString uiFileLink; + const bool is_subst; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/autoprojectpart.cpp b/buildtools/autotools/autoprojectpart.cpp new file mode 100644 index 00000000..ea0b6896 --- /dev/null +++ b/buildtools/autotools/autoprojectpart.cpp @@ -0,0 +1,1474 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * Copyright (C) 2002 by Victor Roeder * + * victor_roeder@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include + +#include "autoprojectpart.h" +#include "autolistviewitems.h" +#include "configureoptionswidget.h" +#include "addtranslationdlg.h" +#include "addicondlg.h" +#include "autoprojectwidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define CONFIGURE_OPTIONS 1 +#define RUN_OPTIONS 2 +#define MAKE_OPTIONS 3 + +static const KDevPluginInfo data("kdevautoproject"); + +K_EXPORT_COMPONENT_FACTORY( libkdevautoproject, AutoProjectFactory( data ) ) + +AutoProjectPart::AutoProjectPart(QObject *parent, const char *name, const QStringList &args) + : KDevBuildTool(&data, parent, name ? name : "AutoProjectPart") + , m_lastCompilationFailed(false) +{ + setInstance(AutoProjectFactory::instance()); + + setXMLFile("kdevautoproject.rc"); + + m_executeAfterBuild = false; + m_isKDE = (args[0] == "kde"); + m_needMakefileCvs = false; + + m_widget = new AutoProjectWidget(this, m_isKDE); + m_widget->setIcon(SmallIcon( info()->icon() )); + m_widget->setCaption(i18n("Automake Manager")); + QWhatsThis::add(m_widget, i18n("Automake manager

" + "The project tree consists of two parts. The 'overview' " + "in the upper half shows the subprojects, each one having a " + "Makefile.am. The 'details' view in the lower half shows the " + "targets and files for the subproject selected in the overview.")); + + mainWindow()->embedSelectViewRight(m_widget, i18n("Automake Manager"), i18n("Automake manager")); + KAction *action; + + action = new KAction( i18n("Add Translation..."), 0, + this, SLOT(slotAddTranslation()), + actionCollection(), "project_addtranslation" ); + action->setToolTip(i18n("Add translation")); + action->setWhatsThis(i18n("Add translation

Creates .po file for the selected language.")); + action->setGroup("autotools"); + + + if (!m_isKDE) + action->setEnabled(false); + + action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8, + this, SLOT(slotBuild()), + actionCollection(), "build_build" ); + action->setToolTip(i18n("Build project")); + action->setWhatsThis(i18n("Build project

Runs make from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Build &Active Target"), "make_kdevelop", Key_F7, + this, SLOT(slotBuildActiveTarget()), + actionCollection(), "build_buildactivetarget" ); + action->setToolTip(i18n("Build active target")); + action->setWhatsThis(i18n("Build active target

Constructs a series of make commands to build an active target. " + "Also builds dependent targets.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Compile &File"), "make_kdevelop", + this, SLOT(slotCompileFile()), + actionCollection(), "build_compilefile" ); + action->setToolTip(i18n("Compile file")); + action->setWhatsThis(i18n("Compile file

Runs make filename.o command from the directory where 'filename' is the name of currently opened file.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Run Configure"), 0, + this, SLOT(slotConfigure()), + actionCollection(), "build_configure" ); + action->setToolTip(i18n("Run configure")); + action->setWhatsThis(i18n("Run configure

Executes configure with flags, arguments " + "and environment variables specified in the project settings dialog, " + "Configure Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Run automake && friends"), 0, + this, SLOT(slotMakefilecvs()), + actionCollection(), "build_makefilecvs" ); + action->setToolTip(i18n("Run automake && friends")); + action->setWhatsThis(i18n("Run automake && friends

Executes
make -f Makefile.cvs
./configure
commands from the project directory.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Install"), 0, + this, SLOT(slotInstall()), + actionCollection(), "build_install" ); + action->setToolTip(i18n("Install")); + action->setWhatsThis(i18n("Install

Runs make install command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Install (as root user)"), 0, + this, SLOT(slotInstallWithKdesu()), + actionCollection(), "build_install_kdesu" ); + action->setToolTip(i18n("Install as root user")); + action->setWhatsThis(i18n("Install

Runs make install command from the project directory with root privileges.
" + "It is executed via kdesu command.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("&Clean Project"), 0, + this, SLOT(slotClean()), + actionCollection(), "build_clean" ); + action->setToolTip(i18n("Clean project")); + action->setWhatsThis(i18n("Clean project

Runs make clean command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("&Distclean"), 0, + this, SLOT(slotDistClean()), + actionCollection(), "build_distclean" ); + action->setToolTip(i18n("Distclean")); + action->setWhatsThis(i18n("Distclean

Runs make distclean command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + action = new KAction( i18n("Make Messages && Merge"), 0, + this, SLOT(slotMakeMessages()), + actionCollection(), "build_messages" ); + action->setToolTip(i18n("Make messages && merge")); + action->setWhatsThis(i18n("Make messages && merge

Runs make package-messages command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + action->setGroup("autotools"); + + if (!m_isKDE) + action->setEnabled(false); + + buildConfigAction = new KSelectAction( i18n("Build Configuration"), 0, + actionCollection(), "project_configuration" ); + buildConfigAction->setToolTip(i18n("Build configuration menu")); + buildConfigAction->setWhatsThis(i18n("Build configuration menu

Allows to switch between project build configurations.
" + "Build configuration is a set of build and top source directory settings, " + "configure flags and arguments, compiler flags, etc.
" + "Modify build configurations in project settings dialog, Configure Options tab.")); + buildConfigAction->setGroup("autotools"); + + QDomDocument &dom = *projectDom(); + if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/run/disable_default")) { + //ok we handle the execute in this kpart + action = new KAction( i18n("Execute Program"), "exec", SHIFT+Key_F9, + this, SLOT(slotExecute()), + actionCollection(), "build_execute" ); + action->setToolTip(i18n("Execute program")); + action->setWhatsThis(i18n("Execute program

Executes the currently active target or the main program specified in project settings, Run Options tab.")); + action->setGroup("autotools"); + } + + connect( buildConfigAction, SIGNAL(activated(const QString&)), + this, SLOT(slotBuildConfigChanged(const QString&)) ); + connect( buildConfigAction->popupMenu(), SIGNAL(aboutToShow()), + this, SLOT(slotBuildConfigAboutToShow()) ); + +// connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*)) ); + + _configProxy = new ConfigWidgetProxy( core() ); + _configProxy->createProjectConfigPage( i18n("Configure Options"), CONFIGURE_OPTIONS, info()->icon() ); + _configProxy->createProjectConfigPage( i18n("Run Options"), RUN_OPTIONS, info()->icon() ); + _configProxy->createProjectConfigPage( i18n("Make Options"), MAKE_OPTIONS, info()->icon() ); + connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), + this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) ); + + + connect( makeFrontend(), SIGNAL(commandFinished(const QString&)), + this, SLOT(slotCommandFinished(const QString&)) ); + connect( makeFrontend(), SIGNAL(commandFailed(const QString&)), + this, SLOT(slotCommandFailed(const QString&)) ); + + setWantautotools(); + + +} + + +AutoProjectPart::~AutoProjectPart() +{ + if (m_widget) + { + mainWindow()->removeView(m_widget); + } + delete m_widget; + delete _configProxy; +} + + +void AutoProjectPart::insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int pagenumber ) +{ + switch ( pagenumber ) + { + case CONFIGURE_OPTIONS: + { + ConfigureOptionsWidget *w2 = new ConfigureOptionsWidget(this, page ); + connect( dlg, SIGNAL(okClicked()), w2, SLOT(accept()) ); + } + break; + + case RUN_OPTIONS: + { + QDomDocument &dom = *projectDom(); + if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/run/disable_default")) + { + //ok we handle the execute in this kpart + RunOptionsWidget *w3 = new RunOptionsWidget(*projectDom(), "/kdevautoproject", buildDirectory(), page ); + connect( dlg, SIGNAL(okClicked()), w3, SLOT(accept()) ); + } + } + break; + + case MAKE_OPTIONS: + { + MakeOptionsWidget *w4 = new MakeOptionsWidget(*projectDom(), "/kdevautoproject", page ); + connect( dlg, SIGNAL(okClicked()), w4, SLOT(accept()) ); + } + break; + } +} + +void AutoProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + m_projectName = projectName; + m_projectPath =dirName; + + m_widget->openProject(dirName); + + QDomDocument &dom = *projectDom(); + QString activeTarget = DomUtil::readEntry(dom, "/kdevautoproject/general/activetarget"); + kdDebug(9020) << k_funcinfo << "activeTarget " << activeTarget << endl; + if (!activeTarget.isEmpty()) + m_widget->setActiveTarget(activeTarget); + else + { + KMessageBox::information( m_widget, i18n("No active target specified, running the application will\n" + "not work until you make a target active in the Automake Manager\n" + "on the right side or use the Main Program options under\n" + "Project -> Project Options -> Run Options"), i18n("No active target specified"), "kdevelop_open_project_no_active_target"); + } + + KDevProject::openProject( dirName, projectName ); +} + + +void AutoProjectPart::closeProject() +{ + m_widget->closeProject(); +} + + +QString AutoProjectPart::projectDirectory() const +{ + return m_projectPath; +} + + +QString AutoProjectPart::projectName() const +{ + return m_projectName; +} + + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList AutoProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry(*projectDom(), "/kdevautoproject/run/envvars", "envvar", "name", "value"); +} + + +/** Retuns the currently selected run directory + * If no main Program was selected in the Run Options dialog + * use the currently active target instead to calculate it. + * The returned string can be: + * if /kdevautoproject/run/directoryradio == executable + * The directory where the executable is + * if /kdevautoproject/run/directoryradio == build + * The directory where the executable is relative to build directory + * if /kdevautoproject/run/directoryradio == custom + * The custom directory absolute path + */ +QString AutoProjectPart::runDirectory() const +{ + + QDomDocument &dom = *projectDom(); + + QString cwd; + if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() ) + { + cwd = defaultRunDirectory("kdevautoproject"); + }else + { + cwd = DomUtil::readEntry( dom, "/kdevautoproject/run/cwd/"+m_widget->activeTarget()->name ); + } + if( cwd.isEmpty() ) + cwd = buildDirectory() +"/"+ URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) +"/"+m_widget->activeDirectory(); + + return cwd; +} + + +/** Retuns the currently selected main program + * If no main Program was selected in the Run Options dialog + * use the currently active target instead. + * The returned string can be: + * if /kdevautoproject/run/directoryradio == executable + * The executable name + * if /kdevautoproject/run/directoryradio == build + * The path to executable relative to build directory + * if /kdevautoproject/run/directoryradio == custom or relative == false + * The absolute path to executable + */ + +QString AutoProjectPart::mainProgram() const +{ + QDomDocument * dom = projectDom(); + + if ( !dom ) return QString(); + + if( DomUtil::readBoolEntry(*dom, "/kdevautoproject/run/useglobalprogram", false) ) + { + QString DomMainProgram = DomUtil::readEntry(*dom, "/kdevautoproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume builddir relative path + { + QString relprojectpath = URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ); + if( !relprojectpath.isEmpty() ) + relprojectpath = "/" + relprojectpath; + return buildDirectory() + relprojectpath + "/" + DomMainProgram; + } + + } + else // If no Main Program was specified, return the active target + { + TargetItem* titem = m_widget->activeTarget(); + + if ( !titem ) { + KMessageBox::error( m_widget, i18n("There is no active target.\n" + "Unable to determine the main program."), i18n("No active target found") ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl; + return QString::null; + } + + if ( titem->primary != "PROGRAMS" ) { + KMessageBox::error( m_widget, i18n("Active target \"%1\" is not binary ( %2 ).\n" + "Unable to determine the main program. If you want this\n" + "to be the active target, set a main program under\n" + "Project -> Project Options -> Run Options").arg(titem->name).arg(titem->primary), i18n("Active target is not a library") ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << titem->primary << ") ! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl; + return QString::null; + } + + QString relprojectpath = URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ); + if( !relprojectpath.isEmpty() ) + relprojectpath = "/" + relprojectpath; + return buildDirectory() + relprojectpath + "/" + activeDirectory() + "/" + titem->name; + } +} + + +/** Retuns a QString with the debug command line arguments */ +QString AutoProjectPart::debugArguments() const +{ + QDomDocument &dom = *projectDom(); + + if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() ) + { + return DomUtil::readEntry(dom, "/kdevautoproject/run/globaldebugarguments"); + }else + { + return DomUtil::readEntry(dom, "/kdevautoproject/run/debugarguments/" + m_widget->activeTarget()->name); + } +} + + +/** Retuns a QString with the run command line arguments */ +QString AutoProjectPart::runArguments() const +{ + QDomDocument &dom = *projectDom(); + + if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() ) + { + return DomUtil::readEntry(dom, "/kdevautoproject/run/programargs"); + }else + { + return DomUtil::readEntry(dom, "/kdevautoproject/run/runarguments/" + m_widget->activeTarget()->name); + } +} + + +QString AutoProjectPart::activeDirectory() const +{ + return m_widget->activeDirectory(); +} + + +QStringList AutoProjectPart::allFiles() const +{ + return m_widget->allFiles(); +} + + +void AutoProjectPart::setWantautotools() +{ + QDomDocument &dom = *projectDom(); + QDomElement el = DomUtil::elementByPath(dom, "/kdevautoproject/make"); + if ( el.namedItem("envvars").isNull() ) { + DomUtil::PairList list; + list << DomUtil::Pair("WANT_AUTOCONF_2_5", "1"); + list << DomUtil::Pair("WANT_AUTOMAKE_1_6", "1"); + DomUtil::writePairListEntry(dom, "/kdevautoproject/make/envvars", "envvar", "name", "value", list); + } +} + + +QString AutoProjectPart::makeEnvironment() const +{ + // Get the make environment variables pairs into the environstr string + // in the form of: "ENV_VARIABLE=ENV_VALUE" + // Note that we quote the variable value due to the possibility of + // embedded spaces + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*projectDom(), "/kdevautoproject/make/envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + for (it = envvars.begin(); it != envvars.end(); ++it) + { + environstr += (*it).first; + environstr += "="; + environstr += EnvVarTools::quote((*it).second); + environstr += " "; + } + + KConfigGroup grp( kapp->config(), "MakeOutputView" ); + if( grp.readBoolEntry( "ForceCLocale", true ) ) + environstr += "LC_MESSAGES="+EnvVarTools::quote("C")+" "+"LC_CTYPE="+EnvVarTools::quote("C")+" "; + + return environstr; +} + + +void AutoProjectPart::addFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->addFiles ( fileList ); +} + +void AutoProjectPart::addFiles ( const QStringList& fileList ) +{ + QString directory, name; + QStringList::ConstIterator it; + bool messageBoxShown = false; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + int pos = ( *it ).findRev('/'); + if (pos != -1) + { + directory = ( *it ).left(pos); + name = ( *it ).mid(pos+1); + } + else + { + directory = ""; + name = ( *it ); + } + + if (directory != m_widget->activeDirectory() || + directory.isEmpty()) + { + if ( !messageBoxShown ) + { + KMessageBox::information(m_widget, i18n("The directory you selected is not the active directory.\n" + "You should 'activate' the target you're currently working on in Automake Manager.\n" + "Just right-click a target and choose 'Make Target Active'."), + i18n ( "No Active Target Found" ), "No automake manager active target warning" ); + messageBoxShown = true; + } + } + } + + m_widget->addFiles(fileList); +} + +void AutoProjectPart::removeFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->removeFiles ( fileList ); +} + +void AutoProjectPart::removeFiles ( const QStringList& fileList ) +{ + /// \FIXME m_widget->removeFiles does nothing! + m_widget->removeFiles ( fileList ); + + emit removedFilesFromProject ( fileList ); +} + +QStringList AutoProjectPart::allBuildConfigs() const +{ + QDomDocument &dom = *projectDom(); + + QStringList allConfigs; + allConfigs.append("default"); + + QDomNode node = dom.documentElement().namedItem("kdevautoproject").namedItem("configurations"); + QDomElement childEl = node.firstChild().toElement(); + while (!childEl.isNull()) + { + QString config = childEl.tagName(); + kdDebug(9020) << k_funcinfo << "Found config " << config << endl; + if (config != "default") + allConfigs.append(config); + childEl = childEl.nextSibling().toElement(); + } + + return allConfigs; +} + + +QString AutoProjectPart::currentBuildConfig() const +{ + QDomDocument &dom = *projectDom(); + + QString config = DomUtil::readEntry(dom, "/kdevautoproject/general/useconfiguration"); + if (config.isEmpty() || !allBuildConfigs().contains(config)) + config = "default"; + + return config; +} + + +QString AutoProjectPart::buildDirectory() const +{ + QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/"; + + QString builddir = DomUtil::readEntry(*projectDom(), prefix + "builddir"); + if (builddir.isEmpty()) + return topsourceDirectory(); + else if (builddir.startsWith("/")) + return builddir; + else + return projectDirectory() + "/" + builddir; +} + +QString AutoProjectPart::topsourceDirectory() const +{ + QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/"; + + QString topsourcedir = DomUtil::readEntry(*projectDom(), prefix + "topsourcedir"); + if (topsourcedir.isEmpty()) + return projectDirectory(); + else if (topsourcedir.startsWith("/")) + return topsourcedir; + else + return projectDirectory() + "/" + topsourcedir; +} + +QString AutoProjectPart::constructMakeCommandLine(const QString &dir, const QString &target) const +{ + + QString preCommand; + QFileInfo fi1(); + kdDebug(9020) << k_funcinfo << "Looking for Makefile in " << dir << endl; + if ( !QFile::exists(dir + "/GNUmakefile") && !QFile::exists(dir + "/makefile") + && ! QFile::exists(dir + "/Makefile") ) + { + if (!QFile::exists(buildDirectory() + "/configure")) + { + int r = KMessageBox::questionYesNo(m_widget, i18n("%1\nThere is no Makefile in this directory\n" + "and no configure script for this project.\n" + "Run automake & friends and configure first?").arg(buildDirectory()), QString::null, i18n("Run Them"), i18n("Do Not Run")); + if (r == KMessageBox::No) + return QString::null; + preCommand = makefileCvsCommand(); + if (preCommand.isNull()) + return QString::null; + preCommand += " && "; + preCommand += configureCommand() + " && "; + } + else + { + int r = KMessageBox::questionYesNo(m_widget, i18n("%1\nThere is no Makefile in this directory. Run 'configure' first?").arg(dir), QString::null, i18n("Run configure"), i18n("Do Not Run")); + if (r == KMessageBox::No) + return QString::null; + preCommand = configureCommand() + " && "; + } + } + QDomDocument &dom = *projectDom(); + + QString cmdline = DomUtil::readEntry(dom, "/kdevautoproject/make/makebin"); + int prio = DomUtil::readIntEntry(dom, "/kdevautoproject/make/prio"); + QString nice; + kdDebug(9020) << k_funcinfo << "nice = " << prio<< endl; + if (prio != 0) + { + nice = QString("nice -n%1 ").arg(prio); + } + + if (cmdline.isEmpty()) + cmdline = MAKE_COMMAND; + if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/make/abortonerror")) + cmdline += " -k"; + bool runmultiple = DomUtil::readBoolEntry(dom, "/kdevautoproject/make/runmultiplejobs"); + int jobs = DomUtil::readIntEntry(dom, "/kdevautoproject/make/numberofjobs"); + if (runmultiple && jobs != 0) + { + cmdline += " -j"; + cmdline += QString::number(jobs); + } + if (DomUtil::readBoolEntry(dom, "/kdevautoproject/make/dontact")) + cmdline += " -n"; + + cmdline += " "; + cmdline += target; + cmdline.prepend(nice); + cmdline.prepend(makeEnvironment()); + + QString dircmd = "cd "; + dircmd += KProcess::quote(dir); + dircmd += " && "; + + return preCommand + dircmd + cmdline; +} + + +void AutoProjectPart::startMakeCommand(const QString &dir, const QString &target, bool withKdesu) +{ + if (partController()->saveAllFiles()==false) + return; //user cancelled + kdDebug(9020) << "startMakeCommand:" << dir << ": "<< target << endl; + m_buildCommand = constructMakeCommandLine(dir, target); + + if (withKdesu) + m_buildCommand = "kdesu -t -c '" + m_buildCommand + "'"; + + if (!m_buildCommand.isNull()) + makeFrontend()->queueCommand(dir, m_buildCommand); +} + + +/** Adds the make command for the libraries that the target depends on + * to the make frontend queue (this is a recursive function) */ +bool AutoProjectPart::queueInternalLibDependenciesBuild(TargetItem* titem, QStringList& alreadyScheduledDeps) +{ + + QString addstr = (titem->primary == "PROGRAMS")? titem->ldadd : titem->libadd; + QStringList l2 = QStringList::split(QRegExp("[ \t]"), addstr); // list of dependencies + QString tdir; // temp target directory + QString tname; // temp target name + QString tcmd; // temp command line + QStringList::Iterator l2it; + for (l2it = l2.begin(); l2it != l2.end(); ++l2it) + { + QString dependency = *l2it; + if (dependency.startsWith("$(top_builddir)/")) + { + // These are the internal libraries + dependency.remove("$(top_builddir)/"); + + if( !alreadyScheduledDeps.contains(*l2it) ) + { + alreadyScheduledDeps << *l2it; + tdir = buildDirectory(); + if (!tdir.endsWith("/") && !tdir.isEmpty()) + tdir += "/"; + int pos = dependency.findRev('/'); + if (pos == -1) + { + tname = dependency; + } + else + { + tdir += dependency.left(pos+1); + tname = dependency.mid(pos+1); + } + kdDebug(9020) << "Scheduling : <" << tdir << "> target <" << tname << ">" << endl; + // Recursively queue the dependencies for building + SubprojectItem *spi = m_widget->subprojectItemForPath( dependency.left(pos) ); + if (spi) + { + QPtrList< TargetItem > tl = spi->targets; + // Cycle through the list of targets to find the one we're looking for + TargetItem *ti = tl.first(); + do + { + if (ti->name == tname) + { + // found it: queue it and stop looking + if( !queueInternalLibDependenciesBuild(ti, alreadyScheduledDeps) ) + return false; + break; + } + ti = tl.next(); + } + while (ti); + } + + kdDebug(9020) << "queueInternalLibDependenciesBuild:" << tdir << ": "<< tname << endl; + tcmd = constructMakeCommandLine(tdir, tname); + if (!tcmd.isNull()) + { + makeFrontend()->queueCommand( tdir, tcmd); + } + }else + { + //Message box about circular deps. + tdir = buildDirectory(); + if (!tdir.endsWith("/") && !tdir.isEmpty()) + tdir += "/"; + int pos = dependency.findRev('/'); + if (pos == -1) + { + tname = dependency; + } + else + { + tdir += dependency.left(pos+1); + tname = dependency.mid(pos+1); + } + KMessageBox::error( 0, i18n("Found a circular dependency in the project, between this target and %1.\nCannot build this project until this is resolved.").arg(tname), i18n("Circular Dependency found") ); + return false; + } + } + } + return true; +} + + +void AutoProjectPart::slotBuild() +{ + //m_lastCompilationFailed = false; + + if( m_needMakefileCvs ) + { + slotMakefilecvs(); + slotConfigure(); + m_needMakefileCvs = false; + } + + startMakeCommand(buildDirectory(), QString::fromLatin1("")); +} + + +void AutoProjectPart::buildTarget(QString relpath, TargetItem* titem) +{ + + if ( !titem ) + return; + + //m_lastCompilationFailed = false; + + // Calculate the complete name of the target and store it in name + QString name = titem->name; + if ( titem->primary == "KDEDOCS" ) + name = "index.cache.bz2"; + + // Calculate the full path of the target and store it in path + QString path = buildDirectory(); + if (!path.endsWith("/") && !path.isEmpty()) + path += "/"; + if (relpath.at(0) == '/') + path += relpath.mid(1); + else + path += relpath; + + // Save all files once + partController()->saveAllFiles(); + + // Add the make command for the libraries that the target depends on to the make frontend queue + // if this recursive behavour is un-wanted comment the next line + QStringList deps; + if( !queueInternalLibDependenciesBuild(titem, deps) ) + return; + + // Calculate the "make" command line for the target + //QString relpath = dir.path().mid( projectDirectory().length() ); + m_runProg=buildDirectory() + "/" + relpath+"/"+name; + kdDebug(9020) << "buildTarget:" << buildDirectory()<< endl; + kdDebug(9020) << "buildTarget:" << relpath << " " << path << ": "<< name << " : " << m_runProg << endl; + QString tcmd = constructMakeCommandLine( path, name ); + + // Call make + if (!tcmd.isNull()) + { + m_buildCommand = tcmd; + makeFrontend()->queueCommand( path, tcmd); + } +} + + +void AutoProjectPart::slotBuildActiveTarget() +{ + // Get a pointer to the active target + TargetItem* titem = m_widget->activeTarget(); + + if ( !titem ) + return; + + // build it + buildTarget( URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + activeDirectory(), titem); +} + + +void AutoProjectPart::slotCompileFile() +{ + KParts::ReadWritePart *part = dynamic_cast(partController()->activePart()); + if (!part || !part->url().isLocalFile()) + return; + + QString fileName = part->url().path(); + QFileInfo fi(fileName); + QString sourceDir = fi.dirPath(); + QString baseName = fi.baseName(true); + kdDebug(9020) << "Compiling " << fileName + << " in dir " << sourceDir + << " with baseName " << baseName << endl; + + QString projectDir = projectDirectory(); + if (!sourceDir.startsWith(projectDir)) { + KMessageBox::sorry(m_widget, i18n("Can only compile files in directories which belong to the project.")); + return; + } + + QString buildDir = buildDirectory() + sourceDir.mid(projectDir.length()); + QString target = baseName + ".lo"; + kdDebug(9020) << "builddir " << buildDir << ", target " << target << endl; + + startMakeCommand(buildDir, target); +} + +QString AutoProjectPart::configureCommand() const +{ + QDomDocument &dom = *projectDom(); + QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/"; + + QString cmdline = "\"" + topsourceDirectory(); + cmdline += "/configure\""; + QString cc = DomUtil::readEntry(dom, prefix + "ccompilerbinary"); + if (!cc.isEmpty()) + cmdline.prepend(QString("CC=%1 ").arg(cc)); + QString cflags = DomUtil::readEntry(dom, prefix + "cflags"); + if (!cflags.isEmpty()) + cmdline.prepend(QString("CFLAGS=\"%1\" ").arg(cflags)); + QString cxx = DomUtil::readEntry(dom, prefix + "cxxcompilerbinary"); + if (!cxx.isEmpty()) + cmdline.prepend(QString("CXX=%1 ").arg(cxx)); + QString cxxflags = DomUtil::readEntry(dom, prefix + "cxxflags"); + if (!cxxflags.isEmpty()) + cmdline.prepend(QString("CXXFLAGS=\"%1\" ").arg(cxxflags)); + QString f77 = DomUtil::readEntry(dom, prefix + "f77compilerbinary"); + if (!f77.isEmpty()) + cmdline.prepend(QString("F77=%1 ").arg(f77)); + QString fflags = DomUtil::readEntry(dom, prefix + "f77flags"); + if (!fflags.isEmpty()) + cmdline.prepend(QString("FFLAGS=\"%1\" ").arg(fflags)); + QString cppflags = DomUtil::readEntry(dom, prefix + "cppflags"); + if (!cppflags.isEmpty()) + cmdline.prepend(QString("CPPFLAGS=\"%1\" ").arg(cppflags)); + QString ldflags = DomUtil::readEntry(dom, prefix + "ldflags"); + if (!ldflags.isEmpty()) + cmdline.prepend(QString("LDFLAGS=\"%1\" ").arg(ldflags)); + + QString configargs = DomUtil::readEntry(dom, prefix + "configargs"); + if (!configargs.isEmpty()) { + cmdline += " "; + cmdline += configargs; + } + + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*projectDom(), prefix + "envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + for (it = envvars.begin(); it != envvars.end(); ++it) { + environstr += (*it).first; + environstr += "="; + environstr += EnvVarTools::quote((*it).second); + environstr += " "; + } + cmdline.prepend(environstr); + + QString builddir = buildDirectory(); + QString dircmd; + + // if the build directory doesn't exist, add it's creation to the configureCommand + if ( !QFile::exists(builddir)) { + dircmd = "mkdir "; + dircmd += KProcess::quote(builddir); + dircmd += " && "; + } + + // add "cd into the build directory" to the configureCommand + dircmd += "cd "; + dircmd += KProcess::quote(builddir); + dircmd += " && "; + + return dircmd + cmdline; +} + +void AutoProjectPart::slotConfigure() +{ + QString cmdline = configureCommand(); + if (cmdline.isNull()) + return; + + makeFrontend()->queueCommand(buildDirectory(), cmdline); +} + +QString AutoProjectPart::makefileCvsCommand() const +{ + kdDebug(9020) << "makefileCvsCommand: runDirectory :" << runDirectory() << ":" <queueCommand(projectDirectory(), cmdline); +} + + +void AutoProjectPart::slotInstall() +{ + startMakeCommand(buildDirectory(), QString::fromLatin1("install")); +} + + +void AutoProjectPart::slotInstallWithKdesu() +{ + // First issue "make" to build the entire project with the current user + // This way we make sure all files are up to date before we do the "make install" + slotBuild(); + + // After that issue "make install" with the root user + startMakeCommand(buildDirectory(), QString::fromLatin1("install"), true); +} + + +void AutoProjectPart::slotClean() +{ + startMakeCommand(buildDirectory(), QString::fromLatin1("clean")); +} + + +void AutoProjectPart::slotDistClean() +{ + startMakeCommand(buildDirectory(), QString::fromLatin1("distclean")); +} + + +void AutoProjectPart::slotMakeMessages() +{ + startMakeCommand(buildDirectory(), QString::fromLatin1("package-messages")); +} + + +/** Checks if the currently selected main program or, + * if no main Program was selected in the Run Options dialog, + * the currently active target is up-to-date and builds it if necessary. + * In the end checks if the program is already running and if not calls the + * slotExecute2() function to execute it or asks the user what to do. + */ +void AutoProjectPart::slotExecute() +{ + partController()->saveAllFiles(); + QDomDocument &dom = *projectDom(); + + m_runProg=m_runProg.isEmpty()?mainProgram():m_runProg; + + bool _auto = false; + if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autocompile", true) && isDirty() ){ + m_executeAfterBuild = true; + if ( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) ){ + // A Main Program was specified, build all targets because we don't know which is it + kdDebug(9020) << "slotExecute: before slotBuild" << endl; + slotBuild(); + + } + else{ + // If no Main Program was specified, build the active target + kdDebug(9020) << "slotExecute: before slotBuildActiveTarget" << endl; + slotBuildActiveTarget(); + } + _auto = true; + } + + if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autoinstall", false) && isDirty() ){ + m_executeAfterBuild = true; + // Use kdesu?? + if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autokdesu", false) ){ + //slotInstallWithKdesu assumes that it hasn't just been build... + kdDebug(9020) << "slotExecute: before startMakeCommand" << endl; + _auto ? slotInstallWithKdesu() : startMakeCommand(buildDirectory(), QString::fromLatin1("install"), true); + } + else{ + kdDebug(9020) << "slotExecute: before slotInstall" << endl; + slotInstall(); + } + _auto = true; + } + + if ( _auto ){ + m_runProg.truncate(0); + return; + } + + if (appFrontend()->isRunning()) { + if (KMessageBox::questionYesNo(m_widget, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) + return; + connect(appFrontend(), SIGNAL(processExited()), SLOT(slotExecute2())); + appFrontend()->stopApplication(); + return; + } + kdDebug(9020) << "slotExecute: before slotExecute2" << endl; + slotExecute2(); +} + +void AutoProjectPart::executeTarget(const QDir& dir, const TargetItem* titem) +{ + m_executeAfterBuild=true; + partController()->saveAllFiles(); + + bool is_dirty = false; + QDateTime t = QFileInfo(dir , titem->name ).lastModified(); + QPtrListIterator it( titem->sources ); + for( ; it.current() ; ++it ) + { + if( t < QFileInfo(dir , (*it)->name).lastModified()) + is_dirty = true; + } + + if( DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/autocompile", true) && is_dirty ) + { + connect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteTargetAfterBuild(const QString&)) ); + connect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotNotExecuteTargetAfterBuildFailed(const QString&)) ); + + m_runProg=titem->name; + m_executeTargetAfterBuild.first = dir; + m_executeTargetAfterBuild.second = const_cast(titem); + + QString relpath = "/" + URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + m_widget->selectedSubproject()->subdir; + kdDebug(9020) << "executeTarget: before buildTarget " << relpath << endl; + buildTarget(relpath, const_cast(titem)); + return; + } + + + bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/terminal"); + + QString program = environString(); + + if ( !titem ) { + KMessageBox::error( m_widget, i18n("There is no active target.\n" + "Unable to determine the main program"), i18n("No active target found") ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl; + program += titem->name; + }else if ( titem->primary != "PROGRAMS" ) { + KMessageBox::error( m_widget, i18n("Active target \"%1\" is not binary ( %2 ).\n" + "Unable to determine the main program. If you want this\n" + "to be the active target, set a main program under\n" + "Project -> Project Options -> Run Options").arg(titem->name).arg(titem->primary), i18n("Active target is not a library") ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << titem->primary << ") ! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl; + program += titem->name; + }else + program += buildDirectory() + "/" + URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + m_widget->selectedSubproject()->relativePath()+ "/" + titem->name; + + QString args = DomUtil::readEntry(*projectDom(), "/kdevautoproject/run/runarguments/" + titem->name); + + program += " " + args; + kdDebug(9020) << "executeTarget:cmd=" << dir.path() << " " << program << endl; + appFrontend()->startAppCommand(dir.path(), program ,inTerminal); + m_executeAfterBuild=false; + +} + +void AutoProjectPart::slotExecuteTargetAfterBuild(const QString& command) +{ + kdDebug(9020) << "slotExecuteTargetAfterBuild " << command << endl; + if ( m_executeAfterBuild && constructMakeCommandLine(m_executeTargetAfterBuild.first.path(), m_executeTargetAfterBuild.second->name) == command ) + { + disconnect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteAfterTargetBuild()) ); + disconnect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotExecuteAfterTargetBuildFailed()) ); + kdDebug(9020) << "slotExecuteTargetAfterBuild " << endl; + executeTarget(m_executeTargetAfterBuild.first, m_executeTargetAfterBuild.second); + } + +} + +void AutoProjectPart::slotNotExecuteTargetAfterBuildFailed(const QString& command) +{ + kdDebug(9020) << "executeTargetAfterBuildFailed" << endl; + if ( constructMakeCommandLine(m_executeTargetAfterBuild.first.path(), m_executeTargetAfterBuild.second->name) == command ) + { + m_executeAfterBuild=false; + disconnect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteTargetAfterBuild()) ); + disconnect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotNotExecuteTargetAfterBuildFailed()) ); + } +} + + +/* Get the run environment variables pairs into the environstr string + * in the form of: "ENV_VARIABLE=ENV_VALUE" + * Note that we quote the variable value due to the possibility of + * embedded spaces. */ +QString AutoProjectPart::environString() const +{ + DomUtil::PairList envvars = runEnvironmentVars(); + QString environstr; + DomUtil::PairList::ConstIterator it; + for (it = envvars.begin(); it != envvars.end(); ++it) { + environstr += (*it).first; + environstr += "="; + environstr += EnvVarTools::quote((*it).second); + environstr += " "; + } + return environstr; +} + +/** Executes the currently selected main program. + * If no main Program was selected in the Run Options dialog + * the currently active target is executed instead. + */ +void AutoProjectPart::slotExecute2() +{ + disconnect(appFrontend(), SIGNAL(processExited()), this, SLOT(slotExecute2())); + + if (m_runProg.isEmpty()){ + // Do not execute non executable targets + return; + } + + QString program = environString(); + // Adds the ./ that is necessary to execute the program in bash shells + if (!m_runProg.startsWith("/")){ + program += "./"; + } + program += m_runProg; + program += " " + runArguments(); + + bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/terminal"); + + kdDebug(9020) << "slotExecute2: runDirectory: <" << runDirectory() << ">" <" <" <" <" <startAppCommand(runDirectory(), program, inTerminal); + m_executeAfterBuild=false; + m_runProg.truncate(0); +} + + +void AutoProjectPart::slotAddTranslation() +{ + AddTranslationDialog dlg(this, m_widget); + dlg.exec(); +} + + +void AutoProjectPart::slotBuildConfigChanged(const QString &config) +{ + DomUtil::writeEntry(*projectDom(), "/kdevautoproject/general/useconfiguration", config); + kdDebug(9020) << "Changed used configuration to " << config << endl; +} + + +void AutoProjectPart::slotBuildConfigAboutToShow() +{ + QStringList l = allBuildConfigs(); + buildConfigAction->setItems(l); + buildConfigAction->setCurrentItem(l.findIndex(currentBuildConfig())); +} + +void AutoProjectPart::restorePartialProjectSession ( const QDomElement* el ) +{ + m_widget->restoreSession ( el ); +} + +void AutoProjectPart::savePartialProjectSession ( QDomElement* el ) +{ + QDomDocument domDoc = el->ownerDocument(); + + KMessageBox::information ( 0, "Hallo, Welt!" ); + + kdDebug ( 9020 ) << k_funcinfo << "1" << endl; + + if ( domDoc.isNull() ) + { + kdDebug ( 9020 ) << k_funcinfo << "2" << endl; + return; + } + + kdDebug ( 9020 ) << k_funcinfo << "3" << endl; + + m_widget->saveSession ( el ); +} + +void AutoProjectPart::slotCommandFinished( const QString& command ) +{ + kdDebug(9020) << k_funcinfo << endl; + + if( m_buildCommand != command ) + return; + + m_buildCommand = QString::null; + + m_timestamp.clear(); + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + m_timestamp[ fileName ] = QFileInfo( projectDirectory(), fileName ).lastModified(); + } + + emit projectCompiled(); + + // reset the "last compilation has failed" flag + m_lastCompilationFailed = false; + + if( m_executeAfterBuild ){ + slotExecute(); + } +} + +void AutoProjectPart::slotCommandFailed( const QString& /*command*/ ) +{ + kdDebug(9020) << "slotCommandFinished " << k_funcinfo << endl; + + m_lastCompilationFailed = true; + m_executeAfterBuild=false; +} + +bool AutoProjectPart::isDirty() +{ + if (m_lastCompilationFailed) return true; + + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + QMap::Iterator it = m_timestamp.find( fileName ); + QDateTime t = QFileInfo( projectDirectory(), fileName ).lastModified(); + if( it == m_timestamp.end() || *it != t ){ + return true; + } + } + + return false; +} + +void AutoProjectPart::needMakefileCvs( ) +{ + m_needMakefileCvs = true; +} + +bool AutoProjectPart::isKDE() const +{ + return m_isKDE; +} + +KDevProject::Options AutoProjectPart::options() const +{ + return UsesAutotoolsBuildSystem; +} + +QStringList recursiveATFind( const QString &currDir, const QString &baseDir ) +{ + kdDebug(9020) << "Dir " << currDir << endl; + QStringList fileList; + + if( !currDir.contains( "/..") && !currDir.contains("/.") ) + { + QDir dir(currDir); + QStringList dirList = dir.entryList(QDir::Dirs ); + QStringList::Iterator idx = dirList.begin(); + for( ; idx != dirList.end(); ++idx ) + { + fileList += recursiveATFind( currDir + "/" + (*idx),baseDir ); + } + QStringList newFiles = dir.entryList("*.am *.in"); + idx = newFiles.begin(); + for( ; idx != newFiles.end(); ++idx ) + { + QString file = currDir + "/" + (*idx); + fileList.append( file.remove( baseDir ) ); + } + } + + + return fileList; +} + +/*! + \fn AutoProjectPart::distFiles() const + */ +QStringList AutoProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QDir dir(projectDir); + QDir admin(projectDir +"/admin"); + QStringList files = dir.entryList( "Makefile.cvs Makefile.am configure* INSTALL README NEWS TODO ChangeLog COPYING AUTHORS stamp-h.in acinclude.m4 config.h.in Makefile.in install-sh config.sub config.guess mkinstalldirs missing ltmain.sh depcomp"); + QStringList adminFiles = admin.entryList(QDir::Files); + QStringList::Iterator idx = adminFiles.begin(); + for( ; idx != adminFiles.end(); ++idx) + { + files.append( "admin/" + (*idx) ); + } + QStringList srcDirs = dir.entryList(QDir::Dirs); + idx = srcDirs.begin(); + for(; idx != srcDirs.end(); ++idx) + { + sourceList += recursiveATFind( projectDirectory() + "/" + (*idx), projectDirectory()); + } + return sourceList + files; +} + +void AutoProjectPart::startSimpleMakeCommand( const QString & dir, const QString & command, bool withKdesu ) +{ + if (partController()->saveAllFiles()==false) + return; //user cancelled + + // m_buildCommand = constructMakeCommandLine(dir, target); + + QString cmdline = command; + cmdline.prepend(makeEnvironment()); + + QString dircmd = "cd "; + dircmd += KProcess::quote(dir); + dircmd += " && "; + + m_buildCommand = dircmd + cmdline; + + if (withKdesu) + m_buildCommand = "kdesu -t -c '" + m_buildCommand + "'"; + + if (!m_buildCommand.isNull()) + makeFrontend()->queueCommand(dir, m_buildCommand); +} + +QString AutoProjectPart::getAutoConfFile(const QString& dir){ + + QFile inFile(dir + "/configure.in"); + QFile acFile(dir + "/configure.ac"); + if ( inFile.exists()){ + return inFile.name(); + }else if (acFile.exists()){ + return acFile.name(); + } + return acFile.name();; +} + +#include "autoprojectpart.moc" + +// kate: space-indent on; indent-width 4; diff --git a/buildtools/autotools/autoprojectpart.h b/buildtools/autotools/autoprojectpart.h new file mode 100644 index 00000000..d0862cc3 --- /dev/null +++ b/buildtools/autotools/autoprojectpart.h @@ -0,0 +1,153 @@ +/*************************************************************************** +* Copyright (C) 2001-2002 by Bernd Gehrmann * +* bernd@kdevelop.org * +* * +* Copyright (C) 2002 by Victor R�er * +* victor_roeder@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _AUTOPROJECTPART_H_ +#define _AUTOPROJECTPART_H_ + +#include +#include +#include +#include +#include +#include +#include "kdevbuildtool.h" + +class QDomElement; +class QStringList; +class KDialogBase; +class AutoProjectWidget; +class KSelectAction; +class TargetItem; +class ConfigWidgetProxy; + +class AutoProjectPart : public KDevBuildTool +{ + Q_OBJECT + +public: + AutoProjectPart( QObject *parent, const char *name, const QStringList &args ); + virtual ~AutoProjectPart(); + + /** + * Implementation of the KDevProject interface. + */ + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual DomUtil::PairList runEnvironmentVars() const; + virtual QString runDirectory() const; + virtual QString mainProgram() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual QString environString() const; + virtual QString activeDirectory() const; + virtual QStringList allFiles() const; + virtual void addFile( const QString &fileName ); + virtual void addFiles ( const QStringList& fileList ); + virtual void removeFile( const QString &fileName ); + virtual void removeFiles ( const QStringList& fileList ); + virtual QString buildDirectory() const; + virtual Options options() const; + + /** + * Implementation of the KDevPlugin interface. + */ + virtual void restorePartialProjectSession ( const QDomElement* el ); + virtual void savePartialProjectSession ( QDomElement* el ); + + /** + * automake specific methods. + */ + QStringList allBuildConfigs() const; + QString currentBuildConfig() const; + QString topsourceDirectory() const; + void startMakeCommand( const QString &dir, const QString &target, bool withKdesu = false ); + void startSimpleMakeCommand( const QString &dir, const QString &command, bool withKdesu = false ); + void buildTarget( QString relpath, TargetItem* titem ); + void executeTarget( const QDir& dir, const TargetItem* titem ); + + void needMakefileCvs(); + bool isDirty(); + bool isKDE() const; + QStringList distFiles() const; + QString getAutoConfFile(const QString& dir); + +protected: + /** + * Reimplemented from KDevProject. These methods are only + * for use by the application core. + */ + virtual void openProject( const QString &dirName, const QString &projectName ); + virtual void closeProject(); + +private slots: + // void projectConfigWidget(KDialogBase *dlg); + void slotAddTranslation(); + void slotBuild(); + void slotBuildActiveTarget(); + void slotCompileFile(); + void slotClean(); + void slotDistClean(); + void slotInstall(); + void slotInstallWithKdesu(); + void slotMakefilecvs(); + void slotMakeMessages(); + void slotConfigure(); + void slotExecute(); + void slotExecute2(); + void slotExecuteTargetAfterBuild( const QString& command ); + void slotNotExecuteTargetAfterBuildFailed( const QString& command ); + void slotBuildConfigChanged( const QString &config ); + void slotBuildConfigAboutToShow(); + void slotCommandFinished( const QString& command ); + void slotCommandFailed( const QString& command ); + //void slotImportExisting(); + void insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int ); + + +private: + QGuardedPtr m_widget; + QString m_projectName; + QString m_projectPath; + KSelectAction *buildConfigAction; + + QString makeEnvironment() const; + void setWantautotools(); + QString makefileCvsCommand() const; + QString configureCommand() const; + + QMap m_timestamp; + bool m_executeAfterBuild; + QString m_buildCommand; + bool m_needMakefileCvs; + bool m_lastCompilationFailed; + bool m_isKDE; + QPair m_executeTargetAfterBuild; + QString m_runProg; + + ConfigWidgetProxy * _configProxy; + + // Enble AutoProjectWidget to emit our signals + friend class AutoProjectWidget; + friend class AddSubprojectDialog; + friend class FileItem; + + // For make commands queuing + QString constructMakeCommandLine( const QString &dir, const QString &target ) const; + bool queueInternalLibDependenciesBuild( TargetItem* titem, QStringList& list ); +}; + +typedef KDevGenericFactory AutoProjectFactory; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/autoprojectviewbase.ui b/buildtools/autotools/autoprojectviewbase.ui new file mode 100644 index 00000000..ad5142ba --- /dev/null +++ b/buildtools/autotools/autoprojectviewbase.ui @@ -0,0 +1,123 @@ + +AutoProjectViewBase + + + AutoProjectViewBase + + + + 0 + 0 + 245 + 334 + + + + + unnamed + + + 4 + + + + layout3 + + + + unnamed + + + 2 + + + + m_button1 + + + + + + + + m_button2 + + + + + + + + m_button3 + + + + + + + + m_button4 + + + + + + + + m_button5 + + + + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + m_optionsButton + + + + + + Options + + + + + + + m_listView + + + true + + + LastColumn + + + false + + + + + + + klistview.h + + diff --git a/buildtools/autotools/autoprojectwidget.cpp b/buildtools/autotools/autoprojectwidget.cpp new file mode 100644 index 00000000..c3248504 --- /dev/null +++ b/buildtools/autotools/autoprojectwidget.cpp @@ -0,0 +1,748 @@ +/* + KDevelop Autotools Support + Copyright (c) 2001-2002 by Bernd Gehrmann + Copyright (c) 2002 by Victor Roeder + Copyright (c) 2005 by Matt Rogers + + *************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + *************************************************************************** +*/ + + +#include "autoprojectwidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kdevcore.h" +#include "domutil.h" +#include "misc.h" +#include "choosetargetdialog.h" + +#include "autolistviewitems.h" + +#include "autoprojectpart.h" +#include "autosubprojectview.h" +#include "autodetailsview.h" +#include "urlutil.h" +#include "makefilehandler.h" + +static QString nicePrimary( const QString &primary ) +{ + if ( primary == "PROGRAMS" ) + return i18n( "Program" ); + else if ( primary == "LIBRARIES" ) + return i18n( "Library" ); + else if ( primary == "LTLIBRARIES" ) + return i18n( "Libtool Library" ); + else if ( primary == "SCRIPTS" ) + return i18n( "Script" ); + else if ( primary == "HEADERS" ) + return i18n( "Header" ); + else if ( primary == "DATA" ) + return i18n( "Data" ); + else if ( primary == "JAVA" ) + return i18n( "Java" ); + else + return QString::null; +} + + +AutoProjectWidget::AutoProjectWidget( AutoProjectPart *part, bool kde ) + : QVBox( 0, "auto project widget" ) +{ + m_part = part; + m_kdeMode = kde; + m_activeSubproject = 0; + m_activeTarget = 0; + m_shownSubproject = 0; + m_choosenTarget = 0; + m_makefileHandler = new MakefileHandler(); + + QSplitter *splitter = new QSplitter(Vertical, this); + + initOverview ( splitter ); + initDetailview ( splitter ); + + initActions (); +} + + +AutoProjectWidget::~AutoProjectWidget() +{ + delete m_makefileHandler; +} + +void AutoProjectWidget::initOverview ( QWidget* parent ) +{ + m_subprojectView = new AutoSubprojectView( this, m_part, parent, "project overview widget" ); +} + +void AutoProjectWidget::initDetailview ( QWidget* parent ) +{ + m_detailView = new AutoDetailsView( this, m_part, parent, "project details widget" ); +} + +void AutoProjectWidget::initActions() +{ + connect( m_subprojectView, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotOverviewSelectionChanged( QListViewItem* ) ) ); +} + +AutoSubprojectView* AutoProjectWidget::getSubprojectView () +{ + return m_subprojectView; +} + +AutoDetailsView* AutoProjectWidget::getDetailsView () +{ + return m_detailView; +} + +void AutoProjectWidget::openProject( const QString &dirName ) +{ + m_subprojectView->loadMakefileams ( dirName ); + MakefileHandler mfh; + mfh.parse( m_part->projectDirectory(), true ); + +} + + +void AutoProjectWidget::closeProject() +{ + m_shownSubproject = 0; + m_subprojectView->listView()->clear(); + m_detailView->listView()->clear(); +} + +SubprojectItem* AutoProjectWidget::activeSubproject () +{ + return m_activeSubproject; +} + +TargetItem* AutoProjectWidget::activeTarget () +{ + return m_activeTarget; +} + +QStringList AutoProjectWidget::allSubprojects() +{ + int prefixlen = m_part->projectDirectory().length() + 1; + QStringList res; + + QListViewItemIterator it( m_subprojectView->listView() ); + for ( ; it.current(); ++it ) + { + // Skip root subproject + // if ( it.current() == m_subprojectView->firstChild() ) + // continue; + QString path = static_cast( it.current() ) ->path; + res.append( path.mid( prefixlen ) ); + } + + return res; +} + +QPtrList AutoProjectWidget::allSubprojectItems() +{ + QPtrList res; + + QListViewItemIterator it ( m_subprojectView->listView() ); + + for ( ; it.current(); ++it ) + { + // Skip root subproject + // if ( it.current() == m_subprojectView->firstChild() ) + // continue; + + SubprojectItem* spitem = static_cast ( it.current() ); + res.append ( spitem ); + } + + return res; +} + +SubprojectItem* AutoProjectWidget::subprojectItemForPath(const QString & path, bool pathIsAbsolute) +{ + kdDebug(9020) << "Looking for path " << path << endl; + + int prefixLen = m_part->projectDirectory().length() + 1; + QListViewItemIterator it( m_subprojectView->listView() ); + for(; it.current(); ++it) + { + SubprojectItem* spitem = static_cast(it.current() ); + QString relpath = (spitem->path).mid(prefixLen); + kdDebug(9020) << " ... checking -" << spitem->path << "-" << endl; + kdDebug(9020) << " ... (tailored: -" << relpath << "- against -" << (pathIsAbsolute ? path.mid(prefixLen) : path) << "- )" << endl; + if ( relpath == (pathIsAbsolute ? path.mid(prefixLen) : path)) + { + kdDebug(9020) << "Found it!" << endl; + return spitem; + } + } + kdDebug(9020) << "Not found" << endl; + return NULL; +} + +QString AutoProjectWidget::pathForTarget(const TargetItem *titem) const +{ + + if (!titem) + return QString::null; + + kdDebug(9020) << "Looking for target " << titem->name << endl; + int prefixLen = m_part->projectDirectory().length() + 1; + QListViewItemIterator it( m_subprojectView->listView() ); + for(; it.current(); ++it) + { + SubprojectItem* spitem = static_cast(it.current() ); + kdDebug(9020) << "Checking: " << spitem->path << endl; + if (spitem->targets.containsRef(titem)) + { + kdDebug(9020) << "Found it!" << endl; + QString relpath = (spitem->path).mid(prefixLen); + return relpath; + } + } + kdDebug(9020) << "Not found" << endl; + return QString::null; +} + +QStringList AutoProjectWidget::allLibraries() +{ + int prefixlen = m_part->projectDirectory().length() + 1; + QStringList res; + + QListViewItemIterator it( m_subprojectView->listView() ); + for ( ; it.current(); ++it ) + { + SubprojectItem *spitem = static_cast( it.current() ); + QString path = spitem->path; + QPtrListIterator tit( spitem->targets ); + for ( ; tit.current(); ++tit ) + { + QString primary = ( *tit ) ->primary; + if ( primary == "LIBRARIES" || primary == "LTLIBRARIES" ) + { + QString fullname = path + "/" + ( *tit ) ->name; + res.append( fullname.mid( prefixlen ) ); + } + } + } + + return res; +} + + +QStringList AutoProjectWidget::allFiles() +{ + QPtrStack s; + QMap dict; + + for ( QListViewItem * item = m_subprojectView->listView()->firstChild(); item; + item = item->nextSibling() ? item->nextSibling() : s.pop() ) + { + if ( item->firstChild() ) + s.push( item->firstChild() ); + + SubprojectItem *spitem = static_cast( item ); + // use URLUtil so paths in root project dir are worked out correctly + QString relPath = URLUtil::relativePath(m_part->projectDirectory(), spitem->path, URLUtil::SLASH_SUFFIX); + QPtrListIterator tit( spitem->targets ); + for ( ; tit.current(); ++tit ) + { + QPtrListIterator fit( tit.current() ->sources ); + for ( ; fit.current(); ++fit ) + { + + if((*fit)->is_subst) + continue; + + QFileInfo fileInfo( (*fit)->name ); + if( fileInfo.extension() == "ui" ) + { + dict.insert( relPath + fileInfo.baseName() + ".h", true ); + dict.insert( relPath + fileInfo.baseName() + ".cpp", true ); + } + + dict.insert( relPath + ( *fit ) ->name, true ); + } + } + } + + // Files may be in multiple targets, so we have to remove + // duplicates + QStringList res; + QMap::Iterator it = dict.begin(); + while( it != dict.end() ){ + res << it.key(); + ++it; + } + + return res; +} + + +QString AutoProjectWidget::subprojectDirectory() +{ + if ( !selectedSubproject() ) + return QString::null; + + return selectedSubproject()->path; +} + + +void AutoProjectWidget::setActiveTarget( const QString &targetPath ) +{ + int prefixlen = m_part->projectDirectory().length() + 1; + QString olddir = m_part->activeDirectory(); + m_activeSubproject = 0; + m_activeTarget = 0; + + QListViewItemIterator it( m_subprojectView->listView() ); + for ( ; it.current(); ++it ) + { + SubprojectItem *spitem = static_cast( it.current() ); + QString path = spitem->path; + QPtrListIterator tit( spitem->targets ); + for ( ; tit.current(); ++tit ) + { + QString primary = ( *tit ) ->primary; + if ( primary != "PROGRAMS" && primary != "LIBRARIES" + && primary != "LTLIBRARIES" && primary != "JAVA" ) + continue; + + QString currentTargetPath = ( path + "/" + ( *tit ) ->name ).mid( prefixlen ); + + bool hasTarget = ( targetPath == currentTargetPath ); + ( *tit )->setBold( hasTarget ); + if ( hasTarget ) + { + spitem->setBold( true ); + m_activeSubproject = spitem; + m_activeTarget = ( *tit ); + m_subprojectView->listView()->setSelected( m_activeSubproject, true ); + m_subprojectView->listView()->ensureItemVisible ( m_activeSubproject ); + m_subprojectView->listView()->viewport()->update(); + m_detailView->listView()->setSelected ( m_activeTarget, true ); + m_detailView->listView()->ensureItemVisible ( m_activeTarget ); + m_detailView->listView()->viewport()->update(); + } + else + { + // to avoid a setBold ( false ) if there's another target in the current Subproject (i.e. spitem) ... + spitem->setBold ( ( m_activeSubproject == spitem ) ); + m_detailView->listView()->viewport()->update(); + } + } + } + if( olddir != m_part->activeDirectory() ) + { + emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() ); + } + + if ( m_activeSubproject == 0 && m_activeTarget == 0 ) + { + m_subprojectView->listView()->setSelected ( m_subprojectView->listView()->firstChild(), true ); + m_subprojectView->listView()->ensureItemVisible ( m_subprojectView->listView()->firstChild() ); + m_subprojectView->listView()->viewport()->update(); + } +} + + +QString AutoProjectWidget::activeDirectory() +{ + if ( m_activeSubproject ) + return m_activeSubproject->path.mid( m_part->projectDirectory().length() + 1 ); + else + { +/* if ( selectedSubproject() ) + return selectedSubproject()->path; + else*/ + return QString::null; + } +} + + +void AutoProjectWidget::addFiles( const QStringList &list ) +{ + QDomDocument &dom = *m_part->projectDom(); + QStringList fileList = list; + + if ( DomUtil::readBoolEntry( dom, "/kdevautoproject/general/useactivetarget" ) ) + { + QStringList::iterator it; + + QString fileName; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + int pos = ( *it ).findRev('/'); + if (pos != -1) + fileName = ( *it ).mid(pos+1); + else + fileName = ( *it ); + + //FileItem * fitem = createFileItem( fileName,m_activeSubproject ); + //m_activeTarget->sources.append( fitem ); + //m_activeTarget->insertItem( fitem ); + + /// @todo Merge with code in addfiledlg.cpp + // Check wether a selected subproject+target exists and matches this file + // If so use that as target. + if( m_detailView->listView()->selectedItem() && m_subprojectView->listView()->selectedItem() ) + { + TargetItem *titem = dynamic_cast ( m_detailView->listView()->selectedItem() ); + SubprojectItem * subitem = dynamic_cast ( m_subprojectView->listView()->selectedItem() ); + QString relativeDir = URLUtil::directory(*it); + SubprojectItem* spitem = subprojectItemForPath(relativeDir); + + if( titem && subitem && subitem == spitem ) + { + addToTarget(fileName, subitem, titem); + }else + { + addToTarget(fileName, m_activeSubproject, m_activeTarget); + } + }else + { + addToTarget(fileName, m_activeSubproject, m_activeTarget); + } + +// QString canontargetname = AutoProjectTool::canonicalize( m_activeTarget->name ); +// QString varname = canontargetname + "_SOURCES"; +// m_activeSubproject->variables[ varname ] += ( " " + fileName ); +// +// QMap replaceMap; +// replaceMap.insert( varname, m_activeSubproject->variables[ varname ] ); +// +// AutoProjectTool::addToMakefileam( m_activeSubproject->path + "/Makefile.am", replaceMap ); + } + + emitAddedFiles ( list ); + } + else + { + QStringList doManually, doneAutomatically; + // First check wether the detail view has a selected target and the subproject + // view selected subproject matches the path of the new file. Then + // we can assume the user used the right-click option on the target + for( QStringList::iterator it = fileList.begin(); it != fileList.end(); ++it) + { + bool autoAdded = false; + if( m_detailView->listView()->selectedItem() && m_subprojectView->listView()->selectedItem() ) + { + TargetItem *titem = dynamic_cast ( m_detailView->listView()->selectedItem() ); + SubprojectItem * subitem = dynamic_cast ( m_subprojectView->listView()->selectedItem() ); + QString relativeDir = URLUtil::directory(*it); + SubprojectItem* spitem = subprojectItemForPath(relativeDir); + if( titem && subitem && subitem == spitem ) + { + addToTarget(URLUtil::filename(*it), subitem, titem); + autoAdded = true; + doneAutomatically << *it; + } + } + if(!autoAdded) doManually << *it; + } + + // See if we can figure out the target for each file without asking the user + // I think it's a valid assumption that if a directory contains only one target + // the file can be added to that target (Julian Rockey linux at jrockey.com) + QStringList temp = doManually; + doManually.clear(); + for(QStringList::iterator it = temp.begin();it!=temp.end();++it) + { + bool autoAdded = false; + QString relativeDir = URLUtil::directory(*it); + SubprojectItem* spitem = subprojectItemForPath(relativeDir); + if (spitem) + { + QPtrList titemList = spitem->targets; + if (titemList.count()==1) { + addToTarget( URLUtil::filename(*it), spitem, titemList.first() ); + doneAutomatically.append(*it); + autoAdded = true; + } + } + + // add to manual list if this file wasn't auto-added + if (!autoAdded) doManually.append(*it); + } + if (doneAutomatically.count()>0) emitAddedFiles(doneAutomatically); + + // raise dialog for any files that weren't added automatically + if (doManually.count()>0) { + ChooseTargetDialog chooseTargetDlg ( this, m_part, doManually, this, "choose target dialog" ); + + //chooseTargetDlg = new ChooseTargetDialog ( this, this, "choose target dialog" ); + + if ( chooseTargetDlg.exec() && chooseTargetDlg.alwaysUseActiveTarget() ) + DomUtil::writeBoolEntry( dom, "/kdevautoproject/general/useactivetarget", true ); + } + } +} + +void AutoProjectWidget::addToTarget(const QString & fileName, SubprojectItem* spitem, TargetItem* titem) +{ + QString varname; + /// \FIXME a quick hack to prevent adding header files to _SOURCES and display them in noinst_HEADERS + if (AutoProjectPrivate::isHeader(fileName) && + ( titem->primary == "PROGRAMS" || titem->primary == "LIBRARIES" || titem->primary == "LTLIBRARIES" ) ) + { + kdDebug ( 9020 ) << "Ignoring header file and adding it to noinst_HEADERS: " << fileName << endl; + TargetItem* noinst_HEADERS_item = getSubprojectView()->findNoinstHeaders(spitem); + FileItem *fitem = createFileItem( fileName, spitem ); + noinst_HEADERS_item->sources.append( fitem ); + noinst_HEADERS_item->insertItem( fitem ); + varname = "noinst_HEADERS"; + } + else + { + FileItem * fitem = createFileItem( fileName, spitem ); + titem->sources.append( fitem ); + titem->insertItem( fitem ); + + QString canontargetname = AutoProjectTool::canonicalize( titem->name ); + varname = canontargetname + "_SOURCES"; + } + spitem->variables[ varname ] += ( " " + fileName ); + + QMap replaceMap; + replaceMap.insert( varname, spitem->variables[ varname ] ); + + AutoProjectTool::addToMakefileam( spitem->path + "/Makefile.am", replaceMap ); + + m_detailView->slotSelectionChanged( spitem ); +} + +void AutoProjectWidget::removeFiles( const QStringList &list ) +{ + Q_UNUSED( list ) +} + +void AutoProjectWidget::slotOverviewSelectionChanged( QListViewItem *item ) +{ + if ( !item ) + return; + + // Delete the items from the details view first. + if ( m_shownSubproject ) + { + // Remove all TargetItems and all of their children from the view + kdDebug ( 9020 ) << "m_shownSubproject (before takeItem()): " << m_shownSubproject->subdir << endl; + + QListViewItem* i = m_detailView->listView()->firstChild(); + while( i ) + { + QListViewItem* o = i; + i = i->nextSibling(); + m_detailView->listView()->takeItem(o); + } + } + + // We assume here that ALL items in the over list view + // are SubprojectItem's + m_shownSubproject = dynamic_cast( item ); + if ( !m_shownSubproject) return; + kdDebug ( 9020 ) << "m_shownSubproject (after takeItem()): " << selectedSubproject()->subdir << endl; + + // Insert all TargetItems and all of their children into the view + QPtrListIterator it2( selectedSubproject()->targets ); + for ( ; it2.current(); ++it2 ) + { + kdDebug ( 9020 ) << "insertItem in detail " << ( *it2 )->name << endl; + m_detailView->listView()->insertItem( *it2 ); + QPtrListIterator it3( ( *it2 ) ->sources ); + for ( ; it3.current(); ++it3 ) + ( *it2 )->insertItem( *it3 ); + QString primary = ( *it2 ) ->primary; + if ( primary == "PROGRAMS" || primary == "LIBRARIES" || + primary == "LTLIBRARIES" || primary == "JAVA" ) + ( *it2 ) ->setOpen( true ); + } +} + +TargetItem *AutoProjectWidget::selectedTarget() +{ + ProjectItem * pvitem = static_cast( m_detailView->listView()->selectedItem() ); + if ( !pvitem || ( pvitem->type() != ProjectItem::Target ) ) + return 0; + + return static_cast( pvitem ); +} + + +FileItem *AutoProjectWidget::selectedFile() +{ + ProjectItem * pvitem = static_cast( m_detailView->listView()->selectedItem() ); + if ( !pvitem || ( pvitem->type() != ProjectItem::File ) ) + return 0; + + return static_cast( pvitem ); +} + +SubprojectItem* AutoProjectWidget::selectedSubproject() +{ + ProjectItem * pvitem = static_cast ( m_subprojectView->listView()->selectedItem() ); + + if ( !pvitem || ( pvitem->type() != ProjectItem::Subproject ) ) + return 0; + + return static_cast ( pvitem ); +} + +TargetItem *AutoProjectWidget::createTargetItem( const QString &name, + const QString &prefix, const QString &primary, + bool take ) +{ + bool docgroup = ( primary == "KDEDOCS" ); + bool icongroup = ( primary == "KDEICON" ); + bool group = !(docgroup || icongroup); + + QString text; + if ( docgroup ) + text = i18n( "Documentation data" ); + else if ( icongroup ) + text = i18n( "KDE Icon data" ).arg( prefix ); + else + text = i18n( "%1 (%2 in %3)" ).arg( name ).arg( nicePrimary( primary ) ).arg( prefix ); + + // Workaround because of QListView not being able to create + // items without actually inserting them + TargetItem *titem = new TargetItem( m_detailView->listView(), group, text ); + titem->name = name; + titem->prefix = prefix; + titem->primary = primary; + if( take ) + m_detailView->listView()->takeItem( titem ); + + return titem; +} + + +FileItem *AutoProjectWidget::createFileItem( const QString &name, SubprojectItem *subproject ) +{ + bool is_subst; + if(name.find("$(") == 0 || name.find("${") == 0) + is_subst = true; + else + is_subst = false; + + FileItem * fitem = new FileItem( m_subprojectView->listView(), name, is_subst ); + fitem->uiFileLink = m_detailView->getUiFileLink(subproject->relativePath()+"/", name ); + m_subprojectView->listView()->takeItem( fitem ); + fitem->name = name; + + return fitem; +} + + +void AutoProjectWidget::emitAddedFiles( const QStringList &fileList ) +{ + emit m_part->addedFilesToProject( fileList ); +} + +void AutoProjectWidget::emitAddedFile( const QString &name ) +{ + QStringList fileList; + fileList.append ( name ); + emit m_part->addedFilesToProject( fileList ); +} + +void AutoProjectWidget::emitRemovedFiles( const QStringList &fileList ) +{ + emit m_part->removedFilesFromProject( fileList ); +} + +void AutoProjectWidget::emitRemovedFile( const QString &name ) +{ + QStringList fileList; + fileList.append ( name ); + emit m_part->removedFilesFromProject( fileList ); +} + +void AutoProjectWidget::restoreSession ( const QDomElement* el ) +{ + Q_UNUSED( el ); +} + +void AutoProjectWidget::saveSession ( QDomElement* el ) +{ + if ( m_activeTarget && m_activeSubproject ) + { + QDomDocument domDoc = el->ownerDocument(); + + QString activeTargetPath = m_activeSubproject->path.mid ( m_part->project()->projectDirectory().length() + 1 ); + activeTargetPath = activeTargetPath + "/" + m_activeTarget->name; + + QDomElement generalEl = domDoc.createElement("general"); + + kdDebug ( 9020 ) << k_funcinfo << "Saving session data of AutoProjectWidget: " << activeTargetPath << endl; + + generalEl.setAttribute("activetarget", activeTargetPath); + el->appendChild(generalEl); + } +} + +void AutoProjectWidget::setActiveSubproject( SubprojectItem * spitem ) +{ + QString olddir = m_part->activeDirectory(); + m_activeSubproject = spitem; + emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() ); +} + +void AutoProjectWidget::focusInEvent( QFocusEvent */*e*/ ) +{ + switch (m_lastFocusedView) + { + case DetailsView: + m_detailView->listView()->setFocus(); + break; + case SubprojectView: + default: + m_subprojectView->listView()->setFocus(); + } +} + +void AutoProjectWidget::setLastFocusedView( AutoProjectView view ) +{ + m_lastFocusedView = view; +} + +#include "autoprojectwidget.moc" + +MakefileHandler* AutoProjectWidget::makefileHandler() +{ + return m_makefileHandler; +} +//kate: indent-mode csands; tab-width 4; space-indent off; + diff --git a/buildtools/autotools/autoprojectwidget.h b/buildtools/autotools/autoprojectwidget.h new file mode 100644 index 00000000..0f4a8b13 --- /dev/null +++ b/buildtools/autotools/autoprojectwidget.h @@ -0,0 +1,229 @@ +/* + KDevelop Autotools Support + Copyright (c) 2001-2002 by Bernd Gehrmann + Copyright (c) 2002 by Victor Roeder + Copyright (c) 2005 by Matt Rogers + +*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +*/ + +#ifndef _AUTOPROJECTWIDGET_H_ +#define _AUTOPROJECTWIDGET_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "makefilehandler.h" + +class AutoProjectPart; +class AutoSubprojectView; +class AutoDetailsView; +class SubprojectItem; +class TargetItem; +class FileItem; +class KAction; +class QDomElement; +class QToolButton; +class QStringList; +class QFocusEvent; +class KListViewItem; +class QListViewItem; +class MakefileHandler; + +class AutoProjectWidget : public QVBox +{ + Q_OBJECT + friend class RemoveFileDialog; + friend class TargetOptionsDialog; // to access projectDom() via m_part->projectDom() +public: + AutoProjectWidget( AutoProjectPart *part, bool kde ); + ~AutoProjectWidget(); + + void openProject( const QString &dirName ); + void closeProject(); + + /** + * A list of the (relative) names of all subprojects (== subdirectories) + */ + QStringList allSubprojects(); + /** + * A list of all Subproject items in the overview KListView + */ + QPtrList allSubprojectItems(); + /** + * A list of the (relative) names of all libraries + */ + QStringList allLibraries(); + /** + * A list of all files that belong to the project + **/ + QStringList allFiles(); + /** + * The top level directory of the project. + **/ + QString projectDirectory() const; + /** + * The directory of the currently shown subproject. + */ + QString subprojectDirectory(); + /** + * Are we in KDE mode? + */ + bool kdeMode() const + { + return m_kdeMode; + } + + /** + * Sets the given target active. The argument is given + * relative to the project directory. + */ + void setActiveTarget( const QString &targetPath ); + /** + * Returns the active target as path relative to + * the project directory. + */ + QString activeDirectory(); + + /** + * Adds a file to the active target. + * If the file does not contain a "/" character, it is added + * to the active target. + * If it does contain "/" character(s), ... @todo .. add to appropriate target + */ + void addFiles( const QStringList &list ); + /** + * Removes the file fileName from the directory directory. + * (not implemented currently) + */ + void removeFiles( const QStringList &list ); + + /** + * Returns the currently selected target. Returns 0 if + * no target is selected. + */ + TargetItem *selectedTarget(); + + /** + * Returns the currently selected file. Returns 0 if + * no file is selected. + */ + FileItem *selectedFile(); + + /** + * Returns the currently selected subproject (directory with Makefile.am). Returns 0 if + * no subproject is selected. + */ + SubprojectItem* selectedSubproject(); + + /** + * Creates a TargetItem instance without a parent item. + */ + TargetItem *createTargetItem( const QString &name, + const QString &prefix, const QString &primary, + bool take = true ); + /** + * Creates a FileItem instance without a parent item. + */ + FileItem *createFileItem( const QString &name, SubprojectItem *subproject ); + + /** + * Returns the Subproject that contains the Active Target. The Active Target is a special target + * to which e.g. all files are added to. + */ + SubprojectItem* activeSubproject (); + void setActiveSubproject( SubprojectItem* spitem ); + + /** + * Returns the Active Target. The Active Target is a special target + * to which e.g. all files are added to. + */ + TargetItem* activeTarget(); + + /** + * Returns the sub project item, if any, for a given path. The path supplied can be either + * absolute, or relative to the project directory. If no subproject item is found for the + * path, null is returned. + */ + SubprojectItem* subprojectItemForPath( const QString & path, bool pathIsAbsolute = false ); + + /** + * Returns the projectdir-relative path for a target item + */ + QString pathForTarget( const TargetItem *item ) const; + + /** + * Adds file fileName to target titem in subproject spitem + */ + void addToTarget( const QString & fileName, SubprojectItem* spitem, TargetItem* titem ); + + /** + * Restores the last settings of the AutoProjectWidget + */ + void restoreSession ( const QDomElement* el ); + + /** + * Saves the latest changes of the AutoProjectWidget to the session file. + */ + void saveSession ( QDomElement* el ); + + AutoSubprojectView* getSubprojectView (); + AutoDetailsView* getDetailsView (); + + + void emitAddedFile ( const QString& name ); + void emitAddedFiles( const QStringList &fileList ); + void emitRemovedFile ( const QString& name ); + void emitRemovedFiles( const QStringList &fileList ); + + void parse( SubprojectItem *item ); + + enum AutoProjectView { SubprojectView, DetailsView }; + void setLastFocusedView( AutoProjectView view ); + + MakefileHandler* makefileHandler(); + +public slots: + void slotOverviewSelectionChanged( QListViewItem *item ); + +protected: + void initOverview ( QWidget* parent ); + void initDetailview ( QWidget* parent ); + void initActions (); + + virtual void focusInEvent( QFocusEvent *e ); + +private: + + AutoSubprojectView* m_subprojectView; + AutoDetailsView* m_detailView; + + bool m_kdeMode; + AutoProjectPart *m_part; + SubprojectItem *m_activeSubproject; + TargetItem *m_activeTarget; + TargetItem *m_choosenTarget; + SubprojectItem *m_shownSubproject; + + AutoProjectView m_lastFocusedView; + + MakefileHandler *m_makefileHandler; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/autosubprojectview.cpp b/buildtools/autotools/autosubprojectview.cpp new file mode 100644 index 00000000..efa3a358 --- /dev/null +++ b/buildtools/autotools/autosubprojectview.cpp @@ -0,0 +1,1137 @@ +/* + KDevelop Autotools Support + Copyright (c) 2002 by Victor Roeder + Copyright (c) 2005 by Matt Rogers + + *************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + *************************************************************************** +*/ + +/** Qt */ +#include +#include +#include +#include +#include + +/** KDE Libs */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** KDevelop */ +#include +#include +#include +#include +#include + +/** AutoProject */ +#include "subprojectoptionsdlg.h" +#include "addsubprojectdlg.h" +#include "addtargetdlg.h" +#include "addservicedlg.h" +#include "addapplicationdlg.h" +#include "addexistingdirectoriesdlg.h" +#include "autolistviewitems.h" +#include "autoprojectwidget.h" +#include "autoprojectpart.h" +#include "autosubprojectview.h" +#include "autotoolsaction.h" +#include "removesubprojectdialog.h" +#include "managecustomcommand.h" + +namespace AutoProjectPrivate +{ + +bool isHeader( const QString& fileName ) +{ + return QStringList::split( ";", "h;H;hh;hxx;hpp;tcc;h++" ).contains( QFileInfo(fileName).extension(false) ); +} + +static QString cleanWhitespace( const QString &str ) +{ + QString res; + + QStringList l = QStringList::split( QRegExp( "[ \t]" ), str ); + QStringList::ConstIterator it; + for ( it = l.begin(); it != l.end(); ++it ) + { + res += *it; + res += " "; + } + + return res.left( res.length() - 1 ); +} + +static void removeDir( const QString& dirName ) +{ + QDir d( dirName ); + const QFileInfoList* fileList = d.entryInfoList(); + if( !fileList ) + return; + + QFileInfoListIterator it( *fileList ); + while( it.current() ){ + const QFileInfo* fileInfo = it.current(); + ++it; + + if( fileInfo->fileName() == "." || fileInfo->fileName() == ".." ) + continue; + + if( fileInfo->isDir() && !fileInfo->isSymLink() ) + removeDir( fileInfo->absFilePath() ); + + kdDebug(9020) << "remove " << fileInfo->absFilePath() << endl; + d.remove( fileInfo->fileName(), false ); + } + + kdDebug(9020) << "remove dir " << dirName << endl; + d.rmdir( d.absPath(), true ); +} + +} + + +AutoSubprojectView::AutoSubprojectView(AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name) +: AutoProjectViewBase(parent, name) +{ + + m_widget = widget; + m_part = part; + + m_listView->setSorting(-1); + m_listView->header()->hide(); + m_listView->addColumn( QString::null ); + + connect( m_listView, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotSelectionChanged( QListViewItem* ) ) ); + + initActions(); +} + + +AutoSubprojectView::~AutoSubprojectView() +{ +} + +void AutoSubprojectView::slotSelectionChanged( QListViewItem* item ) +{ + if ( m_listView->selectedItems().count() <= 0 ) + { + subProjectOptionsAction->setEnabled( false ); + addSubprojectAction->setEnabled( false ); + addTargetAction->setEnabled( false ); + addServiceAction->setEnabled( false ); + addApplicationAction->setEnabled( false ); + buildSubprojectAction->setEnabled( false ); + } + else + { + subProjectOptionsAction->setEnabled( true ); + addSubprojectAction->setEnabled( true ); + addTargetAction->setEnabled( true ); + addServiceAction->setEnabled( true ); + addApplicationAction->setEnabled( true ); + buildSubprojectAction->setEnabled( true ); + } + + emit selectionChanged( item ); +} + +void AutoSubprojectView::loadMakefileams ( const QString& dir ) +{ + SubprojectItem * item = new SubprojectItem( m_listView, m_part->projectName() ); + item->setPixmap ( 0, SmallIcon ( "kdevelop" ) ); + item->subdir = "/"; + item->path = dir; + parse( item ); + item->setOpen( true ); + + //setSelected( item, true ); + + expandCollapseFirst( m_listView->firstChild(), false ); +} + + +void AutoSubprojectView::initActions() +{ + KActionCollection * actions = new KActionCollection( this ); + + subProjectOptionsAction = new AutoToolsAction( i18n( "Options..." ), "configure", 0, + this, SLOT( slotSubprojectOptions() ), actions, "subproject options" ); + subProjectOptionsAction->setWhatsThis(i18n("Options

Shows subproject options dialog " + "that provides settings for compiler, include paths, " + "prefixes and build order.")); + subProjectOptionsAction->plug( m_optionsButton ); + + QToolTip::add( m_button1, tr2i18n( "Add new subproject...")); + addSubprojectAction = new AutoToolsAction( i18n( "Add new subproject..." ), "folder_new", 0, + this, SLOT( slotAddSubproject() ), actions, "add subproject" ); + addSubprojectAction->setWhatsThis(i18n("Add new subproject

Creates a new " + "subproject in currently selected subproject.")); + addSubprojectAction->plug( m_button1 ); + + removeSubprojectAction = new KAction( i18n( "Remove Subproject..." ), "remove_subdir", 0, + this, SLOT( slotRemoveSubproject() ), actions, "remove subproject" ); + removeSubprojectAction->setWhatsThis(i18n("Remove subproject

Removes the subproject. Asks if the " + "subproject should be also removed from disk. Only subprojects " + "which do not hold other subprojects can be removed.")); + addExistingSubprojectAction = new KAction( i18n( "Add Existing Subprojects..." ), "fileimport", 0, + this, SLOT( slotAddExistingSubproject() ), actions, "add existing subproject" ); + addExistingSubprojectAction->setWhatsThis(i18n("Add existing subprojects

Imports existing " + "subprojects containing Makefile.am.")); + + QToolTip::add( m_button2, tr2i18n( "Add Target...")); + addTargetAction = new AutoToolsAction( i18n( "Add Target..." ), "targetnew_kdevelop", 0, + this, SLOT( slotAddTarget() ), actions, "add target" ); + addTargetAction->setWhatsThis(i18n( "Add target

Adds a new target to " + "the currently selected subproject. Target can be a " + "binary program, library, script, also a collection of " + "data or header files.")); + addTargetAction->plug( m_button2 ); + + QToolTip::add( m_button3, tr2i18n( "Add Service...")); + addServiceAction = new AutoToolsAction( i18n( "Add Service..." ), "servicenew_kdevelop", 0, this, + SLOT( slotAddService() ), actions, "add service" ); + addServiceAction->setWhatsThis(i18n("Add service

Creates a .desktop file describing the service.")); + addServiceAction->plug( m_button3 ); + + QToolTip::add( m_button4, tr2i18n( "Add Application...")); + addApplicationAction = new AutoToolsAction( i18n( "Add Application..." ), "window_new", 0, this, + SLOT( slotAddApplication() ), actions, "add application" ); + addApplicationAction->setWhatsThis(i18n("Add application

Creates an application .desktop file.")); + addApplicationAction->plug( m_button4 ); + + QToolTip::add( m_button5, tr2i18n( "Build")); + buildSubprojectAction = new AutoToolsAction( i18n( "Build" ), "launch", 0, this, + SLOT( slotBuildSubproject() ), actions, "build subproject" ); + buildSubprojectAction->setWhatsThis(i18n("Build

Runs make from the directory of " + "the selected subproject.
Environment variables and " + "make arguments can be specified in the project settings " + "dialog, Make Options tab.")); + buildSubprojectAction->plug( m_button5 ); + + forceReeditSubprojectAction = new KAction( i18n( "Force Reedit" ), 0, 0, this, + SLOT( slotForceReeditSubproject() ), actions, "force-reedit subproject" ); + forceReeditSubprojectAction->setWhatsThis(i18n("Force Reedit

Runs make force-reedit " + "from the directory of the selected subproject.
This " + "recreates makefile (tip: and solves most of .moc related " + "problems)
Environment variables and make arguments can " + "be specified in the project settings dialog, " + "Make Options tab.")); + + if (!m_part->isKDE()) + forceReeditSubprojectAction->setEnabled(false); + + cleanSubprojectAction = new KAction( i18n( "Clean" ), 0, 0, this, + SLOT( slotCleanSubproject() ), actions, "clean subproject" ); + cleanSubprojectAction->setWhatsThis(i18n("Clean

Runs make clean from the directory of " + "the selected subproject.
Environment variables and make " + "arguments can be specified in the project settings dialog, " + "Make Options tab.")); + + installSubprojectAction = new KAction( i18n( "Install" ), 0, 0, this, + SLOT( slotInstallSubproject() ), actions, "install subproject" ); + installSubprojectAction->setWhatsThis(i18n("Install

Runs make install from the directory " + "of the selected subproject.
Environment variables and " + "make arguments can be specified in the project settings " + "dialog, Make Options tab.")); + installSuSubprojectAction = new KAction( i18n( "Install (as root user)" ), 0, 0, + this, SLOT( slotInstallSuSubproject() ), actions, "install subproject as root" ); + installSuSubprojectAction->setWhatsThis(i18n("Install as root user

Runs make install " + "command from the directory of the selected subproject " + "with root privileges.
It is executed via kdesu " + "command.
Environment variables and make arguments " + "can be specified in the project settings dialog, " + "Make Options tab.")); + + expandAction = new KAction( i18n( "Expand Subtree" ), 0, 0, this, + SLOT(slotExpandTree()), actions, "expandAction" ); + collapseAction = new KAction( i18n( "Collapse Subtree" ), 0, 0, this, + SLOT(slotCollapseTree()), actions, "collapseAction" ); + + otherAction = new KAction( i18n( "Manage Custom Commands..." ), 0, 0, this, + SLOT( slotManageBuildCommands() ), actions, "manage custom commands" ); + otherAction->setWhatsThis(i18n("Manage custom commands

Allows to create, edit and " + "delete custom build commands which appears in the subproject " + "context menu.
")); + + connect( m_listView, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), + this, SLOT( slotContextMenu( KListView*, QListViewItem*, const QPoint& ) ) ); +} + +void AutoSubprojectView::slotContextMenu( KListView *, QListViewItem *item, const QPoint &p ) +{ + if ( !item ) + return ; + + KPopupMenu popup( i18n( "Subproject: %1" ).arg( item->text( 0 ) ), this ); + + subProjectOptionsAction->plug( &popup ); + popup.insertSeparator(); + addSubprojectAction->plug( &popup ); + addTargetAction->plug( &popup ); + addServiceAction->plug( &popup ); + addApplicationAction->plug( &popup ); + popup.insertSeparator(); + addExistingSubprojectAction->plug( &popup ); + popup.insertSeparator(); + removeSubprojectAction->plug( &popup ); + popup.insertSeparator(); + buildSubprojectAction->plug( &popup ); + popup.insertSeparator(); + forceReeditSubprojectAction->plug( &popup ); + cleanSubprojectAction->plug( &popup ); + popup.insertSeparator(); + installSubprojectAction->plug( &popup ); + installSuSubprojectAction->plug( &popup ); + popup.insertSeparator(); + collapseAction->plug( &popup ); + expandAction->plug( &popup ); + + KConfig *config = m_part->instance()->config(); + bool separate = true; + QMap customBuildCommands = config->entryMap("CustomCommands"); + for (QMap::const_iterator it = customBuildCommands.constBegin(); + it != customBuildCommands.constEnd(); ++it) + { + if (separate) + { + popup.insertSeparator(); + separate = false; + } + int id = popup.insertItem(it.key(), this, SLOT(slotCustomBuildCommand(int))); + m_commandList.append(it.data()); + popup.setItemParameter(id, m_commandList.findIndex(it.data())); + } + + popup.insertSeparator(); + otherAction->plug( &popup ); + + KURL::List urls; + urls.append(m_widget->selectedSubproject()->path); + FileContext context(urls); + m_part->core()->fillContextMenu( &popup, &context ); + + popup.exec( p ); +} + +void AutoSubprojectView::slotSubprojectOptions() +{ + kdDebug( 9020 ) << "AutoSubprojectView::slotSubprojectOptions()" << endl; + + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + SubprojectOptionsDialog dlg( m_part, m_widget, spitem, this, "subproject options dialog" ); + dlg.exec(); +} + + +void AutoSubprojectView::slotAddSubproject() +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + AddSubprojectDialog dlg( m_part, this, spitem, this, "add subproject dialog" ); + + dlg.setCaption ( i18n ( "Add New Subproject to '%1'" ).arg ( spitem->subdir ) ); + dlg.exec(); +} + + +void AutoSubprojectView::slotAddExistingSubproject() +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + AddExistingDirectoriesDialog dlg ( m_part, m_widget, spitem, this, "add existing subprojects" ); + + dlg.setCaption ( i18n ( "Add Existing Subproject to '%1'" ).arg ( spitem->subdir ) ); + dlg.targetLabel->setText(""); + dlg.directoryLabel->setText(spitem->path); + + if ( dlg.exec() ) + emit selectionChanged ( spitem ); +} + +void AutoSubprojectView::slotAddTarget() +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + AddTargetDialog dlg( m_widget, spitem, this, "add target dialog" ); + + dlg.setCaption ( i18n ( "Add New Target to '%1'" ).arg ( spitem->subdir ) ); + + // Update the details view if a target was added + if ( dlg.exec() ) + emit selectionChanged( spitem ); +} + + +void AutoSubprojectView::slotAddService() +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + AddServiceDialog dlg( m_widget, spitem, this, "add service dialog" ); + + dlg.setCaption ( i18n ( "Add New Service to '%1'" ).arg ( spitem->subdir ) ); + + // Update the details view if a service was added + if ( dlg.exec() ) + emit selectionChanged( spitem ); +} + + +void AutoSubprojectView::slotAddApplication() +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + AddApplicationDialog dlg( m_widget, spitem, this, "add application dialog" ); + + dlg.setCaption ( i18n ( "Add New Application to '%1'" ).arg ( spitem->subdir ) ); + + // Update the details view if an application was added + if ( dlg.exec() ) + emit selectionChanged( spitem ); +} + + +void AutoSubprojectView::slotBuildSubproject() +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() ); + + m_part->startMakeCommand( m_part->buildDirectory() + relpath, QString::fromLatin1( "" ) ); +} + +void AutoSubprojectView::slotRemoveSubproject() +{ + kdDebug(9020) << "AutoSubprojectView::slotRemoveSubproject()" << endl; + + SubprojectItem* spitem = static_cast( m_listView->selectedItem() ); + if( !spitem ) + return; + + SubprojectItem* parent = static_cast( spitem->parent() ); + if( !parent || !parent->listView() || spitem->childCount() != 0 ){ + KMessageBox::error( 0, i18n("This item cannot be removed"), i18n("Automake Manager") ); + return; + } + + QStringList list = QStringList::split( QRegExp("[ \t]"), parent->variables["SUBDIRS"] ); + QStringList::Iterator it = list.find( spitem->subdir ); + QString subdirToRemove = spitem->subdir; + bool topsubdirs = true; + if ((parent->variables["SUBDIRS"].find("$(TOPSUBDIRS)") == -1) + && (parent->variables["SUBDIRS"].find("$(AUTODIRS)") == -1)) + { + topsubdirs = false; + if( it == list.end() ){ + KMessageBox::sorry(this, i18n("There is no subproject %1 in SUBDIRS").arg(spitem->subdir)); + return; + } + } + + RemoveSubprojectDialog dlg(i18n("Remove Subproject %1").arg(spitem->text(0)), + i18n("Do you really want to remove subproject %1 with all targets and files?").arg(spitem->text(0))); + if( dlg.exec() ){ + + bool removeSources = dlg.removeFromDisk(); + + if (!topsubdirs) + { + list.remove( it ); + parent->variables[ "SUBDIRS" ] = list.join( " " ); + } + + parent->listView()->setSelected( parent, true ); + kapp->processEvents( 500 ); + + + if( removeSources ){ + kdDebug(9020) << "remove dir " << spitem->path << endl; + AutoProjectPrivate::removeDir( spitem->path ); + } + + if( m_widget->activeSubproject() == spitem ){ + m_widget->setActiveSubproject( 0 ); + } + + // Adjust AC_OUTPUT in configure.in + if ( !m_part->isKDE() ) { + + QString projroot = m_part->projectDirectory() + "/"; + QString subdirectory = spitem->path; + QString relpath = subdirectory.replace(0, projroot.length(),""); + + QString configureFile = m_part->getAutoConfFile(projroot); + + QStringList list = AutoProjectTool::configureinLoadMakefiles(configureFile); + + QStringList::iterator it; + + for ( it = list.begin(); it != list.end(); it++ ) { + QString current = (QString) (*it); + QRegExp path_regex(relpath); + if ( path_regex.search(current) >= 0) { + list.remove(it); + break; + } + } + AutoProjectTool::configureinSaveMakefiles(configureFile, list); + + } + + // remove all targets + spitem->targets.setAutoDelete( true ); + spitem->targets.clear(); + delete( spitem ); + spitem = 0; + + // Adjust SUBDIRS variable in containing Makefile.am + + if (parent->variables["SUBDIRS"].find("$(TOPSUBDIRS)") != -1) + { + QFile subdirsfile( parent->path + "/subdirs" ); + QStringList topdirs; + if ( subdirsfile.open( IO_ReadOnly ) ) + { + QTextStream subdirsstream( &subdirsfile ); + while (!subdirsstream.atEnd()) + topdirs.append(subdirsstream.readLine()); + subdirsfile.close(); + } + topdirs.remove(subdirToRemove); + if ( subdirsfile.open( IO_WriteOnly | IO_Truncate ) ) + { + QTextStream subdirsstream( &subdirsfile ); + for (QStringList::const_iterator it = topdirs.begin(); it != topdirs.end(); ++it) + subdirsstream << *it << endl; + subdirsfile.close(); + } + } + + QMap replaceMap; + replaceMap.insert( "SUBDIRS", subdirToRemove ); + AutoProjectTool::removeFromMakefileam( parent->path + "/Makefile.am", replaceMap ); + + QString relmakefile = ( parent->path + "/Makefile" ).mid( m_part->projectDirectory().length()+1 ); + kdDebug(9020) << "Relative makefile path: " << relmakefile << endl; + + // check for config.status + if( !QFileInfo(m_part->buildDirectory(), "config.status").exists() ){ + return; + } + + QString cmdline = "cd "; + cmdline += KProcess::quote(m_part->projectDirectory()); + cmdline += " && automake "; + cmdline += KProcess::quote(relmakefile); + cmdline += " && cd "; + cmdline += KProcess::quote(m_part->buildDirectory()); + cmdline += " && CONFIG_HEADERS=config.h CONFIG_FILES="; + cmdline += KProcess::quote(relmakefile); + cmdline += " ./config.status"; + m_part->makeFrontend()->queueCommand( m_part->projectDirectory(), cmdline ); + } +} + + +void AutoSubprojectView::parsePrimary( SubprojectItem *item, + const QString &lhs, const QString &rhs ) +{ + // Parse line foo_bar = bla bla + + int pos = lhs.findRev( '_' ); + QString prefix = lhs.left( pos ); + QString primary = lhs.right( lhs.length() - pos - 1 ); + // kdDebug(9020) << "Prefix:" << prefix << ",Primary:" << primary << endl; + + +#if 0 + + QStrList prefixes; + prefixes.append( "bin" ); + prefixes.append( "pkglib" ); + prefixes.append( "pkgdata" ); + prefixes.append( "noinst" ); + prefixes.append( "check" ); + prefixes.append( "sbin" ); + QStrList primaries; + primaries.append( "PROGRAMS" ); + primaries.append( "LIBRARIES" ); + primaries.append( "LTLIBRARIES" ); + primaries.append( "SCRIPTS" ); + primaries.append( "HEADERS" ); + primaries.append( "DATA" ); +#endif + + // Not all combinations prefix/primary are possible, so this + // could also be checked... not trivial because the list of + // possible prefixes can be extended dynamically (see below) + if ( primary == "PROGRAMS" || primary == "LIBRARIES" || primary == "LTLIBRARIES" ) + { + QStringList l = QStringList::split( QRegExp( "[ \t\n]" ), rhs ); + QStringList::Iterator it1; + for ( it1 = l.begin(); it1 != l.end(); ++it1 ) + { + TargetItem *titem = m_widget->createTargetItem( *it1, prefix, primary ); + item->targets.append( titem ); + + QString canonname = AutoProjectTool::canonicalize( *it1 ); + titem->ldflags = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_LDFLAGS" ] ); + titem->ldadd = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_LDADD" ] ); + titem->libadd = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_LIBADD" ] ); + titem->dependencies = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_DEPENDENCIES" ] ); + + QString sources = item->variables[ canonname + "_SOURCES" ]; + QStringList sourceList = QStringList::split( QRegExp( "[ \t\n]" ), sources ); + QMap dict; + QStringList::Iterator it = sourceList.begin(); + while( it != sourceList.end() ){ + dict.insert( *it, true ); + ++it; + } + + QMap::Iterator dictIt = dict.begin(); + while( dictIt != dict.end() ){ + QString fname = dictIt.key(); + ++dictIt; + + FileItem *fitem = m_widget->createFileItem( fname, item ); + titem->sources.append( fitem ); + + if( AutoProjectPrivate::isHeader(fname) ) + headers += fname; + } + } + } + else if ( primary == "SCRIPTS" || primary == "HEADERS" || primary == "DATA" ) + { + // See if we have already such a group + for ( uint i = 0; i < item->targets.count(); ++i ) + { + TargetItem *titem = item->targets.at( i ); + if ( primary == titem->primary && prefix == titem->prefix ) + { + item->targets.remove( i ); + break; + } + } + // Create a new one + TargetItem *titem = m_widget->createTargetItem( "", prefix, primary ); + item->targets.append( titem ); + + QStringList l = QStringList::split( QRegExp( "[ \t]" ), rhs ); + QStringList::Iterator it3; + for ( it3 = l.begin(); it3 != l.end(); ++it3 ) + { + QString fname = *it3; + FileItem *fitem = m_widget->createFileItem( fname, item ); + titem->sources.append( fitem ); + + if( AutoProjectPrivate::isHeader(fname) ) + headers += fname; + + } + } + else if ( primary == "JAVA" ) + { + QStringList l = QStringList::split( QRegExp( "[ \t\n]" ), rhs ); + QStringList::Iterator it1; + TargetItem *titem = m_widget->createTargetItem( "", prefix, primary ); + item->targets.append( titem ); + + for ( it1 = l.begin(); it1 != l.end(); ++it1 ) + { + FileItem *fitem = m_widget->createFileItem( *it1, item ); + titem->sources.append( fitem ); + } + } +} + + +void AutoSubprojectView::parseKDEDOCS( SubprojectItem *item, + const QString & /*lhs*/, const QString & /*rhs*/ ) +{ + // Handle the line KDE_ICON = + // (actually, no parsing is involved here) + + QString prefix = "kde_docs"; + QString primary = "KDEDOCS"; + + TargetItem *titem = m_widget->createTargetItem( "", prefix, primary ); + item->targets.append( titem ); + + QDir d( item->path ); + QStringList l = d.entryList( QDir::Files ); + + QRegExp re( "Makefile.*|\\..*|.*~|index.cache.bz2" ); + + QStringList::ConstIterator it; + for ( it = l.begin(); it != l.end(); ++it ) + { + if ( !re.exactMatch( *it ) ) + { + QString fname = *it; + FileItem * fitem = m_widget->createFileItem( fname, item ); + titem->sources.append( fitem ); + } + } +} + + +void AutoSubprojectView::parseKDEICON( SubprojectItem *item, + const QString &lhs, const QString &rhs ) +{ + // Parse a line foo_ICON = bla bla + + int pos = lhs.find( "_ICON" ); + QString prefix = lhs.left( pos ); + if ( prefix == "KDE" ) + prefix = "kde_icon"; + + QString primary = "KDEICON"; + + TargetItem *titem = m_widget->createTargetItem( "", prefix, primary ); + item->targets.append( titem ); + + QDir d( item->path ); + QStringList l = d.entryList( QDir::Files ); + + QString regexp; + + if ( rhs == "AUTO" ) + { + regexp = ".*\\.(png|mng|xpm)"; + } + else + { + QStringList appNames = QStringList::split( QRegExp( "[ \t\n]" ), rhs ); + regexp = ".*(-" + appNames.join( "|-" ) + ")\\.(png|mng|xpm)"; + } + + QRegExp re( regexp ); + + QStringList::ConstIterator it; + for ( it = l.begin(); it != l.end(); ++it ) + { + if ( re.exactMatch( *it ) ) + { + FileItem * fitem = m_widget->createFileItem( *it, item ); + titem->sources.append( fitem ); + } + } +} + + +void AutoSubprojectView::parsePrefix( SubprojectItem *item, + const QString &lhs, const QString &rhs ) +{ + // Parse a line foodir = bla bla + QString name = lhs.left( lhs.length() - 3 ); + QString dir = rhs; + item->prefixes.insert( name, dir ); +} + + +void AutoSubprojectView::parseSUBDIRS( SubprojectItem *item, + const QString & /*lhs*/, const QString &rhs ) +{ + // Parse a line SUBDIRS = bla bla + QString subdirs = rhs; + kdDebug( 9020 ) << "subdirs are " << subdirs << endl; + + // Take care of KDE hacks: + // TOPSUBDIRS is an alias for all directories + // listed in the subdirs file + if ( subdirs.find( "$(TOPSUBDIRS)" ) != -1 ) + { + QStringList dirs; + QFile subdirsfile( item->path + "/subdirs" ); + if( subdirsfile.exists() ) + { + if ( subdirsfile.open( IO_ReadOnly ) ) + { + QTextStream subdirsstream( &subdirsfile ); + while ( !subdirsstream.atEnd() ) + dirs.append( subdirsstream.readLine() ); + subdirsfile.close(); + } + } else + { + QDir d( item->path ); + QStringList l = d.entryList( QDir::Dirs ); + for( QStringList::const_iterator it = l.begin(); it != l.end(); ++it ) + { + if( (*it) != "CVS" && (*it) != "admin" && (*it) != ".svn" && (*it) != "." && (*it) != ".." ) + { + QDir subdir = d; + subdir.cd( *it, false ); + if( subdir.exists( "Makefile.am" ) ) + dirs.append( *it ); + } + } + + } + subdirs.replace( QRegExp( "\\$\\(TOPSUBDIRS\\)" ), dirs.join( " " ) ); + } + + // AUTODIRS is an alias for all subdirectories + if ( subdirs.find( "$(AUTODIRS)" ) != -1 ) + { + QDir d( item->path ); + QStringList dirs = d.entryList( QDir::Dirs ); + dirs.remove( "." ); + dirs.remove( ".." ); + dirs.remove( "CVS" ); + subdirs.replace( QRegExp( "\\$\\(AUTODIRS\\)" ), dirs.join( " " ) ); + } + + // If there are any variables in the subdirs line then search + // the Makefile(.am?) for its definition. Unfortunately, it may be + // defined outside this file in which case those dirs won't be added. + QRegExp varre( "\\$\\(\\s*(.*)\\s*\\)" ); + varre.setMinimal( true ); + while ( varre.search( subdirs ) != -1 ) + { + QString varname = varre.cap( 1 ); + QString varvalue; + + // Search the whole Makefile(.am?) + // Note that if the variable isn't found it just disappears + // (Perhaps we should add it back in this case?) + QMap::ConstIterator varit = item->variables.find( varname ); + if ( varit != item->variables.end() ) + { + kdDebug( 9020 ) << "Found Makefile var " << varname << ", adding dirs <" << varit.data() << ">" << endl; + varvalue = varit.data(); + } + else + { + kdDebug( 9020 ) << "Not found Makefile var " << varname << endl; + } + subdirs.replace( QRegExp( "\\$\\(\\s*" + varname + "\\s*\\)" ), varvalue ); + } + + //search for AC_SUBST variables and try to replace them with variables + //that have been already defined e.g. in a "kdevelop hint" + varre = QRegExp( "\\@(.*)\\@" ); + varre.setMinimal( true ); + while ( varre.search( subdirs ) != -1 ) + { + QString varname = varre.cap( 1 ); + QString varvalue; + + // Search the whole Makefile(.am?) + // Note that if the variable isn't found it just disappears + // (Perhaps we should add it back in this case?) + QMap::ConstIterator varit = item->variables.find( varname ); + if ( varit != item->variables.end() ) + { + kdDebug( 9020 ) << "Found Makefile var " << varname << ", adding dirs <" << varit.data() << ">" << endl; + varvalue = varit.data(); + } + else + { + kdDebug( 9020 ) << "Not found Makefile var " << varname << endl; + } + subdirs.replace( QRegExp( "\\@" + varname + "\\@" ), varvalue ); + } + + QStringList l = QStringList::split( QRegExp( "[ \t]" ), subdirs ); + l.sort(); + QStringList::Iterator it; + for ( it = l.begin(); it != l.end(); ++it ) + { + if ( *it == "." ) + continue; + SubprojectItem *newitem = new SubprojectItem( item, ( *it ) ); + newitem->subdir = ( *it ); + newitem->path = item->path + "/" + ( *it ); + parse( newitem ); + // Experience tells me this :-) + bool open = true; + if ( newitem->subdir == "doc" ) + open = false; + if ( newitem->subdir == "po" ) + open = false; + if ( newitem->subdir == "pics" ) + open = false; + if ( newitem && static_cast( newitem->parent() ) + ->subdir == "doc" ) + open = false; + if ( newitem && static_cast + ( newitem->parent() ) ->subdir == "po" ) + open = false; + if ( newitem && static_cast + ( newitem->parent() ) ->subdir == "pics" ) + open = false; + newitem->setOpen( open ); + + // Move to the bottom of the list + QListViewItem *lastItem = item->firstChild(); + while ( lastItem->nextSibling() + ) + lastItem = lastItem->nextSibling(); + if ( lastItem != newitem ) + newitem->moveItem( lastItem ); + } +} + +void AutoSubprojectView::parse( SubprojectItem *item ) +{ + headers.clear(); + AutoProjectTool::parseMakefileam( item->path + "/Makefile.am", &item->variables ); + + QMap::ConstIterator it; + for ( it = item->variables.begin(); it != item->variables.end(); ++it ) + { + QString lhs = it.key(); + QString rhs = it.data(); + if ( lhs == "KDE_DOCS" ) + parseKDEDOCS( item, lhs, rhs ); + else if ( lhs.right( 5 ) == "_ICON" ) + parseKDEICON( item, lhs, rhs ); + else if ( lhs.find( '_' ) > 0 ) + parsePrimary( item, lhs, rhs ); + else if ( lhs.right( 3 ) == "dir" ) + parsePrefix( item, lhs, rhs ); + else if ( lhs == "SUBDIRS" ) + parseSUBDIRS( item, lhs, rhs ); + } + + /// @todo only if in a c++ project + TargetItem* noinst_HEADERS_item = findNoinstHeaders(item); + + QDir dir( item->path ); + QStringList headersList = QStringList::split( QRegExp("[ \t]"), item->variables[ "noinst_HEADERS" ] ); + + headersList += dir.entryList( "*.h;*.H;*.hh;*.hxx;*.hpp;*.tcc", QDir::Files ); + headersList.sort(); + headersList = QStringList::split(QRegExp("[ \t]"), headersList.join( " " )); + + QStringList::Iterator fileIt = headersList.begin(); + while( fileIt != headersList.end() ){ + QString fname = *fileIt; + ++fileIt; + + if( AutoProjectPrivate::isHeader(fname) && !headers.contains(fname) ){ + FileItem *fitem = m_widget->createFileItem( fname, item ); + noinst_HEADERS_item->sources.append( fitem ); + } + } +} + +void AutoSubprojectView::slotForceReeditSubproject( ) +{ + SubprojectItem* spitem = dynamic_cast ( m_listView->selectedItem() ); + if ( !spitem ) return; + + QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() ); + + m_part->startMakeCommand( m_part->buildDirectory() + relpath, "force-reedit" ); +} + +void AutoSubprojectView::slotInstallSubproject( ) +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() ); + + m_part->startMakeCommand( m_part->buildDirectory() + relpath, "install" ); +} + +void AutoSubprojectView::slotInstallSuSubproject( ) +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() ); + + m_part->startMakeCommand( m_part->buildDirectory() + relpath, "install", true ); +} + +TargetItem * AutoSubprojectView::findNoinstHeaders( SubprojectItem *item ) +{ + TargetItem* noinst_HEADERS_item = 0; + QPtrListIterator itemIt( item->targets ); + while( itemIt.current() ){ + TargetItem* titem = itemIt.current(); + ++itemIt; + + if( titem->prefix == "noinst" && titem->primary == "HEADERS" ){ + noinst_HEADERS_item = titem; + break; + } + } + + if( !noinst_HEADERS_item ){ + noinst_HEADERS_item = m_widget->createTargetItem( "", "noinst", "HEADERS" ); + item->targets.append( noinst_HEADERS_item ); + } + + return noinst_HEADERS_item; +} + +void AutoSubprojectView::slotCleanSubproject( ) +{ + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() ); + + m_part->startMakeCommand( m_part->buildDirectory() + relpath, "clean" ); +} + +void AutoSubprojectView::focusOutEvent( QFocusEvent */* e*/ ) +{ + m_widget->setLastFocusedView(AutoProjectWidget::SubprojectView); +} + +void AutoSubprojectView::slotManageBuildCommands( ) +{ + KConfig *config = m_part->instance()->config(); + //menu item name <-> command + QMap customBuildCommands = config->entryMap("CustomCommands"); + + KDialogBase dlg(KDialogBase::Plain, i18n("Manage Custom Commands"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok); + dlg.plainPage()->setMargin(0); + (new QVBoxLayout(dlg.plainPage(), 0, 0))->setAutoAdd(true); + + ManageCustomCommand *widget = new ManageCustomCommand(dlg.plainPage()); + + for (QMap::const_iterator it = customBuildCommands.constBegin(); + it != customBuildCommands.constEnd(); ++it) + { + widget->commandsTable->insertRows(widget->commandsTable->numRows()); + widget->setRowProperties(widget->commandsTable->numRows()-1); + widget->commandsTable->setText(widget->commandsTable->numRows() - 1, 0, it.key()); + widget->commandsTable->setText(widget->commandsTable->numRows() - 1, 1, + it.data().section(":::", 0, 0)); + static_cast(widget->commandsTable-> + item(widget->commandsTable->numRows() - 1, 2))-> + setCurrentItem(it.data().section(":::", 1, 1).toInt()); + } + + widget->commandsTable->setFocus(); + if (dlg.exec() == QDialog::Accepted) + { + config->deleteGroup("CustomCommands"); + config->setGroup("CustomCommands"); + for (int i = 0; i < widget->commandsTable->numRows(); ++i) + { + config->writeEntry(widget->commandsTable->text(i, 0), + widget->commandsTable->text(i, 1)+":::"+ + QString("%1").arg(static_cast(widget-> + commandsTable->item(i, 2))->currentItem())); + } + config->sync(); + } + +} + +void AutoSubprojectView::slotCustomBuildCommand(int val) +{ + QString cmd = m_commandList[val].section(":::", 0, 0); + int type = m_commandList[val].section(":::", 1, 1).toInt(); + + SubprojectItem* spitem = dynamic_cast( m_listView->selectedItem() ); + if ( !spitem ) return; + + QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() ); + switch (type) + { + case 0: //make target + m_part->startMakeCommand( m_part->buildDirectory() + relpath, cmd ); + break; + case 1: //make target as root + m_part->startMakeCommand( m_part->buildDirectory() + relpath, cmd, true ); + break; + case 2: //make command + m_part->startSimpleMakeCommand( m_part->buildDirectory() + relpath, cmd ); + break; + case 3: //make command as root + m_part->startSimpleMakeCommand( m_part->buildDirectory() + relpath, cmd, true ); + break; + case 4: //command + m_part->appFrontend()->startAppCommand(m_part->buildDirectory() + relpath, + cmd, false); + break; + case 5: //command as root + m_part->appFrontend()->startAppCommand(m_part->buildDirectory() + relpath, + "kdesu -t -c ' cd " + + KProcess::quote(m_part->buildDirectory() + relpath) + " && " + + cmd + "'", false); + break; + } +} + +void AutoSubprojectView::slotExpandTree() +{ + expandCollapseFirst( m_listView->currentItem(), true ); +} + +void AutoSubprojectView::slotCollapseTree() +{ + expandCollapseFirst( m_listView->currentItem(), false ); +} + +void AutoSubprojectView::expandCollapseFirst( QListViewItem * item, bool expand ) +{ + if ( !item ) return; + + if ( item == m_listView->firstChild() ) // special case for root node + { + item = item->firstChild(); + while ( item ) + { + expandCollapse( item, expand ); + item = item->nextSibling(); + } + } + else + { + expandCollapse( item, expand ); + } +} + +void AutoSubprojectView::expandCollapse( QListViewItem * item, bool expand ) +{ + if ( !item ) return; + + item->setOpen( expand ); + + item = item->firstChild(); + while ( item ) + { + expandCollapse( item, expand ); + item = item->nextSibling(); + } +} + +#include "autosubprojectview.moc" + +// kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/buildtools/autotools/autosubprojectview.h b/buildtools/autotools/autosubprojectview.h new file mode 100644 index 00000000..e49caddd --- /dev/null +++ b/buildtools/autotools/autosubprojectview.h @@ -0,0 +1,130 @@ +/* + KDevelop Autotools Support + Copyright (c) 2002 by Victor Roeder + Copyright (c) 2005 by Matt Rogers + +*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +*/ + +#ifndef AUTOSUBPROJECTVIEW_H +#define AUTOSUBPROJECTVIEW_H + +#include +#include "autoprojectviewbase.h" + + +class KAction; +class AutoToolsAction; +class AutoProjectWidget; +class AutoProjectPart; +class TargetItem; +class SubprojectItem; +class KListViewItem; +class KListView; + +namespace AutoProjectPrivate +{ + bool isHeader( const QString& fileName ); +} + + +//with protected inheritance gcc 3.2.3 complains in autoprojectwidget.cpp, line 116 +//that it cannot access the base class QObject (for the connect() call), +//so in order to be able to compile this file I made the inheritance public again, Alex +class AutoSubprojectView : public AutoProjectViewBase +{ + Q_OBJECT + +public: + AutoSubprojectView( AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name ); + virtual ~AutoSubprojectView(); + +public: + void loadMakefileams ( const QString& dir ); + + void parse( SubprojectItem *item ); + KListView* listView() const + { + return m_listView; + } + + TargetItem *findNoinstHeaders( SubprojectItem *item ); + +signals: + void selectionChanged( QListViewItem* ); + +protected: + void initActions (); + + void parseKDEDOCS( SubprojectItem *item, + const QString &lhs, const QString &rhs ); + void parseKDEICON( SubprojectItem *item, + const QString &lhs, const QString &rhs ); + void parsePrimary( SubprojectItem *item, + const QString &lhs, const QString &rhs ); + void parsePrefix( SubprojectItem *item, + const QString &lhs, const QString &rhs ); + void parseSUBDIRS( SubprojectItem *item, + const QString &lhs, const QString &rhs ); + virtual void focusOutEvent( QFocusEvent *e ); + void expandCollapse( QListViewItem * item, bool expand ); + void expandCollapseFirst( QListViewItem * item, bool expand ); + +private: + AutoProjectWidget* m_widget; + AutoProjectPart* m_part; + QStringList headers; + + bool m_kdeMode; + + AutoToolsAction* addApplicationAction; + AutoToolsAction* subProjectOptionsAction; + AutoToolsAction* addSubprojectAction; + KAction* addExistingSubprojectAction; + AutoToolsAction* addTargetAction; + AutoToolsAction* addServiceAction; + AutoToolsAction* buildSubprojectAction; + KAction* removeSubprojectAction; + KAction* cleanSubprojectAction; + KAction* forceReeditSubprojectAction; + KAction* installSubprojectAction; + KAction* installSuSubprojectAction; + KAction* otherAction; + KAction* expandAction; + KAction* collapseAction; + + QStringList m_commandList; + QValueList m_commandTypeList; + +private slots: + void slotContextMenu( KListView *, QListViewItem *item, const QPoint &p ); + //void slotSubprojectExecuted(QListViewItem* item); + void slotSelectionChanged( QListViewItem* item ); + void slotAddApplication(); + void slotSubprojectOptions(); + void slotAddSubproject(); + void slotAddExistingSubproject(); + void slotAddTarget(); + void slotAddService(); + void slotBuildSubproject(); + void slotRemoveSubproject(); + void slotForceReeditSubproject(); + void slotInstallSubproject(); + void slotInstallSuSubproject(); + void slotCleanSubproject(); + void slotManageBuildCommands(); + void slotCustomBuildCommand( int ); + void slotExpandTree(); + void slotCollapseTree(); +}; + +#endif + +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/autotoolsaction.cpp b/buildtools/autotools/autotoolsaction.cpp new file mode 100644 index 00000000..63b38762 --- /dev/null +++ b/buildtools/autotools/autotoolsaction.cpp @@ -0,0 +1,156 @@ +/* + KDevelop Autotools Support + Copyright (c) 2005 by Matt Rogers + + *************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + *************************************************************************** +*/ +#include "autotoolsaction.h" + +#include +#include +#include +#include +#include +#include + +AutoToolsAction::~AutoToolsAction() +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ) +: KAction( text, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ) +: KAction( text, pix, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ) +: KAction( text, pix, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const KGuiItem& item, const KShortcut & cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ) +: KAction( item, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const KShortcut& cut, + QObject* parent, const char* name ) +: KAction( text, cut, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const KShortcut& cut, + const QObject* receiver, const char* slot, + QObject* parent, const char* name ) +: KAction( text, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const QIconSet& pix, + const KShortcut& cut, QObject* parent, const char* name ) +: KAction( text, pix, cut, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const QString& pix, + const KShortcut& cut, QObject* parent, const char* name ) +: KAction( text, pix, cut, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const QIconSet& pix, + const KShortcut& cut, const QObject* receiver, + const char* slot, QObject* parent, const char * name ) +: KAction( text, pix, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( const QString& text, const QString& pix, + const KShortcut & cut, const QObject* receiver, + const char* slot, QObject* parent, const char * name ) +: KAction( text, pix, cut, receiver, slot, parent, name ) +{ +} + +AutoToolsAction::AutoToolsAction( QObject * parent, const char * name ) +: KAction( parent, name ) +{ +} + +int AutoToolsAction::plug( QWidget* w, int index ) +{ + if ( !w ) { + kdWarning(129) << "KAction::plug called with 0 argument\n"; + return -1; + } + + // Check if action is permitted + if (kapp && !kapp->authorizeKAction(name())) + return -1; + + if ( ::qt_cast( w ) ) + { + QToolButton* tb = static_cast( w ); + connect( tb, SIGNAL( clicked() ), this, SLOT( activate() ) ); + int id = getToolButtonID(); + + if ( !icon().isEmpty() ) + tb->setPixmap( SmallIcon( icon() ) ); + else + tb->setText( text() ); + + if ( !isEnabled() ) + tb->setEnabled( false ); + + if ( !whatsThis().isEmpty() ) + { + QWhatsThis::remove( tb ); + QWhatsThis::add( tb, whatsThisWithIcon() ); + } + + if ( !toolTip().isEmpty() ) + { + QToolTip::remove( tb ); + QToolTip::add( tb, toolTip() ); + } + + addContainer( tb, id ); + + return containerCount() - 1; + } + + return KAction::plug( w, index ); +} + +void AutoToolsAction::updateEnabled( int i ) +{ + QWidget* w = container( i ); + + if ( ::qt_cast( w ) ) + static_cast( w )->setEnabled( isEnabled() ); + else + KAction::updateEnabled( i ) ; +} + + + +//kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/autotoolsaction.h b/buildtools/autotools/autotoolsaction.h new file mode 100644 index 00000000..97c8e79e --- /dev/null +++ b/buildtools/autotools/autotoolsaction.h @@ -0,0 +1,70 @@ +/* + KDevelop Autotools Support + Copyright (c) 2005 by Matt Rogers + +*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +*/ +#ifndef AUTOTOOLSACTION_H +#define AUTOTOOLSACTION_H + +#include +#include + +class QObject; +class KActionCollection; + +/** + * A KAction derivative that will work with the QToolButtons used in + * the Automake Manager + * @author Matt Rogers + */ +class AutoToolsAction : public KAction +{ +public: + virtual ~AutoToolsAction(); + + AutoToolsAction( const QString& text, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ); + + AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ); + + AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ); + + AutoToolsAction( const KGuiItem& item, const KShortcut& cut, + const QObject* receiver, const char* slot, + KActionCollection* parent, const char* name ); + + AutoToolsAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); + AutoToolsAction( const QString& text, const KShortcut& cut, + const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); + AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + QObject* parent = 0, const char* name = 0 ); + AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), + QObject* parent = 0, const char* name = 0 ); + AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); + AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut, + const QObject* receiver, const char* slot, QObject* parent, + const char* name = 0 ); + AutoToolsAction( QObject* parent = 0, const char* name = 0 ); + + virtual int plug( QWidget *widget, int index = -1 ); + + virtual void updateEnabled( int i ); +}; + +#endif + +//kate: indent-mode csands; tab-width 4; auto-insert-doxygen on; diff --git a/buildtools/autotools/choosetargetdialog.cpp b/buildtools/autotools/choosetargetdialog.cpp new file mode 100644 index 00000000..b35c5c75 --- /dev/null +++ b/buildtools/autotools/choosetargetdialog.cpp @@ -0,0 +1,348 @@ +/*************************************************************************** + ------------------- + begin : 29.11.2002 + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "choosetargetdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "choosetargetdlgbase.h" +#include "autodetailsview.h" +#include "autolistviewitems.h" +#include "autosubprojectview.h" +#include "misc.h" +#include "autoprojectwidget.h" +#include "autoprojectpart.h" + +#include "kdevpartcontroller.h" + +class ChooseTargetDialog::Private +{ +public: + AutoProjectWidget* widget; + AutoProjectPart* part; + QStringList fileList; + QPtrList subprojectList; + SubprojectItem* chosenSubproject; + TargetItem* chosenTarget; + ChooseTargetDlgBase* baseUI; +}; + +ChooseTargetDialog::ChooseTargetDialog ( AutoProjectWidget* widget, AutoProjectPart* part, + QStringList fileList, QWidget* parent, const char* name ) +: KDialogBase( parent, name, false, i18n("Automake Manager - Choose Target"), + Ok | Cancel, KDialogBase::Ok, true /* seperator */ ) + +{ + Q_UNUSED( parent ); + Q_UNUSED( name ); + d = new ChooseTargetDialog::Private; + d->widget = widget; + d->part = part; + d->fileList = fileList; + d->subprojectList = widget->allSubprojectItems(); + d->baseUI = new ChooseTargetDlgBase( this, "base ui" ); + setMainWidget( d->baseUI ); + + d->baseUI->subprojectComboBox->setAutoCompletion( true ); + d->baseUI->targetComboBox->setAutoCompletion( true ); + d->baseUI->newFileList->header()->hide(); + d->baseUI->newFileList->addColumn( QString::null ); + d->baseUI->newFileList->setSorting(-1); + + setIcon ( SmallIcon ( "target_kdevelop" ) ); + + + QPtrListIterator sit(d->subprojectList); + for ( ; (*sit); ++sit ) + { + QPtrList targetList = (*sit)->targets; + QPtrListIterator targetIt(targetList); + + // Only insert Subproject which have a "regular" target + for ( ; (*targetIt); ++targetIt ) + { + QString titemPrimary = (*targetIt)->primary; + if ( titemPrimary == "PROGRAMS" || titemPrimary == "LIBRARIES" || + titemPrimary == "LTLIBRARIES" || titemPrimary == "JAVA" ) + { + d->baseUI->subprojectComboBox->insertItem ( SmallIcon ( "folder" ), (*sit)->subdir ); + } + } + } + + if ( d->widget->activeTarget() && d->widget->activeSubproject() ) + { + d->chosenTarget = d->widget->activeTarget(); + //kdDebug ( 9020 ) << "1) Chosen target is " << d->chosenTarget->name << endl; + d->chosenSubproject = widget->activeSubproject(); + d->baseUI->chosenTargetLabel->setText( ( widget->activeSubproject()->path + "/" + + d->widget->activeTarget()->name + "" ) + .mid( d->part->projectDirectory().length() + 1 ) ); + d->baseUI->subprojectComboBox->setEnabled( false ); + d->baseUI->targetComboBox->setEnabled( false ); + + d->baseUI->subprojectComboBox->setCurrentItem( widget->activeSubproject()->subdir ); + slotSubprojectChanged( widget->activeSubproject()->subdir ); + } + else + { + d->baseUI->activeTargetRadioButton->toggle(); + d->baseUI->activeTargetRadioButton->setEnabled ( false ); + d->baseUI->neverAskAgainCheckbox->setEnabled ( false ); + + slotSubprojectChanged ( d->baseUI->subprojectComboBox->text(0) ); + } + + QStringList::iterator it; + QString fileName; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + int pos = ( *it ).findRev('/'); + if (pos != -1) + fileName = ( *it ).mid(pos+1); + else + fileName = ( *it ); + + + d->baseUI->newFileList->insertItem( new QListViewItem( d->baseUI->newFileList, fileName ) ); + } + + connect ( d->baseUI->subprojectComboBox, SIGNAL ( activated ( const QString& ) ), + this, SLOT( slotSubprojectChanged ( const QString& ) ) ); + connect ( d->baseUI->targetComboBox, SIGNAL ( activated ( const QString& ) ), + this, SLOT( slotTargetChanged ( const QString& ) ) ); +} + + +ChooseTargetDialog::~ChooseTargetDialog() +{ +} + +void ChooseTargetDialog::slotSubprojectChanged ( const QString& name ) +{ + d->chosenTarget = 0; + SubprojectItem* spitem = d->subprojectList.first(); + + for ( ; spitem; spitem = d->subprojectList.next() ) + { + if ( spitem->subdir == name ) + { + QPtrList targetList = spitem->targets; + TargetItem* titem = targetList.first(); + + d->baseUI->targetComboBox->clear(); + +/* choosenSubprojectLabel->setText ( ( spitem->path + "" + ->name + "" ).mid ( d->widget->projectDirectory().length() + 1 ) );*/ + + d->chosenSubproject = spitem; + + for ( ; titem; titem = targetList.next() ) + { + if ( titem->primary == "PROGRAMS" || titem->primary == "LIBRARIES" || + titem->primary == "LTLIBRARIES" || titem->primary == "JAVA" ) + { + d->baseUI->targetComboBox->insertItem ( SmallIcon ( "target_kdevelop" ), titem->name ); + + //d->baseUI->targetComboBox->addToHistory ( titem->name ); + + // if the Active Target is in the currently selected Subproject + if ( d->widget->activeTarget() && + titem->name == d->widget->activeTarget()->name ) + { + d->baseUI->targetComboBox->setCurrentItem( titem->name ); + d->baseUI->chosenTargetLabel->setText( ( spitem->path + "/" + titem->name + "" ).mid( d->part->projectDirectory().length() + 1 ) ); + d->chosenTarget = titem; + //kdDebug ( 9020 ) << "2) Chosen target is " << d->chosenTarget->name << endl; + } + else + { + //d->baseUI->targetComboBox->setCurrentItem ( 0 ); + if ( !d->chosenTarget ) + { + d->baseUI->chosenTargetLabel->setText( ( spitem->path + "/" + titem->name + "") + .mid( d->part->projectDirectory().length() + 1 ) ); + //choosenSubprojectLabel->setText ( ( spitem->path + "" + titem->name + "" ).mid ( d->widget->projectDirectory().length() + 1 ) ); + + d->chosenTarget = titem; + } + //kdDebug ( 9020 ) << "2a) Chosen target is " << d->chosenTarget->name << endl; + } + } + } + + break; + } + } +} + +void ChooseTargetDialog::slotTargetChanged( const QString& name ) +{ + d->baseUI->chosenTargetLabel->setText( ( d->chosenSubproject->path + "/" + name + "" ) + .mid( d->part->projectDirectory().length() + 1 ) ); + + QPtrList targetList = d->chosenSubproject->targets; + TargetItem* titem = targetList.first(); + + for ( ; titem; titem = targetList.next() ) + { + if ( titem->name == name ) + { + d->chosenTarget = titem; + //kdDebug ( 9020 ) << "4) Chosen target is " << d->chosenTarget->name << endl; + + break; + } + } +} + +void ChooseTargetDialog::slotOk() +{ + if ( d->baseUI->activeTargetRadioButton->isChecked() ) + { + d->chosenTarget = d->widget->activeTarget(); + d->chosenSubproject = d->widget->activeSubproject(); + } + if ( !d->chosenSubproject || !d->chosenTarget ) + return; + + //kdDebug ( 9020 ) << "3) Chosen target is " << d->chosenTarget->name << endl; + + QStringList newFileList; + QStringList::iterator it; + QString directory, fileName; + + for ( it = d->fileList.begin(); it != d->fileList.end(); ++it ) + { + bool found = false; + + int pos = ( *it ).findRev('/'); + if (pos != -1) + { + directory = ( *it ).left(pos); + fileName = ( *it ).mid(pos+1); + } + else + { + fileName = ( *it ); + } + + FileItem * fitem = d->chosenTarget->sources.first(); + for ( ; fitem; fitem = d->chosenTarget->sources.next() ) + { + if ( fitem->name == fileName ) + { + KMessageBox::error ( this, i18n ( "The file %1 already exists in the chosen target.\nThe file will be created but will not be added to the target.\n" + "Rename the file and select 'Add Existing Files' from the Automake Manager." ).arg ( fitem->name ), + i18n ( "Error While Adding Files" ) ); + found = true; + } + } + + if ( !found ) + { + /// \FIXME a quick hack to prevent adding header files to _SOURCES + /// and display them in noinst_HEADERS + if (AutoProjectPrivate::isHeader(fileName) && + ( d->chosenTarget->primary == "PROGRAMS" || d->chosenTarget->primary == "LIBRARIES" || d->chosenTarget->primary == "LTLIBRARIES" ) ) + { + kdDebug ( 9020 ) << "Ignoring header file and adding it to noinst_HEADERS: " << fileName << endl; + TargetItem* noinst_HEADERS_item = d->widget->getSubprojectView()->findNoinstHeaders(d->chosenSubproject); + FileItem *fitem = d->widget->createFileItem( fileName, d->chosenSubproject ); + noinst_HEADERS_item->sources.append( fitem ); + noinst_HEADERS_item->insertItem( fitem ); + + QString varname = "noinst_HEADERS"; + d->chosenSubproject->variables[ varname ] += ( " " + fileName ); + + QMap replaceMap; + replaceMap.insert( varname, d->chosenSubproject->variables[ varname ] ); + + AutoProjectTool::addToMakefileam( d->chosenSubproject->path + "/Makefile.am", replaceMap ); + } + else + { + fitem = d->widget->createFileItem( fileName,d->chosenSubproject ); + d->chosenTarget->sources.append( fitem ); + d->chosenTarget->insertItem( fitem ); + + QString canontargetname = AutoProjectTool::canonicalize( d->chosenTarget->name ); + QString varname = canontargetname + "_SOURCES"; + d->chosenSubproject->variables[ varname ] += ( " " + fileName ); + + QMap replaceMap; + replaceMap.insert( varname, d->chosenSubproject->variables[ varname ] ); + + AutoProjectTool::addToMakefileam( d->chosenSubproject->path + "/Makefile.am", replaceMap ); + } + newFileList.append ( d->chosenSubproject->path.mid ( d->part->projectDirectory().length() + 1 ) + "/" + fileName ); + } + + if ( directory.isEmpty() || directory != d->chosenSubproject->subdir ) + { + KShellProcess proc("/bin/sh"); + + proc << "mv"; + proc << KShellProcess::quote( d->part->projectDirectory() + "/" + directory + "/" + fileName ); + proc << KShellProcess::quote( d->chosenSubproject->path + "/" + fileName ); + proc.start(KProcess::DontCare); + } + + // why open the files?! +// d->part->partController()->editDocument ( KURL ( d->chosenSubproject->path + "/" + fileName ) ); + + found = false; + } + + d->widget->emitAddedFiles( newFileList ); + KDialogBase::slotOk(); +} + +TargetItem* ChooseTargetDialog::chosenTarget() +{ + return d->chosenTarget; +} + +SubprojectItem* ChooseTargetDialog::chosenSubproject() +{ + return d->chosenSubproject; +} + +bool ChooseTargetDialog::alwaysUseActiveTarget() const +{ + return d->baseUI->neverAskAgainCheckbox->isChecked(); +} + + +#include "choosetargetdialog.moc" +//kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/choosetargetdialog.h b/buildtools/autotools/choosetargetdialog.h new file mode 100644 index 00000000..44825ce5 --- /dev/null +++ b/buildtools/autotools/choosetargetdialog.h @@ -0,0 +1,57 @@ +/*************************************************************************** + ------------------- + begin : 29.11.2002 + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _CHOOSETARGETDIALOG_H_ +#define _CHOOSETARGETDIALOG_H_ + +#include + +class AutoProjectWidget; +class AutoProjectPart; +class SubprojectItem; +class TargetItem; +class QStringList; +class QWidget; + +class ChooseTargetDialog : public KDialogBase +{ +Q_OBJECT +public: + ChooseTargetDialog( AutoProjectWidget* widget, AutoProjectPart* part, + QStringList fileList, QWidget* parent = 0, + const char* name = 0 ); + ~ChooseTargetDialog(); + +public: + TargetItem* chosenTarget(); + SubprojectItem* chosenSubproject(); + + bool alwaysUseActiveTarget() const; + +public slots: + void slotSubprojectChanged ( const QString& ); + void slotTargetChanged ( const QString& ); + +protected: + virtual void slotOk(); + +private: + class Private; + ChooseTargetDialog::Private* d; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/choosetargetdlgbase.ui b/buildtools/autotools/choosetargetdlgbase.ui new file mode 100644 index 00000000..3581e595 --- /dev/null +++ b/buildtools/autotools/choosetargetdlgbase.ui @@ -0,0 +1,222 @@ + +ChooseTargetDlgBase + + + ChooseTargetDlgBase + + + + 0 + 0 + 444 + 306 + + + + + 444 + 306 + + + + Automake Manager - Choose Target + + + + unnamed + + + + buttonGroup1 + + + NoFrame + + + Plain + + + 1 + + + + + + false + + + + unnamed + + + 0 + + + + activeTargetRadioButton + + + Add new files to m&y active target + + + true + + + + + chooseTargetRadioButton + + + Choose &another target + + + + + + + chosenTargetGroupBox + + + false + + + Choose &Target + + + + unnamed + + + + subprojectComboBox + + + false + + + + + targetComboBox + + + true + + + + + targetStaticLabel + + + + + + + Target: + + + + + chosenTargetLabel + + + + 7 + 5 + 0 + 0 + + + + [TARGET] + + + + + + + groupBox1 + + + &New Files + + + + unnamed + + + + newFileList + + + true + + + + + cancelNoticeLabel + + + <qt><b>Note:</b> If you cancel, your files will be created but will <b>not</b> be added to the project.</qt> + + + AlignVCenter + + + + + + + neverAskAgainCheckbox + + + Do &not ask me again and use always my active target + + + + + + + activeTargetRadioButton + toggled(bool) + chosenTargetGroupBox + setDisabled(bool) + + + activeTargetRadioButton + toggled(bool) + subprojectComboBox + setDisabled(bool) + + + activeTargetRadioButton + toggled(bool) + targetComboBox + setDisabled(bool) + + + + activeTargetRadioButton + chooseTargetRadioButton + subprojectComboBox + targetComboBox + newFileList + neverAskAgainCheckbox + + + kdialog.h + + + slotActiveTargetToggled(bool) + slotChooseTargetToggled(bool) + slotSubprojectChanged(const QString&) + slotTargetChanged(const QString&) + + + + kcombobox.h + klineedit.h + kcombobox.h + klineedit.h + klistview.h + + diff --git a/buildtools/autotools/configureoptionswidget.cpp b/buildtools/autotools/configureoptionswidget.cpp new file mode 100644 index 00000000..7e2db214 --- /dev/null +++ b/buildtools/autotools/configureoptionswidget.cpp @@ -0,0 +1,431 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "configureoptionswidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kdevcompileroptions.h" +#include "autoprojectpart.h" +#include "environmentvariableswidget.h" + + +class ServiceComboBox +{ +public: + static void insertStringList(QComboBox *combo, const QValueList &list, + QStringList *names, QStringList *execs) + { + QValueList::ConstIterator it; + for (it = list.begin(); it != list.end(); ++it) { + combo->insertItem((*it)->comment()); + (*names) << (*it)->desktopEntryName(); + (*execs) << (*it)->exec(); + kdDebug(9020) << "insertStringList item " << (*it)->name() << "," << (*it)->exec() << endl; + } + } + static QString currentText(QComboBox *combo, const QStringList &names) + { + if (combo->currentItem() == -1) + return QString::null; + return names[combo->currentItem()]; + } + static void setCurrentText(QComboBox *combo, const QString &str, const QStringList &names) + { + QStringList::ConstIterator it; + int i = 0; + for (it = names.begin(); it != names.end(); ++it) { + if (*it == str) { + combo->setCurrentItem(i); + break; + } + ++i; + } + } +}; + + +ConfigureOptionsWidget::ConfigureOptionsWidget(AutoProjectPart *part, QWidget *parent, const char *name) + : ConfigureOptionsWidgetBase(parent, name) +{ + config_combo->setValidator(new QRegExpValidator(QRegExp("^\\D.*"), this)); + + m_part = part; + env_groupBox->setColumnLayout( 1, Qt::Vertical ); + QDomDocument &dom = *part->projectDom(); + m_environmentVariablesWidget = new EnvironmentVariablesWidget(dom, "/kdevautoproject/general/envvars", env_groupBox); + + coffers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'C'"); + cxxoffers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'C++'"); + f77offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Fortran'"); + + ServiceComboBox::insertStringList(cservice_combo, coffers, &cservice_names, &cservice_execs); + ServiceComboBox::insertStringList(cxxservice_combo, cxxoffers, &cxxservice_names, &cxxservice_execs); + ServiceComboBox::insertStringList(f77service_combo, f77offers, &f77service_names, &f77service_execs); + + if (coffers.isEmpty()) + cflags_button->setEnabled(false); + if (cxxoffers.isEmpty()) + cxxflags_button->setEnabled(false); + if (f77offers.isEmpty()) + f77flags_button->setEnabled(false); + + allConfigs = part->allBuildConfigs(); + config_combo->insertStringList(allConfigs); + + dirty = false; + currentConfig = QString::null; + configChanged(part->currentBuildConfig()); + + fixLayout(); +} + + +ConfigureOptionsWidget::~ConfigureOptionsWidget() +{} + + +void ConfigureOptionsWidget::fixLayout() +{ + int w1 = ccompiler_label->sizeHint().width(); + int w2 = cbinary_label->sizeHint().width(); + int w3 = cflags_label->sizeHint().width(); + int w4 = cxxcompiler_label->sizeHint().width(); + int w5 = cxxbinary_label->sizeHint().width(); + int w6 = cxxflags_label->sizeHint().width(); + int w7 = f77compiler_label->sizeHint().width(); + int w8 = f77binary_label->sizeHint().width(); + int w9 = f77flags_label->sizeHint().width(); + + int w = QMAX(w1, QMAX(w2, w3)); + w = QMAX(w, QMAX(w4, w5)); + w = QMAX(w, QMAX(w6, w7)); + w = QMAX(w, QMAX(w8, w9)); + + ccompiler_label->setMinimumWidth(w); + cxxcompiler_label->setMinimumWidth(w); + f77compiler_label->setMinimumWidth(w); +} + + +void ConfigureOptionsWidget::readSettings(const QString &config) +{ + QDomDocument dom = *m_part->projectDom(); + QString prefix = "/kdevautoproject/configurations/" + config + "/"; + kdDebug(9020) << "Reading config from " << prefix << endl; + + configargs_edit->setText(DomUtil::readEntry(dom, prefix + "configargs")); + QString builddir = DomUtil::readEntry(dom, prefix + "builddir"); + if (builddir.isEmpty() && config != "default") + builddir = config; + builddir_edit->setText(builddir); + + topsourcedir_edit->setText(DomUtil::readEntry(dom, prefix + "topsourcedir")); + + cppflags_edit->setText(DomUtil::readEntry(dom, prefix + "cppflags")); + ldflags_edit->setText(DomUtil::readEntry(dom, prefix + "ldflags")); + + QString ccompiler = DomUtil::readEntry(dom, prefix + "ccompiler"); + QString cxxcompiler = DomUtil::readEntry(dom, prefix + "cxxcompiler"); + QString f77compiler = DomUtil::readEntry(dom, prefix + "f77compiler"); + + if (ccompiler.isEmpty()) { + kdDebug(9020) << "No c compiler set" << endl; + QValueList::ConstIterator it; + for (it = coffers.begin(); it != coffers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + kdDebug(9020) << "Found default " << (*it)->name() << endl; + ccompiler = (*it)->name(); + break; + } + } + } + if (cxxcompiler.isEmpty()) { + kdDebug(9020) << "No cxx compiler set" << endl; + QValueList::ConstIterator it; + for (it = cxxoffers.begin(); it != cxxoffers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + kdDebug(9020) << "Found default " << (*it)->name() << endl; + cxxcompiler = (*it)->name(); + break; + } + } + } + if (f77compiler.isEmpty()) { + kdDebug(9020) << "No c compiler set" << endl; + QValueList::ConstIterator it; + for (it = f77offers.begin(); it != f77offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + kdDebug(9020) << "Found default " << (*it)->name() << endl; + f77compiler = (*it)->name(); + break; + } + } + } + + ServiceComboBox::setCurrentText(cservice_combo, ccompiler, cservice_names); + ServiceComboBox::setCurrentText(cxxservice_combo, cxxcompiler, cxxservice_names); + ServiceComboBox::setCurrentText(f77service_combo, f77compiler, f77service_names); + + cbinary_edit->setText(DomUtil::readEntry(dom, prefix + "ccompilerbinary")); + cxxbinary_edit->setText(DomUtil::readEntry(dom, prefix + "cxxcompilerbinary")); + f77binary_edit->setText(DomUtil::readEntry(dom, prefix + "f77compilerbinary")); + + cflags_edit->setText(DomUtil::readEntry(dom, prefix + "cflags")); + cxxflags_edit->setText(DomUtil::readEntry(dom, prefix + "cxxflags")); + f77flags_edit->setText(DomUtil::readEntry(dom, prefix + "f77flags")); + + m_environmentVariablesWidget->readEnvironment(dom, prefix + "envvars"); +} + + +void ConfigureOptionsWidget::saveSettings(const QString &config) +{ + m_environmentVariablesWidget->accept(); + QDomDocument dom = *m_part->projectDom(); + QString prefix = "/kdevautoproject/configurations/" + config + "/"; + kdDebug(9020) << "Saving config under " << prefix << endl; + + DomUtil::writeEntry(dom, prefix + "configargs", configargs_edit->text()); + DomUtil::writeEntry(dom, prefix + "builddir", builddir_edit->text()); + DomUtil::writeEntry(dom, prefix + "topsourcedir", topsourcedir_edit->text()); + + DomUtil::writeEntry(dom, prefix + "cppflags", cppflags_edit->text()); + DomUtil::writeEntry(dom, prefix + "ldflags", ldflags_edit->text()); + + QFileInfo fi(m_part->buildDirectory()); + QDir dir(fi.dir()); + dir.mkdir(fi.fileName()); + + DomUtil::writeEntry(dom, prefix + "ccompiler", + ServiceComboBox::currentText(cservice_combo, cservice_names)); + DomUtil::writeEntry(dom, prefix + "cxxcompiler", + ServiceComboBox::currentText(cxxservice_combo, cxxservice_names)); + DomUtil::writeEntry(dom, prefix + "f77compiler", + ServiceComboBox::currentText(f77service_combo, f77service_names)); + + DomUtil::writeEntry(dom, prefix + "ccompilerbinary", cbinary_edit->text()); + DomUtil::writeEntry(dom, prefix + "cxxcompilerbinary", cxxbinary_edit->text()); + DomUtil::writeEntry(dom, prefix + "f77compilerbinary", f77binary_edit->text()); + + DomUtil::writeEntry(dom, prefix + "cflags", cflags_edit->text()); + DomUtil::writeEntry(dom, prefix + "cxxflags", cxxflags_edit->text()); + DomUtil::writeEntry(dom, prefix + "f77flags", f77flags_edit->text()); + + if (KMessageBox::questionYesNo(this, i18n("Re-run configure for %1 now?").arg(config), QString::null, i18n("Rerun"), i18n("Do Not Run")) == KMessageBox::Yes) + QTimer::singleShot(0, m_part, SLOT(slotConfigure())); + +} + + +void ConfigureOptionsWidget::setDirty() +{ + kdDebug(9020) << "config dirty" << endl; + dirty = true; +} + + +void ConfigureOptionsWidget::builddirClicked() +{ + QString dir = builddir_edit->text(); + dir = KFileDialog::getExistingDirectory(dir, this); + if (!dir.isNull()) + builddir_edit->setText(dir); +} + +void ConfigureOptionsWidget::topsourcedirClicked() +{ + QString dir = topsourcedir_edit->text(); + dir = KFileDialog::getExistingDirectory(dir, this); + if (!dir.isNull()) + topsourcedir_edit->setText(dir); +} + +void ConfigureOptionsWidget::configComboTextChanged(const QString &config) +{ + bool canAdd = !allConfigs.contains(config) && !config.contains("/") && !config.isEmpty(); + bool canRemove = allConfigs.contains(config) && config != "default"; + addconfig_button->setEnabled(canAdd); + removeconfig_button->setEnabled(canRemove); +} + + +void ConfigureOptionsWidget::configChanged(const QString &config) +{ + if (config == currentConfig || !allConfigs.contains(config)) + return; + + if (!currentConfig.isNull() && dirty) + saveSettings(currentConfig); + + currentConfig = config; + readSettings(config); + dirty = false; + + config_combo->blockSignals(true); + config_combo->setEditText(config); + config_combo->blockSignals(false); +} + + +void ConfigureOptionsWidget::configAdded() +{ + QString config = config_combo->currentText(); + + allConfigs.append(config); + + config_combo->clear(); + config_combo->insertStringList(allConfigs); + configChanged(config); + setDirty(); // force saving +} + + +void ConfigureOptionsWidget::configRemoved() +{ + QString config = config_combo->currentText(); + + QDomDocument dom = *m_part->projectDom(); + QDomNode node = dom.documentElement().namedItem("kdevautoproject").namedItem("configurations"); + node.removeChild(node.namedItem(config)); + allConfigs.remove(config); + + config_combo->clear(); + config_combo->insertStringList(allConfigs); + + currentConfig = QString::null; + configChanged("default"); +} + + +void ConfigureOptionsWidget::cserviceChanged() +{ + QString exec = ServiceComboBox::currentText(cservice_combo, cservice_execs); + cbinary_edit->setText(exec); + kdDebug(9020) << "exec: " << exec << endl; +} + + +void ConfigureOptionsWidget::cxxserviceChanged() +{ + QString exec = ServiceComboBox::currentText(cxxservice_combo, cxxservice_execs); + cxxbinary_edit->setText(exec); +} + + +void ConfigureOptionsWidget::f77serviceChanged() +{ + QString exec = ServiceComboBox::currentText(f77service_combo, f77service_execs); + f77binary_edit->setText(exec); + kdDebug(9020) << "exec: " << exec << endl; +} + + +void ConfigureOptionsWidget::cflagsClicked() +{ + QString name = ServiceComboBox::currentText(cservice_combo, cservice_names); + KDevCompilerOptions *plugin = createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, cflags_edit->text()); + cflags_edit->setText(flags); + delete plugin; + } +} + + +void ConfigureOptionsWidget::cxxflagsClicked() +{ + QString name = ServiceComboBox::currentText(cxxservice_combo, cxxservice_names); + KDevCompilerOptions *plugin = createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, cxxflags_edit->text()); + cxxflags_edit->setText(flags); + delete plugin; + } +} + + +void ConfigureOptionsWidget::f77flagsClicked() +{ + QString name = ServiceComboBox::currentText(f77service_combo, f77service_names); + KDevCompilerOptions *plugin = createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, f77flags_edit->text()); + f77flags_edit->setText(flags); + delete plugin; + } +} + + +KDevCompilerOptions *ConfigureOptionsWidget::createCompilerOptions(const QString &name) +{ + KService::Ptr service = KService::serviceByDesktopName(name); + if (!service) { + kdDebug(9020) << "Can't find service " << name; + return 0; + } + + KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library())); + if (!factory) { + QString errorMessage = KLibLoader::self()->lastErrorMessage(); + KMessageBox::error(0, i18n("There was an error loading the module %1.\n" + "The diagnostics is:\n%2").arg(service->name()).arg(errorMessage)); + exit(1); + } + + QStringList args; + QVariant prop = service->property("X-KDevelop-Args"); + if (prop.isValid()) + args = QStringList::split(" ", prop.toString()); + + QObject *obj = factory->create(this, service->name().latin1(), + "KDevCompilerOptions", args); + + if (!obj->inherits("KDevCompilerOptions")) { + kdDebug(9020) << "Component does not inherit KDevCompilerOptions" << endl; + return 0; + } + KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj; + + return dlg; +} + + +void ConfigureOptionsWidget::accept() +{ + DomUtil::writeEntry(*m_part->projectDom(), "/kdevautoproject/general/useconfiguration", currentConfig); + m_environmentVariablesWidget->accept(); + if (dirty) + { + saveSettings(currentConfig); + } +} + +#include "configureoptionswidget.moc" diff --git a/buildtools/autotools/configureoptionswidget.h b/buildtools/autotools/configureoptionswidget.h new file mode 100644 index 00000000..a973ce7d --- /dev/null +++ b/buildtools/autotools/configureoptionswidget.h @@ -0,0 +1,69 @@ +/*************************************************************************** +* Copyright (C) 2001-2002 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _CONFIGUREOPTIONSWIDGET_H_ +#define _CONFIGUREOPTIONSWIDGET_H_ + +#include "configureoptionswidgetbase.h" + +#include +#include "domutil.h" + + +class KDevCompilerOptions; +class AutoProjectPart; +class EnvironmentVariablesWidget; + +class ConfigureOptionsWidget : public ConfigureOptionsWidgetBase +{ + Q_OBJECT + +public: + ConfigureOptionsWidget( AutoProjectPart *part, QWidget *parent = 0, const char *name = 0 ); + ~ConfigureOptionsWidget(); + +public slots: + void accept(); + +private: + virtual void builddirClicked(); + virtual void topsourcedirClicked(); + virtual void setDirty(); + virtual void configChanged( const QString &config ); + virtual void configComboTextChanged( const QString &config ); + virtual void configAdded(); + virtual void configRemoved(); + virtual void cflagsClicked(); + virtual void cxxflagsClicked(); + virtual void f77flagsClicked(); + virtual void cserviceChanged(); + virtual void cxxserviceChanged(); + virtual void f77serviceChanged(); + + void fixLayout(); + void readSettings( const QString &config ); + void saveSettings( const QString &config ); + + KDevCompilerOptions *createCompilerOptions( const QString &lang ); + KTrader::OfferList coffers, cxxoffers, f77offers; + QStringList cservice_names, cservice_execs; + QStringList cxxservice_names, cxxservice_execs; + QStringList f77service_names, f77service_execs; + QStringList allConfigs; + QString currentConfig; + bool dirty; + + AutoProjectPart *m_part; + EnvironmentVariablesWidget* m_environmentVariablesWidget; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/configureoptionswidgetbase.ui b/buildtools/autotools/configureoptionswidgetbase.ui new file mode 100644 index 00000000..0eb47ac7 --- /dev/null +++ b/buildtools/autotools/configureoptionswidgetbase.ui @@ -0,0 +1,1040 @@ + +ConfigureOptionsWidgetBase + + + configure_options_widget + + + + 0 + 0 + 628 + 607 + + + + Configure Options + + + + unnamed + + + 0 + + + + Layout1 + + + + unnamed + + + + config_label + + + + 1 + 5 + 0 + 0 + + + + &Configuration: + + + config_combo + + + + + config_combo + + + + 3 + 0 + 0 + 0 + + + + true + + + Different build profiles + + + profiles + + + + + Spacer17_2 + + + Horizontal + + + Fixed + + + + 20 + 8 + + + + + + addconfig_button + + + &Add + + + false + + + + + removeconfig_button + + + &Remove + + + false + + + + + Spacer18_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + tabwidget + + + + general_tab + + + &General + + + + unnamed + + + + configargs_edit + + + Options to pass to configure, e.g. --prefix=<install dir> + + + Options to pass to configure, e.g. --prefix=<install dir> + + + + + builddir_label + + + &Build directory (must be different for every different configuration): + + + builddir_edit + + + + + Spacer23 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + topsourcedir_label + + + Top source &directory: + + + topsourcedir_edit + + + + + builddir_edit + + + The build process will place the object +files and binary in this directory. + +If the name does not have a leading / +then it is relative to the project directory. +(in the General page) + +The build process also checks here for +a Makefile and a configure script. + +If you have imported a project and you were +building in the project directory, you +probably want this to be blank. + + + The build process will place the object +files and binary in this directory. + +If the name does not have a leading / +then it is relative to the project directory. +(in the General page) + +The build process also checks here for +a Makefile and a configure script. + +If you have imported a project and you were +building in the project directory, you +probably want this to be blank. + + + + + builddir_button + + + + 30 + 0 + + + + + 30 + 32767 + + + + ... + + + + + Spacer24 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + topsourcedir_button + + + + 30 + 0 + + + + + 30 + 32767 + + + + ... + + + + + topsourcedir_edit + + + Where to start looking for the src files. +If the name does not have a leading / +then it is relative to the project directory. +(in the General page) + + + Where to start looking for the src files. +If the name does not have a leading / +then it is relative to the project directory. +(in the General page) + + + + + spacer17 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + ldflags_label + + + Li&nker flags (LDFLAGS): + + + ldflags_edit + + + Linker flags, e.g. -L<lib dir> if you have libraries in a +nonstandard directory <lib dir> + + + + + spacer17_2_2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + ldflags_edit + + + Linker flags, e.g. -L<lib dir> if you have libraries in a +nonstandard directory <lib dir> + + + Linker flags, e.g. -L<lib dir> if you have libraries in a +nonstandard directory <lib dir> + + + + + cppflags_edit + + + C/C++ preprocessor flags, e.g. -I<include dir> if you have +headers in a nonstandard directory <include dir> + + + C/C++ preprocessor flags, e.g. -I<include dir> if you have +headers in a nonstandard directory <include dir> + + + + + spacer17_2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + cppflags_label + + + C/C++ &preprocessor flags (CPPFLAGS): + + + cppflags_edit + + + C/C++ preprocessor flags, e.g. -I<include dir> if you have +headers in a nonstandard directory <include dir> + + + + + configargs_label + + + Configure argu&ments: + + + configargs_edit + + + + + env_groupBox + + + + 5 + 3 + 0 + 0 + + + + Environment &Variables + + + + unnamed + + + + + + + + c_tab + + + C + + + + unnamed + + + + ccompiler_label + + + C com&piler: + + + cservice_combo + + + + + cservice_combo + + + + + Spacer11 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + cflags_label + + + Compiler f&lags (CFLAGS): + + + cflags_edit + + + + + cflags_edit + + + + + cflags_button + + + + 0 + 0 + 0 + 0 + + + + + 30 + 32767 + + + + ... + + + + + Spacer10 + + + Vertical + + + Expanding + + + + 20 + 168 + + + + + + cbinary_label + + + Compiler co&mmand (CC): + + + cbinary_edit + + + + + cbinary_edit + + + + + Spacer12 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + + + cxx_tab + + + C++ + + + + unnamed + + + + cxxcompiler_label + + + C++ com&piler: + + + cxxservice_combo + + + + + cxxservice_combo + + + + + Spacer13 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + cxxbinary_label + + + Compiler co&mmand (CXX): + + + cxxbinary_edit + + + + + cxxbinary_edit + + + + + Spacer13_2 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + cxxflags_label + + + Compiler flags (C&XXFLAGS): + + + cxxflags_edit + + + + + cxxflags_edit + + + + + cxxflags_button + + + + 0 + 0 + 0 + 0 + + + + + 30 + 32767 + + + + ... + + + + + Spacer16 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + fortran_tab + + + F&ortran + + + + unnamed + + + + f77compiler_label + + + Fortra&n compiler: + + + f77service_combo + + + + + f77service_combo + + + + + Spacer16_2 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + f77binary_label + + + Compiler co&mmand (F77): + + + f77binary_edit + + + + + f77binary_edit + + + + + Spacer17 + + + Vertical + + + Fixed + + + + 20 + 20 + + + + + + f77flags_label + + + Compiler f&lags (FFLAGS): + + + f77flags_edit + + + + + f77flags_edit + + + + + f77flags_button + + + + 0 + 0 + 0 + 0 + + + + + 30 + 32767 + + + + ... + + + + + Spacer18 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + cflags_button + clicked() + configure_options_widget + cflagsClicked() + + + f77flags_button + clicked() + configure_options_widget + f77flagsClicked() + + + cservice_combo + activated(int) + configure_options_widget + cserviceChanged() + + + f77service_combo + activated(int) + configure_options_widget + f77serviceChanged() + + + cxxflags_button + clicked() + configure_options_widget + cxxflagsClicked() + + + cxxservice_combo + activated(int) + configure_options_widget + cxxserviceChanged() + + + addconfig_button + clicked() + configure_options_widget + configAdded() + + + removeconfig_button + clicked() + configure_options_widget + configRemoved() + + + config_combo + activated(const QString&) + configure_options_widget + configChanged(const QString&) + + + config_combo + textChanged(const QString&) + configure_options_widget + configComboTextChanged(const QString&) + + + builddir_button + clicked() + configure_options_widget + builddirClicked() + + + configargs_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + builddir_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + cbinary_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + cflags_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + cxxbinary_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + cxxflags_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + f77binary_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + f77flags_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + topsourcedir_button + clicked() + configure_options_widget + topsourcedirClicked() + + + topsourcedir_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + cppflags_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + ldflags_edit + textChanged(const QString&) + configure_options_widget + setDirty() + + + + configargs_edit + builddir_edit + builddir_button + topsourcedir_edit + topsourcedir_button + cppflags_edit + ldflags_edit + tabwidget + config_combo + addconfig_button + removeconfig_button + cservice_combo + cbinary_edit + cflags_edit + cflags_button + cxxservice_combo + cxxbinary_edit + cxxflags_edit + cxxflags_button + f77service_combo + f77binary_edit + f77flags_edit + f77flags_button + + + kdialog.h + + + builddirClicked() + cflagsClicked() + configAdded() + configChanged(const QString&) + configComboTextChanged(const QString&) + configRemoved() + cserviceChanged() + cxxflagsClicked() + cxxserviceChanged() + f77flagsClicked() + f77serviceChanged() + setDirty() + topsourcedirClicked() + + + + + klineedit.h + + diff --git a/buildtools/autotools/fileselectorwidget.cpp b/buildtools/autotools/fileselectorwidget.cpp new file mode 100644 index 00000000..65b87bf7 --- /dev/null +++ b/buildtools/autotools/fileselectorwidget.cpp @@ -0,0 +1,243 @@ +/**************************************************************************** + * Copyright (C) 2001 by Hugo Varotto * + * hugo@varotto-usa.com * + * * + * Based on Kate's fileselector widget by * + * Matt Newell * + * (C) 2001 by Matt Newell * + * newellm@proaxis.com * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "fileselectorwidget.h" +#include +#include +#include +#include +#include +#include + +#include "autoprojectwidget.h" +#include "autoprojectpart.h" +#include "kdevlanguagesupport.h" + +#include "kfilednddetailview.h" +#include "kfiledndiconview.h" + +KDnDDirOperator::KDnDDirOperator ( const KURL &urlName, QWidget* parent, const char* name ) : KDirOperator ( urlName, parent, name ) +{ + +} + +KFileView* KDnDDirOperator::createView( QWidget* parent, KFile::FileView view ) +{ + KFileView* new_view = 0L; + + if( (view & KFile::Detail) == KFile::Detail ) { + new_view = new KFileDnDDetailView( parent, "detail view"); + } + else if ((view & KFile::Simple) == KFile::Simple ) { + new_view = new KFileDnDIconView( parent, "simple view"); + new_view->setViewName( i18n("Short View") ); + } + + return new_view; +} + + +FileSelectorWidget::FileSelectorWidget(AutoProjectPart* part, KFile::Mode mode, QWidget* parent, const char* name ) : QWidget(parent, name) +{ + m_part = part; + + // widgets and layout + QVBoxLayout* lo = new QVBoxLayout(this); + + QHBox *hlow = new QHBox (this); + lo->addWidget(hlow); + + home = new QPushButton( hlow ); + home->setPixmap(SmallIcon("gohome")); + QToolTip::add(home, i18n("Home directory")); + up = new QPushButton( /*i18n("&Up"),*/ hlow ); + up->setPixmap(SmallIcon("up")); + QToolTip::add(up, i18n("Up one level")); + back = new QPushButton( /*i18n("&Back"),*/ hlow ); + back->setPixmap(SmallIcon("back")); + QToolTip::add(back, i18n("Previous directory")); + forward = new QPushButton( /*i18n("&Next"),*/ hlow ); + forward->setPixmap(SmallIcon("forward")); + QToolTip::add(forward, i18n("Next directory")); + + // HACK + QWidget* spacer = new QWidget(hlow); + hlow->setStretchFactor(spacer, 1); + hlow->setMaximumHeight(up->height()); + + cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" ); + cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); + KURLCompletion* cmpl = new KURLCompletion(); + cmbPath->setCompletionObject( cmpl ); + lo->addWidget(cmbPath); + + dir = new KDnDDirOperator(KURL(), this, "operator"); + dir->setView(KFile::Simple); + dir->setMode(mode); + + lo->addWidget(dir); + lo->setStretchFactor(dir, 2); + + QHBox* filterBox = new QHBox(this); + filterIcon = new QLabel(filterBox); + filterIcon->setPixmap( BarIcon("filter") ); + filter = new KHistoryCombo(filterBox, "filter"); + filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); + filterBox->setStretchFactor(filter, 2); + lo->addWidget(filterBox); + + // slots and signals + connect( filter, SIGNAL( textChanged(const QString&) ), SLOT( slotFilterChanged(const QString&) ) ); + connect( filter, SIGNAL( activated(const QString&) ), SLOT( slotFilterChanged(const QString&) ) ); + connect( filter, SIGNAL( returnPressed(const QString&) ), SLOT( filterReturnPressed(const QString&) ) ); + + connect( home, SIGNAL( clicked() ), dir, SLOT( home() ) ); + connect( up, SIGNAL( clicked() ), dir, SLOT( cdUp() ) ); + connect( back, SIGNAL( clicked() ), dir, SLOT( back() ) ); + connect( forward, SIGNAL( clicked() ), dir, SLOT( forward() ) ); + + connect( cmbPath, SIGNAL( urlActivated( const KURL& )), this, SLOT( cmbPathActivated( const KURL& ) )); + //connect( cmbPath, SIGNAL( returnPressed( const QString& )), this, SLOT( cmbPathReturnPressed( const QString& ) )); + connect( dir, SIGNAL(urlEntered(const KURL&)), this, SLOT(dirUrlEntered(const KURL&)) ); + + connect( dir, SIGNAL(finishedLoading()), this, SLOT(dirFinishedLoading()) ); + +// dirUrlEntered( dir->url() ); + + QStringList list; + + /* read the file patterns from the project DOM */ + QDomElement docEl = m_part->projectDom()->documentElement(); + QDomElement fileviewEl = docEl.namedItem("kdevfileview").toElement(); + QDomElement groupsEl = fileviewEl.namedItem("groups").toElement(); + QDomElement groupEl = groupsEl.firstChild().toElement(); + + while ( !groupEl.isNull() ) + { + if (groupEl.tagName() == "group") + { + list << groupEl.attribute("pattern").replace ( QRegExp ( ";" ), " " ) + " (" + groupEl.attribute("name") + ")"; + } + groupEl = groupEl.nextSibling().toElement(); + } + + filter->setHistoryItems ( list ); + +} + + +FileSelectorWidget::~FileSelectorWidget() +{ +} + +void FileSelectorWidget::dragEnterEvent ( QDragEnterEvent* /*ev*/ ) +{ +} + +void FileSelectorWidget::dropEvent ( QDropEvent* /*ev*/ ) +{ + kdDebug ( 9020 ) << "Dropped" << endl; + + QString path = "Something was dropped in the Destination directory file-selector"; + + emit dropped ( path ); + +} + +void FileSelectorWidget::filterReturnPressed ( const QString& nf ) +{ + // KURL u ( m_part->project()->projectDirectory() ); + setDir ( nf ); +} + +void FileSelectorWidget::slotFilterChanged( const QString & nf ) +{ + dir->setNameFilter( nf ); + dir->updateDir(); +} + +void FileSelectorWidget::cmbPathActivated( const KURL& u ) +{ + dir->setURL( u, true ); +} + +void FileSelectorWidget::cmbPathReturnPressed( const QString& u ) +{ + dir->setFocus(); + dir->setURL( KURL(u), true ); +} + + +void FileSelectorWidget::dirUrlEntered( const KURL& u ) +{ + cmbPath->removeURL( u ); + QStringList urls = cmbPath->urls(); + urls.prepend( u.url() ); + while ( urls.count() >= (uint)cmbPath->maxItems() ) + urls.remove( urls.last() ); + cmbPath->setURLs( urls ); +} + + +void FileSelectorWidget::dirFinishedLoading() +{ + // HACK - enable the nav buttons + // have to wait for diroperator... + up->setEnabled( dir->actionCollection()->action( "up" )->isEnabled() ); + back->setEnabled( dir->actionCollection()->action( "back" )->isEnabled() ); + forward->setEnabled( dir->actionCollection()->action( "forward" )->isEnabled() ); + home->setEnabled( dir->actionCollection()->action( "home" )->isEnabled() ); +} + + +void FileSelectorWidget::focusInEvent(QFocusEvent*) +{ + dir->setFocus(); +} + +void FileSelectorWidget::setDir( KURL u ) +{ + dir->setURL(u, true); +} + +void FileSelectorWidget::setDir(const QString& path) +{ + KURL u ( path ); + dir->setURL ( u, true ); +} + + +#include "fileselectorwidget.moc" + diff --git a/buildtools/autotools/fileselectorwidget.h b/buildtools/autotools/fileselectorwidget.h new file mode 100644 index 00000000..7a981194 --- /dev/null +++ b/buildtools/autotools/fileselectorwidget.h @@ -0,0 +1,96 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _FILESELECTORWIDGET_H_ +#define _FILESELECTORWIDGET_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +class AutoProjectPart; +class SubprojectItem; +class KFile; + +class KDnDDirOperator : public KDirOperator +{ + Q_OBJECT + +public: + KDnDDirOperator ( const KURL& urlName = KURL(), QWidget *parent = 0, const char* name = 0 ); + +protected: + virtual KFileView* createView( QWidget* parent, KFile::FileView view ); +}; + +class FileSelectorWidget : public QWidget +{ + Q_OBJECT + +public: + FileSelectorWidget( AutoProjectPart* part, KFile::Mode, QWidget* parent = 0, const char* name = 0 ); + ~FileSelectorWidget(); + + KDnDDirOperator * dirOperator() + { + return dir; + } + +public slots: + void slotFilterChanged( const QString& ); + void setDir( KURL ); + void setDir( const QString& ); + +private slots: + void cmbPathActivated( const KURL& u ); + void cmbPathReturnPressed( const QString& u ); + void dirUrlEntered( const KURL& u ); + void dirFinishedLoading(); + void filterReturnPressed( const QString& nf ); + +protected: + void focusInEvent( QFocusEvent* ); + void dragEnterEvent ( QDragEnterEvent* ev ); + void dropEvent ( QDropEvent* ev ); + +private: + KURLComboBox *cmbPath; + KHistoryCombo * filter; + QLabel* filterIcon; + KDnDDirOperator * dir; + QPushButton *home, *up, *back, *forward; + AutoProjectPart* m_part; + +signals: + void dropped ( const QString& ); + +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/kdevautoproject.desktop b/buildtools/autotools/kdevautoproject.desktop new file mode 100644 index 00000000..bc366556 --- /dev/null +++ b/buildtools/autotools/kdevautoproject.desktop @@ -0,0 +1,97 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Automake Project +Comment[br]=Raktres Automake +Comment[ca]=Projecte Automake +Comment[da]=Automake-projekt +Comment[de]=Automake-Projekt für KDevelop +Comment[el]=Έργο Automake +Comment[es]=Proyecto de Automake +Comment[et]=Automake'i project +Comment[eu]=Automake proiektua +Comment[fa]=پروژۀ Automake +Comment[fr]=Projet avec Automake +Comment[ga]=Comhad tionscadail Automake +Comment[gl]=Proxecto Automake +Comment[hi]=ऑटोमेक परियोजना +Comment[hu]=Automake-projekt +Comment[is]=Automake verkefni +Comment[it]=Progetto per automake +Comment[ja]=Automake プロジェクト +Comment[ms]=Projek Automake +Comment[nds]=Automake-Projekt +Comment[ne]=स्वत: निर्माण परियोजना +Comment[nl]=Automake-project +Comment[pa]=ਆਟੋਮੈਕ ਪ੍ਰੋਜੈਕਟ +Comment[pl]=Projekt: Automake +Comment[pt]=Projecto Automake +Comment[pt_BR]=Projeto Automake +Comment[ru]=Проект Automake +Comment[sk]=Automake projekt +Comment[sl]=Projekt automake +Comment[sr]=Automake пројекат +Comment[sr@Latn]=Automake projekat +Comment[sv]=Automake-projekt +Comment[ta]=ஆட்டோமேக் பிராஜக்ட் +Comment[tg]=Лоиҳаи Automake +Comment[tr]=Automake Projesi +Comment[uz]=Automake loyihasi +Comment[uz@cyrillic]=Automake лойиҳаси +Comment[zh_CN]=Automake 工程 +Comment[zh_TW]=Automake 專案 +Name=KDevAutoProject +Name[da]=KDevelop Automake-projekt +Name[de]=Automake-Projekt (KDevelop) +Name[hi]=के-डेव-ऑटो-परियोजना +Name[nds]=Automake-Projekt (KDevelop) +Name[ne]=केडीई विकास स्वत: परियोजना +Name[pl]=KDevProjektAuto +Name[pt_BR]=KDevAutoProjeto +Name[sk]=KDevAutoProjekt +Name[sv]=KDevelop autoprojekt +Name[ta]=கெடெவ்ஆட்டோ பிராஜக்ட் +Name[tg]=Лоиҳаи KDevAuto +Name[zh_TW]=KDevelop Automake 專案 +GenericName=Automake Project +GenericName[br]=Raktres Automake +GenericName[ca]=Projecte Automake +GenericName[da]=Automake-projekt +GenericName[de]=Automake-Projekt +GenericName[el]=Έργο Automake +GenericName[es]=Proyecto de Automake +GenericName[et]=Automake'i projekt +GenericName[eu]=Automake proiektua +GenericName[fa]=پروژۀ Automake +GenericName[fr]=Projet avec Automake +GenericName[ga]=Comhad tionscadail Automake +GenericName[gl]=Proxecto Automake +GenericName[hi]=ऑटोमेक परियोजना +GenericName[hu]=Automake-projekt +GenericName[it]=Progetto Automake +GenericName[ja]=Automake プロジェクト +GenericName[ms]=Projek Automake +GenericName[nds]=Automake-Projekt +GenericName[ne]=स्वत: निर्माण परियोजना +GenericName[nl]=Automake-project +GenericName[pl]=Projekt: Automake +GenericName[pt]=Projecto de Automake +GenericName[pt_BR]=Projeto Automake +GenericName[ru]=Проект Automake +GenericName[sk]=Automake projekt +GenericName[sl]=Projekt automake +GenericName[sr]=Automake пројекат +GenericName[sr@Latn]=Automake projekat +GenericName[sv]=Automake-projekt +GenericName[ta]=ஆட்டோமேக் பிராஜக்ட் +GenericName[tg]=Лоиҳаи Automake +GenericName[tr]=Automake Projesi +GenericName[uz]=Automake loyihasi +GenericName[uz@cyrillic]=Automake лойиҳаси +GenericName[zh_CN]=Automake 工程 +GenericName[zh_TW]=Automake 專案 +ServiceTypes=KDevelop/Project +Icon=make +X-KDE-Library=libkdevautoproject +X-KDevelop-Version=5 +X-KDevelop-Args= diff --git a/buildtools/autotools/kdevautoproject.rc b/buildtools/autotools/kdevautoproject.rc new file mode 100644 index 00000000..89571c11 --- /dev/null +++ b/buildtools/autotools/kdevautoproject.rc @@ -0,0 +1,30 @@ + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildtools/autotools/kdevkdeautoproject.desktop b/buildtools/autotools/kdevkdeautoproject.desktop new file mode 100644 index 00000000..235f3071 --- /dev/null +++ b/buildtools/autotools/kdevkdeautoproject.desktop @@ -0,0 +1,92 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=KDE Automake Project +Comment[br]=Raktres KDE Automake +Comment[ca]=Projecte Automake per al KDE +Comment[da]=KDE Automake-projekt +Comment[de]=KDE-Automake-Projekt für KDevelop +Comment[el]=Έργο KDE Automake +Comment[es]=Proyecto de Automake de KDE +Comment[et]=KDE automake'i projekt +Comment[eu]=KDE automake proiektua +Comment[fa]=پروژۀ KDE Automake +Comment[fr]=Projet Automake pour KDE +Comment[ga]=Tionscadal Automake KDE +Comment[gl]=Proxecto Automake de KDE +Comment[hi]=केडीई ऑटोमेक परियोजना +Comment[hu]=KDE Automake-projekt +Comment[is]=KDE Automake verkefni +Comment[it]=Progetto KDE per automake +Comment[ja]=KDE Automake プロジェクト +Comment[ms]=Projek Automake KDE +Comment[nds]=Automake-Projekt vun KDE +Comment[ne]=केडीई स्वत: निर्माण परियोजना +Comment[nl]=KDE Automake-project +Comment[pt]=Projecto Automake do KDE +Comment[pt_BR]=Projeto Automake do KDE +Comment[ru]=Проект KDE Automake +Comment[sk]=KDE Automake projekt +Comment[sl]=Projekt KDE Automake +Comment[sr]=KDE-ов Automake пројекат +Comment[sr@Latn]=KDE-ov Automake projekat +Comment[sv]=KDE Automake-projekt +Comment[ta]=KDE ஆட்டோமேக் பிராஜக்ட் +Comment[tg]=Лоиҳаи KDE Automake +Comment[tr]=KDE Automake Projesi +Comment[zh_CN]=KDE Automake 工程 +Comment[zh_TW]=KDE Automake 專案 +Name=KDevKDEAutoProject +Name[da]=KDevelop KDE Automake-projekt +Name[de]=KDE-Automake-Projekt (KDevelop) +Name[hi]=के-डेव-केडीई-ऑटो-परियोजना +Name[nds]=Automake-Projekt (KDE/KDevelop) +Name[ne]=केडीई विकास केडीई स्वत: परियोजना +Name[pl]=KDevProjektKDEAuto +Name[pt_BR]=KDevKDEAutoProjeto +Name[sk]=KDevAutoProjekt +Name[sv]=KDevelop KDE-autoprojekt +Name[ta]=கெடெவ்ஆட்டோ பிராஜக்ட் +Name[tg]=Лоиҳаи худкори KDevKDEAuto +Name[zh_TW]=KDevelop KDE Automake 專案 +GenericName=KDE Automake Project +GenericName[br]=Raktres KDE Automake +GenericName[ca]=Projecte Automake per al KDE +GenericName[cs]=KDE Automake projekt +GenericName[da]=KDE Automake-projekt +GenericName[de]=KDE-Automake-Projekt +GenericName[el]=Έργο KDE Automake +GenericName[es]=Proyecto de Automake de KDE +GenericName[et]=KDE automake'i projekt +GenericName[eu]=KDE automake proiektua +GenericName[fa]=پروژۀ KDE Automake +GenericName[fr]=Projet avec Automake pour KDE +GenericName[ga]=Tionscadal Automake KDE +GenericName[gl]=Proxecto Automake de KDE +GenericName[hi]=केडीई ऑटोमेक परियोजना +GenericName[hu]=KDE Automake-projekt +GenericName[it]=Progetto KDE Automake +GenericName[ja]=KDE Automake プロジェクト +GenericName[ms]=Projek Automake KDE +GenericName[nds]=Automake-Projekt vun KDE +GenericName[ne]=केडीई स्वत: निर्माण परियोजना +GenericName[nl]=KDE Automake-project +GenericName[pl]=Projekt: KDE Automake +GenericName[pt]=Projecto KDE com Automake +GenericName[pt_BR]=Projeto Automake do KDE +GenericName[ru]=Проект KDE Automake +GenericName[sk]=KDE Automake projekt +GenericName[sl]=Projekt KDE Automake +GenericName[sr]=KDE-ов Automake пројекат +GenericName[sr@Latn]=KDE-ov Automake projekat +GenericName[sv]=KDE Automake-projekt +GenericName[ta]=KDE ஆட்டோமேக் பிராஜக்ட் +GenericName[tg]=Лоиҳаи KDE Automake +GenericName[tr]=KDE Automake Projesi +GenericName[zh_CN]=KDE Automake 工程 +GenericName[zh_TW]=KDE Automake 專案 +ServiceTypes=KDevelop/Project +Icon=make +X-KDE-Library=libkdevautoproject +X-KDevelop-Version=5 +X-KDevelop-Args=kde diff --git a/buildtools/autotools/kfilednddetailview.cpp b/buildtools/autotools/kfilednddetailview.cpp new file mode 100644 index 00000000..c75022fb --- /dev/null +++ b/buildtools/autotools/kfilednddetailview.cpp @@ -0,0 +1,212 @@ +/*************************************************************************** +* kfilednddetailview.cpp - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Bj�n Sahlstr� +* email : kbjorn@users.sourceforge.net +***************************************************************************/ + +/*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +////////////////////////////////////////////////////// +// Qt specific includes +#include +#include +////////////////////////////////////////////////////// +// KDE specific includes +#include +#include +#include +////////////////////////////////////////////////////// +// Application specific includes +#include "kfilednddetailview.h" + +#ifndef AUTO_OPEN_TIME +#define AUTO_OPEN_TIME + static int autoOpenTime = 750; +#endif +//----------------------------------------------- +KFileDnDDetailView::KFileDnDDetailView(QWidget *parent, const char *name ) + : KFileDetailView(parent,name), m_autoOpenTimer( this ), + m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ), + m_dropItem(0), m_dndEnabled( true ) +{ + setAutoUpdate( true ); + setDnDEnabled( true ); + useAutoOpenTimer( true ); +} +//----------------------------------------------- +KFileDnDDetailView::~KFileDnDDetailView(){ +} +//----------------------------------------------- +void KFileDnDDetailView::readConfig( KConfig* config, const QString& group ) { + KConfigGroupSaver cs( config, group ); + bool dnd = config->readBoolEntry("DragAndDrop", true ); + setDnDEnabled( dnd ); + KFileDetailView::readConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDDetailView::writeConfig( KConfig* config, const QString& group ) { + KConfigGroupSaver cs( config, group ); + config->writeEntry("DragAndDrop", m_dndEnabled ); + KFileDetailView::writeConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDDetailView::slotOpenFolder(){ + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + if( !m_dropItem ) + return; + } + KFileItemListIterator it( * KFileView::items() ); + for( ; it.current() ;++it ){ + if( (*it)->name() == m_dropItem->text(0) ) { + if( (*it)->isFile() ) + return; + else if( (*it)->isDir() || (*it)->isLink()) { + sig->activate( (*it) ); + return; + } + } + } +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDragEnterEvent( QDragEnterEvent *e ) { + + kdDebug (9020) << "KFileDnDDetailView::contentsDragEnterEvent" << endl; + + if ( ! acceptDrag( e ) ) { + e->accept( false ); + return; + } + e->acceptAction(); + QListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); + if ( i && m_useAutoOpenTimer ) { + m_dropItem = i; + m_autoOpenTimer.start( m_autoOpenTime ); + } +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDragMoveEvent( QDragMoveEvent *e ) { + + kdDebug (9020) << "KFileDnDDetailView::contentsDragMoveEvent" << endl; + + if ( ! acceptDrag( e ) ) { + e->accept( false ); + return; + } + e->acceptAction(); + QListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); + if( ! m_useAutoOpenTimer ) + return; + if ( i ) { + if ( i != m_dropItem ) { + m_autoOpenTimer.stop(); + m_dropItem = i; + m_autoOpenTimer.start( m_autoOpenTime ); + } + } + else + m_autoOpenTimer.stop(); +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDragLeaveEvent( QDragLeaveEvent* ) { + + kdDebug (9020) << "KFileDnDDetailView::contentsDragLeaveEvent" << endl; + + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDropEvent( QDropEvent* e ) { + + kdDebug (9020) << "KFileDndDetailView::contentsDropEvent" << endl; + + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } + if( ! acceptDrag( e ) ) { + e->acceptAction( false ); + return; + } + e->acceptAction(); + // the drop was accepted so lets emit this to the outside world + KURL::List urls; + KURLDrag::decode( e, urls ); + emit dropped( e ); + emit dropped( this, e ); + emit dropped( this, urls ); +} +//----------------------------------------------- +void KFileDnDDetailView::startDrag(){ + + kdDebug (9020) << "KFileDnDDetailView::startDrag()" << endl; + + // create a list of the URL:s that we want to drag + KURL::List urls; + KFileItemListIterator it( * KFileView::selectedItems() ); + for ( ; it.current(); ++it ){ + urls.append( (*it)->url() ); + } + QPixmap pixmap; + if( urls.count() > 1 ){ + pixmap = DesktopIcon( "kmultiple", 16 ); + } + if( pixmap.isNull() ) + pixmap = currentFileItem()->pixmap( 16 ); + QPoint hotspot; + hotspot.setX( pixmap.width() / 2 ); + hotspot.setY( pixmap.height() / 2 ); + m_dragObject = KURLDrag::newDrag( urls, widget() ); + m_dragObject->setPixmap( pixmap, hotspot ); + m_dragObject->drag(); // start the drag +} +//----------------------------------------------- +QDragObject* KFileDnDDetailView::dragObject() const { + return m_dragObject; +} +//----------------------------------------------- +bool KFileDnDDetailView::acceptDrag(QDropEvent* e ) const { + return KURLDrag::canDecode( e ) && + ( e->action() == QDropEvent::Copy + || e->action() == QDropEvent::Move + || e->action() == QDropEvent::Link ); +} +//----------------------------------------------- +void KFileDnDDetailView::setAutoOpenTime( const int& time ){ + m_autoOpenTime = time; + useAutoOpenTimer(); +} +//----------------------------------------------- +void KFileDnDDetailView::useAutoOpenTimer( bool use ){ + m_useAutoOpenTimer = use; + if( use ) + connect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) ); + else { + disconnect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) ); + m_dropItem = 0L; + m_autoOpenTimer.stop(); + } +} +//----------------------------------------------- +void KFileDnDDetailView::setDnDEnabled( bool useDnD ){ + m_dndEnabled = useDnD; + setDragEnabled( useDnD ); + setDropVisualizer( useDnD ); + setAcceptDrops( useDnD ); + viewport()->setAcceptDrops( useDnD ); +} +//----------------------------------------------- +#ifndef NO_INCLUDE_MOCFILES +#include "kfilednddetailview.moc" +#endif diff --git a/buildtools/autotools/kfilednddetailview.h b/buildtools/autotools/kfilednddetailview.h new file mode 100644 index 00000000..ecb232c6 --- /dev/null +++ b/buildtools/autotools/kfilednddetailview.h @@ -0,0 +1,136 @@ +/*************************************************************************** +* kfilednddetailview.h - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Bjrn Sahlstrm +* email : kbjorn@users.sourceforge.net +***************************************************************************/ + +/*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +**************************************************************************/ + +#ifndef KFILEDNDDETAILVIEW_H +#define KFILEDNDDETAILVIEW_H + +////////////////////////////////////////////////////////////////////// +// Qt specific include files +#include +#include +////////////////////////////////////////////////////////////////////// +// KDE specific include files +#include +#include + + +/** + *This is a fileview inherited from @ref KFileDetailView. + *It adds "drag and drop" handling to the view suitable for a @ref KFileDetailView. + * No special setup is needed, just connect to the @ref dropped signals + * and the view will take care of the rest. + *@short "Drag and drop" aware @ref KFileDetailView + *@author Bjrn Sahlstrm + */ + +class KFileDnDDetailView : public KFileDetailView +{ + Q_OBJECT +public: + /** */ + KFileDnDDetailView( QWidget *parent = 0, const char *name = 0 ); + /** */ + virtual ~KFileDnDDetailView(); + /** + * Set this to true if Drag'n drop should be enabled or not, default is enabled + */ + void setDnDEnabled( bool ); + /** + * @returns wether DnD is enabled or not. + */ + bool isDnDEnabled() const + { + return m_dndEnabled; + } + /** + *Sets the auto open time, which means the time that will + *elapse before a directory is automatically opened after entered by DnD. + *Only need to call this if you want to change the predefined time that is 750 ms. + *This also calls @ref #useAutoOpenTimer so no need to call this to. + */ + void setAutoOpenTime( const int& time ); + /** + *Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false. + *By default this is turned ON. + */ + void useAutoOpenTimer( bool on = true ); + /** + *@returns true if auto open functionallity is turned ON (default), otherwhise false + *@see #useAutoOpenTimer + *@see #setAutoOpenTime + */ + bool isAutoOpening() const + { + return m_useAutoOpenTimer; + } + /** */ + virtual void readConfig( KConfig*, const QString& group = QString::null ); + /** */ + virtual void writeConfig( KConfig*, const QString& group = QString::null ); +signals: // Signals + /** + * Emitted whenever an decodable item is dropped in the view. + * Note: The @ref QDropEvent contains a @ref KURLDrag object. + */ + void dropped( QDropEvent* ); + /** + * Emitted whenever an decodable item is dropped in the view + * Note: The @ref QDropEvent contains a @ref KURLDrag object. + */ + void dropped( KFileView*, QDropEvent* ); + /** + * Emitted whenever an decodable item is dropped in the view. + *@param urls contains a list of all dropped @ref KURL + */ + void dropped( KFileView*, KURL::List& urls ); +protected slots: // Protected slots + /** + * Called when the auto timer times out. Open the current folder. + */ + void slotOpenFolder(); +protected: //Protected Methods + /** */ + virtual void contentsDragEnterEvent( QDragEnterEvent *e ); + /** */ + virtual void contentsDragMoveEvent( QDragMoveEvent *e ); + /** */ + virtual void contentsDragLeaveEvent( QDragLeaveEvent *e ); + /** */ + virtual void contentsDropEvent( QDropEvent* e ); + /** + * Create dragobject encoding the current selection and starts the drag + */ + virtual void startDrag(); + /** + * @returns the dragObject + */ + virtual QDragObject* dragObject() const; + /** + * @returns true if we can decode the drag and support the action + */ + virtual bool acceptDrag( QDropEvent* event ) const; +protected: // Private attributes + QTimer m_autoOpenTimer; + int m_autoOpenTime; + bool m_useAutoOpenTimer; + QListViewItem* m_dropItem; + KURLDrag* m_dragObject; + bool m_dndEnabled; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/kfiledndiconview.cpp b/buildtools/autotools/kfiledndiconview.cpp new file mode 100644 index 00000000..47bb32a9 --- /dev/null +++ b/buildtools/autotools/kfiledndiconview.cpp @@ -0,0 +1,194 @@ +/*************************************************************************** +* kfiledndiconview.cpp - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Bjrn Sahlstrm +* email : kbjorn@users.sourceforge.net +***************************************************************************/ + +/*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +////////////////////////////////////////////////////// +// Qt specific includes +#include +#include +////////////////////////////////////////////////////// +// KDE specific includes +#include +#include +#include +////////////////////////////////////////////////////// +// Application specific includes +#include "kfiledndiconview.h" + +#ifndef AUTO_OPEN_TIME +#define AUTO_OPEN_TIME + static int autoOpenTime = 750; +#endif +//----------------------------------------------- +KFileDnDIconView::KFileDnDIconView( QWidget *parent, const char *name ) + : KFileIconView(parent,name), m_autoOpenTimer( this ), + m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ), + m_dropItem(0), m_dndEnabled( true ) +{ + setDnDEnabled( true ); + setAutoUpdate( true ); + useAutoOpenTimer( true ); +} +//----------------------------------------------- +KFileDnDIconView::~KFileDnDIconView(){ +} +//----------------------------------------------- +void KFileDnDIconView::readConfig( KConfig* config, const QString& group ) { + KConfigGroupSaver cs( config, group ); + bool dnd = config->readBoolEntry("EnableDND", true ); + setDnDEnabled( dnd ); + KFileIconView::readConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDIconView::writeConfig( KConfig* config, const QString& group ) { + KConfigGroupSaver cs( config, group ); + config->writeEntry("EnableDND", m_dndEnabled ); + KFileIconView::writeConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDIconView::slotOpenFolder(){ + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + if( !m_dropItem ) + return; + } + KFileItemListIterator it( * KFileView::items() ); + for( ; it.current() ;++it ){ + if( (*it)->name() == m_dropItem->text() ) { + if( (*it)->isFile() ) + return; + else if( (*it)->isDir() || (*it)->isLink()) { + sig->activate( (*it) ); + return; + } + } + } +} +//----------------------------------------------- +void KFileDnDIconView::contentsDragEnterEvent( QDragEnterEvent *e ) { + if ( ! acceptDrag( e ) ) { // can we decode this ? + e->accept( false ); // No + return; + } + e->acceptAction(); // Yes + QIconViewItem *i = findItem( contentsToViewport( e->pos() ) ); + if ( i && m_useAutoOpenTimer) { // are we over an item ? + m_dropItem = i; // set new m_dropItem + m_autoOpenTimer.start( m_autoOpenTime ); // restart timer + } +} +//----------------------------------------------- +void KFileDnDIconView::contentsDragMoveEvent( QDragMoveEvent *e ) { + if ( ! acceptDrag( e ) ) { // can we decode this ? + e->accept( false ); // No + return; + } + e->acceptAction(); // Yes + QIconViewItem *i = findItem( contentsToViewport( e->pos() ) ); + if( ! m_useAutoOpenTimer ) + return; + if ( i ) { // are we over an item ? + if ( i != m_dropItem ) { // if so, is it a new one ? + m_autoOpenTimer.stop(); // stop timer + m_dropItem = i; // set new m_dropItem + m_autoOpenTimer.start( m_autoOpenTime ); // restart timer + } + } + else + m_autoOpenTimer.stop(); // stop timer +} +//----------------------------------------------- +void KFileDnDIconView::contentsDragLeaveEvent( QDragLeaveEvent* ) { + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } +} +//----------------------------------------------- +void KFileDnDIconView::contentsDropEvent( QDropEvent* e ) { + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } + if( ! acceptDrag( e ) ) { + e->acceptAction( false ); + return; + } + e->acceptAction(); + // the drop was accepted so lets emit this + KURL::List urls; + KURLDrag::decode( e, urls ); + emit dropped( e ); +} +//----------------------------------------------- +void KFileDnDIconView::startDrag(){ + if ( ! currentItem() ) // is there any selected items ? + return; // nope + dragObject()->dragCopy(); // start the drag +} +//----------------------------------------------- +QDragObject* KFileDnDIconView::dragObject() { + // create a list of the URL:s that we want to drag + KURL::List urls; + KFileItemListIterator it( * KFileView::selectedItems() ); + for ( ; it.current(); ++it ){ + urls.append( (*it)->url() ); + } + QPixmap pixmap; + if( urls.count() > 1 ) + pixmap = DesktopIcon( "kmultiple", iconSize() ); + if( pixmap.isNull() ) + pixmap = currentFileItem()->pixmap( iconSize() ); + QPoint hotspot; + hotspot.setX( pixmap.width() / 2 ); + hotspot.setY( pixmap.height() / 2 ); + QDragObject* myDragObject = KURLDrag::newDrag( urls, widget() ); + myDragObject->setPixmap( pixmap, hotspot ); + return myDragObject; +} +//----------------------------------------------- +void KFileDnDIconView::setAutoOpenTime( const int& time ){ + m_autoOpenTime = time; + useAutoOpenTimer(); +} +//----------------------------------------------- +void KFileDnDIconView::useAutoOpenTimer( bool use ){ + m_useAutoOpenTimer = use; + if ( use ) + connect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) ); + else { + disconnect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) ); + m_dropItem = 0L; + m_autoOpenTimer.stop(); + } +} +//----------------------------------------------- +void KFileDnDIconView::setDnDEnabled( bool useDnD ){ + m_dndEnabled = useDnD; + setAcceptDrops( useDnD ); + viewport()->setAcceptDrops( useDnD ); +} +//----------------------------------------------- +bool KFileDnDIconView::acceptDrag(QDropEvent* e ) const { + return KURLDrag::canDecode( e ) && + ( e->action() == QDropEvent::Copy + || e->action() == QDropEvent::Move + || e->action() == QDropEvent::Link ); +} +//----------------------------------------------- +#ifndef NO_INCLUDE_MOCFILES +#include "kfiledndiconview.moc" +#endif diff --git a/buildtools/autotools/kfiledndiconview.h b/buildtools/autotools/kfiledndiconview.h new file mode 100644 index 00000000..65edd91a --- /dev/null +++ b/buildtools/autotools/kfiledndiconview.h @@ -0,0 +1,128 @@ +/************************************************************************** +* kfiledndiconview.h - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Bjrn Sahlstrm +* email : kbjorn@users.sourceforge.net +***************************************************************************/ + +/*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +**************************************************************************/ + +#ifndef KFILEDNDICONVIEW_H +#define KFILEDNDICONVIEW_H + +#include +#include +#include +#include + +/** + * This is a fileview inherited from @ref KFileIconView. + * It adds "drag and drop" suitable for a @ref KFileIconView + * No special setup is needed, just connect to the @ref dropped signals + * and the view will take care of the rest. + * @short Drag and drop" aware @ref KFileIconView + * @author Bjrn Sahlstrm +*/ + +class KFileDnDIconView : public KFileIconView +{ + Q_OBJECT +public: // Public methods + + KFileDnDIconView( QWidget *parent = 0, const char *name = 0 ); + virtual ~KFileDnDIconView(); + + /** + * Set if Drag'n drop should be enabled or not, default is enabled. + */ + void setDnDEnabled( bool ); + + /** + * @returns wether DnD is enabled or not. + */ + bool isDnDEnabled() const + { + return m_dndEnabled; + } + + /** + * Sets the auto open time, which means the time that will + * elapse before a directory is automatically opened after entered by DnD. + * Only need to call this if you want to change the predefined time that is 750 ms. + * This also calls @ref #useAutoOpenTimer so no need to call this to. + */ + void setAutoOpenTime( const int& time ); + + /** + * Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false. + * By default this is turned ON. + */ + void useAutoOpenTimer( bool on = true ); + + /** + * @returns true if auto open functionallity is turned ON (default), otherwhise false + * @see #useAutoOpenTimer + * @see #setAutoOpenTime + */ + bool isAutoOpening() const + { + return m_useAutoOpenTimer; + } + + virtual void readConfig( KConfig*, const QString& group = QString::null ); + virtual void writeConfig( KConfig*, const QString& group = QString::null ); +signals: + + /** + * Emitted whenever an decodable item is dropped in the view. + * Note: The @ref QDropEvent contains a @ref KURLDrag object. + */ + void dropped( QDropEvent* ); + +protected slots: + /** + * Called when the auto timer times out. Open the current folder. + */ + void slotOpenFolder(); + +protected: + virtual void contentsDragEnterEvent( QDragEnterEvent *e ); + virtual void contentsDragMoveEvent( QDragMoveEvent *e ); + virtual void contentsDragLeaveEvent( QDragLeaveEvent *e ); + virtual void contentsDropEvent( QDropEvent* e ); + + /** + * Creates a @ref QDragObject containing all urls of the selected @ref KFileItem of the view, + * @returns the @ref QDragObject + */ + virtual QDragObject* dragObject(); + + /** + *Creates the drag item and starts the drag + */ + virtual void startDrag(); + + /** + *@returns true if we can decode the drag and support the action + */ + virtual bool acceptDrag( QDropEvent* event ) const; + +protected: + + QTimer m_autoOpenTimer; + int m_autoOpenTime; + bool m_useAutoOpenTimer; + QIconViewItem* m_dropItem; + bool m_dndEnabled; +}; +#endif +// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on; + diff --git a/buildtools/autotools/kimporticonview.cpp b/buildtools/autotools/kimporticonview.cpp new file mode 100644 index 00000000..9b64d3ee --- /dev/null +++ b/buildtools/autotools/kimporticonview.cpp @@ -0,0 +1,87 @@ +/*************************************************************************** + ------------------- + begin : 19.01.2003 + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include + +#include "kimporticonview.h" + + +KImportIconView::KImportIconView(const QString& strIntro, QWidget *parent, const char *name) + : KFileDnDIconView(parent, name) +{ + m_strIntro = strIntro; + m_bDropped = false; + + setAcceptDrops ( true ); +} + + +KImportIconView::~KImportIconView() +{ +} + +void KImportIconView::drawContents ( QPainter *p, int cx, int cy, int cw, int ch ) +{ + if ( !m_bDropped) + { + QIconView::drawContents ( p, cx, cy, cw, ch ); + + p->save(); + QFont font ( p->font() ); + font.setBold ( true ); + font.setFamily ( "Helvetica [Adobe]" ); + font.setPointSize ( 10 ); + p->setFont ( font ); + p->setPen ( QPen ( KGlobalSettings::highlightColor() ) ); + + QRect rect = frameRect(); + QFontMetrics fm ( p->font() ); + rect.setLeft ( rect.left() + 30 ); + rect.setRight ( rect.right() - 30 ); + + resizeContents ( contentsWidth(), contentsHeight() ); + + // word-wrap the string + KWordWrap* wordWrap1 = KWordWrap::formatText( fm, rect, AlignHCenter | WordBreak, m_strIntro ); + KWordWrap* wordWrap2 = KWordWrap::formatText( fm, rect, AlignHCenter | WordBreak, i18n("Or just use the buttons.") ); + + QRect introRect1 = wordWrap1->boundingRect(); + QRect introRect2 = wordWrap2->boundingRect(); + + wordWrap1->drawText ( p, ( ( frameRect().right() - introRect1.right() ) / 2 ), ( ( frameRect().bottom() - introRect1.bottom() ) / 2 ) - 20, AlignHCenter | AlignVCenter ); + wordWrap2->drawText ( p, ( ( frameRect().right() - introRect2.right() ) / 2 ), ( ( frameRect().bottom() - introRect2.bottom() ) / 2 ) + introRect1.bottom(), AlignHCenter | AlignVCenter ); + + p->restore(); + } + else + { + QIconView::drawContents ( p, cx, cy, cw, ch ); + } +} + +void KImportIconView::somethingDropped ( bool dropped ) +{ + m_bDropped = dropped; +} + +#include "kimporticonview.moc" diff --git a/buildtools/autotools/kimporticonview.h b/buildtools/autotools/kimporticonview.h new file mode 100644 index 00000000..100fc33e --- /dev/null +++ b/buildtools/autotools/kimporticonview.h @@ -0,0 +1,44 @@ +/*************************************************************************** + ------------------- + begin : 19.01.2003 + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KIMPORTICONVIEW_H +#define KIMPORTICONVIEW_H + +#include + +#include "kfiledndiconview.h" + +class KImportIconView : public KFileDnDIconView +{ + Q_OBJECT + +public: + KImportIconView( const QString& strIntro, QWidget *parent, const char *name ); + virtual ~KImportIconView(); + + void somethingDropped ( bool dropped ); + +protected: + void drawContents ( QPainter *p, int cx, int cy, int cw, int ch ); + +private: + QString m_strIntro; + bool m_bDropped; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/makefilehandler.cpp b/buildtools/autotools/makefilehandler.cpp new file mode 100644 index 00000000..03ad5277 --- /dev/null +++ b/buildtools/autotools/makefilehandler.cpp @@ -0,0 +1,166 @@ +/* + KDevelop Autotools Support + Copyright (c) 2005 by Matt Rogers + +*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +*/ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "makefilehandler.h" + +typedef QValueList ASTList; + +class MakefileHandler::Private +{ +public: + QMap projects; + QMap folderToFileMap; +}; + +MakefileHandler::MakefileHandler() +{ + d = new MakefileHandler::Private; +} + +MakefileHandler::~MakefileHandler() +{ + delete d; +} + +void MakefileHandler::parse( const QString& folder, bool recursive ) +{ + //look for either Makefile.am.in, Makefile.am, or Makefile.in, in that order + AutoTools::ProjectAST* ast; + int ret = -1; + QString filePath = folder + "/Makefile.am.in"; + if ( QFile::exists( filePath ) ) + ret = AutoTools::Driver::parseFile( filePath, &ast ); + else + { + filePath = folder + "/Makefile.am"; + if ( QFile::exists( filePath ) ) + ret = AutoTools::Driver::parseFile( filePath, &ast ); + else + { + filePath = folder + "/Makefile.in"; + if ( QFile::exists( filePath ) ) + ret = AutoTools::Driver::parseFile( filePath, &ast ); + else + kdDebug(9020) << k_funcinfo << "no appropriate file to parse in " + << folder << endl; + } + } + + if ( ret != 0 ) + { + return; + } + + kdDebug(9020) << k_funcinfo << filePath << " was parsed correctly. Adding information" << endl; + Q_ASSERT( ast != 0 ); + d->projects[filePath] = ast; + d->folderToFileMap[folder] = filePath; + + if ( recursive && ast && ast->hasChildren() ) + { + QValueList astChildList = ast->children(); + QValueList::iterator it(astChildList.begin()), clEnd(astChildList.end()); + for ( ; it != clEnd; ++it ) + { + if ( (*it)->nodeType() == AutoTools::AST::AssignmentAST ) + { + AutoTools::AssignmentAST* assignment = static_cast( (*it) ); + if ( assignment->scopedID == "SUBDIRS" ) + { + QString list = assignment->values.join( QString::null ); + list.simplifyWhiteSpace(); + kdDebug(9020) << k_funcinfo << "subdirs is " << list << endl; + QStringList subdirList = QStringList::split( " ", list ); + QStringList::iterator vit = subdirList.begin(); + for ( ; vit != subdirList.end(); ++vit ) + { + QString realDir = ( *vit ); + if ( realDir.startsWith( "\\" ) ) + realDir.remove( 0, 1 ); + + realDir = realDir.stripWhiteSpace(); + if ( realDir != "." && realDir != ".." && !realDir.isEmpty() ) + { + if ( isVariable( realDir ) ) + { + kdDebug(9020) << k_funcinfo << "'" << realDir << "' is a variable" << endl; + realDir = resolveVariable( realDir, ast ); + } + + kdDebug(9020) << k_funcinfo << "Beginning parsing of '" << realDir << "'" << endl; + parse( folder + '/' + realDir, recursive ); + } + } + } + } + } + } +} + +AutoTools::ProjectAST* MakefileHandler::astForFolder( const QString& folderPath ) +{ + if ( d->folderToFileMap.contains( folderPath ) ) + { + QString filePath = d->folderToFileMap[folderPath]; + return d->projects[filePath]; + } + else + return 0; +} + +bool MakefileHandler::isVariable( const QString& item ) const +{ + if ( item.contains( QRegExp( "(\\$\\([a-zA-Z0-9_-]*\\)|@[a-zA-Z0-9_-]*@)" ) ) ) + return true; + else + return false; +} + +QString MakefileHandler::resolveVariable( const QString& variable, AutoTools::ProjectAST* ast ) +{ + if ( !ast ) + return variable; + + kdDebug(9020) << k_funcinfo << "attempting to resolve '" << variable << "'"<< endl; + ASTList childList = ast->children(); + ASTList::iterator it( childList.begin() ), clEnd( childList.end() ); + for ( ; it != clEnd; ++it ) + { + if ( ( *it )->nodeType() == AutoTools::AST::AssignmentAST ) + { + AutoTools::AssignmentAST* assignment = static_cast( ( *it ) ); + if ( variable.find( assignment->scopedID ) != -1 ) + { + kdDebug(9020) << k_funcinfo << "Resolving variable '" << variable << "' to '" + << assignment->values.join( QString::null ).stripWhiteSpace() << "'" << endl; + return assignment->values.join( QString::null ).stripWhiteSpace(); + } + } + } + + return variable; +} +//kate: space-indent on; indent-width 4; diff --git a/buildtools/autotools/makefilehandler.h b/buildtools/autotools/makefilehandler.h new file mode 100644 index 00000000..77045fe9 --- /dev/null +++ b/buildtools/autotools/makefilehandler.h @@ -0,0 +1,76 @@ +/* + KDevelop Autotools Support + Copyright (c) 2005 by Matt Rogers + +*************************************************************************** +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +*/ +#ifndef MAKEFILEHANDLER_H +#define MAKEFILEHANDLER_H + +/** + * This class is responsible for taking the data from the Makefile.am parser + * and providing various data list view items can use in the automake manager + * widget + * @author Matt Rogers + */ +namespace AutoTools { +class ProjectAST; +} + +class MakefileHandler +{ +public: + MakefileHandler(); + ~MakefileHandler(); + + /** + * Parse a folder that has supported makefiles in it. The following files + * will be looked for in the following order: + * \li Makefile.am.in + * \li Makefile.am + * \li Makefile.in + * + * \param folder, the folder to parse + * \param recursive if true, subfolders will be parsed - defaults to true + */ + void parse( const QString& folder, bool recursive = true ); + + /** + * Get the AST for a certain path + * \param folderPath the path of the folder to get an AST for + * \return the AST that represents a particular folder + */ + AutoTools::ProjectAST* astForFolder( const QString& folderPath ); + + /** + * Check if a string is an automake variable + * \return true if it is an automake variable, false otherwise + */ + bool isVariable( const QString& item ) const; + + /** + * Find the value for the variable specified by \p variable + * \param variable The name of the variable to look for + * \param ast the AST to use to look for the variable in + * \return the value to substitute for the variable + */ + QString resolveVariable( const QString& variable, + AutoTools::ProjectAST* ast ); + + +private: + class Private; + Private* d; +}; + +#endif + +//kate: space-indent on; indent-width 4; + diff --git a/buildtools/autotools/managecustomcommand.cpp b/buildtools/autotools/managecustomcommand.cpp new file mode 100644 index 00000000..7d111965 --- /dev/null +++ b/buildtools/autotools/managecustomcommand.cpp @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "managecustomcommand.h" + +#include + +#include + +ManageCustomCommand::ManageCustomCommand(QWidget *parent, const char *name) + :ManageCustomBuildCommandsBase(parent, name) +{ +} + +void ManageCustomCommand::addButton_clicked() +{ + commandsTable->setNumRows(commandsTable->numRows() + 1); + setRowProperties(commandsTable->numRows()-1); +} + +void ManageCustomCommand::removeButton_clicked() +{ + commandsTable->removeRow(commandsTable->currentRow()); +} + +void ManageCustomCommand::setRowProperties(int row) +{ + commandsTable->setItem(row, 2, + new QComboTableItem(commandsTable, QStringList::split(",", + i18n("this is a list of items in the combobox", + "Make target,Make target (as root),Make command,Make command (as root),Command,Command (as root)")))); +} + +#include "managecustomcommand.moc" diff --git a/buildtools/autotools/managecustomcommand.h b/buildtools/autotools/managecustomcommand.h new file mode 100644 index 00000000..cda5e54a --- /dev/null +++ b/buildtools/autotools/managecustomcommand.h @@ -0,0 +1,37 @@ +/*************************************************************************** +* Copyright (C) 2004 by Alexander Dymo * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License as * +* published by the Free Software Foundation; either version 2 of the * +* License, or (at your option) any later version. * +* * +* 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 Library General Public * +* License along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ +#ifndef MANAGECUSTOMCOMMAND_H +#define MANAGECUSTOMCOMMAND_H + +#include "managecustomcommandsbase.h" + +class ManageCustomCommand: public ManageCustomBuildCommandsBase +{ + Q_OBJECT +public: + ManageCustomCommand( QWidget *parent = 0, const char *name = 0 ); + + void setRowProperties( int row ); +public slots: + virtual void addButton_clicked(); + virtual void removeButton_clicked(); +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/managecustomcommandsbase.ui b/buildtools/autotools/managecustomcommandsbase.ui new file mode 100644 index 00000000..43164ef5 --- /dev/null +++ b/buildtools/autotools/managecustomcommandsbase.ui @@ -0,0 +1,125 @@ + +ManageCustomBuildCommandsBase + + + ManageCustomBuildCommandsBase + + + true + + + + 0 + 0 + 435 + 218 + + + + + unnamed + + + 0 + + + + addButton + + + &Add + + + + + removeButton + + + &Remove + + + + + + Menu Text + + + + + + + + Command + + + + + + + + Command Type + + + + + + + commandsTable + + + 0 + + + 3 + + + true + + + SingleRow + + + + + spacer4 + + + Vertical + + + Expanding + + + + 20 + 40 + + + + + + + + addButton + clicked() + ManageCustomBuildCommandsBase + addButton_clicked() + + + removeButton + clicked() + ManageCustomBuildCommandsBase + removeButton_clicked() + + + + commandsTable + addButton + removeButton + + + addButton_clicked() + removeButton_clicked() + + + diff --git a/buildtools/autotools/misc.cpp b/buildtools/autotools/misc.cpp new file mode 100644 index 00000000..97c449e7 --- /dev/null +++ b/buildtools/autotools/misc.cpp @@ -0,0 +1,999 @@ +/*************************************************************************** +* Copyright (C) 2001-2002 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "misc.h" + +#include "kdevcompileroptions.h" + + +static KDevCompilerOptions *createCompilerOptions( const QString &name, QObject *parent ) +{ + KService::Ptr service = KService::serviceByDesktopName( name ); + if ( !service ) + { + kdDebug( 9020 ) << "Can't find service " << name << endl; + return 0; + } + + + KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library())); + if (!factory) { + QString errorMessage = KLibLoader::self()->lastErrorMessage(); + kdDebug(9020) << "There was an error loading the module " << service->name() << endl << + "The diagnostics is:" << endl << errorMessage << endl; + exit(1); + } + + QStringList args; + QVariant prop = service->property("X-KDevelop-Args"); + if (prop.isValid()) + args = QStringList::split(" ", prop.toString()); + + QObject *obj = factory->create(parent, service->name().latin1(), + "KDevCompilerOptions", args); + + if (!obj->inherits("KDevCompilerOptions")) { + kdDebug(9020) << "Component does not inherit KDevCompilerOptions" << endl; + return 0; + } + KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj; + + return dlg; + +/* + QStringList args; + QVariant prop = service->property( "X-KDevelop-Args" ); + if ( prop.isValid() ) + args = QStringList::split( " ", prop.toString() ); + + return KParts::ComponentFactory + ::createInstanceFromService( service, parent, + service->name().latin1(), args );*/ +} + + +QString AutoProjectTool::execFlagsDialog( const QString &compiler, const QString &flags, QWidget *parent ) +{ + KDevCompilerOptions * plugin = createCompilerOptions( compiler, parent ); + + if ( plugin ) + { + QString newflags = plugin->exec( parent, flags ); + delete plugin; + return newflags; + } + return QString::null; +} + + +QString AutoProjectTool::canonicalize( const QString &str ) +{ + QString res; + for ( uint i = 0; i < str.length(); ++i ) + res += ( str[ i ].isLetterOrNumber() || str[ i ] == '@' ) ? str[ i ] : QChar( '_' ); + + kdDebug(9020) << k_funcinfo << "normalized '" << str << "' to '" << res << "'" << endl; + return res; +} + + +/** + * Read the Makefile.am and return a map of all the variables. + * Will take notice of backslash and += constructs. + * @param fileName + * @param variables + */ +void AutoProjectTool::parseMakefileam(const QString &fileName, QMap *variables) +{ + QFile f(fileName); + if (!f.open(IO_ReadOnly)) + { + return ; + } + QTextStream stream(&f); + + QRegExp re("^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$"); + + QString last; + bool multiLine = false; + while (!stream.atEnd()) + { + QString s = stream.readLine().stripWhiteSpace(); + if (re.exactMatch(s)) + { + QString lhs = re.cap(2); + QString rhs = re.cap(4); + if (rhs[ rhs.length() - 1 ] == '\\') + { + multiLine = true; + last = lhs; + rhs[rhs.length() - 1] = ' '; + } + + // The need for stripWhiteSpace seems to be a Qt bug. + // make our list nice and neat. + QStringList bits = QStringList::split(" ", rhs); + rhs = bits.join(" "); + if (re.cap(3) == "+=") + { + ((*variables)[lhs] += ' ') += rhs; + } + else + { + variables->insert(lhs, rhs); + } + } + else if (multiLine) + { + if (s[s.length()-1] == '\\') + { + s[s.length()-1] = ' '; + } + else + { + multiLine = false; + } + QStringList bits = QStringList::split(" ", s); + ((*variables)[last] += ' ') += bits.join(" "); + } + } + f.close(); + + QMap list; + + for (QMap::iterator iter = variables->begin();iter != variables->end();iter++) + { + QStringList items = QStringList::split(" ", iter.data()); + QMap unique; + for (uint i = 0;i < items.size();i++) + { + unique.insert(items[i], ""); + } + QString line; + for (QMap::iterator it = unique.begin();it != unique.end();it++) + { + line += it.key() + ' '; + } + if (line.length() > 1) + { + line.setLength(line.length() - 1); + } + + list.insert(iter.key(), line); + } + *variables = list; +} + +/** + * Add entries to a variable. Will just add the variables to the existing line, removing duplicates + * Will preserve += constructs and make sure that the variable only has one copy of the value across + * all += constructs + * @param fileName + * @param variables key=value string of entries to add + */ +void AutoProjectTool::addToMakefileam(const QString &fileName, QMap variables) +{ + AutoProjectTool::addRemoveMakefileam(fileName, variables, true); +} + +/** + * Set entries to a variable. Will set the variables to the existing line, removing duplicates + * Will preserve += constructs and make sure that the variable only has one copy of the value across + * all += constructs + * Adds line if it does not exist. + * @param fileName + * @param variables key=value string of entries to add + */ +void AutoProjectTool::setMakefileam ( const QString &fileName, QMap variables ) +{ + for ( QMap::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0 ) + { + kdDebug ( 9020 ) << "key (set): " << it0.key() << "=" << it0.data() << endl; + } + + // input file reading + QFile fin ( fileName ); + if ( !fin.open ( IO_ReadOnly ) ) + { + return ; + } + QTextStream ins ( &fin ); + + // output file writing. + QFile fout ( fileName + "#" ); + if ( !fout.open ( IO_WriteOnly ) ) + { + fin.close(); + return ; + } + QTextStream outs ( &fout ); + + // variables + QRegExp re ( "^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$" ); + + bool multiLine = false; + QString lastLhs; + QMap seenLhs; + while ( !fin.atEnd() ) + { + QString s = ins.readLine(); + if ( re.exactMatch ( s ) ) + { + QString lhs = re.cap ( 2 ); + bool notFound = ( variables.find ( lhs ) == variables.end() ); + + if ( notFound ) + { + if ( seenLhs.find ( lhs ) == seenLhs.end() ) + { + // not interested in this line at all + // write it out as is.. + outs << s << endl; + } + // we have seen this variable, but since we are setting the + // whole line - we skip this as it will be a += line. + } + else + { + // we are interested in this line.. + QString rhs = re.cap ( 4 ).stripWhiteSpace(); + if ( rhs[ rhs.length() - 1 ] == '\\' ) + { + // save it for when we have the whole line.. + multiLine = true; + lastLhs = lhs; + } + else + { + // deal with it now - a single line + // we are adding our interested values to this line and writing it + // now write the line out if it is not going to be empty. + QString newLine ( lhs ); + newLine += " = "; + bool added = false; + int len = newLine.length(); + QStringList variableList = QStringList::split ( ' ', variables[lhs] ); + for ( uint count = 0; count < variableList.size(); count++ ) + { + len += variableList[count].length() + 1; + if ( len > 80 ) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += variableList[count]; + newLine += ' '; + added = true; + + } + // only print it out if there was a value to add.. + if ( added ) + { + newLine.setLength ( newLine.length() - 1 ); + outs << newLine << endl; + } + seenLhs[lhs] = "done"; + variables.erase ( lhs ); + } + } + } + else if ( multiLine ) + { + s = s.stripWhiteSpace(); + // we are only here if were interested in this line.. + if ( s[s.length()-1] == '\\' ) + { + s.setLength ( s.length() - 1 ); + // still more multi line we wait for.. + } + else + { + // end of the multi line.. + multiLine = false; + } + + if ( !multiLine ) + { + // we are adding our interested values to this line and writing it + // now write the line out if it is not going to be empty. + QString newLine ( lastLhs ); + newLine += " = "; + bool added = false; + int len = newLine.length(); + QStringList variableList = QStringList::split ( ' ', variables[lastLhs] ); + for ( uint count = 0; count < variableList.size(); count++ ) + { + len += variableList[count].length() + 1; + if ( len > 80 ) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += variableList[count]; + newLine += ' '; + added = true; + } + // only print it out if there was a value to add.. + if ( added ) + { + newLine.setLength ( newLine.length() - 1 ); + outs << newLine << endl; + } + seenLhs[lastLhs] = "done"; + variables.erase ( lastLhs ); + lastLhs.setLength ( 0 ); + } + } + else + { + // can write this line out.. + // not a match, not a multi line, + outs << s << endl; + } + } + + for ( QMap::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0 ) + { + QString newLine ( it0.key() ); + newLine += " = "; + bool added = false; + int len = newLine.length(); + QStringList variableList = QStringList::split ( ' ', it0.data() ); + for ( uint count = 0; count < variableList.size(); count++ ) + { + len += variableList[count].length() + 1; + if ( len > 80 ) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += variableList[count]; + newLine += ' '; + added = true; + + } + // only print it out if there was a value to add.. + if ( added ) + { + newLine.setLength ( newLine.length() - 1 ); + outs << newLine << endl; + } + } + + fin.close(); + fout.close(); + + QDir().rename ( fileName + "#", fileName ); +} + + +/** + * Add entries to a variable. Will just add the variables to the existing line, removing duplicates + * Will preserve += constructs and make sure that the variable only has one copy of the value across + * all += constructs + * @param fileName + * @param variables key=value string of entries to add + * @param add true= add these key,value pairs, false = remove. You can have empty values for an add - the whole line is + * removed. For adding, we will not add an empty line. + */ +void AutoProjectTool::addRemoveMakefileam(const QString &fileName, QMap variables, bool add) +{ + // input file reading + QFile fin(fileName); + if (!fin.open(IO_ReadOnly)) + { + return ; + } + QTextStream ins(&fin); + + // output file writing. + QFile fout(fileName + "#"); + if (!fout.open(IO_WriteOnly)) + { + fin.close(); + return ; + } + QTextStream outs(&fout); + + // variables + QRegExp re("^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$"); + + // build key=map of values to add + // map can be empty.we never add an empty key, but do remove empty keys from the file.. + QDict< QMap > interest; + for (QMap::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0) + { + kdDebug(9020) << "key (" << add<<"): " << it0.key() << "="<< it0.data() << endl; + + QMap* set = new QMap(); + if (!it0.data().stripWhiteSpace().isEmpty()) + { + QStringList variableList = QStringList::split(' ', it0.data()); + + for (uint i = 0; i < variableList.count(); i++) + { + set->insert(variableList[i], true); + } + } + interest.insert(it0.key(), set); + } + + bool multiLine = false; + QString lastLhs; + QStringList lastRhs; + QMap seenLhs; + while (!fin.atEnd()) + { + QString s = ins.readLine(); + if (re.exactMatch(s)) + { + QString lhs = re.cap(2); + QMap* ourRhs = interest.find(lhs); + + if (!ourRhs) + { + // not interested in this line at all + // write it out as is.. + outs << s << endl; + } + else + { + // we are interested in this line.. + QString rhs = re.cap(4).stripWhiteSpace(); + if (rhs[ rhs.length() - 1 ] == '\\') + { + // save it for when we have the whole line.. + multiLine = true; + lastLhs = lhs; + rhs.setLength(rhs.length() - 1); + lastRhs += QStringList::split(" ", rhs); + } + else + { + // deal with it now. + + QStringList bits = QStringList::split(" ", rhs); + if (add) + { + // we are adding our interested values to this line and writing it + + // add this line to we we want to add to remove duplicates. + for (uint index = 0; index < bits.size(); index++) + { + QMap::iterator findEntry = ourRhs->find(bits[index]); + if (findEntry == ourRhs->end()) + { + // we haven't seen it, so add it, so we don't add it again later.. + ourRhs->insert(bits[index], true); + } + // else we have this value in our 'to add list' , it is either already been + // added, so we don't want to add it again, or it hasn't been added, in which + // case we will do so soon. so we can ignore this now.. + } + // now write the line out if it is not going to be empty. + QString newLine(lhs); + if (seenLhs.find(lhs) == seenLhs.end()) + { + newLine += " = "; + seenLhs[lhs] = ""; + } + else + { + newLine += " += "; + } + + int len = newLine.length(); + bool added = false; + QValueList keys = ourRhs->keys(); + for (uint count = 0; count < keys.size(); count++) + { + // if out entry is true, add it.. + if ((*ourRhs)[keys[count]]) + { + added = true; + len += keys[count].length() + 1; + if (len > 80) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += keys[count]; + newLine += ' '; + // set our value so we don't add it again. + (*ourRhs)[keys[count]] = false; + } + } + // only print it out if there was a value to add.. + if (added) + { + newLine.setLength(newLine.length() - 1); + outs << newLine << endl; + } + } + else + { + // we are removing our interested values from this line + + // special case - no values, remove the line.. + if (!ourRhs->empty()) + { + // check if any of these values are down to remove. + QString newLine(lhs); + if (seenLhs.find(lhs) == seenLhs.end()) + { + newLine += " = "; + seenLhs[lhs] = ""; + } + else + { + newLine += " += "; + } + + int len = newLine.length(); + bool added = false; + for (QStringList::Iterator posIter = bits.begin(); posIter != bits.end();posIter++) + { + QMap::iterator findEntry = ourRhs->find(*posIter); + if (findEntry == ourRhs->end()) + { + // we do not want to remove it.. + added = true; + len += (*posIter).length() + 1; + if (len > 80) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += (*posIter); + newLine += ' '; + } + // else we have this value in our 'to remove list', so don't add it. + } + // only print it out if there was a value on it.. + if (added) + { + newLine.setLength(newLine.length() - 1); + outs << newLine << endl; + } + } + }//if (add) + }//if ( rhs[ rhs.length() - 1 ] == '\\' ) + }//if ( found == interest.end()) + } + else if (multiLine) + { + s = s.stripWhiteSpace(); + // we are only here if were interested in this line.. + if (s[s.length()-1] == '\\') + { + s.setLength(s.length() - 1); + // still more multi line we wait for.. + } + else + { + // end of the multi line.. + multiLine = false; + } + lastRhs += QStringList::split(" ", s); + + if (!multiLine) + { + // now we have to deal with this multiLine value.. + // ourRhs will always be a value, as we only get multiLine if we're interested in it.. + QMap* ourRhs = interest.find(lastLhs); + + if (add) + { + // we are adding our interested values to this line and writing it + + // add this line to we we want to add to remove duplicates. + for (uint index = 0; index < lastRhs.size(); index++) + { + QMap::iterator findEntry = ourRhs->find(lastRhs[index]); + if (findEntry == ourRhs->end()) + { + // we haven't seen it, so add it, so we don't add it again later.. + ourRhs->insert(lastRhs[index], true); + } + // else we have this value in our 'to add list' , it is either already been + // added, so we don't want to add it again, or it hasn't been added, in which + // case we will do so soon. so we can ignore this now.. + } + // now write the line out if it is not going to be empty. + QString newLine(lastLhs); + if (seenLhs.find(lastLhs) == seenLhs.end()) + { + newLine += " = "; + seenLhs[lastLhs] = ""; + } + else + { + newLine += " += "; + } + + int len = newLine.length(); + bool added = false; + QValueList keys = ourRhs->keys(); + for (uint count = 0; count < keys.size(); count++) + { + // if out entry is true, add it.. + if ((*ourRhs)[keys[count]]) + { + added = true; + len += keys[count].length() + 1; + if (len > 80) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += keys[count]; + newLine += ' '; + // set our value so we don't add it again. + (*ourRhs)[keys[count]] = false; + } + } + // only print it out if there was a value to add.. + if (added) + { + newLine.setLength(newLine.length() - 1); + outs << newLine << endl; + } + } + else + { + // we are removing our interested values from this line + // special case - no values, remove the line.. + if (!ourRhs->empty()) + { + // check if any of these values are down to remove. + QString newLine(lastLhs); + if (seenLhs.find(lastLhs) == seenLhs.end()) + { + newLine += " = "; + seenLhs[lastLhs] = ""; + } + else + { + newLine += " += "; + } + int len = newLine.length(); + bool added = false; + for (QStringList::Iterator posIter = lastRhs.begin(); posIter != lastRhs.end();posIter++) + { + QMap::iterator findEntry = ourRhs->find(*posIter); + if (findEntry == ourRhs->end()) + { + // we do not want to remove it.. + added = true; + len += (*posIter).length() + 1; + if (len > 80) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += (*posIter); + newLine += ' '; + } + // else we have this value in our 'to remove list', so don't add it. + } + // only print it out if there was a value on it.. + if (added) + { + newLine.setLength(newLine.length() - 1); + outs << newLine << endl; + } + } + } + + lastLhs.setLength(0); + lastRhs.clear(); + } + } + else + { + // can write this line out.. + // not a match, not a multi line, + outs << s << endl; + } + } + + if (add) + { + QDictIterator > it(interest); + for (; it.current(); ++it) + { + QString lhs = it.currentKey(); + QMap* ourRhs = it.current(); + + QString newLine(lhs); + if (seenLhs.find(lhs) == seenLhs.end()) + { + newLine += " = "; + seenLhs[lastLhs] = ""; + } + else + { + newLine += " += "; + } + int len = newLine.length(); + bool added = false; + QValueList keys = ourRhs->keys(); + for (uint count = 0; count < keys.size(); count++) + { + if ((*ourRhs)[keys[count]]) + { + added = true; + len += keys[count].length() + 1; + if (len > 80) + { + newLine += "\\\n\t"; + len = 8; + } + newLine += keys[count]; + newLine += ' '; + // set our value so we don't add it again. + (*ourRhs)[keys[count]] = false; + } + } + // only print it out if there was a value to add.. + if (added) + { + newLine.setLength(newLine.length() - 1); + outs << newLine << endl; + } + } + } + interest.setAutoDelete(true); + interest.clear(); + + fin.close(); + fout.close(); + + QDir().rename(fileName + "#", fileName); +} + +/** + * Any items in the map will be removed from the Makefile.am + * Empty lines are removed. eg. foo_LDDADD if empty is removed. + * @param fileName full path to Makefile.am + * @param variables lines to remove items from. + */ +void AutoProjectTool::removeFromMakefileam(const QString &fileName, QMap variables) +{ + AutoProjectTool::addRemoveMakefileam(fileName, variables, false); +} + + +/** + * Open the file and parse out the AC_OUTPUT line. following backslash continue lines.. + * @param configureinpath + * @return list of all the values + */ +QStringList AutoProjectTool::configureinLoadMakefiles(QString configureinpath) +{ + QFile configurein(configureinpath); + + if (!configurein.open(IO_ReadOnly)) + { + kdDebug(9020) << k_funcinfo << " - couldn't open file: " << configureinpath << endl; + return QStringList(); + } + + QTextStream stream(&configurein); + QStringList list; + + QString ac_match("^AC_OUTPUT"); + + QRegExp ac_regex(ac_match); + bool multiLine = false; + QChar cont('\\'); + QRegExp close("\\)"); + QRegExp open("\\("); + while (!stream.eof()) + { + QString line = stream.readLine().stripWhiteSpace(); + if (multiLine) + { + if (close.search(line) >= 0) + { + line = line.replace(close.search(line), 1, ""); + list += QStringList::split(" ", line); + break; + } + else + { + if (line.endsWith(cont)) + { + line.setLength(line.length() - 1); + } + list += QStringList::split(" ", line); + } + } + else if (ac_regex.search(line) >= 0) + { + line = line.replace(ac_regex.search(line), ac_match.length() - 1, ""); + + if (open.search(line) >= 0) + { + line = line.replace(open.search(line), 1, ""); + } + + if (line.endsWith(cont)) + { + line.setLength(line.length() - 1); + multiLine = true; + } + else + { + if (close.search(line) >= 0) + { + line = line.replace(close.search(line), 1, ""); + } + } + + list = QStringList::split(" ", line); + + if (!multiLine) + { + break; + } + } + } + + configurein.close(); + + // make a new object on the heap + return list; + +} + +/** + * Write the items to the AC_OUTPUT line. This replaces the exiting line. + * @param configureinpath + * @param makefiles + */ +void AutoProjectTool::configureinSaveMakefiles(QString fileName, QStringList makefiles) +{ + // input file reading + QFile fin(fileName); + if (!fin.open(IO_ReadOnly)) + { + return ; + } + QTextStream ins(&fin); + + // output file writing. + QFile fout(fileName + "#"); + if (!fout.open(IO_WriteOnly)) + { + fin.close(); + return ; + } + QTextStream outs(&fout); + + // remove duplicates if any.. + QMap toAdd; + for (uint i = 0; i < makefiles.size();i++) + { + toAdd.insert(makefiles[i].stripWhiteSpace(), ""); + } + + QString ac_match("^AC_OUTPUT"); + QRegExp ac_regex(ac_match); + bool multiLine = false; + QChar cont('\\'); + QRegExp close("\\)"); + QRegExp open("\\("); + bool done = false; + while (!fin.atEnd()) + { + QString line = ins.readLine(); + if (done) + { + outs << line << endl; + } + else + { + if (multiLine) + { + line = line.stripWhiteSpace(); + if (close.search(line) >= 0) + { + int len = 10; + QString acline("AC_OUTPUT("); + for (QMap::iterator iter = toAdd.begin();iter != toAdd.end();iter++) + { + len += iter.key().length(); + if (len > 80) + { + acline += "\\\n\t"; + len = 8; + } + acline += iter.key(); + acline += ' '; + } + acline.setLength(acline.length() - 1); + acline = acline.append(")"); + outs << acline << endl; + done = true; + } + else + { + if (line.endsWith(cont)) + { + line.setLength(line.length() - 1); + } + } + } + else if (ac_regex.search(line) >= 0) + { + line = line.stripWhiteSpace(); + line = line.replace(ac_regex.search(line), ac_match.length() - 1, ""); + if (line.endsWith(cont)) + { + line.setLength(line.length() - 1); + multiLine = true; + } + if (open.search(line) >= 0) + { + line = line.replace(open.search(line), 1, ""); + } + if (close.search(line) >= 0) + { + line = line.replace(close.search(line), 1, ""); + } + + if (!multiLine) + { + int len = 10; + QString acline("AC_OUTPUT("); + for (QMap::iterator iter = toAdd.begin();iter != toAdd.end();iter++) + { + len += iter.key().length(); + if (len > 80) + { + acline += "\\\n\t"; + len = 8; + } + acline += iter.key(); + acline += ' '; + } + acline.setLength(acline.length() - 1); + acline = acline.append(")"); + outs << acline << endl; + done = true; + } + } + else + { + outs << line << endl; + } + } + } + + fin.close(); + fout.close(); + + QDir().rename(fileName + "#", fileName); + +} + +//kate: indent-mode csands; space-indent off; tab-width 4; diff --git a/buildtools/autotools/misc.h b/buildtools/autotools/misc.h new file mode 100644 index 00000000..9db9919e --- /dev/null +++ b/buildtools/autotools/misc.h @@ -0,0 +1,65 @@ +/*************************************************************************** +* Copyright (C) 2001-2002 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _MISC_H_ +#define _MISC_H_ + +#include +#include +#include + +/** + * Very small helper class. It has just static methods. + */ +class AutoProjectTool +{ +public: + + /** + * Loads the compiler options plugin for the given compiler, executes the dialog + * with some initial flags, and returns the new flags. + */ + static QString execFlagsDialog( const QString &compiler, const QString &flags, QWidget *parent ); + + /** + * Returns the canonicalized version of a file name, i.e. + * the file name with special characters replaced by underscores + */ + static QString canonicalize( const QString &str ); + + /** + * Parses a Makefile.am and stores its variable assignments + * in a map. + */ + static void parseMakefileam( const QString &filename, QMap *variables ); + + static void addToMakefileam( const QString &filename, QMap variables ); + static void removeFromMakefileam( const QString &filename, QMap variables ); + static void setMakefileam ( const QString &fileName, QMap variables ); + + static void addRemoveMakefileam(const QString &fileName, QMap variables, bool add); + + /** + * Parses configure.in and splits AC_OUTPUT into a QStringList + */ + static QStringList configureinLoadMakefiles( QString configureinpath ); + + /** + * Receives a QStringList and puts it into + * configure.in as arguments to AC_OUTPUT + */ + static void configureinSaveMakefiles( QString configureinpath, QStringList makefiles ); + +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/removefiledlg.cpp b/buildtools/autotools/removefiledlg.cpp new file mode 100644 index 00000000..2c3bc37f --- /dev/null +++ b/buildtools/autotools/removefiledlg.cpp @@ -0,0 +1,182 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "removefiledlg.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "misc.h" +#include "autoprojectpart.h" +#include "autoprojectwidget.h" +#include "autodetailsview.h" + +static bool fileListContains(const QPtrList &list, const QString &name) +{ + QPtrListIterator it(list); + for (; it.current(); ++it) + if ((*it)->text(0) == name) + return true; + return false; +} + + +RemoveFileDialog::RemoveFileDialog(AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem, + TargetItem *item, const QString &filename, + QWidget *parent, const char *name) + : RemoveFileDlgBase(parent, name, true) +{ + removeFromTargetsCheckBox = 0; + + QStringList targets; + + QPtrListIterator it(spitem->targets); + for (; it.current(); ++it) + if (fileListContains((*it)->sources, filename)) + targets.append((*it)->name); + + if (targets.count() > 1) + { + removeFromTargetsCheckBox = new QCheckBox( fileGroupBox, "removeFromTargetsCheckBox" ); + removeFromTargetsCheckBox->setMinimumSize( QSize( 0, 45 ) ); + fileLayout->addWidget( removeFromTargetsCheckBox ); + + QString joinedtargets = " *" + targets.join("\n *"); + removeFromTargetsCheckBox->setText ( i18n ( "The file %1 is still used by the following targets:\n%2\n" + "Remove it from all of them?").arg(filename).arg(joinedtargets) ); + setMinimumSize(QSize(size().width(), size().height() + removeFromTargetsCheckBox->size().height()*2) ); + } + + removeLabel->setText ( i18n ( "Do you really want to remove %1?" ).arg ( filename ) ); + + directoryLabel->setText ( spitem->path ); + if ( item->name.isEmpty() ) + targetLabel->setText ( i18n ( "%1 in %2" ).arg ( item->primary ).arg ( item->prefix ) ); + else + targetLabel->setText ( item->name ); + + connect ( removeButton, SIGNAL ( clicked() ), this, SLOT ( accept() ) ); + connect ( cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) ); + + setIcon ( SmallIcon ( "editdelete.png" ) ); + + m_widget = widget; + m_part = part; + subProject = spitem; + target = item; + fileName = filename; +} + + +RemoveFileDialog::~RemoveFileDialog() +{} + + +void RemoveFileDialog::accept() +{ + m_widget->emitRemovedFile ( subProject->path.mid ( m_part->projectDirectory().length() + 1 ) + "/" + fileName ); + + QMap replaceMap; + + if (removeFromTargetsCheckBox && removeFromTargetsCheckBox->isChecked()) { + QPtrListIterator it(subProject->targets); + for (; it.current(); ++it) { + if ((*it) != target && fileListContains((*it)->sources, fileName)) { + FileItem *fitem = static_cast((*it)->firstChild()); + while (fitem) { + FileItem *nextitem = static_cast(fitem->nextSibling()); + if (fitem->text(0) == fileName) { + QListView *lv = fitem->listView(); + lv->setSelected(fitem, false); + (*it)->sources.remove(fitem); + } + fitem = nextitem; + } + QString canontargetname = AutoProjectTool::canonicalize((*it)->name); + QString varname; + if( (*it)->primary == "PROGRAMS" || (*it)->primary == "LIBRARIES" || (*it)->primary == "LTLIBRARIES" ) + varname = canontargetname + "_SOURCES"; + else + varname = (*it)->prefix + "_" + (*it)->primary; + QStringList sources = QStringList::split(QRegExp("[ \t\n]"), subProject->variables[varname]); + sources.remove(fileName); + subProject->variables[varname] = sources.join(" "); + replaceMap.insert(varname, fileName); + } + } + } + + QString fileItemName; + FileItem *fitem = static_cast(target->firstChild()); + while (fitem) { + if (fitem->text(0) == fileName) { + QListView *lv = fitem->listView(); + lv->setSelected(fitem, false); + fileItemName = fitem->name; + target->sources.remove(fitem); + break; + } + fitem = static_cast(fitem->nextSibling()); + } + QString canontargetname = AutoProjectTool::canonicalize(target->name); + QString varname; + if( target->primary == "PROGRAMS" || target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES" ) + varname = canontargetname + "_SOURCES"; + else + varname = target->prefix + "_" + target->primary; + QStringList sources = QStringList::split(QRegExp("[ \t\n]"), subProject->variables[varname]); + sources.remove(fileName); + subProject->variables[varname] = sources.join(" "); + replaceMap.insert(varname, fileName); + + AutoProjectTool::removeFromMakefileam(subProject->path + "/Makefile.am", replaceMap); + +// review configuration cleanup in the project file after removing subclassing related source + QDomDocument &dom = *(m_part->projectDom()); + + QDomElement el = dom.documentElement(); + QDomNode el2 = el.namedItem("kdevautoproject"); + QDomNode el3 = el2.namedItem("subclassing"); + + QDomNode n = el3.firstChild(); + QValueList nodesToRemove; + while ( !n.isNull() ) { + QDomNamedNodeMap attr = n.attributes(); + QString fpath = subProject->path + QString("/") + fileItemName; + QString relpath = fpath.remove(0, m_part->projectDirectory().length()); + if ((attr.item(0).nodeValue() == relpath) + || (attr.item(1).nodeValue() == relpath) ) + nodesToRemove.append(n); + n = n.nextSibling(); + } + QValueList::iterator it; + for ( it = nodesToRemove.begin(); it != nodesToRemove.end(); ++it ) + el3.removeChild(*it); + + if (removeCheckBox->isChecked()) + QFile::remove(subProject->path + "/" + fileName); + + QDialog::accept(); +} + +#include "removefiledlg.moc" diff --git a/buildtools/autotools/removefiledlg.h b/buildtools/autotools/removefiledlg.h new file mode 100644 index 00000000..ab843dda --- /dev/null +++ b/buildtools/autotools/removefiledlg.h @@ -0,0 +1,51 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _REMOVEFILEDLG_H_ +#define _REMOVEFILEDLG_H_ + +#include + +#include "removefiledlgbase.h" + +class QCheckBox; +class AutoProjectWidget; +class AutoProjectPart; +class SubprojectItem; +class TargetItem; + + +class RemoveFileDialog : public RemoveFileDlgBase +{ + Q_OBJECT + +public: + RemoveFileDialog( AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem, + TargetItem *item, const QString &filename, + QWidget *parent = 0, const char *name = 0 ); + ~RemoveFileDialog(); + +protected: + virtual void accept(); + +private: + QCheckBox *removeFromTargetsCheckBox; + //QCheckBox *removefromdisk_box; + + AutoProjectWidget* m_widget; + AutoProjectPart *m_part; + SubprojectItem *subProject; + TargetItem *target; + QString fileName; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/removefiledlgbase.ui b/buildtools/autotools/removefiledlgbase.ui new file mode 100644 index 00000000..d7b66011 --- /dev/null +++ b/buildtools/autotools/removefiledlgbase.ui @@ -0,0 +1,233 @@ + +RemoveFileDlgBase + + + RemoveFileDlgBase + + + + 0 + 0 + 447 + 284 + + + + Remove File From This Target + + + + unnamed + + + + layout4 + + + + unnamed + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 247 + 20 + + + + + + removeButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + fileGroupBox + + + + 0 + 0 + + + + &File Information + + + + unnamed + + + + fileLayout + + + + unnamed + + + + removeLabel + + + [REMOVE QUESTION] + + + + + removeCheckBox + + + Also &remove it from disk + + + + + noticeLabel + + + + 200 + 0 + + + + <b>Note:</b> You will not be able to undelete the file. + + + + + + + + + targetBox + + + + 5 + 0 + 0 + 0 + + + + Subproject Information + + + + unnamed + + + + targetLabel + + + + 5 + 1 + 0 + 0 + + + + [TARGET NAME] + + + + + directoryStaticLabel + + + + 0 + 1 + 0 + 0 + + + + + + + + Directory: + + + + + targetStaticLabel + + + + 0 + 1 + 0 + 0 + + + + + + + + Target: + + + + + directoryLabel + + + + 5 + 1 + 0 + 0 + + + + [DIRECTORY NAME] + + + + + + + + removeCheckBox + removeButton + cancelButton + + + ksqueezedtextlabel.h + kdialog.h + + + + diff --git a/buildtools/autotools/removetargetdlg.cpp b/buildtools/autotools/removetargetdlg.cpp new file mode 100644 index 00000000..6104e404 --- /dev/null +++ b/buildtools/autotools/removetargetdlg.cpp @@ -0,0 +1,279 @@ +/*************************************************************************** + ------------------- + begin : 21.11.2002 + copyright : (C) 2002 by Victor R�er + email : victor_roeder@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "removetargetdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "autolistviewitems.h" + +#include "misc.h" + +#include "autoprojectpart.h" +#include "autoprojectwidget.h" + + +RemoveTargetDialog::RemoveTargetDialog( AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem, + TargetItem *titem, QWidget* parent, const char* name ) + : RemoveTargetDlgBase ( parent, name, true, 0 ) +{ + removeLabel->setText ( i18n ( "Do you really want to remove %1
with all files that are attached to it
and all dependencies?" ).arg ( titem->name ) ); + directoryLabel->setText ( spitem->path ); + + if ( titem->name.isEmpty() ) + targetLabel->setText ( i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ) ); + else + targetLabel->setText ( titem->name ); + + connect ( removeButton, SIGNAL ( clicked() ), this, SLOT ( accept() ) ); + connect ( cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) ); + + setIcon ( SmallIcon ( "editdelete" ) ); + + progressBar->hide(); + + m_spitem = spitem; + m_titem = titem; + m_widget = widget; + m_part = part; + + //kdDebug ( 9020 ) << "+++++ " << titem->primary << " " << titem->prefix << " " << titem->name << endl; + + init(); +} + + +RemoveTargetDialog::~RemoveTargetDialog() +{ +} + +void RemoveTargetDialog::init() +{ + QPtrList subprojectItems = m_widget->allSubprojectItems(); + + TargetItem* titem = 0; + + for ( SubprojectItem* spitem = subprojectItems.first(); spitem; spitem = subprojectItems.next() ) + { + if ( m_titem->name.isEmpty() ) + break; + + for ( titem = spitem->targets.first(); titem; titem = spitem->targets.next() ) + { + if ( m_titem->name == titem->name ) + continue; + + if ( titem->primary == "LTLIBRARIES" || titem->primary == "PROGRAMS" + || titem->primary == "LIBRARIES" || titem->primary == "JAVA" ) + { + QString canonname = AutoProjectTool::canonicalize ( titem->name ); + + if ( spitem->variables[canonname + "_LIBADD"].contains ( m_titem->name ) > 0 || + spitem->variables[canonname + "_LDADD"].contains ( m_titem->name ) > 0 ) + { + dependencyListBox->insertItem ( SmallIcon ( "target_kdevelop" ), spitem->path + " (" + titem->name + ")" ); + + dependentSubprojects.append ( spitem ); + } + } + } + } + + if ( dependencyListBox->count() == 0 ) + dependencyListBox->insertItem ( i18n("no dependency", "") ); +} + +void RemoveTargetDialog::accept () +{ + progressBar->show(); + progressBar->setFormat ( i18n ( "Removing Target... %p%" ) ); + + qApp->processEvents(); + + QString canonname = AutoProjectTool::canonicalize ( m_titem->name ); + QString varname = m_titem->prefix + "_" + m_titem->primary; + + SubprojectItem* spitem = 0; + TargetItem* titem = 0; + + QMap removeMap; + QMap replaceMap; + + // Remove dependencies to other targets first (stored by init() in 'dependentTargets') + for ( spitem = dependentSubprojects.first(); spitem; spitem = dependentSubprojects.next() ) + { + for ( titem = spitem->targets.first(); titem; titem = spitem->targets.next() ) + { + QString curVarname; + QString curCanonname = AutoProjectTool::canonicalize ( titem->name ); + QStringList dependencies; + + if ( spitem->variables[curCanonname + "_LIBADD"].contains ( m_titem->name ) ) + curVarname = curCanonname + "_LIBADD"; + else + curVarname = curCanonname + "_LDADD"; + + dependencies = QStringList::split(QRegExp("[ \t\n]"), spitem->variables[curVarname]); + + //QStringList::Iterator it = dependencies.begin(); + + for ( uint i = 0; i < dependencies.size(); ++i ) + { + QString s = dependencies[i]; + if ( s.contains ( m_titem->name ) > 0 ) + dependencies.remove ( s ); + } + + // if we removed the last entry of "blabla_LDADD" or "blabla_LIBADD", remove the complete line + if ( dependencies.count() == 0 ) + { + removeMap.insert ( curVarname, "" ); + AutoProjectTool::removeFromMakefileam ( spitem->path + "/Makefile.am", removeMap ); + removeMap.clear(); + } + else + { + spitem->variables[curVarname] = dependencies.join ( " " ); + replaceMap.insert ( curVarname, spitem->variables[curVarname] ); + AutoProjectTool::addToMakefileam ( spitem->path + "/Makefile.am", replaceMap ); + replaceMap.clear(); + } + } + } + + // handling am_edit stuff + if ( m_titem->primary == "KDEICON" ) + removeMap.insert ( "KDE_ICON", "" ); + else if ( m_titem->primary == "KDEDOCS" ) + removeMap.insert ( "KDE_DOCS", "" ); + else + { + // if we have bin_PROGRAMS = [target to be deleted] [other target] + // delete only the [target to be deleted], not the whole line! + QStringList targets = QStringList::split(QRegExp("[ \t\n]"), m_spitem->variables[varname]); + + if ( targets.count() > 1 ) + { + targets.remove ( m_titem->name ); + m_spitem->variables[varname] = targets.join ( " " ); + replaceMap.insert ( varname, m_spitem->variables[varname] ); + AutoProjectTool::addToMakefileam ( m_spitem->path + "/Makefile.am", replaceMap ); + replaceMap.clear(); + } + else + { + removeMap.insert ( varname, m_titem->name ); + } + } + + // if we have no such line containing blabla_SOURCES, blabla_LDFLAGS, etc. + // they are ignored + removeMap.insert ( canonname + "_SOURCES", "" ); + + // remove from our internal list + m_spitem->variables.erase(canonname+"_SOURCES"); + + if ( m_titem->primary == "PROGRAMS" || m_titem->primary == "LTLIBRARIES" ) + { + removeMap.insert ( canonname + "_LDFLAGS", "" ); + removeMap.insert ( canonname + "_DEPENDENCIES", "" ); + removeMap.insert ( canonname + "_LDADD", "" ); + removeMap.insert ( canonname + "_LIBADD", "" ); + } + + AutoProjectTool::removeFromMakefileam ( m_spitem->path + "/Makefile.am", removeMap ); + + removeMap.clear(); + + // if we have another "blabla_PROGRAMS" or "blabla_LTLIBRARIES" target in the same subproject + // check if it has an empty "blabla_LIBADD"-entry + if ( m_titem->primary == "PROGRAMS" || m_titem->primary == "LTLIBRARIES" ) + { + for ( titem = m_spitem->targets.first(); titem; titem = m_spitem->targets.next() ) + { + //kdDebug (9020) << "******** " << m_spitem->subdir << endl; + if ( titem->primary == "PROGRAMS" || titem->primary == "LTLIBRARIES" ) + { + QString curCanonname = AutoProjectTool::canonicalize ( titem->name ); + + if ( m_spitem->variables[curCanonname + "_LIBADD"].isEmpty() ) + { + removeMap.insert ( curCanonname + "_LIBADD", "" ); + + //kdDebug (9020) << "Removing from " << m_spitem->subdir << " " << curCanonname << "_LIBADD" << endl; + + AutoProjectTool::removeFromMakefileam ( m_spitem->path + "/Makefile.am", removeMap ); + + removeMap.clear(); + } + } + } + } + + + progressBar->setTotalSteps ( m_titem->sources.count() ); + + QStringList fileList; + + for ( FileItem* fitem = m_titem->sources.first(); fitem; fitem = m_titem->sources.next() ) + { + if (removeCheckBox->isChecked()) + { + // before removing the files, check if they are mentioned in "noinst_HEADERS = blabla1.h blabla2.h" + QStringList noInstHeaders = QStringList::split ( QRegExp ( "[ \t\n]" ), m_spitem->variables["noinst_HEADERS"] ); + + if ( noInstHeaders.contains ( fitem->name ) ) + { + noInstHeaders.remove ( fitem->name ); + + m_spitem->variables["noinst_HEADERS"] = noInstHeaders.join ( " " ); + replaceMap.insert ( "noinst_HEADERS", m_spitem->variables["noinst_HEADERS"] ); + AutoProjectTool::addToMakefileam ( m_spitem->path + "/Makefile.am", replaceMap ); + replaceMap.clear(); + } + + QFile::remove(m_spitem->path + "/" + fitem->name); + } + + fileList.append ( m_spitem->path.mid ( m_part->projectDirectory().length() + 1 ) + "/" + fitem->name ); + + qApp->processEvents(); + + progressBar->setValue ( progressBar->value() + 1 ); + } + + m_widget->emitRemovedFiles ( fileList ); + + m_spitem->targets.remove ( m_titem ); + + + QDialog::accept(); +} diff --git a/buildtools/autotools/removetargetdlg.h b/buildtools/autotools/removetargetdlg.h new file mode 100644 index 00000000..6953d2bf --- /dev/null +++ b/buildtools/autotools/removetargetdlg.h @@ -0,0 +1,55 @@ +/*************************************************************************** + ------------------- + begin : 21.11.2002 + copyright : (C) 2002 by Victor Rder + email : victor_roeder@gmx.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _REMOVETARGETDLG_H_ +#define _REMOVETARGETDLG_H_ + +#include "removetargetdlgbase.h" + +#include + +class AutoProjectWidget; +class AutoProjectPart; +class SubprojectItem; +class TargetItem; + +/** + * + * KDevelop Authors + **/ +class RemoveTargetDialog : public RemoveTargetDlgBase +{ + +public: + RemoveTargetDialog( AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem, + TargetItem *titem, QWidget* parent = 0, const char* name = 0 ); + ~RemoveTargetDialog(); + +private: + SubprojectItem* m_spitem; + TargetItem* m_titem; + AutoProjectWidget* m_widget; + AutoProjectPart* m_part; + + QPtrList dependentSubprojects; + +protected: + void init (); + virtual void accept(); +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/removetargetdlgbase.ui b/buildtools/autotools/removetargetdlgbase.ui new file mode 100644 index 00000000..8e3660d3 --- /dev/null +++ b/buildtools/autotools/removetargetdlgbase.ui @@ -0,0 +1,264 @@ + +RemoveTargetDlgBase + + + RemoveTargetDlgBase + + + + 0 + 0 + 472 + 477 + + + + Remove Target From [SUBPROJECT] + + + + unnamed + + + + targetBox + + + Subproject Information + + + + unnamed + + + + directoryLabel + + + + 5 + 5 + 0 + 0 + + + + [TARGET DIRECTORY] + + + + + targetLabel + + + [TARGET NAME] + + + + + directoryStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + + + + Directory: + + + + + targetStaticLabel + + + + 0 + 5 + 0 + 0 + + + + + + + + Target: + + + + + + + fileGroupBox + + + + 0 + 0 + + + + + 32767 + 140 + + + + &Target Information + + + + unnamed + + + + removeLabel + + + [REMOVE QUESTION] + + + + + removeCheckBox + + + Also &remove it from disk + + + + + textLabel + + + + 200 + 0 + + + + <b>Note:</b> You will not be able to undo this operation. Please check your Makefile.am afterwards. + + + + + + + groupBox3 + + + &Dependencies to Other Subprojects + + + + unnamed + + + + dependencyListBox + + + false + + + NoSelection + + + + + + + progressBar + + + true + + + + + Spacer2 + + + Vertical + + + Fixed + + + + 20 + 16 + + + + + + buttonLayout + + + + unnamed + + + 0 + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 30 + 20 + + + + + + removeButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + + kdialog.h + + + + + ksqueezedtextlabel.h + klistbox.h + kprogress.h + + diff --git a/buildtools/autotools/subprojectoptionsdlg.cpp b/buildtools/autotools/subprojectoptionsdlg.cpp new file mode 100644 index 00000000..5ad6bf10 --- /dev/null +++ b/buildtools/autotools/subprojectoptionsdlg.cpp @@ -0,0 +1,404 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "subprojectoptionsdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "domutil.h" +#include "misc.h" +#include "addprefixdlg.h" + +#include "autolistviewitems.h" + +#include "autoprojectpart.h" +#include "autoprojectwidget.h" + + +SubprojectOptionsDialog::SubprojectOptionsDialog(AutoProjectPart *part, AutoProjectWidget *widget, + SubprojectItem *item, QWidget *parent, const char *name) + : SubprojectOptionsDialogBase(parent, name, true) +{ + setCaption(i18n("Subproject Options for '%1'").arg(item->subdir)); + + subProject = item; + m_part = part; + + QFontMetrics fm(cflags_edit->fontMetrics()); + int wid = fm.width('X')*35; + cflags_edit->setMinimumWidth(wid); + cxxflags_edit->setMinimumWidth(wid); + fflags_edit->setMinimumWidth(wid); + + QDomDocument &dom = *part->projectDom(); + QString prefix = "/kdevautoproject/configurations/" + m_part->currentBuildConfig() + "/"; + + ccompiler = DomUtil::readEntry(dom, prefix + "ccompiler", "kdevgccoptions"); + cxxcompiler = DomUtil::readEntry(dom, prefix + "cxxcompiler", "kdevgppoptions"); + f77compiler = DomUtil::readEntry(dom, prefix + "f77compiler", "kdevg77options"); + + if (!KService::serviceByDesktopName(ccompiler)) + cflags_button->setEnabled(false); + if (!KService::serviceByDesktopName(cxxcompiler)) + cxxflags_button->setEnabled(false); + if (!KService::serviceByDesktopName(f77compiler)) + fflags_button->setEnabled(false); + + insideinc_listview->header()->hide(); + outsideinc_listview->header()->hide(); + buildorder_listview->header()->hide(); + + insideinc_listview->setSorting(-1); + outsideinc_listview->setSorting(-1); + prefix_listview->setSorting(-1); + buildorder_listview->setSorting(-1); + + connect( prefix_listview, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), this, SLOT( editPrefixClicked() ) ); + + // Insert all subdirectories as possible include directories + QStringList l = widget->allSubprojects(); + QCheckListItem *lastItem = 0; + QStringList::ConstIterator it; + for (it = l.begin(); it != l.end(); ++it) { + kdDebug(9020) << "----------> subproject = " << (*it) << endl; + QString subProjectName = *it; + + if( subProjectName.isEmpty() ){ + subProjectName = QString::fromLatin1( "." ); + } + QCheckListItem *clitem = new QCheckListItem(insideinc_listview, subProjectName, QCheckListItem::CheckBox); + if (lastItem) + clitem->moveItem(lastItem); + lastItem = clitem; + } + + setIcon ( SmallIcon ( "configure" ) ); + + readConfig(); +} + + +SubprojectOptionsDialog::~SubprojectOptionsDialog() +{} + + +void SubprojectOptionsDialog::readConfig() +{ + + cflags_edit->setText(subProject->variables["AM_CFLAGS"]); + cxxflags_edit->setText(subProject->variables["AM_CXXFLAGS"]); + fflags_edit->setText(subProject->variables["AM_FFLAGS"]); + + metasources_checkbox->setChecked(subProject->variables["METASOURCES"].stripWhiteSpace() == "AUTO"); + + QString includes = subProject->variables["INCLUDES"]; + QStringList includeslist = QStringList::split(QRegExp("[ \t]"), QString(includes)); + + QListViewItem *lastItem = 0; + QStringList::Iterator it; + for (it = includeslist.begin(); it != includeslist.end(); ++it) { + QCheckListItem *clitem = static_cast(insideinc_listview->firstChild()); + while (clitem) { + if (*it == ("-I$(top_srcdir)/" + clitem->text())) { + clitem->setOn(true); + break; + } + clitem = static_cast(clitem->nextSibling()); + } + if (!clitem) { + QListViewItem *item = new QListViewItem(outsideinc_listview, *it); + if (lastItem) + item->moveItem(lastItem); + lastItem = item; + } + } + + QMap::ConstIterator it2; + for (it2 = subProject->prefixes.begin(); it2 != subProject->prefixes.end(); ++it2) + new QListViewItem(prefix_listview, it2.key(), it2.data()); + + QString subdirs = subProject->variables["SUBDIRS"]; + kdDebug(9020) << "Subdirs variable: " << subdirs << endl; + QStringList subdirslist = QStringList::split(QRegExp("[ \t]"), QString(subdirs)); + lastItem = 0; + for (it = subdirslist.begin(); it != subdirslist.end(); ++it) { + QListViewItem *item = new QListViewItem(buildorder_listview, *it); + if (lastItem) + item->moveItem(lastItem); + lastItem = item; + } +} + + +void SubprojectOptionsDialog::storeConfig() +{ + QMap replaceMap; + + QString old_cflags = subProject->variables["AM_CFLAGS"]; + QString new_cflags = cflags_edit->text(); + if (new_cflags != old_cflags) { + subProject->variables["AM_CFLAGS"] = new_cflags; + replaceMap.insert("AM_CFLAGS", new_cflags); + } + + QString old_cxxflags = subProject->variables["AM_CXXFLAGS"]; + QString new_cxxflags = cxxflags_edit->text(); + if (new_cxxflags != old_cxxflags) { + subProject->variables["AM_CXXFLAGS"] = new_cxxflags; + replaceMap.insert("AM_CXXFLAGS", new_cxxflags); + } + + QString old_fflags = subProject->variables["AM_FFLAGS"]; + QString new_fflags = fflags_edit->text(); + if (new_fflags != old_fflags) { + subProject->variables["AM_FFLAGS"] = new_fflags; + replaceMap.insert("AM_FFLAGS", new_fflags); + } + + QString old_metasources = subProject->variables["METASOURCES"]; + QString new_metasources = metasources_checkbox->isChecked() ? QString::fromLatin1("AUTO") : QString::null; + if (new_metasources != old_metasources) { + subProject->variables["METASOURCES"] = new_metasources; + replaceMap.insert("METASOURCES", new_metasources); + } + + QStringList includeslist; + QCheckListItem *clitem = static_cast(insideinc_listview->firstChild()); + while (clitem) { + if (clitem->isOn()) + includeslist.append("-I$(top_srcdir)/" + clitem->text()); + clitem = static_cast(clitem->nextSibling()); + } + clitem = static_cast(outsideinc_listview->firstChild()); + while (clitem) { + includeslist.append(clitem->text()); + clitem = static_cast(clitem->nextSibling()); + } + QString includes = includeslist.join(" "); + subProject->variables["INCLUDES"] = includes; + replaceMap.insert("INCLUDES", includes); + + subProject->prefixes.clear(); + for (QListViewItem *item = prefix_listview->firstChild(); + item; item = item->nextSibling()) { + QString key = item->text(0); + QString data = item->text(1); + subProject->prefixes[key] = data; + replaceMap.insert(key + "dir", data); + } + /// \FIXME take removed prefixes into account + + QStringList subdirslist; + for (QListViewItem *item = buildorder_listview->firstChild(); + item; item = item->nextSibling()) + subdirslist.append(item->text(0)); + QString subdirs = subdirslist.join(" "); + kdDebug() << "New subdirs variable: " << subdirs << endl; + subProject->variables["SUBDIRS"] = subdirs; + replaceMap.insert("SUBDIRS", subdirs); + + AutoProjectTool::setMakefileam(subProject->path + "/Makefile.am", replaceMap); +} + + +void SubprojectOptionsDialog::cflagsClicked() +{ + QString new_cflags = AutoProjectTool::execFlagsDialog(ccompiler, cflags_edit->text(), this); +// if (!new_cflags.isNull()) + cflags_edit->setText(new_cflags); +} + + +void SubprojectOptionsDialog::cxxFlagsClicked() +{ + QString new_cxxflags = AutoProjectTool::execFlagsDialog(cxxcompiler, cxxflags_edit->text(), this); +// if (!new_cxxflags.isNull()) + cxxflags_edit->setText(new_cxxflags); +} + + +void SubprojectOptionsDialog::fflagsClicked() +{ + QString new_fflags = AutoProjectTool::execFlagsDialog(f77compiler, fflags_edit->text(), this); +// if (!new_fflags.isNull()) + fflags_edit->setText(new_fflags); +} + + +void SubprojectOptionsDialog::insideMoveUpClicked() +{ + if (insideinc_listview->currentItem() == insideinc_listview->firstChild()) { + KNotifyClient::beep(); + return; + } + + QListViewItem *item = insideinc_listview->firstChild(); + while (item->nextSibling() != insideinc_listview->currentItem()) + item = item->nextSibling(); + item->moveItem(insideinc_listview->currentItem()); +} + + +void SubprojectOptionsDialog::insideMoveDownClicked() +{ + if (insideinc_listview->currentItem() == 0 || insideinc_listview->currentItem()->nextSibling() == 0) { + KNotifyClient::beep(); + return; + } + + insideinc_listview->currentItem()->moveItem(insideinc_listview->currentItem()->nextSibling()); +} + + +void SubprojectOptionsDialog::outsideMoveUpClicked() +{ + if (outsideinc_listview->currentItem() == outsideinc_listview->firstChild()) { + KNotifyClient::beep(); + return; + } + + QListViewItem *item = outsideinc_listview->firstChild(); + while (item->nextSibling() != outsideinc_listview->currentItem()) + item = item->nextSibling(); + item->moveItem(outsideinc_listview->currentItem()); +} + + +void SubprojectOptionsDialog::outsideMoveDownClicked() +{ + if (outsideinc_listview->currentItem() == 0 || outsideinc_listview->currentItem()->nextSibling() == 0) { + KNotifyClient::beep(); + return; + } + + outsideinc_listview->currentItem()->moveItem(outsideinc_listview->currentItem()->nextSibling()); +} + +void SubprojectOptionsDialog::outsideAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add Include directory: Choose directory, give -Idirectory or use a variable with -I$(FOOBAR)" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString file = dialog.urlRequester() ->url(); + if ( !file.isEmpty() ) + { + if ( !file.isEmpty() ) + { + if( file.startsWith("-I") ) + new QListViewItem( outsideinc_listview, file ); + else + { + new QListViewItem( outsideinc_listview, "-I"+file ); + } + } + } +} + + +void SubprojectOptionsDialog::outsideEditClicked() +{ + if ( (outsideinc_listview->childCount()==0) || (outsideinc_listview->currentItem() == 0) ) + return; + bool ok; + QString dir = KInputDialog::getText(i18n("Edit Include Directory"), i18n("Edit include directory:"), + outsideinc_listview->currentItem()-> text(0), &ok, 0); + if (ok && !dir.isEmpty()) + outsideinc_listview->currentItem()-> setText(0, dir); +} + + +void SubprojectOptionsDialog::outsideRemoveClicked() +{ + delete outsideinc_listview->currentItem(); +} + + +void SubprojectOptionsDialog::addPrefixClicked() +{ + AddPrefixDialog dlg; + if (!dlg.exec() || dlg.name().isEmpty() || dlg.path().isEmpty() ) + return; + + new QListViewItem(prefix_listview, dlg.name(), dlg.path()); +} + + +void SubprojectOptionsDialog::editPrefixClicked() +{ + QListViewItem* lvItem = prefix_listview->currentItem(); + if ( (prefix_listview->childCount()==0) || (lvItem == 0) ) + return; + AddPrefixDialog dlg(lvItem-> text(0), lvItem-> text(1)); + dlg.setCaption(i18n("Edit Prefix")); + if (!dlg.exec() || dlg.name().isEmpty() || dlg.path().isEmpty() ) + return; + lvItem-> setText(0, dlg.name()); + lvItem-> setText(1, dlg.path()); +} + +void SubprojectOptionsDialog::removePrefixClicked() +{ + delete prefix_listview->currentItem(); +} + + +void SubprojectOptionsDialog::buildorderMoveUpClicked() +{ + if (buildorder_listview->currentItem() == buildorder_listview->firstChild()) { + KNotifyClient::beep(); + return; + } + + QListViewItem *item = buildorder_listview->firstChild(); + while (item->nextSibling() != buildorder_listview->currentItem()) + item = item->nextSibling(); + item->moveItem(buildorder_listview->currentItem()); +} + + +void SubprojectOptionsDialog::buildorderMoveDownClicked() +{ + if (buildorder_listview->currentItem() == 0 || buildorder_listview->currentItem()->nextSibling() == 0) { + KNotifyClient::beep(); + return; + } + + buildorder_listview->currentItem()->moveItem(buildorder_listview->currentItem()->nextSibling()); +} + + +void SubprojectOptionsDialog::accept() +{ + storeConfig(); + QDialog::accept(); +} + +#include "subprojectoptionsdlg.moc" diff --git a/buildtools/autotools/subprojectoptionsdlg.h b/buildtools/autotools/subprojectoptionsdlg.h new file mode 100644 index 00000000..7ec1fbf0 --- /dev/null +++ b/buildtools/autotools/subprojectoptionsdlg.h @@ -0,0 +1,63 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _SUBPROJECTOPTIONSDLG_H_ +#define _SUBPROJECTOPTIONSDLG_H_ + +#include "subprojectoptionsdlgbase.h" + +class AutoProjectPart; +class AutoProjectWidget; +class SubprojectItem; + + +class SubprojectOptionsDialog : public SubprojectOptionsDialogBase +{ + Q_OBJECT + +public: + SubprojectOptionsDialog( AutoProjectPart *part, AutoProjectWidget *widget, + SubprojectItem *item, QWidget *parent = 0, const char *name = 0 ); + ~SubprojectOptionsDialog(); + +private: + virtual void cflagsClicked(); + virtual void cxxFlagsClicked(); + virtual void fflagsClicked(); + virtual void insideMoveUpClicked(); + virtual void insideMoveDownClicked(); + virtual void outsideMoveUpClicked(); + virtual void outsideMoveDownClicked(); + virtual void outsideAddClicked(); + virtual void outsideRemoveClicked(); + virtual void outsideEditClicked(); + virtual void addPrefixClicked(); + virtual void editPrefixClicked(); + virtual void removePrefixClicked(); + virtual void buildorderMoveUpClicked(); + virtual void buildorderMoveDownClicked(); + virtual void accept(); + + void readConfig(); + void storeConfig(); + + SubprojectItem *subProject; + AutoProjectWidget *m_widget; + AutoProjectPart *m_part; + + QString ccompiler; + QString cxxcompiler; + QString f77compiler; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/subprojectoptionsdlgbase.ui b/buildtools/autotools/subprojectoptionsdlgbase.ui new file mode 100644 index 00000000..f2723e5a --- /dev/null +++ b/buildtools/autotools/subprojectoptionsdlgbase.ui @@ -0,0 +1,989 @@ + +SubprojectOptionsDialogBase + + + sub project options widget + + + + 0 + 0 + 442 + 437 + + + + Subproject Options + + + + unnamed + + + + subprojectoptions_tabwidget + + + + tab + + + Co&mpiler + + + + unnamed + + + + cflags_label + + + + + + + Compiler flags for C compiler (CFLA&GS): + + + cflags_edit + + + + + Layout5 + + + + unnamed + + + 0 + + + + cflags_edit + + + + 7 + 0 + 0 + 0 + + + + + + cflags_button + + + + 0 + 0 + 0 + 0 + + + + + 30 + 25 + + + + ... + + + false + + + + + + + Spacer2 + + + Vertical + + + Preferred + + + + 20 + 20 + + + + + + cxxflags_label + + + + + + + Compiler flags for C++ compiler (C&XXFLAGS): + + + cxxflags_edit + + + + + Layout3 + + + + unnamed + + + 0 + + + + cxxflags_edit + + + + + cxxflags_button + + + + 1 + 0 + 0 + 0 + + + + + 30 + 25 + + + + ... + + + false + + + + + + + Spacer3 + + + Vertical + + + Preferred + + + + 20 + 20 + + + + + + fflags_label + + + + + + + Compiler flags for Fortran compiler (&FFLAGS): + + + fflags_edit + + + + + Layout4 + + + + unnamed + + + 0 + + + + fflags_edit + + + + + fflags_button + + + + 1 + 0 + 0 + 0 + + + + + 30 + 25 + + + + ... + + + false + + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + tab + + + &Includes + + + + unnamed + + + + layout11 + + + + unnamed + + + + metasources_checkbox + + + Automatically &generate metasources + + + + + layout9 + + + + unnamed + + + + Layout9 + + + + unnamed + + + 0 + + + + Spacer2_3 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + insidemoveup_button + + + Move &Up + + + + + insidemovedown_button + + + Move &Down + + + + + Spacer3_2 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + + insideinc_label + + + + + + + Directories in&side project: + + + insideinc_listview + + + + + + + + + true + + + true + + + + insideinc_listview + + + LastColumn + + + + + + + layout10 + + + + unnamed + + + + Layout10 + + + + unnamed + + + 0 + + + + Spacer1_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + outsideadd_button + + + &Add... + + + + + outsideedit_button + + + &Edit... + + + + + outsideremove_button + + + &Remove + + + + + outsidemoveup_button + + + Move U&p + + + + + outsidemovedown_button + + + Move Dow&n + + + + + Spacer2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + TextLabel2_2 + + + + + + + Directories ou&tside project: + + + outsideinc_listview + + + + + + + + + true + + + true + + + + outsideinc_listview + + + LastColumn + + + + + + + + + + + tab + + + &Prefixes + + + + unnamed + + + + + Name + + + true + + + true + + + + + Path + + + true + + + true + + + + prefix_listview + + + true + + + AllColumns + + + + + prefixes_label + + + + + + + C&ustom prefixes: + + + prefix_listview + + + + + Layout6 + + + + unnamed + + + 0 + + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + addprefix_button + + + &Add... + + + + + editprefix_button + + + &Edit... + + + + + removeprefix_button + + + &Remove + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + tab + + + &Build Order + + + + unnamed + + + + Layout9_2 + + + + unnamed + + + 0 + + + + Spacer2_3_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + buildmoveup_button + + + Move &Up + + + + + buildmovedown_button + + + Move &Down + + + + + Spacer3_2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + true + + + true + + + + buildorder_listview + + + LastColumn + + + + + buildorder_label + + + + + + + O&rder in which sub projects are built: + + + buildorder_listview + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okbutton + + + &OK + + + true + + + + + cancelbutton + + + &Cancel + + + + + + + + + cflags_button + clicked() + sub project options widget + cflagsClicked() + + + cxxflags_button + clicked() + sub project options widget + cxxFlagsClicked() + + + removeprefix_button + clicked() + sub project options widget + removePrefixClicked() + + + insidemoveup_button + clicked() + sub project options widget + insideMoveUpClicked() + + + insidemovedown_button + clicked() + sub project options widget + insideMoveDownClicked() + + + outsideadd_button + clicked() + sub project options widget + outsideAddClicked() + + + outsideedit_button + clicked() + sub project options widget + outsideEditClicked() + + + outsidemovedown_button + clicked() + sub project options widget + outsideMoveDownClicked() + + + outsidemoveup_button + clicked() + sub project options widget + outsideMoveUpClicked() + + + outsideremove_button + clicked() + sub project options widget + outsideRemoveClicked() + + + okbutton + clicked() + sub project options widget + accept() + + + cancelbutton + clicked() + sub project options widget + reject() + + + fflags_button + clicked() + sub project options widget + fflagsClicked() + + + buildmovedown_button + clicked() + sub project options widget + buildorderMoveDownClicked() + + + buildmoveup_button + clicked() + sub project options widget + buildorderMoveUpClicked() + + + addprefix_button + clicked() + sub project options widget + addPrefixClicked() + + + editprefix_button + clicked() + sub project options widget + editPrefixClicked() + + + + cflags_edit + cflags_button + cxxflags_edit + cxxflags_button + fflags_edit + fflags_button + subprojectoptions_tabwidget + metasources_checkbox + insideinc_listview + insidemoveup_button + insidemovedown_button + outsideinc_listview + outsideadd_button + outsideedit_button + outsideremove_button + outsidemoveup_button + outsidemovedown_button + prefix_listview + addprefix_button + editprefix_button + removeprefix_button + buildorder_listview + buildmoveup_button + buildmovedown_button + okbutton + cancelbutton + + + kdialog.h + + + buildorderMoveDownClicked() + cflagsClicked() + cxxFlagsClicked() + fflagsClicked() + insideMoveDownClicked() + insideMoveUpClicked() + buildorderMoveUpClicked() + outsideAddClicked() + outsideEditClicked() + outsideMoveDownClicked() + outsideMoveUpClicked() + outsideRemoveClicked() + removePrefixClicked() + addPrefixClicked() + editPrefixClicked() + + + + diff --git a/buildtools/autotools/targetoptionsdlg.cpp b/buildtools/autotools/targetoptionsdlg.cpp new file mode 100644 index 00000000..c8d49c55 --- /dev/null +++ b/buildtools/autotools/targetoptionsdlg.cpp @@ -0,0 +1,357 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "targetoptionsdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "autolistviewitems.h" + +#include "misc.h" +#include "autoprojectpart.h" +#include "autoprojectwidget.h" +#include "urlutil.h" + +TargetOptionsDialog::TargetOptionsDialog(AutoProjectWidget *widget, TargetItem *item, + QWidget *parent, const char *name) + : TargetOptionsDialogBase(parent, name, true) +{ + setCaption( i18n("Target Options for '%1'").arg(item->name) ); + setIcon( SmallIcon("configure") ); + + target = item; + m_widget = widget; + + if (item->primary == "PROGRAMS") { + insidelib_label->setText(i18n("Link convenience libraries inside project (LDADD)")); + outsidelib_label->setText(i18n("Link libraries outside project (LDADD)")); + } + else + argumentBox->setEnabled( false ); +// run_arguments_edit->setEnabled(false); + + insidelib_listview->header()->hide(); + outsidelib_listview->header()->hide(); + insidelib_listview->setSorting(-1); + outsidelib_listview->setSorting(-1); + + + m_cwdEdit->completionObject()->setMode(KURLCompletion::DirCompletion); + m_cwdEdit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + + // Insert all convenience libraries as possible linked libraries + QStringList l = widget->allLibraries(); + QStringList::ConstIterator it; + QString fulltargetname = m_widget->subprojectDirectory() + "/" + item->name; + for (it = l.begin(); it != l.end(); ++it) + // Do not list the target itself (a target can not link with itself) + if ( !fulltargetname.endsWith(*it) ) + (void) new QCheckListItem(insidelib_listview, *it, QCheckListItem::CheckBox); + readConfig(); +} + + +TargetOptionsDialog::~TargetOptionsDialog() +{} + + +void TargetOptionsDialog::readConfig() +{ + QString flagsstr = target->ldflags; + flagsstr.replace(QRegExp("$(KDE_PLUGIN)"), "-avoid-version -module -no-undefined $(KDE_RPATH)"); + QStringList l1 = QStringList::split(QRegExp("[ \t]"), flagsstr); + QStringList::Iterator l1it; + + l1it = l1.find("-all-static"); + if (l1it != l1.end()) { + allstatic_box->setChecked(true); + l1.remove(l1it); + } + l1it = l1.find("-avoid-version"); + if (l1it != l1.end()) { + avoidversion_box->setChecked(true); + l1.remove(l1it); + } + l1it = l1.find("-module"); + if (l1it != l1.end()) { + module_box->setChecked(true); + l1.remove(l1it); + } + l1it = l1.find("-no-undefined"); + if (l1it != l1.end()) { + noundefined_box->setChecked(true); + l1.remove(l1it); + } + ldflagsother_edit->setText(l1.join(" ")); + dependencies_edit->setText(target->dependencies); + + QString addstr = (target->primary == "PROGRAMS")? target->ldadd : target->libadd; + QStringList l2 = QStringList::split(QRegExp("[ \t]"), addstr); + + kdDebug(9020) << "ls=: " << addstr << endl; + + bool inlistItem; + QListViewItem *lastItem = 0; + QStringList::Iterator l2it; + QCheckListItem *flitem = static_cast(insidelib_listview->firstChild()); + for (l2it = l2.begin(); l2it != l2.end(); ++l2it) { + inlistItem = false; + QCheckListItem *clitem = static_cast(insidelib_listview->firstChild()); + if (flitem) { + while (clitem) { + if (*l2it == ("$(top_builddir)/" + clitem->text())) { + clitem->setOn(true); + // move this item to the "top of the list" + if (flitem != clitem) + clitem->moveItem(flitem); + // move the "top of the list" one item down + flitem = static_cast(flitem->nextSibling()); + inlistItem = true; + break; + } + clitem = static_cast(clitem->nextSibling()); + } + } + if ( inlistItem == false ) { + QListViewItem *item = new QListViewItem(outsidelib_listview, *l2it); + if (lastItem) + item->moveItem(lastItem); + lastItem = item; + } + } + + if (target->primary == "PROGRAMS") + { + run_arguments_edit->setText(DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/runarguments/" + target->name)); + if( DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name).isEmpty() ) + { + m_cwdEdit->setURL( m_widget->m_part->buildDirectory()+"/"+URLUtil::getRelativePath(m_widget->m_part->topsourceDirectory(), m_widget->m_part->projectDirectory())+"/"+m_widget->activeDirectory() ); + m_cwdEdit->fileDialog()->setURL( KURL::fromPathOrURL( m_widget->m_part->buildDirectory()+"/"+URLUtil::getRelativePath(m_widget->m_part->topsourceDirectory(), m_widget->m_part->projectDirectory())+"/"+m_widget->activeDirectory() ) ); + }else + { + m_cwdEdit->setURL( DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name) ); + m_cwdEdit->fileDialog()->setURL( KURL::fromPathOrURL( DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name) ) ); + } + debug_arguments_edit->setText(DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/debugarguments/" + target->name)); + } +} + + +void TargetOptionsDialog::storeConfig() +{ + QStringList flagslist; + if (allstatic_box->isChecked()) + flagslist.append("-all-static"); + if (avoidversion_box->isChecked()) + flagslist.append("-avoid-version"); + if (module_box->isChecked()) + flagslist.append("-module"); + if (noundefined_box->isChecked()) + flagslist.append("-no-undefined"); + flagslist.append(ldflagsother_edit->text()); + QString new_ldflags = flagslist.join(" "); + + QStringList liblist; + QCheckListItem *clitem = static_cast(insidelib_listview->firstChild()); + while (clitem) { + if( clitem->isOn() ) + liblist.append("$(top_builddir)/" + clitem->text()); + clitem = static_cast(clitem->nextSibling()); + } + clitem = static_cast(outsidelib_listview->firstChild()); + while (clitem) { + liblist.append(clitem->text()); + clitem = static_cast(clitem->nextSibling()); + } + QString new_addstr = liblist.join(" "); + + QString canonname = AutoProjectTool::canonicalize(target->name); + QMap replaceMap; + + if (target->primary == "PROGRAMS") { + QString old_ldadd = target->ldadd; + if (new_addstr != old_ldadd) { + target->ldadd = new_addstr; + replaceMap.insert(canonname + "_LDADD", new_addstr); + } + } + + if (target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES") { + QString old_libadd = target->libadd; + if (new_addstr != old_libadd) { + target->libadd = new_addstr; + replaceMap.insert(canonname + "_LIBADD", new_addstr); + } + } + + QString old_ldflags = target->ldflags; + if (new_ldflags != old_ldflags) { + target->ldflags = new_ldflags; + replaceMap.insert(canonname + "_LDFLAGS", new_ldflags); + } + + QString new_dependencies = dependencies_edit->text(); + QString old_dependencies = target->dependencies; + if (new_dependencies != old_dependencies) { + target->dependencies = new_dependencies; + if (!new_dependencies.isEmpty()) + replaceMap.insert(canonname + "_DEPENDENCIES", new_dependencies); + } + + // We can safely assume that this target is in the active sub project + AutoProjectTool::setMakefileam(m_widget->subprojectDirectory() + "/Makefile.am", replaceMap); + + if (target->primary == "PROGRAMS") + { + DomUtil::writeEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/runarguments/" + target->name, run_arguments_edit->text()); + DomUtil::writeEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/debugarguments/" + target->name, debug_arguments_edit->text()); + DomUtil::writeEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name, m_cwdEdit->url()); + } +} + + +void TargetOptionsDialog::insideMoveUpClicked() +{ + if (!insidelib_listview->currentItem()) + return; + if (insidelib_listview->currentItem() == insidelib_listview->firstChild()) { + KNotifyClient::beep(); + return; + } + + QListViewItem *item = insidelib_listview->firstChild(); + while (item->nextSibling() != insidelib_listview->currentItem()) + item = item->nextSibling(); + item->moveItem(insidelib_listview->currentItem()); +} + + +void TargetOptionsDialog::insideMoveDownClicked() +{ + if (!insidelib_listview->currentItem()) + return; + + if (insidelib_listview->currentItem()->nextSibling() == 0) { + KNotifyClient::beep(); + return; + } + + insidelib_listview->currentItem()->moveItem(insidelib_listview->currentItem()->nextSibling()); +} + + +void TargetOptionsDialog::outsideMoveUpClicked() +{ + if (!outsidelib_listview->currentItem()) + return; + if (outsidelib_listview->currentItem() == outsidelib_listview->firstChild()) { + KNotifyClient::beep(); + return; + } + + QListViewItem *item = outsidelib_listview->firstChild(); + while (item->nextSibling() != outsidelib_listview->currentItem()) + item = item->nextSibling(); + item->moveItem(outsidelib_listview->currentItem()); +} + + +void TargetOptionsDialog::outsideMoveDownClicked() +{ + if (!outsidelib_listview->currentItem()) + return; + if (outsidelib_listview->currentItem()->nextSibling() == 0) { + KNotifyClient::beep(); + return; + } + + outsidelib_listview->currentItem()->moveItem(outsidelib_listview->currentItem()->nextSibling()); +} + + +void TargetOptionsDialog::outsideAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add Library: Choose the .a/.so file, give -l or use a variable with $(FOOBAR)" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + dialog.urlRequester() ->setFilter( "*.so|"+i18n("Shared Library (*.so)")+"\n*.a|"+i18n("Static Library (*.a)") ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( m_widget->selectedSubproject()->path ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL::fromPathOrURL( m_widget->selectedSubproject()->path ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString file = dialog.urlRequester() ->url(); + if ( !file.isEmpty() ) + { + if ( !file.isEmpty() ) + { + if( file.startsWith("-l") ) + new QListViewItem( outsidelib_listview, file ); + else + { + QFileInfo fi(file); + if( !fi.exists() ) + new QListViewItem( outsidelib_listview, file ); + if( fi.extension(false) == "a" ) + { + new QListViewItem( outsidelib_listview, file ); + }else if ( fi.extension(false) == "so" ) + { + QString name = fi.fileName(); + if( name.startsWith( "lib" ) ) + name = name.mid(3); + name = "-l"+name.left( name.length() - 3 ); + new QListViewItem( outsidelib_listview, name ); + } + } + } + } +} + + +void TargetOptionsDialog::outsideEditClicked() +{ + if ( (outsidelib_listview->childCount()==0) || (outsidelib_listview->currentItem() == 0) ) + return; + bool ok; + QString dir = KInputDialog::getText(i18n("Edit External Library"), i18n("Edit external library:"), + outsidelib_listview->currentItem()-> text(0), &ok, 0); + if (ok && !dir.isEmpty()) + outsidelib_listview->currentItem()-> setText(0, dir); +} + + +void TargetOptionsDialog::outsideRemoveClicked() +{ + delete outsidelib_listview->currentItem(); +} + + +void TargetOptionsDialog::accept() +{ + storeConfig(); + QDialog::accept(); +} + +#include "targetoptionsdlg.moc" +// kate: indent-mode csands; space-indent on; indent-width 4; replace-tabs on; diff --git a/buildtools/autotools/targetoptionsdlg.h b/buildtools/autotools/targetoptionsdlg.h new file mode 100644 index 00000000..c1dea20a --- /dev/null +++ b/buildtools/autotools/targetoptionsdlg.h @@ -0,0 +1,49 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _TARGETOPTIONSDLG_ +#define _TARGETOPTIONSDLG_ + +#include "targetoptionsdlgbase.h" + +class AutoProjectWidget; +class TargetItem; + + +class TargetOptionsDialog : public TargetOptionsDialogBase +{ + Q_OBJECT + +public: + TargetOptionsDialog( AutoProjectWidget *widget, TargetItem *item, + QWidget *parent = 0, const char *name = 0 ); + ~TargetOptionsDialog(); + +private: + virtual void insideMoveUpClicked(); + virtual void insideMoveDownClicked(); + virtual void outsideMoveUpClicked(); + virtual void outsideMoveDownClicked(); + virtual void outsideAddClicked(); + virtual void outsideEditClicked(); + virtual void outsideRemoveClicked(); + virtual void accept(); + + void readConfig(); + void storeConfig(); + + TargetItem *target; + AutoProjectWidget *m_widget; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/buildtools/autotools/targetoptionsdlgbase.ui b/buildtools/autotools/targetoptionsdlgbase.ui new file mode 100644 index 00000000..07487ac2 --- /dev/null +++ b/buildtools/autotools/targetoptionsdlgbase.ui @@ -0,0 +1,726 @@ + +TargetOptionsDialogBase + + + target_options_dialog + + + + 0 + 0 + 627 + 474 + + + + Target Options + + + false + + + + unnamed + + + + tabWidget + + + + Widget5 + + + Fl&ags + + + + unnamed + + + + TextLabel1 + + + + + + + Li&nker flags (LDFLAGS): + + + allstatic_box + + + + + Layout12 + + + + unnamed + + + 0 + + + + allstatic_box + + + &Do not link against shared libraries (-all-static) + + + + + avoidversion_box + + + Do not &assign version numbers to libraries (-avoid-version) + + + + + module_box + + + Create a library that can &be dynamically loaded (-module) + + + + + noundefined_box + + + Library does not depend on external symbols (-no-&undefined) + + + + + Layout11 + + + + unnamed + + + 0 + + + + ldflagsother_label + + + + + + + O&ther: + + + ldflagsother_edit + + + + + ldflagsother_edit + + + + + + + + + Spacer1 + + + Vertical + + + Preferred + + + + 20 + 20 + + + + + + Spacer2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + dependencies_edit + + + + + dependencies_label + + + + + + + E&xplicit dependencies (DEPENDENCIES): + + + dependencies_edit + + + + + Spacer3 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Widget6 + + + Li&braries + + + + unnamed + + + + insidelib_label + + + + + + + Lin&k convenience libraries inside project (LIBADD): + + + insidelib_listview + + + + + Spacer9 + + + Vertical + + + Fixed + + + + 20 + 7 + + + + + + + + + + true + + + true + + + + outsidelib_listview + + + LastColumn + + + + + outsidelib_label + + + + + + + Link libraries ou&tside project (LIBADD): + + + outsidelib_listview + + + + + Layout9_3 + + + + unnamed + + + 0 + + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + insidemoveup_button + + + Move &Up + + + + + insidemovedown_button + + + Move &Down + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + true + + + true + + + + insidelib_listview + + + LastColumn + + + + + Layout10_4 + + + + unnamed + + + 0 + + + + Spacer7 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + outsideadd_button + + + &Add... + + + + + outsideedit_button + + + &Edit... + + + + + outsideremove_button + + + &Remove + + + + + outsidemoveup_button + + + Mo&ve Up + + + + + outsidemovedown_button + + + Move Dow&n + + + + + Spacer8 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + arguments_page + + + Ar&guments + + + + unnamed + + + + argumentBox + + + Program Arguments (only valid for executable targets) + + + + unnamed + + + + run_arguments_edit + + + + + arguments_label_1 + + + + + + + &Run arguments: + + + run_arguments_edit + + + + + m_cwdEdit + + + + + textLabel1 + + + Working Directory: + + + + + arguments_label_2 + + + + + + + &Debug arguments: + + + run_arguments_edit + + + + + debug_arguments_edit + + + + + + + Spacer4_2 + + + Vertical + + + Expanding + + + + 20 + 120 + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + + Spacer10 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okbutton + + + &OK + + + true + + + true + + + + + cancelbutton + + + &Cancel + + + true + + + + + + + + + + + okbutton + clicked() + target_options_dialog + accept() + + + cancelbutton + clicked() + target_options_dialog + reject() + + + insidemoveup_button + clicked() + target_options_dialog + insideMoveUpClicked() + + + outsidemoveup_button + clicked() + target_options_dialog + outsideMoveUpClicked() + + + outsidemovedown_button + clicked() + target_options_dialog + outsideMoveDownClicked() + + + outsideadd_button + clicked() + target_options_dialog + outsideAddClicked() + + + outsideedit_button + clicked() + target_options_dialog + outsideEditClicked() + + + outsideremove_button + clicked() + target_options_dialog + outsideRemoveClicked() + + + insidemovedown_button + clicked() + target_options_dialog + insideMoveDownClicked() + + + + allstatic_box + avoidversion_box + module_box + noundefined_box + ldflagsother_edit + dependencies_edit + tabWidget + insidelib_listview + insidemoveup_button + insidemovedown_button + outsidelib_listview + outsideadd_button + outsideedit_button + outsideremove_button + outsidemoveup_button + outsidemovedown_button + okbutton + cancelbutton + + + kdialog.h + + + insideMoveDownClicked() + insideMoveUpClicked() + outsideAddClicked() + outsideEditClicked() + outsideMoveDownClicked() + outsideMoveUpClicked() + outsideRemoveClicked() + + + + + klineedit.h + klineedit.h + klineedit.h + kurlrequester.h + klineedit.h + kpushbutton.h + klineedit.h + + diff --git a/buildtools/custommakefiles/Makefile.am b/buildtools/custommakefiles/Makefile.am new file mode 100644 index 00000000..fab92b8b --- /dev/null +++ b/buildtools/custommakefiles/Makefile.am @@ -0,0 +1,26 @@ +# Here resides the custom project part. + +INCLUDES = -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes) \ + -I$(top_builddir)/buildtools/lib/widgets + +kde_module_LTLIBRARIES = libkdevcustomproject.la +libkdevcustomproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevcustomproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la + +libkdevcustomproject_la_SOURCES = selectnewfilesdialog.cpp selectnewfilesdialogbase.ui \ + custombuildoptionswidget.cpp custombuildoptionswidgetbase.ui custommakeconfigwidget.cpp \ + custommakeconfigwidgetbase.ui custommanagerwidget.cpp custommanagerwidgetbase.ui \ + customotherconfigwidget.cpp customotherconfigwidgetbase.ui customprojectpart.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevcustomproject.desktop + +rcdir = $(kde_datadir)/kdevcustomproject +rc_DATA = kdevcustomproject.rc +noinst_HEADERS = selectnewfilesdialog.h custommanagerwidget.h \ + customotherconfigwidget.h diff --git a/buildtools/custommakefiles/README.dox b/buildtools/custommakefiles/README.dox new file mode 100644 index 00000000..28762d87 --- /dev/null +++ b/buildtools/custommakefiles/README.dox @@ -0,0 +1,47 @@ +/** \class CustomProjectPart +This is the custom build tools part. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +\authors Bernd Gehrmann + +\unmaintained This part is currently un-maintained + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in customproject component at Bugzilla database +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/buildtools/custommakefiles/custombuildoptionswidget.cpp b/buildtools/custommakefiles/custombuildoptionswidget.cpp new file mode 100644 index 00000000..37b087b2 --- /dev/null +++ b/buildtools/custommakefiles/custombuildoptionswidget.cpp @@ -0,0 +1,99 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "custombuildoptionswidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include "domutil.h" + + +CustomBuildOptionsWidget::CustomBuildOptionsWidget(QDomDocument &dom, + QWidget *parent, const char *name) + : CustomBuildOptionsWidgetBase(parent, name), + m_dom(dom) +{ + ant_button->setChecked(DomUtil::readEntry(dom, "/kdevcustomproject/build/buildtool") == "ant"); + other_button->setChecked(DomUtil::readEntry(dom, "/kdevcustomproject/build/buildtool") == "other"); + if( !DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir").isEmpty() + && QFileInfo( DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir") ).exists() ) + { + builddir_edit->setURL(DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir")); + builddir_edit->fileDialog()->setURL( DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir") ); + } + else + { + builddir_edit->setURL( QString() ); + builddir_edit->fileDialog()->setURL( QString() ); + } + builddir_edit->completionObject()->setMode(KURLCompletion::DirCompletion); + builddir_edit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + + // This connection must not be made before the ant->setChecked() line, + // because at this time makeToggled() would crash + connect( make_button, SIGNAL(toggled(bool)), + this, SLOT(makeToggled(bool)) ); + connect( other_button, SIGNAL(toggled(bool)), + this, SLOT(otherToggled(bool)) ); +} + + +CustomBuildOptionsWidget::~CustomBuildOptionsWidget() +{} + + +void CustomBuildOptionsWidget::accept() +{ + QString buildtool; + if (ant_button->isChecked()) + { + buildtool = "ant"; + } + else if (other_button->isChecked()) + { + buildtool = "other"; + } + else + { + buildtool = "make"; + } + DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/buildtool", buildtool); + DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/builddir", builddir_edit->url()); +} + + +void CustomBuildOptionsWidget::setMakeOptionsWidget(QTabWidget *tw, QWidget *mow, QWidget* oow) +{ + m_tabWidget = tw; + m_makeOptions = mow; + m_otherOptions = oow; + makeToggled(make_button->isChecked()); + otherToggled(other_button->isChecked()); +} + +void CustomBuildOptionsWidget::otherToggled(bool b) +{ + m_tabWidget->setTabEnabled(m_otherOptions, b); +} + +void CustomBuildOptionsWidget::makeToggled(bool b) +{ + m_tabWidget->setTabEnabled(m_makeOptions, b); +} + +#include "custombuildoptionswidget.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/custombuildoptionswidget.h b/buildtools/custommakefiles/custombuildoptionswidget.h new file mode 100644 index 00000000..1b049574 --- /dev/null +++ b/buildtools/custommakefiles/custombuildoptionswidget.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _CUSTOMBUILDOPTIONSWIDGET_H_ +#define _CUSTOMBUILDOPTIONSWIDGET_H_ + +#include "custombuildoptionswidgetbase.h" +#include + +class QTabWidget; + + +class CustomBuildOptionsWidget : public CustomBuildOptionsWidgetBase +{ + Q_OBJECT + +public: + CustomBuildOptionsWidget( QDomDocument &dom, QWidget *parent=0, const char *name=0 ); + ~CustomBuildOptionsWidget(); + + void setMakeOptionsWidget(QTabWidget *tw, QWidget *mow, QWidget *oow); + +public slots: + void accept(); + +private: + virtual void makeToggled(bool b); + virtual void otherToggled(bool b); + + QDomDocument &m_dom; + QTabWidget *m_tabWidget; + QWidget *m_makeOptions; + QWidget *m_otherOptions; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/custombuildoptionswidgetbase.ui b/buildtools/custommakefiles/custombuildoptionswidgetbase.ui new file mode 100644 index 00000000..59ca9ba2 --- /dev/null +++ b/buildtools/custommakefiles/custombuildoptionswidgetbase.ui @@ -0,0 +1,164 @@ + +CustomBuildOptionsWidgetBase + + + configure_options_widget + + + + 0 + 0 + 592 + 480 + + + + Custom Build Options + + + + unnamed + + + + buildtool_group + + + Build Tool + + + + unnamed + + + + make_button + + + &Make + + + true + + + + + ant_button + + + A&nt + + + + + other_button + + + Other + + + + + + other custom build tool, e.g. script + + + There are myriads of buildtools out there that are not ant or make. If you use one of them (or have your own scripts), select this option. + + + + + + + Spacer19 + + + Vertical + + + Minimum + + + + 20 + 20 + + + + + + builddir_label + + + Run &the build tool in the following directory: + + + builddir_edit + + + + + layout2 + + + + unnamed + + + + Spacer38 + + + Horizontal + + + Fixed + + + + 16 + 20 + + + + + + builddir_edit + + + + + + + Spacer39 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + kdialog.h + + + makeToggled(bool) + otherToggled(bool) + + + + + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/custommakefiles/custommakeconfigwidget.cpp b/buildtools/custommakefiles/custommakeconfigwidget.cpp new file mode 100644 index 00000000..2af0d137 --- /dev/null +++ b/buildtools/custommakefiles/custommakeconfigwidget.cpp @@ -0,0 +1,134 @@ +/*************************************************************************** + * Copyright (C) 2003 by Hendrik Kueck * + * kueck@cs.ubc.ca * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "custommakeconfigwidget.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +CustomMakeConfigWidget::CustomMakeConfigWidget(CustomProjectPart* part, const QString& configGroup, QWidget* parent) + : CustomMakeConfigWidgetBase(parent), + m_part(part), m_configGroup(configGroup), m_dom( *part->projectDom() ) +{ + abort_box->setChecked(DomUtil::readBoolEntry(m_dom, m_configGroup + "/make/abortonerror")); + int numjobs = DomUtil::readIntEntry(m_dom, m_configGroup + "/make/numberofjobs"); + jobs_box->setValue(numjobs); + runMultiJobs->setChecked( (numjobs > 0 ) ); + + prio_box->setValue(DomUtil::readIntEntry(m_dom, m_configGroup + "/make/prio")); + dontact_box->setChecked(DomUtil::readBoolEntry(m_dom, m_configGroup + "/make/dontact")); + makebin_edit->setText(DomUtil::readEntry(m_dom, m_configGroup + "/make/makebin")); + defaultTarget_edit->setText(DomUtil::readEntry(m_dom, m_configGroup + "/make/defaulttarget")); + makeoptions_edit->setText(DomUtil::readEntry(m_dom, m_configGroup + "/make/makeoptions")); + + envs_combo->setValidator(new QRegExpValidator(QRegExp("^\\D[^\\s]*"), this)); + m_allEnvironments = m_part->allMakeEnvironments(); + m_currentEnvironment = m_part->currentMakeEnvironment(); + env_var_group->setColumnLayout( 1, Qt::Vertical ); + m_envWidget = new EnvironmentVariablesWidget(m_dom, m_configGroup + "/make/environments/" + m_currentEnvironment, env_var_group); + envs_combo->insertStringList(m_allEnvironments); + envs_combo->setEditText(m_currentEnvironment); +} + + +CustomMakeConfigWidget::~CustomMakeConfigWidget() +{ + +} + +void CustomMakeConfigWidget::envNameChanged(const QString& envName) +{ + QStringList allEnvNames = m_part->allMakeEnvironments(); + bool canAdd = !allEnvNames.contains(envName) && !envName.contains("/") && !envName.isEmpty(); + bool canRemove = allEnvNames.contains(envName) && allEnvNames.count() > 1; + addenvs_button->setEnabled(canAdd); + copyenvs_button->setEnabled(canAdd); + removeenvs_button->setEnabled(canRemove); +} + +void CustomMakeConfigWidget::envChanged(const QString& envName) +{ + if (envName == m_currentEnvironment || !m_allEnvironments.contains(envName)) + return; + + // save settings of previously active environment + if (!m_currentEnvironment.isNull() ) + m_envWidget->accept(); + + m_currentEnvironment = envName; + m_envWidget->readEnvironment(m_dom, m_configGroup + "/make/environments/" + envName); + envs_combo->setEditText(envName); +} + +void CustomMakeConfigWidget::envAdded() +{ + QString env = envs_combo->currentText(); + m_allEnvironments.append(env); + + envs_combo->clear(); + envs_combo->insertStringList(m_allEnvironments); + envChanged(env); +} + +void CustomMakeConfigWidget::envRemoved() +{ + QString env = envs_combo->currentText(); + QDomNode node = DomUtil::elementByPath(m_dom, m_configGroup + "/make/environments"); + node.removeChild(node.namedItem(env)); + m_allEnvironments.remove(env); + envs_combo->clear(); + envs_combo->insertStringList(m_allEnvironments); + m_currentEnvironment = QString::null; + envChanged( m_allEnvironments[0] ); +} + +void CustomMakeConfigWidget::envCopied() +{ + QString env = envs_combo->currentText(); + m_allEnvironments.append(env); + envs_combo->clear(); + envs_combo->insertStringList(m_allEnvironments); + m_currentEnvironment = env; + m_envWidget->changeConfigGroup(m_configGroup + "/make/environments/" + env); + envs_combo->setEditText(env); +} + +void CustomMakeConfigWidget::accept() +{ + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/abortonerror", abort_box->isChecked()); + if( runMultiJobs->isChecked() ) + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/numberofjobs", jobs_box->value()); + else + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/numberofjobs", 0); + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/prio", prio_box->value()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/dontact", dontact_box->isChecked()); + DomUtil::writeEntry(m_dom, m_configGroup + "/make/makebin", makebin_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/make/defaulttarget", defaultTarget_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/make/makeoptions", makeoptions_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/make/selectedenvironment", m_currentEnvironment); + m_envWidget->accept(); +} + +#include "custommakeconfigwidget.moc" diff --git a/buildtools/custommakefiles/custommakeconfigwidget.h b/buildtools/custommakefiles/custommakeconfigwidget.h new file mode 100644 index 00000000..ae8376c1 --- /dev/null +++ b/buildtools/custommakefiles/custommakeconfigwidget.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2003 by Hendrik Kueck * + * kueck@cs.ubc.ca * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef CUSTOMMAKECONFIGWIDGET_H +#define CUSTOMMAKECONFIGWIDGET_H + +#include "domutil.h" + +#include + +class CustomProjectPart; +class EnvironmentVariablesWidget; + +/** +@author KDevelop Authors +*/ +class CustomMakeConfigWidget : public CustomMakeConfigWidgetBase +{ + Q_OBJECT + +public: + CustomMakeConfigWidget(CustomProjectPart* part, const QString& configGroup, QWidget* parent); + + ~CustomMakeConfigWidget(); + +public slots: + void accept(); + +protected: + CustomProjectPart* m_part; + QString m_configGroup; + QDomDocument& m_dom; + + QStringList m_allEnvironments; + QString m_currentEnvironment; + + EnvironmentVariablesWidget* m_envWidget; + + virtual void envNameChanged(const QString& envName); + virtual void envChanged(const QString& envName); + virtual void envAdded(); + virtual void envRemoved(); + virtual void envCopied(); + +}; + +#endif diff --git a/buildtools/custommakefiles/custommakeconfigwidgetbase.ui b/buildtools/custommakefiles/custommakeconfigwidgetbase.ui new file mode 100644 index 00000000..b864a18f --- /dev/null +++ b/buildtools/custommakefiles/custommakeconfigwidgetbase.ui @@ -0,0 +1,395 @@ + +CustomMakeConfigWidgetBase + + + CustomMakeConfigWidgetBase + + + + 0 + 0 + 659 + 600 + + + + Make Options + + + + unnamed + + + + abort_box + + + A&bort on first error + + + + + dontact_box + + + Only di&splay commands without actually executing them + + + + + layout3 + + + + unnamed + + + + defaultTarget_edit + + + + + makebin_edit + + + + + makeoptions_label + + + A&dditional make options: + + + makeoptions_edit + + + + + makeoptions_edit + + + + + makebin_label + + + Name of make e&xecutable: + + + makebin_edit + + + + + defTarget_label + + + Default make &target: + + + defaultTarget_edit + + + + + + + layout6 + + + + unnamed + + + + runMultiJobs + + + Run multiple jobs + + + + + jobs_label + + + false + + + Number of simultaneous &jobs: + + + jobs_box + + + + + jobs_box + + + false + + + + 0 + 0 + 0 + 0 + + + + 30 + + + 1 + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 200 + 20 + + + + + + + + layout5 + + + + unnamed + + + + prio_label + + + Make &priority: + + + jobs_box + + + + + prio_box + + + + 0 + 0 + 0 + 0 + + + + 19 + + + -20 + + + 0 + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 192 + 20 + + + + + + + + layout3 + + + + unnamed + + + + envs_label + + + + 1 + 5 + 0 + 0 + + + + E&nvironment: + + + envs_combo + + + + + envs_combo + + + + 3 + 0 + 0 + 0 + + + + true + + + + + addenvs_button + + + &Add + + + false + + + + + copyenvs_button + + + Co&py + + + false + + + + + removeenvs_button + + + Re&move + + + false + + + + + + + env_var_group + + + + 5 + 3 + 0 + 0 + + + + Environment &Variables + + + + + + + envs_combo + textChanged(const QString&) + CustomMakeConfigWidgetBase + envNameChanged(const QString&) + + + envs_combo + activated(const QString&) + CustomMakeConfigWidgetBase + envChanged(const QString&) + + + copyenvs_button + clicked() + CustomMakeConfigWidgetBase + envCopied() + + + addenvs_button + clicked() + CustomMakeConfigWidgetBase + envAdded() + + + removeenvs_button + clicked() + CustomMakeConfigWidgetBase + envRemoved() + + + runMultiJobs + toggled(bool) + jobs_label + setEnabled(bool) + + + runMultiJobs + toggled(bool) + jobs_box + setEnabled(bool) + + + + abort_box + dontact_box + makebin_edit + makeoptions_edit + jobs_box + envs_combo + addenvs_button + copyenvs_button + removeenvs_button + + + kdialog.h + + + envNameChanged(const QString &) + envChanged(const QString&) + envAdded() + envRemoved() + envCopied() + + + + + klineedit.h + klineedit.h + klineedit.h + + diff --git a/buildtools/custommakefiles/custommanagerwidget.cpp b/buildtools/custommakefiles/custommanagerwidget.cpp new file mode 100644 index 00000000..9001480e --- /dev/null +++ b/buildtools/custommakefiles/custommanagerwidget.cpp @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "custommanagerwidget.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "customprojectpart.h" +#include "domutil.h" + +CustomManagerWidget::CustomManagerWidget( CustomProjectPart* part, QWidget* parent ) + : CustomManagerWidgetBase( parent ), m_part( part), m_dom( *part->projectDom() ) +{ + m_filetypes->insertStringList( DomUtil::readListEntry( m_dom, "kdevcustomproject/filetypes", "filetype" ) ); + KURLRequester* urlselector = new KURLRequester( ); + urlselector->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + urlselector->setURL( QString::null ); + urlselector->completionObject() ->setDir( part->projectDirectory() ); + urlselector->fileDialog() ->setURL( KURL( part->projectDirectory() ) ); + m_blacklistBox = new KEditListBox( i18n("blacklisted files and directories are not" + " considered part of the project, even if they fit one of " + "the wildcard patterns in the project file list", + "Blacklisted files/dirs"), urlselector->customEditor(), this); + m_blacklistBox->setButtons( KEditListBox::Add | KEditListBox::Remove ); + m_blacklistBox->insertStringList( DomUtil::readListEntry( m_dom, "kdevcustomproject/blacklist","path") ); + grid->addWidget( m_blacklistBox, 0, 1 ); + connect(m_blacklistBox, SIGNAL(added(const QString&)), this, SLOT(checkUrl(const QString&))); +} + +void CustomManagerWidget::checkUrl(const QString& url) +{ + kdDebug(9025) << "got file:" << url << endl; + if( !QFileInfo(url).isRelative() ) + { + kdDebug(9025) << "seems to be non-relative" << endl; + QString relpath = m_part->relativeToProject( url ); + QListBoxItem* item = m_blacklistBox->listBox()->findItem( url ); + m_blacklistBox->listBox()->takeItem( item ); + kdDebug(9025) << "relative path:" << relpath << endl; + if( !relpath.isEmpty() ) + m_blacklistBox->insertItem( relpath ); + } +} + +CustomManagerWidget::~CustomManagerWidget() +{ +} + +void CustomManagerWidget::accept() +{ + DomUtil::writeListEntry( m_dom, "kdevcustomproject/filetypes", "filetype", + m_filetypes->items() ); + DomUtil::writeListEntry( m_dom, "kdevcustomproject/blacklist", "path", + m_blacklistBox->items() ); +} + + +#include "custommanagerwidget.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/custommanagerwidget.h b/buildtools/custommakefiles/custommanagerwidget.h new file mode 100644 index 00000000..4f15f156 --- /dev/null +++ b/buildtools/custommakefiles/custommanagerwidget.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef CUSTOMMANAGERWIDGET_H +#define CUSTOMMANAGERWIDGET_H + +#include "custommanagerwidgetbase.h" + + +#include + +class CustomProjectPart; +class KEditListBox; + +class CustomManagerWidget : public CustomManagerWidgetBase +{ +Q_OBJECT + +public: + CustomManagerWidget( CustomProjectPart* part, QWidget* parent ); + ~CustomManagerWidget(); +public slots: + void checkUrl(const QString& url); + void accept(); +private: + CustomProjectPart* m_part; + QDomDocument& m_dom; + KEditListBox* m_blacklistBox; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/custommanagerwidgetbase.ui b/buildtools/custommakefiles/custommanagerwidgetbase.ui new file mode 100644 index 00000000..a388b288 --- /dev/null +++ b/buildtools/custommakefiles/custommanagerwidgetbase.ui @@ -0,0 +1,74 @@ + +CustomManagerWidgetBase + + + CustomManagerWidgetBase + + + + 0 + 0 + 467 + 393 + + + + Custom Manager Options + + + + unnamed + + + + grid + + + + unnamed + + + + m_filetypes + + + Filetypes used in Project + + + Remove|Add + + + Add filetypes to be used in Projects, can be full filenames or shell wildcards + + + Each entry contains a filetype used in the project in the form of a filename or a filename wildcard (using shell wildcards). +This will be used when adding/removing files in directories and re-populating the project + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 108 + + + + + + + + + + keditlistbox.h + klineedit.h + + diff --git a/buildtools/custommakefiles/customotherconfigwidget.cpp b/buildtools/custommakefiles/customotherconfigwidget.cpp new file mode 100644 index 00000000..47fe4b4d --- /dev/null +++ b/buildtools/custommakefiles/customotherconfigwidget.cpp @@ -0,0 +1,125 @@ +/*************************************************************************** + * Copyright (C) 2005 by Achim Herwig * + * achim.herwig@wodca.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "customotherconfigwidget.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +CustomOtherConfigWidget::CustomOtherConfigWidget(CustomProjectPart* part, const QString& configGroup, QWidget* parent) + : CustomOtherConfigWidgetBase(parent), + m_part(part), m_configGroup(configGroup), m_dom( *part->projectDom() ) +{ + prio_box->setValue(DomUtil::readIntEntry(m_dom, m_configGroup + "/other/prio")); + makebin_edit->setText(DomUtil::readEntry(m_dom, m_configGroup + "/other/otherbin")); + defaultTarget_edit->setText(DomUtil::readEntry(m_dom, m_configGroup + "/other/defaulttarget")); + makeoptions_edit->setText(DomUtil::readEntry(m_dom, m_configGroup + "/other/otheroptions")); + + envs_combo->setValidator(new QRegExpValidator(QRegExp("^\\D.*"), this)); + m_allEnvironments = m_part->allMakeEnvironments(); + m_currentEnvironment = m_part->currentMakeEnvironment(); + env_var_group->setColumnLayout( 1, Qt::Vertical ); + m_envWidget = new EnvironmentVariablesWidget(m_dom, m_configGroup + "/other/environments/" + m_currentEnvironment, env_var_group); + envs_combo->insertStringList(m_allEnvironments); + envs_combo->setEditText(m_currentEnvironment); +} + + +CustomOtherConfigWidget::~CustomOtherConfigWidget() +{ + +} + +void CustomOtherConfigWidget::envNameChanged(const QString& envName) +{ + QStringList allEnvNames = m_part->allMakeEnvironments(); + bool canAdd = !allEnvNames.contains(envName) && !envName.contains("/") && !envName.isEmpty(); + bool canRemove = allEnvNames.contains(envName) && allEnvNames.count() > 1; + addenvs_button->setEnabled(canAdd); + copyenvs_button->setEnabled(canAdd); + removeenvs_button->setEnabled(canRemove); +} + +void CustomOtherConfigWidget::envChanged(const QString& envName) +{ + if (envName == m_currentEnvironment || !m_allEnvironments.contains(envName)) + return; + + // save settings of previously active environment + if (!m_currentEnvironment.isNull() ) + m_envWidget->accept(); + + m_currentEnvironment = envName; + m_envWidget->readEnvironment(m_dom, m_configGroup + "/other/environments/" + envName); + envs_combo->setEditText(envName); +} + +void CustomOtherConfigWidget::envAdded() +{ + QString env = envs_combo->currentText(); + m_allEnvironments.append(env); + + envs_combo->clear(); + envs_combo->insertStringList(m_allEnvironments); + envChanged(env); +} + +void CustomOtherConfigWidget::envRemoved() +{ + QString env = envs_combo->currentText(); + QDomNode node = DomUtil::elementByPath(m_dom, m_configGroup + "/other/environments"); + node.removeChild(node.namedItem(env)); + m_allEnvironments.remove(env); + envs_combo->clear(); + envs_combo->insertStringList(m_allEnvironments); + m_currentEnvironment = QString::null; + envChanged( m_allEnvironments[0] ); +} + +void CustomOtherConfigWidget::envCopied() +{ + QString env = envs_combo->currentText(); + m_allEnvironments.append(env); + envs_combo->clear(); + envs_combo->insertStringList(m_allEnvironments); + m_currentEnvironment = env; + m_envWidget->changeConfigGroup(m_configGroup + "/other/environments/" + env); + envs_combo->setEditText(env); +} + +void CustomOtherConfigWidget::accept() +{ + DomUtil::writeIntEntry(m_dom, m_configGroup + "/other/prio", prio_box->value()); + DomUtil::writeEntry(m_dom, m_configGroup + "/other/otherbin", makebin_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/other/defaulttarget", defaultTarget_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/other/otheroptions", makeoptions_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/other/selectedenvironment", m_currentEnvironment); + m_envWidget->accept(); +} + +#include "customotherconfigwidget.moc" +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/custommakefiles/customotherconfigwidget.h b/buildtools/custommakefiles/customotherconfigwidget.h new file mode 100644 index 00000000..755df98b --- /dev/null +++ b/buildtools/custommakefiles/customotherconfigwidget.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2005 by Achim Herwig * + * achim.herwig@wodca.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef CUSTOMOTHERCONFIGWIDGET_H +#define CUSTOMOTHERCONFIGWIDGET_H + +#include "domutil.h" + +#include + +class CustomProjectPart; +class EnvironmentVariablesWidget; + +/** +@author KDevelop Authors +*/ +class CustomOtherConfigWidget : public CustomOtherConfigWidgetBase +{ + Q_OBJECT + +public: + CustomOtherConfigWidget(CustomProjectPart* part, const QString& configGroup, QWidget* parent); + + ~CustomOtherConfigWidget(); + +public slots: + void accept(); + +protected: + CustomProjectPart* m_part; + QString m_configGroup; + QDomDocument& m_dom; + + QStringList m_allEnvironments; + QString m_currentEnvironment; + + EnvironmentVariablesWidget* m_envWidget; + + virtual void envNameChanged(const QString& envName); + virtual void envChanged(const QString& envName); + virtual void envAdded(); + virtual void envRemoved(); + virtual void envCopied(); + +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/custommakefiles/customotherconfigwidgetbase.ui b/buildtools/custommakefiles/customotherconfigwidgetbase.ui new file mode 100644 index 00000000..174391ae --- /dev/null +++ b/buildtools/custommakefiles/customotherconfigwidgetbase.ui @@ -0,0 +1,288 @@ + +CustomOtherConfigWidgetBase + + + CustomOtherConfigWidgetBase + + + + 0 + 0 + 659 + 600 + + + + Make Options + + + + unnamed + + + + layout3 + + + + unnamed + + + + defaultTarget_edit + + + + + makebin_edit + + + + + makeoptions_label + + + Add&itional options: + + + makeoptions_edit + + + + + makeoptions_edit + + + + + makebin_label + + + Name of build &script + + + makebin_edit + + + + + defTarget_label + + + Default &target: + + + defaultTarget_edit + + + + + + + layout2 + + + + unnamed + + + + prio_label + + + Run with priority: + + + jobs_box + + + + + prio_box + + + + 0 + 0 + 0 + 0 + + + + 19 + + + -20 + + + 0 + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + + + layout3 + + + + unnamed + + + + envs_label + + + + 1 + 5 + 0 + 0 + + + + E&nvironment: + + + envs_combo + + + + + envs_combo + + + + 3 + 0 + 0 + 0 + + + + true + + + + + addenvs_button + + + &Add + + + false + + + + + copyenvs_button + + + &Copy + + + false + + + + + removeenvs_button + + + Re&move + + + false + + + + + + + env_var_group + + + + 5 + 3 + 0 + 0 + + + + Environment &Variables + + + + + + + envs_combo + textChanged(const QString&) + CustomOtherConfigWidgetBase + envNameChanged(const QString&) + + + envs_combo + activated(const QString&) + CustomOtherConfigWidgetBase + envChanged(const QString&) + + + copyenvs_button + clicked() + CustomOtherConfigWidgetBase + envCopied() + + + addenvs_button + clicked() + CustomOtherConfigWidgetBase + envAdded() + + + removeenvs_button + clicked() + CustomOtherConfigWidgetBase + envRemoved() + + + + makebin_edit + makeoptions_edit + envs_combo + addenvs_button + copyenvs_button + removeenvs_button + + + kdialog.h + + + envNameChanged(const QString &) + envChanged(const QString&) + envAdded() + envRemoved() + envCopied() + + + + diff --git a/buildtools/custommakefiles/customprojectpart.cpp b/buildtools/custommakefiles/customprojectpart.cpp new file mode 100644 index 00000000..f061dadc --- /dev/null +++ b/buildtools/custommakefiles/customprojectpart.cpp @@ -0,0 +1,1669 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "customprojectpart.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevmakefrontend.h" +#include "kdevappfrontend.h" +#include "kdevpartcontroller.h" +#include "runoptionswidget.h" +#include "makeoptionswidget.h" +#include "custombuildoptionswidget.h" +#include "custommakeconfigwidget.h" +#include "customotherconfigwidget.h" +#include "custommanagerwidget.h" +#include "config.h" +#include "envvartools.h" +#include "urlutil.h" + +#include "selectnewfilesdialog.h" + +#include + +typedef KDevGenericFactory CustomProjectFactory; +static const KDevPluginInfo data( "kdevcustomproject" ); +K_EXPORT_COMPONENT_FACTORY( libkdevcustomproject, CustomProjectFactory( data ) ) + +CustomProjectPart::CustomProjectPart( QObject *parent, const char *name, const QStringList & ) + : KDevBuildTool( &data, parent, name ? name : "CustomProjectPart" ) + , m_lastCompilationFailed( false ), m_recursive( false ), m_first_recursive( false ) +{ + setInstance( CustomProjectFactory::instance() ); + setXMLFile( "kdevcustomproject.rc" ); + + m_executeAfterBuild = false; + + KAction *action; + + action = new KAction( i18n( "Re-Populate Project" ), 0, this, SLOT( populateProject() ), actionCollection(), "repopulate_project" ); + action->setToolTip( i18n( "Re-Populate Project" ) ); + action->setWhatsThis( i18n( "Re-Populate Project

Re-Populates the project, searching through the project directory and adding all files that match one of the wildcards set in the custom manager options of the project filelist." ) ); + + action = new KAction( i18n( "&Build Project" ), "make_kdevelop", Key_F8, + this, SLOT( slotBuild() ), + actionCollection(), "build_build" ); + action->setToolTip( i18n( "Build project" ) ); + action->setWhatsThis( i18n( "Build project

Runs make from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Build Options tab." ) ); + + action = new KAction( i18n( "&Build Active Directory" ), "make_kdevelop", Key_F7, + this, SLOT( slotBuildActiveDir() ), + actionCollection(), "build_buildactivetarget" ); + action->setToolTip( i18n( "Build active directory" ) ); + action->setWhatsThis( i18n( "Build active directory

Constructs a series of make commands to build the active directory. " + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + action = new KAction( i18n( "Compile &File" ), "make_kdevelop", + this, SLOT( slotCompileFile() ), + actionCollection(), "build_compilefile" ); + action->setToolTip( i18n( "Compile file" ) ); + action->setWhatsThis( i18n( "Compile file

Runs make filename.o command from the directory where 'filename' is the name of currently opened file.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Build Options tab." ) ); + + action = new KAction( i18n( "Install" ), 0, + this, SLOT( slotInstall() ), + actionCollection(), "build_install" ); + action->setToolTip( i18n( "Install" ) ); + action->setWhatsThis( i18n( "Install

Runs make install command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + action = new KAction( i18n( "Install Active Directory" ), 0, + this, SLOT( slotInstallActiveDir() ), + actionCollection(), "build_installactivetarget" ); + action->setToolTip( i18n( "Install active directory" ) ); + action->setWhatsThis( i18n( "Install active directory

Runs make install command from the active directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + action = new KAction( i18n( "Install (as root user)" ), 0, + this, SLOT( slotInstallWithKdesu() ), + actionCollection(), "build_install_kdesu" ); + action->setToolTip( i18n( "Install as root user" ) ); + action->setWhatsThis( i18n( "Install

Runs make install command from the project directory with root privileges.
" + "It is executed via kdesu command.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + action = new KAction( i18n( "&Clean Project" ), 0, + this, SLOT( slotClean() ), + actionCollection(), "build_clean" ); + action->setToolTip( i18n( "Clean project" ) ); + action->setWhatsThis( i18n( "Clean project

Runs make clean command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Build Options tab." ) ); + + action = new KAction( i18n( "Execute Program" ), "exec", 0, + this, SLOT( slotExecute() ), + actionCollection(), "build_execute" ); + action->setToolTip( i18n( "Execute program" ) ); + action->setWhatsThis( i18n( "Execute program

Executes the main program specified in project settings, Run Options tab. " + "If it is not specified then the active target is used to determine the application to run." ) ); + + KActionMenu *menu = new KActionMenu( i18n( "Build &Target" ), + actionCollection(), "build_target" ); + m_targetMenu = menu->popupMenu(); + menu->setToolTip( i18n( "Build target" ) ); + menu->setWhatsThis( i18n( "Build target

Runs make targetname from the project directory (targetname is the name of the target selected).
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Build Options tab." ) ); + + m_targetObjectFilesMenu = new QPopupMenu(); + m_targetOtherFilesMenu = new QPopupMenu(); + + m_makeEnvironmentsSelector = new KSelectAction( i18n( "Make &Environment" ), 0, + actionCollection(), "build_make_environment" ); + m_makeEnvironmentsSelector->setToolTip( i18n( "Make environment" ) ); + m_makeEnvironmentsSelector->setWhatsThis( i18n( "Make Environment

Choose the set of environment variables to be passed on to make.
" + "Environment variables can be specified in the project " + "settings dialog, Build Options tab." ) ); + + connect( m_targetMenu, SIGNAL( aboutToShow() ), + this, SLOT( updateTargetMenu() ) ); + connect( m_targetMenu, SIGNAL( activated( int ) ), + this, SLOT( targetMenuActivated( int ) ) ); + connect( m_targetObjectFilesMenu, SIGNAL( activated( int ) ), + this, SLOT( targetObjectFilesMenuActivated( int ) ) ); + connect( m_targetOtherFilesMenu, SIGNAL( activated( int ) ), + this, SLOT( targetOtherFilesMenuActivated( int ) ) ); + connect( m_makeEnvironmentsSelector->popupMenu(), SIGNAL( aboutToShow() ), + this, SLOT( updateMakeEnvironmentsMenu() ) ); + connect( m_makeEnvironmentsSelector->popupMenu(), SIGNAL( activated( int ) ), + this, SLOT( makeEnvironmentsMenuActivated( int ) ) ); + connect( core(), SIGNAL( projectConfigWidget( KDialogBase* ) ), + this, SLOT( projectConfigWidget( KDialogBase* ) ) ); + connect( core(), SIGNAL( contextMenu( QPopupMenu *, const Context * ) ), + this, SLOT( contextMenu( QPopupMenu *, const Context * ) ) ); + + connect( makeFrontend(), SIGNAL( commandFinished( const QString& ) ), + this, SLOT( slotCommandFinished( const QString& ) ) ); + connect( makeFrontend(), SIGNAL( commandFailed( const QString& ) ), + this, SLOT( slotCommandFailed( const QString& ) ) ); +} + + +CustomProjectPart::~CustomProjectPart() +{} + + +void CustomProjectPart::projectConfigWidget( KDialogBase *dlg ) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage( i18n( "Custom Manager" ), i18n( "Custom Manager" ), BarIcon( "make", KIcon::SizeMedium ) ); + CustomManagerWidget *w0 = new CustomManagerWidget( this, vbox ); + connect( dlg, SIGNAL( okClicked() ), w0, SLOT( accept() ) ); + + vbox = dlg->addVBoxPage( i18n( "Run Options" ), i18n( "Run Options" ), BarIcon( "make", KIcon::SizeMedium ) ); + RunOptionsWidget *w1 = new RunOptionsWidget( *projectDom(), "/kdevcustomproject", buildDirectory(), vbox ); + connect( dlg, SIGNAL( okClicked() ), w1, SLOT( accept() ) ); + vbox = dlg->addVBoxPage( i18n( "Build Options" ), i18n( "Build Options" ), BarIcon( "make", KIcon::SizeMedium ) ); + QTabWidget *buildtab = new QTabWidget( vbox ); + + CustomBuildOptionsWidget *w2 = new CustomBuildOptionsWidget( *projectDom(), buildtab ); + connect( dlg, SIGNAL( okClicked() ), w2, SLOT( accept() ) ); + buildtab->addTab( w2, i18n( "&Build" ) ); + + CustomOtherConfigWidget *w4 = new CustomOtherConfigWidget( this, "/kdevcustomproject", buildtab ); + connect( dlg, SIGNAL( okClicked() ), w4, SLOT( accept() ) ); + buildtab->addTab( w4, i18n( "&Other" ) ); + + CustomMakeConfigWidget *w3 = new CustomMakeConfigWidget( this, "/kdevcustomproject", buildtab ); + buildtab->addTab( w3, i18n( "Ma&ke" ) ); + w2->setMakeOptionsWidget( buildtab, w3, w4 ); + connect( dlg, SIGNAL( okClicked() ), w3, SLOT( accept() ) ); + +} + + +void CustomProjectPart::contextMenu( QPopupMenu *popup, const Context *context ) +{ + if ( !context->hasType( Context::FileContext ) ) + return; + + const FileContext *fcontext = static_cast( context ); + + m_contextAddFiles.clear(); + m_contextRemoveFiles.clear(); + + QString popupstr = fcontext->urls().first().fileName(); + + if ( popupstr == QString::null ) + popupstr = "."; + + if ( fcontext->urls().size() == 1 && URLUtil::isDirectory( fcontext->urls().first() ) && !isInBlacklist( fcontext->urls().first().path() ) ) + { + popup->insertSeparator(); + // remember the name of the directory + m_contextDirName = fcontext->urls().first().path(); + m_contextDirName = m_contextDirName.mid( project()->projectDirectory().length() + 1 ); + int id = popup->insertItem( i18n( "Make Active Directory" ), + this, SLOT( slotChooseActiveDirectory() ) ); + popup->setWhatsThis( id, i18n( "Make active directory

" + "Chooses this directory as the destination for new files created using wizards " + "like the New Class wizard." ) ); + } + + kdDebug( 9025 ) << "context urls: " << fcontext->urls() << endl; + if ( fcontext->urls().size() == 1 && ( isProjectFileType( fcontext->urls().first().path() ) || URLUtil::isDirectory( fcontext->urls().first() ) ) ) + { + popup->insertSeparator(); + m_contextDirName = fcontext->urls().first().path(); + m_contextDirName = m_contextDirName.mid( project()->projectDirectory().length() + 1 ); + int id; + if ( isInBlacklist( m_contextDirName ) ) + { + id = popup->insertItem( i18n( "Remove from blacklist" ), + this, SLOT( slotChangeBlacklist() ) ); + popup->setWhatsThis( id, i18n( "Remove from blacklist

" + "Removes the given file or directory from the " + "blacklist if it is already in it.
The blacklist contains files and" + " directories that should be ignored even if they match a project filetype " + "pattern" ) ); + } + else + { + id = popup->insertItem( i18n( "Add to blacklist" ), + this, SLOT( slotChangeBlacklist() ) ); + popup->setWhatsThis( id, i18n( "Add to blacklist

" + "Adds the given file or directory to the blacklist.
The blacklist contains files and" + " directories that should be ignored even if they match a project filetype " + "pattern" ) ); + } + } + + const KURL::List urls = fcontext->urls(); + + bool dirAddRecursive = false; + bool dirDelRecursive = false; + + for ( KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it ) + { + kdDebug( 9025 ) << "Checking URL: " << *it << endl; + QString canPath( URLUtil::canonicalPath(( *it ).path() ) ); + QString relPath = relativeToProject( canPath ); + kdDebug( 9025 ) << "relpath: " << relPath << "|canpath: " << canPath << endl; + if ( isInBlacklist( relPath ) ) + continue; + if ((( *it ).isLocalFile() && isProjectFileType(( *it ).fileName() ) ) ) + { + if ( project()->isProjectFile( canPath ) ) + m_contextRemoveFiles << relPath; + if ( !project()->isProjectFile( canPath ) ) + m_contextAddFiles << relPath; + } + if ( QFileInfo(( *it ).path() ).isDir() ) + { + if ( containsProjectFiles( canPath ) || project()->isProjectFile( canPath ) ) + { + if ( containsProjectFiles( canPath ) ) + dirDelRecursive = true; + m_contextRemoveFiles << relPath; + } + if ( containsNonProjectFiles( canPath ) || !project()->isProjectFile( canPath ) ) + { + if ( containsNonProjectFiles( canPath ) ) + dirAddRecursive = true; + m_contextAddFiles << relPath; + } + } + } + + if ( m_contextAddFiles.size() > 0 || m_contextRemoveFiles.size() > 0 ) + popup->insertSeparator(); + if ( m_contextAddFiles.size() > 0 ) + { + int id = popup->insertItem( i18n( "Add Selected File/Dir(s) to Project" ), + this, SLOT( slotAddToProject() ) ); + popup->setWhatsThis( id, i18n( "Add to project

Adds selected file/dir(s) to the list of files in the project. " + "Note that the files should be manually added to the corresponding makefile or build.xml." ) ); + if ( dirAddRecursive ) + { + int id = popup->insertItem( i18n( "Add Selected Dir(s) to Project (recursive)" ), + this, SLOT( slotAddToProjectRecursive() ) ); + popup->setWhatsThis( id, i18n( "Add to project

Recursively adds selected dir(s) to the list of files in the project. " + "Note that the files should be manually added to the corresponding makefile or build.xml." ) ); + } + } + + if ( m_contextRemoveFiles.size() > 0 ) + { + int id = popup->insertItem( i18n( "Remove Selected File/Dir(s) From Project" ), + this, SLOT( slotRemoveFromProject() ) ); + popup->setWhatsThis( id, i18n( "Remove from project

Removes selected file/dir(s) from the list of files in the project. " + "Note that the files should be manually excluded from the corresponding makefile or build.xml." ) ); + + if ( dirDelRecursive ) + { + int id = popup->insertItem( i18n( "Remove Selected Dir(s) From Project (recursive)" ), + this, SLOT( slotRemoveFromProjectRecursive() ) ); + popup->setWhatsThis( id, i18n( "Remove from project

Recursively removes selected dir(s) from the list of files in the project. " + "Note that the files should be manually excluded from the corresponding makefile or build.xml." ) ); + } + } +} + + +void CustomProjectPart::slotAddToProject() +{ + m_recursive = false; + m_first_recursive = true; + addFiles( m_contextAddFiles ); +} + + +void CustomProjectPart::slotRemoveFromProject() +{ + m_recursive = false; + m_first_recursive = true; + removeFiles( m_contextRemoveFiles ); +} + + +void CustomProjectPart::slotAddToProjectRecursive() +{ + m_recursive = true; + addFiles( m_contextAddFiles ); + m_recursive = false; +} + + +void CustomProjectPart::slotRemoveFromProjectRecursive() +{ + m_recursive = true; + removeFiles( m_contextRemoveFiles ); + m_recursive = false; +} + +void CustomProjectPart::slotChangeBlacklist() +{ + switchBlacklistEntry( m_contextDirName ); +} + +void CustomProjectPart::slotChooseActiveDirectory() +{ + QString olddir = activeDirectory(); + QDomDocument &dom = *projectDom(); + DomUtil::writeEntry( dom, "/kdevcustomproject/general/activedir", m_contextDirName ); + emit activeDirectoryChanged( olddir, activeDirectory() ); +} + + +void CustomProjectPart::openProject( const QString &dirName, const QString &projectName ) +{ + m_projectDirectory = dirName; + m_projectName = projectName; + + QDomDocument &dom = *projectDom(); + // Set the default directory radio to "executable" + if ( DomUtil::readEntry( dom, "/kdevcustomproject/run/directoryradio" ) == "" ) + { + DomUtil::writeEntry( dom, "/kdevcustomproject/run/directoryradio", "executable" ); + } + + if ( filetypes().isEmpty() ) + { + QStringList types; + types << "*.java" << "*.h" << "*.H" << "*.hh" << "*.hxx" << "*.hpp" << "*.c" << "*.C" + << "*.cc" << "*.cpp" << "*.c++" << "*.cxx" << "Makefile" << "CMakeLists.txt"; + DomUtil::writeListEntry( dom, "/kdevcustomproject/filetypes", "filetype", types ); + } + + /*this entry is currently only created by the cmake kdevelop3 project generator + in order to support completely-out-of-source builds, where nothing, not + even the kdevelop project files are created in the source directory, Alex + */ + m_filelistDir = DomUtil::readEntry( dom, "/kdevcustomproject/filelistdirectory" ); + if ( m_filelistDir.isEmpty() ) + m_filelistDir = dirName; + + if ( QFileInfo( m_filelistDir + "/" + projectName.lower() + + ".kdevelop.filelist" ).exists() ) + { + QDir( m_filelistDir ).rename( + projectName.lower() + ".kdevelop.filelist", + projectName + ".kdevelop.filelist" ); + } + + QFile f( m_filelistDir + "/" + projectName + ".kdevelop.filelist" ); + if ( f.open( IO_ReadOnly ) ) + { + QTextStream stream( &f ); + while ( !stream.atEnd() ) + { + QString s = stream.readLine(); + // Skip comments. + if ( s.isEmpty() || s.startsWith( "#" ) ) + continue; + // Skip non-existent files. + if ( ! QFileInfo( projectDirectory() + "/" + s ).exists() ) + continue; + // Do not bother with files already in project or on blacklist. + if ( isInProject( s ) || isInBlacklist( s ) ) + continue; + addToProject( s ); + } + QStringList newfiles; + findNewFiles( dirName, newfiles ); + + if ( newfiles.count() > 0 ) + { + addNewFilesToProject( newfiles ); + } + + } + else + { + int r = KMessageBox::questionYesNo( mainWindow()->main(), + i18n( "This project does not contain any files yet.\n" + "Populate it with all C/C++/Java files below " + "the project directory?" ), QString::null, i18n( "Populate" ), i18n( "Do Not Populate" ) ); + if ( r == KMessageBox::Yes ) + populateProject(); + } + + + // check if there is an old envvars entry (from old project file with single make environment) + QString buildtool = DomUtil::readEntry( dom , "/kdevcustomproject/build/buildtool" ); + QDomElement el = + DomUtil::elementByPath( dom , "/kdevcustomproject/" + buildtool + "/envvars" ); + if ( !el.isNull() ) + { + QDomElement envs = DomUtil::createElementByPath( dom , "/kdevcustomproject/" + buildtool + "/environments" ); + DomUtil::makeEmpty( envs ); + el.setTagName( "default" ); + envs.appendChild( el ); + } + KDevProject::openProject( dirName, projectName ); +} + + +/** + * @brief Recursively search given directory searching for files which may be part of this project. + * + * The files found not in a black list, + * and not being already part of our project are gathered. + * + * @param dir directory to scan (and recurse) for potential project files. + * @param[out] fileList the list of files found. + */ +void CustomProjectPart::findNewFiles( const QString& dir, QStringList& filelist ) const +{ + if ( dir.isEmpty() ) + return; + QStringList fileentries = QDir( dir ).entryList( filetypes().join( ";" ) ); + QStringList dirs = QDir( dir ).entryList( QDir::Dirs ); + QStringList entries = fileentries + dirs; + QString relpath = relativeToProject( dir ); + if ( !relpath.isEmpty() ) + relpath += "/"; + for ( QStringList::const_iterator it = entries.begin(); it != entries.end(); ++it ) + { + // Only process genuine entries - files and directories. + if (( *it == "." ) || ( *it == ".." ) ) + continue; + // If the entry (be it a file or a directory) is already part of this project, proceed to next one. + const QString relativeEntry( relpath + *it ); + if ( isInProject( relativeEntry ) ) + continue; + // If the entry is blacklisted, proceed to next one. + // Note that by using generic isInBlacklist(), + // we are actually wasting resources, + // because it also tests whether any parent directory of relativeEntry is blacklisted. + // But by the order we are traversing and processing the directories, + // we know it is not the case, ever. + if ( isInBlacklist( relativeEntry ) ) + continue; + // We have a new, non-blacklisted entry. + // Recurse into it (a directory) or add it to the potential list of new project files. + const QString absoluteEntry( dir + "/" + *it ); + if ( QFileInfo( absoluteEntry ).isFile() ) + { + filelist << relativeEntry; + } + else if ( QFileInfo( absoluteEntry ).isDir() ) + { + bool searchRecursive = true; + QFileInfo fi( absoluteEntry ); + if( fi.isSymLink() ) + { + QString realDir = fi.readLink(); + if( QFileInfo( realDir ).exists() ) + { + for( QStringList::const_iterator it = filelist.constBegin(); it != filelist.constEnd(); ++it ) + { + + if( QFileInfo(projectDirectory()+"/"+*it).absFilePath().startsWith( realDir ) ) + { + searchRecursive = false; + } + } + } else { + searchRecursive = false; + } + } + if( searchRecursive ) + { + findNewFiles( absoluteEntry, filelist ); + } + } + } +} + + +void CustomProjectPart::populateProject() +{ + + KDialogBase* dlg = new KDialogBase( mainWindow()->main(), "typeselector", true, + "Select filetypes of project", KDialogBase::Ok | KDialogBase::Cancel ); + QVBox* box = dlg->makeVBoxMainWidget(); + KEditListBox* lb = new KEditListBox( "Filetypes in the project", box, "selecttypes", + false, KEditListBox::Add | KEditListBox::Remove ); + lb->setItems( filetypes() ); + if ( dlg->exec() == QDialog::Accepted ) + { + setFiletypes( lb->items() ); + } + + QApplication::setOverrideCursor( Qt::waitCursor ); + removeFiles( allFiles() ); + updateBlacklist( QStringList() ); + + QStringList newlist; + + findNewFiles( projectDirectory(), newlist ); + + QApplication::restoreOverrideCursor(); + addNewFilesToProject( newlist ); +} + + +void CustomProjectPart::closeProject() +{ + saveProject(); +} + +void CustomProjectPart::saveProject() +{ + QFile f( m_filelistDir + "/" + m_projectName + ".kdevelop.filelist" ); + if ( !f.open( IO_WriteOnly ) ) + return; + + QTextStream stream( &f ); + stream << "# KDevelop Custom Project File List" << endl; + + ProjectFilesSet::ConstIterator it; + for ( it = m_sourceFilesSet.constBegin(); it != m_sourceFilesSet.constEnd(); ++it ) + stream << it.key() << endl; + f.close(); +} + + +QString CustomProjectPart::projectDirectory() const +{ + return m_projectDirectory; +} + + +QString CustomProjectPart::projectName() const +{ + return m_projectName; +} + + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList CustomProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry( *projectDom(), "/kdevcustomproject/run/envvars", "envvar", "name", "value" ); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString CustomProjectPart::runDirectory() const +{ + QString cwd = defaultRunDirectory( "kdevcustomproject" ); + if ( cwd.isEmpty() ) + cwd = buildDirectory(); + return cwd; +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ +QString CustomProjectPart::mainProgram() const +{ + QDomDocument * dom = projectDom(); + + if ( !dom ) return QString(); + + QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevcustomproject/run/mainprogram" ); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith( "/" ) ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + + return QString(); +} + +/** Retuns a QString with the debug command line arguments */ +QString CustomProjectPart::debugArguments() const +{ + return DomUtil::readEntry( *projectDom(), "/kdevcustomproject/run/globaldebugarguments" ); +} + + +/** Retuns a QString with the run command line arguments */ +QString CustomProjectPart::runArguments() const +{ + return DomUtil::readEntry( *projectDom(), "/kdevcustomproject/run/programargs" ); +} + +QString CustomProjectPart::activeDirectory() const +{ + QDomDocument &dom = *projectDom(); + return DomUtil::readEntry( dom, "/kdevcustomproject/general/activedir", "." ); +} + + +QStringList CustomProjectPart::allFiles() const +{ + return m_sourceFilesSet.keys(); +} + + +void CustomProjectPart::addFile( const QString &fileName ) +{ + QStringList fileList; + fileList.append( fileName ); + + this->addFiles( fileList ); +} + +void CustomProjectPart::addFiles( const QStringList& fileList ) +{ + QStringList::ConstIterator it; + QStringList addedFiles; + QStringList myfileList = fileList; + kdDebug( 9025 ) << "Adding files: " << myfileList << endl; + myfileList.remove( "." ); + myfileList.remove( "" ); + myfileList.remove( ".." ); + for ( it = myfileList.begin(); it != myfileList.end(); ++it ) + { + if ( isInBlacklist( *it ) ) + continue; + QString relpath; + kdDebug( 9025 ) << "Checking path: " << *it << endl; + if ( QDir::isRelativePath( *it ) ) + { + kdDebug( 9025 ) << *it << " is relative" << endl; + relpath = *it; + } + else + { + kdDebug( 9025 ) << *it << " is not relative" << endl; + relpath = relativeToProject( *it ); + } + + if ( !QFileInfo( projectDirectory() + "/" + relpath ).exists() ) + continue; + + if ( QFileInfo( projectDirectory() + "/" + relpath ).isDir() && ( m_recursive || m_first_recursive ) ) + { + kdDebug( 9025 ) << "is a dir and " << m_recursive << "|" << m_first_recursive << endl; + m_first_recursive = false; + QStringList fileentries = QDir( projectDirectory() + "/" + relpath ).entryList( filetypes().join( ";" ) ); + QStringList dirs = QDir( projectDirectory() + "/" + relpath ).entryList( QDir::Dirs ); + QStringList subentries = fileentries + dirs; + for ( QStringList::iterator subit = subentries.begin(); subit != subentries.end(); ++subit ) + { + if ( *subit != "." && *subit != ".." ) + *subit = relpath + "/" + ( *subit ); + if (( *subit ).startsWith( "/" ) ) + *subit = ( *subit ).mid( 1, ( *subit ).length() ); + } + addFiles( subentries ); + addedFiles << relpath; + addToProject( relpath ); + m_first_recursive = true; + } + else if ( isProjectFileType( QFileInfo( relpath ).fileName() ) && ( ! isInProject( relpath ) ) ) + { + QStringList paths = QStringList::split( "/", relpath ); + paths.pop_back(); + QString path; + for ( QStringList::const_iterator it = paths.begin(); it != paths.end(); ++it ) + { + path += *it; + if ( ! isInProject( path ) ) + { + addedFiles << path; + addToProject( path ); + } + path += "/"; + } + addedFiles << relpath; + addToProject( relpath ); + } + else + { + kdDebug( 9025 ) << "not adding " << relpath << endl; + } + } + m_first_recursive = false; + saveProject(); + + kdDebug( 9025 ) << "Emitting addedFilesToProject" << addedFiles << endl; + emit addedFilesToProject( addedFiles ); +} + +void CustomProjectPart::removeFile( const QString &fileName ) +{ + QStringList fileList; + fileList.append( fileName ); + + this->removeFiles( fileList ); +} + +void CustomProjectPart::removeFiles( const QStringList& fileList ) +{ + kdDebug( 9025 ) << "Emitting removedFilesFromProject" << fileList << endl; + QStringList removedFiles; + QStringList myfileList = fileList; + QStringList::ConstIterator it; + myfileList.remove( "." ); + myfileList.remove( ".." ); + myfileList.remove( "" ); + + for ( it = myfileList.begin(); it != myfileList.end(); ++it ) + { + QString relpath; + if ( QDir::isRelativePath( *it ) ) + relpath = *it; + else + relpath = relativeToProject( *it ); + + if ( QFileInfo( projectDirectory() + "/" + relpath ).isDir() && ( m_recursive || m_first_recursive ) ) + { + m_first_recursive = false; + QStringList fileentries = QDir( projectDirectory() + "/" + relpath ).entryList( filetypes().join( ";" ) ); + QStringList dirs = QDir( projectDirectory() + "/" + relpath ).entryList( QDir::Dirs ); + QStringList subentries = fileentries + dirs; + for ( QStringList::iterator subit = subentries.begin(); subit != subentries.end(); ++subit ) + if ( *subit != "." && *subit != ".." ) + *subit = relpath + "/" + ( *subit ); + removeFiles( subentries ); + if ( !containsProjectFiles( relpath ) ) + { + removedFiles << relpath; + removeFromProject( relpath ); + } + m_first_recursive = true; + } + else if ( isInProject( relpath ) ) + { + removedFiles << relpath; + removeFromProject( relpath ); + QStringList paths = QStringList::split( "/", relpath ); + QString lastsubentry = paths[paths.size()-1]; + paths.pop_back(); + while ( paths.size() > 0 ) + { + QString dir = paths.join( "/" ); + QStringList projectentries = projectFilesInDir( dir ); + if ( projectentries.size() == 0 ) + { + removedFiles << dir; + removeFromProject( dir ); + } + else + break; + lastsubentry = paths[paths.size()-1]; + paths.pop_back(); + } + } + } + + saveProject(); + emit removedFilesFromProject( removedFiles ); +} + +QString CustomProjectPart::buildDirectory() const +{ + QString dir = DomUtil::readEntry( *projectDom(), "/kdevcustomproject/build/builddir" ); + if ( dir.isEmpty() ) + return projectDirectory(); + if ( QFileInfo( dir ).isRelative() ) + return QDir::cleanDirPath( projectDirectory() + "/" + dir ); + return dir; +} + + +QString CustomProjectPart::makeEnvironment() const +{ + // Get the make environment variables pairs into the environstr string + // in the form of: "ENV_VARIABLE=ENV_VALUE" + // Note that we quote the variable value due to the possibility of + // embedded spaces + QString buildtool = DomUtil::readEntry( *projectDom(), "/kdevcustomproject/build/buildtool" ); + DomUtil::PairList envvars = + DomUtil::readPairListEntry( *projectDom(), "/kdevcustomproject/" + buildtool + "/environments/" + currentMakeEnvironment(), "envvar", "name", "value" ); + + QString environstr; + DomUtil::PairList::ConstIterator it; + for ( it = envvars.begin(); it != envvars.end(); ++it ) + { + environstr += ( *it ).first; + environstr += "="; + environstr += EnvVarTools::quote(( *it ).second ); + environstr += " "; + } + + KConfigGroup grp( kapp->config(), "MakeOutputView" ); + if( grp.readBoolEntry( "ForceCLocale", true ) ) + environstr += "LC_MESSAGES=" + EnvVarTools::quote( "C" )+" "+" "+"LC_CTYPE="+EnvVarTools::quote("C")+" "; + + return environstr; +} + + +void CustomProjectPart::startMakeCommand( const QString &dir, const QString &target, bool withKdesu ) +{ + if ( partController()->saveAllFiles() == false ) + return; //user cancelled + + QDomDocument &dom = *projectDom(); + QString buildtool = DomUtil::readEntry( dom, "/kdevcustomproject/build/buildtool" ); + + QString cmdline; + if ( buildtool == "ant" ) + { + cmdline = "ant"; + } + else if ( buildtool == "other" ) + { + cmdline = DomUtil::readEntry( dom, "/kdevcustomproject/other/otherbin" ); + if ( cmdline.isEmpty() ) + cmdline = "echo"; + else if ( cmdline.find( "/" ) == -1 ) + cmdline = "./" + cmdline; + cmdline += " " + DomUtil::readEntry( dom, "/kdevcustomproject/other/otheroptions" ); + } + else + { + cmdline = DomUtil::readEntry( dom, "/kdevcustomproject/make/makebin" ); + if ( cmdline.isEmpty() ) + cmdline = MAKE_COMMAND; + if ( !DomUtil::readBoolEntry( dom, "/kdevcustomproject/make/abortonerror" ) ) + cmdline += " -k"; + int jobs = DomUtil::readIntEntry( dom, "/kdevcustomproject/make/numberofjobs" ); + if ( jobs != 0 ) + { + cmdline += " -j"; + cmdline += QString::number( jobs ); + } + if ( DomUtil::readBoolEntry( dom, "/kdevcustomproject/make/dontact" ) ) + cmdline += " -n"; + cmdline += " " + DomUtil::readEntry( dom, "/kdevcustomproject/make/makeoptions" ); + } + + cmdline += " "; + if ( !target.isEmpty() ) + cmdline += KProcess::quote( target ); + + QString dircmd = "cd "; + dircmd += KProcess::quote( dir ); + dircmd += " && "; + + int prio = DomUtil::readIntEntry( dom, "/kdevcustomproject/" + buildtool + "/prio" ); + QString nice; + if ( prio != 0 ) + { + nice = QString( "nice -n%1 " ).arg( prio ); + } + + cmdline.prepend( nice ); + cmdline.prepend( makeEnvironment() ); + + if ( withKdesu ) + cmdline = "kdesu -t -c '" + cmdline + "'"; + + m_buildCommand = dircmd + cmdline; + + + makeFrontend()->queueCommand( dir, dircmd + cmdline ); +} + + +void CustomProjectPart::slotBuild() +{ + m_lastCompilationFailed = false; + QString buildtool = DomUtil::readEntry( *projectDom(), "/kdevcustomproject/build/buildtool" ); + startMakeCommand( buildDirectory(), DomUtil::readEntry( *projectDom(), + "/kdevcustomproject/" + buildtool + "/defaulttarget" ) ); +} + +void CustomProjectPart::slotBuildActiveDir() +{ + m_lastCompilationFailed = false; + QString buildtool = DomUtil::readEntry( *projectDom(), "/kdevcustomproject/build/buildtool" ); + startMakeCommand( buildDirectory() + "/" + activeDirectory(), DomUtil::readEntry( *projectDom(), + "/kdevcustomproject/" + buildtool + "/defaulttarget" ) ); +} + + +void CustomProjectPart::slotCompileFile() +{ + KParts::ReadWritePart *part = dynamic_cast( partController()->activePart() ); + if ( !part || !part->url().isLocalFile() ) + return; + + QString fileName = part->url().path(); + QFileInfo fi( fileName ); + QString sourceDir = fi.dirPath(); + QString baseName = fi.baseName( true ); + kdDebug( 9025 ) << "Compiling " << fileName + << "in dir " << sourceDir + << " with baseName " << baseName << endl; + + // What would be nice: In case of non-recursive build system, climb up from + // the source dir until a Makefile is found + + QString buildDir = sourceDir; + QString target = baseName + ".o"; + + QString buildtool = DomUtil::readEntry( *projectDom(), "/kdevcustomproject/build/buildtool" ); + + //if there is no Makefile in the directory of the source file + //try to build it from the main build dir + //this works e.g. for non-recursive cmake Makefiles, Alex + if ( buildtool == "make" && ( QFile::exists( sourceDir + "/Makefile" ) == false ) + && ( QFile::exists( sourceDir + "/makefile" ) == false ) ) + { + buildDir = buildDirectory(); + } + + startMakeCommand( buildDir, target ); +} + +void CustomProjectPart::slotInstallActiveDir() +{ + startMakeCommand( buildDirectory() + "/" + activeDirectory(), QString::fromLatin1( "install" ) ); +} + +void CustomProjectPart::slotInstall() +{ + startMakeCommand( buildDirectory(), QString::fromLatin1( "install" ) ); +} + + +void CustomProjectPart::slotInstallWithKdesu() +{ + // First issue "make" to build the entire project with the current user + // This way we make sure all files are up to date before we do the "make install" + slotBuild(); + + // After that issue "make install" with the root user + startMakeCommand( buildDirectory(), QString::fromLatin1( "install" ), true ); +} + +void CustomProjectPart::slotClean() +{ + startMakeCommand( buildDirectory(), QString::fromLatin1( "clean" ) ); +} + + +void CustomProjectPart::slotExecute() +{ + partController()->saveAllFiles(); + + bool _auto = false; + if ( DomUtil::readBoolEntry( *projectDom(), "/kdevcustomproject/run/autocompile", true ) && ( isDirty() || !QFileInfo( mainProgram() ).exists() ) ) + { + m_executeAfterBuild = true; + slotBuild(); + _auto = true; + } + + if ( DomUtil::readBoolEntry( *projectDom(), "/kdevcustomproject/run/autoinstall", false ) && ( isDirty() || !QFileInfo( mainProgram() ).exists() ) ) + { + m_executeAfterBuild = true; + // Use kdesu?? + if ( DomUtil::readBoolEntry( *projectDom(), "/kdevcustomproject/run/autokdesu", false ) ) + //slotInstallWithKdesu assumes that it hasn't just been build... + _auto ? slotInstallWithKdesu() : startMakeCommand( buildDirectory(), QString::fromLatin1( "install" ), true ); + else + slotInstall(); + _auto = true; + } + + if ( _auto ) + return; + + // Get the run environment variables pairs into the environstr string + // in the form of: "ENV_VARIABLE=ENV_VALUE" + // Note that we quote the variable value due to the possibility of + // embedded spaces + DomUtil::PairList envvars = runEnvironmentVars(); + QString environstr; + DomUtil::PairList::ConstIterator it; + for ( it = envvars.begin(); it != envvars.end(); ++it ) + { + environstr += ( *it ).first; + environstr += "="; + environstr += EnvVarTools::quote(( *it ).second ); + environstr += " "; + } + + if ( mainProgram().isEmpty() ) + // Do not execute non executable targets + return; + + QString program = environstr; + program += mainProgram(); + program += " " + runArguments(); + + bool inTerminal = DomUtil::readBoolEntry( *projectDom(), "/kdevcustomproject/run/terminal" ); + + kdDebug( 9025 ) << "runDirectory: <" << runDirectory() << ">" << endl; + kdDebug( 9025 ) << "environstr : <" << environstr << ">" << endl; + kdDebug( 9025 ) << "mainProgram : <" << mainProgram() << ">" << endl; + kdDebug( 9025 ) << "runArguments: <" << runArguments() << ">" << endl; + + appFrontend()->startAppCommand( runDirectory(), program, inTerminal ); +} + +void CustomProjectPart::updateTargetMenu() +{ + m_targets.clear(); + m_targetsObjectFiles.clear(); + m_targetsOtherFiles.clear(); + m_targetMenu->clear(); + m_targetObjectFilesMenu->clear(); + m_targetOtherFilesMenu->clear(); + + QDomDocument &dom = *projectDom(); + bool ant = DomUtil::readEntry( dom, "/kdevcustomproject/build/buildtool" ) == "ant"; + + if ( ant ) + { + QFile f( buildDirectory() + "/build.xml" ); + if ( !f.open( IO_ReadOnly ) ) + { + kdDebug( 9025 ) << "No build file" << endl; + return; + } + QDomDocument dom; + if ( !dom.setContent( &f ) ) + { + kdDebug( 9025 ) << "Build script not valid xml" << endl; + f.close(); + return; + } + f.close(); + + QDomNode node = dom.documentElement().firstChild(); + while ( !node.isNull() ) + { + if ( node.toElement().tagName() == "target" ) + m_targets.append( node.toElement().attribute( "name" ) ); + node = node.nextSibling(); + } + } + else + { + kdDebug( 9025 ) << "Trying to load a makefile... " << endl; + + m_makefileVars.clear(); + m_parsedMakefiles.clear(); + m_makefilesToParse.clear(); + m_makefilesToParse.push( "Makefile" ); + m_makefilesToParse.push( "makefile" ); + putEnvVarsInVarMap(); + while ( !m_makefilesToParse.isEmpty() ) + parseMakefile( m_makefilesToParse.pop() ); + + //free the memory again + m_makefileVars.clear(); + m_parsedMakefiles.clear(); + + m_targets.sort(); + m_targetsObjectFiles.sort(); + m_targetsOtherFiles.sort(); + + } + + m_targetMenu->insertItem( i18n( "Object Files" ), m_targetObjectFilesMenu ); + m_targetMenu->insertItem( i18n( "Other Files" ), m_targetOtherFilesMenu ); + + int id = 0; + QStringList::ConstIterator it; + for ( it = m_targets.begin(); it != m_targets.end(); ++it ) + m_targetMenu->insertItem( *it, id++ ); + + id = 0; + for ( it = m_targetsObjectFiles.begin(); it != m_targetsObjectFiles.end(); ++it ) + m_targetObjectFilesMenu->insertItem( *it, id++ ); + + id = 0; + for ( it = m_targetsOtherFiles.begin(); it != m_targetsOtherFiles.end(); ++it ) + m_targetOtherFilesMenu->insertItem( *it, id++ ); +} + +void CustomProjectPart::putEnvVarsInVarMap() +{ + DomUtil::PairList envvars = + DomUtil::readPairListEntry( *projectDom(), "/kdevcustomproject/make/environments/" + currentMakeEnvironment(), "envvar", "name", "value" ); + + for ( DomUtil::PairList::ConstIterator it = envvars.begin(); it != envvars.end(); ++it ) + m_makefileVars[( *it ).first] = ( *it ).second; //is qouting here required as in makeEnvironment() ?? +} + +void CustomProjectPart::parseMakefile( const QString& filename ) +{ + if ( m_parsedMakefiles.contains( filename ) ) + return; + + m_parsedMakefiles.insert( filename, 1 ); + + QString absFilename = filename; + if ( !filename.startsWith( "/" ) ) + absFilename = buildDirectory() + "/" + filename; + + QFile f( absFilename ); + if ( !f.open( IO_ReadOnly ) ) + { + kdDebug( 9025 ) << "could not open " << absFilename << endl; + return; + } + QRegExp targetRe( "^ *([^\\t$.#]\\S+) *:.*$" ); + targetRe.setMinimal( true ); + + QRegExp variablesRe( "\\$\\(\\s*([^\\)\\s]+)\\s*\\)" ); + QRegExp assignmentRe( "^\\s*(\\S+)\\s*[:\\?]?=\\s*(\\S+)\\s*(#.*)?$" ); + + QRegExp includedMakefilesRe( "^include\\s+(\\S+)" ); + QString str = ""; + while ( !f.atEnd() ) + { + f.readLine( str, 200 ); + + // Replace any variables in the current line + int offset = -1; + while (( offset = variablesRe.search( str, offset + 1 ) ) != -1 ) + { + QString variableName = variablesRe.cap( 1 ).simplifyWhiteSpace(); + if ( m_makefileVars.contains( variableName ) ) + { + str.replace( variablesRe.cap( 0 ), m_makefileVars[variableName] ); + } + } + + // Read all continuation lines + // kdDebug(9025) << "Trying: " << str.simplifyWhiteSpace() << endl; + //while (str.right(1) == "\\" && !stream.atEnd()) { + // str.remove(str.length()-1, 1); + // str += stream.readLine(); + //} + // Find any variables + if ( assignmentRe.search( str ) != -1 ) + { + m_makefileVars[assignmentRe.cap( 1 ).simplifyWhiteSpace()] = assignmentRe.cap( 2 ).simplifyWhiteSpace(); + } + else if ( includedMakefilesRe.search( str ) != -1 ) + { + QString includedMakefile = includedMakefilesRe.cap( 1 ).simplifyWhiteSpace(); + m_makefilesToParse.push( includedMakefile ); + } + else if ( targetRe.search( str ) != -1 ) + { + QString tmpTarget = targetRe.cap( 1 ).simplifyWhiteSpace(); + if ( tmpTarget.endsWith( ".o" ) ) + { + if ( m_targetsObjectFiles.find( tmpTarget ) == m_targetsObjectFiles.end() ) + m_targetsObjectFiles += tmpTarget; + } + else if ( tmpTarget.contains( '.' ) ) + { + if ( m_targetsOtherFiles.find( tmpTarget ) == m_targetsOtherFiles.end() ) + m_targetsOtherFiles += tmpTarget; + } + else + { + if ( m_targets.find( tmpTarget ) == m_targets.end() ) + m_targets += tmpTarget; + } + } + } + f.close(); +} + +void CustomProjectPart::targetMenuActivated( int id ) +{ + QString target = m_targets[id]; + startMakeCommand( buildDirectory(), target ); +} + +void CustomProjectPart::targetObjectFilesMenuActivated( int id ) +{ + QString target = m_targetsObjectFiles[id]; + startMakeCommand( buildDirectory(), target ); +} + +void CustomProjectPart::targetOtherFilesMenuActivated( int id ) +{ + QString target = m_targetsOtherFiles[id]; + startMakeCommand( buildDirectory(), target ); +} + +void CustomProjectPart::updateMakeEnvironmentsMenu() +{ + QDomDocument &dom = *projectDom(); + bool makeUsed = ( DomUtil::readEntry( dom, "/kdevcustomproject/build/buildtool" ) == "make" ); + if ( makeUsed ) + { + QStringList l = allMakeEnvironments(); + m_makeEnvironmentsSelector->setItems( l ); + m_makeEnvironmentsSelector->setCurrentItem( l.findIndex( currentMakeEnvironment() ) ); + } + else + { + m_makeEnvironmentsSelector->clear(); + } + /* + m_makeEnvironmentsMenu->clear(); + QDomDocument &dom = *projectDom(); + + QStringList environments = allMakeEnvironments(); + QStringList::ConstIterator it; + int id = 0; + for (it = environments.begin(); it != environments.end(); ++it) + m_makeEnvironmentsMenu->insertItem(*it, id++); + } + */ +} + +void CustomProjectPart::makeEnvironmentsMenuActivated( int id ) +{ + QDomDocument &dom = *projectDom(); + QString environment = allMakeEnvironments()[id]; + DomUtil::writeEntry( dom, "/kdevcustomproject/make/selectedenvironment", environment ); +} + +void CustomProjectPart::slotCommandFinished( const QString& command ) +{ + kdDebug( 9025 ) << "CustomProjectPart::slotProcessFinished()" << endl; + + if ( m_buildCommand != command ) + return; + + m_buildCommand = QString::null; + + m_timestamp.clear(); + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while ( it != fileList.end() ) + { + QString fileName = *it; + ++it; + + m_timestamp[ fileName ] = QFileInfo( projectDirectory(), fileName ).lastModified(); + } + + emit projectCompiled(); + + if ( m_executeAfterBuild ) + { + slotExecute(); + m_executeAfterBuild = false; + } +} + +void CustomProjectPart::slotCommandFailed( const QString& /*command*/ ) +{ + m_lastCompilationFailed = true; + m_executeAfterBuild = false; +} + +bool CustomProjectPart::isDirty() +{ + if ( m_lastCompilationFailed ) return true; + + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while ( it != fileList.end() ) + { + QString fileName = *it; + ++it; + + QMap::Iterator it = m_timestamp.find( fileName ); + QDateTime t = QFileInfo( projectDirectory(), fileName ).lastModified(); + if ( it == m_timestamp.end() || *it != t ) + { + return true; + } + } + + return false; +} + + +QStringList CustomProjectPart::allMakeEnvironments() const +{ + QDomDocument &dom = *projectDom(); + + QStringList allConfigs; + + QDomNode node = + DomUtil::elementByPath( dom , "/kdevcustomproject/make/environments" ); + // extract the names of the different make environments + QDomElement childEl = node.firstChild().toElement(); + while ( !childEl.isNull() ) + { + QString config = childEl.tagName(); + allConfigs.append( config ); + childEl = childEl.nextSibling().toElement(); + } + if ( allConfigs.isEmpty() ) + allConfigs.append( "default" ); + + return allConfigs; +} + + +QString CustomProjectPart::currentMakeEnvironment() const +{ + QStringList allEnvs = allMakeEnvironments(); + QDomDocument &dom = *projectDom(); + QString environment = DomUtil::readEntry( dom, "/kdevcustomproject/make/selectedenvironment" ); + if ( environment.isEmpty() || !allEnvs.contains( environment ) ) + environment = allEnvs[0]; + return environment; +} + +/*! + \fn CustomProjectPart::distFiles() const + */ +QStringList CustomProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QDir dir( projectDir ); + QStringList files = dir.entryList( "*README*" ); + return sourceList + files; +} + +bool CustomProjectPart::containsNonProjectFiles( const QString& dir ) +{ + if ( isInBlacklist( dir ) ) + return false; + QStringList fileentries = QDir( dir ).entryList( filetypes().join( ";" ) ); + QStringList dirs = QDir( dir ).entryList( QDir::Dirs ); + QStringList subentries = fileentries + dirs; + subentries.remove( "." ); + subentries.remove( ".." ); + for ( QStringList::const_iterator it = subentries.begin(); it != subentries.end(); ++it ) + { + if ( isInBlacklist( *it ) ) + continue; + if ( QFileInfo( dir + "/" + *it ).isDir() && !isInBlacklist( *it ) ) + { + if ( containsNonProjectFiles( dir + "/" + *it ) ) + { + return true; + } + } + else if ( !project()->isProjectFile( URLUtil::canonicalPath( dir + "/" + *it ) ) + && !isInBlacklist( *it ) ) + { + return true; + } + } + return false; +} + +bool CustomProjectPart::containsProjectFiles( const QString& dir ) +{ + if ( isInBlacklist( dir ) ) + return false; + + QStringList fileentries = QDir( dir ).entryList( filetypes().join( ";" ) ); + QStringList dirs = QDir( dir ).entryList( QDir::Dirs ); + QStringList subentries = fileentries + dirs; + subentries.remove( "." ); + subentries.remove( ".." ); + for ( QStringList::const_iterator it = subentries.begin(); it != subentries.end(); ++it ) + { + if ( isInBlacklist( *it ) ) + continue; + + if ( QFileInfo( dir + "/" + *it ).isDir() && !isInBlacklist( *it ) ) + { + if ( containsProjectFiles( dir + "/" + *it ) ) + { + return true; + } + } + else if ( project()->isProjectFile( URLUtil::canonicalPath( dir + "/" + *it ) ) && !isInBlacklist( *it ) ) + { + return true; + } + } + return false; +} + +QStringList CustomProjectPart::projectFilesInDir( const QString& dir ) +{ + QStringList result; + QStringList fileentries = QDir( projectDirectory() + "/" + dir ).entryList( filetypes().join( ";" ) ); + QStringList dirs = QDir( projectDirectory() + "/" + dir ).entryList( QDir::Dirs ); + QStringList subentries = fileentries + dirs; + subentries.remove( "." ); + subentries.remove( ".." ); + for ( QStringList::const_iterator it = subentries.begin(); it != subentries.end(); ++it ) + { + if ( isInProject( dir + "/" + *it ) ) + { + result << ( *it ); + } + } + return result; +} + +QStringList CustomProjectPart::filetypes( ) const +{ + return DomUtil::readListEntry( *projectDom(), "/kdevcustomproject/filetypes", "filetype" ); +} + +bool CustomProjectPart::isProjectFileType( const QString& filename ) const +{ + QStringList types = filetypes(); + QRegExp re( "", true, true ); + for ( QStringList::const_iterator it = types.begin(); it != types.end(); ++it ) + { + re.setPattern( *it ); + int pos = re.search( filename ); + uint len = re.matchedLength(); + if ((( *it ).find( "*" ) != -1 || ( *it ).find( "?" ) != -1 ) && pos + len == filename.length() ) + return true; + else if ( filename.find( "/" ) != -1 && filename.find( *it ) != -1 ) + return true; + else if ( filename.find( "/" ) == -1 && filename == *it ) + return true; + } + return false; +} + +void CustomProjectPart::switchBlacklistEntry( const QString& path ) +{ + QStringList blacklist = this->blacklist(); + kdDebug( 9025 ) << "Switching path " << path << endl; + if ( !isInBlacklist( path ) ) + { + blacklist << path; + m_recursive = true; + removeFile( path ); + m_recursive = false; + } + else + { + blacklist.remove( path ); + } + updateBlacklist( blacklist ); +} + +QString CustomProjectPart::relativeToProject( const QString& abspath ) const +{ + QString path = abspath.mid( projectDirectory().length() + 1 ); + kdDebug( 9025 ) << "abspath: " << "|project dir: " << projectDirectory() << "|path: " << path << endl; + if ( path.endsWith( "/" ) ) + path = path.mid( 0, path.length() - 1 ); + if ( path.startsWith( "/" ) ) + path = path.mid( 1, path.length() ); + return path; +} + +bool CustomProjectPart::isInBlacklist( const QString& path ) const +{ + QString relpath = path; + QStringList blacklist = this->blacklist(); + if ( !QFileInfo( relpath ).isRelative() ) + relpath = relativeToProject( path ); + if ( blacklist.find( relpath ) != blacklist.end() ) + return true; + QStringList paths = QStringList::split( "/", relpath ); + QString parentpath; + for ( QStringList::const_iterator it = paths.begin(); it != paths.end(); ++it ) + { + parentpath += *it; + if ( blacklist.find( parentpath ) != blacklist.end() ) + return true; + parentpath = parentpath + "/"; + } + return false; +} + +void CustomProjectPart::updateBlacklist( const QStringList& l ) +{ + DomUtil::writeListEntry( *projectDom(), "kdevcustomproject/blacklist", "path", l ); +} + +QStringList CustomProjectPart::blacklist() const +{ + return DomUtil::readListEntry( *projectDom(), "kdevcustomproject/blacklist", "path" ); +} + +void CustomProjectPart::addNewFilesToProject( const QStringList& filelist ) +{ + QStringList addfiles; + for ( QStringList::const_iterator it = filelist.begin(); it != filelist.end(); ++it ) + { + if (( ! isInProject( *it ) ) && ( isProjectFileType( *it ) || QFileInfo( projectDirectory() + "/" + *it ).isDir() ) && !isInBlacklist( *it ) ) + { + addfiles << *it; + } + } + + if ( addfiles.isEmpty() ) + return; + + SelectNewFilesDialog *dlg = new SelectNewFilesDialog( addfiles, mainWindow()->main() ); + if ( dlg->exec() == KDialog::Accepted ) + { + m_first_recursive = false; + m_recursive = false; + QStringList blacklist = this->blacklist(); + QStringList excludelist = dlg->excludedPaths(); + QStringList removeFromExcludes; + for ( QStringList::const_iterator it = excludelist.begin(); it != excludelist.end(); ++it ) + { + if ( QFileInfo( projectDirectory() + "/" + *it ).isDir() ) + { + for ( ProjectFilesSet::ConstIterator it2 = m_sourceFilesSet.constBegin(); it2 != m_sourceFilesSet.constEnd(); ++it2 ) + { + if ( it2.key().find( *it ) != -1 ) + { + removeFromExcludes << *it; + } + } + } + } + for ( QStringList::const_iterator it = removeFromExcludes.begin(); it != removeFromExcludes.end(); ++it ) + { + excludelist.remove( *it ); + } + blacklist += excludelist; + updateBlacklist( blacklist ); + addFiles( dlg->includedPaths() ); + } +} + +void CustomProjectPart::setFiletypes( const QStringList& l ) +{ + DomUtil::writeListEntry( *projectDom(), "kdevcustomproject/filetypes", "filetype", l ); +} + + +/** + * @brief Is a given file (or a directory) part of this project? + * + * @param fileName + */ +bool CustomProjectPart::isInProject( const QString& fileName ) const +{ + return m_sourceFilesSet.contains( fileName ); +} + + +/** + * @brief Add a file (or a directory) to this project. + * + * @param fileName + * + * @see removeFromProject() + */ +void CustomProjectPart::addToProject( const QString& fileName ) +{ + m_sourceFilesSet.insert( fileName, false ); +} + + +/** + * @brief Remove a file (or a directory) from this project. + * + * @param fileName + */ +void CustomProjectPart::removeFromProject( const QString& fileName ) +{ + m_sourceFilesSet.remove( fileName ); +} + + +#include "customprojectpart.moc" + diff --git a/buildtools/custommakefiles/customprojectpart.h b/buildtools/custommakefiles/customprojectpart.h new file mode 100644 index 00000000..f3fb9ec4 --- /dev/null +++ b/buildtools/custommakefiles/customprojectpart.h @@ -0,0 +1,158 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _CUSTOMPROJECTPART_H_ +#define _CUSTOMPROJECTPART_H_ + +#include +#include +#include +#include +#include + +#include + +class QListViewItem; +class QPopupMenu; +class QStringList; +class KDialogBase; +class CustomProjectWidget; +class Context; +class KSelectAction; + +class CustomProjectPart : public KDevBuildTool +{ + Q_OBJECT + +public: + CustomProjectPart( QObject *parent, const char *name, const QStringList & ); + ~CustomProjectPart(); + + QStringList allMakeEnvironments() const; + QString currentMakeEnvironment() const; + + bool isDirty(); + QStringList distFiles() const; + + virtual void openProject( const QString &dirName, const QString &projectName ); + virtual void closeProject(); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString mainProgram() const; + virtual QString activeDirectory() const; + virtual QStringList allFiles() const; + virtual void addFile( const QString &fileName ); + virtual void addFiles( const QStringList& fileList ); + virtual void removeFile( const QString &fileName ); + virtual void removeFiles( const QStringList &fileList ); + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + QString relativeToProject( const QString& ) const; + + +private slots: + void populateProject(); + void projectConfigWidget( KDialogBase *dlg ); + void contextMenu( QPopupMenu *popup, const Context *context ); + void slotAddToProject(); + void slotRemoveFromProject(); + void slotAddToProjectRecursive(); + void slotRemoveFromProjectRecursive(); + void addNewFilesToProject( const QStringList& ); + void slotChangeBlacklist(); + void slotChooseActiveDirectory(); + void slotBuild(); + void slotBuildActiveDir(); + void slotCompileFile(); + void slotInstall(); + void slotInstallActiveDir(); + void slotInstallWithKdesu(); + void slotClean(); + void slotExecute(); + void updateTargetMenu(); + void targetMenuActivated( int id ); + void targetObjectFilesMenuActivated( int id ); + void targetOtherFilesMenuActivated( int id ); + void updateMakeEnvironmentsMenu(); + void makeEnvironmentsMenuActivated( int id ); + void slotCommandFinished( const QString& command ); + void slotCommandFailed( const QString& command ); + +private: + bool containsNonProjectFiles( const QString& url ); + QStringList projectFilesInDir( const QString& dir ); + bool containsProjectFiles( const QString& url ); + bool isProjectFileType( const QString& absFile ) const; + bool isInBlacklist( const QString& ) const; + void cleanFileList(); + void setFiletypes( const QStringList& ); + void findNewFiles( const QString& dir, QStringList& list) const; + + QStringList filetypes() const; + QStringList blacklist() const; + void updateBlacklist( const QStringList& ); + void saveProject(); + void startMakeCommand( const QString &dir, const QString &target, bool withKdesu = false ); + void parseMakefile( const QString& file ); + QString makeEnvironment() const; + void putEnvVarsInVarMap(); + void switchBlacklistEntry(const QString& ); + + bool isInProject( const QString& fileName ) const; + void addToProject( const QString& fileName ); + void removeFromProject( const QString& fileName ); + + /** + * @brief Set of all the project's files. + * + * @bug + * Due to deficiency in QT3, + * we have to use a map with next-to-useless element value, + * keyed by the file name, + * as a set-container replacement. + */ + typedef QMap ProjectFilesSet; + + QString m_projectDirectory; + QString m_projectName; + QString m_filelistDir; + /** All the sources (files and directories) of this project. */ + ProjectFilesSet m_sourceFilesSet; + QPopupMenu *m_targetMenu; + QPopupMenu *m_targetObjectFilesMenu; + QPopupMenu *m_targetOtherFilesMenu; + KSelectAction *m_makeEnvironmentsSelector; + QStringList m_targets; + QStringList m_targetsObjectFiles; + QStringList m_targetsOtherFiles; + QStringList m_contextAddFiles; + QStringList m_contextRemoveFiles; + QString m_contextDirName; + + QMap m_timestamp; + bool m_executeAfterBuild; + QString m_buildCommand; + bool m_lastCompilationFailed; + QMap m_parsedMakefiles; + QValueStack m_makefilesToParse; + QMap m_makefileVars; + bool m_recursive; + bool m_first_recursive; +}; + +#endif +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/kdevcustomproject.desktop b/buildtools/custommakefiles/kdevcustomproject.desktop new file mode 100644 index 00000000..276f4c1a --- /dev/null +++ b/buildtools/custommakefiles/kdevcustomproject.desktop @@ -0,0 +1,91 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Custom Project +Comment[br]=Raktres diouzhoc'h +Comment[ca]=Projecte a mida +Comment[cs]=Vlastní projekt +Comment[da]=Brugerdefineret projekt +Comment[de]=Benutzerdefiniertes Projekt für KDevelop +Comment[el]=Προσαρμοσμένo έργο +Comment[es]=Proyecto personalizado +Comment[et]=Kohandatav projekt +Comment[eu]=Proiektu pertsonalizatua +Comment[fa]=پروژۀ سفارشی +Comment[fr]=Projet personnalisé +Comment[ga]=Tionscadal Saincheaptha +Comment[gl]=Proxecto persoalizado +Comment[hi]=कस्टम परियोजना +Comment[hu]=Egyedi projekt +Comment[is]=Sérsniðið verkefni +Comment[it]=Progetto personalizzato +Comment[ja]=カスタムプロジェクト +Comment[ms]=Projek Tersendiri +Comment[nds]=Egen Projekt +Comment[ne]=अनुकूल परियोजना +Comment[nl]=Aangepast project +Comment[pl]=Własny projekt +Comment[pt]=Projecto Personalizado +Comment[pt_BR]=Projeto Personalizado +Comment[ru]=Особый проект +Comment[sk]=Vlastný projekt +Comment[sl]=Poljuben projekt +Comment[sr]=Произвољан пројекат +Comment[sr@Latn]=Proizvoljan projekat +Comment[sv]=Eget projekt +Comment[ta]=தனிப்பயன் பிராஜக்ட் +Comment[tg]=Лоиҳаи оддӣ +Comment[tr]=Özel Proje +Comment[zh_CN]=自定义工程 +Comment[zh_TW]=自訂專案 +Name=KDevCustomProject +Name[da]=KDevelop brugerdefineret projekt +Name[de]=Benutzerdefiniertes Projekt (KDevelop) +Name[hi]=के-डेव-कस्टम-परियोजना +Name[nds]=Egen Projekt (KDevelop) +Name[ne]=केडीई विकास अनुकूल परियोजना +Name[pl]=KDevWłasnyProjekt +Name[sk]=KDevVlastnýProjekt +Name[sv]=KDevelop eget projekt +Name[ta]=கெடெவ் தனிப்பயன் பிராஜக்ட் +Name[tg]=Лоиҳаи оддӣKDev +Name[zh_TW]=KDevelop 自訂專案 +GenericName=Custom Project +GenericName[br]=Raktres diouzhoc'h +GenericName[ca]=Projecte a mida +GenericName[da]=Brugerdefineret projekt +GenericName[de]=Benutzerdefiniertes Projekt +GenericName[el]=Προσαρμοσμένο έργο +GenericName[es]=Proyecto personalizado +GenericName[et]=Kohandatav projekt +GenericName[eu]=Proiektu pertsonalizatua +GenericName[fa]=پروژۀ سفارشی +GenericName[fr]=Projet personnalisé +GenericName[ga]=Tionscadal Saincheaptha +GenericName[gl]=Proxecto persoalizado +GenericName[hi]=कस्टम परियोजना +GenericName[hu]=Egyedi projekt +GenericName[it]=Progetto personalizzato +GenericName[ja]=カスタムプロジェクト +GenericName[ms]=Projek Tersendiri +GenericName[nds]=Egen Projekt +GenericName[ne]=अनुकूल परियोजना +GenericName[nl]=Aangepast project +GenericName[pl]=Projekt: własny +GenericName[pt]=Projecto Personalizado +GenericName[pt_BR]=Projeto Personalizado +GenericName[ru]=Особый проект +GenericName[sk]=Vlastný projekt +GenericName[sl]=Poljuben projekt +GenericName[sr]=Произвољан пројекат +GenericName[sr@Latn]=Proizvoljan projekat +GenericName[sv]=Eget projekt +GenericName[ta]=தனிப்பயன் பிராஜக்ட் +GenericName[tg]=Лоиҳаи оддӣ +GenericName[tr]=Özel Proje +GenericName[zh_CN]=自定义工程 +GenericName[zh_TW]=自訂專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevcustomproject +X-KDevelop-Version=5 +X-KDevelop-Args= diff --git a/buildtools/custommakefiles/kdevcustomproject.rc b/buildtools/custommakefiles/kdevcustomproject.rc new file mode 100644 index 00000000..c744b4be --- /dev/null +++ b/buildtools/custommakefiles/kdevcustomproject.rc @@ -0,0 +1,30 @@ + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildtools/custommakefiles/selectnewfilesdialog.cpp b/buildtools/custommakefiles/selectnewfilesdialog.cpp new file mode 100644 index 00000000..cfcb84e6 --- /dev/null +++ b/buildtools/custommakefiles/selectnewfilesdialog.cpp @@ -0,0 +1,131 @@ +/*************************************************************************** + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "selectnewfilesdialog.h" + +#include +#include +#include +#include +#include +#include +#include "selectnewfilesdialogbase.h" + +SelectNewFilesDialog::SelectNewFilesDialog( QStringList paths, QWidget* parent, const char* name ) + : KDialogBase( parent, name, true, i18n("Add newly created files to project"), KDialogBase::Ok|KDialogBase::Cancel ) +{ + m_widget = new SelectNewFilesDialogBase(this); + m_widget->fileView->header()->hide(); + m_widget->fileView->addColumn(i18n("Path") ); + for( QStringList::const_iterator it = paths.begin(); it != paths.end(); ++it) + { + addPath(0, *it); + } + setMainWidget( m_widget ); + resize( 300,400 ); +} + +SelectNewFilesDialog::~SelectNewFilesDialog() +{} + +void SelectNewFilesDialog::slotCancel() +{ + excludePaths.clear(); + includePaths.clear(); + KDialogBase::slotCancel(); +} + +void SelectNewFilesDialog::checkItem( QCheckListItem* item, const QString& curpath ) +{ + if( !item ) + return; + + QString path = curpath + item->text(); + if( item->state() != QCheckListItem::Off ) + includePaths << path; + else + excludePaths << path; + if( item->firstChild() ) + { + checkItem( static_cast(item->firstChild()), path+"/" ); + } + if( item->nextSibling() ) + { + checkItem( static_cast(item->nextSibling()), curpath ); + } +} + +void SelectNewFilesDialog::slotOk() +{ + QCheckListItem* item = static_cast (m_widget->fileView->firstChild()); + checkItem( item, "" ); + kdDebug(9025) << "Inc List:" << includePaths << endl; + kdDebug(9025) << "Exc List:" << excludePaths << endl; + KDialogBase::slotOk(); +} + +void SelectNewFilesDialog::addPath( QCheckListItem* item, const QString& path ) +{ + if( path.isEmpty() ) + return; + + QStringList parts = QStringList::split("/", path ); + QString name = parts.first(); + parts.pop_front(); + QCheckListItem* i = createItem( item, name, parts.size() ); + i->setState( QCheckListItem::On ); + i->setTristate( true ); + addPath(i, parts.join("/") ); +} + +QCheckListItem* SelectNewFilesDialog::createItem( QCheckListItem* parent, const QString& name, int count ) +{ + QCheckListItem::Type t = QCheckListItem::CheckBox; + if( count > 0 ) + t = QCheckListItem::CheckBoxController; + + if( parent == 0 ) + { + QListViewItem* item = m_widget->fileView->firstChild(); + while( item ) + { + if( item->text( 0 ) == name ) + return static_cast(item); + item = item->nextSibling(); + } + return new QCheckListItem( m_widget->fileView, name, t ); + }else + { + QListViewItem* item = parent->firstChild(); + while( item ) + { + if( item->text( 0 ) == name ) + return static_cast(item); + item = item->nextSibling(); + } + return new QCheckListItem( parent, name, t ); + } +} + +QStringList SelectNewFilesDialog::excludedPaths() const +{ + return excludePaths; +} + +QStringList SelectNewFilesDialog::includedPaths() const +{ + return includePaths; +} + +#include "selectnewfilesdialog.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/selectnewfilesdialog.h b/buildtools/custommakefiles/selectnewfilesdialog.h new file mode 100644 index 00000000..b970dc7d --- /dev/null +++ b/buildtools/custommakefiles/selectnewfilesdialog.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef SELECTNEWFILESDIALOG_H +#define SELECTNEWFILESDIALOG_H + +#include "kdialogbase.h" + +class QCheckListItem; +class QStringList; +class SelectNewFilesDialogBase; + +class SelectNewFilesDialog : public KDialogBase +{ +Q_OBJECT + +public: + SelectNewFilesDialog( QStringList paths, QWidget* parent = 0, const char* name = 0 ); + ~SelectNewFilesDialog(); + + QStringList excludedPaths() const; + QStringList includedPaths() const; + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void slotCancel(); + virtual void slotOk(); +private: + void addPath( QCheckListItem* , const QString& ); + void checkItem( QCheckListItem* item, const QString& curpath ); + QCheckListItem* createItem( QCheckListItem*, const QString&, int ); + SelectNewFilesDialogBase* m_widget; + QStringList excludePaths; + QStringList includePaths; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/custommakefiles/selectnewfilesdialogbase.ui b/buildtools/custommakefiles/selectnewfilesdialogbase.ui new file mode 100644 index 00000000..fbd5b5ec --- /dev/null +++ b/buildtools/custommakefiles/selectnewfilesdialogbase.ui @@ -0,0 +1,50 @@ + +SelectNewFilesDialogBase + + + SelectNewFilesDialogBase + + + + 0 + 0 + 532 + 324 + + + + + unnamed + + + + textLabel1 + + + Files to add to the Project: + + + + + fileView + + + true + + + false + + + Select the files to add to the project + + + Select the files and directories that should be added to the list of project files. All other files and directories will be put into the blacklist. + + + + + + + klistview.h + + diff --git a/buildtools/lib/Makefile.am b/buildtools/lib/Makefile.am new file mode 100644 index 00000000..c772e395 --- /dev/null +++ b/buildtools/lib/Makefile.am @@ -0,0 +1,8 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +SUBDIRS = parsers widgets base + +DOXYGEN_EMPTY = YES +include ../../Doxyfile.am diff --git a/buildtools/lib/base/Mainpage.dox b/buildtools/lib/base/Mainpage.dox new file mode 100644 index 00000000..dbf199a5 --- /dev/null +++ b/buildtools/lib/base/Mainpage.dox @@ -0,0 +1,19 @@ +/** +@mainpage The KDevelop Buildtool Base Library + +This library contains base classes for KDevelop builtool support plugins. + +Link with: -lkdevbuildbase + +Include path: -I\$(kde_includes)/kdevelop/buildtools/base + +\section btbaseoverview Overview +This library is created to provide KDevBuildTool compat class which can be used +as drop-in replacement of KDevProject class for buildtool support plugins +written for old KDevelop architecture (before version 3.2). + +Nevertheless, it can be useful for new buildtool plugins as well because it provides +useful methods to get application and make frontend extensions. + +*/ + diff --git a/buildtools/lib/base/Makefile.am b/buildtools/lib/base/Makefile.am new file mode 100644 index 00000000..6c9f6df6 --- /dev/null +++ b/buildtools/lib/base/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \ + $(all_includes) +METASOURCES = AUTO +lib_LTLIBRARIES = libkdevbuildbase.la +libkdevbuildbase_la_LDFLAGS = $(all_libraries) +libkdevbuildbase_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la $(LIB_QT) $(LIB_KDEUI) +libkdevbuildbase_la_SOURCES = kdevbuildtool.cpp +kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/base +kdevelopbuildtoolsinclude_HEADERS = kdevbuildtool.h + +DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces kdevextensions +DOXYGEN_PROJECTNAME = KDevelop Buildtool Base Library +DOXYGEN_DOCDIRPREFIX = kdevbt +include ../../../Doxyfile.am diff --git a/buildtools/lib/base/kdevbuildtool.cpp b/buildtools/lib/base/kdevbuildtool.cpp new file mode 100644 index 00000000..a8b7de3a --- /dev/null +++ b/buildtools/lib/base/kdevbuildtool.cpp @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include "kdevbuildtool.h" + +#include +#include + +KDevBuildTool::KDevBuildTool(const KDevPluginInfo* info, QObject* parent, const char* name) + :KDevProject(info, parent, name) +{ +} + +KDevMakeFrontend * KDevBuildTool::makeFrontend() +{ + return extension("KDevelop/MakeFrontend"); +} + +KDevAppFrontend * KDevBuildTool::appFrontend() +{ + return extension("KDevelop/AppFrontend"); +} + diff --git a/buildtools/lib/base/kdevbuildtool.h b/buildtools/lib/base/kdevbuildtool.h new file mode 100644 index 00000000..95ed8d37 --- /dev/null +++ b/buildtools/lib/base/kdevbuildtool.h @@ -0,0 +1,41 @@ +/* This file is part of the KDE project + Copyright (C) 1999-2001 Bernd Gehrmann + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#ifndef KDEVBUILDTOOL_H +#define KDEVBUILDTOOL_H + +#include + +class KDevMakeFrontend; +class KDevAppFrontend; + +/**Base class for KDevelop build tool support plugins.*/ +class KDevBuildTool: public KDevProject +{ +public: + KDevBuildTool(const KDevPluginInfo* info, QObject* parent, const char* name); + + /**@return The make frontend.*/ + KDevMakeFrontend *makeFrontend(); + /**@return The application frontend.*/ + KDevAppFrontend *appFrontend(); + +}; + +#endif diff --git a/buildtools/lib/parsers/Makefile.am b/buildtools/lib/parsers/Makefile.am new file mode 100644 index 00000000..a1c9f256 --- /dev/null +++ b/buildtools/lib/parsers/Makefile.am @@ -0,0 +1,8 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +SUBDIRS = qmake autotools + +DOXYGEN_EMPTY = YES +include ../../../Doxyfile.am diff --git a/buildtools/lib/parsers/autotools/Mainpage.dox b/buildtools/lib/parsers/autotools/Mainpage.dox new file mode 100644 index 00000000..99d200d9 --- /dev/null +++ b/buildtools/lib/parsers/autotools/Mainpage.dox @@ -0,0 +1,11 @@ +/** +@mainpage The KDevelop Makefile.am Parser + +This library contains a parser that handles Makefile.am. + +Link with: -lkdevautotoolsparser + +Include path: -I\$(kde_includes)/kdevelop/buildtools/parsers/autotools + +*/ + diff --git a/buildtools/lib/parsers/autotools/Makefile.am b/buildtools/lib/parsers/autotools/Makefile.am new file mode 100644 index 00000000..c0776c2f --- /dev/null +++ b/buildtools/lib/parsers/autotools/Makefile.am @@ -0,0 +1,24 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. +SUBDIRS = . tests +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \ + $(all_includes) +METASOURCES = AUTO +noinst_LTLIBRARIES = libkdevautotoolsparser.la +libkdevautotoolsparser_la_LDFLAGS = $(all_libraries) $(LIB_KIO) +libkdevautotoolsparser_la_SOURCES = autotoolsast.cpp autotoolsdriver.cpp autotools_yacc.cpp + +parser: + cd $(srcdir) ; \ + bison -d autotools.yy -o autotools_yacc.cpp ; \ + mv -f autotools_yacc.hpp autotools_yacc.h ; \ + flex -oautotools_lex.cpp autotools.ll + +EXTRA_DIST = autotools.yy autotools.ll + +DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils +DOXYGEN_PROJECTNAME = KDevelop AutoTools Parser +DOXYGEN_DOCDIRPREFIX = kdevparser +include ../../../../Doxyfile.am diff --git a/buildtools/lib/parsers/autotools/autotools.ll b/buildtools/lib/parsers/autotools/autotools.ll new file mode 100644 index 00000000..ae646edb --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotools.ll @@ -0,0 +1,136 @@ +%{ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include + +/** +@file autotools.ll +Autotools Lexer + +There are 3 types of identifiers recognized by this lexer: +-id_simple: examples of such identifiers are qmake variables and scoped variables +at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp"); +-id_list: those are "value list identifiers" at the right side in assignments +(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp"); +-id_args: function arguments recognized as one identifier +(example: ""${QMAKE_FILE} is intended only for Windows!"" +in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements). +. + +To recognize those identifiers two additional start conditions are used: list and funcargs. + +@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to +the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped +so no indentation is preserved by this lexer (and parser). + +To debug this lexer, put the line below into the next flex file section. +%option debug +*/ +%} +%option noyywrap + +%x list +%x funcargs +%x conditional + +delim [ \t] +ws {delim}+ +letter [A-Za-z] +digit [0-9] +id_simple ({digit}|{letter}|\!|-|_|\*|\$|@)({letter}|{digit}|\||\!|-|_|\*|\$|\(|\.|\+|\-|\)|\/)* +id_list [^\n]*\\{ws}* +id_args [^\n]*\) +number {digit}+ +comment #.* +comment_cont {ws}*#.*\n +id_list_single [^\n]* +cont \\{ws}*\n +keywords (if|else|endif|include) +rule [\t]+[^\n]* + +%% + +{ws} {} +{cont} { BEGIN(list); return CONT; } +{keywords} { + yylval.value = yytext; + if ( yylval.value == "if" ) + return IF_KEYWORD; + + if ( yylval.value == "else" ) + return ELSE_KEYWORD; + + if ( yylval.value == "endif" ) + return ENDIF_KEYWORD; + + return KEYWORD; +} + + +{id_simple} { yylval.value = yytext; return (ID_SIMPLE); } + +{rule} { + yylval.value = yytext; + return RULE; +} + +{id_list} { + yylval.value = yytext; + yylval.value = yylval.value.mid(0, yylval.value.findRev("\\")); + unput('\\'); + BEGIN(INITIAL); + return (ID_LIST); + } + +{comment_cont} { + yylval.value = yytext; + BEGIN(list); + return (LIST_COMMENT); + } + +{id_list_single} { + yylval.value = yytext; + BEGIN(INITIAL); + return (ID_LIST_SINGLE); + } + +{id_args} { + yylval.value = yytext; + yylval.value = yylval.value.mid(0, yylval.value.length()-1); + unput(')'); + BEGIN(INITIAL); + return (ID_ARGS); + } + +"=" { BEGIN(list); yylval.value = yytext; return EQ; } +"+=" { BEGIN(list); yylval.value = yytext; return PLUSEQ; } +"{" { return LCURLY; } +"}" { return RCURLY; } +":" { BEGIN(list); yylval.value = yytext; return COLON; } +"\n" { BEGIN(INITIAL); return NEWLINE; } +{comment} { yylval.value = yytext; return (COMMENT); } + +%% + diff --git a/buildtools/lib/parsers/autotools/autotools.yy b/buildtools/lib/parsers/autotools/autotools.yy new file mode 100644 index 00000000..e124ee85 --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotools.yy @@ -0,0 +1,323 @@ +%{ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +/** +@file qmake.yy +Autotools Parser + +Simple LALR parser which builds the syntax tree (see @ref Autotools::AST). + +@todo Recognize comments after statements like: +noinst_HEADERS = foo.h #regognize me + +@fixme Parser fails on files that do not end with a newline +@fixme 1 shift/reduce conflict in "line_body" rule +*/ + +#include +#include "autotoolsast.h" + +#define YYSTYPE_IS_DECLARED + +using namespace AutoTools; + +/** +The yylval type. +*/ +struct Result { + Result(): node(0) {} + + /**Type of semantic value for simple grammar rules.*/ + QString value; + /**Type of semantic value for grammar rules which are parts of AST.*/ + AST *node; + /**Type of semantic value for "multiline_values" grammar rule. + Each line of multiline value is stored as a string in the list. + + For example we have in Makefile.am file: + @code + foo_SOURCES = foo1.cpp \ + foo2.cpp \ + foo3.cpp foo4.cpp + @endcode + The string list will be populated with three strings: +
+    foo1.cpp
+    foo2.cpp
+    foo3.cpp foo4.cpp
+    
+ */ + QStringList values; +}; + +typedef Result YYSTYPE; + +void yyerror(const char *str) { + printf("bison error: %s\n", str); +} + +int yylex(); + +/** +The stack to store ProjectAST pointers when a new child +ProjectAST is created and filled with statements. + +Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts +adding statements. Each statement is added as a child StatementAST to the ProjectAST +currently on the top in the stack. + +When a scope or function scope statement is parsed, the child ProjectAST is created +and pushed onto the stack. Therefore all statements which belong to the scope +or function scope are added as childs to their direct parent (scope or function scope). +*/ +QValueStack projects; + +/** +The current depth of AST node is stored here. +AST depth is important to know because automatic indentation can +be easily implemented (the parser itself looses all information +about indentation). +*/ +int depth = 0; + +/* +To debug this parser, put the line below into the next bison file section. +Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. +%debug +*/ +%} + +%token ID_SIMPLE +%token ID_LIST +%token LBRACE +%token EQ +%token PLUSEQ +%token MINUSQE +%token STAREQ +%token TILDEEQ +%token LBRACE +%token RBRACE +%token COLON +%token NUMSIGN +%token NEWLINE +%token NUMBER +%token COMMENT +%token CONT +%token DOT +%token RCURLY +%token LCURLY +%token ID_ARGS +%token LIST_COMMENT +%token ID_LIST_SINGLE +%token IF_KEYWORD +%token ELSE_KEYWORD +%token ENDIF_KEYWORD +%token KEYWORD +%token RULE + +%% + +project : +{ + ProjectAST *projectAST = new ProjectAST(); + projects.push(projectAST); +} +statements +; + +statements : statements statement +{ + projects.top()->addChildAST($2); + + if ( $2->nodeType() == AST::ProjectAST && + static_cast( $2 )->scopedID == "if" ) + { + $2->setDepth(depth); + depth++; + } + else if ( $2->nodeType() == AST::ProjectAST && + static_cast( $2 )->scopedID == "else" ) + { + --depth; + $2->setDepth(depth); + ++depth; + } + else if ( $2->nodeType() == AST::ProjectAST && + static_cast( $2 )->scopedID == "endif" ) + { + --depth; + $2->setDepth(depth); + } + else + $2->setDepth(depth); +} +| +; + +statement : variable_assignment +{ + $$ = $1; +} +| automake_if +{ + $$ = $1; +} +| else_statement +{ + $$ = $1; +} +| endif_statement +{ + $$ = $1; +} +| target +{ + $$ = $1; +} +| am_rule +{ + $$ = $1; +} +| include_directive +{ + $$ = $1; +} +| comment +{ + $$ = $1; +} +| emptyline +{ + $$ = new NewLineAST(); +} +; + +automake_if: IF_KEYWORD scoped_identifier +{ + ConditionAST* projectAST = new ConditionAST(); + projectAST->type = "if"; + projectAST->conditionName = $2; + $$ = projectAST; +}; + +endif_statement: ENDIF_KEYWORD +{ + ConditionAST* past = new ConditionAST(); + past->type= "endif"; + $$ = past; +} +| ENDIF_KEYWORD scoped_identifier +{ + ConditionAST* past = new ConditionAST(); + past->type= "endif"; + past->conditionName = $2; + $$ = past; +} +; + +else_statement: ELSE_KEYWORD +{ + ConditionAST* past = new ConditionAST(); + past->type = "else"; + $$ = past; +} +| ELSE_KEYWORD scoped_identifier +{ + ConditionAST* past = new ConditionAST(); + past->type = "else"; + past->conditionName = $2; + $$ = past; +} +; + +variable_assignment : scoped_identifier operator multiline_values +{ + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values = $3; + $$ = node; +} +; + +scoped_identifier : ID_SIMPLE scoped_identifier +{ $$ = $1 + $2; } +| ID_SIMPLE +; + +multiline_values : multiline_values line_body +{ + $$.append($2); +} +| { $$.clear(); } + ; + +line_body : ID_LIST CONT { $$ = $1 + " \\\n"; } + | ID_LIST_SINGLE NEWLINE { $$ = $1 + "\n"; } + | CONT { $$ = "\\\n"; } + | LIST_COMMENT + ; + +target: scoped_identifier COLON multiline_values +{ + AutomakeTargetAST *node = new AutomakeTargetAST(); + node->target = $1; + node->deps = $3; + $$ = node; +} +; + +am_rule: RULE +{ + ProjectAST* node = new ProjectAST(ProjectAST::Rule); + node->scopedID = $1; + $$ = node; +} +; + +include_directive: KEYWORD scoped_identifier +{ + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->values = QStringList($2); + $$ = node; +} +; + +operator : EQ | PLUSEQ +; + +comment : COMMENT NEWLINE +{ + CommentAST *node = new CommentAST(); + node->comment = $1 + "\n"; + $$ = node; +} +; + +emptyline : NEWLINE +; +%% + +#include "autotools_lex.cpp" diff --git a/buildtools/lib/parsers/autotools/autotools_lex.cpp b/buildtools/lib/parsers/autotools/autotools_lex.cpp new file mode 100644 index 00000000..ac307240 --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotools_lex.cpp @@ -0,0 +1,1894 @@ +#line 2 "autotools_lex.cpp" + +#line 4 "autotools_lex.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 17 +#define YY_END_OF_BUFFER 18 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[64] = + { 0, + 0, 0, 8, 8, 0, 0, 0, 0, 18, 17, + 1, 15, 1, 4, 16, 17, 14, 10, 17, 4, + 4, 12, 13, 8, 1, 8, 6, 17, 9, 5, + 1, 1, 1, 4, 4, 16, 11, 0, 2, 4, + 4, 3, 4, 8, 6, 1, 8, 8, 7, 6, + 6, 0, 9, 4, 4, 4, 6, 6, 4, 4, + 4, 4, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 1, 6, 7, 1, 1, 1, 8, + 9, 10, 11, 1, 12, 13, 14, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 16, 1, 1, + 17, 1, 1, 18, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 1, 20, 1, 1, 21, 1, 19, 19, 22, 23, + + 24, 25, 19, 19, 26, 19, 19, 27, 19, 28, + 19, 19, 19, 19, 29, 19, 30, 19, 19, 19, + 19, 19, 31, 32, 33, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[34] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[72] = + { 0, + 0, 0, 32, 51, 34, 36, 0, 0, 155, 156, + 38, 156, 42, 67, 0, 137, 156, 156, 45, 23, + 31, 156, 156, 133, 63, 38, 98, 134, 133, 0, + 58, 59, 62, 0, 0, 0, 156, 101, 156, 112, + 117, 0, 117, 118, 104, 105, 65, 67, 156, 110, + 113, 127, 126, 110, 106, 104, 117, 124, 104, 93, + 99, 96, 156, 144, 146, 148, 109, 97, 83, 150, + 72 + } ; + +static yyconst flex_int16_t yy_def[72] = + { 0, + 63, 1, 64, 64, 65, 65, 66, 66, 63, 63, + 67, 63, 63, 63, 68, 63, 63, 63, 63, 14, + 14, 63, 63, 69, 69, 70, 69, 71, 71, 67, + 67, 67, 63, 14, 14, 68, 63, 63, 63, 14, + 14, 14, 14, 69, 69, 69, 70, 70, 63, 70, + 69, 71, 71, 14, 14, 14, 69, 70, 14, 14, + 14, 14, 0, 63, 63, 63, 63, 63, 63, 63, + 63 + } ; + +static yyconst flex_int16_t yy_nxt[190] = + { 0, + 10, 11, 12, 13, 14, 15, 14, 10, 10, 14, + 16, 14, 10, 10, 14, 17, 18, 14, 14, 19, + 14, 14, 14, 20, 14, 21, 14, 14, 14, 14, + 22, 10, 23, 25, 12, 25, 10, 26, 10, 31, + 49, 32, 29, 33, 29, 33, 38, 39, 38, 40, + 41, 27, 25, 12, 25, 42, 26, 50, 43, 31, + 32, 32, 32, 33, 46, 33, 46, 49, 47, 49, + 27, 34, 52, 34, 34, 34, 34, 34, 35, 34, + 34, 34, 45, 44, 50, 34, 50, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 36, 34, 51, + + 39, 51, 38, 39, 38, 57, 46, 57, 46, 30, + 47, 58, 49, 58, 51, 39, 51, 45, 57, 42, + 57, 62, 61, 45, 45, 58, 49, 58, 42, 50, + 60, 59, 45, 42, 53, 53, 45, 45, 56, 55, + 54, 53, 53, 50, 24, 24, 28, 28, 10, 10, + 48, 48, 45, 37, 63, 9, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63 + } ; + +static yyconst flex_int16_t yy_chk[190] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 3, 5, 3, 6, 11, + 26, 11, 5, 13, 6, 13, 19, 19, 19, 20, + 20, 3, 4, 4, 4, 21, 4, 26, 21, 31, + 32, 31, 32, 33, 25, 33, 25, 47, 25, 48, + 4, 14, 71, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 25, 69, 47, 14, 48, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 68, 14, 27, + + 27, 27, 38, 38, 38, 45, 46, 45, 46, 67, + 46, 50, 50, 50, 51, 51, 51, 27, 57, 62, + 57, 61, 60, 45, 46, 58, 58, 58, 59, 50, + 56, 55, 51, 54, 53, 52, 57, 44, 43, 41, + 40, 29, 28, 58, 64, 64, 65, 65, 66, 66, + 70, 70, 24, 16, 9, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "autotools.ll" +#line 2 "autotools.ll" +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include + +/** +@file autotools.ll +Autotools Lexer + +There are 3 types of identifiers recognized by this lexer: +-id_simple: examples of such identifiers are qmake variables and scoped variables +at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp"); +-id_list: those are "value list identifiers" at the right side in assignments +(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp"); +-id_args: function arguments recognized as one identifier +(example: ""${QMAKE_FILE} is intended only for Windows!"" +in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements). +. + +To recognize those identifiers two additional start conditions are used: list and funcargs. + +@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to +the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped +so no indentation is preserved by this lexer (and parser). + +To debug this lexer, put the line below into the next flex file section. +%option debug +*/ + + + +#line 559 "autotools_lex.cpp" + +#define INITIAL 0 +#define list 1 +#define funcargs 2 +#define conditional 3 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 73 "autotools.ll" + + +#line 716 "autotools_lex.cpp" + + if ( (yy_init) ) + { + (yy_init) = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 64 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 156 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 75 "autotools.ll" +{} + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 76 "autotools.ll" +{ BEGIN(list); return CONT; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 77 "autotools.ll" +{ + yylval.value = yytext; + if ( yylval.value == "if" ) + return IF_KEYWORD; + + if ( yylval.value == "else" ) + return ELSE_KEYWORD; + + if ( yylval.value == "endif" ) + return ENDIF_KEYWORD; + + return KEYWORD; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 92 "autotools.ll" +{ yylval.value = yytext; return (ID_SIMPLE); } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 94 "autotools.ll" +{ + yylval.value = yytext; + return RULE; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 99 "autotools.ll" +{ + yylval.value = yytext; + yylval.value = yylval.value.mid(0, yylval.value.findRev("\\")); + unput('\\'); + BEGIN(INITIAL); + return (ID_LIST); + } + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 107 "autotools.ll" +{ + yylval.value = yytext; + BEGIN(list); + return (LIST_COMMENT); + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 113 "autotools.ll" +{ + yylval.value = yytext; + BEGIN(INITIAL); + return (ID_LIST_SINGLE); + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 119 "autotools.ll" +{ + yylval.value = yytext; + yylval.value = yylval.value.mid(0, yylval.value.length()-1); + unput(')'); + BEGIN(INITIAL); + return (ID_ARGS); + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 127 "autotools.ll" +{ BEGIN(list); yylval.value = yytext; return EQ; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 128 "autotools.ll" +{ BEGIN(list); yylval.value = yytext; return PLUSEQ; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 129 "autotools.ll" +{ return LCURLY; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 130 "autotools.ll" +{ return RCURLY; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 131 "autotools.ll" +{ BEGIN(list); yylval.value = yytext; return COLON; } + YY_BREAK +case 15: +/* rule 15 can match eol */ +YY_RULE_SETUP +#line 132 "autotools.ll" +{ BEGIN(INITIAL); return NEWLINE; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 133 "autotools.ll" +{ yylval.value = yytext; return (COMMENT); } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 135 "autotools.ll" +ECHO; + YY_BREAK +#line 922 "autotools_lex.cpp" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(list): +case YY_STATE_EOF(funcargs): +case YY_STATE_EOF(conditional): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 64 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 64 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 63); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) +{ + + return yy_scan_bytes(yy_str,strlen(yy_str) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif +#line 135 "autotools.ll" + + + + diff --git a/buildtools/lib/parsers/autotools/autotools_yacc.cpp b/buildtools/lib/parsers/autotools/autotools_yacc.cpp new file mode 100644 index 00000000..f4a3892c --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotools_yacc.cpp @@ -0,0 +1,1631 @@ +/* A Bison parser, made by GNU Bison 1.875d. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ID_SIMPLE = 258, + ID_LIST = 259, + LBRACE = 260, + EQ = 261, + PLUSEQ = 262, + MINUSQE = 263, + STAREQ = 264, + TILDEEQ = 265, + RBRACE = 266, + COLON = 267, + NUMSIGN = 268, + NEWLINE = 269, + NUMBER = 270, + COMMENT = 271, + CONT = 272, + DOT = 273, + RCURLY = 274, + LCURLY = 275, + ID_ARGS = 276, + LIST_COMMENT = 277, + ID_LIST_SINGLE = 278, + IF_KEYWORD = 279, + ELSE_KEYWORD = 280, + ENDIF_KEYWORD = 281, + KEYWORD = 282, + RULE = 283 + }; +#endif +#define ID_SIMPLE 258 +#define ID_LIST 259 +#define LBRACE 260 +#define EQ 261 +#define PLUSEQ 262 +#define MINUSQE 263 +#define STAREQ 264 +#define TILDEEQ 265 +#define RBRACE 266 +#define COLON 267 +#define NUMSIGN 268 +#define NEWLINE 269 +#define NUMBER 270 +#define COMMENT 271 +#define CONT 272 +#define DOT 273 +#define RCURLY 274 +#define LCURLY 275 +#define ID_ARGS 276 +#define LIST_COMMENT 277 +#define ID_LIST_SINGLE 278 +#define IF_KEYWORD 279 +#define ELSE_KEYWORD 280 +#define ENDIF_KEYWORD 281 +#define KEYWORD 282 +#define RULE 283 + + + + +/* Copy the first part of user declarations. */ +#line 1 "autotools.yy" + +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +/** +@file qmake.yy +Autotools Parser + +Simple LALR parser which builds the syntax tree (see @ref Autotools::AST). + +@todo Recognize comments after statements like: +noinst_HEADERS = foo.h #regognize me + +@fixme Parser fails on files that do not end with a newline +@fixme 1 shift/reduce conflict in "line_body" rule +*/ + +#include +#include "autotoolsast.h" + +#define YYSTYPE_IS_DECLARED + +using namespace AutoTools; + +/** +The yylval type. +*/ +struct Result { + Result(): node(0) {} + + /**Type of semantic value for simple grammar rules.*/ + QString value; + /**Type of semantic value for grammar rules which are parts of AST.*/ + AST *node; + /**Type of semantic value for "multiline_values" grammar rule. + Each line of multiline value is stored as a string in the list. + + For example we have in Makefile.am file: + @code + foo_SOURCES = foo1.cpp \ + foo2.cpp \ + foo3.cpp foo4.cpp + @endcode + The string list will be populated with three strings: +
+    foo1.cpp
+    foo2.cpp
+    foo3.cpp foo4.cpp
+    
+ */ + QStringList values; +}; + +typedef Result YYSTYPE; + +void yyerror(const char *str) { + printf("bison error: %s\n", str); +} + +int yylex(); + +/** +The stack to store ProjectAST pointers when a new child +ProjectAST is created and filled with statements. + +Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts +adding statements. Each statement is added as a child StatementAST to the ProjectAST +currently on the top in the stack. + +When a scope or function scope statement is parsed, the child ProjectAST is created +and pushed onto the stack. Therefore all statements which belong to the scope +or function scope are added as childs to their direct parent (scope or function scope). +*/ +QValueStack projects; + +/** +The current depth of AST node is stored here. +AST depth is important to know because automatic indentation can +be easily implemented (the parser itself looses all information +about indentation). +*/ +int depth = 0; + +/* +To debug this parser, put the line below into the next bison file section. +Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. +%debug +*/ + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 214 of yacc.c. */ +#line 253 "autotools_yacc.cpp" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# endif +# else +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined (__GNUC__) && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 33 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 29 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 18 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 35 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 43 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 283 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned char yyprhs[] = +{ + 0, 0, 3, 4, 7, 10, 11, 13, 15, 17, + 19, 21, 23, 25, 27, 29, 32, 34, 37, 39, + 42, 46, 49, 51, 54, 55, 58, 61, 63, 65, + 69, 71, 74, 76, 78, 81 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 30, 0, -1, -1, 31, 32, -1, 32, 33, -1, + -1, 37, -1, 34, -1, 36, -1, 35, -1, 41, + -1, 42, -1, 43, -1, 45, -1, 46, -1, 24, + 38, -1, 26, -1, 26, 38, -1, 25, -1, 25, + 38, -1, 38, 44, 39, -1, 3, 38, -1, 3, + -1, 39, 40, -1, -1, 4, 17, -1, 23, 14, + -1, 17, -1, 22, -1, 38, 12, 39, -1, 28, + -1, 27, 38, -1, 6, -1, 7, -1, 16, 14, + -1, 14, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 142, 142, 142, 149, 175, 178, 182, 186, 190, + 194, 198, 202, 206, 210, 216, 224, 230, 239, 245, + 254, 264, 266, 269, 273, 276, 277, 278, 279, 282, + 291, 299, 308, 308, 311, 319 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ID_SIMPLE", "ID_LIST", "LBRACE", "EQ", + "PLUSEQ", "MINUSQE", "STAREQ", "TILDEEQ", "RBRACE", "COLON", "NUMSIGN", + "NEWLINE", "NUMBER", "COMMENT", "CONT", "DOT", "RCURLY", "LCURLY", + "ID_ARGS", "LIST_COMMENT", "ID_LIST_SINGLE", "IF_KEYWORD", + "ELSE_KEYWORD", "ENDIF_KEYWORD", "KEYWORD", "RULE", "$accept", "project", + "@1", "statements", "statement", "automake_if", "endif_statement", + "else_statement", "variable_assignment", "scoped_identifier", + "multiline_values", "line_body", "target", "am_rule", + "include_directive", "operator", "comment", "emptyline", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 29, 31, 30, 32, 32, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 34, 35, 35, 36, 36, + 37, 38, 38, 39, 39, 40, 40, 40, 40, 41, + 42, 43, 44, 44, 45, 46 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 0, 2, 2, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, + 3, 2, 1, 2, 0, 2, 2, 1, 1, 3, + 1, 2, 1, 1, 2, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 2, 0, 5, 1, 3, 22, 35, 0, 0, 18, + 16, 0, 30, 4, 7, 9, 8, 6, 0, 10, + 11, 12, 13, 14, 21, 34, 15, 19, 17, 31, + 32, 33, 24, 24, 29, 20, 0, 27, 28, 0, + 23, 25, 26 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = +{ + -1, 1, 2, 4, 13, 14, 15, 16, 17, 18, + 34, 40, 19, 20, 21, 33, 22, 23 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -18 +static const yysigned_char yypact[] = +{ + -18, 2, -18, -18, -3, 0, -18, -6, 0, 0, + 0, 0, -18, -18, -18, -18, -18, -18, 3, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, 10, 10, -5, -18, -18, 4, + -18, -18, -18 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = +{ + -18, -18, -18, -18, -18, -18, -18, -18, -18, -4, + -17, -18, -18, -18, -18, -18, -18, -18 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const unsigned char yytable[] = +{ + 5, 24, 3, 5, 26, 27, 28, 29, 25, 30, + 31, 6, 41, 7, 36, 32, 35, 0, 42, 0, + 0, 8, 9, 10, 11, 12, 0, 37, 0, 0, + 0, 0, 38, 39 +}; + +static const yysigned_char yycheck[] = +{ + 3, 5, 0, 3, 8, 9, 10, 11, 14, 6, + 7, 14, 17, 16, 4, 12, 33, -1, 14, -1, + -1, 24, 25, 26, 27, 28, -1, 17, -1, -1, + -1, -1, 22, 23 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 30, 31, 0, 32, 3, 14, 16, 24, 25, + 26, 27, 28, 33, 34, 35, 36, 37, 38, 41, + 42, 43, 45, 46, 38, 14, 38, 38, 38, 38, + 6, 7, 12, 44, 39, 39, 4, 17, 22, 23, + 40, 17, 14 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + ((Current).first_line = (Rhs)[1].first_line, \ + (Current).first_column = (Rhs)[1].first_column, \ + (Current).last_line = (Rhs)[N].last_line, \ + (Current).last_column = (Rhs)[N].last_column) +#endif + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ + + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + +#define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short int *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 142 "autotools.yy" + { + ProjectAST *projectAST = new ProjectAST(); + projects.push(projectAST); +;} + break; + + case 4: +#line 150 "autotools.yy" + { + projects.top()->addChildAST(yyvsp[0].node); + + if ( yyvsp[0].node->nodeType() == AST::ProjectAST && + static_cast( yyvsp[0].node )->scopedID == "if" ) + { + yyvsp[0].node->setDepth(depth); + depth++; + } + else if ( yyvsp[0].node->nodeType() == AST::ProjectAST && + static_cast( yyvsp[0].node )->scopedID == "else" ) + { + --depth; + yyvsp[0].node->setDepth(depth); + ++depth; + } + else if ( yyvsp[0].node->nodeType() == AST::ProjectAST && + static_cast( yyvsp[0].node )->scopedID == "endif" ) + { + --depth; + yyvsp[0].node->setDepth(depth); + } + else + yyvsp[0].node->setDepth(depth); +;} + break; + + case 6: +#line 179 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 7: +#line 183 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 8: +#line 187 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 9: +#line 191 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 10: +#line 195 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 11: +#line 199 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 12: +#line 203 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 13: +#line 207 "autotools.yy" + { + yyval.node = yyvsp[0].node; +;} + break; + + case 14: +#line 211 "autotools.yy" + { + yyval.node = new NewLineAST(); +;} + break; + + case 15: +#line 217 "autotools.yy" + { + ConditionAST* projectAST = new ConditionAST(); + projectAST->type = "if"; + projectAST->conditionName = yyvsp[0].value; + yyval.node = projectAST; +;} + break; + + case 16: +#line 225 "autotools.yy" + { + ConditionAST* past = new ConditionAST(); + past->type= "endif"; + yyval.node = past; +;} + break; + + case 17: +#line 231 "autotools.yy" + { + ConditionAST* past = new ConditionAST(); + past->type= "endif"; + past->conditionName = yyvsp[0].value; + yyval.node = past; +;} + break; + + case 18: +#line 240 "autotools.yy" + { + ConditionAST* past = new ConditionAST(); + past->type = "else"; + yyval.node = past; +;} + break; + + case 19: +#line 246 "autotools.yy" + { + ConditionAST* past = new ConditionAST(); + past->type = "else"; + past->conditionName = yyvsp[0].value; + yyval.node = past; +;} + break; + + case 20: +#line 255 "autotools.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = yyvsp[-2].value; + node->op = yyvsp[-1].value; + node->values = yyvsp[0].values; + yyval.node = node; +;} + break; + + case 21: +#line 265 "autotools.yy" + { yyval.value = yyvsp[-1].value + yyvsp[0].value; ;} + break; + + case 23: +#line 270 "autotools.yy" + { + yyval.values.append(yyvsp[0].value); +;} + break; + + case 24: +#line 273 "autotools.yy" + { yyval.values.clear(); ;} + break; + + case 25: +#line 276 "autotools.yy" + { yyval.value = yyvsp[-1].value + " \\\n"; ;} + break; + + case 26: +#line 277 "autotools.yy" + { yyval.value = yyvsp[-1].value + "\n"; ;} + break; + + case 27: +#line 278 "autotools.yy" + { yyval.value = "\\\n"; ;} + break; + + case 29: +#line 283 "autotools.yy" + { + AutomakeTargetAST *node = new AutomakeTargetAST(); + node->target = yyvsp[-2].value; + node->deps = yyvsp[0].values; + yyval.node = node; +;} + break; + + case 30: +#line 292 "autotools.yy" + { + ProjectAST* node = new ProjectAST(ProjectAST::Rule); + node->scopedID = yyvsp[0].value; + yyval.node = node; +;} + break; + + case 31: +#line 300 "autotools.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = yyvsp[-1].value; + node->values = QStringList(yyvsp[0].value); + yyval.node = node; +;} + break; + + case 34: +#line 312 "autotools.yy" + { + CommentAST *node = new CommentAST(); + node->comment = yyvsp[-1].value + "\n"; + yyval.node = node; +;} + break; + + + } + +/* Line 1010 of yacc.c. */ +#line 1403 "autotools_yacc.cpp" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + const char* yyprefix; + char *yymsg; + int yyx; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yyp = yystpcpy (yyp, yyprefix); + yyp = yystpcpy (yyp, yytname[yyx]); + yyprefix = " or "; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + } + } + else + { + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; + + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + + yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; + + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} + + +#line 321 "autotools.yy" + + +#include "autotools_lex.cpp" + diff --git a/buildtools/lib/parsers/autotools/autotools_yacc.h b/buildtools/lib/parsers/autotools/autotools_yacc.h new file mode 100644 index 00000000..b8becb4a --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotools_yacc.h @@ -0,0 +1,100 @@ +/* A Bison parser, made by GNU Bison 1.875d. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ID_SIMPLE = 258, + ID_LIST = 259, + LBRACE = 260, + EQ = 261, + PLUSEQ = 262, + MINUSQE = 263, + STAREQ = 264, + TILDEEQ = 265, + RBRACE = 266, + COLON = 267, + NUMSIGN = 268, + NEWLINE = 269, + NUMBER = 270, + COMMENT = 271, + CONT = 272, + DOT = 273, + RCURLY = 274, + LCURLY = 275, + ID_ARGS = 276, + LIST_COMMENT = 277, + ID_LIST_SINGLE = 278, + IF_KEYWORD = 279, + ELSE_KEYWORD = 280, + ENDIF_KEYWORD = 281, + KEYWORD = 282, + RULE = 283 + }; +#endif +#define ID_SIMPLE 258 +#define ID_LIST 259 +#define LBRACE 260 +#define EQ 261 +#define PLUSEQ 262 +#define MINUSQE 263 +#define STAREQ 264 +#define TILDEEQ 265 +#define RBRACE 266 +#define COLON 267 +#define NUMSIGN 268 +#define NEWLINE 269 +#define NUMBER 270 +#define COMMENT 271 +#define CONT 272 +#define DOT 273 +#define RCURLY 274 +#define LCURLY 275 +#define ID_ARGS 276 +#define LIST_COMMENT 277 +#define ID_LIST_SINGLE 278 +#define IF_KEYWORD 279 +#define ELSE_KEYWORD 280 +#define ENDIF_KEYWORD 281 +#define KEYWORD 282 +#define RULE 283 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +extern YYSTYPE yylval; + + + diff --git a/buildtools/lib/parsers/autotools/autotoolsast.cpp b/buildtools/lib/parsers/autotools/autotoolsast.cpp new file mode 100644 index 00000000..71596e3d --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotoolsast.cpp @@ -0,0 +1,117 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "autotoolsast.h" + +namespace AutoTools { + +//AST + +AST::~AST() +{ + for (QValueList::iterator it = m_children.begin(); it != m_children.end(); ++it) + { + AST *node = *it; + delete node; + } +} + +void AST::addChildAST(AST *node) +{ + m_children.append(node); +} + +void AST::writeBack(QString &buffer) +{ + for (QValueList::const_iterator it = m_children.constBegin(); + it != m_children.constEnd(); ++it) + { + if (*it) + (*it)->writeBack(buffer); + } +} + +QString AST::indentation() +{ + QString result; + for (int i = 0; i < depth(); i++) + result += '\t'; + return result; +} + +bool AST::hasChildren() const +{ + return !m_children.isEmpty(); +} + +QValueList AST::children() const +{ + return m_children; +} + +//ProjectAST + +void ProjectAST::writeBack(QString &buffer) +{ + if ( isRule() ) + buffer += scopedID; + else + buffer += indentation(); + + AST::writeBack(buffer); + +} + +void ProjectAST::addChildAST(AST *node) +{ + statements.append(node); + AST::addChildAST(node); +} + +void AssignmentAST::writeBack(QString &buffer) +{ + buffer += indentation() + scopedID + " " + op + values.join(""); +} + +void AutomakeTargetAST::writeBack( QString& buffer ) +{ + buffer += target + ":" + deps.join(""); +} + +void ConditionAST::writeBack( QString& buffer ) +{ + buffer += indentation() + type + " " + conditionName; +} + +void NewLineAST::writeBack(QString &buffer) +{ + buffer += "\n"; +} + +void CommentAST::writeBack(QString &buffer) +{ + buffer += indentation() + comment; +} + +} + +// kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/buildtools/lib/parsers/autotools/autotoolsast.h b/buildtools/lib/parsers/autotools/autotoolsast.h new file mode 100644 index 00000000..c92c17c7 --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotoolsast.h @@ -0,0 +1,269 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef AUTOTOOLSAST_H +#define AUTOTOOLSAST_H + +#include + +/** +@file autotools.h +Abstract Syntax Tree (AST) class declarations. +*/ + +namespace AutoTools +{ + +/** + * AST node. + * This is the base class. Objects of this type are not created by the parser. + * + * Each AST node holds the list of its children which are always deleted in the + * destructor. This way, it's possible call delete for only root AST node and + * others will be deleted automatically. + * + * Each AST node also knows how to write the information back into .pro file. + */ +class AST +{ +public: + /**Type of AST node.*/ + enum NodeType { + ProjectAST, ///< Project, scope or function scope. + AssignmentAST, ///< Variable assignment. + TargetAST, ///< Automake target + MakefileConditionalAST, ///< Makefile.am conditional + NewLineAST, ///< Line feed. + CommentAST ///< Comment. + }; + + /** Constructs AST with given node type.*/ + AST(NodeType nodeType): m_nodeType(nodeType), m_depth(0) {} + virtual ~AST(); + + /** + * Adds child AST node to this node. Despite this function is virtual, + * reimplementations should call it to make automatic destruction of + * AST tree possible.*/ + virtual void addChildAST(AST *node); + + /** + * Writes information stored in the AST into the @p buffer. + * This is a default implementation which iterates over child nodes + * and calls writeBack for each child node. + */ + virtual void writeBack(QString &buffer); + + /** @return The type of the node.*/ + virtual NodeType nodeType() const { return m_nodeType; } + + /** Sets the depth of the node in AST.*/ + void setDepth(int depth) { m_depth = depth; } + + /** @return The depth of the node in AST.*/ + int depth() const { return m_depth; } + + /** @return The indentation string based on node depth.*/ + virtual QString indentation(); + + //! \return true if this AST has children + bool hasChildren() const; + + /** + * Get the children of this ast + * \return the list of this ast's childre + */ + QValueList children() const; + + + +protected: + NodeType m_nodeType; + QValueList m_children; + +private: + int m_depth; + +}; + + +/** + * Project AST node. + * Represents complete projects, scopes and function scopes. + * Examples: + * @code + * scopename{ + * var=value + * } + * function(args){ + * var=value + * } + * @endcode + */ +class ProjectAST: public AST +{ +public: + /**The kind of a project node.*/ + enum Kind + { + Project, ///< Project + Target, ///< Custom Automake Target + ConditionalScope, ///< Automake Conditional + Rule, ///< Automake Rule + Empty ///< Project does not exist. the AST is empty + }; + + /** Constructs a project node of given @p kind. */ + ProjectAST(Kind kind = Project): AST(AST::ProjectAST), m_kind(kind) {} + + virtual void writeBack(QString &buffer); + virtual void addChildAST(AST *node); + + /** @return true if this node is a project.*/ + bool isProject() const { return m_kind == Project; } + + bool isRule() const { return m_kind == Rule; } + + /** @return true if this node is an automake conditional */ + bool isConditionalScope() const { return m_kind == ConditionalScope; } + + /** @return true if this node is empty.*/ + bool isEmpty() const { return m_kind == Empty; } + + /**Scoped identifier (scope name or rule).*/ + QString scopedID; + + /**Function arguments. Empty for other kinds of projects.*/ + QString args; + + /** The automake conditional has an else attached */ + bool hasElse; + + /**List of statements.*/ + QValueList statements; + +private: + Kind m_kind; + +}; + + +/** + * Assignment AST node. + * Represents assignments, for example: + * \code + * var=value + * \endcode + * + * Values can be specified on several lines and + * each line is stored as a string in the list of values.@n + * For example, if we have in .pro: + * \code + * SOURCES=a.cpp \ + * b.cpp c.cpp + * \endcode + * then values will be stored as a two elements list: + * \code + * a.cpp + * b.cpp c.cpp + * \endcode + */ +class AssignmentAST: public AST +{ +public: + AssignmentAST(): AST(AST::AssignmentAST) {} + + virtual void writeBack(QString &buffer); + + /**Scoped name of the variable.*/ + QString scopedID; + + /**Operator.*/ + QString op; + + /**List of values.*/ + QStringList values; +}; + +class AutomakeTargetAST : public AST +{ +public: + AutomakeTargetAST() : AST(AST::TargetAST) {} + + virtual void writeBack( QString& buffer ); + + /// The name of the target + QString target; + + /// The dependencies for the target, if any + QStringList deps; +}; + +class ConditionAST : public AST +{ +public: + ConditionAST() : AST( AST::MakefileConditionalAST ) {} + + virtual void writeBack( QString& buffer ); + + /// The keyword for the condition (if, else, endif) + QString type; + + /// The name of the condition + QString conditionName; +}; + +/** + * New line AST node. + * Represents line feeds in files. + */ +class NewLineAST: public AST +{ +public: + NewLineAST(): AST(AST::NewLineAST) {} + + virtual void writeBack(QString &buffer); + +}; + + +/** + * Comment AST node. + * Represents comments. + */ +class CommentAST: public AST +{ +public: + CommentAST(): AST(AST::CommentAST) {} + + virtual void writeBack(QString &buffer); + + /**Comment text.*/ + QString comment; + +}; + +} + +#endif + +// kate: indent-mode csands; space-indent off; tab-width 4; auto-insert-doxygen on; diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.cpp b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp new file mode 100644 index 00000000..8ec643ab --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp @@ -0,0 +1,70 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "autotoolsdriver.h" +#include "autotoolsast.h" + +#include +#include +#include + +extern FILE *yyin, *yyout; +extern int yyparse(); +//extern int yydebug; +extern QValueStack projects; + +namespace AutoTools { + +int Driver::parseFile(const char *fileName, ProjectAST **ast) +{ + //yydebug = 1; + yyin = fopen(fileName, "r"); + if (yyin == 0) + { + ast = 0; + return 1; + } + int ret = yyparse(); + *ast = projects.top(); + fclose(yyin); + return ret; +} + +int Driver::parseFile(QString fileName, ProjectAST **ast) +{ + return parseFile(fileName.ascii(), ast); +} + +int Driver::parseFile(KURL fileName, ProjectAST **ast) +{ + QString tmpFile; + int ret = 0; + if (KIO::NetAccess::download(fileName, tmpFile, 0)) + ret = parseFile(tmpFile, ast); + KIO::NetAccess::removeTempFile(tmpFile); + return ret; +} + +} + +//kate: indent-mode csands; space-indent off; tab-width 4; + diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.h b/buildtools/lib/parsers/autotools/autotoolsdriver.h new file mode 100644 index 00000000..eba0a823 --- /dev/null +++ b/buildtools/lib/parsers/autotools/autotoolsdriver.h @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * Copyright (c) 2005 by Matt Rogers * + * mattr@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef QMAKEQMAKEDRIVER_H +#define QMAKEQMAKEDRIVER_H + +#include +#include + +namespace AutoTools { + +/** +@file autotoolsdriver.h +Driver for a qmake parser. +*/ + +class ProjectAST; + +/** + * Driver. + * Use methods of this class to lauch parsing and build the AST. + */ +class Driver +{ +public: + /** + * Parses the file @p fileName and stores the resulting ProjectAST root + * into @p ast. @p ast should not be initialized before. Driver will + * initialize it on its own. + * @return The result of parsing. Result is 0 on success and <> 0 on failure. + */ + static int parseFile(const char *fileName, ProjectAST **ast); + static int parseFile(QString fileName, ProjectAST **ast); + static int parseFile(KURL fileName, ProjectAST **ast); + +/* template + static void walkAST(Op &op, const ProjectAST *ast) + { +// op(ast); + for (QValueList::const_iterator it = ast->statements.constBegin(); + it != ast->statements.constEnd(); ++it) + { + const AST *child = *it; + if (child->nodeType() == AST::ProjectAST) + walkAST(op, static_cast(child)); + else + op(child); + } + } +*/ +}; + +} + +#endif + +// kate: indent-mode csands; tab-width 4; space-indent off; auto-insert-doxygen on; diff --git a/buildtools/lib/parsers/autotools/tests/Makefile.am b/buildtools/lib/parsers/autotools/tests/Makefile.am new file mode 100644 index 00000000..222a0482 --- /dev/null +++ b/buildtools/lib/parsers/autotools/tests/Makefile.am @@ -0,0 +1,21 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \ + -I$(top_srcdir)/buildtools/lib/parsers/autotools \ + -I$(top_builddir)/buildtools/lib/parsers/autotools/tests \ + $(all_includes) + +METASOURCES = AUTO + +check_PROGRAMS = runner viewer + +runner_LDFLAGS = $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH) +runner_LDADD = $(top_builddir)/buildtools/lib/parsers/autotools/libkdevautotoolsparser.la +runner_SOURCES = runner.cpp + +viewer_LDFLAGS = $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH) +viewer_LDADD = $(top_builddir)/buildtools/lib/parsers/autotools/libkdevautotoolsparser.la +viewer_SOURCES = viewer.cpp viewer_main.cpp viewerbase.ui diff --git a/buildtools/lib/parsers/autotools/tests/runner.cpp b/buildtools/lib/parsers/autotools/tests/runner.cpp new file mode 100644 index 00000000..cf9f68d1 --- /dev/null +++ b/buildtools/lib/parsers/autotools/tests/runner.cpp @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include +#include + +using namespace AutoTools; + +int main(int argc, char *argv[]) +{ + ProjectAST *projectAST; + if (argc > 1) + return Driver::parseFile(argv[1], &projectAST); + else + return 0; +} + diff --git a/buildtools/lib/parsers/autotools/tests/viewer.cpp b/buildtools/lib/parsers/autotools/tests/viewer.cpp new file mode 100644 index 00000000..047e6b28 --- /dev/null +++ b/buildtools/lib/parsers/autotools/tests/viewer.cpp @@ -0,0 +1,162 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "viewer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace AutoTools; + +Viewer::Viewer(QWidget *parent, const char *name) + :ViewerBase(parent, name) +{ + if (QFile::exists(QDir::currentDirPath() + "/" + "qtlist")) + { + QFile f(QDir::currentDirPath() + "/" + "qtlist"); + f.open(IO_ReadOnly); + QTextStream str(&f); + while (!str.eof()) + files->insertItem(str.readLine()); + } + ast->setSorting(-1); + parentProject.push((QListViewItem*)0); +} + +void Viewer::addAll_clicked() +{ + if (allLocation->text().isEmpty()) + return; + QDir d(allLocation->text()); + QStringList l = d.entryList("*.am"); + for (QStringList::iterator it = l.begin(); it != l.end(); ++it) + (*it) = QDir::cleanDirPath(allLocation->text() + "/" + (*it)); + files->insertStringList(l); +} + +void Viewer::choose_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(QDir::currentDirPath(), "*.am", this); + if (!fileName.isEmpty()) + files->insertItem(fileName); +} + +void Viewer::files_currentChanged(QListBoxItem* item) +{ + ast->clear(); + + QFile f(item->text()); + f.open(IO_ReadOnly); + QTextStream str(&f); + source->setText(str.read()); + f.close(); + + int result = Driver::parseFile(item->text().ascii(), &projectAST); + if (projectAST && (result == 0)) + { + processAST(projectAST); + } + if (tabWidget2->currentPageIndex() == 1) + tabWidget2_selected("Source to be written back"); +} + +void Viewer::tabWidget2_selected(const QString& text) +{ + if ((text == "Source to be written back") && projectAST) + { + QString buffer; + projectAST->writeBack(buffer); + writeBack->setText(buffer); + } +} + +void Viewer::processAST(ProjectAST *projectAST, QListViewItem *globAfter) +{ + QListViewItem *projectIt; + if (!parentProject.top()) + projectIt = new QListViewItem(ast, "Project"); + else + { + if ( projectAST->isConditionalScope() || projectAST->isRule() ) + projectIt = new QListViewItem(parentProject.top(), globAfter, projectAST->scopedID); + } + projectIt->setOpen(true); + + QListViewItem *after = 0; + for (QValueList::const_iterator it = projectAST->statements.constBegin(); + it != projectAST->statements.constEnd(); ++it) + { + AST *ast = *it; + if (ast == 0) + continue; + switch (ast->nodeType()) { + case AST::AssignmentAST: { + AssignmentAST *assignmentAST = static_cast(ast); + QListViewItem *item = new QListViewItem(projectIt, after, + assignmentAST->scopedID, assignmentAST->op, assignmentAST->values.join("")); + item->setMultiLinesEnabled(true); + after = item; } + break; + + case AST::TargetAST: + { + AutomakeTargetAST* ata = static_cast(ast); + QListViewItem* item = new QListViewItem(projectIt, after, + ata->target, QString::null, ata->deps.join("")); + after = item; + } + break; + + case AST::NewLineAST: +// after = new QListViewItem(projectIt, after, ""); + break; + + case AST::CommentAST: +// after = new QListViewItem(projectIt, after, ""); + break; + + case AST::MakefileConditionalAST: + { + ConditionAST* ata = static_cast(ast); + QListViewItem* item = new QListViewItem(projectIt, after, + ata->type, ata->conditionName, QString::null ); + after = item; + } + case AST::ProjectAST: { + ProjectAST *projectAST = static_cast(ast); + parentProject.push(projectIt); + processAST(projectAST, after); + parentProject.pop(); } + break; + } + } +} + +#include "viewer.moc" + diff --git a/buildtools/lib/parsers/autotools/tests/viewer.h b/buildtools/lib/parsers/autotools/tests/viewer.h new file mode 100644 index 00000000..46698483 --- /dev/null +++ b/buildtools/lib/parsers/autotools/tests/viewer.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef VIEWER_H +#define VIEWER_H + +#include + +#include "viewerbase.h" + +namespace AutoTools { class ProjectAST; } + +class QListViewItem; + +class Viewer: public ViewerBase { +Q_OBJECT +public: + Viewer(QWidget *parent = 0, const char *name = 0); + void processAST(AutoTools::ProjectAST *projectAST, QListViewItem *globAfter = 0); +public slots: + virtual void tabWidget2_selected(const QString&); + virtual void files_currentChanged(QListBoxItem*); + virtual void choose_clicked(); + virtual void addAll_clicked(); +private: + AutoTools::ProjectAST *projectAST; + QValueStack parentProject; +}; + +#endif diff --git a/buildtools/lib/parsers/autotools/tests/viewer_main.cpp b/buildtools/lib/parsers/autotools/tests/viewer_main.cpp new file mode 100644 index 00000000..32641eff --- /dev/null +++ b/buildtools/lib/parsers/autotools/tests/viewer_main.cpp @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include +#include "viewer.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + Viewer viewer; + app.setMainWidget(&viewer); + viewer.show(); + viewer.resize(800, 600); + //viewer.setWindowState(viewer.windowState() | Qt::WindowMaximized); + + return app.exec(); +} diff --git a/buildtools/lib/parsers/autotools/tests/viewerbase.ui b/buildtools/lib/parsers/autotools/tests/viewerbase.ui new file mode 100644 index 00000000..7c228299 --- /dev/null +++ b/buildtools/lib/parsers/autotools/tests/viewerbase.ui @@ -0,0 +1,220 @@ + +ViewerBase + + + ViewerBase + + + + 0 + 0 + 600 + 480 + + + + Viewer + + + + unnamed + + + + layout2 + + + + unnamed + + + + source + + + + 7 + 7 + 0 + 1 + + + + + + tabWidget2 + + + + 7 + 7 + 0 + 2 + + + + + tab + + + Parse Tree + + + + unnamed + + + + + Name + + + true + + + true + + + + + Value 1 + + + true + + + true + + + + + Value 2 + + + true + + + true + + + + ast + + + + + + + tab + + + Source to Be Written Back + + + + unnamed + + + + writeBack + + + + + + + + + + allLocation + + + + 150 + 32767 + + + + + + addAll + + + + 150 + 32767 + + + + Add All From Directory + + + + + choose + + + + 150 + 32767 + + + + Choose File to Add... + + + + + files + + + + 7 + 7 + 0 + 0 + + + + + 150 + 32767 + + + + + + + + addAll + clicked() + ViewerBase + addAll_clicked() + + + choose + clicked() + ViewerBase + choose_clicked() + + + files + currentChanged(QListBoxItem*) + ViewerBase + files_currentChanged(QListBoxItem*) + + + tabWidget2 + selected(const QString&) + ViewerBase + tabWidget2_selected(const QString&) + + + + addAll_clicked() + choose_clicked() + files_currentChanged(QListBoxItem*) + tabWidget2_selected(const QString&) + + + diff --git a/buildtools/lib/parsers/qmake/FlexLexer.h b/buildtools/lib/parsers/qmake/FlexLexer.h new file mode 100644 index 00000000..1db844da --- /dev/null +++ b/buildtools/lib/parsers/qmake/FlexLexer.h @@ -0,0 +1,205 @@ + +// -*-C++-*- +// FlexLexer.h -- define interfaces for lexical analyzer classes generated +// by flex + +// Copyright (c) 1993 The Regents of the University of California. +// All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Kent Williams and Tom Epperly. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: + +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. + +// Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE. + +// This file defines FlexLexer, an abstract class which specifies the +// external interface provided to flex C++ lexer objects, and yyFlexLexer, +// which defines a particular lexer class. +// +// If you want to create multiple lexer classes, you use the -P flag +// to rename each yyFlexLexer to some other xxFlexLexer. You then +// include in your other sources once per lexer class: +// +// #undef yyFlexLexer +// #define yyFlexLexer xxFlexLexer +// #include +// +// #undef yyFlexLexer +// #define yyFlexLexer zzFlexLexer +// #include +// ... + +#ifndef __FLEX_LEXER_H +// Never included before - need to define base class. +#define __FLEX_LEXER_H + +#include +# ifndef FLEX_STD +# define FLEX_STD std:: +# endif + +extern "C++" { + +struct yy_buffer_state; +typedef int yy_state_type; + +class FlexLexer { +public: + virtual ~FlexLexer() { } + + const char* YYText() const { return yytext; } + int YYLeng() const { return yyleng; } + + virtual void + yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; + virtual struct yy_buffer_state* + yy_create_buffer( FLEX_STD istream* s, int size ) = 0; + virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; + virtual void yyrestart( FLEX_STD istream* s ) = 0; + + virtual int yylex() = 0; + + // Call yylex with new input/output sources. + int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ) + { + switch_streams( new_in, new_out ); + return yylex(); + } + + // Switch to new input/output streams. A nil stream pointer + // indicates "keep the current one". + virtual void switch_streams( FLEX_STD istream* new_in = 0, + FLEX_STD ostream* new_out = 0 ) = 0; + + int lineno() const { return yylineno; } + + int debug() const { return yy_flex_debug; } + void set_debug( int flag ) { yy_flex_debug = flag; } + +protected: + char* yytext; + int yyleng; + int yylineno; // only maintained if you use %option yylineno + int yy_flex_debug; // only has effect with -d or "%option debug" +}; + +} +#endif + +#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) +// Either this is the first time through (yyFlexLexerOnce not defined), +// or this is a repeated include to define a different flavor of +// yyFlexLexer, as discussed in the flex man page. +#define yyFlexLexerOnce + +extern "C++" { + +class yyFlexLexer : public FlexLexer { +public: + // arg_yyin and arg_yyout default to the cin and cout, but we + // only make that assignment when initializing in yylex(). + yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 ); + + virtual ~yyFlexLexer(); + + void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); + struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size ); + void yy_delete_buffer( struct yy_buffer_state* b ); + void yyrestart( FLEX_STD istream* s ); + + void yypush_buffer_state( struct yy_buffer_state* new_buffer ); + void yypop_buffer_state(void); + + virtual int yylex(); + virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out ); + +protected: + virtual int LexerInput( char* buf, int max_size ); + virtual void LexerOutput( const char* buf, int size ); + virtual void LexerError( const char* msg ); + + void yyunput( int c, char* buf_ptr ); + int yyinput(); + + void yy_load_buffer_state(); + void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s ); + void yy_flush_buffer( struct yy_buffer_state* b ); + + int yy_start_stack_ptr; + int yy_start_stack_depth; + int* yy_start_stack; + + void yy_push_state( int new_state ); + void yy_pop_state(); + int yy_top_state(); + + yy_state_type yy_get_previous_state(); + yy_state_type yy_try_NUL_trans( yy_state_type current_state ); + int yy_get_next_buffer(); + + FLEX_STD istream* yyin; // input source for default LexerInput + FLEX_STD ostream* yyout; // output sink for default LexerOutput + + // yy_hold_char holds the character lost when yytext is formed. + char yy_hold_char; + + // Number of characters read into yy_ch_buf. + int yy_n_chars; + + // Points to current character in buffer. + char* yy_c_buf_p; + + int yy_init; // whether we need to initialize + int yy_start; // start state number + + // Flag which is used to allow yywrap()'s to do buffer switches + // instead of setting up a fresh yyin. A bit of a hack ... + int yy_did_buffer_switch_on_eof; + + + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */ + void yyensure_buffer_stack(void); + + // The following are not always needed, but may be depending + // on use of certain flex features (like REJECT or yymore()). + + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + yy_state_type* yy_state_buf; + yy_state_type* yy_state_ptr; + + char* yy_full_match; + int* yy_full_state; + int yy_full_lp; + + int yy_lp; + int yy_looking_for_trail_begin; + + int yy_more_flag; + int yy_more_len; + int yy_more_offset; + int yy_prev_more_offset; +}; + +} + +#endif diff --git a/buildtools/lib/parsers/qmake/Mainpage.dox b/buildtools/lib/parsers/qmake/Mainpage.dox new file mode 100644 index 00000000..7b2e2682 --- /dev/null +++ b/buildtools/lib/parsers/qmake/Mainpage.dox @@ -0,0 +1,16 @@ +/** +@mainpage The KDevelop QMake Parser + +This library contains qmake parser. + +Link with: -lkdevqmakeparser + +Include path: -I\$(kde_includes)/kdevelop/buildtools/parsers/qmake + +\section qmakeparseroverview Overview +Here resides a parser for qmake .pro (.pri) files. This parser +reads project files, builds an AST which then can be written +back to the project file. + +*/ + diff --git a/buildtools/lib/parsers/qmake/Makefile.am b/buildtools/lib/parsers/qmake/Makefile.am new file mode 100644 index 00000000..fd80170c --- /dev/null +++ b/buildtools/lib/parsers/qmake/Makefile.am @@ -0,0 +1,31 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +#SUBDIRS = tests + +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \ + $(all_includes) +METASOURCES = AUTO +lib_LTLIBRARIES = libkdevqmakeparser.la +libkdevqmakeparser_la_LDFLAGS = -no-undefined $(all_libraries) $(LIB_KIO) +libkdevqmakeparser_la_SOURCES = qmake_lex.cpp qmake_yacc.cpp qmakeast.cpp \ + qmakeastvisitor.cpp qmakedriver.cpp + +kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/parsers/qmake +kdevelopbuildtoolsinclude_HEADERS = qmakeast.h qmakedriver.h qmakeastvisitor.h + +parser: + cd $(srcdir) ; \ + bison -d qmake.yy -r all -k -t -oqmake_yacc.cpp ; \ + flex -d -oqmake_lex.cpp qmake.ll + +EXTRA_DIST = qmake.yy qmake.ll + +DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils +DOXYGEN_PROJECTNAME = KDevelop QMake parser +DOXYGEN_DOCDIRPREFIX = kdevparser +include ../../../../Doxyfile.am + +noinst_HEADERS = qmake.ll qmake.yy qmake_lex.h diff --git a/buildtools/lib/parsers/qmake/location.hh b/buildtools/lib/parsers/qmake/location.hh new file mode 100644 index 00000000..4da36b8a --- /dev/null +++ b/buildtools/lib/parsers/qmake/location.hh @@ -0,0 +1,145 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Locations for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file location.hh + ** Define the QMake::location class. + */ + +#ifndef BISON_LOCATION_HH +# define BISON_LOCATION_HH + +# include +# include +# include "position.hh" + +namespace QMake +{ + + /// Abstract a location. + class location + { + public: + + /// Construct a location. + location () + : begin (), end () + { + } + + + /// Initialization. + inline void initialize (std::string* fn) + { + begin.initialize (fn); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + inline void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + inline void columns (unsigned int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + inline void lines (unsigned int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) + { + location res = begin; + res.end = end.end; + return res; + } + + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) + { + location res = begin; + res.columns (width); + return res; + } + + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) + { + res.columns (width); + return res; + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + inline std::ostream& operator<< (std::ostream& ostr, const location& loc) + { + position last = loc.end - 1; + ostr << loc.begin; + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) + ostr << '-' << last; + else if (loc.begin.line != last.line) + ostr << '-' << last.line << '.' << last.column; + else if (loc.begin.column != last.column) + ostr << '-' << last.column; + return ostr; + } + +} + +#endif // not BISON_LOCATION_HH diff --git a/buildtools/lib/parsers/qmake/position.hh b/buildtools/lib/parsers/qmake/position.hh new file mode 100644 index 00000000..704f0df4 --- /dev/null +++ b/buildtools/lib/parsers/qmake/position.hh @@ -0,0 +1,142 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Positions for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file position.hh + ** Define the QMake::position class. + */ + +#ifndef BISON_POSITION_HH +# define BISON_POSITION_HH + +# include +# include + +namespace QMake +{ + /// Abstract a position. + class position + { + public: + + /// Construct a position. + position () + : filename (0), line (1), column (0) + { + } + + + /// Initialization. + inline void initialize (std::string* fn) + { + filename = fn; + line = 1; + column = 0; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// (line related) Advance to the COUNT next lines. + inline void lines (int count = 1) + { + column = 0; + line += count; + } + + /// (column related) Advance to the COUNT next columns. + inline void columns (int count = 1) + { + int leftmost = 0; + int current = column; + if (leftmost <= current + count) + column += count; + else + column = 0; + } + /** \} */ + + public: + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + }; + + /// Add and assign a position. + inline const position& + operator+= (position& res, const int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) + { + position res = begin; + return res += width; + } + + /// Add and assign a position. + inline const position& + operator-= (position& res, const int width) + { + return res += -width; + } + + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) + { + return begin + -width; + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + inline std::ostream& + operator<< (std::ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + +} +#endif // not BISON_POSITION_HH diff --git a/buildtools/lib/parsers/qmake/qmake.ll b/buildtools/lib/parsers/qmake/qmake.ll new file mode 100644 index 00000000..715d60b3 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake.ll @@ -0,0 +1,237 @@ +%{ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#define DONT_INCLUDE_FLEXLEXER + +#include "qmake_lex.h" + +/** +@file qmake.ll +QMake Lexer + +There are 3 types of identifiers recognized by this lexer: +-id_simple: examples of such identifiers are qmake variables and scoped variables +at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp"); +-id_list: those are "value list identifiers" at the right side in assignments +(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp"); +-id_args: function arguments recognized as one identifier +(example: ""${QMAKE_FILE} is intended only for Windows!"" +in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements). +. + +To recognize those identifiers two additional start conditions are used: list and funcargs. + +@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to +the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped +so no indentation is preserved by this lexer (and parser). + +To debug this lexer, put the line below into the next flex file section. +%option debug +*/ +%} + +%option noyywrap +%option yylineno +%option c++ +%option yyclass="QMake::Lexer" + +%x vallist +%x funcargs + +delim [ \t] +ws {delim}+ +newline (\n|\r|\r\n) +quote "\"" +var_value [^#\r\n\t ]*[^\r\n\t \\] +quoted_var_value {quote}({var_value}|[\t ])({var_value}|[\t ])*{quote} +letter [A-Za-z] +digit [0-9] +id_simple ({digit}|{letter}|\!|-|_|\*|\$)({letter}|{digit}|\||\!|-|_|\*|\$|\.|\+)* +id_args [^\r\n]*\) +number {digit}+ +comment #[^\r\n]*{newline} +comment_cont (\\{ws}*#[^\r\n]*{newline}|#[^\r\n]*\\{newline}) +cont \\{ws}*{newline} + +%% +<> { + BEGIN(INITIAL); + return Parser::token::token::ENDOFFILE; +} +{ws} {} + +{ws} { + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::LIST_WS; +} + +{cont} { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::CONT; +} + +{comment_cont} { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::COMMENT_CONT; +} + +{id_simple} { + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return (Parser::token::token::ID_SIMPLE); +} + +{id_args} { + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + mylval->value = mylval->value.mid(0, mylval->value.length()-1); + unput(')'); + BEGIN(INITIAL); + return (Parser::token::token::ID_ARGS); + } + +{var_value} { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::VARIABLE_VALUE; +} + +{quoted_var_value} { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::QUOTED_VARIABLE_VALUE; +} + +"=" { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::EQ; +} + +"+=" { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::PLUSEQ; +} + +"-=" { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::MINUSEQ; +} + +"*=" { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::STAREQ; +} + +"~=" { + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::TILDEEQ; +} + +"{" { + return Parser::token::token::LCURLY; +} + +":"{delim}*"{" { + return Parser::token::token::LCURLY; +} + +"}" { + return Parser::token::token::RCURLY; +} + +"(" { + BEGIN(funcargs); + return Parser::token::token::LBRACE; +} + +")" { + BEGIN(INITIAL); + return Parser::token::token::RBRACE; +} + +":" { + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::COLON; +} + + +{ws}{newline} { + BEGIN(INITIAL); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + setLineEndingFromString( mylval->value ); + return Parser::token::token::NEWLINE; +} + +{newline} { + BEGIN(INITIAL); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + setLineEndingFromString( mylval->value ); + return Parser::token::token::NEWLINE; +} + +{comment} { + BEGIN(INITIAL); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return (Parser::token::token::COMMENT); +} + +%% +namespace QMake +{ + Lexer::Lexer( std::istream* argin, std::ostream* argout ) + : yyFlexLexer(argin, argout), mylval(0), m_lineEnding(None) + { + } + + int Lexer::yylex( QMake::Parser::semantic_type* yylval ) + { + mylval = yylval; + return yylex(); + } + + void Lexer::setLineEndingFromString( const QString& str ) + { + if( str.endsWith("\r\n") && m_lineEnding == None ) + m_lineEnding = Windows; + else if ( str.endsWith("\r") && m_lineEnding == None ) + m_lineEnding = MacOS; + else if ( m_lineEnding == None ) + m_lineEnding = Unix; + } + + Lexer::LineEnding Lexer::lineending() + { + return m_lineEnding; + } +} + +int QMakelex( QMake::Parser::semantic_type* yylval, QMake::Lexer* lexer) +{ + return lexer->yylex( yylval ); +} + diff --git a/buildtools/lib/parsers/qmake/qmake.yy b/buildtools/lib/parsers/qmake/qmake.yy new file mode 100644 index 00000000..9e6d378a --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake.yy @@ -0,0 +1,430 @@ +%{ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * Copyright (C) 2006 by Andreas Pakulat * + * apaku@gmx.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +/** +@file qmake.yy +QMake Parser + +Simple LALR parser which builds the syntax tree (see @ref QMake::AST). + +@todo Recognize comments after statements like: +SOURCES = foo #regognize me + +@fixme Parser fails on files that do not end with a newline +@fixme 1 shift/reduce conflict in "line_body" rule +*/ + +#include +#include "qmakeast.h" +#include + +#define YYSTYPE_IS_DECLARED + +namespace QMake +{ + class Lexer; + +/** +The yylval type. +*/ +struct Result { + Result(): node(0) {} + + /**Type of semantic value for simple grammar rules.*/ + QString value; + /**Type of semantic value for grammar rules which are parts of AST.*/ + AST *node; + /**Type of semantic value for "multiline_values" grammar rule. + Each line of multiline value is stored as a string in the list. + + For example we have in .pro file: + @code + SOURCE = foo1.cpp \ + foo2.cpp \ + foo3.cpp foo4.cpp + @endcode + The string list will be populated with three strings: +
+    foo1.cpp
+    foo2.cpp
+    foo3.cpp foo4.cpp
+    
+ */ + QStringList values; + QString indent; +}; + +#define YYSTYPE Result +typedef Result YYSTYPE; +} + +extern int QMakelex( QMake::Result* yylval, QMake::Lexer* lexer ); + +/** +The stack to store ProjectAST pointers when a new child +ProjectAST is created and filled with statements. + +Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts +adding statements. Each statement is added as a child StatementAST to the ProjectAST +currently on the top in the stack. + +When a scope or function scope statement is parsed, the child ProjectAST is created +and pushed onto the stack. Therefore all statements which belong to the scope +or function scope are added as childs to their direct parent (scope or function scope). +*/ +//QValueStack projects; + +/** +The current depth of AST node is stored here. +AST depth is important to know because automatic indentation can +be easily implemented (the parser itself looses all information +about indentation). +*/ +// int depth = 0; + +/* +To debug this parser, put the line below into the next bison file section. +Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. +%debug +*/ +%} + +%skeleton "lalr1.cc" +%define "parser_class_name" "Parser" +%name-prefix="QMake" +%parse-param { QMake::Lexer* lexer } +%parse-param { QValueStack& projects } +%parse-param { int depth } +%lex-param { QMake::Lexer* lexer } +%start project + +%token ID_SIMPLE +%token EQ +%token PLUSEQ +%token MINUSEQ +%token STAREQ +%token TILDEEQ +%token LBRACE +%token RBRACE +%token COLON +%token NEWLINE +%token COMMENT +%token CONT +%token COMMENT_CONT +%token RCURLY +%token LCURLY +%token ID_ARGS +%token QUOTED_VARIABLE_VALUE +%token VARIABLE_VALUE +%token LIST_WS +%token ENDOFFILE +%% + +project : + { + ProjectAST *projectAST = new ProjectAST(); + projects.push(projectAST); + } + statements + ; + +statements : statements statement + { + projects.top()->addChildAST($2); + $2->setDepth(depth); + } + | + ; + +statement : variable_assignment + { + $$ = $1; + } + | scope + { + $$ = $1; + } + | function_call + { + $$ = $1; + } + | comment + { + $$ = $1; + } + | emptyline + { + $$ = new NewLineAST(); + } + ; + +variable_assignment : ID_SIMPLE operator multiline_values listws NEWLINE + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values = $3 ; + node->values.append( $4 ); + node->values.append( $5 ); + node->indent = $3; + $$ = node; + } + | ID_SIMPLE operator multiline_values listws ENDOFFILE + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values = $3 ; + node->values.append( $4 ); + node->indent = $3; + $$ = node; + } + | ID_SIMPLE operator multiline_values listws CONT + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values = $3 ; + node->values.append( $4 ); + node->values.append( $5 ); + node->indent = $3; + $$ = node; + } + | ID_SIMPLE operator multiline_values listws COMMENT_CONT + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values = $3 ; + node->values.append( $4 ); + node->values.append( $5 ); + node->indent = $3; + $$ = node; + } + | ID_SIMPLE operator listws NEWLINE + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values.append( $3 ); + node->values.append( $4 ); + $$ = node; + } + | ID_SIMPLE operator listws ENDOFFILE + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values.append( $3 ); + $$ = node; + } + | ID_SIMPLE operator listws COMMENT + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values.append( $3 ); + node->values.append( $4 ); + $$ = node; + } + | ID_SIMPLE operator multiline_values listws COMMENT + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = $1; + node->op = $2; + node->values = $3; + node->values.append( $4 ); + node->values.append( $5 ); + node->indent = $3; + $$ = node; + } + ; + +possible_value : variable_value | COMMENT_CONT | CONT + +multiline_values : multiline_values LIST_WS possible_value + { + $$.append( $2 ); + $$.append( $3 ); + } + | multiline_values variable_value + { + $$.append( $2 ); + } + | multiline_values listws CONT listws possible_value + { + $$.append( $2 ); + $$.append( $3 ); + $$.append( $4 ); + $$.append( $5 ); + if( $4 != "" && $$ == "" ) + $$ = $4; + } + | multiline_values listws COMMENT_CONT listws possible_value + { + $$.append( $2 ); + $$.append( $3 ); + $$.append( $4 ); + $$.append( $5 ); + if( $4 != "" && $$ == "" ) + $$ = $4; + } + | listws possible_value + { + $$ = QStringList(); + $$.append( $1 ); + $$.append( $2 ); + } + ; + + +variable_value : VARIABLE_VALUE { $$ = $1; } + | QUOTED_VARIABLE_VALUE { $$ = $1; } + ; + + +listws: LIST_WS + { + $$ = $1; + $$ = $1; + } + | + { + $$ = QString(); + $$ = QString(); + } + ; +operator : EQ + { + $$ = $1; + } + | PLUSEQ + { + $$ = $1; + } + | MINUSEQ + { + $$ = $1; + } + | STAREQ + { + $$ = $1; + } + | TILDEEQ + { + $$ = $1; + } + ; + +scope : ID_SIMPLE + { + ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope); + projects.push(projectAST); + projects.top()->scopedID = $1; + depth++; + } + scope_body + { + $$ = projects.pop(); + depth--; + } + ; + +function_call : ID_SIMPLE LBRACE function_args RBRACE + { + ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope); + projects.push(projectAST); + projects.top()->scopedID = $1; + projects.top()->args = $3; + depth++; + + //qWarning("%s", $1.ascii()); + if ($1.contains("include")) + { + IncludeAST *includeAST = new IncludeAST(); + includeAST->projectName = $3; + projects.top()->addChildAST(includeAST); + includeAST->setDepth(depth); + } + } + scope_body + else_statement + { + $$ = projects.pop(); + depth--; + } + ; + +function_args : ID_ARGS { $$ = $1; } + | { $$ = ""; } + ; + +scope_body : LCURLY statements RCURLY + | COLON statement + { + projects.top()->addChildAST($2); + $2->setDepth(depth); + } + | + ; + +else_statement : "else" LCURLY + { + ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope); + projects.push(projectAST); + projects.top()->scopedID = "else"; + projects.top()->args = ""; + depth++; + } + scope_body RCURLY + { + $$ = projects.pop(); + depth--; + } + | + { + $$ = new ProjectAST(); + } + ; + +comment : COMMENT + { + CommentAST *node = new CommentAST(); + node->comment = $1; + $$ = node; + } + ; + +emptyline : NEWLINE + ; + +%% + + +namespace QMake +{ + void Parser::error(const location_type& /*l*/, const std::string& m) + { + std::cerr << m << std::endl; + } +} diff --git a/buildtools/lib/parsers/qmake/qmake_lex.cpp b/buildtools/lib/parsers/qmake/qmake_lex.cpp new file mode 100644 index 00000000..b49677fe --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake_lex.cpp @@ -0,0 +1,2239 @@ +#line 2 "qmake_lex.cpp" + +#line 4 "qmake_lex.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 33 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* %if-c++-only */ + /* The c++ scanner is a mess. The FlexLexer.h header file relies on the + * following macro. This is required in order to pass the c++-multiple-scanners + * test in the regression suite. We get reports that it breaks inheritance. + * We will address this in a future release of flex, or omit the C++ scanner + * altogether. + */ + #define yyFlexLexer yyFlexLexer +/* %endif */ + +/* %if-c-only */ +/* %endif */ + +/* %if-c-only */ +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ +/* %endif */ + +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* begin standard C++ headers. */ +#include +#include +#include +#include +/* end standard C++ headers. */ +/* %endif */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* %not-for-header */ + +/* Returned upon end-of-file. */ +#define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +/* %if-not-reentrant */ +extern int yyleng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +/* %endif */ +/* %endif */ + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { +/* %if-c-only */ +/* %endif */ + +/* %if-c++-only */ + std::istream* yy_input_file; +/* %endif */ + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* %if-c-only Standard (non-C++) definition */ +/* %if-not-reentrant */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ +/* %endif */ + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ +/* Begin user sect3 */ + +#define yywrap() 1 +#define YY_SKIP_YYWRAP + +#define FLEX_DEBUG + +typedef unsigned char YY_CHAR; + +#define yytext_ptr yytext +#define YY_INTERACTIVE + +#include +int yyFlexLexer::yylex() + { + LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" ); + return 0; + } + +#define YY_DECL int QMake::Lexer::yylex() + +/* %if-c-only Standard (non-C++) definition */ +/* %endif */ + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; + +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ +#define YY_NUM_RULES 23 +#define YY_END_OF_BUFFER 24 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[76] = + { 0, + 0, 0, 0, 0, 0, 0, 24, 23, 1, 21, + 21, 5, 23, 17, 18, 5, 23, 5, 19, 9, + 23, 14, 16, 23, 7, 2, 7, 7, 23, 23, + 6, 1, 21, 5, 0, 22, 22, 0, 12, 10, + 11, 0, 15, 0, 3, 3, 0, 13, 7, 7, + 0, 2, 20, 20, 7, 0, 7, 0, 7, 0, + 6, 4, 4, 0, 4, 4, 7, 0, 7, 7, + 0, 0, 8, 0, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 8, 1, 1, 1, 9, + 10, 11, 12, 1, 13, 14, 1, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 16, 1, 1, + 17, 1, 1, 1, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 1, 19, 1, 1, 20, 1, 18, 18, 18, 18, + + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 21, 22, 23, 24, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[25] = + { 0, + 1, 2, 3, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[85] = + { 0, + 0, 0, 23, 41, 28, 30, 132, 289, 126, 289, + 123, 56, 32, 289, 289, 106, 105, 104, 35, 289, + 77, 289, 289, 103, 34, 55, 47, 69, 87, 108, + 106, 111, 289, 0, 79, 289, 96, 82, 289, 289, + 289, 44, 289, 0, 289, 90, 59, 289, 68, 289, + 85, 93, 289, 74, 105, 123, 141, 98, 99, 45, + 42, 289, 47, 105, 289, 36, 159, 177, 195, 213, + 108, 231, 249, 112, 289, 268, 271, 274, 27, 277, + 279, 281, 284, 286 + } ; + +static yyconst flex_int16_t yy_def[85] = + { 0, + 75, 1, 76, 76, 77, 77, 75, 75, 75, 75, + 75, 75, 78, 75, 75, 12, 75, 12, 75, 75, + 75, 75, 75, 75, 79, 75, 80, 78, 79, 81, + 81, 75, 75, 12, 78, 75, 75, 78, 75, 75, + 75, 75, 75, 21, 75, 75, 82, 75, 79, 75, + 79, 75, 75, 75, 83, 84, 84, 80, 82, 81, + 81, 75, 75, 82, 75, 75, 83, 84, 83, 84, + 83, 84, 84, 84, 0, 75, 75, 75, 75, 75, + 75, 75, 75, 75 + } ; + +static yyconst flex_int16_t yy_nxt[314] = + { 0, + 8, 9, 10, 11, 12, 8, 13, 12, 14, 15, + 16, 17, 18, 8, 12, 19, 20, 12, 21, 12, + 22, 8, 23, 24, 26, 10, 11, 49, 27, 28, + 8, 8, 8, 8, 36, 37, 42, 31, 65, 31, + 50, 29, 26, 10, 11, 42, 27, 28, 56, 62, + 38, 61, 51, 57, 61, 43, 52, 53, 54, 29, + 34, 65, 66, 34, 43, 58, 34, 34, 34, 34, + 34, 36, 37, 34, 50, 34, 53, 34, 44, 45, + 46, 36, 37, 47, 62, 63, 51, 38, 44, 45, + 46, 50, 45, 59, 52, 53, 54, 38, 36, 75, + + 38, 65, 66, 51, 57, 51, 68, 65, 66, 75, + 69, 70, 32, 75, 70, 61, 58, 61, 68, 48, + 41, 40, 39, 71, 68, 33, 71, 32, 73, 68, + 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 74, 68, 75, 75, 75, 73, 68, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, + 68, 75, 75, 75, 69, 70, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 71, 68, 75, + 75, 75, 73, 68, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 74, 68, 75, 75, 75, + + 69, 70, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 71, 68, 75, 75, 75, 73, 68, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 74, 68, 75, 75, 75, 73, 68, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, + 68, 75, 75, 75, 73, 68, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 74, 25, 25, + 25, 30, 30, 30, 35, 35, 35, 55, 55, 60, + 60, 64, 64, 64, 67, 67, 72, 72, 7, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75 + } ; + +static yyconst flex_int16_t yy_chk[314] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 3, 79, 3, 3, + 5, 5, 6, 6, 13, 13, 19, 5, 66, 6, + 25, 3, 4, 4, 4, 42, 4, 4, 27, 63, + 13, 61, 25, 27, 60, 19, 26, 26, 26, 4, + 12, 47, 47, 12, 42, 27, 12, 12, 12, 12, + 12, 28, 28, 12, 49, 12, 54, 12, 21, 21, + 21, 35, 35, 21, 38, 38, 49, 28, 29, 29, + 29, 51, 46, 29, 52, 52, 52, 35, 37, 58, + + 38, 59, 59, 51, 58, 29, 55, 64, 64, 71, + 55, 55, 32, 74, 71, 31, 58, 30, 74, 24, + 18, 17, 16, 55, 56, 11, 71, 9, 56, 56, + 74, 7, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 56, 57, 0, 0, 0, 57, 57, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, + 67, 0, 0, 0, 67, 67, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 67, 68, 0, + 0, 0, 68, 68, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 68, 69, 0, 0, 0, + + 69, 69, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 69, 70, 0, 0, 0, 70, 70, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 70, 72, 0, 0, 0, 72, 72, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 73, 0, 0, 0, 73, 73, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 73, 76, 76, + 76, 77, 77, 77, 78, 78, 78, 80, 80, 81, + 81, 82, 82, 82, 83, 83, 84, 84, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[24] = + { 0, +0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 0, }; + +static yyconst flex_int16_t yy_rule_linenum[23] = + { 0, + 81, 83, 88, 94, 100, 105, 113, 119, 125, 131, + 137, 143, 149, 155, 159, 163, 167, 172, 177, 183, + 190, 197 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "qmake.ll" +#line 2 "qmake.ll" +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#define DONT_INCLUDE_FLEXLEXER + +#include "qmake_lex.h" + +/** +@file qmake.ll +QMake Lexer + +There are 3 types of identifiers recognized by this lexer: +-id_simple: examples of such identifiers are qmake variables and scoped variables +at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp"); +-id_list: those are "value list identifiers" at the right side in assignments +(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp"); +-id_args: function arguments recognized as one identifier +(example: ""${QMAKE_FILE} is intended only for Windows!"" +in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements). +. + +To recognize those identifiers two additional start conditions are used: list and funcargs. + +@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to +the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped +so no indentation is preserved by this lexer (and parser). + +To debug this lexer, put the line below into the next flex file section. +%option debug +*/ + + +#line 657 "qmake_lex.cpp" + +#define INITIAL 0 +#define vallist 1 +#define funcargs 2 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +#include +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-c-only */ +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif End reentrant structures and macros. */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ +#endif + +/* %if-c-only */ +/* %endif */ + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ +/* %endif */ +/* %if-c++-only C++ definition */ +#define ECHO LexerOutput( yytext, yyleng ) +/* %endif */ +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ +\ +/* %if-c++-only C++ definition \ */\ + if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +/* %endif */ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +#define YY_FATAL_ERROR(msg) LexerError( msg ) +/* %endif */ +#endif + +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ +/* %endif */ +/* %if-c++-only C++ definition */ +#define YY_DECL int yyFlexLexer::yylex() +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +/* %% [6.0] YY_RULE_SETUP definition goes here */ +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +/* %% [7.0] user's declarations go here */ +#line 76 "qmake.ll" + +#line 818 "qmake_lex.cpp" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + yyin = & std::cin; +/* %endif */ + + if ( ! yyout ) +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + yyout = & std::cout; +/* %endif */ + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 76 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 289 ); + +yy_find_action: +/* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +/* %% [11.0] code for yylineno update goes here */ + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; +; + } + +do_action: /* This label is used only to access EOF actions. */ + +/* %% [12.0] debug code goes here */ + if ( yy_flex_debug ) + { + if ( yy_act == 0 ) + std::cerr << "--scanner backing up\n"; + else if ( yy_act < 23 ) + std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] << + "(\"" << yytext << "\")\n"; + else if ( yy_act == 23 ) + std::cerr << "--accepting default rule (\"" << yytext << "\")\n"; + else if ( yy_act == 24 ) + std::cerr << "--(end of buffer or a NUL)\n"; + else + std::cerr << "--EOF (start condition " << YY_START << ")\n"; + } + + switch ( yy_act ) + { /* beginning of action switch */ +/* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case YY_STATE_EOF(vallist): +#line 77 "qmake.ll" +{ + BEGIN(INITIAL); + return Parser::token::token::ENDOFFILE; +} + YY_BREAK +case 1: +YY_RULE_SETUP +#line 81 "qmake.ll" +{} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 83 "qmake.ll" +{ + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::LIST_WS; +} + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 88 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::CONT; +} + YY_BREAK +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +#line 94 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::COMMENT_CONT; +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 100 "qmake.ll" +{ + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return (Parser::token::token::ID_SIMPLE); +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 105 "qmake.ll" +{ + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + mylval->value = mylval->value.mid(0, mylval->value.length()-1); + unput(')'); + BEGIN(INITIAL); + return (Parser::token::token::ID_ARGS); + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 113 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::VARIABLE_VALUE; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 119 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::QUOTED_VARIABLE_VALUE; +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 125 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::EQ; +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 131 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::PLUSEQ; +} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 137 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::MINUSEQ; +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 143 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::STAREQ; +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 149 "qmake.ll" +{ + BEGIN(vallist); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::TILDEEQ; +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 155 "qmake.ll" +{ + return Parser::token::token::LCURLY; +} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 159 "qmake.ll" +{ + return Parser::token::token::LCURLY; +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 163 "qmake.ll" +{ + return Parser::token::token::RCURLY; +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 167 "qmake.ll" +{ + BEGIN(funcargs); + return Parser::token::token::LBRACE; +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 172 "qmake.ll" +{ + BEGIN(INITIAL); + return Parser::token::token::RBRACE; +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 177 "qmake.ll" +{ + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return Parser::token::token::COLON; +} + YY_BREAK +case 20: +/* rule 20 can match eol */ +YY_RULE_SETUP +#line 183 "qmake.ll" +{ + BEGIN(INITIAL); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + setLineEndingFromString( mylval->value ); + return Parser::token::token::NEWLINE; +} + YY_BREAK +case 21: +/* rule 21 can match eol */ +YY_RULE_SETUP +#line 190 "qmake.ll" +{ + BEGIN(INITIAL); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + setLineEndingFromString( mylval->value ); + return Parser::token::token::NEWLINE; +} + YY_BREAK +case 22: +/* rule 22 can match eol */ +YY_RULE_SETUP +#line 197 "qmake.ll" +{ + BEGIN(INITIAL); + mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() ); + return (Parser::token::token::COMMENT); +} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 203 "qmake.ll" +ECHO; + YY_BREAK +#line 1145 "qmake_lex.cpp" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(funcargs): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ +/* %ok-for-header */ + +/* %if-c++-only */ +/* %not-for-header */ + +yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) +{ + yyin = arg_yyin; + yyout = arg_yyout; + yy_c_buf_p = 0; + yy_init = 0; + yy_start = 0; + yy_flex_debug = 0; + yylineno = 1; // this will only get updated if %option yylineno + + yy_did_buffer_switch_on_eof = 0; + + yy_looking_for_trail_begin = 0; + yy_more_flag = 0; + yy_more_len = 0; + yy_more_offset = yy_prev_more_offset = 0; + + yy_start_stack_ptr = yy_start_stack_depth = 0; + yy_start_stack = NULL; + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + + yy_state_buf = 0; + +} + +void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) +{ + if ( new_in ) + { + yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); + } + + if ( new_out ) + yyout = new_out; +} + +#ifdef YY_INTERACTIVE +int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) +#else +int yyFlexLexer::LexerInput( char* buf, int max_size ) +#endif +{ + if ( yyin->eof() || yyin->fail() ) + return 0; + +#ifdef YY_INTERACTIVE + yyin->get( buf[0] ); + + if ( yyin->eof() ) + return 0; + + if ( yyin->bad() ) + return -1; + + return 1; + +#else + (void) yyin->read( buf, max_size ); + + if ( yyin->bad() ) + return -1; + else + return yyin->gcount(); +#endif +} + +void yyFlexLexer::LexerOutput( const char* buf, int size ) +{ + (void) yyout->write( buf, size ); +} +/* %ok-for-header */ + +/* %endif */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +int yyFlexLexer::yy_get_next_buffer() +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +/* %if-c-only */ +/* %not-for-header */ + +/* %endif */ +/* %if-c++-only */ + yy_state_type yyFlexLexer::yy_get_previous_state() +/* %endif */ +{ + register yy_state_type yy_current_state; + register char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { +/* %% [16.0] code to find the next state goes here */ + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 76 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +/* %endif */ +{ + register int yy_is_jam; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 76 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 75); + + return yy_is_jam ? 0 : yy_current_state; +} + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yyunput( int c, register char* yy_bp) +/* %endif */ +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +/* %% [18.0] update yylineno here */ + + if ( c == '\n' ){ + --yylineno; + } + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} +/* %if-c-only */ +/* %endif */ + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + int yyFlexLexer::yyinput() +/* %endif */ +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + +/* %% [19.0] update BOL and yylineno */ + if ( c == '\n' ) + + yylineno++; +; + + return c; +} +/* %if-c-only */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yyrestart( std::istream* input_file ) +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_load_buffer_state() +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) +/* %endif */ +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +/* %endif */ +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +/* %if-c-only */ +/* %endif */ + +/* %if-c++-only */ + +extern "C" int isatty (int ); + +/* %endif */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) +/* %endif */ + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + b->yy_is_interactive = 0; +/* %endif */ + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +/* %endif */ +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) +/* %endif */ +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +void yyFlexLexer::yypop_buffer_state (void) +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +void yyFlexLexer::yyensure_buffer_stack(void) +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/* %endif */ + +/* %if-c-only */ +/* %endif */ + +/* %if-c-only */ +/* %endif */ + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_push_state( int new_state ) +/* %endif */ +{ + if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) + { + yy_size_t new_size; + + (yy_start_stack_depth) += YY_START_STACK_INCR; + new_size = (yy_start_stack_depth) * sizeof( int ); + + if ( ! (yy_start_stack) ) + (yy_start_stack) = (int *) yyalloc(new_size ); + + else + (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size ); + + if ( ! (yy_start_stack) ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; + + BEGIN(new_state); +} + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + void yyFlexLexer::yy_pop_state() +/* %endif */ +{ + if ( --(yy_start_stack_ptr) < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); +} + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ + int yyFlexLexer::yy_top_state() +/* %endif */ +{ + return (yy_start_stack)[(yy_start_stack_ptr) - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +void yyFlexLexer::LexerError( yyconst char msg[] ) +{ + std::cerr << msg << std::endl; + exit( YY_EXIT_FAILURE ); +} +/* %endif */ + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ +/* %if-reentrant */ +/* %endif */ +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif */ + +/* %if-c-only */ +/* %endif */ + +/* %if-c-or-c++ */ +/* %if-c-only */ +/* %endif */ +/* %if-c++-only */ +yyFlexLexer::~yyFlexLexer() +/* %endif */ +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + +/* %if-c++-only */ + delete [] (yy_state_buf); + yyfree((yy_start_stack) ); +/* %endif */ + +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ +/* %endif */ +} +/* %endif */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#line 203 "qmake.ll" + + +namespace QMake +{ + Lexer::Lexer( std::istream* argin, std::ostream* argout ) + : yyFlexLexer(argin, argout), mylval(0), m_lineEnding(None) + { + } + + int Lexer::yylex( QMake::Parser::semantic_type* yylval ) + { + mylval = yylval; + return yylex(); + } + + void Lexer::setLineEndingFromString( const QString& str ) + { + if( str.endsWith("\r\n") && m_lineEnding == None ) + m_lineEnding = Windows; + else if ( str.endsWith("\r") && m_lineEnding == None ) + m_lineEnding = MacOS; + else if ( m_lineEnding == None ) + m_lineEnding = Unix; + } + + Lexer::LineEnding Lexer::lineending() + { + return m_lineEnding; + } +} + +int QMakelex( QMake::Parser::semantic_type* yylval, QMake::Lexer* lexer) +{ + return lexer->yylex( yylval ); +} + + diff --git a/buildtools/lib/parsers/qmake/qmake_lex.h b/buildtools/lib/parsers/qmake/qmake_lex.h new file mode 100644 index 00000000..1b91e747 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake_lex.h @@ -0,0 +1,49 @@ +/* KDevelop QMake Support + * + * Copyright 2007 Andreas Pakulat + * + * 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; either version 2 + * of the License, or (at your option) any later version. + * + * 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. + */ +#ifndef QMAKE_LEX_H +#define QMAKE_LEX_H + +#include "qmake_yacc.hpp" +#include + +#ifndef DONT_INCLUDE_FLEXLEXER +#include "FlexLexer.h" +#endif + +namespace QMake +{ + class Lexer : public yyFlexLexer + { + public: + enum LineEnding{ None, Unix, MacOS, Windows }; + Lexer( std::istream* argin = 0, std::ostream* argout = 0 ); + int yylex( QMake::Parser::semantic_type* yylval ); + int yylex(); + void setLineEndingFromString( const QString& ); + LineEnding lineending(); + private: + QMake::Parser::semantic_type* mylval; + LineEnding m_lineEnding; + }; +} + +#endif + +// kate: space-indent on; indent-width 4; tab-width: 4; replace-tabs on; auto-insert-doxygen on diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.cpp b/buildtools/lib/parsers/qmake/qmake_yacc.cpp new file mode 100644 index 00000000..9cd09ebe --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake_yacc.cpp @@ -0,0 +1,1243 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton implementation for Bison LALR(1) parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +// Take the name prefix into account. +#define yylex QMakelex + +#include "qmake_yacc.hpp" + +/* User implementation prologue. */ + + +/* Line 317 of lalr1.cc. */ +#line 45 "qmake_yacc.cpp" + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* FIXME: INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#define YYUSE(e) ((void) (e)) + +/* A pseudo ostream that takes yydebug_ into account. */ +# define YYCDEBUG \ + for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ + (*yycdebug_) + +/* Enable debugging if requested. */ +#if YYDEBUG + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_symbol_print_ ((Type), (Value), (Location)); \ + *yycdebug_ << std::endl; \ + } \ +} while (false) + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ +} while (false) + +# define YY_STACK_PRINT() \ +do { \ + if (yydebug_) \ + yystack_print_ (); \ +} while (false) + +#else /* !YYDEBUG */ + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_REDUCE_PRINT(Rule) +# define YY_STACK_PRINT() + +#endif /* !YYDEBUG */ + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + +namespace QMake +{ +#if YYERROR_VERBOSE + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + Parser::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr = ""; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + +#endif + + /// Build a parser object. + Parser::Parser (QMake::Lexer* lexer_yyarg, QValueStack& projects_yyarg, int depth_yyarg) + : yydebug_ (false), + yycdebug_ (&std::cerr), + lexer (lexer_yyarg), + projects (projects_yyarg), + depth (depth_yyarg) + { + } + + Parser::~Parser () + { + } + +#if YYDEBUG + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + inline void + Parser::yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yyvaluep); + switch (yytype) + { + default: + break; + } + } + + + void + Parser::yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << *yylocationp << ": "; + yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); + *yycdebug_ << ')'; + } +#endif /* ! YYDEBUG */ + + void + Parser::yydestruct_ (const char* yymsg, + int yytype, semantic_type* yyvaluep, location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yymsg); + YYUSE (yyvaluep); + + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } + } + + void + Parser::yypop_ (unsigned int n) + { + yystate_stack_.pop (n); + yysemantic_stack_.pop (n); + yylocation_stack_.pop (n); + } + + std::ostream& + Parser::debug_stream () const + { + return *yycdebug_; + } + + void + Parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + Parser::debug_level_type + Parser::debug_level () const + { + return yydebug_; + } + + void + Parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } + + + int + Parser::parse () + { + /// Look-ahead and look-ahead in internal form. + int yychar = yyempty_; + int yytoken = 0; + + /* State. */ + int yyn; + int yylen = 0; + int yystate = 0; + + /* Error handling. */ + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// Semantic value of the look-ahead. + semantic_type yylval; + /// Location of the look-ahead. + location_type yylloc; + /// The locations where the error started and ended. + location yyerror_range[2]; + + /// $$. + semantic_type yyval; + /// @$. + location_type yyloc; + + int yyresult; + + YYCDEBUG << "Starting parse" << std::endl; + + + /* Initialize the stacks. The initial state will be pushed in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystate_stack_ = state_stack_type (0); + yysemantic_stack_ = semantic_stack_type (0); + yylocation_stack_ = location_stack_type (0); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* New state. */ + yynewstate: + yystate_stack_.push (yystate); + YYCDEBUG << "Entering state " << yystate << std::endl; + goto yybackup; + + /* Backup. */ + yybackup: + + /* Try to take a decision without look-ahead. */ + yyn = yypact_[yystate]; + if (yyn == yypact_ninf_) + goto yydefault; + + /* Read a look-ahead token. */ + if (yychar == yyempty_) + { + YYCDEBUG << "Reading a token: "; + yychar = yylex (&yylval, lexer); + } + + + /* Convert token to internal form. */ + if (yychar <= yyeof_) + { + yychar = yytoken = yyeof_; + YYCDEBUG << "Now at end of input." << std::endl; + } + else + { + yytoken = yytranslate_ (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) + goto yydefault; + + /* Reduce or error. */ + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == yytable_ninf_) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Accept? */ + if (yyn == yyfinal_) + goto yyacceptlab; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != yyeof_) + yychar = yyempty_; + + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus_) + --yyerrstatus_; + + yystate = yyn; + goto yynewstate; + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. */ + if (yylen) + yyval = yysemantic_stack_[yylen - 1]; + else + yyval = yysemantic_stack_[0]; + + { + slice slice (yylocation_stack_, yylen); + YYLLOC_DEFAULT (yyloc, slice, yylen); + } + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 144 "qmake.yy" + { + ProjectAST *projectAST = new ProjectAST(); + projects.push(projectAST); + ;} + break; + + case 4: +#line 152 "qmake.yy" + { + projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node)); + (yysemantic_stack_[(2) - (2)].node)->setDepth(depth); + ;} + break; + + case 6: +#line 160 "qmake.yy" + { + (yyval.node) = (yysemantic_stack_[(1) - (1)].node); + ;} + break; + + case 7: +#line 164 "qmake.yy" + { + (yyval.node) = (yysemantic_stack_[(1) - (1)].node); + ;} + break; + + case 8: +#line 168 "qmake.yy" + { + (yyval.node) = (yysemantic_stack_[(1) - (1)].node); + ;} + break; + + case 9: +#line 172 "qmake.yy" + { + (yyval.node) = (yysemantic_stack_[(1) - (1)].node); + ;} + break; + + case 10: +#line 176 "qmake.yy" + { + (yyval.node) = new NewLineAST(); + ;} + break; + + case 11: +#line 182 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(5) - (1)].value); + node->op = (yysemantic_stack_[(5) - (2)].value); + node->values = (yysemantic_stack_[(5) - (3)].values) ; + node->values.append( (yysemantic_stack_[(5) - (4)].value) ); + node->values.append( (yysemantic_stack_[(5) - (5)].value) ); + node->indent = (yysemantic_stack_[(5) - (3)].indent); + (yyval.node) = node; + ;} + break; + + case 12: +#line 193 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(5) - (1)].value); + node->op = (yysemantic_stack_[(5) - (2)].value); + node->values = (yysemantic_stack_[(5) - (3)].values) ; + node->values.append( (yysemantic_stack_[(5) - (4)].value) ); + node->indent = (yysemantic_stack_[(5) - (3)].indent); + (yyval.node) = node; + ;} + break; + + case 13: +#line 203 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(5) - (1)].value); + node->op = (yysemantic_stack_[(5) - (2)].value); + node->values = (yysemantic_stack_[(5) - (3)].values) ; + node->values.append( (yysemantic_stack_[(5) - (4)].value) ); + node->values.append( (yysemantic_stack_[(5) - (5)].value) ); + node->indent = (yysemantic_stack_[(5) - (3)].indent); + (yyval.node) = node; + ;} + break; + + case 14: +#line 214 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(5) - (1)].value); + node->op = (yysemantic_stack_[(5) - (2)].value); + node->values = (yysemantic_stack_[(5) - (3)].values) ; + node->values.append( (yysemantic_stack_[(5) - (4)].value) ); + node->values.append( (yysemantic_stack_[(5) - (5)].value) ); + node->indent = (yysemantic_stack_[(5) - (3)].indent); + (yyval.node) = node; + ;} + break; + + case 15: +#line 225 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(4) - (1)].value); + node->op = (yysemantic_stack_[(4) - (2)].value); + node->values.append( (yysemantic_stack_[(4) - (3)].value) ); + node->values.append( (yysemantic_stack_[(4) - (4)].value) ); + (yyval.node) = node; + ;} + break; + + case 16: +#line 234 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(4) - (1)].value); + node->op = (yysemantic_stack_[(4) - (2)].value); + node->values.append( (yysemantic_stack_[(4) - (3)].value) ); + (yyval.node) = node; + ;} + break; + + case 17: +#line 242 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(4) - (1)].value); + node->op = (yysemantic_stack_[(4) - (2)].value); + node->values.append( (yysemantic_stack_[(4) - (3)].value) ); + node->values.append( (yysemantic_stack_[(4) - (4)].value) ); + (yyval.node) = node; + ;} + break; + + case 18: +#line 251 "qmake.yy" + { + AssignmentAST *node = new AssignmentAST(); + node->scopedID = (yysemantic_stack_[(5) - (1)].value); + node->op = (yysemantic_stack_[(5) - (2)].value); + node->values = (yysemantic_stack_[(5) - (3)].values); + node->values.append( (yysemantic_stack_[(5) - (4)].value) ); + node->values.append( (yysemantic_stack_[(5) - (5)].value) ); + node->indent = (yysemantic_stack_[(5) - (3)].indent); + (yyval.node) = node; + ;} + break; + + case 22: +#line 266 "qmake.yy" + { + (yyval.values).append( (yysemantic_stack_[(3) - (2)].value) ); + (yyval.values).append( (yysemantic_stack_[(3) - (3)].value) ); + ;} + break; + + case 23: +#line 271 "qmake.yy" + { + (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) ); + ;} + break; + + case 24: +#line 275 "qmake.yy" + { + (yyval.values).append( (yysemantic_stack_[(5) - (2)].value) ); + (yyval.values).append( (yysemantic_stack_[(5) - (3)].value) ); + (yyval.values).append( (yysemantic_stack_[(5) - (4)].value) ); + (yyval.values).append( (yysemantic_stack_[(5) - (5)].value) ); + if( (yysemantic_stack_[(5) - (4)].indent) != "" && (yyval.indent) == "" ) + (yyval.indent) = (yysemantic_stack_[(5) - (4)].indent); + ;} + break; + + case 25: +#line 284 "qmake.yy" + { + (yyval.values).append( (yysemantic_stack_[(5) - (2)].value) ); + (yyval.values).append( (yysemantic_stack_[(5) - (3)].value) ); + (yyval.values).append( (yysemantic_stack_[(5) - (4)].value) ); + (yyval.values).append( (yysemantic_stack_[(5) - (5)].value) ); + if( (yysemantic_stack_[(5) - (4)].indent) != "" && (yyval.indent) == "" ) + (yyval.indent) = (yysemantic_stack_[(5) - (4)].indent); + ;} + break; + + case 26: +#line 293 "qmake.yy" + { + (yyval.values) = QStringList(); + (yyval.values).append( (yysemantic_stack_[(2) - (1)].value) ); + (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) ); + ;} + break; + + case 27: +#line 301 "qmake.yy" + { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;} + break; + + case 28: +#line 302 "qmake.yy" + { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;} + break; + + case 29: +#line 307 "qmake.yy" + { + (yyval.value) = (yysemantic_stack_[(1) - (1)].value); + (yyval.indent) = (yysemantic_stack_[(1) - (1)].value); + ;} + break; + + case 30: +#line 312 "qmake.yy" + { + (yyval.value) = QString(); + (yyval.indent) = QString(); + ;} + break; + + case 31: +#line 318 "qmake.yy" + { + (yyval.value) = (yysemantic_stack_[(1) - (1)].value); + ;} + break; + + case 32: +#line 322 "qmake.yy" + { + (yyval.value) = (yysemantic_stack_[(1) - (1)].value); + ;} + break; + + case 33: +#line 326 "qmake.yy" + { + (yyval.value) = (yysemantic_stack_[(1) - (1)].value); + ;} + break; + + case 34: +#line 330 "qmake.yy" + { + (yyval.value) = (yysemantic_stack_[(1) - (1)].value); + ;} + break; + + case 35: +#line 334 "qmake.yy" + { + (yyval.value) = (yysemantic_stack_[(1) - (1)].value); + ;} + break; + + case 36: +#line 340 "qmake.yy" + { + ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope); + projects.push(projectAST); + projects.top()->scopedID = (yysemantic_stack_[(1) - (1)].value); + depth++; + ;} + break; + + case 37: +#line 347 "qmake.yy" + { + (yyval.node) = projects.pop(); + depth--; + ;} + break; + + case 38: +#line 354 "qmake.yy" + { + ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope); + projects.push(projectAST); + projects.top()->scopedID = (yysemantic_stack_[(4) - (1)].value); + projects.top()->args = (yysemantic_stack_[(4) - (3)].value); + depth++; + + //qWarning("%s", $1.ascii()); + if ((yysemantic_stack_[(4) - (1)].value).contains("include")) + { + IncludeAST *includeAST = new IncludeAST(); + includeAST->projectName = (yysemantic_stack_[(4) - (3)].value); + projects.top()->addChildAST(includeAST); + includeAST->setDepth(depth); + } + ;} + break; + + case 39: +#line 372 "qmake.yy" + { + (yyval.node) = projects.pop(); + depth--; + ;} + break; + + case 40: +#line 378 "qmake.yy" + { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;} + break; + + case 41: +#line 379 "qmake.yy" + { (yyval.value) = ""; ;} + break; + + case 43: +#line 384 "qmake.yy" + { + projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node)); + (yysemantic_stack_[(2) - (2)].node)->setDepth(depth); + ;} + break; + + case 45: +#line 392 "qmake.yy" + { + ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope); + projects.push(projectAST); + projects.top()->scopedID = "else"; + projects.top()->args = ""; + depth++; + ;} + break; + + case 46: +#line 400 "qmake.yy" + { + (yyval.node) = projects.pop(); + depth--; + ;} + break; + + case 47: +#line 405 "qmake.yy" + { + (yyval.node) = new ProjectAST(); + ;} + break; + + case 48: +#line 411 "qmake.yy" + { + CommentAST *node = new CommentAST(); + node->comment = (yysemantic_stack_[(1) - (1)].value); + (yyval.node) = node; + ;} + break; + + + /* Line 675 of lalr1.cc. */ +#line 756 "qmake_yacc.cpp" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); + + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + yysemantic_stack_.push (yyval); + yylocation_stack_.push (yyloc); + + /* Shift the result of the reduction. */ + yyn = yyr1_[yyn]; + yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0]; + if (0 <= yystate && yystate <= yylast_ + && yycheck_[yystate] == yystate_stack_[0]) + yystate = yytable_[yystate]; + else + yystate = yydefgoto_[yyn - yyntokens_]; + goto yynewstate; + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus_) + { + ++yynerrs_; + error (yylloc, yysyntax_error_ (yystate)); + } + + yyerror_range[0] = yylloc; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= yyeof_) + { + /* Return failure if at end of input. */ + if (yychar == yyeof_) + YYABORT; + } + else + { + yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); + yychar = yyempty_; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (false) + goto yyerrorlab; + + yyerror_range[0] = yylocation_stack_[yylen - 1]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + yystate = yystate_stack_[0]; + goto yyerrlab1; + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact_[yystate]; + if (yyn != yypact_ninf_) + { + yyn += yyterror_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yystate_stack_.height () == 1) + YYABORT; + + yyerror_range[0] = yylocation_stack_[0]; + yydestruct_ ("Error: popping", + yystos_[yystate], + &yysemantic_stack_[0], &yylocation_stack_[0]); + yypop_ (); + yystate = yystate_stack_[0]; + YY_STACK_PRINT (); + } + + if (yyn == yyfinal_) + goto yyacceptlab; + + yyerror_range[1] = yylloc; + // Using YYLLOC is tempting, but would change the location of + // the look-ahead. YYLOC is available though. + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yyloc); + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], + &yysemantic_stack_[0], &yylocation_stack_[0]); + + yystate = yyn; + goto yynewstate; + + /* Accept. */ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + /* Abort. */ + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyreturn: + if (yychar != yyeof_ && yychar != yyempty_) + yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); + + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (yystate_stack_.height () != 1) + { + yydestruct_ ("Cleanup: popping", + yystos_[yystate_stack_[0]], + &yysemantic_stack_[0], + &yylocation_stack_[0]); + yypop_ (); + } + + return yyresult; + } + + // Generate an error message. + std::string + Parser::yysyntax_error_ (int yystate) + { + std::string res; + YYUSE (yystate); +#if YYERROR_VERBOSE + int yyn = yypact_[yystate]; + if (yypact_ninf_ < yyn && yyn <= yylast_) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = yylast_ - yyn + 1; + int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; + int count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn] == x && x != yyterror_) + ++count; + + // FIXME: This method of building the message is not compatible + // with internationalization. It should work like yacc.c does it. + // That is, first build a string that looks like this: + // "syntax error, unexpected %s or %s or %s" + // Then, invoke YY_ on this string. + // Finally, use the string as a format to output + // yytname_[tok], etc. + // Until this gets fixed, this message appears in English only. + res = "syntax error, unexpected "; + res += yytnamerr_ (yytname_[tok]); + if (count < 5) + { + count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn] == x && x != yyterror_) + { + res += (!count++) ? ", expecting " : " or "; + res += yytnamerr_ (yytname_[x]); + } + } + } + else +#endif + res = YY_("syntax error"); + return res; + } + + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + const signed char Parser::yypact_ninf_ = -44; + const signed char + Parser::yypact_[] = + { + -44, 19, -44, -44, 8, 45, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, 12, + 10, 31, -44, 24, -44, -15, -5, 8, -44, -44, + -44, -44, -44, 26, -44, 14, -44, -44, -44, -44, + -44, -44, -44, -44, 0, 31, -44, -44, -44, 18, + 18, -44, -44, 20, 26, 26, 27, -44, -44, -44, + -44, 31, 39, -44 + }; + + /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ + const unsigned char + Parser::yydefact_[] = + { + 2, 0, 5, 1, 3, 36, 49, 48, 4, 6, + 7, 8, 9, 10, 31, 32, 33, 34, 35, 41, + 30, 44, 40, 0, 29, 30, 0, 0, 5, 37, + 38, 28, 27, 29, 23, 0, 15, 17, 21, 20, + 16, 26, 19, 43, 0, 44, 22, 11, 18, 13, + 14, 12, 42, 47, 0, 0, 0, 39, 24, 25, + 45, 44, 0, 46 + }; + + /* YYPGOTO[NTERM-NUM]. */ + const signed char + Parser::yypgoto_[] = + { + -44, -44, -44, 7, 29, -44, -32, -44, 22, -25, + -44, -44, -44, -44, -44, -44, -43, -44, -44, -44, + -44 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + const signed char + Parser::yydefgoto_[] = + { + -1, 1, 2, 4, 8, 9, 41, 25, 42, 26, + 20, 10, 21, 11, 45, 23, 29, 57, 61, 12, + 13 + }; + + /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. */ + const signed char Parser::yytable_ninf_ = -31; + const signed char + Parser::yytable_[] = + { + 35, 46, 53, 5, 31, 32, 33, 36, 37, 38, + 39, 5, 6, 7, 31, 32, 52, 40, 62, 3, + 6, 7, 58, 59, 54, 55, 47, 48, 49, 50, + 22, 24, -30, -30, 30, 44, 51, -30, -30, 24, + 38, 39, 27, 56, 60, 31, 32, 34, 28, 14, + 15, 16, 17, 18, 19, 63, 43 + }; + + /* YYCHECK. */ + const unsigned char + Parser::yycheck_[] = + { + 25, 33, 45, 3, 19, 20, 21, 12, 13, 14, + 15, 3, 12, 13, 19, 20, 16, 22, 61, 0, + 12, 13, 54, 55, 49, 50, 12, 13, 14, 15, + 18, 21, 14, 15, 10, 28, 22, 19, 20, 21, + 14, 15, 11, 23, 17, 19, 20, 25, 17, 4, + 5, 6, 7, 8, 9, 16, 27 + }; + + /* STOS_[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + const unsigned char + Parser::yystos_[] = + { + 0, 25, 26, 0, 27, 3, 12, 13, 28, 29, + 35, 37, 43, 44, 4, 5, 6, 7, 8, 9, + 34, 36, 18, 39, 21, 31, 33, 11, 17, 40, + 10, 19, 20, 21, 32, 33, 12, 13, 14, 15, + 22, 30, 32, 28, 27, 38, 30, 12, 13, 14, + 15, 22, 16, 40, 33, 33, 23, 41, 30, 30, + 17, 42, 40, 16 + }; + +#if YYDEBUG + /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding + to YYLEX-NUM. */ + const unsigned short int + Parser::yytoken_number_[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278 + }; +#endif + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + const unsigned char + Parser::yyr1_[] = + { + 0, 24, 26, 25, 27, 27, 28, 28, 28, 28, + 28, 29, 29, 29, 29, 29, 29, 29, 29, 30, + 30, 30, 31, 31, 31, 31, 31, 32, 32, 33, + 33, 34, 34, 34, 34, 34, 36, 35, 38, 37, + 39, 39, 40, 40, 40, 42, 41, 41, 43, 44 + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + const unsigned char + Parser::yyr2_[] = + { + 0, 2, 0, 2, 2, 0, 1, 1, 1, 1, + 1, 5, 5, 5, 5, 4, 4, 4, 5, 1, + 1, 1, 3, 2, 5, 5, 2, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 0, 3, 0, 7, + 1, 0, 3, 2, 0, 0, 5, 0, 1, 1 + }; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ + const char* + const Parser::yytname_[] = + { + "$end", "error", "$undefined", "ID_SIMPLE", "EQ", "PLUSEQ", "MINUSEQ", + "STAREQ", "TILDEEQ", "LBRACE", "RBRACE", "COLON", "NEWLINE", "COMMENT", + "CONT", "COMMENT_CONT", "RCURLY", "LCURLY", "ID_ARGS", + "QUOTED_VARIABLE_VALUE", "VARIABLE_VALUE", "LIST_WS", "ENDOFFILE", + "\"else\"", "$accept", "project", "@1", "statements", "statement", + "variable_assignment", "possible_value", "multiline_values", + "variable_value", "listws", "operator", "scope", "@2", "function_call", + "@3", "function_args", "scope_body", "else_statement", "@4", "comment", + "emptyline", 0 + }; +#endif + +#if YYDEBUG + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + const Parser::rhs_number_type + Parser::yyrhs_[] = + { + 25, 0, -1, -1, 26, 27, -1, 27, 28, -1, + -1, 29, -1, 35, -1, 37, -1, 43, -1, 44, + -1, 3, 34, 31, 33, 12, -1, 3, 34, 31, + 33, 22, -1, 3, 34, 31, 33, 14, -1, 3, + 34, 31, 33, 15, -1, 3, 34, 33, 12, -1, + 3, 34, 33, 22, -1, 3, 34, 33, 13, -1, + 3, 34, 31, 33, 13, -1, 32, -1, 15, -1, + 14, -1, 31, 21, 30, -1, 31, 32, -1, 31, + 33, 14, 33, 30, -1, 31, 33, 15, 33, 30, + -1, 33, 30, -1, 20, -1, 19, -1, 21, -1, + -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, + -1, -1, 3, 36, 40, -1, -1, 3, 9, 39, + 10, 38, 40, 41, -1, 18, -1, -1, 17, 27, + 16, -1, 11, 28, -1, -1, -1, 23, 17, 42, + 40, 16, -1, -1, 13, -1, 12, -1 + }; + + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + const unsigned char + Parser::yyprhs_[] = + { + 0, 0, 3, 4, 7, 10, 11, 13, 15, 17, + 19, 21, 27, 33, 39, 45, 50, 55, 60, 66, + 68, 70, 72, 76, 79, 85, 91, 94, 96, 98, + 100, 101, 103, 105, 107, 109, 111, 112, 116, 117, + 125, 127, 128, 132, 135, 136, 137, 143, 144, 146 + }; + + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + const unsigned short int + Parser::yyrline_[] = + { + 0, 144, 144, 144, 151, 156, 159, 163, 167, 171, + 175, 181, 192, 202, 213, 224, 233, 241, 250, 263, + 263, 263, 265, 270, 274, 283, 292, 301, 302, 306, + 312, 317, 321, 325, 329, 333, 340, 339, 354, 353, + 378, 379, 382, 383, 388, 392, 391, 405, 410, 418 + }; + + // Print the state stack on the debug stream. + void + Parser::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (state_stack_type::const_iterator i = yystate_stack_.begin (); + i != yystate_stack_.end (); ++i) + *yycdebug_ << ' ' << *i; + *yycdebug_ << std::endl; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + Parser::yy_reduce_print_ (int yyrule) + { + unsigned int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + /* Print the symbols being reduced, and their result. */ + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "), "; + /* The symbols being reduced. */ + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yyrhs_[yyprhs_[yyrule] + yyi], + &(yysemantic_stack_[(yynrhs) - (yyi + 1)]), + &(yylocation_stack_[(yynrhs) - (yyi + 1)])); + } +#endif // YYDEBUG + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + Parser::token_number_type + Parser::yytranslate_ (int t) + { + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23 + }; + if ((unsigned int) t <= yyuser_token_number_max_) + return translate_table[t]; + else + return yyundef_token_; + } + + const int Parser::yyeof_ = 0; + const int Parser::yylast_ = 56; + const int Parser::yynnts_ = 21; + const int Parser::yyempty_ = -2; + const int Parser::yyfinal_ = 3; + const int Parser::yyterror_ = 1; + const int Parser::yyerrcode_ = 256; + const int Parser::yyntokens_ = 24; + + const unsigned int Parser::yyuser_token_number_max_ = 278; + const Parser::token_number_type Parser::yyundef_token_ = 2; + +} // namespace QMake + +#line 421 "qmake.yy" + + + +namespace QMake +{ + void Parser::error(const location_type& /*l*/, const std::string& m) + { + std::cerr << m << std::endl; + } +} + diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.hpp b/buildtools/lib/parsers/qmake/qmake_yacc.hpp new file mode 100644 index 00000000..69b8a035 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake_yacc.hpp @@ -0,0 +1,418 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison LALR(1) parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C++ LALR(1) parser skeleton written by Akim Demaille. */ + +#ifndef PARSER_HEADER_H +# define PARSER_HEADER_H + +#include +#include +#include "stack.hh" + +namespace QMake +{ + class position; + class location; +} + +/* First part of user declarations. */ +#line 1 "qmake.yy" + +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * Copyright (C) 2006 by Andreas Pakulat * + * apaku@gmx.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +/** +@file qmake.yy +QMake Parser + +Simple LALR parser which builds the syntax tree (see @ref QMake::AST). + +@todo Recognize comments after statements like: +SOURCES = foo #regognize me + +@fixme Parser fails on files that do not end with a newline +@fixme 1 shift/reduce conflict in "line_body" rule +*/ + +#include +#include "qmakeast.h" +#include + +#define YYSTYPE_IS_DECLARED + +namespace QMake +{ + class Lexer; + +/** +The yylval type. +*/ +struct Result { + Result(): node(0) {} + + /**Type of semantic value for simple grammar rules.*/ + QString value; + /**Type of semantic value for grammar rules which are parts of AST.*/ + AST *node; + /**Type of semantic value for "multiline_values" grammar rule. + Each line of multiline value is stored as a string in the list. + + For example we have in .pro file: + @code + SOURCE = foo1.cpp \ + foo2.cpp \ + foo3.cpp foo4.cpp + @endcode + The string list will be populated with three strings: +
+    foo1.cpp
+    foo2.cpp
+    foo3.cpp foo4.cpp
+    
+ */ + QStringList values; + QString indent; +}; + +#define YYSTYPE Result +typedef Result YYSTYPE; +} + +extern int QMakelex( QMake::Result* yylval, QMake::Lexer* lexer ); + +/** +The stack to store ProjectAST pointers when a new child +ProjectAST is created and filled with statements. + +Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts +adding statements. Each statement is added as a child StatementAST to the ProjectAST +currently on the top in the stack. + +When a scope or function scope statement is parsed, the child ProjectAST is created +and pushed onto the stack. Therefore all statements which belong to the scope +or function scope are added as childs to their direct parent (scope or function scope). +*/ +//QValueStack projects; + +/** +The current depth of AST node is stored here. +AST depth is important to know because automatic indentation can +be easily implemented (the parser itself looses all information +about indentation). +*/ +// int depth = 0; + +/* +To debug this parser, put the line below into the next bison file section. +Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. +%debug +*/ + + +/* Line 35 of lalr1.cc. */ +#line 165 "qmake_yacc.hpp" + +#include "location.hh" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 1 +#endif + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).begin = (Rhs)[1].begin; \ + (Current).end = (Rhs)[N].end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = (Rhs)[0].end; \ + } \ +} while (false) +#endif + +namespace QMake +{ + + /// A Bison parser. + class Parser + { + public: + /// Symbol semantic values. +#ifndef YYSTYPE + typedef int semantic_type; +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + /// Tokens. + struct token + { + /* Tokens. */ + enum yytokentype { + ID_SIMPLE = 258, + EQ = 259, + PLUSEQ = 260, + MINUSEQ = 261, + STAREQ = 262, + TILDEEQ = 263, + LBRACE = 264, + RBRACE = 265, + COLON = 266, + NEWLINE = 267, + COMMENT = 268, + CONT = 269, + COMMENT_CONT = 270, + RCURLY = 271, + LCURLY = 272, + ID_ARGS = 273, + QUOTED_VARIABLE_VALUE = 274, + VARIABLE_VALUE = 275, + LIST_WS = 276, + ENDOFFILE = 277 + }; + + }; + /// Token type. + typedef token::yytokentype token_type; + + /// Build a parser object. + Parser (QMake::Lexer* lexer_yyarg, QValueStack& projects_yyarg, int depth_yyarg); + virtual ~Parser (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); + + private: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Generate an error message. + /// \param state the state where the error occurred. + /// \param tok the look-ahead token. + virtual std::string yysyntax_error_ (int yystate); + +#if YYDEBUG + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); +#endif /* ! YYDEBUG */ + + + /// State numbers. + typedef int state_type; + /// State stack type. + typedef stack state_stack_type; + /// Semantic value stack type. + typedef stack semantic_stack_type; + /// location stack type. + typedef stack location_stack_type; + + /// The state stack. + state_stack_type yystate_stack_; + /// The semantic value stack. + semantic_stack_type yysemantic_stack_; + /// The location stack. + location_stack_type yylocation_stack_; + + /// Internal symbol numbers. + typedef unsigned char token_number_type; + /* Tables. */ + /// For a state, the index in \a yytable_ of its portion. + static const signed char yypact_[]; + static const signed char yypact_ninf_; + + /// For a state, default rule to reduce. + /// Unless\a yytable_ specifies something else to do. + /// Zero means the default is an error. + static const unsigned char yydefact_[]; + + static const signed char yypgoto_[]; + static const signed char yydefgoto_[]; + + /// What to do in a state. + /// \a yytable_[yypact_[s]]: what to do in state \a s. + /// - if positive, shift that token. + /// - if negative, reduce the rule which number is the opposite. + /// - if zero, do what YYDEFACT says. + static const signed char yytable_[]; + static const signed char yytable_ninf_; + + static const unsigned char yycheck_[]; + + /// For a state, its accessing symbol. + static const unsigned char yystos_[]; + + /// For a rule, its LHS. + static const unsigned char yyr1_[]; + /// For a rule, its RHS length. + static const unsigned char yyr2_[]; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif + +#if YYERROR_VERBOSE + /// Convert the symbol name \a n to a form suitable for a diagnostic. + virtual std::string yytnamerr_ (const char *n); +#endif + +#if YYDEBUG + /// A type to store symbol numbers and -1. + typedef signed char rhs_number_type; + /// A `-1'-separated list of the rules' RHS. + static const rhs_number_type yyrhs_[]; + /// For each rule, the index of the first RHS symbol in \a yyrhs_. + static const unsigned char yyprhs_[]; + /// For each rule, its source line number. + static const unsigned short int yyrline_[]; + /// For each scanner token number, its symbol number. + static const unsigned short int yytoken_number_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); +#endif + + /// Convert a scanner token number \a t to a symbol number. + token_number_type yytranslate_ (int t); + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + + /// Pop \a n symbols the three stacks. + inline void yypop_ (unsigned int n = 1); + + /* Constants. */ + static const int yyeof_; + /* LAST_ -- Last index in TABLE_. */ + static const int yylast_; + static const int yynnts_; + static const int yyempty_; + static const int yyfinal_; + static const int yyterror_; + static const int yyerrcode_; + static const int yyntokens_; + static const unsigned int yyuser_token_number_max_; + static const token_number_type yyundef_token_; + + /* Debugging. */ + int yydebug_; + std::ostream* yycdebug_; + + + /* User arguments. */ + QMake::Lexer* lexer; + QValueStack& projects; + int depth; + }; +} + + +#endif /* ! defined PARSER_HEADER_H */ diff --git a/buildtools/lib/parsers/qmake/qmakeast.cpp b/buildtools/lib/parsers/qmake/qmakeast.cpp new file mode 100644 index 00000000..e6283e28 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmakeast.cpp @@ -0,0 +1,170 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "qmakeast.h" + +#include + +namespace QMake { + +//AST + +AST::~AST() +{ + for (QValueList::iterator it = m_children.begin(); it != m_children.end(); ++it) + { + AST *node = *it; + delete node; + } + m_children.clear(); +} + +void AST::addChildAST(AST *node) +{ + m_children.append(node); +} + +void AST::removeChildAST(AST *node) +{ + m_children.remove(node); +} + +void AST::writeBack(QString &buffer) +{ + for (QValueList::const_iterator it = m_children.constBegin(); + it != m_children.constEnd(); ++it) + { + if (*it) + { + (*it)->writeBack(buffer); + } + } +} + +QString AST::indentation() +{ + QString result; + for (int i = 0; i < depth(); i++) + result += " "; + return result; +} + +//ProjectAST + +void ProjectAST::writeBack(QString &buffer) +{ + bool hasActualStatements = false; + for (QValueList::const_iterator it = m_children.begin(); it != m_children.end(); ++it) + { + if ((*it)->nodeType() != AST::IncludeAST) + { + hasActualStatements = true; + break; + } + } + + if (isScope()) + { + if( !buffer.endsWith(": ") ) + buffer += indentation(); + buffer += scopedID; + if( m_children.count() == 1 ) + buffer += " : "; + else + buffer += " {"; + } + else if (isFunctionScope()) + { + if( !buffer.endsWith(": ") ) + buffer += indentation(); + buffer += scopedID + "(" + args + ")"; + if( m_children.count() == 1 && hasActualStatements ) + buffer += ": "; + else if( (m_children.count() > 0 && hasActualStatements) ) + buffer += "{"; + else + buffer += ""; + } + else if( !buffer.endsWith(": ") ) + buffer += indentation(); + AST::writeBack(buffer); + if (isScope() && m_children.count() > 1 ) + buffer += indentation() + "}"; + + if (isFunctionScope() && (hasActualStatements) && m_children.count() > 1) + buffer += indentation() + "}"; +} + + +void ProjectAST::setLineEnding( ProjectAST::LineEnding l ) +{ + m_lineEnding = l; +} + +ProjectAST::LineEnding ProjectAST::lineEnding() +{ + return m_lineEnding; +} + +//AssignmentAST + +AssignmentAST::~AssignmentAST() +{ +} + +void AssignmentAST::writeBack(QString &buffer) +{ + if( !buffer.endsWith(": ") ) + buffer += indentation(); + buffer += scopedID + " " + op; + if( values.first().stripWhiteSpace() != "" ) + buffer += " "; + buffer += values.join(""); +} + + +//NewLineAST + +void NewLineAST::writeBack(QString &buffer) +{ + buffer += "\n"; +} + + +//CommentAST + +void CommentAST::writeBack(QString &buffer) +{ + if( !buffer.endsWith(": ") ) + buffer += indentation(); + buffer += comment; +} + + +//IncludeAST + +void IncludeAST::writeBack(QString &/*buffer*/) +{ +} + +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + + diff --git a/buildtools/lib/parsers/qmake/qmakeast.h b/buildtools/lib/parsers/qmake/qmakeast.h new file mode 100644 index 00000000..b8486433 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmakeast.h @@ -0,0 +1,236 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef QMAKEQMAKEAST_H +#define QMAKEQMAKEAST_H + +#include + +/** +@file qmakeast.h +Abstract Syntax Tree (AST) class declarations. +*/ + +namespace QMake { + +/** +AST node. +This is the base class. Objects of this type are not created by the parser. + +Each AST node holds the list of its children which are always deleted in the +destructor. This way, it's possible call delete for only root AST node and +others will be deleted automatically. + +Each AST node also knows how to write the information back into .pro file. +*/ +class AST { +public: + /**Type of AST node.*/ + enum NodeType { + ProjectAST /** m_children; + +protected: + NodeType m_nodeType; + +private: + int m_depth; + +}; + + +/** +Project AST node. +Represents complete projects, scopes and function scopes. +Examples: +@code +scopename{ +var=value +} +function(args){ +var=value +} +@endcode +*/ +class ProjectAST: public AST { +public: + /**The kind of a project node.*/ + enum Kind { + Project /** +var=value + + +Values can be specified on several lines and +each line is stored as a string in the list of values.@n +For example, if we have in .pro: +
+SOURCES=a.cpp \
+    b.cpp c.cpp
+
+then values will be stored as a two elements list: +
+a.cpp
+    b.cpp c.cpp
+
+*/ +class AssignmentAST: public AST { +public: + AssignmentAST(): AST(AST::AssignmentAST){} + ~AssignmentAST(); + + virtual void writeBack(QString &buffer); + + /**Scoped name of the variable.*/ + QString scopedID; + /**Operator.*/ + QString op; + /**List of values.*/ + QStringList values; + /**Indentation of multiline values*/ + QString indent; +}; + + +/** +New line AST node. +Represents line feeds in files. +*/ +class NewLineAST: public AST { +public: + NewLineAST(): AST(AST::NewLineAST) {} + + virtual void writeBack(QString &buffer); + +}; + + +/** +Comment AST node. +Represents comments. +*/ +class CommentAST: public AST { +public: + CommentAST(): AST(AST::CommentAST) {} + + virtual void writeBack(QString &buffer); + + /**Comment text.*/ + QString comment; + +}; + + +/** +Include AST node. +Represents pri include. + */ +class IncludeAST: public AST { +public: + IncludeAST(): AST(AST::IncludeAST) {} + + virtual void writeBack(QString &buffer); + + QString projectName; +}; + +} + +#endif diff --git a/buildtools/lib/parsers/qmake/qmakeastvisitor.cpp b/buildtools/lib/parsers/qmake/qmakeastvisitor.cpp new file mode 100644 index 00000000..d8dd7751 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmakeastvisitor.cpp @@ -0,0 +1,68 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "qmakeastvisitor.h" + +namespace QMake { + +void ASTVisitor::processProject(ProjectAST *project) +{ + if (project->isProject()) + enterRealProject(project); + else if (project->isScope()) + enterScope(project); + else if (project->isFunctionScope()) + enterFunctionScope(project); + for (QValueList::const_iterator it = project->m_children.constBegin(); + it != project->m_children.constEnd(); ++it) + { + AST *ast = *it; + if (ast == 0) + continue; + switch (ast->nodeType()) { + case AST::AssignmentAST: + processAssignment(static_cast(ast)); + break; + + case AST::NewLineAST: + processNewLine(static_cast(ast)); + break; + + case AST::CommentAST: + processComment(static_cast(ast)); + break; + + case AST::ProjectAST: + processProject(static_cast(ast)); + break; + + case AST::IncludeAST: + processInclude(static_cast(ast)); + break; + } + } + if (project->isProject()) + leaveRealProject(project); + else if (project->isScope()) + leaveScope(project); + else if (project->isFunctionScope()) + leaveFunctionScope(project); +} + +} diff --git a/buildtools/lib/parsers/qmake/qmakeastvisitor.h b/buildtools/lib/parsers/qmake/qmakeastvisitor.h new file mode 100644 index 00000000..006d1de3 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmakeastvisitor.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef QMAKEQMAKEASTVISITOR_H +#define QMAKEQMAKEASTVISITOR_H + +#include "qmakeast.h" + +namespace QMake { + +class ASTVisitor{ +public: + ASTVisitor() {} + + virtual void processProject(ProjectAST *); + virtual void enterRealProject(ProjectAST *) {} + virtual void leaveRealProject(ProjectAST *) {} + virtual void enterScope(ProjectAST *) {} + virtual void leaveScope(ProjectAST *) {} + virtual void enterFunctionScope(ProjectAST *) {} + virtual void leaveFunctionScope(ProjectAST *) {} + virtual void processAssignment(AssignmentAST *) {} + virtual void processNewLine(NewLineAST *) {} + virtual void processComment(CommentAST *) {} + virtual void processInclude(IncludeAST *) {} +}; + +} + +#endif diff --git a/buildtools/lib/parsers/qmake/qmakedriver.cpp b/buildtools/lib/parsers/qmake/qmakedriver.cpp new file mode 100644 index 00000000..3e385c7a --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmakedriver.cpp @@ -0,0 +1,113 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "qmakedriver.h" +#include "qmakeast.h" + +#include +#include + +#include +#include +#include + +#include "qmake_lex.h" +#include "qmake_yacc.hpp" + +namespace QMake { + +int Driver::parseFile(const char *fileName, ProjectAST **ast, int debug) +{ + std::ifstream inf( fileName, std::ios::in ); + if ( !inf.is_open() ) + { + *ast = 0; + return 1; + } +// yydebug = 1; + Lexer l(&inf); + l.set_debug(debug); + int depth = 0; + QValueStack stack; + Parser p(&l, stack, depth); + p.set_debug_level(debug); + int ret = p.parse(); + *ast = stack.top(); + (*ast)->setFileName(fileName); + switch( l.lineending() ) + { + case QMake::Lexer::Windows: + (*ast)->setLineEnding(QMake::ProjectAST::Windows); + break; + case QMake::Lexer::MacOS: + (*ast)->setLineEnding(QMake::ProjectAST::MacOS); + break; + case QMake::Lexer::Unix: + default: + (*ast)->setLineEnding(QMake::ProjectAST::Unix); + break; + } + return ret; +} + +int Driver::parseFile(QString fileName, ProjectAST **ast, int debug) +{ + return parseFile(fileName.ascii(), ast, debug); +} + +int Driver::parseFile(KURL fileName, ProjectAST **ast, int debug) +{ + QString tmpFile; + int ret = 0; + if (KIO::NetAccess::download(fileName, tmpFile, 0)) + ret = parseFile(tmpFile, ast, debug); + KIO::NetAccess::removeTempFile(tmpFile); + return ret; +} + +int Driver::parseString( const char* string, ProjectAST **ast, int debug ) +{ + std::istringstream ins; + ins.str(string); + Lexer l(&ins); + l.set_debug(debug); + int depth = 0; + QValueStack stack; + Parser p(&l, stack, depth); + p.set_debug_level(debug); + int ret = p.parse(); + *ast = stack.top(); + (*ast)->setFileName(""); + switch( l.lineending() ) + { + case QMake::Lexer::Windows: + (*ast)->setLineEnding(QMake::ProjectAST::Windows); + break; + case QMake::Lexer::MacOS: + (*ast)->setLineEnding(QMake::ProjectAST::MacOS); + break; + case QMake::Lexer::Unix: + default: + (*ast)->setLineEnding(QMake::ProjectAST::Unix); + break; + } + return ret; +} + +} diff --git a/buildtools/lib/parsers/qmake/qmakedriver.h b/buildtools/lib/parsers/qmake/qmakedriver.h new file mode 100644 index 00000000..a1cdc9d9 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmakedriver.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef QMAKEQMAKEDRIVER_H +#define QMAKEQMAKEDRIVER_H + +class QString; +class KURL; + +namespace QMake { + +/** +@file qmakedriver.h +Driver for a qmake parser. +*/ + +class ProjectAST; + +/** +Driver. +Use methods of this class to lauch parsing and build the AST. +*/ +class Driver{ +public: + /**Parses the file @p fileName and stores the resulting ProjectAST root + into @p ast. @p ast should not be initialized before. Driver will + initialize it on its own. + @return The result of parsing. Result is 0 on success and <> 0 on failure. + */ + static int parseFile(const char *fileName, ProjectAST **ast, int debug); + static int parseFile(QString fileName, ProjectAST **ast, int debug); + static int parseFile(KURL fileName, ProjectAST **ast, int debug); + static int parseString(const char* string, ProjectAST **ast, int debug); + +}; + +} + +#endif diff --git a/buildtools/lib/parsers/qmake/stack.hh b/buildtools/lib/parsers/qmake/stack.hh new file mode 100644 index 00000000..b81e4a28 --- /dev/null +++ b/buildtools/lib/parsers/qmake/stack.hh @@ -0,0 +1,129 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Stack handling for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + 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; either version 2, or (at your option) + any later version. + + 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. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef BISON_STACK_HH +# define BISON_STACK_HH + +#include + +namespace QMake +{ + template > + class stack + { + public: + + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () : seq_ () + { + } + + stack (unsigned int n) : seq_ (n) + { + } + + inline + T& + operator [] (unsigned int i) + { + return seq_[i]; + } + + inline + const T& + operator [] (unsigned int i) const + { + return seq_[i]; + } + + inline + void + push (const T& t) + { + seq_.push_front (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_front (); + } + + inline + unsigned int + height () const + { + return seq_.size (); + } + + inline const_iterator begin () const { return seq_.rbegin (); } + inline const_iterator end () const { return seq_.rend (); } + + private: + + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + + slice (const S& stack, + unsigned int range) : stack_ (stack), + range_ (range) + { + } + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + + const S& stack_; + unsigned int range_; + }; +} + +#endif // not BISON_STACK_HH diff --git a/buildtools/lib/parsers/qmake/tests/Makefile.am b/buildtools/lib/parsers/qmake/tests/Makefile.am new file mode 100644 index 00000000..a73f8f4e --- /dev/null +++ b/buildtools/lib/parsers/qmake/tests/Makefile.am @@ -0,0 +1,21 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \ + -I$(top_srcdir)/buildtools/lib/parsers/qmake \ + -I$(top_builddir)/buildtools/lib/parsers/qmake/tests \ + $(all_includes) + +METASOURCES = AUTO + +noinst_PROGRAMS = runner viewer + +runner_LDFLAGS = $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH) +runner_LDADD = $(top_builddir)/buildtools/lib/parsers/qmake/libkdevqmakeparser.la +runner_SOURCES = runner.cpp + +viewer_LDFLAGS = --no-undefined $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH) +viewer_LDADD = $(top_builddir)/buildtools/lib/parsers/qmake/libkdevqmakeparser.la +viewer_SOURCES = viewer.cpp viewer_main.cpp viewerbase.ui diff --git a/buildtools/lib/parsers/qmake/tests/runner.cpp b/buildtools/lib/parsers/qmake/tests/runner.cpp new file mode 100644 index 00000000..b01284f1 --- /dev/null +++ b/buildtools/lib/parsers/qmake/tests/runner.cpp @@ -0,0 +1,169 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include "qmakedriver.h" +#include "qmakeastvisitor.h" + +#include + +#include +#include +#include + +static const KCmdLineOptions options[] = +{ + {"silent", "Enable Parser debug output", 0}, + {"!debug", "Disable output of the generated AST", 0}, + {"!+files", "QMake project files", 0} +}; + + +class PrintAST : QMake::ASTVisitor +{ +public: + PrintAST() : QMake::ASTVisitor() + { + indent = 0; + } + + virtual void processProject( QMake::ProjectAST* p ) + { + QMake::ASTVisitor::processProject(p); + } +private: + virtual void enterRealProject( QMake::ProjectAST* p ) + { + kdDebug(9024) << getIndent() << "--------- Entering Project: " << replaceWs(p->fileName()) << "| LineEnding:" << p->lineEnding() << " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterRealProject(p); + } + + virtual void leaveRealProject( QMake::ProjectAST* p ) + { + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving Project: " << replaceWs(p->fileName()) << " --------------" << endl; + QMake::ASTVisitor::leaveRealProject(p); + } + + virtual void enterScope( QMake::ProjectAST* p ) + { + kdDebug(9024) << getIndent() << "--------- Entering Scope: " << replaceWs(p->scopedID) << " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterScope(p); + } + + virtual void leaveScope( QMake::ProjectAST* p ) + { + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving Scope: " << replaceWs(p->scopedID) << " --------------" << endl; + QMake::ASTVisitor::leaveScope(p); + } + + virtual void enterFunctionScope( QMake::ProjectAST* p ) + { + kdDebug(9024) << getIndent() << "--------- Entering FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterFunctionScope(p); + } + + virtual void leaveFunctionScope( QMake::ProjectAST* p ) + { + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl; + QMake::ASTVisitor::leaveFunctionScope(p); + } + + QString replaceWs(QString s) + { + return s.replace("\n", "%nl").replace("\t", "%tab").replace(" ", "%spc"); + } + + virtual void processAssignment( QMake::AssignmentAST* a) + { + kdDebug(9024) << getIndent() << "Assignment(" << replaceWs(a->indent) << "):" << replaceWs(a->scopedID) << " " << replaceWs(a->op) << " " << replaceWs(a->values.join("|")) << endl; + QMake::ASTVisitor::processAssignment(a); + } + + virtual void processNewLine( QMake::NewLineAST* n) + { + kdDebug(9024) << getIndent() << "Newline " << endl; + QMake::ASTVisitor::processNewLine(n); + } + + virtual void processComment( QMake::CommentAST* a) + { + kdDebug(9024) << getIndent() << "Comment: " << replaceWs(a->comment) << endl; + QMake::ASTVisitor::processComment(a); + } + + virtual void processInclude( QMake::IncludeAST* a) + { + kdDebug(9024) << getIndent() << "Include: " << replaceWs(a->projectName) << endl; + QMake::ASTVisitor::processInclude(a); + } + + QString getIndent() + { + QString ind; + for( int i = 0 ; i < indent ; i++) + ind += " "; + return ind; + } + int indent; +}; +int main(int argc, char *argv[]) +{ + KCmdLineArgs::init( argc, argv, "QMake Parser", "qmake-parser", "Parse QMake project files", "1.0.0"); + KCmdLineArgs::addCmdLineOptions(options); + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + if( args->count() < 1 ) + { + KCmdLineArgs::usage(0); + } + + int debug = 0; + bool silent = false; + + if( args->isSet("silent") ) + silent = true; + if( args->isSet("debug") ) + debug = 1; + for( int i = 0 ; i < args->count() ; i++ ) + { + QMake::ProjectAST *projectAST; + int ret = QMake::Driver::parseFile(args->url(i).path(), &projectAST, debug); + PrintAST pa; + if ( ret == 0 ) + if ( !silent ) + { + pa.processProject(projectAST); + QString profile; + projectAST->writeBack(profile); + kdDebug(9024) << "QMake file written back:\n" << profile << endl; + } + return ret; + } + return 0; +} diff --git a/buildtools/lib/parsers/qmake/tests/viewer.cpp b/buildtools/lib/parsers/qmake/tests/viewer.cpp new file mode 100644 index 00000000..dba2b7fb --- /dev/null +++ b/buildtools/lib/parsers/qmake/tests/viewer.cpp @@ -0,0 +1,182 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "viewer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +using namespace QMake; + +Viewer::Viewer(QWidget *parent, const char *name) + :ViewerBase(parent, name), projectAST(0) +{ + if (QFile::exists(QDir::currentDirPath() + "/" + "qtlist")) + { + QFile f(QDir::currentDirPath() + "/" + "qtlist"); + f.open(IO_ReadOnly); + QTextStream str(&f); + while (!str.eof()) + files->insertItem(str.readLine()); + } + ast->setSorting(-1); +// parentProject.push((QListViewItem*)0); +} + +void Viewer::addAll_clicked() +{ + if (allLocation->text().isEmpty()) + return; + QDir d(allLocation->text()); + QStringList l = d.entryList("*.pro *.pri"); + for (QStringList::iterator it = l.begin(); it != l.end(); ++it) + (*it) = QDir::cleanDirPath(allLocation->text() + "/" + (*it)); + files->insertStringList(l); +} + +void Viewer::choose_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(QDir::currentDirPath(), "*.pro *.pri", this); + if (!fileName.isEmpty()) + files->insertItem(fileName); +} + +void Viewer::files_currentChanged(QListBoxItem* item) +{ + ast->clear(); + + QFile f(item->text()); + f.open(IO_ReadOnly); + QTextStream str(&f); + source->setText(str.read()); + f.close(); + + int result = QMake::Driver::parseFile(item->text().ascii(), &projectAST, 0); + if (projectAST && (result == 0)) + { + processAST(projectAST); + } + if (tabWidget2->currentPageIndex() == 1) + tabWidget2_selected("Source to be written back"); +} + +void Viewer::tabWidget2_selected(const QString& text) +{ + if ((text == "Source to Be Written Back") && projectAST) + { + QString buffer; + projectAST->writeBack(buffer); + writeBack->setText(buffer); + } +} + +class ViewerVisitor: public ASTVisitor { +public: + ViewerVisitor(Viewer *v): ASTVisitor() + { + this->v = v; + parentProject.push((QListViewItem*)0); + } + + virtual void processProject(ProjectAST *project) + { + ASTVisitor::processProject(project); + } + + virtual void enterRealProject(ProjectAST *project) + { + QListViewItem *projectIt; + if (!parentProject.top()) + { + projectIt = new QListViewItem(v->ast, "Project"); + projectIt->setOpen(true); + parentProject.push(projectIt); + } + + ASTVisitor::enterRealProject(project); + } + virtual void enterScope(ProjectAST *scope) + { + QListViewItem *projectIt = new QListViewItem(parentProject.top(), scope->scopedID, "scope"); + parentProject.push(projectIt); + ASTVisitor::enterScope(scope); + } + virtual void leaveScope(ProjectAST *scope) + { + parentProject.pop(); + } + virtual void enterFunctionScope(ProjectAST *fscope) + { + QListViewItem *projectIt = new QListViewItem(parentProject.top(), + fscope->scopedID + "(" + fscope->args + ")", "function scope"); + parentProject.push(projectIt); + ASTVisitor::enterFunctionScope(fscope); + } + virtual void leaveFunctionScope(ProjectAST *fscope) + { + parentProject.pop(); + } + virtual void processAssignment(AssignmentAST *assignment) + { + QListViewItem *item = new QListViewItem(parentProject.top(), + assignment->scopedID, assignment->op, assignment->values.join("|"), + "assignment"); + item->setMultiLinesEnabled(true); + + ASTVisitor::processAssignment(assignment); + } + virtual void processNewLine(NewLineAST *newline) + { + new QListViewItem(parentProject.top(), ""); + ASTVisitor::processNewLine(newline); + } + virtual void processComment(CommentAST *comment) + { + new QListViewItem(parentProject.top(), ""); + ASTVisitor::processComment(comment); + } + virtual void processInclude(IncludeAST *include) + { + new QListViewItem(parentProject.top(), "", include->projectName); + QMake::ASTVisitor::processInclude(include); + } + + Viewer *v; + QValueStack parentProject; +}; + + +void Viewer::processAST(QMake::ProjectAST *projectAST, QListViewItem *globAfter) +{ + ViewerVisitor visitor(this); + visitor.processProject(projectAST); +} + +#include "viewer.moc" diff --git a/buildtools/lib/parsers/qmake/tests/viewer.h b/buildtools/lib/parsers/qmake/tests/viewer.h new file mode 100644 index 00000000..8d0da49f --- /dev/null +++ b/buildtools/lib/parsers/qmake/tests/viewer.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef VIEWER_H +#define VIEWER_H + +#include + +#include "viewerbase.h" + +namespace QMake { +class ProjectAST; +} + +class QListViewItem; + +class Viewer: public ViewerBase { +Q_OBJECT +public: + Viewer(QWidget *parent = 0, const char *name = 0); + void processAST(QMake::ProjectAST *projectAST, QListViewItem *globAfter = 0); +public slots: + virtual void tabWidget2_selected(const QString&); + virtual void files_currentChanged(QListBoxItem*); + virtual void choose_clicked(); + virtual void addAll_clicked(); +private: + QMake::ProjectAST *projectAST; + friend class ViewerVisitor; +}; + +#endif diff --git a/buildtools/lib/parsers/qmake/tests/viewer_main.cpp b/buildtools/lib/parsers/qmake/tests/viewer_main.cpp new file mode 100644 index 00000000..8fdbc910 --- /dev/null +++ b/buildtools/lib/parsers/qmake/tests/viewer_main.cpp @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include +#include "viewer.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + Viewer viewer; + app.setMainWidget(&viewer); + viewer.show(); + viewer.setWindowState(viewer.windowState() | Qt::WindowMaximized); + + return app.exec(); +} diff --git a/buildtools/lib/parsers/qmake/tests/viewerbase.ui b/buildtools/lib/parsers/qmake/tests/viewerbase.ui new file mode 100644 index 00000000..976d4d0f --- /dev/null +++ b/buildtools/lib/parsers/qmake/tests/viewerbase.ui @@ -0,0 +1,250 @@ + +ViewerBase + + + ViewerBase + + + + 0 + 0 + 600 + 480 + + + + Viewer + + + + unnamed + + + + splitter5 + + + Horizontal + + + + layout4 + + + + unnamed + + + + allLocation + + + + 32767 + 32767 + + + + + + addAll + + + + 32767 + 32767 + + + + Add All From Directory + + + + + choose + + + + 32767 + 32767 + + + + Choose File to Add... + + + + + files + + + + 7 + 7 + 0 + 0 + + + + + 32767 + 32767 + + + + Auto + + + + + + + splitter2 + + + Vertical + + + + source + + + + 7 + 7 + 0 + 1 + + + + + + tabWidget2 + + + + 7 + 7 + 0 + 2 + + + + + tab + + + Parse Tree + + + + unnamed + + + + + Name + + + true + + + true + + + + + Value 1 + + + true + + + true + + + + + Value 2 + + + true + + + true + + + + + Value 3 + + + true + + + true + + + + ast + + + + + + + tab + + + Source to Be Written Back + + + + unnamed + + + + writeBack + + + + + + + + + + + + addAll + clicked() + ViewerBase + addAll_clicked() + + + choose + clicked() + ViewerBase + choose_clicked() + + + files + currentChanged(QListBoxItem*) + ViewerBase + files_currentChanged(QListBoxItem*) + + + tabWidget2 + selected(const QString&) + ViewerBase + tabWidget2_selected(const QString&) + + + + addAll_clicked() + choose_clicked() + files_currentChanged( QListBoxItem * ) + tabWidget2_selected( const QString & ) + + + diff --git a/buildtools/lib/widgets/Mainpage.dox b/buildtools/lib/widgets/Mainpage.dox new file mode 100644 index 00000000..56884c97 --- /dev/null +++ b/buildtools/lib/widgets/Mainpage.dox @@ -0,0 +1,10 @@ +/** +@mainpage The KDevelop Buildtool Widgets Library + +This library contains widgets commonly used in buildtool support plugins. + +Link with: -lkdevbuildtoolswidgets + +Include path: -I\$(kde_includes)/kdevelop/buildtools/widgets +*/ + diff --git a/buildtools/lib/widgets/Makefile.am b/buildtools/lib/widgets/Makefile.am new file mode 100644 index 00000000..2277d9d0 --- /dev/null +++ b/buildtools/lib/widgets/Makefile.am @@ -0,0 +1,30 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/lib/widgets/propeditor $(all_includes) + +lib_LTLIBRARIES = libkdevbuildtoolswidgets.la +libkdevbuildtoolswidgets_la_LDFLAGS = $(all_libraries) +libkdevbuildtoolswidgets_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la \ + $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO) -lktexteditor +libkdevbuildtoolswidgets_la_SOURCES = addenvvardlg.cpp addfilesdialog.cpp \ + environmentdisplaydialog.cpp environmentdisplaydialogbase.ui environmentvariableswidget.cpp \ + environmentvariableswidgetbase.ui envvartools.cpp makeoptionswidget.cpp makeoptionswidgetbase.ui \ + removesubprojectdialog.cpp removesubprojectdlgbase.ui runoptionswidget.cpp runoptionswidgetbase.ui \ + subclassesdlg.cpp subclassesdlgbase.ui + +METASOURCES = AUTO + +kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/widgets +kdevelopbuildtoolsinclude_HEADERS = addenvvardlg.h addfilesdialog.h \ + environmentvariableswidget.h environmentvariableswidgetbase.h envvartools.h makeoptionswidget.h \ + makeoptionswidgetbase.h removesubprojectdialog.h removesubprojectdlgbase.h runoptionswidget.h \ + runoptionswidgetbase.h subclassesdlg.h subclassesdlgbase.h + +DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces kdevutil +DOXYGEN_PROJECTNAME = KDevelop Buildtool Widgets Library +DOXYGEN_DOCDIRPREFIX = kdevbt +include ../../../Doxyfile.am +noinst_HEADERS = environmentdisplaydialog.h diff --git a/buildtools/lib/widgets/addenvvardlg.cpp b/buildtools/lib/widgets/addenvvardlg.cpp new file mode 100644 index 00000000..aaf82774 --- /dev/null +++ b/buildtools/lib/widgets/addenvvardlg.cpp @@ -0,0 +1,84 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "addenvvardlg.h" + + +AddEnvvarDialog::AddEnvvarDialog(QWidget *parent, const char *name) + : QDialog(parent, name, true) +{ + setCaption(i18n("Add Environment Variable")); + + QLabel *varname_label = new QLabel(i18n("&Name:"), this); + varname_edit = new KLineEdit(this); + varname_edit->setFocus(); + varname_label->setBuddy(varname_edit); + + connect( varname_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) ); + QLabel *value_label = new QLabel(i18n("&Value:"), this); + value_edit = new KLineEdit(this); + value_label->setBuddy(value_edit); + QFontMetrics fm(value_edit->fontMetrics()); + value_edit->setMinimumWidth(fm.width('X')*35); + connect( value_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) ); + + + QVBoxLayout *layout = new QVBoxLayout(this, 10); + + QGridLayout *grid = new QGridLayout(2, 2); + layout->addLayout(grid); + grid->addWidget(varname_label, 0, 0); + grid->addWidget(varname_edit, 0, 1); + grid->addWidget(value_label, 1, 0); + grid->addWidget(value_edit, 1, 1); + + QFrame *frame = new QFrame(this); + frame->setFrameStyle(QFrame::HLine | QFrame::Sunken); + layout->addWidget(frame, 0); + + KButtonBox *buttonbox = new KButtonBox(this); + buttonbox->addStretch(); + m_pOk = buttonbox->addButton( KStdGuiItem::ok()); + QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel()); + m_pOk->setDefault(true); + connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); + buttonbox->layout(); + layout->addWidget(buttonbox, 0); + slotTextChanged(); +} + + +AddEnvvarDialog::~AddEnvvarDialog() +{} + +void AddEnvvarDialog::slotTextChanged() +{ + m_pOk->setEnabled( !varname_edit->text().isEmpty() && !value_edit->text().isEmpty() ); +} + +#include "addenvvardlg.moc" diff --git a/buildtools/lib/widgets/addenvvardlg.h b/buildtools/lib/widgets/addenvvardlg.h new file mode 100644 index 00000000..0ffdbde1 --- /dev/null +++ b/buildtools/lib/widgets/addenvvardlg.h @@ -0,0 +1,54 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _ADDENVVARDLG_H_ +#define _ADDENVVARDLG_H_ + +#include +#include +class QPushButton; + +/** +Dialog to add environment variables. +*/ +class AddEnvvarDialog : public QDialog +{ + Q_OBJECT + +public: + AddEnvvarDialog( QWidget *parent=0, const char *name=0 ); + ~AddEnvvarDialog(); + + QString varname() const + { return varname_edit->text(); } + QString value() const + { return value_edit->text(); } + void setvarname(const QString name) const + { varname_edit->setText(name); } + void setvalue(const QString value) const + { value_edit->setText(value); } + private slots: + void slotTextChanged(); +private: + KLineEdit *varname_edit; + KLineEdit *value_edit; + QPushButton *m_pOk; +}; + +#endif diff --git a/buildtools/lib/widgets/addfilesdialog.cpp b/buildtools/lib/widgets/addfilesdialog.cpp new file mode 100644 index 00000000..8ba14539 --- /dev/null +++ b/buildtools/lib/widgets/addfilesdialog.cpp @@ -0,0 +1,78 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include +#include + +#include + +#include "addfilesdialog.h" +#include "addfilesdialog.moc" + +AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal): + KFileDialog(startDir, filter, parent, name, modal) +{ + KConfig *config = kapp->config(); + config->setGroup("Add Files Dialog"); + + m_extraWidget = new QComboBox(false, this); + m_extraWidget->insertItem(i18n("Copy File(s)"), 0); + m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1); + m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2); + m_extraWidget->setCurrentItem(config->readNumEntry("Mode")); + connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int))); + + setPreviewWidget(m_extraWidget); + + setOperationMode(Opening); +} + + +AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal, QComboBox *extraWidget): + KFileDialog(startDir, filter, parent, name, modal, extraWidget), m_extraWidget(extraWidget) +{ + KConfig *config = kapp->config(); + config->setGroup("Add Files Dialog"); + + m_extraWidget->insertItem(i18n("Copy File(s)"), 0); + m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1); + m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2); + m_extraWidget->setCurrentItem(config->readNumEntry("Mode")); + connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int))); + + setOperationMode(Opening); +} + + +AddFilesDialog::~AddFilesDialog() +{ +} + +AddFilesDialog::Mode AddFilesDialog::mode( ) +{ + return (AddFilesDialog::Mode)m_extraWidget->currentItem(); +} + +void AddFilesDialog::storePreferred( int index ) +{ + KConfig *config = kapp->config(); + config->setGroup("Add Files Dialog"); + config->writeEntry("Mode", index); +} diff --git a/buildtools/lib/widgets/addfilesdialog.h b/buildtools/lib/widgets/addfilesdialog.h new file mode 100644 index 00000000..00b238a7 --- /dev/null +++ b/buildtools/lib/widgets/addfilesdialog.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#ifndef ADDFILESDIALOG_H +#define ADDFILESDIALOG_H + +#include +#include + +class QComboBox; + +/** +This class allows you to choose additional modes when adding +files to the project. +Currently available modes are Copy, Link and Relative. +Relative means that file should be not copied but added +with the relative path (e.g. ../../dir/filename) +*/ +class AddFilesDialog : public KFileDialog +{ + Q_OBJECT +public: + enum Mode { Copy, Link, Relative }; + + AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal); + + AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal, QComboBox *extraWidget); + + virtual ~AddFilesDialog(); + + virtual AddFilesDialog::Mode mode(); + +private: + QComboBox * m_extraWidget; + +private slots: + void storePreferred(int index); +}; + +#endif diff --git a/buildtools/lib/widgets/environmentdisplaydialog.cpp b/buildtools/lib/widgets/environmentdisplaydialog.cpp new file mode 100644 index 00000000..7d01b031 --- /dev/null +++ b/buildtools/lib/widgets/environmentdisplaydialog.cpp @@ -0,0 +1,54 @@ +/* This file is part of the KDE project + Copyright (C) 2007 Jens Dagerbo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "environmentdisplaydialog.h" + +extern char **environ; + +EnvironmentDisplayDialog::EnvironmentDisplayDialog(QWidget* parent, const char* name, bool modal, WFlags fl) +: EnvironmentDisplayDialogBase(parent,name, modal,fl) +{ + QStringList environment; + char ** e = ::environ; + + while ( *e ) + { + environment << *e; + e++; + } + + QStringList::ConstIterator it = environment.begin(); + while( it !=environment.end() ) + { + QStringList pair = QStringList::split( QChar('='), *it ); + if ( pair.count() == 2 ) + { + new QListViewItem( environmentListView, pair.first(), pair.last() ); + } + ++it; + } +} + + +#include "environmentdisplaydialog.moc" + diff --git a/buildtools/lib/widgets/environmentdisplaydialog.h b/buildtools/lib/widgets/environmentdisplaydialog.h new file mode 100644 index 00000000..af284a3b --- /dev/null +++ b/buildtools/lib/widgets/environmentdisplaydialog.h @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2007 Jens Dagerbo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef ENVIRONMENTDISPLAYDIALOG_H +#define ENVIRONMENTDISPLAYDIALOG_H + + +#include "environmentdisplaydialogbase.h" + +class EnvironmentDisplayDialog : public EnvironmentDisplayDialogBase +{ +Q_OBJECT + +public: + EnvironmentDisplayDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); +}; + +#endif + diff --git a/buildtools/lib/widgets/environmentdisplaydialogbase.ui b/buildtools/lib/widgets/environmentdisplaydialogbase.ui new file mode 100644 index 00000000..8b41862f --- /dev/null +++ b/buildtools/lib/widgets/environmentdisplaydialogbase.ui @@ -0,0 +1,111 @@ + +EnvironmentDisplayDialogBase + + + EnvironmentDisplayDialogBase + + + + 0 + 0 + 583 + 523 + + + + Environment + + + + unnamed + + + + groupBox1 + + + Current Environment + + + + unnamed + + + + + Variable + + + true + + + true + + + + + Value + + + true + + + true + + + + environmentListView + + + + + + + layout1 + + + + unnamed + + + + spacer1 + + + Horizontal + + + Expanding + + + + 321 + 21 + + + + + + closeButton + + + &Close + + + + + + + + + closeButton + clicked() + EnvironmentDisplayDialogBase + accept() + + + + + klistview.h + + diff --git a/buildtools/lib/widgets/environmentvariableswidget.cpp b/buildtools/lib/widgets/environmentvariableswidget.cpp new file mode 100644 index 00000000..7ba08427 --- /dev/null +++ b/buildtools/lib/widgets/environmentvariableswidget.cpp @@ -0,0 +1,126 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2003 John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "environmentvariableswidget.h" +#include "environmentdisplaydialog.h" + +#include +#include +#include +#include +#include "domutil.h" +#include "addenvvardlg.h" + + +void EnvironmentVariablesWidget::addVarClicked() +{ + AddEnvvarDialog dlg( this, "add env dialog" ) ; + if (QListViewItem *Item = listview->selectedItem()) + { + dlg.setvarname(Item->text(0)); + dlg.setvalue(Item->text(1)); + } + if (!dlg.exec()) + return; + + (void) new QListViewItem(listview, dlg.varname(), dlg.value()); +} + + +void EnvironmentVariablesWidget::editVarClicked() +{ + AddEnvvarDialog dlg( this, "edit env dialog" ); + QListViewItem *item = listview->selectedItem(); + if ( !item ) + return; + dlg.setvarname(item->text(0)); + dlg.setvalue(item->text(1)); + if (!dlg.exec()) + return; + + item->setText(0,dlg.varname()); + item->setText(1,dlg.value()); +} + + +void EnvironmentVariablesWidget::removeVarClicked() +{ + delete listview->selectedItem(); +} + + +EnvironmentVariablesWidget::EnvironmentVariablesWidget(QDomDocument &dom, const QString &configGroup, + QWidget *parent, const char *name) + : EnvironmentVariablesWidgetBase(parent, name), + m_dom(dom), m_configGroup(configGroup) +{ + readEnvironment(dom, configGroup); + connect( listview, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), this, SLOT( editVarClicked() ) ); +} + + +EnvironmentVariablesWidget::~EnvironmentVariablesWidget() +{} + +void EnvironmentVariablesWidget::readEnvironment(QDomDocument &dom, const QString &configGroup) +{ + m_dom = dom; + m_configGroup = configGroup; + + listview->clear(); + + DomUtil::PairList list = + DomUtil::readPairListEntry(dom, m_configGroup, "envvar", "name", "value"); + + QListViewItem *lastItem = 0; + + DomUtil::PairList::ConstIterator it; + for (it = list.begin(); it != list.end(); ++it) { + QListViewItem *newItem = new QListViewItem(listview, (*it).first, (*it).second); + if (lastItem) + newItem->moveItem(lastItem); + lastItem = newItem; + } +} + +void EnvironmentVariablesWidget::changeConfigGroup( const QString &configGroup) +{ + m_configGroup = configGroup; +} + +void EnvironmentVariablesWidget::accept() +{ + DomUtil::PairList list; + QListViewItem *item = listview->firstChild(); + while (item) { + list << DomUtil::Pair(item->text(0), item->text(1)); + item = item->nextSibling(); + } + + DomUtil::writePairListEntry(m_dom, m_configGroup, "envvar", "name", "value", list); +} + +void EnvironmentVariablesWidget::environmentClicked() +{ + EnvironmentDisplayDialog dlg; + dlg.exec(); +} + +#include "environmentvariableswidget.moc" diff --git a/buildtools/lib/widgets/environmentvariableswidget.h b/buildtools/lib/widgets/environmentvariableswidget.h new file mode 100644 index 00000000..9f2d472e --- /dev/null +++ b/buildtools/lib/widgets/environmentvariableswidget.h @@ -0,0 +1,59 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2003 John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _ENVIRONMENTVARIABLESWIDGET_H_ +#define _ENVIRONMENTVARIABLESWIDGET_H_ + +#include "environmentvariableswidgetbase.h" + +#include + +/** +Environment variables widget. +*/ +class EnvironmentVariablesWidget : public EnvironmentVariablesWidgetBase +{ + Q_OBJECT + +public: + EnvironmentVariablesWidget( QDomDocument &dom, const QString &configGroup, + QWidget *parent=0, const char *name=0 ); + ~EnvironmentVariablesWidget(); + + /// read in a set of environment variables from the DOM document + void readEnvironment(QDomDocument &dom, const QString &configGroup); + + /// changes the path in the DOM structure where the environment variables are stored + void changeConfigGroup( const QString &configGroup); + +public slots: + void accept(); + +private: + virtual void addVarClicked(); + virtual void removeVarClicked(); + virtual void editVarClicked(); + virtual void environmentClicked(); + + QDomDocument &m_dom; + QString m_configGroup; +}; + +#endif diff --git a/buildtools/lib/widgets/environmentvariableswidgetbase.ui b/buildtools/lib/widgets/environmentvariableswidgetbase.ui new file mode 100644 index 00000000..d16cc613 --- /dev/null +++ b/buildtools/lib/widgets/environmentvariableswidgetbase.ui @@ -0,0 +1,200 @@ + +EnvironmentVariablesWidgetBase + + + EnvironmentVariablesWidgetBase + + + + 0 + 0 + 566 + 451 + + + + Environment Variables + + + + unnamed + + + 0 + + + + + Name + + + true + + + true + + + + + Value + + + true + + + true + + + + listview + + + + 7 + 7 + 0 + 0 + + + + true + + + AllColumns + + + + + removevar_button + + + + 5 + 0 + 0 + 0 + + + + &Remove + + + + + editvar_button + + + + 1 + 0 + 0 + 0 + + + + &Edit + + + + + addvar_button + + + + 1 + 0 + 0 + 0 + + + + A&dd / Copy + + + + + Spacer12 + + + Vertical + + + Expanding + + + + 20 + 60 + + + + + + environmentButton + + + E&nvironment + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 171 + + + + + + + + addvar_button + clicked() + EnvironmentVariablesWidgetBase + addVarClicked() + + + removevar_button + clicked() + EnvironmentVariablesWidgetBase + removeVarClicked() + + + editvar_button + clicked() + EnvironmentVariablesWidgetBase + editVarClicked() + + + environmentButton + clicked() + EnvironmentVariablesWidgetBase + environmentClicked() + + + + listview + addvar_button + removevar_button + + + kdialog.h + + + addVarClicked() + removeVarClicked() + editVarClicked() + environmentClicked() + + + + diff --git a/buildtools/lib/widgets/envvartools.cpp b/buildtools/lib/widgets/envvartools.cpp new file mode 100644 index 00000000..bc8eaf51 --- /dev/null +++ b/buildtools/lib/widgets/envvartools.cpp @@ -0,0 +1,31 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include "envvartools.h" + +#include + +QString EnvVarTools::quote( const QString & arg ) +{ + QString res = arg; + res.replace(QRegExp(QString::fromLatin1("'")), QString::fromLatin1("'\\''")); + res.prepend("\""); + res.append("\""); + return res; +} + diff --git a/buildtools/lib/widgets/envvartools.h b/buildtools/lib/widgets/envvartools.h new file mode 100644 index 00000000..65db1b8d --- /dev/null +++ b/buildtools/lib/widgets/envvartools.h @@ -0,0 +1,28 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include + +/**Environment support functions.*/ +namespace EnvVarTools{ + + /**Quotes the argument using double quotes ("). Created as a replacement + for KShellProcess::quote.*/ + QString quote(const QString &arg); + +} diff --git a/buildtools/lib/widgets/makeoptionswidget.cpp b/buildtools/lib/widgets/makeoptionswidget.cpp new file mode 100644 index 00000000..c720de8b --- /dev/null +++ b/buildtools/lib/widgets/makeoptionswidget.cpp @@ -0,0 +1,64 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "makeoptionswidget.h" + +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "environmentvariableswidget.h" + +MakeOptionsWidget::MakeOptionsWidget(QDomDocument &dom, const QString &configGroup, + QWidget *parent, const char *name) + : MakeOptionsWidgetBase(parent, name), + m_dom(dom), m_configGroup(configGroup) +{ + env_var_group->setColumnLayout( 1, Qt::Vertical ); + m_environmentVariablesWidget = new EnvironmentVariablesWidget( dom, configGroup + "/make/envvars", env_var_group ); + + abort_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/abortonerror", true )); + jobs_box->setValue(DomUtil::readIntEntry(dom, configGroup + "/make/numberofjobs")); + runMultiJobs->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/runmultiplejobs")); + dontact_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/dontact")); + makebin_edit->setText(DomUtil::readEntry(dom, configGroup + "/make/makebin")); + prio_box->setValue(DomUtil::readIntEntry(dom, configGroup + "/make/prio")); +} + + +MakeOptionsWidget::~MakeOptionsWidget() +{} + + +void MakeOptionsWidget::accept() +{ + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/abortonerror", abort_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/runmultiplejobs", runMultiJobs->isChecked()); + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/numberofjobs", jobs_box->value()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/dontact", dontact_box->isChecked()); + DomUtil::writeEntry(m_dom, m_configGroup + "/make/makebin", makebin_edit->text()); + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/prio", prio_box->value()); + + m_environmentVariablesWidget->accept(); +} + +#include "makeoptionswidget.moc" diff --git a/buildtools/lib/widgets/makeoptionswidget.h b/buildtools/lib/widgets/makeoptionswidget.h new file mode 100644 index 00000000..b6deeb05 --- /dev/null +++ b/buildtools/lib/widgets/makeoptionswidget.h @@ -0,0 +1,50 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _MAKEOPTIONSWIDGET_H_ +#define _MAKEOPTIONSWIDGET_H_ + +#include "makeoptionswidgetbase.h" + +#include + +class EnvironmentVariablesWidget; + +/** +Make options widget. +*/ +class MakeOptionsWidget : public MakeOptionsWidgetBase +{ + Q_OBJECT + +public: + MakeOptionsWidget( QDomDocument &dom, const QString &configGroup, + QWidget *parent=0, const char *name=0 ); + ~MakeOptionsWidget(); + +public slots: + void accept(); + +private: + QDomDocument &m_dom; + QString m_configGroup; + EnvironmentVariablesWidget* m_environmentVariablesWidget; +}; + +#endif diff --git a/buildtools/lib/widgets/makeoptionswidgetbase.ui b/buildtools/lib/widgets/makeoptionswidgetbase.ui new file mode 100644 index 00000000..4bddebd1 --- /dev/null +++ b/buildtools/lib/widgets/makeoptionswidgetbase.ui @@ -0,0 +1,194 @@ + +MakeOptionsWidgetBase + + + make_options_widget + + + + 0 + 0 + 507 + 366 + + + + Make Options + + + + unnamed + + + + abort_box + + + &Abort on first error + + + + + dontact_box + + + Onl&y display commands without actually executing them + + + + + env_var_group + + + Environment &Variables + + + + + makebin_label + + + &Name of make executable: + + + makebin_edit + + + + + makebin_edit + + + + + jobs_box + + + false + + + + 0 + 0 + 0 + 0 + + + + 30 + + + 1 + + + + + textLabel1 + + + false + + + Num&ber of jobs to run simultaneously: + + + jobs_box + + + + + spacer33 + + + Horizontal + + + Expanding + + + + 121 + 20 + + + + + + spacer2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + runMultiJobs + + + Run more than one &job at a time + + + + + prio_label + + + Make priority: + + + + + prio_box + + + + 0 + 0 + 0 + 0 + + + + 19 + + + -20 + + + + + + + runMultiJobs + toggled(bool) + textLabel1 + setEnabled(bool) + + + runMultiJobs + toggled(bool) + jobs_box + setEnabled(bool) + + + + abort_box + dontact_box + makebin_edit + jobs_box + + + kdialog.h + + + + diff --git a/buildtools/lib/widgets/removesubprojectdialog.cpp b/buildtools/lib/widgets/removesubprojectdialog.cpp new file mode 100644 index 00000000..37f9aaf8 --- /dev/null +++ b/buildtools/lib/widgets/removesubprojectdialog.cpp @@ -0,0 +1,52 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include +#include +#include "removesubprojectdialog.h" + +RemoveSubprojectDialog::RemoveSubprojectDialog(QString caption, QString question, QWidget* parent, const char* name, bool modal, WFlags fl) + : RemoveSubprojectDlgBase(parent,name, modal,fl) +{ + setCaption(caption); + removeLabel->setText(question); +} + +RemoveSubprojectDialog::~RemoveSubprojectDialog() +{ +} + +/*$SPECIALIZATION$*/ +void RemoveSubprojectDialog::reject() +{ + QDialog::reject(); +} + +void RemoveSubprojectDialog::accept() +{ + QDialog::accept(); +} + +bool RemoveSubprojectDialog::removeFromDisk( ) +{ + return removeCheckBox->isChecked(); +} + + +#include "removesubprojectdialog.moc" + diff --git a/buildtools/lib/widgets/removesubprojectdialog.h b/buildtools/lib/widgets/removesubprojectdialog.h new file mode 100644 index 00000000..89487511 --- /dev/null +++ b/buildtools/lib/widgets/removesubprojectdialog.h @@ -0,0 +1,52 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef REMOVESUBPROJECTDIALOG_H +#define REMOVESUBPROJECTDIALOG_H + +#include "removesubprojectdlgbase.h" + +/** +Subproject removal dialog. +*/ +class RemoveSubprojectDialog : public RemoveSubprojectDlgBase +{ + Q_OBJECT + +public: + RemoveSubprojectDialog(QString caption, QString question, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~RemoveSubprojectDialog(); + /*$PUBLIC_FUNCTIONS$*/ + bool removeFromDisk(); + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void reject(); + virtual void accept(); + +}; + +#endif + diff --git a/buildtools/lib/widgets/removesubprojectdlgbase.ui b/buildtools/lib/widgets/removesubprojectdlgbase.ui new file mode 100644 index 00000000..cd36b6ff --- /dev/null +++ b/buildtools/lib/widgets/removesubprojectdlgbase.ui @@ -0,0 +1,154 @@ + +RemoveSubprojectDlgBase + + + RemoveSubprojectDlgBase + + + + 0 + 0 + 378 + 147 + + + + [REMOVE SUBPROJECT] + + + + unnamed + + + + fileGroupBox + + + + 0 + 0 + + + + + 32767 + 140 + + + + Sunken + + + &Information + + + + unnamed + + + + removeLabel + + + [REMOVE QUESTION] + + + + + removeCheckBox + + + Also &remove it from disk + + + + + noticeLabel + + + + 200 + 0 + + + + <b>Note:</b> You will not be able to undo this operation. + + + + + + + buttonLayout + + + + unnamed + + + 0 + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 30 + 20 + + + + + + removeButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + + + removeButton + clicked() + RemoveSubprojectDlgBase + accept() + + + cancelButton + clicked() + RemoveSubprojectDlgBase + reject() + + + + kdialog.h + + + accept() + reject() + + + + diff --git a/buildtools/lib/widgets/runoptionswidget.cpp b/buildtools/lib/widgets/runoptionswidget.cpp new file mode 100644 index 00000000..95fe4529 --- /dev/null +++ b/buildtools/lib/widgets/runoptionswidget.cpp @@ -0,0 +1,138 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "runoptionswidget.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "environmentvariableswidget.h" + + +RunOptionsWidget::RunOptionsWidget(QDomDocument &dom, const QString &configGroup, + const QString &buildDirectory, QWidget *parent, const char *name) + : RunOptionsWidgetBase(parent, name), + m_dom(dom), m_configGroup(configGroup) +{ + // Create the "Environment Variables" GUI + env_var_group->setColumnLayout( 1, Qt::Vertical ); + m_environmentVariablesWidget = new EnvironmentVariablesWidget( dom, configGroup + "/run/envvars", env_var_group ); + + mainprogram_edit->completionObject()->setMode(KURLCompletion::FileCompletion); + mainprogram_edit->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + if( DomUtil::readEntry(dom, configGroup + "/run/mainprogram").isEmpty() && QFileInfo( buildDirectory ).exists() ) + { + mainprogram_edit->setURL( buildDirectory ); + mainprogram_edit->fileDialog()->setURL( KURL::fromPathOrURL(buildDirectory) ); + }else if ( QFileInfo( DomUtil::readEntry(dom, configGroup + "/run/mainprogram") ).exists() ) + { + QString program = DomUtil::readEntry(dom, configGroup + "/run/mainprogram"); + if( QDir::isRelativePath(program) ) + program = buildDirectory + "/" + program; + mainprogram_edit->setURL(program); + mainprogram_edit->fileDialog()->setURL( program ); + }else + { + mainprogram_edit->setURL(QString()); + mainprogram_edit->fileDialog()->setURL(QString()); + } + + cwd_edit->completionObject()->setMode(KURLCompletion::DirCompletion); + cwd_edit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + if( DomUtil::readEntry(dom, configGroup + "/run/globalcwd").isEmpty() && QFileInfo( buildDirectory ).exists() ) + { + cwd_edit->setURL( buildDirectory ); + cwd_edit->fileDialog()->setURL( KURL::fromPathOrURL(buildDirectory) ); + }else if( QFileInfo( DomUtil::readEntry(dom, configGroup + "/run/globalcwd") ).exists() ) + { + cwd_edit->setURL(DomUtil::readEntry(dom, configGroup + "/run/globalcwd")); + cwd_edit->fileDialog()->setURL( KURL::fromPathOrURL( DomUtil::readEntry(dom, configGroup + "/run/globalcwd") ) ); + }else + { + cwd_edit->setURL(QString()); + cwd_edit->fileDialog()->setURL(QString()); + } + + if( configGroup == "/kdevautoproject" || configGroup == "/kdevtrollproject" ) + { + mainProgramGroupBox->setCheckable(true); + mainProgramGroupBox->setChecked( DomUtil::readBoolEntry(dom, configGroup+"/run/useglobalprogram", false ) ); + }else + { + delete notelabel; + } + + // Read the main program command line arguments and store them in the edit box + + runargs_edit->setText(DomUtil::readEntry(dom, configGroup + "/run/programargs")); + debugargs_edit->setText(DomUtil::readEntry(dom, configGroup + "/run/globaldebugarguments")); + + startinterminal_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/terminal")); + autocompile_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autocompile", false)); + autoinstall_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autoinstall", false)); + autokdesu_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autokdesu", false)); +} + + +RunOptionsWidget::~RunOptionsWidget() +{} + + +void RunOptionsWidget::accept() +{ + DomUtil::writeEntry(m_dom, m_configGroup + "/run/mainprogram", mainprogram_edit->url()); + DomUtil::writeEntry(m_dom, m_configGroup + "/run/programargs", runargs_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/run/globaldebugarguments", debugargs_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/run/globalcwd", cwd_edit->url()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/useglobalprogram", mainProgramGroupBox->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/terminal", startinterminal_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autocompile", autocompile_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autoinstall", autoinstall_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autokdesu", autokdesu_box->isChecked()); + + m_environmentVariablesWidget->accept(); +} + +void RunOptionsWidget::mainProgramChanged( ) +{ + + if( mainProgramGroupBox->isChecked() && mainprogram_edit->url().isEmpty() ) + { + mainprogram_label->setPaletteForegroundColor(QColor("#ff0000")); + } + else + { + mainprogram_label->unsetPalette(); + } +} + +#include "runoptionswidget.moc" diff --git a/buildtools/lib/widgets/runoptionswidget.h b/buildtools/lib/widgets/runoptionswidget.h new file mode 100644 index 00000000..758ef4b1 --- /dev/null +++ b/buildtools/lib/widgets/runoptionswidget.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _RUNOPTIONSWIDGET_H_ +#define _RUNOPTIONSWIDGET_H_ + +#include "runoptionswidgetbase.h" + +#include +#include + +class EnvironmentVariablesWidget; + +/** +Run options widget. +*/ +class RunOptionsWidget : public RunOptionsWidgetBase +{ + Q_OBJECT + +public: + RunOptionsWidget( QDomDocument &dom, //!< document DOM + const QString &configGroup, //!< configuration group + const QString &buildDirectory, //!< project build directory + QWidget *parent=0, //!< parent widget + const char *name=0 //!< widget's name + ); + ~RunOptionsWidget(); + +public slots: + void accept(); + +private: + virtual void mainProgramChanged( ); + + QDomDocument &m_dom; + QString m_configGroup; + EnvironmentVariablesWidget* m_environmentVariablesWidget; +}; + +#endif diff --git a/buildtools/lib/widgets/runoptionswidgetbase.ui b/buildtools/lib/widgets/runoptionswidgetbase.ui new file mode 100644 index 00000000..1163484c --- /dev/null +++ b/buildtools/lib/widgets/runoptionswidgetbase.ui @@ -0,0 +1,257 @@ + +RunOptionsWidgetBase + + + run_options_widget + + + + 0 + 0 + 500 + 506 + + + + Run Options + + + + unnamed + + + + mainProgramGroupBox + + + + 5 + 0 + 0 + 0 + + + + Main Program + + + false + + + false + + + + unnamed + + + + notelabel + + + Note: These options override target specific settings. + + + AlignVCenter + + + For Automake and QMake type projects, the proper way to set these options are per target in the <b>Automake Manager</b> and <b>QMake Manager</b>, respectively. + + + + + runargs_edit + + + The command line arguments passed to the main program when run + + + + + mainprogram_label_2 + + + Run Arg&uments: + + + mainprogram_edit + + + + + mainprogram_label + + + Executa&ble: + + + mainprogram_edit + + + + + mainprogram_edit + + + Full path to the executable + + + + + mainprogram_label_3 + + + Debug Ar&guments: + + + mainprogram_edit + + + + + debugargs_edit + + + The command line arguments passed to the main program when debugged + + + + + mainprogram_label_3_2 + + + Working &Directory: + + + mainprogram_edit + + + + + cwd_edit + + + Sets the current working directory for the launched process + + + + + + + groupBox2 + + + + 5 + 0 + 0 + 0 + + + + Options + + + + unnamed + + + + autocompile_box + + + Automaticall&y compile before execution + + + If the program is not up-to-date with the source code, compile it before starting its execution + + + + + autoinstall_box + + + &Automatically install before execution + + + + + + + + autokdesu_box + + + Use &kdesu when installing + + + + + + + + startinterminal_box + + + Start in e&xternal terminal + + + Start the main program in an external terminal + + + + + + + env_var_group + + + Environment &Variables + + + + + + + mainprogram_edit + textChanged(const QString&) + run_options_widget + mainProgramChanged() + + + mainprogram_edit + urlSelected(const QString&) + run_options_widget + mainProgramChanged() + + + mainProgramGroupBox + toggled(bool) + run_options_widget + mainProgramChanged() + + + + startinterminal_box + autocompile_box + + + kdialog.h + ksqueezedtextlabel.h + + + mainProgramChanged() + + + + + klineedit.h + kurlrequester.h + klineedit.h + kpushbutton.h + klineedit.h + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/lib/widgets/subclassesdlg.cpp b/buildtools/lib/widgets/subclassesdlg.cpp new file mode 100644 index 00000000..5c3a0fef --- /dev/null +++ b/buildtools/lib/widgets/subclassesdlg.cpp @@ -0,0 +1,122 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include +#include + +#include "subclassesdlg.h" +#include "subclassesdlg.moc" +SubclassesDlg::SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent, const char* name, bool modal, WFlags fl) +: SubclassesDlgBase(parent,name, modal,fl), m_form(form), m_config(config), m_projectDir(projectDir) +{ + subclass_url->setEnabled(false); + + DomUtil::PairList::iterator it; + for ( it = config.begin(); it != config.end(); ++it ) + { + if ((*it).second == form) + subclasses_box->insertItem(projectDir + (*it).first); + } +} + +SubclassesDlg::~SubclassesDlg() +{ +} + +/*$SPECIALIZATION$*/ +void SubclassesDlg::accept() +{ + QPtrList pairsToRemove; + + DomUtil::PairList::iterator it; + for ( it = m_config.begin(); it != m_config.end(); ++it ) + { + if ((*it).second == m_form) + { + pairsToRemove.append(&(*it)); + } + } + + DomUtil::Pair *pair; + for ( pair = pairsToRemove.first(); pair; pair = pairsToRemove.next() ) + { + m_config.remove(*pair); + } + + for (int i = 0; i < (int)subclasses_box->count(); ++i) + { + m_config << DomUtil::Pair(subclasses_box->text(i).remove(0,m_projectDir.length()), m_form); + } + + SubclassesDlgBase::accept(); +} + + +void SubclassesDlg::newRelation() +{ + subclasses_box->setFocus(); + subclasses_box->insertItem(""); + subclasses_box->setCurrentItem(subclasses_box->count()-1); + subclass_url->setEnabled(true); + subclass_url->setURL(""); + subclass_url->setFocus(); +} + +void SubclassesDlg::removeRelation() +{ + if (subclasses_box->currentItem() > -1) + { + QListBoxItem *item = subclasses_box->item(subclasses_box->currentItem()); + int itemIdx = subclasses_box->currentItem(); + + if (item->prev()) + { + subclasses_box->setCurrentItem(item->prev()); + subclass_url->setURL(item->prev()->text()); + } + else if (item->next()) + { + subclasses_box->setCurrentItem(item->next()); + subclass_url->setURL(item->next()->text()); + } + else + { + subclass_url->setEnabled(false); + subclass_url->setURL(""); + } + subclasses_box->removeItem(itemIdx); + } +} + +void SubclassesDlg::changeCurrentURL(const QString &str) +{ + if ( subclasses_box->currentItem() > -1 ) + { + subclasses_box->changeItem(str, subclasses_box->currentItem()); + } +} + +void SubclassesDlg::currentRelationChanged( QListBoxItem * item ) +{ + if (item) + { + subclass_url->setEnabled(true); + subclass_url->setURL(item->text()); + } +} + diff --git a/buildtools/lib/widgets/subclassesdlg.h b/buildtools/lib/widgets/subclassesdlg.h new file mode 100644 index 00000000..46b07b31 --- /dev/null +++ b/buildtools/lib/widgets/subclassesdlg.h @@ -0,0 +1,58 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef SUBCLASSESDLG_H +#define SUBCLASSESDLG_H +#include "domutil.h" +#include "subclassesdlgbase.h" + +/** +Subclass creation dialog. +*/ +class SubclassesDlg : public SubclassesDlgBase +{ + Q_OBJECT + +public: + SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SubclassesDlg(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + virtual void accept(); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void newRelation(); + virtual void removeRelation(); + virtual void changeCurrentURL(const QString &str); + virtual void currentRelationChanged(QListBoxItem *item); + +private: + QString m_form; + DomUtil::PairList &m_config; + QString m_projectDir; +}; + +#endif + diff --git a/buildtools/lib/widgets/subclassesdlgbase.ui b/buildtools/lib/widgets/subclassesdlgbase.ui new file mode 100644 index 00000000..026ab2ca --- /dev/null +++ b/buildtools/lib/widgets/subclassesdlgbase.ui @@ -0,0 +1,224 @@ + +SubclassesDlgBase + + + SubclassesDlgBase + + + + 0 + 0 + 514 + 278 + + + + Related Subclasses + + + true + + + + unnamed + + + + add_button + + + &Add Relation + + + false + + + + + remove_button + + + &Remove Relation + + + false + + + + + subclasses_box + + + + + subclass_url + + + + 0 + 24 + + + + WheelFocus + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 90 + + + + + + textLabel2 + + + + 5 + 5 + 0 + 0 + + + + Related subclass &location: + + + WordBreak|AlignVCenter + + + subclass_url + + + + + layout3 + + + + unnamed + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 310 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + true + + + false + + + + + + + + + buttonOk + clicked() + SubclassesDlgBase + accept() + + + subclass_url + textChanged(const QString&) + SubclassesDlgBase + changeCurrentURL(const QString&) + + + remove_button + clicked() + SubclassesDlgBase + removeRelation() + + + buttonCancel + clicked() + SubclassesDlgBase + reject() + + + add_button + clicked() + SubclassesDlgBase + newRelation() + + + subclasses_box + clicked(QListBoxItem*) + SubclassesDlgBase + currentRelationChanged(QListBoxItem*) + + + + subclasses_box + add_button + subclass_url + remove_button + buttonOk + buttonCancel + + + kdialog.h + + + changeCurrentURL(const QString &str) + removeRelation() + newRelation() + currentRelationChanged(QListBoxItem *item) + + + + + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/pascal/Makefile.am b/buildtools/pascal/Makefile.am new file mode 100644 index 00000000..d975575a --- /dev/null +++ b/buildtools/pascal/Makefile.am @@ -0,0 +1,24 @@ +INCLUDES = -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \ + -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util -I$(top_builddir)/buildtools/lib/widgets \ + $(all_includes) + +kde_module_LTLIBRARIES = libkdevpascalproject.la +libkdevpascalproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevpascalproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la + +libkdevpascalproject_la_SOURCES = pascalproject_part.cpp pascalproject_widget.cpp pascalproject_optionsdlgbase.ui pascalprojectoptionsdlg.cpp pascalglobaloptionsdlg.cpp service.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevpascalproject.desktop + +rcdir = $(kde_datadir)/kdevpascalproject +rc_DATA = kdevpascalproject.rc + + + + diff --git a/buildtools/pascal/README.dox b/buildtools/pascal/README.dox new file mode 100644 index 00000000..4f3b9897 --- /dev/null +++ b/buildtools/pascal/README.dox @@ -0,0 +1,13 @@ +/** \class PascalProjectPart +This is the Pascal build tool part. + +Common build tool part part for all available pascal compilers (gpc, fpc, dcc). +It holds no project file list and tries to abstract from their specifics. + +\authors Alexander Dymo + +\maintainer Alexander Dymo + +\deprecated This class is deprecated, use GenericProjectPart (buildtools/generic) instead. + +*/ diff --git a/buildtools/pascal/kdevpascalproject.desktop b/buildtools/pascal/kdevpascalproject.desktop new file mode 100644 index 00000000..05b7e507 --- /dev/null +++ b/buildtools/pascal/kdevpascalproject.desktop @@ -0,0 +1,93 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Pascal Project +Comment[br]=Raktres Pascal +Comment[ca]=Projecte Pascal +Comment[da]=Pascal projekt +Comment[de]=Pascal-Projekt für KDevelop +Comment[el]=Έργο Pascal +Comment[es]=Proyecto de Pascal +Comment[et]=Pascali projekt +Comment[eu]=Pascal proiektua +Comment[fa]=پروژۀ پاسکال +Comment[fr]=Projet en langage PASCAL +Comment[ga]=Tionscadal Pascal +Comment[gl]=Proxecto Pascal +Comment[hi]=पास्कल परियोजना +Comment[hu]=Pascal-projekt +Comment[is]=Pascal verkefni +Comment[it]=Progetto per Pascal +Comment[ja]=Pascal プロジェクト +Comment[ms]=Projek Pascal +Comment[nds]=Pascal-Projekt +Comment[ne]=पास्कल परियोजना +Comment[nl]=Pascal-project +Comment[pa]=ਪਾਸਕਲ ਪ੍ਰੋਜੈਕਟ +Comment[pl]=Projekt: Pascal +Comment[pt]=Projecto de Pascal +Comment[pt_BR]=Projeto Pascal +Comment[ru]=Проект Pascal +Comment[sk]=Pascal projekt +Comment[sl]=Projekt Pascal +Comment[sr]=Pascal пројекат +Comment[sr@Latn]=Pascal projekat +Comment[sv]=Pascal-projekt +Comment[ta]=பாஸ்கல் பிராஜக்ட் +Comment[tg]=Лоиҳаи Pascal +Comment[tr]=Pascal Projesi +Comment[uz]=Pascal loyihasi +Comment[uz@cyrillic]=Pascal лойиҳаси +Comment[zh_CN]=Pascal 工程 +Comment[zh_TW]=Pascal 專案 +Name=KDevPascalProject +Name[da]=KDevelop Pascal-projekt +Name[de]=Pascal-Projekt (KDevelop) +Name[hi]=के-डेव-पास्कल-परियोजना +Name[nds]=Pascal-Projekt (KDevelop) +Name[ne]=केडीई विकास पास्कल परियोजना +Name[pl]=KDevProjektPascal +Name[sk]=KDevPascalProjekt +Name[sv]=KDevelop Pascal-projekt +Name[ta]=கெடெவ் பாஸ்கல் பிராஜக்ட் +Name[tg]=Лоиҳаи ПаскалKDev +Name[zh_TW]=KDevelop Pascal 專案 +GenericName=Pascal Project +GenericName[br]=Raktres Pascal +GenericName[ca]=Projecte Pascal +GenericName[da]=Pascal projekt +GenericName[de]=Pascal-Projekt +GenericName[el]=Έργο Pascal +GenericName[es]=Proyecto de Pascal +GenericName[et]=Pascali projekt +GenericName[eu]=Pascal proiektua +GenericName[fa]=پروژۀ پاسکال +GenericName[fr]=Projet en langage PASCAL +GenericName[ga]=Tionscadal Pascal +GenericName[gl]=Proxecto Pascal +GenericName[hi]=पास्कल परियोजना +GenericName[hu]=Pascal-projekt +GenericName[it]=Progetto in Pascal +GenericName[ja]=Pascal プロジェクト +GenericName[ms]=Projek Pascal +GenericName[nds]=Pascal-Projekt +GenericName[ne]=पास्कल परियोजना +GenericName[nl]=Pascal-project +GenericName[pl]=Projekt: Pascal +GenericName[pt]=Projecto de Pascal +GenericName[pt_BR]=Projeto Pascal +GenericName[ru]=Проект Pascal +GenericName[sk]=Pascal projekt +GenericName[sl]=Projekt Pascal +GenericName[sr]=Pascal пројекат +GenericName[sr@Latn]=Pascal projekat +GenericName[sv]=Pascal-projekt +GenericName[ta]=பாஸ்கல் பிராஜக்ட் +GenericName[tr]=Pascal Projesi +GenericName[uz]=Pascal loyihasi +GenericName[uz@cyrillic]=Pascal лойиҳаси +GenericName[zh_CN]=Pascal 工程 +GenericName[zh_TW]=Pascal 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevpascalproject +X-KDevelop-Version=5 diff --git a/buildtools/pascal/kdevpascalproject.rc b/buildtools/pascal/kdevpascalproject.rc new file mode 100644 index 00000000..9e7f46fd --- /dev/null +++ b/buildtools/pascal/kdevpascalproject.rc @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/buildtools/pascal/pascalglobaloptionsdlg.cpp b/buildtools/pascal/pascalglobaloptionsdlg.cpp new file mode 100644 index 00000000..a710db19 --- /dev/null +++ b/buildtools/pascal/pascalglobaloptionsdlg.cpp @@ -0,0 +1,132 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include +#include +#include +#include + +#include +#include +#include + +#include "kdevcompileroptions.h" + +#include "service.h" +#include "pascalproject_part.h" +#include "pascalglobaloptionsdlg.h" + +PascalGlobalOptionsDlg::PascalGlobalOptionsDlg(PascalProjectPart *part, QWidget* parent, const char* name, WFlags fl) + :PascalProjectOptionsDlgBase(parent,name,fl), m_part(part) +{ + delete config_label; + delete config_combo; + delete addconfig_button; + delete removeconfig_button; + delete compiler_label; + delete configuration_layout; + delete configuration_line; + delete exec_label; + delete exec_edit; + delete mainSourceLabel; + delete mainSourceUrl; + delete defaultopts_button; + + + offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); + + ServiceComboBox::insertStringList(compiler_box, offers, &service_names, &service_execs); + + if (offers.isEmpty()) + options_button->setEnabled(false); + + currentCompiler = QString::null; + + /*kdDebug() << ServiceComboBox::defaultCompiler() << endl; + kdDebug() << ServiceComboBox::itemForText(ServiceComboBox::defaultCompiler(), service_names) << endl; + kdDebug() << compiler_box->text(ServiceComboBox::itemForText(ServiceComboBox::defaultCompiler(), service_names)) << endl; +*/ + ServiceComboBox::setCurrentText(compiler_box, ServiceComboBox::defaultCompiler(), service_names); + compiler_box_activated(compiler_box->currentText()); +} + +PascalGlobalOptionsDlg::~PascalGlobalOptionsDlg() +{ +} + +void PascalGlobalOptionsDlg::optionsButtonClicked() +{ + QString name = ServiceComboBox::currentText(compiler_box, service_names); + KDevCompilerOptions *plugin = m_part->createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, options_edit->text()); + options_edit->setText(flags); + delete plugin; + } +} + +void PascalGlobalOptionsDlg::compiler_box_activated(const QString& text) +{ + kdDebug() << "text changed from " << currentCompiler << " to " << text << endl; + if (currentCompiler == text) + return; + if (!currentCompiler.isEmpty()) + saveCompilerOpts(currentCompiler); + currentCompiler = text; + readCompilerOpts(currentCompiler); +} + +void PascalGlobalOptionsDlg::accept() +{ + saveCompilerOpts(currentCompiler); + + saveConfigCache(); +} + +void PascalGlobalOptionsDlg::saveCompilerOpts( QString compiler ) +{ + configCache[compiler] = options_edit->text(); +} + +void PascalGlobalOptionsDlg::readCompilerOpts( QString compiler ) +{ + QString settings = configCache[compiler]; + if (settings.isEmpty()) + { + KConfig *config = KGlobal::config(); + config->setGroup("Pascal Compiler"); + settings = config->readPathEntry(compiler); + } + + options_edit->setText(settings); +} + +void PascalGlobalOptionsDlg::readConfigCache( ) +{ +/* KConfig *config = KGlobal::config(); + config->setGroup("Pascal Compiler"); + + QMap settings = config->entryMap("Pascal Compiler"); +*/ +} + +void PascalGlobalOptionsDlg::saveConfigCache( ) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Pascal Compiler"); + + for (QMap::iterator it = configCache.begin(); it != configCache.end(); ++it) + { + config->writeEntry(it.key(), it.data()); + } +} + +#include "pascalglobaloptionsdlg.moc" diff --git a/buildtools/pascal/pascalglobaloptionsdlg.h b/buildtools/pascal/pascalglobaloptionsdlg.h new file mode 100644 index 00000000..14da2221 --- /dev/null +++ b/buildtools/pascal/pascalglobaloptionsdlg.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef PASCALGLOBALOPTIONSDLG_H +#define PASCALGLOBALOPTIONSDLG_H + +#include + +#include + +#include "pascalproject_optionsdlgbase.h" + +class PascalProjectPart; + +class PascalGlobalOptionsDlg : public PascalProjectOptionsDlgBase +{ + Q_OBJECT + +public: + PascalGlobalOptionsDlg(PascalProjectPart *part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~PascalGlobalOptionsDlg(); + +public slots: + virtual void accept(); + +protected slots: + virtual void optionsButtonClicked(); + virtual void compiler_box_activated(const QString& text); + +private: + PascalProjectPart *m_part; + KTrader::OfferList offers; + QString currentCompiler; + QStringList service_names; + QStringList service_execs; + QMap configCache; + + void saveCompilerOpts(QString compiler); + void readCompilerOpts(QString compiler); + + void readConfigCache(); + void saveConfigCache(); +}; + +#endif diff --git a/buildtools/pascal/pascalproject_optionsdlgbase.ui b/buildtools/pascal/pascalproject_optionsdlgbase.ui new file mode 100644 index 00000000..0f0b2324 --- /dev/null +++ b/buildtools/pascal/pascalproject_optionsdlgbase.ui @@ -0,0 +1,474 @@ + +PascalProjectOptionsDlgBase + + + PascalProjectOptionsDlgBase + + + true + + + + 0 + 0 + 600 + 480 + + + + Pascal Compiler + + + + unnamed + + + + configuration_layout + + + + unnamed + + + + config_label + + + + 1 + 5 + 0 + 0 + + + + Con&figuration: + + + config_combo + + + + + config_combo + + + + 3 + 0 + 0 + 0 + + + + true + + + + + Spacer17_2 + + + Horizontal + + + Fixed + + + + 20 + 8 + + + + + + addconfig_button + + + &Add + + + + + removeconfig_button + + + &Remove + + + + + Spacer18_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + options_button + + + + 0 + 0 + 0 + 0 + + + + + 30 + 32767 + + + + ... + + + + + options_label + + + + 4 + 5 + 0 + 0 + + + + Compiler op&tions: + + + compiler_box + + + + + compiler_label + + + + 4 + 5 + 0 + 0 + + + + &Pascal compiler: + + + compiler_box + + + + + exec_edit + + + + + options_edit + + + + + compiler_box + + + + + exec_label + + + + 4 + 5 + 0 + 0 + + + + Compiler co&mmand: + + + compiler_box + + + + + configuration_line + + + HLine + + + Sunken + + + Horizontal + + + + + spacer11 + + + Vertical + + + Fixed + + + + 20 + 16 + + + + + + spacer12 + + + Vertical + + + Fixed + + + + 20 + 16 + + + + + + spacer13 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 400 + 20 + + + + + + defaultopts_button + + + Load &Default Compiler Options + + + + + mainSourceUrl + + + + 0 + 26 + + + + WheelFocus + + + + + mainSourceLabel + + + + 4 + 5 + 0 + 0 + + + + Main &source file: + + + compiler_box + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + compiler_box + activated(const QString&) + PascalProjectOptionsDlgBase + compiler_box_activated(const QString&) + + + removeconfig_button + clicked() + PascalProjectOptionsDlgBase + configRemoved() + + + config_combo + textChanged(const QString&) + PascalProjectOptionsDlgBase + configComboTextChanged(const QString&) + + + config_combo + activated(const QString&) + PascalProjectOptionsDlgBase + configChanged(const QString&) + + + addconfig_button + clicked() + PascalProjectOptionsDlgBase + configAdded() + + + options_button + clicked() + PascalProjectOptionsDlgBase + optionsButtonClicked() + + + exec_edit + textChanged(const QString&) + PascalProjectOptionsDlgBase + setDirty() + + + options_edit + textChanged(const QString&) + PascalProjectOptionsDlgBase + setDirty() + + + mainSourceUrl + textChanged(const QString&) + PascalProjectOptionsDlgBase + setDirty() + + + mainSourceUrl + urlSelected(const QString&) + PascalProjectOptionsDlgBase + setDirty() + + + compiler_box + activated(const QString&) + PascalProjectOptionsDlgBase + setDirty() + + + compiler_box + textChanged(const QString&) + PascalProjectOptionsDlgBase + setDirty() + + + defaultopts_button + clicked() + PascalProjectOptionsDlgBase + setDefaultOptions() + + + defaultopts_button + clicked() + PascalProjectOptionsDlgBase + setDirty() + + + + compiler_box + exec_edit + options_edit + options_button + defaultopts_button + mainSourceUrl + config_combo + addconfig_button + removeconfig_button + + + kdialog.h + + + compiler_box_activated(const QString&) + addconfig_button_clicked() + configRemoved() + configComboTextChanged(const QString&) + configChanged(const QString&) + optionsButtonClicked() + configAdded() + setDirty() + setDefaultOptions() + + + + + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/pascal/pascalproject_part.cpp b/buildtools/pascal/pascalproject_part.cpp new file mode 100644 index 00000000..3fe09420 --- /dev/null +++ b/buildtools/pascal/pascalproject_part.cpp @@ -0,0 +1,493 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "pascalproject_part.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevmakefrontend.h" +#include "kdevappfrontend.h" +#include "kdevpartcontroller.h" +#include "kdevlanguagesupport.h" +#include "kdevcompileroptions.h" +#include "runoptionswidget.h" +#include "envvartools.h" + +#include "pascalproject_widget.h" +#include "pascalprojectoptionsdlg.h" +#include "pascalglobaloptionsdlg.h" + +#include + +typedef KDevGenericFactory PascalProjectFactory; +static const KDevPluginInfo data("kdevpascalproject"); +K_EXPORT_COMPONENT_FACTORY( libkdevpascalproject, PascalProjectFactory( data ) ) + +PascalProjectPart::PascalProjectPart(QObject *parent, const char *name, const QStringList& ) + :KDevBuildTool(&data, parent, name ? name : "PascalProjectPart" ) +{ + setInstance(PascalProjectFactory::instance()); + setXMLFile("kdevpascalproject.rc"); + + KAction *action; + action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8, + this, SLOT(slotBuild()), + actionCollection(), "build_build" ); + action->setToolTip(i18n("Build project")); + action->setWhatsThis(i18n("Build project

Runs the compiler on a main source file of the project. " + "The compiler and the main source file can be set in project settings, Pascal Compiler tab.")); + action = new KAction( i18n("Execute Program"), "exec", 0, + this, SLOT(slotExecute()), + actionCollection(), "build_execute" ); + action->setToolTip(i18n("Execute program")); + action->setWhatsThis(i18n("Execute program

Executes the main program specified in project settings, Run options tab. " + "If nothing is set, the binary file with the same name as the main source file name is executed.")); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + + connect( core(), SIGNAL(configWidget(KDialogBase*)), + this, SLOT(configWidget(KDialogBase*)) ); + +// m_widget = new PascalProjectWidget(this); + +// QWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?")); + + // now you decide what should happen to the widget. Take a look at kdevcore.h + // or at other plugins how to embed it. + + // if you want to embed your widget as an outputview, simply uncomment + // the following line. + + // mainWindow()->embedOutputView( m_widget, "name that should appear", "enter a tooltip" ); + +} + +PascalProjectPart::~PascalProjectPart() +{ +// delete m_widget; +} + +/** + * @todo This should really be merged with FileTreeWidget::matchesHidePattern() + * and put in its own class. Currently this is repeated in scriptprojectpart.cpp, pascalproject_part.cpp, adaproject_part.cpp + */ +static bool matchesPattern(const QString &fileName, const QStringList &patternList) +{ + QStringList::ConstIterator it; + for (it = patternList.begin(); it != patternList.end(); ++it) { + QRegExp re(*it, true, true); + if (re.search(fileName) == 0 && re.matchedLength() == (int)fileName.length()) + return true; + } + + return false; +} + +void PascalProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + m_buildDir = dirName; + m_projectDir = dirName; + m_projectName = projectName; + + QDomDocument &dom = *projectDom(); + // Set the default directory radio to "executable" + if (DomUtil::readEntry(dom, "/kdevpascalproject/run/directoryradio") == "" ) { + DomUtil::writeEntry(dom, "/kdevpascalproject/run/directoryradio", "executable"); + } + + loadProjectConfig(); + + // Put all files from all subdirectories into file list + QValueStack s; + int prefixlen = m_projectDir.length()+1; + s.push(m_projectDir); + + QStringList includepatternList; + if ( languageSupport() ) + { + KMimeType::List list = languageSupport()->mimeTypes(); + KMimeType::List::Iterator it = list.begin(); + while( it != list.end() ){ + includepatternList += (*it)->patterns(); + ++it; + } + } + QString excludepatterns = "*~"; + QStringList excludepatternList = QStringList::split(",", excludepatterns); + + QDir dir; + do { + dir.setPath(s.pop()); + kdDebug(9033) << "Examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + QPtrListIterator it(*dirEntries); + for (; it.current(); ++it) { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + QString path = it.current()->absFilePath(); + if (it.current()->isDir()) { + kdDebug(9033) << "Pushing: " << path << endl; + s.push(path); + } + else { + if (matchesPattern(path, includepatternList) + && !matchesPattern(path, excludepatternList)) { + kdDebug(9033) << "Adding: " << path << endl; + m_sourceFiles.append(path.mid(prefixlen)); + } else { + kdDebug(9033) << "Ignoring: " << path << endl; + } + } + } + } while (!s.isEmpty()); + + KDevProject::openProject( dirName, projectName ); +} + +void PascalProjectPart::closeProject() +{ +} + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList PascalProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry(*projectDom(), "/kdevpascalproject/run/envvars", "envvar", "name", "value"); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString PascalProjectPart::runDirectory() const +{ + QString cwd = defaultRunDirectory("kdevpascalproject"); + if (cwd.isEmpty()) + cwd = buildDirectory(); + return cwd; +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ +QString PascalProjectPart::mainProgram() const +{ + QDomDocument * dom = projectDom(); + + if ( !dom ) return QString(); + + QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevpascalproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + + return QString(); +} + +/** Retuns a QString with the debug command line arguments */ +QString PascalProjectPart::debugArguments() const +{ + return DomUtil::readEntry(*projectDom(), "/kdevpascalproject/run/globaldebugarguments"); +} + + +/** Retuns a QString with the run command line arguments */ +QString PascalProjectPart::runArguments() const +{ + return DomUtil::readEntry(*projectDom(), "/kdevpascalproject/run/programargs"); +} + +QString PascalProjectPart::mainSource() const +{ + return projectDirectory() + "/" + m_mainSource; +} + +void PascalProjectPart::setMainSource(QString fullPath) +{ + QString olddir = activeDirectory(); + m_mainSource = fullPath.replace(QRegExp(QString(projectDirectory() + QString("/"))),""); + emit activeDirectoryChanged( olddir, activeDirectory() ); +} + +QString PascalProjectPart::projectDirectory() const +{ + return m_projectDir; +} + +QString PascalProjectPart::projectName() const +{ + return m_projectName; +} + +QString PascalProjectPart::activeDirectory() const +{ + QFileInfo fi(mainSource()); + return fi.dirPath(true).replace(QRegExp(projectDirectory()),""); +} + +QString PascalProjectPart::buildDirectory() const +{ + QFileInfo fi(mainSource()); + return fi.dirPath(true); +} + +void PascalProjectPart::listOfFiles(QStringList &result, QString path) const +{ + QDir d(path); + if (!d.exists()) + return; + QFileInfoList *entries = const_cast(d.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden)); + for (QFileInfo *it = entries->first(); it; it = entries->next()) + { + if ((it->isDir()) && (it->filePath() != path)) + { +// qWarning("entering dir %s", it->dirPath().latin1()); + listOfFiles(result, it->dirPath()); + } + else + { +// qWarning("adding to result: %s", it->filePath().latin1()); + result << it->filePath(); + } + } +} + +QStringList PascalProjectPart::allFiles() const +{ +// QStringList files; + +// listOfFiles(files, projectDirectory()); + +// return files; + return m_sourceFiles; +} + +void PascalProjectPart::addFile(const QString& /*fileName*/) +{ +} + +void PascalProjectPart::addFiles(const QStringList& /*fileList*/) +{ +} + +void PascalProjectPart::removeFile(const QString& /*fileName*/) +{ +} + +void PascalProjectPart::removeFiles(const QStringList& /*fileList*/) +{ +} + +void PascalProjectPart::slotBuild() +{ + if (partController()->saveAllFiles()==false) + return; //user cancelled + + QString cmdline = m_compilerExec + " " + m_compilerOpts + " "; + + if (cmdline.isEmpty()) + { + KMessageBox::sorry(0, i18n("Could not find pascal compiler.\nCheck if your compiler settings are correct.")); + return; + } + + QFileInfo fi(mainSource()); + cmdline += fi.fileName(); + + QString dircmd = "cd "; + dircmd += KProcess::quote(buildDirectory()); + dircmd += " && "; + + makeFrontend()->queueCommand(buildDirectory(), dircmd + cmdline); +} + +void PascalProjectPart::slotExecute() +{ + partController()->saveAllFiles(); + + QDomDocument &dom = *(projectDom()); + bool runInTerminal = DomUtil::readBoolEntry(dom, "/kdevpascalproject/run/terminal", true); + + // Get the run environment variables pairs into the environstr string + // in the form of: "ENV_VARIABLE=ENV_VALUE" + // Note that we quote the variable value due to the possibility of + // embedded spaces + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*projectDom(), "/kdevpascalproject/run/envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + for (it = envvars.begin(); it != envvars.end(); ++it) { + environstr += (*it).first; + environstr += "="; + environstr += EnvVarTools::quote((*it).second); + environstr += " "; + } + + QString program = mainProgram(); + program.prepend(environstr); + program += " " + DomUtil::readEntry(*projectDom(), "/kdevpascalproject/run/programargs"); + + appFrontend()->startAppCommand(buildDirectory(), program, runInTerminal); +} + +void PascalProjectPart::changedFiles( const QStringList & fileList ) +{ + KDevProject::changedFiles(fileList); +} + +void PascalProjectPart::changedFile( const QString & fileName ) +{ + KDevProject::changedFile(fileName); +} + +void PascalProjectPart::projectConfigWidget( KDialogBase * dlg ) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Pascal Compiler")); + PascalProjectOptionsDlg *w = new PascalProjectOptionsDlg(this, vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); + connect( dlg, SIGNAL(okClicked()), this, SLOT(loadProjectConfig()) ); + + vbox = dlg->addVBoxPage(i18n("Run Options"), i18n("Run Options"), BarIcon( "make", KIcon::SizeMedium )); + RunOptionsWidget *w3 = new RunOptionsWidget(*projectDom(), "/kdevpascalproject", buildDirectory(), vbox); + connect( dlg, SIGNAL(okClicked()), w3, SLOT(accept()) ); + +} + +void PascalProjectPart::loadProjectConfig( ) +{ + QDomDocument &dom = *(projectDom()); + + QString config = DomUtil::readEntry(dom, "/kdevpascalproject/general/useconfiguration", "default"); + m_mainSource = DomUtil::readEntry(dom, QString("/kdevpascalproject/configurations/") + config + QString("/mainsource") ); + m_compilerOpts = DomUtil::readEntry(dom, QString("/kdevpascalproject/configurations/") + config + QString("/compileroptions")); + m_compilerExec = DomUtil::readEntry(dom, QString("/kdevpascalproject/configurations/") + config + QString("/compilerexec")); + + if (m_compilerExec.isEmpty()) + { + KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); + QValueList::ConstIterator it; + for (it = offers.begin(); it != offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + m_compilerExec = (*it)->exec(); + break; + } + } + } +} + +void PascalProjectPart::configWidget( KDialogBase * dlg ) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Pascal Compiler")); + PascalGlobalOptionsDlg *w = new PascalGlobalOptionsDlg(this, vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + +KDevCompilerOptions *PascalProjectPart::createCompilerOptions(const QString &name) +{ + KService::Ptr service = KService::serviceByDesktopName(name); + if (!service) { + kdDebug() << "Can't find service " << name; + return 0; + } + + KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library())); + if (!factory) { + QString errorMessage = KLibLoader::self()->lastErrorMessage(); + KMessageBox::error(0, i18n("There was an error loading the module %1.\n" + "The diagnostics is:\n%2").arg(service->name()).arg(errorMessage)); + exit(1); + } + + QStringList args; + QVariant prop = service->property("X-KDevelop-Args"); + if (prop.isValid()) + args = QStringList::split(" ", prop.toString()); + + QObject *obj = factory->create(this, service->name().latin1(), + "KDevCompilerOptions", args); + + if (!obj->inherits("KDevCompilerOptions")) { + kdDebug() << "Component does not inherit KDevCompilerOptions" << endl; + return 0; + } + KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj; + + return dlg; +} + +QString PascalProjectPart::defaultOptions( const QString compiler ) const +{ + KConfig *config = KGlobal::config(); + config->setGroup("Pascal Compiler"); + return config->readPathEntry(compiler); +} + +#include "pascalproject_part.moc" + + +/*! + \fn PascalProjectPart::distFiles() const + */ +QStringList PascalProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QDir dir(projectDir); + QStringList files = dir.entryList( "Makefile"); + return sourceList + files; +} diff --git a/buildtools/pascal/pascalproject_part.h b/buildtools/pascal/pascalproject_part.h new file mode 100644 index 00000000..3273011d --- /dev/null +++ b/buildtools/pascal/pascalproject_part.h @@ -0,0 +1,95 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef __KDEVPART_PASCALPROJECT_H__ +#define __KDEVPART_PASCALPROJECT_H__ + +#include + +#include "kdevbuildtool.h" + +class PascalProjectWidget; +class KDialogBase; +class KDevCompilerOptions; + +class PascalProjectPart : public KDevBuildTool +{ + Q_OBJECT +public: + PascalProjectPart(QObject *parent, const char *name, const QStringList &); + ~PascalProjectPart(); + + virtual void openProject(const QString &dirName, const QString &projectName); + virtual void closeProject(); + + /**Returns the name of the main source file without extension. + All pascal compilers call the binary by that way*/ + virtual QString mainProgram() const; + /**Main source file (like src/main.pp)*/ + virtual QString mainSource() const; + virtual void setMainSource(QString fullPath); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString activeDirectory() const; + /**The location of the main source file*/ + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + + /**Returns everything in the project directory*/ + virtual QStringList allFiles() const; + /**This does absolutelly nothing*/ + virtual void addFile(const QString &fileName); + /**This does absolutelly nothing*/ + virtual void addFiles(const QStringList &fileList); + /**This does absolutelly nothing*/ + virtual void removeFile(const QString &fileName); + /**This does absolutelly nothing*/ + virtual void removeFiles(const QStringList &fileList); + + virtual void changedFiles( const QStringList & fileList ); + virtual void changedFile( const QString & fileName ); + + KDevCompilerOptions *createCompilerOptions(const QString &name); + + virtual QString defaultOptions(const QString compiler) const; + QStringList distFiles() const; + +public slots: + /**loads config from project file*/ + void loadProjectConfig(); + +private slots: + void slotBuild(); + void slotExecute(); + void projectConfigWidget(KDialogBase *dlg); + void configWidget(KDialogBase *dlg); + +private: + QGuardedPtr m_widget; + + void listOfFiles(QStringList &result, QString path) const; + + QString m_buildDir; + QString m_projectDir; + QString m_projectName; + + QString m_mainProg; + QString m_mainSource; + QString m_compilerExec; + QString m_compilerOpts; + + QStringList m_sourceFiles; +}; + +#endif diff --git a/buildtools/pascal/pascalproject_widget.cpp b/buildtools/pascal/pascalproject_widget.cpp new file mode 100644 index 00000000..039c97e6 --- /dev/null +++ b/buildtools/pascal/pascalproject_widget.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include + + +#include + + +#include "pascalproject_part.h" +#include "pascalproject_widget.h" + + +PascalProjectWidget::PascalProjectWidget(PascalProjectPart *part) + : QWidget(0, "PascalProject widget") +{ + Q_UNUSED( part ); +} + + +PascalProjectWidget::~PascalProjectWidget() +{ +} + + +#include "pascalproject_widget.moc" diff --git a/buildtools/pascal/pascalproject_widget.h b/buildtools/pascal/pascalproject_widget.h new file mode 100644 index 00000000..198cf794 --- /dev/null +++ b/buildtools/pascal/pascalproject_widget.h @@ -0,0 +1,25 @@ +#ifndef __PASCALPROJECT_WIDGET_H__ +#define __PASCALPROJECT_WIDGET_H__ + + +#include +#include + + +class KDevProject; +class PascalProjectPart; + + +class PascalProjectWidget : public QWidget +{ + Q_OBJECT + +public: + + PascalProjectWidget(PascalProjectPart *part); + ~PascalProjectWidget(); + +}; + + +#endif diff --git a/buildtools/pascal/pascalprojectoptionsdlg.cpp b/buildtools/pascal/pascalprojectoptionsdlg.cpp new file mode 100644 index 00000000..7a97cea3 --- /dev/null +++ b/buildtools/pascal/pascalprojectoptionsdlg.cpp @@ -0,0 +1,210 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "domutil.h" +#include "kdevcompileroptions.h" + +#include "service.h" +#include "pascalproject_part.h" +#include "pascalprojectoptionsdlg.h" + +PascalProjectOptionsDlg::PascalProjectOptionsDlg(PascalProjectPart *part, QWidget* parent, const char* name, WFlags fl) + : PascalProjectOptionsDlgBase(parent,name, fl), m_part(part) +{ + config_combo->setValidator(new QRegExpValidator(QRegExp("^\\D.*"), this)); + + offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); + + ServiceComboBox::insertStringList(compiler_box, offers, &service_names, &service_execs); + + if (offers.isEmpty()) + options_button->setEnabled(false); + + allConfigs = allBuildConfigs(); + config_combo->insertStringList(allConfigs); + + dirty = false; + + QDomDocument &dom = *(m_part->projectDom()); + currentConfig = QString::null; + configChanged(DomUtil::readEntry(dom, "/kdevpascalproject/general/useconfiguration", "default")); +} + +PascalProjectOptionsDlg::~PascalProjectOptionsDlg() +{ +} + +QStringList PascalProjectOptionsDlg::allBuildConfigs() +{ + QDomDocument &dom = *(m_part->projectDom()); + + QStringList allConfigs; + allConfigs.append("default"); + + QDomNode node = dom.documentElement().namedItem("kdevpascalproject").namedItem("configurations"); + QDomElement childEl = node.firstChild().toElement(); + while (!childEl.isNull()) { + QString config = childEl.tagName(); + kdDebug() << "Found config " << config << endl; + if (config != "default") + allConfigs.append(config); + childEl = childEl.nextSibling().toElement(); + } + + return allConfigs; +} + +void PascalProjectOptionsDlg::accept() +{ + DomUtil::writeEntry(*m_part->projectDom(), "/kdevpascalproject/general/useconfiguration", currentConfig); + if (dirty) + { + saveConfig(currentConfig); + } +} + +void PascalProjectOptionsDlg::compiler_box_activated( const QString& /*s*/ ) +{ + QString exec = ServiceComboBox::currentText(compiler_box, service_execs); + exec_edit->setText(exec); +} + +void PascalProjectOptionsDlg::saveConfig( QString config ) +{ + QDomDocument dom = *m_part->projectDom(); + QString prefix = "/kdevpascalproject/configurations/" + config + "/"; + + DomUtil::writeEntry(dom, prefix + "compiler", + ServiceComboBox::currentText(compiler_box, service_names)); + DomUtil::writeEntry(dom, prefix + "compileroptions", options_edit->text()); + DomUtil::writeEntry(dom, prefix + "compilerexec", exec_edit->text()); + DomUtil::writeEntry(dom, prefix + "mainsource", mainSourceUrl->url().replace(QRegExp(m_part->projectDirectory() + QString("/")),"")); +} + +void PascalProjectOptionsDlg::readConfig( QString config ) +{ + QDomDocument dom = *m_part->projectDom(); + QString prefix = "/kdevpascalproject/configurations/" + config + "/"; + + QString compiler = DomUtil::readEntry(dom, prefix + "compiler", ""); + + if (compiler.isEmpty()) + { + offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); + QValueList::ConstIterator it; + for (it = offers.begin(); it != offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + compiler = (*it)->name(); + kdDebug() << "compiler is " << compiler << endl; + break; + } + } + } + ServiceComboBox::setCurrentText(compiler_box, compiler, service_names); + + QString exec = DomUtil::readEntry(dom, prefix + "compilerexec", ""); + if (exec.isEmpty()) + exec = ServiceComboBox::currentText(compiler_box, service_execs); + exec_edit->setText(exec); + options_edit->setText(DomUtil::readEntry(dom, prefix + "compileroptions")); + mainSourceUrl->setURL(m_part->projectDirectory() + "/" + DomUtil::readEntry(dom, prefix + "mainsource")); +} + +void PascalProjectOptionsDlg::configComboTextChanged(const QString &config) +{ + bool canAdd = !allConfigs.contains(config) && !config.contains("/") && !config.isEmpty(); + bool canRemove = allConfigs.contains(config) && config != "default"; + addconfig_button->setEnabled(canAdd); + removeconfig_button->setEnabled(canRemove); +} + + +void PascalProjectOptionsDlg::configChanged(const QString &config) +{ + if (config == currentConfig || !allConfigs.contains(config)) + return; + + if (!currentConfig.isNull() && dirty) + saveConfig(currentConfig); + + currentConfig = config; + readConfig(config); + dirty = false; + + config_combo->blockSignals(true); + config_combo->setEditText(config); + config_combo->blockSignals(false); +} + + +void PascalProjectOptionsDlg::configAdded() +{ + QString config = config_combo->currentText(); + + allConfigs.append(config); + + config_combo->clear(); + config_combo->insertStringList(allConfigs); + configChanged(config); + setDirty(); // force saving +} + + +void PascalProjectOptionsDlg::configRemoved() +{ + QString config = config_combo->currentText(); + + QDomDocument dom = *m_part->projectDom(); + QDomNode node = dom.documentElement().namedItem("kdevpascalproject").namedItem("configurations"); + node.removeChild(node.namedItem(config)); + allConfigs.remove(config); + + config_combo->clear(); + config_combo->insertStringList(allConfigs); + + currentConfig = QString::null; + configChanged("default"); +} + +void PascalProjectOptionsDlg::optionsButtonClicked( ) +{ + QString name = ServiceComboBox::currentText(compiler_box, service_names); + KDevCompilerOptions *plugin = m_part->createCompilerOptions(name); + + if (plugin) { + QString flags = plugin->exec(this, options_edit->text()); + options_edit->setText(flags); + delete plugin; + } +} + +void PascalProjectOptionsDlg::setDirty( ) +{ + dirty = true; +} + +void PascalProjectOptionsDlg::setDefaultOptions( ) +{ + if (!compiler_box->currentText().isEmpty()) + options_edit->setText(m_part->defaultOptions(compiler_box->currentText())); +} + +#include "pascalprojectoptionsdlg.moc" diff --git a/buildtools/pascal/pascalprojectoptionsdlg.h b/buildtools/pascal/pascalprojectoptionsdlg.h new file mode 100644 index 00000000..70e911de --- /dev/null +++ b/buildtools/pascal/pascalprojectoptionsdlg.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef PASCALPROJECTOPTIONSDLG_H +#define PASCALPROJECTOPTIONSDLG_H + +#include + +#include "pascalproject_optionsdlgbase.h" + +class PascalProjectPart; +class KDevCompilerOptions; + +class PascalProjectOptionsDlg : public PascalProjectOptionsDlgBase +{ + Q_OBJECT + +public: + PascalProjectOptionsDlg(PascalProjectPart *part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~PascalProjectOptionsDlg(); + +public slots: + virtual void accept(); + +protected slots: + virtual void compiler_box_activated(const QString &s); + void configComboTextChanged(const QString &config); + void configChanged(const QString &config); + void configAdded(); + void configRemoved(); + void optionsButtonClicked(); + void setDirty(); + void setDefaultOptions(); + +private: + QStringList allConfigs; + QString currentConfig; + bool dirty; + + KTrader::OfferList offers; + QStringList service_names; + QStringList service_execs; + + PascalProjectPart *m_part; + + void saveConfig(QString config); + void readConfig(QString config); + QStringList allBuildConfigs(); +}; + +#endif + diff --git a/buildtools/pascal/service.cpp b/buildtools/pascal/service.cpp new file mode 100644 index 00000000..c678f916 --- /dev/null +++ b/buildtools/pascal/service.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include +#include + +#include +#include + +#include "service.h" + + +void ServiceComboBox::insertStringList(QComboBox *combo, const QValueList &list, + QStringList *names, QStringList *execs) +{ + QValueList::ConstIterator it; + for (it = list.begin(); it != list.end(); ++it) { + combo->insertItem((*it)->comment()); + (*names) << (*it)->desktopEntryName(); + (*execs) << (*it)->exec(); + kdDebug() << "insertStringList item " << (*it)->name() << "," << (*it)->exec() << endl; + } +} + +QString ServiceComboBox::currentText(QComboBox *combo, const QStringList &names) +{ + if (combo->currentItem() == -1) + return QString::null; + return names[combo->currentItem()]; +} + +void ServiceComboBox::setCurrentText(QComboBox *combo, const QString &str, const QStringList &names) +{ + QStringList::ConstIterator it; + int i = 0; + for (it = names.begin(); it != names.end(); ++it) { + if (*it == str) { + combo->setCurrentItem(i); + break; + } + ++i; + } +} + +int ServiceComboBox::itemForText(const QString &str, const QStringList &names) +{ + QStringList::ConstIterator it; + int i = 0; + for (it = names.begin(); it != names.end(); ++it) { + if (*it == str) { + return i; + } + ++i; + } + return 0; +} + +QString ServiceComboBox::defaultCompiler() +{ + KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); + QValueList::ConstIterator it; + for (it = offers.begin(); it != offers.end(); ++it) { + if ((*it)->property("X-KDevelop-Default").toBool()) { + return (*it)->name();; + } + } + return ""; +} diff --git a/buildtools/pascal/service.h b/buildtools/pascal/service.h new file mode 100644 index 00000000..30bb142b --- /dev/null +++ b/buildtools/pascal/service.h @@ -0,0 +1,29 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef SERVICE_H +#define SERVICE_H + +#include + +class ServiceComboBox +{ +public: + static void insertStringList(QComboBox *combo, const QValueList &list, + QStringList *names, QStringList *execs); + static QString currentText(QComboBox *combo, const QStringList &names); + static void setCurrentText(QComboBox *combo, const QString &str, const QStringList &names); + static int itemForText(const QString &str, const QStringList &names); + static QString defaultCompiler(); +}; + +#endif diff --git a/buildtools/qmake/Makefile.am b/buildtools/qmake/Makefile.am new file mode 100644 index 00000000..6b65901a --- /dev/null +++ b/buildtools/qmake/Makefile.am @@ -0,0 +1,34 @@ +# Here resides the troll project part for tmake or qmake + + +INCLUDES = -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/buildtools/lib/parsers/qmake \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + -I$(top_builddir)/buildtools/lib/widgets $(all_includes) + + +kde_module_LTLIBRARIES = libkdevtrollproject.la +libkdevtrollproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevtrollproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/util/libkdevutil.la $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la \ + $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la \ + $(top_builddir)/buildtools/lib/parsers/qmake/libkdevqmakeparser.la + +libkdevtrollproject_la_SOURCES = choosesubprojectdlg.cpp \ + choosesubprojectdlgbase.ui createscopedlg.cpp createscopedlgbase.ui disablesubprojectdlg.cpp \ + disablesubprojectdlgbase.ui newwidgetdlg.cpp newwidgetdlgbase.ui \ + projectconfigurationdlg.cpp projectconfigurationdlgbase.ui qmakedefaultopts.cpp \ + qmakeoptionswidget.cpp qmakeoptionswidgetbase.ui qmakescopeitem.cpp scope.cpp \ + trolllistview.cpp trollprojectpart.cpp trollprojectwidget.cpp + + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevtrollproject.desktop kdevtmakeproject.desktop + +rcdir = $(kde_datadir)/kdevtrollproject +rc_DATA = kdevtrollproject.rc +noinst_HEADERS = createscopedlg.h disablesubprojectdlg.h qmakedefaultopts.h \ + qmakeoptionswidget.h qmakescopeitem.h trolllistview.h diff --git a/buildtools/qmake/README b/buildtools/qmake/README new file mode 100644 index 00000000..0146b60f --- /dev/null +++ b/buildtools/qmake/README @@ -0,0 +1 @@ +Please read the README.dox file. \ No newline at end of file diff --git a/buildtools/qmake/README.dox b/buildtools/qmake/README.dox new file mode 100644 index 00000000..6f0a4027 --- /dev/null +++ b/buildtools/qmake/README.dox @@ -0,0 +1,39 @@ +/** \class TrollProjectPart +A projectmanager for qmake based projects. + +Loads and maintains .pro files (qmake project files). The trollprojectpart +supports subprojects and qmake scopes. Qmake projects can be configured on +project, subproject and file level. +It will regenerate a projects .pro files dynamically as you add,remove or +reconfigure (sub)projects. Unsupported qmake features will be left unchanged +(hopefully) no major testing has been run yet. + +\authors Bernd Gehrmann +\authors Thomas Hasart + +\maintainer Jakob Simon-Gaarde + +\feature Loads and maintains .pro files (qmake project files). +\feature Supports subprojects and qmake scopes. +\feature Qmake projects can be configured on project, subproject and file level. +\feature Regenerates a projects .pro files dynamically as you add, +remove or reconfigure (sub)projects. +\feature Unsupported qmake features will be left unchanged (hopefully) + no major testing has been run yet. + +\bug bugs in trollproject component at Bugzilla database + +\requirement QMake >= 3.0.3 + +\todo Relative directories (priority 1) + By default a qmake projects created with kdevelop must be distributable, + therefore all directory-selections must be relative the subproject where + it is used (user can override this ofcourse). So when a select-directory + dialog is opened getRelativeDirectory() (#include pathutil.h) should be + called. +\todo Ignore shell-expressions and qmake-functions (priority 2-3) + FileBuffer should recognize and ignore shell-expressions and qmake-functions. + (Jakob Simon-Gaarde says: I'm on this one) + + +*/ diff --git a/buildtools/qmake/choosesubprojectdlg.cpp b/buildtools/qmake/choosesubprojectdlg.cpp new file mode 100644 index 00000000..20264144 --- /dev/null +++ b/buildtools/qmake/choosesubprojectdlg.cpp @@ -0,0 +1,114 @@ +/*************************************************************************** + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include + +#include "trollprojectwidget.h" + +#include "choosesubprojectdlg.h" +#include "scope.h" + +ChooseSubprojectDlg::ChooseSubprojectDlg(TrollProjectWidget *widget, QWidget* parent, const char* name, bool modal, WFlags fl) + : ChooseSubprojectDlgBase(parent,name, modal,fl), m_widget(widget) +{ + connect(subprojects_view, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem *))); + if( m_widget->m_rootSubproject) + { + ChooseItem *it = new ChooseItem(m_widget->m_rootSubproject, subprojects_view, m_widget->m_rootSubproject->text(0)); + it->setPixmap(0, *(m_widget->m_rootSubproject->pixmap(0))); + it->setOpen(true); + fillSubprojectsView(it); + subprojects_view->setSelected(it, true); + } +} + +ChooseSubprojectDlg::~ChooseSubprojectDlg() +{ +} + +/*$SPECIALIZATION$*/ +void ChooseSubprojectDlg::accept() +{ + if (!subprojects_view->currentItem()) + return; + ChooseItem *item = dynamic_cast(subprojects_view->currentItem()); + if (!item) + return; + if ( item->subproject()->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + return; + + QDialog::accept(); +} + +ChooseItem::ChooseItem( QMakeScopeItem * spitem, QListViewItem * parent, QString text ) + :KListViewItem(parent, text), m_spitem(spitem) +{ +} + +ChooseItem::ChooseItem( QMakeScopeItem * spitem, QListView * parent, QString text ) + :KListViewItem(parent, text), m_spitem(spitem) +{ +} + +QMakeScopeItem * ChooseItem::subproject( ) +{ + return m_spitem; +} + +void ChooseSubprojectDlg::fillSubprojectsView( ChooseItem *item ) +{ + if (!item->subproject()) + return; + + QListViewItem * sub_spitem = item->subproject()->firstChild(); + while( sub_spitem ) { + QMakeScopeItem *spitem = dynamic_cast(sub_spitem); + if ( spitem && spitem->scope->scopeType() == Scope::ProjectScope ) + { + ChooseItem *child_item = new ChooseItem(spitem, item, spitem->text(0)); + child_item->setPixmap(0, *(spitem->pixmap(0))); + child_item->setOpen(true); + fillSubprojectsView(child_item); + } + + sub_spitem = sub_spitem->nextSibling(); + } +} + +void ChooseSubprojectDlg::itemSelected( QListViewItem * it ) +{ + if (!it) + return; + ChooseItem *item = dynamic_cast(it); + if (!item) + return; + if ( item->subproject()->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + buttonOk->setEnabled(false); + else + buttonOk->setEnabled(true); +} + +QMakeScopeItem * ChooseSubprojectDlg::selectedSubproject( ) +{ + if (subprojects_view->currentItem()) + { + ChooseItem *item = dynamic_cast(subprojects_view->currentItem()); + if (item) + return item->subproject(); + } + + return 0; +} + + +#include "choosesubprojectdlg.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/choosesubprojectdlg.h b/buildtools/qmake/choosesubprojectdlg.h new file mode 100644 index 00000000..689fe8b3 --- /dev/null +++ b/buildtools/qmake/choosesubprojectdlg.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef CHOOSESUBPROJECTDLG_H +#define CHOOSESUBPROJECTDLG_H + +#include + +#include "choosesubprojectdlgbase.h" + +class QMakeScopeItem; +class TrollProjectWidget; + +class ChooseItem: public KListViewItem +{ +public: + ChooseItem(QMakeScopeItem *spitem, QListViewItem *parent, QString text); + ChooseItem(QMakeScopeItem *spitem, QListView *parent, QString text); + + QMakeScopeItem *subproject(); + +private: + QMakeScopeItem *m_spitem; +}; + +class ChooseSubprojectDlg : public ChooseSubprojectDlgBase +{ + Q_OBJECT + +public: + ChooseSubprojectDlg(TrollProjectWidget *widget, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ChooseSubprojectDlg(); + /*$PUBLIC_FUNCTIONS$*/ + + QMakeScopeItem *selectedSubproject(); + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + TrollProjectWidget *m_widget; + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void accept(); + virtual void itemSelected(QListViewItem *it); + +private: + void fillSubprojectsView(ChooseItem *item); + +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/choosesubprojectdlgbase.ui b/buildtools/qmake/choosesubprojectdlgbase.ui new file mode 100644 index 00000000..12db29e2 --- /dev/null +++ b/buildtools/qmake/choosesubprojectdlgbase.ui @@ -0,0 +1,134 @@ + +ChooseSubprojectDlgBase + + + ChooseSubprojectDlgBase + + + + 0 + 0 + 511 + 282 + + + + Select Subproject + + + true + + + + unnamed + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + Subprojects + + + true + + + true + + + + subprojects_view + + + LastColumn + + + + + + + buttonOk + clicked() + ChooseSubprojectDlgBase + accept() + + + buttonCancel + clicked() + ChooseSubprojectDlgBase + reject() + + + + subprojects_view + buttonOk + buttonCancel + + + + klistview.h + kpushbutton.h + + diff --git a/buildtools/qmake/createscopedlg.cpp b/buildtools/qmake/createscopedlg.cpp new file mode 100644 index 00000000..439ddd70 --- /dev/null +++ b/buildtools/qmake/createscopedlg.cpp @@ -0,0 +1,100 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "createscopedlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "urlutil.h" +#include "qmakescopeitem.h" +#include "scope.h" +#include "trollprojectwidget.h" + +CreateScopeDlg::CreateScopeDlg( QMakeScopeItem* item, QWidget* parent, const char* name, bool modal, WFlags fl ) + : CreateScopeDlgBase( parent, name, modal, fl ), m_item( item ) +{ + incUrl->setMode( KFile::File | KFile::LocalOnly ); + incUrl->setCaption( i18n( "Choose existing .pri file or give a new filename for creation" ) ); + incUrl->setURL( QString("") ); + incUrl->completionObject() ->setDir( item->scope->projectDir() ); + incUrl->fileDialog()->setURL( KURL::fromPathOrURL( item->scope->projectDir() ) ); +} + +CreateScopeDlg::~CreateScopeDlg() +{} + +void CreateScopeDlg::accept() +{ + Scope * s = 0; + switch ( comboScopeType->currentItem() ) + { + case 0: + if ( !editScopeName->text().isEmpty() ) + s = m_item->scope->createSimpleScope( editScopeName->text() ); + break; + case 1: + if ( !editFunction->text().isEmpty() && !editArguments->text().isEmpty() ) + s = m_item->scope->createFunctionScope( editFunction->text(), editArguments->text() ); + break; + case 2: + if ( !incUrl->url().isEmpty() ) + { + QString file = incUrl->url(); + if ( !incUrl->url().endsWith( ".pri" ) ) + file += ".pri"; + if( file.find("/") == -1 ) + file = m_item->scope->projectDir()+"/"+file; + // We need to create the file, because getRelativePath checks for existent paths + if( !QFile::exists(file) ) + { + QFile temp(file); + if( temp.open(IO_WriteOnly) ) + temp.close(); + } + file = URLUtil::getRelativePath( m_item->scope->projectDir(), file ); + s = m_item->scope->createIncludeScope( file ); + } + break; + } + if ( s ) + { + if ( !m_item->firstChild() ) + new QMakeScopeItem( m_item, s->scopeName(), s ); + else + { + QListViewItem* item = m_item->firstChild(); + while( item->nextSibling() ) + item = item->nextSibling(); + QMakeScopeItem* newitem = new QMakeScopeItem( m_item, s->scopeName(), s ); + newitem->moveItem( item ); + } + QDialog::accept(); + } + else + { + if ( KMessageBox::warningYesNo( this, i18n( "You did not specify all needed information. " + "The scope will not be created.
Do you want to abort the scope creation?" ), + i18n( "Missing information" ) ) == KMessageBox:: Yes ) + QDialog::reject(); + } +} + +#include "createscopedlg.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/createscopedlg.h b/buildtools/qmake/createscopedlg.h new file mode 100644 index 00000000..c8ed86ef --- /dev/null +++ b/buildtools/qmake/createscopedlg.h @@ -0,0 +1,45 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef CREATESCOPEDLG_H +#define CREATESCOPEDLG_H + +#include "createscopedlgbase.h" + +class QMakeScopeItem; +class TrollProjectWigdet; + +class CreateScopeDlg : public CreateScopeDlgBase +{ + Q_OBJECT + +public: + CreateScopeDlg( QMakeScopeItem* item, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~CreateScopeDlg(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void accept(); +private: + QMakeScopeItem* m_item; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/createscopedlgbase.ui b/buildtools/qmake/createscopedlgbase.ui new file mode 100644 index 00000000..244589cd --- /dev/null +++ b/buildtools/qmake/createscopedlgbase.ui @@ -0,0 +1,329 @@ + +CreateScopeDlgBase + + + CreateScopeDlgBase + + + + 0 + 0 + 348 + 208 + + + + Create Scope + + + + unnamed + + + + layout4 + + + + unnamed + + + + textLabel1 + + + Scopetype: + + + + + + Simple Scope + + + + + Function Scope + + + + + Include File + + + + comboScopeType + + + Choose between the different types of new scopes + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 95 + 20 + + + + + + + + groupBox1 + + + Scope Settings + + + + unnamed + + + + widgetStack1 + + + + simplePage + + + 0 + + + + unnamed + + + + editScopeName + + + Specify the new scope name + + + + + textLabel2 + + + Scopename: + + + editScopeName + + + + + + + funcPage + + + 1 + + + + unnamed + + + + editFunction + + + + + textLabel3 + + + Function: + + + editFunction + + + Specify the function name + + + + + textLabel4 + + + Arguments: + + + editArguments + + + Specify the list of function arguments, delimited by a comma + + + + + editArguments + + + + + + + incPage + + + 2 + + + + unnamed + + + + incUrl + + + StrongFocus + + + *.pri + + + 25 + + + Choose the .pri file to include + + + + + textLabel5 + + + Include File: + + + incUrl + + + + + checkNotInc + + + &use !include instead of include + + + Use !include instead of include for the function scope + + + + + + + + + + layout3 + + + + unnamed + + + + spacer2 + + + Horizontal + + + Expanding + + + + 150 + 20 + + + + + + buttonOk + + + O&K + + + true + + + true + + + + + buttonCancel + + + Ca&ncel + + + true + + + + + + + + + + + comboScopeType + activated(int) + widgetStack1 + raiseWidget(int) + + + buttonOk + clicked() + CreateScopeDlgBase + accept() + + + buttonCancel + clicked() + CreateScopeDlgBase + reject() + + + + editFunction + editArguments + comboScopeType + buttonOk + buttonCancel + editScopeName + incUrl + checkNotInc + + + + kcombobox.h + klineedit.h + klineedit.h + klineedit.h + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/qmake/disablesubprojectdlg.cpp b/buildtools/qmake/disablesubprojectdlg.cpp new file mode 100644 index 00000000..335bf33f --- /dev/null +++ b/buildtools/qmake/disablesubprojectdlg.cpp @@ -0,0 +1,50 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "disablesubprojectdlg.h" +#include +#include +#include "scope.h" +#include "qmakescopeitem.h" + +DisableSubprojectDlg::DisableSubprojectDlg( const QStringList& projects, QWidget* parent, const char* name, WFlags fl ) + : DisableSubprojectDlgBase( parent, name, fl ) +{ + for( QStringList::const_iterator it = projects.begin(); it != projects.end(); ++it ) + { + new QCheckListItem(subprojects_view, *it, QCheckListItem::CheckBox); + } +} + +DisableSubprojectDlg::~DisableSubprojectDlg() +{ +} + +QStringList DisableSubprojectDlg::selectedProjects() +{ + QStringList result; + QListViewItem* item = subprojects_view->firstChild(); + while( item ) + { + QCheckListItem* ci = dynamic_cast(item); + if( ci && ci->isOn() ) + { + result << ci->text(0); + } + item = item->nextSibling(); + } + return result; +} + +#include "disablesubprojectdlg.moc" + + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/disablesubprojectdlg.h b/buildtools/qmake/disablesubprojectdlg.h new file mode 100644 index 00000000..13a27468 --- /dev/null +++ b/buildtools/qmake/disablesubprojectdlg.h @@ -0,0 +1,42 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef DISABLESUBPROJECTDLG_H +#define DISABLESUBPROJECTDLG_H + +#include "disablesubprojectdlgbase.h" + +class DisableSubprojectDlg : public DisableSubprojectDlgBase +{ + Q_OBJECT + +public: + DisableSubprojectDlg( const QStringList& projects, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DisableSubprojectDlg(); + /*$PUBLIC_FUNCTIONS$*/ + + QStringList selectedProjects(); + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + +}; + +#endif + + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/disablesubprojectdlgbase.ui b/buildtools/qmake/disablesubprojectdlgbase.ui new file mode 100644 index 00000000..ffcc1d32 --- /dev/null +++ b/buildtools/qmake/disablesubprojectdlgbase.ui @@ -0,0 +1,126 @@ + +DisableSubprojectDlgBase + + + DisableSubprojectDlgBase + + + + 0 + 0 + 512 + 282 + + + + Select Subprojects to disable + + + + unnamed + + + + + Subprojects + + + true + + + true + + + + subprojects_view + + + LastColumn + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + O&K + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + + + + buttonOk + clicked() + DisableSubprojectDlgBase + accept() + + + buttonCancel + clicked() + DisableSubprojectDlgBase + accept() + + + + + klistview.h + kpushbutton.h + kpushbutton.h + + diff --git a/buildtools/qmake/kdevtmakeproject.desktop b/buildtools/qmake/kdevtmakeproject.desktop new file mode 100644 index 00000000..f1921523 --- /dev/null +++ b/buildtools/qmake/kdevtmakeproject.desktop @@ -0,0 +1,91 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=TMake Project +Comment[br]=Rektras TMake +Comment[ca]=Projecte TMake +Comment[da]=TMake-projekt +Comment[de]=TMake-Projekt für KDevelop +Comment[el]=Έργο TMake +Comment[es]=Proyecto TMake +Comment[et]=TMake projekt +Comment[eu]=TMake proiektua +Comment[fa]=پروژۀ TMake +Comment[fr]=Projet avec TMake +Comment[ga]=Comhad tionscadail TMake +Comment[gl]=Proxecto TMake +Comment[hi]=टी-मेक परियोजना +Comment[hu]=TMake-projekt +Comment[is]=TMake verkefni +Comment[it]=Progetto per TMake +Comment[ja]=TMake プロジェクト +Comment[ms]=Projek TMake +Comment[nds]=TMake-Projekt +Comment[ne]=TMake परियोजना +Comment[nl]=TMake-project +Comment[pl]=Projekt: TMake +Comment[pt]=Projecto TMake +Comment[pt_BR]=Projeto TMake +Comment[ru]=Проект TMake +Comment[sk]=TMake projekt +Comment[sl]=Projekt TMake +Comment[sr]=TMake пројекат +Comment[sr@Latn]=TMake projekat +Comment[sv]=Tmake-projekt +Comment[ta]=டிமேக் பிராஜக்ட் +Comment[tg]=Лоиҳаи TMake +Comment[tr]=TMake Projesi +Comment[zh_CN]=TMake 工程 +Comment[zh_TW]=TMake 專案 +Name=KDevTMakeProject +Name[da]=KDevelop TMake-projekt +Name[de]=TMake-Projekt (KDevelop) +Name[hi]=के-डेव-टी-मेक-परियोजना +Name[nds]=TMake-Projekt (KDevelop) +Name[ne]=KDevTMake परियोजना +Name[pl]=KDevProjektTMake +Name[sk]=KDevTMakeProjekt +Name[sv]=KDevelop Tmake-projekt +Name[ta]=கெடெவ் டிமேக் பிராஜக்ட் +Name[tg]=KDevTСохтани лоиҳа +Name[zh_TW]=KDevelop TMake 專案 +GenericName=TMake Project +GenericName[br]=Raktres TMake +GenericName[ca]=Projecte TMake +GenericName[da]=TMake-projekt +GenericName[de]=TMake-Projekt +GenericName[el]=Έργο TMake +GenericName[es]=Proyecto TMake +GenericName[et]=TMake projekt +GenericName[eu]=TMake proiektua +GenericName[fa]=پروژۀ TMake +GenericName[fr]=Projet avec TMake +GenericName[ga]=Tionscadal TMake +GenericName[gl]=Proxecto TMake +GenericName[hi]=टी-मेक परियोजना +GenericName[hu]=TMake-projekt +GenericName[it]=Progetto per TMake +GenericName[ja]=TMake プロジェクト +GenericName[ms]=Projek TMake +GenericName[nds]=TMake-Projekt +GenericName[ne]=TMake परियोजना +GenericName[nl]=TMake-project +GenericName[pl]=Projekt: TMake +GenericName[pt]=Projecto TMake +GenericName[pt_BR]=Projeto TMake +GenericName[ru]=Проект TMake +GenericName[sk]=TMake projekt +GenericName[sl]=Projekt TMake +GenericName[sr]=TMake пројекат +GenericName[sr@Latn]=TMake projekat +GenericName[sv]=Tmake-projekt +GenericName[ta]=டிமேக் பிராஜக்ட் +GenericName[tg]=Лоиҳаи TMake +GenericName[tr]=TMake Projesi +GenericName[zh_CN]=TMake 工程 +GenericName[zh_TW]=TMake 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevtrollproject +X-KDevelop-Version=5 +X-KDevelop-Args=TMake + diff --git a/buildtools/qmake/kdevtrollproject.desktop b/buildtools/qmake/kdevtrollproject.desktop new file mode 100644 index 00000000..5debaf34 --- /dev/null +++ b/buildtools/qmake/kdevtrollproject.desktop @@ -0,0 +1,95 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=QMake Project +Comment[br]=Raktres QMake +Comment[ca]=Projecte QMake +Comment[da]=QMake-projekt +Comment[de]=QMake-Projekt für KDevelop +Comment[el]=Έργο QMake +Comment[es]=Proyecto QMake +Comment[et]=QMake projekt +Comment[eu]=QMake proiektua +Comment[fa]=پروژۀ QMake +Comment[fr]=Projet avec QMake +Comment[ga]=Tionscadal QMake +Comment[gl]=Proxecto QMake +Comment[hi]=क्यू-मेक परियोजना +Comment[hu]=QMake-projekt +Comment[is]=QMake verkefni +Comment[it]=Progetto per QMake +Comment[ja]=QMake プロジェクト +Comment[ms]=Projek QMake +Comment[nds]=QMake-Projekt +Comment[ne]=QMake परियोजना +Comment[nl]=QMake-project +Comment[pa]=QMake ਪ੍ਰੋਜੈਕਟ +Comment[pl]=Projekt: QMake +Comment[pt]=Projecto QMake +Comment[pt_BR]=Projeto QMake +Comment[ru]=Проект QMake +Comment[sk]=QMake projekt +Comment[sl]=Projekt QMake +Comment[sr]=QMake пројекат +Comment[sr@Latn]=QMake projekat +Comment[sv]=Qmake-projekt +Comment[ta]=க்யுமேக் பிராஜக்ட் +Comment[tg]=Лоиҳаи QMake +Comment[tr]=QMake Projesi +Comment[uz]=QMake loyihasi +Comment[uz@cyrillic]=QMake лойиҳаси +Comment[zh_CN]=QMake 工程 +Comment[zh_TW]=QMake 專案 +Name=KDevTrollProject +Name[da]=KDevelop Troll-projekt +Name[de]=QMake-Projekt (KDevelop) +Name[hi]=के-डेव-ट्रॉल-परियोजना +Name[nds]=QMake-Projekt (KDevelop) +Name[ne]=KDevTroll परियोजना +Name[pl]=KDevProjektTroll +Name[sk]=KDevTrollProjekt +Name[sv]=KDevelop Troll-projekt +Name[ta]=கெடெவ் டிரால் பிராஜக்ட் +Name[zh_TW]=KDevelop Troll 專案 +GenericName=QMake Project +GenericName[br]=Raktres QMake +GenericName[ca]=Projecte QMake +GenericName[da]=QMake-projekt +GenericName[de]=QMake-Projekt +GenericName[el]=Έργο QMake +GenericName[es]=Proyecto QMake +GenericName[et]=QMake projekt +GenericName[eu]=QMake proiektua +GenericName[fa]=پروژۀ QMake +GenericName[fr]=Projet avec QMake +GenericName[ga]=Tionscadal QMake +GenericName[gl]=Proxecto QMake +GenericName[hi]=क्यू-मेक परियोजना +GenericName[hu]=QMake-projekt +GenericName[it]=Progetto per QMake +GenericName[ja]=QMake プロジェクト +GenericName[ms]=Projek QMake +GenericName[nds]=QMake-Projekt +GenericName[ne]=QMake परियोजना +GenericName[nl]=QMake-project +GenericName[pa]=QMake ਪ੍ਰੋਜੈਕਟ +GenericName[pl]=Projekt: QMake +GenericName[pt]=Projecto QMake +GenericName[pt_BR]=Projeto QMake +GenericName[ru]=Проект QMake +GenericName[sk]=QMake projekt +GenericName[sl]=Projekt QMake +GenericName[sr]=QMake пројекат +GenericName[sr@Latn]=QMake projekat +GenericName[sv]=Qmake-projekt +GenericName[ta]=க்யுமேக் பிராஜக்ட் +GenericName[tg]=Лоиҳаи QMake +GenericName[tr]=QMake Projesi +GenericName[uz]=QMake loyihasi +GenericName[uz@cyrillic]=QMake лойиҳаси +GenericName[zh_CN]=QMake 工程 +GenericName[zh_TW]=QMake 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevtrollproject +X-KDevelop-Version=5 +X-KDevelop-Args= diff --git a/buildtools/qmake/kdevtrollproject.rc b/buildtools/qmake/kdevtrollproject.rc new file mode 100644 index 00000000..8f6e0048 --- /dev/null +++ b/buildtools/qmake/kdevtrollproject.rc @@ -0,0 +1,33 @@ + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildtools/qmake/newwidgetdlg.cpp b/buildtools/qmake/newwidgetdlg.cpp new file mode 100644 index 00000000..7be62acd --- /dev/null +++ b/buildtools/qmake/newwidgetdlg.cpp @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jsgaarde@tdcspace.dk * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "newwidgetdlg.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define WIDGET_CAPTION_NAME "widget/property|name=caption/string" +#define WIDGET_CLASS_NAME "class" +#define WIDGET_SLOTS "slots" + +NewWidgetDlg::NewWidgetDlg(QStringList &newFileNames,QWidget* parent, const char* name, bool modal, WFlags fl) +: NewWidgetDlgBase(parent,name,modal,fl), +m_newFileNames(newFileNames) +//================================================= +{ +// Remove in kde 3.4 support + okayButton->setGuiItem(KStdGuiItem::ok()); + cancelButton->setGuiItem(KStdGuiItem::cancel()); +} + + +NewWidgetDlg::~NewWidgetDlg() +//============================================== +{ +} + + +void NewWidgetDlg::subclassingPressed() +//===================================== +{ + QMessageBox::information(0,"subclassing",""); +} + + +void NewWidgetDlg::templateSelChanged() +//===================================== +{ + QMessageBox::information(0,"template",""); +} + +void NewWidgetDlg::accept() +//========================= +{ + QDomDocument doc; + DomUtil::openDOMFile(doc,"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog.ui"); + DomUtil::replaceText(doc,WIDGET_CLASS_NAME,"TestClass"); + DomUtil::replaceText(doc,WIDGET_CAPTION_NAME,"Test Dialog"); + QDomElement slotsElem = DomUtil::elementByPathExt(doc,WIDGET_SLOTS); + QDomNodeList slotnodes = slotsElem.childNodes(); + for (unsigned int i=0; i +NewWidgetDlgBase + + + NewWidgetDlgBase + + + + 0 + 0 + 650 + 474 + + + + + 5 + 7 + 0 + 0 + + + + New Widget + + + + unnamed + + + + cancelButton + + + &Cancel + + + + + GroupBox2 + + + Widget Properties + + + + unnamed + + + + subclassingCb + + + Subclassing + + + + + Layout5 + + + + unnamed + + + 0 + + + + captionLb + + + Caption: + + + + + subclassnameEd + + + + + TextLabel4 + + + Subclass name: + + + + + captionEd + + + + + ui_classnameEd + + + + 120 + 0 + + + + + + classnameLb + + + Class name: + + + + + + + previewLb + + + + 2 + 2 + 0 + 0 + + + + + 0 + 160 + + + + image0 + + + true + + + + + + New Item + + + + templateList + + + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 310 + 0 + + + + + + okayButton + + + &OK + + + + + + + 789cdd5c577362cb767e3fbf62eaf6db2d571ba148b9fc80028a244584cb0f9d480221b22497ffbb57afd06c103aa399a3721dfb72f7814f9bdddd2b876ee65ffff9a3512bfff8e7bffe31999a69d7fd701d33fef14f3f1b0cdefee33ffffdbffef8c7562ef7235e3b3bdb3ff2fff8973ffea1fc0ff743e5f07f88e7091f20ae09dec2fba69530dd778c77f8f959c274ff40303f7f9730ddb78c0fe879f39e30de770bc1fc7c89b1a3efbb7dc25bbc7ef7ca98d7632e111f24fa7209d3fc8f8279fce384e9fe94b1d0d74c98ee5705f3f36f09d3fd0963a64fd513a6fb05c1f4bced254cf49f09ced3f8278c997e7396307edf68c1349e3b4f18ef7b599fa3f15485b0f0cfdb84697d5b8c857ec398e9f13cdf16afc7aa88b792fcfc8031dff71709d37a5f05d37a7d8fb0ac271405337fde13a6e7f705333d0dc6bcde6004f3f3e78c451e0bc6c2cf36e13ccf6f4e190bfd63c4895e1308cbf77583317f5f3f30e6f9f43d637e3ee0f7f369fc304f98f897eeb37e2d18f378e13061d297316359df3de16dd1ffc098e7f3c78c793c37445c90efeb47c6f2fd66c2a41f79c662bf3dc6629ffcfd1d9127fa8bed2d19cf6e3116fedc3196f5ef254cf21e1296f1743361bc6feb8c793c8bf6b55d90e75d8fb03cefa709e3fdd0144cfc56fb8c65bdc58489fe9160febe622cf39f254ceb97fbc29f838469fd4f11ef6cc9f7435e30db8762cccfabd78489bea260d6774d7857f8759b307e5fe704f3fa5b8c77993faf82e97ea8332e307d57888d3c6f04f3f36e37615a9f15ccfee892318fa7b712267ed404f3fccf09d3fd05e1bd2d9e1fe5b79bdff5ccbf53c1ccbf47c1f902dedf26bcb7c5f33505f37c0f09d3fd57c1e46f429931f3c7dd33e6f92deaf36e5a5f7817bcbd85f79f19f3f3ea21615aff93609acf0e19337f5459303daf6f12a6f90f04f37a2d63e1cf96605eff7bc224afb9607ade05c2fbcc2f7f2698d77f9d30e9fbae607ade9f3016f923fd7bf9bdc236cac37518f3fcbe2d989f2f0ba6efab6dc269be5bc1fcfdd384697ccf98f96dca09d3f345c1fcfc3861d2971a63d6573f17ccfc7a13ccfc427ddb03fa49defe29615a4f9d31cfe74e13a6fb53c1ac2f8631cfa7af05f3f38384f179db15ccf3df244cfc6b3366f99bf384899e1dc1cc8f56c2f8bc1f09e6f12b840f581e6120989f47feed6fcbfabc134ccf872a6399af9330f1e34a30cf774758e6332f82e9799d4f98e84df7e979374a18ef9b29639647d009d3fc15c1f4bc318c999e702298e9a1f1ac3caf3463be6f1e1833bd6a2f6192df9b601eef967081e9f58782e9fbe646308f8ff67fb09dee3f0b667dba60ccf4eaba60e6cf56c2f4fc2363a6576f0be6f9761226f91e1136ec1f2c7fdfb0fd595cff8195f94c25617ade08dea1fb5dc6a2cfa58489ff82995fba9030c9ef52308d175a848df0e74930d37f9c303d9f632cfa712598e5f39830c90ff5adb023e3bb13c6c25f9d30cd5f154cebf3216183fad1616c985fdb09d3f81782e979f79c303e1f468c03eb575e30ebc37ec234dead601acf5608db3cc7f707c1cc8f90303d9f17ccf2d863bcc7cf1f254cfe662698e3a560c3f9ce5dc2a4ffbb82397ea1fc0a4ef8158e19337fc2a560a6679e307edf5e33667ea8ab84493e1dc1fc7c59f02ed6d3a14d38d1bb9330d94b4d30ebf375c224df73c6c28f8260e6877c7f8ffde34c30cf779a30f99b1bc1349fea33667e9a79c2c44f998ff9a95f13a67ce25230fb8b9260e6cf11e3c0f9dc4bc214af268279fc69c2e4bf9d60ce777612267dcd1176ac7fba97308d3f13ccf9c861c2c4cf3bc6ac7ff621618a571dc1fc3cf3d3317f1cd263923d98026191a71a264cfad4174cfae1cf198bfc1e0433ff6a82d97e0f13c6f15c5b308d675b8c595ebe9830c96b2c98f3839b84491f4f04b37e9e0966faea09937ebe09667af619b3bc552f61e29711ccfcdc4998d61704f3faaa09d37a8e05337f6682993f9384717d8671d28f61c2a41f5dc1ac7f8384e9fe5830eb773161f2670dc1ec2f4f13a678f52298d7779d30ae4f5718b3fee99030cdaf04f3fa5cc2747f2498ede32461b28f92608e47321edbbb6e254ce379c13c5f3f61aa2f647cd61f9f672cf23e4a98ec47e86779dbbd8449de587f1827faecbb8c59ffecbd60bedf17ccfa564f98eeef31667d315b8299fe8b84697c2798e4a30f1226fdc90966fb9a12167db1ed84899e8960d697fd84495fb605b37fde4d98d63b12ccf6964f98ec2d7d9fe3cb59c214dfee188b3fab264ceb3b16ccf2b50993fc851ed627bd4898d63716cceb3f4c98ecf34830f3f33c61f27f8f8279fd3b8c25fe0c12a6f518c1b4defa3461badf11ccf9727a9efd455930e7478d84291ebe0be6f55e244cfc147a257ebd254cf3cf05b33f3b4b98ee3f09667ebe274cf9475f30e717c584e93eebbf677fa58e05f37ca58449be0dc15c4fa13ddbe46ffc4430f1df29c62c4feb1326fb1809e6fca693308db710ccf6789030c5a71a6396573817ccfe232798f35f9730e99bac87e5a39e13267d9a09e6f9ab09d3fab6184b3e712198e5514d98e81d0866fdbe4a98f4e55630d70b9384c93e9f088b7cec4dc2a40fcf8239be9513267afb82591ebb09d3fc5dc15c0fdc274cf4ee30667bf55782391e61fcb3deeded917edf3066fe865ec2743f2798edb59230cd772d787f1bf16dc216d77fc458fcef2261a2e75e30fbdb43c1ac9f7b09d37aba82f768bf8ae4e9855fae9430f9dbbe60e6d776c2147f2f05337daf0993fef27c9efda1b18239ff6a0966fd7b4f98d6eb190b7fd17fb85d170e905fe188b08ca72e05f37a860993bedf326679d4a75a69a3d5efbe6bab1d5cebef3fbbe8d9ccf557d781b250dffe725fb8e2cbeb00d737cd4a71eb2ff32464aef477bc677f22d36f92497cff16b904dd42fe662ffafbf74bfc2772f90e9e2439988f57f63ecb6a69376dedbe63fe6fb417a757ed407d90d167df779967be412e7f992719dff4996cf8fa60577f3b7bd9eca33ef29be4d45ab3af6f92cab7d98b179f559fc2a70e6a4e37da027eb6681378c5bfc37b37ce4deff8c4dfc95e94eec1baba280b79efc01c4fbacf36d1d503b82ce027f8348814216dddbf99bd3cc30a15ad0e71570fd10e228543fd827fa35547bf35826ba0c748d184a8fa5bd98b42ad899ae6d1b2e96f434d31e625ca0aa530d05378454a46ac8933d2b7ef92cb5fcec786b0e239fade177c714e86abb7ac631d58fd026818eb57944b9449179f7bfb2e5ff62d7269c18a5ab8a2b8ea77586f115e87f03ad2c7fa4497e03ad567f03ad717fa12fe7ea5cb2897397ab46ff265df622f735dc1f53ce92aacf210565cd3757dad6ff4adbed3f7fa4137e07ad08fbaa9737a4be7f5b6ded1bbf0dd77a067ef7f35be50ec96f8ed327f979831048dd9072a0e74016e28fda88cb2cae1e594cf5cf16f16ee06d5526dd5d147aa8bd633c071b373b8b555ace3dfb21798a105974ffe9572a8aeea69a39e541f3e0dd4b31aaa1735526358ed04d7ecd494df676a0e97c76b4951bc16ea555fab37f5ae8aea500fd5913ad6bd7af40e237502144eb453a54c5da4b2b9c56fd80bc66a758a3c136ac06ed5997e51e7f07ea12ed5952a832c2ab07aafaab0f21a5c73f89cbd3cbed3ab0674d5912aa047dfab6b75a36e61ed33f0e271960efa3c075aabd49dfe4a4ef1557b11b91035f4a4c1d870a5ee754d3de83bd56019444a1ee16ac24aa749361ea98cef39a4845ed524a32d9557604340cf15f839a00238a550fa1d9827238fbf682f3e632f74b540ee4a81f5aa5db5a7f6515f68e5f58c1cdc868b6473c0b4cc819aa62ac0522245c6c4ffdf186b1c7aeb18a7ba20abea4fedf957eca59fb90c7ad117bd301e2ce4c104584513d65480ff3679b5510659b988bd084573a48234112ed382ff16a27c4c5bdf980e8c3c80b9233506e4d2f92cf7fecdf8229ae5c1fbb6c0daabfac874f52de846e428ad26aeb09ef15bcbd52fed67796f96b19d1a3e7f007f07eb313df3a4774d1f5608be0566ec26ddf8495efd257b8916cf323103786f0325cf60eb16f95e4f3cf688a34ce6c96eaa19fba8a17ce691dd20078fa8c074d5f01dbd81199a17333231631b9a81996caa797ed35ec47f88ddb4f5a199ea06f2b7ce16d084753493ad08bfe76bafa52dcdf8bdc0eb772b76e654de1833839cc7821e543ef412c287f57ddd5e3af8fd9656660ee31fe96bb3483e09a831af448179636da921752ef9ae498a9ae01dcc3b0cb9a46f66ded3f78803e4a9c7a6680ed5c01c61be36446d33baa7fa7fd15e623c8959e00bdac9543fe0cc05d40db2802893a8f7c7a0f5d5f4576b4e4c4955c0a21be61424b98008e4e465ced86666186b2cda5a93e509583f9a73b09b0ba026ad247a6af4d6bf6f2f1db0bfa8e451bb9e99921c4ac59b4bd2fb2893a585030d01d67265caa662aaa6069eb66eaee1d38dce9b5b88250b96d3ccdcb1dd57d97eaa38ce0ca9bd370f10bfc65cd57563bc9118b3eedbbe6c2f2fe622d685a6611ec1e21dc77689e59ef9db645dafc01a9ae6d9e44047ee81b35b90332fe055d665d3006ee4cdb6d931bb660f640663997d8c3873b623d2bc038aa1face1ca84ba0c6a5573753ef848f72f999bd809540fe67c6a600c1d7a24c222dde2ab08418556aaa091a833aa5e03fd65a67bddeb7c1b66cbb3e351758c9c42aba873ce9ab5bdb3155db85fc6d413edbf630428907885a3781d1ac7db27dc859c758c175b026edacf7a27fc95ebc99db813eb7cf104f7c8aed31168a078655989259d8a17db1233bb690dfd8b6eeda295a2de5d301fb2f2dc403e38cb7333bb70b8cb61ec79de1b8758eb41e680129db5733b2548f8e309f7ecaf8ae95fedb57ec45c50cefd9bee1ac53f24b682739b217fb1ee7b5457b08741c45dbb2c7f569bc8083167522d4a75c41f771051e32ae437b624bf6d474ec993d477a482ef5943fd4316b58d80b5db6037b895569ac0f36f4e13eb117b782806e73a42e4c07f2aee82b27c94a3cdbc80429b9b265a037d88aad9a23886f437b8cba1d3b16432db943acef6325ed319ebfe8be3a01ddedd81ada8e63bbab27df1865ee6cdd5eeb2b1b50cf62b5bdb63eb19bacbde085392970f5065710b32f63dbf6d6de61e6b8cc5222d7c06ea24c40f3b6ed3dc49d05ca213b16d51d31cf7e025feae0d3dc3ec46aa13ee5ee6bd736ccd83e4234016ae0a1038e4d8e3d74f435d63675940a4818a59d1ddf6fb017d23b8ef178778833e7e0d3425dd92dcce76b1cd5a6999aa4a2ae6d5e455f35415e0f3ff898168cd243b94ce0d55103bb6d77ec2ef0b96ff7e089992eda7d7b80d167b692b771be600b40b882da2f44fdd5215e5a313756ec654d2e0e31d002fc9beba133ea5e95a13e89d1718e71708a7491079e386beaaa68636745adea70b2b73398fd06fe0b3ecc393373def45cd067e09f5ec9c3aa43d7726d18a994ea50d1308cbcf6dc75c01681578e7b6ff529cba5bfc15e967ae770fc1e7e07b206e0770da3ca947936656e45adb6aee79eec295684d421f2cc896c8f1fb20f5582bf4f5ddfe4dc007b010b5384eaa7ab5fcd857d80e7c6fadc3ddbb3186739cecc967251ce0ddd0b649bedfa34c517d6a13f970b522b18aa093742e94f52fd4eb92fe8b11bebbaedb07605f6bea2bfcbdc760e79c80b54f0b76ee2a61851a21731a66867ceb959e401e459afaea5eb6e8c5c9bb3ddd01575a1a25e6ccc36bba05fd9fd9bfea7f642f4ced07b7a908983ec2e0f114d6ac6097b9b98cd3bd08832483ea0a70afa0dac62c8fd61b7d6cf1feaa9eaaa5d37c78a07b2140714b957f7a6cf80db90ed458b5210c3dc3b663712ff4536e0715cd11d02e547988f59b615b936ca85fd4bbf4e7de10e3c7d8cdebf4039125a7d0db2afc8ab7d77e24a9015185809d59b5d8864129703d43a1419a3b4ae6025a75126e6dd9d012de7902958fde006e0c3c6ea10b40c9eb6bbeec2f4909a6ab219cf9e6dec2e21beb6d0fa891aaa799de4672bf145ecc5215fa3d779b7a74ae3c833b5eca550d7a1628d812801f16480eb35dc4319f058ad5883f298637de6aec04e809254db78d6b45b88ff25eca70757d627aec2fd03a973a4d6713aaf9ed5ce8a0f53eb72f910473ba8fd91f6a23e5731ebaaa5de8a64e5608d9076555d6d59f7896fc15a7daedfa25c30aa94ad737594ee2ce5f9527581a69aa2bbb6bb205f18c1dda837f43413c964f81df233b56f3b9019058cc24eabac5c32f6e256628cc34c307e2eba5b1c59b2f959e2a9354dc82027c8a5a5cfa2712287ef7485ec07e27accf31729bf2e485586b137f2bbe1eedd036827f0cf9e981964012798c32efb3971e65803d420cfab6204eb7e2e17d171de59205db4aea1ebe841973279441979a8fb9eadb76d57dbb00719fbcb6ff08a9ea06c46ee1129b1189fb836e14c32c60f882aaee9727680dcacea63b765dae899e7ecc3880b1efcf8237832ca5497e706d6ed45e4d2c2cfb1c3463a79e8de507b853f73aeb840c34c4eef6b6b8f5132ab7b906f6829b11b78a58fcd0b7af45449732e2c7950acdcdacebb3ce8738c155db76deadc1759e6169eba346ec78cd1b2b2f6dd5f938b9c4f21deb6317f0bb1dfa26f60d4a9f229bb8f72c9c1a8bb6e0fbc31ed3d9a9578425e00bc30d46e79b7c3da2575499573e13952073c77fb3aaf4b9003d09eda8b5ec0c89a39982a3ea86f7ccccb20da19b67ee911adc797a55c025acb13e87afc74e40e567af52417c88bc102ee5dc192e7cec679b29b2ec8f6ca4dd4b6a75535590acb6a8b2cda99606ecdcc34ec896ec7c8015135f6fab6d7e432a728e09519a99db59d34af3fb117b81cd6d74394cbb1becb7458a72c97b939f1062aa4367ccbe28e6ad259b4b70e585c19f2ae9d4889b7cc893a6b19ad0ef32c13bc53bb503d2bee21473f02551a58e916e7c9443dd16255de7b1b2be6e8cb643ebfa17e71593f06fcf130fe09772a66ab7251151fa08e076b513de45236fe3a3d76db6ee25bd16b002533b68dd57e7ff44b25df062dbc01bbf290cf4d584307ae01d592e1e82fcf92958e4ddd62ee9ff1639bea4a976229f9ee21c8e5047b7a32a678e48969aba12e9a0bb63ec87780a78677ec604ac856a6c8598b598fc4a41c5b402d5a8a3df71ddf059b8b73cf40effb3cce047cd519cc40f34e1217d17bdb7b4b3eac8d6b0d1fea1791c720c9867cc408c63c5dd55bf29240e10dcc083516e4b8f1bb3daa3fd1c38cad4bf1a4c97ce52e385102763cf73dffe4fbd6c72e2b6618919a58c9f8a8a160416db6fda5adc24b3720c2ecc78a2cee3669c5be73935c9856cedae3b98953d0319f6a71910bd062eae01da98e8f7ade5367aa046b993807d94a9dfb11d2eb9fb34ca2a6e648f7fdc03ffb2154d52dacf97a2897aeba437e2efc4b461fa48e454f01fab0bf2e97157b913c4ce412efcfa2de03171ed2484bb9007fa0a629933470155023c49d39756b6a7e04d98a8508a839ffc8fa2ea9150be065cfcd2de49b55f0b10fee0e2ae7125bcd087c1ae918d9a97468638c825a0a79a878adad757b497d40b297c05d4e17f516339855eb8fef0b53055a869c27807d41a93e55b76ad78f31efaa638ccfc17f0b240b5e158d95c34eba530d73eba3249dcd410c883b54313fef40d6b38d3a3a632d937c3946e83acbc57e622fe27f5cb2178be7572093d2cd157ba1cfb13779631aa0539427f8b8df672c545a735a037ad079eafdcf33cf4b4f7f869da910a95183a8a52ce5ae1e012d076e1f75f380b9d8241efa29d2a230eb77595b59938b4bb4aad8b7859834864a2ec7d5572ee3cbea31ff8648dd055aa29697f42cfa2edb454f1af763a8435e55d2bb8fcf7b257bcbe4639be8e3c6beed67fa1d32cbd8f5807c01e63df473ec95d7388f957cc1aa57bf203f96d9b3db54bf2ce5d283911d8c39d597fe1533d65477630c7e0769cf416633ac5c14f8b227338378829516f7ed675c7bc8cab3fb6213b5dc9d9840ce3f056acae89762ded086d85ec6fe127d676975d6d6a0d619a7b82f76bea9aeb4c98f7571cf6504b9658533a31af590e30c71af543f9a0e64b65849838694637a01df3bf0a45d13f663a4a1d10b8b9cbc92be175dd3989199b27f37635fc4a8d6f11eabfe264b257579210bac9811d475d9b3b59beb7d95b117dec5370d7fc815fa9c77e864d7c5e80258cc007939f347fe1869a69dbc3ad252672df7ecd10a5c8165f7cea4ba5c78a85b629f052365b47c9faa64e9ca38b5e54bd82757985d66fa79abf165ad37d68fbd4b90cec274cc3dcc55e5fdf819f7c8c0e7fa53fb0879ba43af5cf4d18b5ab770e7e47ba09aaf2baa4fd063f91ef277861ca11a556a22f2070bc843176029e7766421073497ac9753e482f717e8c56a2eeabecde8d1267bc9d6d0333c21721673567bea2f15755f97fb8f3eee50983d53852c30d23ef390139b629420dcc18cd8bcb32c3cf2f3c997d5183fcf9092b5fd7fcc3f17a6acdeec0c62ce38555fcd94c94d807f2d88ad7472216b2b7f2e173af91575b7afaf7c85b3f60c35d1fa4dc9767d15e25a0fabb743fbe8c76e1f4fee5074e1fa04f2d09aaffb6b778a6733ea6acedae3d2fe3ff9280bdfbcf1b7306a0f635153e5403a3945f5ce1434e1cef5d50eee1e28aeb33ef6c7a4672972910aab027173e04ed28e025123bbd94e8ddcb32d61efdee9577f6f67a608b907f5b7a4660cfed43f580f1cbd872c6dbc127165af9fb516e4d3f08fbe99bc9dec20e25826b8139f3373bf855c0f18fb47ebf125d593cb33c60ebf1d6bdd01d4eb45b665ca3eb0978275dec22eec29ea63ec09bd9a0664fa1df4159eec4437dc95c9c7fa13f2ae7d3f416a265ca72e7725a29c9b98a7d18eed257cbe54d48bcbb10c27ae683bd8513219b98c3ef493b3bde4e5157c5e57dc91dfc61e9d679b218ecfd4818d7ad68ef991df8138d7d3cf1eaa2afb087562097d53ec16c5ac660faac581df77c6397fe0db2b75aaf4bf3c7a851a72c82305cb1c90bc4705c6b5be907691e39a1dca65a3bd6cdaa385cf45df076bb460d51287a38c649f64df5c9b317ab3987fcf6c09a939053a4e2137385303b641f2a06575032a20fb46b27b2e14496e3157d96c36f62d9c3d33dbfa8af2dfd87f3383a0b006b61ffa637ff61ad911d4df9518f34c4bc9ee1b65215e356c0d328078926dae8e22352e6ada996bfa337d6a77b587ac2066bf3d7c3d417c3f058f07194230187bce56f270c9da9aca67fe6e4d2958882cf184739f7bfbcb9ee807b9fcc97ea573ce1442e464016879645bacb24638a8fddb66dbb5f448f56186b9ee061f426885b67a072f17f78efba1837add03aade4d2374d53558955dd1b666e6dd73dca12bd60f3d7762fa7a6873d807b52b7af32bfbfb56ed849eebe06e528deb7df169b4021b9e5c5b9feb29f66e8399eb4ee81bdac7a65346b1fa2d01277b71efc296628726c656eee8adcb6599937b1e7f003986d395a0300288bffd8dfd7d48f316eec53ee1e892472d3d74ecdb6d8567f71c86601d5d9b8b7d0fdc05838ad3de70b61ac20b5013772fe229bab25fb837f47805ecb77d944d73498b5761e4ca3617c6d80b5dd62ebfb1bf6f0620994998a6ae9d64f39c5721b925b0ce1b90cd15eebf2bac46e26cb1e3d3b20f61861d6a1f6bae1819c0aa0edd34cc39be6f7a516fd341fd59c55c89f60dfccafece87fae567fbfb71d7322cfc83bee13d2d393122d56f3c6b143b9063a804aafac46dc7332c51abc182700737bc207506e51269ecba6a780d6fe11d7de2267bf1d83b77a1180e5ddb35a422c8d84bf8757bb1c7e6c81e83648ec2b1ca533ce6bd07c731146b4d3c256155de55dca18995da3e584bcc32bafa055780792078b436bc16fa085638f5cd0d5e4c2ca5c99fc7e1c4e4819a57aca0973dcb0fbf79fada79fefad419b5e35c28b95e92cc9ce79af0994ad2711b4fe4d82664e707e61032971148097f07a3069081348c371ee27f379cbab18f63e592947dfaafc85cec06e26438d347317fc02cd1a6b812b01a345fb7173d08e71a7b4ce1c2bcd8ad14e99aa2d3c98e6a8c2aba0114695336cfe152efc433fd1025afd49e3f0b6588bc8bf48cf8c58f92c99c35376dd0de9cba05afd1036f223d23957ee7f4e5f8a2db76e26a16f2533bb00e1ea29caac95926adbea9e8ac6e15abcae86d21c241846fd873a0ab611670058c2a48059fa799731ebcecb5f81599905c22c716fe1434f72ae58bcbdfff855f892f404bc0bd6890ae19c77cd70d71451395faf56ad9095cefb92cdfe97301655a4b75e33473afce1ab62a971966070b3f3723dc7fa475498cd9b8bfffd97bb4563c41751cadc6fa5009d598a1a909cc5150cb7d78b9aadcb958e2033eed963d554a19249ddb5ada4a7d835ca0c28b72d60fa16643e63c8c59cd1fbf622fbea0abdac63d1c1bfbfa166c7864e2b9f7e52f0f64cf57e423a73f2406656a5296256a156ada261ff6e1cc39686bcccaeae17a997fadc8e78bf1054f3a44c9c41dbdaaaea8beb90837e600328106dacd2347cfa95a9e4f4ebb79c0d333aa4fb07eab738f46f6da72fc3dde6d0ac58ced64fb01b182e8855bc84d2799fdea5f8e2f7ecbcce17501686826e12edcfb7d888697e63a3c70cd99958bec98644fc4bb957bcb6e77532dbb802ec6f8d0c05f9dacf93188fd25736f20fbd0639685cbd8cb86f3639fdacbeac57b9aaeaa77adb317b68eddc0cc09a9150f2bbb0e2233cab267a95e21ff57c7ce8e3255d78645d1ce4d3afd0bf50664cae1112829c61c2fb3ae95fdeb2f9ee75f3bb31d3bd8e011c67637f4f5692887a69273e475ae1357f6053299bd74a57cc68791fe0cc248175dd5e4cd2e7640cf3cd1037edc28f3a48ff0345c2fed0f7df8bdf3577f2fb67275b1af3982ace215f4f730e440e01d88a10d96411dfbbf55dbb33d3cb79cdd89aae2abee2fc06e2698f954ec59d882faa4e1cab1ea750d7fe0e65177e33da2d31d87219eefefc73317ebb5ef2fc497e52b5b2fe0af0ce31948b8dad1b3854b370879888713deadcdca65dd57f1efc6ccc215a1a2ded6875069c53dd29843bfaa779373733c2361ddbeb977c7fa08aba1e5997197f55f59b9fc3c1f5bf5e37cde78807a06f117a24e0fdeafcca1effb921b28981f4f867ffcf51bfdf22dfef62def2fcd7968d98ebdc53a7e0895d638e0ef4d6d50b790cd9debfb28135d473b19f3391b857d9895dfa4ff4a7cf9c003fa55ee047f6535897591adaa1ee44a4520cb9b43db3135f3e876c2b65790378f3187092083b19faa575bd3795f32b53051b73ea776207ab958c105e5f331b7c21ed54e3c7b126a104f6ea3ef021c6532e49330ebbf25fc157bc9fc1b23743682cf823fc51e22f5055dd75cd8b63ab72d88a9f177ad0b33365e1f796fef21eba9411d5030757de01776663bfad06d836ec62a349e4119d4a7bc52ac47f1f30034f8125e033c011fcf1078f63a935f389fbc49266b1756c05ddd8ffa1b730acbfbfc985f809784881aebad98f18ce115a096d9078ddfc773f121ee52c15ab903c17b5c74ce93cf7ae289e22e563df48bc13ef646e3aed984bbf7abbeecebf165eddf7ff9d4c7595a199f5791735eddcc6f2357ff7d98ecef2557ffeed6f462e5b9cfd6f90bf6b27e65e20ef256f1ea48a387994ba8fbf09e7af6ab7b29ab7d96e59ccbb37c1bedf8977e8fbc41362bbd10e19d4bab240da2dfec679fcbc66b3997b9cc29f8df27d9a013cbded81afe727c59fa8a55b9acc6dde5bdd57f2bc1613f7ef0e1391977d9835cf65696673eb3e76c5c668c0d31e68bf9585897cd8a5c3ef9379236c5e71519b613ffc3fa3cebb12d53e367f1cab85f944b6b03ffb3325bb7a3d51c61f5dcdf92c724afd1da5c9ffd8e72b34c7eadde8fef2dfd718f66c913f99d325db28718dfe9372fd95f00f3fd956bdd6fd17cab72cdcc9be402df0b3be157ed6595a7eb79c0f2f7ca2ef1dcf1af76567fcfbc49861ffd53d66e3eca7e2927f85e50ab72f96a8efc2b79dbbace7ff5fe67f36db4a1aceffb7a7cf93ff1faa67f7fec6ff1feff4a2efffd6f7ffc0f54dd11fd + + + + + okayButton + pressed() + NewWidgetDlgBase + accept() + + + cancelButton + pressed() + NewWidgetDlgBase + reject() + + + templateList + selectionChanged() + NewWidgetDlgBase + templateSelChanged() + + + subclassingCb + pressed() + NewWidgetDlgBase + subclassingPressed() + + + + templateList + subclassingCb + ui_classnameEd + captionEd + subclassnameEd + okayButton + cancelButton + + + kdialog.h + kpushbutton.h + + + subclassingPressed() + templateSelChanged() + + + + diff --git a/buildtools/qmake/projectconfigurationdlg.cpp b/buildtools/qmake/projectconfigurationdlg.cpp new file mode 100644 index 00000000..b76fc3a5 --- /dev/null +++ b/buildtools/qmake/projectconfigurationdlg.cpp @@ -0,0 +1,2174 @@ +/*************************************************************************** +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jsgaarde@tdcspace.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "projectconfigurationdlg.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "trollprojectwidget.h" +#include "trollprojectpart.h" +#include "qmakescopeitem.h" +#include "scope.h" +#include "urlutil.h" + +InsideCheckListItem::InsideCheckListItem( QListView *parent, QMakeScopeItem *item, ProjectConfigurationDlg *config ) : + QCheckListItem( parent, item->relativePath().endsWith("/") ? item->relativePath().right( item->relativePath().length() - 1 ) : item->relativePath(), QCheckListItem::CheckBox ) +{ + prjItem = item; + m_config = config; +} + +InsideCheckListItem::InsideCheckListItem( QListView *parent, QListViewItem *after, QMakeScopeItem *item, ProjectConfigurationDlg *config ) : + QCheckListItem( parent, + after, + item->relativePath(), QCheckListItem::CheckBox ) +{ + prjItem = item; + m_config = config; +} + +//check or uncheck dependency to currently checked or unchecked library +void InsideCheckListItem::stateChange( bool state ) +{ + if ( listView() == m_config->insidelib_listview ) + { + QListViewItemIterator it( m_config->intDeps_view ); + while ( it.current() ) + { + InsideCheckListItem * chi = dynamic_cast( it.current() ); + if ( chi ) + if ( chi->prjItem == prjItem ) + chi->setOn( state ); + ++it; + } + } +} + +CustomVarListItem::CustomVarListItem(QListView* parent, unsigned int id, QMap var) + : KListViewItem(parent), m_key(id) +{ + setText(0, var["var"]); + setText(1, var["op"]); + setText(2, var["values"]); +} + +QString CustomVarListItem::key(int column, bool ascending) const +{ + if( column == 0) + return QString::number(m_key); + return KListViewItem::key(column, ascending); +} + +ProjectConfigurationDlg::ProjectConfigurationDlg( QListView *_prjList, TrollProjectWidget* _prjWidget, QWidget* parent, const char* name, bool modal, WFlags fl ) + : ProjectConfigurationDlgBase( parent, name, modal, fl | Qt::WStyle_Tool ), myProjectItem(0) +{ + prjList = _prjList; + prjWidget = _prjWidget; + // m_projectConfiguration = conf; + m_targetLibraryVersion->setValidator( new QRegExpValidator( + QRegExp( "\\d+(\\.\\d+)?(\\.\\d+)" ), this ) ); + customVariables->setSortColumn(0); + customVariables->setSortOrder(Qt::Ascending); + mocdir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + mocdir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + objdir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + objdir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + rccdir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + rccdir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + uidir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + uidir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + m_CWDEdit->completionObject()->setMode(KURLCompletion::DirCompletion); + m_CWDEdit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + m_targetPath->completionObject()->setMode(KURLCompletion::DirCompletion); + m_targetPath->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); +} + +void ProjectConfigurationDlg::updateSubproject( QMakeScopeItem* _item ) +{ + if ( myProjectItem && myProjectItem->scope ) + { + switch ( prjWidget->dialogSaveBehaviour() ) + { + case TrollProjectWidget::AlwaysSave: + apply(); + break; + case TrollProjectWidget::NeverSave: + break; + case TrollProjectWidget::Ask: + if ( !buttonApply->isEnabled() ) + break; + if ( KMessageBox::questionYesNo( 0, i18n( "Save the current subproject's configuration?" ), + i18n( "Save Configuration?" ) ) == KMessageBox::Yes ) + apply(); + break; + } + } + myProjectItem = _item; + updateControls(); + buttonApply->setEnabled( false ); +} + +ProjectConfigurationDlg::~ProjectConfigurationDlg() +{} + +void ProjectConfigurationDlg::updateProjectConfiguration() +{ + // Template + if ( myProjectItem->scope->scopeType() == Scope::ProjectScope ) + { + if ( radioApplication->isChecked() ) + { + if( myProjectItem->scope->variableValues("TEMPLATE").findIndex("app") == -1 ) + { + addAppDeps(); + removeSharedLibDeps(); + removeStaticLibDeps(); + } + myProjectItem->scope->setEqualOp( "TEMPLATE", "app" ); + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "staticlib" ); + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "dll" ); + myProjectItem->setPixmap( 0, SmallIcon( "qmake_app" ) ); + QString targetname = prjWidget->getCurrentOutputFilename(); + if( targetname.findRev("/") != -1 ) + targetname = targetname.right( targetname.length() - targetname.findRev("/") - 1 ); + DomUtil::writeEntry( *prjWidget->m_part->projectDom(), + "/kdevtrollproject/run/runarguments/"+targetname, m_editRunArguments->text() ); + DomUtil::writeEntry( *prjWidget->m_part->projectDom(), + "/kdevtrollproject/run/cwd/"+targetname, m_CWDEdit->url() ); + DomUtil::writeEntry( *prjWidget->m_part->projectDom(), + "/kdevtrollproject/run/debugarguments/"+targetname, m_editDebugArguments->text() ); + + } + else if ( radioLibrary->isChecked() ) + { + myProjectItem->scope->setEqualOp( "TEMPLATE", "lib" ); + if ( staticRadio->isOn() ) + { + if( myProjectItem->scope->variableValues("CONFIG").findIndex("dll") != -1 ) + { + addStaticLibDeps(); + removeSharedLibDeps(); + } + myProjectItem->addValue( "CONFIG", "staticlib" ); + myProjectItem->removeValue( "CONFIG", "dll" ); + if ( !myProjectItem->scope->listIsEmpty( myProjectItem->scope->variableValues( "VERSION" ) ) ) + { + myProjectItem->scope->removeVariable( "VERSION", "=" ); + myProjectItem->scope->removeVariable( "VERSION", "+=" ); + myProjectItem->scope->removeVariable( "VERSION", "-=" ); + } + } + if ( sharedRadio->isOn() ) + { + kdDebug(9024) << "Activating debug lib:" << myProjectItem->scope->variableValues("CONFIG") << endl; + if( myProjectItem->scope->variableValues("CONFIG").findIndex("dll") == -1 ) + { + addSharedLibDeps(); + removeStaticLibDeps(); + } + myProjectItem->addValue( "CONFIG", "dll" ); + myProjectItem->scope->setEqualOp( "VERSION", m_targetLibraryVersion->text() ); + if ( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 ) + myProjectItem->removeValue( "CONFIG", "staticlib" ); + } + if ( checkPlugin->isOn() ) + myProjectItem->addValue( "CONFIG", "plugin" ); + else + myProjectItem->removeValue( "CONFIG", "plugin" ); + if ( checkDesigner->isChecked() ) + myProjectItem->addValue( "CONFIG", "designer" ); + else + myProjectItem->removeValue( "CONFIG", "designer" ); + + myProjectItem->setPixmap( 0, SmallIcon( "qmake_lib" ) ); + removeAppDeps(); + } + else if ( radioSubdirs->isChecked() ) + { + if( myProjectItem->scope->variableValues("TEMPLATE").findIndex("subdirs") == -1 ) + { + removeSharedLibDeps(); + removeStaticLibDeps(); + removeAppDeps(); + } + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "dll" ); + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "staticlib" ); + myProjectItem->scope->setEqualOp( "TEMPLATE", "subdirs" ); + myProjectItem->setPixmap( 0, SmallIcon( "folder" ) ); + } + } + + // Buildmode + int releaseidx = myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "release" ); + int debugidx = myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "debug" ); + if ( radioReleaseMode->isChecked() ) + { + if( releaseidx != -1 && releaseidx < debugidx ) + myProjectItem->removeValue( "CONFIG", "debug" ); + else if( debugidx != -1 ) + myProjectItem->removeValue( "CONFIG", "debug" ); + myProjectItem->addValue( "CONFIG", "release" ); + }else if( !checkDebugReleaseMode->isChecked() ) + myProjectItem->removeValue( "CONFIG", "release" ); + + if ( radioDebugMode->isChecked() ) + { + if( debugidx != -1 && debugidx < releaseidx ) + myProjectItem->removeValue( "CONFIG", "release" ); + else if( releaseidx != -1 ) + myProjectItem->removeValue( "CONFIG", "release" ); + myProjectItem->addValue( "CONFIG", "debug" ); + }else if( !checkDebugReleaseMode->isChecked() ) + myProjectItem->removeValue( "CONFIG", "debug" ); + + // requirements + if ( exceptionCheck->isChecked() ) + myProjectItem->addValue( "CONFIG", "exceptions" ); + else + myProjectItem->removeValue( "CONFIG", "exceptions" ); + if ( stlCheck->isChecked() ) + myProjectItem->addValue( "CONFIG", "stl" ); + else + myProjectItem->removeValue( "CONFIG", "stl" ); + if ( rttiCheck->isChecked() ) + myProjectItem->addValue( "CONFIG", "rtti" ); + else + myProjectItem->removeValue( "CONFIG", "rtti" ); + if ( checkQt->isChecked() ) + myProjectItem->addValue( "CONFIG", "qt" ); + else + myProjectItem->removeValue( "CONFIG", "qt" ); + if ( checkOpenGL->isChecked() ) + myProjectItem->addValue( "CONFIG", "opengl" ); + else + myProjectItem->removeValue( "CONFIG", "opengl" ); + if ( checkThread->isChecked() ) + myProjectItem->addValue( "CONFIG", "thread" ); + else + myProjectItem->removeValue( "CONFIG", "thread" ); + if ( checkX11->isChecked() ) + myProjectItem->addValue( "CONFIG", "x11" ); + else + myProjectItem->removeValue( "CONFIG", "x11" ); + if ( checkOrdered->isChecked() ) + myProjectItem->addValue( "CONFIG", "ordered" ); + else + myProjectItem->removeValue( "CONFIG", "ordered" ); + if ( checkLibtool->isChecked() ) + myProjectItem->addValue( "CONFIG", "compile_libtool" ); + else + myProjectItem->removeValue( "CONFIG", "compile_libtool" ); + + if ( checkConsole->isChecked() ) + myProjectItem->addValue( "CONFIG", "console" ); + else + myProjectItem->removeValue( "CONFIG", "console" ); + if ( checkPCH->isChecked() ) + myProjectItem->addValue( "CONFIG", "precompile_header" ); + else + myProjectItem->removeValue( "CONFIG", "precompile_header" ); + // Warnings + if ( checkWarning->isChecked() ) + { + myProjectItem->addValue( "CONFIG", "warn_on" ); + myProjectItem->removeValue( "CONFIG", "warn_off" ); + } + else + { + myProjectItem->addValue( "CONFIG", "warn_off" ); + myProjectItem->removeValue( "CONFIG", "warn_on" ); + } + if ( checkWindows->isChecked() ) + myProjectItem->addValue( "CONFIG", "windows" ); + else + myProjectItem->removeValue( "CONFIG", "windows" ); + + //Qt4 libs + if ( prjWidget->m_part->isQt4Project() ) + { + if ( checkDebugReleaseMode->isChecked() ) + myProjectItem->addValue( "CONFIG", "debug_and_release" ); + else + myProjectItem->removeValue( "CONFIG", "debug_and_release" ); + + if ( checkTestlib->isChecked() ) + myProjectItem->addValue( "CONFIG", "qtestlib" ); + else + myProjectItem->removeValue( "CONFIG", "qtestlib" ); + if ( checkAssistant->isChecked() ) + myProjectItem->addValue( "CONFIG", "assistant" ); + else + myProjectItem->removeValue( "CONFIG", "assistant" ); + if ( checkUiTools->isChecked() ) + myProjectItem->addValue( "CONFIG", "uitools" ); + else + myProjectItem->removeValue( "CONFIG", "uitools" ); + if ( checkQDBus->isChecked() ) + myProjectItem->addValue( "CONFIG", "dbus" ); + else + myProjectItem->removeValue( "CONFIG", "dbus" ); + if ( checkBuildAll->isChecked() ) + myProjectItem->addValue( "CONFIG", "build_all" ); + else + myProjectItem->removeValue( "CONFIG", "build_all" ); + if ( checkQtHelp->isChecked() ) + myProjectItem->addValue( "CONFIG", "help" ); + else + myProjectItem->removeValue( "CONFIG", "help" ); + + if ( checkQt4Core->isChecked() ) + myProjectItem->addValue( "QT", "core" ); + else + myProjectItem->removeValue( "QT", "core" ); + if ( checkQt4Gui->isChecked() ) + myProjectItem->addValue( "QT", "gui" ); + else + myProjectItem->removeValue( "QT", "gui" ); + if ( checkQt4SQL->isChecked() ) + myProjectItem->addValue( "QT", "sql" ); + else + myProjectItem->removeValue( "QT", "sql" ); + if ( checkQt4SVG->isChecked() ) + myProjectItem->addValue( "QT", "svg" ); + else + myProjectItem->removeValue( "QT", "svg" ); + if ( checkQt4XML->isChecked() ) + myProjectItem->addValue( "QT", "xml" ); + else + myProjectItem->removeValue( "QT", "xml" ); + if ( checkQt4Network->isChecked() ) + myProjectItem->addValue( "QT", "network" ); + else + myProjectItem->removeValue( "QT", "network" ); + if ( checkQt3Support->isChecked() ) + myProjectItem->addValue( "QT", "qt3support" ); + else + myProjectItem->removeValue( "QT", "qt3support" ); + if ( checkQt4OpenGL->isChecked() ) + myProjectItem->addValue( "QT", "opengl" ); + else + myProjectItem->removeValue( "QT", "opengl" ); + if ( checkQtScript->isChecked() ) + myProjectItem->addValue( "QT", "script" ); + else + myProjectItem->removeValue( "QT", "script" ); + if ( checkQtWebKit->isChecked() ) + myProjectItem->addValue( "QT", "webkit" ); + else + myProjectItem->removeValue( "QT", "webkit" ); + if ( checkQtXmlPatterns->isChecked() ) + myProjectItem->addValue( "QT", "xmlpatterns" ); + else + myProjectItem->removeValue( "QT", "xmlpatterns" ); + if ( checkPhonon->isChecked() ) + myProjectItem->addValue( "QT", "phonon" ); + else + myProjectItem->removeValue( "QT", "phonon" ); + } + + QStringList confValues = myProjectItem->scope->variableValues( "CONFIG" ); + QStringList extraValues = QStringList::split( " ", editConfigExtra->text() ); + for ( QStringList::iterator it = confValues.begin() ; it != confValues.end() ; ++it ) + { + if ( Scope::KnownConfigValues.findIndex( *it ) == -1 && extraValues.findIndex( *it ) == -1 ) + { + myProjectItem->scope->removeFromPlusOp( "CONFIG", *it ); + } + } + + for ( QStringList::iterator it = extraValues.begin() ; it != extraValues.end() ; ++it ) + { + if ( confValues.findIndex( *it ) == -1 ) + myProjectItem->scope->addToPlusOp( "CONFIG", *it ); + } + + QString targetpath = m_targetPath->url(); +// if( !QFileInfo( targetpath ).isRelative() ) +// targetpath = URLUtil::getRelativePath( myProjectItem->scope->projectDir(), targetpath ); + if( myProjectItem->scope->scopeType() == Scope::FunctionScope || myProjectItem->scope->scopeType() == Scope::SimpleScope ) + { + if( myProjectItem->scope->variableValues("TARGET").findIndex( m_targetOutputFile->text() ) == -1 ) + myProjectItem->scope->setEqualOp( "TARGET", QStringList( m_targetOutputFile->text() ) ); + if( myProjectItem->scope->variableValues("DESTDIR").findIndex( targetpath ) == -1 ) + myProjectItem->scope->setEqualOp( "DESTDIR", QStringList( targetpath ) ); + }else + { + myProjectItem->scope->setEqualOp( "TARGET", QStringList( m_targetOutputFile->text() ) ); + myProjectItem->scope->setEqualOp( "DESTDIR", QStringList( targetpath ) ); + } + + myProjectItem->updateValues( "DEFINES", QStringList::split( " ", m_defines->text() ) ); + myProjectItem->updateValues( "QMAKE_CXXFLAGS_DEBUG", QStringList::split( " ", m_debugFlags->text() ) ); + myProjectItem->updateValues( "QMAKE_CXXFLAGS_RELEASE", QStringList::split( " ", m_releaseFlags->text() ) ); + + //add selected includes + QStringList values; + InsideCheckListItem *insideItem = ( InsideCheckListItem * ) insideinc_listview->firstChild(); + while ( insideItem ) + { + if ( insideItem->isOn() ) + { + QString tmpInc = insideItem->prjItem->getIncAddPath( myProjectItem->scope->projectDir() ); + tmpInc = QDir::cleanDirPath( tmpInc ); + values << tmpInc; + + } + insideItem = ( InsideCheckListItem* ) insideItem->itemBelow(); + } + + QCheckListItem *outsideItem = ( QCheckListItem * ) outsideinc_listview->firstChild(); + while ( outsideItem ) + { + values << outsideItem->text( 0 ); + outsideItem = ( QCheckListItem* ) outsideItem->itemBelow(); + } +// myProjectItem->removeValues( "INCLUDEPATH", values ); + myProjectItem->updateValues( "INCLUDEPATH", values ); + + //target.install + if ( checkInstallTarget->isChecked() == true ) + { + myProjectItem->addValue( "INSTALLS", "target" ); + myProjectItem->scope->setEqualOp( "target.path", QStringList( m_InstallTargetPath->text() ) ); + } + else + { + myProjectItem->removeValue( "INSTALLS", "target" ); + myProjectItem->scope->removeVariable( "target.path", "=" ); + } + + //makefile + myProjectItem->scope->setEqualOp( "MAKEFILE", QStringList( makefile_url->url() ) ); + + //add libs to link + + values.clear(); + QStringList libPaths; + + //inside libs to link + insideItem = ( InsideCheckListItem * ) insidelib_listview->firstChild(); + while ( insideItem ) + { + if ( insideItem->isOn() ) + { + + QString tmpLib = insideItem->prjItem->getLibAddObject( myProjectItem->scope->projectDir() ); + if ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + //add path if shared lib is linked + QString tmpPath = insideItem->prjItem->getLibAddPath( + myProjectItem->scope->projectDir() ); + if ( tmpPath != "" ) + { + values << ("-L"+tmpPath) ; + } + } + values << tmpLib ; + + } + insideItem = ( InsideCheckListItem* ) insideItem->itemBelow(); + } + + //extra lib paths + QListViewItem *lvItem = outsidelibdir_listview->firstChild(); + while ( lvItem ) + { + values << ( "-L"+lvItem->text( 0 ) ); + lvItem = lvItem->itemBelow(); + } + + + //outside libs to link + outsideItem = ( QCheckListItem * ) outsidelib_listview->firstChild(); + while ( outsideItem ) + { + values << outsideItem->text( 0 ); + outsideItem = ( QCheckListItem* ) outsideItem->itemBelow(); + } + + +// myProjectItem->removeValues( "LIBS", values ); + myProjectItem->updateValues( "LIBS", values ); + + values.clear(); + + //external project dependencies + QListViewItem *depItem = extDeps_view->firstChild(); + while ( depItem ) + { + values << depItem->text( 0 ); + depItem = depItem->itemBelow(); + } + + //internal project dependencies + insideItem = dynamic_cast( intDeps_view->firstChild() ); + while ( insideItem ) + { + if ( insideItem->isOn() ) + { + if ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 + || ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex("dll") == -1 + && insideItem->prjItem->scope->variableValues( "TEMPLATE" ).findIndex("lib") != -1 ) ) + { + values << insideItem->prjItem->getLibAddObject( + myProjectItem->scope->projectDir() ); + } + else if ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + values << insideItem->prjItem->getSharedLibAddObject( + myProjectItem->scope->projectDir() ); + } + else + { + values << insideItem->prjItem->getApplicationObject( + myProjectItem->scope->projectDir() ); + } + } + insideItem = dynamic_cast( insideItem->itemBelow() ); + } +// myProjectItem->removeValues( "TARGETDEPS", values ); + myProjectItem->updateValues( "TARGETDEPS", values ); + + values.clear(); + //change build order + lvItem = buildorder_listview->firstChild(); + if ( lvItem && lvItem->itemBelow() && myProjectItem->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + { + + while ( lvItem ) + { + values << lvItem->text( 0 ); + lvItem = lvItem->itemBelow(); + } + + if( values != myProjectItem->scope->variableValues("SUBDIRS") ) + { + if ( myProjectItem->scope->isVariableReset( "SUBDIRS" ) ) + { + myProjectItem->scope->removeVariable( "SUBDIRS", "=" ); + myProjectItem->scope->setEqualOp( "SUBDIRS", values ); + } + else + { + myProjectItem->scope->removeVariable( "SUBDIRS", "+=" ); + myProjectItem->scope->setPlusOp( "SUBDIRS", values ); + } + } + } + + // intermediate locations + myProjectItem->scope->setEqualOp( "OBJECTS_DIR", QStringList( objdir_url->url() ) ); + myProjectItem->scope->setEqualOp( "UI_DIR", QStringList( uidir_url->url() ) ); + myProjectItem->scope->setEqualOp( "MOC_DIR", QStringList( mocdir_url->url() ) ); + myProjectItem->scope->setEqualOp( "RCC_DIR", QStringList( rccdir_url->url() ) ); + + //CORBA + myProjectItem->scope->setEqualOp( "IDL_COMPILER", QStringList( idlCmdEdit->url() ) ); + myProjectItem->updateValues( "IDL_OPTIONS", QStringList::split( " ", idlCmdOptionsEdit->text() ) ); + + QListViewItemIterator iter(customVariables); + for( ; iter.current() ; iter++ ) + { + QListViewItem* item = iter.current(); + myProjectItem->scope->updateCustomVariable( item->key(0, true).toUInt(), item->text(0), item->text(1), item->text(2) ); + } +} + +void ProjectConfigurationDlg::accept() +{ + if( buttonApply->isEnabled() ) + apply(); + myProjectItem = 0; + QDialog::accept(); +} + +void ProjectConfigurationDlg::reject() +{ + myProjectItem = 0; + QDialog::reject(); +} + + + +void ProjectConfigurationDlg::updateControls() +{ + // Project template + groupLibraries->setEnabled( false ); + if( myProjectItem->scope->scopeType() != Scope::ProjectScope ) + groupTemplate->setEnabled( false ); + else + groupTemplate->setEnabled( true ); + + //cache the value of the some variables + QStringList configValues = myProjectItem->scope->variableValues( "CONFIG" ); + QStringList templateValues = myProjectItem->scope->variableValues( "TEMPLATE" ); + //if( !myProjectItem->isScope ) + //{ + if ( templateValues.findIndex( "lib" ) != -1 ) + { + groupLibraries->setEnabled( true ); + + radioLibrary->setChecked( true ); + staticRadio->setChecked( true ); //default + + if ( configValues.findIndex( "staticlib" ) != -1 ) + { + staticRadio->setChecked( true ); + checkPlugin->setEnabled( false ); + checkDesigner->setEnabled( false ); + } + else + staticRadio->setChecked( false ); + if ( configValues.findIndex( "dll" ) != -1 ) + { + sharedRadio->setChecked( true ); + checkPlugin->setEnabled( true ); + if( prjWidget->m_part->isQt4Project() ) + checkDesigner->setEnabled( true ); + m_targetLibraryVersion->setText( myProjectItem->scope->variableValues( "VERSION" ).front() ); + } + else + { + sharedRadio->setChecked( false ); + m_targetLibraryVersion->setText( "" ); + } + + if( !staticRadio->isChecked() && !sharedRadio->isChecked() ) + { + staticRadio->setChecked( true ); + checkPlugin->setEnabled( false ); + checkDesigner->setEnabled( false ); + } + + if ( configValues.findIndex( "plugin" ) != -1 ) + checkPlugin->setChecked( true ); + else + checkPlugin->setChecked( false ); + if ( configValues.findIndex( "designer" ) != -1 ) + checkDesigner->setChecked( true ); + else + checkDesigner->setChecked( false ); + if ( configValues.findIndex( "compile_libtool" ) != -1 ) + checkLibtool->setChecked( true ); + else + checkLibtool->setChecked( false ); + } + else if ( templateValues.findIndex( "subdirs" ) != -1 ) + { + radioSubdirs->setChecked( true ); + }else + { + //Default is app mode + radioApplication->setChecked( true ); + if ( configValues.findIndex( "console" ) != -1 ) + { + checkConsole->setChecked( true ); + } + QString targetname = prjWidget->getCurrentOutputFilename(); + if( targetname.findRev("/") != -1 ) + targetname = targetname.right( targetname.length() - targetname.findRev("/") - 1 ); + m_editRunArguments->setText( DomUtil::readEntry( *prjWidget->m_part->projectDom(), "/kdevtrollproject/run/runarguments/"+targetname, "" ) ); + + QString dir = DomUtil::readEntry( *prjWidget->m_part->projectDom(), "/kdevtrollproject/run/cwd/"+targetname, "" ); + if( QFileInfo(dir).isRelative() ) + { + m_CWDEdit->completionObject()->setDir( myProjectItem->scope->projectDir() ); + m_CWDEdit->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + + m_CWDEdit->completionObject()->setDir( dir); + m_CWDEdit->fileDialog()->setURL( KURL( dir ) ); + } + m_CWDEdit->setURL( dir ); + + if( m_CWDEdit->url().isEmpty() ) + { + QString destdir = myProjectItem->m_widget->getCurrentDestDir(); + if( !destdir.startsWith( "/" ) ) + destdir = myProjectItem->m_widget->projectDirectory()+"/"+destdir; + m_CWDEdit->setURL( destdir.left( destdir.findRev("/") ) ); + m_CWDEdit->fileDialog()->setURL( KURL::fromPathOrURL( destdir.left( destdir.findRev("/") ) ) ); + } + m_editDebugArguments->setText( DomUtil::readEntry( *prjWidget->m_part->projectDom(), "/kdevtrollproject/run/debugarguments/"+targetname, "" ) ); + } + + // Buildmode + int debugidx = configValues.findIndex( "debug" ); + int releaseidx = configValues.findIndex( "release" ); + if ( debugidx != -1 && debugidx > releaseidx ) + { + radioDebugMode->setChecked( true ); + } + if ( releaseidx != -1 && releaseidx > debugidx ) + { + radioReleaseMode->setChecked( true ); + } + if ( configValues.findIndex( "debug_and_release" ) != -1 ) + { + checkDebugReleaseMode->setChecked( true ); + } + + // Requirements + if ( configValues.findIndex( "qt" ) != -1 ) + checkQt->setChecked( true ); + else + checkQt->setChecked( false ); + if ( configValues.findIndex( "opengl" ) != -1 ) + checkOpenGL->setChecked( true ); + else + checkOpenGL->setChecked( false ); + if ( configValues.findIndex( "thread" ) != -1 ) + checkThread->setChecked( true ); + else + checkThread->setChecked( false ); + if ( configValues.findIndex( "x11" ) != -1 ) + checkX11->setChecked( true ); + else + checkX11->setChecked( false ); + if ( configValues.findIndex( "ordered" ) != -1 ) + checkOrdered->setChecked( true ); + else + checkOrdered->setChecked( false ); + if ( configValues.findIndex( "exceptions" ) != -1 ) + exceptionCheck->setChecked( true ); + else + exceptionCheck->setChecked( false ); + if ( configValues.findIndex( "stl" ) != -1 ) + stlCheck->setChecked( true ); + else + stlCheck->setChecked( false ); + if ( configValues.findIndex( "rtti" ) != -1 ) + rttiCheck->setChecked( true ); + else + rttiCheck->setChecked( false ); + if ( configValues.findIndex( "precompile_header" ) != -1 ) + checkPCH->setChecked( true ); + else + checkPCH->setChecked( false ); + // Warnings + if ( configValues.findIndex( "warn_on" ) != -1 ) + { + checkWarning->setChecked( true ); + } + if ( configValues.findIndex( "warn_off" ) != -1 ) + { + checkWarning->setChecked( false ); + } + + if ( configValues.findIndex( "windows" ) != -1 ) + checkWindows->setChecked( true ); + else + checkWindows->setChecked( false ); + + //Qt4 libs + if ( prjWidget->m_part->isQt4Project() ) + { + + if ( configValues.findIndex( "assistant" ) != -1 ) + checkAssistant->setChecked( true ); + else + checkAssistant->setChecked( false ); + if ( configValues.findIndex( "qtestlib" ) != -1 ) + checkTestlib->setChecked( true ); + else + checkTestlib->setChecked( false ); + if ( configValues.findIndex( "uitools" ) != -1 ) + checkUiTools->setChecked( true ); + else + checkUiTools->setChecked( false ); + if ( configValues.findIndex( "dbus" ) != -1 ) + checkQDBus->setChecked( true ); + else + checkQDBus->setChecked( false ); + if ( configValues.findIndex( "build_all" ) != -1 ) + checkBuildAll->setChecked( true ); + else + checkBuildAll->setChecked( false ); + if ( configValues.findIndex( "help" ) != -1 ) + checkQtHelp->setChecked( true ); + else + checkQtHelp->setChecked( false ); + + QStringList qtLibs = myProjectItem->scope->variableValues( "QT" ); + if ( qtLibs.findIndex( "core" ) != -1 ) + checkQt4Core->setChecked( true ); + else + checkQt4Core->setChecked( false ); + if ( qtLibs.findIndex( "gui" ) != -1 ) + checkQt4Gui->setChecked( true ); + else + checkQt4Gui->setChecked( false ); + if ( qtLibs.findIndex( "sql" ) != -1 ) + checkQt4SQL->setChecked( true ); + else + checkQt4SQL->setChecked( false ); + if ( qtLibs.findIndex( "xml" ) != -1 ) + checkQt4XML->setChecked( true ); + else + checkQt4XML->setChecked( false ); + if ( qtLibs.findIndex( "network" ) != -1 ) + checkQt4Network->setChecked( true ); + else + checkQt4Network->setChecked( false ); + if ( qtLibs.findIndex( "svg" ) != -1 ) + checkQt4SVG->setChecked( true ); + else + checkQt4SVG->setChecked( false ); + if ( qtLibs.findIndex( "opengl" ) != -1 ) + checkQt4OpenGL->setChecked( true ); + else + checkQt4OpenGL->setChecked( false ); + if ( qtLibs.findIndex( "qt3support" ) != -1 ) + checkQt3Support->setChecked( true ); + else + checkQt3Support->setChecked( false ); + if ( qtLibs.findIndex( "script" ) != -1 ) + checkQtScript->setChecked( true ); + else + checkQtScript->setChecked( false ); + if ( qtLibs.findIndex( "phonon" ) != -1 ) + checkPhonon->setChecked( true ); + else + checkPhonon->setChecked( false ); + if ( qtLibs.findIndex( "webkit" ) != -1 ) + checkQtWebKit->setChecked( true ); + else + checkQtWebKit->setChecked( false ); + if ( qtLibs.findIndex( "xmlpatterns" ) != -1 ) + checkQtXmlPatterns->setChecked( true ); + else + checkQtXmlPatterns->setChecked( false ); + + checkDebugReleaseMode->setEnabled( true ); + checkBuildAll->setEnabled( true ); + groupQt4Libs->setEnabled( checkQt->isChecked() ); + rccdir_url->setEnabled( true ); + rccdir_label->setEnabled( true ); + } + + //fill the custom config edit + QStringList extraValues; + for ( QStringList::const_iterator it = configValues.begin() ; it != configValues.end() ; ++it ) + { + if ( Scope::KnownConfigValues.findIndex( *it ) == -1 ) + { + extraValues << *it; + } + } + editConfigExtra->setText( extraValues.join( " " ) ); + + QString dir = myProjectItem->scope->variableValues( "MAKEFILE" ).front(); + if( QFileInfo(dir).isRelative() ) + { + makefile_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + makefile_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + makefile_url->completionObject()->setDir( dir ); + makefile_url->fileDialog()->setURL( KURL( dir ) ); + } + makefile_url->setURL( dir ); + + if ( myProjectItem->scope->variableValues( "INSTALLS" ).findIndex( "target" ) != -1 ) + { + checkInstallTarget->setChecked( true ); + m_InstallTargetPath->setEnabled( true ); + } + else + { + checkInstallTarget->setChecked( false ); + m_InstallTargetPath->setEnabled( false ); + } + m_InstallTargetPath->setText( myProjectItem->scope->variableValues( "target.path" ).front() ); + + m_targetOutputFile->setText( myProjectItem->scope->variableValues( "TARGET" ).front() ); + + dir = myProjectItem->scope->variableValues( "DESTDIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + m_targetPath->completionObject()->setDir( myProjectItem->scope->projectDir() ); + m_targetPath->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + m_targetPath->completionObject()->setDir( dir ); + m_targetPath->fileDialog()->setURL( KURL( dir ) ); + } + m_targetPath->setURL( dir ); + + m_defines->setText( myProjectItem->scope->variableValues( "DEFINES" ).join( " " ) ); + m_debugFlags->setText( myProjectItem->scope->variableValues( "QMAKE_CXXFLAGS_DEBUG" ).join( " " ) ); + m_releaseFlags->setText( myProjectItem->scope->variableValues( "QMAKE_CXXFLAGS_RELEASE" ).join( " " ) ); + + updateIncludeControl(); + updateLibControls(); + updateBuildOrderControl(); + updateDependenciesControl(); + + dir = myProjectItem->scope->variableValues( "OBJECTS_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + objdir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + objdir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + objdir_url->completionObject()->setDir( dir ); + objdir_url->fileDialog()->setURL( KURL( dir ) ); + } + objdir_url->setURL( dir ); + dir = myProjectItem->scope->variableValues( "UI_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + uidir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + uidir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + uidir_url->completionObject()->setDir( dir ); + uidir_url->fileDialog()->setURL( KURL( dir ) ); + } + uidir_url->setURL( dir ); + dir = myProjectItem->scope->variableValues( "MOC_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + mocdir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + mocdir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + mocdir_url->completionObject()->setDir( dir ); + mocdir_url->fileDialog()->setURL( KURL( dir ) ); + } + mocdir_url->setURL( dir ); + dir = myProjectItem->scope->variableValues( "RC_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + rccdir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + rccdir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + rccdir_url->completionObject()->setDir( dir ); + rccdir_url->fileDialog()->setURL( KURL( dir ) ); + } + rccdir_url->setURL( dir ); + + + dir = myProjectItem->scope->variableValues( "IDL_COMPILER" ).front(); + if( QFileInfo(dir).isRelative() ) + { + idlCmdEdit->completionObject()->setDir( myProjectItem->scope->projectDir() ); + idlCmdEdit->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + idlCmdEdit->completionObject()->setDir( dir ); + idlCmdEdit->fileDialog()->setURL( KURL( dir ) ); + } + idlCmdEdit->setURL( dir ); + idlCmdOptionsEdit->setText( myProjectItem->scope->variableValues( "IDL_OPTIONS" ).join( " " ) ); + + customVariables->clear(); + customVariableName->setText(""); + customVariableData->setText(""); + customVariableOp->setCurrentItem( 0 ); + QMap > customvars = myProjectItem->scope->customVariables(); + QMap >::iterator idx = customvars.begin(); + for ( ; idx != customvars.end(); ++idx ) + { + CustomVarListItem* item = new CustomVarListItem( customVariables, idx.key(), idx.data() ); + item->setMultiLinesEnabled(true); + } + + groupTemplateChanged(0); +} + +QPtrList ProjectConfigurationDlg::getAllProjects() +{ + QPtrList tmpPrjList; + QMakeScopeItem *item = static_cast( prjList->firstChild() ); + while ( item ) + { + if ( item->scope->scopeType() == Scope::ProjectScope ) + { + if( item != myProjectItem ) + tmpPrjList.append( item ); + getAllSubProjects( item, &tmpPrjList ); + } + item = static_cast( item->nextSibling() ); + } + return ( tmpPrjList ); +} + +void ProjectConfigurationDlg::getAllSubProjects( QMakeScopeItem *item, QPtrList *itemList ) +{ + + QMakeScopeItem * subItem = static_cast( item->firstChild() ); + while ( subItem ) + { + if ( subItem->scope->scopeType() == Scope::ProjectScope ) + { + if ( subItem != myProjectItem ) + itemList->append( subItem ); + getAllSubProjects( subItem, itemList ); + } + subItem = static_cast( subItem->nextSibling() ); + } +} + +void ProjectConfigurationDlg::updateIncludeControl() +{ + insideinc_listview->setSorting( -1, false ); + outsideinc_listview->setSorting( -1, false ); + insideinc_listview->clear(); + outsideinc_listview->clear(); + + QStringList incList = myProjectItem->scope->variableValues( "INCLUDEPATH" ); + QStringList intIncList = incList; + QMap items; + QPtrList itemList = getAllProjects(); + QMakeScopeItem *item = itemList.first(); + while ( item ) + { + if ( item->scope->variableValues( "TEMPLATE" ).findIndex( "lib" ) != -1 || + item->scope->variableValues( "TEMPLATE" ).findIndex( "app" ) != -1 ) + { + QString tmpInc = item->getIncAddPath( myProjectItem->scope->projectDir() ); + tmpInc = QDir::cleanDirPath( tmpInc ); + InsideCheckListItem *newItem = new InsideCheckListItem( insideinc_listview, + insideinc_listview->lastItem(), item, this ); + + items[tmpInc] = newItem; + if ( incList.findIndex( tmpInc ) != -1 ) + { + incList.remove( tmpInc ); + newItem->setOn( true ); + } + } + // item=(ProjectItem*)item->itemBelow(); + item = itemList.next(); + } + + + //all other in incList are outside incs + outsideinc_listview->clear(); + QStringList::Iterator it1 = incList.begin(); + for ( ;it1 != incList.end();++it1 ) + { + intIncList.remove(*it1); + new QListViewItem( outsideinc_listview, outsideinc_listview->lastItem(), ( *it1 ) ); + } + for( QStringList::const_iterator it = intIncList.begin(); it != intIncList.end(); ++it ) + { + insideinc_listview->insertItem( items[*it] ); + items.remove(*it); + } + for( QMap::ConstIterator it3 = items.begin(); it3 != items.end(); it3++ ) + { + insideinc_listview->insertItem( it3.data() ); + } +} + +void ProjectConfigurationDlg::updateLibControls() +{ + + QPtrList itemList = getAllProjects(); + + insidelib_listview->setSorting( -1, false ); + outsidelib_listview->setSorting( -1, false ); + outsidelibdir_listview->setSorting( -1, false ); + insidelib_listview->clear(); + outsidelib_listview->clear(); + outsidelibdir_listview->clear(); + //update librarys + //temp strlist + QStringList libList = myProjectItem->scope->variableValues( "LIBS" ); + QStringList intLibList = libList; + QMap items; + QMakeScopeItem* item = itemList.first(); + while ( item ) + { + if ( item->scope->variableValues( "TEMPLATE" ).findIndex( "lib" ) != -1 ) + { + if ( item != myProjectItem ) + { + // create lib string + QString tmpLib = item->getLibAddObject( myProjectItem->scope->projectDir() ); + + InsideCheckListItem * newItem = new InsideCheckListItem( insidelib_listview, + insidelib_listview->lastItem(), item, this ); + insidelib_listview->takeItem( newItem ); + items[tmpLib] = newItem; + QString tmpLibDir = item->getLibAddPath( myProjectItem->scope->projectDir() ); + kdDebug(9024) << "lib:" << tmpLib << " dir:" << tmpLibDir << "|" << libList << endl; + if ( libList.findIndex( "-L" + tmpLibDir ) != -1 ) + { + libList.remove( "-L" + tmpLibDir ); + } + if ( libList.findIndex( tmpLib ) != -1 ) + { + libList.remove( tmpLib ); + newItem->setOn( true ); + } + } + } + item = itemList.next(); + } + + //all other in libList are outside libs + QStringList::Iterator it1 = libList.begin(); + for ( ;it1 != libList.end();++it1 ) + { + intLibList.remove( *it1 ); + if ( ( *it1 ).startsWith( "-L" ) ) + new QListViewItem( outsidelibdir_listview, outsidelibdir_listview->lastItem(), ( *it1 ).mid( 2 ) ); + else + { + new QListViewItem( outsidelib_listview, outsidelib_listview->lastItem(), ( *it1 ) ); + } + } + + for( QStringList::const_iterator it = intLibList.begin(); it != intLibList.end(); ++it ) + { + QString lib = *it; + if( !lib.startsWith( "-L" ) ) + { + insidelib_listview->insertItem( items[lib] ); + items.remove(lib); + } + } + for( QMap::ConstIterator it3 = items.begin(); it3 != items.end(); it3++ ) + { + insidelib_listview->insertItem( it3.data() ); + } +} + +void ProjectConfigurationDlg::updateDependenciesControl( ) +{ + QPtrList itemList = getAllProjects(); + + intDeps_view->setSorting( -1, false ); + extDeps_view->setSorting( -1, false ); + intDeps_view->clear(); + extDeps_view->clear(); + + QStringList depsList = myProjectItem->scope->variableValues( "TARGETDEPS" ); + QStringList intDepList = depsList; + QMap items; + QMakeScopeItem *item = itemList.first(); + while ( item ) + { + QStringList templateval = item->scope->variableValues( "TEMPLATE" ); + if ( templateval.findIndex( "lib" ) != -1 + || templateval.findIndex( "app" ) != -1 ) + { + QString tmpLib; + QStringList values = item->scope->variableValues( "CONFIG" ); + if ( templateval.findIndex( "lib" ) != -1 && values.findIndex( "dll" ) != -1 ) + tmpLib = item->getSharedLibAddObject( myProjectItem->scope->projectDir() ); + else if ( templateval.findIndex( "lib" ) != -1 ) + tmpLib = item->getLibAddObject( myProjectItem->scope->projectDir() ); + else + tmpLib = item->getApplicationObject( myProjectItem->scope->projectDir() ); + InsideCheckListItem * newItem = new InsideCheckListItem( intDeps_view, intDeps_view->lastItem(), item, this ); + items[tmpLib] = newItem; + if ( depsList.findIndex( tmpLib ) != -1 ) + { + depsList.remove( tmpLib ); + newItem->setOn( true ); + } + + } + item = itemList.next(); + } + + //add all other prj in itemList unchecked + + extDeps_view->clear(); + for ( QStringList::Iterator it1 = depsList.begin();it1 != depsList.end();++it1 ) + { + intDepList << *it1; + new QListViewItem( extDeps_view, extDeps_view->lastItem(), ( *it1 ) ); + } + + + for( QStringList::const_iterator it = intDepList.begin(); it != intDepList.end(); ++it ) + { + intDeps_view->insertItem( items[*it] ); + items.remove(*it); + } + + for( QMap::ConstIterator it2 = items.begin(); it2 != items.end(); it2++ ) + { + intDeps_view->insertItem( it2.data() ); + } +} + + +void ProjectConfigurationDlg::updateBuildOrderControl() +{ + //sort build order only if subdirs + if ( myProjectItem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) != -1 ) + { + + QPtrList itemList; + + QMakeScopeItem *item = static_cast( myProjectItem->firstChild() ); + while ( item ) + { + itemList.append( item ); + item = static_cast( item->nextSibling() ); + } + + incaddTab->setEnabled( false ); + buildorder_listview->setSorting( -1, false ); + buildorder_listview->clear(); + QStringList buildList = myProjectItem->scope->variableValues( "SUBDIRS" ); + QStringList::Iterator it1 = buildList.begin(); + for ( ;it1 != buildList.end();++it1 ) + { + item = itemList.first(); + while ( item ) + { + if ( item->scope->scopeType() == Scope::ProjectScope ) + { + if ( item->text( 0 ) == ( *it1 ) ) + { + new QListViewItem( buildorder_listview, buildorder_listview->lastItem(), item->text( 0 ) ); + itemList.take(); + break; + } + } + item = itemList.next();; + } + } + }else + buildorder_listview->clear(); +} + +//build order buttons +void ProjectConfigurationDlg::buildorderMoveUpClicked() +{ + if ( buildorder_listview->currentItem() == buildorder_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = buildorder_listview->firstChild(); + while ( item->nextSibling() != buildorder_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( buildorder_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::buildorderMoveDownClicked() +{ + if ( buildorder_listview->currentItem() == 0 || buildorder_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + buildorder_listview->currentItem() ->moveItem( buildorder_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +//Include dir buttons +void ProjectConfigurationDlg::insideIncMoveUpClicked() +{ + if ( insideinc_listview->currentItem() == insideinc_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = insideinc_listview->firstChild(); + while ( item->nextSibling() != insideinc_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( insideinc_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::insideIncMoveDownClicked() +{ + if ( insideinc_listview->currentItem() == 0 || insideinc_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + insideinc_listview->currentItem() ->moveItem( insideinc_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideIncMoveUpClicked() +{ + if ( outsideinc_listview->currentItem() == outsideinc_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = outsideinc_listview->firstChild(); + while ( item->nextSibling() != outsideinc_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( outsideinc_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideIncMoveDownClicked() +{ + if ( outsideinc_listview->currentItem() == 0 || outsideinc_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + outsideinc_listview->currentItem() ->moveItem( outsideinc_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideIncAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add include directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + new QListViewItem( outsideinc_listview, dir ); + activateApply( 0 ); + } +} + + +void ProjectConfigurationDlg::outsideIncRemoveClicked() +{ + delete outsideinc_listview->currentItem(); + activateApply( 0 ); +} + +//libadd buttons +void ProjectConfigurationDlg::insideLibMoveUpClicked() +{ + if ( insidelib_listview->currentItem() == insidelib_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = insidelib_listview->firstChild(); + while ( item->nextSibling() != insidelib_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( insidelib_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::insideLibMoveDownClicked() +{ + if ( insidelib_listview->currentItem() == 0 || insidelib_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + insidelib_listview->currentItem() ->moveItem( insidelib_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibMoveUpClicked() +{ + if ( outsidelib_listview->currentItem() == outsidelib_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = outsidelib_listview->firstChild(); + while ( item->nextSibling() != outsidelib_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( outsidelib_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibMoveDownClicked() +{ + if ( outsidelib_listview->currentItem() == 0 || outsidelib_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + outsidelib_listview->currentItem() ->moveItem( outsidelib_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add Library: Either choose the .a/.so file or give -l" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + dialog.urlRequester() ->setFilter( "*.so|"+i18n("Shared Library (*.so)")+"\n*.a|"+i18n("Static Library (*.a)") ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString file = dialog.urlRequester() ->url(); + if ( !file.isEmpty() ) + { + if( file.startsWith("-l") ) + { + new QListViewItem( outsidelib_listview, file ); + activateApply( 0 ); + } + else + { + QFileInfo fi(file); + if( !fi.exists() ) + { + new QListViewItem( outsidelib_listview, file );; + activateApply( 0 ); + } + if( fi.extension(false) == "a" ) + { + new QListViewItem( outsidelib_listview, file ); + activateApply( 0 ); + }else if ( fi.extension(false) == "so" ) + { + QString path = fi.dirPath( true ); + QString name = fi.fileName(); + if( name.startsWith( "lib" ) ) + name = name.mid(3); + name = "-l"+name.left( name.length() - 3 ); + new QListViewItem( outsidelib_listview, name ); + new QListViewItem( outsidelibdir_listview, path ); + activateApply( 0 ); + }else + return; + } + + } +} + + +void ProjectConfigurationDlg::outsideLibRemoveClicked() +{ + delete outsidelib_listview->currentItem(); + activateApply( 0 ); +} + +//lib paths buttons +void ProjectConfigurationDlg::outsideLibDirMoveUpClicked() +{ + if ( outsidelibdir_listview->currentItem() == outsidelibdir_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = outsidelibdir_listview->firstChild(); + while ( item->nextSibling() != outsidelibdir_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( outsidelibdir_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibDirMoveDownClicked() +{ + if ( outsidelibdir_listview->currentItem() == 0 || outsidelibdir_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + outsidelibdir_listview->currentItem() ->moveItem( outsidelibdir_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibDirAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add library directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + new QListViewItem( outsidelibdir_listview, dir ); + activateApply( 0 ); + } +} + + +void ProjectConfigurationDlg::outsideLibDirRemoveClicked() +{ + delete outsidelibdir_listview->currentItem(); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::outsideIncEditClicked() +{ + QListViewItem * item = outsideinc_listview->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change include directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + } + else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + item->setText( 0, dir ); + activateApply( 0 ); + } +} + +void ProjectConfigurationDlg::outsideLibEditClicked() +{ + QListViewItem *item = outsidelib_listview->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change Library:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + }else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString file = dialog.urlRequester() ->url(); + if ( !file.isEmpty() ) + { + if( file.startsWith("-l") ) + { + item->setText( 0, file ); + activateApply( 0 ); + } + else + { + QFileInfo fi(file); + if( !fi.exists() ) + { + item->setText( 0, file ); + activateApply( 0 ); + } + if( fi.extension(false) == "a" ) + { + item->setText( 0, file ); + activateApply( 0 ); + }else if ( fi.extension(false) == "so" ) + { + QString path = fi.dirPath( true ); + QString name = fi.fileName(); + if( name.startsWith( "lib" ) ) + name = name.mid(3); + name = "-l"+name.left( name.length() - 3 ); + item->setText( 0, name ); + new QListViewItem( outsidelibdir_listview, path ); + activateApply( 0 ); + }else + return; + } + } +} + +void ProjectConfigurationDlg::outsideLibDirEditClicked() +{ + QListViewItem * item = outsidelibdir_listview->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change library directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + } + else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + item->setText( 0, dir ); + activateApply( 0 ); + } +} + + +void ProjectConfigurationDlg::extAdd_button_clicked( ) +{ + KURLRequesterDlg dialog( "", i18n( "Add target:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString path = dialog.urlRequester() ->url(); + if ( !path.isEmpty() ) + { + new QListViewItem( extDeps_view, path ); + activateApply( 0 ); + } +} + +void ProjectConfigurationDlg::extEdit_button_clicked( ) +{ + QListViewItem * item = extDeps_view->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change target:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::LocalOnly ); + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + } + else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString path = dialog.urlRequester() ->url(); + if ( !path.isEmpty() ) + { + item->setText( 0, path ); + activateApply( 0 ); + } +} + +void ProjectConfigurationDlg::extMoveDown_button_clicked( ) +{ + if ( extDeps_view->currentItem() == 0 || extDeps_view->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + extDeps_view->currentItem() ->moveItem( extDeps_view->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::extMoveUp_button_clicked( ) +{ + if ( extDeps_view->currentItem() == extDeps_view->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = extDeps_view->firstChild(); + while ( item->nextSibling() != extDeps_view->currentItem() ) + item = item->nextSibling(); + item->moveItem( extDeps_view->currentItem() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::extRemove_button_clicked( ) +{ + delete extDeps_view->currentItem(); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::intMoveDown_button_clicked( ) +{ + if ( intDeps_view->currentItem() == 0 || intDeps_view->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + intDeps_view->currentItem() ->moveItem( intDeps_view->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::intMoveUp_button_clicked( ) +{ + if ( intDeps_view->currentItem() == intDeps_view->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = intDeps_view->firstChild(); + while ( item->nextSibling() != intDeps_view->currentItem() ) + item = item->nextSibling(); + item->moveItem( intDeps_view->currentItem() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::addCustomValueClicked() +{ + QMap customvar; + customvar["var"] = i18n("Name"); + customvar["op"] = "="; + customvar["values"] = i18n("Value"); + unsigned int key = myProjectItem->scope->addCustomVariable( customvar["var"], customvar["op"], customvar["values"] ); + CustomVarListItem* item = new CustomVarListItem( customVariables, key, customvar ); + item->setMultiLinesEnabled(true); + customVariables->setSelected( item, true ); + newCustomVariableActive(); + customVariables->sort(); + activateApply( 0 ); +} +void ProjectConfigurationDlg::removeCustomValueClicked() +{ + QListViewItem * item = customVariables->currentItem(); + if ( item ) + { + myProjectItem->scope->removeCustomVariable( item->key(0, true).toUInt() ); + delete item; + } + if( customVariables->firstChild() ) + { + customVariables->setSelected( customVariables->firstChild(), true ); + newCustomVariableActive(); + }else + { + customVariableName->setText( "" ); + customVariableData->setText( "" ); + customVariableOp->setCurrentItem( 0 ); + customVariableName->setFocus(); + } + customVariables->sort(); + + activateApply( 0 ); +} + +void ProjectConfigurationDlg::upCustomValueClicked() +{ + // custom vars + QListViewItem * item = customVariables->firstChild(); + if ( customVariables->currentItem() == item ) + { + KNotifyClient::beep(); + return ; + } + while ( item->nextSibling() != customVariables->currentItem() ) + item = item->nextSibling(); + item->moveItem( customVariables->currentItem() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::downCustomValueClicked() +{ + if ( customVariables->currentItem() == 0 || customVariables->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + customVariables->currentItem() ->moveItem( customVariables->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::newCustomVariableActive( ) +{ + customVariableOp->blockSignals(true); + customVariableName->blockSignals(true); + customVariableData->blockSignals(true); + QListViewItem * item = customVariables->currentItem(); + if ( item ) + { + customVariableName->setText( item->text( 0 ) ); + customVariableData->setText( item->text( 2 ) ); + customVariableOp->setCurrentText( item->text( 1 ) ); + customVariableName->setFocus(); + } + customVariableOp->blockSignals(false); + customVariableName->blockSignals(false); + customVariableData->blockSignals(false); +} + +void ProjectConfigurationDlg::groupLibrariesChanged( int ) +{ + if ( staticRadio->isChecked() ) + { + checkPlugin->setEnabled( false ); + checkDesigner->setEnabled( false ); + } + else if ( sharedRadio->isChecked() ) + { + checkPlugin->setEnabled( true ); + checkDesigner->setEnabled( checkPlugin->isChecked() ); + } + else if ( checkPlugin->isChecked() && prjWidget->m_part->isQt4Project() ) + { + checkDesigner->setEnabled( true ); + } + else + { + checkDesigner->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::groupTemplateChanged( int ) +{ + + if ( radioSubdirs->isChecked() ) + { + TabBuild->setTabEnabled( custVarsTab, true ); + TabBuild->setTabEnabled( libAddTab, false ); + TabBuild->setTabEnabled( incaddTab, false ); + TabBuild->setTabEnabled( buildOptsTab, false ); + TabBuild->setTabEnabled( configTab, false ); + TabBuild->setTabEnabled( depTab, true ); + intDeps_view->setEnabled( false ); + intMoveUp_button->setEnabled( false ); + intMoveDown_button->setEnabled( false ); + extAdd_button->setEnabled( false ); + extRemove_button->setEnabled( false ); + extEdit_button->setEnabled( false ); + extMoveUp_button->setEnabled( false ); + extMoveDown_button->setEnabled( false ); + extDeps_view->setEnabled( false ); + buildorder_listview->setEnabled( checkOrdered->isOn() ); + buildmoveup_button->setEnabled( checkOrdered->isOn() ); + buildmovedown_button->setEnabled( checkOrdered->isOn() ); + targetGroupbox->setEnabled( false ); + targetInstGroupbox->setEnabled( false ); + checkOrdered->setEnabled( true ); + } + else if ( radioLibrary->isChecked() ) + { + // staticRadio->setChecked(true); + TabBuild->setTabEnabled( custVarsTab, true ); + TabBuild->setTabEnabled( depTab, true ); + TabBuild->setTabEnabled( libAddTab, true ); + TabBuild->setTabEnabled( incaddTab, true ); + TabBuild->setTabEnabled( buildOptsTab, true ); + TabBuild->setTabEnabled( configTab, true ); + intDeps_view->setEnabled( true ); + intMoveUp_button->setEnabled( true ); + intMoveDown_button->setEnabled( true ); + extAdd_button->setEnabled( true ); + extRemove_button->setEnabled( true ); + extEdit_button->setEnabled( true ); + extMoveUp_button->setEnabled( true ); + extMoveDown_button->setEnabled( true ); + extDeps_view->setEnabled( true ); + buildorder_listview->setEnabled( false ); + buildmoveup_button->setEnabled( false ); + buildmovedown_button->setEnabled( false ); + groupLibraries->setEnabled( true ); + targetGroupbox->setEnabled( true ); + targetInstGroupbox->setEnabled( true ); + checkOrdered->setEnabled( false ); + } + else if ( radioApplication->isChecked() ) + { + TabBuild->setTabEnabled( custVarsTab, true ); + TabBuild->setTabEnabled( depTab, true ); + TabBuild->setTabEnabled( libAddTab, true ); + TabBuild->setTabEnabled( incaddTab, true ); + TabBuild->setTabEnabled( buildOptsTab, true ); + TabBuild->setTabEnabled( configTab, true ); + intDeps_view->setEnabled( true ); + intMoveUp_button->setEnabled( true ); + intMoveDown_button->setEnabled( true ); + extAdd_button->setEnabled( true ); + extRemove_button->setEnabled( true ); + extEdit_button->setEnabled( true ); + extMoveUp_button->setEnabled( true ); + extMoveDown_button->setEnabled( true ); + extDeps_view->setEnabled( true ); + buildorder_listview->setEnabled( false ); + buildmoveup_button->setEnabled( false ); + buildmovedown_button->setEnabled( false ); + groupLibraries->setEnabled( false ); + targetGroupbox->setEnabled( true ); + targetInstGroupbox->setEnabled( true ); + checkConsole->setEnabled( true ); + checkWindows->setEnabled( true ); + checkOrdered->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::groupRequirementsChanged( int ) +{ + if ( checkQt->isChecked() && prjWidget->m_part->isQt4Project() ) + { + groupQt4Libs->setEnabled( true ); + } + else + { + groupQt4Libs->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::targetInstallChanged( bool checked ) +{ + if ( checked ) + { + m_InstallTargetPath->setEnabled( true ); + } + else + { + m_InstallTargetPath->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::apply() +{ +// if( buttonApply->isEnabled() ) + if( !myProjectItem || !myProjectItem->scope ) + { + buttonApply->setEnabled( false ); + return; + } + updateProjectConfiguration(); + myProjectItem->scope->saveToFile(); + // prjWidget->updateProjectConfiguration( myProjectItem ); + prjWidget->setupContext(); + buttonApply->setEnabled( false ); +} + +void ProjectConfigurationDlg::activateApply( int ) +{ + buttonApply->setEnabled( true ); +} +void ProjectConfigurationDlg::activateApply( const QString& ) +{ + buttonApply->setEnabled( true ); +} + +void ProjectConfigurationDlg::activateApply( QListViewItem* ) +{ + buttonApply->setEnabled( true ); +} + +void ProjectConfigurationDlg::removeSharedLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("LIBS").findIndex(infos["shared_lib"]) != -1 ) + prjItem->scope->removeFromPlusOp("LIBS", infos["shared_lib"]); + if( prjItem->scope->variableValues("LIBS").findIndex(infos["shared_libdir"]) != -1 ) + prjItem->scope->removeFromPlusOp("LIBS", infos["shared_libdir"]); + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["shared_depend"]) != -1 ) + { + prjItem->scope->removeFromPlusOp("TARGETDEPS", infos["shared_depend"]); + + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::addStaticLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["app_depend"]) != -1 + || prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["shared_depend"]) != -1 ) + { + prjItem->scope->addToPlusOp("LIBS", infos["static_lib"]); + prjItem->scope->addToPlusOp("TARGETDEPS", infos["static_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::removeStaticLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + + QMap infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("LIBS").findIndex(infos["static_lib"]) != -1 ) + prjItem->scope->removeFromPlusOp("LIBS", infos["static_lib"]); + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["static_depend"]) != -1 ) + { + prjItem->scope->removeFromPlusOp("TARGETDEPS", infos["static_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::addSharedLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["app_depend"]) != -1 + || prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["static_depend"]) != -1 ) + { + prjItem->scope->addToPlusOp("LIBS", infos["shared_lib"]); + prjItem->scope->addToPlusOp("LIBS", infos["shared_libdir"]); + prjItem->scope->addToPlusOp("TARGETDEPS", infos["shared_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::removeAppDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["app_depend"]) != -1 ) + { + prjItem->scope->removeFromPlusOp("TARGETDEPS", infos["app_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::addAppDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["shared_depend"]) != -1 + || prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["static_depend"]) != -1 ) + { + prjItem->scope->addToPlusOp("TARGETDEPS", infos["app_depend"]); + + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::customVarChanged() +{ + QListViewItem * item = customVariables->currentItem(); + if ( item ) + { + item->setText( 0, customVariableName->text() ); + item->setText( 1, customVariableOp->currentText() ); + item->setText( 2, customVariableData->text() ); + } + activateApply( 0 ); +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/projectconfigurationdlg.h b/buildtools/qmake/projectconfigurationdlg.h new file mode 100644 index 00000000..246fb388 --- /dev/null +++ b/buildtools/qmake/projectconfigurationdlg.h @@ -0,0 +1,145 @@ +/*************************************************************************** +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jsgaarde@tdcspace.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef PROJECTCONFIGURATIONDLG_H +#define PROJECTCONFIGURATIONDLG_H + +#include "projectconfigurationdlgbase.h" +//#include "trollprojectwidget.h" +#include +#include +#include +#include + +class QMakeScopeItem; +class KListViewItem; +class qProjectItem; +class ProjectConfigurationDlg; +class TrollProjectWidget; + +class InsideCheckListItem : public QCheckListItem +{ +public: + InsideCheckListItem( QListView *parent, QMakeScopeItem *item, ProjectConfigurationDlg *config ); + + InsideCheckListItem( QListView *parent, QListViewItem *after, QMakeScopeItem *item, ProjectConfigurationDlg *config ); + QMakeScopeItem *prjItem; + ProjectConfigurationDlg *m_config; + +protected: + virtual void stateChange ( bool state ); +}; + +class CustomVarListItem : public KListViewItem +{ + public: + CustomVarListItem( QListView*, unsigned int, QMap ); + QString key(int column, bool ascending) const; + private: + unsigned int m_key; +}; + +class ProjectConfigurationDlg : public ProjectConfigurationDlgBase +{ +public: + ProjectConfigurationDlg( QListView *_prjList, TrollProjectWidget* _prjWidget, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ProjectConfigurationDlg(); + void updateControls(); + void updateSubproject( QMakeScopeItem* _item ); + QMakeScopeItem* currentProjectItem() { return myProjectItem; } + +public slots: + // virtual void radioLibrarytoggled(bool); + virtual void updateProjectConfiguration(); + + virtual void buildorderMoveUpClicked(); + virtual void buildorderMoveDownClicked(); + + virtual void insideIncMoveUpClicked(); + virtual void insideIncMoveDownClicked(); + virtual void outsideIncMoveUpClicked(); + virtual void outsideIncMoveDownClicked(); + virtual void outsideIncAddClicked(); + virtual void outsideIncRemoveClicked(); + virtual void outsideIncEditClicked(); + + virtual void insideLibMoveUpClicked(); + virtual void insideLibMoveDownClicked(); + virtual void outsideLibMoveUpClicked(); + virtual void outsideLibMoveDownClicked(); + virtual void outsideLibAddClicked(); + virtual void outsideLibRemoveClicked(); + virtual void outsideLibEditClicked(); + + virtual void outsideLibDirMoveUpClicked(); + virtual void outsideLibDirMoveDownClicked(); + virtual void outsideLibDirAddClicked(); + virtual void outsideLibDirRemoveClicked(); + virtual void outsideLibDirEditClicked(); + + virtual void extAdd_button_clicked(); + virtual void extEdit_button_clicked(); + virtual void extMoveDown_button_clicked(); + virtual void extMoveUp_button_clicked(); + virtual void extRemove_button_clicked(); + virtual void intMoveDown_button_clicked(); + virtual void intMoveUp_button_clicked(); + + virtual void addCustomValueClicked(); + virtual void removeCustomValueClicked(); + virtual void upCustomValueClicked(); + virtual void downCustomValueClicked(); + + virtual void newCustomVariableActive(); + + virtual void groupLibrariesChanged( int ); + virtual void groupRequirementsChanged( int ); + virtual void groupTemplateChanged( int ); + virtual void targetInstallChanged( bool ); + virtual void accept(); + virtual void reject(); + virtual void apply(); + virtual void activateApply( int ); + virtual void activateApply( const QString& ); + + + void updateIncludeControl(); + void updateLibControls(); + void updateBuildOrderControl(); + void updateDependenciesControl(); + virtual void activateApply(QListViewItem*); + virtual void customVarChanged(); + +protected: + QListView *prjList; + QMakeScopeItem *myProjectItem; + QPtrList getAllProjects(); + TrollProjectWidget* prjWidget; + void getAllSubProjects( QMakeScopeItem *item, QPtrList *itemList ); + +private: + void removeSharedLibDeps(); + void removeStaticLibDeps(); + void addSharedLibDeps(); + void addStaticLibDeps(); + void removeAppDeps(); + void addAppDeps(); +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/projectconfigurationdlgbase.ui b/buildtools/qmake/projectconfigurationdlgbase.ui new file mode 100644 index 00000000..d447210d --- /dev/null +++ b/buildtools/qmake/projectconfigurationdlgbase.ui @@ -0,0 +1,2897 @@ + +ProjectConfigurationDlgBase +Jakob Simon-Gaarde + + + ProjectConfigurationDlgBase + + + + 0 + 0 + 746 + 694 + + + + + 5 + 5 + 0 + 0 + + + + QMake Subproject Configuration + + + + unnamed + + + + buttonCancel + + + &Cancel + + + + + buttonOk + + + &OK + + + true + + + + + Spacer1_2 + + + Horizontal + + + Expanding + + + + 260 + 16 + + + + + + buttonApply + + + &Apply + + + + + TabBuild + + + true + + + 0 + + + + buildTab + + + Basics + + + + unnamed + + + + groupTemplate + + + Template + + + + unnamed + + + + radioLibrary + + + Librar&y + + + Create a library + + + + + radioSubdirs + + + &Subdirectories + + + This project holds subdirectories + + + + + checkOrdered + + + false + + + Ordered + + + Build the subprojects in the order they are listed in the .pro file + + + + + spacer15 + + + Horizontal + + + Expanding + + + + 101 + 20 + + + + + + radioApplication + + + WidgetOrigin + + + A&pplication + + + Create an application + + + + + + + targetGroupbox + + + Target + + + + unnamed + + + + TextLabel1_2 + + + Path: + + + m_targetPath + + + + + TextLabel2 + + + Output file: + + + m_targetOutputFile + + + + + m_targetOutputFile + + + + + m_targetPath + + + + + + + targetInstGroupbox + + + Target Installation + + + + unnamed + + + + m_InstallTargetPath + + + + + checkInstallTarget + + + I&nstall + + + + + textLabel1_2 + + + Installation path: + + + m_InstallTargetPath + + + + + + + groupBox6 + + + Makefile + + + + unnamed + + + + makefile_url + + + + + + + argumentsGroupBox + + + false + + + Arguments + + + + unnamed + + + + textLabel1_6 + + + Run arguments: + + + + + m_editRunArguments + + + + + m_editDebugArguments + + + + + textLabel2_2 + + + Debug Arguments: + + + + + textLabel2_2_2 + + + Working Directory: + + + + + m_CWDEdit + + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 120 + + + + + + + + configTab + + + Configuration + + + + unnamed + + + + groupBuildMode + + + Build Mode + + + -1 + + + Set project to be built in release mode + + + + unnamed + + + + layout147 + + + + unnamed + + + + radioDebugMode + + + Debug + + + Set project to be built in debug mode + + + + + radioReleaseMode + + + Release + + + Set project to be built in release mode + + + + + checkDebugReleaseMode + + + false + + + Debug && Release + + + + + + Set project to be built in debug_and_release mode + + + + + + + layout30 + + + + unnamed + + + + checkWarning + + + Enable warnings + + + Show compiler warnings + + + + + checkBuildAll + + + false + + + Build All + + + Builds Debug and Release version if Debug&Release is configured + + + + + + + + + groupRequirements + + + Requirements + + + + unnamed + + + + checkOpenGL + + + OpenGL + + + Requires the OpenGL (or Mesa) headers/libraries + + + + + stlCheck + + + STL + + + + + checkThread + + + Thread + + + Requires support for multi-threaded application or library. + + + + + checkQt + + + Qt + + + Requires the Qt header files/library + + + + + checkX11 + + + X11 + + + Support required for X11 application or library + + + + + checkPCH + + + Precompiled headers + + + + + rttiCheck + + + RTTI + + + + + checkWindows + + + Windows + + + + + textLabel1_4 + + + Custom Configuration + + + + + exceptionCheck + + + Exceptions + + + + + editConfigExtra + + + + + checkConsole + + + true + + + Console + + + + + + Check to build a win32 console app + + + + + + + groupQt4Libs + + + false + + + Qt4 Libraries + + + + unnamed + + + + checkQt4Gui + + + Gui + + + true + + + + + checkQt4XML + + + XML + + + + + checkQt4Network + + + Network + + + + + checkQt4Core + + + Core + + + true + + + + + checkQt4OpenGL + + + OpenGL + + + + + checkUiTools + + + QtUiTools + + + + + checkQt4SQL + + + SQL + + + + + checkQt4SVG + + + SVG + + + + + checkTestlib + + + QtTest + + + + + checkQt3Support + + + Qt3 Support + + + + + checkQDBus + + + QDBus (Qt4.2) + + + + + checkAssistant + + + QtAssistant + + + + + checkQtScript + + + QtScript (Qt4.3) + + + + + checkQtWebKit + + + QtWebKit (Qt4.4) + + + + + checkQtXmlPatterns + + + QtXmlPatterns (Qt4.4) + + + + + checkPhonon + + + Phonon (Qt4.4) + + + + + checkQtHelp + + + QtHelp (Qt4.4) + + + + + + + groupLibraries + + + Library Options + + + false + + + + unnamed + + + + layout69 + + + + unnamed + + + + staticRadio + + + Build as static library + + + true + + + + + checkPlugin + + + false + + + Plugin + + + + + checkLibtool + + + true + + + Make libtool archive + + + Support required for X11 application or library + + + + + + + spacer34 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + layout68 + + + + unnamed + + + + sharedRadio + + + Build as shared library + + + + + checkDesigner + + + false + + + Designer Plugin + + + + + + + + layout67 + + + + unnamed + + + + textLabel1 + + + Library version: + + + m_targetLibraryVersion + + + + + m_targetLibraryVersion + + + + + + + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + + incaddTab + + + Includes + + + + unnamed + + + + Layout9 + + + + unnamed + + + 0 + + + + insideIncMoveUpBtn + + + Move Up + + + + + insideIncMoveDownBtn + + + Move Down + + + + + Spacer3_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + Directories Outside Project + + + true + + + true + + + + outsideinc_listview + + + LastColumn + + + + + + Directories Inside Project + + + true + + + true + + + + insideinc_listview + + + LastColumn + + + + + layout8 + + + + unnamed + + + + outsideIncAddBtn + + + Add... + + + + + outsideIncRemoveBtn + + + Remove + + + + + outsideIncEditBtn + + + Edit + + + + + outsideIncMoveUpBtn + + + Move Up + + + + + outsideIncMoveDownBtn + + + Move Down + + + + + Spacer2_2 + + + Vertical + + + Expanding + + + + 20 + 70 + + + + + + + + + + libAddTab + + + Libraries + + + + unnamed + + + + layout12 + + + + unnamed + + + + + External Library Dirs + + + true + + + true + + + + outsidelibdir_listview + + + LastColumn + + + + + layout10 + + + + unnamed + + + + outsideLibDirAddBtn + + + Add... + + + + + outsideLibDirRemoveBtn + + + Remove + + + + + outsideLibDirEditBtn + + + Edit + + + + + outsideLibDirMoveUpBtn + + + Move Up + + + + + outsideLibDirMoveDownBtn + + + Move Down + + + + + Spacer2_2_2 + + + Vertical + + + Expanding + + + + 20 + 70 + + + + + + + + + + layout11 + + + + unnamed + + + + + External Libraries + + + true + + + true + + + + outsidelib_listview + + + LastColumn + + + + + layout9 + + + + unnamed + + + + outsideLibAddBtn + + + Add... + + + + + outsideLibRemoveBtn + + + Remove + + + + + outsideLibEditBtn + + + Edit + + + + + outsideLibMoveUpBtn + + + Move Up + + + + + outsideLibMoveDownBtn + + + Move Down + + + + + Spacer8_2 + + + Vertical + + + Expanding + + + + 20 + 64 + + + + + + + + + + layout10 + + + + unnamed + + + + + Link Convenience Libraries Inside Project + + + true + + + true + + + + insidelib_listview + + + LastColumn + + + + + Layout9_3 + + + + unnamed + + + + insideLibMoveUpBtn + + + Move Up + + + + + insideLibMoveDownBtn + + + Move Down + + + + + Spacer6_2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + depTab + + + Dependencies + + + + unnamed + + + + layout26 + + + + unnamed + + + + + Targets in Project + + + true + + + true + + + + intDeps_view + + + LastColumn + + + + + Layout9_3_2 + + + + unnamed + + + 0 + + + + intMoveUp_button + + + Move Up + + + + + intMoveDown_button + + + Move Down + + + + + Spacer6_2_2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + layout27 + + + + unnamed + + + + + Miscellaneous Targets + + + true + + + true + + + + extDeps_view + + + LastColumn + + + + + layout9_2 + + + + unnamed + + + + extAdd_button + + + Add... + + + + + extRemove_button + + + Remove + + + + + extEdit_button + + + Edit + + + + + extMoveUp_button + + + Move Up + + + + + extMoveDown_button + + + Move Down + + + + + Spacer8_2_2 + + + Vertical + + + Expanding + + + + 20 + 64 + + + + + + + + + + layout28_2 + + + + unnamed + + + + + Order in Which Sub Projects Are Built + + + true + + + true + + + + buildorder_listview + + + LastColumn + + + + + Layout9_2 + + + + unnamed + + + 0 + + + + buildmoveup_button + + + Move Up + + + + + buildmovedown_button + + + Move Down + + + + + Spacer3_2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + buildOptsTab + + + Build Options + + + + unnamed + + + + GroupBox2 + + + + 1 + 1 + 0 + 0 + + + + Compiler Options + + + + unnamed + + + + layout26 + + + + unnamed + + + + layout23 + + + + unnamed + + + + TextLabel2_2 + + + Debug flags: + + + m_debugFlags + + + + + TextLabel2_2_2 + + + Release flags: + + + m_releaseFlags + + + + + TextLabel1 + + + Defines: + + + + + + + layout24 + + + + unnamed + + + + m_debugFlags + + + + + m_releaseFlags + + + + + m_defines + + + + + + + + + + + groupBox8 + + + Intermediate File Directories + + + + unnamed + + + + layout84 + + + + unnamed + + + + mocdir_label + + + MOC files: + + + mocdir_url + + + + + uidir_label + + + UI files: + + + uidir_url + + + + + objdir_label + + + Object files: + + + objdir_url + + + + + rccdir_label + + + false + + + RCC files: + + + + + + + layout85 + + + + unnamed + + + + mocdir_url + + + + + uidir_url + + + + + objdir_url + + + + + rccdir_url + + + false + + + + + + + + + idlGroup + + + Corba + + + + unnamed + + + 11 + + + + TextLabel2_3 + + + Compiler options: + + + idlCmdOptionsEdit + + + + + idlCmdOptionsEdit + + + + + idlCmdEdit + + + + + TextLabel1_2_2 + + + IDL compiler: + + + idlCmdEdit + + + + + + + spacer29 + + + Vertical + + + Expanding + + + + 20 + 21 + + + + + + + + custVarsTab + + + Custom Variables + + + + unnamed + + + + layout24 + + + + unnamed + + + + + Name + + + true + + + true + + + + + Operator + + + true + + + true + + + + + Value + + + true + + + true + + + + customVariables + + + + 7 + 7 + 0 + 6 + + + + true + + + Accept + + + true + + + + + layout23 + + + + unnamed + + + + layout22 + + + + unnamed + + + + varAdd_button + + + New + + + + + varRemove_button + + + Remove + + + + + varMoveUp_button + + + Move Up + + + + + varMoveDown_button + + + Move Down + + + + + + + Spacer8_2_2_2 + + + Vertical + + + Expanding + + + + 20 + 106 + + + + + + + + + + layout33 + + + + unnamed + + + + textLabel1_3 + + + + 5 + 5 + 0 + 0 + + + + Name: + + + + + customVariableName + + + + 7 + 0 + 3 + 0 + + + + + + + + layout32 + + + + unnamed + + + + textLabel1_5 + + + Operator + + + + + + += + + + + + -= + + + + + = + + + + + *= + + + + + ~= + + + + customVariableOp + + + + 1 + 0 + 0 + 0 + + + + 0 + + + false + + + + + spacer17 + + + Horizontal + + + Expanding + + + + 250 + 20 + + + + + + + + layout34 + + + + unnamed + + + + textLabel2 + + + + 5 + 5 + 0 + 0 + + + + Value: + + + AlignTop + + + + + customVariableData + + + + 7 + 7 + 0 + 2 + + + + + + + + + + + + + buttonOk + clicked() + ProjectConfigurationDlgBase + accept() + + + idlCmdEdit + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + idlCmdEdit + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + idlCmdOptionsEdit + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + makefile_url + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + makefile_url + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_debugFlags + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_defines + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_InstallTargetPath + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + mocdir_url + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + mocdir_url + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_releaseFlags + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_targetLibraryVersion + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_targetOutputFile + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + objdir_url + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + objdir_url + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + rccdir_url + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + rccdir_url + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + uidir_url + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + editConfigExtra + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_editRunArguments + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_editDebugArguments + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + groupBuildMode + clicked(int) + ProjectConfigurationDlgBase + activateApply(int) + + + groupQt4Libs + clicked(int) + ProjectConfigurationDlgBase + activateApply(int) + + + insideinc_listview + clicked(QListViewItem*) + ProjectConfigurationDlgBase + activateApply(QListViewItem*) + + + insideinc_listview + spacePressed(QListViewItem*) + ProjectConfigurationDlgBase + activateApply(QListViewItem*) + + + insidelib_listview + clicked(QListViewItem*) + ProjectConfigurationDlgBase + activateApply(QListViewItem*) + + + insidelib_listview + spacePressed(QListViewItem*) + ProjectConfigurationDlgBase + activateApply(QListViewItem*) + + + intDeps_view + clicked(QListViewItem*) + ProjectConfigurationDlgBase + activateApply(QListViewItem*) + + + intDeps_view + spacePressed(QListViewItem*) + ProjectConfigurationDlgBase + activateApply(QListViewItem*) + + + varAdd_button + clicked() + ProjectConfigurationDlgBase + addCustomValueClicked() + + + buttonApply + clicked() + ProjectConfigurationDlgBase + apply() + + + buildmovedown_button + clicked() + ProjectConfigurationDlgBase + buildorderMoveDownClicked() + + + buildmoveup_button + clicked() + ProjectConfigurationDlgBase + buildorderMoveUpClicked() + + + customVariableName + textChanged(const QString&) + ProjectConfigurationDlgBase + customVarChanged() + + + customVariableOp + activated(const QString&) + ProjectConfigurationDlgBase + customVarChanged() + + + customVariableData + textChanged() + ProjectConfigurationDlgBase + customVarChanged() + + + varMoveUp_button + clicked() + ProjectConfigurationDlgBase + downCustomValueClicked() + + + extAdd_button + clicked() + ProjectConfigurationDlgBase + extAdd_button_clicked() + + + extEdit_button + clicked() + ProjectConfigurationDlgBase + extEdit_button_clicked() + + + extMoveDown_button + clicked() + ProjectConfigurationDlgBase + extMoveDown_button_clicked() + + + extMoveUp_button + clicked() + ProjectConfigurationDlgBase + extMoveUp_button_clicked() + + + extRemove_button + clicked() + ProjectConfigurationDlgBase + extRemove_button_clicked() + + + groupLibraries + clicked(int) + ProjectConfigurationDlgBase + groupLibrariesChanged(int) + + + groupRequirements + clicked(int) + ProjectConfigurationDlgBase + groupRequirementsChanged(int) + + + groupTemplate + clicked(int) + ProjectConfigurationDlgBase + groupTemplateChanged(int) + + + insideIncMoveDownBtn + clicked() + ProjectConfigurationDlgBase + insideIncMoveDownClicked() + + + insideIncMoveUpBtn + clicked() + ProjectConfigurationDlgBase + insideIncMoveUpClicked() + + + insideLibMoveDownBtn + clicked() + ProjectConfigurationDlgBase + insideLibMoveDownClicked() + + + insideLibMoveUpBtn + clicked() + ProjectConfigurationDlgBase + insideLibMoveUpClicked() + + + intMoveDown_button + clicked() + ProjectConfigurationDlgBase + intMoveDown_button_clicked() + + + intMoveUp_button + clicked() + ProjectConfigurationDlgBase + intMoveUp_button_clicked() + + + customVariables + selectionChanged() + ProjectConfigurationDlgBase + newCustomVariableActive() + + + outsideIncAddBtn + clicked() + ProjectConfigurationDlgBase + outsideIncAddClicked() + + + outsideIncEditBtn + clicked() + ProjectConfigurationDlgBase + outsideIncEditClicked() + + + outsideIncMoveDownBtn + clicked() + ProjectConfigurationDlgBase + outsideIncMoveDownClicked() + + + outsideIncMoveUpBtn + clicked() + ProjectConfigurationDlgBase + outsideIncMoveUpClicked() + + + outsideIncRemoveBtn + clicked() + ProjectConfigurationDlgBase + outsideIncRemoveClicked() + + + outsideLibAddBtn + clicked() + ProjectConfigurationDlgBase + outsideLibAddClicked() + + + outsideLibDirAddBtn + clicked() + ProjectConfigurationDlgBase + outsideLibDirAddClicked() + + + outsideLibDirEditBtn + clicked() + ProjectConfigurationDlgBase + outsideLibDirEditClicked() + + + outsideLibDirMoveDownBtn + clicked() + ProjectConfigurationDlgBase + outsideLibDirMoveDownClicked() + + + outsideLibDirMoveUpBtn + clicked() + ProjectConfigurationDlgBase + outsideLibDirMoveUpClicked() + + + outsideLibDirRemoveBtn + clicked() + ProjectConfigurationDlgBase + outsideLibDirRemoveClicked() + + + outsideLibEditBtn + clicked() + ProjectConfigurationDlgBase + outsideLibEditClicked() + + + outsideLibMoveDownBtn + clicked() + ProjectConfigurationDlgBase + outsideLibMoveDownClicked() + + + outsideLibMoveUpBtn + clicked() + ProjectConfigurationDlgBase + outsideLibMoveUpClicked() + + + outsideLibRemoveBtn + clicked() + ProjectConfigurationDlgBase + outsideLibRemoveClicked() + + + buttonCancel + clicked() + ProjectConfigurationDlgBase + reject() + + + varRemove_button + clicked() + ProjectConfigurationDlgBase + removeCustomValueClicked() + + + checkOrdered + toggled(bool) + buildmovedown_button + setDisabled(bool) + + + checkOrdered + toggled(bool) + buildmoveup_button + setDisabled(bool) + + + checkOrdered + toggled(bool) + buildorder_listview + setDisabled(bool) + + + radioApplication + toggled(bool) + argumentsGroupBox + setEnabled(bool) + + + checkInstallTarget + toggled(bool) + ProjectConfigurationDlgBase + targetInstallChanged(bool) + + + varMoveDown_button + clicked() + ProjectConfigurationDlgBase + upCustomValueClicked() + + + m_targetPath + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_targetPath + returnPressed(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_targetPath + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + uidir_url + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_CWDEdit + textChanged(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + m_CWDEdit + urlSelected(const QString&) + ProjectConfigurationDlgBase + activateApply(const QString&) + + + + TabBuild + radioApplication + radioLibrary + radioSubdirs + checkOrdered + m_targetOutputFile + checkInstallTarget + m_InstallTargetPath + makefile_url + radioDebugMode + radioReleaseMode + checkDebugReleaseMode + checkWarning + checkBuildAll + checkQt + checkOpenGL + stlCheck + checkWindows + checkThread + checkX11 + rttiCheck + exceptionCheck + checkConsole + checkPCH + editConfigExtra + checkQt4Core + checkQt4Gui + checkQt4XML + checkQt4Network + checkQt4OpenGL + checkUiTools + checkQt4SQL + checkQt4SVG + checkTestlib + checkQt3Support + checkQDBus + checkAssistant + checkQtScript + checkQtWebKit + checkQtXmlPatterns + checkPhonon + checkQtHelp + staticRadio + checkPlugin + checkLibtool + sharedRadio + checkDesigner + m_targetLibraryVersion + insideinc_listview + insideIncMoveUpBtn + insideIncMoveDownBtn + outsideinc_listview + outsideIncAddBtn + outsideIncRemoveBtn + outsideIncEditBtn + outsideIncMoveUpBtn + outsideIncMoveDownBtn + insidelib_listview + insideLibMoveUpBtn + insideLibMoveDownBtn + outsidelibdir_listview + outsideLibDirAddBtn + outsideLibDirRemoveBtn + outsideLibDirEditBtn + outsideLibDirMoveUpBtn + outsideLibDirMoveDownBtn + outsidelib_listview + outsideLibAddBtn + outsideLibRemoveBtn + outsideLibEditBtn + outsideLibMoveUpBtn + outsideLibMoveDownBtn + intDeps_view + intMoveUp_button + intMoveDown_button + extDeps_view + extAdd_button + extRemove_button + extEdit_button + extMoveUp_button + extMoveDown_button + buildorder_listview + buildmoveup_button + buildmovedown_button + m_debugFlags + m_releaseFlags + m_defines + mocdir_url + uidir_url + objdir_url + rccdir_url + idlCmdEdit + idlCmdOptionsEdit + customVariables + varAdd_button + varRemove_button + varMoveUp_button + varMoveDown_button + customVariableName + customVariableOp + customVariableData + buttonOk + buttonApply + buttonCancel + + + klineedit.h + kdialog.h + kpushbutton.h + + + updateProjectConfiguration() + buildorderMoveUpClicked() + buildorderMoveDownClicked() + outsideIncMoveUpClicked() + outsideIncMoveDownClicked() + insideIncMoveUpClicked() + insideIncMoveDownClicked() + outsideLibMoveUpClicked() + outsideLibMoveDownClicked() + insideLibMoveUpClicked() + insideLibMoveDownClicked() + outsideIncAddClicked() + outsideIncRemoveClicked() + outsideLibAddClicked() + outsideLibRemoveClicked() + outsideLibDirMoveDownClicked() + outsideLibDirMoveUpClicked() + outsideLibDirAddClicked() + outsideLibDirRemoveClicked() + outsideLibDirEditClicked() + outsideLibEditClicked() + outsideIncEditClicked() + intMoveUp_button_clicked() + intMoveDown_button_clicked() + extAdd_button_clicked() + extRemove_button_clicked() + extEdit_button_clicked() + extMoveUp_button_clicked() + extMoveDown_button_clicked() + removeCustomValueClicked() + upCustomValueClicked() + downCustomValueClicked() + newCustomVariableActive() + addCustomValueClicked() + groupRequirementsChanged( int ) + groupLibrariesChanged( int ) + groupTemplateChanged( int ) + targetInstallChanged( bool ) + apply() + activateApply( int ) + activateApply( const QString & ) + activateApply( QListViewItem * ) + customVarChanged() + + + + + kpushbutton.h + kpushbutton.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + klistview.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kcombobox.h + ktextedit.h + + diff --git a/buildtools/qmake/qmakedefaultopts.cpp b/buildtools/qmake/qmakedefaultopts.cpp new file mode 100644 index 00000000..14ca7aa0 --- /dev/null +++ b/buildtools/qmake/qmakedefaultopts.cpp @@ -0,0 +1,91 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "qmakedefaultopts.h" + +#include +#include +#include +#include + +#include + +QMakeDefaultOpts::QMakeDefaultOpts() +{ + +} + +void QMakeDefaultOpts::readVariables( const QString& qmake, const QString& projdir ) +{ + KTempFile makefile (projdir+"/", ".mf"); + KTempFile qmakefile(projdir+"/", ".pro"); + if ( makefile.status() == 0 && qmakefile.status() == 0 ) + { + makefile.close(); + qmakefile.close(); + + BlockingKProcess proc; + kdDebug(9024) << "KProc Working dir:" << projdir << endl; + proc.setWorkingDirectory( projdir ); + proc << qmake; + proc << "-d"; + proc << "-o"; + proc << makefile.name(); + proc << qmakefile.name(); + kdDebug(9024) << "Executing:" << proc.args() << endl; + proc.start( KProcess::NotifyOnExit, KProcess::Stderr ); + if( !proc.isRunning() && !proc.normalExit() ) + { + kdDebug(9024) << "Couldn't execute qmake: " << proc.args() << endl; + makefile.unlink(); + qmakefile.unlink(); + m_variables.clear(); + m_keys.clear(); + }else + { + makefile.unlink(); + qmakefile.unlink(); + QStringList lines = QStringList::split( "\n", proc.stdErr() ); + kdDebug(9024) << "Got " << lines.count() << " lines" << endl; + for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it) + { + QString line = *it; + QRegExp re( "DEBUG 1: ([^ =:]+) === (.*)" ); + if ( re.exactMatch( line ) ) + { + QString var = re.cap( 1 ); + QStringList values = QStringList::split( " :: ", re.cap( 2 ) ); + m_variables[var] = values; + m_keys.append( var ); + } + } + } + } +} + +QMakeDefaultOpts::~QMakeDefaultOpts() +{ +} + +const QStringList QMakeDefaultOpts::variableValues( const QString& var ) const +{ +// QStringList result; + if ( m_variables.contains(var) ) + return m_variables[var]; + return QStringList(); +} + +const QStringList& QMakeDefaultOpts::variables() const +{ + return m_keys; +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakedefaultopts.h b/buildtools/qmake/qmakedefaultopts.h new file mode 100644 index 00000000..63bab54b --- /dev/null +++ b/buildtools/qmake/qmakedefaultopts.h @@ -0,0 +1,49 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef QMAKEDEFAULTOPTS_H +#define QMAKEDEFAULTOPTS_H + +#include +#include +// #include + +// class KTempFile; +// class BlockingKProcess; + +class QMakeDefaultOpts +{ +public: + QMakeDefaultOpts( ); + + ~QMakeDefaultOpts(); + + void readVariables( const QString& qtdir, const QString& projdir ); + + const QStringList variableValues( const QString& ) const; + const QStringList& variables() const; + +// signals: +// void variablesRead(); + +// private slots: +// void slotReadStderr( KProcess*, char*, int ); +// void slotFinished( KProcess* ); + +private: + QMap m_variables; + QStringList m_keys; +}; + +#endif + + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakeoptionswidget.cpp b/buildtools/qmake/qmakeoptionswidget.cpp new file mode 100644 index 00000000..89f63c1e --- /dev/null +++ b/buildtools/qmake/qmakeoptionswidget.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "qmakeoptionswidget.h" + +#include +#include +#include +#include + +#include +#include + +QMakeOptionsWidget::QMakeOptionsWidget( const QString& projectdir, QDomDocument &dom, const QString &configGroup, + QWidget *parent, const char *name ) + : QMakeOptionsWidgetBase( parent, name ), + m_dom( dom ), m_configGroup( configGroup ), m_projectDir( projectdir ) +{ + groupBehaviour->setButton( DomUtil::readIntEntry( dom, configGroup+"/qmake/savebehaviour", 2) ); + checkReplacePaths->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/replacePaths", false ) ); + checkDisableDefaultOpts->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/disableDefaultOpts", true ) ); + checkFilenamesOnly->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/enableFilenamesOnly", false ) ); + showVariablesInTree->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/showVariablesInTree", true ) ); + checkShowParseErrors->setChecked( DomUtil::readBoolEntry( dom, + configGroup+"/qmake/showParseErrors", true ) ); + qmakeProjectFile->setURL( DomUtil::readEntry( dom, configGroup+"/qmake/projectfile", "" ) ); + qmakeProjectFile->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + qmakeProjectFile->setFilter( "*.pro *.pri" ); + if( qmakeProjectFile->url().isEmpty() ) + { + qmakeProjectFile->setURL( projectdir ); + } +} + + +QMakeOptionsWidget::~QMakeOptionsWidget() +{} + + +void QMakeOptionsWidget::accept() +{ + DomUtil::writeIntEntry( m_dom, m_configGroup + "/qmake/savebehaviour", groupBehaviour->selectedId() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/replacePaths", checkReplacePaths->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/disableDefaultOpts", checkDisableDefaultOpts->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/enableFilenamesOnly", checkFilenamesOnly->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/showVariablesInTree", showVariablesInTree->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/showParseErrors", checkShowParseErrors->isChecked() ); + QString projfile = qmakeProjectFile->url(); + if( projfile != m_projectDir && QFileInfo( projfile ).isFile() && ( projfile.endsWith( ".pro" ) || projfile.endsWith( ".pri" ) ) ) + DomUtil::writeEntry( m_dom, m_configGroup + "/qmake/projectfile", projfile ); +} + +#include "qmakeoptionswidget.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakeoptionswidget.h b/buildtools/qmake/qmakeoptionswidget.h new file mode 100644 index 00000000..c50e4b44 --- /dev/null +++ b/buildtools/qmake/qmakeoptionswidget.h @@ -0,0 +1,39 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef QMAKEOPTIONSWIDGET_H +#define QMAKEOPTIONSWIDGET_H + +#include "qmakeoptionswidgetbase.h" + +#include + +class QMakeOptionsWidget : public QMakeOptionsWidgetBase +{ + Q_OBJECT +public: + QMakeOptionsWidget( const QString& projectdir, QDomDocument &dom, const QString &configGroup, + QWidget *parent = 0, const char *name = 0 ); + ~QMakeOptionsWidget(); + +public slots: + void accept(); +private: + QDomDocument &m_dom; + QString m_configGroup; + QString m_projectDir; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + + diff --git a/buildtools/qmake/qmakeoptionswidgetbase.ui b/buildtools/qmake/qmakeoptionswidgetbase.ui new file mode 100644 index 00000000..0ad833d1 --- /dev/null +++ b/buildtools/qmake/qmakeoptionswidgetbase.ui @@ -0,0 +1,217 @@ + +QMakeOptionsWidgetBase + + + QMakeOptionsWidgetBase + + + + 0 + 0 + 738 + 523 + + + + QMake Manager Options + + + + unnamed + + + + textLabel1_2 + + + - Also look into C++/Qt to define the QMake, Qt and Designer paths. +- Environment variables that should be resolved during parsing can be set on the Make Options page. +- For changes on this page to take effect the project needs to be reloaded. + + + + + layout1 + + + + unnamed + + + + textLabel1_3 + + + QMake Project File: + + + qmakeProjectFile + + + + + qmakeProjectFile + + + This is the top level qmake project file, from which the project manager will be populated. +Leave this empty to automatically search for a .pro file in the project directory. + + + + + + + groupBehaviour + + + true + + + Behaviour on Subproject Change + + + + unnamed + + + + textLabel1 + + + The following settings determine what the project configuration dialog should do when another subproject is selected while the dialog is still open. + + + WordBreak|AlignVCenter + + + + + radioAlwaysSave + + + &Always Save + + + Always save the configuration when changing the project. + + + Always save the project configuration when selecting a another sub project. + + + + + radioNeverSave + + + &Never Save (Warning: This can lead to loss of setting changes) + + + Never save the configuration when changing the project. + + + Never save the project configuration when selecting a another sub project. + + + + + radioAsk + + + As&k + + + true + + + Ask whether the configuration should be saved when switching the project. + + + Always ask whether the configuration should be saved when selecting another subproject. + + + + + + + checkReplacePaths + + + + 5 + 5 + 0 + 0 + + + + Repla&ce File Paths with matching Variables when adding files + + + false + + + This replaces the relative paths of added files with existing custom variables if the value assigned to it is the same as the path. + + + + + showVariablesInTree + + + Show variables in filenames in the QMake projectmanager view. + + + + + checkFilenamesOnly + + + Display only filenames in the QMake Manager (Project reload is needed after changing this setting) + + + + + checkDisableDefaultOpts + + + Do not use the QMake Default Options +This disables the reading of any .qmake.cache files or mkspecs. + + + + + checkShowParseErrors + + + Show parse error in message box + + + true + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 50 + + + + + + + + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/qmake/qmakescopeitem.cpp b/buildtools/qmake/qmakescopeitem.cpp new file mode 100644 index 00000000..66fa3c3f --- /dev/null +++ b/buildtools/qmake/qmakescopeitem.cpp @@ -0,0 +1,928 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* Part of this file is taken from Qt Designer. * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "qmakescopeitem.h" + +#include +#include + +#include +#include +#include +#include + +#include "scope.h" +#include "urlutil.h" +#include "trollprojectwidget.h" +/* + * Class qProjectItem + */ + +qProjectItem::qProjectItem( Type type, QListView *parent, const QString &text ) + : QListViewItem( parent, text ), typ( type ) +{} + + +qProjectItem::qProjectItem( Type type, qProjectItem *parent, const QString &text ) + : QListViewItem( parent, text ), typ( type ) +{} + + + +/* + * Class GroupItem + */ + +GroupItem::GroupItem( QListView *lv, GroupType type, const QString &text, QMakeScopeItem* spitem ) + : qProjectItem( Group, lv, text ) +{ + this->owner = spitem; + groupType = type; +// files.setAutoDelete( true ); + setPixmap( 0, SmallIcon( "tar" ) ); +} + +GroupItem::GroupType GroupItem::groupTypeForExtension( const QString &ext ) +{ + if ( ext == "cpp" || ext == "cc" || ext == "c" || ext == "C" || ext == "c++" || ext == "cxx" || ext == "ocl" ) + return Sources; + else if ( ext == "hpp" || ext == "h" || ext == "hxx" || ext == "hh" || ext == "h++" || ext == "H" ) + return Headers; + else if ( ext == "ui" ) + return Forms; + else if ( ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "xpm" || ext == "gif" || ext == "bmp" ) + return Images; + else if ( ext == "idl" ) + return IDLs; + else if ( ext == "l" || ext == "ll" || ext == "lxx" || ext == "l++" ) + return Lexsources; + else if ( ext == "y" || ext == "yy" || ext == "yxx" || ext == "y++" ) + return Yaccsources; + else if ( ext == "ts" ) + return Translations; + else if ( ext == "qrc" ) + return Resources; + else + return Distfiles; +} + +void GroupItem::groupTypeMeanings( GroupItem::GroupType type, QString& title, QString& ext ) +{ + switch ( type ) + { + case GroupItem::Sources: + title = i18n( "Sources" ); + ext = "*.cpp *.c"; + break; + case GroupItem::Headers: + title = i18n( "Headers" ); + ext = "*.h *.hpp"; + break; + case GroupItem::Forms: + title = i18n( "Forms" ); + ext = "*.ui"; + break; + case GroupItem::IDLs: + title = i18n( "Corba IDLs" ); + ext = "*.idl *.kidl"; + break; + case GroupItem::Lexsources: + title = i18n( "Lexsources" ); + ext = "*.l *.ll *.lxx *.l++"; + break; + case GroupItem::Yaccsources: + title = i18n( "Yaccsources" ); + ext = "*.y *.yy *.yxx *.y++"; + break; + case GroupItem::Images: + title = i18n( "Images" ); + ext = "*.jpg *.jpeg *.png *.xpm *.gif *.bmp"; + break; + case GroupItem::Resources: + title = i18n( "Resources" ); + ext = "*.qrc"; + break; + case GroupItem::Distfiles: + title = i18n( "Distfiles" ); + ext = "*"; + break; + case GroupItem::Translations: + title = i18n( "Translations" ); + ext = "*.ts"; + break; + case GroupItem::InstallRoot: + title = i18n( "Installs" ); + ext = "*"; + break; + case GroupItem::InstallObject: + title = i18n( "Install object" ); + ext = "*"; + break; + + default: // just give back source files, et all + title = i18n( "Source Files" ); + ext = "*.cpp *.cc *.ocl *.c *.hpp *.h *.ui"; + } +} + +void GroupItem::paintCell( QPainter* p, const QColorGroup& c, int column, int width, int align ) +{ + QColorGroup cg( c ); + if ( !firstChild() ) + { + cg.setColor( QColorGroup::Text, cg.mid() ); + } + + qProjectItem::paintCell( p, cg, column, width, align ); +} + +void GroupItem::addFileToScope( const QString& filename ) +{ + QString file = filename; + + QPtrListIterator it( files ); + while ( it.current() != 0 ) + { + if ( it.current() ->text( 0 ) == file ) //File already exists in this subproject + return ; + ++it; + } + + FileItem *fitem = owner->createFileItem( file ); + + fitem->uiFileLink = owner->m_widget->getUiFileLink( owner->relativePath() + QString( QChar( QDir::separator() ) ), owner->scope->resolveVariables( filename ) ); + files.append( fitem ); + switch ( groupType ) + { + case GroupItem::Sources: + owner->addValue( "SOURCES", file ); + break; + case GroupItem::Headers: + owner->addValue( "HEADERS", file ); + break; + case GroupItem::Forms: + if( owner->m_widget->isTMakeProject() ) + owner->addValue( "INTERFACES", file ); + else + owner->addValue( "FORMS", file ); + break; + case GroupItem::IDLs: + owner->addValue( "IDLS", file ); + break; + case GroupItem::Lexsources: + owner->addValue( "LEXSOURCES", file ); + break; + case GroupItem::Yaccsources: + owner->addValue( "YACCSOURCES", file ); + break; + case GroupItem::Images: + owner->addValue( "IMAGES", file ); + break; + case GroupItem::Resources: + owner->addValue( "RESOURCES", file ); + break; + case GroupItem::Distfiles: + owner->addValue( "DISTFILES", file ); + break; + case GroupItem::Translations: + owner->addValue( "TRANSLATIONS", file ); + break; + case GroupItem::InstallObject: + owner->addValue( text( 0 ) + ".files", file ); + break; + default: + break; + } + owner->scope->saveToFile(); +} + +void GroupItem::removeFileFromScope( const QString& filename ) +{ + QString filePath; + + QPtrListIterator it( files ); + while ( it.current() != 0 ) + { + if ( it.current() ->text( 0 ) == filename ) //File already exists in this subproject + { + FileItem * fitem = it.current(); + filePath = fitem->localFilePath; + files.remove( it ); + delete fitem; + break; + } + ++it; + } + + if ( groupType == GroupItem::Sources ) + { + owner->removeValue( "SOURCES", filePath ); + } + else if ( groupType == GroupItem::Headers ) + { + owner->removeValue( "HEADERS", filePath ); + } + else if ( groupType == GroupItem::Forms ) + { + owner->removeValue( "FORMS", filePath ); + } + else if ( groupType == GroupItem::Images ) + { + owner->removeValue( "IMAGES", filePath ); + } + else if ( groupType == GroupItem::Resources ) + { + owner->removeValue( "RESOURCES", filePath ); + } + else if ( groupType == GroupItem::Lexsources ) + { + owner->removeValue( "LEXSOURCES", filePath ); + } + else if ( groupType == GroupItem::Yaccsources ) + { + owner->removeValue( "YACCSOURCES", filePath ); + } + else if ( groupType == GroupItem::Translations ) + { + owner->removeValue( "TRANSLATIONS", filePath ); + } + else if ( groupType == GroupItem::IDLs ) + { + owner->removeValue( "IDL", filePath ); + } + else if ( groupType == GroupItem::Distfiles ) + { + owner->removeValue( "DISTFILES", filePath ); + } + else if ( groupType == GroupItem::InstallObject ) + { + owner->removeValue( text( 0 ) + ".files", filePath ); + } + owner->scope->saveToFile(); +} + +void GroupItem::addInstallObject( const QString& objectname ) +{ + GroupItem * objitem = owner->createGroupItem( GroupItem::InstallObject, objectname, owner ); + owner->addValue( "INSTALLS", objectname ); + owner->scope->saveToFile(); + installs.append( objitem ); +} + +void GroupItem::removeInstallObject( GroupItem* item ) +{ + owner->removeValue( "INSTALLS", item->text(0) ); + owner->scope->saveToFile(); + installs.remove( item ); + delete item; +} + +/* + * Class FileItem + */ + +FileItem::FileItem( QListView *lv, const QString &text ) + : qProjectItem( File, lv, text ), uiFileLink( "" ) +{ + // if excluded is set the file is excluded in the subproject/project. + // by default excluded is set to false, thus file is included + // excluded = exclude; + setPixmap( 0, SmallIcon( "document" ) ); +} + + +/* + * Class QMakeScopeItem + */ + +QMakeScopeItem::QMakeScopeItem( QListView *parent, const QString &text, Scope* s, TrollProjectWidget* widget ) + : qProjectItem( Subproject, parent, text ), scope( s ), m_widget( widget ) +{ + // configuration.m_template = QTMP_APPLICATION; + init(); +} + + +QMakeScopeItem::QMakeScopeItem( QMakeScopeItem *parent, const QString &text, Scope* s ) + : qProjectItem( Subproject, parent, text ), scope( s ), m_widget( parent->m_widget ) +{ + init(); +} + +QMakeScopeItem::~QMakeScopeItem() +{ + QMap::iterator it; + for ( it = groups.begin() ; it != groups.end() ; ++it ) + { + GroupItem* s = it.data(); + delete s; + } + groups.clear(); + +} + +QString QMakeScopeItem::relativePath() +{ + if( !scope || !scope->parent() ) + return ""; + if( scope->scopeType() == Scope::ProjectScope ) + { + if( scope->parent() && scope->parent()->variableValues("SUBDIRS").contains( URLUtil::relativePathToFile( scope->parent()->projectDir(), scope->projectDir()+"/"+scope->fileName() ) ) ) + { + return URLUtil::relativePathToFile( scope->parent()->projectDir(), scope->projectDir()+"/"+scope->fileName() ); + }else + { + return URLUtil::getRelativePath( m_widget->projectDirectory(), scope->projectDir() ); + } + }else + return static_cast( parent() ) ->relativePath(); +// if( !scope->parent() ) +// return ""; +// else if ( !scope->parent()->parent() || scope->scopeType() != Scope::ProjectScope ) +// return scope->scopeName(); +// else if ( scope->scopeType() == Scope::ProjectScope ) +// return ( static_cast( parent() ) ->relativePath() +// + QString( QChar( QDir::separator() ) ) + scope->scopeName() ); +// else +// return ( static_cast( parent() ) ->relativePath() ); +} + +QString QMakeScopeItem::getSharedLibAddObject( QString basePath ) +{ + if ( scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + if ( !scope->variableValues( "DESTDIR" ).front().isEmpty() ) + { + if ( QDir::isRelativePath( scope->variableValues( "DESTDIR" ).front() ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + scope->variableValues( "DESTDIR" ).front(); + else + tmpPath = scope->variableValues( "DESTDIR" ).front(); + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + QString libString; + if ( !scope->variableValues( "TARGET" ).front().isEmpty() ) + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + scope->variableValues( "TARGET" ).front() + ".so"; + + } + else + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + scope->projectName() + ".so"; + + } + return ( libString ); + } + return ""; +} + +QString QMakeScopeItem::getApplicationObject( QString basePath ) +{ + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + QString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); + + if ( !destdir.isEmpty() ) + { + if ( QDir::isRelativePath( destdir ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + destdir; + else + tmpPath = destdir; + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + QString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); + + if ( target.isEmpty() ) + return tmpPath + QString( QChar( QDir::separator() ) ) + scope->projectName(); + else + return tmpPath + QString( QChar( QDir::separator() ) ) + target; +} + +QString QMakeScopeItem::getLibAddObject( QString basePath ) +{ + if ( scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + QString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); + if ( !target.isEmpty() ) + { + return ( "-l" + target ); + } + else + { + return ( "-l" + scope->projectName() ); + } + } + else if ( scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 + || scope->variableValues("TEMPLATE").findIndex("lib") != -1 ) + { + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + QString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); + if ( !destdir.isEmpty() ) + { + if ( QDir::isRelativePath( destdir ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + destdir; + else + tmpPath = destdir; + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + QString libString; + QString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); + if ( !target.isEmpty() ) + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + target + ".a"; + + } + else + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + scope->projectName() + ".a"; + + } + return ( libString ); + } + + return ( "" ); +} +QString QMakeScopeItem::getLibAddPath( QString basePath ) +{ + + //PATH only add if shared lib + if ( scope->variableValues( "CONFIG" ).findIndex( "dll" ) == -1 ) return ( "" ); + + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + QString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); + if ( !destdir.isEmpty() ) + { + if ( QDir::isRelativePath( destdir ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + destdir; + else + tmpPath = destdir; + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + return ( tmpPath ); + +} + +QString QMakeScopeItem::getIncAddPath( QString basePath ) +{ + QString tmpPath = URLUtil::getRelativePath( basePath, scope->projectDir() ); + tmpPath = QDir::cleanDirPath( tmpPath ); + + return ( tmpPath ); +} + +void QMakeScopeItem::buildSubTree() +{ + QValueList::const_iterator it; + + sortChildItems( 0, false ); + + QValueList scopes = scope->scopesInOrder(); + + for ( it = scopes.begin(); it != scopes.end(); ++it ) + { + if( (*it)->scopeType() != Scope::InvalidScope ) + new QMakeScopeItem( this, ( *it )->scopeName(), ( *it ) ); + else + kdDebug( 9024 ) << "No QMakeScopeItem created" << endl; + } +} + + +void QMakeScopeItem::init() +{ + if ( scope->scopeType() == Scope::SimpleScope ) + { + setPixmap( 0, SmallIcon( "qmake_scope" ) ); + } + else if ( scope->scopeType() == Scope::FunctionScope ) + { + setPixmap( 0, SmallIcon( "qmake_func_scope" ) ); + } + else if ( scope->scopeType() == Scope::IncludeScope ) + { + setPixmap( 0, SmallIcon( "qmake_inc_scope" ) ); + } + else + { + QStringList tmp = scope->variableValues( "TEMPLATE" ); + if( scope->isEnabled() ) + { + if ( tmp.findIndex( "subdirs" ) != -1 ) + setPixmap( 0, SmallIcon( "folder" ) ); + else if ( tmp.findIndex( "lib" ) != -1 ) + setPixmap( 0, SmallIcon( "qmake_lib" ) ); + else + setPixmap( 0, SmallIcon( "qmake_app" ) ); + }else + { + if ( tmp.findIndex( "subdirs" ) != -1 ) + setPixmap( 0, SmallIcon( "folder_grey" ) ); + else if ( tmp.findIndex( "lib" ) != -1 ) + setPixmap( 0, SmallIcon( "qmake_lib_disabled" ) ); + else + setPixmap( 0, SmallIcon( "qmake_app_disabled" ) ); + } + } + + setEnabled( scope->isEnabled() ); + if( scope->isEnabled() ) + { + buildGroups(); + buildSubTree(); + } +} + +GroupItem* QMakeScopeItem::createGroupItem( GroupItem::GroupType type, const QString& label, QMakeScopeItem* scopeitem ) +{ + GroupItem * item = new GroupItem( scopeitem->listView(), type, label, scopeitem ); + scopeitem->listView() ->takeItem( item ); + return item; +} + +FileItem* QMakeScopeItem::createFileItem( const QString& name ) +{ + QString display = name; + if( m_widget->showFilenamesOnly() ) + { + int dirSepPos = name.findRev( QChar( QDir::separator() ) ); + if ( dirSepPos != - 1 ) + display = name.mid( dirSepPos + 1 ); + } + if( !m_widget->showVariablesInTree() ) + { + display = scope->resolveVariables( display ); + } + FileItem * fitem = new FileItem( listView(), display ); + listView() ->takeItem( fitem ); + + fitem->localFilePath = name; + + return fitem; +} + +void QMakeScopeItem::buildGroups() +{ + if( scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + return; + QStringList values; + + GroupItem* item; + QStringList::iterator it; + + values = scope->variableValues( "INSTALLS" ); + item = createGroupItem( GroupItem::InstallRoot, "INSTALLS", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + if ( ( *it ) == "target" ) + continue; + + QString path = scope->variableValues( *it + ".path" ).front(); + GroupItem* installitem = createGroupItem( GroupItem::InstallObject, *it, this ); + item->installs.append( installitem ); + QStringList files = scope -> variableValues( *it + ".files" ); + if ( !files.isEmpty() ) + { + QStringList::iterator filesit = files.begin(); + for ( ;filesit != files.end(); ++filesit ) + { + installitem->files.append( createFileItem( *filesit ) ); + } + } + } + + values = scope->variableValues( "LEXSOURCES" ); + item = createGroupItem( GroupItem::Lexsources, "LEXSOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "YACCSOURCES" ); + item = createGroupItem( GroupItem::Yaccsources, "YACCSOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "DISTFILES" ); + item = createGroupItem( GroupItem::Distfiles, "DISTFILES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + if ( scope->isQt4Project() ) + { + values = scope->variableValues( "RESOURCES" ); + item = createGroupItem( GroupItem::Resources, "RESOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + } + values = scope->variableValues( "IMAGES" ); + item = createGroupItem( GroupItem::Images, "IMAGES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "TRANSLATIONS" ); + item = createGroupItem( GroupItem::Translations, "TRANSLATIONS", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "IDLS" ); + item = createGroupItem( GroupItem::IDLs, "Corba IDL", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + if ( m_widget->isTMakeProject() ) + { + values = scope->variableValues( "INTERFACES" ); + item = createGroupItem( GroupItem::Forms, "INTERFACES", this ); + } + else + { + values = scope->variableValues( "FORMS" ); + item = createGroupItem( GroupItem::Forms, "FORMS", this ); + } + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "SOURCES" ); + item = createGroupItem( GroupItem::Sources, "SOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + FileItem* fitem = createFileItem( *it ); + fitem->uiFileLink = m_widget->getUiFileLink( relativePath() + QString( QChar( QDir::separator() ) ), scope->resolveVariables( *it ) ); + item->files.append( fitem ); + } + + values = scope->variableValues( "HEADERS" ); + item = createGroupItem( GroupItem::Headers, "HEADERS", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + FileItem* fitem = createFileItem( *it ); + fitem->uiFileLink = m_widget->getUiFileLink( relativePath() + QString( QChar( QDir::separator() ) ), scope->resolveVariables( *it ) ); + item->files.append( fitem ); + } + +} + +void QMakeScopeItem::removeValues( const QString& var, const QStringList& values ) +{ + for( QStringList::const_iterator it = values.begin() ; it != values.end(); ++it ) + { + removeValue( var, *it ); + } +} + +void QMakeScopeItem::addValues( const QString& var, const QStringList& values ) +{ + for( QStringList::const_iterator it = values.begin() ; it != values.end(); ++it ) + { + addValue( var, *it ); + } +} + +void QMakeScopeItem::removeValue( const QString& var, const QString& value ) +{ + if( scope->scopeType() != Scope::IncludeScope && scope->variableValues( var ).findIndex( value ) != -1 ) + { + if( scope->variableValuesForOp( var, "+=" ).findIndex(value) != -1 ) + { + scope->removeFromPlusOp( var, QStringList( value ) ); + if( scope->variableValues( var ).findIndex( value ) != -1 ) + { + scope->addToMinusOp( var, QStringList( value ) ); + } + }else + scope->addToMinusOp( var, QStringList( value ) ); + }else if( scope->scopeType() == Scope::IncludeScope ) + { + scope->addToMinusOp( var, QStringList( value ) ); + } +} + +void QMakeScopeItem::addValue( const QString& var, const QString& value ) +{ + if( scope->scopeType() != Scope::IncludeScope && scope->variableValues( var ).findIndex( value ) == -1 ) + { + if( scope->variableValuesForOp( var, "-=" ).findIndex(value) != -1 ) + scope->removeFromMinusOp( var, QStringList( value ) ); + else + scope->addToPlusOp( var, QStringList( value ) ); + }else if( scope->scopeType() == Scope::IncludeScope ) + { + scope->addToPlusOp( var, QStringList( value ) ); + } +} + +void QMakeScopeItem::updateValues( const QString& var, const QStringList& values ) +{ + QStringList curValues = scope->variableValues( var, (scope->scopeType() != Scope::IncludeScope) ); + QStringList scopeValues = scope->variableValuesForOp( var, "+=" ); + for( QStringList::const_iterator it = curValues.begin(); it != curValues.end(); ++it ) + { + if ( values.findIndex( *it ) == -1 ) + { + if( scopeValues.findIndex( *it ) != -1 ) + { + scope->removeFromPlusOp( var, QStringList( *it ) ); + scopeValues.remove( *it ); + }else + scope->addToMinusOp( var, QStringList( *it ) ); + } + } + for( QStringList::const_iterator it = values.begin(); it != values.end(); ++it ) + { + if ( scopeValues.findIndex( *it ) != -1 ) + { + scopeValues.remove(*it); + } + } +// kdDebug(9024) << "--------------" << var << "------------------" << endl; +// kdDebug(9024) << "values: " << values << "| scope:" << scopeValues << endl; + scopeValues += values; +// kdDebug(9024) << "values: " << values << "| scope:" << scopeValues << endl; + scope->setPlusOp( var, scopeValues ); +// QStringList tmp = scope->variableValuesForOp( var, "+=" ); +// kdDebug(9024) << "result:" << tmp << endl; +// kdDebug(9024) << "---------------------------------------" << endl; +} + +QMakeScopeItem* QMakeScopeItem::projectFileItem() +{ + if( scope->scopeType() != Scope::ProjectScope ) + { + QMakeScopeItem* parentitem = dynamic_cast(parent()); + if( parentitem ) + return parentitem->projectFileItem(); + } + return this; +} + +void QMakeScopeItem::reloadProject() +{ + kdDebug(9024) << "Reloading Project" << endl; + QListViewItem* item = firstChild(); + while( item ) + { + QListViewItem* olditem = item; + item = olditem->nextSibling(); + delete olditem; + } + QMap::iterator it; + for ( it = groups.begin() ; it != groups.end() ; ++it ) + { + GroupItem* s = it.data(); + QListView* l = s->listView(); + if(l) + l->removeItem(s); + delete s; + } + groups.clear(); + scope->reloadProject(); + init(); +} + +void QMakeScopeItem::disableSubprojects( const QStringList& dirs ) +{ + QStringList::const_iterator it = dirs.begin(); + for( ; it != dirs.end() ; ++it) + { + if( scope->variableValues("SUBDIRS").findIndex(*it) != -1 ) + { + Scope* s = scope->disableSubproject(*it); + if( !s ) + return; + else + { + QMakeScopeItem* newitem = new QMakeScopeItem( this, s->scopeName(), s ); + QListViewItem* lastitem = firstChild(); + while( lastitem && lastitem->nextSibling() ) + lastitem = lastitem->nextSibling(); + if( lastitem ) + newitem->moveItem(lastitem); + } + } + } + +} + +int QMakeScopeItem::compare( QListViewItem* i, int , bool ) const +{ + QMakeScopeItem* other = dynamic_cast(i); + if( !i ) + return -1; + if( other->scope->getNum() < scope->getNum() ) + return 1; + else if ( other->scope->getNum() > scope->getNum() ) + return -1; + else + return 0; +} + +QMap QMakeScopeItem::getLibInfos( QString basePath ) +{ + + QMap result; + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["shared_lib"] = "-l"+scope->projectName(); + else + result["shared_lib"] = "-l"+scope->variableValues( "TARGET" ).front(); + + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + if ( !scope->variableValues( "DESTDIR" ).front().isEmpty() ) + { + if ( QDir::isRelativePath( scope->variableValues( "DESTDIR" ).front() ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + scope->variableValues( "DESTDIR" ).front(); + else + tmpPath = scope->variableValues( "DESTDIR" ).front(); + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + result["shared_libdir"] = "-L"+tmpPath; + + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["shared_depend"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->projectName()+".so"; + else + result["shared_depend"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->variableValues( "TARGET" ).front()+".so"; + + + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["static_lib"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->projectName()+".a"; + else + result["static_lib"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->variableValues( "TARGET" ).front()+".a"; + + result["static_depend"] = result["static_lib"]; + + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["app_depend"] = tmpPath + QString( QChar( QDir::separator() ) ) + scope->projectName(); + else + result["app_depend"] = tmpPath + QString( QChar( QDir::separator() ) ) + scope->variableValues( "TARGET" ).front(); + + QString map; + for( QMap::const_iterator it = result.begin(); it != result.end(); ++it ) + map += "["+it.key() + "=>" +it.data() + "],"; + kdDebug(9024) << "Running getLibInfo for" << scope->projectName() << "|" << map << endl; + return result; +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakescopeitem.h b/buildtools/qmake/qmakescopeitem.h new file mode 100644 index 00000000..b2c84345 --- /dev/null +++ b/buildtools/qmake/qmakescopeitem.h @@ -0,0 +1,128 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _QMAKESCOPEITEM_H_ +#define _QMAKESCOPEITEM_H_ + +#include +#include + +class Scope; +class QMakeScopeItem; +class FileItem; +class TrollProjectWidget; + +/** + * Base class for all items appearing in ProjectOverview and ProjectDetails. + */ +class qProjectItem : public QListViewItem +{ +public: + enum Type { Subproject, Group, File }; + + qProjectItem( Type type, QListView *parent, const QString &text ); + qProjectItem( Type type, qProjectItem *parent, const QString &text ); + + QString scopeString; + Type type() + { return typ; } + +private: + Type typ; + void init(); + +}; + + +class GroupItem : public qProjectItem +{ +public: + enum GroupType {NoType, Sources, Headers, Forms, Distfiles, Images, Resources, Lexsources, Yaccsources, Translations, IDLs, InstallRoot, InstallObject, MaxTypeEnum }; + + static GroupType groupTypeForExtension( const QString &ext ); + static void groupTypeMeanings( GroupItem::GroupType type, QString& title, QString& ext ); + + GroupItem( QListView *lv, GroupType type, const QString &text, QMakeScopeItem* spitem ); + + void removeFileFromScope( const QString& filename); + void addFileToScope( const QString& filename); + void addInstallObject( const QString& objectname); + void removeInstallObject( GroupItem* item ); + + // qmake INSTALLS support + QPtrList installs; + QPtrList files; + +// QStringList str_files; +// QStringList str_files_exclude; + // end qmake INSTALLS support + GroupType groupType; + QMakeScopeItem* owner; + +protected: + void paintCell( QPainter* p, const QColorGroup& cg, int column, int width, int align ); +}; + + +// Not sure if this complexity is really necessary... +class FileItem : public qProjectItem +{ +public: + FileItem( QListView *lv, const QString &text ); + + QString uiFileLink; + QString localFilePath; +}; + +/** + * Stores one Scope + */ +class QMakeScopeItem : public qProjectItem +{ +public: + QMakeScopeItem( QListView *parent, const QString &text, Scope *s, TrollProjectWidget* widget ); + QMakeScopeItem( QMakeScopeItem *parent, const QString &text, Scope* ); + void updateValues( const QString& var, const QStringList& values ); + void addValue( const QString& var, const QString& value ); + void removeValue( const QString& var, const QString& value ); + void addValues( const QString& var, const QStringList& values ); + void removeValues( const QString& var, const QStringList& values ); + void disableSubprojects( const QStringList& ); + void reloadProject(); + int compare( QListViewItem* i, int col, bool ascending ) const; + ~QMakeScopeItem(); + + QMap groups; + + Scope* scope; + QString relativePath(); + QString getLibAddPath( QString ); + QString getLibAddObject( QString ); + QString getSharedLibAddObject( QString ); + QString getApplicationObject( QString ); + QString getIncAddPath( QString downDirs ); + FileItem* createFileItem(const QString& file); + GroupItem* createGroupItem(GroupItem::GroupType type, const QString& name, QMakeScopeItem* scopeitem); + QMap getLibInfos( QString ); + + QMakeScopeItem* projectFileItem(); + + TrollProjectWidget* m_widget; +private: + void init(); + void buildSubTree(); + void buildGroups(); +}; + + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/scope.cpp b/buildtools/qmake/scope.cpp new file mode 100644 index 00000000..c090861b --- /dev/null +++ b/buildtools/qmake/scope.cpp @@ -0,0 +1,1710 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "scope.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "urlutil.h" +#include "trollprojectpart.h" +#include "qmakedefaultopts.h" + +const QStringList Scope::KnownVariables = QStringList() << "QT" << "CONFIG" << "TEMPLATE" << "SUBDIRS" << "VERSION" << "LIBS" << "target.path" << "INSTALLS" << "MAKEFILE" << "TARGETDEPS" << "INCLUDEPATH" << "TARGET" << "DESTDIR" << "DEFINES" << "QMAKE_CXXFLAGS_DEBUG" << "QMAKE_CXXFLAGS_RELEASE" << "OBJECTS_DIR" << "UI_DIR" << "MOC_DIR" << "IDL_COMPILER" << "IDL_OPTIONS" << "RCC_DIR" << "IDLS" << "RESOURCES" << "IMAGES" << "LEXSOURCES" << "DISTFILES" << "YACCSOURCES" << "TRANSLATIONS" << "HEADERS" << "SOURCES" << "INTERFACES" << "FORMS" ; + +const QStringList Scope::KnownConfigValues = QStringList() << "debug" << "release" << "debug_and_release" << "warn_on" << "warn_off" << "staticlib" << "dll" << "plugin" << "designer" << "create_pkgconf" << "create_libtool" << "qt" << "console" << "windows" << "x11" << "thread" << "exceptions" << "stl" << "rtti" << "opengl" << "thread" << "ordered" << "precompile_header" << "qtestlib" << "uitools" << "dbus" << "assistant" << "build_all" << "help"; + +Scope::Scope( const QMap& env, const QString &filename, TrollProjectPart* part ) + : m_root( 0 ), m_incast( 0 ), m_parent( 0 ), m_num(0), m_isEnabled( true ), m_part(part), m_defaultopts(0), m_environment( env ) +{ + if ( !loadFromFile( filename ) ) + { + if( !QFileInfo( filename ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( filename ); + }else + { + delete m_root; + m_root = 0; + } + } + loadDefaultOpts(); + if( m_root ) + { + m_part->dirWatch()->addFile(filename); + } + init(); +} + +Scope::~Scope() +{ + QMap::iterator it; + for ( it = m_scopes.begin() ; it != m_scopes.end() ; ++it ) + { + Scope* s = it.data(); + delete s; + } + m_scopes.clear(); + + m_customVariables.clear(); + if ( m_root && m_root->isProject() && !m_incast ) + { + delete m_root; + m_root = 0; + delete m_defaultopts; + m_defaultopts = 0; + } + +} + +// Simple/Function Scopes +Scope::Scope( const QMap& env, unsigned int num, Scope* parent, QMake::ProjectAST* scope, + QMakeDefaultOpts* defaultopts, TrollProjectPart* part ) + : m_root( scope ), m_incast( 0 ), m_parent( parent ), m_num(num), m_isEnabled( true ), + m_part(part), m_defaultopts(defaultopts), m_environment( env ) +{ + init(); +} + +//Subdirs +Scope::Scope( const QMap& env, unsigned int num, Scope* parent, const QString& filename, + TrollProjectPart* part, bool isEnabled ) + : m_root( 0 ), m_incast( 0 ), m_parent( parent ), m_num(num), m_isEnabled( isEnabled ), + m_part(part), m_defaultopts(0), m_environment( env ) +{ + if ( !loadFromFile( filename ) ) + { + if( !QFileInfo( filename ).exists() && QFileInfo( QFileInfo( filename ).dirPath( true ) ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( filename ); + }else + { + delete m_root; + m_root = 0; + m_isEnabled = false; + } + } + loadDefaultOpts(); + if( m_root ) + m_part->dirWatch()->addFile(filename); + init(); +} + +//Include Scope +Scope::Scope( const QMap& env, unsigned int num, Scope* parent, QMake::IncludeAST* incast, const QString& path, + const QString& incfile, QMakeDefaultOpts* defaultopts, TrollProjectPart* part ) + : m_root( 0 ), m_incast( incast ), m_parent( parent ), m_num(num), m_isEnabled( true ), + m_part(part), m_defaultopts(defaultopts), m_environment( env ) +{ + QString absfilename; + QString tmp = incfile.stripWhiteSpace(); + if( tmp.contains(")" ) ) + tmp = tmp.mid(0, tmp.find(")") ); + + if( tmp.startsWith( "\"" ) ) + tmp = tmp.mid( 1, tmp.length()-2 ); + + if( QFileInfo(tmp).isRelative() ) + { + absfilename = QDir::cleanDirPath( path + QString( QChar( QDir::separator() ) ) + tmp ); + }else + absfilename = QDir::cleanDirPath( tmp ); + if ( !loadFromFile( absfilename ) ) + { + if( !QFileInfo( absfilename ).exists() && QFileInfo( QFileInfo( absfilename ).dirPath( true ) ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( absfilename ); + }else + { + delete m_root; + m_root = 0; + m_isEnabled = false; + } + } + if( m_root ) + m_part->dirWatch()->addFile( m_root->fileName() ); + init(); +} + +bool Scope::loadFromFile( const QString& filename ) +{ + if ( !QFileInfo(filename).exists() || QMake::Driver::parseFile( filename, &m_root, 0 ) != 0 ) + { + kdDebug( 9024 ) << "Couldn't parse project: " << filename << endl; + if( DomUtil::readBoolEntry( *m_part->projectDom(), + "/kdevtrollproject/qmake/showParseErrors", true ) ) + { + KMessageBox::error( 0, i18n( "Could not parse project file: %1" ).arg( filename ), + i18n( "Could not parse project file" ) ); + } + m_root = 0; + return false; + } +// init(); + return true; +} + +void Scope::saveToFile() const +{ + if ( !m_root ) + return ; + + if ( scopeType() != ProjectScope && scopeType() != IncludeScope ) + { + m_parent->saveToFile(); + return; + } + + QString filename; + if ( scopeType() == ProjectScope ) + filename = m_root->fileName() ; + else if ( scopeType() == IncludeScope ) + filename = m_parent->projectDir() + QString( QChar( QDir::separator() ) ) + m_incast->projectName; + if ( filename.isEmpty() ) + return ; + m_part->dirWatch()->stopScan(); + QFile file( filename ); + if ( file.open( IO_WriteOnly ) ) + { + + QTextStream out( &file ); + QString astbuffer; + m_root->writeBack( astbuffer ); + out << astbuffer; + file.close(); + }else + { + KMessageBox::error( 0, i18n( "Could not write project file: %1" ).arg( filename ), + i18n( "Could not write project file" ) ); + } +#ifdef DEBUG + Scope::PrintAST pa; + pa.processProject(m_root); +#endif + m_part->dirWatch()->startScan(); +} + +void Scope::addToPlusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "+=", values, false ); +} + +void Scope::removeFromPlusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "+=", values, true ); +} + + +void Scope::addToMinusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "-=", values, false ); +} + +void Scope::removeFromMinusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "-=", values, true ); +} + +void Scope::addToEqualOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "=", values, false ); +} + +void Scope::removeFromEqualOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "=", values, true ); +} + +void Scope::setPlusOp( const QString& variable, const QStringList& values ) +{ + if( !m_root || Scope::listsEqual(values, variableValuesForOp(variable, "+=") ) ) + return; + + updateVariable( variable, "+=", variableValuesForOp( variable, "+=" ), true ); + updateVariable( variable, "+=", values, false ); +} + +void Scope::setEqualOp( const QString& variable, const QStringList& values ) +{ + if( !m_root || Scope::listsEqual(values, variableValuesForOp(variable, "=") ) ) + return; + + updateVariable( variable, "=", variableValuesForOp( variable, "=" ), true ); + updateVariable( variable, "=", values, false ); +} + +void Scope::setMinusOp( const QString& variable, const QStringList& values ) +{ + if( !m_root || Scope::listsEqual(values, variableValuesForOp(variable, "-=") ) ) + return; + + updateVariable( variable, "-=", variableValuesForOp( variable, "-=" ), true ); + updateVariable( variable, "-=", values, false ); +} + +QStringList Scope::variableValuesForOp( const QString& variable , const QString& op ) const +{ + QStringList result; + + if( !m_root ) + return result; + + QValueList::const_iterator it; + for ( it = m_root->m_children.begin(); it != m_root->m_children.end(); ++it ) + { + QMake::AST* ast = *it; + if ( ast->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assign = static_cast( ast ); + if ( assign->scopedID == variable && assign->op == op ) + { + result += assign->values; + } + } + } + result = cleanStringList(result); + return result; +} + +QStringList Scope::variableValues( const QString& variable, bool checkIncParent, bool fetchFromParent, bool evaluateSubScopes ) +{ + QStringList result; + + if ( !m_root ) + return result; + + if( m_varCache.contains( variable ) && fetchFromParent && ( checkIncParent || scopeType() != Scope::IncludeScope ) ) + { + return m_varCache[variable]; + } + + calcValuesFromStatements( variable, result, checkIncParent, 0, fetchFromParent, true, evaluateSubScopes ); + result = cleanStringList(result); + if( ( scopeType() != Scope::IncludeScope || checkIncParent ) && fetchFromParent ) + { + m_varCache[ variable ] = result; + } + return result; +} + +void Scope::calcValuesFromStatements( const QString& variable, QStringList& result, bool checkIncParent, QMake::AST* stopHere, bool fetchFromParent, bool setDefault, bool evaluateSubScopes ) const +{ + if( !m_root ) + return; + + /* For variables that we don't know and which are not QT/CONFIG find the default value */ + if( setDefault && m_defaultopts + && m_defaultopts->variables().findIndex(variable) != -1 + && ( variable == "TEMPLATE" || variable == "QT" || KnownVariables.findIndex(variable) == -1 || variable == "CONFIG" ) ) + { + result = m_defaultopts->variableValues(variable); + } + + if ( ( scopeType() == FunctionScope || scopeType() == SimpleScope ) && fetchFromParent ) + { + m_parent->calcValuesFromStatements( variable, result, checkIncParent, this->m_root, fetchFromParent, setDefault, evaluateSubScopes ); + } + else if ( scopeType() == IncludeScope && checkIncParent && fetchFromParent ) + { + m_parent->calcValuesFromStatements( variable, result, true, this->m_incast, fetchFromParent, setDefault, evaluateSubScopes ); + } + + QValueList::const_iterator it; + for ( it = m_root->m_children.begin(); it != m_root->m_children.end(); ++it ) + { + if ( stopHere && *it == stopHere ) + return ; + QMake::AST* ast = *it; + if ( ast->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assign = static_cast( ast ); + if ( assign->scopedID == variable ) + { + if ( assign->op == "=" ) + { + result = assign->values; + } + else if ( assign->op == "+=" ) + { + for ( QStringList::const_iterator sit = assign->values.begin(); sit != assign->values.end() ; ++sit ) + { + if ( result.findIndex( *sit ) == -1 ) + result.append( *sit ); + } + } + else if ( assign->op == "-=" ) + { + for ( QStringList::const_iterator sit = assign->values.begin(); sit != assign->values.end() ; ++sit ) + { + if ( result.findIndex( *sit ) != -1 ) + result.remove( *sit ); + } + } + } + }else if( evaluateSubScopes ) + { + if( ast->nodeType() == QMake::AST::IncludeAST ) + { + QMake::IncludeAST* iast = static_cast(ast); + QValueList l = m_scopes.keys(); + for( unsigned int i = 0; i < l.count(); ++i ) + { + int num = l[ i ]; + if( m_scopes.contains( num ) ) + { + Scope* s = m_scopes[num]; + if( s && s->scopeType() == IncludeScope && s->m_incast == iast ) + { + s->calcValuesFromStatements( variable, result, false, 0, false, false, evaluateSubScopes ); + } + } + } + + } + else if( ast->nodeType() == QMake::AST::ProjectAST ) + { + QMake::ProjectAST* past = static_cast(ast); + if( past->isFunctionScope() || past->isScope() ) + { + QValueList l = m_scopes.keys(); + for( unsigned int i = 0; i < l.count(); ++i ) + { + int num = l[ i ]; + if( m_scopes.contains( num ) ) + { + Scope* s = m_scopes[num]; + if( s && s->m_root == past && s->m_root->scopedID == past->scopedID ) + { + s->calcValuesFromStatements( variable, result, false, 0, false, false, evaluateSubScopes ); + } + } + } + } + } + } + } + + result = cleanStringList( result ); + return ; +} + +Scope::ScopeType Scope::scopeType() const +{ + if ( !m_root ) + return InvalidScope; + else if ( m_incast ) + return IncludeScope; + else if ( m_root->isProject() ) + return ProjectScope; + else if ( m_root->isScope() ) + return SimpleScope; + else if ( m_root->isFunctionScope() ) + return FunctionScope; + return InvalidScope; +} + +QString Scope::scopeName() const +{ + if ( !m_root ) + return ""; + if ( m_incast ) + return "include<" + m_incast->projectName + ">"; + else if ( m_root->isFunctionScope() ) + return funcScopeKey( m_root ); + else if ( m_root->isScope() ) + return m_root->scopedID; + else if ( m_root->isProject() ) + { + if( m_parent && QDir::cleanDirPath( m_parent->projectDir() ) != QDir::cleanDirPath( projectDir() ) ) + { + return URLUtil::getRelativePath( m_parent->projectDir(), projectDir() ); + }else if ( m_parent && QDir::cleanDirPath( m_parent->projectDir() ) == QDir::cleanDirPath( projectDir() ) ) + { + return fileName(); + }else + return QFileInfo( projectDir() ).fileName() ; + } + return QString(); +} + +QString Scope::fileName() const +{ + if( !m_root ) + return ""; + if ( m_incast ) + return m_incast->projectName; + else if ( m_root->isProject() ) + return QFileInfo( m_root->fileName() ).fileName(); + else + return m_parent->fileName(); +} + +Scope* Scope::createFunctionScope( const QString& funcName, const QString& args ) +{ + if ( !m_root ) + return 0; + + QMake::ProjectAST* ast = new QMake::ProjectAST( QMake::ProjectAST::FunctionScope ); + ast->scopedID = funcName; + ast->args = args; + ast->setDepth( m_root->depth() ); + ast->addChildAST( new QMake::NewLineAST() ); + m_root->addChildAST( ast ); + m_root->addChildAST( new QMake::NewLineAST() ); + Scope* funcScope = new Scope( m_environment, getNextScopeNum(), this, ast, m_defaultopts, m_part ); + if( funcScope->scopeType() != Scope::InvalidScope ) + { + m_scopes.insert( getNextScopeNum(), funcScope ); + return funcScope; + }else + delete funcScope; + return 0; +} + +Scope* Scope::createSimpleScope( const QString& scopename ) +{ + if ( !m_root ) + return 0; + + QMake::ProjectAST* ast = new QMake::ProjectAST( QMake::ProjectAST::Scope ); + ast->scopedID = scopename; + ast->addChildAST( new QMake::NewLineAST() ); + ast->setDepth( m_root->depth() ); + m_root->addChildAST( ast ); + m_root->addChildAST( new QMake::NewLineAST() ); + /* We can't unconditionally add the scope name to CONFIG, scope might be win32 which may only be in CONFIG under windows. + if ( m_part->isQt4Project() ) + addToPlusOp( "CONFIG", QStringList( scopename ) ); + */ + Scope* simpleScope = new Scope( m_environment, getNextScopeNum(), this, ast, m_defaultopts, m_part ); + + if( simpleScope->scopeType() != Scope::InvalidScope ) + { + m_scopes.insert( getNextScopeNum(), simpleScope ); + return simpleScope; + }else + delete simpleScope; + return 0; + +} + +Scope* Scope::createIncludeScope( const QString& includeFile, bool negate ) +{ + if ( !m_root ) + return 0; + + Scope* funcScope; + if ( negate ) + { + funcScope = createFunctionScope( "!include", includeFile ); + } + else + { + funcScope = createFunctionScope( "include", includeFile ); + } + if( funcScope == 0 ) + return 0; + + QMake::IncludeAST* ast = new QMake::IncludeAST(); + ast->setDepth( m_root->depth() ); + ast->projectName = includeFile; + Scope* incScope = new Scope( m_environment, funcScope->getNextScopeNum(), funcScope, ast, projectDir(), resolveVariables( ast->projectName ), m_defaultopts, m_part ); + if ( incScope->scopeType() != InvalidScope ) + { + funcScope->m_root->addChildAST( ast ); + funcScope->m_scopes.insert( funcScope->getNextScopeNum(), incScope ); + return funcScope; + } + else + { + deleteFunctionScope( m_scopes.keys().last() ); + delete incScope; + } + return 0; + +} + +Scope* Scope::createSubProject( const QString& projname ) +{ + if( !m_root ) + return 0; + + if( variableValuesForOp( "SUBDIRS", "-=").findIndex( projname ) != -1 ) + removeFromMinusOp( "SUBDIRS", projname ); + + QString realprojname = resolveVariables(projname); + + if( variableValuesForOp( "SUBDIRS", "-=").findIndex( realprojname ) != -1 ) + removeFromMinusOp( "SUBDIRS", realprojname ); + + QDir curdir( projectDir() ); + + if ( variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) + { + QString filename; + if( !realprojname.endsWith(".pro") ) + { + if ( !curdir.exists( realprojname ) ) + if ( !curdir.mkdir( realprojname ) ) + return 0; + curdir.cd( realprojname ); + QStringList entries = curdir.entryList("*.pro", QDir::Files); + + if ( !entries.isEmpty() && entries.findIndex( curdir.dirName()+".pro" ) == -1 ) + filename = curdir.absPath() + QString(QChar(QDir::separator()))+entries.first(); + else + filename = curdir.absPath() + QString(QChar(QDir::separator()))+curdir.dirName()+".pro"; + }else + filename = curdir.absPath() + QString(QChar(QDir::separator())) + realprojname; + + kdDebug( 9024 ) << "Creating subproject with filename:" << filename << endl; + + Scope* s = new Scope( m_environment, getNextScopeNum(), this, filename, m_part ); + s->loadDefaultOpts(); + if ( s->scopeType() != InvalidScope ) + { + if( s->variableValues("TEMPLATE").isEmpty() ) + s->setEqualOp("TEMPLATE", QStringList("app")); + s->saveToFile(); + addToPlusOp( "SUBDIRS", QStringList( realprojname ) ); + m_scopes.insert( getNextScopeNum(), s ); + return s; + } else + { + delete s; + } + } + + return 0; +} + +bool Scope::deleteFunctionScope( unsigned int num ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + Scope* funcScope = m_scopes[ num ]; + if ( funcScope ) + { + QMake::AST* ast = m_root->m_children[ m_root->m_children.findIndex( funcScope->m_root ) ]; + if( !ast ) + return false; + m_scopes.remove( num ); + m_root->removeChildAST( funcScope->m_root ); + delete funcScope; + delete ast; + return true; + } + return false; +} + +bool Scope::deleteSimpleScope( unsigned int num ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + Scope* simpleScope = m_scopes[ num ]; + if ( simpleScope ) + { + QMake::AST* ast = m_root->m_children[ m_root->m_children.findIndex( simpleScope->m_root ) ]; + if( !ast ) + return false; + m_scopes.remove( num ); + removeFromPlusOp( "CONFIG", simpleScope->m_root->scopedID ); + m_root->removeChildAST( simpleScope->m_root ); + delete simpleScope; + delete ast; + return true; + } + return false; +} + +bool Scope::deleteIncludeScope( unsigned int num ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + Scope * incScope = m_scopes[ num ]; + if( !incScope ) + return false; + QMake::AST* ast = incScope->m_incast; + if( !ast ) + return false; + m_scopes.remove( num ); + m_root->removeChildAST( incScope->m_incast); + delete incScope; + delete ast; + + return m_parent->deleteFunctionScope( getNum() ); +} + +bool Scope::deleteSubProject( unsigned int num, bool deleteSubdir ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + QValueList::iterator it = findExistingVariable( "TEMPLATE" ); + if ( it != m_root->m_children.end() ) + { + QMake::AssignmentAST * tempast = static_cast( *it ); + if ( tempast->values.findIndex( "subdirs" ) != -1 || findExistingVariable( "TEMPLATE" ) != m_root->m_children.end() ) + { + Scope* project = m_scopes[ num ]; + if( !project ) + return false; + + QString projdir = project->scopeName(); + if ( deleteSubdir ) + { + QDir projdir = QDir( projectDir() ); + QString dir = project->scopeName(); + if( !dir.endsWith(".pro") ) + { + QDir subdir = QDir( projectDir() + QString( QChar( QDir::separator() ) ) + dir ); + if ( subdir.exists() ) + { + QStringList entries = subdir.entryList(); + for ( QStringList::iterator eit = entries.begin() ; eit != entries.end() ; ++eit ) + { + if( *eit == "." || *eit == ".." ) + continue; + if( !subdir.remove( *eit ) ) + kdDebug( 9024 ) << "Couldn't delete " << *eit << " from " << subdir.absPath() << endl; + } + if( !projdir.rmdir( dir ) ) + kdDebug( 9024 ) << "Couldn't delete " << dir << " from " << projdir.absPath() << endl; + } + }else + { + QDir d( project->projectDir() ); + kdDebug(9024) << "removed subproject?:" << d.remove( dir ) << endl; + } + } + QValueList::iterator foundit = findExistingVariable( "SUBDIRS" ); + if ( foundit != m_root->m_children.end() ) + { + QMake::AssignmentAST * ast = static_cast( *foundit ); + updateValues( ast->values, QStringList( projdir ), true, ast->indent ); + if( m_varCache.contains( "SUBDIRS" ) ) + m_varCache.erase( "SUBDIRS" ); + }else + return false; + m_scopes.remove( num ); + delete project; + return true; + } + } + return false; +} + +void Scope::updateValues( QStringList& origValues, const QStringList& newValues, bool remove, QString indent ) +{ + if( !m_root ) + return; + + for ( QStringList::const_iterator it = newValues.begin(); it != newValues.end() ; ++it ) + { + if ( origValues.findIndex( *it ) == -1 && !remove ) + { + while ( !origValues.isEmpty() && origValues.last() == getLineEndingString() ) + origValues.pop_back(); + if ( origValues.count() > 0 && !containsContinue( origValues.last() ) && !isComment( origValues.last() ) ) + { + origValues.append( " " ); + origValues.append( "\\"+getLineEndingString() ); + if( indent != "" ) + origValues.append( indent ); + }else if ( !origValues.isEmpty() && containsContinue( origValues.last() ) && !isComment( origValues.last() ) ) + { + if( indent != "" ) + origValues.append( indent ); + }else if ( !origValues.isEmpty() && isComment( origValues.last() ) ) + { + origValues[origValues.count()-1] = "\\ "+origValues[origValues.count()-1]; + if( indent != "" ) + origValues.append( indent ); + }else if ( origValues.isEmpty() ) + origValues.append(" "); + QString newval = *it; + QRegExp re("([^$])\\$([^$\\(\\)\\{\\} /]*)( |\\)|/)"); + newval.replace(re, "\\1$(\\2)\\3"); + if( (newval).contains(" ") || (newval).contains("\t") || (newval).contains( getLineEndingString() ) || (newval).contains("#") ) + origValues.append( "\""+newval+"\"" ); + else + origValues.append( newval ); + origValues.append( getLineEndingString() ); + } else if ( origValues.findIndex( *it ) != -1 && remove ) + { + QStringList::iterator posit = origValues.find( *it ); + posit = origValues.remove( posit ); + while( posit != origValues.end() && ( (*posit).find( QRegExp("\\\\[\\s]*"+getLineEndingString() ) ) != -1 + || (*posit).stripWhiteSpace() == "" ) ) + { + posit = origValues.remove( posit ); + } + } + } + while( !origValues.isEmpty() && (origValues.last() == "\\"+getLineEndingString() + || origValues.last() == getLineEndingString() + || origValues.last().stripWhiteSpace() == "" ) && !origValues.isEmpty() ) + origValues.pop_back(); + if( !origValues.isEmpty() && origValues.last().find( QRegExp("\\\\[ \t]*#") ) != -1 ) + origValues[origValues.count()-1] = origValues[origValues.count()-1].mid(origValues[origValues.count()-1].find( "#") ); + if( !origValues.isEmpty() && origValues.last().find( getLineEndingString() ) == -1 ) + origValues.append(getLineEndingString()); +} + +void Scope::updateVariable( const QString& variable, const QString& op, const QStringList& values, bool removeFromOp ) +{ + if ( !m_root || listIsEmpty( values ) ) + return ; + + if( m_varCache.contains( variable ) ) + m_varCache.erase( variable ); + + for ( int i = m_root->m_children.count() - 1; i >= 0; --i ) + { + if ( m_root->m_children[ i ] ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assignment = static_cast( m_root->m_children[ i ] ); + if ( assignment->scopedID == variable && Scope::isCompatible( assignment->op, op ) ) + { + updateValues( assignment->values, values, removeFromOp, assignment->indent ); + if ( removeFromOp && listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + } + return ; + } + else if ( assignment->scopedID == variable && !Scope::isCompatible( assignment->op, op ) ) + { + for ( QStringList::const_iterator it = values.begin() ; it != values.end() ; ++it ) + { + if ( op == "+=" && !removeFromOp && assignment->values.findIndex( *it ) != -1 ) + { + if ( assignment->op == "=" ) + { + updateValues( assignment->values, values, false, assignment->indent ); + return ; + } + else if ( assignment->op == "-=" ) + { + updateValues( assignment->values, QStringList( *it ), true, assignment->indent ); + if ( listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + break; + } + } + } + else if ( op == "-=" && !removeFromOp && assignment->values.findIndex( *it ) != -1 ) + { + updateValues( assignment->values, QStringList( *it ), true, assignment->indent ); + if ( listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + break; + } + } + else if ( op == "=" ) + { + if ( !removeFromOp ) + { + m_root->removeChildAST( assignment ); + delete assignment; + } + else if ( assignment->op == "+=" && assignment->values.findIndex( *it ) != -1 ) + { + updateValues( assignment->values, QStringList( *it ), true, assignment->indent ); + if ( listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + break; + } + } + } + } + } + } + } + + if ( !removeFromOp ) + { + QMake::AssignmentAST * ast = new QMake::AssignmentAST(); + ast->scopedID = variable; + ast->op = op; + updateValues( ast->values, values ); + if( scopeType() == ProjectScope ) + ast->setDepth( m_root->depth() ); + else + ast->setDepth( m_root->depth()+1 ); + m_root->addChildAST( ast ); + if ( values.findIndex( getLineEndingString() ) == -1 ) + { + ast->values.append( getLineEndingString() ); + } + } +} + +QValueList::iterator Scope::findExistingVariable( const QString& variable ) +{ + QValueList::iterator it; + QStringList ops; + ops << "=" << "+="; + + for ( it = m_root->m_children.begin(); it != m_root->m_children.end() ; ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assignment = static_cast( *it ); + if ( assignment->scopedID == variable && ops.findIndex( assignment->op ) != -1 ) + { + return it; + } + } + } + return m_root->m_children.end(); +} + +void Scope::init() +{ + if( !m_root ) + return; + + kdDebug(9024) << "Initializing Scope: " << scopeName() << this << endl; + m_maxCustomVarNum = 1; + + QValueList::const_iterator it; + for ( it = m_root->m_children.begin(); it != m_root->m_children.end(); ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::ProjectAST ) + { + QMake::ProjectAST * p = static_cast( *it ); + m_scopes.insert( getNextScopeNum(), new Scope( m_environment, getNextScopeNum(), this, p, m_defaultopts, m_part ) ); + } + else if ( ( *it ) ->nodeType() == QMake::AST::IncludeAST ) + { + QMake::IncludeAST * i = static_cast( *it ); + QString filename = i->projectName; + if( i->projectName.stripWhiteSpace().startsWith("$") ) + { + filename = resolveVariables(i->projectName, *it); + } + m_scopes.insert( getNextScopeNum(), new Scope( m_environment, getNextScopeNum(), this, i, projectDir(), filename, m_defaultopts, m_part ) ); + } + else if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * m = static_cast( *it ); + // Check wether TEMPLATE==subdirs here too! + if ( m->scopedID == "SUBDIRS" && variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + { + for ( QStringList::const_iterator sit = m->values.begin() ; sit != m->values.end(); ++sit ) + { + QString str = *sit; + if ( containsContinue( str ) || isComment( str ) || str == getLineEndingString() || str == "." || str == "./" || (str).stripWhiteSpace() == "" ) + continue; + QDir subproject; + QString projectfile; + kdDebug(9024) << "reading subproject: " << str << endl; + if( str.startsWith("$") ) + str = resolveVariables(str, *it); + if( str.endsWith(".pro") ) + { + subproject = QDir( projectDir(), "*.pro", QDir::Name | QDir::IgnoreCase, QDir::Files ); + projectfile = str; + }else + { + QString dir = str; + if( QFileInfo( dir ).isRelative() ) + dir = projectDir() + QString( QChar( QDir::separator() ) ) + dir; + subproject = QDir( dir, + "*.pro", QDir::Name | QDir::IgnoreCase, QDir::Files ); + if( !subproject.exists() ) + { + kdDebug(9024) << "Project Dir doesn't exist, trying to find name.subdir variable:" << str << endl; + if( !variableValues(str+".subdir").isEmpty() ) + { + kdDebug(9024) << "Found name.subdir variable for " << str << endl; + subproject = QDir( projectDir() + QString( QChar( QDir::separator() ) ) + + variableValues(str+".subdir").first(), + "*.pro", QDir::Name | QDir::IgnoreCase, QDir::Files ); + }else + continue; + } + if ( subproject.entryList().isEmpty() || subproject.entryList().findIndex( str + ".pro" ) != -1 ) + projectfile = (str) + ".pro"; + else + projectfile = subproject.entryList().first(); + + } + kdDebug( 9024 ) << "Parsing subproject: " << projectfile << endl; + m_scopes.insert( getNextScopeNum(), new Scope( m_environment, getNextScopeNum(), this, + subproject.absFilePath( projectfile ), + m_part, ( m->op != "-=" )) ); + } + } + else + { + if ( !( + KnownVariables.findIndex( m->scopedID ) != -1 + && ( m->op == "=" || m->op == "+=" || m->op == "-=") + ) + && !( + ( m->scopedID.contains( ".files" ) || m->scopedID.contains( ".path" ) ) + && variableValues("INSTALLS").findIndex(m->scopedID.left( m->scopedID.findRev(".") != -1 ) ) + ) + && !( + ( m->scopedID.contains( ".subdir" ) ) + && variableValues("SUBDIRS").findIndex(m->scopedID.left( m->scopedID.findRev(".") != -1 ) ) + ) + ) + { + m_customVariables[ m_maxCustomVarNum++ ] = m; + } + } + } + } +} + +QString Scope::projectName() const +{ + if( !m_root ) + return ""; + + return QFileInfo( projectDir() ).fileName(); +} + +QString Scope::projectDir() const +{ + if( !m_root ) + return ""; + if ( m_root->isProject() ) + { + return QFileInfo( m_root->fileName() ).dirPath( true ); + } + else + { + return m_parent->projectDir(); + } +} + +const QMap > Scope::customVariables() const +{ + QMap > result; + if( !m_root ) + return result; + + QMap::const_iterator it = m_customVariables.begin(); + for ( ; it != m_customVariables.end(); ++it ) + { + QMap temp; + temp[ "var" ] = it.data()->scopedID; + temp[ "op" ] = it.data()->op; + temp[ "values" ] = it.data()->values.join("").stripWhiteSpace(); + result[ it.key() ] = temp; + } + return result; +} + +void Scope::updateCustomVariable( unsigned int id, const QString& name, const QString& newop, const QString& newvalues ) +{ + if( !m_root ) + return; + if ( id > 0 && m_customVariables.contains( id ) ) + { + m_customVariables[ id ] ->values.clear(); + updateValues( m_customVariables[ id ] ->values, newvalues.stripWhiteSpace() ); + if( m_varCache.contains( m_customVariables[ id ]->scopedID ) ) + m_varCache.erase( m_customVariables[ id ]->scopedID ); + m_customVariables[ id ] ->op = newop; + m_customVariables[ id ] ->scopedID = name; + } +} + +unsigned int Scope::addCustomVariable( const QString& var, const QString& op, const QString& values ) +{ + QMake::AssignmentAST* newast = new QMake::AssignmentAST(); + newast->scopedID = var; + newast->op = op; + newast->values.append(values.stripWhiteSpace()); + if( scopeType() == ProjectScope ) + newast->setDepth( m_root->depth() ); + else + newast->setDepth( m_root->depth()+1 ); + m_root->addChildAST( newast ); + m_customVariables[ m_maxCustomVarNum++ ] = newast; + return (m_maxCustomVarNum-1); +} + +void Scope::removeCustomVariable( unsigned int id ) +{ + if( m_customVariables.contains(id) ) + { + QMake::AssignmentAST* m = m_customVariables[id]; + m_customVariables.remove(id); + m_root->m_children.remove( m ); + } +} + +bool Scope::isVariableReset( const QString& var ) +{ + bool result = false; + if( !m_root ) + return result; + QValueList::const_iterator it = m_root->m_children.begin(); + for ( ; it != m_root->m_children.end(); ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * ast = static_cast( *it ); + if ( ast->scopedID == var && ast->op == "=" ) + { + result = true; + break; + } + } + } + return result; +} + +void Scope::removeVariable( const QString& var, const QString& op ) +{ + if ( !m_root ) + return ; + + QMake::AssignmentAST* ast = 0; + + QValueList::iterator it = m_root->m_children.begin(); + for ( ; it != m_root->m_children.end(); ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + ast = static_cast( *it ); + if ( ast->scopedID == var && ast->op == op ) + { + m_root->m_children.remove( ast ); + it = m_root->m_children.begin(); + } + } + } +} + +bool Scope::listIsEmpty( const QStringList& values ) +{ + if ( values.size() < 1 ) + return true; + for ( QStringList::const_iterator it = values.begin(); it != values.end(); ++it ) + { + if ( ( *it ).stripWhiteSpace() != "" && ( *it ).stripWhiteSpace() != "\\" ) + return false; + } + return true; +} + +bool Scope::isCompatible( const QString& op1, const QString& op2) +{ + if( op1 == "+=" ) + return ( op2 == "+=" || op2 == "=" ); + else if ( op1 == "-=" ) + return ( op2 == "-=" ); + else if ( op1 == "=" ) + return ( op2 == "=" || op2 == "+=" ); + return false; +} + +bool Scope::listsEqual(const QStringList& l1, const QStringList& l2) +{ + QStringList left = l1; + QStringList right = l2; +// left.sort(); +// right.sort(); + return (left == right); +} + +QStringList Scope::cleanStringList(const QStringList& list) const +{ + QStringList result; + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + QString s = *it; + if( s.stripWhiteSpace() != "" + && !containsContinue(s) + && s.stripWhiteSpace() != getLineEndingString() + && !isComment(s) ) + result.append(s); + } + return result; +} + +bool Scope::isQt4Project() const +{ + return m_part->isQt4Project(); +} + +void Scope::reloadProject() +{ + if ( !m_root || !m_root->isProject() ) + return; + + QString filename = m_root->fileName(); + QMap::iterator it; + for ( it = m_scopes.begin() ; it != m_scopes.end() ; ++it ) + { + Scope* s = it.data(); + delete s; + } + m_scopes.clear(); + + m_customVariables.clear(); + + m_varCache.clear(); + + if ( m_root->isProject() ) + delete m_root; + if ( !loadFromFile( filename ) && !QFileInfo( filename ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( filename ); + } + init(); +} + +Scope* Scope::disableSubproject( const QString& dir) +{ + if( !m_root || ( m_root->isProject() && !m_incast ) ) + return 0; + + if( scopeType() != Scope::IncludeScope && variableValuesForOp( "SUBDIRS", "+=").findIndex( dir ) != -1 ) + removeFromPlusOp( "SUBDIRS", dir ); + else if( scopeType() != Scope::IncludeScope ) + removeFromPlusOp( "SUBDIRS", dir ); + + QDir curdir( projectDir() ); + + if ( variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) + { + curdir.cd(dir); + QString filename; + QStringList entries = curdir.entryList("*.pro", QDir::Files); + + if ( !entries.isEmpty() && entries.findIndex( curdir.dirName()+".pro" ) != -1 ) + filename = curdir.absPath() + QString(QChar(QDir::separator()))+entries.first(); + else + filename = curdir.absPath() + QString(QChar(QDir::separator()))+curdir.dirName()+".pro"; + + kdDebug( 9024 ) << "Disabling subproject with filename:" << filename << endl; + + Scope* s = new Scope( m_environment, getNextScopeNum(), this, filename, m_part, false ); + addToMinusOp( "SUBDIRS", QStringList( dir ) ); + m_scopes.insert( getNextScopeNum(), s ); + return s; + } + + return 0; +} + +QString Scope::resolveVariables( const QString& value ) const +{ + return resolveVariables(QStringList(value), 0).front(); +} + + +QString Scope::resolveVariables( const QString& value, QMake::AST* stopHere ) const +{ + return resolveVariables(QStringList(value), stopHere).front(); +} + +QStringList Scope::variableValues( const QString& variable, QMake::AST* stopHere, bool fetchFromParent ) const +{ + QStringList result; + + if ( !m_root ) + return result; + + calcValuesFromStatements( variable, result, true, stopHere, fetchFromParent ); + result = cleanStringList(result); + return result; +} + +QStringList Scope::resolveVariables( const QStringList& values, QMake::AST* stopHere ) const +{ + QStringList result = values; + QMap variables; + for( QStringList::iterator it = result.begin(); it != result.end(); ++it ) + { + QRegExp re("\\$\\$([^{}\\) /]*)( |\\)|/|$)"); + int pos = 0; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !variables.contains( re.cap(1) ) ) + { + variables[re.cap(1)] = resolveVariables( variableValues( re.cap(1), stopHere ) ); + if( variables[re.cap(1)].isEmpty() && re.cap(1) == "TARGET" ) + { + variables[re.cap(1)] = QFileInfo( fileName() ).baseName(); + } + } + pos += re.matchedLength(); + } + } + re = QRegExp("\\$\\$\\{([^\\)\\}]*)\\}"); + pos = 0; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !variables.contains( re.cap(1) ) ) + { + variables[re.cap(1)] = resolveVariables( variableValues( re.cap(1), stopHere ) ); + if( variables[re.cap(1)].isEmpty() && re.cap(1) == "TARGET" ) + { + variables[re.cap(1)] = QFileInfo( fileName() ).baseName(); + } + } + pos += re.matchedLength(); + } + } + re = QRegExp("\\$\\$\\(([^\\)\\}]*)\\)"); + pos = 0; + QMap envvars; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !envvars.contains( re.cap(1) ) ) + if( m_environment.contains( re.cap(1) ) != -1 ) + envvars[re.cap(1)] = m_environment[ re.cap(1) ]; + else if ( ::getenv( re.cap(1).local8Bit() ) != 0 ) + envvars[re.cap(1)] = QString::fromLocal8Bit( ::getenv( re.cap(1).local8Bit() ) ); + pos += re.matchedLength(); + } + } + for( QMap::const_iterator it2 = envvars.begin(); it2 != envvars.end(); ++it2 ) + { + (*it).replace("$$("+it2.key()+")", it2.data() ); + } + for( QMap::const_iterator it2 = variables.begin(); it2 != variables.end(); ++it2 ) + { + for( QStringList::const_iterator it3 = it2.data().begin(); it3 != it2.data().end(); ++it3 ) + { + (*it).replace("$$"+it2.key(), *it3 ); + (*it).replace("$${"+it2.key()+"}", *it3 ); + } + } + } + return result; +} + +void Scope::allFiles( const QString& projectDirectory, std::set& res ) +{ + + QString myRelPath = URLUtil::getRelativePath( projectDirectory, projectDir() ); + QString file; + QStringList values; + QString header = ""; + if( variableValues("TEMPLATE",false ).findIndex("subdirs") == -1 ) + { + values = variableValues( "INSTALLS" ,false, false ); + QStringList::const_iterator it; + for ( it = values.begin(); it != values.end(); ++it ) + { + if ( ( *it ) == "target" ) + continue; + + QStringList files = variableValues( *it + ".files" ,false, false ); + QStringList::iterator filesit = files.begin(); + for ( ;filesit != files.end(); ++filesit ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *filesit; + file = resolveVariables( file ); + if( file.contains("*") ) + { + QFileInfo fi( projectDirectory + QString( QChar( QDir::separator() ) ) + file ); + QDir absDir = fi.dir( true ); + absDir.setNameFilter( fi.fileName() ); + absDir.setFilter( QDir::Files | QDir::Readable | QDir::NoSymLinks ); + QStringList list = absDir.entryList(); + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + res.insert( QDir::cleanDirPath( URLUtil::getRelativePath( projectDirectory, absDir.path()+QString( QChar( QDir::separator() ) )+*it ) ) ); + } + } + else + { + res.insert( QDir::cleanDirPath( file ) ); + } + } + } + + values = variableValues( "LEXSOURCES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "YACCSOURCES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "DISTFILES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + if( file.contains("*") ) + { + QFileInfo fi( projectDirectory + QString( QChar( QDir::separator() ) ) + file ); + QDir absDir = fi.dir( true ); + absDir.setNameFilter( fi.fileName() ); + absDir.setFilter( QDir::Files | QDir::Readable | QDir::NoSymLinks ); + QStringList list = absDir.entryList(); + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + res.insert( QDir::cleanDirPath( URLUtil::getRelativePath( projectDirectory, absDir.path()+QString( QChar( QDir::separator() ) )+*it ) ) ); + } + } + else + { + res.insert( QDir::cleanDirPath( file ) ); + } + } + + if ( isQt4Project() ) + { + values = variableValues( "RESOURCES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + } + values = variableValues( "IMAGES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "TRANSLATIONS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "IDLS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + if ( m_part->isTMakeProject() ) + { + values = variableValues( "INTERFACES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + if( QFileInfo(projectDir()+QString(QChar(QDir::separator())) + *it+".h").exists() ) + res.insert( QDir::cleanDirPath( file+".h" ) ); + } + } + else + { + values = variableValues( "FORMS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + + if( !m_part->isQt4Project()) + { + header = projectDir()+QString(QChar(QDir::separator())) + *it+".h"; + if( QFileInfo(header).exists() ) + res.insert( QDir::cleanDirPath( header ) ); + header = projectDir()+QString(QChar(QDir::separator())) + *it+".cpp"; + if( QFileInfo(header).exists() ) + res.insert( QDir::cleanDirPath( header ) ); + } + else + { + header = projectDir()+QString(QChar(QDir::separator())) + "ui_" +*it; + header.replace(QRegExp("\\.ui$"),".h"); + if( QFileInfo(header).exists() ) + res.insert( QDir::cleanDirPath( header ) ); + } + } + } + + values = variableValues( "SOURCES" ,false, false ); + kdDebug(9024) << "scope:" << scopeType() << " found values: " << values << endl; + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "HEADERS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + } + QMap::const_iterator it = m_scopes.begin(); + for( ; it != m_scopes.end(); ++it ) + { + it.data()->allFiles( projectDirectory, res ); + } +} + +QStringList Scope::allFiles( const QString& projectDir ) +{ + QStringList result; + std::set files; + allFiles( projectDir, files ); + for( std::set::const_iterator it = files.begin(); it != files.end() ; ++it ) + result.append( *it ); + kdDebug(9024) << "all files: " << result << endl; + return result; +} + +QString Scope::findCustomVarForPath( const QString& path ) +{ + QString result; + if( !m_root ) + return result; + + QMap::const_iterator it = m_customVariables.begin(); + for( ; it != m_customVariables.end(); ++it ) + { + kdDebug(9024) << "Checking " << path << " against " << cleanStringList(it.data()->values) << endl; + if( !it.data()->values.isEmpty() && cleanStringList(it.data()->values).front() == path ) + { + return it.data()->scopedID; + } + } + if( scopeType() != ProjectScope ) + { + return parent()->findCustomVarForPath( path ); + } + return result; +} + +void Scope::loadDefaultOpts() +{ + if( !m_defaultopts && m_root ) + { + m_defaultopts = new QMakeDefaultOpts(); + if( DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/disableDefaultOpts", true ) ) + { + m_defaultopts->readVariables( m_part->qmakePath(), QFileInfo( m_root->fileName() ).dirPath( true ) ); + } + } +} + +QString Scope::getLineEndingString() const +{ + + if( scopeType() == ProjectScope ) + { + switch( m_root->lineEnding() ) + { + case QMake::ProjectAST::Windows: + return QString("\r\n"); + break; + case QMake::ProjectAST::MacOS: + return QString("\r"); + break; + case QMake::ProjectAST::Unix: + return QString("\n"); + break; + } + }else if( m_parent ) + { + return m_parent->getLineEndingString(); + } + return "\n"; +} + +QString Scope::replaceWs(QString s) +{ + return s.replace( getLineEndingString(), "%nl").replace("\t", "%tab").replace(" ", "%spc"); +} + +bool Scope::containsContinue(const QString& s ) const +{ + return( s.find( QRegExp( "\\\\\\s*"+getLineEndingString() ) ) != -1 + || s.find( QRegExp( "\\\\\\s*#" ) ) != -1 ); +} + +bool Scope::isComment( const QString& s) const +{ + return s.startsWith("#"); +} + +#ifdef DEBUG +void Scope::printTree() +{ + PrintAST p; + p.processProject(m_root); +} + +Scope::PrintAST::PrintAST() : QMake::ASTVisitor() +{ + indent = 0; +} + +void Scope::PrintAST::processProject( QMake::ProjectAST* p ) +{ + QMake::ASTVisitor::processProject(p); +} + +void Scope::PrintAST::enterRealProject( QMake::ProjectAST* p ) +{ + kdDebug(9024) << getIndent() << "--------- Entering Project: " << replaceWs(p->fileName()) << " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterRealProject(p); +} + +void Scope::PrintAST::leaveRealProject( QMake::ProjectAST* p ) +{ + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving Project: " << replaceWs(p->fileName()) << " --------------" << endl; + QMake::ASTVisitor::leaveRealProject(p); +} + +void Scope::PrintAST::enterScope( QMake::ProjectAST* p ) +{ + kdDebug(9024) << getIndent() << "--------- Entering Scope: " << replaceWs(p->scopedID) << " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterScope(p); +} + +void Scope::PrintAST::leaveScope( QMake::ProjectAST* p ) +{ + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving Scope: " << replaceWs(p->scopedID) << " --------------" << endl; + QMake::ASTVisitor::leaveScope(p); +} + +void Scope::PrintAST::enterFunctionScope( QMake::ProjectAST* p ) +{ + kdDebug(9024) << getIndent() << "--------- Entering FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterFunctionScope(p); +} + +void Scope::PrintAST::leaveFunctionScope( QMake::ProjectAST* p ) +{ + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl; + QMake::ASTVisitor::leaveFunctionScope(p); +} + +QString Scope::PrintAST::replaceWs(QString s) +{ + return s.replace("\n", "%nl").replace("\t", "%tab").replace(" ", "%spc"); +} + +void Scope::PrintAST::processAssignment( QMake::AssignmentAST* a) +{ + kdDebug(9024) << getIndent() << "Assignment: " << replaceWs(a->scopedID) << " " << replaceWs(a->op) << " " + << replaceWs(a->values.join("|"))<< endl; + QMake::ASTVisitor::processAssignment(a); +} + +void Scope::PrintAST::processNewLine( QMake::NewLineAST* n) +{ + kdDebug(9024) << getIndent() << "Newline " << endl; + QMake::ASTVisitor::processNewLine(n); +} + +void Scope::PrintAST::processComment( QMake::CommentAST* a) +{ + kdDebug(9024) << getIndent() << "Comment: " << replaceWs(a->comment) << endl; + QMake::ASTVisitor::processComment(a); +} + +void Scope::PrintAST::processInclude( QMake::IncludeAST* a) +{ + kdDebug(9024) << getIndent() << "Include: " << replaceWs(a->projectName) << endl; + QMake::ASTVisitor::processInclude(a); +} + +QString Scope::PrintAST::getIndent() +{ + QString ind; + for( int i = 0 ; i < indent ; i++) + ind += " "; + return ind; +} +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/scope.h b/buildtools/qmake/scope.h new file mode 100644 index 00000000..e8f40eb9 --- /dev/null +++ b/buildtools/qmake/scope.h @@ -0,0 +1,308 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _SCOPE_H_ +#define _SCOPE_H_ + +#include +#include +#include +#include + +#include "qmakeast.h" +#include "qmakedefaultopts.h" + +#ifdef DEBUG +#include "qmakeastvisitor.h" +#endif + +class Scope; +class TrollProjectPart; + +class Scope +{ +public: + + enum ScopeType { + ProjectScope, + FunctionScope, + SimpleScope, + IncludeScope, + InvalidScope + }; + static const QStringList KnownVariables; + static const QStringList KnownConfigValues; + + Scope( const QMap& env, const QString &filename, TrollProjectPart* part ); + ~Scope(); + + void saveToFile() const; + + // Changing variable values + void addToPlusOp( const QString& variable, const QStringList& values ); + void removeFromPlusOp( const QString& variable, const QStringList& values ); + void addToMinusOp( const QString& variable, const QStringList& values ); + void removeFromMinusOp( const QString& variable, const QStringList& values ); + void addToEqualOp( const QString& variable, const QStringList& values ); + void removeFromEqualOp( const QString& variable, const QStringList& values ); + void setPlusOp( const QString& variable, const QStringList& values ); + void setEqualOp( const QString& variable, const QStringList& values ); + void setMinusOp( const QString& variable, const QStringList& values ); + + // Checks wether a line like VAR = exists in this subscope + bool isVariableReset( const QString& var ); + + // Fetch the valuelist for the variable op combination inside this scope + QStringList variableValuesForOp( const QString& variable, const QString& op ) const; + + // Fetch the variable values by running over the statements and adding/removing/setting + // as the encountered op's say, begin with the parent projects variableValues list + QStringList variableValues( const QString& variable, bool checkIncParent = true, bool fetchFromParent = true, bool evaluateSubScopes = false ); + + // Remove a variable+Op combination from the scope, if existant + void removeVariable( const QString& var, const QString& op ); + + // Getting to know what type of scope this is + ScopeType scopeType() const; + + // This returns the function+args, the scopename or the pro/pri file + // depending on the type of scope + QString scopeName() const; + + // Returns the projectName for this scope, this is equal to the last part of the projectDir() + QString projectName() const; + + // Returns just the filename of this project's .pro file + QString fileName() const; + + // Returns the absolute path of the dir containing the .pro file + QString projectDir() const; + + // get the parent Scope + Scope* parent() const { return m_parent; } + + // Fetching sub-scopes + const QValueList scopesInOrder() const { return m_scopes.values(); } + // Working on SubScopes + /* + * creates a new function scope at the end of this (Sub-)AST and returns the Scope wrapping it + */ + Scope* createFunctionScope( const QString& funcName, const QString& args ); + /* + * creates a new simple scope at the end of this (Sub-)AST and returns the Scope wrapping it + */ + Scope* createSimpleScope( const QString& scopename ); + + /* + * creates a new function scope at the end of this (Sub-)AST + * and a new include scope inside the new function scope. + * It returns the Scope wrapping the include-AST, the function scope AST + * can be accessed easily using the parent() method. + */ + Scope* createIncludeScope( const QString& includeFile, bool negate = false ); + + /* + * creates a new subproject in dir (create's dir if necessary) + * If this scope is not a project scope the subproject will be added to this + * Scope only, i.e. it is not seen in the project-files list of subdirs + */ + Scope* createSubProject( const QString& dir ); + + /* delete the given function scope */ + bool deleteFunctionScope( unsigned int ); + /* delete the given simple scope */ + bool deleteSimpleScope( unsigned int ); + /* delete the given include scope */ + bool deleteIncludeScope( unsigned int ); + /* deletes the subproject (including the subdir if deleteSubdir is true) */ + bool deleteSubProject( unsigned int, bool deleteSubdir ); + + /* find out wether the project is Qt4 or Qt3 */ + bool isQt4Project() const ; + + /* Provide a Map of Custom variables */ + const QMap > customVariables() const; + + unsigned int addCustomVariable( const QString& var, const QString& op, const QString& values ); + + /* Removes the variable with the given id if it exists */ + void removeCustomVariable( unsigned int ); + + /* Update the values of the variable/operation combo var+op to values */ + void updateCustomVariable( unsigned int, const QString&, const QString& , const QString& ); + + // Checks wether a QStringList contains any values that are not whitespace or \\n + static bool listIsEmpty( const QStringList& values ); + + /* returns wether this is an enabled subproject or a disabled one */ + bool isEnabled() { return m_isEnabled; } + + QStringList cleanStringList(const QStringList& list) const; + + /* Reload a project scope */ + void reloadProject(); + + /* creates a new disabled Scope child and add SUBDIRS -= dir to this scope */ + Scope* disableSubproject( const QString& ); + + /* return the "position" of this scope in the list of scopes */ + unsigned int getNum() { return m_num; } + + QStringList allFiles( const QString& ); + + QString resolveVariables( const QString& ) const; + + QString findCustomVarForPath( const QString& ); + +#ifdef DEBUG + void printTree(); +#endif + +private: + + // Builds the scope-lists and the customVariables list + void init(); + + /* + * Updates the given Variable+op with the values, if removeFromOp is true it removes the values, else it adds them + * this works it's way back through the current scope and changes the last occurence of op to + * include all new values. + * + * Depending on "op" it might end the search earlier (if op is += it also stops at =) + * + * This also removes the values from other assignments if the operation is not op, i.e. + * if op is += removes values from any occurence of -= + * if op is -= removes values from any occurence of = and += + * if op is = removes values frmo any occurence of -= + */ + void updateVariable( const QString& variable, const QString& op, const QStringList& values, bool removeFromOp ); + + /* + * Helper Function to change the origValues list with the values from newValues + * depending on the state of "remove" either adds or removes all entries from newValues + * to origValues if they didn't exist there yet + */ + void updateValues( QStringList& origValues, const QStringList& newValues, bool remove = false, QString indent = " " ); + + /* + * Finds an existing variable, returns the end() of the statemenst if it is not found + */ + QValueList::iterator findExistingVariable( const QString& variable ); + + // Private constructors for easier subscope creation + /* + * just initializes the lists from the scope + */ + Scope( const QMap& env, unsigned int num, Scope* parent, QMake::ProjectAST* root, QMakeDefaultOpts*, TrollProjectPart* part ); + /* + * reads the given filename and parses it. If it doesn't exist creates an empty + * ProjectAST with the given filename + */ + Scope( const QMap& env, unsigned int num, Scope* parent, const QString& filename, TrollProjectPart* part, bool isEnabled = true ); + /* + * Creates a scope for an include statement, parses the file and initializes the Scope + * Create an empty ProjectAST if the file cannot be found or parsed. + */ + Scope( const QMap& env, unsigned int num, Scope* parent, QMake::IncludeAST* incast, const QString& path, const QString& incfile, QMakeDefaultOpts*, TrollProjectPart* part ); + + + // runs through the statements until stopHere is found (or the end is reached, if stopHere is 0), + // using the given list as startvalue + // Changes the list using the +=, -=, = operations accordingly + void calcValuesFromStatements( const QString& variable, QStringList& result, bool, QMake::AST* stopHere = 0, bool fetchFromParent = true, bool setDefault = true, bool evaluateSubScopes = false ) const; + + // Check wether the two operators are compatible + static bool isCompatible( const QString& op1, const QString& op2); + + // Check wether the 2 lists are equal, regardless of element order. + static bool listsEqual(const QStringList& , const QStringList& ); + + // Load and Save project files, these only work on ProjectScope's + bool loadFromFile( const QString& filename ); + + QString funcScopeKey( QMake::ProjectAST* funcast ) const { return funcast->scopedID + "(" + funcast->args + ")"; } + + unsigned int getNextScopeNum() { if( m_scopes.isEmpty() ) return 0; else return (m_scopes.keys().last()+1); } + + QStringList lookupVariable( const QString& var ); + + QStringList resolveVariables( const QStringList&, QMake::AST* = 0 ) const; + QStringList variableValues( const QString& variable, QMake::AST*, bool fetchFromParent = true ) const; + QString resolveVariables( const QString& , QMake::AST* ) const; + + // This function determines the currently used String for fileending, it can be \n, \r or \r\n + QString getLineEndingString() const; + bool isComment( const QString& ) const; + bool containsContinue( const QString& ) const; + void allFiles( const QString&, std::set& ); + + void loadDefaultOpts(); + + QMake::ProjectAST* m_root; + QMake::IncludeAST* m_incast; + QMap m_customVariables; + QMap m_scopes; + Scope* m_parent; + unsigned int m_maxCustomVarNum; + + QString replaceWs(QString); + + + // The "position" inside the parent scope that this scope starts at + unsigned int m_num; + bool m_isEnabled; + TrollProjectPart* m_part; + QMakeDefaultOpts* m_defaultopts; + QMap m_varCache; + QMap m_environment; + +#ifdef DEBUG + class PrintAST : QMake::ASTVisitor + { + + public: + PrintAST(); + virtual void processProject( QMake::ProjectAST* p ); + virtual void enterRealProject( QMake::ProjectAST* p ); + + virtual void leaveRealProject( QMake::ProjectAST* p ); + + virtual void enterScope( QMake::ProjectAST* p ); + + virtual void leaveScope( QMake::ProjectAST* p ); + + virtual void enterFunctionScope( QMake::ProjectAST* p ); + + virtual void leaveFunctionScope( QMake::ProjectAST* p ); + + virtual void processAssignment( QMake::AssignmentAST* a); + + virtual void processNewLine( QMake::NewLineAST* n); + + virtual void processComment( QMake::CommentAST* a); + + virtual void processInclude( QMake::IncludeAST* a); + + QString replaceWs(QString); + + private: + QString getIndent(); + int indent; + + }; +#endif + +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/trolllistview.cpp b/buildtools/qmake/trolllistview.cpp new file mode 100644 index 00000000..531bb3e8 --- /dev/null +++ b/buildtools/qmake/trolllistview.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * adymo@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "trolllistview.h" + + +TrollListView::TrollListView(TrollProjectWidget *widget, QWidget *parent, + TrollProjectWidget::TrollProjectView view, const char *name) + :KListView(parent, name), m_widget(widget), m_view(view) +{ +} + +TrollListView::~TrollListView() +{ +} + +void TrollListView::focusOutEvent( QFocusEvent */* e*/ ) +{ + m_widget->setLastFocusedView(m_view); +} + +#include "trolllistview.moc" diff --git a/buildtools/qmake/trolllistview.h b/buildtools/qmake/trolllistview.h new file mode 100644 index 00000000..0ee86abb --- /dev/null +++ b/buildtools/qmake/trolllistview.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * adymo@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef TROLLLISTVIEW_H +#define TROLLLISTVIEW_H + +#include + +#include "trollprojectwidget.h" + +class TrollListView : public KListView +{ +Q_OBJECT +public: + TrollListView(TrollProjectWidget *widget, QWidget *parent, TrollProjectWidget::TrollProjectView view, const char *name = 0); + ~TrollListView(); +protected: + virtual void focusOutEvent(QFocusEvent *e); + +private: + TrollProjectWidget *m_widget; + TrollProjectWidget::TrollProjectView m_view; +}; + +#endif diff --git a/buildtools/qmake/trollprojectpart.cpp b/buildtools/qmake/trollprojectpart.cpp new file mode 100644 index 00000000..6d2f5b3a --- /dev/null +++ b/buildtools/qmake/trollprojectpart.cpp @@ -0,0 +1,931 @@ +/*************************************************************************** + * Copyright (C) 2003 by Thomas Hasart * + * thasart@gmx.de * + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jakob@jsg.dk * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "trollprojectpart.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "domutil.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevmakefrontend.h" +#include "kdevappfrontend.h" +#include "kdevpartcontroller.h" +#include "trollprojectwidget.h" +#include "runoptionswidget.h" +#include "config.h" +#include "envvartools.h" +#include "qmakeoptionswidget.h" +#include "scope.h" + +#include +#include + +typedef KDevGenericFactory TrollProjectFactory; +static const KDevPluginInfo data("kdevtrollproject"); +K_EXPORT_COMPONENT_FACTORY( libkdevtrollproject, TrollProjectFactory( data ) ) + +TrollProjectPart::TrollProjectPart(QObject *parent, const char *name, const QStringList& args ) + : KDevBuildTool(&data, parent, name ? name : "TrollProjectPart") +{ + setInstance(TrollProjectFactory::instance()); + + if ( args.count() == 1 && args[0] == "TMake" ) + m_tmakeProject = true; + else + m_tmakeProject = false; + + setXMLFile("kdevtrollproject.rc"); + + m_executeProjectAfterBuild = false; + m_executeTargetAfterBuild = false; + + m_dirWatch = new KDirWatch(this); + + m_widget = new TrollProjectWidget(this); + m_widget->setIcon(SmallIcon("qmakerun")); + m_widget->setCaption(i18n("QMake Manager")); + QWhatsThis::add(m_widget, i18n("QMake manager

" + "The QMake manager project tree consists of two parts. The 'overview' " + "in the upper half shows the subprojects, each one having a " + ".pro file. The 'details' view in the lower half shows the " + "list of files for the active subproject selected in the overview.")); + + mainWindow()->embedSelectViewRight(m_widget, i18n("QMake Manager"), i18n("QMake manager")); + + KAction *action; + + const QIconSet icon(SmallIcon("compfile")); + action = new KAction( i18n("Compile &File"), "compfile", 0, + m_widget, SLOT(slotBuildOpenFile()), + actionCollection(),"build_compilefile" ); + action->setToolTip(i18n("Compile file")); + action->setWhatsThis(i18n("Compile file

Runs make filename.o command from the directory where 'filename' is the name of currently opened file.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + + action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8, + m_widget, SLOT(slotBuildProject()), + actionCollection(), "build_build_project" ); + action->setToolTip(i18n("Build project")); + action->setWhatsThis(i18n("Build project

Runs make from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Rebuild Project"),"rebuild" , 0, + m_widget, SLOT(slotRebuildProject()), + actionCollection(),"build_rebuild_project" ); + action->setToolTip(i18n("Rebuild project")); + action->setWhatsThis(i18n("Rebuild project

Runs make clean and then make from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Install Project"),"install" , 0, + m_widget, SLOT(slotInstallProject()), + actionCollection(),"build_install_project" ); + action->setToolTip(i18n("Install project")); + action->setWhatsThis(i18n("Install project

Runs make install from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Clean Project"), 0, + m_widget, SLOT(slotCleanProject()), + actionCollection(), "build_clean_project" ); + action->setToolTip(i18n("Clean project")); + action->setWhatsThis(i18n("Clean project

Runs make clean command from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Dist-Clean Project"), 0, + m_widget, SLOT(slotDistCleanProject()), + actionCollection(), "build_distclean_project" ); + action->setToolTip(i18n("Dist-Clean project")); + action->setWhatsThis(i18n("Dist-Clean project

Runs make distclean command from the " + "project directory.
Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("Execute Main Program"), "exec", SHIFT+Key_F9, + this, SLOT(slotBuildAndExecuteProject()), + actionCollection(), "build_execute_project" ); + action->setToolTip(i18n("Execute main program")); + action->setWhatsThis(i18n("Execute program

Executes the currently selected subproject if it is an application or the program specified in project settings, Run Options tab.")); + + action = new KAction( i18n("&Build Subproject"), "make_kdevelop", Key_F7, + m_widget, SLOT(slotBuildTarget()), + actionCollection(), "build_build_target" ); + action->setToolTip(i18n("Build subproject")); + action->setWhatsThis(i18n("Build subproject

Runs make from the current subproject directory. " + "Current subproject is a subproject selected in QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Rebuild Subproject"), "rebuild", 0, + m_widget, SLOT(slotRebuildTarget()), + actionCollection(),"build_rebuild_target" ); + action->setToolTip(i18n("Rebuild subproject")); + action->setWhatsThis(i18n("Rebuild subproject

Runs make clean and then make from the current subproject directory. " + "Current subproject is a subproject selected in QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Install Subproject"), "install", 0, + m_widget, SLOT(slotInstallTarget()), + actionCollection(),"build_install_target" ); + action->setToolTip(i18n("Install subproject")); + action->setWhatsThis(i18n("Install subproject

Runs make install from the current subproject directory. " + "The current subproject is the subproject selected in the QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Clean Subproject"), 0, + m_widget, SLOT(slotCleanTarget()), + actionCollection(), "build_clean_target" ); + action->setToolTip(i18n("Clean subproject")); + action->setWhatsThis(i18n("Clean subproject

Runs make clean from the current subproject directory. " + "The current subproject is the subproject selected in the QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("&Dist-Clean Subproject"), 0, + m_widget, SLOT(slotDistCleanTarget()), + actionCollection(), "build_distclean_target" ); + action->setToolTip(i18n("Dist-Clean subproject")); + action->setWhatsThis(i18n("Dist-Clean subproject

Runs make distclean from the current" + " subproject directory. The current subproject is the subproject selected in the QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab.")); + + action = new KAction( i18n("Execute Subproject"), "exec", 0, + this, SLOT(slotBuildAndExecuteTarget()), + actionCollection(), "build_execute_target" ); + action->setToolTip(i18n("Execute subproject")); + action->setWhatsThis(i18n("Execute subproject

Executes the target program for the currently selected subproject. " + "This action is allowed only if a type of the subproject is 'application'. The type of the subproject can be " + "defined in Subproject Settings dialog (open it from the subproject context menu).")); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + + connect( makeFrontend(), SIGNAL(commandFinished(const QString&)), + this, SLOT(slotCommandFinished(const QString&)) ); + + QString m_defaultQtDir = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", ""); + QString m_qmakePath = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", ""); + QString qtversion = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/version", "3"); + + if( m_defaultQtDir.isEmpty() || !isValidQtDir( m_defaultQtDir ) ) + { + m_defaultQtDir = findQtDir(); + kdDebug(9024) << "Setting default dir to: " << m_defaultQtDir << endl; + DomUtil::writeEntry(*projectDom(), "/kdevcppsupport/qt/root", m_defaultQtDir ); + } + if( m_qmakePath.isEmpty() || !isExecutable( m_qmakePath ) ) + { + m_qmakePath = findExecutable( "qmake-qt"+qtversion ); + if( m_qmakePath.isEmpty() || !isExecutable( m_qmakePath ) ) + m_qmakePath = findExecutable( "qmake" ); + kdDebug(9024) << "Setting qmake binary to: " << m_qmakePath << endl; + DomUtil::writeEntry(*projectDom(), "/kdevcppsupport/qt/qmake", m_qmakePath ); + } +} + + +TrollProjectPart::~TrollProjectPart() +{ + if (m_widget) + mainWindow()->removeView(m_widget); + delete m_widget; +} + +QString TrollProjectPart::makeEnvironment() +{ + // Get the make environment variables pairs into the environstr string + // in the form of: "ENV_VARIABLE=ENV_VALUE" + // Note that we quote the variable value due to the possibility of + // embedded spaces + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*projectDom(), "/kdevtrollproject/make/envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + bool hasQtDir = false; + for (it = envvars.begin(); it != envvars.end(); ++it) { + if( (*it).first == "QTDIR" ) + hasQtDir = true; + + environstr += (*it).first; + environstr += "="; + environstr += EnvVarTools::quote((*it).second); + environstr += " "; + } + + if( !hasQtDir && !isQt4Project() && !DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", "").isEmpty() ) + { + environstr += QString( "QTDIR=" ) + EnvVarTools::quote( DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", "") ) + QString( " PATH=$QTDIR/bin:$PATH " ); + } + + KConfigGroup grp( kapp->config(), "MakeOutputView" ); + if( grp.readBoolEntry( "ForceCLocale", true ) ) + environstr += "LC_MESSAGES="+EnvVarTools::quote("C")+" "+" "+"LC_CTYPE="+EnvVarTools::quote("C")+" "; + + return environstr; +} + +void TrollProjectPart::projectConfigWidget(KDialogBase *dlg) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Run Options"), i18n("Run Options"), BarIcon( "make", KIcon::SizeMedium )); + RunOptionsWidget *optdlg = new RunOptionsWidget(*projectDom(), "/kdevtrollproject", buildDirectory(), vbox); + + vbox = dlg->addVBoxPage(i18n("Make Options"), i18n("Make Options"), BarIcon( "make", KIcon::SizeMedium )); + MakeOptionsWidget *w4 = new MakeOptionsWidget(*projectDom(), "/kdevtrollproject", vbox); + + vbox = dlg->addVBoxPage(i18n("QMake Manager"), i18n("QMake Manager"), BarIcon( "make", KIcon::SizeMedium )); + QMakeOptionsWidget *qm = new QMakeOptionsWidget( projectDirectory(), *projectDom(), "/kdevtrollproject", vbox); + + + connect( dlg, SIGNAL(okClicked()), w4, SLOT(accept()) ); + connect( dlg, SIGNAL(okClicked()), qm, SLOT(accept()) ); + connect( dlg, SIGNAL(okClicked()), optdlg, SLOT(accept()) ); +} + + +void TrollProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + mainWindow()->statusBar()->message( i18n("Loading Project...") ); + + QString defaultQtDir = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", ""); + if( !isQt4Project() && ( defaultQtDir.isEmpty() || !isValidQtDir( defaultQtDir ) ) ) + { + bool doask = true; + while( doask ) + { + KURLRequesterDlg dlg( i18n("Choose Qt3 directory"), + i18n("Choose the Qt3 directory to use. This directory needs to have an include directory containing qt.h.") + , m_widget, 0); + dlg.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dlg.urlRequester() ->setURL( QString::null ); + dlg.urlRequester() ->completionObject() ->setDir( "/" ); + + if ( dlg.exec() == QDialog::Accepted && !dlg.urlRequester() ->url().isEmpty() ) + { + QString qtdir = dlg.urlRequester()->url(); + if( !isValidQtDir( qtdir ) ) + { + if( KMessageBox::warningYesNo( m_widget, + i18n("The directory you gave is not a proper Qt directory, the " + "project might not work properly without one.\nPlease make " + "sure you give a directory that contains a bin with the " + "qmake binary in it and for Qt3 project also contains an " + "include directory with qt.h in it.\nDo you want to try " + "setting a Qt directory again?"), + i18n("Wrong Qt directory given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + }else + { + defaultQtDir = qtdir; + doask = false; + } + + }else + { + if( KMessageBox::warningYesNo( m_widget, + i18n("You did not specify a Qt directory, and the project might not " + "work properly without one.\nDo you want to try setting a Qt" + " directory again?"), + i18n("No Qt directory given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + } + } + } + QString qmakePath = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", ""); + if( qmakePath.isEmpty() || !isExecutable( qmakePath ) ) + { + bool doask = true; + while( doask ) + { + KURLRequesterDlg dlg( i18n("Choose QMake executable"), + i18n("Choose the QMake binary to use. QMake is used to generate Makefiles from the project files."), m_widget, 0); + dlg.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dlg.urlRequester() ->setURL( QString::null ); + dlg.urlRequester() ->completionObject() ->setDir( "/" ); + + if ( dlg.exec() == QDialog::Accepted && !dlg.urlRequester() ->url().isEmpty() ) + { + QString qmake = dlg.urlRequester()->url(); + if( !isExecutable( qmake ) ) + { + if( KMessageBox::warningYesNo( m_widget, + i18n("The binary you gave is not executable, the " + "project might not work properly.\nPlease make " + "sure you give a qmake binary that is executable.\nDo you want to try " + "setting the QMake binary again?"), + i18n("Wrong QMake binary given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + }else + { + qmakePath = qmake; + doask = false; + } + + }else + { + if( KMessageBox::warningYesNo( m_widget, + i18n("You did not specify a QMake binary, and the project might not " + "work properly without one.\nDo you want to try setting a QMake" + " binary again?"), + i18n("No QMake binary given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + } + } + } + DomUtil::writeEntry( *projectDom(), "/kdevcppsupport/qt/root", defaultQtDir ); + DomUtil::writeEntry( *projectDom(), "/kdevcppsupport/qt/qmake", qmakePath ); + + m_projectName = projectName; + + m_widget->openProject(dirName); + + + QDomDocument &dom = *projectDom(); + // Set the default directory radio to "executable" + if (DomUtil::readEntry(dom, "/kdevtrollproject/run/directoryradio") == "" ) { + DomUtil::writeEntry(dom, "/kdevtrollproject/run/directoryradio", "executable"); + } + + KDevProject::openProject( dirName, projectName ); +} + + +void TrollProjectPart::closeProject() +{ + m_widget->closeProject(); +} + + +QString TrollProjectPart::projectDirectory() const +{ + return m_widget->projectDirectory(); +} + + +QString TrollProjectPart::buildDirectory() const +{ + return m_widget->projectDirectory(); +} + +QString TrollProjectPart::projectName() const +{ + return m_projectName; +} + + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList TrollProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry(*projectDom(), "/kdevtrollproject/run/envvars", "envvar", "name", "value"); +} + +void TrollProjectPart::slotBuildAndExecuteProject() +{ + partController()->saveAllFiles(); + if (isDirty()) { + m_executeProjectAfterBuild = true; + m_widget->slotBuildProject(); + } else + m_widget->slotExecuteProject(); +} + +void TrollProjectPart::slotBuildAndExecuteTarget() +{ + partController()->saveAllFiles(); + if (isDirty()) { + m_executeTargetAfterBuild = true; + m_widget->slotBuildTarget(); + } else + m_widget->slotExecuteTarget(); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString TrollProjectPart::runDirectory() const +{ + QDomDocument &dom = *projectDom(); + + QString cwd; + if( DomUtil::readBoolEntry(dom, "/kdevtrollproject/run/useglobalprogram", true) ) + { + cwd = defaultRunDirectory("kdevtrollproject"); + }else + { + QString name = m_widget->getCurrentOutputFilename(); + if( name.findRev("/") != -1 ) + name = name.right( name.length()-name.findRev("/")-1 ); + cwd = DomUtil::readEntry( dom, "/kdevtrollproject/run/cwd/" + name ); + } + if( cwd.isEmpty() ) + { + QString destpath = m_widget->getCurrentTarget(); + if( QDir::isRelativePath( destpath ) ) + { + destpath = m_widget->subprojectDirectory() + QString( QChar( QDir::separator() ) ) + destpath; + } + destpath = destpath.left( destpath.findRev("/") ); + cwd = destpath; + } + + return cwd; +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ + + +QString TrollProjectPart::mainProgram() const +{ + + QDomDocument &dom = *projectDom(); + + if( DomUtil::readBoolEntry(dom, "/kdevtrollproject/run/useglobalprogram", false) ) + { + QString DomMainProgram = DomUtil::readEntry(dom, "/kdevtrollproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + }else + { + if( !m_widget->currentSubproject()) + { + KMessageBox::error( m_widget, "There's no selected subproject!\n" + "Unable to determine the main program", "No selected subproject found" ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in TrollProjectPart::mainProgram()" << endl; + return QString::null; + } + + if ( m_widget->currentSubproject()->scope->variableValues("TEMPLATE").findIndex("app") == -1 ) + { + KMessageBox::error( m_widget, "Selected Subproject \""+m_widget->currentSubproject()->scope->projectName()+"\"isn't binary ( " + m_widget->currentSubproject()->scope->variableValues("TEMPLATE").join(" ") + " ) !\n" + "Unable to determine the main program. If you want this\n" + "to be the selected subproject, set a main program under\n" + "Project -> Project Options -> Run Options", "Selected subproject is not a library" ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << m_widget->currentSubproject()->scope->variableValues("TEMPLATE").join(" ") << ") ! -> Unable to determine the main program in TrollProjectPart::mainProgram()" << endl; + return QString::null; + } + + QString destpath = m_widget->getCurrentTarget(); + if( QDir::isRelativePath( destpath ) ) + { + destpath = m_widget->subprojectDirectory() + QString( QChar( QDir::separator() ) ) + destpath; + } + return destpath; + } +} + +QString TrollProjectPart::debugArguments() const +{ + if( DomUtil::readBoolEntry(*projectDom(), "/kdevtrollproject/run/useglobalprogram", true ) ) + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/globaldebugarguments"); + }else + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/debugarguments/"+m_widget->getCurrentOutputFilename() ); + } +} + +/** Retuns a QString with the run command line arguments */ +QString TrollProjectPart::runArguments() const +{ + if( DomUtil::readBoolEntry(*projectDom(), "/kdevtrollproject/run/useglobalprogram", true) ) + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/programargs"); + }else + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/runarguments/"+m_widget->getCurrentOutputFilename() ); + } +} + + +QString TrollProjectPart::activeDirectory() const +{ + QDomDocument &dom = *projectDom(); + + return DomUtil::readEntry(dom, "/kdevtrollproject/general/activedir"); +} + + +QStringList TrollProjectPart::allFiles() const +{ + return m_widget->allFiles(); +} + + +void TrollProjectPart::addFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->addFiles ( QStringList( fileName ) ); +} + +void TrollProjectPart::addFiles ( const QStringList &fileList ) +{ + QStringList files = fileList; + for (QStringList::iterator it = files.begin(); it != files.end(); ++it) + { + if( !QFileInfo( *it ).isRelative() ) + { + *it = URLUtil::relativePathToFile( projectDirectory(), *it ); + } + } + m_widget->addFiles(files); + +} + +void TrollProjectPart::removeFile(const QString & /* fileName */) +{ + /// \FIXME +/* QStringList fileList; + fileList.append ( fileName ); + + this->removeFiles ( fileList );*/ +} + +void TrollProjectPart::removeFiles ( const QStringList& fileList ) +{ +/// \FIXME missing remove files functionality +// QStringList::ConstIterator it; +// +// it = fileList.begin(); +// +// for ( ; it != fileList.end(); ++it ) +// { +// FIXME +// } + + emit removedFilesFromProject ( fileList ); +} +/* +void TrollProjectPart::startMakeCommand(const QString &dir, const QString &target) +{ + partController()->saveAllFiles(); + + QFileInfo fi(dir + "/Makefile"); + if (!fi.exists()) { + int r = KMessageBox::questionYesNo(m_widget, i18n("There is no Makefile in this directory. Run qmake first?"), QString::null, i18n("Run qmake"), i18n("Do Not Run")); + if (r == KMessageBox::No) + return; + startQMakeCommand(dir); + } + QDomDocument &dom = *projectDom(); + + if (target=="clean") + { + QString cmdline = DomUtil::readEntry(dom, "/kdevtrollproject/make/makebin"); + if (cmdline.isEmpty()) + cmdline = MAKE_COMMAND; + cmdline += " clean"; + QString dircmd = "cd "; + dircmd += dir; + dircmd += " && "; + cmdline.prepend(makeEnvironment()); + makeFrontend()->queueCommand(dir, dircmd + cmdline); + } + + QString cmdline = DomUtil::readEntry(dom, "/kdevtrollproject/make/makebin"); + if (cmdline.isEmpty()) + cmdline = MAKE_COMMAND; + if (!DomUtil::readBoolEntry(dom, "/kdevtrollproject/make/abortonerror")) + cmdline += " -k"; + int jobs = DomUtil::readIntEntry(dom, "/kdevtrollproject/make/numberofjobs"); + if (jobs != 0) { + cmdline += " -j"; + cmdline += QString::number(jobs); + } + if (DomUtil::readBoolEntry(dom, "/kdevtrollproject/make/dontact")) + cmdline += " -n"; + + cmdline += " "; + cmdline += target; + + QString dircmd = "cd "; + dircmd += dir; + dircmd += " && "; + + cmdline.prepend(makeEnvironment()); + makeFrontend()->queueCommand(dir, dircmd + cmdline); +} +*/ + +void TrollProjectPart::startQMakeCommand(const QString &dir, bool recursive) +{ + QFileInfo fi(dir); + QString cmdline; + + if ( isTMakeProject() ) + { + cmdline = "tmake "; + }else + { + cmdline = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", "")+" "; + } + + if(isQt4Project() && recursive) + { + cmdline += " -recursive "; + } + + //QString cmdline = QString::fromLatin1( isTMakeProject() ? "tmake " : "qmake " ); +// cmdline += fi.baseName() + ".pro"; + QDir d(dir); + QStringList l = d.entryList("*.pro"); + + if( l.isEmpty() || ( l.count() && l.findIndex( projectName() + ".pro" ) != -1 ) ) + cmdline += projectName()+".pro"; + else if( l.isEmpty() || (l.count() && l.findIndex( fi.baseName() + ".pro" ) != -1 ) ) + cmdline += fi.baseName() + ".pro"; + else + cmdline += l[0]; + +// cmdline += QString::fromLatin1( " -o Makefile" ); + + QString dircmd = "cd "; + dircmd += KProcess::quote(dir); + dircmd += " && "; + + cmdline.prepend(makeEnvironment()); + makeFrontend()->queueCommand(dir, dircmd + cmdline); +} + +void TrollProjectPart::queueCmd(const QString &dir, const QString &cmd) +{ + makeFrontend()->queueCommand(dir, cmd); +} + +void TrollProjectPart::slotCommandFinished( const QString& command ) +{ + Q_UNUSED( command ); + +// if( m_buildCommand != command ) +// return; +// +// m_buildCommand = QString::null; + + m_timestamp.clear(); + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + m_timestamp[ fileName ] = QFileInfo( projectDirectory(), fileName ).lastModified(); + } + + emit projectCompiled(); + + if( m_executeProjectAfterBuild ) + { + m_widget->slotExecuteProject(); + m_executeProjectAfterBuild = false; + }else if( m_executeTargetAfterBuild ) + { + m_widget->slotExecuteTarget(); + m_executeTargetAfterBuild = false; + } + +} + +bool TrollProjectPart::isDirty() +{ + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + QMap::Iterator it = m_timestamp.find( fileName ); + QDateTime t = QFileInfo( projectDirectory(), fileName ).lastModified(); + if( it == m_timestamp.end() || *it != t ){ + return true; + } + } + + return false; +} + +KDevProject::Options TrollProjectPart::options( ) const +{ + return UsesQMakeBuildSystem; +} + +bool TrollProjectPart::isValidQtDir( const QString& path ) const +{ + QFileInfo inc( path + QString( QChar( QDir::separator() ) )+ + "include"+QString( QChar( QDir::separator() ) )+ + "qt.h" ); + return ( isQt4Project() || ( !isQt4Project() && inc.exists() ) ); +} + +void TrollProjectPart::buildBinDirs( QStringList & dirs ) const +{ + if( !isQt4Project() ) + { + QString m_defaultQtDir = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", ""); + if( !m_defaultQtDir.isEmpty() ) + dirs << (m_defaultQtDir + QString( QChar( QDir::separator() ) ) + "bin" ); + dirs << ( ::getenv("QTDIR") + QString( QChar( QDir::separator() ) ) + "bin" ); + } + QStringList paths = QStringList::split(":",::getenv("PATH")); + dirs += paths; + QString binpath = QDir::rootDirPath() + "bin"; + if( dirs.findIndex( binpath ) != -1 ) + dirs << binpath; + + binpath = QDir::rootDirPath() + "usr" + QString( QChar( QDir::separator() ) ) + "bin"; + if( dirs.findIndex( binpath ) != -1 ) + dirs << binpath; + binpath = QDir::rootDirPath() + "usr" + QString( QChar( QDir::separator() ) ) + "local" + QString( QChar( QDir::separator() ) ) + "bin"; + if( dirs.findIndex( binpath ) != -1 ) + dirs << binpath; +} + + +QString TrollProjectPart::findExecutable( const QString& execname ) const +{ + QStringList dirs; + buildBinDirs( dirs ); + + for( QStringList::Iterator it=dirs.begin(); it!=dirs.end(); ++it ) + { + QString designer = *it + QString( QChar( QDir::separator() ) ) + execname; + if( !designer.isEmpty() && isExecutable( designer ) ) + { + return designer; + } + } + return ""; +} + +bool TrollProjectPart::isExecutable( const QString& path ) const +{ + QFileInfo fi(path); + return( fi.exists() && fi.isExecutable() ); +} + +QString TrollProjectPart::findQtDir() +{ + QStringList qtdirs; + if( !isQt4Project() ) + qtdirs.push_back( ::getenv("QTDIR") ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"lib"+QString( QChar( QDir::separator() ) )+"qt"+QString("%1").arg( DomUtil::readEntry( *projectDom(), "/kdevcppsupport/qt/version", "3") ) ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"lib"+QString( QChar( QDir::separator() ) )+"qt"+QString( QChar( QDir::separator() ) )+QString("%1").arg( DomUtil::readEntry( *projectDom(), "/kdevcppsupport/qt/version", "3") ) ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"share"+QString( QChar( QDir::separator() ) )+"qt"+QString("%1").arg( DomUtil::readEntry( *projectDom(), "/kdevcppsupport/qt/version", "3") ) ); + qtdirs.push_back( QDir::rootDirPath()+"usr" ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"lib"+QString( QChar( QDir::separator() ) )+"qt" ); + + for( QStringList::Iterator it=qtdirs.begin(); it!=qtdirs.end(); ++it ) + { + QString qtdir = *it; + if( !qtdir.isEmpty() && isValidQtDir(qtdir) ) + { + return qtdir; + } + } + return ""; +} + + +QStringList recursiveProFind( const QString &currDir, const QString &baseDir ) +{ + QStringList fileList; + + if( !currDir.contains( QString( QChar ( QDir::separator() ) ) +".." ) + && !currDir.contains( QString( QChar( QDir::separator() ) )+".") ) + { + QDir dir(currDir); + QStringList dirList = dir.entryList(QDir::Dirs ); + QStringList::Iterator idx = dirList.begin(); + for( ; idx != dirList.end(); ++idx ) + { + fileList += recursiveProFind( currDir + QString( QChar( QDir::separator() ) ) + (*idx),baseDir ); + } + QStringList newFiles = dir.entryList("*.pro *.PRO"); + idx = newFiles.begin(); + for( ; idx != newFiles.end(); ++idx ) + { + QString file = currDir + QString( QChar( QDir::separator() ) ) + (*idx); + fileList.append( file.remove( baseDir ) ); + } + } + + + return fileList; +} + +/*! + \fn TrollProjectPart::distFiles() const + */ +QStringList TrollProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QStringList files = recursiveProFind( projectDir, projectDir + QString( QChar( QDir::separator() ) ) ); + return sourceList + files; +} + +bool TrollProjectPart::isQt4Project() const +{ + return ( DomUtil::readIntEntry( *projectDom(), "kdevcppsupport/qt/version", 3 ) == 4 ); +} + +KDirWatch* TrollProjectPart::dirWatch() +{ + return m_dirWatch; +} + +void TrollProjectPart::slotBuild() +{ + m_widget->slotBuildProject(); +} + +#include "trollprojectpart.moc" + +//kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + + diff --git a/buildtools/qmake/trollprojectpart.h b/buildtools/qmake/trollprojectpart.h new file mode 100644 index 00000000..3e571e85 --- /dev/null +++ b/buildtools/qmake/trollprojectpart.h @@ -0,0 +1,105 @@ +/*************************************************************************** + * Copyright (C) 2003 by Thomas Hasart * + * thasart@gmx.de * + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jakob@jsg.dk * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _TROLLPROJECTPART_H_ +#define _TROLLPROJECTPART_H_ + +#include +#include +#include +#include + +#include "kdevbuildtool.h" + +class KDialogBase; +class TrollProjectWidget; +class KDirWatch; +class QMakeDefaultOpts; + +class TrollProjectPart : public KDevBuildTool +{ + Q_OBJECT + +public: + TrollProjectPart( QObject *parent, const char *name, const QStringList &args ); + ~TrollProjectPart(); + + bool isTMakeProject() const { return m_tmakeProject; } + bool isQt4Project() const; + bool isDirty(); + KDirWatch* dirWatch(); + virtual Options options() const; + QStringList distFiles() const; + inline QString qmakePath() const { return DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", "");; } + +protected: + virtual void openProject(const QString &dirName, const QString &projectName); + virtual void closeProject(); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString mainProgram() const; + virtual QString activeDirectory() const; + virtual QStringList allFiles() const; + virtual void addFile(const QString &fileName); + virtual void addFiles ( const QStringList &fileList ); + virtual void removeFile(const QString &fileName); + virtual void removeFiles ( const QStringList &fileList ); + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + +private slots: + void projectConfigWidget(KDialogBase *dlg); + void slotBuild(); +// void slotClean(); +// void slotExecute(); + void slotCommandFinished( const QString& command ); + void slotBuildAndExecuteProject(); + void slotBuildAndExecuteTarget(); + +private: +// void startMakeCommand(const QString &dir, const QString &target); + void startQMakeCommand(const QString &dir, bool recursive = false ); +// void execute(const QString &directory, const QString &command); + void queueCmd(const QString &dir, const QString &cmd); + QString makeEnvironment(); + + QString findQtDir(); + QString findExecutable( const QString& path ) const; + void buildBinDirs( QStringList& ) const; + bool isValidQtDir( const QString& path ) const; + bool isExecutable( const QString& path ) const; + + QGuardedPtr m_widget; + QString m_projectName; + bool m_tmakeProject; + + QMap m_timestamp; + bool m_executeProjectAfterBuild; + bool m_executeTargetAfterBuild; + QString m_buildCommand; + + KDirWatch* m_dirWatch; + + friend class TrollProjectWidget; + friend class ProjectRunOptionsDlg; + friend class QMakeDefaultOpts; +}; + +#endif + diff --git a/buildtools/qmake/trollprojectwidget.cpp b/buildtools/qmake/trollprojectwidget.cpp new file mode 100644 index 00000000..7668dbd7 --- /dev/null +++ b/buildtools/qmake/trollprojectwidget.cpp @@ -0,0 +1,2547 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2000-2001 by Trolltech AS. * +* info@trolltech.com * +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jakob@jsg.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* Part of this file is taken from Qt Designer. * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "trollprojectwidget.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kdevcore.h" +#include "kdevpartcontroller.h" +#include "kdevmainwindow.h" +#include "trollprojectpart.h" +#include "kdevappfrontend.h" +#include "kdevmakefrontend.h" +#include "kdevlanguagesupport.h" +#include "kdevcreatefile.h" +#include "subclassesdlg.h" +#include "addfilesdialog.h" +#include "urlutil.h" +#include "trolllistview.h" +#include "projectconfigurationdlg.h" +#include "qmakescopeitem.h" +#include "scope.h" +#include "createscopedlg.h" +#include "disablesubprojectdlg.h" +#include + +TrollProjectWidget::TrollProjectWidget( TrollProjectPart *part ) + : QVBox( 0, "troll project widget" ), m_shownSubproject( 0 ), m_rootSubproject( 0 ), + m_rootScope ( 0 ), m_part ( part ), m_configDlg( 0 ), m_filesCached(false) +{ + + QSplitter * splitter = new QSplitter( Vertical, this ); + + ////////////////// + // PROJECT VIEW // + ////////////////// + + overviewContainer = new QVBox( splitter, "Projects" ); + overviewContainer->setMargin ( 2 ); + overviewContainer->setSpacing ( 2 ); + // overviewContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); + // splitter->setResizeMode(overviewContainer, QSplitter::FollowSizeHint); + + projectTools = new QHBox( overviewContainer, "Project buttons" ); + projectTools->setMargin ( 2 ); + projectTools->setSpacing ( 2 ); + // Add subdir + addSubdirButton = new QToolButton ( projectTools, "Add subproject button" ); + addSubdirButton->setPixmap ( SmallIcon ( "folder_new" ) ); + addSubdirButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, addSubdirButton->sizePolicy().hasHeightForWidth() ) ); + addSubdirButton->setEnabled ( true ); + QToolTip::add( addSubdirButton, i18n( "Add subproject" ) ); + QWhatsThis::add( addSubdirButton, i18n( "Add subproject

Creates a new or adds an existing subproject to a currently selected subproject. " + "This action is allowed only if a type of the subproject is 'subdirectories'. The type of the subproject can be " + "defined in Subproject Settings dialog (open it from the subproject context menu)." ) ); + // Create scope + createScopeButton = new QToolButton ( projectTools, "Create scope button" ); + createScopeButton->setPixmap ( SmallIcon ( "qmake_scopenew" ) ); + createScopeButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, createScopeButton->sizePolicy().hasHeightForWidth() ) ); + createScopeButton->setEnabled ( true ); + QToolTip::add( createScopeButton, i18n( "Create scope" ) ); + QWhatsThis::add( createScopeButton, i18n( "Create scope

Creates QMake scope in the project file in case the subproject is selected or creates nested scope in case the scope is selected." ) ); + + // build + buildProjectButton = new QToolButton ( projectTools, "Make button" ); + buildProjectButton->setPixmap ( SmallIcon ( "make_kdevelop" ) ); + buildProjectButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, buildProjectButton->sizePolicy().hasHeightForWidth() ) ); + buildProjectButton->setEnabled ( true ); + QToolTip::add( buildProjectButton, i18n( "Build project" ) ); + QWhatsThis::add( buildProjectButton, i18n( "Build project

Runs make from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + // rebuild + rebuildProjectButton = new QToolButton ( projectTools, "Rebuild button" ); + rebuildProjectButton->setPixmap ( SmallIcon ( "rebuild" ) ); + rebuildProjectButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, rebuildProjectButton->sizePolicy().hasHeightForWidth() ) ); + rebuildProjectButton->setEnabled ( true ); + QToolTip::add( rebuildProjectButton, i18n( "Rebuild project" ) ); + QWhatsThis::add( rebuildProjectButton, i18n( "Rebuild project

Runs make clean and then make from the project directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + // run + executeProjectButton = new QToolButton ( projectTools, "Run button" ); + executeProjectButton->setPixmap ( SmallIcon ( "exec" ) ); + executeProjectButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, executeProjectButton->sizePolicy().hasHeightForWidth() ) ); + executeProjectButton->setEnabled ( true ); + QToolTip::add( executeProjectButton, i18n( "Execute main program" ) ); + QWhatsThis::add( executeProjectButton, i18n( "Execute main program

Executes the main program specified in project settings, Run Options tab." ) ); + // spacer + QWidget *spacer = new QWidget( projectTools ); + projectTools->setStretchFactor( spacer, 1 ); + // Project configuration + projectconfButton = new QToolButton ( projectTools, "Project configuration button" ); + projectconfButton->setPixmap ( SmallIcon ( "configure" ) ); + projectconfButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, projectconfButton->sizePolicy().hasHeightForWidth() ) ); + projectconfButton->setEnabled ( true ); + QToolTip::add( projectconfButton, i18n( "Subproject settings" ) ); + QWhatsThis::add( projectconfButton, i18n( "Subproject settings

Opens QMake Subproject Configuration dialog for the currently selected subproject. " + "It provides settings for:
subproject type and configuration,
include and library paths,
lists of dependencies and " + "external libraries,
build order,
intermediate files locations,
compiler options." ) ); + + // Project button connections + connect ( addSubdirButton, SIGNAL ( clicked () ), this, SLOT ( slotAddSubproject () ) ); + connect ( createScopeButton, SIGNAL ( clicked () ), this, SLOT ( slotCreateScope () ) ); + + + connect ( buildProjectButton, SIGNAL ( clicked () ), this, SLOT ( slotBuildProject () ) ); + connect ( rebuildProjectButton, SIGNAL ( clicked () ), this, SLOT ( slotRebuildProject () ) ); + connect ( executeProjectButton, SIGNAL ( clicked () ), m_part, SLOT ( slotBuildAndExecuteProject () ) ); + + + connect ( projectconfButton, SIGNAL ( clicked () ), this, SLOT ( slotConfigureProject () ) ); + + // Project tree + overview = new TrollListView( this, overviewContainer, SubprojectView, "project overview widget" ); +// overview->setResizeMode( QListView::LastColumn ); + overview->setSorting( -1 ); + overview->header() ->hide(); + overview->addColumn( QString::null ); + + // Project tree connections + connect( overview, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotOverviewSelectionChanged( QListViewItem* ) ) ); + connect( overview, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), + this, SLOT( slotOverviewContextMenu( KListView*, QListViewItem*, const QPoint& ) ) ); + + + ///////////////// + // DETAIL VIEW // + ///////////////// + + // Details tree + detailContainer = new QVBox( splitter, "Details" ); + detailContainer->setMargin ( 2 ); + detailContainer->setSpacing ( 2 ); + // detailContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + + // Details Toolbar + fileTools = new QHBox( detailContainer, "Detail buttons" ); + fileTools->setMargin ( 2 ); + fileTools->setSpacing ( 2 ); + + // Add new file button + newfileButton = new QToolButton ( fileTools, "Create new file" ); + newfileButton->setPixmap ( SmallIcon ( "filenew" ) ); + newfileButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, newfileButton->sizePolicy().hasHeightForWidth() ) ); + newfileButton->setEnabled ( true ); + QToolTip::add( newfileButton, i18n( "Create new file" ) ); + QWhatsThis::add( newfileButton, i18n( "Create new file

Creates a new file and adds it to a currently selected group." ) ); + + // Add existing files button + addfilesButton = new QToolButton ( fileTools, "Add existing files" ); + addfilesButton->setPixmap ( SmallIcon ( "fileimport" ) ); + addfilesButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, addfilesButton->sizePolicy().hasHeightForWidth() ) ); + addfilesButton->setEnabled ( true ); + QToolTip::add( addfilesButton, i18n( "Add existing files" ) ); + QWhatsThis::add( addfilesButton, i18n( "Add existing files

Adds existing files to a currently selected group. It is " + "possible to copy files to a current subproject directory, create symbolic links or " + "add them with the relative path." ) ); + + // remove file button + removefileButton = new QToolButton ( fileTools, "Remove file" ); + removefileButton->setPixmap ( SmallIcon ( "button_cancel" ) ); + removefileButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, removefileButton->sizePolicy().hasHeightForWidth() ) ); + removefileButton->setEnabled ( true ); + QToolTip::add( removefileButton, i18n( "Remove file" ) ); + QWhatsThis::add( removefileButton, i18n( "Remove file

Removes file from a current group. Does not remove file from disk." ) ); + + // build selected file + buildFileButton = new QToolButton ( fileTools, "Make file button" ); + buildFileButton->setPixmap ( SmallIcon ( "compfile" ) ); + buildFileButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, buildFileButton->sizePolicy().hasHeightForWidth() ) ); + buildFileButton->setEnabled ( true ); + QToolTip::add( buildFileButton, i18n( "Compile file" ) ); + QWhatsThis::add( buildFileButton, i18n( "Compile file

Runs make filename.o command from the directory where 'filename' is the name of currently opened file.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + // build + buildTargetButton = new QToolButton ( fileTools, "Make sp button" ); + buildTargetButton->setPixmap ( SmallIcon ( "make_kdevelop" ) ); + buildTargetButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, buildTargetButton->sizePolicy().hasHeightForWidth() ) ); + buildTargetButton->setEnabled ( true ); + QToolTip::add( buildTargetButton, i18n( "Build subproject" ) ); + QWhatsThis::add( buildTargetButton, i18n( "Build subproject

Runs make from the current subproject directory. " + "Current subproject is a subproject selected in QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + // rebuild + rebuildTargetButton = new QToolButton ( fileTools, "Rebuild sp button" ); + rebuildTargetButton->setPixmap ( SmallIcon ( "rebuild" ) ); + rebuildTargetButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, rebuildTargetButton->sizePolicy().hasHeightForWidth() ) ); + rebuildTargetButton->setEnabled ( true ); + QToolTip::add( rebuildTargetButton, i18n( "Rebuild subproject" ) ); + QWhatsThis::add( rebuildTargetButton, i18n( "Rebuild subproject

Runs make clean and then make from the current subproject directory. " + "Current subproject is a subproject selected in QMake manager 'overview' window.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + // run + executeTargetButton = new QToolButton ( fileTools, "Run sp button" ); + executeTargetButton->setPixmap ( SmallIcon ( "exec" ) ); + executeTargetButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, executeTargetButton->sizePolicy().hasHeightForWidth() ) ); + executeTargetButton->setEnabled ( true ); + QToolTip::add( executeTargetButton, i18n( "Execute subproject" ) ); + QWhatsThis::add( executeTargetButton, i18n( "Execute subproject

Executes the target program for the currently selected subproject. " + "This action is allowed only if a type of the subproject is 'application'. The type of the subproject can be " + "defined in Subproject Settings dialog (open it from the subproject context menu)." ) ); + + + // spacer + spacer = new QWidget( fileTools ); + projectTools->setStretchFactor( spacer, 1 ); + + // Configure file button + excludeFileFromScopeButton = new QToolButton ( fileTools, "Exclude file" ); + excludeFileFromScopeButton->setPixmap ( SmallIcon ( "configure_file" ) ); + excludeFileFromScopeButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, excludeFileFromScopeButton->sizePolicy().hasHeightForWidth() ) ); + excludeFileFromScopeButton->setEnabled ( true ); + QToolTip::add( excludeFileFromScopeButton , i18n( "Exclude file" ) ); + QWhatsThis::add( excludeFileFromScopeButton , i18n( "Exclude file

Exclude the selected file from this scope." ) ); + + // detail tree + details = new TrollListView( this, detailContainer, DetailsView, "details widget" ); + details->setRootIsDecorated( true ); + details->setResizeMode( QListView::LastColumn ); + details->setSorting( -1 ); + details->header() ->hide(); + details->addColumn( QString::null ); + // Detail button connections + connect ( addfilesButton, SIGNAL ( clicked () ), this, SLOT ( slotAddFiles () ) ); + connect ( newfileButton, SIGNAL ( clicked () ), this, SLOT ( slotNewFile () ) ); + connect ( removefileButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveFile () ) ); + connect ( buildFileButton, SIGNAL ( clicked () ), this, SLOT ( slotBuildSelectedFile () ) ); + connect ( excludeFileFromScopeButton, SIGNAL ( clicked () ), this, SLOT ( slotExcludeFileFromScopeButton() ) ); + + // Detail tree connections + connect( details, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotDetailsSelectionChanged( QListViewItem* ) ) ); + connect( details, SIGNAL( executed( QListViewItem* ) ), + this, SLOT( slotDetailsExecuted( QListViewItem* ) ) ); + connect( details, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), + this, SLOT( slotDetailsContextMenu( KListView*, QListViewItem*, const QPoint& ) ) ); + + connect ( buildTargetButton, SIGNAL ( clicked () ), this, SLOT ( slotBuildTarget () ) ); + connect ( rebuildTargetButton, SIGNAL ( clicked () ), this, SLOT ( slotRebuildTarget () ) ); + connect ( executeTargetButton, SIGNAL ( clicked () ), m_part, SLOT ( slotBuildAndExecuteTarget () ) ); + buildTargetButton->setEnabled( false ); + rebuildTargetButton->setEnabled( false ); + executeTargetButton->setEnabled( false ); + + m_configDlg = new ProjectConfigurationDlg( overview, this, this ); + + connect( m_part->dirWatch(), SIGNAL( dirty(const QString&) ), this, SLOT( slotProjectDirty(const QString&) ) ); +} + + +TrollProjectWidget::~TrollProjectWidget() +{ + delete m_configDlg; +} + + +void TrollProjectWidget::openProject( const QString &dirName ) +{ + QDomDocument & dom = *( m_part->projectDom() ); + m_subclasslist = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + + QString projectfile = DomUtil::readEntry( dom, "/kdevtrollproject/qmake/projectfile", "" ); + + m_showFilenamesOnly = DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/enableFilenamesOnly", false ); + m_showVariablesInTree = DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/showVariablesInTree", true ); + + QString proname; + + if( projectfile.isEmpty() ) + { + QFileInfo fi( dirName ); + QDir dir( dirName ); + // QString proname = item->path + "/" + fi.baseName() + ".pro"; + + QStringList l = dir.entryList( "*.pro" ); + + QString profile; + if( l.count() && l.findIndex( m_part->projectName() + ".pro") != -1 ) + profile = m_part->projectName()+".pro"; + else if( l.isEmpty() || ( l.count() && l.findIndex( fi.baseName() + ".pro") != -1 ) ) + profile = fi.baseName()+".pro"; + else + profile = l[0]; + + proname = dirName + QString( QChar( QDir::separator() ) ) + profile; + } else + { + proname = projectfile; + } + + kdDebug( 9024 ) << "Parsing " << proname << endl; + + m_rootScope = new Scope( qmakeEnvironment(), proname, m_part ); + if( m_rootScope->scopeType() != Scope::InvalidScope ) + { + + m_rootSubproject = new QMakeScopeItem( overview, m_rootScope->scopeName(), m_rootScope, this ); + + + m_rootSubproject->setOpen( true ); + if ( m_rootSubproject->firstChild() && m_rootSubproject->scope->variableValues( "TEMPLATE" ).findIndex("subdirs") != -1 ) + { + overview->setSelected( m_rootSubproject->firstChild(), true ); + } + else + { + overview->setSelected( m_rootSubproject, true ); + } + }else + { + delete m_rootScope; + m_rootScope = 0; + } +// kdDebug(9024) << "Adding " << allFiles().count() << " Files" << endl; +// kdDebug(9024) << allFiles() << endl; + +} + +void TrollProjectWidget::createQMakeScopeItems() +{ + +} + +void TrollProjectWidget::closeProject() +{ + m_rootSubproject = 0; + overview->clear(); + details->clear(); + delete m_rootScope; +} + +QStringList TrollProjectWidget::allFiles() +{ + if( !m_rootScope ) + return QStringList(); + if( m_filesCached ) + return m_allFilesCache; + m_allFilesCache = m_rootScope->allFiles( m_rootScope->projectDir() ); + m_filesCached = true; + return m_allFilesCache; +} + +QString TrollProjectWidget::projectDirectory() +{ + if ( !m_rootScope ) + return QString::null; //confused + + return m_rootScope->projectDir(); +} + + +QString TrollProjectWidget::subprojectDirectory() +{ + if ( !m_shownSubproject ) + return QString::null; + + return m_shownSubproject->scope->projectDir(); +} + +void TrollProjectWidget::setupContext() +{ + if ( !m_shownSubproject ) + return ; + bool buildable = true; + bool runable = true; + bool fileconfigurable = true; + bool hasSourceFiles = true; + bool hasSubdirs = false; + + QStringList tmpl = m_shownSubproject->scope->variableValues( "TEMPLATE" ); + + if ( tmpl.findIndex( "lib" ) != -1 ) + { + runable = false; + } + else if ( tmpl.findIndex( "subdirs" ) != -1 ) + { + hasSubdirs = true; + runable = false; + hasSourceFiles = false; + fileconfigurable = false; + } + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + { + runable = false; + buildable = false; + } + + + // Setup toolbars according to context + addSubdirButton->setEnabled( hasSubdirs ); + buildTargetButton->setEnabled( buildable ); + m_part->actionCollection() ->action( "build_build_target" ) ->setEnabled( buildable ); + + rebuildTargetButton->setEnabled( buildable ); + m_part->actionCollection() ->action( "build_rebuild_target" ) ->setEnabled( buildable ); + + executeTargetButton->setEnabled( runable ); + m_part->actionCollection() ->action( "build_execute_target" ) ->setEnabled( runable ); + + excludeFileFromScopeButton->setEnabled( !hasSubdirs ); + newfileButton->setEnabled( !hasSubdirs ); + removefileButton->setEnabled( !hasSubdirs ); + addfilesButton->setEnabled( !hasSubdirs ); + buildFileButton->setEnabled( !hasSubdirs ); + + details->setEnabled( hasSourceFiles ); +} + +void TrollProjectWidget::slotOverviewSelectionChanged( QListViewItem *item ) +{ + QString olddir = m_part->activeDirectory(); + if ( !item ) + { + kdDebug(9024) << "Trying to select a non-existing item" << endl; + return ; + } + cleanDetailView( m_shownSubproject ); + m_shownSubproject = static_cast( item ); + setupContext(); + buildProjectDetailTree( m_shownSubproject, details ); + + QDomDocument &dom = *( m_part->projectDom() ); + DomUtil::writeEntry( dom, "/kdevtrollproject/general/activedir", m_shownSubproject->relativePath() ); + if ( m_configDlg && m_configDlg->isShown() ) + { + m_configDlg->updateSubproject( m_shownSubproject ); + } + emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() ); +} + +QString TrollProjectWidget::getCurrentTarget() +{ + if ( !m_shownSubproject ) + return ""; + QString destdir = getCurrentDestDir(); + if ( destdir.isEmpty() ) + return getCurrentOutputFilename(); + else + return destdir + QString( QChar( QDir::separator() ) ) + getCurrentOutputFilename(); +} + +QString TrollProjectWidget::getCurrentDestDir() +{ + if ( !m_shownSubproject ) + return ""; + QStringList destdir = m_shownSubproject->scope->variableValues( "DESTDIR", true, true, true ); + return m_shownSubproject->scope->resolveVariables(m_shownSubproject->scope->variableValues( "DESTDIR", true, true, true ).front()); +} + +QString TrollProjectWidget::getCurrentOutputFilename() +{ + if ( !m_shownSubproject ) + return ""; + if ( m_shownSubproject->scope->variableValues( "TARGET", true, true, true ).isEmpty() ) + { + QString exe = m_shownSubproject->scope->resolveVariables(m_shownSubproject->scope->fileName()); + return exe.replace( QRegExp( "\\.pro$" ), "" ); + } + else + { + return m_shownSubproject->scope->resolveVariables(m_shownSubproject->scope->variableValues( "TARGET", true, true, true ).front()); + } +} + +void TrollProjectWidget::cleanDetailView( QMakeScopeItem *item ) +{ + // If no children in detailview + // it is a subdir template + if ( item && details->childCount() ) + { + QListViewItem* i = details->firstChild(); + while( i ) + { + QListViewItem* old = i; + i = i->nextSibling(); + details->takeItem(old); + } +// QMapIterator it1 = item->groups.begin() ; +// for ( ; it1 != item->groups.end(); ++it1 ) +// { +// // After AddTargetDialog, it can happen that an +// // item is not yet in the list view, so better check... +// if ( it1.data() ->parent() ) +// while ( it1.data() ->firstChild() ) +// it1.data() ->takeItem( it1.data() ->firstChild() ); +// details->takeItem( it1.data() ); +// } + } +} + +void TrollProjectWidget::buildProjectDetailTree( QMakeScopeItem *item, KListView *listviewControl ) +{ + + // Insert all GroupItems and all of their children into the view + if ( !listviewControl || item->scope->variableValues( "TEMPLATE" ).findIndex("subdirs") != -1 ) + return ; + + QMapIterator it2 = item->groups.begin(); + QListViewItem* lastItem = 0; + for ( ; it2 != item->groups.end(); ++it2 ) + { + listviewControl->insertItem( it2.data() ); + if(lastItem) + it2.data()->moveItem(lastItem); + lastItem = it2.data(); + if ( it2.key() == GroupItem::InstallRoot ) + { + QListViewItem* lastinstallitem = 0; + QPtrListIterator it3( it2.data() ->installs ); + for ( ; it3.current(); ++it3 ) + { + it2.data() ->insertItem( *it3 ); + if ( lastinstallitem ) + it3.current()->moveItem(lastinstallitem); + lastinstallitem = it3.current(); + QPtrListIterator it4( ( *it3 ) ->files ); + QListViewItem* lastfileitem = 0; + for ( ; it4.current(); ++it4 ) + { + ( *it3 ) ->insertItem( *it4 ); + if ( lastfileitem ) + it4.current()->moveItem(lastfileitem); + lastfileitem = it4.current(); + } + ( *it3 ) ->setOpen( true ); + ( *it3 ) ->sortChildItems( 0, true ); + } + it2.data() ->setOpen( true ); + it2.data() ->sortChildItems( 0, true ); + } + else + { + QPtrListIterator it3( it2.data() ->files ); + QListViewItem* lastfileitem = 0; + for ( ; it3.current(); ++it3 ) + { + it2.data() ->insertItem( *it3 ); + if ( lastfileitem ) + it3.current()->moveItem(lastfileitem); + lastfileitem = it3.current(); + } + it2.data() ->setOpen( true ); + it2.data() ->sortChildItems( 0, true ); + } + } + listviewControl->setSelected( listviewControl->selectedItem(), false ); + listviewControl->setCurrentItem( 0 ); +} + +void TrollProjectWidget::slotDetailsExecuted( QListViewItem *item ) +{ + if ( !item ) + return ; + + // We assume here that ALL items in both list views + // are qProjectItem's + qProjectItem *pvitem = static_cast( item ); + if ( pvitem->type() != qProjectItem::File ) + return ; + + FileItem *fitem = static_cast( pvitem ); + + QString filePath; + if( m_shownSubproject->scope->scopeType() == Scope::IncludeScope ) + { + filePath = m_shownSubproject->scope->parent()->projectDir(); + }else + { + filePath = m_shownSubproject->scope->projectDir(); + } + filePath += QChar( QDir::separator() ) + m_shownSubproject->scope->resolveVariables( fitem->localFilePath ); + + bool isUiFile = QFileInfo( fitem->text( 0 ) ).extension() == "ui"; + kdDebug(9024) << "Opening file: " << filePath << endl; + if ( isTMakeProject() && isUiFile ) + { + // start designer in your PATH + KShellProcess proc; + proc << "designer" << filePath; + proc.start( KProcess::DontCare, KProcess::NoCommunication ); + } + else + m_part->partController() ->editDocument( KURL( filePath ) ); +} + + +void TrollProjectWidget::slotConfigureProject() +{ + m_configDlg->updateSubproject( m_shownSubproject ); + m_configDlg->show(); +} + +void TrollProjectWidget::slotExecuteTarget() +{ + //m_part->slotExecute(); + // no subproject selected + if ( !m_shownSubproject ) + return ; + + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + + + + // Only run application projects + if ( !m_shownSubproject->scope->variableValues( "TEMPLATE" ).isEmpty() && m_shownSubproject->scope->variableValues( "TEMPLATE" ).findIndex( "app" ) == -1 ) + return ; + + //only run once + if (m_part->appFrontend()->isRunning()) + { + if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) + return; + m_part->appFrontend()->stopApplication(); + while(m_part->appFrontend()->isRunning()) + { + KApplication::kApplication()->processEvents(); + usleep(100); + } + } + + + QString program = KProcess::quote( "." + QString( QChar( QDir::separator() ) ) + getCurrentOutputFilename() ); + + // Build environment variables to prepend to the executable path + QString runEnvVars = QString::null; + DomUtil::PairList list = + DomUtil::readPairListEntry( *( m_part->projectDom() ), "/kdevtrollproject/run/envvars", "envvar", "name", "value" ); + + DomUtil::PairList::ConstIterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + const DomUtil::Pair &pair = ( *it ); + if ( ( !pair.first.isEmpty() ) && ( !pair.second.isEmpty() ) ) + runEnvVars += pair.first + "=" + pair.second + " "; + } + program.prepend( runEnvVars ); + + program.append( " " + m_part->runArguments() + " " ); + // std::cerr<execute(dircmd + "./"+program); + // m_part->appFrontend()->startAppCommand(dircmd +"./"+program,true); + + bool inTerminal = DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/run/terminal" ); + + m_part->appFrontend() ->startAppCommand( subprojectDirectory() + QString( QChar( QDir::separator() ) ) + getCurrentDestDir(), program, inTerminal ); + +} + +void TrollProjectWidget::slotBuildProject() +{ + if ( m_part->partController() ->saveAllFiles() == false ) + return ; //user cancelled + + QString dir = projectDirectory(); + + if ( !m_rootSubproject ) + return ; + + createMakefileIfMissing( dir, m_rootSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_rootSubproject->scope ); + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotInstallProject() +{ + if ( m_part->partController() ->saveAllFiles() == false ) + return ; //user cancelled + + QString dir = projectDirectory(); + + if ( !m_rootSubproject ) + return ; + + createMakefileIfMissing( dir, m_rootSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_rootSubproject->scope ) + " install"; + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotBuildTarget() +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !m_shownSubproject ) + return ; + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + QString dir = subprojectDirectory(); + createMakefileIfMissing( dir, m_shownSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_shownSubproject->scope ); + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotInstallTarget() +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !m_shownSubproject ) + return ; + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + QString dir = subprojectDirectory(); + createMakefileIfMissing( dir, m_shownSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_shownSubproject->scope ) + " install"; + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotRebuildProject() +{ + m_part->partController() ->saveAllFiles(); + QString dir = this-> projectDirectory(); + + if ( !m_rootSubproject ) + return ; + + createMakefileIfMissing( dir, m_rootSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString rebuildcmd = constructMakeCommandLine( m_rootSubproject->scope ) + " clean && " + constructMakeCommandLine( m_rootSubproject->scope ); + m_part->queueCmd( dir, dircmd + rebuildcmd ); +} + +void TrollProjectWidget::slotRebuildTarget() +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !m_shownSubproject ) + return ; + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + + QString dir = subprojectDirectory(); + createMakefileIfMissing( dir, m_shownSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString rebuildcmd = constructMakeCommandLine( m_shownSubproject->scope ) + " clean && " + constructMakeCommandLine( m_shownSubproject->scope ); + m_part->queueCmd( dir, dircmd + rebuildcmd ); +} + +void TrollProjectWidget::slotCreateScope( QMakeScopeItem *spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else + spitem = m_shownSubproject; + CreateScopeDlg dlg( spitem, this ); + if ( dlg.exec() == QDialog::Accepted ) + { + spitem->scope->saveToFile( ); + spitem->sortChildItems( 0, true ); + } + return ; +} + +void TrollProjectWidget::slotAddSubproject( QMakeScopeItem *spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else + spitem = m_shownSubproject; + + m_filesCached = false; + m_allFilesCache.clear(); + + QString projectdir = spitem->scope->projectDir(); + + KURLRequesterDlg dialog( i18n( "Add Subproject" ), i18n( "Please enter a name for the subproject: " ), this, 0 ); + KURLRequester* req = dialog.urlRequester(); + req->setMode( KFile::Directory | KFile::File | KFile::LocalOnly ); + req->setFilter( "*.pro|QMake Project Files (*.pro)" ); + req->setURL( QString() ); + req->fileDialog()->setURL( KURL::fromPathOrURL( projectdir ) ); + req->completionObject() ->setDir( projectdir ); + + if ( dialog.exec() == QDialog::Accepted && !dialog.urlRequester() ->url().isEmpty() ) + { + QString subdirname; + if ( !QDir::isRelativePath( dialog.urlRequester() ->url() ) ) + subdirname = URLUtil::getRelativePath( projectdir, dialog.urlRequester()->url() ); + else + subdirname = dialog.urlRequester()->url(); + + while( subdirname.endsWith( QString(QChar(QDir::separator())) ) ) + subdirname = subdirname.left(subdirname.length()-1); + if( !subdirname.endsWith(".pro") ) + { + kdDebug(9024) << "Cleaned subdirname: " << subdirname << endl; + QDir dir( projectdir ); + QString realdir = spitem->scope->resolveVariables( subdirname ); + if ( !dir.exists( realdir ) ) + { + if ( !dir.mkdir( realdir ) ) + { + KMessageBox::error( this, i18n( "Failed to create subdirectory. " + "Do you have write permission " + "in the project folder?" ) ); + return ; + }else + { + QFile f( dir.absPath()+"/"+realdir+"/"+realdir+".pro" ); + f.open( IO_WriteOnly ); + f.close(); + } + } + }else + { + QString realdir = spitem->scope->resolveVariables( subdirname ); + QFile f( projectdir+"/"+realdir ); + f.open( IO_WriteOnly ); + f.close(); + } + + addSubprojectToItem( spitem, subdirname ); + + } +} + +void TrollProjectWidget::addSubprojectToItem( QMakeScopeItem* spitem, const QString& subdirname ) +{ + QListViewItem* item = spitem->firstChild(); + while( item ) + { + QMakeScopeItem* sitem = static_cast(item); + if( sitem->scope->scopeName() == subdirname ) + { + if( sitem->scope->isEnabled() ) + { + return; + }else + { + spitem->scope->removeFromMinusOp( "SUBDIRS", subdirname ); + delete item; + if( spitem->scope->variableValues( "SUBDIRS" ).findIndex( subdirname ) != -1 ) + return; + } + } + item = item->nextSibling(); + } + + Scope* subproject = spitem->scope->createSubProject( subdirname ); + if( subproject ) + { + new QMakeScopeItem( spitem, subproject->scopeName(), subproject ); +// QListViewItem* lastitem = spitem->firstChild(); +// while( lastitem->nextSibling() != 0 ) +// lastitem = lastitem->nextSibling(); +// newitem->moveItem( lastitem ); + }else + { + KMessageBox::error(this, i18n("Could not create subproject. This means that either the project you wanted" + " to add a subproject to is not parsed correctly, or it is not a" + " subdirs-project."), i18n("Subproject creation failed") ); + } + spitem->scope->saveToFile(); + spitem->sortChildItems( 0, true ); +} + +void TrollProjectWidget::slotRemoveSubproject( QMakeScopeItem *spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else if ( ( spitem = dynamic_cast( m_shownSubproject->parent() ) ) != NULL ) + { + + m_filesCached = false; + m_allFilesCache.clear(); + + bool delsubdir = false; + if ( KMessageBox::warningYesNo( this, i18n( "Delete the file/directory of the subproject from disk?" ), i18n( "Delete subdir?" ) ) == KMessageBox::Yes ) + delsubdir = true; + if( !spitem->scope->deleteSubProject( m_shownSubproject->scope->getNum(), delsubdir ) ) + { + KMessageBox::error(this, i18n("Could not delete subproject.\nThis is an internal error, please write a" + " bug report to bugs.kde.org and include the output of kdevelop when run" + "from a shell."),i18n("Subproject Deletion failed")); + return; + } + delete m_shownSubproject; + m_shownSubproject = spitem; + spitem->scope->saveToFile( ); + overview->setCurrentItem( m_shownSubproject ); + overview->setSelected( m_shownSubproject, true ); + } +} + +void TrollProjectWidget::slotOverviewContextMenu( KListView *, QListViewItem *item, const QPoint &p ) +{ + if ( !item ) + return ; + + QMakeScopeItem *spitem = static_cast( item ); + + KPopupMenu popup( this ); + popup.insertTitle( i18n( "Subproject %1" ).arg( item->text( 0 ) ) ); + + int idBuild = -2; + int idRebuild = -2; + int idClean = -2; + int idInstall = -2; + int idDistClean = -2; + int idQmake = -2; + int idQmakeRecursive = -2; + int idProjectConfiguration = -2; + int idAddSubproject = -2; + int idRemoveSubproject = -2; + int idDisableSubproject = -2; + int idRemoveScope = -2; + int idAddScope = -2; + + + if ( spitem->scope->scopeType() == Scope::ProjectScope && ( !spitem->scope->parent() || spitem->scope->parent()->scopeType() == Scope::ProjectScope ) ) + { + idBuild = popup.insertItem( SmallIcon( "make_kdevelop" ), i18n( "Build" ) ); + popup.setWhatsThis( idBuild, i18n( "Build

Runs make from the selected subproject directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + idInstall = popup.insertItem( i18n( "Install" ) ); + popup.setWhatsThis( idBuild, i18n( "Install

Runs make install from the selected subproject directory.
" + "Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + idClean = popup.insertItem( i18n( "Clean" ) ); + popup.setWhatsThis( idBuild, i18n( "Clean project

Runs make clean command from the project " + "directory.
Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + idDistClean = popup.insertItem( i18n( "Dist-Clean" ) ); + popup.setWhatsThis( idBuild, i18n( "Dist-Clean project

Runs make distclean command from the project " + "directory.
Environment variables and make arguments can be specified " + "in the project settings dialog, Make Options tab." ) ); + + idRebuild = popup.insertItem( SmallIcon( "rebuild" ), i18n( "Rebuild" ) ); + popup.setWhatsThis( idRebuild, i18n( "Rebuild project

Runs make clean and then make from " + "the project directory.
Environment variables and make arguments can be " + "specified in the project settings dialog, Make Options tab." ) ); + idQmake = popup.insertItem( SmallIcon( "qmakerun" ), i18n( "Run qmake" ) ); + popup.setWhatsThis( idQmake, i18n( "Run qmake

Runs qmake from the selected subproject directory. This creates or regenerates Makefile." ) ); + idQmakeRecursive = popup.insertItem( SmallIcon( "qmakerun" ), i18n( "Run qmake recursively" ) ); + popup.setWhatsThis( idQmakeRecursive, i18n( "Run qmake recursively

Runs qmake from the selected " + "subproject directory and recurses into all subproject directories. " + "This creates or regenerates Makefile." ) ); + + popup.insertSeparator(); + idAddSubproject = popup.insertItem( SmallIcon( "folder_new" ), i18n( "Add Subproject..." ) ); + popup.setWhatsThis( idAddSubproject, i18n( "Add subproject

Creates a new or adds an existing subproject to a currently selected subproject. " + "This action is allowed only if a type of the subproject is 'subdirectories'. The type of the subproject can be " + "defined in Subproject Settings dialog (open it from the subproject context menu)." ) ); + if ( spitem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 ) + popup.setItemEnabled( idAddSubproject, false ); + idRemoveSubproject = popup.insertItem( SmallIcon( "remove_subdir" ), i18n( "Remove Subproject..." ) ); + popup.setWhatsThis( idRemoveSubproject, i18n( "Remove subproject

Removes currently selected subproject. Does not delete any file from disk. Deleted subproject can be later added by calling 'Add Subproject' action." ) ); + if ( spitem->parent() == NULL ) + popup.setItemEnabled( idRemoveSubproject, false ); + idAddScope = popup.insertItem( SmallIcon( "qmake_scopenew" ), i18n( "Create Scope..." ) ); + popup.setWhatsThis( idAddScope, i18n( "Create scope

Creates QMake scope in the project file of the currently selected subproject." ) ); + popup.insertSeparator(); + idProjectConfiguration = popup.insertItem( SmallIcon( "configure" ), i18n( "Subproject Settings" ) ); + popup.setWhatsThis( idProjectConfiguration, i18n( "Subproject settings

Opens QMake Subproject Configuration dialog. " + "It provides settings for:
subproject type and configuration,
include and library paths,
lists of dependencies and " + "external libraries,
build order,
intermediate files locations,
compiler options." ) ); + } + else + { + idAddScope = popup.insertItem( SmallIcon( "qmake_scopenew" ), i18n( "Create Scope..." ) ); + popup.setWhatsThis( idAddScope, i18n( "Create Scope

Creates QMake scope in the currently selected scope." ) ); + idRemoveScope = popup.insertItem( SmallIcon( "editdelete" ), i18n( "Remove Scope" ) ); + popup.setWhatsThis( idRemoveScope, i18n( "Remove Scope

Removes currently selected scope." ) ); + popup.insertSeparator(); + idAddSubproject = popup.insertItem( SmallIcon( "folder_new" ), i18n( "Add Subproject..." ) ); + popup.setWhatsThis( idAddSubproject, i18n( "Add subproject

Creates a new or adds an existing subproject to the currently selected scope. " + "This action is allowed only if the type of the subproject is 'subdirectories'. The type of the subproject can be " + "defined in the Subproject Settings dialog (open it from the subproject context menu)." ) ); + if ( spitem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 ) + popup.setItemEnabled( idAddSubproject, false ); + idDisableSubproject = popup.insertItem( SmallIcon( "remove_subdir" ), i18n( "Disable Subproject..." ) ); + popup.setWhatsThis( idRemoveSubproject, i18n( "Disable subproject

Disables the currently selected subproject when this scope is active. Does not delete the directory from disk. The deleted subproject can be later added by using the 'Add Subproject' action." ) ); + if( spitem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 && spitem->scope->parent()->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 ) + popup.setItemEnabled( idDisableSubproject, false ); + popup.insertSeparator(); + idProjectConfiguration = popup.insertItem( SmallIcon( "configure" ), i18n( "Scope Settings" ) ); + popup.setWhatsThis( idProjectConfiguration, i18n( "Scope settings

Opens QMake Subproject Configuration dialog. " + "It provides settings for:
subproject type and configuration,
include and library paths,
lists of dependencies and " + "external libraries,
build order,
intermediate files locations,
compiler options." ) ); + } + + int r = popup.exec( p ); + + QString relpath = spitem->relativePath(); + if ( r == idAddSubproject ) + { + slotAddSubproject( spitem ); + } + if ( r == idRemoveSubproject ) + { + slotRemoveSubproject( spitem ); + } + if ( r == idDisableSubproject ) + { + slotDisableSubproject( spitem ); + } + if ( r == idAddScope ) + { + slotCreateScope( spitem ); + } + else if ( r == idRemoveScope ) + { + slotRemoveScope( spitem ); + } + else if ( r == idBuild ) + { + slotBuildTarget(); + // m_part->startMakeCommand(projectDirectory() + relpath, QString::fromLatin1("")); + } + else if ( r == idInstall ) + { + slotInstallTarget(); + // m_part->startMakeCommand(projectDirectory() + relpath, QString::fromLatin1("")); + } + else if ( r == idRebuild ) + { + slotRebuildTarget(); + } + else if ( r == idClean ) + { + slotCleanTarget(); + } + else if ( r == idDistClean ) + { + slotDistCleanTarget(); + } + + else if ( r == idQmake ) + { + m_part->startQMakeCommand( projectDirectory() + QString(QChar(QDir::separator())) + relpath ); + } + else if ( r == idQmakeRecursive ) + { + runQMakeRecursive( spitem ); + } + + else if ( r == idProjectConfiguration ) + { + m_configDlg->updateSubproject( spitem ); + m_configDlg->show(); + } +} + +void TrollProjectWidget::addFileToCurrentSubProject( GroupItem *titem, const QString &filename ) +{ + + m_filesCached = false; + m_allFilesCache.clear(); + titem->addFileToScope( filename ); +} + +void TrollProjectWidget::addFileToCurrentSubProject( GroupItem::GroupType gtype, const QString &filename ) +{ + if ( !m_shownSubproject ) + return ; + + m_filesCached = false; + m_allFilesCache.clear(); + + GroupItem *gitem = 0; + + if ( m_shownSubproject->groups.contains( gtype ) ) + gitem = m_shownSubproject->groups[ gtype ]; + + if ( !gitem ) + return ; + + gitem->addFileToScope( filename ); +} + +/** +* Method adds a file to the current project by grouped +* by file extension +*/ +void TrollProjectWidget::addFiles( QStringList &files, bool relativeToProjectRoot ) +{ + if ( !m_shownSubproject ) + return ; + kdDebug(9024) << "Files to add:"<scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) != -1 && !fileName.endsWith(".pro") ) + { + ChooseSubprojectDlg dlg( this, false ); + if ( dlg.exec() == QDialog::Accepted ) + { + if ( dlg.selectedSubproject() && dlg.selectedSubproject()->scope->variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) + { + fileName = URLUtil::getRelativePath( dlg.selectedSubproject()->scope->projectDir() , + QDir::cleanDirPath( + m_shownSubproject->scope->projectDir()+ + QString(QChar(QDir::separator()))+ + fileName ) ); + overview->setCurrentItem( dlg.selectedSubproject() ); + + } + } + else + { + KMessageBox::error( this, i18n("You did not select a subproject to add the file to, or select a subproject that has subdirs."), i18n( "File adding aborted" ) ); + } + } + + QFileInfo info( fileName ); + QString ext = info.extension( false ).simplifyWhiteSpace(); + + QString noPathFileName; + if( relativeToProjectRoot ) + noPathFileName = URLUtil::getRelativePath( m_shownSubproject->scope->projectDir(), QDir::cleanDirPath(projectDirectory()+QString(QChar(QDir::separator()))+fileName ) ); + else + noPathFileName = URLUtil::getRelativePath( m_shownSubproject->scope->projectDir(), QDir::cleanDirPath(m_shownSubproject->scope->projectDir()+QString(QChar(QDir::separator()))+fileName ) ); + + if( DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/replacePaths", false ) ) + { + QString var = m_shownSubproject->scope->findCustomVarForPath( QFileInfo( noPathFileName ).dirPath() ); + if( !var.isEmpty() ) + { + noPathFileName = "$${"+var+"}"+QString( QChar( QDir::separator() ) )+QFileInfo( noPathFileName ).fileName(); + } + } + + kdDebug(9024) << "calc filename:" << noPathFileName << endl; +// GroupItem *gitem = 0; +// GroupItem::GroupType gtype = GroupItem::groupTypeForExtension( ext ); +// if ( m_shownSubproject->groups.contains( gtype ) ) +// gitem = m_shownSubproject->groups[ gtype ]; + + + if( ext == "pro" ) + { + addSubprojectToItem( findSubprojectForPath( QFileInfo( fileName ).dirPath() ), QFileInfo( fileName ).fileName() ); + }else + { + addFileToCurrentSubProject( GroupItem::groupTypeForExtension( ext ), noPathFileName ); + slotOverviewSelectionChanged( m_shownSubproject ); + kdDebug(9024) << "emitting" << relativeToProjectRoot << " " << fileName << endl; + if( relativeToProjectRoot ) + emitAddedFile ( projectDirectory()+QString( QChar( QDir::separator() ) ) + fileName ); + else + emitAddedFile ( m_shownSubproject->scope->projectDir()+QString( QChar( QDir::separator() ) ) + fileName ); + } + } + +} + + +void TrollProjectWidget::slotAddFiles() +{ + static KURL lastVisited; + QString cleanSubprojectDir = QDir::cleanDirPath( m_shownSubproject->scope->projectDir() ); + QString title, filter; + QString otherTitle, otherFilter; + + GroupItem* item = dynamic_cast( details->selectedItem() ); + GroupItem::GroupType type = item ? item->groupType : GroupItem::NoType; + GroupItem::groupTypeMeanings( type, title, filter ); + filter += "|" + title; + + m_filesCached = false; + m_allFilesCache.clear(); + + for ( int i = GroupItem::NoType + 1; i < GroupItem::MaxTypeEnum; ++i ) + { + if ( type != i ) + { + GroupItem::groupTypeMeanings( static_cast( i ), otherTitle, otherFilter ); + filter += "\n" + otherFilter + "|" + otherTitle; + } + } + + filter += "\n*|" + i18n( "All Files" ); + + AddFilesDialog *dialog = new AddFilesDialog( cleanSubprojectDir, + filter, + this, + "Insert existing files", + true, new QComboBox( false ) ); + + dialog->setMode( KFile::Files | KFile::ExistingOnly | KFile::LocalOnly ); + + if ( !lastVisited.isEmpty() ) + { + dialog->setURL( lastVisited ); + } + + dialog->exec(); + QStringList files = dialog->selectedFiles(); + lastVisited = dialog->baseURL(); + + for ( unsigned int i = 0; i < files.count(); i++ ) + { + switch ( dialog->mode() ) + { + case AddFilesDialog::Copy: + { + // Copy selected files to current subproject folder + // and add them to the filelist + QString filename = KURL( files[ i ] ).fileName(); + KIO::NetAccess::file_copy( files[ i ], cleanSubprojectDir + QString( QChar( QDir::separator() ) ) + filename, -1, false, false, this ); + QFile testExist( cleanSubprojectDir + QString( QChar( QDir::separator() ) ) + filename ); + + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Link: + { + // Link selected files to current subproject folder + KProcess *proc = new KProcess( this ); + *proc << "ln"; + *proc << "-s"; + *proc << files[ i ]; + *proc << cleanSubprojectDir; + proc->start(KProcess::Block); + QString filename = files[ i ].right( files[ i ].length() - files[ i ].findRev( '/' ) - 1 ); + // and add them to the filelist + QFile testExist( cleanSubprojectDir + QString( QChar( QDir::separator() ) ) + filename ); + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Relative: + { + // Form relative path to current subproject folder + QString theFile = files[ i ]; + QStringList files( URLUtil::relativePathToFile( cleanSubprojectDir , theFile ) + ); + addFiles( files, false ); + } + break; + } + } +} + +GroupItem* TrollProjectWidget::getInstallRoot( QMakeScopeItem* item ) +{ + if ( item->groups.contains( GroupItem::InstallRoot ) ) + return item->groups[ GroupItem::InstallRoot ]; + return 0; +} + +GroupItem* TrollProjectWidget::getInstallObject( QMakeScopeItem* item, const QString& objectname ) +{ + GroupItem * instroot = getInstallRoot( item ); + if ( !instroot ) + return 0; + QPtrListIterator it( instroot->installs ); + for ( ;it.current();++it ) + { + if ( ( *it ) ->groupType == GroupItem::InstallObject && + ( *it ) ->text( 0 ) == objectname ) + return * it; + } + return 0; + +} + +void TrollProjectWidget::slotNewFile() +{ + GroupItem * gitem = dynamic_cast( details->currentItem() ); + + m_filesCached = false; + m_allFilesCache.clear(); + + if( !gitem ) + { + gitem = dynamic_cast( details->currentItem()->parent() ); + } + + if ( gitem ) + { + if ( gitem->groupType == GroupItem::InstallObject ) + { + // QString relpath = m_shownSubproject->path.mid(projectDirectory().length()); + bool ok = FALSE; + QString filepattern = KInputDialog::getText( + i18n( "Insert New Filepattern" ), + i18n( "Please enter a filepattern relative the current " + "subproject (example docs/*.html):" ), + QString::null, &ok, this ); + if ( ok && !filepattern.isEmpty() ) + { + addFileToCurrentSubProject( gitem, filepattern ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + return ; + } + if ( gitem->groupType == GroupItem::InstallRoot ) + { + // QString relpath = m_shownSubproject->path.mid(projectDirectory().length()); + bool ok = FALSE; + QString install_obj = KInputDialog::getText( + i18n( "Insert New Install Object" ), + i18n( "Please enter a name for the new object:" ), + QString::null, &ok, this ); + if ( ok && !install_obj.isEmpty() ) + { + gitem->addInstallObject( install_obj ); + //GroupItem * institem = createGroupItem( GroupItem::InstallObject, install_obj , m_shownSubproject ); + //gitem->owner->scope->addToPlusOp("INSTALLS", install_obj); + gitem->owner->scope->saveToFile(); + slotOverviewSelectionChanged( m_shownSubproject ); + } + return ; + } + } + KDevCreateFile * createFileSupport = m_part->extension( "KDevelop/CreateFile" ); + QString fcext; + if( gitem ) + { + switch ( gitem->groupType ) + { + case GroupItem::Sources: + fcext = "cpp"; + break; + case GroupItem::Headers: + fcext = "h"; + break; + case GroupItem::Forms: + if ( !m_part->isQt4Project() ) + fcext = "ui-widget"; + else + fcext = "ui-widget-qt4"; + break; + case GroupItem::Translations: + fcext = "ts"; + break; + case GroupItem::Lexsources: + fcext = "l"; + break; + case GroupItem::Yaccsources: + fcext = "y"; + break; + case GroupItem::Resources: + fcext = "qrc"; + break; + default: + fcext = QString::null; + } + } + KDevCreateFile::CreatedFile crFile = + createFileSupport->createNewFile( fcext, projectDirectory() + QString(QChar(QDir::separator()))+ m_shownSubproject->relativePath() ); +} + +void TrollProjectWidget::slotRemoveFile() +{ + QListViewItem * selectedItem = details->currentItem(); + if ( !selectedItem ) + return ; + + m_filesCached = false; + m_allFilesCache.clear(); + + qProjectItem *pvitem = static_cast( selectedItem ); + // Check that it is a file (just in case) + if ( pvitem->type() != qProjectItem::File ) + return ; + FileItem *fitem = static_cast( pvitem ); + removeFile( m_shownSubproject, fitem ); +} + +void TrollProjectWidget::slotExcludeFileFromScopeButton() +{ + QListViewItem * selectedItem = details->currentItem(); + if ( !selectedItem ) + return ; + qProjectItem *pvitem = static_cast( selectedItem ); + // Check that it is a file (just in case) + if ( pvitem->type() != qProjectItem::File ) + return ; + FileItem *fitem = static_cast( pvitem ); + + GroupItem *gitem = static_cast( fitem->parent() ); + + gitem->removeFileFromScope( fitem->text( 0 ) ); +} + +void TrollProjectWidget::slotDetailsSelectionChanged( QListViewItem *item ) +{ + if ( !item ) + { + removefileButton->setEnabled( false ); + excludeFileFromScopeButton->setEnabled( false ); + return ; + } + removefileButton->setEnabled( false ); + excludeFileFromScopeButton->setEnabled( false ); + + qProjectItem *pvitem = static_cast( item ); + if ( pvitem->type() == qProjectItem::Group ) + { + GroupItem * gitem = static_cast( item ); + if ( gitem->groupType == GroupItem::InstallObject ) + { + excludeFileFromScopeButton->setEnabled( true ); + newfileButton->setEnabled( true ); + } + else if ( gitem->groupType == GroupItem::InstallRoot ) + { + newfileButton->setEnabled( true ); + } + else + { + addfilesButton->setEnabled( true ); + newfileButton->setEnabled( true ); + } + + + } + else if ( pvitem->type() == qProjectItem::File ) + { + removefileButton->setEnabled( true ); + excludeFileFromScopeButton->setEnabled( true ); + /* buildTargetButton->setEnabled(true); + rebuildTargetButton->setEnabled(true); + executeTargetButton->setEnabled(true);*/ + } +} + +void TrollProjectWidget::slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p ) +{ + if ( !item ) + return ; + + qProjectItem *pvitem = static_cast( item ); + if ( pvitem->type() == qProjectItem::Group ) + { + GroupItem * titem = static_cast( pvitem ); + QString title, ext; + GroupItem::groupTypeMeanings( titem->groupType, title, ext ); + + KPopupMenu popup( this ); + popup.insertTitle( title ); + + int idInsExistingFile = -2; + int idInsNewFile = -2; + int idInsInstallObject = -2; + int idInsNewFilepatternItem = -2; + int idSetInstObjPath = -2; + int idLUpdate = -2; + int idLRelease = -2; + int idRemoveFile = -2; + + // int idFileProperties = popup.insertItem(SmallIconSet("filenew"),i18n("Properties...")); + if ( titem->groupType == GroupItem::InstallRoot ) + { + idInsInstallObject = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Install Object..." ) ); + popup.setWhatsThis( idInsInstallObject, i18n( "Add install object

Creates QMake install object. " + "It is possible to define a list of files to install and installation locations for each object. Warning! " + "Install objects without path specified will not be saved to a project file." ) ); + } + else if ( titem->groupType == GroupItem::InstallObject ) + { + idSetInstObjPath = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Install Path..." ) ); + popup.setWhatsThis( idSetInstObjPath, i18n( "Install path

Allows to choose the installation path for the current install object." ) ); + idInsNewFilepatternItem = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Pattern of Files to Install..." ) ); + popup.setWhatsThis( idInsNewFilepatternItem, i18n( "Add pattern of files to install

Defines the pattern to match files which will be installed. " + "It is possible to use wildcards and relative paths like docs/*." ) ); + idRemoveFile = popup.insertItem( SmallIconSet( "editdelete" ), i18n( "Remove Install Object" ) ); + popup.setWhatsThis( idRemoveFile, i18n( "Remove install object

Removes the install object the current group." ) ); + } + else if ( titem->groupType == GroupItem::Translations ) + { + idInsNewFile = popup.insertItem( SmallIconSet( "filenew" ), i18n( "Create New File..." ) ); + popup.setWhatsThis( idInsNewFile, i18n( "Create new file

Creates a new translation file and adds it to a currently selected TRANSLATIONS group." ) ); + idInsExistingFile = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Existing Files..." ) ); + popup.setWhatsThis( idInsExistingFile, i18n( "Add existing files

Adds existing translation (*.ts) files to a currently selected TRANSLATIONS group. It is " + "possible to copy files to a current subproject directory, create symbolic links or " + "add them with the relative path." ) ); + idLUpdate = popup.insertItem( SmallIconSet( "konsole" ), i18n( "Update Translation Files" ) ); + popup.setWhatsThis( idLUpdate, i18n( "Update Translation Files

Runs lupdate command from the current subproject directory. It collects translatable " + "messages and saves them into translation files." ) ); + idLRelease = popup.insertItem( SmallIconSet( "konsole" ), i18n( "Release Binary Translations" ) ); + popup.setWhatsThis( idLRelease, i18n( "Release Binary Translations

Runs lrelease command from the current subproject directory. It creates binary " + "translation files that are ready to be loaded at program execution." ) ); + } + else // File group containing files + { + idInsNewFile = popup.insertItem( SmallIconSet( "filenew" ), i18n( "Create New File..." ) ); + popup.setWhatsThis( idInsNewFile, i18n( "Create new file

Creates a new file and adds it to a currently selected group." ) ); + idInsExistingFile = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Existing Files..." ) ); + popup.setWhatsThis( idInsExistingFile, i18n( "Add existing files

Adds existing files to a currently selected group. It is " + "possible to copy files to a current subproject directory, create symbolic links or " + "add them with the relative path." ) ); + } + int r = popup.exec( p ); + QString cleanSubprojectPath = QDir::cleanDirPath( m_shownSubproject->scope->projectDir() ); + + if ( r == idSetInstObjPath ) + { + KURLRequesterDlg dialog( i18n( "Choose Install Path" ), i18n( "Enter a path " + "(example /usr/local/share/... ):" ), this, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory ); + dialog.urlRequester() ->setURL( titem->owner->scope->variableValues( titem->text( 0 ) + ".path" ).front() ); + if ( dialog.exec() == QDialog::Accepted ) + { + titem->owner->scope->setEqualOp( titem->text( 0 ) + ".path", dialog.urlRequester() ->url() ); + titem->owner->scope->saveToFile( ); + } + } + else if ( r == idInsNewFilepatternItem ) + { + bool ok = FALSE; + QString filepattern = KInputDialog::getText( + i18n( "Add Pattern of Files to Install" ), + i18n( "Enter a pattern relative to the current " + "subproject (example docs/*.html):" ), + QString::null, &ok, this ); + if ( ok && !filepattern.isEmpty() ) + { + addFileToCurrentSubProject( titem, filepattern ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( r == idInsExistingFile ) + { + AddFilesDialog * dialog = new AddFilesDialog( cleanSubprojectPath, + ext + "|" + title + " (" + ext + ")", + this, + "Add existing files", + true, new QComboBox( false ) ); + dialog->setMode( KFile::Files | KFile::ExistingOnly | KFile::LocalOnly ); + if ( dialog->exec() == QDialog::Rejected ) + return ; + QStringList files = dialog->selectedFiles(); + for ( unsigned int i = 0;i < files.count();++i ) + { + switch ( dialog->mode() ) + { + case AddFilesDialog::Copy: + { + // Copy selected files to current subproject folder + // and add them to the filelist + QString filename = KURL( files[ i ] ).fileName(); + KIO::NetAccess::file_copy( files[ i ], cleanSubprojectPath + QString( QChar( QDir::separator() ) ) + filename, -1, false, false, this ); + QFile testExist( cleanSubprojectPath + QString( QChar( QDir::separator() ) ) + filename ); + + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Link: + { + // Link selected files to current subproject folder + KProcess *proc = new KProcess( this ); + *proc << "ln"; + *proc << "-s"; + *proc << files[ i ]; + *proc << cleanSubprojectPath; + proc->start(KProcess::Block); + QString filename = files[ i ].right( files[ i ].length() - files[ i ].findRev( '/' ) - 1 ); + // and add them to the filelist + QFile testExist( cleanSubprojectPath + QString( QChar( QDir::separator() ) ) + filename ); + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Relative: + { + // Form relative path to current subproject folder + QString theFile = files[ i ]; + QStringList files( URLUtil::relativePathToFile( cleanSubprojectPath, theFile ) + ); + addFiles( files, false ); + } + break; + } + } + // Update project file + if ( titem && titem->owner ) + { + titem->owner->scope->saveToFile( ); + } + // Update subprojectview + slotOverviewSelectionChanged( m_shownSubproject ); + } + else if ( r == idInsNewFile ) + { + KDevCreateFile * createFileSupport = m_part->extension( "KDevelop/CreateFile" ); + QString fcext; + switch ( titem->groupType ) + { + case GroupItem::Sources: + fcext = "cpp"; + break; + case GroupItem::Headers: + fcext = "h"; + break; + case GroupItem::Forms: + if ( !m_part->isQt4Project() ) + fcext = "ui-widget"; + else + fcext = "ui-widget-qt4"; + break; + case GroupItem::Translations: + fcext = "ts"; + break; + case GroupItem::Lexsources: + fcext = "l"; + break; + case GroupItem::Yaccsources: + fcext = "y"; + break; + case GroupItem::Resources: + fcext = "qrc"; + break; + default: + fcext = QString::null; + } + KDevCreateFile::CreatedFile crFile = + createFileSupport->createNewFile( fcext, cleanSubprojectPath ); + + } + else if ( r == idInsInstallObject ) + { + bool ok = FALSE; + QString install_obj = KInputDialog::getText( + i18n( "Add Install Object" ), + i18n( "Enter a name for the new object:" ), + QString::null, &ok, this ); + if ( ok && !install_obj.isEmpty() ) + { + titem->addInstallObject( install_obj ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( r == idLUpdate ) + { + QString cmd = "lupdate "; + cmd += m_shownSubproject->scope->fileName(); + m_part->appFrontend() ->startAppCommand( m_shownSubproject->scope->projectDir(), cmd, false ); + } + else if ( r == idLRelease ) + { + QString cmd = "lrelease "; + cmd += m_shownSubproject->scope->fileName(); + m_part->appFrontend() ->startAppCommand( m_shownSubproject->scope->projectDir(), cmd, false ); + }else if( r == idRemoveFile ) + { + static_cast(titem->parent())->removeInstallObject( titem ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( pvitem->type() == qProjectItem::File ) + { + + removefileButton->setEnabled( true ); + FileItem *fitem = static_cast( pvitem ); + GroupItem* gitem = static_cast( item->parent() ); + + KPopupMenu popup( this ); + if ( !( gitem->groupType == GroupItem::InstallObject ) ) + popup.insertTitle( i18n( "File: %1" ).arg( fitem->text( 0 ) ) ); + else + popup.insertTitle( i18n( "Pattern: %1" ).arg( fitem->text( 0 ) ) ); + + int idRemoveFile = -2; + int idSubclassWidget = -2; + int idUpdateWidgetclass = -2; + int idBuildFile = -2; + int idUISubclasses = -2; + int idViewUIH = -2; + int idFileProperties = -2; + int idEditInstallPattern = -2; + + if ( !fitem->uiFileLink.isEmpty() ) + { + idUpdateWidgetclass = popup.insertItem( SmallIconSet( "qmake_subclass" ), i18n( "Edit ui-Subclass..." ) ); + popup.setWhatsThis( idUpdateWidgetclass, i18n( "Edit ui-subclass

Launches Subclassing wizard " + "and prompts to implement missing in childclass slots and functions." ) ); + } + if ( fitem->text( 0 ).contains( ".ui" ) ) + { + idSubclassWidget = popup.insertItem( SmallIconSet( "qmake_subclass" ), i18n( "Subclassing Wizard..." ) ); + popup.setWhatsThis( idSubclassWidget, i18n( "Subclass widget

Launches Subclassing wizard. " + "It allows to create a subclass from the class defined in .ui file. " + "There is also possibility to implement slots and functions defined in the base class." ) ); + if ( !m_part->isQt4Project() ) + { + idViewUIH = popup.insertItem( SmallIconSet( "qmake_ui_h" ), i18n( "Open ui.h File" ) ); + popup.setWhatsThis( idViewUIH, i18n( "Open ui.h file

Opens .ui.h file associated with the selected .ui." ) ); + } + idUISubclasses = popup.insertItem( SmallIconSet( "qmake_subclass" ), i18n( "List of Subclasses..." ) ); + popup.setWhatsThis( idUISubclasses, i18n( "List of subclasses

Shows subclasses list editor. " + "There is possibility to add or remove subclasses from the list." ) ); + } + if ( !( gitem->groupType == GroupItem::InstallObject ) ) + { + idRemoveFile = popup.insertItem( SmallIconSet( "editdelete" ), i18n( "Remove File" ) ); + popup.setWhatsThis( idRemoveFile, i18n( "Remove file

Removes file from a current group. For sources, this also removes the subclassing information." ) ); + idFileProperties = popup.insertItem( SmallIconSet( "configure_file" ), i18n( "Exclude File" ) ); + popup.setWhatsThis( idFileProperties, i18n( "Exclude File

Excludes the file from this Scope. Does not touch subclassing information" ) ); + } + else + { + idEditInstallPattern = popup.insertItem( SmallIconSet( "configure_file" ), i18n( "Edit Pattern" ) ); + popup.setWhatsThis( idEditInstallPattern, i18n( "Edit pattern

Allows to edit install files pattern." ) ); + idRemoveFile = popup.insertItem( SmallIconSet( "editdelete" ), i18n( "Remove Pattern" ) ); + popup.setWhatsThis( idRemoveFile, i18n( "Remove pattern

Removes install files pattern from the current install object." ) ); + } + if ( !( gitem->groupType == GroupItem::InstallObject ) ) + { + KURL::List urls; + urls.append( m_shownSubproject->scope->projectDir() + QChar( QDir::separator() ) + m_shownSubproject->scope->resolveVariables( fitem->localFilePath ) ); + FileContext context( urls ); + m_part->core() ->fillContextMenu( &popup, &context ); + } + if ( gitem->groupType == GroupItem::Sources ) + { + idBuildFile = popup.insertItem( SmallIconSet( "make_kdevelop" ), i18n( "Build File" ) ); + popup.setWhatsThis( idBuildFile, i18n( "Build File

Builds the object file for this source file." ) ); + } + + int r = popup.exec( p ); + if ( r == idRemoveFile ) + removeFile( m_shownSubproject, fitem ); + else if ( r == idFileProperties ) + { + slotExcludeFileFromScopeButton(); + } + else if ( r == idViewUIH ) + { + kdDebug(9024) << "Opening:" << fitem->text(0) << ";" << fitem->text(0).replace(".ui","") << endl; + m_part->partController() ->editDocument( KURL( m_shownSubproject->scope->projectDir() + QChar( QDir::separator() ) + + fitem->localFilePath.replace(".ui","") + ".h" ) ); + + } + else if ( r == idSubclassWidget ) + { + QStringList newFileNames; + newFileNames = m_part->languageSupport() ->subclassWidget( m_shownSubproject->scope->projectDir() + QChar( QDir::separator() ) + fitem->localFilePath ); + kdDebug(9024) << "got new filenames: " << newFileNames << endl; + if ( !newFileNames.empty() ) + { + QDomDocument & dom = *( m_part->projectDom() ); + for ( uint i = 0; i < newFileNames.count(); ++i ) + { + QString srcfile_relpath = URLUtil::getRelativePath( m_shownSubproject->scope->projectDir(), newFileNames[ i ] ) ; + newFileNames[i] = URLUtil::getRelativePath( projectDirectory(), newFileNames[ i ] ) ; + QString uifile_relpath = m_shownSubproject->relativePath() + QChar( QDir::separator() ) + fitem->localFilePath; + DomUtil::PairList list = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + + list << DomUtil::Pair( srcfile_relpath, uifile_relpath ); + DomUtil::writePairListEntry( dom, "/kdevtrollproject/subclassing", "subclass", "sourcefile", "uifile", list ); + // newFileNames[i] = newFileNames[i].replace(QRegExp(projectDirectory()+"/"),""); + qWarning( "new file: %s", newFileNames[ i ].latin1() ); + } + m_subclasslist = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + + m_part->addFiles( newFileNames ); + } + } + else if ( r == idUpdateWidgetclass ) + { + QString noext = fitem->text( 0 ); + if ( noext.findRev( '.' ) > -1 ) + noext = noext.left( noext.findRev( '.' ) ); + QStringList dummy; + QString uifile = fitem->uiFileLink; + if ( uifile.findRev( QString( QChar( QDir::separator() ) ) ) > -1 ) + { + QStringList uisplit = QStringList::split( QString( QChar( QDir::separator() ) ), uifile ); + uifile = uisplit[ uisplit.count() - 1 ]; + } + m_part->languageSupport() ->updateWidget( m_shownSubproject->scope->projectDir() + QString( QChar( QDir::separator() ) ) + uifile, noext ); + } + else if ( r == idUISubclasses ) + { + QDomDocument & dom = *( m_part->projectDom() ); + DomUtil::PairList list = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + SubclassesDlg *sbdlg = new SubclassesDlg( m_shownSubproject->relativePath() + QChar( QDir::separator() ) + fitem->localFilePath, + list, projectDirectory() ); + + if ( sbdlg->exec() ) + { + QDomElement el = DomUtil::elementByPath( dom, "/kdevtrollproject" ); + QDomElement el2 = DomUtil::elementByPath( dom, "/kdevtrollproject/subclassing" ); + if ( ( !el.isNull() ) && ( !el2.isNull() ) ) + { + el.removeChild( el2 ); + } + + DomUtil::writePairListEntry( dom, "/kdevtrollproject/subclassing", "subclass", "sourcefile", "uifile", list ); + + m_subclasslist = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + } + } + else if ( r == idEditInstallPattern ) + { + GroupItem * titem = static_cast( item->parent() ); + + bool ok = FALSE; + QString filepattern = KInputDialog::getText( + i18n( "Edit Pattern" ), + i18n( "Enter a pattern relative to the current " + "subproject (example docs/*.html):" ), + fitem->text( 0 ) , &ok, this ); + if ( ok && !filepattern.isEmpty() ) + { + removeFile( m_shownSubproject, fitem ); + addFileToCurrentSubProject( titem, filepattern ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( r == idBuildFile ) + { + buildFile( m_shownSubproject, fitem ); + } + } +} + + +void TrollProjectWidget::removeFile( QMakeScopeItem *spitem, FileItem *fitem ) +{ + GroupItem * gitem = static_cast( fitem->parent() ); + + m_filesCached = false; + m_allFilesCache.clear(); + + QString realfilename = spitem->scope->resolveVariables( fitem->localFilePath ); + if ( KMessageBox::warningYesNo( this, + "" + + i18n( "Do you want to delete the file %1 from the project and your disk?" ) + .arg( fitem->text( 0 ) ) + + "", + i18n( "Remove File" ), + KStdGuiItem::remove(), + KStdGuiItem::no(), + "deleteFileFromQMakeProject" ) == KMessageBox::No ) + { + return; + }else + { + kdDebug(9024) << "Deleting file as the user wished: " << spitem->scope->projectDir() + QString( QChar( QDir::separator() ) ) + realfilename << endl; + KIO::NetAccess::del( KURL::fromPathOrURL( spitem->scope->projectDir() + QString( QChar( QDir::separator() ) ) + realfilename ), 0 ); + } + + if ( gitem->groupType != GroupItem::InstallObject ) + { + QString removedFileName = spitem->relativePath() + QString( QChar( QDir::separator() ) ) + realfilename; + if ( removedFileName.startsWith( QDir::rootDirPath() ) ) + removedFileName = removedFileName.mid( 1 ); + emitRemovedFile( removedFileName ); + } + + + //remove subclassing info + QDomDocument &dom = *( m_part->projectDom() ); + DomUtil::PairList list = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + QPtrList pairsToRemove; + DomUtil::PairList::iterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + if ( ( ( *it ).first == realfilename ) || ( ( *it ).second == realfilename ) ) + { + pairsToRemove.append( &( *it ) ); + } + } + DomUtil::Pair *pair; + for ( pair = pairsToRemove.first(); pair; pair = pairsToRemove.next() ) + { + list.remove( *pair ); + } + QDomElement el = DomUtil::elementByPath( dom, "/kdevtrollproject" ); + QDomElement el2 = DomUtil::elementByPath( dom, "/kdevtrollproject/subclassing" ); + if ( ( !el.isNull() ) && ( !el2.isNull() ) ) + { + el.removeChild( el2 ); + } + DomUtil::writePairListEntry( dom, "/kdevtrollproject/subclassing", "subclass", "sourcefile", "uifile", list ); + + gitem->removeFileFromScope( fitem->text( 0 ) ); +} + +void TrollProjectWidget::emitAddedFile( const QString &fileName ) +{ + emit m_part->addedFilesToProject( QStringList( fileName ) ); +} + + +void TrollProjectWidget::emitRemovedFile( const QString &fileName ) +{ + emit m_part->removedFilesFromProject( QStringList( fileName ) ); +} + + +QString TrollProjectWidget::getUiFileLink( const QString &relpath, const QString& filename ) +{ + DomUtil::PairList::iterator it; + for ( it = m_subclasslist.begin();it != m_subclasslist.end(); ++it ) + { + if ( ( *it ).first == relpath + filename ) + return ( *it ).second; + } + return ""; +} + +void TrollProjectWidget::slotBuildOpenFile() +{ + KParts::ReadWritePart * part = dynamic_cast( m_part->partController() ->activePart() ); + if ( !part || !part->url().isLocalFile() ) + return ; + + QString fileName = part->url().path(); + QFileInfo fi( fileName ); + QString sourceDir = fi.dirPath(); + QString baseName = fi.baseName( true ); + kdDebug( 9024 ) << "Compiling " << fileName + << "in dir " << sourceDir + << " with baseName " << baseName << endl; + + + QString buildDir = sourceDir; + QString target = baseName + ".o"; + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + // m_part->startMakeCommand(buildDir, target); + + QPtrList list = findSubprojectForFile( fi ); + + QMakeScopeItem *spitem; + for ( spitem = list.first(); spitem; spitem = list.next() ) + { + QString buildcmd = constructMakeCommandLine( spitem->scope ); + QString dircmd = "cd " + KProcess::quote( spitem->scope->projectDir() ) + " && " ; + kdDebug( 9024 ) << "builddir " << spitem->scope->projectDir() << ", cmd " << dircmd + buildcmd + " " + target << endl; + m_part->queueCmd( spitem->scope->projectDir(), dircmd + buildcmd + " " + target ); + } + + // startMakeCommand(buildDir, target); + +} + + +void TrollProjectWidget::slotExecuteProject() +{ + QString program = m_part->mainProgram(); + if ( program.isEmpty() ) + { + KMessageBox::sorry( this, i18n( "Please specify the executable name in the " + "project options dialog or select an application subproject in the QMake Manager." ), i18n( "No Executable Found" ) ); + return ; + } + + //only run once + if (m_part->appFrontend()->isRunning()) + { + if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) + return; + m_part->appFrontend()->stopApplication(); + while(m_part->appFrontend()->isRunning()) + { + KApplication::kApplication()->processEvents(); + usleep(100); + } + } + + if ( !program.startsWith( QDir::rootDirPath() ) ) + program.prepend( "." + QString( QChar( QDir::separator() ) ) ); + + + // Build environment variables to prepend to the executable path + QString runEnvVars = QString::null; + DomUtil::PairList list = + DomUtil::readPairListEntry( *( m_part->projectDom() ), "/kdevtrollproject/run/envvars", "envvar", "name", "value" ); + + DomUtil::PairList::ConstIterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + const DomUtil::Pair &pair = ( *it ); + if ( ( !pair.first.isEmpty() ) && ( !pair.second.isEmpty() ) ) + runEnvVars += pair.first + "=" + pair.second + " "; + } + program.prepend( runEnvVars ); + program.append( " " + m_part->runArguments() + " " ); + + bool inTerminal = DomUtil::readBoolEntry( *( m_part->projectDom() ), "/kdevtrollproject/run/terminal" ); + m_part->appFrontend() ->startAppCommand( m_part->runDirectory(), program, inTerminal ); +} + + +void TrollProjectWidget::slotCleanProject() +{ + runClean(m_rootSubproject, "clean"); +} + +void TrollProjectWidget::slotCleanTarget() +{ + runClean(m_shownSubproject, "clean"); +} + +void TrollProjectWidget::slotDistCleanProject() +{ + runClean(m_rootSubproject, "distclean"); + +} + +void TrollProjectWidget::slotDistCleanTarget() +{ + runClean(m_shownSubproject, "distclean"); +} + +void TrollProjectWidget::runClean( QMakeScopeItem* item, const QString& cleantargetname ) +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !item ) + return ; + // can't build from scope + if ( item->scope->scopeType() != Scope::ProjectScope ) + return ; + + QString dir = item->scope->projectDir(); + createMakefileIfMissing( dir, item ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString rebuildcmd = constructMakeCommandLine( item->scope ) + " "+cleantargetname; + m_part->queueCmd( dir, dircmd + rebuildcmd ); +} + +QString TrollProjectWidget::constructMakeCommandLine( Scope* s ) +{ + QString makeFileName; + if ( s ) + makeFileName = s->resolveVariables( s->variableValues( "MAKEFILE", true, true, true ).front() ); + + QDomDocument & dom = *( m_part->projectDom() ); + + QString cmdline = DomUtil::readEntry( dom, "/kdevtrollproject/make/makebin" ); + if ( cmdline.isEmpty() ) + cmdline = MAKE_COMMAND; + if ( !makeFileName.isEmpty() ) + { + cmdline += " -f " + makeFileName; + } + if ( !DomUtil::readBoolEntry( dom, "/kdevtrollproject/make/abortonerror" ) ) + cmdline += " -k"; + bool runmultiple = DomUtil::readBoolEntry(dom, "/kdevtrollproject/make/runmultiplejobs"); + int jobs = DomUtil::readIntEntry( dom, "/kdevtrollproject/make/numberofjobs" ); + if ( jobs != 0 && runmultiple ) + { + cmdline += " -j"; + cmdline += QString::number( jobs ); + } + if ( DomUtil::readBoolEntry( dom, "/kdevtrollproject/make/dontact" ) ) + cmdline += " -n"; + + cmdline += " "; + cmdline.prepend( m_part->makeEnvironment() ); + + return cmdline; +} + + +void TrollProjectWidget::createMakefileIfMissing( const QString &dir, QMakeScopeItem *item ) +{ + QFileInfo fi; + QFileInfo fi2; + kdDebug(9024) << "Makefile:" << item->scope->variableValues( "MAKEFILE", true, true, true ) << endl; + if ( item->scope->variableValues( "MAKEFILE", true, true, true ).isEmpty() ) + { + fi.setFile( dir + QString( QChar( QDir::separator() ) ) + "Makefile" ); + fi2.setFile( dir + QString( QChar( QDir::separator() ) ) + "makefile" ); + } + else + { + QString realmf = item->scope->resolveVariables( item->scope->variableValues( "MAKEFILE", true, true, true ).front() ); + fi.setFile( realmf ); + fi2.setFile( dir + QString( QChar( QDir::separator() ) ) + realmf ); + } + if ( !fi.exists() && !fi2.exists() ) + { + int r = KMessageBox::questionYesNo( this, i18n( "There is no Makefile in this directory. Run qmake first?" ), QString::null, i18n( "Run qmake" ), i18n( "Do Not Run" ) ); + if ( r == KMessageBox::No ) + return ; + m_part->startQMakeCommand( dir ); + } +} + +QMakeScopeItem* TrollProjectWidget::findSubprojectForPath( const QString& relPath ) +{ + if( !m_rootSubproject ) + return 0; + QStringList dirs = QStringList::split("/", relPath); + QMakeScopeItem* pitem = static_cast(m_rootSubproject); + for( QStringList::iterator it = dirs.begin(); it != dirs.end(); ++it) + { + QListViewItem* item = pitem->firstChild(); + while( item ) + { + QMakeScopeItem* sitem = static_cast(item); + if( QFileInfo( sitem->scope->projectDir() ).fileName() == *it ) + { + pitem = sitem; + break; + } + } + } + return pitem; +} + +QPtrList TrollProjectWidget::findSubprojectForFile( QFileInfo fi ) +{ + QPtrList list; + findSubprojectForFile( list, m_rootSubproject, fi.absFilePath() ); + return list; +} + +void TrollProjectWidget::findSubprojectForFile( QPtrList &list, QMakeScopeItem * item, QString absFilePath ) +{ + if( !item ) + return; + + QDir d( item->scope->projectDir() ); + + QStringList vars = item->scope->variableValues( "SOURCES" ); + for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) + { + QFileInfo fi2( d, item->scope->resolveVariables( *it ) ); + if ( absFilePath == fi2.absFilePath() ) + list.append( item ); + } + + vars = item->scope->variableValues( "HEADERS" ); + for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) + { + QFileInfo fi2( d, item->scope->resolveVariables( *it ) ); + if ( absFilePath == fi2.absFilePath() ) + list.append( item ); + } + + QListViewItem * child = item->firstChild(); + while ( child ) + { + QMakeScopeItem * spitem = dynamic_cast( child ); + + if ( spitem ) + { + findSubprojectForFile( list, spitem, absFilePath ); + } + + child = child->nextSibling(); + } +} + +void TrollProjectWidget::slotRemoveScope( QMakeScopeItem * spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else + { + m_filesCached = false; + m_allFilesCache.clear(); + + QMakeScopeItem* pitem = dynamic_cast( spitem->parent() ); + if ( pitem != 0 ) + { + switch ( spitem->scope->scopeType() ) + { + case Scope::FunctionScope: + if( !pitem->scope->deleteFunctionScope( spitem->scope->getNum() ) ) + { + KMessageBox::error(this, i18n("Could not delete Function Scope.\nThis is an internal error, please write a bug report to bugs.kde.org and include the output of kdevelop when run from a shell."),i18n("Function Scope Deletion failed")); + return; + } + // pitem->scopes.remove( spitem ); + break; + case Scope::IncludeScope: + if( !pitem->scope->deleteIncludeScope( spitem->scope->getNum() ) ) + { + KMessageBox::error(this, i18n("Could not delete Include Scope.\nThis is an internal error, please write a bug report to bugs.kde.org and include the output of kdevelop when run from a shell."),i18n("Include Scope Deletion failed")); + return; + } + // pitem->scopes.remove( spitem ); + delete spitem; + spitem = pitem; + pitem = dynamic_cast( pitem->parent() ); + // pitem->scopes.remove(spitem); + break; + case Scope::SimpleScope: + if( !pitem->scope->deleteSimpleScope( spitem->scope->getNum() ) ) + { + KMessageBox::error(this, i18n("Could not delete Scope.\nThis is an internal error, please write a bug report to bugs.kde.org and include the output of kdevelop when run from a shell."),i18n("Scope Deletion failed")); + return; + } + // pitem->scopes.remove( spitem ); + break; + default: + break; + } + pitem->scope->saveToFile(); + delete spitem; + m_shownSubproject = pitem; + overview->setCurrentItem ( m_shownSubproject ); + overview->setSelected( m_shownSubproject, true ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } +} + +QMakeScopeItem * TrollProjectWidget::findSubprojectForScope( QMakeScopeItem * scope ) +{ + if ( ( scope == 0 ) || ( scope->parent() == 0 ) ) + return 0; + if ( scope->scope->scopeType() == Scope::ProjectScope ) + return scope; + return findSubprojectForScope( dynamic_cast( scope->parent() ) ); +} + +void TrollProjectWidget::focusInEvent( QFocusEvent * /*e*/ ) +{ + switch ( m_lastFocusedView ) + { + case DetailsView: + details->setFocus(); + break; + case SubprojectView: + default: + overview->setFocus(); + } +} + +void TrollProjectWidget::setLastFocusedView( TrollProjectView view ) +{ + m_lastFocusedView = view; +} + +void TrollProjectWidget::runQMakeRecursive( QMakeScopeItem* proj ) +{ + if( m_part->isQt4Project() ) + { + m_part->startQMakeCommand( proj->scope->projectDir(), true ); + }else + { + if ( proj->scope->scopeType() == Scope::ProjectScope ) + { + m_part->startQMakeCommand( proj->scope->projectDir() ); + } + QMakeScopeItem* item = static_cast( proj->firstChild() ); + while ( item ) + { + runQMakeRecursive( item ); + item = static_cast( item->nextSibling() ); + } + } +} + +void TrollProjectWidget::slotBuildSelectedFile() +{ + QListViewItem * selectedItem = details->currentItem(); + if ( !selectedItem ) + return ; + qProjectItem *pvitem = static_cast( selectedItem ); + // Check that it is a file (just in case) + if ( pvitem->type() != qProjectItem::File ) + return ; + FileItem *fitem = static_cast( pvitem ); + buildFile( m_shownSubproject, fitem ); +} + +void TrollProjectWidget::buildFile( QMakeScopeItem* spitem, FileItem* fitem ) +{ + QFileInfo fi( spitem->scope->projectDir() + QChar( QDir::separator() ) + spitem->scope->resolveVariables( fitem->localFilePath ) ); + QString sourceDir = fi.dirPath(); + QString baseName = fi.baseName( true ); + kdDebug( 9024 ) << "Compiling " << spitem->scope->resolveVariables( fitem->text( 0 ) ) + << "in dir " << sourceDir + << " with baseName " << baseName << endl; + + QString buildDir = sourceDir; + QString target = baseName + ".o"; + if( !spitem->scope->variableValues("OBJECTS_DIR").isEmpty() ) + target = spitem->scope->resolveVariables( spitem->scope->variableValues("OBJECTS_DIR").first() )+ QString( QChar( QDir::separator() ) )+target; + kdDebug( 9024 ) << "builddir " << buildDir << ", target " << target << endl; + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + // m_part->startMakeCommand(buildDir, target); + + QString buildcmd = constructMakeCommandLine( spitem->scope ); + QString dircmd = "cd " + KProcess::quote( spitem->scope->projectDir() ) + " && " ; + kdDebug( 9024 ) << "builddir " << spitem->scope->projectDir() << ", cmd " << dircmd + buildcmd + " " + target << endl; + m_part->queueCmd( spitem->scope->projectDir(), dircmd + buildcmd + " " + target ); + + + // startMakeCommand(buildDir, target); + +} + +TrollProjectWidget::SaveType TrollProjectWidget::dialogSaveBehaviour() const +{ + switch ( DomUtil::readIntEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/savebehaviour", 2 ) ) + { + case 0: + return AlwaysSave; + break; + case 1: + return NeverSave; + break; + case 2: + default: + return Ask; + break; + } +} + +bool TrollProjectWidget::isTMakeProject() +{ + return m_part->isTMakeProject(); +} + +void TrollProjectWidget::slotDisableSubproject( QMakeScopeItem* spitem ) +{ + m_filesCached = false; + m_allFilesCache.clear(); + + if( spitem->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + { + QStringList subdirs = spitem->scope->variableValues( "SUBDIRS" ); + DisableSubprojectDlg dlg( subdirs ); + if( dlg.exec() ) + { + QStringList values = dlg.selectedProjects(); + QListViewItem* item = spitem->firstChild(); + while( item ) + { + if( values.findIndex( item->text(0) ) != -1 ) + delete item; + item = item->nextSibling(); + } + spitem->disableSubprojects( values ); + spitem->scope->saveToFile(); + m_shownSubproject = spitem; + slotOverviewSelectionChanged( m_shownSubproject ); + } + }else + { + QMakeScopeItem* parent = static_cast(spitem->parent()); + parent->disableSubprojects( QStringList( spitem->scope->scopeName() ) ); + delete spitem; + parent->scope->saveToFile(); + m_shownSubproject = parent; + slotOverviewSelectionChanged( m_shownSubproject ); + } +} + +void TrollProjectWidget::slotProjectDirty(const QString& path) +{ + kdDebug(9024) << "File is dirty:" << path << " using method " << endl; + if( KMessageBox::warningYesNo(this, i18n("The project file \"%1\" has changed on disk\n(Or you have \"%2\" opened in the editor, which also triggers a reload when you change something in the QMake Manager).\n\nDo you want to reload it?").arg(path).arg(path), i18n("Project File Changed"), i18n("Reload"), i18n("Do Not Reload"), "trollproject_reload_project_file" ) != KMessageBox::No ) + { + m_part->dirWatch()->stopScan(); + QListViewItemIterator it(m_rootSubproject); + QValueList itemstoreload; + while( it.current() ) + { + QMakeScopeItem* projectitem = static_cast( it.current() ); + if( projectitem->scope->scopeType() == Scope::ProjectScope + || projectitem->scope->scopeType() == Scope::IncludeScope ) + { + QString projectfile = projectitem->scope->projectDir() + QString(QChar(QDir::separator())) + projectitem->scope->fileName(); + if( projectfile == path ) + { + itemstoreload.append(projectitem); + } + } + it++; + } + + QValueList::const_iterator reloadit = itemstoreload.begin(); + for( ; reloadit != itemstoreload.end() ; ++reloadit ) + { + (*reloadit)->reloadProject(); + if( m_shownSubproject == (*reloadit) ) + { + cleanDetailView(*reloadit); + setupContext(); + buildProjectDetailTree( *reloadit, details ); + } + if( m_configDlg->isShown() && m_configDlg->currentProjectItem() == (*reloadit) ) + { + m_configDlg->reject(); + m_configDlg->updateSubproject(m_shownSubproject); + m_configDlg->show(); + } + } + m_part->dirWatch()->startScan(); + } +} + + +QMakeScopeItem* TrollProjectWidget::currentSubproject() +{ + return m_shownSubproject; +} + +bool TrollProjectWidget::showFilenamesOnly() const +{ + return m_showFilenamesOnly; +} + +bool TrollProjectWidget::showVariablesInTree() const +{ + return m_showVariablesInTree; +} + + +QMap TrollProjectWidget::qmakeEnvironment() const +{ + QMap map; + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*m_part->projectDom(), "/kdevtrollproject/make/envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + bool hasQtDir = false; + for (it = envvars.begin(); it != envvars.end(); ++it) { + if( (*it).first == "QTDIR" ) + hasQtDir = true; + + map[(*it).first] = (*it).second; + } + + if( !hasQtDir && !m_part->isQt4Project() && !DomUtil::readEntry(*m_part->projectDom(), "/kdevcppsupport/qt/root", "").isEmpty() ) + { + map["QTDIR="] = DomUtil::readEntry(*m_part->projectDom(), "/kdevcppsupport/qt/root", ""); + map["PATH"] = map["PATH"].prepend( DomUtil::readEntry(*m_part->projectDom(), "/kdevcppsupport/qt/root", "") +"/bin" ); + } + return map; +} + +#include "trollprojectwidget.moc" + +//kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/trollprojectwidget.h b/buildtools/qmake/trollprojectwidget.h new file mode 100644 index 00000000..19595f78 --- /dev/null +++ b/buildtools/qmake/trollprojectwidget.h @@ -0,0 +1,218 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jakob@jsg.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _TROLLPROJECTWIDGET_H_ +#define _TROLLPROJECTWIDGET_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "choosesubprojectdlg.h" +#include "newwidgetdlg.h" +#include "domutil.h" +#include "qmakescopeitem.h" + +class TrollProjectPart; +class KListView; +class ProjectConfigurationDlg; + +class TrollProjectWidget : public QVBox +{ + Q_OBJECT + +public: + TrollProjectWidget( TrollProjectPart *part ); + ~TrollProjectWidget(); + + void openProject( const QString &dirName ); + void closeProject(); + + /** + * A list of the (relative) names of all subprojects (== subdirectories). + */ + //QStringList allSubprojects(); + /** + * A list of the (relative) names of all libraries. + */ + QStringList allLibraries(); + /** + * A list of all files that belong to the project. + **/ + QStringList allFiles(); + /** + * The top level directory of the project. + **/ + QString projectDirectory(); + /** + * The directory of the currently active subproject. + */ + QString subprojectDirectory(); + /** + * The directory of the currently active subproject. + */ + QString getCurrentTarget(); + + QString getCurrentDestDir(); + + QString getCurrentOutputFilename(); + + void addFileToCurrentSubProject( GroupItem *titem, const QString &filename ); + void addFileToCurrentSubProject( GroupItem::GroupType gtype, const QString &filename ); + void addFiles( QStringList &files, bool relativeToProjectRoot = true ); + void emitAddedFile( const QString &name ); + void emitRemovedFile( const QString &name ); + + QString getUiFileLink( const QString &path, const QString& filename ); + bool isTMakeProject(); + + enum TrollProjectView { SubprojectView, DetailsView }; + void setLastFocusedView( TrollProjectView view ); + enum SaveType { AlwaysSave, NeverSave, Ask }; + QMakeScopeItem* currentSubproject(); + + bool showFilenamesOnly() const; + bool showVariablesInTree() const; + +public slots: + void slotBuildTarget(); + void slotInstallTarget(); + void slotRebuildTarget(); + void slotCleanTarget(); + void slotDistCleanTarget(); + void slotExecuteTarget(); + + void slotBuildProject(); + void slotInstallProject(); + void slotRebuildProject(); + void slotCleanProject(); + void slotDistCleanProject(); + void slotExecuteProject(); + + void slotBuildOpenFile(); + void slotBuildSelectedFile(); + + void slotConfigureProject(); + void slotAddFiles(); + void slotNewFile(); + void slotRemoveFile(); + +protected: + virtual void focusInEvent( QFocusEvent *e ); + +private slots: + void slotOverviewSelectionChanged( QListViewItem *item ); + void slotOverviewContextMenu( KListView *, QListViewItem *item, const QPoint &p ); + void slotDetailsSelectionChanged( QListViewItem* ); + void slotDetailsExecuted( QListViewItem *item ); + void slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p ); + void slotExcludeFileFromScopeButton(); + void slotAddSubproject( QMakeScopeItem *spitem = 0 ); + void slotRemoveSubproject( QMakeScopeItem *spitem = 0 ); + void slotCreateScope( QMakeScopeItem *spitem = 0 ); + void slotRemoveScope( QMakeScopeItem *spitem = 0 ); + void slotDisableSubproject( QMakeScopeItem* spitem = 0 ); + void slotProjectDirty( const QString& ); + + void createQMakeScopeItems(); + +private: + void cleanDetailView( QMakeScopeItem *item ); + void runClean( QMakeScopeItem*, const QString& ); + void buildProjectDetailTree( QMakeScopeItem *item, KListView *listviewControl ); + void removeFile( QMakeScopeItem *spitem, FileItem *fitem ); + void addSubprojectToItem( QMakeScopeItem*, const QString& ); + void setupContext(); + // void parseScope(QMakeScopeItem *item,QString scopeString, Scope *scope); + GroupItem* getInstallRoot( QMakeScopeItem *item ); + GroupItem* getInstallObject( QMakeScopeItem *item, const QString& objectname ); + QString constructMakeCommandLine( Scope* s = 0 ); + + void createMakefileIfMissing( const QString &dir, QMakeScopeItem *item ); + + void runQMakeRecursive( QMakeScopeItem* proj); + void buildFile( QMakeScopeItem* spitem, FileItem* fitem); + + /*fileName: full base file name like QFileInfo::baseName ( true )*/ + QPtrList findSubprojectForFile( QFileInfo fi ); + void findSubprojectForFile( QPtrList &list, QMakeScopeItem * item, QString absFilePath ); + QMakeScopeItem* findSubprojectForPath( const QString& ); + // QString makeEnvironment(); + + TrollProjectWidget::SaveType dialogSaveBehaviour() const; + + QMakeScopeItem *findSubprojectForScope( QMakeScopeItem *scope ); + + void reloadProjectFromFile( QMakeScopeItem* item ); + QMap qmakeEnvironment() const; + + QVBox *overviewContainer; + KListView *overview; + QHBox *projectTools; + QToolButton *addSubdirButton; + QToolButton *createScopeButton; + + QToolButton *buildProjectButton; + QToolButton *rebuildProjectButton; + QToolButton *executeProjectButton; + + QToolButton *buildTargetButton; + QToolButton *rebuildTargetButton; + QToolButton *executeTargetButton; + + QToolButton *buildFileButton; + QToolButton *projectconfButton; + + QVBox *detailContainer; + KListView *details; + QHBox *fileTools; + QToolButton *addfilesButton; + QToolButton *newfileButton; + QToolButton *removefileButton; + QToolButton *excludeFileFromScopeButton; + + DomUtil::PairList m_subclasslist; + QMakeScopeItem *m_shownSubproject; + QMakeScopeItem *m_rootSubproject; + Scope* m_rootScope; + TrollProjectPart *m_part; + ProjectConfigurationDlg* m_configDlg; + + TrollProjectView m_lastFocusedView; + + bool m_filesCached; + bool m_showFilenamesOnly; + bool m_showVariablesInTree; + QStringList m_allFilesCache; + + friend class ChooseSubprojectDlg; + friend class ProjectConfigurationDlg; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/script/Makefile.am b/buildtools/script/Makefile.am new file mode 100644 index 00000000..73cee869 --- /dev/null +++ b/buildtools/script/Makefile.am @@ -0,0 +1,26 @@ +# Here resides the script project part. +# This is a generic part for various scripting languages that simply +# includes all files from the project directory without managing +# them. If a language needs more specific features, it deserves +# its own part (or the respective features should be added to the +# language support part) + +INCLUDES = -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/lib/external_interfaces $(all_includes) + +kde_module_LTLIBRARIES = libkdevscriptproject.la +libkdevscriptproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevscriptproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la + +libkdevscriptproject_la_SOURCES = scriptprojectpart.cpp scriptoptionswidget.cpp scriptoptionswidgetbase.ui scriptnewfiledlg.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevscriptproject.desktop + +rcdir = $(kde_datadir)/kdevscriptproject +rc_DATA = kdevscriptproject.rc diff --git a/buildtools/script/README.dox b/buildtools/script/README.dox new file mode 100644 index 00000000..a7a19983 --- /dev/null +++ b/buildtools/script/README.dox @@ -0,0 +1,48 @@ +/** \class ScriptProjectPart +This is the script build tool part +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +\authors Bernd Gehrmann + +\unmaintained This part is currently un-maintained + +\deprecated This class is deprecated, use GenericProjectPart (buildtools/generic) instead. + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/buildtools/script/kdevscriptproject.desktop b/buildtools/script/kdevscriptproject.desktop new file mode 100644 index 00000000..1200f9ba --- /dev/null +++ b/buildtools/script/kdevscriptproject.desktop @@ -0,0 +1,87 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Scripting Language Project +Comment[ca]=Projecte de llenguatge escrivint scripts +Comment[da]=Scriptsprog-projekt +Comment[de]=Skriptsprachen-Projekt für KDevelop +Comment[el]=Έργο γλώσσας γραφής σεναρίων +Comment[es]=Proyecto de lenguaje de guiones +Comment[et]=Skriptikeele projekt +Comment[eu]=Script lengoai proiektua +Comment[fa]=پروژۀ زبان دست‌نوشته‌ای +Comment[fr]=Projet avec les langages de scripts +Comment[ga]=Tionscadal i dTeanga Scriptithe +Comment[gl]=Proxecto de linguaxe de scripting +Comment[hi]=स्क्रिप्टिंग भाषा परियोजना +Comment[hu]=Szkript-projekt +Comment[is]=Skriftumálsverkefni +Comment[it]=Progetto con linguaggio di scripting +Comment[ja]=スクリプト言語プロジェクト +Comment[ms]=Projek Bahasa Penskrip +Comment[nds]=Skriptspraak-Projekt +Comment[ne]=स्क्रिप्टिङ भाषा परियोजना +Comment[nl]=Scripttaal-project +Comment[pl]=Projekt w języku skryptowym +Comment[pt]=Projecto de uma Linguagem de 'Scripting' +Comment[pt_BR]=Projeto de Linguagem de Script +Comment[ru]=Проект скриптового языка +Comment[sk]=Skriptovací jazyk projekt +Comment[sl]=Projekt skriptnega jezika +Comment[sr]=Пројекат скриптног језика +Comment[sr@Latn]=Projekat skriptnog jezika +Comment[sv]=Projekt för skriptspråk +Comment[ta]=ஸ்கிரிப்டிங் மொழி பிராஜக்ட் +Comment[tg]=Лоиҳа бо забони ғарчкунӣ +Comment[tr]=Betik Dili Projesi +Comment[zh_CN]=脚本语言工程 +Comment[zh_TW]=文稿語言專案 +Name=KDevScriptProject +Name[da]=KDevelop script-projekt +Name[de]=Skriptsprachen-Projekt (KDevelop) +Name[hi]=के-डेव-स्क्रिप्ट-परियोजना +Name[nds]=Skriptspraak-Projekt (KDevelop) +Name[ne]=केडीई विकास स्क्रिप्ट परियोजना +Name[pl]=KDevProjektSkrypt +Name[sk]=KDevSkriptProjekt +Name[sv]=KDevelop skriptprojekt +Name[ta]=கெடெவ் ஸ்கிரிப்ட் பிராஜக்ட் +Name[tg]=KDevЛоиҳаи скрипт +Name[zh_TW]=KDevelop 文稿專案 +GenericName=Scripting Language Project +GenericName[ca]=Projecte de llenguatge escrivint scripts +GenericName[da]=Scriptsprog-projekt +GenericName[de]=Skriptsprachen-Projekt +GenericName[el]=Έργο γλώσσας γραφής σεναρίων +GenericName[es]=Proyecto de lenguaje de guiones +GenericName[et]=Skriptikeele projekt +GenericName[eu]=Script lengoaia proiektua +GenericName[fa]=پروژۀ زبان دست‌نوشته‌ای +GenericName[fr]=Projet avec les langages de scripts +GenericName[ga]=Tionscadal i dTeanga Scriptithe +GenericName[gl]=Proxecto de linguaxe de scripting +GenericName[hi]=स्क्रिप्टिंग भाषा परियोजना +GenericName[hu]=Szkript-projekt +GenericName[it]=Progetto con linguaggio di scripting +GenericName[ja]=スクリプト言語プロジェクト +GenericName[nds]=Skriptspraak-Projekt +GenericName[ne]=स्क्रिप्टिङ भाषा परियोजना +GenericName[nl]=Scripttaal-project +GenericName[pl]=Projekt w języku skryptowym +GenericName[pt]=Projecto de uma Linguagem de 'Scripting' +GenericName[pt_BR]=Projeto de Linguagem de Script +GenericName[ru]=Проект скриптового языка +GenericName[sk]=Skriptovací jazyk projekt +GenericName[sl]=Projekt skriptnega jezika +GenericName[sr]=Пројекат скриптног језика +GenericName[sr@Latn]=Projekat skriptnog jezika +GenericName[sv]=Projekt för skriptspråk +GenericName[ta]=ஸ்கிரிப்டிங் மொழி பிராஜக்ட் +GenericName[tg]=Лоиҳа бо забони ғарчкунӣ +GenericName[tr]=Betik Dili Projesi +GenericName[zh_CN]=脚本语言工程 +GenericName[zh_TW]=文稿語言專案 +ServiceTypes=KDevelop/Project +Icon=kdevelop +X-KDE-Library=libkdevscriptproject +X-KDevelop-Version=5 diff --git a/buildtools/script/kdevscriptproject.rc b/buildtools/script/kdevscriptproject.rc new file mode 100644 index 00000000..651b10b4 --- /dev/null +++ b/buildtools/script/kdevscriptproject.rc @@ -0,0 +1,12 @@ + + + +

+ + + + + + + + diff --git a/buildtools/script/scriptnewfiledlg.cpp b/buildtools/script/scriptnewfiledlg.cpp new file mode 100644 index 00000000..336187d3 --- /dev/null +++ b/buildtools/script/scriptnewfiledlg.cpp @@ -0,0 +1,119 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "scriptnewfiledlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "scriptprojectpart.h" +#include "filetemplate.h" + + +ScriptNewFileDialog::ScriptNewFileDialog(ScriptProjectPart *part, + QWidget *parent, const char *name) + : QDialog(parent, name, true) +{ + setCaption(i18n("New File")); + + QLabel *filename_label = new QLabel(i18n("&File name:"), this); + + filename_edit = new KLineEdit(this); + filename_edit->setFocus(); + filename_label->setBuddy(this); + QFontMetrics fm(filename_edit->fontMetrics()); + filename_edit->setMinimumWidth(fm.width('X')*35); + + usetemplate_box = new QCheckBox(i18n("&Use file template"), this); + usetemplate_box->setChecked(true); + + QFrame *frame = new QFrame(this); + frame->setFrameStyle(QFrame::HLine | QFrame::Sunken); + + KButtonBox *buttonbox = new KButtonBox(this); + buttonbox->addStretch(); + QPushButton *ok_button = buttonbox->addButton(KStdGuiItem::ok()); + QPushButton *cancel_button = buttonbox->addButton(KStdGuiItem::cancel()); + ok_button->setDefault(true); + connect( ok_button, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( cancel_button, SIGNAL(clicked()), this, SLOT(reject()) ); + buttonbox->layout(); + + QVBoxLayout *layout = new QVBoxLayout(this, 10, 4); + layout->addWidget(filename_label); + layout->addWidget(filename_edit); + layout->addWidget(usetemplate_box); + layout->addWidget(frame, 0); + layout->addWidget(buttonbox, 0); + + m_part = part; +} + + +ScriptNewFileDialog::~ScriptNewFileDialog() +{} + + +void ScriptNewFileDialog::accept() +{ + QString fileName = filename_edit->text(); + if (fileName.find('/') != -1) { + KMessageBox::sorry(this, i18n("Please enter the file name without '/' and so on.")); + return; + } + + KDevProject *project = m_part->project(); + if (!project->activeDirectory().isEmpty()) + fileName.prepend(project->activeDirectory() + "/"); + QString destpath = project->projectDirectory() + "/" + fileName; + + if (QFileInfo(destpath).exists()) { + KMessageBox::sorry(this, i18n("A file with this name already exists.")); + return; + } + + bool success = false; + + if (usetemplate_box->isChecked()) { + QString extension = QFileInfo(destpath).extension(); + if (!FileTemplate::exists(m_part, extension)) { + KMessageBox::sorry(this, i18n("A file template for this extension does not exist.")); + return; + } + success = FileTemplate::copy(m_part, extension, destpath); + } else { + QFile f(destpath); + success = f.open(IO_WriteOnly); + if (success) + f.close(); + } + + if (!success) + KMessageBox::sorry(this, i18n("Could not create the new file.")); + + kdDebug(9015) << "AddFile1: " << fileName << endl; + m_part->addFile(fileName); + + QDialog::accept(); +} + +#include "scriptnewfiledlg.moc" diff --git a/buildtools/script/scriptnewfiledlg.h b/buildtools/script/scriptnewfiledlg.h new file mode 100644 index 00000000..b3c73713 --- /dev/null +++ b/buildtools/script/scriptnewfiledlg.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _SCRIPTNEWFILEDLG_H_ +#define _SCRIPTNEWFILEDLG_H_ + +#include + +class QCheckBox; +class KLineEdit; +class ScriptProjectPart; + + +class ScriptNewFileDialog : public QDialog +{ + Q_OBJECT + +public: + ScriptNewFileDialog( ScriptProjectPart *part, QWidget *parent=0, const char *name=0 ); + ~ScriptNewFileDialog(); + +protected: + virtual void accept(); + +private: + QCheckBox *usetemplate_box; + KLineEdit *filename_edit; + ScriptProjectPart *m_part; +}; + +#endif diff --git a/buildtools/script/scriptoptionswidget.cpp b/buildtools/script/scriptoptionswidget.cpp new file mode 100644 index 00000000..c1660b00 --- /dev/null +++ b/buildtools/script/scriptoptionswidget.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "scriptoptionswidget.h" + +#include +#include +#include +#include +#include "domutil.h" +#include "kdevlanguagesupport.h" + + +ScriptOptionsWidget::ScriptOptionsWidget(KDevPlugin *part, + QWidget *parent, const char *name) + : ScriptOptionsWidgetBase(parent, name) +{ + m_part = part; + + QDomDocument &dom = *m_part->projectDom(); + + QString includepatterns + = DomUtil::readEntry(dom, "/kdevscriptproject/general/includepatterns"); + + if (includepatterns.isNull() && part->languageSupport()){ + QStringList includepatternList; + KMimeType::List list = part->languageSupport()->mimeTypes(); + KMimeType::List::Iterator it = list.begin(); + while( it != list.end() ){ + includepatternList += (*it)->patterns(); + ++it; + } + includepatterns = includepatternList.join( "," ); + } + + QString excludepatterns + = DomUtil::readEntry(dom, "/kdevscriptproject/general/excludepatterns"); + if (excludepatterns.isNull()) + excludepatterns = "*~"; + + includepatterns_edit->setText(includepatterns); + excludepatterns_edit->setText(excludepatterns); +} + + +ScriptOptionsWidget::~ScriptOptionsWidget() +{} + + +void ScriptOptionsWidget::accept() +{ + QDomDocument &dom = *m_part->projectDom(); + + QString includepatterns = includepatterns_edit->text(); + QString excludepatterns = excludepatterns_edit->text(); + + DomUtil::writeEntry(dom, "/kdevscriptproject/general/includepatterns", includepatterns); + DomUtil::writeEntry(dom, "/kdevscriptproject/general/excludepatterns", excludepatterns); +} + +#include "scriptoptionswidget.moc" diff --git a/buildtools/script/scriptoptionswidget.h b/buildtools/script/scriptoptionswidget.h new file mode 100644 index 00000000..c33d099d --- /dev/null +++ b/buildtools/script/scriptoptionswidget.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _SCRIPTPROJECTOPTIONSWIDGET_H_ +#define _SCRIPTPROJECTOPTIONSWIDGET_H_ + +#include "scriptoptionswidgetbase.h" + +class KDevPlugin; + + +class ScriptOptionsWidget : public ScriptOptionsWidgetBase +{ + Q_OBJECT + +public: + ScriptOptionsWidget( KDevPlugin *part, QWidget *parent=0, const char *name=0 ); + ~ScriptOptionsWidget(); + +public slots: + void accept(); + +private: + KDevPlugin *m_part; +}; + +#endif diff --git a/buildtools/script/scriptoptionswidgetbase.ui b/buildtools/script/scriptoptionswidgetbase.ui new file mode 100644 index 00000000..3a8f7b99 --- /dev/null +++ b/buildtools/script/scriptoptionswidgetbase.ui @@ -0,0 +1,155 @@ + +ScriptOptionsWidgetBase + + + script_project_options + + + + 0 + 0 + 600 + 482 + + + + Script Project Options + + + + unnamed + + + + includepatterns_label + + + &Include files into the project with the following patterns: + + + includepatterns_edit + + + + + Layout2 + + + + unnamed + + + 0 + + + + Spacer4 + + + Horizontal + + + Minimum + + + + 20 + 20 + + + + + + includepatterns_edit + + + + + + + Spacer7 + + + Vertical + + + Minimum + + + + 20 + 20 + + + + + + excludepatterns_label + + + &Exclude the following patterns: + + + excludepatterns_edit + + + + + Layout2_2 + + + + unnamed + + + 0 + + + + Spacer4_2 + + + Horizontal + + + Minimum + + + + 20 + 20 + + + + + + excludepatterns_edit + + + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + kdialog.h + + + + diff --git a/buildtools/script/scriptprojectpart.cpp b/buildtools/script/scriptprojectpart.cpp new file mode 100644 index 00000000..ff560f23 --- /dev/null +++ b/buildtools/script/scriptprojectpart.cpp @@ -0,0 +1,446 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "scriptprojectpart.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevpartcontroller.h" +#include "kdevlanguagesupport.h" +#include "scriptoptionswidget.h" +#include "scriptnewfiledlg.h" +#include "kdevplugininfo.h" + +typedef KDevGenericFactory ScriptProjectFactory; +static const KDevPluginInfo data("kdevscriptproject"); +K_EXPORT_COMPONENT_FACTORY( libkdevscriptproject, ScriptProjectFactory( data ) ) + +ScriptProjectPart::ScriptProjectPart(QObject *parent, const char *name, const QStringList &) + : KDevBuildTool(&data, parent, name ? name : "ScriptProjectPart") +{ + setInstance(ScriptProjectFactory::instance()); + + setXMLFile("kdevscriptproject.rc"); + + // only create new file action if file creation part not available + if (!extension("KDevelop/CreateFile")) { + KAction *action; + action = new KAction( i18n("New File..."), 0, + this, SLOT(slotNewFile()), + actionCollection(), "file_newfile" ); + action->setWhatsThis( i18n("New file

Creates a new file.") ); + action->setToolTip( i18n("Create a new file") ); + } + new KAction( i18n("Rescan Project"), 0, CTRL+ALT+Key_R, + this, SLOT(rescan()), + actionCollection(), "rescan" ); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); +} + + +ScriptProjectPart::~ScriptProjectPart() +{} + + +void ScriptProjectPart::projectConfigWidget(KDialogBase *dlg) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Script Project Options"), i18n("Script Project Options"), BarIcon("kdevelop", KIcon::SizeMedium)); + ScriptOptionsWidget *w = new ScriptOptionsWidget(this, vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + + +/** + * @todo This should really be merged with FileTreeWidget::matchesHidePattern() + * and put in its own class. Currently this is repeated in scriptprojectpart.cpp, pascalproject_part.cpp, adaproject_part.cpp + */ +static bool matchesPattern(const QString &fileName, const QStringList &patternList) +{ + QStringList::ConstIterator it; + for (it = patternList.begin(); it != patternList.end(); ++it) { + QRegExp re(*it, true, true); + if (re.search(fileName) == 0 && re.matchedLength() == (int)fileName.length()) + return true; + } + + return false; +} + + +void ScriptProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + if (!languageSupport()) + kdDebug(9015) << "ScriptProjectPart::openProject: no language support found!" << endl; + + m_projectDirectory = dirName; + m_projectName = projectName; + + QDomDocument &dom = *projectDom(); + + // Set the default directory radio to "executable" + if (DomUtil::readEntry(dom, "/kdevscriptproject/run/directoryradio") == "" ) { + DomUtil::writeEntry(dom, "/kdevscriptproject/run/directoryradio", "executable"); + } + + // Put all files from all subdirectories into file list + QValueStack s; + int prefixlen = m_projectDirectory.length()+1; + s.push(m_projectDirectory); + + QDir dir; + do { + dir.setPath(s.pop()); + kdDebug(9015) << "Examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + if ( dirEntries ) + { + QPtrListIterator it(*dirEntries); + for (; it.current(); ++it) { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + QString path = it.current()->absFilePath(); + if (it.current()->isDir()) { + //do not follow symlinks which point to the themselves + if (it.current()->isSymLink()) + { + QString symLink = it.current()->readLink(); + if ((symLink == path) || (symLink == "./")) + continue; + } else if (canAddDirectoryToProject(path)) { + kdDebug(9015) << "Pushing: " << path << endl; + s.push(path); + } + } + else { + if (canAddToProject(path)) + m_sourceFiles.append(path.mid(prefixlen)); + } + } + } + } while (!s.isEmpty()); + + KDevProject::openProject( dirName, projectName ); +} + + +void ScriptProjectPart::closeProject() +{ +} + + +QString ScriptProjectPart::projectDirectory() const +{ + return m_projectDirectory; +} + + +QString ScriptProjectPart::buildDirectory() const +{ + return m_projectDirectory; +} + +QString ScriptProjectPart::projectName() const +{ + return m_projectName; +} + + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList ScriptProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry(*projectDom(), "/kdevscriptproject/run/envvars", "envvar", "name", "value"); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString ScriptProjectPart::runDirectory() const +{ + QString cwd = defaultRunDirectory("kdevscriptproject"); + if (cwd.isEmpty()) + cwd = buildDirectory(); + return cwd; +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ +QString ScriptProjectPart::mainProgram() const +{ + QDomDocument * dom = projectDom(); + + if ( !dom ) return QString(); + + QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevscriptproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + + return QString(); +} + +/** Retuns a QString with the debug command line arguments */ +QString ScriptProjectPart::debugArguments() const +{ + return DomUtil::readEntry(*projectDom(), "/kdevscriptproject/run/globaldebugarguments"); +} + + +/** Retuns a QString with the run command line arguments */ +QString ScriptProjectPart::runArguments() const +{ + return DomUtil::readEntry(*projectDom(), "/kdevscriptproject/run/programargs"); +} + + +QString ScriptProjectPart::activeDirectory() const +{ + QDomDocument &dom = *projectDom(); + + return DomUtil::readEntry(dom, "/kdevscriptproject/general/activedir"); +} + + +QStringList ScriptProjectPart::allFiles() const +{ +/* QStringList res; + + QStringList::ConstIterator it; + for (it = m_sourceFiles.begin(); it != m_sourceFiles.end(); ++it) + res += (m_projectDirectory + "/" + (*it)); + + return res;*/ + + // return all files relative to the project directory! + return m_sourceFiles; +} + +void ScriptProjectPart::addFile(const QString &fileName) +{ + kdDebug(9015) << "AddFile2" << fileName << endl; + + QStringList fileList; + fileList.append ( fileName ); + + this->addFiles ( fileList ); +} + +void ScriptProjectPart::addFiles ( const QStringList& fileList ) +{ + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + m_sourceFiles.append ( ( *it ) ); + } + + emit addedFilesToProject ( fileList ); +} + +void ScriptProjectPart::removeFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->addFiles ( fileList ); +} + +void ScriptProjectPart::removeFiles ( const QStringList& fileList ) +{ + emit removedFilesFromProject ( fileList ); + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + m_sourceFiles.remove ( ( *it ) ); + } +} + +void ScriptProjectPart::slotNewFile() +{ + ScriptNewFileDialog dlg(this); + dlg.exec(); +} + +/*! + \fn ScriptProjectPart::distFiles() const + */ +QStringList ScriptProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QDir dir(projectDir); + QStringList files = dir.entryList( "*README*"); + return sourceList + files; +} + +void ScriptProjectPart::rescan() +{ +// kdDebug() << "Directory " << path << " changed, scanning for new files in the project" << endl; + + // Put all files from all subdirectories into file list + QValueStack s; + int prefixlen = m_projectDirectory.length()+1; + s.push(m_projectDirectory); + + QDir dir; + do { + dir.setPath(s.pop()); + kdDebug(9015) << "Examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + if ( dirEntries ) + { + QPtrListIterator it(*dirEntries); + for (; it.current(); ++it) { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + QString path = it.current()->absFilePath(); + if (it.current()->isDir()) { + //do not follow symlinks which point to the themselves + if (it.current()->isSymLink()) + { + QString symLink = it.current()->readLink(); + if ((symLink == path) || (symLink == "./")) + continue; + } else if (canAddDirectoryToProject(path)) { + kdDebug(9015) << "Pushing: " << path << endl; + s.push(path); + } + } + else { + if (!isProjectFile(path) && canAddToProject(path)) + addFile(path.mid(prefixlen)); +// m_sourceFiles.append(path.mid(prefixlen)); + } + } + } + } while (!s.isEmpty()); + +/* const QFileInfoList *dirEntries = QDir(path).entryInfoList(); + if ( dirEntries ) + { + kdDebug() << "1" << endl; + QPtrListIterator it(*dirEntries); + for (; it.current(); ++it) { + kdDebug() << "2" << endl; + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + kdDebug() << "3" << endl; + QString filePath = it.current()->absFilePath(); + if (!it.current()->isDir() && canAddToProject(filePath) && !isProjectFile(filePath)) { + kdDebug() << "=== adding " << filePath << endl; + addFile(filePath); + } + } + }*/ +} + +bool ScriptProjectPart::canAddToProject(const QString & path) +{ + QDomDocument &dom = *projectDom(); + QString includepatterns + = DomUtil::readEntry(dom, "/kdevscriptproject/general/includepatterns"); + QStringList includepatternList; + if ( includepatterns.isNull() ) { + if ( languageSupport() ){ + KMimeType::List list = languageSupport()->mimeTypes(); + KMimeType::List::Iterator it = list.begin(); + while( it != list.end() ){ + includepatternList += (*it)->patterns(); + ++it; + } + } + } else { + includepatternList = QStringList::split(",", includepatterns); + } + + QString excludepatterns + = DomUtil::readEntry(dom, "/kdevscriptproject/general/excludepatterns"); + if (excludepatterns.isNull()) + excludepatterns = "*~"; + QStringList excludepatternList = QStringList::split(",", excludepatterns); + + if (matchesPattern(path, includepatternList) + && !matchesPattern(path, excludepatternList)) { + kdDebug(9015) << "Adding: " << path << endl; + return true; + } else { + kdDebug(9015) << "Ignoring: " << path << endl; + return false; + } +} + +bool ScriptProjectPart::canAddDirectoryToProject(const QString & path) +{ + QDomDocument &dom = *projectDom(); + QString excludepatterns + = DomUtil::readEntry(dom, "/kdevscriptproject/general/excludepatterns"); + if (excludepatterns.isNull()) { + return true; + } + QStringList excludepatternList = QStringList::split(",", excludepatterns); + + if (!matchesPattern(path, excludepatternList)) { + return true; + } else { + kdDebug(9015) << "Ignoring Directory: " << path << endl; + return false; + } +} + +#include "scriptprojectpart.moc" diff --git a/buildtools/script/scriptprojectpart.h b/buildtools/script/scriptprojectpart.h new file mode 100644 index 00000000..b16c4ffb --- /dev/null +++ b/buildtools/script/scriptprojectpart.h @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _SCRIPTPROJECTPART_H_ +#define _SCRIPTPROJECTPART_H_ + +#include +#include + +#include "kdevbuildtool.h" + +class QListViewItem; +class QStringList; +class KDialogBase; +class ScriptProjectWidget; + +class ScriptProjectPart : public KDevBuildTool +{ + Q_OBJECT + +public: + ScriptProjectPart( QObject *parent, const char *name, const QStringList &args ); + ~ScriptProjectPart(); + QStringList distFiles() const; + +protected: + virtual void openProject(const QString &dirName, const QString &projectName); + virtual void closeProject(); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString mainProgram() const; + virtual QString activeDirectory() const; + virtual QStringList allFiles() const; + virtual void addFile(const QString &fileName); + virtual void addFiles ( const QStringList& fileList ); + virtual void removeFile(const QString &fileName); + virtual void removeFiles ( const QStringList& fileList ); + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + + bool canAddToProject(const QString &path); + bool canAddDirectoryToProject(const QString &path); + +private slots: + void projectConfigWidget(KDialogBase *dlg); + void slotNewFile(); + void rescan(); + +private: + QString m_projectDirectory; + QString m_projectName; + QStringList m_sourceFiles; + + friend class ScriptNewFileDialog; +}; + +#endif diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 00000000..77d61a45 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,22 @@ +/* config.h. Generated by cmake from config.h.cmake */ + + +#define QT_DOCDIR ${CONFIG_QT_DOCDIR} + +#define KDELIBS_DOXYDIR ${CONFIG_KDELIBS_DOXYDIR} + +#define MAKE_COMMAND "gmake" + +/* Version number of package */ +#define VERSION "3.2.0" + +/* Define if you have libz */ +#define HAVE_LIBZ ${HAVE_LIBZ} + +/* Define if you have libpng */ +#define HAVE_LIBPNG ${HAVE_LIBPNG} + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H ${HAVE_DLFCN_H} + +////////////////////////////// diff --git a/configure.in.bot b/configure.in.bot new file mode 100644 index 00000000..91ad3029 --- /dev/null +++ b/configure.in.bot @@ -0,0 +1,24 @@ +if test "$DOT_FOUND" = "no"; then + echo "" + echo "You're missing the dot program." + echo "It is still possible to run and use KDevelop without it, but you will " + echo "not be able to use the new graphical classbrowser. In order to get " + echo "a dot copy, go to www.graphviz.org and download the graphviz package." +fi + +if test -z "$kdelibs_doxydir"; then + echo "" + echo "You have no kdelibs documentation generated by Doxygen installed." + echo "You should install Doxygen from www.doxygen.org, reconfigure" + echo "and rebuild the kdelibs sources. You should 'make apidox' and" + echo "'make install' in your kdelibs build dir, and then rerun this" + echo "configure script." +fi + +if test -n "$VCSCOMPAT" -a -z "$SVN_SUBDIR"; then + echo "" + echo "You're missing Subversion libraries (1.x)" + echo "KDevelop subversion support will not work without it," + echo "consider installing it." + echo "" +fi diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 00000000..3cdfa2df --- /dev/null +++ b/configure.in.in @@ -0,0 +1,127 @@ +#MIN_CONFIG(3.3.0) + +AM_INIT_AUTOMAKE(kdevelop, 3.5.4) +KDEV_CHECK_KDE_VERSION +KDE_NEED_FLEX + +KDEV_CHECK_DOCBASE +#KDEV_CHECK_SCRIPTING +#KDEV_CHECK_JAVA +#KDEV_CHECK_CSHARP +#KDEV_CHECK_SVN +#KDEV_CHECK_QEDITOR +KDEV_CHECK_BDB +#KDEV_PATH_PYTHONDOCDIR +#KDEV_PATH_PHPDOCDIR +#KDEV_PATH_GNUSTEPDOCDIR +#KDEV_PATH_GTKDOCDIR +KDEV_PATH_QTDOC +KDEV_PATH_KDELIBSDOXY +KDEV_PATH_KDELIBSDOC + +AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0]) + +dnl ********** +dnl Check which programming languages support should be compiled +dnl ********** + +AC_ARG_ENABLE(ada, AC_HELP_STRING([--disable-ada], [disable programming language support for Ada]), [ada=${enableval}], [ada=yes]) +AM_CONDITIONAL(include_ada, test "$ada" = "yes") + +AC_ARG_ENABLE(bash, AC_HELP_STRING([--disable-bash], [disable programming language support for bash]), [bash=${enableval}], [bash=yes]) +AM_CONDITIONAL(include_bash, test "$bash" = "yes") + +AC_ARG_ENABLE(cpp, AC_HELP_STRING([--disable-cpp], [disable programming language support for C and C++]), [cpp=${enableval}], [cpp=yes]) +AM_CONDITIONAL(include_cpp, test "$cpp" = "yes") + +AC_ARG_ENABLE(fortran, AC_HELP_STRING([--disable-fortran], [disable programming language support for Fortran]), [fortran=${enableval}], [fortran=yes]) +AM_CONDITIONAL(include_fortran, test "$fortran" = "yes") + +AC_ARG_ENABLE(java, AC_HELP_STRING([--disable-java], [disable programming language support for Java]), [java=${enableval}], [java=yes]) +AM_CONDITIONAL(include_java, test "$java" = "yes") + +AC_ARG_ENABLE(csharp, AC_HELP_STRING([--disable-csharp], [disable programming language support for C#]), [csharp=${enableval}], [csharp=yes]) +AM_CONDITIONAL(include_csharp, test "$csharp" = "yes") + +AC_ARG_ENABLE(pascal, AC_HELP_STRING([--disable-pascal], [disable programming language support for Pascal]), [pascal=${enableval}], [pascal=yes]) +AM_CONDITIONAL(include_pascal, test "$pascal" = "yes") + +AC_ARG_ENABLE(perl, AC_HELP_STRING([--disable-perl], [disable programming language support for perl]), [perl=${enableval}], [perl=yes]) +AM_CONDITIONAL(include_perl, test "$perl" = "yes") + +AC_ARG_ENABLE(php, AC_HELP_STRING([--disable-php], [disable programming language support for PHP]), [php=${enableval}], [php=yes]) +AM_CONDITIONAL(include_php, test "$php" = "yes") + +AC_ARG_ENABLE(python, AC_HELP_STRING([--disable-python], [disable programming language support for Python]), [python=${enableval}], [python=yes]) +AM_CONDITIONAL(include_python, test "$python" = "yes") + +AC_ARG_ENABLE(ruby, AC_HELP_STRING([--disable-ruby], [disable programming language support for ruby]), [ruby=${enableval}], [ruby=yes]) +AM_CONDITIONAL(include_ruby, test "$ruby" = "yes") + +AC_ARG_ENABLE(sql, AC_HELP_STRING([--disable-sql], [disable programming language support for SQL]), [sql=${enableval}], [sql=yes]) +AM_CONDITIONAL(include_sql, test "$sql" = "yes") + +dnl ********** +dnl Check which build tools support should be compiled +dnl ********** + +AC_ARG_ENABLE(antproject, AC_HELP_STRING([--disable-antproject], [disable build tool support for ant]), [antproject=${enableval}], [antproject=yes]) +AM_CONDITIONAL(include_ant, test "$antproject" = "yes") + +AC_ARG_ENABLE(autoproject, AC_HELP_STRING([--disable-autoproject], [disable build tool support for autotools]), [autoproject=${enableval}], [autoproject=yes]) +AM_CONDITIONAL(include_autoproject, test "$autoproject" = "yes") + +AC_ARG_ENABLE(customproject, AC_HELP_STRING([--disable-customproject], [disable build tool support for custom makefiles]), [customproject=${enableval}], [customproject=yes]) +AM_CONDITIONAL(include_customproject, test "$customproject" = "yes") + +AC_ARG_ENABLE(scriptproject, AC_HELP_STRING([--disable-scriptproject], [disable build tool support for script]), [scriptproject=${enableval}], [scriptproject=yes]) +AM_CONDITIONAL(include_scriptproject, test "$scriptproject" = "yes") + +AC_ARG_ENABLE(trollproject, AC_HELP_STRING([--disable-trollproject], [disable build tool support for qmake]), [trollproject=${enableval}], [trollproject=yes]) +AM_CONDITIONAL(include_trollproject, test "$trollproject" = "yes") + + +dnl ********** +dnl Check which version control systems support should be compiled +dnl ********** + +dnl cervisia is currently disabled +dnl AC_ARG_ENABLE(cervisia, AC_HELP_STRING([--disable-cervisia], [disable vcs support for cervisia]), [with_cervisia=${enableval}], [with_cervisia=yes]) + +AC_ARG_ENABLE(clearcase, AC_HELP_STRING([--disable-clearcase], [disable vcs support for clearcase]), [with_clearcase=${enableval}], [with_clearcase=yes]) +AM_CONDITIONAL(include_clearcase, test "$with_clearcase" = "yes") + +AC_ARG_ENABLE(cvs, AC_HELP_STRING([--disable-cvs], [disable vcs support for cvs]), [with_cvs=${enableval}], [with_cvs=yes]) +AM_CONDITIONAL(include_cvsclient, test "$with_cvs" = "yes") + +dnl This one is automatic and depends is cervisia is installed or not +KDE_CHECK_HEADER(cvsservice_stub.h, [cvsservice_stub_h="found"], [cvsservice_stub_h="none"]) +AM_CONDITIONAL(include_cvsservice, test "$cvsservice_stub_h" = "found") + +AC_ARG_ENABLE(perforce, AC_HELP_STRING([--disable-perforce], [disable vcs support for perforce]), [with_perforce=${enableval}], [with_perforce=yes]) +AM_CONDITIONAL(include_perforce, test "$with_perforce" = "yes") + +dnl ********** +dnl Check which embedded support should be compiled +dnl ********** + +AC_ARG_ENABLE(vba, AC_HELP_STRING([--enable-vba], [enable visualboy advance support]), [with_vba=${enableval}], [with_vba=no]) +AM_CONDITIONAL(include_vba, test "$with_vba" = "yes") + + +AC_PATH_PROG(DOT_FOUND, dot, no) +AC_CHECK_PROG(gmake_prog, gmake, gmake, make) +AC_CHECK_PROGS(TAR, gnutar gtar tar, [AM_MISSING_PROG(tar)]) +AC_CHECK_PROG(GZIP_COMMAND, gzip, gzip) +AC_DEFINE_UNQUOTED(MAKE_COMMAND, "$gmake_prog", [GNU make command]) + +CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS" +case $host_os in +hpux11*) + CPPFLAGS="$CPPFLAGS -D_PROTOTYPES" + ;; +esac + +AC_CHECK_FILE([$qt_includes/qassistantclient.h], [],[AC_MSG_ERROR([The qassistantclient.h header from Qt3 is needed to build kdevelop, on some systems this header is in a separate package called qt3-apps-dev])]) + +KDE_INIT_DOXYGEN([KDevelop], [Version $VERSION]) diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 00000000..2c7c6128 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = kdevelop std extras kde_app_devel + diff --git a/doc/api/Architecture.dox b/doc/api/Architecture.dox new file mode 100644 index 00000000..ae4ef73d --- /dev/null +++ b/doc/api/Architecture.dox @@ -0,0 +1,315 @@ +/** \file Architecture.dox + * \brief KDevelop architecture + */ + +/** \page architecture KDevelop 3 Architecture + +KDevelop uses a plugin based architecture. This will be explained in more +detail in the next sections. To add a new plugin check the \ref howToAddPlugins page. + +\section devteammodel Development Team cooperation model + +KDevelop is the result of the work of many people. To help syncronize the effords and to automate +some tasks, the team uses many tools: + + - CVS servers + - KDE Bugzilla + - Web servers + - Mailing Lists + - IRC + - Doxygen + - docbook + - LXR + - E-mail :) + - Cron Jobs + - and of course KDevelop :) + . + +They get interconnected like this: + +\image html Development.png + + +\section overview Source Overview + +\subsection source-division Main Source Divisions + +The KDevelop 3 source is divided into several parts which correspond to +subdirectories in the KDevelop project directory. There are several main +parts to distinguish, mainly: + + - src = The core part of KDevelop + - lib/interfaces = Plugin handler interface classes + - parts = The various parts using the KParts framework ( KDevPlugin children ) + - languages = \ref language-parts + - buildtools = \ref buildtool-parts + - vcs = \ref vcs-parts + - editors = \ref editor-parts + . + +\image html Architecture.png + +This image is not complete there are parts that are not displayed. See below for a more detailed description. + +\subsection core-part The Core Part of KDevelop + +\subsubsection mainwindows Main Window Objects + +There are two types of possible main window objects: + + - MainWindow implements standard MDI user interfaces: + - Top level mode (see MainWindow::switchToToplevelMode() ) + - Childframe mode (see MainWindow::switchToChildframeMode() ) + - Tab page mode (see MainWindow::switchToTabPageMode() ) + - IDEAl mode (see MainWindow::switchToIDEAlMode() ) + . + - MainWindowIDEAl implements an enhanced MDI main window providing a set of + pre-arranged access tabs around user areas. + . + +Both main window classes inherit from the KDevMainWindow class which provides +access to common window features. + +\subsubsection toplevel The TopLevel Object + +There is only one toplevel object of class KDevMainWindow in KDevelop. It can +be accessed through the static function TopLevel::getInstance() (see the +TopLevel class). + +\subsection parts-overview KDevelop Parts Overview + +All parts reside in dedicated subdirectories acording to their function. They can +be viewed according to their functionalities as follows. + +\subsubsection language-parts Programming Language Support Parts + +These parts implement a KDevLanguageSupport Class interface. +To add support for a new programming language check the \ref howToAddProgrammingLanguages page (doc/api/HowToAddProgrammingLanguages.dox file). +Take a look at \ref LangSupportStatus (doc/api/LangSupportStatus.dox file) to see the current status/features of the programming languages currently supported by KDevelop. + + - languages/ada = Support for Ada + - (see AdaSupportPart) + . + - languages/bash = Support for bash + - (see BashSupportPart) + . + - languages/cpp = Support for C/C++ + - (see CppSupportPart) + - languages/cpp/debugger = GNU Debugger frontend + - (see GDBDebugger::DebuggerPart) + . + . + . + - languages/fortran = Support for Fortran + - (see FortranSupportPart) + . + - languages/haskell = Support for Haskell + - (see HaskellSupportPart) + . + - languages/java = Support for Java + - (see JavaSupportPart) + - languages/java/degugger = Java debugger frontend + - (JAVADebugger::JavaDebuggerPart) + . + . + . + - languages/pascal = Support for Pascal + - (see PascalSupportPart) + . + - languages/perl = Support for Perl + - (see PerlSupportPart) + . + - languages/php = Support for PHP + - (see PHPSupportPart) + . + - languages/python = Support for Python + - (see PythonSupportPart) + . + - languages/ruby = Support for Ruby + - (see RubySupportPart) + . + - languages/sql = Support for SQL + - (see SQLSupportPart) + . + . + +\subsubsection buildtool-parts Build tools Parts + +These parts implement a KDevProject Class interface. + + - buildtools/ada = Ada build tool + - (see AdaProjectPart) + . + - buildtools/ant = ANT build tool + - (see AntProjectPart) + . + - buildtools/autotools = Autotools build tool + - (see AutoProjectPart) + . + - buildtools/custommakefiles = Custom makefiles build tool + - (see CustomProjectPart) + . + - buildtools/generic = Generic build tool + - (see GenericProjectPart) + . + - buildtools/pascal = Pascal build tool + - (see PascalProjectPart) + . + - buildtools/script = Script build tool + - (see ScriptProjectPart) + . + - buildtools/qmake = QMake based build tool + - (see TrollProjectPart) + . + . + + +\subsubsection vcs-parts VCS (Version Control System) Parts + +These parts implement a KDevVersionControl Class interface. + + - vcs/cervisia = Cervisia Support + - (see CervisiaPlugin) + . + - vcs/clearcase = IBM Rational ClearCase Support + - (see ClearcasePart) + . + - vcs/cvs = CVS Support + - (see CvsPart) + . + - vcs/cvsservice = cvsservice Support (Cervisia interface) + - (see CvsServicePart) + . + - vcs/perforce = Version managment system perforce integration + - (see PerforcePart) + . + - vcs/subversion = Subversion integration + - (see subversionPart) + . + . + + +\subsubsection editor-parts editor support Specific Parts + +These parts implement a KTextEditor Class interface. +Take a look at \ref EditorsSupportStatus (doc/api/EditorsSupportStatus.dox file) to see the current status/features of the editors currently supported by KDevelop. + + - editors/editor-chooser = Chooses an internal text editor + - (see EditorChooserPart) + . + - editors/nedit = KTextEditor interface for nedit + - (see KNEditFactory, Document, View) + . + - editors/qeditor = QEditor integration + - (see QEditorPart) + . + . + + +\subsubsection global-parts Global Parts + +Some of the parts are considered global - that is, they effect the entire +operation of KDevelop. + +These parts implement a KDevPlugin Class interface. + + - parts/appwizard = New Project Wizard + - see AppWizardPart + - see \ref howToAddApplicationTemplates (doc/api/HowToAddApplicationTemplates.dox file) + . + - parts/history = Project history + - (see HistoryPart) + . + - parts/konsole = Embedded Konsole + - (see KonsoleViewPart) + . + - parts/doctreeview = Documentation Viewer + - (see DocTreeViewPart) + . + - parts/openwith = "Open with" menu addon + - (see OpenWithPart) + . + - parts/fileselector = A file selection widget + - (see FileSelectorPart) + . + - parts/uimode = Customize the UI mode + - (see UIChooserPart) + . + - parts/texttools = Additional text tools + - (see TextToolsPart) + . + - parts/tipofday = A tip of the day + - (see TipOfDayPart) + . + - parts/grepview = A graphical grep utility + - (see GrepViewPart) + . + - parts/tools = Toolbar management + - (see ToolsPart) + . + - parts/regexptest = A regular expression tester + - (see RegexpTestPart) + . + - parts/abbrev = Abbreviation Expansion + - (see AbbrevPart) + . + - parts/filter = Shell Filtering and Insertion + - (see FilterPart) + . + - parts/valgrind = A graphical valgrind frontend + - (see ValgrindPart) + . + . + + +\subsubsection project-specific-parts Project Specific Parts + +These parts implement a KDevPlugin Class interface. + + - parts/astyle = Source code formatter + - (see AStylePart) + . + - parts/buglist = Bug tracking application + - (see BugList) + . + - parts/classview = Classview Manager + - (see ClassViewPart) + . + - parts/ctags = CTags frontend + - (see CTagsPart) + . + - parts/diff = Difference viewer + - (see DiffPart) + . + - parts/distpart = Aids in building and publishing the final project + - (see DistpartPart) + . + - parts/doxygen = Doxygen integration + - (see DoxygenPart) + . + - parts/filecreate = New file creation + - see FileCreatePart + - see \ref howToAddFileTemplates (doc/api/HowToAddFileTemplates.dox file) + . + - parts/fileview = File groups + - (see FileViewPart, FileGroupsPart) + . + - parts/manager = Document manager + - (see DocManager, ViewManager) + . + - parts/outputviews = Application output views + - (see AppOutputViewPart, MakeViewPart) + . + - parts/scripting = Python scripting interface + - (see ScriptingPart) + . + - parts/sourcenav = Source code navigation + - (see SourceNavPart) + . + - parts/visualboyadvance = VisualBoy Advance integration + - (see VisualBoyAdvance::VisualBoyAdvancePart) + . + . + +*/ + diff --git a/doc/api/Architecture.png b/doc/api/Architecture.png new file mode 100644 index 00000000..306881fa Binary files /dev/null and b/doc/api/Architecture.png differ diff --git a/doc/api/Architecture.sxd b/doc/api/Architecture.sxd new file mode 100644 index 00000000..b48f9a36 Binary files /dev/null and b/doc/api/Architecture.sxd differ diff --git a/doc/api/Development.png b/doc/api/Development.png new file mode 100644 index 00000000..063e63db Binary files /dev/null and b/doc/api/Development.png differ diff --git a/doc/api/Development.sxd b/doc/api/Development.sxd new file mode 100644 index 00000000..ff5b06cc Binary files /dev/null and b/doc/api/Development.sxd differ diff --git a/doc/api/EditorsSupportStatus.dox b/doc/api/EditorsSupportStatus.dox new file mode 100644 index 00000000..e826471c --- /dev/null +++ b/doc/api/EditorsSupportStatus.dox @@ -0,0 +1,189 @@ +/** \file EditorsSupportStatus.dox + * \brief Editors Support Status + */ + +/** \page EditorsSupportStatus Editors Support Status + +Kate and Kvim are part of KDE and KDevelop just uses them. + +qeditor and Nedit are interfaced via KDevelop's code. You can look at their code at editors/qeditor and editors/nedit. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
features/editorkatekvim (KDE 3.2)qeditorNedit (Disabled)
Advanced text editor
Open, close and save big text filesYNYY
Undo and redoYNY
Jump in text: next/previous character, word.YNYY
Jump to start or the end of the line/textYNYY
Go to lineYNY
Select text when jumping (character, word, line), YNY
Select all the textYNY
Copy, paste and delete selections of textYNY
PrintYNY
Advanced text view:
Horizontal and vertical scrollingYNY
Display selectionsYNY
Mouse Wheel supportYNY
Dynamic word wrapYN
Line numbersYN
Show tabsYN
Find in fileYNY
Replace in fileYNY
Coding specific properties:



Syntax highlightingYNY
Code foldingYN
SpellYN
Auto indendtNNY
+ +*/ diff --git a/doc/api/FutureTasks.dox b/doc/api/FutureTasks.dox new file mode 100644 index 00000000..fbed119a --- /dev/null +++ b/doc/api/FutureTasks.dox @@ -0,0 +1,136 @@ +/** \file FutureTasks.dox + * \brief Future tasks and ideas for the next release of KDevelop + */ +/** \page FutureTasks Future tasks and ideas for the next release of KDevelop + +\section codereftodo Code Refactoring / Improvements: + + - Core + - Make sure all lib interfaces are available via DCOP + - Find a nicer way to remove dynamic menu entries from context menus + - Resolve the path handling mess + - Project name should be able to contain spaces + - Import existing directory: Should be named "Import existing project" + and more intuitive (wizard-like) + - Question from the wizard: "I have found C++ files in your + project directory. Should C++ be the primary language of your + project?" User: [Yes/No] => Next Step... + - Something intuitive for the binary/-ies (for debugger and + execution of program), libtool ([Yes/No] for the debugger), build + tool (qmake, automake,...?), etc.., too. + - use mimetype to determine code files, not extension + (see bug # + - Make the help buttons (that we already have) open the KDevelop Handbook on + the correct page (or the index if the subject is not covered yet). + - New and improved VCS framework (Needs better description) + - Another look at the plugin system (Nees better description) + - Another look at the project files (shared, non-shared, session) + - fix(redesign?) project language switching + - editor handling could be made a bit saner if editor plugin switching was an after-restart-only feature + + - Programming Language Support Parts + - Create base classes for language support parts: + - AntlrLanguageSupport + - AntlrBackgroundParser + - AntlrProblemReporter + - Same for: + - YaccLanguageSupport + - YaccBackgroundParser + - YaccProblemReporter + - There is a possibility to create even something like + - LanguageSupportBase + + Look at java, pascal and ada support parts to get more inspiration. + There should be base classes for ada, java and pascal language supports - too much code duplication. + + - CppSupportPart + - Extended "make member" functionality - run on a .h to implement stubs for all unimplemented non-abstract methods + - Code Refactoring + - text hint type info tooltips (edit mode) + - text hint value info tooltips (debug mode) + - Make the language plugin know stuff like what file patterns to look for (for instance, "find in files" needs this) + + - Build tools Parts + - Show .po files in project management + - Custom actions for groups, targets and files for project managers: + - any menu item should be a KAction plugged into KPopupMenu, also we need to define shortcuts for any such action, + also we should make sure those actions are properly executed from a shortcut. + - AutoProjectPart + - Should be able to DND files from other targets / file list / konq to add to targets + - Should loose the experimental crashy and nonstandard "add files" dialog + - Update configure.in when sub projects are added and the project doesn't use am_edit + - Keep the correctly cased project name and save it to the project file + + - Debugger Parts + - Create a debugger support base classes. Make the current GDB support a plugin. + - Implement parts for other debuggers i.e. DBX, WDB, Ladebug, JDB, XDB, bashdb, the Perl debugger, or the Python debugger. + We can use DDD as inspiration. + - General debugger + - variable widget + - set variable by editing the value in the tree + - cast value by editing the type in the tree + - disassembly + - add breakpoint display + - set breakpoint by selecting a line as in the edit window + - allow scrolling of disassembled code about and below current limits + - add source to disassembled code as comments + - basically just re-work the whole disassemble window :) + - Bugs + - Fix "core file" handling + - Fix "attach to" handling + - Breakpoints can disappear at odd times + - When the target program crashes, the debugger can't be started again. (intermittant?) + - Break on method() - could have multiple methods which require a choice. How to handle this? + + + - Plugins + - DocTreeViewPart + - Implement plugin system for doctreeview. + - improve documentation browsing + - Check if a man page exists before offering the context menu item 'Goto manpage' + - right click -> set as bookmark in docviewer + - ClassViewPart + - Implement language-dependant plugin system for classview: + - namespaces/classes/functions are not always applicable to a language, we need a way to correctly + fill a class view and combo boxes - only a language support can do that properly. + - Distinguish vanilla c++ support from c++ + Qt extensions and show signals/slots in the class view only with Qt. (is this still valid?) + - KonsoleViewPart + - Perhaps use konsole part for the application frontend + - cd's when selecting a file, but doesn't when selecting a dir, + desired: a menu option to "cd" to that directory + - QEditor + - Replace editors/qeditor/koReplace.* and editors/qeditor/koFind.* with kdelibs/kutils/kreplace.* and kdelibs/kutils/kfind.* + + +\section extensiontodo Extensions / New Functionality: + + - Core + - implement multiple-views per document (why?) + - Document manager (not obviously useful) + - Implement Add Plugin + - Show intro page on startup + - Programming Language Support Parts + - Build tools Parts + - Plugins + - better sourcenav part (all navigation tools should be supported with at least a "back" action - forward much less important) + - Integrate kontact's TODO-List and knotes plugin. (We need something like a + server/client system that all the knotes/toto-clients are always synced.) + - a generic macro-tool (if possible, probably best implemented as a KTE plugin) + - Free grouping of files in file group plugin + + +\section misctodo Miscellaneous (and possibly invalid) items: + + - UI bugs + - Editor options dialog missing when all views are closed (virtually impossible to fix) + - If you click an error in the output view, "Next Error"/"Previous + Error" should then start from that point (already implemented?) + - Messages in status bar would look nicer if they appeared with + the same border as other items (impossible) + - Browser tool bar should truncate long menu entries so it doesn't + take so much space (already implemented?) + - Extend KDevPlugin-API in order to have a preferred border for at + least the selection parts (Automake Manager, Class Browser, File + Groups, etc...) + +*/ diff --git a/doc/api/HighPriTasks.dox b/doc/api/HighPriTasks.dox new file mode 100644 index 00000000..21116342 --- /dev/null +++ b/doc/api/HighPriTasks.dox @@ -0,0 +1,36 @@ +/** \file HighPriTasks.dox + * \brief High priority tasks + */ +/** \page HighPriTasks High priority tasks! + +\section fixMajBugs Fixing major/annoying bugs + + - Fix the mess of .kdevelop and .kdevses file. + - All project wide setings should go into .kdevelop and + - all session (and personal) options should go into .kdevses file + . + This way the .kdevelop file can be shared in teams of developers. + + +\section KDevelop2compat KDevelop 2 compatibility +(These are things that must be accomplished before we can say that KDevelop 3 +>= kdevelop 2.x UI-wise and functionality-wise!) + + - general UI issues: + - toplevel UI mode broken concerning to the accels + - [Modified] missing in mainframe caption + - captions missing for toolbar buttons + . + - build/configuration: + - cross-compiling feature missing + - make "MIN_VERSION" configurable on new project creation + . + - doctreeview: + - implement "Make User Manual" + - use kdoc to update Qt/KDE docs + . + - Solve the regression bugs. These are the ones +marked with priority "HI" in the bug database + + +*/ diff --git a/doc/api/HowToAddApplicationTemplates.dox b/doc/api/HowToAddApplicationTemplates.dox new file mode 100644 index 00000000..7eec80c7 --- /dev/null +++ b/doc/api/HowToAddApplicationTemplates.dox @@ -0,0 +1,285 @@ +/** \file HowToAddApplicationTemplates.dox + * \brief How to add application templates to the application wizard part + */ +/** \page howToAddApplicationTemplates How to add application templates to the application wizard part + +Project templates provide the developer with a basic application framework. +This is necessary for rapid application development (RAD) and makes it even possible +for an inexperienced 3rd party developer to create standard conforming +applications like kedit as well as plugins for example for kdevelop or noatun.\n\n +\ref templates_1\n + - \ref templates_1_1 + - \ref templates_1_2 + - \ref templates_1_2a + - \ref templates_1_2b + - \ref templates_1_2c + - \ref templates_1_2d + - \ref templates_1_2e + . + . +\ref templates_2\n +\ref templates_3\n +\ref templates_4\n + +


+ +\section templates_1 I. Example: How To Create a Simple KDE Application Template "KHello" + +You can find this template in $KDEDIR/share/apps/kdevappwizard/template-khello. + +\subsection templates_1_1 I.1. Step 1: Basic Skeleton + +Create a directory template-khello with the files +
+    - template-khello/app.cpp
+    - template-khello/app.h
+    - template-khello/app.desktop
+    - template-khello/app.kdevelop
+    - template-khello/appui.rc
+    - template-khello/khello
+    - template-khello/main.cpp
+    - template-khello/preview.png
+    - template-khello/script
+    - template-khello/src-Makefile.am
+    - template-khello/subdirs
+    .
+
+\note The directory name must begin with "template-". + +\subsection templates_1_2 I.2. Step 2: The Files in Detail + +Have a look into the files! There are some variables which the application +wizard will replace: +
+    - \%{AUTHOR} ...... by the author
+    - \%{EMAIL} ....... by the e-mail address 
+    - \%{VERSION} ..... by the version
+    - \%{APPNAME} ..... by the project name (KHello)
+    - \%{APPNAMELC} ... by the project name in lowercase (khello)
+    - \%{APPNAMEUC} ... by the project name in uppercase (KHELLO)
+    - \%{LICENSE} ..... by the license (GPL, BSD, QPL, LGPL, ...)
+    - \%{LICENSEFILE} . by the licensefile
+    - \%{YEAR} ........ by the year
+    .
+
+All this can be found in $KDEDIR/share/apps/kdevappwizard/template-common/kdevelop.pm. +\subsubsection templates_1_2a I.2.1. The Source Files + +The files template-khello/app.cpp, template-khello/app.h and +template-khello/main.cpp contain the source code that should not +be too special so that the user can implement his own ideas.\n +(There may be variables included - see \ref templates_1_2 "Step 2: The Files in Detail"). + +\subsubsection templates_1_2b I.2.2. The File template-khello/khello + +It may look like this: +\verbinclude khello/khello + +The application wizard looks into this file to get + - the information where to integrate the plugin into the the listview (Category=) + - the name (Name=) and the comment (Comment=) + - the preview image (Icon=) + - and the file templates the project uses (FileTemplates=). + . +Further information could be (not required): + - Comment= a small comment for the template. Longer comments should go into a README.devel and shown on startup + - ShowFilesAfterGeneration= a comma-separated list (without whitespaces) of files that should be opened immediately after the generation, for instance a README.devel or a source file the user has to modify, the path is relative to the project directory (example: ShowFilesAfterGeneration=src/main.cpp,src/plugin.cpp). And + - APPNAMEUC will be replaced with the projectname in uppercase, + - APPNAMELC will be replaced with the projectname in lowercase, + - APPNAME will be replaced with the projectname. + . + - DefaultDestinatonDir changes the default destination dir for the project (~) to your value, whereas HOMEDIR is a keyword + . + +\attention The file template-khello/khello must have the same name as +the right half of the directory! If the directory is template-foobar +the file must be template-foobar/foobar. + +\see AppWizardPart for more information. + +\subsubsection templates_1_2c I.2.3. Some Additional Files + +The file + - template-khello/appui.rc contains information about the toolbar and the menu. + - template-khello/preview.png will be shown in the aplication wizard. + - template-khello/app.desktop describes the application. + - template-khello/subdirs contains a list of the subdirectories (usually doc, po, src) and can be found in the project root directory. It is necessary for the autotools. + . + +\subsubsection templates_1_2d I.2.4. The File template-khello/src-Makefile.am + +This file will be copied to the $PROJECTDIR/src/. +\verbinclude khello/src-Makefile.am + +\subsubsection templates_1_2e I.2.5. The File template-khello/script + +The following script is used to install the template and replaces all +variables by the corresponding value. The result is a hopefully working +kdevelop project! +\verbinclude khello/script +
+\note There are several application templates which use some identical +files - that's why some files are taken from the "template-common"-directory. + +\section templates_2 II. Registration/Installation Of The Application Template + +The easiest way to install your template is to provide an "install.sh" shell script.\n +Example: +\code +#!/bin/sh + +kde_prefix=`kde-config --prefix` +if [ `id -u` = 0 ]; then + # we are root so install the template into the global kde directory + kde_dir=`kde-config --prefix` +else + # we are a user so install it into $HOME/.kde/share/apps/kdevappwizard directory + kde_dir=`kde-config --localprefix` + echo "Note: It would be better to install as root. Press CTRL+C to abort" +fi + +# use usual path or another one? +echo "Install dir [${kde_dir}/share/apps/kdevappwizard]:" +read newdir + +if [ "$newdir"a = a ]; then newdir="${kde_dir}/share/apps/kdevappwizard/"; fi + +# make sure the directories exist +if [ ! -e "${newdir}/template-khello" ]; then mkdir -p "${newdir}/template-khello" ; fi; +if [ ! -e "${newdir}/templates" ]; then mkdir -p "${newdir}/templates" ; fi; +if [ ! -e "${newdir}" ]; then mkdir -p "$newdir" ; fi; +if [ ! -e "${newdir}/template-common" ]; then ln -s "${kde_prefix}/share/apps/kdevappwizard/template-common" "${newdir}/template-common" ; fi; + +# install now +cp -R --target-directory "$newdir" template-khello +# the file template-khello/khello must go to the "templates" directory that +# kdevelop knows that it exists +mv "$newdir/template-khello/khello" "$newdir/templates/" +echo "done" +\endcode +\n +\attention Please test your template whether it installs and behaves correctly! Test, test and test again! ;) + +\section templates_3 III. How To Add The Template To KDevelop CVS HEAD + +This section is for kdevelop developers only. Most probably you don't have to read this!.\n +Move the directory "template-khello" to kdevelop/languages/cpp/app_templates/ +and then add the following files in kdevelop/languages/cpp/app_templates/template-khello/ +(in this example the language is c++ if you use other language replace cpp with the language name): + - ".kdev_ignore" is an empty file. It prevents KDevelop's + C++-parser from parsing the C++ template files. This is necessary because the template files are just code templates and not real code (yet). + - ".cvsignore" looks like this: +\code +Makefile +Makefile.in +script.local +\endcode + - "Makefile.am" looks like this: + \verbinclude khello/Makefile.am + . +Finally add "template-khello" to "SUBDIRS = " in kdevelop/languages/cpp/app_templates/Makefile.am.\n +\attention Please test your template whether it installs and behaves correctly! +Test, test and test again! It works? Well - now talk to the kdevelop guys so +that they know what's going on and probably you may commit. ;) + +\section templates_4 IV. Changes to the template system (VERY IMPORTANT) + +The entire app template system described above has been changed. +To port a template to the new system the +information from the script file will need to be moved into the ini file. +The example is as follows: +\code +install( +"${src}/template-chello/app.kdevelop","${dest}/${APPNAMELC}.kdevelop" ); +\endcode +becomes +\code +[PROJECT] +Type=install +Source=%{src}/template-chello/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop +\endcode + +Things like installIncAdmin(); and installGNU(); now involve unpacking +the tar archives. This is done by creating a target in the ini file as +follows: +\code +[GNU] +Type=install archive +Source=%{src}/template-common/gnu.tar.gz +Dest=%{dest} +\endcode + +The popular script functions convert as follows: +\code +installIncAdmin(); %{src}/template-common/incadmin.tar.gz +installGNU(); %{src}/template-common/gnu.tar.gz +installAdmin(); %{src}/template-common/admin.tar.gz +installGnome(); %{src}/template-common/gnome.tar.gz +installWX(); %{src}/template-common/wxwidgets.tar.gz +\endcode + + +To create directories is now: +\code +[SRC] +Type= mkdir +Dir=%{dest}/src +\endcode + +New additions are as follows: +\code +[MGS] +Type=message +Comment=A simple C project was created in %{dest}. +\endcode + +Will allow you to display a custom message when the template has +finished installing. This is very handy for projects that require +custom variables to be set. + +The concept of custom variables was also introduced. To create a +variable that can be edited from the project wizard you need to add an +entry as follows: +\code +[LIBS] +Type = value +ValueType= +Value= +Comment= +Default= +\endcode + +One special value can be used to turn targets on and off. This is done +by adding a value as follows: +\code +[DOCSOPT] +Type = value +ValueType=bool +Value=INSTALL_DOCS +Comment= Install Docbook documentation templates. +Default=true +\endcode + +Then in the targets you wish to make optional you add the Option +property with the value's name as the data. This will look as follows: +\code +[DOCSDIREN] +Type=mkdir +Dir=%{dest}/doc/en +Option=INSTALL_DOCS +\endcode + +The Option target is available to the mkdir, install, and install +archive targets. + +The last new addition is the optional post processing of the files as +they are copied. For install and install archive you can add a +Process=true or Process=false to turn the processing on or off. + +A note on the UI. its not final, it will get better. Suggestions or +bugs should be noted asap. + +*/ diff --git a/doc/api/HowToAddFileTemplates.dox b/doc/api/HowToAddFileTemplates.dox new file mode 100644 index 00000000..fa6e630b --- /dev/null +++ b/doc/api/HowToAddFileTemplates.dox @@ -0,0 +1,30 @@ +/** \file HowToAddFileTemplates.dox + * \brief How to add file templates to the file create part + */ +/** \page howToAddFileTemplates How to add file templates to the file create part + +File templates provide the developer with a basic file. They are prototypes for both source files of +the project's language, and for other files that may be useful in the project. For example, a C++ +project may have templates for both .cpp and .h files, plus QT Designer .ui files, and supporting +files such as XML. + +These prototypes are placed in parts/filecreate/file-templates dir or +languages/YOURLANGUAGE/file_templates and have names equal to the extensions of language +source files. + +Sometimes, different 'flavours' of template are required for a particular file type. In these +instances, 'subtypes' can be defined to allow several different templates for a file type. An example +of this are QT designer '.ui' files. KDevelop supplies several different templates for .ui +files. Subtypes are named by the file type extension followed by a hyphen followed by an identifier +for the subtype. E.g. ui-widget, ui-dialog + +The description of the prototypes is placed in parts/filecreate/template-info.xml. This +file is fairly self-explanatory if you take a look at it. + +Note that templates and templates information can be edited within KDevelop itself. The global +templates that can be made available to any project can be changed in Settings / Configure KDevelop... / New File +Wizard; and project related settings can be changed in Project / Project Options / New File Wizard. + +That's all! :) + +*/ diff --git a/doc/api/HowToAddGenericBuildTools.dox b/doc/api/HowToAddGenericBuildTools.dox new file mode 100644 index 00000000..b073cf0f --- /dev/null +++ b/doc/api/HowToAddGenericBuildTools.dox @@ -0,0 +1,21 @@ +/** \file HowToAddGenericBuildTools.dox + * \brief How to add a generic build tool plugins to the generic build tool part + */ + +/** \page howToAddGenericBuildTools How to add a generic build tool plugins to the generic build tool part + +This part offers build tool facilities using project files in xml format (dtd is located in buildtools/generic/kdevxmlproject.dtd). +Those xml files can be converted into makefiles, ant xml files or simply shell scripts using build system plugins. +Build system plugin is an object that implements KDevBuildSystem interface. +Build system plugins are located in buildtools/generic/buildsystem. + +\section sectionStep1 Step 1: Make your plugin loadable + +For a plugin foo, create a file foo.desktop which contains KDevelop/Part in its list of ServiceTypes. + +The rest of this document is to be written. + +Document your plugin in the way described at \ref howToDocument (doc/api/HowToDocument.dox file). + +*/ + diff --git a/doc/api/HowToAddPlugins.dox b/doc/api/HowToAddPlugins.dox new file mode 100644 index 00000000..ce8f259a --- /dev/null +++ b/doc/api/HowToAddPlugins.dox @@ -0,0 +1,204 @@ +/** \file HowToAddPlugins.dox + * \brief How to extend KDevelop via plugins + */ + +/** \page howToAddPlugins How to extend KDevelop via plugins + +\section createDesktop Step 1: Make your plugin loadable + +For a plugin foo, create a file foo.desktop which contains KDevelop/Part in its list of ServiceTypes. + + - See parts/doctreeview/kdevdoctreeview.desktop for an example. + . + +If you install this file into \$(kde_servicesdir), your plugin will automatically be loaded. + +\subsection changeLoading How to change the default loading + +You can change the default loading by changing some settings in your foo.desktop file: + + - Set X-KDevelop-Scope= to Global or + Project + - Note: This property is not optional + . + - You can add a list of programming languages which are supported by your + plugin + - If your plugin works with all languages leave the + X-KDevelop-ProgrammingLanguages= field empty + (optional) + . + - You can add a list of keywords. + - The plugin will only be loaded if all keywords match with the + Keywords= field in the projectfile (optional). + . + . + +An example from the Java Debugger Plugin: + +
+    #######################
+    X-KDevelop-Scope=Project
+    X-KDevelop-ProgrammingLanguages=Java
+    Keywords=
+    ##########################
+
+ + +\section createFactory Step 2: Make the plugin accessible by the factory + +Create a factory class FooFactory which inherits +KDevFactory. Put a section + +
+    extern "C" {
+        void *init_libfoo()
+        {
+            return new FooFactory;
+        }
+    }
+
+ +into the source file, so that the factory can be accessed by KDE's library +loader. Keep in mind that the name of the method init_libfoo() is +required for a library with the name libfoo.so. + +This may be simplified by the use of the +K_EXPORT_COMPONENT_FACTORY macro which is defined in +klibloader.h: + + +K_EXPORT_COMPONENT_FACTORY( libfoo, FooFactory ); + + + - Note: Your factory must reimplement the + createPartObject() method of KDevFactory and + produce the part there. + . + +See parts/doctreeview/doctreeviewfactory.cpp for an example. + + +\section implementPart Step 3: Implement your part. + +Your part must be derived from KDevPlugin. + + - KDevPlugin takes two arguments: + - 1) A parent argument. This also comes from + createPartObject(). + - 2) A name, which in turn is given to the QObject + constructor. + . + . + +\subsection accessIDE How to access other IDE components + +A part can access other components of the IDE via some accessors +of KDevPlugin: + + - The application core via core(), + - the build tools via project(), + - the programming language specific stuff via + languageSupport(), + - the make frontend via makeFrontend(), + - the part which displays appication output via + appFrontend(), + and finally + - the symbol database via classStore(). + . + +In order to see what these components provide, see lib/interfaces/kdev*.h. + +\subsection userPrefs How to store user preferences + +Parts can also store user preferences on a per-project basis. To this +end, they can access a QDomDocument representing the project file +(which is stored as xml) via document(). + +Take attention to the issue that the project file usually is shared in a team of +developers (e.g. via version control application CVS). So some user preferences might be +very individual, and some may be valid for all of the team - project-wide so to speak. + +That's why the KDevelop architecture makes a difference here and supports two files +which will be stored in the project root directory. They are the project file (*.kdevelop) +and the session (*.kdevses) file. The later is for individual settings, not to be thought +to be shared. + +\subsection domProject Project file (*.kdevelop) + +For your convenience, you don't have to use the quite complex DOM API. Strings +can very easily be read from and written to this document using the +DomUtil class. Here, entries are identified by a 'path' in the +document. You can think of the DOM document as representing a file system +rooted in the dom document node. + +For example, the autoproject part uses the statement + +
+    QString cflags = DomUtil::readEntry( *part->document(),
+                                         "/kdevautoproject/cflags" );
+
+ +to read the CFLAGS variable set by the user, and uses the statement similar to + +
+    DomUtil::writeEntry( *part->document(),
+                         "kdevautoproject/cflags",
+                         "--no-exceptions" );
+
+ +to write it back. + + - Note: In order to avoid conflicts between different plugins, you + should use your part name as top-level 'directory' in the configuration + tree. + . + +\subsection sessionAccess Project session file (*.kdevses) + +The base class of all KDevelop plugins is KDevPlugin. It provides two virtual methods +restorePartialProjectSession(..) and savePartialProjectSession(..) +that you should reimplement in your special plugin to attach to session loading and saving. + +When KDevelop loads or closes a project, the program's project session manager +(class ProjectSession) calls them for each plugin. That manager gives a QDOM node to the +plugin where it can read out or build up its partial DOM subtree with the session settings. +That subtree will be stored in the .kdevses file by that session manager. + +For example each programmer has set breakpoints in different files than the other ones of +the team. So the debugger plugin saves them to project session file: + +
+void DebuggerPart::savePartialProjectSession(QDomElement* el)
+{
+    gdbBreakpointWidget->savePartialProjectSession(el);
+}
+void GDBBreakpointWidget::savePartialProjectSession(QDomElement* el)
+{
+    QDomDocument domDoc = el->ownerDocument();
+    if (domDoc.isNull()) return;
+    QDomElement breakpointListEl = domDoc.createElement("breakpointList");
+    for ( int row = 0; row < m_table->numRows(); row++ )
+    {
+        BreakpointTableRow* btr = (BreakpointTableRow *) m_table->item(row, Control);
+        Breakpoint* bp = btr->breakpoint();
+        QDomElement breakpointEl = domDoc.createElement("breakpoint"+QString::number(row));
+        breakpointEl.setAttribute("type", bp->type());
+        breakpointEl.setAttribute("location", bp->location(false));
+        breakpointEl.setAttribute("enabled", bp->isEnabled());
+        breakpointEl.setAttribute("condition", bp->conditional());
+        breakpointListEl.appendChild(breakpointEl);
+    }
+    if (!breakpointListEl.isNull()) el->appendChild(breakpointListEl);
+}
+
+}
+
+ +Note that the .kdevses is related to a project. User settings equal for all projects don't +belong to here. You save them to ~/.kde/share/config/kdeveloprc via class KConfig of the +kdecore library. + +Document your part in the way described at \ref howToDocument (doc/api/HowToDocument.dox file). + +*/ + diff --git a/doc/api/HowToAddProgrammingLanguages.dox b/doc/api/HowToAddProgrammingLanguages.dox new file mode 100644 index 00000000..5cfa3643 --- /dev/null +++ b/doc/api/HowToAddProgrammingLanguages.dox @@ -0,0 +1,252 @@ +/** \file HowToAddProgrammingLanguages.dox + * \brief How to add support for a programming language + */ + +/** \page howToAddProgrammingLanguages How to add support for a programming language + +\section LSupport List of things to have "complete" support of a given language in KDevelop + + - Implement interface KDevLanguageSupport + - \ref sectionClassWizard + - \ref sectionAttributeMethodWizard + - \ref sectionQtUiSubclassing - (if the language has Qt bindings) + - \ref sectionLanguageParser + - \ref sectionClassStore + - \ref sectionMemoryClassStore + - \ref sectionPersistantClassStore + . + - \ref sectionCodeCompletion + - \ref sectionProblemReporter - (parses source on the fly and reports syntax errors) + - \ref sectionTemplates + - \ref sectionApplicationTemplates + - \ref sectionApplicationImportTemplates + - \ref sectionSourceFileTemplates + - \ref sectionAbbreviationTemplates - (ife expands to an if else statement, etc) + . + - \ref sectionSourceCodeFormater (prettyprint functionality) + - \ref sectionDocumentationTopics + - \ref sectionDebugger + - (gdb/jdb/??? integration) + - \ref sectionCompilerPlugins + . + +List of optional things to support a given language in KDevelop: + - \ref sectionEditor - Syntax highlighter - (add to QEditor if not available elsewhere) + - \ref sectionBuildTool (make/ant/etc) + . + +Take a look at \ref LangSupportStatus (doc/api/LangSupportStatus.dox file) to see the current status/features of the programming languages currently supported by KDevelop. + + + + +\section sectionLanguageSupport Language Support + +Any language support should be written as a kdevelop part and implement +KDevLanguageSupport interface (lib/interfaces/kdevlanguagesupport.h). + +Implementing methods: + - virtual Features features(); + - virtual KMimeType::List mimeTypes(); + . + +Should be enough for a language support to start working. + +KDevelop ships with KDevLang project template. It is a simple language support prototype that can be used when developing language support plugins with KDevelop. +To use it, start a New Project and select: C++->KDevelop->KDevelop Language Support Plugin in the application wizard. +The template is located in languages/cpp/app_templates/kdevlang, you can change it there if you need. + + +You should look at languages/ruby for a simple language support +implementation. For a compilable language support, consult languages/ada or languages/pascal (they are not so complex as languages/cpp). + +Pascal would be a good starting place, as it is the smaller of the two by far. + +Language support can offer additional features: + +\subsection sectionClassWizard Class wizard + - new class wizard: (See ada, php, cpp or java) + - virtual void addClass(); + . + +\subsection sectionAttributeMethodWizard Attribute/Method wizard + - add method dialog: (See cpp or java) + - virtual void addMethod(const QString &className); + . + - add attribute dialog: (See cpp or java) + - virtual void addAttribute(const QString &className); + . + . + +\subsection sectionQtUiSubclassing Qt UI subclassing + +If there is a Qt bindings for your language and there is a possibility +to use QtDesigner ui files, you could implement ui subclassing feature: + - virtual QStringList subclassWidget(const QString& formName); + - virtual QStringList updateWidget(const QString& formName, const QString& + fileName); + . + +See cpp and java for examples. + +\subsection sectionLanguageParser Language parser + +In general, class stores can be filled with information without specialized +and complex language parsers (take a look at languages/python that have a very simple python parser) but your language support will surely benefit +from having such. There is a hand-written c/c++ parser (lib/cppparser) in KDevelop that might be used for ObjC or related C-based languages. + +Other (not so complex as c++) languages can be parsed by ANTLR based parsers (library is in lib/antlr). +Consult www.antlr.org for a ANTLR documentation and look at languages/java, languages/ada and languages/pascal for an example of using such parsers. +The latest version of ANTLR (2.7.2) has support for Java, C, Pascal, Ada, C++, CIM, HTML, IDL, Verilog, VRML, OCL, ASN.1, and SQL. You can write an ANTLR parser for your own language, of course. + +\subsection sectionClassStore Class store + +If you write (or have) a language parser, your language support can have +"class store" (a database containing the information about scopes, classes +and methods - their names, names of source files, location in source files, +etc.). Class store libraries can be found at lib/catalog (Catalog) and lib/interfaces (CodeModel). + +KDevelop provides class browsers that extract information from a class store and display it in a tree view and toolbar selectors of scopes, classes and methods. + +\subsubsection sectionMemoryClassStore Memory class store +CodeModel is the memory class store. It is very efficient and thus it is recommended for using as a project class store. CodeModel libraries are located in lib/interfaces/codemodel.h. The class browser for a CodeModel based stores is parts/classview. + +\subsubsection sectionPersistantClassStore Persistant class store +Catalog is the persistant class store for KDevelop. Persistant class store can be used as an information storage for code completion but it also can be used as a class store for the project. Take a look at +languages/cpp for an example of using catalog. Catalog is stored on disk in the database file (Berkeley db) If you use catalog with the project, your class browser will be parts/classbrowser. + +\subsection sectionCodeCompletion Code completion +Class store enables you to write a code completion for the language. At the +moment (2003-06-25), code completion is available only to cpp so take a +look at it for an example. + +\subsection sectionProblemReporter Problem reporter + +If you have a language parser, you can implement problem reporter +functionality for your language. The problem reporter catches errors +reported by a parser and displays it in a problem reporter view. +languages/java, languages/ada, languages/pascal and languages/cpp have problem reporters. + +\subsection sectionTemplates Templates + +\subsubsection sectionApplicationTemplates Application templates + +Application wizard templates should be also written. Appwizard templates are simple to create - consult \ref howToAddApplicationTemplates (HowToAddApplicationTemplates.dox file) +and look at languages/ruby/app_templates/rubyhello, languages/pascal/app_templates/pascalhello, or languages/ada/app_templates/adahello. + +\subsubsection sectionApplicationImportTemplates Application import templates + +KDevelop has the ability to create a new project from existing projects or source code. +It scans for project files ('*.kdevelop, *.kdevprj, *.studio, *.pro) and if + - it finds a project it extracts the necessary information + - it does not find project files it scans for source files (*.cpp, *.java, *.pl, *.py, ...) + . +and creates a new KDevelop project in the direcotry the user has chosen. + +\subsubsection sectionSourceFileTemplates Source file templates + +Another thing to do is to create file create templates. They are prototypes for a source files of your language. These prototypes are placed in +parts/filecreate/file-templates dir or languages/YOURLANGUAGE/file_templates and have names equal to the extensions of language source files. +The description of the prototypes is placed in parts/filecreate/template-info.xml. + +Consult FileCreatePart (parts/filecreate/README.dox file) and \ref howToAddFileTemplates for further information. + +\subsubsection sectionAbbreviationTemplates Code abbreviation templates + +KDevelop has a support for code abbreviations so you can add some predefined abbreviations to your language support. Take languages/cpp/cpptemplates as an example. + + +\subsection sectionSourceCodeFormater Source code formater + +Implement a KDevSourceFormater class interface. +To obtain source formater functionality (that is already available to +c-based languages) you can extend astyle library (lib/astyle) that is used by KDevelop to format sources. +Take a look at AStylePart for an example how to do it. + +\subsection sectionDocumentationTopics Documentation topics + +Add them to languages/YOURLANGUAGE/doc. For an example see languages/python/doc/python.toc and languages/python/doc/python.index +In the end you need to edit the languages/YOURLANGUAGE/doc/Makefile.am file to include the .toc and/or .index file. + +\subsection sectionDebugger Debugger + +The last thing to have a complete language support in KDevelop is to +write a Debugger . KDevelop already provides GDB support +(languages/cpp/debugger) and JDB (java debugger) support (languages/java/debugger). Take a look at them to get inspiration. + +\subsection sectionCompilerPlugins Compiler plugins + +There is an ability to create compiler plugin for KDevelop. Compiler plugin provides the compiler configuration dialog which implements command line compiler options. +Compiler plugins must implement KDevCompilerOptions interface. + + +\section MiscInf Other Info + +In the end you should add the language you implemented to the doc/api/LangSupportStatus.dox file and +document your language support part in the way described at \ref howToDocument (doc/api/HowToDocument.dox file). +See also \ref howToAddPlugins (doc/api/HowToAddPlugins.dox file) for an information on how to create a generic KDevelop plugin and how to manage project and global configuration information. + + + + + +\section sectionEditor Language Editor + +To edit source files KDevelop uses any editor that supports the KTextEditor +interface. The current supported editors and their features are listed +in the \ref EditorsSupportStatus (doc/api/EditorsSupportStatus.dox file) page. + +In case none of the editors does support advanced editing of sources +written in your language (like code folding, syntax highlighting, line +indentation) you can improve QEditor included in KDevelop (editors/qeditor). +By creating QEditorIndenter and QSourceColorizer descendants you can provide the support for an automatic indentation and syntax highlighting that will be available for sure in KDevelop. + + + + + + +\section sectionBuildTool Build Tool + +The language support is important, but it is unusable without a build tool +that can manage projects written on this language. KDevelop +currently provides several build tools. They are: + + - ANT build tool + - see AntProjectPart at buildtools/ant + . + - Autotools build tool + - see AutoProjectPart at buildtools/autotools + . + - Custom build tool + - see CustomProjectPart at buildtools/custommakefiles + - (works with custom makefiles, also has ant support) + . + - Generic build tool + - see GenericProjectPart at buildtools/generic + - Offers build tool facilities using project files in xml format (dtd is located in buildtools/generic/kdevxmlproject.dtd). + Those xml files can be converted into makefiles, ant xml files or simply shell scripts using build system plugins. + Build system plugin is an object that implements KDevBuildSystem interface. Build system plugins are located in buildtools/generic/buildsystem. + . + - QMake build tool + - see TrollProjectPart at buildtools/qmake + . + . + +Also available: + - Script build tool + - buildtools/script + - (the generic build tool for all scripting languages). + . + - buildtools/pascal and + - buildtools/ada + - buildtools/haskell + . + +(They are deprecated build tools that will be replaced with the generic build tool). + +Choose your build tool and if the existing build tools doesn't fit +in, extend generic build tool via build system plugin. \ref howToAddGenericBuildTools page (doc/api/HowToAddGenericBuildTools.dox file) helps you to do it. + + +*/ diff --git a/doc/api/HowToDocument.dox b/doc/api/HowToDocument.dox new file mode 100644 index 00000000..d606a8bf --- /dev/null +++ b/doc/api/HowToDocument.dox @@ -0,0 +1,39 @@ +/** \file HowToDocument.dox + * \brief How to document KDevelop parts + */ +/** \page howToDocument How to document KDevelop parts + +You should add a README and a README.dox file to your part (KDevPlugin). + +On the README file put this text: +\verbatim +Please read the on-line, automaticaly updated KDevelop API documentation at: +http://www.kdevelop.org +or read the README.dox file. +\endverbatim + +On the README.dox file put the mandatory information: +\verbatim +/** \class yourPartClassName +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +... + +/* +\endverbatim + +IMPORTANT: You should replace yourPartClassName with the name of the class that +implements your part. + +On the area marked with ... you can add optional informations. Here is an example of that: + +\verbinclude languages/cpp/app_templates/kdevpart/README.dox + +All these infos are optional and you should only add the link to the bugzilla database if YOUR_COMPONENT_NAME +has been defined in that database. + +*/ diff --git a/doc/api/LangSupportStatus.dox b/doc/api/LangSupportStatus.dox new file mode 100644 index 00000000..fa08cc67 --- /dev/null +++ b/doc/api/LangSupportStatus.dox @@ -0,0 +1,330 @@ +/** \file LangSupportStatus.dox + * \brief Programming Languages Support Status + */ + +/** \page LangSupportStatus Programming Languages Support Status + +\ref howToAddProgrammingLanguages (doc/api/HowToAddProgrammingLanguages.dox file) for step by step info on how to implement these features. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Feature/LanguageAdaBashC/C++FortranHaskellJavaPascalPerlPHPPythonRubySQL
\ref sectionClassWizardYN/AYN/AN/AYNNYNNN/A
\ref sectionAttributeMethodWizardNN/AYN/AN/AYNNNNNN/A
\ref sectionQtUiSubclassingN/AN/AYN/AN/AYN/AN/AN/ANN/AN/A
\ref sectionLanguageParserANTLRInternalcppparserInternalNANTLRANTLRInternalInternalInternalNN
\ref sectionMemoryClassStoreCodeModelCodeModelCodeModelCodeModelNCodeModelCodeModelCodeModelCodeModelCodeModelNY
\ref sectionPersistantClassStoreNNCatalogNNNNNNNNN/A
\ref sectionCodeCompletionNYYNNNNNYNNN
\ref sectionProblemReporterYNYNNYYNYNNN
\ref sectionApplicationTemplatesYYYYYYYYYYYY
\ref sectionApplicationImportTemplatesYNYYNYYYYYYN
\ref sectionSourceFileTemplatesYNYYYYYYYYYN
\ref sectionAbbreviationTemplatesNNYNN/ANYNYNNN
\ref sectionSourceCodeFormaterNNYNNYNNNNNN
\ref sectionDocumentationTopicsYYYNYYNYYYYN
\ref sectionDebuggerNNYNN/AYNNNNNN
\ref sectionCompilerPluginsNN/AgccPGHPF, PGF77GlasgowNDelphi, Free PascalNNNNN
+
+Legend: +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Feature has not been implemented
Feature is in alpha state, the development has only been started or the feature is turned off at the moment
Feature is in beta state or it is unfinished
Feature is considered to be complete or complete enough for the release
N/AFeature is not applicable for given language
SourceinfoDeprecated class store that should be replaced by a CodeModel +
Features implemented with Sourceinfo should not be marked as complete
CodeModelNew memory class store
CatalogNew persistant class store using Berkeley DB storage backend
ANTLRLanguage parser is generated by ANTLR parser generator, http://www.antlr.org
cppparserNew c/c++ parser written by Roberto Raggi for KDevelop
InternalLanguage parser is included in language support part
+ +*/ + diff --git a/doc/api/Mainpage.dox b/doc/api/Mainpage.dox new file mode 100644 index 00000000..9d4b6d4c --- /dev/null +++ b/doc/api/Mainpage.dox @@ -0,0 +1,91 @@ +/** \file Mainpage.dox + \brief The main page of the doxygen generated %API Documentation +*/ + +/** +\mainpage The KDevelop %API %Documentation + +KDevelop is an easy to use IDE (Integrated Development Environment) for developing applications under X11. + +\section intro Introduction + +This document is targeted at all those that want to add or improve KDevelop's source code. +If you are instead looking for a user manual, just go to the help menu of your KDevelop and select KDevelop handbook. +This documentation contains the KDevelop online class reference for the current +development version of KDevelop. Additionally, you +can subscribe or read the mailing list for any additions and/or +modifications to the %API. + +An on-line, updated every 24H, html version of this documentation can be found at: http://www.kdevelop.org/HEAD/doc/api/html/index.html + +More information about the KDevelop architecture in form of tutorials, HOWTOs, +and FAQs can be found at +the KDevelop website. + + +\section status Current Status + +Here you can see the current \ref requirements and the \ref features. +There is also a \ref LangSupportStatus (doc/api/LangSupportStatus.dox file) page and a \ref EditorsSupportStatus (doc/api/EditorsSupportStatus.dox file) page. + + +\section expand How to expand KDevelop + +First of all read the \ref architecture (doc/api/Architecture.dox file) then you can find more information on how to expand KDevelop: + - \ref howToAddPlugins (doc/api/HowToAddPlugins.dox file) + - \ref howToAddProgrammingLanguages (doc/api/HowToAddProgrammingLanguages.dox file) + - \ref howToAddApplicationTemplates (doc/api/HowToAddApplicationTemplates.dox file) + - \ref howToAddFileTemplates (doc/api/HowToAddFileTemplates.dox file) + - \ref howToAddGenericBuildTools (doc/api/HowToAddGenericBuildTools.dox file) + +Additionally you may also want to find out \ref howToDocument (doc/api/HowToDocument.dox file). + +\section PlannedTasks Planned tasks + +Here is a priority ordered list: + -# \ref HighPriTasks (doc/api/HighPriTasks.dox file) + -# fix the dispersed \ref fixme + -# reported bugs in bugzilla database + -# fix the bugs in the \ref bug + -# fix the dispersed \ref todo all over the code. + . +There are some \ref unmaintained parts in KDevelop. You migth want to "adopt" one. :)\n +There is also \ref FutureTasks (doc/api/FutureTasks.dox file). Put all ideas for the future KDevelop releases there. It is also a good place to comment on those ideas. + +\section misc Misc + + - \ref authors + - \ref maintainers + - \ref FAQ + - \ref deprecated + +\section misc_libs Miscellaneous libraries included in KDevelop + - \ref PropEditor + +\section howTobuildAPIlocalcopy How to build a local copy of this documentation + +This documentation is very large and changes with every cvs commit, therefore is not available for download. +To build your local copy of this documentation you have two choices, depending on your system configuration. + - If you have doxygen >= 1.3.4 , PHP >= 4.10 and a local running webserver then + - make apidox + - make install-apidox (as root) + . + - If you have an older system then + - setenv KDEDIR=/location_of_your_kde_instalation + - setenv QTDIR=/location_of_your_qt_instalation + - doxygen Doxyfile + - make install-apidox (as root) + . + . + +The advantage of the first method is that you'll get a search engine in your documentation if you read your +documentation using your local webserver. + +\section License + +Permission is granted to copy, distribute and/or modify this document under +the terms of the GNU Free %Documentation License, Version 1.2 or any later +version published by the Free Software Foundation; For details see +http://www.gnu.org/copyleft/fdl.html . + +*/ diff --git a/doc/api/PropEditor.dox b/doc/api/PropEditor.dox new file mode 100644 index 00000000..b4f4eccc --- /dev/null +++ b/doc/api/PropEditor.dox @@ -0,0 +1,108 @@ +/** \file PropEditor.dox + \brief The KDevelop Property Editor library description page +*/ + +/** \page PropEditor KDevelop Property Editor library description + +\section whatis What is Property Editor? + +%Property editor is a collection of facilities to store and edit the +properties of an object. For example, look at %Qt Designer. Each widget +has a list of properties that can be edited in a nice table form. +Same ideology is used to edit properties in Kugar Report Designer +(from KOffice distribution). In KDevelop project manager can also display +the properties of currently selected build item in property editor. + +\section over Library Overview + +This PropertyEditor library is a redesign of Kugar property editing library +with the goal to be more generic and extensible. + +Library provides a @ref PropertyLib::Property class which stores property name, value and some +more important information like description or the list of possible values. +Using @ref PropertyLib::Property class adds more overhead over Q_PROPERTY but provides more +flexibility. You can subclass @ref PropertyLib::Property and create your custom properties. +Custom properties can have either predefined type (see @ref PropertyLib::PropertyType) or +custom type. Custom type should be used if a custom property editor widget is +necessary. + +Properties are organized into lists. @ref PropertyLib::PropertyList is designed +to store such lists in most efficient manner. It also allows to group +properties (for example think about "geometrical" properties like "x", "y", etc.). + +Property lists can be displayed in @ref PropertyLib::PropertyEditor widget which will +display them in a table form. Note that @ref PropertyLib::PropertyEditor takes not +a @ref PropertyLib::PropertyList object, but @ref PropertyLib::PropertyAccessor instead. + +@ref PropertyLib::PropertyAccessor is designed to provide a method to access an intersection +of property lists. For example, let's consider object A with property list a_list +abd object B with list b_list. Now let's imagine we want to display common properties +from a_list and b_list in one @ref PropertyLib::PropertyEditor widget. Obviously, we need to +"intersect" a_list with b_list and display the result of intersection. +This is why @ref PropertyLib::PropertyAccessor is used for editing. If we change +the value of a property in the editor, @ref PropertyLib::PropertyAccessor will update +both properties from underlying a_list and b_list. + +@ref PropertyLib::PropertyEditor at the same time shows only one editor for selected +property in the list. Each @ref PropertyLib::PropertyType has corresponding @ref PropertyLib::PropertyWidget +which displays property editor or draws a property in the list if it is not edited. +More exactly, if @ref PropertyLib::PropertyEditor needs to display editor widget, it displays +@ref PropertyLib::PropertyWidget, else it calls @ref PropertyLib::PropertyWidget::drawViewer function. +Custom property widgets should be subclasses of @ref PropertyLib::PropertyWidget. + +To create property widgets at runtime, a factory is used. Factory class is +called @ref PropertyLib::PropertyMachineFactory. Static function @ref PropertyLib::PropertyMachineFactory::getInstance +can be used to obtain the reference to the factory instance. Factory creates and returns +so-called @ref Machine for each registered property type (either predefined or user defined). + +@ref Machine contains @ref PropertyLib::PropertyWidget and a list of "detailed" machines. +Usually only property widget is necessary for a property but there are +complex properties like "Font" for example. We would like to see separate editors +for font family, size, etc. and a button to choose all of these in the dialog. +For that "Font" property, a PropertyWidget with a "choose font" button +and also number of detailed widgets like "font family" combo, etc. can be created. + +\section Examples +A simple example on how to create a property editor and use it with one property list: +\code + PropertyEditor *m_editor = new PropertyEditor(this); + + PropertyList *list = new PropertyList; + list->addProperty("My Group", new Property(Integer, "First Property", + "This is my first property", -5)); + list->addProperty("My Group", new Property(String, "Second Property", + "This is my second property", "Hello")); + list->addProperty(new Property(Color, "Third Property", + "This is my third property", QColor("green"))); + + m_editor->populateProperties(*list); +\endcode + +More advanced example with property accessors and list intersection: +\code + PropertyEditor *m_editor = new PropertyEditor(this); + + PropertyList *list = new PropertyList; + list->addProperty("My Group", new Property(Integer, "First Property", + "This is my first property", -5)); + list->addProperty("My Group", new Property(String, "Second Property", + "This is my second property", "Hello")); + list->addProperty(new Property(Color, "Third Property", + "This is my third property", QColor("green"))); + + PropertyList *list2 = new PropertyList; + list2->addProperty("My Group", new Property(Integer, "First Property", + "This is my first property", -7)); + list2->addProperty("My Group", new Property(String, "Second Property", + "This is my second property", "Hello")); + list2->addProperty(new Property(String, "Third Property", + "This is my third property", "green")); + + PropertyAccessor *ac = list->intersect(*list2); + + m_editor->populateProperties(ac); +\endcode +In this example only properties named "First Property" and "Second Property" will be shown in editor. +"Third Property" has different types in list and list2 and will not be included in intersection. + +*/ diff --git a/doc/api/propeditor1.png b/doc/api/propeditor1.png new file mode 100644 index 00000000..854b91f6 Binary files /dev/null and b/doc/api/propeditor1.png differ diff --git a/doc/api/propeditor2.png b/doc/api/propeditor2.png new file mode 100644 index 00000000..66f8a75b Binary files /dev/null and b/doc/api/propeditor2.png differ diff --git a/doc/extras/Makefile.am b/doc/extras/Makefile.am new file mode 100644 index 00000000..0e7893c4 --- /dev/null +++ b/doc/extras/Makefile.am @@ -0,0 +1,8 @@ +SUBDIRS=w3c + +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = sdl.toc opengl.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + diff --git a/doc/extras/opengl.toc b/doc/extras/opengl.toc new file mode 100644 index 00000000..efe104ff --- /dev/null +++ b/doc/extras/opengl.toc @@ -0,0 +1,267 @@ + + +OpenGL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/extras/sdl.toc b/doc/extras/sdl.toc new file mode 100644 index 00000000..947dd09a --- /dev/null +++ b/doc/extras/sdl.toc @@ -0,0 +1,219 @@ + + +SDL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/extras/w3c/Makefile.am b/doc/extras/w3c/Makefile.am new file mode 100644 index 00000000..19518e8d --- /dev/null +++ b/doc/extras/w3c/Makefile.am @@ -0,0 +1,3 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = w3c-dom-level2-html.toc w3c-svg.toc w3c-uaag10.toc + diff --git a/doc/extras/w3c/w3c-dom-level2-html.toc b/doc/extras/w3c/w3c-dom-level2-html.toc new file mode 100644 index 00000000..f3540ff1 --- /dev/null +++ b/doc/extras/w3c/w3c-dom-level2-html.toc @@ -0,0 +1,70 @@ + + +Document Object Model (DOM) Level 2 HTML Specification + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +       + + + + + + + + + + diff --git a/doc/extras/w3c/w3c-svg.toc b/doc/extras/w3c/w3c-svg.toc new file mode 100644 index 00000000..a53e34fc --- /dev/null +++ b/doc/extras/w3c/w3c-svg.toc @@ -0,0 +1,1446 @@ + + +Scalable Vector Graphics (SVG) 1.1 Specification + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/extras/w3c/w3c-uaag10.toc b/doc/extras/w3c/w3c-uaag10.toc new file mode 100644 index 00000000..08f90cc9 --- /dev/null +++ b/doc/extras/w3c/w3c-uaag10.toc @@ -0,0 +1,69 @@ + + +User Agent Accessibility Guidelines 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/kde_app_devel/Makefile.am b/doc/kde_app_devel/Makefile.am new file mode 100644 index 00000000..41691557 --- /dev/null +++ b/doc/kde_app_devel/Makefile.am @@ -0,0 +1,3 @@ +KDE_LANG = en +KDE_DOCS = AUTO + diff --git a/doc/kde_app_devel/appwizard.png b/doc/kde_app_devel/appwizard.png new file mode 100644 index 00000000..adbadb35 Binary files /dev/null and b/doc/kde_app_devel/appwizard.png differ diff --git a/doc/kde_app_devel/index.docbook b/doc/kde_app_devel/index.docbook new file mode 100644 index 00000000..5b721135 --- /dev/null +++ b/doc/kde_app_devel/index.docbook @@ -0,0 +1,1549 @@ + +KDevelop"> + + + +]> + + + + +The &kdevelop; Programming Handbook + +2002-12-05 +2.0 + + + +Ralf +Nolden +
Ralf.Nolden@post.rwth-aachen.de
+
+ +Caleb +Tennis +
caleb@aei-tech.com
+
+
+ + +1999 +Ralf Nolden + + +2002 +Caleb Tennis + + + + +&FDLNotice; + + +The User Guide to C++ Application Design for the K Desktop Environment (KDE) with +the &kdevelop; IDE + + + +KDE +KDevelop +IDE +development +programming + + +
+ + +Introduction + +As Unix Systems are becoming more and more popular to even beginners working with computer machines +due to its advantages in regards of stability and functionality, most are somehow disappointed, because +those applications don't have a consistent look and each one behaves different from another. With KDE, +developers have an almost perfect way to create first-class applications for Unix desktop systems to get +a wider user community by the mere quality their applications have to offer. Therefore, KDE becomes more +and more popular as a base for programming design, and developers want to take advantage of the +possibilities that the system has to offer. + + + +What you should know already + +For making the best use of this programming handbook, we assume that you already know about the +C++ programming language; if not, you should make yourself familiar with that first. Information about +C++ is available through various sources either in printed form at your local bookstore or by tutorials +found on the Internet. Knowledge about the design of Graphical User Interfaces is not required, as this +handbook tries to cover the application design for KDE programs, which also includes an introduction into +the Qt toolkit as well as the KDE libraries and the design of User Interfaces. Also, you should have made +yourself comfortable with &kdevelop; by reading The User Manual to &kdevelop;, which contains a descriptive +review of the functionality provided by the IDE. + + + + +About this Handbook + +This handbook has been written to give developers an introduction into KDE application development by +using the KDevelop Integrated Development Environment. + + +The following chapters therefore give an introduction on how to create projects, explains the sourcecode +already generated and shows how to extend the given sources on various topics such as toolbars, menu bars +and view areas. + + +Then the dialogeditor is discussed in detail, explaining how widgets are created and covers widget +properties settings in detail for all provided widgets. + + +Finally, you will learn about several topics that will complete your knowledge in regards of project design +and helps you work out additional issues besides coding such as adding API documentation and extending +online-manuals. + + +In the next chapter + +We'll take a look at the Qt and KDE libraries, showing basic concepts and why things are the way they are. +Also, we will discuss how to create the tutorial applications provided with the Qt toolkit by using +kdevelop;, so beginners can already see first results with a few steps, and thereby will learn how to make +use of some of &kdevelop;'s best features. + + + + +In the following chapters + +You will learn how to: + +create an application with the KAppWizard +What the project skeleton already provides +What the code already create means +How to create your own views +How to extend your application's functionality by dialog, menu bars, and toolbars +How to make your application user friendly by providing help functions +How to write online documentation + + + + + + + +Additional Information + +Additional information about Qt/KDE programming is available by various sources: + +Programming with Qt by Matthias Kalle Dalheimer +The User Manual to KDevelop, provided with the KDevelop IDE +The Online Reference to the Qt library +The KDE Developer web site + + + +Additionally, you should look for help by subscribing to the various mailing lists, whose addresses +are available on the mentioned web sites, and on the Usenet newsgroups dedicated to users of KDE and +Unix Systems as well as about the C and C++ programming language. + + +For obtaining help about the KDevelop IDE, you should send requests to our mailinglist at +kdevelop@kdevelop.org. Mind that the KDevelop team is dedicated to provide the means to enable you to +program applications and therefore is not intended as a technical support team in cases where the +applications you're developing don't work due to implementation errors or misconfigurations of your +operating system. By this, we ask all users to take advantage of the mailinglist in any case you're running +into problems with the use of the IDE itself, as well as for bug reports and suggestions for improving the +functionality of the development environment. + + + + + + +The KDE and Qt Libraries + +The Norwegian company TrollTech (http://www.trolltech.com) +provides a so-called GUI toolkit, named Qt. GUI means "Graphical User Interface", and therefore, Qt-based +applications represent themselves with buttons, windows etc, allowing user input by visualizing the functions +an application provides. Such a toolkit is needed for developing graphical applications that run on the X-Window +interface on Unix Systems, because X does not contain a pre-defined user interface itself. Although other +toolkits are also available to create User Interfaces, Qt offers some technical advantages that make +application design very easy. Additionally, the Qt toolkit is also available for Microsoft Windows systems, +which allows developers to provide their applications for both platforms. + + +The KDE Team (http://www.kde.org) joined together with the goal +to make using Unix Systems more friendly, and decided to use the Qt toolkit for the development of a window +manager on X-Windows, plus a variety of tools included with the KDE packages. The K Desktop Environment +therefore contains the window manager kwm, the file manager kfm and the launch panel kpanel as the main +components plus a variety of first-class utilities and applications. After KDE was out, a lot of developers +turned their eyes towards the new environment and what it has to offer them. The KDE libraries are providing +essential methods and classes that make all applications designed with them look similar and consistent, +so the user has the great advantage that he only has to get accustomed with an application's specific +usage, not with handling dialogs or buttons. Also, KDE programs integrate themselves into the desktop and +are able to interact with the file manager via drag'n drop, offer session management and many more, if all +features offered by the KDE libraries are used. Both, the Qt toolkit and the KDE libraries, are implemented +in the C++ programming language; therefore applications that make use of these libraries are also mostly +written in C++. In the following chapter, we'll make a short trip through the libraries to see what already +is provided and how Qt and KDE applications are created in general. + + +Both, the Qt toolkit and the KDE libraries, are implemented in the C++ programming language; +therefore applications that make use of these libraries are also mostly written in C++. In the following +chapter, we'll make a short trip through the libraries to see what already is provided and how Qt and KDE +applications are created in general. + + + +The Qt GUI Toolkit + +As said, the Qt library is a toolkit that offers graphical elements that are used for creating GUI +applications and are needed for X-Window programming. Additionally, the toolkit offers: + +A complete set of classes and methods ready to use even for non-graphical programming issues +A good solution towards user interaction by virtual methods and the signal/slot mechanism +A set of predefined GUI-elements, called "widgets", that can be used easily for creating the visible elements +Additional completely pre-defined dialogs that are often used in applications such as progress and file dialogs + + + +Therefore knowing the Qt classes is very essential, even if you only want to program KDE-applications. +To have an impression on the basic concept how GUI-applications are constructed and compiled, we'll first +have a look at a sample Qt-only program; then we'll extend it to a KDE program. + + + +The first Qt Application + +As usual, programs in C++ have to contain a main() function, which is the starting point for application +execution. As we want them to be graphically visible in windows and offering user interaction, +we first have to know, how they can show themselves to the user. For an example, we'll have a look +at the first tutorial included with the Qt Online Reference Documentation and explain the basic execution +steps; also why and how the application window appears: + +#include <qapplication.h> +#include <qpushbutton.h> + +int main( int argc, char **argv ) +{ +QApplication a( argc, argv ); + +QPushButton hello( "Hello world!", 0 ); +hello.resize( 100, 30 ); + +a.setMainWidget( &hello ); +hello.show(); +return a.exec(); +} + + + +This application merely paints a window containing a button with "Hello world" as its text. As for +all Qt-based applications, you first have to create an instance of the class QApplication, represented by +variable a. + + +Next, the program creates an instance of the class QPushButton called hello, this will be the button. +The constructor of hello gets a string as a parameter, which is the contents of the widget visible as +the buttons text. + + +Then the resize() method is called on the hello button. This changes the default size a widget +(which is in this case the QPushButton) has when created to the length of 100 pixels and the height of +30 pixels. Finally, the setMainWidget() method is called for a and the show() method for hello. The +QApplication is finally executed by a.exec(), enters the main event loop and waits until it has to return +an integer value to the overlaying Operating System signaling that the application is exited. + + + + +The Reference Documentation for Qt + +Now, let's have a quick look at the reference documentation of the Qt library. To do this, start +&kdevelop; and select "Qt" from the tree in the Documentation tab. The documentation browser opens +and shows you the start page of the Qt reference. This will be your first place to get information +about Qt, it's classes and the available functions they provide. Also, the above program is the first +that is included in the tutorials section. To get to the classes we want to have a look at, +QApplication and QPushButton, select "Alphabetical Class List" +and search for the according names. Follow either of them to have a look at the class documentation. + + +Alternatively, you can use the online documentation from Trolltech's Qt Documentation + + +For QApplication, you will see the constructor and all other methods that this +class provides. If you follow a link, you will get more information about the usage and meaning of the +methods, which is very useful when you sometimes can't detect the correct use or want to have an example. +This also counts for the KDE library documentation, which uses a similar documentation type; therefore +this is almost all you have to know about using the class-references with the documentation browser. + + +Interpretation of the Sample + +Starting with QApplication, you will find all the methods used in our first example: + +the constructor QApplication() +the setMainWidget() method +the exec() method + + + +The interpretation why we use these methods is very simple: + +Create an instance of the class QApplication with the constructor, +so we can make use of the GUI elements provided by Qt +Create a widget which will be the contents of our program window +Set the widget as the main widget for a +Execute the a instance of QApplication + + + +The second object of our program is the pushbutton, an instance of the class QPushButton. +From the two constructors given to create an instance, we used the second: this accepts a text, +which is the label contents of the button; here, it is the string "Hello world!". Then we called the +resize() method to change the size of the button according to it's contents - +the button has to be larger to make the string completely visible. + + +But what about the show() method? Now, you see that like most other widgets, +QPushButton is based on a single inheritance, the documentation says, Inherits +QButton. Follow the link to the QButton class. +This shows you a lot of other widgets that are inherited by QPushButton, +which we'll use later to explain the signal/slot mechanism. Anyway, the show() +method is not listed, therefore, it must be a method that is provided by inheritance as well. The class +that QButton inherits is QWidget. Just follow the link +again, and you will see a whole bunch of methods that the QWidget class provides; including +the show() method. Now we understand what was done in the sample with the button: + +Create an instance of QPushButton, use the second constructor to set the button text +Resize the widget to its contents +Set the widget as the main widget of the QApplication instance a +Tell the widget to display itself on the screen by calling show(), an inherited method from QWidget + + + +After calling the exec() method, the application is visible to the user, +showing a window with the button showing "Hello world!". Note: GUI programs behave somewhat differently +than procedural applications. The main thing here is that the application enters a so-called +"main event loop". This means that the program has to wait for user actions and then react to it, also +that for a Qt application, the program has to be in the main event loop to start the event handling. +The next section tells you in short what this means to the programmer and what Qt offers to process +user events. + + +For already advanced users: The button has no parent declared in the constructor, therefore it +is a top-level widget alone and runs in a local event loop which doesn't need to wait for the main +event loop. See the QWidget class documentation and The KDE Library Reference Guide + + + + + + +User Interaction + +After reading the last sections, you should already know: + +What the Qt-library provides in terms of GUI applications +How a program using Qt is created and +Where and how to find information about classes that you want to use with the documentation browser + + + +Now we'll turn to give the application "life" by processing user events. Generally, the user has two ways +to interact with a program: the mouse and the keyboard. For both ways, a graphical user interface has to +provide methods that detect actions and methods that do something as a reaction to these actions. + + +The Window system therefore sends all interaction events to the according application. The +QApplication then sends them to the active window as a QEvent +and the widgets themselves have to decide what to do with them. A widget receives the event and processes +QWidget::event(QEvent*), which then decides which event has been executed +and how to react; event() is therefore the main event handler. Then, +the event() method passes the event to so-called event filters +that determine what happened and what to do with the event. If no filter signs responsible for the +event, the specialized event handlers are called. Thereby we can decide between: + + +Keyboard events -- TAB and Shift-TAB keys: + +virtual void focusInEvent(QFocusEvent *) +virtual void focusOutEvent(QFocusEvent *) + + + + +All other keyboard input: + +virtual void keyPressEvent(QKeyEvent *) +virtual void keyReleaseEvent(QKeyEvent *) + + + + +Mouse movements: + +virtual void mouseMoveEvent(QMouseEvent *) +virtual void enterEvent(QEvent *) +virtual void leaveEvent(QEvent *) + + + + +Mouse button actions + +virtual void mousePressEvent(QMouseEvent *) +virtual void mouseReleaseEvent(QMouseEvent *) +virtual void mouseDoubleClickEvent(QMouseEvent *) + + + + +Window events containing the widget + +virtual void moveEvent(QMoveEvent *) +virtual void resizeEvent(QResizeEvent *) +virtual void closeEvent(QCloseEvent *) + + + + + + +Note that all event functions are virtual and protected; therefore you can re-implement the events +that you need in your own widgets and specify how your widget has to react. QWidget +also contains some other virtual methods that can be useful in your programs; anyway, it is sufficient +to know about QWidget very well. + + + +Object Interaction by Signals and Slots + +Now we're coming to the most obvious advantages of the Qt toolkit: the signal/slot mechanism. +This offers a very handy and useful solution to object interaction, which usually is solved by +callback functions for X-Window toolkits. As this communication requires a strict programming and +sometimes makes user interface creation very difficult (as referred by the Qt documentation and explained +in Programming with Qt by K.Dalheimer), Troll Tech invented a new system where objects can emit signals +that can be connected to methods declared as slots. For the C++ part of the programmer, he only has to know +some things about this mechanism: + + +the class declaration of a class using signals/slots has to contain the Q_OBJECT macro at the beginning +(without a semicolon); and have to be derved from the QObject class + + +a signal can be emitted by the keyword emit, e.g. emit signal(parameters); from within any member function +of a class that allows signals/slots + + + +all signals used by the classes that are not inherited have to be added to the class declaration by a +signals section + + +all methods that can be connected with a signal are declared in sections with the additional keyword slot, +e.g. public slots: within the class declaration + + +the meta-object compiler moc has to run over the header file to expand the macros and to produce the +implementation (which is not necessary to know). The output files of moc are compiled also by the C++ compiler. + + + + +Another way to use signals without deriving from QObject is to use the +QSignal class- see the reference documentation for more information and example +usage. In the following, we assume you're deriving from QObject. + + +This way, your class is able to send signals anywhere and to provide slots that signals can connect +to. By using the signals, you don't have to care about who's receiving it- you just have to emit the +signal and whatever slot you want to connect to it can react to the emission. Also the slots can be used +as normal methods during implementation. + + +Now, to connect a signal to a slot, you have to use the connect() methods that +are provided by QObject or, where available, special methods that objects provide +to set the connection for a certain signal. + + + +Sample Usage + +To explain the way how to set up object-interaction, we'll take our first example again and extend it by a +simple connection: + +#include <qapplication.h> +#include <qpushbutton.h> + +int main( int argc, char **argv ) +{ +QApplication a( argc, argv ); + +QPushButton hello( "Hello world!" , 0); +hello.resize( 100, 30 ); + +a.setMainWidget( &hello ); + +QObject::connect(&hello, SIGNAL( clicked() ), &a, SLOT( quit() )); + +hello.show(); +return a.exec(); +} + + + +You see, the only addition to give the button more interaction is to use a connect() + method: connect(&hello, SIGNAL( clicked() ), &a, SLOT( quit() )); +is all you have to add. What is the meaning now? The class declaration of QObject says about the +connect() method: + + +bool connect ( const QObject * sender, const char * signal, const QObject * receiver, const char * member ) + + +This means you have to specify a QObject instance pointer that is the sender +of the signal, meaning that it can emit this signal as first parameter; then you have to specify the signal +that you want to connect to. The last two parameters are the receiver object that provides a slot, followed +by the member function which actually is the slot that will be executed on signal emission. + + +By using signals and slots, your program's objects can interact with each other easily without explicitly +depending on the type of the receiver object. You will learn more about using this mechanism for productive +usage later in this handbook. More information about the Signals/Slot mechanism can also be found in +The KDE Library Reference Guide +and the Qt online reference. + + + + + + +What KDE provides + +The KDE 3.x libraries + +The main KDE libraries you'll be using for creating your own KDE applications are: + + +the kdecore library, containing all classes that are non-visible elements to provide application functionality + + +the kdeui library, containing user interface elements like menubars, toolbars, etc. + + +the kfile library, containing the file selection dialogs + + + + +Additionally, for specific solutions KDE offers the following libraries: + + +the kdefx library, containing pixmaps, image effects the KStyle extension to QStyle + + +the khtml library, containing KDE's html component + + +the kjs library, containing KDE's Javascript support + + +the kio library, containing low level access to network files + + +the kparts library, containing support for re-usable embeddable extendable applications + + + + +Next we'll have a look at what is needed to turn out first Qt Application into a KDE one. + + + +Example KDE Application + +In the following, you will see that writing a KDE application is not much more difficult than a +Qt application. For the use of KDE's features, you just have to use some other classes, and you're almost +done. As an example, we'll discuss the changed version of the Qt example from above: + +#include <kapplication.h> +#include <qpushbutton.h> + +int main( int argc, char **argv ) +{ +KApplication a( argc, argv ); + +QPushButton hello( "Hello world!", 0 ); +hello.resize( 100, 30 ); + +a.setTopWidget( &hello ); + +QObject::connect(&hello, SIGNAL( clicked() ), &a, SLOT( quit() )); + +hello.show(); +return a.exec(); +} + + + +You see that first we have changed from QApplication to KApplication +. Further, we had to change the previously used setMainWidget() method +to setTopWidget, which KApplication uses to set the main +widget. That's it! Your first KDE application is ready - you only have to tell the compiler the KDE +include path and the linker to link in the kdecore library with -lkdecore. + + +As you now know what at least the main() function provides generally and how an +application gets visible and allows user and object interaction, we'll go on with the next chapter, +where our first application is made with &kdevelop;. There you can also test everything which was +mentioned before and see the effects. + + +What you should have looked into additionally until now is the reference documentation for Qt, +especially the QApplication, QWidget and QObject + class and the kdecore library documentation for the KApplication class. +The KDE Library Reference handbook +also covers a complete description about the invocation of the QApplication and +KApplication constructors including command-line argument processing. + + + + + + + +Creating New Applications + + +The Application Wizard + +&kdevelop;'s Application Wizard is intended to let you start working on new project with &kdevelop;. Therefore +all of your projects are first created by the wizard, and then you can start building them and extend what is +already provided by the source skeleton. You can choose from several project types according to your project goals: + + +KDE Application Framework: includes source code for a complete frame structre of a standard KDE application + + +QMake Project: Creates an application framework based around Trolltech's qmake configuration system + + +Simple hello world program: Creates a C++ terminal based program with no GUI support + + +A multitude of other program skeletons + + + + +In this chapter we'll see how the Application Wizard can be invoked and what has to be done to generate +a KDE application project. This will also be the initial step of our coverage, where we will create the +initial version of a sample project. For all other project types the steps are usualyl the same, but you +may not have as many options available. + + + + +Invoking the Application Wizard and Project Generation + +Starting the Application Wizard and the First Page + +To start with your KDE application, open &kdevelop;. From the Project menu, selection New Project. The +Application Wizard starts, and you'll see the selection tree on the first page containing available project +types that can be created. Choose the C++ subtree, then KDE, then Application Framework. + + +For our sample project, we are going to create the application KScribble. Enter this as the application +name, and change any other information at the bottom of this screen that may need it. Then, select Next. + + +Application Wizard + + + + +Version control information + +On this screen you have the ability to decide if your project will use a version control system like +CVS. For our sample project we will not use source control, so make sure the selection box reads None +and select Next. + + + +Header and Source Templates + +The next two pages show example headers that will go at the top of each of the header and source files that +you create using &kdevelop;. For now, just leave these as the default, and select Next, then Finish. If the +Finish button is not activated, you haven't set all of the options correct. Use the Back button to return +to earlier menus and correct any mistakes. + + + +Finishing Up + +Upon completion, the Application Wizard should close and the messages window should popup displaying +information about the tasks that &kdevelop; is currently doing. At the end of all of the tasks, you +should see **** Success *****. This means the application framework was successfully loaded. + + + + + +The First Build + +After our project is generated, we'll first make a trip through the source code to get a general understanding +of how the application framework looks. This won't only help us get started, but we'll know where to change +what in later steps. + + +This chapter makes the assumption that you understand the basic navigation of &kdevelop;. Consult the +KDevelop User Manual for information if you need it. + + +The Automake manager shows the project files as follows: + + +Files in our project + + + +Before diving into the sources, we'll let &kdevelop; build an run our new application. To do this, select +Build Project from the Build menu, or press F8. The output window opens and displays output messages during +the compilation phase. + +1 cd /home/caleb/kscribble && WANT_AUTOCONF_2_5=1 WANT_AUTOMAKE_1_6=1 gmake k +2 gmake all-recursive +3 gmake[1]: Entering directory `/home/caleb/kscribble' +4 Making all in doc +5 gmake[2]: Entering directory `/home/caleb/kscribble/doc' +6 Making all in . +7 gmake[3]: Entering directory `/home/caleb/kscribble/doc' +8 gmake[3]: Nothing to be done for `all-am'. +9 gmake[3]: Leaving directory `/home/caleb/kscribble/doc' +10 Making all in en +11 gmake[3]: Entering directory `/home/caleb/kscribble/doc/en' +12 /usr/local/kde3/bin/meinproc --check --cache index.cache.bz2 /home/caleb/kscribble/doc/en/index.docbook +13 gmake[3]: Leaving directory `/home/caleb/kscribble/doc/en' +14 gmake[2]: Leaving directory `/home/caleb/kscribble/doc' +15 Making all in po +16 gmake[2]: Entering directory `/home/caleb/kscribble/po' +17 gmake[2]: Nothing to be done for `all'. +18 gmake[2]: Leaving directory `/home/caleb/kscribble/po' +19 Making all in src +20 gmake[2]: Entering directory `/home/caleb/kscribble/src' +21 source='main.cpp' object='main.o' libtool=no \ +22 depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \ +23 depmode=gcc3 /bin/sh /home/caleb/kscribble/admin/depcomp \ +24 g++ -DHAVE_CONFIG_H -I. -I/home/caleb/kscribble/src -I.. -I/usr/local/kde3/include + -I/usr/lib/qt/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor + -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings + -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new + -c -o main.o `test -f 'main.cpp' || echo '/home/caleb/kscribble/src/'`main.cpp +25 /usr/lib/qt/bin/moc /home/caleb/kscribble/src/kscribble.h -o kscribble.moc +26 source='kscribble.cpp' object='kscribble.o' libtool=no \ +27 depfile='.deps/kscribble.Po' tmpdepfile='.deps/kscribble.TPo' \ +28 depmode=gcc3 /bin/sh /home/caleb/kscribble/admin/depcomp \ +29 g++ -DHAVE_CONFIG_H -I. -I/home/caleb/kscribble/src -I.. -I/usr/local/kde3/include + -I/usr/lib/qt/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor + -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings + -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new + -c -o kscribble.o `test -f 'kscribble.cpp' || echo '/home/caleb/kscribble/src/'`kscribble.cpp +30 kscribble.cpp: In member function `void KScribble::setupActions()' +31 kscribble.cpp:107: warning: unused variable `KAction*custom' +32 /usr/lib/qt/bin/moc /home/caleb/kscribble/src/kscribbleview.h -o kscribbleview.moc +33 source='kscribbleview.cpp' object='kscribbleview.o' libtool=no \ +34 depfile='.deps/kscribbleview.Po' tmpdepfile='.deps/kscribbleview.TPo' \ +35 depmode=gcc3 /bin/sh /home/caleb/kscribble/admin/depcomp \ +36 g++ -DHAVE_CONFIG_H -I. -I/home/caleb/kscribble/src -I.. -I/usr/local/kde3/include + -I/usr/lib/qt/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor + -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi + -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new -c + -o kscribbleview.o `test -f 'kscribbleview.cpp' || echo '/home/caleb/kscribble/src/'`kscribbleview.cpp +37 kscribbleview.cpp: In member function `void KScribbleView::print(QPainter*, +38 int, int)': +39 kscribbleview.cpp:79: warning: unused parameter `QPainter*p' +40 kscribbleview.cpp:79: warning: unused parameter `int height' +41 kscribbleview.cpp:79: warning: unused parameter `int width' +42 /usr/lib/qt/bin/moc /home/caleb/kscribble/src/pref.h -o pref.moc +43 source='pref.cpp' object='pref.o' libtool=no \ +44 depfile='.deps/pref.Po' tmpdepfile='.deps/pref.TPo' \ +45 depmode=gcc3 /bin/sh /home/caleb/kscribble/admin/depcomp \ +46 g++ -DHAVE_CONFIG_H -I. -I/home/caleb/kscribble/src -I.. -I/usr/local/kde3/include + -I/usr/lib/qt/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor + -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings + -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new + -c -o pref.o `test -f 'pref.cpp' || echo '/home/caleb/kscribble/src/'`pref.cpp +47 /usr/local/kde3/bin/dcopidl /home/caleb/kscribble/src/kscribbleiface.h > kscribbleiface.kidl || + ( rm -f kscribbleiface.kidl ; /bin/false ) +48 /usr/local/kde3/bin/dcopidl2cpp --c++-suffix cpp --no-signals --no-stub kscribbleiface.kidl +49 source='kscribbleiface_skel.cpp' object='kscribbleiface_skel.o' libtool=no \ +50 depfile='.deps/kscribbleiface_skel.Po' tmpdepfile='.deps/kscribbleiface_skel.TPo' \ +51 depmode=gcc3 /bin/sh /home/caleb/kscribble/admin/depcomp \ +52 g++ -DHAVE_CONFIG_H -I. -I/home/caleb/kscribble/src -I.. -I/usr/local/kde3/include + -I/usr/lib/qt/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor + -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings + -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new + -c -o kscribbleiface_skel.o `test -f 'kscribbleiface_skel.cpp' || + echo '/home/caleb/kscribble/src/'`kscribbleiface_skel.cpp +53 /bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall + -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 + -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new -o kscribble -R + /usr/local/kde3/lib -R /usr/lib/qt/lib -R /usr/X11R6/lib -L/usr/X11R6/lib -L/usr/lib/qt/lib + -L/usr/local/kde3/lib main.o kscribble.o kscribbleview.o pref.o kscribbleiface_skel.o -lkio +54 source='kscribble_client.cpp' object='kscribble_client.o' libtool=no \ +55 depfile='.deps/kscribble_client.Po' tmpdepfile='.deps/kscribble_client.TPo' \ +56 depmode=gcc3 /bin/sh /home/caleb/kscribble/admin/depcomp \ +57 g++ -DHAVE_CONFIG_H -I. -I/home/caleb/kscribble/src -I.. -I/usr/local/kde3/include + -I/usr/lib/qt/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor + -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings + -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new + -c -o kscribble_client.o `test -f 'kscribble_client.cpp' || echo + '/home/caleb/kscribble/src/'`kscribble_client.cpp +58 /bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef + -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 + -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -fno-exceptions -fno-check-new -o kscribble_client -R + /usr/local/kde3/lib -R /usr/lib/qt/lib -R /usr/X11R6/lib -L/usr/X11R6/lib -L/usr/lib/qt/lib + -L/usr/local/kde3/lib kscribble_client.o -lkdecore +59 gmake[2]: Leaving directory `/home/caleb/kscribble/src' +60 gmake[2]: Entering directory `/home/caleb/kscribble' +61 gmake[2]: Nothing to be done for `all-am'. +62 gmake[2]: Leaving directory `/home/caleb/kscribble' +63 gmake[1]: Leaving directory `/home/caleb/kscribble' +64 *** Success *** + + + +As you can see, we've put line numbers in front of each line which won't appear on your output but it makes it +easier to describe what is happening during the build. First of all, gmake works recursively. This means +that it starts from the directory it is invoked and goes into the subdirectories first, one at a time, then +returns to the directory it was started, processes it, then finishes. + + +Our first line of interest is 24. Notice on this line that g++, which is our C++ compiler, gets called by make +to compile the first source code file in our project - in this case main.cpp. Many extra command line options +are also being used with the g++ compiler; some of which are defaults and some of which can be configured +via &kdevelop;. + + +Before the next file (kscribble.cpp, line 29) is compiled, the moc (meta object compiler) is first +invoked on kscribble.h (line 25). This is because KScribble classes use signals/slots, so the +Q_OBJECT macro must be expanded, and the moc does this for us. The resultant file, kscribble.moc, is +used by kscribble.cpp via an #include statement inside of the file. + + + + +The source skeleton + +To conceptualize how a KDE application works, we'll first have a very close look at the source +skeleton already provided by the Application Wizard. As we already saw, we're having a set of source +and header files that build the initial code for the application and make it ready-to-run. Therefore, +the easiest way to explain the code is to follow the implementation line by line as it is processed +during executing the program until it enters the main event loop and is ready to accept user input. +Then, we'll have a look at the functionality that enables user interaction and how certain things work. +This is probably the best way to explain the framework and, as it is similar to almost all KDE +applications, will enable you to read source codes from other projects as well; additionally, you will +know where to change what part of the code to make your applications behave the way they are designed for. + + + +The main() function + +As the application begins its execution with entering the main() function, +this will be the start for our code examination. The main() function of +KScribble is implemented in the file main.cpp and can also be found using the Class Browser +by selecting the "Global Functions" folder. + +1 int main(int argc, char **argv) +2 { +3 KAboutData about("kscribble", I18N_NOOP("KScribble"), version, description, +4 KAboutData::License_GPL, "(C) 2002 Your Name", 0, 0, "you@you.com"); +5 about.addAuthor( "Your Name", 0, "you@you.com" ); +6 KCmdLineArgs::init(argc, argv, &about); +7 KCmdLineArgs::addCmdLineOptions(options); +8 KApplication app; +9 +10 // register ourselves as a dcop client +11 app.dcopClient()->registerAs(app.name(), false); +12 +13 // see if we are starting with session management +14 if (app.isRestored()) +15 RESTORE(KScribble) +16 else +17 { +18 // no session.. just start up normally +19 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); +20 if (args->count() == 0) +21 { +22 KScribble *widget = new KScribble; +23 widget->show(); +24 } +25 else +26 { +27 int i = 0; +28 for (; i < args->count(); i++) +29 { +30 KScribble *widget = new KScribble; +31 widget->show(); +32 widget->load(args->url(i)); +33 } +34 } +35 args->clear(); +36 } +37 +38 return app.exec(); +39 } + + + +Now, what happens first is the usual creation of a KApplication object, but we've +added some KDE methods that set program and author information for this application. + + + +User Application Start + +... (not written yet) + + + +The Constructor + +Let's have a look at the constructor and see how this instance is called + +1 KScribble::KScribble() +2 : KMainWindow( 0, "KScribble" ), +3 m_view(new KScribbleView(this)), +4 m_printer(0) +5 { +6 // accept dnd +7 setAcceptDrops(true); +8 +9 // tell the KMainWindow that this is indeed the main widget +10 setCentralWidget(m_view); +11 +12 // then, setup our actions +13 setupActions(); +14 +15 // and a status bar +16 statusBar()->show(); +17 +18 // allow the view to change the statusbar and caption +19 connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)), +20 this, SLOT(changeStatusbar(const QString&))); +21 connect(m_view, SIGNAL(signalChangeCaption(const QString&)), +22 this, SLOT(changeCaption(const QString&))); +23 +24 } + + + +Notice that KScribble inherits the KMainWindow class - a +commonly used base class for KDE applications. We initialize a class called KScribbleView +as our central widget, create a KStatusBar via the statusBar() +method (line 16), and connect some signals and slots together. + + + + + + + +Application View Design + +Introduction + +When developing an application with a graphical user interface, the main work takes place in +providing a so-called "view" for the application. A view generally is a widget that displays the data +of a document and provides methods to manipulate the document contents. This can be done by the user via +the events he emits by the keyboard or the mouse; more complex operations are often processed by toolbars +and menubars which interact with the view and the document. The statusbar then provides information about +the document, view or application status. As an example, we look at how an editor is constructed and where +we can find which part. + + +An editor generally is supposed to provide an interface to view and/or change the contents of a text +document for the user. If you start Kate, you see the visual interface as the following: + + +The menubar: providing complex operations as well as opening, saving and closing files and +exiting the application. + + +The toolbar: offers icons which allow quicker access for most needed functions, + + +The statusbar: displays the status of the cursor position by the current row and column, + + +The view in the center of the window, displaying a document and offering a cursor connected to +the keyboard and the mouse to operate on the data. + + + + +Now it's easy to understand that a view is the most unique part of the application and the design +of the view decides about the usability and acceptability of an application. This means that one of +the first steps in development is to determine the purpose of the application and what kind of view +design would match best to allow any user to work with the application with a minimum of work +learning how to handle the user interface. + + +For some purposes like text editing and displaying HTML files, views are provided by the Qt and KDE +libraries; we will discuss certain aspects of these high-level widgets in the next section. +But for most applications new widgets have to be designed and implemented. It is that what makes a +programmer also a designer and where his abilities on creativity are asked. Nevertheless, you should +watch for intuitivity first. Remember, a lot of users won't accept an application that isn't: + + +graphically nice. + + +offering a lot of features + + +easy to handle + + +fast to learn how to use it + + + + +Needless to say that stability is a major design goal. Nobody can prevent bugs, but a minimum can +be reached at least by clever design goals and wide use of object-oriented design. C++ makes programming +a joy if you know how to exploit it's capabilities- inheritance, information hiding and reusablitity of +already existing code. + + +When creating a KDE or Qt project, you always have to have a view that inherits QWidget, either by +direct inheritance or because the library widget you want to use inherits QWidget. Therefore, the +Application Wizard already constructed a view that is an instance of a class yourappView, which +inherits QWidget already. + + +This chapter therefore describes how to use library widgets for creating views of KDE or +Qt applications that are generated with &kdevelop;, then we look at the libraries and what kind of +views are already offered. + + + +Using Library Views + +When your application design has been set up, you first should look for already existing code that +will make your life a lot easier. A part of this search is to look for a widget that can be used as +a view or at least as a part of it; either directly or by inheritance. The KDE and Qt libraries already +contain a set of widgets that can be used for this purpose. To use them, you have two options: + + +Remove the new view class and create an instance of a library widget; then set this as the view, + + +Change the inheritance of the provided view class to the class of the library widget to use. + + + + +In either way, it is important to know that if the application framework is currently not linked +against the library that contains the widget, the linker will fail. After you decided to use a +certain widget, look for the library to link to; then open "Project"->"Options" from the &kdevelop; +menubar. Switch to the "Linker Options" page and look for the checkmarks indicating the libraries +that are currently used. If the library of your view widget is already checked, you can leave the +project options untouched and start doing the necessary changes due to your choice. If not, and the +linker options offer to add the library by a check box, check it and press "OK" to leave the project +options dialog again. In any other case, add the library in the edit line below with the -l option. +For libraries that your application has to search for before preparing the Makefiles by the +configure script on the end-user machine, add the according search macro to the configure.in file +located at the root directory of your project and add the macro to the edit line. Mind that you have +to run "Build"->"Autoconf and automake" and "Build"->"Configure" before the Makefiles contain the +correct expansion for the library macro. + + +Also, if the include files for the library to add are not in the current include path +(which can be seen by the -I options in the output window on "Make"), you have to add the path to the +Project Options dialog -"Compiler Options" page with the -I option or the according automake macro at +the edit line for "Additional Options". + + +Qt Views + +Looking at the first page of the Qt online documentation, you will find a link to +"Widget Screenshots" where you can have a look at how the widgets Qt contains look like. +These are ready to use and can be combined together to form complex widgets to create application +views or dialogs. In the following, we'll discuss some of these which are very usable for creating +application views, but keep in mind that the KDE libraries sometimes contain other widgets for the +same purpose; those will be reviewed in the next section. + + +Here are a set of hints for what purpose you could use which Qt component: + + +If your view area isn't big enough to display all your data, the user must be enabled to scroll +over the document with bars on the left and bottom of the view. For this, Qt provides the class +QScrollView, which offers a scrollable child area. As explained, you could +inherit your own widget from QScrollView or use an instance to manage your +document's view widget. + + +to create a ScrollView yourself, inherit the View widget from QWidget +and add vertical and horizontal QScrollBars . +(This is done by KDE`s KHTMLView widget.) + + +For text processing, use QTextEdit. This class provides a complete +text editor widget that is already capable to cut, copy and paste text and is managed by a scrollview. + + +Use QTable to display data that is arranged in a table. +As QTable is managed by scrollbars as well, it offers a good solution for +table calculation applications. + + +To display two different widgets or two widget instances at the same time, use QSplitter +. This allows to tile views by horizontal or vertical dividers. +KMail is a good example what this would look like- the main view is separated by a +splitter vertically, the right window then is divided again horizontally. + + +QListView displays information in a list and tree. +This is useful for creating file trees or any other hierarchical information you want to interact with. + + + + +You see that Qt alone offers a whole set of widgets which are ready to use so you don't have to invent +new solutions if these match your needs. The sideffect when using standard widgets is that users already +know how to handle them and only have to concentrate on the displayed data. + + + +KDE Views + +The KDE libraries were invented to make designing applications for the K Desktop Environment easier +and capable of more functionality than what Qt alone is offering. The kdeui library offers: + + +KListView: a more powerful version of QListView + + +KIconView: a graphical viewer of icon files + + + + +The khtml library, on the other hand, offers a complete HTML-interpreting widget that is ready to use. +It is scrollable already, so you don't even have to take care for that. A possible use could be to +integrate it as a preview widget for an HTML editor; used by applications such as Konqueror to display HTML files. + + + + +Creating your own Views + +Not yet written + + + + + +Configuring Menubars and Toolbars + +Introduction + +Menubars and toolbars are one of the most important parts of an application to provide methods to +work with a document structure. As a general rule, you should make all functions available by the menubar. +Those methods that should not be available at a current stage of the application process should be +disabled. + + +Further, an application can only contain one menubar, but several toolbars. +Toolbars on the other hand should contain only the most frequently used commands by pixmap +icons or provide quick access methods like combos to select values. + + + +How does it work? + +Our application inherits the KMainWindow class, which automatically handles creating +a menu bar and tool bars for us. In the KScribble::setupActions() method there is +a call to KMainWindow::createGUI(). This method loads a resource file, in this +case kscribbleui.rc, to initialize menus at startup. Note that kscribbleui.rc is listed as one of the +project files in the Automake Manager. Opening that file up reveals this: + +1 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +2 <kpartgui name="kscribble" version="1"> +3 <MenuBar> +4 <Menu name="custom"><text>C&ustom</text> +5 <Action name="custom_action" /> +6 </Menu> +7 </MenuBar> +8 </kpartgui> + + + +Explanation... + + +Another way to modify the contents of the menu and tool bars is to directly manipulate them through the +methods provided by their class. For example, the menuBar() method returns the +KMenuBar widget that the menubar for our program. Looking at the documentation for +KMenuBar and its inheritor class QMenuBar, you will find +a large number of insertItem() methods which allow you to add items to the +menu bar. + + +KMainWindow's methods statusBar() and +toolBar() will also provide you with applicable widgets. + + + +Keyboard Accelerator Configuration + +A very professional thing you should always add to your application are keyboard accelerators. +Those are mainly used by experienced users that want to work fast with their applications and +are willing to learn shortcuts. For this, the KDE libraries provide the class +KAction, which provides the keyboard accelerator keys and access to global configured +standard keyboard accelerators. + + +By default, frame applications generated by &kdevelop; only use standard keyboard accelerators +such as F1 for accessing online-help, Ctrl+N for New File etc. + + +If your application contains a lot of accelerators, you should make them configurable +by an Options-menu; either it could be combined with other application configuration in a QWidget +or stand alone. The KDE library already provides a KKeyChooser +for use in tab dialogs, whereas KKeyDialog provides a ready-to use +key-configuration dialog. + + + + + + + +Help Functions + +Introduction + +A very important part of the development process is to provide help functionality to the user +wherever possible. Most developers tend to delay this, but you should remember that a normal user +isn't necessarily a Unix expert. He may come from the the dark side of computer software usage offering +all sweets that a user may need to work himself into using an application even without ever touching the +manuals. Therefore, the KDE and Qt library provide all means usually considered making an application +professional in the eyes of the normal user by help functions that are ready to use. +Within the application, those are: + +Tool-Tips +Statusbar help +What's this...? buttons + + +Additionally, the application should provide means to access a HTML-based online manual directly +using the standard help key F1. This context based help system is provided automatically through the +KMainWindow class, though as the author you must provide the content. + + +As &kdevelop; also offers all types of help as well as the KDE framework generated by the +application wizard already contains support for this, this chapter will help you find out where +and how to add your help functionality. + +During the development of your application you should try to be consistent whatever you're doing; +therefore you should do the necessary steps directly while extending the code. This will prevent you +from diving into the code again and figuring out what your application does or what you intended by +certain parts of the code. + + + + +Tool-Tips + +A very easy means of providing help are tool-tips. Those are small help messages popping up while +the user moves the mouse over a widget that provides a tool-tip and disappears when the mouse moves away. +The most popular usage of tool-tips is made in toolbars where your tool-tips should be kept as small +as possible because toolbars can be configured to display their contents in various ways: +either displaying the button, button with text on the right, button with text below, text only. +This possibility should be made configurable by the user, but isn't a must-be. The text is shown +as a tool-tip anyway and a toolbar usually consists of buttons and other widgets like lineedits and +combo boxes. For a complete reference, see the KToolBar class reference located +in the kdeui library. + + +As an example, we have a look at the "New File" button in a generic application: + + +There, the part i18n("New File") provides a tool-tip message. It is enclosed by the i18n() +macro provided by kapp.h to translate the tool-tip towards the currently selected language. + + +Tool-tips can also be added to any custom widget by using the QToolTip +provided by Qt. An example of that would be: + + + +Extending the Statusbar + +As the applications that inherit KMainWindow contain a statusbar as well, +it also offers a set of statusbar messages already for all menu and toolbar items. A statusbar +help message is a short message that extends the meaning of a tool-tip or can be seen as a replacement +for a tool-tip over menubar items and is (as the name suggests) displayed in the statusbar when the user +enters a menu and highlights the menu entry. + + + +The <guibutton>What's This...?</guibutton> Button + +The What's This...? button provides help windows with the intention +that the user wants to get help about a certain widget within the working view or a toolbar item. +It is placed in the toolbar and gets activated once the user hits the button. The cursor changes +to an arrow cursor with a question mark like the button itself looks like. The the user can press on +a visible widget item and gets a help window. As an exercise, you could try this behavior with the +What's this...? button within &kdevelop;. + + +To add the What's This...? help to one of your widgets, use the static method +QWhatsThis::add(QWidget *widget, const QString &text) + + + + + +Documentation + +Introduction + +Due to the fact that projects often lack a complete set of user documentation, +all &kdevelop; projects contain a pre-build handbook that can be easily adapted; +therefore fulfiling another goal of KDE: providing enough online-help to support users that +are not familiar with an application. This chapter therefore introduces you on how to extend +the provided documentation template and what you have to do to make it available to the user. + + + +User Documentation + +The documentation for your project lies in projectdir/doc/en, or perhaps another directory if English +isn't your native language. Therein lies a file, index.docbook, in which the documentation is stored. +The format for editing this file is explained on +KDE's documentation website. + + + +Programmer Documentation + +Another important part of the documentation is including a descriptive help for your class interfaces. +This will allow you and other programmers to use your classes by reading the HTML class documentation +that can be created with KDoc. &kdevelop; supports the use of KDoc completely by creating the +KDE-library documentation, also your application frameworks are already documented. To work yourself +into the provided code, it would be a good start to read the included documentation online. +The following describes what to do to get the API documentation, where &kdevelop; helps you add it +and what kind of special tags KDoc provides. + + + + + +Internationalization + +Introdction + +i18n is an internationalization system that is used to offer internationalized versions of an +application or project. The difficulty with writing applications is that they only support the +language they originally are composed with; visually this can be seen on labels, menu entries and the +like. The goal of the internationalization is to provide applications and library functions in the +language of the user; therefore enabling users that are not native speakers the original language to make +use of the provided functionality and feel more comfortable. + + + + + + +Credits + + +(... to be written ...) + + + + + + + +Bibliography + + + +<ulink url="info://make/Top">GNU Make Manual</ulink> + +Richard M.Stallman +RolandMcGrath + + + + +<ulink url="info://automake/Top">GNU Automake</ulink> + +DavidMacKenzie +TomTromey + + + + +<ulink url="info://autoconf/Top">GNU Autoconf</ulink> + +DavidMacKenzie +BenElliston + + + + +<ulink url="info://gcc/Top">Using the GNU Compiler Collection</ulink> +Richard M.Stallman + + + +<ulink url="info://libtool/Top">GNU Libtool</ulink> + +GordonMatzigkeit +AlexandreOliva +ThomasTanner +Gary V.Vaughan + + + + +GNU Autoconf, Automake, and Libtool +1st edition +October 2000 + +Gary V.Vaughan +BenElliston +TomTromey +Ian LanceTaylor + +New Riders Publishing +ISBN 1578701902 + + + + +Advanced Programming in the UNIX(R) Environment +1st edition +June 1992 +W. RichardStevens +Addison-Wesley Pub Co +ISBN 0201563177 + + + +Thinking in C++, Volume 1: Introduction to Standard C++ +2nd Edition +April 15, 2000 +BruceEckel +Prentice Hall +ISBN 0139798099 + + + +Open Source Development with CVS +2nd Edition +October 12, 2001 + +KarlFogel +MosheBar + +The Coriolis Group +ISBN 158880173X + + + +Programming PHP +1st edition +March 2002 + +RasmusLerdorf +KevinTatroe + +O'Reilly & Associates +ISBN 1565926102 + + + +Programming Python +2nd Edition +March 2001 +MarkLutz +O'Reilly & Associates +ISBN 0596000855 + + + +Gui Programming With Python : Using the Qt Toolkit +Bk&Cd-r edition +January 2002 +BoudewijnRempt +Opendocs Llc +ISBN 0970033044 + + + +Programming Perl +The Camel book +3rd Edition +July 2000 + +LarryWall +TomChristiansen +JonOrwant + +O'Reilly & Associates +ISBN 0596000278 + + + +Learning Perl +The Lama book +3rd Edition +July 15, 2001 + +Randal L.Schwartz +TomPhoenix + +O'Reilly & Associates +ISBN 0596001320 + + + + +&underFDL; + + + + +
diff --git a/doc/kde_app_devel/kscribblefiles.png b/doc/kde_app_devel/kscribblefiles.png new file mode 100644 index 00000000..1591b3cf Binary files /dev/null and b/doc/kde_app_devel/kscribblefiles.png differ diff --git a/doc/kdearch/Makefile.am b/doc/kdearch/Makefile.am new file mode 100644 index 00000000..171f575c --- /dev/null +++ b/doc/kdearch/Makefile.am @@ -0,0 +1,2 @@ +KDE_LANG = en +KDE_DOCS = AUTO diff --git a/doc/kdearch/affine-general.png b/doc/kdearch/affine-general.png new file mode 100644 index 00000000..8e59d5e5 Binary files /dev/null and b/doc/kdearch/affine-general.png differ diff --git a/doc/kdearch/affine-rotate.png b/doc/kdearch/affine-rotate.png new file mode 100644 index 00000000..7192ed9c Binary files /dev/null and b/doc/kdearch/affine-rotate.png differ diff --git a/doc/kdearch/affine-scale.png b/doc/kdearch/affine-scale.png new file mode 100644 index 00000000..0b52fd4c Binary files /dev/null and b/doc/kdearch/affine-scale.png differ diff --git a/doc/kdearch/affine-shear.png b/doc/kdearch/affine-shear.png new file mode 100644 index 00000000..1ed5fbd8 Binary files /dev/null and b/doc/kdearch/affine-shear.png differ diff --git a/doc/kdearch/affine-translate.png b/doc/kdearch/affine-translate.png new file mode 100644 index 00000000..87265e30 Binary files /dev/null and b/doc/kdearch/affine-translate.png differ diff --git a/doc/kdearch/brushstyles.png b/doc/kdearch/brushstyles.png new file mode 100644 index 00000000..b6df50ca Binary files /dev/null and b/doc/kdearch/brushstyles.png differ diff --git a/doc/kdearch/canvas.png b/doc/kdearch/canvas.png new file mode 100644 index 00000000..dd83dae9 Binary files /dev/null and b/doc/kdearch/canvas.png differ diff --git a/doc/kdearch/capflat.png b/doc/kdearch/capflat.png new file mode 100644 index 00000000..5e1c92ce Binary files /dev/null and b/doc/kdearch/capflat.png differ diff --git a/doc/kdearch/capround.png b/doc/kdearch/capround.png new file mode 100644 index 00000000..0e66eaac Binary files /dev/null and b/doc/kdearch/capround.png differ diff --git a/doc/kdearch/capsquare.png b/doc/kdearch/capsquare.png new file mode 100644 index 00000000..35724a72 Binary files /dev/null and b/doc/kdearch/capsquare.png differ diff --git a/doc/kdearch/index.docbook b/doc/kdearch/index.docbook new file mode 100644 index 00000000..b1a40091 --- /dev/null +++ b/doc/kdearch/index.docbook @@ -0,0 +1,3337 @@ + + + +]> + + + + +KDE Architecture Overview + + + + + + +Bernd +Gehrmann +
bernd@kdevelop.org
+
+
+ + +2001 +2002 +Bernd Gehrmann + + +&FDLNotice; + + +This documentation gives an overview of the KDE Development Platform + + + +KDE +architecture +development +programming + + +
+ + +Library structure + + +Libraries by name + + + + +kdecore + +The kdecore library is the basic application framework for every KDE based +program. It provides access to the configuration system, command line +handling, icon loading and manipulation, some special kinds inter-process +communication, file handling and various other utilities. + + + + +kdeui + +The kdeui library provides many widgets and standard +dialogs which Qt doesn't have or which have more features than their Qt +counterparts. It also includes several widgets which are subclassed +from Qt ones and are better integrated with the KDE desktop by +respecting user preferences. + + + + +kio + +The kio library contains facilities for asynchronous, +network transparent I/O and access to mimetype handling. It also provides the +KDE file dialog and its helper classes. + + + + +kjs + +The kjs library provides an implementation of JavaScript. + + + + +khtml + +The khtml library contains the KHTML part, a HTML browsing +widget, DOM API and parser, including interfaces to Java and JavaScript. + + + + + + + + + +Grouped classes + + +Core application skeleton - classes needed by almost every application. + + + + + +<ulink url="kdeapi:kdecore/KApplication">KApplication</ulink> + +Initializes and controls a KDE application. + + + + +<ulink url="kdeapi:kdecore/KUniqueApplication">KUniqueApplication</ulink> + +Makes sure only one instance of an application can run simultaneously. + + + +<ulink url="kdeapi:kdecore/KAboutData">KAboutData</ulink> + +Holds information for the about box. + + + +<ulink url="kdeapi:kdecore/KCmdLineArgs">KCmdLineArgs</ulink> + +Command line argument processing. + + + + + + +Configuration settings - access to KDE's hierarchical configuration +database, global settings and application resources. + + + + +<ulink url="kdeapi:kdecore/KConfig">KConfig</ulink> + +Provides access to KDE's configuration database. + + + +<ulink url="kdeapi:kdecore/KSimpleConfig">KSimpleConfig</ulink> + +Access to simple, non-hierarchical configuration files. + + + +<ulink url="kdeapi:kdecore/KDesktopFile">KDesktopFile</ulink> + +Access to .desktop files. + + + +<ulink url="kdeapi:kdecore/KGlobalSettings">KGlobalSettings</ulink> + +Convenient access to not application-specific settings. + + + + + + +File and URL handling - decoding of URLs, temporary files etc. + + + + +<ulink url="kdeapi:kdecore/KURL">KURL</ulink> + +Represents and parses URLs. + + + +<ulink url="kdeapi:kdecore/KTempFile">KTempFile</ulink> + +Creates unique files for temporary data. + + + +<ulink url="kdeapi:kdecore/KSaveFile">KSaveFile</ulink> + +Allows to save files atomically. + + + + + + +Interprocess communication - DCOP helper classes and subprocess invocation. + + + + +<ulink url="kdeapi:kdecore/KProcess">KProcess</ulink> + +Invokes and controls child processes. + + + +<ulink url="kdeapi:kdecore/KShellProcess">KShellProcess</ulink> + +Invokes child processes via a shell. + + + +<ulink url="kdeapi:kdesu/PtyProcess">PtyProcess</ulink> + +Communication with a child processes through a pseudo terminal. + + + +<ulink url="kdeapi:kdecore/KIPC">KIPC</ulink> + +Simple IPC mechanism using X11 ClientMessages. + + + +<ulink url="kdeapi:dcop/DCOPClient">DCOPClient</ulink> + +DCOP messaging. + + + +<ulink url="kdeapi:kdecore/KDCOPPropertyProxy">KDCOPPropertyProxy</ulink> + +A proxy class publishing Qt properties through DCOP. + + + +<ulink url="kdeapi:kdeui/KDCOPActionProxy">KDCOPActionProxy</ulink> + +A proxy class publishing a DCOP interface for actions. + + + + + + +Utility classes - memory management, regular expressions, string manipulation, +random numbers + + + + +<ulink url="kdeapi:kdecore/KRegExp">KRegExp</ulink> + +POSIX regular expression matching. + + + +<ulink url="kdeapi:kdecore/KStringHandler">KStringHandler</ulink> + +An extravagant interface for string manipulation. + + + +<ulink url="kdeapi:kdecore/KZoneAllocator">KZoneAllocator</ulink> + +Efficient memory allocator for large groups of small objects. + + + +<ulink url="kdeapi:kdecore/KRandomSequence">KRandomSequence</ulink> + +Pseudo random number generator. + + + + + + +Keyboard accelerators - classes helping to establish consistent key bindings +throughout the desktop. + + + + +<ulink url="kdeapi:kdecore/KAccel">KAccel</ulink> + +Collection of keyboard shortcuts. + + + +<ulink url="kdeapi:kdecore/KStdAccel">KStdAccel</ulink> + +Easy access to the common keyboard shortcut keys. + + + +<ulink url="kdeapi:kdecore/KGlobalAccel"></ulink> + +Collection of system-wide keyboard shortcuts. + + + + + + +Image processing - icon loading and manipulating. + + + + +<ulink url="kdeapi:kdecore/KIconLoader">KIconLoader</ulink> + +Loads icons in a theme-conforming way. + + + +<ulink url="kdeapi:kdecore/KIconTheme">KIconTheme</ulink> + +Helper classes for KIconLoader. + + + +<ulink url="kdeapi:kdecore/KPixmap">KPixmap</ulink> + +A pixmap class with extended dithering capabilities. + + + +<ulink url="kdeapi:kdeui/KPixmapEffect">KPixmapEffect</ulink> + +Pixmap effects like gradients and patterns. + + + +<ulink url="kdeapi:kdeui/KPixmapIO">KPixmapIO</ulink> + +Fast QImage to QPixmap conversion. + + + + + + +Drag and Drop - drag objects for colors and URLs. + + + + +<ulink url="kdeapi:kdecore/KURLDrag">KURLDrag</ulink> + +A drag object for URLs. + + + +<ulink url="kdeapi:kdeui/KColorDrag">KColorDrag</ulink> + +A drag object for colors. + + + +<ulink url="kdeapi:kdecore/KMultipleDrag">KMultipleDrag</ulink> + +Allows to construct drag objects from several others. + + + + + + +Auto-Completion + + + + +<ulink url="kdeapi:kdecore/KCompletion">KCompletion</ulink> + +Generic auto-completion of strings. + + + +<ulink url="kdeapi:kio/KURLCompletion">KURLCompletion</ulink> + +Auto-completion of URLs. + + + +<ulink url="kdeapi:kio/KShellCompletion">KShellCompletion</ulink> + +Auto-completion of executables. + + + + + + +Widgets - widget classes for list views, rules, color selection etc. + + + + +<ulink url="kdeapi:kdeui/KListView">KListView</ulink> + +A variant of QListView that honors KDE's system-wide settings. + + + +<ulink url="kdeapi:kdeui/KListView">KListBox</ulink> + +A variant of QListBox that honors KDE's system-wide settings. + + + +<ulink url="kdeapi:kdeui/KListView">KIconView</ulink> + +A variant of QIconView that honors KDE's system-wide settings. + + + +<ulink url="kdeapi:kdeui/KListView">KLineEdit</ulink> + +A variant of QLineEdit with completion support. + + + +<ulink url="kdeapi:kdeui/KComboBox">KComboBox</ulink> + +A variant of QComboBox with completion support. + + + +<ulink url="kdeapi:kdeui/KFontCombo">KFontCombo</ulink> + +A combo box for selecting fonts. + + + +<ulink url="kdeapi:kdeui/KColorCombo">KColorCombo</ulink> + +A combo box for selecting colors. + + + +<ulink url="kdeapi:kdeui/KColorButton">KColorButton</ulink> + +A button for selecting colors. + + + +<ulink url="kdeapi:kdeui/KURLCombo">KURLCombo</ulink> + +A combo box for selecting file names and URLs. + + + +<ulink url="kdeapi:kfile/KURLRequester">KURLRequester</ulink> + +A line edit for selecting file names and URLs. + + + +<ulink url="kdeapi:kdeui/KRuler">KRuler</ulink> + +A ruler widget. + + + +<ulink +url="kdeapi:kdeui/KAnimWidget">KAnimWidget</ulink> + +animations. + + + +<ulink url="kdeapi:kdeui/KNumInput">KNumInput</ulink> + +A widget for inputting numbers. + + + +<ulink url="kdeapi:kdeui/KPasswordEdit">KPasswordEdit</ulink> + +A widget for inputting passwords. + + + + + + +Dialogs - full-featured dialogs for file, color and font selection. + + + + +<ulink url="kdeapi:kfile/KFileDialog">KFileDialog</ulink> + +A file selection dialog. + + + +<ulink url="kdeapi:kdeui/KColorDialog">KColorDialog</ulink> + +A color selection dialog. + + + +<ulink url="kdeapi:kdeui/KFontDialog">KFontDialog</ulink> + +A font selection dialog. + + + +<ulink url="kdeapi:kfile/KIconDialog">KIconDialog</ulink> + +An icon selection dialog. + + + +<ulink url="kdeapi:kdeui/KKeyDialog">KKeyDialog</ulink> + +A dialog for editing keyboard bindings. + + + +<ulink url="kdeapi:kdeui/KEditToolBar">KEditToolBar</ulink> + +A dialog for editing toolbars. + + + +<ulink url="kdeapi:kdeui/KTipDialog">KTipDialog</ulink> + +A Tip-of-the-day dialog. + + + +<ulink url="kdeapi:kdeui/KAboutDialog">KAboutDialog</ulink> + +An about dialog. + + + +<ulink url="kdeapi:kdeui/KLineEditDlg">KLineEditDlg</ulink> + +A simple dialog for entering text. + + + +<ulink url="kdeapi:kfile/KURLRequesterDlg">KURLRequesterDlg</ulink> + +A simple dialog for entering URLs. + + + +<ulink url="kdeapi:kdeui/KMessageBox">KMessageBox</ulink> + +A dialog for signaling errors and warnings. + + + +<ulink url="kdeapi:kdeui/KPasswordDialog">KPasswordDialog</ulink> + +A dialog for inputting passwords. + + + + + + +Actions and XML GUI + + + + +<ulink url="kdeapi:kdeui/KAction">KAction</ulink> + +Abstraction for an action that can be plugged into menu bars and tool bars. + + + +<ulink url="kdeapi:kdeui/KActionCollection">KActionCollection</ulink> + +A set of actions. + + + +<ulink url="kdeapi:kdeui/KXMLGUIClient">KXMLGUIClient</ulink> + +A GUI fragment consisting of an action collection and a DOM tree representing their location in the GUI. + + + +<ulink url="kdeapi:kparts/KPartManager">KPartManager</ulink> + +Manages the activation of XMLGUI clients. + + + + + + +Plugins and Components + + + + +<ulink url="kdeapi:kdecore/KLibrary">KLibrary</ulink> + +Represents a dynamically loaded library. + + + +<ulink url="kdeapi:kdecore/KLibrary">KLibLoader</ulink> + +Shared library loading. + + + +<ulink url="kdeapi:kdecore/KLibFactory">KLibFactory</ulink> + +Object factory in plugins. + + + +<ulink url="kdeapi:kio/KServiceType">KServiceType</ulink> + +Represents a service type. + + + +<ulink url="kdeapi:kio/KService">KService</ulink> + +Represents a service. + + + +<ulink url="kdeapi:kio/KMimeType">KMimeType</ulink> + +Represents a MIME type. + + + +<ulink url="kdeapi:kio/KServiceTypeProfile">KServiceTypeProfile</ulink> + +User preferences for MIME type mappings. + + + +<ulink url="kdeapi:kio/KServiceTypeProfile">KTrader</ulink> + +Querying for services. + + + + + + + + + + + + +Graphics + + +Low-level graphics with QPainter + + +Rendering with QPainter + + +Qt's low level imaging model is based on the capabilities provided by X11 and +other windowing systems for which Qt ports exist. But it also extends these by +implementing additional features such as arbitrary affine transformations for +text and pixmaps. + + + +The central graphics class for 2D painting with Qt is +QPainter. It can +draw on a +QPaintDevice. +There are three possible paint devices implemented: One is +QWidget +which represents a widget on the screen. The second is +QPrinter which +represents a printer and produces Postscript output. The third it +the class +QPicture which +records paint commands and can save them on disk and play them back +later. A possible storage format for paint commands is the W3C standard +SVG. + + + +So, it is possible to reuse the rendering code you use for displaying a +widget for printing, with the same features supported. Of course, in +practice, the code is used in a slightly different context. Drawing +on a widget is almost exclusively done in the paintEvent() method +of a widget class. + + + +void FooWidget::paintEvent() +{ + QPainter p(this); + // Setup painter + // Use painter +} + + + +When drawing on a printer, you have to make sure to use QPrinter::newPage() +to finish with a page and begin a new one - something that naturally is not +relevant for painting widgets. Also, when printing, you may want to use the +device metrics +in order to compute coordinates. + + + + + + +Transformations + + +By default, when using QPainter, it draws in the natural coordinate +system of the device used. This means, if you draw a line along the horizontal +axis with a length of 10 units, it will be painted as a horizontal line +on the screen with a length of 10 pixels. However, QPainter can apply arbitrary +affine transformations before actually rendering shapes and curves. An +affine transformation maps the x and y coordinates linearly into x' and +y' according to + + + + + + + +The 3x3 matrix in this equation can be set with QPainter::setWorldMatrix() and +is of type QWMatrix. +Normally, this is the identity matrix, i.e. m11 and m22 are one, and the +other parameters are zero. There are basically three different groups of +transformations: + + + + + +Translations + +These move all points of an object by a fixed amount in +some direction. A translation matrix can be obtained by calling +method m.translate(dx, dy) for a QWMatrix. This corresponds to the +matrix + + + + + + + + + + +Scaling + +These stretch or shrink the coordinates of an object, making +it bigger or smaller without distorting it. A scaling transformation +can be applied to a QWMatrix by calling m.scale(sx, sy). This corresponds +to the matrix + + + + + + + + +By setting one of the parameters to a negative value, one can +achieve a mirroring of the coordinate system. + + + + + +Shearing + +A distortion of the coordinate system with two +parameters. A shearing transformation can be applied by calling +m.shear(sh, sv), corresponding to the matrix + + + + + + + + + + +Rotating + +This rotates an object. A rotation transformation can be +applied by calling m.rotate(alpha). Note that the angle has to be given +in degrees, not as mathematical angle! The corresponding matrix is + + + + + + + + +Note that a rotation is equivalent with a combination of +scaling and shearing. + + + + + + + +Here are some pictures that show the effect of the elementary +transformation to our masquot: + + + + + + + + + + + + + + + + + + + + +a) Normal +b) Rotated by 30 degrees +c) Sheared by 0.4 +d) Mirrored + + + + + + +Transformations can be combined by multiplying elementary matrices. Note that +matrix operations are not commutative in general, and therefore the combined +effect of of a concatenation depends on the order in which the matrices are +multiplied. + + + + + + +Setting stroking attributes + + +The rendering of lines, curves and outlines of polygons can be modified by +setting a special pen with QPainter::setPen(). The argument of this function is a +QPen object. The properties +stored in it are a style, a color, a join style and a cap style. + + + +The pen style is member of the enum +Qt::PenStyle. +and can take one of the following values: + + + + + + + +The join style is a member of the enum +Qt::PenJoinStyle. +It specifies how the junction between multiple lines which are attached to each +other is drawn. It takes one of the following values: + + + + + + + + + + + + + + + + + +a) MiterJoin +c) BevelJoin +b) RoundJoin + + + + + + +The cap style is a member of the enum +Qt::PenCapStyleand specifies how the end points of lines are drawn. It takes one of the values +from the following table: + + + + + + + + + + + + + + + + + +a) FlatCap +b) SquareCap +c) RoundCap + + + + + + + + + +Setting fill attributes + + +The fill style of polygons, circles or rectangles can be modified by setting +a special brush with QPainter::setBrush(). This function takes a +QBrush object as argument. +Brushes can be constructed in four different ways: + + + + +QBrush::QBrush() - This creates a brush that does not fill shapes. + + +QBrush::QBrush(BrushStyle) - This creates a black brush with one of the default +patterns shown below. + + +QBrush::QBrush(const QColor &, BrushStyle) - This creates a colored brush +with one of the patterns shown below. + + +QBrush::QBrush(const QColor &, const QPixmap) - This creates a colored +brush with the custom pattern you give as second parameter. + + + + +A default brush style is from the enum +Qt::BrushStyle. +Here is a picture of all predefined patterns: + + + + + + + +A further way to customize the brush behavior is to use the function +QPainter::setBrushOrigin(). + + + + + + +Color + + +Colors play a role both when stroking curves and when filling shapes. In Qt, +colors are represented by the class +QColor. Qt does not support +advanced graphics features like ICC color profiles and color correction. Colors +are usually constructed by specifying their red, green and blue components, as +the RGB model is the way pixels are composed of on a monitor. + + + +It is also possible to use hue, saturation and value. This HSV representation is +what you use in the Gtk color dialog, e.g. in GIMP. There, the hue corresponds +to the angle on the color wheel, while the saturation corresponds to the +distance from the center of the circle. The value can be chosen with a separate +slider. + + + + + + +Other settings + + +Normally, when you paint on a paint device, the pixels you draw replace those +that were there previously. This means, if you paint a certain region with +a red color and paint the same region with a blue color afterwards, only +the blue color will be visible. Qt's imaging model does not support +transparency, i.e. a way to blend the painted foreground with the background. +However, there is a simple way to combine background and foreground with +boolean operators. The method QPainter::setRasterOp() sets the used operator, +which comes from the enum +RasterOp. + + + +The default is CopyROP which ignores the background. Another popular choice is +XorROP. If you paint a black line with this operator on a colored image, then +the covered area will be inverted. This effect is for example used to create +the rubberband selections in image manipulation programs known as +"marching ants". + + + + + + +Drawing graphics primitives + + +In the following we list the elementary graphics elements supported by +QPainter. Most of them exist in several overloaded versions which take a +different number of arguments. For example, methods that deal with rectangles +usually either take a +QRect as argument or a set +of four integers. + + + + +Drawing a single point - drawPoint(). + + +Drawing lines - drawLine(), drawLineSegments() and drawPolyLine(). + + +Drawing and filling rectangles - drawRect(), drawRoundRect(), +fillRect() and eraseRect(). + + +Drawing and filling circles, ellipses and parts or them - +drawEllipse(), drawArc(), drawPie and drawChord(). + + +Drawing and filling general polygons - drawPolygon(). + + +Drawing bezier curves - drawQuadBezier() [drawCubicBezier in Qt 3.0]. + + + + + + + +Drawing pixmaps and images + + +Qt provides two very different classes to represent images. + + + +QPixmap directly corresponds +to the pixmap objects in X11. Pixmaps are server-side objects and may - on a +modern graphics card - even be stored directly in the card's memory. This makes +it very efficient to transfer pixmaps to the screen. Pixmaps also act as +an off-screen equivalent of widgets - the QPixmap class is a subclass of +QPaintDevice, so you can draw on it with a QPainter. Elementary drawing +operations are usually accelerated by modern graphics. Therefore, a common usage +pattern is to use pixmaps for double buffering. This means, instead of painting +directly on a widget, you paint on a temporary pixmap object and use the +bitBlt +function to transfer the pixmap to the widget. For complex repaints, this helps +to avoid flicker. + + + +In contrast, QImage objects +live on the client side. Their emphasis in on providing direct access to the +pixels of the image. This makes them of use for image manipulation, and things +like loading and saving to disk (QPixmap's load() method takes QImage as +intermediate step). On the other hand, painting an image on a widget is a +relatively expensive operation, as it implies a transfer to the X server, +which can take some time, especially for large images and for remote servers. +Depending on the color depth, the conversion from QImage to QPixmap may also +require dithering. + + + + + + +Drawing text + + +Text can be drawn with one of the overloaded variants of the method +QPainter::drawText(). These draw a QString either at a given point or in a given +rectangle, using the font set by QPainter::setFont(). There is also a parameter +which takes an ORed combination of some flags from the enums +Qt::AlignmentFlags +and +Qt::TextFlags + + + +Beginning with version 3.0, Qt takes care of the complete text layout even for +languages written from right to left. + + + +A more advanced way to display marked up text is the +QSimpleRichText +class. Objects of this class can be constructed with a piece of text using +a subset of the HTML tags, which is quite rich and provides even tables. +The text style can be customized by using a +QStyleSheet (the +documentation of the tags can also be found here). Once the rich text object has +been constructed, it can be rendered on a widget or another paint device with +the QSimpleRichText::draw() method. + + + + + + + + +Structured graphics with QCanvas + + +QPainter offers a powerful imaging model for painting on widgets and pixmaps. +However, it can also be cumbersome to use. Each time your widget receives +a paint event, it has to analyze the QPaintEvent::region() or +QPaintEvent::rect() which has to be redrawn. Then it has to setup a +QPainter and paint all objects which overlap with that region. For example, +image a vector graphics program which allows to drag objects like polygons, +circles and groups of them around. Each time those objects move a bit, the +widget's mouse event handler triggers a paint event for the whole area covered +by the objects in their old position and in their new position. Figuring +out the necessary redraws and doing them in an efficient way can be difficult, +and it may also conflict with the object-oriented structure of the program's +source code. + + + +As an alternative, Qt contains the class +QCanvas in which +you put graphical objects like polygons, text, pixmaps. You may also provide +additional items by subclassing +QCanvasItem or +one of its more specialized subclasses. A canvas can be shown on the screen by +one or more widgets of the class +QCanvasView which +you have to subclass in order to handle user interactions. Qt takes care of +all repaints of objects in the view, whether they are caused by the widget +being exposed, new objects being created or modified or other things. By using +double buffering, this can be done in an efficient and flicker-free way. + + + +Canvas items can overlap each other. In this case, the visible one depends on +the z order which can be assigned by QCanvasItem::setZ(). Items can also be +made visible or invisible. You can also provide a background to be drawn +"behind" all items and a foreground. For associating mouse events with objects, +in the canvas, there is the method QCanvas::collisions() which returns a list +of items overlapping with a given point. Here we show a screenshot of a canvas +view in action: + + + + + + + +Here, the mesh is drawn in the background. Furthermore, there is a +QCanvasText item and a violet QCanvasPolygon. The butterfly is a +QCanvasPixmap. It has transparent areas, so you can see the underlying +items through it. + + + +A tutorial on using QCanvas for writing sprite-based games can be +found here. + + + + + + +3D graphics with OpenGL + + +Low-level interface + + +The de facto standard for rendering 3D graphics today is +OpenGL. Implementations of this +specification come with Microsoft Windows, Mac OS X and XFree86 and often +support the hardware acceleration features offered by modern graphics cards. +OpenGL itself only deals with rendering on a specified area of the framebuffer +through a GL context and does not have any interactions +with the toolkit of the environment + + + +Qt offers the widget QGLWidget +which encapsulates a window with an associated GL context. Basically, you use it +by subclassing it and reimplementing some methods. + + + + + +Instead of reimplementing paintEvent() and using QPainter to draw the widget's +contents, you override paintGL() and use GL commands to render a scene. QLWidget +will take care of making its GL context the current one before paintGL() is +called, and it will flush afterwards. + + + +The virtual method initializeGL() is called once before the first time resizeGL() +or paintGL() are called. This can be used to construct display lists for objects, +and make any initializations. + + + +Instead of reimplementing resizeEvent(), you override resizeGL(). This can +be used to set the viewport appropriately. + + + +Instead of calling update() when the state of the scene has changed - for example +when you animate it with a timer -, you should call updateGL(). This will trigger +a repaint. + + + + + +In general, QGLWidget behaves just like any other widget, i.e. for example +you can process mouse events as usual, resize the widget and combine it with +others in a layout. + + + + + + + +Qt contains some examples of QGLWidget usage in its demo +example. A collection of tutorials can be found +here, +and more information and a reference of OpenGL is available on the +OpenGL homepage. + + + + + + +High-level interfaces + + +OpenGL is a relatively low-level interface for drawing 3D graphics. In the same +way QCanvas gives the programmer a higher-level interface which details with +objects and their properties, there are also high-level interfaces for 3D graphics. +One of the most popular is Open Inventor. Originally a technology developed by SGI, +there is today also the open source implementation +Coin, complemented by a toolkit binding to Qt +called SoQt. + + + +The basic concept of Open Inventor is that of a scene. +A scene can be loaded from disk and saved in a special format closely related +to VRML. A scene consists of a +collection of objects called nodes. Inventor already +provides a rich collection of reusable nodes, such as cubes, cylinders and +meshes, furthermore light sources, materials, cameras etc. Nodes are +represented by C++ classes and can be combined and subclassed. + + + +An introduction to Inventor can be found +here +(in general, you can substitute all mentions of SoXt by SoQt in this article). + + + + + + + + + + + +User interface + + +The action pattern + + + + + + + +Defining menus and toolbars in XML + + +Introduction + + +While the action pattern +allows to encapsulate actions triggered by the user in an object which can be +"plugged" somewhere in the menu bars or toolbars, it does not by itself solve +the problem of constructing the menus themselves. In particular, you have to +build all popup menus in C++ code and explicitly insert the actions in a +certain order, under consideration of the style guide for standard actions. +This makes it pretty difficult to allow the user to customize the menus or +change shortcuts to fit his needs, without changing the source code. + + + +This problem is solved by a set of classes called XMLGUI. +Basically, this separates actions (coded in C++) from their appearance in menu +bars and tool bars (coded in XML). Without modifying any source code, menus +can be simply customized by adjusting an XML file. Furthermore, it helps +to make sure that standard actions (such as +FileOpen +or HelpAbout) +appear in the locations suggested by the style guide. XMLGUI is especially +important for modular programs, where the items appearing in the menu bar may +come from many different plugins or parts. + + + +KDE's class for toplevel windows, +KMainWindow, +inherits +KXMLGUIClient +and therefore supports XMLGUI out of the box. All actions created within it must +have the client's actionCollection() as parent. A call to +createGUI() will then build the whole set of menu and tool +bars defined the applications XML file (conventionally with the suffix +ui.rc). + + + + + + +An example: Menu in KView + + +In the following, we take KDE's image view KView as +example. It has a ui.rc file named +kviewui.rc which is installed with the +Makefile.am snippet + + + +rcdir = $(kde_datadir)/kview +rc_DATA = kviewui.rc + + + +Here is an excerpt from the kviewui.rc file. For +simplicity, we show only the definition of the View menu. + + + +<!DOCTYPE kpartgui> +<kpartgui name="kview"> + <MenuBar> + <Menu name="view" > + <Action name="zoom50" /> + <Action name="zoom100" /> + <Action name="zoom200" /> + <Action name="zoomMaxpect" /> + <Separator/> + <Action name="fullscreen" /> + </Menu> + </MenuBar> +</kpartgui> + + + +The corresponding part of the setup in C++ is: + + + + KStdAction::zoomIn ( this, SLOT(slotZoomIn()), actionCollection() ); + KStdAction::zoomOut ( this, SLOT(slotZoomOut()), actionCollection() ); + KStdAction::zoom ( this, SLOT(slotZoom()), actionCollection() ); + new KAction ( i18n("&Half size"), ALT+Key_0, + this, SLOT(slotHalfSize()), + actionCollection(), "zoom50" ); + new KAction ( i18n("&Normal size"), ALT+Key_1, + this, SLOT(slotDoubleSize()), + actionCollection(), "zoom100" ); + new KAction ( i18n("&Double size"), ALT+Key_2, + this, SLOT(slotDoubleSize()), + actionCollection(), "zoom200" ); + new KAction ( i18n("&Fill Screen"), ALT+Key_3, + this, SLOT(slotFillScreen()), + actionCollection(), "zoomMaxpect" ); + new KAction ( i18n("Fullscreen &Mode"), CTRL+SHIFT+Key_F, + this, SLOT(slotFullScreen()), + actionCollection(), "fullscreen" ); + + + +The View menu resulting from this GUI definition looks like +in this screenshot: + + + + + + + +The XML file begins with a document type declaration. The DTD for kpartgui can +be found in the kdelibs sources in kdeui/kpartgui.dtd. The +outermost element of the file contains the instance name of the application as +attribute. It can also contain a version number in the form "version=2". This +is useful when you release new versions of an application with a changed menu +structure, e.g. with more features. If you bump up the version number of the +ui.rc file, KDE makes sure that any customized version of +the file is discarded and the new file is used instead. + + + +The next line, <MenuBar>, contains a declaration of a +menu bar. You can also insert any number of <ToolBar> +declarations in order to create some tool bars. The menu contains a submenu +with the name "view". This name is already predefined, and thus you see a +translated version of the word "View" in the screenshot. If you declare your +own submenus, you have to add the title explicitly. For example, +KView has a submenu with the title "Image" which is +declared as follows: + + + +<Menu name="image" > + <text>&amp;Image</text> + ... +</Menu> + + + +In KDE's automake framework, such titles are automatically extracted and put +into the application's .po +file , so it is considered by translators. Note that you have to write the +accelerator marker "&" in the form XML compliant form "&amp;". + + + +Let us come back to the example. KView's +View menu contains a couple of custom actions: +zoom50, zoom100, +zoom200, zoomMaxpect and +fullscreen, declared with a +<Action> element. The separator in the +screenshots corresponds to the <Separator> element. + + + +You will note that some menu items do not not have a corresponding element in +the XML file. These are standard actions. Standard +actions are created by the class +KStdAction. +When you create such actions in your application (such as in the C++ example +above), they will automatically be inserted in a prescribed position, and +possibly with an icon and a shortcut key. You can look up these locations in +the file kdeui/ui_standards.rc in the kdelibs sources. + + + + + + +An example: Toolbars in Konqueror + + +For the discussion of toolbars, we switch to +Konqueror's GUI definition. This excerpt defines +the location bar, which contains the input field for URLs. + + + +<ToolBar name="locationToolBar" fullWidth="true" newline="true" > + <text>Location Toolbar</text> + <Action name="clear_location" /> + <Action name="location_label" /> + <Action name="toolbar_url_combo" /> + <Action name="go_url" /> +</ToolBar> + + + +The first thing we notice is that there are a lot more attributes than for +menu bars. These include: + + + + + +fullWidth: Tells XMLGUI that the toolbar has the same width as the + toplevel window. Af this is "false", the toolbar only takes as much space as + necessary, and further toolbars are put in the same row. + + + +newline: This is related to the option above. If newline is "true", +the toolbar starts a new row. Otherwise it may be put in the row together +with the previous toolbar. + + + +noEdit: Normally toolbars can be customized by the user, +e.g. in SettingsConfigure +Toolbars in +Konqueror. Setting this option to "true" marks this +toolbar as not editable. This is important for toolbars which are filled with +items at runtime, e.g. Konqueror's bookmark toolbar. + + + +iconText: Tells XMLGUI to show the text of the action next to the +icon. Normally, the text is only shown as a tooltip when the mouse cursor +remains over the icon for a while. Possible values for this attribute are +"icononly" (shows only the icon), "textonly" (shows only the text), +"icontextright" (shows the text on the right side of the icon) and +"icontextbottom" (shows the text beneath the icon). + + + + +hidden: If this is "true", the toolbar is not visible initially +and must be activated by some menu item. + + + + +position: The default for this attribute is "top", meaning that the +toolbar is positioned under the menu bar. For programs with many tools, +such as graphics programs, it may be interesting to replace this with +"left", "right" or "bottom". + + + + + + + + +Dynamical menus + + +Obviously, an XML can only contain a static description of a user interface. +Often, there are menus which change at runtime. For example, +Konqueror's Location menu +contains a set of items Open with Foo with the +applications able to load a file with a given MIME type. Each time the +document shown changes, the list of menu items is updated. XMLGUI is prepared +to handle such cases with the notion of action lists. +An action list is declared as one item in the XML file, but consists of +several actions which are plugged into the menu at runtime. The above example +is implemented with the following declaration in +Konqueror's XML file: + + + +<Menu name="file"> + <text>&amp;Location</text> + ... + <ActionList name="openwith"> + ... +</Menu> + + + +The function KXMLGUIClient::plugActionList() is then used +to add actions to be displayed, whereas the function +KXMLGuiClient::unplugActionList() removes all +plugged actions. The routine responsible for updating looks as follows: + + + +void MainWindow::updateOpenWithActions() +{ + unplugActionList("openwith"); + openWithActions.clear(); + for ( /* iterate over the relevant services */ ) { + KAction *action = new KAction( ...); + openWithActions.append(action); + } + plugActionList("openwith", openWithActions); +} + + + +Note that in contrast to the static actions, the ones created here are +not constructed with the action collection as parent, and +you are responsible for deleting them for yourself. The simplest way to achievethis +is by using openWithActions.setAutoDelete(true) in the above +example. + + + + + + +Context menus + + +The examples above only contained cases where a main window's menubar and +toolbars were created. In the cases, the processes of constructing these +containers is completely hidden from you behind the +createGUI() call (except if you have custom containers). +However, there are cases, where you want to construct other containers and +populate them with GUI definitions from the XML file. One such example are +context menus. In order to get a pointer to a context menu, you have to +ask the client's factory for it: + + + +void MainWindow::popupRequested() +{ + QWidget *w = factory()->container("context_popup", this); + QPopupMenu *popup = static_cast<QPopupMenu *>(w); + popup->exec(QCursor::pos()); +} + + + +The method KXMLGUIFactory::container() used above looks +whether it finds a container in the XML file with the given name. Thus, a +possible definition could look as follows: + + + +... +<Menu name="context_popup"> + <Action name="file_add"/> + <Action name="file_remove"/> +</Menu> +... + + + + + + + + +Providing online help + + +Making a program easy and intuitive to use involves a wide range of +facilities which are usually called online help. Online help has several, +partially conflicting goals: on the one, it should give the user answers +to the question "How can I do a certain task?", on the other hand it +should help the user exploring the application and finding features he +doesn't yet know about. It is important to recognize that this can only +be achieved by offering several levels of help: + + + + + +Tooltips are tiny labels that pop up over user interface elements when +the mouse remains there longer. They are especially important for tool- +bars, where icons are not always sufficient to explain the purpose of +a button. + + + +"What's this?" help is usually a longer and richer explanation of a widget +or a menu item. It is also more clunky to use: In dialogs, it can be invoked +in two ways: either by pressing +ShiftF1 or by clicking +on the question mark in the title bar (where the support of the latter depends +on the window manager). The mouse pointer then turns into an arrow with a +question mark, and the help window appears when a user interfact element has +been clicked. "What's this?" help for menu items is usually activated by a +button in the toolbar which contains an arrow and a question mark. + + + +The problem with this approach is that the user can't see whether a widget +provides help or not. When the user activates the question mark button and +doesn't get any help window when clicking on a user interface element, he +will get frustrated very quickly. + + + +The advantage of "What's this?" help windows as provided by Qt and KDE is that +they can contain rich text, +i.e. the may contain different fonts, bold and italic text and even images and tables. + + + +An example of "What's this?" help: + + + + + + + + + +Finally, every program should have a manual. A manual is normally viewed in +KHelpCenter by activating the +Help menu. That means, a complete additional application +pops up and diverts the user from his work. Consequently, consulting the +manual should only be necessary if other facilities like tooltips and what's +this help are not sufficient. Of course, a manual has the advantage that it +does not explain single, isolated aspects of the user interface. Instead, it +can explain aspects of the application in a greater context. Manuals for KDE +are written using the DocBook markup +language. + + + + + +From the programmer's point of view, Qt provides an easy to use API for online +help. To assign a tooltip to widget, use the +QToolTip class. + + + +QToolTip::add(w, i18n("This widget does something.")) + + + +If the menu bars and tool bars are created using the +action pattern, the string used as tooltip is derived from the first argument +of the KAction constructor: + + + +action = new KAction(i18n("&Delete"), "editdelete", + SHIFT+Key_Delete, actionCollection(), "del") + + + +Here it is also possible to assign a text which is shown in the status bar when the +respective menu item is highlighted: + + + +action->setStatusText(i18n("Deletes the marked file")) + + + +The API for "What's this?' help is very similar. In dialogs, use the following +code: + + + +QWhatsThis::add(w, i18n("<qt>This demonstrates <b>Qt</b>'s" + " rich text engine.<ul>" + "<li>Foo</li>" + "<li>Bar</li>" + "</ul></qt>")) + + + +For menu items, use + + + +action->setWhatsThis(i18n("Deletes the marked file")) + + + +The invocation of KHelpCenter is encapsulated in the +KApplication +class. In order to show the manual of your application, just use + + + +kapp->invokeHelp() + + + +This displays the first page with the table of contents. When you want to +display only a certain section of the manual, you can give an additional +argument to invokeHelp() determining the anchor which +the browser jumps to. + + + + + + + + + +Components and services + + +KDE services + + +What are KDE services? + + +The notion of a service is a central concept in KDE's +modular architecture. There is no strict technical implementation connected +with this term - services can be plugins in the form of shared libraries, +or they can be programs controlled via DCOP. +By claiming to be of a certain service type, a service +promises to implement certain APIs or features. In C++ terms, one can think +of a service type as an abstract class, and a service as an implementation +of that interface. + + + +The advantage of this separation is clear: An application utilizing a service +type does not have to know about possible implementations of it. It just uses +the APIs associated with the service type. In this way, the used service can be +changed without affecting the application. Also, the user can configure which +services he prefers for certain features. + + + +Some examples: + + + + + +The HTML rendering engine used in Konqueror is an +embedable component that implements the service types +KParts/ReadOnlyPart and Browser/View. + + +In KDevelop HEAD, most functionality is packaged in +plugins with the service type KDevelop/Part. At startup, +all services with this type are loaded, such that you can extend the IDE in a +very flexible way. + + +In the icon view, Konqueror displays - if enabled - +thumbnail pictures of images, HTML pages, PDF and text files. This ability can +be extended. If you want it to display preview pictures of your own data files +with some MIME type, you can implement a service with service type +ThumbCreator. + + + + + +Obviously, a service is not only characterized by the service types it +implements, but also by some properties. For example, a +ThumbCreator does not only claim to implement the C++ class with the type +ThumbCreator, it also has a list of MIME types it is +responsible for. Similarly, KDevelop parts have the programming language they +support as a property. When an application requests a service type, it can +also list constraints on the properties of the service. In the above example, +when KDevelop loads the plugins for a Java project, it asks only for the +plugins which have Java as the programming language property. For this +purpose, KDE contains a full-blown CORBA-like trader with +a complex query language. + + + + + + +Defining service types + + +New service types are added by installing a description of them into the +directory KDEDIR/share/servicetypes. In an automake +framework, this can be done with this Makefile.am +snippet: + + + +kde_servicetypesdir_DATA = kdeveloppart.desktop +EXTRA_DIST = $(kde_servicetypesdir_DATA) + + + +The definition kdeveloppart.desktop of a +KDevelop part looks as follows: + + + +[Desktop Entry] +Type=ServiceType +X-KDE-ServiceType=KDevelop/Part +Name=KDevelop Part + +[PropertyDef::X-KDevelop-Scope] +Type=QString + +[PropertyDef::X-KDevelop-ProgrammingLanguages] +Type=QStringList + +[PropertyDef::X-KDevelop-Args] +Type=QString + + + +In addition to the usual entries, this example demonstrates how you declare +that a service has some properties. Each property definition corresponds +to a group [PropertyDef::name] in the configuration file. In +this group, the Type entry declares the type of the property. +Possible types are everything that can be stored in a +QVariant. + + + + + + +Defining shared library services + + +Service definitions are stored in the directory +KDEDIR/share/services: + + + +kde_servicesdir_DATA = kdevdoxygen.desktop +EXTRA_DIST = $(kde_servicesdir_DATA) + + + +The content of the following example file +kdevdoxygen.desktop defines the +KDevDoxygen plugin with the service type +KDevelop/Part: + + + +[Desktop Entry] +Type=Service +Comment=Doxygen +Name=KDevDoxygen +ServiceTypes=KDevelop/Part +X-KDE-Library=libkdevdoxygen +X-KDevelop-ProgrammingLanguages=C,C++,Java +X-KDevelop-Scope=Project + + + +In addition to the usual declarations, an important entry is +X-KDE-Library. This contains the name of the libtool +library (without the .la extension). It also fixes +(with the prefix init_ prepended) the name of the exported +symbol in the library which returns an object factory. For the above example, +the library must contain the following function: + + + +extern "C" { + void *init_libkdevdoxygen() + { + return new DoxygenFactory; + } +}; + + + +The type of the factory class DoxygenFactory depends on +the specific service type the service implements. In our example of a KDevelop +plugin, the factory must be a KDevFactory (which +inherits KLibFactory). More common examples are +KParts::Factory +which is supposed to produce +KParts::ReadOnlyPart +objects or in most cases the generic +KLibFactory. + + + + + + +Using shared library services + + +In order to use a shared library service in an application, you need to obtain a +KService object +representing it. This is discussed in the +section about MIME types (and in a section about the +trader to be written :-) + + + +With the KService object at hand, you can very simply +load the library and get a pointer to its factory object: + + + +KService *service = ... +QString libName = QFile::encodeName(service->library()); +KLibFactory *factory = KLibLoader::self()->factory(libName); +if (!factory) { + QString name = service->name(); + QString errorMessage = KLibLoader::self()->lastErrorMessage(); + KMessageBox::error(0, i18n("There was an error loading service %1.\n" + "The diagnostics from libtool is:\n%2") + .arg(name).arg(errorMessage); +} + + + +From this point, the further proceeding depends again on the service type. For +generic plugins, you create objects with the method +KLibFactory::create(). +For KParts, you must cast the factory pointer to the more specific KParts::Factory and use +its create() method: + + + +if (factory->inherits("KParts::Factory")) { + KParts::Factory *partFactory = static_cast<KParts::Factory*>(factory); + QObject *obj = partFactory->createPart(parentWidget, widgetName, + parent, name, "KParts::ReadOnlyPart"); + ... +} else { + cout << "Service does not implement the right factory" << endl; +} + + + + + + +Defining DCOP services + + +A DCOP service is usually implemented as a program that is started up when it is +needed. It then goes into a loop and listens for DCOP connections. The program +may be an interactive one, but it may also run completely or for a part of its +lifetime as a daemon in the background without the user noticing it. An example +for such a daemon is kio_uiserver, which implements user interaction +such as progress dialog for the KIO library. The advantage of such a centralized +daemon in this context is that e.g. the download progress for several different +files can be shown in one window, even if those downloads were initiated from +different applications. + + + +A DCOP service is defined differently from a shared library service. Of course, +it doesn't specify a library, but instead an executable. Also, DCOP services +do not specify a ServiceType line, because usually they are started by their +name. As additional properties, it contains two lines: + + + +X-DCOP-ServiceType specifies the way the service is +started. The value Unique says that the service must not be +started more than once. This means, if you try to start this service (e.g. via + +KApplication::startServiceByName(), KDE looks whether it is already +registered with DCOP and uses the running service. If it is not registered yet, +KDE will start it up and wait until is registered. Thus, you can immediately +send DCOP calls to the service. In such a case, the service should be implemented +as a +KUniqueApplication. + + + +The value Multi for X-DCOP-ServiceType says that multiple +instances of the service can coexist, so every attempt to start the service +will create another process. As a last possibility the value None +can be used. In this case, a start of the service will not wait until it +is registered with DCOP. + + + +X-KDE-StartupNotify should normally be set to false. Otherwise, when +the program is started, the task bar will show a startup notification, or, depending +on the user's settings, the cursor will be changed. + + + +Here is the definition of kio_uiserver: + + + +[Desktop Entry] +Type=Service +Name=kio_uiserver +Exec=kio_uiserver +X-DCOP-ServiceType=Unique +X-KDE-StartupNotify=false + + + + + + +Using DCOP services + + +A DCOP service is started with one of several methods in the KApplication +class: + + + +DCOPClient *client = kapp->dcopClient(); +client->attach(); +if (!client->isApplicationRegistered("kio_uiserver")) { + QString error; + if (KApplication::startServiceByName("kio_uiserver", QStringList(), &error)) + cout << "Starting kioserver failed with message " << error << endl; +} +... +QByteArray data, replyData; +QCString replyType; +QDataStream arg(data, IO_WriteOnly); +arg << true; +if (!client->call("kio_uiserver", "UIServer", "setListMode(bool)", + data, replyType, replyData)) + cout << "Call to kio_uiserver failed" << endl; +... + + + +Note that the example of a DCOP call given here uses explicit marshalling +of arguments. Often you will want to use a stub generated by dcopidl2cpp +instead, because it is much simpler and less error prone. + + + +In the example given here, the service was started "by name", i.e. the +first argument to KApplication::startServiceByName() is +the name is appearing in the Name line of the desktop +file. An alternative is to use +KApplication::startServiceByDesktopName(), which takes +the file name of its desktop file as argument, i.e. in this case +"kio_uiserver.desktop". + + + +All these calls take a list of URLs as a second argument, which is given +to the service on the command line. The third argument is a pointer to a +QString. If starting the service fails, this argument +is set to a translated error message. + + + + + + + + +MIME types + + +What are MIME types? + + +MIME types are used to describe the content type of files or data +chunks. Originally they were introduced in order to allow sending around image +or sound files etc. by e-mail (MIME stands for "Multipurpose Internet Mail +Extensions"). Later this system was also used by web browsers to determine how +to present data sent by a web server to the user. For example, an HTML page +has a MIME type "text/html", a postscript file "application/postscript". In +KDE, this concept is used at a variety of places: + + + + + +In Konqueror's icon view, files are represented by +icons. Each MIME type has a certain associated icon shown here. + + + +When you click onto a file icon or a file name in +Konqueror, either the file is shown in an embedded +view, or an application associated with the file type is opened. + + + +When you drag and drop some data from one application to another (or +within the same application), the drop target may choose to accept only +certain data types. Furthermore, it will handle image data different +from textual data. + + + +Clipboard data has a MIME type. Traditionally, X programs only handle +pixmaps or texts, but with Qt, there are no restrictions on the data type. + + + + + +From the above examples, it is clear that MIME handling is a complex issue. +First, it is necessary to establish a mapping from file names to MIME types. +KDE goes one step further in allowing even file contents to be mapped to +MIME types, for cases in which the file name is not available. Second, it +is necessary to map MIME types to applications or libraries which can view +or edit a file with a certain type, or create a thumbnail picture for it. + + + +There is a variety of APIs to figure out the MIME type of data or files. In +general, there is a certain speed/reliability trade-off you have to make. You +can find out the type of a file by examining only its file name (i.e. in most +cases the file name extension). For example, a file +foo.jpg is normally "image/jpeg". In cases where the +extension is stripped off this is not safe, and you actually have to look at +the contents of the file. This is of course slower, in particular for files +that have to be downloaded via HTTP first. The content-based method is based +on the file KDEDIR/share/mimelnk/magic and therefore +difficult to extend. But in general, MIME type information can easily be made +available to the system by installing a .desktop file, and +it is efficiently and conveniently available through the KDE libraries. + + + + + + +Defining MIME types + + +Let us define a type "application/x-foo" for our new +foobar program. To this end, you have to write a +file foo.desktop and install it into +KDEDIR/share/mimelnk/application. (This is the usual +location, which may differ between distributions). This can be done by adding +this to the Makefile.am: + + + +mimedir = $(kde_mimedir)/application +mime_DATA = foo.desktop +EXTRA_DIST = $(mime_DATA) + + + +The file foo.desktop should look as follows: + + + +[Desktop Entry] +Type=MimeType +MimeType=application/x-foo +Icon=fooicon +Patterns=*.foo; +DefaultApp=foobar +Comment=Foo Data File +Comment[de]=Foo Datei + + + +The "Comment" entry is supposed to be translated. Since the +.desktop file specifies an icon, you should also install +an icon fooicon.png, which represents the file e.g. in +Konqueror. + + + +In the KDE libraries, such a type definition is mapped to an instance of the +class KMimeType. +Use this like in the following example: + + + +KMimeType::Ptr type = KMimeType::mimeType("application/x-foo"); +cout << "Type: " << type->name() < endl; +cout << "Icon: " << type->icon() < endl; +cout << "Comment: " << type->icon() < endl; +QStringList patterns = type->patterns(); +QStringList::ConstIterator it; +for (it = patterns.begin(); it != patterns.end(); ++it) + cout << "Pattern: " << (*it) << endl; + + + + + + +Determining the MIME type of data + + +The fast method for determining the type of a file is +KMimeType::findByURL(). This looks for the URL string and +in most cases determines the type from the extension. For certain protocols +(e.g. http, man, info), this mechanism is not used. For example, CGI scripts +on web servers written in Perl often have the extension +.pl, which would indicate a +"text/x-perl" type. However, we file delivered by the +server is the output of this script, which is normally HTML. For such a case, +KMimeType::findByURL() returns the MIME type +"application/octet-stream" (available through +KMimeType::defaultMimeType()), which indicates a failure +to find out the type. + + + +KMimeType::Ptr type = KMimeType::findByURL("/home/bernd/foobar.jpg"); +if (type->name() == KMimeType::defaultMimeType()) + cout << "Could not find out type" << endl; +else + cout << "Type: " << type->name() << endl; + + + +(this method has some more arguments, but these are undocumented, so simply +forget about them.) + + + +You may want to find out a MIME from the contents of file instead of +the file name. This is more reliable, but also slower, as it requires +reading a part of the file. This is done with the +KMimeMagic +class, which has different error handling: + + + +KMimeMagicResult *result = KMimeMagic::self()->findFileType("/home/bernd/foobar.jpg"); +if (!result || !result->isValid()) + cout << "Could not find out type" << endl; +else + cout << "Type: " << result->mimeType() << endl; + + + +As a variant of this function, you can also determine the type of a memory +chunk. This is e.g. used in Kate in order to find +out the highlighting mode: + + + +QByteArray array; +... +KMimeMagicResult *result = KMimeMagic::self()->findBufferType(array); +if (!result || !result->isValid()) + cout << "Could not find out type" << endl; +else + cout << "Type: " << result->mimeType() << endl; + + + +Of course, even KMimeMagic is only able to determine a file type from the +contents of a local file. For remote files, there is a further possibility: + + + +KURL url("http://developer.kde.org/favicon.ico"); +QString type = KIO::NetAccess::mimetype(url); +if (type == KMimeType::defaultMimeType()) + cout << "Could not find out type" << endl; +else + cout << "Type: " << type << endl; + + + +This starts a KIO job to download a part of the file and check this. +Note that this function is perhaps quite slow and blocks the program. Normally +you will only want to use this if KMimeType::findByURL() +has returned "application/octet-stream". + + + +On the other hand, if you do not want to block your application, you can also +explicitly start the KIO job and connect to some of its signals: + + + +void FooClass::findType() +{ + KURL url("http://developer.kde.org/favicon.ico"); + KIO::MimetypeJob *job = KIO::mimetype(url); + connect( job, SIGNAL(result(KIO::Job*)), + this, SLOT(mimeResult(KIO::Job*)) ); +} + +void FooClass::mimeResult(KIO::Job *job) +{ + if (job->error()) + job->showErrorDialog(); + else + cout << "MIME type: " << ((KIO::MimetypeJob *)job)->mimetype() << endl; +} + + + + + + +Mapping a MIME type to an application or service + + +When an application is installed, it installs a .desktop +file which contains a list of MIME types this application can load. Similarly, +components like KParts make this information available by their service +.desktop files. So in general, there are several programs +and components which can process a given MIME type. You can obtain such a list +from the class KServiceTypeProfile: + + + +KService::OfferList offers = KServiceTypeProfile::offers("text/html", "Application"); +KService::OfferList::ConstIterator it; +for (it = offers.begin(); it != offers.end(); ++it) { + KService::Ptr service = (*it); + cout << "Name: " << service->name() << endl; +} + + + +The return value of this function is a list of service offers. A +KServiceOffer object packages a KService::Ptr together +with a preference number. The list returned by +KServiceTypeProfile::offers() is ordered by the user's +preference. The user can change this by calling "keditfiletype +text/html" or choosing Edit File Type on +Konqueror's context menu on a HTML file. + + + +In the above example, an offer list of the applications supporting +text/html was requested. This will - among others - contain +HTML editors like Quanta Plus. You can also replace +the second argument "Application" by +"KParts::ReadOnlyPart". In that case, you get a list of +embedable components for presenting HTML content, for example KHTML. + + + +In most cases, you are not interested in the list of all service offers +for a combination of MIME type and service type. There is a convenience +function which gives you only the service offer with the highest preference: + + + +KService::Ptr offer = KServiceTypeProfile::preferredService("text/html", "Application"); +if (offer) + cout << "Name: " << service->name() << endl; +else + cout << "No appropriate service found" << endl; + + + +For even more complex queries, there is a full-blown CORBA-like +trader. + + + +In order to run an application service with some URLs, use +KRun: + + + +KURL::List urlList; +urlList << "http://www.ietf.org/rfc/rfc1341.txt?number=1341"; +urlList << "http://www.ietf.org/rfc/rfc2046.txt?number=2046"; +KRun::run(offer.service(), urlList); + + + + + + +Miscellaneous + + +In this section, we want to list some APIs which are loosely related +to the previous discussion. + + + +Getting an icon for a URL. This looks for the type of the URL +and returns the associated icon. + + + +KURL url("ftp://ftp.kde.org/pub/incoming/wibble.c"); +QString icon = KMimeType::iconForURL(url); + + + +Running a URL. This looks for the type of the URL and starts the +user's preferred program associated with this type. + + + +KURL url("http://dot.kde.org"); +new KRun(url); + + + + + + + + +Network transparency + + +Introduction + + +In the age of the world wide web, it is of essential importance that desktop +applications can access resources over the internet: they should be able to +download files from a web server, write files to an ftp server or read mails +from a web server. Often, the ability to access files regardless of their +location is called network transparency. + + + +In the past, different approaches to this goals were implemented. The old NFS +file system is an attempt to implement network transparency on the level of +the POSIX API. While this approach works quite well in local, closely coupled +networks, it does not scale for resources to which access is unreliable and +possibly slow. Here, asynchronicity is important. While +you are waiting for your web browser to download a page, the user interface +should not block. Also, the page rendering should not begin when the page is +completely available, but should updated regularly as data comes in. + + + +In the KDE libraries, network transparency is implemented in the KIO API. The +central concept of this architecture is an IO job. A job +may copy, or delete files or similar things. Once a job is started, it works +in the background and does not block the application. Any communication from +the job back to the application - like delivering data or progress information +- is done integrated with the Qt event loop. + + + +Background operation is achieved by starting ioslaves to +perform certain tasks. ioslaves are started as separate processes and are +communicated with through UNIX domain sockets. In this way, no multi-threading +is necessary and unstable slaves can not crash the application that uses them. + + + +File locations are expressed by the widely used URLs. But in KDE, URLs do not +only expand the range of addressable files beyond the local file system. It +also goes in the opposite direction - e.g. you can browse into tar archives. +This is achieved by nesting URLs. For example, a file in a tar archive on +a http server could have the URL + + + +http://www-com.physik.hu-berlin.de/~bernd/article.tgz#tar:/paper.tex + + + + + + +Using KIO + + +In most cases, jobs are created by calling functions in the KIO namespace. +These functions take one or two URLs as arguments, and possible other +necessary parameters. When the job is finished, it emits the signal +result(KIO::Job*). After this signal has been emitted, the job +deletes itself. Thus, a typical use case will look like this: + + + +void FooClass::makeDirectory() +{ + SimpleJob *job = KIO::mkdir(KURL("file:/home/bernd/kiodir")); + connect( job, SIGNAL(result(KIO::Job*)), + this, SLOT(mkdirResult(KIO::Job*)) ); +} + +void FooClass::mkdirResult(KIO::Job *job) +{ + if (job->error()) + job->showErrorDialog(); + else + cout << "mkdir went fine" << endl; +} + + + +Depending on the type of the job, you may connect also to other +signals. + + + +Here is an overview over the possible functions: + + + + +KIO::mkdir(const KURL &url, int permission) + +Creates a directory, optionally with certain permissions. + + + +KIO::rmdir(const KURL &url) + +Removes a directory. + + + +KIO::chmod(const KURL &url, int permissions) + +Changes the permissions of a file. + + + +KIO::rename(const KURL &src, const KURL &dest, + bool overwrite) + +Renames a file. + + + +KIO::symlink(const QString &target, const KURL &dest, + bool overwrite, bool showProgressInfo) + +Creates a symbolic link. + + + +KIO::stat(const KURL &url, bool showProgressInfo) + +Finds out certain information about the file, such as size, modification +time and permissions. The information can be obtained from +KIO::StatJob::statResult() after the job has finished. + + + +KIO::get(const KURL &url, bool reload, bool showProgressInfo) + +Transfers data from a URL. + + + +KIO::put(const KURL &url, int permissions, bool overwrite, + bool resume, bool showProgressInfo) + +Transfers data to a URL. + + + +KIO::http_post(const KURL &url, const QByteArray &data, + bool showProgressInfo) +Posts data. Special for HTTP. + + + +KIO::mimetype(const KURL &url, bool showProgressInfo) + +Tries to find the MIME type of the URL. The type can be obtained from +KIO::MimetypeJob::mimetype() after the job has finished. + + + +KIO::file_copy(const KURL &src, const KURL &dest, int permissions, + bool overwrite, bool resume, bool showProgressInfo) + +Copies a single file. + + + +KIO::file_move(const KURL &src, const KURL &dest, int permissions, + bool overwrite, bool resume, bool showProgressInfo) + +Renames or moves a single file. + + + +KIO::file_delete(const KURL &url, bool showProgressInfo) + +Deletes a single file. + + + +KIO::listDir(const KURL &url, bool showProgressInfo) + +Lists the contents of a directory. Each time some new entries are known, the +signal KIO::ListJob::entries() is emitted. + + + +KIO::listRecursive(const KURL &url, bool showProgressInfo) + +Similar to the listDir() function, but this one is recursive. + + + +KIO::copy(const KURL &src, const KURL &dest, bool showProgressInfo) + +Copies a file or directory. Directories are copied recursively. + + + +KIO::move(const KURL &src, const KURL &dest, bool showProgressInfo) + +Moves or renames a file or directory. + + + +KIO::del(const KURL &src, bool shred, bool showProgressInfo) + +Deletes a file or directory. + + + + + + + + + +Directory entries + + +Both the KIO::stat() and KIO::listDir() jobs return their results as a type +UDSEntry, UDSEntryList resp. The latter is defined as QValueList<UDSEntry>. +The acronym UDS stands for "Universal directory service". The principle behind +it is that the a directory entry only carries the information which an ioslave +can provide, not more. For example, the http slave does not provide any +information about access permissions or file owners. +Instead, a UDSEntry is a list of UDSAtoms. Each atom provides a specific piece +of information. It consists of a type stored in m_uds and either an integer +value in m_long or a string value in m_str, depending on the type. + + + +The following types are currently defined: + + + + + +UDS_SIZE (integer) - Size of the file. + + + +UDS_USER (string) - User owning the file. + + + +UDS_GROUP (string) - Group owning the file. + + + +UDS_NAME (string) - File name. + + + +UDS_ACCESS (integer) - Permission rights of the file, as e.g. stored +by the libc function stat() in the st_mode field. + + + +UDS_FILE_TYPE (integer) - The file type, as e.g. stored by stat() in the +st_mode field. Therefore you can use the usual libc macros like S_ISDIR to +test this value. Note that the data provided by ioslaves corresponds to +stat(), not lstat(), i.e. in case of symbolic links, the file type here is +the type of the file pointed to by the link, not the link itself. + + + +UDS_LINK_DEST (string) - In case of a symbolic link, the name of the file +pointed to. + + + +UDS_MODIFICATION_TIME (integer) - The time (as in the type time_t) when the +file was last modified, as e.g. stored by stat() in the st_mtime field. + + + +UDS_ACCESS_TIME (integer) - The time when the file was last accessed, as +e.g. stored by stat() in the st_atime field. + + + +UDS_CREATION_TIME (integer) - The time when the file was created, as e.g. +stored by stat() in the st_ctime field. + + + +UDS_URL (string) - Provides a URL of a file, if it is not simply the +the concatenation of directory URL and file name. + + + +UDS_MIME_TYPE (string) - MIME type of the file + + + +UDS_GUESSED_MIME_TYPE (string) - MIME type of the file as guessed by the +slave. The difference to the previous type is that the one provided here +should not be taken as reliable (because determining it in a reliable way +would be too expensive). For example, the KRun class explicitly checks the +MIME type if it does not have reliable information. + + + + + +Although the way of storing information about files in a +UDSEntry is flexible and practical from the ioslave +point of view, it is a mess to use for the application programmer. For +example, in order to find out the MIME type of the file, you have to iterate +over all atoms and test whether m_uds is +UDS_MIME_TYPE. Fortunately, there is an API which is a lot +easier to use: the class KFileItem. + + + + + + +Synchronous usage + + +Often, the asynchronous API of KIO is too complex to use and therefore +implementing full asynchronicity is not a priority. For example, in a program +that can only handle one document file at a time, there is little that can be +done while the program is downloading a file anyway. For these simple cases, +there is a mucher simpler API in the form of a set of static functions in +KIO::NetAccess. For example, in order to copy a file, use + + + +KURL source, target; +source = ...; +target = ... +KIO::NetAccess::copy(source, target); + + + +The function will return after the complete copying process has finished. Still, +this method provides a progress dialog, and it makes sure that the application +processes repaint events. + + + +A particularly interesting combination of functions is +download() in combination with +removeTempFile(). The former downloads a file from given +URL and stores it in a temporary file with a unique name. The name is stored +in the second argument. If the URL is local, the file is +not downloaded, and instead the second argument is set to the local file +name. The function removeTempFile() deletes the file +given by its argument if the file is the result of a former download. If that +is not the case, it does nothing. Thus, a very easy to use way of loading +files regardless of their location is the following code snippet: + + + +KURL url; +url = ...; +QString tempFile; +if (KIO::NetAccess::download(url, tempFile) { + // load the file with the name tempFile + KIO::NetAccess::removeTempFile(tempFile); +} + + + + + + +Meta data + + +As can be seen above, the interface to IO jobs is quite abstract and does not +consider any exchange of information between application and IO slave that +is protocol specific. This is not always appropriate. For example, you may give +certain parameters to the HTTP slave to control its caching behavior or +send a bunch of cookies with the request. For this need, the concept of meta +data has been introduced. When a job is created, you can configure it by adding +meta data to it. Each item of meta data consists of a key/value pair. For +example, in order to prevent the HTTP slave from loading a web page from its +cache, you can use: + + + +void FooClass::reloadPage() +{ + KURL url("http://www.kdevelop.org/index.html"); + KIO::TransferJob *job = KIO::get(url, true, false); + job->addMetaData("cache", "reload"); + ... +} + + + +The same technique is used in the other direction, i.e. for communication from +the slave to the application. The method +Job::queryMetaData() asks for the value of the certain +key delivered by the slave. For the HTTP slave, one such example is the key +"modified", which contains a (stringified representation of) +the date when the web page was last modified. An example how you can use this +is the following: + + + +void FooClass::printModifiedDate() +{ + KURL url("http://developer.kde.org/documentation/kde2arch/index.html"); + KIO::TransferJob *job = KIO::get(url, true, false); + connect( job, SIGNAL(result(KIO::Job*)), + this, SLOT(transferResult(KIO::Job*)) ); +} + +void FooClass::transferResult(KIO::Job *job) +{ + QString mimetype; + if (job->error()) + job->showErrorDialog(); + else { + KIO::TransferJob *transferJob = (KIO::TransferJob*) job; + QString modified = transferJob->queryMetaData("modified"); + cout << "Last modified: " << modified << endl; +} + + + + + + +Scheduling + + +When using the KIO API, you usually do not have to cope with the details of +starting IO slaves and communicating with them. The normal use case is to +start a job and with some parameters and handle the signals the jobs emits. + + + +Behind the curtains, the scenario is a lot more complicated. When you create a +job, it is put in a queue. When the application goes back to the event loop, +KIO allocates slave processes for the jobs in the queue. For the first jobs +started, this is trivial: an IO slave for the appropriate protocol is started. +However, after the job (like a download from an http server) has finished, it +is not immediately killed. Instead, it is put in a pool of idle slaves and +killed after a certain time of inactivity (current 3 minutes). If a new request +for the same protocol and host arrives, the slave is reused. The obvious +advantage is that for a series of jobs for the same host, the cost for creating +new processes and possibly going through an authentication handshake is saved. + + + +Of course, reusing is only possible when the existing slave has already finished +its previous job. when a new request arrives while an existing slave process is +still running, a new process must be started and used. In the API usage in the +examples above, there are no limitation for creating new slave processes: if you +start a consecutive series of downloads for 20 different files, then KIO will +start 20 slave processes. This scheme of assigning slaves to jobs is called +direct. It not always the most appropriate scheme, as it +may need much memory and put a high load on both the client and server machines. + + + +So there is a different way. You can schedule jobs. If +you do this, only a limited number (currently 3) of slave processes for a +protocol will be created. If you create more jobs than that, they are put in a +queue and are processed when a slave process becomes idle. This is done as +follows: + + + +KURL url("http://developer.kde.org/documentation/kde2arch/index.html"); +KIO::TransferJob *job = KIO::get(url, true, false); +KIO::Scheduler::scheduleJob(job); + + + +A third possibility is connection oriented. For example, +for the IMAP slave, it does not make any sense to start multiple processes for +the same server. Only one IMAP connection at a time should be enforced. In +this case, the application must explicitly deal with the notion of a slave. It +has to deallocate a slave for a certain connection and then assign all jobs +which should go through the same connection to the same slave. This can again +be easily achieved by using the KIO::Scheduler: + + + +KURL baseUrl("imap://bernd@albert.physik.hu-berlin.de"); +KIO::Slave *slave = KIO::Scheduler::getConnectedSlave(baseUrl); + +KIO::TransferJob *job1 = KIO::get(KURL(baseUrl, "/INBOX;UID=79374")); +KIO::Scheduler::assignJobToSlave(slave, job1); + +KIO::TransferJob *job2 = KIO::get(KURL(baseUrl, "/INBOX;UID=86793")); +KIO::Scheduler::assignJobToSlave(slave, job2); + +... + +KIO::Scheduler::disconnectSlave(slave); + + + +You may only disconnect the slave after all jobs assigned to it are guaranteed +to be finished. + + + + + + +Defining an ioslave + + +In the following we discuss how you can add a new ioslave to the system. +In analogy to services, new ioslaves are advertised to the system by +installing a little configuration file. The following Makefile.am +snippet installs the ftp protocol: + + + +protocoldir = $(kde_servicesdir) +protocol_DATA = ftp.protocol +EXTRA_DIST = $(mime_DATA) + + + +The contents of the file ftp.protocol is as follows: + + + +[Protocol] +exec=kio_ftp +protocol=ftp +input=none +output=filesystem +listing=Name,Type,Size,Date,Access,Owner,Group,Link, +reading=true +writing=true +makedir=true +deleting=true +Icon=ftp + + + +The "protocol" entry defines for which protocol this slave +is responsible. "exec" is (in contrast what you would +expect naively) the name of the library that implements the slave. When the +slave is supposed to start, the "kdeinit" executable is +started which in turn loads this library into its address space. So in +practice, you can think of the running slave as a separate process although it +is implemented as library. The advantage of this mechanism is that it saves a +lot of memory and reduces the time needed by the runtime linker. + + + +The "input" and "output" lines are not used currently. + + + +The remaining lines in the .protocol file define which +abilities the slave has. In general, the features a slave must implement are +much simpler than the features the KIO API provides for the application. The +reason for this is that complex jobs are scheduled to a couple of subjobs. For +example, in order to list a directory recursively, one job will be started for +the toplevel directory. Then for each subdirectory reported back, new subjobs +are started. A scheduler in KIO makes sure that not too many jobs are active +at the same time. Similarly, in order to copy a file within a protocol that +does not support copying directly (like the ftp: protocol), +KIO can read the source file and then write the data to the destination +file. For this to work, the .protocol must advertise the +actions its slave supports. + + + +Since slaves are loaded as shared libraries, but constitute standalone programs, +their code framework looks a bit different from normal shared library plugins. +The function which is called to start the slave is called +kdemain(). This function does some initializations and +then goes into an event loop and waits for requests by the application using +it. This looks as follows: + + + +extern "C" { int kdemain(int argc, char **argv); } + +int kdemain(int argc, char **argv) +{ + KLocale::setMainCatalogue("kdelibs"); + KInstance instance("kio_ftp"); + (void) KGlobal::locale(); + + if (argc != 4) { + fprintf(stderr, "Usage: kio_ftp protocol " + "domain-socket1 domain-socket2\n"); + exit(-1); + } + + FtpSlave slave(argv[2], argv[3]); + slave.dispatchLoop(); + return 0; +} + + + + + + +Implementing an ioslave + + +Slaves are implemented as subclasses of KIO::SlaveBase +(FtpSlave in the above example). Thus, the actions listed in the +.protocol correspond to certain virtual functions in +KIO::SlaveBase the slave implementation must +reimplement. Here is a list of possible actions and the corresponding virtual +functions: + + + + +reading - Reads data from a URL +void get(const KURL &url) + +writing - Writes data to a URL and create the file if it does not exist yet. +void put(const KURL &url, int permissions, bool overwrite, bool resume) + +moving - Renames a file. +void rename(const KURL &src, const KURL &dest, bool overwrite) + +deleting - Deletes a file or directory. +void del(const KURL &url, bool isFile) + +listing - Lists the contents of a directory. +void listDir(const KURL &url) + +makedir - Creates a directory. +void mkdir(const KURL &url, int permissions) + + + + +Additionally, there are reimplementable functions not listed in the .protocol +file. For these operations, KIO automatically determines whether they are supported +or not (i.e. the default implementation returns an error). + + + + +Delivers information about a file, similar to the C function stat(). +void stat(const KURL &url) + +Changes the access permissions of a file. +void chmod(const KURL &url, int permissions) + +Determines the MIME type of a file. +void mimetype(const KURL &url) + +Copies a file. +copy(const KURL &url, const KURL &dest, int permissions, bool overwrite) + +Creates a symbolic link. +void symlink(const QString &target, const KURL &dest, bool overwrite) + + + + +All these implementation should end with one of two calls: If the operation +was successful, they should call finished(). If an error has occurred, +error() should be called with an error code as first argument and a +string in the second. Possible error codes are listed as enum +KIO::Error. The second argument is usually the URL in +question. It is used e.g. in KIO::Job::showErrorDialog() +in order to parameterize the human-readable error message. + + + +For slaves that correspond to network protocols, it might be interesting to +reimplement the method SlaveBase::setHost(). This is +called to tell the slave process about the host and port, and the user name +and password to log in. In general, meta data set by the application can be +queried by SlaveBase::metaData(). You can check for the +existence of meta data of a certain key with +SlaveBase::hasMetaData(). + + + + + + +Communicating back to the application + + +Various actions implemented in a slave need some way to communicate data back +to the application using the slave process: + + + + + +get() sends blocks of data. This is done with +data(), which takes a QByteArray +as argument. Of course, you do not need to send all data at once. If you send +a large file, call data() with smaller data blocks, so +the application can process them. Call finished() when +the transfer is finished. + + + +listDir() reports information about the entries of a +directory. For this purpose, call listEntries() with a +KIO::UDSEntryList as argument. Analogously to +data(), you can call this several times. When you are +finished, call listEntry() with the second argument set +to true. You may also call totalSize() to report the +total number of directory entries, if known. + + + +stat() reports information about a file like size, MIME +type, etc. Such information is packaged in a +KIO::UDSEntry, which will be discussed below. Use +statEntry() to send such an item to the application. + + + +mimetype() calls mimeType() with a +string argument. + + + +get() and copy() may want to provide +progress information. This is done with the methods +totalSize(), processedSize(), +speed(). The total size and processed size are reported +as bytes, the speed as bytes per second. + + + +You can send arbitrary key/value pairs of meta data with +setMetaData(). + + + + + + + + +Interacting with the user + + +Sometimes a slave has to interact with the user. Examples include informational +messages, authentication dialogs and confirmation dialogs when a file is about +to be overwritten. + + + + + +infoMessage() - This is for informational feedback, such +as the message "Retrieving data from <host>" from the http slave, which +is often displayed in the status bar of the program. On the application side, +this method corresponds to the signal +KIO::Job::infoMessage(). + + + +warning() - Displays a warning in a message box with +KMessageBox::information(). If a message box is still +open from a former call of warning() from the same slave process, nothing +happens. + + + +messageBox() - This is richer than the previous +method. It allows to open a message box with text and caption and some +buttons. See the enum SlaveBase::MessageBoxType for reference. + + + +openPassDlg() - Opens a dialog for the input of user name +and password. + + + + + + + + + + + + + +Licensing + +&underFDL; +&underGPL; + + + +
diff --git a/doc/kdearch/joinbevel.png b/doc/kdearch/joinbevel.png new file mode 100644 index 00000000..584b6bd4 Binary files /dev/null and b/doc/kdearch/joinbevel.png differ diff --git a/doc/kdearch/joinmiter.png b/doc/kdearch/joinmiter.png new file mode 100644 index 00000000..e5d94b13 Binary files /dev/null and b/doc/kdearch/joinmiter.png differ diff --git a/doc/kdearch/joinround.png b/doc/kdearch/joinround.png new file mode 100644 index 00000000..9a8bbe93 Binary files /dev/null and b/doc/kdearch/joinround.png differ diff --git a/doc/kdearch/konqi-mirrored.png b/doc/kdearch/konqi-mirrored.png new file mode 100644 index 00000000..5145c0ee Binary files /dev/null and b/doc/kdearch/konqi-mirrored.png differ diff --git a/doc/kdearch/konqi-normal.png b/doc/kdearch/konqi-normal.png new file mode 100644 index 00000000..c16e1475 Binary files /dev/null and b/doc/kdearch/konqi-normal.png differ diff --git a/doc/kdearch/konqi-rotated.png b/doc/kdearch/konqi-rotated.png new file mode 100644 index 00000000..157e82dd Binary files /dev/null and b/doc/kdearch/konqi-rotated.png differ diff --git a/doc/kdearch/konqi-sheared.png b/doc/kdearch/konqi-sheared.png new file mode 100644 index 00000000..ee645f87 Binary files /dev/null and b/doc/kdearch/konqi-sheared.png differ diff --git a/doc/kdearch/kview-menu.png b/doc/kdearch/kview-menu.png new file mode 100644 index 00000000..0e57e721 Binary files /dev/null and b/doc/kdearch/kview-menu.png differ diff --git a/doc/kdearch/opengl.png b/doc/kdearch/opengl.png new file mode 100644 index 00000000..2489777d Binary files /dev/null and b/doc/kdearch/opengl.png differ diff --git a/doc/kdearch/penstyles.png b/doc/kdearch/penstyles.png new file mode 100644 index 00000000..7e976bcd Binary files /dev/null and b/doc/kdearch/penstyles.png differ diff --git a/doc/kdearch/whatsthis.png b/doc/kdearch/whatsthis.png new file mode 100644 index 00000000..4bdba093 Binary files /dev/null and b/doc/kdearch/whatsthis.png differ diff --git a/doc/kdevelop/Makefile.am b/doc/kdevelop/Makefile.am new file mode 100644 index 00000000..41691557 --- /dev/null +++ b/doc/kdevelop/Makefile.am @@ -0,0 +1,3 @@ +KDE_LANG = en +KDE_DOCS = AUTO + diff --git a/doc/kdevelop/SF-general.png b/doc/kdevelop/SF-general.png new file mode 100644 index 00000000..0824c835 Binary files /dev/null and b/doc/kdevelop/SF-general.png differ diff --git a/doc/kdevelop/SF-indent.png b/doc/kdevelop/SF-indent.png new file mode 100644 index 00000000..d84cd469 Binary files /dev/null and b/doc/kdevelop/SF-indent.png differ diff --git a/doc/kdevelop/SF-other.png b/doc/kdevelop/SF-other.png new file mode 100644 index 00000000..750f112b Binary files /dev/null and b/doc/kdevelop/SF-other.png differ diff --git a/doc/kdevelop/adv-build-management.docbook b/doc/kdevelop/adv-build-management.docbook new file mode 100644 index 00000000..e589a007 --- /dev/null +++ b/doc/kdevelop/adv-build-management.docbook @@ -0,0 +1,128 @@ + +Advanced Build Management +&automake; + + +Multiple Build Configurations +build configurationsmultiple + + +(... to be written ...) + + + + + + + +Cross-Compiling +cross compiling +compilingcross + + + +When you have suitable cross compilers available, you can cross compile your +programs for processors and operating systems different from the system where +&kdevelop; and the compiler is running. The &GNU; compiler collection &gcc; can +be configured and compiled as a cross compiler if you compile it yourself. +Consult the GCC info pages for +more information. Some &Linux; distributions also provide binary packages. + + + +An automake based package can easily be +cross-compiled by specifying the option to the +configure script and setting the CC and CXX +environment variables to the respective cross compiler binaries. Often you +want to switch between a the cross-compiled version of your application and +one compiled for your development system. For this, it is advantageous to +use &kdevelop; capability of creating multiple build configurations, as +explained in . Once you have created a +new build configuration for cross-compiling in the +ProjectProject +Options... dialog, add the option + + +platform + + +to the configure options. The platform name +is a tuple of the form + + +cpu-vendor-os +or +cpu-vendor-kernel-os + + +For many combinations, you can use a short form, for instance +i386-linux or arm-elf. + + + + + + + +Qt/Embedded +embeddedQt +Qt/Embedded +Qtopia +framebuffer + + +&qte; is a version of the &Qt; library that does not use the X window +system, but draws directly to the framebuffer on &Linux; systems. It is +therefore interesting for embedded systems which have tight restrictions +on the memory usage of the whole system. Its &API; is fully compatible with +the one of the X11 version. + + + +Developing an application for &qte; with &kdevelop; is not very different +from developing a program for the X11 version of &Qt;. In fact, you can use the +same codebase for both versions. If you use the autoproject project +management, you switch to the embedded version by passing the argument + to the configure script. You can set +this in the Project +Project Options... dialog under +Configure Options. With the option + you set the directory in which &qte; +is installed. + + + +After configuring and compiling your application with these options, it will +link with the libqpe.so library. This version of your +application will not normally run when you use X11. In order to test it, +run it under the control of the program qvfb +(&Qt; Virtual Frame Buffer). This is done by starting +qvfb and then starting your application with + + +app + + +Naturally, when you have a working version of your application, you +will want to use it on the target processor. For this, it will probably +be convenient to create multiple build configurations, as explained above, +so that you can quickly switch between the version running on your development +system and the version running on the target system. + + + +Applications for &qte; normally run as single applications on the +device they are designed for. Trolltech also supports Qtopia, which is a +collection of applications for PIM, web browsing and various other areas that +work together in a consistent manner. It is the standard environment for +instance on the Sharp Zaurus. You can write applications that integrate into +this environment by using the Qtopia SDK. This implies making your application +class a subclass of QPEApplication and linking to the +library libqpe.so. If you develop your application with +the autoproject project management, you have to add + to the configure options. + + + + + diff --git a/doc/kdevelop/app-changelog.docbook b/doc/kdevelop/app-changelog.docbook new file mode 100644 index 00000000..50e8f4ee --- /dev/null +++ b/doc/kdevelop/app-changelog.docbook @@ -0,0 +1,69 @@ + +Changes + +Changes to This Document + + + + 2003-01-03 Bernd Gehrmann, Caleb Tennis + + + initial manual layout + + + many chapter contents sketched + + + + + + + + 2004-08-01 Bernd Pol, Ian Wadham + + + manual slightly reorganized + + + some missing chapters written + + + + + + + 2005-05-02 Volker Paul — Many changes, including: + + + split into one file per chapter/appendix + + + added command reference sorted by menu (descriptions not yet complete) + + + AppWizard tutorial in getting-started.docbook + + + reorganized chapters, guided by Konqueror manual + + + moved installation, Unix development, In a Nutshell to the appendix + + + rewrote plugin appendix, incl. plugin list generator listplugins.sh + + + + Still far from complete, but a small step forward. + + + + 2006-05-20 Bernd Pol — Filling in some more to be written holes: + + + + + + + + diff --git a/doc/kdevelop/app-files.docbook b/doc/kdevelop/app-files.docbook new file mode 100644 index 00000000..210e1469 --- /dev/null +++ b/doc/kdevelop/app-files.docbook @@ -0,0 +1,425 @@ + + + + + + + + BerndPol + + + + +Configuration Files Used by &kdevelop; + + +&kdevelop; uses a series of configuration files which are distributed amongst several directories. There are two main groups of configuration files to distinguish: + + + + &kdevelop; Default Configuration — files set up when &kdevelop; was installed. + + + User Oriented Configuration — files which contain user modifications of the defaults as well as settings made by the &kdevelop; application itself and its plugins. + + + + +&kdevelop; Default Configuration + + +On installation, &kdevelop; writes some default information files for setup and configuration purposes into subdirectories of the $KDEDIR installation directory (usually something like /opt/kde, /usr/local/kde, or some other user-defined installation directory, see Installing &kdevelop;). + + + +Default &kdevelop; Configuration + + +There is only one &kdevelop; specific default configuration file in the $KDEDIR/share/config/ directory: + + + + kdeveloprc + + This file contains the basic settings &kdevelop; needs to start. It will be copied to the user's $KDEHOME/share/config directory when &kdevelop; does not find a kdeveloprc file there on startup. + + + + + + + +Application Specific Defaults + + +Most &kdevelop; features are provided by KParts. These are basically applications specially designed to run in the &kdevelop; framework (see the overview in the Plugin Tools appendix). Each KPart application has its own set of configuration files whose defaults will be stored in several subdirectories of the $KDEDIR/share/apps/ installation directory. + + + +There are quite a lot of default configuration subdirectories in $KDEDIR/share/apps/ whose names all start with a kdev sequence. Most of them are for &kdevelop; internal use only. They might be deliberately grouped for readability as: + + Stand-alone Applications + Task Specific Parts + Project Generation Parts + Language Specific Parts + + + + + + Stand-alone Applications + + kdevelop/ — contains files to configure the &kdevelop; &IDE;: + + licenses/ — contains various licenses texts. + pics/ — contains the picture files used for the &kdevelop;, &kdevelop; Assistant, and &kdevelop; Designer splash screens. + profiles/ — contains default plugin profile settings. (Currently there is only a tiny profile provided which defines a minimum set of active &kdevelop; plugins.) + eventsrc — holds a lot of Process successful localization strings. + kdevelopui.rc — provides the basic menu and tool bar entries &kdevelop; uses. + kdevhtml_partui.rc — provides a Print... entry in the File menu, a Copy entry in the Edit menu, and Back and Forward arrows in the Browser Toolbar in case a &HTML; file is browsed from the Documentation plugin. + + + kdevassistant/ — provides the menu and tool bars of the stand-alone &kdevelop; Assistant documentation browser. + kdevdesigner/ and kdevdesignerpart/ — provide menu bar and tool bars of the stand-alone &kdevelop; user interface designer. + + + + Task Specific Parts + + kdevabbrev/ — contains files used by the Abbreviation Expansion plugin: + + sources/ — contains keyword definition files used by the Expand Text command. + templates/ — contains template definition files used by the Expand Abbreviation command. + kdevabbrev.rc — provides the Expand Text and Expand Abbreviation entries in the Edit menu. + + + + kdevappwizard/ — contains files used by the &appwizard; part: + + importfiles/ — contains .kdevelop project files which control the initialization of a new project. + imports/ — contains templates to set up project specific .desktop files. + template-common/ — contains various files commonly included in the project source directories. + templates/ — contains configuration files which describe the information to be included in a given project source directory. + *.png — project preview images used by the &appwizard;. + *.tar.gz — tarballs containing the source files to be included in a new generated project directory. + + + kdevastyle/ — provides the Reformat Source entry in the Edit menu. + kdevautoproject/ — provides most of the entries in the Build menu and the Build Toolbar (&kdevelop;) toolbar. + + kdevclassview/ — contains files used by the Class View project plugin: + + pics/ — contains the icons used in the Classes classview tree. + kdevclassview.tc — provides the Class Inheritance Diagram entry in the Projects menu as well as the classes navigation combo box in the Browser Toolbar. + + + kdevcloser/ — provides the Windows menu close entries. + kdevctags/ — provides the CTags entry in the Tools menu for the CTags Frontend project plugin. + kdevcvsservice/ — provides the icon used by the CvsService tab and a short shell script used to add a new entry to the &cvs; repository, both used by the CVS Integration project plugin. + kdevdebugger/ — provides the Debug menu entries for the Debugger Frontend project plugin. + kdevdiff/ — provides the Difference Viewer entry in the Tools menu. + kdevdistpart/ — provides the Distribution & Publishing entry in the Project menu for the Final Packaging Support project plugin. + + kdevdocumentation/ — contains files used by the Documentation plugin: + + en/ and pics/ — contain files used by the htdig search tool. + tocs/ — contain the default &kdevelop; documentation content description files (see the description in Basic Structure of &kdevelop; TOC Files). + kdevpart_documentation.rc — provides the search related entries in the Help menu. + + + kdevdoxygen/ — provides the menu entries for the Doxygen Support project plugin. + + kdevfilecreate/ — contains files used by the New File Wizard: + + file-templates/ — provides the initial text contents to be put into the new source file of a given type. + kdevpart_filecreate.rc — provides the New entry in the File menu. + template-info.xml — contains descriptions of the available file types to be displayed in the New File tool view. + + + kdevfilter/ — provides the Execute Command... and Filter Selection Through Command... entries in the Tools menu used by the Shell Filtering and Insertion plugin. + kdevfullscreen/ — provides the Full Screen Mode entry in the View menu and the according tool bar icon. + kdevgrepview/ — provides the Find in Files...entry in the Edit menu used by the Grep Frontend plugin. + kdevhistory/ — provides the Back and Forward entries in the View menu. + kdevjavadebugger/ — provides a Java Debug menu in order to debug a &Java; application. + kdevoutputviews/ — provides the Next Error and Previous Error entries in the View menu. + kdevpartexplorer/ — provides the Part Explorer entry in the Tools menu used by the Part Explorer Tool plugin. + kdevquickopen/ — provides the Quick Open File.. entry in the File menu and the Quick Open Class... and Quick Open Method entries in the Tools menu used by the Quick Open project plugin. + kdevregexptest/ — provides the Debug Regular Expression... entry in the Tools menu used by the Regular Expression Tester plugin. + kdevreplace/ — provides the Find-Select-Replace... entry in the Edit menu used by the Replace Part plugin. + kdevtipofday/ — provides the Tip of the Day entry in the Help menu as well as a HTML-File containing the available tips. + kdevtools/ — controls various menu entries ceated by Tools Menu and External Tools Menu settings provided by the Tools Menu Addition plugin. + kdevvalgrind/ — provides the Valgrind Memory Leak Check and Profile with KCachegrind entries in the Debug menu used by the Valgrind Frontend plugin. + + + + Project Generation Parts + kdevadaproject/ — provides entries for the Build menu and according tool bar icons to build an Ada application. + kdevantproject/ — provides entries for the Build menu when the Ant project generator is used. + kdevautoproject/ — provides entries for the Build menu and according tool bar icons when working with the &GNU; Tools based &automake; project generator. Additionally provides the Add Translation and Build Configuration entries to the Project menu. + kdevcustomproject/ — provides entries for the Build menu and according tool bar icons when the project is based on custom Makefils. + kdevgenericproject/ — contains menu definitions for an experimental generic project generator. Currently (version 3.1.0) unused. + kdevhaskellproject/ — provides entries for the Build menu and according tool bar icons to build a Haskell application. + kdevpascalproject/ — provides entries for the Build menu and according tool bar icons to build a Pascal application. + kdevtrollproject/ — provides entries for the Build menu and according tool bar icons to build an application using the &Qt; QMake project manager. + + + + Language Specific Parts + kdevadasupport/ — provides entries in the Tools menu and according tool bar icons needed to develop Ada applications. + kdevbashsupport/ — provides entries in the Build menu and according tool bar icons needed to develop Bash scripts. + + kdevcppsupport/ — contains files used by the &appwizard; to build C++ applications: + + newclass/ — contains header and source templates from which the &appwizard; builds the according source files. + subclassing/ — contains templates which the &appwizard; uses to set up initial class declarations/definitions in the source files. + templates — contains templates from which the &appwizard; sets up the default header and source template files to be used by the &nfwizard;. + configuration — dummy template to add macros. + kdevcppsupport.rc — provides the Complete Text and Make Member entries fo the Edit menu, the Switch Header/Implementation entry for the View menu, and the New Class entry for the Project menu as well as a New Class icon for the Browser Toolbar. + + + kdevfortransupport/ — provides entries in the Build menu needed to develop Fortran applications. + kdevhaskellsupport/ — provides entries in the Build menu and according tool bar icons needed to develop Haskell applications. + kdevjavasupport/ — contains the UI definition needed to develop &Java; applications. + kdevpascalsupport/ — contains the UI definition needed to develop Pascal applications. + kdevperlsupport/ — provides Project and Help menu entries needed to develop Perl scripts. + kdevphpsupport/ — contains UI and PHP function definition files needed to develop PHP scripts. + kdevpythonsupport/ — provides Build and Help menu entries and according tool bar icons needed to develop Python scripts. + kdevrubysupport/ — provides Build menu entries and according tool bar icons needed to develop Ruby scripts. + kdevscriptproject/ — provides th UI definitions needed to develop custom projects. Currently (version 3.1.0) unused. + kdevsqlsupport/ — provides th UI definitions needed to develop SQL projects. Currently (version 3.1.0) unused. + + + + + + + + + + + +User Oriented Configuration + + +All information about user defined settings is kept in two subdirectories of $KDEHOME, namely: + + Application Specific Configuration in the $KDEHOME/share/apps/ directory, and + Resource Configuration File in the $KDEHOME/share/config/ directory. + + + + +Application Specific Configuration + + +Any user changes to the &kdevelop; Default Configuration settings as well as user specific settings which are not kept in any of the Resource Configuration Files are found in kdev... subdirectories of the $KDEHOME/share/apps/ directory. + + +Most of these configuration files are however used by various &kdevelop; plugins in order to provide some specific menu and/or toolbar entries. Thus they are of interest only in case something went really wrong with the user interface. + + +In case the contents of these directories mirror those of the Default Configuration settings, &kdevelop; will have copied them from $KDEDIR/apps/ into the $KDEHOME/apps/ directory on its initial start. Any subsequent changes will be made to these copies only. The Default Configuration settings remain unchanged in any case. + + + + + kdevabbrev/ — contains files used by the Abbreviation Expansion plugin: + + sources/ — currently empty; &kdevelop; uses the default keyword definition files for Expand Text commands. + templates/ — contains the user modified template definition files used by the Expand Abbreviation command. + kdevabbrev.rc — provides the Expand Text and Expand Abbreviation entries in the Edit menu. + + + + kdevappwizard/ — only provides the New Project... and Import Existing Project... entries in the Projects menu. The &appwizard; will use the default configuration settings for its actual works. + + + kdevastyle/ — provides the actual Reformat Source entry in the Edit menu. + + + kdevautoproject/ — provides the actual entries in the Build menu and the Build Toolbar (KDevelop) toolbar. + + + kdevclassview/ — provides the Class Inheritance Diagram entry in the Project menu and the class browser combo box in the Browser Toolbar by the Class View project plugin. + + + kdevcloser/ — provides the Close Selected Windows... entry in the Windows menu. + + + kdevcppsupport/ — holds the acual configuration used by the &appwizard; to build C++ applications. The &appwizard; however uses its main bulk of configuration information directly from the default configuration directory. See there for more detail. + + + newclass/ — contains the actual header and source templates from which the &appwizard; builds the according source files. + + + pcs/ — contains database files &kdevelop; uses build the actual Persistent Code Store (.pcs) file of a &kde; C++ project. + + + kdevcppsupport.rc — provides the Complete Text and Make Member entries fo the Edit menu, the Switch Header/Implementation entry for the View menu, and the New Class entry for the Project menu as well as a New Class icon for the Browser Toolbar. + + + + + kdevctags/ — provides the CTags entry in the Tools menu for the CTags Frontend project plugin. + + + kdevdebugger/ — provides the Debug menu entries for the Debugger Frontend project plugin. + + + kdevdiff/ — provides the Difference Viewer entry in the Tools menu. + + + kdevdocumentation/ — contains the actual files used by the Documentation plugin in addition to the default configuration files. See there for more detail. + The directories in kdevdocumentation/ mainly hold actual bookkeeping information. The actually set up documentation files are kept in doc...pluginrc files in the $KDEHOME/share/config/ directory. + + + bookmarks/ — maintains the entries in the Bookmarks tab of the &kdevelop; Documentation plugin. + + + index/ — holds various cache files &kdevelop; uses to speed up indexed documentation searches in the Index tab of the Documentation plugin. + + + search/ — contains files used by the htdig search tool which serves search calls from the Search tab of the Documentation plugin. + + + kdevpart_documentation.rc — provides the search related entries in the Help menu. + + + + + kdevdoxygen/ — provides the menu entries for the Doxygen Support project plugin. + + + kdevelop/ — contains some actual settings &kdevelop; uses for its basic setup: + + profiles/ — provides actual plugin profile setting. (Initially there is only a FullIDE profile which defines a full set of initially active &kdevelop; plugins.) + kdevelopui.rc — provides the basic menu and tool bar entries &kdevelop; uses. + + + + kdevfilecreate/ — contains files used by the New File Wizard: + + file-templates/ — provides the actually used text contents to be put into the new source file of a given type. More file templates are found in the default configuration files directory. + kdevpart_filecreate.rc — provides the New entry in the File menu. + template-info.xml — contains descriptions of the available file types to be displayed in the New File tool view. + + + + kdevfilter/ — provides the Execute Command... and Filter Selection Through Command... entries in the Tools menu used by the Shell Filtering and Insertion plugin. + + + kdevfullscreen/ — provides the Full Screen Mode entry in the View menu and the according tool bar icon. + + + kdevgrepview/ — provides the Find in Files...entry in the Edit menu used by the Grep Frontend plugin. + + + kdevoutputviews/ — provides the Next Error and Previous Error entries in the View menu. + + + kdevpartexplorer/ — provides the Part Explorer entry in the Tools menu used by the Part Explorer Tool plugin. + + + kdevquickopen/ — provides the Quick Open File.. entry in the File menu and the Quick Open Class... and Quick Open Method entries in the Tools menu used by the Quick Open project plugin. + + + kdevregexptest/ — provides the Debug Regular Expression... entry in the Tools menu used by the Regular Expression Tester plugin. + + + kdevreplace/ — provides the Find-Select-Replace... entry in the Edit menu used by the Replace Part plugin. + + + kdevtipofday/ —provides the Tip of the Day entry in the Help menu. The HTML-File containing the available tips is provided as a default configuration file only. + + + kdevtools/ — controls various menu entries ceated by Tools Menu and External Tools Menu settings provided by the Tools Menu Addition plugin. + + + kdevvalgrind/ — provides the Valgrind Memory Leak Check and Profile with KCachegrind entries in the Debug menu used by the Valgrind Frontend plugin. + + + + + + +Resource Configuration Files + + +There are two groups of &kdevelop; configuration files in the $KDEHOME/share/config/ directory, distiguished by their surrounding character sequences: + + doc...pluginrc denotes files used by the documentation plugin. + kdev...rc denotes configuration files used by &kdevelop; itself and its available plugins. + + + + +Configuration Files Used by &kdevelop; + + kdevabbrevrc — holds the current state of the Abbreviations configuration provided by the Abbreviation Expansion plugin. + This only records whether the abbreviations will be used or not. The actual definitions of new abbreviations will go into the $KDEHOME/share/apps/kdevabbrev/templates/templates file. + + + kdevassistantrc — holds some configuration states specific of the stand-alone &kdevelop; Assistant documentation browser. + Most common configuration settings are shared with the &kdevelop; IDE kdeveloprc file. + + kdevassistantuimode4rc — holds the current MDI configuration states (dock positions &etc;) of the stand-alone &kdevelop; Assistant documentation browser. + + kdevclassviewrc — holds the View Mode setting of the Classes class browser tab provided by the Class View project plugin. + This is a global setting, although the Class View plugin may be disabled on a per project basis. Any change in this setting will be globally updated whenever the current project is closed and thus affect all subsequently loaded projects. + + kdevcppsupportrc — holds some settings used to set up CPP source files. In particular you will find the settings made on the C++ Class Generator configuration dialog in here. + kdevdocumentationrc — holds actual settings the Documentation plugin uses. + kdeveloprc — holds the global settings the &kdevelop; IDE and the &kdevelop; Assistant stand-alone documentation browser will use. + kdevelopuimode4rc — holds the current MDI configuration states (dock positions &etc;) of the &kdevelop; IDE. + kdevfileselectorrc — holds actual settings the File Selector plugin uses. + kdevfileviewrc — holds the actual filename color settings the CVS Integration (Cervisia) project plugin uses for display. + kdevfilterrc — holds actual settings the Shell Filtering and Insertion plugin uses. + kdevgrepviewrc — holds actual settings the Grep Frontend plugin uses. + kdevsnippetrc — holds actual settings the Code Snippets plugin uses. + kdevtoolsrc — holds actual settings the Tools Menu Addition plugin uses. + + + +Configuration Files Used by the Documentation Plugin + docchmpluginrc — holds information about the actual &Microsoft; CHM help files as defined on the CHM Documentation Collection configuration page. + doccustompluginrc — holds information about any custom documentation file defined on the Custom Documentation Collection configuration page. + docdevhelppluginrc — holds information about the actual GNOME 2 DevHelp documentation files as defined on the Devhelp Documentation Collection configuration page. + docdoxygenpluginrc — holds information about the actual Doxygen generated API documentations as defined on the Doxygen Documentation Collection configuration page. + dockdevtocpluginrc — holds information about the actual KDevelopTOC structured documentation files as defined on the KDevelopTOC Documentation Collection configuration page. + docqtpluginrc — holds information about the QT documentation files actually included on the Documentation CollectionQt configuration page. + + + + + + + + + +Project Dependent Configuration + + +Most project dependend configuration is kept in the <project-name>.kdevelop and <project-name>.kdevses &kdevelop; project configuration files rather than in separate files as the other, more global, configuration settings. In short, those files are meant for: + + + <project-name>.kdevelop — global project configuration information. + <project-name>.kdevses — configuration information needed to restore the specific behaviours of the running session. + + +Both are &XML; coded files. They can be viewed and (cautiously) altered using any text editor. + + + +Persistent Code Store Files + +There is a third project dependend configuration file, the <project-name>.kdevelop.pcs Persistant Code Store. This is a binary coded file holding an internal parser cache for the most part in order to speed up the loading sequence of the project. Additionally, this Persistant Code Store keeps information use by the Code Completion facility of &kdevelop;. + + + +There can be additional Persistant Code Store files be set up on the Code Completion tab of the C++ Specific project configuration page. Information about these additional .pcs is kept globally in the $KDEHOME/share/apps/kdevcppsupport/pcs/ directory. + + + + + + diff --git a/doc/kdevelop/app-menu.docbook b/doc/kdevelop/app-menu.docbook new file mode 100644 index 00000000..954b65f2 --- /dev/null +++ b/doc/kdevelop/app-menu.docbook @@ -0,0 +1,61 @@ + + + + + BerndPol + + + + +Menus and Toolbars Overview + + +(... to be written ...) + + + +Menus + + +(... to be written ...) + + + +Commonly Available Menus + + +(... to be written ...) + + + + + +Project Specific Menus + + +(... to be written ...) + + + + + +Plugin Tools Specific Menus + + +(... to be written ...) + + + + + + + +Toolbars + + +(... to be written ...) + + + + + diff --git a/doc/kdevelop/app-misc-info.docbook b/doc/kdevelop/app-misc-info.docbook new file mode 100644 index 00000000..308be579 --- /dev/null +++ b/doc/kdevelop/app-misc-info.docbook @@ -0,0 +1,24 @@ + +Further Information + +Getting Information + +(... to be written ...) + + + + +Reporting Bugs + +(... to be written ...) + + + + +Licensing +&underFDL; +&underGPL; + + + + diff --git a/doc/kdevelop/app-uimodes-examples.docbook b/doc/kdevelop/app-uimodes-examples.docbook new file mode 100644 index 00000000..24b93c61 --- /dev/null +++ b/doc/kdevelop/app-uimodes-examples.docbook @@ -0,0 +1,125 @@ + +&kdevelop; User Interface Mode Examples + + +IDEAl Mode + + +Click here to return to the modes overview. + + + + + + + + Screenshot + &kdevelop; IDEAl mode + + + + +Click here to return to the modes overview. + + + + + + + + Screenshot + &kdevelop; IDEAl mode, closed tabs + + + + +This example screenshot demonstrates one of the main virtues of IDEAl mode. There is a maximum workspace available. Yet any tool view is readily available by clicking on the according tab. + + +You will most probably need some time to get accustomed to the icons in the tab bar. If you got lost, just position the mouse over a tab and wait a few seconds. A short tool tip description will pop up. In this screenshot the Automake Manager tool tip is shown as an example. It describes the lower tab in the right tab bar. + + + +Click here to return to the modes overview. + + + + + + + +Child Frame Windows Mode + + +Click here to return to the modes overview. + + + + + + + + Screenshot + &kdevelop; child frame windows mode + + + + +Click here to return to the modes overview. + + + + + + + +Tabbed Pages Mode + + +Click here to return to the modes overview. + + + + + + + + Screenshot + &kdevelop; tabbed pages mode + + + + +Click here to return to the modes overview. + + + + + + + +Toplevel Windows Mode + + +Click here to return to the modes overview. + + + + + + + + Screenshot + &kdevelop; toplevel windows mode + + + + +Click here to return to the modes overview. + + + + + + + diff --git a/doc/kdevelop/applicationwizard.docbook b/doc/kdevelop/applicationwizard.docbook new file mode 100644 index 00000000..ee732a78 --- /dev/null +++ b/doc/kdevelop/applicationwizard.docbook @@ -0,0 +1,820 @@ + + + + + BerndPol + + + + +Getting Started — the &appwizard; + + + + + + &appwizard; + + +In &kdevelop; software development work is organized in projects. Such a project keeps everything together which belongs to a complete programming task: source files, additional data files, any actually needed management facilities as the make system as well as access to all components and any additional tools needed to get the application up and running. + + +Organizing all development work in projects allows you to easily switch between the global tasks at hand. This is quite handy if you ⪚ work on several applications at the same time as is often the case. Tell &kdevelop; to open the project you want to work at and you may proceed in the environment just where you left. + + + +New Projects + + + + + + project + new + + +Whenever you want to initiate a new programming project quite a lot of formal setup procedures need to be done. An initial directory structure has to be set up, initial header and source files must be provided, the make system has to be initialized, &etc; + + +&kdevelop; provides an easy way to initiate a new programming project—the &appwizard;. You will find the &appwizard; at menu entry Project New Project. + + +Only a short series of steps is necessary to start a new programming project, using the &appwizard;: + + + + Select the programming language you want to use and the type of the application you want to build from a set of predefined templates. + + + Supply some general information as application name, directory where the application shall be built, &etc; + + + Decide whether you want to use a version control system, like ⪚ CVS, and supply the necessary data if needed. + + + Set up some templates for initial header and source files (if applicable). + + + Finally tell &appwizard; to set up all initial stuff, directory structure, starting header/source file templates, and management tools, like ⪚ an initial make skeleton, &etc; + + + +Voilà—that's all. &appwizard; will have provided you with a primary functional set of programming files, where you can readily start working. + + +Let's look at all this in more detail now ... + + + +Initial Steps + + + dialog + create new project + + project + create new project + dialog + + project + templates + + templates + project + + +To create a new project in &kdevelop;, select New Project from the Project menu. The Create New Project dialog will pop up showing an initial General page: + + + + + + + + + Initial dialog to set up a new project + + + + + +As you see, this dialog is divided into an upper and a lower part. In the upper part you can decide on the programming language and application type, the lower part holds some general information. + + + +Select Programming Language and Application Type + + + project + application type + + project + programming language + + project + language + + language + + programming language + + application + type + + +The left hand side of the upper part in this dialog is where you do the selection work. When it shows up, you'll find there a list of folders each labeled with a programming language, as there are: + + + + + Ada + + Ada + new project + + + C + + C + new project + + + C++ + + C++ + new project + + + Database (SQL Projects) + + SQL + new project + + Database + new project + + + Fortran + + Fortran + new project + + + Haskell + + Haskell + new project + + + Java + + Java + new project + + + PHP + + PHP + new project + + + Pascal + + Pascal + new project + + + Perl + + Perl + new project + + + Python + + Python + new project + + + Ruby + + Ruby + new project + + + Shell (Scripts for the Bash Shell) + + Bash + new project + + shell + new project + + + + +To be precise, these folders do not contain real programming tools actually. They do lead to pre-defined templates you can use as a starting point for development in that language. To get an idea of what is provided, just open the folders one after the other. There will be a series of subfolders on some, one or more simple entries only on others. The subfolders you see organize the available templates according to some tasks, the simple entries name the templates you may select. + + +We cannot go into detail here on which tasks each template provides, but it's easy to find out. Whenever you select a template entry some information is displayed in the fields to the right. In the lower field you will find a short description on what the template is supposed to do. In the field above that a picture will be shown, if available, about the outcome of the application this template produces if you compile and run it unmodified. Usually this is a screenshot of the main window the application will display. + + +Select the template which best fits your application's goals as a starting point. Then enter the general properties information in the lower field as shown in the next chapter. + + + +Selecting a Project Management System + +Each template is bound to a specific Project Management System. Currently there is no direct means to freely select such a Project Management System. You have to find a template which suits your needs or alter your project accordingly after creation. + + + + + + +Provide General Information + + + project + properties + + properties + + application + name + + name + application + + project + directory + + directory + project + + path + new project + + project + author + + project + email + + author + + email + + project + main.cpp + + main.cpp + + project + license + + license + + +The lower part of the Create New Project dialog General page is a framed field labeled Properties. You must provide some general information about your project here so that the &appwizard; knows how to build the initial structure. + + +Application Name + +Your application needs a name of course. Enter this in the uppermost Properties field, called Application Name. We use MyApp as an example. + + + +When you do so, you will notice that the &appwizard; refuses to accept special characters of any kind. The only characters accepted are: + + upper and lower case characters + numbers + the underline character + + + +One prominent cause of this restriction is that the &appwizard; will use this application name as the basis of some class names it will construct when it sets up an initial project. Thus the name of the application must stick to the rules of the programming language you use. + + +The Project Directory + +The other prominent cause of this restriction you can see at the bottom line of the Properties area. It is labeled Final location and shows the directory where the &appwizard; will create the application. + + + +As you type the application name you will notice that the &appwizard; repeats your input at the end of the Final location line, using lower case only characters. + + +Thus you must select the name of your new application with care. If you end up with an already used directory the &appwizard; will not allow you to continue to the next step, keeping the Next > button deactivated (grayed). Yet, it will warn you in this case by appending (dir/file already exist) to the Final location line. + + + +The Starting Path + +There are two ways to select another path for your new application. One is to select another name. Yet, this is not always feasible (you might ⪚ set up for another version of an already existing application). As an alternative you may select another path to the application directory. + + + +This is done in the second row input field of the Properties, named Location. What you enter here is the starting path of the new application development directory. The &appwizard; appends the application name to this path when it initializes the new project. The result is shown in the Final location line to give you better control on what is going on. + + +&appwizard; will copy an initial value to the Location field on start-up. This is taken from what you have chosen in the Default projects directory field during the general configuration steps. In our case we have &kdevelop; set up to use /home/devel/projects/ as initial path for new projects. + + +Alter the Location field contents so that the application development directory shown in the Final location line will be unique. + + + +Take care that the path you enter in the Location field already exists. Otherwise you will not be able to continue to the next step. The &appwizard; will warn you about non-existing paths by appending (invalid) to the Final location line. + + + + + + + + + Set new project up for CVS + + + + + +Personal Information + +The fields following this are not so critical. Just supply your name (&ie; the name of the person who is responsible for the application) in the Author field, and a valid e-mail address in the Email field, so that users can give you feedback on the application. + + + + + + + The &appwizard; fills these fields with some default values, taken from + the Email presets in the &kcontrolcenter;. If these defaults in the Create New Project Author and Email fields do not suit, you may want to have a look at your mail configuration in the &kcontrolcenter;. + + + The &appwizard; will integrate this information into the starting program templates if applicable. In &kde; C++ programs for instance you will find it near the beginning of the main.cpp source file. + + + Of all fields, the Email is optional, reflecting the fact that not every developer may have access to the internet. You may keep this field empty if you wish and proceed nevertheless. + + + + + +Version and License Info + +Finally enter a starting version number for your new application in the Version field, and select the license under which you want your application be put from the License tab. + + + + +If you select an application type for which the &appwizard; provides common source template texts (⪚ C/C++), you may view the license notification text on the third page of this Create New Project dialog (see the Supply header/source templates chapter below). + + +If you selected Custom from the License tab you must provide a license text on your own. + + + +Both version and license information will as well be integrated into the starting templates in a suiting format the application type you selected does provide. + + + +Once you have correctly entered all this information stuff, press the Next > button to proceed as shown in the following chapters. + + + + + + +Supply Version System Information + + + CVS + new project + + project + CVS + + database + CVS + + version + database + + version + CVS + + +In a second step the &appwizard; will lead you to the Version Control System page where you can decide which version control system you want to use. + + + +This discussion concentrates on the needs for project creation only. For more information on &CVS; see the Using &CVS; chapter below. + + + +No Version Control System Wanted + +Initially there is None selected in the Version control system tab, and the page will be empty otherwise. If you don't want to use a version control system, just click the Next > button and go on. + + + + +Using &CVS; + +Otherwise you must reselect the version control system you want to use from the Version control system tab. We use &cvs; for our example. If you select this, the &appwizard; will redisplay the page, now showing a series of fields you must fill in. + + + + + + + + + + Set new project up for CVS + + + + + +A version control system such as &CVS; (which means Concurrent Versions System) stores copies of selected project files in some sort of a database. If you use &CVS; you can amongst others upload (commit) those files or load them back into your project directory (checkout, or update). The special thing about this is that the files in the versioning database are stored in a structured way which allows you to always revert to an earlier development state if you need so. And &CVS; allows multiple designers to fairly easily collaborate on a big project (such as &kdevelop;) without disturbing each others work. + + + + CVS + root + + root + CVS + + CVS + local + + CVS + remote + + local CVS + + :local: + + CVS + :local: + + +&CVS; Root + +&CVS; needs to manage the versioning database it keeps from your project files. To accomplish this it keeps some special database information in an own directory, called the &CVS; root. The first step on setting up &CVS; for your new project thus is to tell &kdevelop; where this root is located. + + + + +Local &CVS; root. There are two basic possibilities. Either you want to use a local &CVS; database or you use a database which is held on a remote server. If you develop for your own, you may want use the &CVS; database as some sort of a backup system on your own computer. Usually this is set up in your home directory root and given the name cvsroot. This may look as follows: + +/home/devel/cvsroot (where devel simply denotes the developing user, just for example) + + + +In fact, this is a short form. Exactly, the local &CVS; root should be addressed using the :local: prefix. The short form is only allowed in cases where the filename starts with a slash (/). The full name for our example local &CVS; root would exactly look like: :local:/home/devel/cvsroot + + + +Enter the name of the &CVS; root directory your system has been set up for in the CVS root field. In principle you can select any name, even use multiple &CVS; databases, but it is advisable that you stick to the &CVS; root once set up. + + +Initialize a new &CVS; root. If there does not exist a &CVS; root yet, &kdevelop; can command the &CVS; system to create one for you in the given directory. Just check the Init root checkbox below the CVS root field. + + +As said, &kdevelop; only commands the &CVS; system to initialize a new &CVS; root. It does nothing by itself to this directory. Fortunately &CVS; is clever enough to check whether the &CVS; root directory already exists. Hence it does no harm if you should have inadvertently checked Init root on an already existing &CVS; root directory. + + + +Remote &CVS; root. There are occasions where the &CVS; database is to be kept on a remote server, especially when several developers work at the same project. Then you must enter the &CVS; root &URL; of this server in the CVS root field. For example, if you want access to the &kde; &CVS; server: + + +:pserver:mylogin@cvs.kde.org:/home/kde (where mylogin denotes the login name set up in your &kde; &CVS; account) + + + + remote CVS + + :pserver: + + :ext: + + CVS + :local: + + CVS + :pserver: + + CVS + :ext: + + +Remote &CVS; Server Types + +Basically there are two widely used remote &CVS; server types, the +pserver which uses a password-secured non-encrypted +protocol, and the ext server which uses an rsh or ssh +encrypted data transfer. They are distinguished by the &URL; prefix they use: + + + +:pserver: + + +for the password protected server non-encrypted type, and + + +:ext: + + +for an rsh or ssh encrypted server type. For example + + +:ext:mylogin@cvs.cervisia.sourceforge.net:/cvsroot/cervisia + + +accesses the &CVS; root of the widely used Cervisia &CVS; management tool on the SourceForge server. + + +If you want to use an rsh or ssh encrypted server for &CVS; access you must tell &kdevelop; the encryption protocol to be used. Just enter rsh or ssh in the CVS_RSH field of the Create New Project Version Control System page. + + + +There is a caveat if you use an encrypted server for &CVS; from within &kdevelop;. See the Using &CVS; chapter for details. + + + + CVS + repository + + repository + CVS + + +The &CVS; Repository + +So far you have told &kdevelop; where the &CVS; root resides which manages the versioning database and how to access it. Now you need to tell &kdevelop; under which name you want &CVS; save your project files in that database. Such a place your project files will be held in &CVS; is called a repository. + + + +In principle you can use any name for the &CVS; repository of your project files as long as it adheres to the specifications of naming a file. Yet, most developers simply use the name of the application itself. &CVS; will build a directory with this name in the &CVS; root, hence it is more easily found if you keep the application name for it. + + +Just enter the repository name you want to use in the CVS repository field of the Create New Project Version Control System page. In our example this is: MyApp + + + +Take care not to use a repository which already exists! The &CVS; system does not warn about duplicate files but will shovel everything in which does not produce a formal conflict. You will mess up everything! + + + +The Remaining Fields + +There is not much work left to do. &appwizard; has already set up the remaining fields for you. In detail: + + + +The Vendor field is used for compatibility reasons only. You can stick to the vendor default the &appwizard; puts in here. + + +The Message field allows you to comment the initial &CVS; contents. Use any text you like or just stick to the new project default the &appwizard; did put in. + + +The Release tag holds the name which tags the initial state of your project. Such a tag names a certain point within the &CVS; repository by which you can later access this state of your development. (See more in the Using &CVS; chapter.) + + +The &appwizard; has put a default start tag in here which is a worthy proposal. Just stick to it. + + + + +When any information of all these is wrong &kdevelop; usually will not know about until project construction time. It is the &CVS; system which will figure out those errors when it tries to build the repository. Hence you must keep an eye to the Messages window of &kdevelop; when the project is created in the final setup step. If anything was in error with &CVS; you will in most cases see an error message like this: + + + +* cd '/home/devel/test' && cvs -d '/home/devel/mycvsroot' \ + import -m 'new project' '' 'vendor' 'start' &&\ + sh /opt/kde3/share/apps/kdevcvs/buildcvs.sh . '' \ + '/home/devel/mycvsroot' +* cvs [import aborted]: /home/devel/mycvsroot/CVSROOT: No such file or + directory +* *** Exited with status: 1 *** + + + +If this happens you will have to either manually set up &CVS; (&kdevelop; should have successfully initialized your project files at this time) or delete the project directory and start over again with New Project from the Project menu. + + + + +After you have entered all &CVS; related information, click the Next > to go on. + + + +If you want to correct an error on the previous Create New Project page, just press the < Back button. The &appwizard; will remember your settings on the current page, so you can easily proceed when you come back. + + + + + +Supply Header/Source Templates + + +The next step brings you to a series of pages where you can set up common information you want to include in your source and header files, if the task at hand allows. + + +Both header and source templates are provided for C and C++ applications, each on its own page. For other languages there may be source templates only. And in some cases you will even find this template page empty. + + +If the page is used, &appwizard; will fill in some common header comment which for a C++ based application might look like: + + + +/*************************************************************************** + * Copyright (C) 2003 by Your Name * + * you@you.com * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + + +Other templates will provide similar information in a format according to the definitions of the programming language you want to use. + + +As you might have noticed, the applications manager did readily fill in some information you provided on the first General page of the Create New Project dialog, namely the contents of the Author and Email fields. Also proper license information will have been inserted according to your selection in the License tab. + + + +How to Edit the Templates + + + templates + project + edit + + project + templates + edit + + +The templates you set up in the Create New Project dialog will later be processed whenever you command &kdevelop; to set up a new source and/or header file. The information you provided here will be included at top as a documentation header, before the code parts begin. + + +You are not restricted to plain text however. &kdevelop; knows of several variables which allow you to include actual information in the file. The &appwizard; did in fact use some such variables to insert the Author, Email, and License informations into the initial template text. + + + + +Include &doxygen; File Information + + +If, for example, you want the &doxygen;-built &API; documentation to display some further information about the file's contents in its filenames list, you may include the following lines in the source file template: + + +/** + * \file $MODULE$.cpp + * \brief (put some short descripion here). + **/ + + +Whenever you create a new source file, &kdevelop; will replace the $MODULE$ variable by the name body of the newly created file. For example, if you created a new C++ class named ASimpleTest you will see the following lines in the asimpletest.cpp file: + + +/** + * \file asimpletest.cpp + * \brief (put some short descripion here). + **/ + + +You will still have to provide the short description after the \brief keyword, but part of the job is automatically done for you. + + + + + +The License Text File + + +As another example you could include an explicit hint to the license text you want to use into the template. Use the $LICENSEFILE$ variable for this and add for example this line: + + + +// See $LICENSEFILE$ for the full license text. + + +The &appwizard; will replace the $LICENSEFILE$ with the name of the file where the full license text is to be found, namely: + + +// See COPYING for the full license text. + + +for the GPL license, or + + +// See LICENSE.BSD for the full license text. + + +if you decided to put your application under the BSD license. + + +Thee are of course more variables &kdevelop; knows of. See the Editing the templates section in the Editing tools chapter for what is possible. + + + + + + +The templates you define here will come in effect only after the &appwizard; has created the new project. You will find this information on top of the files you created yourself in the development process. When creating the initial files the &appwizard; will use some predefined standard templates. You will have to manually adapt those initial files to your needs. + + + + + + +Build the Initial Project Files + + + project + new + build + + project + initial build + + +Almost everything is done now. On the last templates page the Next > button will have changed to read Finish now. + + +Think twice before you click on it! You still have the option to revise everything by repeatedly using the < Back button. As the &appwizard; remembers all information you did input so far, it may be advisable for you to take the time and look back once again. In case you use local &CVS;, do not forget to double-check the &CVS; repository name (there should be no subdirectory with that name in the &CVS; root directory already—if it does, try another repository name). + + +If ever you don't want the new project be built, abort the Create New Project dialog by the Cancel button. Otherwise click Finish and watch in the Messages window how the &appwizard; initiates the project. + + +If you want to use a versioning system (&CVS;) there will be two runs actually. &appwizard; will first build the project directories and files and then call up the &CVS; program which restarts the Messages window with its own contents. If any error occurs in either of these runs, the process will stop showing you an according error message in the window. + + + +In many cases when your new project has been set up this way, &kdevelop; will automatically load the source file(s) of one or more basically important modules so you can readily start work. (Which source modules will be displayed—if any at all—however depends on the template initially selected in the &appwizard;.) + + + +Do not forget to initially check what the &appwizard; has provided. For example you may want to change the initial heading informations according to your own templates. Usually you will find these in a templates subdirectory in your project directory. Some simple copy operations will mostly suffice. + + +Then it is advisable that you compile the initial project before you attempt to change any code. In most cases this initial compilation should be possible. Thus you can make up whether the project really was set up according to your needs. If it was not, simply remove the project directory (in your local &CVS; root as well if you use one) and start over again. + + + + + + default build configuration + warning + + build configurations + default build warning + + warning + default build configuration + + + Before you compile your new project the first time, have a look at Project Build Configuration. If there are three selections displayed: default, optimized, and debug, with debug selected, by all means stick to this, or use optimized instead. + + + Due to some limitations in the current autoconf/automake setup you should by no means build in the default configuration. This will corrupt some internal directory settings, thus making configure complain when you try to use it in the optimized, or debug build configuration afterwards. + + + (This applies to these multiselection capabilities only. If the application type you selected provides a default build configuration only, you should of course use this one.) + + + + + + + + +Configuring Projects + +(... to be written ...) + + + + diff --git a/doc/kdevelop/automake-file-popup.png b/doc/kdevelop/automake-file-popup.png new file mode 100644 index 00000000..e40f7108 Binary files /dev/null and b/doc/kdevelop/automake-file-popup.png differ diff --git a/doc/kdevelop/automake-manager.png b/doc/kdevelop/automake-manager.png new file mode 100644 index 00000000..5e3a9907 Binary files /dev/null and b/doc/kdevelop/automake-manager.png differ diff --git a/doc/kdevelop/automake-subproject-popup.png b/doc/kdevelop/automake-subproject-popup.png new file mode 100644 index 00000000..e795be9b Binary files /dev/null and b/doc/kdevelop/automake-subproject-popup.png differ diff --git a/doc/kdevelop/automake-target-popup.png b/doc/kdevelop/automake-target-popup.png new file mode 100644 index 00000000..a561e4cc Binary files /dev/null and b/doc/kdevelop/automake-target-popup.png differ diff --git a/doc/kdevelop/automakemanager.png b/doc/kdevelop/automakemanager.png new file mode 100644 index 00000000..89891748 Binary files /dev/null and b/doc/kdevelop/automakemanager.png differ diff --git a/doc/kdevelop/build-commands.png b/doc/kdevelop/build-commands.png new file mode 100644 index 00000000..a6ed86e9 Binary files /dev/null and b/doc/kdevelop/build-commands.png differ diff --git a/doc/kdevelop/build-configurations.png b/doc/kdevelop/build-configurations.png new file mode 100644 index 00000000..6194255e Binary files /dev/null and b/doc/kdevelop/build-configurations.png differ diff --git a/doc/kdevelop/build-menu-automake.png b/doc/kdevelop/build-menu-automake.png new file mode 100644 index 00000000..e468bb78 Binary files /dev/null and b/doc/kdevelop/build-menu-automake.png differ diff --git a/doc/kdevelop/build-menu.png b/doc/kdevelop/build-menu.png new file mode 100644 index 00000000..20353cb5 Binary files /dev/null and b/doc/kdevelop/build-menu.png differ diff --git a/doc/kdevelop/class-browsers.docbook b/doc/kdevelop/class-browsers.docbook new file mode 100644 index 00000000..7c251ee1 --- /dev/null +++ b/doc/kdevelop/class-browsers.docbook @@ -0,0 +1,90 @@ + +The Class Browsers +class browser + + +When working on a project in an object-oriented language, your emphasis when +working on a project is not on the source files and their names, but on the +classes and their relationships. In order to help you navigating in the space +of defined classes and symbols, &kdevelop; includes various class browsers +that visualize the class structure in different ways. + + + +Class View + + +This view is shown on the left side of the main window and contains a linear +list of all classes, variables and functions in your project. It is designed +as a tree view. If you open a class node by clicking on it, a list with all +methods and attributes of the respective class is shown. + + +
+A Screenshot of the Class View + + + +
+ + +The class view works in two different modes. By default, all symbols are +grouped into Classes, Structs, +Functions, Variables and +Namespaces. In the context menu of the view, you can choose +List by Namespaces. In this mode, the namespace +hierarchy is shown and the symbols grouped into the respective namespace +where they are defined. This may be more useful in projects which make heavy +use of (nested) namespaces. It is less useful in projects without +namespaces. + + + +You can also change the way in which class names are displayed. Normally, the +names of the classes are shown, without the namespace in which they are defined. +This means, you cannot immediately distinguish classes with the same name in +different namespaces. If you rest for a while with the mouse over an item, the +full scoped name is shown as a tooltip though. You can decide to always +display the fully scoped class name by choosing +Full Identifier scopes from the context menu. + + + +Clicking on a class or method in the class view brings you to its definition. +You can also jump to the declaration of a method by choosing +Go to declaration from the context menu. In the +context menu for classes are also the items +Add method... and +Add attribute.... This opens dialogs where you can +generate new method and variable declaration in the respective class, together +with an empty implementation. + + +
+ + + + +Class Tools + + +The class tool dialog is activated by right clicking on a class in the class +view and choosing Class tool.... + + + + + + + +Class Hierarchy + + +(... to be written ...) + + + + +
+ + diff --git a/doc/kdevelop/classview.png b/doc/kdevelop/classview.png new file mode 100644 index 00000000..34e3707d Binary files /dev/null and b/doc/kdevelop/classview.png differ diff --git a/doc/kdevelop/commands.docbook b/doc/kdevelop/commands.docbook new file mode 100644 index 00000000..31fff849 --- /dev/null +++ b/doc/kdevelop/commands.docbook @@ -0,0 +1,1989 @@ + + + + + + + Volker Paul + + + + 2005-04-03 + + +Command Reference + + + The shortcut key combinations shown in this chapter are the default ones. They can be changed. + + + + + +The Menubar Note that some menu entries only appear when +they are applicable. Especially, some entries are linked to +plugin +functionality which is only available when the plugin is enabled. + + + + + + + + + +The <guimenu>File</guimenu> Menu + + + + + +&Ctrl;N + +File +New + +Create a new file. +The user is prompted to select the directory (default: the current project's +source directory) and enter a file name. The file type can be selected from a list. +Also, the user can choose whether the file is to be added to the project. +Then the Automake Manager asks which target to add the new file to. + + + + + + +&Ctrl;O + +File +Open + +Open an existing file in a simple dialog +box. + + + + + +&Ctrl;O + +File +Open Recent + +Displays a submenu showing the files recently opened. +Selecting one of these will make KDevelop open that file. + + + + + + +&Alt;&Ctrl;O + +File +Quick Open + +Presents a list of files in the current project's +source directory. The user can select from this list +or type a filename. That file is then opened. + + + + + + + +&Ctrl;S + +File +Save + +Saves the current file. + + + + + + +&Ctrl;S + +File +Save As... + +Uses the +Save As... dialog box to let you save a copy +under a new name. + + + + +File +Save All + +Saves all open files. + + + + +F5 +File +Reload + +Reloads current file to show changes +made by different programs. +(Note that such changes are normally detected automatically +and the user is prompted whether the file is to be reloaded.) +. + + + + +File +Revert all + + +Reverts all changes in opened files. +Prompts to save changes so the +reversion can be canceled for each +modified file. + + + + + + + +&Ctrl;P + +File +Print... + +Print. + + + + +File +Export + + +Export + + + + + + + +&Ctrl;F4 + +File +Close + + +Closes current file. + + + + + + +File +Close All + + +Closes all open files. + + + + + + +File +Close All Others + + +Closes all files except the current one. +Very useful if you opened a lot of files and you want +to concentrate on the current one. +Without this, you would have to close them all +and re-open the current one. + +Note there is a similar command in the Window menu. + + + + + + + +&Ctrl;Q + +File +Quit + +Close KDevelop. + + + + + + + + + + + + +The <guimenu>Edit</guimenu> Menu + + + + + + + + +&Ctrl;Z + +Edit +Undo + + +Undo + + + + + + + +&Ctrl;&Shift;Z + +Edit +Redo + + +Redo + + + + + + + +&Ctrl;X + +Edit +Cut + + +Cut + + + + + + + +&Ctrl;C + +Edit +Copy + + +Copy + + + + + + + +&Ctrl;V + +Edit +Paste + + +Paste + + + + + + + +&Ctrl;A + +Edit +Select All + + +Select All + + + + + + + +&Ctrl;&Shift;A + +Edit +Deselect + + +Deselect + + + + + + + +&Ctrl;&Shift;B + +Edit +Block Selection Mode + + +Block Selection Mode + + + + + + + +Insert + +Edit +Overwrite Mode + + +Overwrite Mode + + + + + + + +&Ctrl;F + +Edit +Find + + +Find + + + + + + + +F3 + +Edit +Find Next + + +Find Next + + + + + + + +&Shift;F3 + +Edit +Find Previous + + +Find Previous + + + + + + + +&Ctrl;R + +Edit +Replace + + +Replace + + + + + + + +&Ctrl;G + +Edit +Go to Line + + +Go to Line + + + + + + + +&Alt;&Ctrl;F + +Edit +Find in Files + + +Find in Files + + + + + + + +&Shift;R + +Edit +Find-Select-Replace + + +Find-Select-Replace + + + + + + +Edit +Reformat Source + + +Reformat Source + + + + + + + +&Ctrl;J + +Edit +Expand Text + + +Expand Text + + + + + + + +&Ctrl;L + +Edit +Expand Abbreviation + + +Expand Abbreviation + + + + + + + +&Ctrl;Space + +Edit +Complete Text + + +Complete Text + + + + + + + +F2 + +Edit +Make Member + + +Make Member + + + + + + + + + + + + + + + +The <guimenu>View</guimenu> Menu + + + + +View +Back + + +Back + + + + + + +View +Forward + + +Forward + + + + + + + +&Ctrl;/ + +View +Switch to... + + +Switch to... + + + + + + + +&Alt;C + +View +Raise Editor + + +Raise Editor + + + + + + + +F4 + +View +Next Error + + +Next Error + + + + + + + +&Shift;F4 + +View +Previous Error + + +Previous Error + + + + + + + +&Shift;F + +View +Full Screen Mode + + +Full Screen Mode + + + + + + + +&Ctrl;F12 + +View +Switch Header/Implementation + + +Switch Header/Implementation + + + + + + +View +Tool Views + + +Tool Views + + + + + + +View +Tool Docks + + +Tool Docks + + + + + + + +F7 + +View +Switch to Command Line + + +Switch to Command Line + + + + + + +View +Schema + + +Schema + + + + + + + +F10 + +View +Dynamic Word Wrap + + +Dynamic Word Wrap + + + + + + +View +Dynamic Word Wrap Indicators + + +Dynamic Word Wrap Indicators + + + + + + +View +Show/Hide Static Word Wrap Marker + + +Show/Hide Static Word Wrap Marker + + + + + + + +F6 + +View +Show/Hide Icon Border + + +Show/Hide Icon Border + + + + + + + +F11 + +View +Show/Hide Line Numbers + + +Show/Hide Line Numbers + + + + + + +View +Show/Hide Scrollbar Marks + + +Show/Hide Scrollbar Marks + + + + + + + +F9 + +View +Show/Hide Folding Marks + + +Show/Hide Folding Marks + + + + + + +View +Code Folding + + +Code Folding + + + + + + +View +Set Encoding + + +Set Encoding + + + + + + + + + + + + + + + + +The <guimenu>Project</guimenu> Menu + + + + + +Project +New Project... + + +New Project... + + + + + + +Project +Open Project... + + +Open Project... + + + + + + +Project +Open Recent Project + + +Open Recent Project + + + + + + +Project +Active Language + + +Active Language + + + + + + +Project +Import Existing Project... + + +Import Existing Project... + + + + + + +Project +New Class... + + +New Class... + + + + + + +Project +Class Inheritance Diagram + + +Class Inheritance Diagram + + + + + + +Project +Add Translation... + + +Add Translation... + + + + + + +Project +Build Configuration + + +Build Configuration + + + + + + +Project +Distribution & Publishing + + +Distribution & Publishing + + + + + + +Project +Project Options... + + +Project Options... + + + + + + +Project +Close Project + + +Close Project + + + + + + + + + + + + + + + +The <guimenu>Project</guimenu> Menu + + + + + + +F8 + +Build +Build Project + + +Build Project + + + + + + + +F7 + +Build +Build Active Target + + +Build Active Target + + + + + + +Build +Compile File + + +Compile File + + + + + + +Build +Run Configure + + +Run Configure + + + + + + +Build +Run automake & friends + + +Run automake & friends + + + + + + +Build +Install + + +Install + + + + + + +Build +Install (as root user) + + +Install (as root user) + + + + + + +Build +Clean project + + +Clean project + + + + + + +Build +Distclean + + +Distclean + + + + + + + +&Shift;F9 + +Build +Make Messages & Merge + + +Make Messages & Merge + + + + + + +Build +Execute Program + + +Execute Program + + + + + + +Build +Build API Documentation + + +Build API Documentation + + + + + + +Build +Clean API Documentation + + +Clean API Documentation + + + + + + + +Escape + +Build +Stop + + +Stop + + + + + + + + + + + + + + + + +The <guimenu>Project</guimenu> Menu + + + + + +Debug +Start + + +Start + + + + + + +Debug +Stop + + +Stop + + + + + + +Debug +Interrupt + + +Interrupt + + + + + + +Debug +Run to Cursor + + +Run to Cursor + + + + + + +Debug +Step Over + + +Step Over + + + + + + +Debug +Step over Instruction + + +Step over Instruction + + + + + + +Debug +Step Into + + +Step Into + + + + + + +Debug +Step into Instruction + + +Step into Instruction + + + + + + +Debug +Step Out + + +Step Out + + + + + + +Debug +Toggle Breakpoint + + +Toggle Breakpoint + + + + + + +Debug +Viewers + + +Viewers + + + + + + +Debug +Examine Core File... + + +Examine Core File... + + + + + + +Debug +Attach to Process + + +Attach to Process + + + + + + +Debug +Valgrind Memory Leak Check + + +Valgrind Memory Leak Check + + + + + + +Debug +Profile with KCachegrind + + +Profile with KCachegrind + + + + + + + + + + + + + + + + + + + +The <guimenu>Bookmarks</guimenu> Menu + + + + + + +&Ctrl;B + +Bookmarks +Set Bookmark + +Add current selection to your +bookmarks. + + + + + +Bookmarks +Clear All Bookmarks + +Clear All Bookmarks. + + + + + + + + + + + + +The <guimenu>Window</guimenu> Menu + + + + + + +&Alt;W +Window +Close Selected Windows... + +Close Selected Windows... + + + + + +&Ctrl;F4 +Window +Close + +Close + + + + +Window +Close All + +Close All + + + + +Window +Close All Others + +Close All Others + + + + + + + + + + + + + + + + +The <guimenu>Tools</guimenu> Menu + + + + +Tools +Read Only Mode + + +Read Only Mode + + + + + + +Tools +Filetype Mode + + +Filetype Mode + + + + + + +Tools +Highlight Mode + + +Highlight Mode + + + + + + +Tools +End of Line + + +End of Line + + + + + + +Tools +Spelling + + +Spelling + + + + + + + +&Ctrl;I + +Tools +Indent + + +Indent + + + + + + + +&Ctrl;&Shift;I + +Tools +unindent + + +unindent + + + + + + +Tools +Clean Indentation + + +Clean Indentation + + + + + + + +&Ctrl;Tab + +Tools +Align + + +Align + + + + + + + +&Ctrl;D + +Tools +Comment + + +Comment + + + + + + + +&Ctrl;&Shift;D + +Tools +Uncomment + + +Uncomment + + + + + + + +&Ctrl;U + +Tools +Uppercase + + +Uppercase + + + + + + + +&Ctrl;&Shift;U + +Tools +Lowercase + + +Lowercase + + + + + + + +&Alt;&Ctrl;U + +Tools +Capitalize + + +Capitalize + + + + + + + +&Ctrl;J + +Tools +Join Lines + + +Join Lines + + + + + + +Tools +Word Wrap Document + + +Word Wrap Document + + + + + + +Tools +Difference Viewer... + + +Difference Viewer... + + + + + + +Tools +Execute Command... + + +Execute Command... + + + + + + +Tools +Filter Selection Through Command... + + +Filters selection through external command using +the Filter plugin. + + + + + + +Tools +Debug Regular Expression... + + +Debug Regular Expression... + + + + + + +Tools +Part Explorer + + +Part Explorer + + + + + + + +&Alt;&Ctrl;C + +Tools +Quick Open Class... + + +Quick Open Class... + + + + + + + +&Alt;&Ctrl;M + +Tools +Quick Open Method... + + +Quick Open Method... + + + + + + + +&Alt;&Ctrl;P + +Tools +Preview Doxygen Output + + +Preview Doxygen Output + + + + + + + +&Ctrl;&Shift;S + +Tools +Document Current Function + + +Document Current Function + + + + + + + + + + + + + + + + +The <guimenu>Settings</guimenu> Menu + + + + + + + +&Ctrl;M +Settings +Show/Hide Menubar + +Show/Hide the menubar. + + + + +Settings +Toolbars + +Opens a sub menu where you can choose to show or hide +the various Toolbars. + + + + +Settings +Show Statusbar + +Show the Statusbar. + + + + +Settings +Configure Shortcuts... + + +Configure Shortcuts... + + + + + + +Settings +Configure Toolbar... + + +Configure Toolbar... + + + + + + +Settings +Configure Notifications... + + +Configure Notifications... + + + + + + +Settings +Configure Editor... + + +Configure Editor... + + + + + + +Settings +Configure KDevelop... + + +Configure KDevelop... + + + + + + + + + + + + + + + +The <guimenu>Help</guimenu> Menu + + + + + +Help +KDevelop Handbook + +View this document. + + + + + +&Shift;F1 +Help +What's This? + +Draws a question mark (?) beside the mouse +pointer, clicking on a window item such as the +Stop button will then display a brief explanation. + + + + + + + +Help +Tip of the Day + + +Tip of the Day + + + + + + + +&Alt;&Ctrl;I + +Help +Look in Documentation Index... + + +Look in Documentation Index... + + + + + + + +&Alt;&Ctrl;S + +Help +Search in Documentation... + + +Search in Documentation... + + + + + + +Help +Man Page... + + +Man Page... + + + + + + +Help +Info Page... + + +Info Page... + + + + + + +Help +Report Bug... + +Report bug. + + + + +Help +About KDevelop... + +Display some brief information about +KDevelop's version number, authors and license agreement. + + + + +Help +About KDE... + +Show some information about the version of &kde; that +you are running. + + + + + + + + + + + + + + diff --git a/doc/kdevelop/configure-adddialog-baselibs.png b/doc/kdevelop/configure-adddialog-baselibs.png new file mode 100644 index 00000000..6d97097c Binary files /dev/null and b/doc/kdevelop/configure-adddialog-baselibs.png differ diff --git a/doc/kdevelop/configure-adddialog-qt.png b/doc/kdevelop/configure-adddialog-qt.png new file mode 100644 index 00000000..3138d416 Binary files /dev/null and b/doc/kdevelop/configure-adddialog-qt.png differ diff --git a/doc/kdevelop/configure-adddialog.png b/doc/kdevelop/configure-adddialog.png new file mode 100644 index 00000000..6ebd62d5 Binary files /dev/null and b/doc/kdevelop/configure-adddialog.png differ diff --git a/doc/kdevelop/configure-doctree-DevHelp.png b/doc/kdevelop/configure-doctree-DevHelp.png new file mode 100644 index 00000000..0cf26aeb Binary files /dev/null and b/doc/kdevelop/configure-doctree-DevHelp.png differ diff --git a/doc/kdevelop/configure-doctree-TOC.png b/doc/kdevelop/configure-doctree-TOC.png new file mode 100644 index 00000000..cec94cd6 Binary files /dev/null and b/doc/kdevelop/configure-doctree-TOC.png differ diff --git a/doc/kdevelop/configure-doctree-bookmark.png b/doc/kdevelop/configure-doctree-bookmark.png new file mode 100644 index 00000000..152ee605 Binary files /dev/null and b/doc/kdevelop/configure-doctree-bookmark.png differ diff --git a/doc/kdevelop/configure-doctree-general.png b/doc/kdevelop/configure-doctree-general.png new file mode 100644 index 00000000..abf8be8c Binary files /dev/null and b/doc/kdevelop/configure-doctree-general.png differ diff --git a/doc/kdevelop/configure-doctree-textsearch.png b/doc/kdevelop/configure-doctree-textsearch.png new file mode 100644 index 00000000..680f5137 Binary files /dev/null and b/doc/kdevelop/configure-doctree-textsearch.png differ diff --git a/doc/kdevelop/configure-docu-chm.png b/doc/kdevelop/configure-docu-chm.png new file mode 100644 index 00000000..6456580a Binary files /dev/null and b/doc/kdevelop/configure-docu-chm.png differ diff --git a/doc/kdevelop/configure-docu-custom.png b/doc/kdevelop/configure-docu-custom.png new file mode 100644 index 00000000..25e3bb6d Binary files /dev/null and b/doc/kdevelop/configure-docu-custom.png differ diff --git a/doc/kdevelop/configure-docu-devhelp.png b/doc/kdevelop/configure-docu-devhelp.png new file mode 100644 index 00000000..b7db6634 Binary files /dev/null and b/doc/kdevelop/configure-docu-devhelp.png differ diff --git a/doc/kdevelop/configure-docu-dox.png b/doc/kdevelop/configure-docu-dox.png new file mode 100644 index 00000000..916e32b8 Binary files /dev/null and b/doc/kdevelop/configure-docu-dox.png differ diff --git a/doc/kdevelop/configure-docu-edit.png b/doc/kdevelop/configure-docu-edit.png new file mode 100644 index 00000000..bc904327 Binary files /dev/null and b/doc/kdevelop/configure-docu-edit.png differ diff --git a/doc/kdevelop/configure-docu-general.png b/doc/kdevelop/configure-docu-general.png new file mode 100644 index 00000000..0feaef99 Binary files /dev/null and b/doc/kdevelop/configure-docu-general.png differ diff --git a/doc/kdevelop/configure-docu-indexgen.png b/doc/kdevelop/configure-docu-indexgen.png new file mode 100644 index 00000000..4315b6c3 Binary files /dev/null and b/doc/kdevelop/configure-docu-indexgen.png differ diff --git a/doc/kdevelop/configure-docu-toc.png b/doc/kdevelop/configure-docu-toc.png new file mode 100644 index 00000000..5f5bfb65 Binary files /dev/null and b/doc/kdevelop/configure-docu-toc.png differ diff --git a/doc/kdevelop/configure-editor.png b/doc/kdevelop/configure-editor.png new file mode 100644 index 00000000..2e4b80fa Binary files /dev/null and b/doc/kdevelop/configure-editor.png differ diff --git a/doc/kdevelop/configure-file-selector.png b/doc/kdevelop/configure-file-selector.png new file mode 100644 index 00000000..7ddcb044 Binary files /dev/null and b/doc/kdevelop/configure-file-selector.png differ diff --git a/doc/kdevelop/configure-file-templates.png b/doc/kdevelop/configure-file-templates.png new file mode 100644 index 00000000..b49fbc77 Binary files /dev/null and b/doc/kdevelop/configure-file-templates.png differ diff --git a/doc/kdevelop/configure-general.png b/doc/kdevelop/configure-general.png new file mode 100644 index 00000000..b8c7268c Binary files /dev/null and b/doc/kdevelop/configure-general.png differ diff --git a/doc/kdevelop/configure-project-buildconfig.png b/doc/kdevelop/configure-project-buildconfig.png new file mode 100644 index 00000000..a0236cd8 Binary files /dev/null and b/doc/kdevelop/configure-project-buildconfig.png differ diff --git a/doc/kdevelop/configure-project-configure.png b/doc/kdevelop/configure-project-configure.png new file mode 100644 index 00000000..c918a48b Binary files /dev/null and b/doc/kdevelop/configure-project-configure.png differ diff --git a/doc/kdevelop/configure-project-cpp.png b/doc/kdevelop/configure-project-cpp.png new file mode 100644 index 00000000..7d29091c Binary files /dev/null and b/doc/kdevelop/configure-project-cpp.png differ diff --git a/doc/kdevelop/configure-project-cppoptions.png b/doc/kdevelop/configure-project-cppoptions.png new file mode 100644 index 00000000..2f51ec88 Binary files /dev/null and b/doc/kdevelop/configure-project-cppoptions.png differ diff --git a/doc/kdevelop/configure-project-doc.png b/doc/kdevelop/configure-project-doc.png new file mode 100644 index 00000000..05b29e6d Binary files /dev/null and b/doc/kdevelop/configure-project-doc.png differ diff --git a/doc/kdevelop/configure-project-make.png b/doc/kdevelop/configure-project-make.png new file mode 100644 index 00000000..17b5f426 Binary files /dev/null and b/doc/kdevelop/configure-project-make.png differ diff --git a/doc/kdevelop/configure-project-run.png b/doc/kdevelop/configure-project-run.png new file mode 100644 index 00000000..6bbef8c6 Binary files /dev/null and b/doc/kdevelop/configure-project-run.png differ diff --git a/doc/kdevelop/configure-select.png b/doc/kdevelop/configure-select.png new file mode 100644 index 00000000..1c272a65 Binary files /dev/null and b/doc/kdevelop/configure-select.png differ diff --git a/doc/kdevelop/configure-snippets.png b/doc/kdevelop/configure-snippets.png new file mode 100644 index 00000000..64a2ca00 Binary files /dev/null and b/doc/kdevelop/configure-snippets.png differ diff --git a/doc/kdevelop/create-new-project-cvs.png b/doc/kdevelop/create-new-project-cvs.png new file mode 100644 index 00000000..a4955ae5 Binary files /dev/null and b/doc/kdevelop/create-new-project-cvs.png differ diff --git a/doc/kdevelop/create-new-project.png b/doc/kdevelop/create-new-project.png new file mode 100644 index 00000000..140d5ebb Binary files /dev/null and b/doc/kdevelop/create-new-project.png differ diff --git a/doc/kdevelop/createnewproject.png b/doc/kdevelop/createnewproject.png new file mode 100644 index 00000000..965a14d1 Binary files /dev/null and b/doc/kdevelop/createnewproject.png differ diff --git a/doc/kdevelop/createnewprojectoptions.png b/doc/kdevelop/createnewprojectoptions.png new file mode 100644 index 00000000..1d515bc3 Binary files /dev/null and b/doc/kdevelop/createnewprojectoptions.png differ diff --git a/doc/kdevelop/credits.docbook b/doc/kdevelop/credits.docbook new file mode 100644 index 00000000..77712cc4 --- /dev/null +++ b/doc/kdevelop/credits.docbook @@ -0,0 +1,24 @@ + +Credits + + +Contributions + + + + + The initial contents of this manual were witten by Bernd Gehrmann bernd@kdevelop.org and Caleb Tennis caleb@aei-tech.com. + + + The Summary of &automanag; and Automake Manager Operation chapters were written by Ian Wadham, ianw@netspace.net.au). + + + + + + + + + + + diff --git a/doc/kdevelop/cvs.docbook b/doc/kdevelop/cvs.docbook new file mode 100644 index 00000000..ccdce4e6 --- /dev/null +++ b/doc/kdevelop/cvs.docbook @@ -0,0 +1,139 @@ + +Using &CVS; +CVS +revision control + + +&CVS; Basics + + +&CVS; is the revision control system which many open source projects - +including &kde; — are using. It stores all sources codes in a central place, +called the repository. From the repository, developers +can check out a current version of the project or snapshots of it at arbitrary +points of time. In contrast to some other revision control systems, it is not +necessary to lock files one wants to work on. So +development can be highly parallelized. + + + +Whenever a developer has finished a task, he commits his +code (accompanied by a log message). &CVS; takes the job to merge the changes +made by several developers. It can of course happen that developers work on +the same piece of code, resulting in a conflicting set of changes (in practice +this occurs seldom, and is often a sign of a lack of communication). In this +case &CVS; rejects a commit; only after all conflicts are resolved, a file can +be committed. + + + +So far, this has been a description of the basic features of &CVS; one usually +has to cope with. But &CVS; can provide a lot more: One can maintain several +branches of a project (⪚ &kde; 1.1.2 and &kde; 2 were branches in &kde;'s +development tree), merge changes from one branch to another, ask for +differences between revisions, the revision history of files &etc; + + + +&CVS; is implemented as a client-server system. As a user, all communication +with the repository goes through the command line program &cvs;. A higher +level user interface is available through frontends like &cervisia; () or TkCVS (). In &kdevelop;, only a small part of the &cvs; +functionality which is important for your daily work can be used directly. + + + +Basic knowledge of &CVS; usage is assumed. In particular, you should know +how to checkout a given project from the repository. We recommend the +book Open Source Development With &CVS; by Karl Fogel which is freely +distributed (except for the non-technical chapters). See +. + + + + + + + +&CVS; Commands in &kdevelop; + + +In the file views, the following context menu items are available: + + + + +Add to Repository + +Prepares the marked file for addition to the repository. The file +is transferred to the repository when you commit it (or the containing +directory) the next time. + + + + + +Remove from Repository + + +Prepares a file for removal from the repository. This also deletes +the file on the local file system, so use this feature with care! + + + + + +Update + + +Runs cvs update to merge any changes from other +users into your working directory. When you use this menu item over +a directory, the update normally happens recursively, except if you +have disabled this in the configuration file .cvsrc. + + + + + +Commit + + +Runs cvs commit to upload any locally made changes +to the repository. Note that you should update before doing this. +Otherwise, when another user has committed his own changes before, +&CVS; may give you an error message. + + + + + + +All these commands are invoked as subprocesses by &kdevelop; without any +further command line options or environment variables. This may be a +problem when the connection with the &CVS; server goes through a +&ssh; connection and requires that you enter your password each time +you commit or update. This is for instance necessary when your project is +hosted on sourceforge.net. Workarounds for this +problem are described on the &CVS;/SSH FAQ which you can find in the +SourceForge documentation. + + + + + + + +Behind the Scenes + + +What &CVS; Records in the Working Directory + + +(... to be written ...) + + + + + + diff --git a/doc/kdevelop/debugger.docbook b/doc/kdevelop/debugger.docbook new file mode 100644 index 00000000..a06f2c83 --- /dev/null +++ b/doc/kdevelop/debugger.docbook @@ -0,0 +1,242 @@ + +The Debugger Interface +debugger + + +For C and C++, &kdevelop; contains an internal debugger that is directly +integrated with the editor. Technically, it is implemented as a frontend +that uses the portable &GNU; debugger gdb through +a pipe. The debugger can be started in several ways: + + + + + +With DebugStart, +the main program of your project is loaded into the debugger. + + + + + +Using Debug +Start (other) +Examine core file you load a core file +into memory, which is generated by the operating system kernel when the +program has crashed (The generation of core files may be switched off on your +system, see ulimit(1)). This is useful for a +post-mortem analysis of a program. + + + + + +With Debug +Start (other) +Attach to process you invoke the +debugger on an already running program. You will be shown a +process list where you can select the process which the debugger +should take over. + + + + + +Note that debugging is only possible if your project has been compiled with +debugging information enabled. It can be activated in the +Compiler options dialog. When this option is switched +on, the compiler generates additional data which allows the debugger to +associate file names and line numbers with addresses in the executable. + + + + + +The debugger frontend offers several views into the process: + + +If you try to debug a project without debugging information, you get +the message No source... in the status +bar.If you try to set a breakpoint, it is shown as Pending +(add) in the breakpoint window (see below). + + + + +Variables + +watch variables + +This window lists the values of all local variables at the current execution +point of the program. It covers the variables in the complete call stack, +&ie; the function where the process was interrupted, the function that called +this function, and so on up to main() function. + + + +Another branch in the variables contains watch variables. You can configure +yourself which variables are shown here. Both local and global variables can +be watched. You can add variables either by clicking on the +Add button or pressing Return while +the Watch item is selected. They can be removed again +via the context menu. + + + + + +Frame Stack + +frame stack + +(... to be written ...) + + + + + +Breakpoints + +breakpoints + +This window allows you to see and manipulate the breakpoints. Remember that +&kdevelop; uses GDB, so to fully understand the +&kdevelop; debugging features, you should know a little bit about the GDB. + + +If you want to look at the source code, breakpoints are defined in +kdevelop/languages/cpp/debugger/breakpoint.h. + + +At the left edge, the window has buttons to: + + +Add an empty breakpoint +Edit the selected breakpoint + Delete the selected breakpoint +Remove all breakpoints + + +The main part of the window is a table with 7 columns. Each line in +the table is a breakpoint. The columns are: + + +Selection checkbox +Type: one of: Invalid, File:Line, Watchpoint, Address, Function +Status. Values are: + + Active + Disabled: Each breakpoint may be enabled or + disabled; if disabled, it has no effect on your program until + you enable it again. + Pending (add): a breakpoint is marked like this if no + debugging information is available. From GDB Info page: +
If a specified breakpoint location cannot be found, it may be due to + the fact that the location is in a shared library that is yet to be + loaded. In such a case, you may want GDB to create a special + breakpoint (known as a pending breakpoint) that attempts to resolve + itself in the future when an appropriate shared library gets loaded. +
+
+
+
+Pending (clear) +Pending (modify) +Location in the format filename:linenumber +Condition +Ignore Count: If this is a number COUNT +greater than zero, the next COUNT times the breakpoint is +reached, your program's execution does not stop; other than to decrement the +ignore count, gdb takes no action. +Hits: counts how many times a breakopint has been hit. +
+ + +
+
+ + +Disassemble + +disassemble +(... to be written ...) + + + +
+ + + +Setting Breakpoints + + +(... to be written ...) + + + + + + + +Options + + + +Display Mangled Names + +name mangling +manglingname + + +In C++, function names in the executable are mangled, &ie; +the function names include information about the argument types. This is +necessary in order to support overloading of functions. The mangling +algorithm is not standardized and differs even between different versions of +the &GNU; C++ compiler. + + + +In the disassembling window, normally unmangled names are displayed, so +function signatures appear in the similar way as in the source code, so +they are easily readable. Alternatively, you can decide to see mangled names. + + + + + +Try Setting Breakpoints on Lib Load + +lazy breakpoints +breakpointslazy + + +The debugger backend gdb does not allow to set +breakpoints within code that is not currently loaded. In a highly modular +application, where often code is only loaded on demand as a plugin (using +the libc function dlopen(3)), this can be inconvenient. +Therefore, &kdevelop; rolls its own support for breakpoints in shared +libraries. If you set this option, it allows you to set breakpoints in +libraries which are not loaded. Then, whenever gdb +notifies that a library is loaded, &kdevelop; tries to set the pending +breakpoints. + + + + + +Enable Floating Toolbar + +debugger toolbar +toolbardebugger + + +(... to be written ...) + + + + + + + +
diff --git a/doc/kdevelop/doctree-add-bookmark.png b/doc/kdevelop/doctree-add-bookmark.png new file mode 100644 index 00000000..090c93f9 Binary files /dev/null and b/doc/kdevelop/doctree-add-bookmark.png differ diff --git a/doc/kdevelop/doctree-reduced.png b/doc/kdevelop/doctree-reduced.png new file mode 100644 index 00000000..30c22e79 Binary files /dev/null and b/doc/kdevelop/doctree-reduced.png differ diff --git a/doc/kdevelop/doctree.png b/doc/kdevelop/doctree.png new file mode 100644 index 00000000..26264828 Binary files /dev/null and b/doc/kdevelop/doctree.png differ diff --git a/doc/kdevelop/doctreeview.png b/doc/kdevelop/doctreeview.png new file mode 100644 index 00000000..64031238 Binary files /dev/null and b/doc/kdevelop/doctreeview.png differ diff --git a/doc/kdevelop/documentation.docbook b/doc/kdevelop/documentation.docbook new file mode 100644 index 00000000..eed065b0 --- /dev/null +++ b/doc/kdevelop/documentation.docbook @@ -0,0 +1,57 @@ + +Documentation + + +Documention unfortunately belongs to the most-overlooked programming +issues. Yet, once properly set up and maintained internal and external +documentation provides most valuable help. + + + +Documentation has multiple facets. There is + + + project internal documentation, mainly consisting of + + + comments in header/source files + + + internal &API; documentation of your project + generated from the program file by special tools, ⪚ &doxygen; + + + + + project external documentation, comprising among others + + + external &API; documentation of ⪚ common system libraries (&kde;, &Qt;, &etc;) + + + any other documentation (programming language manuals, general system information, how-to articles and the like) + + + + + + +All this documentation should be easily maintainable and ready at hand whenever you need it. &kdevelop; has provisions for just this. + + + + + +The Documentation Browser + + +
+A Screenshot of the Documentation Tree + + + +
+ +
+ +
diff --git a/doc/kdevelop/documents-contents.png b/doc/kdevelop/documents-contents.png new file mode 100644 index 00000000..9adb1699 Binary files /dev/null and b/doc/kdevelop/documents-contents.png differ diff --git a/doc/kdevelop/documents-search.png b/doc/kdevelop/documents-search.png new file mode 100644 index 00000000..f1e23048 Binary files /dev/null and b/doc/kdevelop/documents-search.png differ diff --git a/doc/kdevelop/edit-doctree-TOC-entry.png b/doc/kdevelop/edit-doctree-TOC-entry.png new file mode 100644 index 00000000..f0d56685 Binary files /dev/null and b/doc/kdevelop/edit-doctree-TOC-entry.png differ diff --git a/doc/kdevelop/editing.docbook b/doc/kdevelop/editing.docbook new file mode 100644 index 00000000..54074bdb --- /dev/null +++ b/doc/kdevelop/editing.docbook @@ -0,0 +1,401 @@ + +Editing Tools + + +Code Snippets + + + Features (preliminary overview) + + SnippetPart adds a tool-view which by default docks to the right + + + Adding, editing and removing of snippets is available via a popup-menu + + + Double-clicking a snippet form the list inserts it into to the active view at the current cursor position + + + Tool tips show the content of a snippet + + + Snippets are stored in the users home-directory, so every user can have his own snippets + + + Snippets can contain variables in the style of $VARNAME$. On using the snippet the user is prompted to enter replacement value for the variables + + + + + +Keyboard Mapping +keybindings + + +In the following, we will list the default keybindings of the +default editor. You can configure them as you like (how?) + + + + + + + + Left + + + Moves one character left + + + + Right + + + Moves one character right + + + +&Ctrl; + Left + + + Moves one word left + + + +&Ctrl; + Right + + + Moves one word right + + + + Up + + + Moves up one line + + + + Down + + + Moves down one line + + + + Page Up + + + Moves up one page + + + + Page Down + + + Moves down one page + + +&Ctrl; + Page Down + + + Moves to the beginning of the file + + +&Ctrl; + + Page Down + + + Moves to the end of the file + + + + Home + + + Moves to the beginning of the line + + + + End + + + Moves to the end of the line + + + + + + + +For all the keys above, the &Shift; key can be pressed additionally, +to mark from the current cursor position to the one afterwards. + + + + + + + + Backspace + + + Deletes one character left + + + + Delete + + + Deletes the character under the cursor + + + +&Ctrl; + + C + + + Copies the selected text to the clipboard + + +&Ctrl; + V + + + Pastes the selected text from the clipboard + + +&Ctrl; + X + + + Deletes the selected text and puts it into the clipboard + + +&Ctrl; + Z + + + Undo + + +&Shift;&Ctrl; + Z + + +Redo + + + + + + + + + + + +The Problem Reporter + + +(... to be written ...) + + + + + + +Searching and Grepping +searching +finding + + +Searching for Text + + +&Ctrl;F- Find +&Ctrl;R- Replace + + + + + + +ISearch +isearch +incremental search +searchincremental + + +The conventional search with Edit +Find requires you to specify the full +search term before starting. Most of the time, it is much faster to search +incrementally. If you click into the edit field labeled +ISearch in the toolbar, the search is performed as you +type. You will find that often the desired term is already found after typing +in 3 or 4 letters. + + + + + + +Grep +searchin files + + +Both search mechanisms described above are restricted to searching within one +source file. An additional tool which allows you to search through a (possibly +large) number of files is available through the +Search in Files... item in the +Edit menu. It is basically a frontend for the +&grep;(1) program. + + + +In the dialog, you can specify which files are searched. There is a number of +wildcard patterns available in a combobox. In this way, you can easily +restrict the find mechanism to header files. Furthermore, you specify a +directory where the search is started. If you check the +Recursive box, the search iterates through all +directories in the hierarchy below this one. + + + +The search term is in general a regular expression following POSIX syntax. +For example, you can use the term "\<K.*" if you want to +find all words which begin with the letter K. The following characters +are interpreted in a special way: + + + + + + + + . + + Matches any character + + + ^ + +Matches the beginning of a line + + + $ + + Matches the end of a line + + + \< + + Matches the beginning of a word + + + \> + + Matches the end of a word + + + ? + + The preceding item matches less than once + + + * + + The preceding item is matched zero or more times + + + + + + The preceding item is matched once or more times + + + {n} + + The preceding item is matched exactly n times + + + {n,} + + The preceding item is matched n or more times + + + {,n} + + The preceding item matches less than n times + + + {n,m} + + The preceding item matches at least n times but less +than m times + + + + + + + +Backreferences to bracketed subexpressions are also available by the notation +\n. + + + +For C++ programmers, as special bonus there are some search templates +available for typical patterns. These allow you to search for example +all calls of member functions of a certain object. + + + +Once you start the search by clicking on the Search +button, it will be performed by an external, asynchronous process. All found +items will appear in the view called Grep. You can then +jump to the found items by clicking on them. Note that grep scans the files +as they stored in the file system. If you have modified versions of them in +your editor, you may get some mismatches in the line number, or some found +items will be invalid. You can avoid this by saving all files beforehand. + + + + + + + + + +Code Completion + + +(... to be written ...) + + + + + + +Creating New Files and Classes + + +(... to be written ...) + + + +Editing the Templates + + +(... to be written ...) + + + + + + + diff --git a/doc/kdevelop/editor-ctags-lookup.png b/doc/kdevelop/editor-ctags-lookup.png new file mode 100644 index 00000000..f07a1348 Binary files /dev/null and b/doc/kdevelop/editor-ctags-lookup.png differ diff --git a/doc/kdevelop/editor-ctags-menu.png b/doc/kdevelop/editor-ctags-menu.png new file mode 100644 index 00000000..b128b69b Binary files /dev/null and b/doc/kdevelop/editor-ctags-menu.png differ diff --git a/doc/kdevelop/editor-ctags-regenerate.png b/doc/kdevelop/editor-ctags-regenerate.png new file mode 100644 index 00000000..b29cb352 Binary files /dev/null and b/doc/kdevelop/editor-ctags-regenerate.png differ diff --git a/doc/kdevelop/editor-find-menu.png b/doc/kdevelop/editor-find-menu.png new file mode 100644 index 00000000..e71c6d00 Binary files /dev/null and b/doc/kdevelop/editor-find-menu.png differ diff --git a/doc/kdevelop/editor-search-doc.png b/doc/kdevelop/editor-search-doc.png new file mode 100644 index 00000000..ad91da28 Binary files /dev/null and b/doc/kdevelop/editor-search-doc.png differ diff --git a/doc/kdevelop/editor-switch-header.png b/doc/kdevelop/editor-switch-header.png new file mode 100644 index 00000000..76d95c29 Binary files /dev/null and b/doc/kdevelop/editor-switch-header.png differ diff --git a/doc/kdevelop/empty-ide.png b/doc/kdevelop/empty-ide.png new file mode 100644 index 00000000..3cf19981 Binary files /dev/null and b/doc/kdevelop/empty-ide.png differ diff --git a/doc/kdevelop/file-browsers.docbook b/doc/kdevelop/file-browsers.docbook new file mode 100644 index 00000000..f8b37735 --- /dev/null +++ b/doc/kdevelop/file-browsers.docbook @@ -0,0 +1,79 @@ + +The File Browsers + + +On the left side of the main window, &kdevelop; can display various kinds of +lists and trees for the selection of files: + + + + +File Tree + + +This shows a tree view of the file hierarchy below the project directory. If +you click on a file, it is loaded into the editor. For files which do not +contain text, &kdevelop; starts an application that can handle the respective +MIME type. + + + +The file tree is regularly updated whenever something changes in the file +system. For example, if you create new files or directories (even outside +&kdevelop;), this is immediately reflected in the file list. On &Linux;, +this feature makes use of the FAM library. On other operating systems or over +NFS, the directories shown are polled in small intervals. + + + +The file tree hides files which are usually not interesting, like object +files. In the Project options under +File views, you can configure (as a comma separated +list of wildcards) which patterns are used to filter out irrelevant files. + + + +Furthermore, you can decide to restrict the file tree to show only files which +belong to the currently loaded project. This can be toggled by clicking with +the right mouse button on the root item of the tree. + + +
+A Screenshot of the File Tree + + +A Screenshot of the File Tree + +
+ +
+
+ +File Groups + + +This shows the files belonging to the project, grouped by their file name +extension. As in the file tree, you can edit a file by clicking on it +with the &LMB;. + + + +The groups shown in this view can be configured under +File views in the +Project options dialog. In order to customize the +view to your needs, it is helpful to understand how files are distributed on +the groups. For each file, &kdevelop; goes through all groups from top to +bottom. In each group, it looks whether the file name matches one of the +patterns. If there is a match, the file is shown in this group and the +iteration is aborted. This makes it clear that more general patterns should +be put below more specific ones. For example, an asterisk for the +Other group should be the last pattern. + + + + +
+ +
+ + diff --git a/doc/kdevelop/file-list-close-selected.png b/doc/kdevelop/file-list-close-selected.png new file mode 100644 index 00000000..18ff8b9b Binary files /dev/null and b/doc/kdevelop/file-list-close-selected.png differ diff --git a/doc/kdevelop/file-list-session-create.png b/doc/kdevelop/file-list-session-create.png new file mode 100644 index 00000000..a80fa37c Binary files /dev/null and b/doc/kdevelop/file-list-session-create.png differ diff --git a/doc/kdevelop/file-list-session-default.png b/doc/kdevelop/file-list-session-default.png new file mode 100644 index 00000000..1eaf565c Binary files /dev/null and b/doc/kdevelop/file-list-session-default.png differ diff --git a/doc/kdevelop/file-selector.png b/doc/kdevelop/file-selector.png new file mode 100644 index 00000000..8a357851 Binary files /dev/null and b/doc/kdevelop/file-selector.png differ diff --git a/doc/kdevelop/filetree.png b/doc/kdevelop/filetree.png new file mode 100644 index 00000000..1e731402 Binary files /dev/null and b/doc/kdevelop/filetree.png differ diff --git a/doc/kdevelop/find-in-files.png b/doc/kdevelop/find-in-files.png new file mode 100644 index 00000000..17dae505 Binary files /dev/null and b/doc/kdevelop/find-in-files.png differ diff --git a/doc/kdevelop/folded-tabs.png b/doc/kdevelop/folded-tabs.png new file mode 100644 index 00000000..1218421f Binary files /dev/null and b/doc/kdevelop/folded-tabs.png differ diff --git a/doc/kdevelop/getting-started.docbook b/doc/kdevelop/getting-started.docbook new file mode 100644 index 00000000..11a08253 --- /dev/null +++ b/doc/kdevelop/getting-started.docbook @@ -0,0 +1,3221 @@ + + + + + + + +BerndPol + + + + +Getting Started with &kdevelop; — a Guided Tour + +Now that you have got your new &kdevelop; &IDE;, how are you going to make +good use of it? As this is a complex application, the learning curve may be +somewhat steep, especially if you are not already used to this type of an +Integrated Development Environment. + +We will try to soften this learning curve a bit by stepping through the +makings of a simple KDE C++ application. Thereby we will have a (cursory) look +at: + + +A first look — the user +interface elements of the &kdevelop; &IDE;. +Doing some initial +configuration. +How to create a new project. + +Some tips about dealing with +documents. +How to compile the application in +this project. +How to add classes and other +detail to your project. +What to do to debug the +application. +Some basic tools to build program or +user documentation. +Last but not least, keyboard +shortcuts + + +Before we start, one important concept should be made clear. + + +What to expect? +As said, &kdevelop; is an Integrated Development +Environment. That means in essence that &kdevelop; is no development +tool by itself but rather a graphical front end to easily access a wide range of +development tools, many of which actually would require complex keyboard +commands run from a text console. + + +While &kdevelop; eases many of those programming tasks, much of the +complexity from this bundle of tools still remains which means that in order to +fully understand the &kdevelop; &IDE; you will still need to comprehend these +tools actually running beneath the surface. + +Hence, we cannot teach you how to build software, but rather introduce you +to some of the ways &kdevelop; was designed to ease such a software building +process. If you want to learn more about what an Integrated Development +Environment is meant for, you might want to have a look at the Development on &UNIX; historical overview and there +especially at the Integrating Concepts and +Tools chapter. + + +The following discussions apply to the default case, where &kdevelop; +starts up in the Simplified IDEAl Window Mode. If you +already did switch to another user interface mode some items may not be there as +described or will behave slightly different. If in doubt which user interface +mode your &kdevelop; currently uses, check with the +Settings Configure +KDevelop... User Interface +dialog. + + + +A Very First Look at &kdevelop; + +This is all about what you will see when you first started &kdevelop;. +You will find preliminary information about: + + +What is there on the +surface? +How to get some +help. +What is in the +menus? +What are those tool views +for? + + + +On the Surface + +When you start &kdevelop; for the first time you will get a display +similar to this one: + + + + + + + +The &kdevelop; initial layout +(Actually the initial &kdevelop; window will be larger, but the elements +you see are the same.) + + + + + +Workspace Area and Tool View Tabs +In this initial case &kdevelop; uses the so-called IDEAl user interface mode. A workspace area of +maximum possible size is surrounded left, bottom, and right by a series of +buttons which act similar to tabs on a tabbed display. If you click on one of +those tabs, a so-called tool view window will open which +allows you to work on a specific task. + + + +Menu and Toolbars +On top there is the usual menubar, followed by several rows of toolbars, +some being initially empty. They will get populated once there is a project open +for actual work. + + + +Status Bar +Finally, there is a status bar on the bottom of the window where short +informations on several tasks will be shown. + + + + +How to Get Some Help + +Besides the Help menu which offers answers to specific +questions, the status bar and two kinds of tool tips provide some quick +information. + + +What Does This Menu Entry Do? +When you place the mouse cursor on a menu entry, there will usually some +short information be displayed in the status bar. While in most cases this +repeats just the name of the selection, in some cases it will provide additional +information about the purpose of the menu command. + + + +What Is the Name of This Item? +On many items a short function name tool tip will pop up when you place +the cursor on it for a few seconds. This is useful for quick orientation on +toolbar or tool view tabs in IDEAl mode when the &IDE; has been set up to +display icons only on these buttons. + + + +What Does This Item Do? +More information is available through expanded tool tip help for many +items on the &IDE;. Select Help +What's This? or press +&Shift;F1, then with the +question mark cursor select the item you want to know more of. You can as well +open any menu this way and click on a specific menu entry (active as well as +greyed disabled ones) to see if more information is available. + + + + +What is in the menus? + +There are ten menus selectable on the menubar. Most of them get fully +populated once a project is open for actual work while others require at least +one document be open in an editor window. In short, they will allow the +following action types. + + +This is only a preliminary overview. For a detailed menu description see +the Command Reference. + + + + +File + + +Usual Actions +This is pretty standard. It allows to create, open, save, print, and close +document files as well as quitting the &kdevelop; application as usual. + + + +Revert All +This allows to revert all recent, yet unsaved changes by reloading the +file from the disk. This works on any file you edit, not only on those which are +part of a project. + + + + + +Edit + +This menu is useful only if a document is opened. + + +Usual Actions +It provides the usual undo/redo and cut/copy/paste actions. +Furthermore it allows to select text blocks in various ways. + + + +Search and Replace +There are two very powerful search facility available, +Edit Find in +Files..., and Edit +Find-Select-Replace.... These allow, in +addition to the usual search and replace actions limited to the the current +document, to conduct global search or search-and-replace actions in one single +turn. + + + +Advanced Text Edit +There are provisions to reformat the current document and to automatically +complete partially typed texts in various ways. + + + + + +View + +Like the Edit menu, this menu is useful only if there +is an open project. I this case there will be the following actions available +(amongst others): + + +Navigation History +Switch back and forth through the documents &etc; you visited. + + + +Error Tracking +Navigate to the source lines of the errors encountered in the most recent +compilation/build process. + + + +Editor Related Actions +Some entries in the View menu control the look and view +of the editor you use. In case of the &kate; Part (Embedded Advanced Text +Editor) there will be the following controls available: + + + + +Control the word wrap behavior in the document window. + + +Show or hide several border displays in the document windows: line +numbers, icons, and, additionally, bookmark marks in the scroll bar. + + +Control the display of folded (temporarily hidden) sections in a source +text. + + + + + + +Project + +All work of &kdevelop; is based on projects which +basically collect source files, build management files, and other information in +one project directory. In this menu you control which project to use, which +properties it has, and some other managing actions. +In particular: + + +Open a Project +Allows to create new projects, open existing ones, and import projects +from other environments. + + + +Project Options +Allows to define a whole bunch of different project properties. + + + +Classes Management +Add new classes to the project and traverse the inheritance tree of a +class. + + + +Distribute Project +Helps to build distribution packages of the project. + + + + + +Build + +This menu is all about compiling and documenting the project. Thus it is +of use only when a project is actually open. In this case it provides the +following actions: + + +Compile, Link, Execute +Allows to compile and link the whole project or parts of it as well as run +the application from within the &IDE;. + + + +Prepare Build Operations +This actually depends on the make system you use for this project. In the +case of automake projects it allows to run Makefile.cvs and +configure on their own. There are also provisions to remove +translated files from the project in various stages of intensity. + + + +Install the Application +Allows to install the application both in local directories as well as in +system directories only accessible to the root user. + + + +API Documentation +Build or remove a doxygen-based API documentation of the project as +defined in the project options. + + + + + +Debug + +Although this menu will be filled once a project is active, it of course +is useful only if the actual project has been previously compiled with debugging +information (this is basically set up in Project +Project Options..). There are the +following actions available in this case: + + +Usual Debugger Actions +The first section in the Debug provides a graphical +interface to the GDB &GNU; symbolic debugger. It allows to start and stop your +application in the debugger and step through it in various ways. + + + +Breakpoints +&kdevelop; provides several means to set breakpoints in your application +sources. One is through the use of the Toggle +Breakpoint menu entry. + + + +Advanced Debugging +Other Debug menu entries allow more sophisticated +program analysis. Use +&Shift;F1 to get more +information about their purpose. + + + + + +Scripts + +You can call various scripts from this menu to more easily accomplish +tedious actions on the text in the currently selected editor window. The +available actions depend on the selected script, however. + + + + + +Window + +This is fairly standard. You may select any open document window as well +as close one or more documents windows in here. You may even select a set of +document windows to be closed in one single turn. + +Depending on the editor plugin you use may there be other menu items as +well. So will the default Kate editor plugin additionally allow to split the +editor window horizontally as well as vertically. + + + + +Tools + +&kdevelop; is highly customizable. +You may select a favorite editor for your documents as well as provide external +and plugged-in tools to extend the basic &IDE; capabilities. The +Tools menu reflects most of this setup. + + +Advanced Editing +The upper set of Tools menu entries will be provided by +the editor plugin which is in use. You may select your favorite editor via +Settings Configure +KDevelop... Editor. Once an +editable document file is selected, the upper part of the +Tools menu will provide advanced editing commands specific to +the editor part in use. + + + +Web Side Handling +In case the active document window contains a HTML page (⪚ displayed +from a Documentation selection), the +Tools will show additional menu entries which provide various +means to handle Web pages. + + + +Other Tools +Usually there will be a bunch of other entries according to the currently +available tools. Use &Shift; +F1 to get more information about their +purposes. + + + + + +Settings + +This menu allows you to show and hide menubar, toolbars and statusbar. +Also, you can configure shortcuts, toolbars, notifications, the editor and +&kdevelop;'s general behavior. + + + + +Help + +Here you can open this KDevelop manual, look up terms in various +documentation files, open man pages (the traditional UNIX manual format) and +info pages (the GNU manual format). Furthermore you can report bugs here or get +some info about your current KDevelop version and its authors. + + + + + + +What are those tool views for? + +In the IDEAl user interface mode the workspace will be surrounded by three +areas of buttons, so-called tool view tabs. They provide +access to tool view windows which accomplish main tasks +during software development. Each of these three tool view areas serves a +different main purpose. + + + + +Left Side +Provides access to navigation and selection tools + + + + + +Bottom +These views display messages produced by various tools. + + + + + +Right Side +Provides access to documentation and source management tools. + + + + +The number of tool view tabs shown will change once a project is open for +actual work. More tools to work on that project will be available then. The +actual number of tool views depends on the Plugin +Tools being currently available to &kdevelop;. You will find more on this +topic in the Configuring KDevelop chapter. + +Currently, with no project open and the default number of plugin tools +loaded, you will find the following tool views. Clicking on a tab will open +respectively close its tool view window. + + + +Navigation and Selection + + +File Selector +Provides a panel to navigate the directory tree and select files for work +just like you do in the &konqueror;. Clicking a file will open it in an +appropriate editor window in the workspace area. A right click in the file +selector area will pop up a navigation and file manipulation menu. + + + +File List +Lists the currently open files. Clicking on a file will usually select its +editor window in the workspace area. Use this to quickly navigate in a large +number of open files. Furthermore this view provides a means to organize the +open files into different sessions. This is particularly +useful in very large and complex projects to help the developer concentrate on +different tasks. Right clicking a file will pop up a file manipulation +menu. + + + + + +Messages Displays + + +Application +Displays the output from an application started from within +&kdevelop;. + + + +Diff +Used to display patch file contents. +Displays the output from the difference viewer tool started from the +Tools Difference +Viewer... menu. + + + +Messages +Displays messages produced by the build tools called from within +&kdevelop;, usually from the Build menu. + + + +Find in Files +Displays the list of items found by the global search operation started +from the Edit Find in +Files... menu. Clicking on a line here will +automatically open that file at the specified position in an editor +window. + + + +Replace +Lists the results of the global search-and-replace operation issued from +the Edit +Find-Select-Replace... menu. In this +view you can decide on every found item whether you really want it be replaced +or not. + + +This global search-and-replace facility is actually available only after a +project has been loaded into &kdevelop;. Otherwise the global replace tool in +the Edit +Find-Select-Replace... menu will in +fact be be disabled. + + + +Konsole +Opens a &kde; Konsole like terminal emulator +window where you can use keyboard commands in a traditional &UNIX; command line +interface. + + + + + +Documentation and Source Manipulation + + +Documentation +&kdevelop; provides access to a whole bunch of documentation through this +tool. You may here access document files, usually online from remote locations, +in a structured way. And there are several ways available to directly access +valuable information from &kde; or &Qt; manuals. + + +See the Documentation and Configuring the Documentation chapters for more +details. + + +Code Snippets +This tool allows you to permanently store selected texts for later use in +other editing cycles. It is a very flexible tool, as any text snipped stored +here may contain a set of variables which will get their actual values at the +time when you insert such a snippet in some other text. + +More information on this is available in the Code Snippets and Setting Up the Code Snippets Tool +chapters. + + + + + + + +A Bit of Configuration + +Before we actually start a first example project, we should tailor the +&kdevelop; behavior to our needs. Although most of the default settings will be +appropriate for now, there are a few places which better should be +adjusted. + + +If you want to know more about &kdevelop; configuration, have a look at +the Configuring KDevelop chapter. + + + +Some General Settings + +To configure &kdevelop;, click the +Settings menu and select +Configure KDevelop.... The +Configure KDevelop dialog will pop up, showing the +following General settings page to the right. + + + + + + + +The &kdevelop; general configuration dialog + + + + +Most of the defaults will be o.k. +But you will probably want to change two of those settings. + + +Default projects directory +At first start of &kdevelop; this will most likely be preset to your home +directory. Most people however prefer a dedicated projects directory for +software development. Change the text box to your preferred parent development +directory. You may select it from the directory tree if you press the +Open file dialog button labeled with a folder icon to the +right of it. + + +In our examples we will assume a (somewhat artificial) user called +devel. +Thus always replace this devel by your user name. Our devel user +will utilize the /home/devel/projects +parent directory for actual development. Again, replace projects with your development directory name. + + +&kdevelop; will by default set up an own subdirectory below this parent +for every new project you create. So will ⪚ all files of a project named +Hello in our case be located in the /home/devel/projects/hello directory. + +You may of course temporarily override these directory settings if you +need to. See the &appwizard; chapter +for more info on this. + + +Compiler output +Whenever &kdevelop; compiles some source, it will display the messages of +the make, etc. build tools in the +Messages window in the lower part of the workspace area. +Usually these messages will be overwhelmingly wordy. To keep a better overview +of what happens, &kdevelop; has some means of shortening those messages built +in. + + +Depending on the &kdevelop; version you use, the Compiler +output selection may be preset to Long, which will +cause all message contents be fully shown. You may probably want to change this +to the far more convenient Very Short setting. Just select this +from the drop down box. + + +Be aware that only most basic information will be +shown in the Messages window this way. In case of errors +during ⪚ a build run you will most likely want to see more, if not all, of +the message texts. They are not lost, however. Just right click into the +Messages window and select ⪚ Full Compiler +Output from the popup menu. + + + + +Initializing Documentation Search Indexes + +There is another, not so obvious, item which preferably should be +initialized before you start actual development work. This is because you will +want to perform documentation search regularly during development. &kdevelop; +requires some search indexes be created before such search operations can be +performed. So let's initialize them before we attempt our first steps +toward actual &kdevelop; work. + +Open the Documentation tool view at the right side of +the &kdevelop; main window. There open the Search dialog +page. + + + + + + +Where to generate the search indexes. + + + +Now press the Update Config button to make sure the +basic search tools are properly set up. A dialog should pop up, telling +Configuration file updated. Click OK to +make it disappear. + +This done, &kdevelop; will be ready to parse the documentation it knows of +and build some useful search indexes from it. Press the Update +Index button to the right. Now the Generating Search +Index dialog will pop up showing the progress of the index build +operations. + + + + + + +&kdevelop; is generating documentation search +indexes. + + + +This will take some time depending on the size of documentation and the +speed of your machine. But finally the Cancel will make +place to OK. Just press this button to proceed. + + + + +This usually should work out of the box. In some cases the +htdig application &kdevelop; uses to perform its full +text searches might not be properly set up. Refer to the Setting Up Text Search Indexes chapter +for more help in this case. + + +To be able to look up &kde; and &Qt; specific API documentation, it is +mandatory that the KDELibs Apidocs were present when +&kdevelop; was installed. If you experience problems building the indexes or +perform the identifier lookup +examples later in this chapter, make sure that this documentation exists +and is accessible to &kdevelop;. See Installing +KDevelop fore more detail. + + + + + + + + +Starting a New Project + +Almost any application will consist of dozens, hundreds, even thousands of +files which need kept structured and maintainable. To accomplish this, +&kdevelop; organizes software development tasks in +projects. Thus the first practical step to develop software +in &kdevelop; usually is to create a new project. + +Fortunately this is fairly easily accomplished. &kdevelop; provides the +so-called &appwizard; tool for this. (See the Getting Started — the &appwizard; +chapter for more.) + +We will now start a simple &kde; application project to illustrate how +easily this is accomplished and which files and tools &kdevelop; will have +provided. Thereby we will have a short look at: + + +How to create a new project +with the help of the &appwizard;. +Which files the &appwizard; +initially did set up. +What about the additional +tool view shown with the project? + + + +How to Create a New Project + +Let us create a rather simple Hello World &kde; project. +Just follow these steps. + + + +To start the &appwizard; click the Project +New Project... menu. + + + +The Create New Project dialog will pop up. In the +upper left All Projects window there will be a number of +programming languages listed. + + + +We want to build a &kde; C++ application as usual, thus click on the ++ label left of the C++ label to open +this branch. + + + +A series of possible application targets will be displayed. We will build +a &kde; application, thus open the next sub-branch via the ++ label next to KDE + + + +Now you will be offered a series of possible project +templates. Navigate down to the end of this branch and click +Simple KDE Application. + +A preview and short description of the application this project template +will produce pops up in the two windows to the right. + + + + + + + +Selecting a Hello World project template + + + + + +Our application will need a name. Find the Properties +area on the dialog bottom and enter a suitable name into the +Application name input field. + +We use Hello in our example, but you can use whatever you +like, provided the name consists of letters, number digits, and underlines only. +You will find that the &appwizard; rejects any other character. + + + +Make sure the Location text box below the input field +shows the name of your top project directory as set up in the A Bit of Configuration chapter above. +If it does not do so, enter a suitable directory name or select one from the +directory list provided by the folder labeled button to the right. + +If all went well, the Final location line at the +bottom will show the directory path your new project will use. In case there was +an (invalid) suffix appended, try another name for your project +and/or make sure the top project directory in the Location +text box really exists and is writable. + + + +Once everything is right, the Next button in the +bottom row of the dialog will be enabled. Click it to proceed. + + + + + +This will lead you to the Project Options dialog +page. Make sure the Author and Email +text boxes are properly filled in. Usually they will default to your general +&kde; user settings as given in the Password & User +Account dialog of the &kde; Control Center. If not, change them to +some settings you prefer for your application. + + + + + + + +Provide your name and (optionally) email address. + + + + + +You must provide an Author name at least. This is +mandatory for the application files setup. + + +If all is right, the Next button will be enabled. +Click it to further proceed. + + + +The following Version Control System, +Template for .h Files, and Template for .cpp +Files dialog pages are not of interest for now. Skip them by clicking +the Next buttons and, finally, the +Finish button. + + + +That was all! +The &appwizard; will take over and construct a series of initial files in the +Final location directory you provided in step 2c +above. + +Once this file creation phase is finished, &kdevelop; will open an editor +window for the application main window implementation file +(which is hello.cpp in our example), so you can readily +proceed. + + + +Initial Project Files + +Even if our sample Hello project is fairly simple, the &appwizard; did +create a whole bunch of source and project management files. You will most +easily list them if you open the File Tree tool view on the +bottom left. This will open a file list similar to the one below. + + + + + + + +Initial files in our Hello World project + + + + +To demonstrate the main bunch of files the &appwizard; produced, we did +open most of the directory branches in the left-hand File +Tree tool view window. Just click the branch names in the tree to see +for yourself. + +Additionally, just for demonstration, we did as well open most of the +branches the Automake Manager tool view window to the right +where some of the project sources are listed, too. + + +Copyright Issues + +All &GNU; conformant applications must be copyrighted. There are two +levels which require copyright notices, individual source +files and run-time application level. The +&appwizard; did already put appropriate copyright and licensing information into +the project files. + + +Source File Level Copyrights +Do you remember the +Project Options dialog page in the new project +setup? You had to provide your (the developer's) name and optionally an +email address there. Now refer to the top of the hello.cpp +editor window currently displayed in the workspace area. The &appwizard; did +enter these statements on top of the licensing header of every source file it +created. + + + +/*************************************************************************** + * Copyright (C) 2006 by Joe User * + * joe@user.com * + * * + * This program is free software; you can redistribute it and/or modify * + + +You will find exactly the same text headers in every source file you will +create inside &kdevelop; (provided you use the proper built in tools for file +creation). &kdevelop; remembers these settings in some template files you may +find in the templates directory. + + +Application Run-Time Copyrights +Once your &kde; application runs, the user may display some +About data, usually from the Help menu. +The &appwizard; did also take care of this. If you have a look at the +main.cpp file, you will find an entry similar to the one +below. + + + +int main(int argc, char **argv) +{ + KAboutData about("hello", I18N_NOOP("Hello"), version, description, + KAboutData::License_GPL, "(C) 2006 Joe User", 0, 0, + "joe@user.com"); + about.addAuthor( "Joe User", 0, "joe@user.com" ); + + +This will put the main developer's name (Joe User in +our case) and email address into the About copyright page +in the display and list this name and address on the +Authors page there as well. + + +Whenever you make substantial changes to an existing project, be sure to +enter your name and email address to the copyright notices on every file you +changed and to the run-time copyright display as well. Don't be shy, you +help the open source society considerably if you do so. + + + + +Initial Source Files + +The &appwizard; did put the source files into the src sub-directory of the project's directory. +You will find the main.cpp, hello.h, +and hello.cpp files there as you may have possibly +expected. + +There are some additional files you usually will find in a typical &kde; +application, namely + + + +hello.desktop contains some meta data used by +&kdevelop; to maintain and start the application. + + + +hi16-app-hello.png, and +hi32-app-hello.png contain some initial default icons, +&kdevelop; will use for application display. + + + +Finally, helloui.rc contains a description of the +application's user interface, currently the menus the application will +provide. + + + + + +Initial Application Documentation + +In the doc/en subdirectory of the +project you will find the index.docbook file. This is a +default template from where you can start to write a suitable user +documentation. + + + +Project and Auxiliary Files + +You will have noted that the files we introduced so far are listed in +boldface in the File Tree tool view while most of the other +files are not. This depicts the substantially different tasks these files are +used for. The contents of those bold listed files directly influence the +application. Source files will produce the code to be run, others will provide +necessary data or documentation. These files must be maintained and orderly +processed in the build stages by the project, hence they are called +project files. + +If you have a look at the lower Automake Manager +window to the right of the workspace area you will find all project files listed +as well. The &automanag; tool uses this knowledge to take care of the build +control as we shortly will see. + +The other, non-bold listed files are of more auxiliary nature. They belong +to several distinctive classes as follows: + + + + +Project Build Control +These files control the compile, install, documentation building, &etc; +processes. If the project utilizes the &GNU; +autotools machinery as our example does, you will +find a Makefile.am file in each project directory. These +are kind of basic make core files which contain build control commands and will +be processed in conjunction with various configure files +during the build stages. Such a build produces a final +Makefile in every directory. And from these in turn the +make utility will finally build the binaries of the +application. + + +Those Makefile.am files need to be maintained +throughout the development process. Luckily, &kdevelop; relieves you of most of +this burden by the &automanag; tool, which basically is a graphical front end to +maintain Makefile.am contents. + +Other project build control files currently listed are +configure.in.in and subdirs in the +project root directory. They will be processed by some of the files in the +admin &kde; specific administration +directory to produce more configure and +Makefile type files and finally the application's +binaries. + + + + +&kdevelop; Control Files +&kdevelop; needs some control and administration data on its own. These +are located in the project root directory, in our example +hello.kdevelop, hello.kdevelop.pcs, +and hello.kdevses. + + +Of particular importance in each project is the +xxx.kdevelop (where xxx denotes the project +name) file. It is the main KDevelop 3 Project File and +needed if you later want load this project into the &IDE;. + + +Never do manually modify, rename, or even delete any of these &kdevelop; +control files! The &IDE; will most likely not function properly on your project +afterwards. + + + + + +GNU Project Description Files +Some files in the project root directory are mandatory in any &GNU; +conformant application. These are: AUTHORS, +ChangeLog, INSTALL, +COPYING (which contains the GNU GENERAL PUBLIC LICENSE), +INSTALL, NEWS, +README, and TODO. + + + + + +Other Files +A few more files, not mentioned yet, are: + + + + +Doxyfile controls the creation of the project +specific &API; internal programming interface documentation. + + + +The templates directory containes +file templates the &IDE; uses as stubs to create new source files. +You may at any time edit these templates. The new contents will be reflected in +the next source files you create of the related types. + +You may ⪚ want to realign the right hand stars in the copyright lines +the &appwizard; inserted into the cpp and +h template files, so the source files created from them +will look less awkward. + + + +The po directory will be used for +localization purposes. It is essentially part of the project files (contains a +Makefile.am) but will mainly be used in translation +processing. Not of main interest to the application developer, however. + + + +Finally, the admin directory is +specially needed in &kde; oriented applications. It provides a whole bunch of +files necessary to maintain the application's sources and binaries so they +will integrate properly into the &kde; environment. + + + + + + + + + +Additional Tool Views + +As you will have noticed, as soon as the &appwizard; had the new project +ready, several additional tool views were provided. These make sense during +project development only and, in short, provide the following +functionality. + + +The tool views actually visible depend on the plugins currently loaded +into &kdevelop;. There are ways to control this. See the Plugin Tools chapter for instructions. + + + +Navigation and Selection Tools (left side) + + + + +Bookmarks +You can mark any text file line in order to quickly return to this +position from everywhere. &kdevelop; will remember all those +bookmarks, even if you close the editor window afterwards. +The Bookmarks tool view lists all those bookmarks by file +name and line number. You need only click such an entry to open the editor +window accordingly and position the cursor on that line. + + + + + +Classes +Lists classes, methods, &etc; known in the project. Clicking the entry +opens the appropriate header or source file in an editor window and positions +the cursor at the respective declaration or definition. + + + + + +File Groups +Sorts the files in the projects into various utility groups, &ie; Sources, +User Interface, Icons, Translations, and Others. Clicking an entry opens that +file in an editor window. + + + + + +Variables +This is used by the debugger tool to display, evaluate, and watch +variables during debug runs. + + + + + + +Messages (bottom) + + + + +Valgrind +Valgrind is a run-time program analyzer. This +tool view lists the results of such an analyze run. It is used ⪚ to find +memory leaks. + + + + + +Security Problems +There is a Security Checker plugin tool for +&kdevelop;. It analyzes the currently edited source file for several common +security problems which may occur in the application and notifies the user in +this tool view window. + + + + + +Breakpoints +This tool view allows to explicitly set, clear, and manage debug +breakpoints in the application source files. It is used in conjunction with the +debugger. + + + + + +CTags +Allows to create a database of identifier indexes using the popular +CTags application. This tags database may then be +used from out this tool view window to look up any needed identifier in the +project sources. Clicking a thus found item line will open an editor window and +position the cursor on the appropriate identifier there. + + + + + +Problems +&kdevelop; keeps track of common programming problems in the currently +edited source file and notifies the user in this tool view window. + + + + + + +Source Management (right side) + + + + +Automake Manager +The &automanag; tool is basically a graphical front end to maintain the +contents of the Makefile.am files located in each project +directory. This tool view uses two windows to control its work. The upper window +mirrors part of the project subdirectories, namely those which explicitly +contain project files. Each subdirectory of this kind must +contain a Makefile.am file and is termed a +subproject in the &automanag; context. + + +Clicking a subproject entry opens a suitable display of the project files +in this subproject in the lower window. The files listed there will be grouped +according to their Makefile.am functionality in this +subproject. + +The &automanag; is a very powerful tool to manage the project and its +subprojects as well as the roles project files play in building the application. +We will have a short look at a few major details below. See the Building and Project Management chapter for +a more extensive description. + + + + + + + + +Some Tips About Dealing With Documents + +In our example project the &appwizard; did leave the +hello.cpp file open in an editor window, so you can +immediately start working. Now, we may well assume your are knowledgeable about +using an editor, so we do not need talk much about this here. But there are some +handy &kdevelop; specifics about dealing with such tabbed editor windows and the +documents you are working on. We will have a short look at some of them, +namely: + + +How to easily switch between +header and implementation files. +How to quickly access +declarations and definitions. +How to arrange editor +windows to your current needs. +How to keep an eye on +common problems. + + + +Switching Between Header and Implementation Files + +&kdevelop; provides a quick and easy way to switch from a given +implementation (.cpp) file to the corresponding header +(.h) file and vice versa. Just right click into the editor +window you want to switch. A menu similar to the following will pop up. + + + + + + +How to switch between implementation and header +files. + + + +Find the Switch header/implementation entry and +select it. &kdevelop; will look up the corresponding header or implementation +file and open it in another editor window. In our example, if you did right +click into the hello.cpp source, the +hello.h file will be displayed and the cursor positioned +there. + +There is even more. If you do right click inside the text of a class +implementation, &kdevelop; will position the cursor on the corresponding +declaration line in the header file. And vice versa, right clicking on a +declaration line will bring you to the corresponding class +implementation. + +If the editor window with the file to be switched to already exists, +&kdevelop; will of course activate this one and reposition the cursor there if +necessary. + + + +How to Access Declarations and Definitions + +But what if you are working on a source file and want to look up the +declaration or definition of an identifier you just found there? Well, this is +equally easily accomplished. Basically all you need to do is to right click on +the identifier in question. + +There are two different cases to consider, however, namely: + +Accessing externally +defined identifiers, and +dealing with project +internal text items. + + + +External Declarations and Definitions + +In a most common case you want to look up an identifier which was defined +externally to your project. In &kde; projects such identifiers are most likely +documented in various &kde; or &Qt; libraries. If &kde; and &kdevelop; were +properly installed, &kdevelop; will be able to access such so-called API +documentation and be able to search it for identifiers of this kind. + +Let us look at an example. In the hello.cpp editor +window find the following lines. + + +Hello::Hello() + : KMainWindow( 0, "Hello" ) +{ + + +Right click on KMainWindow. +A menu will pop up. There select the Search in Documentation: +KMainWindow entry and release the mouse button. Now the +Documentation tool view will open, showing the +KMainWindow entry as search item on the +Search sub-page. And a short while after another editor +window will open in the workspace area, showing the KDE API Reference page of +the KMainWindow class. + +This all will look like the following. (We deliberately opened the +Documentation, Search page already to +illustrate the result of the menu selection.) + + + + + + +How to look up an externally documented +identifier. + + + +You might as well select Find Documentation: +KMainWindow. In this case the Finder sub-page +of the Documentation tool view will show up, usually +providing a selection of pages containing the search term. (In our example this +will probably be the KMainWindow and +KMainWindowInterface classes. Select the one you are +interested in and the corresponding documentation will be displayed in an editor +window. + + +If this did not work, then there is probably no documents index yet. Did +you initialize the indexes as shown above? If not, please do so, +then come back here and try again. + + + + +Project Internal Declarations and Definitions + +Such search facilities in external documentation have their limitations, +however. Of course one cannot look up an identifier externally if it is only +defined and used inside the current project. But there is help. &kdevelop; can +use indexes built by the CTags application to search +the sources in your project. + +Before we can use this on our Hello example project, we must however first +generate a suitable index. This is done by the CTags tool +view at the bottom of the workspace area. + +When you click the CTags tab, a dialog window will +open where you will find the following key in the lower right corner. + + + + + + +Build a CTags index with the Regenerate +key. + + + +Press the Regenerate button and wait a few seconds. +Then the No CTags Database Found will be replaced by the +current date. Now you are ready to perform some identifier look ups in your +project source. + + +The date next to the Regenerate button is there to +remind you of possibly too old indexes. Whenever you are obviously not able to +look up some identifier in your project, consider regenerating the index. On +large projects this might take considerable time, but you should make it a habit +to regenerate the index regularly after extensive source file changes. + + +To look up an identifier in your project sources there are several +possibilities. + + + + +Use the CTags tool view +This is easy. +Just start typing the identifier name you are interested in into the +Lookup input field in the bottom left. &kdevelop; will try +to complete the word you have typed so far and show all occurrences of those +identifiers which start with this character sequence. + + +If for example you want to know wherever the Hello +identifier was used in our example project, type an "H" into the +Lookup input field. &kdevelop; will immediately start +working and present you a result like this: + + + + + + +How to look up an identifier in the CTags +tool view. + + + +If you click one of the listed entries, &kdevelop; will open an editor +window with this file and position the cursor on the appropriate place. + + + + +Use a context menu in a source file +This is handy while you are working on a certain source file. +Assume you are studying the main.cpp file of our Hello +example project. There you find the following line + + + Hello *mainWin = 0; + +and wonder whatever the Hello was used for in the program. +To find out, simply right click on this Hello identifier. A menu will pop up in +response to this right mouse click, featuring the following lines near the +bottom. + + + + + + +Getting CTags information on a project +internal identifier. + + + +Click what you are interested in, say CTags - Go to Definition: +Hello, and &kdevelop; will immediately open the +hello.cpp editor window and position the cursor right in +front of this class definition: + +Hello::Hello() + : KMainWindow( 0, "Hello" ) +{ + + + + + +Do a global search +This is especially useful if you want to look up arbitrary text in your +project source. There are two possibilities to start a global search from within +&kdevelop;. + + + +Start a global search from the Edit +Find in Files... menu. +Or + + +Directly make use of the context menu with a right mouse click in the +editor window. + + + +We will illustrate the second possibility on our Hello example project. +The outcome of the menu call will essentially be the same. Let us assume you are +studying the hello.cpp source file and have the cursor +positioned on the first Hello occurrence there. Now you wonder, where this one +word Hello was used in the project source and how many +occurrences there are. This is a typical case where to use &kdevelop;'s +global search facilities. + +Now, still keeping the cursor somewhere on this Hello in +the source text, click the right mouse button. The now well known context menu +will pop up, where you should select the Grep: Hello +line. + + + + + + +Initiating a global search from within an editor +window. + + + +This will pop up the following Find in Files dialog +(exactly the same as if you did use the Edit +Find in Files... menu). + + + + + + +A versatile graphical front end to perform global searches in the +project. + + + +As you see, this is a very versatile tool to initiate +find-and-grep searches +throughout your project. We won't delve further into details here, but you +may want to experiment with this facility on your own. For the moment, there +should be our Hello be preselected in the +Pattern field. If it is not, just type it in, then press +the Search button at the bottom right. + +Now the Find in Files tool view will open at the +bottom, showing you file names and lines of all literal occurrences of +Hello in our example project. As usual, if you click an entry, +&kdevelop; will get you to exactly that position in an editor window in the +workspace area. + +There are two lines of special interest in the tool view window. + + +Right on top you will find the command sequences &kdevelop; did actually +use to perform the search. This will be useful to more precisely control the +search outcome. + + + +On bottom the number of occurrences found in these search run will be +listed. In our example this should read *** 11 matches found +***. + + + +&kdevelop; will remember these search results throughout the currently +running session. If you initiate another global search, its results will display +in another tabbed window in the Find in Files tool view +window. + + + + + + +Arranging Editor Windows + +When your work with large complex projects you will often end up with +quite a lot of tabbed editor windows residing on the tab bar. This makes +specific facilities to clean up, order, and group all those editor tabs +necessary. &kdevelop; provides several means for this. We will have a short look +at some of them. + +How to remove unneeded +tabs. +How to rearrange the +tabs. +How to view several +files simultaneously in the workspace area. +How to edit +C++ source and header files simultaneously +How to group source +files into development sessions. + + + +Cleaning up the Tabs Row + +If the vast amount of editor window tabs becomes badly arranged at all, +you usually may want to close all those tabs you really do not need any more. +&kdevelop; provides several facilities to do so, the usual way of bulk closing +open editor windows and a more specific approach where you can expressly command +which ones to close and which to keep open. + + +Closing Several Tabs At Once +This is kind of a bulk approach to close unnecessarily open tabs which you +may find in other &kde; applications as well. You can use the +Window menu or right click on a tab to either + + + +close the currently selected editor window, + + +close all other open editor windows, or + + +close all editor windows at once (available from the +Window menu only). + + + + +Closing Selected Sets of Tabs +The step-by-step approach of closing individual editor window tabs can +become awkward if there are a great number of tabs from which you want to still +keep several open. Instead of searching and closing one editor window tab after +another &kdevelop; provides a means to select the candidates from a list and +close those, and only those, with one single mouse click. + + +Let us illustrate this on a simple example. +In our Hello example project let us assume there were several files open for +edit: hello.cpp, hello.h, +helloui.rc, hello.desktop, and +main.cpp. Now you want to close all of them except +hello.cpp and hello.h. The easiest way +to do so is with the File List tool view. Because this list +of open files is alphabetically ordered you can more easily find the ones you +want to be closed. Proceed as follows: + + + +Open File List and, with the Ctrl +key held down, click the files you want to be closed in the list. + + +Then, keeping the mouse pointer on a file name in the list, click the +right mouse button. + + +From the File List popup menu select Close +Selected. + + + + + + + + +How to close selected editor windows in one +step. + + +That was all. +&kdevelop; will have closed all editor windows at your wish, and you are ready +to proceed with a clean tab bar again. + + + +How to Rearrange Edit Window Tabs + +Even if you have only the really necessary editor windows open you may +still want to have their tabs arranged in some logical way. &kdevelop; provides +some common means to do so, in short: + + +Basic Setup — Where to Position New Tabs + +By default, when you open a new editor window, its tab will be inserted to +the right of the editor window tab currently in use. This can be changed so that +the new tab will open to the far right on the tab bar. + +You must change a basic user interface setting in &kdevelop; to enable +this behavior. + + +Select Settings Configure +KDevelop... + + +In the left hand icon bar on the dialog popup click the User +Interface icon. The User Interface dialog page +will be now shown. + + +In the left bottom corner there find the section labeled Tabbed +Browsing. Remove the check mark on the Open new tab after +current tab line. + + +Close &kdevelop; and restart it again. Now the new editor window tabs will +open at the far right end of the current tabs row. + + + +Unfortunately, this setting cannot be changed on the fly during a +development session. You must make up your mind which behavior you prefer in the +long run and then stick to it, at least until the next start of +&kdevelop;. + + +How to Rearrange the Tabs +As development tasks do vary over time, the need to rearrange the tabbed +editor windows will more or less often arise. This is easily accomplished in +&kdevelop;. + + +Just click the tab you want to move with the middle mouse button and move the +mouse a short distance. The cursor will change to a crossed-arrow pattern. You +can now drag this tab, holding the middle mouse button down, until it did skip +into the place where you want it to be. + + + +Viewing Several Files Simultaneously + +At first sight there is always at most one single editor window open to +work on a source file. Although you may fast switch the tabbed windows, there +are times where you want have several files open at once, ⪚ for reference +purposes or to keep complex tasks under better control. To accomplish this, +&kdevelop; provides a way to split the workspace area into different, +simultaneously visible sections which each can hold their own series of tabbed +windows. + +There are two split commands which you can reach either through the +Window menu or by right clicking either into a tabbed window +or on the window tab itself. We will illustrate this splitting behavior again +with our Hello example project. + +Assume there are two source files open on the tab bar, +hello.cpp and hello.h. Now, while +working on the hello.cpp source, you often need to refer to +the declarations in the hello.h headers file, so you want +to keep both files open simultaneously. + +To get this done, right click on the tab of, say, +hello.h. The following menu will then pop up. + + + + + + +How to split the current workspace area into two +parts. + + + +Select the Split Horizontal entry. This will +split the current workspace area in the middle and move the tabbed editor window +holding the hello.h file into the lower part. + + + + + + +The workspace has been split horizontally. + + + +Note the dotted separator line between both windows. You can grab it with +the mouse and adjust the heights of the editor windows according to your +needs. + +There are a few points to note. + + +The split workspace areas are fully functional at their own. This means, +new tabbed windows will open in the workspace which contains the currently +active editor window. And you can split any sub-area again to your wish, thus +keeping as much windows open simultaneously as you need. + + + +Any split will move the currently active editor window into the new +workspace sub-area, either downward or to the right. The other tabbed windows +all remain where they were. You cannot directly move tabbed windows between +split areas, instead you need to explicitly close the window in one workspace +area and reopen it in another to regroup. + + + +Also, there is no direct way to close a split area again. +It closes automatically, once the last tabbed window in it was closed. + + + + + +Edit C++ Source and Header Files Simultaneously + +There is a neat application of the above mentioned workspace split +feature built into &kdevelop;. It allows to automatically keep a +.cpp source and its accompanying +.h header file side by side open in the workspace area. +And, optionally, it allows to work on both files synchronously, such that if +you select a declaration in the header file &kdevelop; will navigate to the +respective definition in the source file and vice versa. + +This feature is however deactivated by default. If you want to use it in +your project you need to activate it. + +Select Project +Project Options. The +Project Options dialog will pop up. In the left hand icon +bar there select C++ Support and subsequently the +Navigation tab on the dialog page which will display on +the right side. + + + + + + +Have C++ source and header files be displayed side by +side. + + + +Now check the Enable split of Header/Source files +box. This will enable Automatic Synchronize +and Vertical by default. Keep these settings for now and +press OK. + +To illustrate this feature, now close in our example Hello project +both the hello.cpp and hello.h editor +windows, if necessary. Then select hello.cpp again from the +src subdirectory of the project. The +editor window will open as usual. But if you now open the +hello.h belonging to it, &kdevelop; will automatically +split the workspace and open this header file editor window just beneath the +hello.cpp window. + +There is even more, as we mentioned already. In the +hello.cpp editor find ⪚ this constructor definition +line: + +Hello::Hello() + +and put the cursor there. Then look at the hello.h +window below and note how &kdevelop; did navigate to the corresponding default +constructor declaration line. + + + + + + +&kdevelop; automatically navigated to the constructor +declaration. + + + +This works vice versa as well. Whenever you put the cursor somewhere into +a construct in one editor window, &kdevelop; will navigate to the corresponding +construct in the other. + + + +Grouping Source Files Into Development Sessions + +When your project grows larger, and the development tasks become more and +more complex and force you to often switch between different, even distinct sets +of files, it is about time to organize your development work into distinct +sessions. The File List tool view of &kdevelop; allows you +do to just this. + +On top of the File List tool view window there is a +tool bar where you can create, save, select, and remove such sessions. Or +alternatively use the View View +Sessions sub-menu. + +We will illustrate this facility again with our Hello example project. +Assume you want to always open the hello.cpp, +hello.h, and main.cpp files all in one +step, no matter what development task you just did perform in the project. To +accomplish this, you first need to create a new development session named, say, +sources. + + + + + + +Use development sessions to remember groups of +files. + + + +This is a multiple step approach as follows. + + +Create a new session + + +Click the New Session icon top left in the +File List tool view window. + + +A dialog will pop up. In the Enter the name of the +session input field give your new session a name, ⪚ +sources. + + +Close the dialog with OK. The new session will now +be listed in the drop down box on the toolbar. + + + + +This new session will initially be empty. You must populate it with the +files you want to be kept there. + + +Open all files you want to be grouped in this development session. In our +example we decided to keep hello.cpp, +hello.h, and main.cpp there as +planned. + + +Once your file list is complete, click the Save Session +icon in the toolbar. Do not skip this step, &kdevelop; will forget the file list +otherwise. + + + + + +That was it. Whenever you select the sources session +from the Open Session drop down box, &kdevelop; will close +all currently open editor windows and open the remembered ones +(hello.cpp, hello.h, and +main.cpp in our example) instead. + +You can define as many sessions as you wish in the context of your +project. If you want to change the session's contents, just update the +remembered file list with a Save Session click. And if you +want get rid of a session, select it in the drop down box, then click the +Delete Session icon in the toolbar right. + +There is even more. You can force &kdevelop; to open a given session by +default when it loads the project. Just select the session in the drop down box +on the Projects Project +Options File List project +options configuration page. + + + + + + +Let &kdevelop; open a specific session when the project is +loaded. + + + + + + +Keeping an Eye on Common Problems + +When you open an editor window containing a source file, &kdevelop; will +parse its contents. This allows the built in problem +reporter to scan the source text for some common errors it knows of. +And it can alert the user of different places which have been marked for special +treatment. + +Let us illustrate this facility with our Hello example project. + + + +Open an editor window with the main.cpp source +file. + + + +Make sure it still contains the following line somewhere towards the +end: + + /// @todo do something with the command line args here + +This was inserted by the &appwizard; when you created the Hello project in +the Starting a New Project chapter +above. + + + +Now open the Problems tool view in the bottom tabs +row. If all went right, it will currently report this todo: + + + + + +&kdevelop; is alerting a source code line containing a todo +mark. + + + + + +The format of the /// @todo command is +for special treatment by the Doxygen code documenter, +which we will look at briefly in the Documentation section below. It is not +mandatory that you use this format, the more common +TODO and FIXME +comment marks will be recognized as well. + +If you ⪚ insert the following TODO and +FIXME comment lines in our +hello.cpp example file + +Hello::Hello() + : KMainWindow( 0, "Hello" ) +{ + // set the shell's ui resource file + // TODO check the user interface + setXMLFile("helloui.rc"); + + // FIXME change to a better suited greeting + new QLabel( "Hello World", this, "hello label" ); +} + +you will find them listed in the Problems tool view +as well: + + + + + + +The problem reporter listing lines which require attention in the +currently edited file. + + + +Note the other tabs in the Problem reporter tool view +window, especially Fixme, and Todo. If +you open them, you will find all FIXME and +TODO marked lines, &kdevelop; has found so far +in this session. For example the TODO alerts +will currently look thus: + + + + + + +The problem reporter has collected the +TODO alerts. + + + +The Errors tab will however not list every coding +error you make. This is the job of other tools in ⪚ the build process. But +you will find here alerts of some common programming mistakes which would likely +go unnoticed otherwise and probably be catched with difficulties during complex +debugging session. + +You will find the &kdevelop; problem reporter facility a very valuable +tool, so check the Problems tool view regularly in the +development process. + + + + +How to Compile a Project + +Compiling a project in &kdevelop; requires several setup steps and then +building the application. All these are available through the +Build menu. + + + + + + +Building a project requires several steps. + + + +We are interested for now in the upper section only of this menu. The +entries there are sorted in order of their importance. Thus the most often +needed command is on top, the Build Project entry, +which will cause all of the project be initialized, compiled and linked as +needed. Other entries are there to compile selected project portions or a single +file only, to perform several initialization sequences, or to install the +completed application binaries. + +For now we will concentrate on several facilities which &kdevelop; +provides for project setup, initializing, building, and running an application. +In general, this includes: + + +Looking briefly at the +basic build cycle. +Looking at some basic +means to configure a project. + + + +The Basic Build Cycle + +Once you created a new project you usually want to check if everything +went right so far. This implies a first build and test run of the application, +which we will do now. In order to initially compile a project there are several +steps to perform, which we will briefly look at. + +How to initialize the +project for a first build. +How to do the +initial configuration. +How to build the +project. +How to run the +application from within &kdevelop;. + + + +This discussion implies that your project is based on the &GNU; autotools, +which enabled the &automanag; tool in &kdevelop; as our example Hello project +does. If you created another type project, ⪚ for the &Qt; based +QMake project manager, there will be other facilities +available in the menus or perhaps even none of them. You will have to consult +the respective vendor documentation on project management and application +building in these cases. + + + +Initialize the Project for the Build + +When the &appwizard; created our Hello example project, it left it in a +sort of raw, virgin state. The &GNU; autotools chain dictates +several initialization steps to be performed before the application could be +actually compiled and linked. If you try to build a project in such a raw state, +⪚ by selecting the Build Build +Project menu or pressing the F8 +function key, you will get the following warning. + + + + + + +Trying to build a raw automake based project. + + + +You may press the Run Them button in which case +&kdevelop; will try to automatically run all required setup steps prior to +compiling and linking the application. But we will look at those initial steps +in sequence, so cancel the dialog by pressing Do Not run. + + +As mentioned already, compiling and linking the application is done +through the Build menu. Call it up and select +Run automake and friends. + + + + + + +Initiating a basic initialization run. + + + + +&kdevelop; will now open the Messages tool view window at +the bottom and list a series of messages produced by several make tools. If +everything went right, the final line will read +*** Success ***. + +If you scroll back to the top, you will find the command line, &kdevelop; +issued to call up the tools beneath the surface: + + +cd '/home/devel/projects/hello' && \ +WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -f Makefile.cvs + + +This basically tells that &kdevelop; first switched to the root directory +of our example project. Then it set up a dedicated environment, advising the +make system of the autoconf and +automake tool revisions used for this initialization. +And finally it instructed the make tool (&GNU; gmake +in this case) to process the Makefile.cvs make file. + +This make file was automatically set up when you created the Hello +project. It contains all the commands necessary to properly initialize the +project so the resulting application will run under &kde;. Especially this will +create the configure skript file necessary to perform the +next setup step. + + + +Initial Hello Configuration + +Configuring means to tailor the build process to the hardware and software +peculiarities of your system. This is a basic requirement in build processes +based on the &GNU; autotools scheme as you probably will know. + +You can command a configure sequence once the basic automake +initialization has been successfully finished because only after this +initial run the necessary configure files will be +available. This done, select the Build +Run Configure menu entry to initiate a +configuration sequence. + +&kdevelop; opened the Messages tool view +window again if necessary and listed the messages of the configure run therein. +If all went right, the final messages will be Good - your +configure finished. Start make now (which was issued by +configure) followed by the &kdevelop; *** Success +*** message. + +On top of the +Messages window you will again find +the command line, &kdevelop; used to initiate this configuration run: + + +mkdir '/home/devel/projects/hello/debug' && \ +cd '/home/devel/projects/hello/debug' && \ +CXXFLAGS="-O0 -g3" "/home/devel/projects/hello/configure" --enable-debug=full + + +You can tell several interesting details from these commands. + + + + + + + + + + + + + +First, &kdevelop; uses a dedicated subdirectory in the project directory +tree for the build process. This debug +build directory (shown to the left) mirrors the basic project structure and +contains some set of build related files, such as several +configure based files and additionally a +Makefile in each subdirectory. + + +In the Configuring the +Project +section shortly below we will have a brief look at the motivations why +&kdevelop; uses separate build directories in cases like this one. For the +moment it is enough to know that &kdevelop; created this debug directory — if necessary — prior +to the configure call and that the configure script did +build the sub structure and all the Makefiles in +there. + + +Next, from within the debug build +directory, &kdevelop; called the configure script in the +root directory of our project using a dedicated environment, where the +CXXFLAGS="-O0 -g3" flags will later signal the +&gcc; compiler that it should not optimize the resulting binaries and include +full debugging information with them. + + +Finally the configure script was called with the +--enable-debug=full option which instructs it +to create each Makefile so that later compilation and +linking will have all necessary debugging information be built in and +usable. + + + + + + +All these settings are configurable on a per project basis. You will learn +more about this in the Project +Management chapter. + + + +Build the Project + +Once you got this far you will be ready to actually build, &ie; +compile and link the application. Looking at the Build menu, +there are three such compile options from which to select. + + + + + + +&kdevelop; commands to build binaries. + + + +Going from bottom to top, there are: + + +Compile File — This will compile the +source file in the currently open editor window. Mostly used for quick error +checks. + + +Build Active Target — This is mainly used +in conjunction with the Automake +Manager which we will briefly look at below. + + +Build Project — Now this is what we +currently are interested in. It will iterate over the whole project, compiling +and linking all files as necessary. + + + +It might be interesting to watch what happens to the +Debug directory created in the former +configure run. So best keep it open with all +subdirectories unfolded just as shown above. Then select +Build Build +Project (or press the F8 key) to +initiate the build sequence. As before, the Messages tool +view window will open at the bottom and list the outcome of this build run. And +additionally some files will appear on the Debug subtree. + +There are not many source +files in our Hello example project, so the Messages window +will contain only a few lines. On top of them again find the command line +&kdevelop; issued to the underlying shell. + + +cd '/home/devel/projects/hello/debug' && \ +WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k + + +Not very surprisingly, &kdevelop; switched to the Debug subtree root in order to run the +Makefile located there. A dedicated sub-environment was +set up again as before in the Initialization step in which +then the gmake tool was called. + +Note the -k option in the +gmake call. It forces the build process to continue +up to its very end, even if errors will occur. This makes sense as &kdevelop; +will list all error messages in the Messages window. If +there are any, use the virtues of an &IDE;: Just click on the error message in +the Messages window and &kdevelop; will take you to +exactly the position where the error occurred in the source file. + +And what did happen inside the Debug subtree? Not very much. A few files showed up +on the doc/en and src branches, most notably the +hello file in /home/devel/projects/hello/debug/src/. This, +finally, is the application binary we were looking for. All what is left +to do in our initial project check is to run this +hello. + + + +Run the Application + +There are no extra steps involved to run this new Hello +application. Either select Build +Execute Program or press +Shift F9 or use the +Execute program button on the Build +Toolbar shown below. + + + + + + +Running an application form the Build +Toolbar. + + + + +That was all. &kdevelop; will now start the new application in +the dedicated console window which opens as Application +tool view on the bottom. There the command &kdevelop; issued to execute the +program will be shown in the top line: + + +./hello + + +showing that the &IDE; has a notion about where the executable it +shall run resides. This notion can be widely configured. See more about +this in the Project +Management chapter. + +The ./hello line will most likely +be followed by a warning message. Ignore this for now. It does not keep +our Hello form running. + + + + + + + +Our initial Hello application. + + + + +Close the Hello application window as +usual. If no errors occurred, &kdevelop; will report this as +*** Exited normally *** +in the Application tool view window. + + + + +Configuring the Project + +In &kdevelop; there are numerous ways how you can manage your project. +This behavior is configurable on a per-project basis and mostly of interest to +the advanced developer. Yet there are a few project specific settings you +should know of right from the beginning. + + + +Of what use are build +configurations? + +Where to the define +the behavior of the configure script. + +Some considerations +how make should run. + +Where should the +executable be and how should it be called? + + + +Build Configurations + +When we did a first run of the configure script in +the Initial Hello +Configuration section above, we noted that &kdevelop; had set up a +dedicated debug subdirectory for this +purpose. In this section we will briefly consider some consequences of +this feature. + +First of all, &kdevelop; does not necessarily use dedicated build +directories apart from the source. The preparations to automatically use +dedicated build configurations is done through templates the &appwizard; uses +when creating a new project. + +To find out which build configurations currently are available, have a +look at the Project Build +Configuration menu. + + + + + + +There are various build configurations available +for this project. + + + +In this case, like our Hello example project, there are three different +build configurations available. In other cases, there may — initially +— be only one such build configuration, namely +default. + +The currently used build configuration has a check mark left to it. In +order to switch to another build configuration simply select its menu +entry. + +Now let us have a brief look at what these build configurations +provide. + + + +debug + +You should use this as the standard build configuration during the +development process. The build occurs separately from the source directories in +the dedicated debug subdirectory, &ie; +all object, auxiliary, and executable files will be put in the subdirectories +there instead of their counterparts in the project root. The +configure script will be given the +--enable-debug=full option and the +CXXFLAGS="-O0 -g3" will signal the &gcc; +compiler to not optimize the code and to insert extensive debug information +into the resulting binaries. + + + + +optimized + +This is used to build a final C++ application. The build occurs +separately from the source directories in the dedicated optimized subdirectory. No specific arguments to +the configure script will be preset, yet the +CXXFLAGS="-O2 -g0" will signal the &gcc; +compiler to optimize the code and to not insert debug information into the +resulting binaries. + + + + +default + +The term default denotes the standard setup when you build +an application from the console using ⪚ the &GNU; +configure and +make/gmake command line +oriented build tools. Other than debug or +optimize no dedicated build directory will be used. +The application will by default be built in the sources directories instead. +There are no special configuration switches predefined. Building and running the +application will use the default settings of the underlying tools (e.g. &gcc;, +etc.). + + +Think twice before you decide to use the +default build environment! + +It cannot be used in parallel to the dedicated +debug or optimized ones. +Any build operation using default will +render both of the other build environments unusable. This is caused +by some peculiarities of the Makefile construction process +using the +automake/autoconf +machinery, which cannot be easily overcome. + + + + + +Now, why does one one want to use different build configurations at all, +when they even appear to be not compatible to each other? The answer is — +it simplifies edit-compile-debug cycles. The extra debug instructions +inserted into the binaries as well as all those subtle structure changes to +the program code made during optimizations will effect the run time behavior of +the resulting application. So in many cases, when the logical structure of some +routine appears to be correct, you may want to test whether it still behaves +correctly under more practical conditions. + +This is where the build configurations of &kdevelop; step in. Because +the built object and executable files in each dedicated build directory and the +build commands are kept separately from each other only source changes need +to be handled when you switch between these build configurations. + +Thus instead of cleaning up and recompile everything from scratch with +alternate options, you need only switch from the +debug to the optimize +build configuration, have the source changes compiled in and then retest the +application under these circumstances. If anything inappropriate shows up, +simply switch back to debug and immediately continue +your work there. + +A final note — many build configuration settings are configurable. +You can even define your own build configurations if your development process +requires some. We will briefly look at these possibilities in the next +section. + + + +Project Configure Options + +Configuring the application properly is vital in the &GNU; +autotools building chain. This is usually guided by option definitions to the +configure script and/or specific flags settings in the +environment prior to running configure as ⪚ the +CXXFLAGS in our previous discussions. + +You may set most of the configuring options for a given project from +within &kdevelop; &GUI;. Select +Project +Project Options and then from the +icon bar on the left of the dialog the Configure Options +icon. The Configure Options dialog featuring several tabbed +windows will display on the right handed side. + + + + + + +Most configure options can be defined here. + + + +As you see, there are quite a lot of options you can set up in this +dialog. For now we will briefly look at only a few of them with regard to our +Hello example project. For detailed instructions see the Configuring Projects chapter. If you +want to know more about the meaning of the various flags which can be +set, look up info make from the console (or +info:make from within &konqueror;) and there the +Implicit Rules +Implicit Variables section. + +There are several tabbed dialog setup windows from which the first +one, General, refers to commonly used settings, +while the others are rather compiler specific. In all cases, however, will the +actual contents of those dialogs be governed by the given build +configuration. + +You select the build configuration whose configuration settings +have to be defined from the Configuration combo box +on top of the Configure Options dialog. + + + + + + +Select the build configuration whose settings to +define. + + + +Now select another build configuration from this combo box and note how +the contents of ⪚ the Configure arguments and +Build directory text boxes change according to the +settings we mentioned in the build +configurations list above. + + +General Configuration Settings + +On the General dialog page, these +configuration options can be defined: + + + + +Configure arguments +These are the options &kdevelop; assigns to the +configure script call in the build process. See the +example in +the Initial Hello Configuration section above. + + + + + +Build directory +This is the subdirectory in the current project root, where &kdevelop; +will put all files created in the build process. Ideally, this should +correspond to the name of the build configuration in use, but you are +free to use any name you like, provided it is different from any other +build configuration directory. + + + + + +Top source directory +You won't need this one often. It defaults to the project root +directory and needs only be redefined if your project sources are located +in another place. + + + + + +C/C++ preprocessor flags (CPPFLAGS) +Put specific instructions for the preprocessor here. &kdevelop; will +use this to set up a temporary environment before it calls the actual +build tool. Again, see the example in +the Initial Hello Configuration section above how this is +done. + + + + + +Linker flags (LDFLAGS) +This is extra information for the ld linker +tool where it should look for additional libraries. It is used to build the +temporary build environment as well. + + + + + +Environment Variables +Here you may define additional variables to be set up in the +temporal build environment, &kdevelop; will set up before calling the +respective build tool. Again, you must define these environment variables for +every build configuration where they are to be used. + + + + + + +Compiler Specific Settings + +The other tabs on the Configure Options dialog +page are for compiler specific settings. They are similarly structured, +so it suffices to have a brief look at the C++ page. + + + + + + +Select the compiler and its working environment &kdevelop; shall +use here. + + + +This is what you can set up from here: + + + + +C++ compiler +Select the C++ compiler &kdevelop; should regularly use from this +combo box. It however lists only those compilers &kdevelop; really knows +of. + + + + + +Compiler command (CXX) +Only for experts. This is only needed if the C++ compiler is not standard. +Put the name by which it is called here. + + + + + +Compiler flags (CXXFLAGS) +Here you can enter any extra option &kdevelop; shall pass (via the +Makefile) to the compiler. Some option values will be +preset according to the build configuration selected in the +Configuration combo box. + + +Note, that many common compiler options can be selected from a +dialog which will pop up when you press the ... button to +the right of the text box. + + + + + + +Use this dialog to define the &GNU; C++ compiler +behavior. + + + +We deliberately selected the Optimization tab +here. Note how the No Optimization option has been +preselected (according to the -O0 +option preset in the debug build +configuration). + +Unfortunately you cannot currently select all options from this +dialog. The -g3 option ⪚ used by the +debug build +configuration would have to be altered manually if ever needed. + + + + + + +How Make Should Build the Program + +You can as well configure the way &kdevelop; will call the +make tool in the project build. Select +Project +Project Options and then the +Make Options icon from the left dialog window side. The +Make Options dialog page will then be displayed to +the right. + + + + + + +Define how &kdevelop; will call the +make tool. + + + +There is not much to do here for now. The only setting of interest in +most cases will be the Abort on first error switch. +You will find it deactivated in most projects. This corresponds to the +-k option in the +gmake call we found in the initial build of +our example Hello project. + +This makes sense in an &IDE; like &kdevelop; which will protocol any +error message during the build. After the build process you may easily +navigate to any error message in the Messages tool +window. Use View +Next Error and +View Previous +Error or respectively the F4 and +Shift F4 keys for this. +&kdevelop; will automatically activate the editor window of the source file in +question and put the cursor on the error line. + +If on the other hand you rather want the build be stopped on whenever an +error occurs, check the Abort on first error option +in this dialog. &kdevelop; will then call gmake +without the -k option. + + + +How to Run the Executable + +Once the build is complete, you can easily run the application from within +&kdevelop;. Use either Build +Execute Program, the +Shift F9 keys, or the +Execute program button in the Build +Toolbar of &kdevelop;. + + + + + + +Run the program from here. + + + +But where is the executable located which should be run? How does +one have &kdevelop; append options to the call? Or, how can I have the +application executed in a terminal by its own to test its console interactive +behavior? + +All this can be solved by configuring some project oriented run options in +&kdevelop;. Select Project +Project Options and then the +Run Options icon from the icon bar on the left dialog window +side. The Run Options dialog page will display to the +right. + + + + + + +Define where and how your program shall be run. + + + +Now, there is quite a lot which can be set up from this dialog. +Basically there are four groups of configuration items. + + + + +Directory +This tells &kdevelop; where it basically shall assume the +executable to be called. There are three possibilities you can select +from. + + +Note however that only root directories are defined here. +&kdevelop; usually looks for the executable in some subdirectory +given in the next configuration group. + + + +Run from the directory, where the executable was build the last +time. This is the default. You can keep this for now. + + + +Run from the build directory according to the currently selected +build configuration. +The name of this directory was set up on the General +Configuration dialog page. + +This is the root where &kdevelop; will find the executable. It +changes automatically with the selection you made in +Project +Build Configurations menu. Try it. + +Other than always running the most recently built executable according to +the setting above, this allows you to switch the program to be executed by +simply selecting another build configuration from the Project +menu. + + + +Run the executable found in a fixed custom directory. Again +this is the root only from where the actual executable is to be +found. + +Use this if you ⪚ want to run the actually installed program instead of +the version located in the project directories. + + + + + + +Program +This tells &kdevelop; the relative position and name of the +program it shall actually call. This is relative to the root directory +defined in the configuration group above. Furthermore you can define any +argument &kdevelop; will pass to the program when it is actually called. + + + +If leave the Main program text box empty, the +active target settings of the &automanag; will be used. +Although this is an expert setting, inadvertently leaving this input +field blank is a common cause of problems. Check this setting if &kdevelop; +appears not to call the executable you wanted. + + + + + +Environment Variables +&kdevelop; will set up a dedicated shell environment to run the +program in. Define any extra environment variable in this configuration +group. + + + + + +Miscellaneous +Two more check boxes are located at the bottom of this dialog page. + + + + +Automatically compile before execution comes +in handy most of time. &kdevelop; will check the project for changes and +perform necessary configure and build steps for you any time you command +it to run the program. + +Uncheck this in case you want to run the program version prior to the +last change. + + + +Start in external terminal is interesting if +you want to test the input/output behavior of non-&GUI; programs in a console +terminal. This is unchecked by default, so &kdevelop; does start the program in +a window of its own without console terminal I/O capabilities. + + + + + + + + + +How to Extend a Project — the &automanag; + +(- to be written -) + + +A Short Look at the Automake Machinery + +(- to be written -) + + + +How to Place Icons in a Separate Directory + +(- to be written -) + + + +How to Add New Classes + +(- to be written -) + + +Be careful when you select your class file names. It is extremely difficult to +change them later. + + + +What is in a Subproject? + +(- to be written -) + + +Concentrate on Your Work — the Active Target + +(- to be written -) + + + + +Some Steps to Restructure a Project + +(- to be written -) + + + + + +How to Debug + +(- to be written -) + + + + +A Note on Your Project Documentation + +The &kde; project uses docbook for +generating your project handbook (&ie; the user manual). The user manual is +available through your application menubar by choosing +Help +YourApplication +Handbook when your &kde; GUI application is running. +After building your project, the user manual is displayed in &kde; +&khelpcenter;. It should explain to the user how your application works, what +are the main features and how to configure it. It should also explain the +advanced features if any. + +All &kde; based templates in &kdevelop; have a doc subdir which contains +a index.docbook template in the en folder to get you +started in writing the user manual. You should edit this +index.docbook in &kdevelop; and start changing personal +details such as name, email, &etc;. Look at the comments in this file and try +following these indications to start your application documentation. Rebuild +your project to see the changes in &khelpcenter;. +You need to install your project using +Build +Install or Install (as +root user) in &kdevelop; to see the user manual in +&khelpcenter;. +You can find more about the docbook syntax on the &kde; documentation +website. + + + +Last But Not Least, Keyboard Shortcuts + +(- to be written -) + + + +Where to go from here + +(- to be written -) + + +Frequently Encountered Problems + + +The nutshell chapter +FAQ pages +Forum +Mailing lists + + + + +Working With Projects + +(- to be written -) + + +Using Existing &kdevelop; Projects + +(- to be written -) + + + +Importing External Projects + +(- to be written -) + + + + + diff --git a/doc/kdevelop/hello-world-app.png b/doc/kdevelop/hello-world-app.png new file mode 100644 index 00000000..6f2ab007 Binary files /dev/null and b/doc/kdevelop/hello-world-app.png differ diff --git a/doc/kdevelop/importdirectory.png b/doc/kdevelop/importdirectory.png new file mode 100644 index 00000000..3d0372ad Binary files /dev/null and b/doc/kdevelop/importdirectory.png differ diff --git a/doc/kdevelop/index.docbook b/doc/kdevelop/index.docbook new file mode 100644 index 00000000..993400c0 --- /dev/null +++ b/doc/kdevelop/index.docbook @@ -0,0 +1,372 @@ + +KDevelop"> --> + + + + + Apache"> + API"> + + autoconf"> + automake"> + + ctags"> + CVS"> + + Doxygen"> + doxywizard"> + egrep"> + grep"> + HTML"> + IDE"> + libtool"> + + Python"> + Perl"> + PHP"> + + Qt/embedded"> + ssh"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + + + &kdevelop; User Manual + + 2006-06-19 + &kdevrelease; + + + + Bernd + Gehrmann + +
bernd@kdevelop.org
+
+
+ + + Caleb + Tennis + +
caleb@aei-tech.com
+
+
+ + + Bernd + Pol + +
bernd.pol@online.de
+
+
+ + + Volker + Paul + +
volker.paul@tiscali.de
+
+
+
+ + + 2002 + Bernd Gehrmann + + + 2002 + Caleb Tennis + + + 2004 + Bernd Pol + + + 2005 + Volker Paul + + + + + &FDLNotice; + + + &kdevelop; is an Integrated Development Environment to be used for a wide variety of programming tasks. + + + + KDE + KDevelop + IDE + development + programming + + +
+ + + +&survey-manual; +&getting-started; +&kdevelop-survey; +&setup; +&applicationwizard; +&editing; +&file-browsers; +&class-browsers; +&documentation; +&project-management; +&adv-build-management; +&debugger; +&cvs-chapter; + +&credits; + + + + +&kdevelop-install; +&nutshell; +&unixdev; + +&app-files; +&plugin-tools; +&app-uimodes-examples; +&commands; +&app-misc-info; +&app-changelog; + + + + + + + + + + + + + + + + +Bibliography + +(... to be written ...) + + + + +<ulink url="info://make/Top">GNU Make Manual</ulink> + +Richard M.Stallman +RolandMcGrath + + + + +<ulink url="info://automake/Top">GNU Automake</ulink> + +DavidMacKenzie +TomTromey + + + + +<ulink url="info://autoconf/Top">GNU Autoconf</ulink> + +DavidMacKenzie +BenElliston + + + + +<ulink url="info://gcc/Top">Using the GNU Compiler Collection</ulink> +Richard M.Stallman + + + +<ulink url="info://libtool/Top">GNU Libtool</ulink> + +GordonMatzigkeit +AlexandreOliva +ThomasTanner +Gary V.Vaughan + + + + +GNU Autoconf, Automake, and Libtool +1st edition +October 2000 + +Gary V.Vaughan +BenElliston +TomTromey +Ian LanceTaylor + +New Riders Publishing +ISBN 1578701902 + + + + +Advanced Programming in the &UNIX; Environment +1st edition +June 1992 +W. RichardStevens +Addison-Wesley Pub Co +ISBN 0201563177 + + + +Thinking in C++, Volume 1: Introduction to Standard C++ +2nd Edition +April 15, 2000 +BruceEckel +Prentice Hall +ISBN 0139798099 + + + +Open Source Development with CVS +2nd Edition +October 12, 2001 + +KarlFogel +MosheBar + +The Coriolis Group +ISBN 158880173X + + + +Programming PHP +1st edition +March 2002 + +RasmusLerdorf +KevinTatroe + +O'Reilly & Associates +ISBN 1565926102 + + + +Programming Python +2nd Edition +March 2001 +MarkLutz +O'Reilly & Associates +ISBN 0596000855 + + + +Gui Programming With Python : Using the Qt Toolkit +Bk&Cd-r edition +January 2002 +BoudewijnRempt +Opendocs Llc +ISBN 0970033044 + + + +Programming Perl +The Camel book +3rd Edition +July 2000 + +LarryWall +TomChristiansen +JonOrwant + +O'Reilly & Associates +ISBN 0596000278 + + + +Learning Perl +The Lama book +3rd Edition +July 15, 2001 + +Randal L.Schwartz +TomPhoenix + +O'Reilly & Associates +ISBN 0596001320 + + + + + + + + + +&documentation.index; + +
diff --git a/doc/kdevelop/kdcop_browsing.png b/doc/kdevelop/kdcop_browsing.png new file mode 100644 index 00000000..26dbaaf1 Binary files /dev/null and b/doc/kdevelop/kdcop_browsing.png differ diff --git a/doc/kdevelop/kdevdesigner.png b/doc/kdevelop/kdevdesigner.png new file mode 100644 index 00000000..4fa74c68 Binary files /dev/null and b/doc/kdevelop/kdevdesigner.png differ diff --git a/doc/kdevelop/kdevelop-ideal-mode-0.png b/doc/kdevelop/kdevelop-ideal-mode-0.png new file mode 100644 index 00000000..ea2d7c50 Binary files /dev/null and b/doc/kdevelop/kdevelop-ideal-mode-0.png differ diff --git a/doc/kdevelop/kdevelop-ideal-mode.png b/doc/kdevelop/kdevelop-ideal-mode.png new file mode 100644 index 00000000..00e73804 Binary files /dev/null and b/doc/kdevelop/kdevelop-ideal-mode.png differ diff --git a/doc/kdevelop/kdevelop-install.docbook b/doc/kdevelop/kdevelop-install.docbook new file mode 100644 index 00000000..1ff5982c --- /dev/null +++ b/doc/kdevelop/kdevelop-install.docbook @@ -0,0 +1,754 @@ + + + + + BerndPol + Anne-MarieMahfouf + + + + +Installing &kdevelop; + + + installation + + +In this chapter we will discuss the steps necessary to compile and install the &kdevelop; IDE: + + + + How to obtain &kdevelop; mainly concentrates on downloading the most recent &kdevelop; sources from svn. + + + &kdevelop; requirements lists the programs and libraries which you need installed to successfully compile the IDE. + + + &kdevelop; compilation and installation leads you through all the steps of compilation and installation of the application. + + +How to obtain a &kdevelop; &API; documentation tells what an API is and how you get such a useful tool for navigating the &kdevelop; sources. + + + + + +How to Obtain &kdevelop; + + + obtain &kdevelop; + + &kdevelop; + obtain + + +&kdevelop; is available in binary form from many different &Linux; distributions such as SuSE, RedHat and others. These binaries are packed in some convenient format, mostly RPM, for easy installation. To install, follow the standard instructions given in your distribution. + + +You may as well obtain the &kdevelop; sources, compile and install them by yourself. These sources can be found via the project home page at http://www.kdevelop.org or via the &kde; ftp site. + + + +Get Daily &kdevelop; Snapshots from svn + + + svn + +If you want to be in front of current development, anonymous svn repository snapshots are available. +The module name is kdevelop at svn co svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/kdevelop. + + + +Initial svn Checkout + + + checkout + + &kdevelop; + svn + checkout + + +To obtain an initial version of &kdevelop; you must download it from anonymous svn. For this so-called checkout operation follow these steps. + + + +We assume you want to put your &kdevelop; copy into the kde3src subdirectory of your home directory (~). + + + + + # Create the destination directory, if necessary: + + + ~> + mkdir kde3src + + + ~> + cd kde3src + + + ~/kde3src> + svn co svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/kdevelop + + + ~/kde3src> + cd kdevelop + + + + + Once you have successfully checked out your &kdevelop; version, you may keep up with the changes using the update procedure shown in the next section. + + + + Keep the server load low. Please do not checkout every time you want to keep your &kdevelop; up to date! Use svn update for this purpose. + + + +Now you may compile your &kdevelop; version as shown in the &kdevelop; Compilation and Installation section. + + + + + +Keeping Your svn Copy up to Date + + + update + + &kdevelop; + svn + update + + +After you checked out (and successfully compiled) &kdevelop; from svn as shown above, you'll want to keep it up to date in order to get all the patches. Follow these steps. (We again assume you have put your &kdevelop; copy into the kde3src directory.) + + +Note the up (= update) command instead of the co (which stands for checkout). + + + + + ~> + cd kde3src + + + ~/kde3src> + cd kdevelop + + + ~/kde3src> + svn up + + + + +Keep an eye on the messages svn produces during the update sequence. The exact steps in the compilation sequence depend on this. + + + +Now you can compile a new &kdevelop; version as shown in the Special svn compilation considerations chapter. + + + + + + + + + + +&kdevelop; Requirements + + + requirements + + &kdevelop; + requirements + + GNU + requirements + + +In order to successfully compile and use &kdevelop;, you need the following programs and libraries. They are available on most platforms as distribution packages and thereby can be installed easily. + + + +Required: + + + gcc/g++ ≥ 2.95.3 (or compatible) + + gcc + requirements + + g++ + requirements + + + Available from gcc.gnu.org + + + + + &GNU; make (or compatible) + + make + requirements + + + Available from www.gnu.org/software/make + + + + + &perl; 5.004 (or higher) + + Perl + requirements + + + Available from www.perl.com + + + + + autoconf ≥ 2.52 (or higher) + + autoconf + requirements + + + Available from www.gnu.org/software/autoconf + + + + + automake ≥ 1.6 (or higher) + + automake + requirements + + + Available from www.gnu.org/software/automake + + + + + flex 2.5.4 (or higher) + + flex + requirements + + + Available from www.gnu.org/software/flex + + + + + &Qt; ≥ 3.3.0 (or higher) + + Qt + requirements + + + Available from www.trolltech.com/products/qt + + + + + KDE ≥ 3.4.0 (or higher) + + KDE + requirements + + + Available from www.kde.org + + + + + +Optional: + + The ctags source navigation tool, from http://ctags.sourceforge.net, which enables you fast access to declarations and definitions by a few simple clicks on a name in the editor. + ctags + + + dot, a graphics language compiler, from http:/www.graphviz.org. This + + tool is needed in conjunction with &doxygen; below if you want to have class relationships graphically displayed (which is highly recommended). + dot + + + The &doxygen; documentation tool, from http://www.doxygen.org if you want to generate concise and powerful API documentation from your projects. + doxygen + + + valgrind from http://developer.kde.org/~sewardj/ helps you to find memory management problems in your applications. + valgrind + + + svn from http://subversion.tigris.org/ if you want to use the svn versioning system. + + svn + requirements + + + Any other compiler and/or tool in case you want to develop for another language/platform than C++/&kde; or use some special facility. + + + + + + + + You can, to a certain extent, circumvent the need for &autoconf; ≥ 2.52 and &automake; ≥ 1.6. Just remove the admin directory in your &kdevelop; installation directory and type + + autoconf + circumvent version need + + automake + circumvent version need + + version need + circumvent for autoconf/automake + + + (your-kdevelop-directory)> + ln -s $KDEDIR/share/apps/kdelibs/admin admin + + + at the console. This causes &kdevelop; to use the standard settings in the &kde; admin directory instead. + + + + + Be careful not to mix &Qt; versions. Always link &kdevelop; to the same &Qt; version your &kde; library was compiled. Otherwise you will most likely experience very strange behaviours. + + + + + + + + + + +&kdevelop; Compilation and Installation + + + &kdevelop; + compilation + + &kdevelop; + installation + + +Once all requirements are met, you are ready to compile and install &kdevelop;. This appendix will discuss the necessary steps to do so. + + + + Preliminary Steps tells you about setting up a proper environment. + + + Compile &kdevelop; deals with obtaining the &kdevelop; sources from svn, how to prepare them for the installation process, and finally shows the steps necessary to compile and install &kdevelop;. + + + Some Notes on configure Options tells you how to run &kdevelop; if it has been installed in a location other than the &kde; directory. + + + + +Preliminary Steps + + + preliminaries + &kdevelop; installation + + KDEDIR + + QTDIR + + LD_LIBRARY_PATH + + LIBRARY_PATH + + PATH + + +Before entering the compile sequence you must make sure all libraries and tools are available to the make system. To accomplish this some environment variables need to be properly set. The actual steps to be performed depend on the console shell you use. + + + +To avoid typing in all the statements that set the necessary environment variables every time you want to compile, you should put them into your .bashrc or .cshrc file. This way the environment variables will be properly set every time you start the shell. + + + +Setting the Environment for the bash Shell + + +If you use the bash shell add the following lines: + + + + export KDEDIR=(path to your KDE installation) + export QTDIR=(path to your Qt library) + export LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib:$LD_LIBRARY_PATH + export LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib:$LIBRARY_PATH + export PATH=$QTDIR/bin:$KDEDIR/bin:$PATH + + + + + + +Setting the Environment for the tcsh Shell + + +If you use the tcsh shell add the following lines: + + + + setenv KDEDIR (path to your KDE installation) + setenv QTDIR (path to your Qt library) + setenv LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib:$LD_LIBRARY_PATH + setenv LIBRARY_PATH $QTDIR/lib:$KDEDIR/lib:$LIBRARY_PATH + setenv PATH $QTDIR/bin:$KDEDIR/bin:$PATH + + + + + + + + +Compile &kdevelop; + + + make + &kdevelop; installation + + compiling + &kdevelop; + + +In the following discussion we assume that you have put your &kdevelop; sources in the ~/kde3src/kdevelop directory. + + + +Special svn Compilation Considerations + + +In case you use a &kdevelop; snapshot from svn the initial compilation steps depend on whether you just did a complete checkout or only updated the source. + + + + +After a svn Checkout + + +You must initialize the make system after a fresh checkout. The same is true every time you need to start over from scratch. Type: + + + + ~/kde3src/kdevelop> + make -f admin/Makefile.common svn-clean + + +and then all of the following steps. + + +You might need access to the svn repository for the clean-up if any corrupted or missing files must be reconstructed. + + +The svn-clean command will remove every file not in svn from the directory! Make sure to back up any valuable information before you issue this clean-up command. + + + + + +After a svn Update + + +The next step depends on the output of the svn update sequence. If you got something like (there may be a U or a P marker in the leftmost column, both denoting the file has been changed): + + + +U /some_directory_path/Makefile.am + + +or if you just did a full checkout, you must enter: + + + ~/kde3src/kdevelop> + make -f Makefile.svn + + +before you proceed with all of the following steps. + + + + + + + +Basic <command>make</command> Command Sequence + + +Once the basic make system is set up you must decide which type of the &kdevelop; system you want to use. This is done in the following configure step which builds the actual Makefiles the make command will use. + + + +You may drop the option in the following configure command lines if you want &kdevelop; be installed in the default &kde; directory. See the Some notes on configure options chapter for this. + + + + +A Debug-Compiled Version + + +If you want to keep track of what your &kdevelop; application does at run-time you may build a debug-compiled version. Just command configure to do so: + + + + ~/kde3src/kdevelop> + ./configure --enable-debug=full --prefix=(where-your-kde3-is) + + + + + +A Release-Compiled Version + +If you only want to use &kdevelop; as-is a (smaller and faster +running) release version suffices. configure defaults to +this. + + + ~/kde3src/kdevelop> + ./configure --prefix=(where-your-kde3-is) + + + + +If you want to build your own API documentation for &kdevelop; you must include yet another option in the configure command: + + + ~/kde3src/kdevelop> + ./configure --(options-as-above) \ --with-kdelibsdoxy-dir=$KDEDIR/share/doc/HTML/en/kdelibs-apidocs + + + + + + +Make and Install &kdevelop; + + +configure will check the system and build some Makefiles according to what it found. The make command will use the main Makefile by default. Thus + + + + ~/kde3src/kdevelop> + make + + +suffices. If necessary, now gain root user rights using the command + + + ~/kde3src/kdevelop> + su + + +and entering the root password. Then install the application: + + + ~/kde3src/kdevelop> + make install + + +That's all. If you installed &kdevelop; in the default &kde; directory you may now run the IDE. Otherwise some additional steps will be necessary as shown in the Non-default installation directory section below. + + + + + In fact there usually will have been three &kdevelop;-based applications installed: + + + The &kdevelop; IDE — this is the place where you will usually work. + The stand-alone &kdevelop; Assistant documentation browser — isolates all the powerful documentation facilities of the &kdevelop; IDE in a separate tool. This comes in handy when you want to look up some programming documentation but do not want to start the full IDE. + The &kdevelop; Designer — enhances the &Qt; User Interface Designer by &kde; specific elements and integrates nicely in the &kdevelop; IDE. + + + + + + + + + + + + +Some Notes on <command>configure</command> Options + + +Non-default Installation Directory + + + &kdevelop; + installation + non-default directory + + non-default directory + + KDEDIRS + + kbuildsycoca + + +By default configure prepares the IDE to be installed in the default &kde; directory. This is necessary because &kdevelop; assumes direct access to some tools and parts which reside there. If want to use your own installation directory, you must tell configure this by the option: + + + ~/kde3src/kdevelop> + ./configure --prefix=(where-your-kde3-is) + + +There is a caveat if you do so. You must provide a means for &kdevelop; to access the needed tools and parts in the &kde; directory when running. (You can still use the IDE without doing so, but with very restrained capabilities.) + + +Call up a shell and have the following commands executed before you start &kdevelop; at the shell prompt. + + + + Take care to use the plural: It is KDEDIRS, not just KDEDIR) + + + + + ~> + export KDEDIRS=/usr/local/kde:/opt/kde3 + + + ~> + kbuildsycoca + + + (Now start &kdevelop;:) + + + ~> + kdevelop + + + + + The KDEDIRS environment variable must be set to the list of active &kde; directories in your system. We use + /usr/local/kde:/opt/kde3 + as an example only. + The /usr/local/kde directory may for instance contain an incomplete &kde; version you compiled for debug purposes, and the /opt/kde3 directory may in addition contain the standard &kde; version from your distribution that is used for everyday work. + + + +In a tcsh shell you must set the environment variables using: + + + ~> + setenv KDEDIRS /usr/local/kde:/opt/kde3 + + +The kbuildsycoca command (build system control cache) looks around for libraries and caches their location and version, so that &kdevelop; can find them. The caveat is that it takes noticeable time—and it has to be run any time you call up the shell to start &kdevelop; from a non-default directory. You may want to put the above commands into a shell script to reduce the typing effort. + + +(You could as well put the lines in your .bashrc or .cshrc file, but this is not advisable as kbuildsycoca will then be run any time you call up the shell.) + + + +The kbuildsycoca command does not run from within the root. You must call it from a non-root user. (But is not a very good idea after all to do software development from within the root!) + + + + + + + + + + +How to Obtain a &kdevelop; API Documentation + + + API + &kdevelop; + + &kdevelop; + API + + compiling + &kdevelop; + API + + configure + &kdevelop; API + + +API is the short form of Application Program Interface. Actually such an API cotains a series of descriptions (&ie; calling conventions) by which an application program can access the operating system and other services. In our context, however, a broader definition was adopted. The API of a &kde; or &Qt; application is an abstract of the classes and methods interfaces, a synopsis to be used like a dictionary to navigate the sources. + + +There is a version of the most current API available at the KDevelop-Home website. It will be automatically updated every 24 hours so you can keep up. + + +Alas, this version is best used read-only over the internet. If you do not always have internet access you may as well build your own API documentation from the &kdevelop; sources. To do so, you must tell the automake system where to find the KDELIBS API in your system. This is accomplished by the special option in the configure command when you prepare to compile the &kdevelop; sources: + + + + + ~/kde3src/kdevelop> + ./configure --(options-as-usual) \ + + + --with-kdelibsdoxy-dir=$KDEDIR/share/doc/HTML/en/kdelibs-apidocs + + + + +(make will replace the global $KDEDIR variable with the actual &kde; directory setting recorded therein.) Then issue a make command as usual. After the &kdevelop; IDE has been built you have the option to build the API as well. For this you must issue + + + ~/kde3src/kdevelop> + make apidocs + + + +This will build a Doxyfile in your &kdevelop; base directory which in turn will be processed by the Doxygen application to build quite a lot of .html API files. When this rather lengthy API building process (may last more than an hour on a slow system) finally comes to an end, you must install the API just like you have to install the &kdevelop; IDE itself. If necessary obtain superuser rights by + + + + ~/kde3src/kdevelop> + su + + + +and entering the root password. Then install the API files: + + + + ~/kde3src/kdevelop> + make install-apidox + + + +Once this is done, make will inform you about the directory where you can finally look at the API documentation's contents. Note this address, you can use it from &konqueror; as well as from inside &kdevelop;, in case you have set up the &kdevelop; sources themselves as a project to work on. + + + +You will most probably see a lot of warning and/or error messages during the API build run by Doxygen. It is best to ignore them, they are of interest to the &kdevelop; developers only. If the API generation ever comes to a successful end, the .html API files will be usable. + + + + + diff --git a/doc/kdevelop/kdevelop-mdi-mode.png b/doc/kdevelop/kdevelop-mdi-mode.png new file mode 100644 index 00000000..51ed019a Binary files /dev/null and b/doc/kdevelop/kdevelop-mdi-mode.png differ diff --git a/doc/kdevelop/kdevelop-scripting.docbook b/doc/kdevelop/kdevelop-scripting.docbook new file mode 100644 index 00000000..d9e59bb5 --- /dev/null +++ b/doc/kdevelop/kdevelop-scripting.docbook @@ -0,0 +1,56 @@ + + + + + IanGeiser + + + + +Using Scripts in KDevelop + + +Running Scripts + + To access a script that is available to &kdevelop; use the ToolsScripts menu. If there there is no such menu item then there are no installed scripts available to KDevelop. + + + + +Adding Scripts + + Once you have added KScript support to your host application adding the scripts is just as easy. The scripts are comprised of two parts, a desktop file that contains meta-data about the script and the script itself. This approach was used because of security and simplicity. The desktop file provides meta-information for menus and script type. This keeps the host application from having to inspect for load each script. An example of this file is shown below: + + + The above example demonstrates the main parts that KScript will look for. The first item the "Name" is the name that will appear to the user in the host application and the "Comment" will be usually provided as a tool tip. The "Type" is the most important. This is used to select the proper script engine to run the script. Currently the ones available to KDE are "ShellScript/bash" and "JavaScript/kjs" +The next step is to create the actual script. For the above example the Type of script that is used is "ShellScript/bash". The shellscript script engine provides a few things for the developer. The first element is the DCOP ID of the host application. This is passed to the script as the first argument. This means from anywhere in the script the value of "$1" will return the host's DCOP ID. An example shell script is shown below: + + +This script is quite simple and just executes a command and sets the text of the first document to the output of "ls -l" + +One of the most useful tools in developing scripts for applications is the KDCOP application. +
+ KDCOP Browsing DCOP Interfaces in &kdevelop; + + + +
+ +The KDCOP tool allows script developers to browse and debug the current interfaces of the host application. KDCOP also provides a neat feature of allowing users to select a method and drag the current code to their text editor. This simplifies use for people who are not savvy to the DCOP methods of the host language. Currently KDCOP supports KJSEmbed, Python, and UNIX Shell method for accessing DCOP. + +Once the script is complete it is ready to be installed. Application developers should document the location that will be scanned for scripts. In the case of the above example for Kate the scripts are located in "$KDEDIRS/share/apps/kate/scripts". + +
+ &kdevelop; Scripts on the Filesystem + + + +
+ +The script desktop file, and its associated script should be in the same directory. For script developers it is also recommended that all other script resources such as UI files, or data files should also reside in the script directory. In the above example the script will appear under the Tools->KDE Scripts menu. One important thing for script developers to note is that they should not perform operations that could block for a long time, or go into an eventloop. This is because the current version of the script interface is geared for automated tasks that run until completion. This is being addressed and extended for KDE 4. + + +
+ + +
diff --git a/doc/kdevelop/kdevelop-survey.docbook b/doc/kdevelop/kdevelop-survey.docbook new file mode 100644 index 00000000..9fe32d2d --- /dev/null +++ b/doc/kdevelop/kdevelop-survey.docbook @@ -0,0 +1,489 @@ + + + + + BerndPol + + + + +Overview of &kdevelop; Features + + + &kdevelop; + survey + + overall view + + survey + + +&kdevelop; integrates a lot of tools, scripts, and templates in a common user interface. Basically it consists of + + + + several user interface modes from which you can select the look and feel of the workspace, + + + an &appwizard; which aids you in setting up a new project, + + + several project management systems which aid in building and managing your project, + + + some editing tools to easily work on your program texts + + + various file browsers providing you different views on your file system, + + + various class browsers to aid you in maintaining the classes and their relationships of your object-oriented programming project, + + + a debugger interface to find and remove program errors from within &kdevelop;, and + + + several plugin tools, extensible modules which can be loaded at runtime and on demand. This allows you to only turn on those features you really need. + + + a set of other diagnosis, documentation, and optimization helper tools. + + + + + + + In fact there are three &kdevelop;-based applications: + + + The &kdevelop; IDE — this is the place where you will usually work. + The stand-alone &kdevelop; Assistant documentation browser — isolates all the powerful documentation facilities of the &kdevelop; IDE in a separate tool. This comes in handy when you want to look up some programming documentation but do not want to start the full IDE. + The &kdevelop; Designer — enhances the &Qt; User Interface Designer by &kde; specific elements and integrates nicely in the &kdevelop; IDE. + + + + + +Available User Interface Modes + + + &kdevelop; + user interface modes + + user interface + &kdevelop; modes + + UI modes + + Child Frame Windows + + Tabbed Pages + + Toplevel Windows + + IDEAl + + +&kdevelop; offers developers four separate user interface modes (click on the mode name to view an example): + + IDEAl + + This is a novel user interface approach optimizing both work space and intuitive handling of the tools. + + + + All tool views are docked in a tabbar fashion around the mainframe area. They are grouped left, bottom, and right according to the services provided. + + + Editor and browser views will be stacked in a big sized tabbed window inmidst the mainframe area. + + + + + + Child Frame Windows + + All tool views are initially docked to the mainframe. + Editor and browser views will live like toplevel windows within a view area of the mainframe. + + + + + Tabbed Pages + + + All tool views are initially docked to the mainframe. + + + Editor and browser views will be stacked in a tabbed window. + + + + + + Toplevel Windows + + + All editor, browser, and tool views will be toplevel windows directly on the desktop. + + + The main widget only contains the menu, toolbars, and statusbar. + + + + + + + + +How to Switch User Interface Modes + + + user interface + switch modes + + switch UI modes + + +To switch the user interface mode select Settings Configure KDevelop... from the menus. The Customize KDevelop dialog will pop up, where you have to select User Interface in the left hand tree. This will display the settings page shown below. + + + + + + + + + Select a user interface mode + + + + + +(Older &kdevelop; versions provide the top mode selection section only.) + + + +In the Major User-Interface Mode section select the radio button of the user interface mode you want to work in. + + +Dependent on the user interface mode you selected, other configuration sections will become available where you can taylor more details of the look and feel to your preferences. See the Selecting the User Interface chapter for more detail. + + + +Do not forget to restart &kdevelop; in order to let your selections take effect. + + + + + +How to Maximize the Work Space Area + + + &kdevelop; + work space + + &kdevelop; + maximize work space + + user interface + work space + + user interface + menubar + + user interface + full screen mode + + full screen mode + + menubar + hide/unhide + + hide menubar + + unhide menubar + + +To maximize space, there is a full-screen window mode available which expands the mainframe area to the screen borders. Additional space can be reclaimed by hiding the menubar. And you can of course hide any toolbar as usual in KDE applications. + + + + +Full Screen Mode + + +To switch to or from full screen mode select +View Full-Screen Mode + from the menus or press +&Ctrl;&Shift;F . There is also a +Full-Screen Mode icon in the Browse +Toolbar available. + + + + +Hide/Unhide the Menubar + + +To hide the menubar select Settings Show Menubar from the menus or press &Ctrl;M . You may also include a Show Menubar icon in a suiting toolbar, ⪚ the Browse Toolbar for that purpose. To unhide the menubar you must press &Ctrl;M or use the Show Menubar icon if available. + + + + + + + + + + + + +Elements of the User Interface + + +(... to be written ...) + + + +The Workarea + + +(... to be written ...) + + + + +The &kdevelop; Titlebar + + +(... to be written ...) + + + + +The &kdevelop; Statusbar + + +(... to be written ...) + + + + +The menubar + + +(... to be written ...) + + + + +The Toolbars + + +(... to be written ...) + + + + +The Tree Tool Views + + +(... to be written ...) + + + + +The Output Tool Views + + +(... to be written ...) + + + + + + + + +Project Management Systems + + + project management + + +Globally, a project will rely on some form of project management system. &kdevelop; offers four project management systems the programmer can select from when creating a new project. + + + + Automake projects use the &GNU; standard development tools. + + + QMake projects use the trolltech QMake project manager. + + + ANT projects use the Apache ANT project manager for &Java; development. + + + Custom projects require you to maintain your own Makefiles. + + + + + +Automake Projects + + + projects + automake + + automake + projects + + +Projects created with &kdevelop;'s &automanag; make it very easy for developers to use the &GNU; standard development tools. They provide + + + a better way of Makefile generation and + + + a good and safe way for fast adaption towards different systems by autoconf-generated configure scripts. + + + + + + +QMake Projects + + + projects + qmake + + qmake + projects + + +For developers who enjoy the flexibility and feel of &Qt;'s qmake system, &kdevelop; offers the ability to handle qmake based projects (.pro files) within the &GUI;. + + +For more information on the QMake project manager see the qmake User Guide which should be included in your distribution or have a look at the TROLLTECH Documentation home page where you may find the QMake documentation of your Qt C++ GUI Application Development Toolkit version. + + + + +CMake Projects + + + projects + cmake + + cmake + projects + + +CMake will be the &kde; build system for &kde; 4 and &kdevelop; already +provides you some CMake based templates in C and C++. You only need the cmake +program in your $PATH to build them. + + +To set up a new C or C++ project in &kdevelop; select +Project +New Project... +C or C++ +CMake based projects +A shared library template or Hello world program +. + + + + +ANT Projects (&Java; Projects) + + + projects + ant + + ant + projects + + projects + Java + + Java + projects + + development + Java + + +&Java; developers may want to use the Apache ANT project manager for their projects. To set up a new Ant project in &kdevelop; select Project +New Project... +Java +Ant Project +Application. + + +For more information see The Apache Ant Project home page. + + + + +Custom Projects + + + projects + custom + + custom projects + + Makefile + custom projects + + +If you prefer to maintain your own Makefiles for your project you may use the custom project option of &kdevelop;. This may be feasible in unusually structured projects or if you want to retain full control over the make process. + + +Yet, if you do not really need the extra flexibility and control of the custom project manager you should consider &automanag; or one of the other project managers, because they considerably ease the program building and distribution processes. + + + + +How to Distribute Your Application + + + distribution + + application + distribution + + binary packages + + +The distribution of your applications does not require the end-user to have anything different installed other than + + an appropriate compiler, + a linker, and + the appropriate development libraries, + + + +which at least for C++ applications is most often the case. But you can as well distribute binary packages of your application. + +In either way, the end-user of your product does not need &kdevelop; installed. + + +For giving away your sources, we advise to include the project file of &kdevelop; as well. This makes it very easy for other developers—if they use &kdevelop;—to work with your sources. + + +For projects where several developers, maybe working on different places, are involved, this should be the case anyway. So you can ensure consistency of the Makefiles to not run into trouble. + + +Especially on multi language applications, translators won't actually work with the source code, except in cases that require correction for enabling translation support. + + + + + + + diff --git a/doc/kdevelop/kdevelop-tabbed-mode.png b/doc/kdevelop/kdevelop-tabbed-mode.png new file mode 100644 index 00000000..faa7a97f Binary files /dev/null and b/doc/kdevelop/kdevelop-tabbed-mode.png differ diff --git a/doc/kdevelop/kdevelop-toplevel-mode.png b/doc/kdevelop/kdevelop-toplevel-mode.png new file mode 100644 index 00000000..c2fb812b Binary files /dev/null and b/doc/kdevelop/kdevelop-toplevel-mode.png differ diff --git a/doc/kdevelop/listplugins.sh b/doc/kdevelop/listplugins.sh new file mode 100755 index 00000000..e21b3a15 --- /dev/null +++ b/doc/kdevelop/listplugins.sh @@ -0,0 +1,43 @@ + +# kdevdir must be set to the KDevelop project directory. +kdevdir=/home/volker/data/prj/kdevelop/kdevelop/ +# The plugins are in the parts/ subdirectory. + +pushd $kdevdir/parts >/dev/null +oldscope=nix +echo "The following plugin list is generated by a small script" +echo "written by Volker Paul. All plugins have a .desktop file" +echo "where information such as name and comments are written." +echo "If in the following these comments are not very useful," +echo "it is because the plugin authors made them this way." +echo "The plugins are grouped by scope (Core, Global, Project)." + +for defscope in Core Global Project; do + if [ $defscope != $oldscope ]; then + oldscope=$defscope + echo +# echo "Scope: $defscope" + echo "Scope: $defscope" + echo "" + fi + for dir in `ls`; do + if [ ! -d $dir ]; then continue; fi + dfile=$dir/*.desktop + # echo $dfile | wc -w + if [ `echo $dfile | wc -w` -gt 1 ]; then continue; fi + if [ ! -f $dfile ]; then continue; fi + scope=`cat $dfile | grep "X-KDevelop-Scope=" | cut -d= -f2-` + if [ $scope != $defscope ]; then continue; fi + comment=`cat $dfile | grep "Comment=" | cut -d= -f2-` + name=`cat $dfile | egrep "^Name=" | cut -d= -f2- | tr " " _` + genericname=`cat $dfile | grep "GenericName=" | cut -d= -f2-` + echo "" + echo "$genericname" + echo "$comment" + done + echo "" +# echo "" +done +popd >/dev/null +echo "So far the generated plugin list." +echo diff --git a/doc/kdevelop/loading-progress-bar.png b/doc/kdevelop/loading-progress-bar.png new file mode 100644 index 00000000..f786721d Binary files /dev/null and b/doc/kdevelop/loading-progress-bar.png differ diff --git a/doc/kdevelop/nutshell.docbook b/doc/kdevelop/nutshell.docbook new file mode 100644 index 00000000..1c5395dd --- /dev/null +++ b/doc/kdevelop/nutshell.docbook @@ -0,0 +1,242 @@ + +In a Nutshell — Tips and Tricks + + + + +The information in this chapter is meant as a quick reference for a head start or if you (momentarily) forgot about some basic concept. There are also short hints on how to solve some common problems when working with &kdevelop;. + + +If you want more information on a topic, just follow the link in the title starting that advice. + + +Information on these topics is availabe: + + + Look and Feel + Projects + Compilation + &automanag; + Compile/Make Problems + Other Topics + + + +Look and Feel + + +Force +smaller tool view tabs in IDEAl Mode + +By default &kdevelop; starts with large text-based tool tip tabs +around the work area. You may change this look to ⪚ save space in the +&kdevelop; configuration dialog (Settings +Configure KDevelop... User +Interface). +If you use an older &kdevelop; 3 version, this configuration dialog +may not be available. To change the toolview tabs display manually, place a + entry under the + tag in your +$KDEHOME/share/config/kdeveloprc configuration file as +follows: + + +: icons only +: text only (default) + +: icons and text + + + + + +Weird colored characters and/or display +style + +If you notice random colored letters everywhere (&ie; on tabs, on tool +bars, etc.) and the &kdevelop; window seemingly uses a wrong display style, +this may help: + + +In your +$KDEHOME/share/config/kdeveloprc +configuration file find the line containing +Style=Checked and remove +it. Then restart &kdevelop;. + + + +(This behaviour does sometimes occur after you left clicked a .ui file +in one of the file navigators and &kdevelop; did load +KUIViewer to show the &GUI; which was produced +from this file.) + + + + +Full +screen mode + +Select ViewFull-Screen +Mode from the menus or press +&Ctrl;&Shift;F. + + + + +Hide/Unhide +the menubar + +To hide the menubar select +SettingsShow +Menubar from the menus or press +&Ctrl;M. To redisplay the menubar only +&Ctrl;M is available. + + + + + +Projects + +Create New Project + +ProjectNew +Project... will start the &appwizard;. + + + + +Create a custom project + +There is no direct way to create a custom project (&ie; a project +which does use its own makefiles). Use +Project Import Existing +Project instead. Remember to set the appropriate +Project Type, labeled by an additional (Custom +Makefiles), in the dialog. + + + + +Use project options early + +Whenever you start a new project do not forget to set the +Project Project +Options... to your needs. + + + + + +Compilation + +Missing detail in compilation +messages + +If during compilations you notice some valuable information is missing +in the Messages Output View window, it may be that the +level of message detail is set too low. &RMB; click in the window and select +another detail level from the context menu. + + + + + + + + +<link linkend="automake-manager">&automanag;</link> + + +Create new files in a project + +Select the sub-project in the upper half of the &automanag;, then +&RMB; click in the lower half on the groups title you want to have the files +added and select Create New File.... + + + + +Add existing files to a project + +Select the sub-project in the upper half of the &automanag;, then +&RMB; click in the lower half on the groups title you want to have the files +added and select Add Existing Files.... + + + + +Remove a file from a project + +Select the sub-project in the upper half of the &automanag;, then in +the lower half open the groups list you want to have the file removed from, +&RMB; click on the file in this list and select +Remove. + + + + + +Compile/Make Problems + +Project does not build again after switching +to/from default target + +There is a problem with the &automake;/&autoconf; machinery. If + Project Build +Configuration provides to select from three build +directories: default, +optimized, and debug, +by all means stick to either the default +or the debug/optimized targets. + + +Once you configured your project with default it will no longer build +with debug or optimzed. + + +Once you configured your project with debug or optimzed it will no +longer build with default. + + + + + + +Wrong +autoconf version &etc; Error + +There are several error messages concerning too old versions of +autoconf &etc; prohibiting +configure to work properly. Run +autoreconf in the directory tree where the +configure.in files in question are. This command will +try to update the information in the &GNU; Build System files. See +man autoreconf for more information. + + + + + +Other Topics + +Configuration +Files used by &kdevelop; + +Usually you should not need to care, but this is very useful to know +in case something went wrong with your setup. + + + + + diff --git a/doc/kdevelop/open-project.png b/doc/kdevelop/open-project.png new file mode 100644 index 00000000..c7b1ee20 Binary files /dev/null and b/doc/kdevelop/open-project.png differ diff --git a/doc/kdevelop/open-recent-project.png b/doc/kdevelop/open-recent-project.png new file mode 100644 index 00000000..20a1adc6 Binary files /dev/null and b/doc/kdevelop/open-recent-project.png differ diff --git a/doc/kdevelop/plugin-tools.docbook b/doc/kdevelop/plugin-tools.docbook new file mode 100644 index 00000000..1c07cb7a --- /dev/null +++ b/doc/kdevelop/plugin-tools.docbook @@ -0,0 +1,433 @@ + +Plugin Tools + + + plugins + + +&kdevelop; contains a large number of little tools that help you to perform +certain task. Most of them are realized as plugins. That means, if you do not +need a plugin, you can disable it. +That also means, if you are looking for a functionality that should be there +and isn't, then maybe it's implemented in a plugin and that plugin is disabled. +For example, in the file menu there is a Quick Open feature, but only if +it's enabled in the Project - Project Options dialog. + + +Technically, plugins are based on the KDevPlugin class defined in +lib/interfaces/kdevplugin.h. The following is taken from a comment from there. + + +KDevPlugin is the base class for all KDevelop plugins. +A plugin is a component which is loaded into KDevelop shell at startup or by request. +A plugin has a scope that can be either: + +Core +Global +Project + + + +Core plugins are global plugins which offer some important "core" functionality and thus +are not selectable by user in plugin configuration pages. + +Global plugins are plugins which require only shell to be loaded and do not operate on +KDevProject interface and/or do not use project wide information. +For example, the uimode plugin allows a developer to select which user interface they wish to use. + + +Project plugins require a project to be loaded and are usually loaded/unloaded along with the project. +If a plugin operates on project-related information then it is a project plugin. +The Automake Manager, for example, only needs to be active when an Automake based project is currently loaded. + + +As stated above, core plugins cannot be disabled. Global plugins can be +enabled/disabled in Settings +Configure KDevelop... +under Plugins. +Project plugins can be +enabled/disabled in Project +Project Options... +under Plugins. +Active plugins can have many effects on KDevelop. +Depending on their function, they may add extra menus, extra menu items, extra tool buttons, etc. + + +Plugins which are disabled do not clutter your menus and are not loaded +into memory. + + + +The following plugin list is generated by a small script +(listplugins.sh) written by Volker Paul. All plugins have a .desktop file +where information such as name and comments are written. +If in the following these comments are not very useful, +it is because the plugin authors made them this way. +The plugins are grouped by scope (Core, Global, Project). + +Scope: Core + + +Application Wizard +Application Wizard + +Difference Viewer +Difference Viewer + +FileCreate +FileCreate + +FullScreen +FullScreen + +Tip of the Day +Tip of the Day + +User-Interface Selection +Provides a dialog for UI-mode selection. + +VCSManager +Version Control System Manager + + +Scope: Global + + +Abbreviation Expansion +Provides support for customizable abbreviations - short words which expand into commonly needed code structures. + +Documentation +The Documentation plugin offers browsing and searching in local and online documentation with support for multiple documentation systems. + +FileList +Provides a list of all currently open files. (Handy when the tab bar is not quite wide enough.) + +File Selector +Powerful network transparent file browser utility. + +Shell Filtering and Insertion +Provides a way of manipulating editor text using commandline tools. Appears in the Tools menu. + +Grep Frontend +Integrates "find|grep" in KDevelop - allows fast searching of multiple files using patterns or regular expressions. + +Embedded Konsole +This plugin gives KDevelop an embedded konsole for quick and easy command line access. + +"Open with" Menu Addon +This plugin provides additional "open" alternatives for various context menus in KDevelop. + +Part Explorer Tool +A Graphical tool for performing KTrader-like queries about registered services + +Regular Expression Tester +Tool to design and test regular expressions against common regexp syntaxes. + +Replace Part +This plugin is an interactive projectwide "Search and Replace" tool. Search using string or regexp matching, and select the replacements to be made from a preview before the action is finalized. When loaded it appears in the Edit menu. + +Scripting +The Scripting plugin offers KScript based scripting of the KDevelop application + +Code Snippets +This plugin allows you to store code snippets and add them to your code + +Text Structure +Provides a structure overview and navigation for HTML and TEX files + +Tools Menu Addition +This plugin provides an easy way to add external applications to the Tools menu and toolbar. + +Valgrind Frontend +Valgrind is a tool that helps you find memory management problems in programs. http://developer.kde.org/~sewardj/ + + +Scope: Project + + +annotation Plugin +annotation Description + +Source Code Formatter +A plugin for formatting of sourcecode according to a specified set of rules. When loaded it is found in the Tools menu. + +Bookmarks +Plugin that provides navigation and overview of active source bookmarks and persists them between sessions. + +Class View +This plugin displays a graphical view of all the classes in the project, complete with methods and attributes, and provides a way of direct source navigation. + +CopyTo +Simple file uploader plugin. It does a file copy over any KIO supported protocol. + +CTags Frontend +CTags is a source navigation tool with support for many languages. When loaded it provides a context menu for finding type declarations/definitions and also a query dialog. http://ctags.sourceforge.net/ + +Final Packaging Support +Aids in building and publishing the final project. Only RPM package format is supported for now. + +Doxygen Support +The doxygen plugin provides a way to specify and control generation of documentation for a project, based on source code content. You need to have doxygen installed to be able to use this. For more info goto http://www.doxygen.org + +QuickOpen +Provides an efficient way of finding/opening files, classes and methods in a large project. Appears in the File and Tools menus when loaded. + +Security Checker +Code security checker + +So far the generated plugin list. + + + +Project Management Plugins in &kdevelop; + + + antproject + ANT Project Manager (&Java; applications) + + + autoproject + Automake Project Manager + + + customproject + Custom Project Manager + + + trollproject + QMake based Project Manager + + +
+The above plugins are currently (May 2005) empty. Maybe +project management support will be implemented as plugins +in the future. + + + +Language Support Plugins in &kdevelop; + + +cppsupportSupport for C/C++ +fortransupportSupport for Fortran +javasupportSupport for &Java; +perlsupportSupport for Perl +phpsupportSupport for PHP +pythonsupportSupport for Python + +
+ + +In the following, some of the plugins will be discussed in detail. + + + + +The <command>abbrev</command> Plugin +abbrev + + +This plugin expands abbreviations into frequently used code snippets. It is +activated by pressing Ctrl +Space. For example, when you enter +"ife" into a C++ in the editor and press +CtrlSpace, you obtain +an if-else code template and save some key strokes. The set +of supported abbreviations depends on the programming language of the edited +file. For example, for PHP you will obviously be interested in other code +templates than for &Java;. + + + + +The set of code templates is configurable. If the plugin is enabled, you can see +which ones are available in the Settings +Configure KDevelop... +dialog under Abbreviations. + + + + + +The <command>filter</command> Plugin +filter + + +This offers two features. If you select Tools +Execute command, you can enter a shell +command. The output of this command is inserted into the editor buffer when +you hit the Start button. + + + + +A related feature is available under +ToolsFilter selection through +command.... In order to use this, you must +select a text area in the editor. If you now enter a shell command and hit +the Start button, the command is started and the +selection used as the standard input for it. The standard output of the +command is then inserted into the editor, replacing the selection. + + + +For example, if you write documentation, you frequently have to refer +to menu items. To do this correctly for e.g. the Copy command in the +Edit menu, you have to write: +<menuchoice><guimenu>Edit</guimenu><guimenuitem>Copy</guimenuitem></menuchoice> +This is cumbersome, so you'd rather just write "Edit - Copy" +and let the computer do the tagging. +Here is how you can do it. +You write a little shell script called mef you put e.g. in your home's bin directory: +sed s/"^\(.*\) - \(.*\)\$"/"<menuchoice><guimenu>\1<\/guimenu><guimenuitem>\2<\/guimenuitem><\/menuchoice>"/ +Don't forget to make it executable. +That's all. Now, in your documentation .docbook source, you write "Edit - Copy". +You select this text you just wrote, choose +ToolsFilter selection through +command... and call ~/bin/mef. +Instantly "Edit - Copy" is replaced by +<menuchoice><guimenu>Edit</guimenu><guimenuitem>Copy</guimenuitem></menuchoice> + + + + + + + +The &doxygen; Plugin +&doxygen; +documentation tool +API documentation + + +This one helps you to use the &doxygen; API documentation tool +(). You can select +Project +Run Doxygen to generate API +documentation for your current project, based on the configuration given by +the file Doxyfile in your project directory. + + + + +Furthermore, you can configure &doxygen; in the +Project +Project options... dialog. This dialog +is very similar to the &doxywizard; tool. + + + + + +The &ctags; Plugin +&ctags; + + +Although the class browser gives you extensive insight into the symbols and +classes of your project, you may also want to use the ctags tool. In particular, +this one supports a lot more language than the class browser. + + + + +You activate this plugin under Tools +CTags.... When you start it the first +time, you will be asked to generate a search database first. When you accept +this, the &ctags; program will be started and will create a file named +tags in your project directory. This is a text file containing +all symbols of your source files. + + + +You can search in the symbol database in two ways: when the +Regular expression match box is checked, the text you +enter will be interpreted as a regular expression (POSIX flavor) and matched +with the existing symbols. For example, the text .*Widget +will search for all symbols ending with Widget. If the +box is not checked, the search will be verbatim. + + + +When searching, you will get a list of the matched symbols, accompanied with +the line numbers where they are defined. You jump to the respective point by +clicking on the list. + + + +For some languages, &ctags; distinguishes different kinds of symbols. For +example, Python has classes and functions. You can selectively search only +for classes by checking the respecting kinds in the dialog. + + + +The symbol database is normally not updated when your sources change. +Consequently, after a while the line numbers will not be correct anymore +and newly added classes and functions will be missing. Therefore you should +update the tags file in regular intervals by pressing +the button Regenerate. + + + + + +The <command>astyle</command> Plugin +astyle +Artistic Style +indentation + + +Astyle is a plugin for formatting of sourcecode according to a specified set of rules. + + + + + + +The <command>regexptest</command> Plugin +regexptest +debuggingregular expressions +regular expressionsdebugging + + +Designing with regular expressions can be hard work. Often the first try at an +expression matches too many strings. In particular, when working with a +compiled language, the turnaround times when debugging a regular expression +can be awkward. The regexptest plugin allows you to directly explore the +changes in a regular expression. It is activated by choosing +Tools +Debug Regular Expression.... + + + + +In the flavor group box, you can choose the flavor of the regular expression +engine used. Currently supported is the flavor defined in the POSIX standard, +which is used by the &grep; program, and the extended POSIX syntax used by the +program &egrep;. + + + +When you enter an expression, you get immediate feedback about any syntax +errors in it. By entering a text under Test string, +you can see whether the expression matches this string. In particular, if +your regular expression includes groups, such as ([a-z]), +the content of the matched subgroups will be shown in a list box. + + + + + + + +
+ + diff --git a/doc/kdevelop/problem-report-all-todos.png b/doc/kdevelop/problem-report-all-todos.png new file mode 100644 index 00000000..7b2d1b62 Binary files /dev/null and b/doc/kdevelop/problem-report-all-todos.png differ diff --git a/doc/kdevelop/problem-report-marks.png b/doc/kdevelop/problem-report-marks.png new file mode 100644 index 00000000..1e01ebdf Binary files /dev/null and b/doc/kdevelop/problem-report-marks.png differ diff --git a/doc/kdevelop/problem-report-todo.png b/doc/kdevelop/problem-report-todo.png new file mode 100644 index 00000000..56ccbd54 Binary files /dev/null and b/doc/kdevelop/problem-report-todo.png differ diff --git a/doc/kdevelop/project-advanced.docbook b/doc/kdevelop/project-advanced.docbook new file mode 100644 index 00000000..d597e65e --- /dev/null +++ b/doc/kdevelop/project-advanced.docbook @@ -0,0 +1,83 @@ + + + + + BerndPol + + + + +Advanced Project Management + + +Loading Projects + + +Loading a Recently Used Project + + +(... to be written ...) + + + + + + + + + How to open a recent project + + + + + + + + +Loading an Existing Project + + +(... to be written ...) + + + + +Converting Old KDevelop Project Files + + +&kdevelop; allows you to open old KDevelop 2.x project files and convert them to &kdevelop; files. To do so go to Open Project... and select KDevelop 2 project files in the Filter:. Then select project file you want to open. The project gets converted to &kdevelop; and saved as a &kdevelop; project file. + + + + + +Importing an Existing Project + + +To import an existing directory in &kdevelop; select Import Existing Directory +from the Project menu. You should see the Import Directory Wizard, as seen below: + + +
+The Import Directory Dialog + + + +
+ +
+ +
+ + + + +Tailoring the Project — Project Options + + +(... to be written ...) + + + + +
diff --git a/doc/kdevelop/project-management.docbook b/doc/kdevelop/project-management.docbook new file mode 100644 index 00000000..38a3ff8d --- /dev/null +++ b/doc/kdevelop/project-management.docbook @@ -0,0 +1,751 @@ + + + + + BerndPol + IanWadham + + + + +Building and Project Management + + +This chapter deals only with compiled projects, such as C++, &Java; or +Fortran projects. Projects for scripting languages like Python and +PHP work very differently. + + + +You will find here information on: + + + Summary of &automanag; containing an initial overall view of &automanag;, + + + Automake Manager Operation describing the basics of how to work with &automanag;, + + + + +Summary of &automanag; + + +In the Build systems chapter we have given a rough overview of the build systems commonly in use on &UNIX; systems. In the following sections we will look at this in more detail. + + +There is some confusion about how to name such things. &GNU; calls them build systems when it describes Automake, Autoconf and Libtool. QMake calls itself a tool to write Makefiles for different compilers and platforms. In &kde; often the term project management systems is used. We will use this term in a broader sense to describe the built-in environments in &kdevelop; which are used to organize and build your projects. In the context of this section, however, we will mostly talk about automated build systems. + + + +The Need for an Automated Build System + + +If you have a simple Hello World program, written in C, you can compile and link it using &gcc; -o hello hello.c and execute it using the command ./hello, so you do not even need a Makefile. + + +If you have a C application with several modules and header files and you are only going to run it on your own machine (&ie; it is an in-house application), you will only need a simple Makefile, which is fairly easy to write by hand (use info make to find out more). + + +The complications begin when: + + + + Your source-code, documentation, graphics, sounds, translations, data files, &etc; are located in more than one directory, + + + You have a hierarchy of directories and sub-directories, + + + You are using libraries that are not part of the traditional &UNIX; set, such as the &Qt; Object Library or the &kde; Desktop libraries, + + + You are using a pre-processor to generate some of your source-code, such as Qt's MOC pre-compiler, + + + You aim to distribute your application worldwide, to people who may not have the same &UNIX;/&Linux; system, software and hardware as you, + + + You require an automated Install and Uninstall facility, + + + You aim to make your application part of the &kde; Desktop set. + + + + +If you have some or all of the above situations, you probably need a build system. In the example above we used &gcc; to compile and build the Hello World program, but not all C compilers are called &gcc;. So if you distribute your application to someone who is using some other C compiler, your Makefile must somehow use the name of that person's compiler, otherwise your application will fail to compile—and that is just simple example of what can go wrong. + + +A build system will iron out these differences for you. + + + + It will check that the libraries you need are present on each receiving machine, + + + will automatically scan all your application directories for files to pre-process, compile or install and + + + will install the components of your application in the correct receiving directories, making sure that + + + the directories are created in the receiving machine as required. + + + + +In brief, a build system offers safe and secure methods for your application to be compiled and installed correctly on any receiving machine. As we have shown before in the Project Management Systems survey, &kdevelop; offers three automated build systems and the option of creating your own Makefile, in short (click on the project names to get more information): + + + + Automake projects which use the &GNU; standard development tools. + + + QMake projects which use the trolltech QMake project manager. + + + ANT projects which use the Apache ANT project manager for &Java; development. + + + Custom projects which require you to maintain your own Makefiles. + + + + + +One of these four alternatives must be chosen when you create a project and the choice is difficult to change later, so you should give it some thought before you start. + + + + + + +Tutorials on Autoconf/Automake/Libtool + +There are several tutorials available on the &GNU; Build System (Autoconf, Automake and Libtool) of which the &automanag; makes use. + + + A short autoconf tutorial written by Christopher W. Curtis available on the &kdevelop; home page. It concentrates on some basic steps to modify a Makefile. + + + A more detailed tutorial can be found in a greater set of tutorials on Developing software with GNU. + + + And there is the famous Goat Book, titled Autoconf, Automake, and Libtool. This is an easily readable, yet concise, introduction in all main aspects of the &GNU; Autotools. + + + + + + +What does &automanag; Do? + + +The &appwizard; will have set up some initial Makefile.am files when you created a New Project of a type that uses the &GNU; Build System, such as C++ KDE Application framework. During development &automanag; creates any other Makefile.am files for projects that use the &GNU; Build System and maintains them all, &appwizard; and &automanag; created alike. + + +There will be one Makefile.am file in each directory of your project that contains files to be compiled or installed. It will contain your specifications for compiling, building and installing files and a reference to any subdirectories that also have a Makefile.am file and possibly some files to compile, build and install. + + + +Your project's directories and source files may be structured to any depth, or you may prefer a flat project-structure with all subdirectories at the top level. + + + +The aim of the &GNU; Build System is to produce source-code file structures that can be compiled, built and installed on any &UNIX; or &Linux; system by using the simple commands: + + + +./configure +make +make install # Usually as "root". + + +and can be uninstalled by the command make uninstall (usually as root). + + + +How does this work? Well configure is a script that + + + + works out the details of whatever system it is in, such as what compiler and libraries to use and where they are located, and then + + + creates recursive Makefile files by filling in the substitutions in the corresponding Makefile.in files. + + + + +The Makefile.in are input files—templates which provide basic information for the Makefiles to be produced from them by filling in some system dependent information. They are generated by the Automake utility from the Makefile.am files. + + +The process of going from Makefile.am (.am denotes Automake template files) to Makefile files is handled automatically by the &kdevelop; &promanag;, using the Autoconf utility, M4 macros and other arcana we need not go into here. + + +So when make runs, it automatically picks up the correct pieces from the current environment, such as compilers and libraries. Similarly, make install puts your application components, such as executables, documentation and data files in the correct places for that environment. + + + +If you distribute your application as a tarball (a single compressed file that &kdevelop; can create for you), it will include the Makefile.in files and the configure script file, so the recipient can compile, build and install your application without having Automake, Autoconf or &kdevelop; on their machine. The Makefile.am files are also included, just in case the receiver needs to do any source-code modifications. + + +The rules are rather different if you distribute via a web-based source-code repository such as &kde; &cvs;. + + + + + +Summary of What Automake Manager Does + + + + Generates Makefile.am files in subdirectories it knows as subprojects. + + + Updates Makefile.am files as the project structure changes. + + + Updates Makefile.am files as files are added to or removed from the project. + + + Accepts definitions of how the various files are to be built or installed and modifies the Makefile.am accordingly. + + + Accepts parameters used in building or installing (⪚ library names) and ensures that they are used in the required compilation and build steps. + + + + + + +Contents of Automake Files + + +A Makefile.am file has lines containing variable-names followed by an equals sign and a list of files or parameter values. The variables have two-part names, such as bin_PROGRAMS, myapp_SOURCES or kdelnk_DATA. The second part is called the primary and represents something from which to build or install. The first part is called the prefix and represents: + + + + A directory in which to do installation (⪚ bin), + + + A qualifier for the primary (⪚ myapp for SOURCES, indicating that the source files listed after myapp_SOURCES go into building myapp), + + + A special prefix noinst (short for no installation), usually used to list program header files (.h), + + + Or the special prefix EXTRA, for configuration-dependent stuff. + + + + +For more information on Automake and Makefile.am files, look up info Automake. + + +Basically, &automanag; creates and updates the variable-names and lists of files or parameters. See the following example of a Makefile.am for a typical application, called myapp. + + + +## Makefile.am for myapp + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = myapp + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# the library search path. +myapp_LDFLAGS = $(KDE_RPATH) $(all_libraries) + +# the libraries to link against. +myapp_LDADD = $(LIB_KFILE) $(LIB_KDEPRINT) + +# which sources should be compiled for myapp +myapp_SOURCES = main.cpp myapp.cpp myappview.cpp + +# these are the headers for your project +noinst_HEADERS = myapp.h myappview.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +KDE_ICON = myapp + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = myapp.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/myapp +rc_DATA = myappui.rc + +AM_CXXFLAGS = -DMY_C++_PREPROCESSOR_OPTION + + + +As you can see, many of the items on the right hand side are symbols of the form $(xxx). These are environment variables which are defined in the actual &kde; environment and are substituted with real values when ./configure generates the final Makefile files in the receiving machine. + + + +Also, sometime after you have started with &kdevelop;, it is a good idea to run the command ./configure --help, which will show you the range of things you can change at build and installation time, such as for a test environment. In particular, the command: + + +./configure --prefix=/where/you/wish + +will re-direct the entire installation to a directory structure of your choice, by changing the internal variable $(prefix) to value /where/you/wish. + + + + + + + + + +Automake Manager Operation + + +In this chapter you will find a basic description of the &automanag; elements and how to use them. This covers: + + + The &automanag; Window describes the basic structure of the &automanag; main window. + + + The Overall View Window describes the elements of the upper subwindow. + + + The Detail View Window describes the elements of the lower subwindow. + + + Navigating in the &automanag; lists some basic operations you can perform in the &automanag;. + + + Popup Menus in the &automanag; describes the windows which will pop up when you select an action in the &automanag;. + + + + + +The &automanag; Window + + + + + + + + + + + &automanag; runs in a split window. The top part is called the Overall View and the bottom part is called the Detail View. Between them is a narrow bar that can be dragged with the mouse to adjust the sizes of the views. In IDEAl mode you can also drag the side of the split window to change the width. + + + On top of each view there is a toolbar, the buttons in which will become activated when an element in this view is selected. This provides one way you can access the actions provided for that view element. The other are context menus which pop up on right mouse button click as will be discussed below. + + + In IDEAl mode there are two additional small buttons in the &automanag; window titlebar left hand side – a triangular shaped right arrow, and a dot button. The arrow button is used to close the window. The dot button on the other hand will keep the window open even if another &kdevelop; window has been selected. (Otherwise the &automanag; window will automatically close whenever another window gets the input focus.) + + + + + + + + +The Overall View Window + + +The overall view window contains a tree-list of all the directories in your project that contain program files, documentation or data. Each such directory contains a Makefile.am file and is known in &automanag; as a subproject. There are three typical subprojects in a &kde;-based project as shown in the above illustration: + + + + + src – source-code files for your application, + + + doc – your user manual or Handbook, + + + po – extracts of strings in your source-code files that require translation into other human languages (⪚ window titles, menu names, button labels, dialog box text and messages of various kinds). + + + + +Note that the doc subproject always has an en subproject, which you can see if you click on the + symbol next to the word doc. That is because the base language of all documentation in &kde; is United States English (en). If your application becomes part of &kde;, the &kde; translation teams may translate your documentation from United States English into other languages and the translations will go into other subprojects, such as de (German) or fr (French). The strings in the po subproject may also be translated and stored in other files in po, thus allowing your application to be operated by people who do not know English. + + + +The doc and po subprojects serve different purposes. doc contains documentation like a user manual, po contains translatable text strings of the user interface which is integrated in the source code of this application. + + + +The overall view window serves—amongst other things—as a navigation tool. If you select a subproject in the overall view window, the corresponding details will be shown in the detail view window. + + + + + +The Detail View Window + + +The detail view contains a tree-list of all the files in the subproject currently selected in the overall view as well as the compilation, build and installation rules for this subproject. Thus the two views together can give you access to all the components of your application and all the information on how to compile, build and install it. + + + +Targets + +The tree-list in the detail view has two levels. The top level consists of so-called &automanag; targets and the next level contains lists of files that go to make up each target. + + + +This concept of an &automanag; target differs somewhat from what a Makefile target usually is. In short: + + + The definition of how a set of files is to be compiled, built or installed is known as a target in &automanag;, but as a variable in Automake itself. + + + A target in make is often something quite different, being the parameter of a make command (⪚ make install, make clean). + + + However some Makefile.am variables do represent an underlying sub-target in make. + + + + + + + +Navigating in the &automanag; + + +In both the overall and the detail view you can left-click on the + or - next to a subproject or target name to expand or contract the tree view. If you do that with a subproject in the overall view, it shows or hides the subprojects at the next level down (if any). If you do it with a target in the detail view, it shows or hides the list of files that go into that target. + + + + +Opening a file for Edit + +If you &LMB; click on a file name in the detail +view, the corresponding file opens up in &kdevelop;'s editing window. + + + + +Activating the &automanag; Toolbar Buttons + + +If you &LMB; click on the name of a subproject in the +overall view or target in the detail view, the name is highlighted and some +toolbar buttons become active in the top part of that view. + + + + It is recommended that you use the right mouse-button and popup menus, rather than the toolbar buttons, because it is then much easier to see and understand what you are doing. + + + Operations on subprojects and targets have far-reaching effects on the structure, compilation, building and installation of your application. + + + + + + +Selecting Actions/Popup Menus + + +If you &RMB; click on the name of a subproject, target or file, a menu pops up and you can then select actions to perform on the subproject, target or file, such as add a target to the subproject, add a file to a target or logically remove the selected file from its target. + + + + + + + + +Popup Menus in the &automanag; + + +The following sections explain in short terms which operations the menus make available which will pop up on right mouse button clicks in the &automanag; window. They are meant for overall view only. You will find detailed descriptions of most operations in a later chapter. + + + + +The Popup Menu for a File + + +When you &RMB; click on a file name in the detail view the following menu will pop up allowing you to select one of several operations to be performed on that file. In the illustration below the hi-16app-myapp.png icon file was selected from the Icon data in myapp target of the myapp/src subproject. + + + + + + + + + + + + The main popup-menu item for a file is to Remove the file from its target (&ie; it will no longer be used to compile, build or install that target). + + + The CVS item offers a variety of CVS operations on the file. + + + The Open With item allows you to open the file with a variety of editors or with any application at all (⪚ you can open the icon file in our example with KIcon). + + + The Perforce item is used for similar operations as in CVS using the commercial Perforce version control system. + + + + + + + + +The Popup Menu for a Target + + +When you right-click on a target in the detail view the following menu will pop up allowing you to select one of several operations to be performed on it. In the illustration below the myapp (Program in bin) target of the myapp/src subproject was selected. + + + + + + + + + + + + The Options item for a target only applies to source code files. In the corresponding dialog box you can specify linker flags and paths on which to locate libraries and you can give a list of actual libraries to be linked in to your application. + + + The Create New File item brings up a dialog in which you can set the file name and the type of file to be generated (from a drop-down list). + + + The Add Existing Files item brings up a dialog box in which you can add an already existing file to this target. + + + The Remove item for a target allows you to logically remove the target and all its files from the project structure. + + + The Make Target Active item only applies to targets containing source code files. New files will always be added to such an active target. + + + The Build Target item calls all necessary compile and make operations to build the code for this target only. + + + + + + + + +The Popup Menu for a Subproject + + +When you &RMB; click on a subproject in the overall view window the following menu will pop up which allows you to make major changes to the structure of your project and the way it is compiled, built and installed. You can use it to expand or modify the basic project structure that the &appwizard; has created. + + + + + + + + + + + + + The Options item for a subproject controls the way that the subproject will be compiled, built and installed. The dialog box that pops up has tabs for Compiler, Includes, Prefixes and Build Order. + + + The Add Subproject item creates a new directory and skeleton Makefile.am file. + + + The Add Target item pops up a dialog in which you can set the rules for compiling, building or installing a group of files within your subproject. + + + Add Service (... to be written ...) + + + Add Application (... to be written ...) + + + Add Existing Subprojects (... to be written ...) + + + The Remove Subproject item in the popup menu for a subproject is the proper way to remove a subproject. It will adjust the Makefile.am files accordingly. You will also be offered the option to delete all the files (or links) in the corresponding subdirectory. Obviously, this feature should be used with caution. + + + The Build item calls all necessary compile and make operations to build the code for this subproject only. + + + Force Reedit (... to be written ...) + + + Clean (... to be written ...) + + + Install (... to be written ...) + + + Install (as root user) (... to be written ...) + + + + + + + + + + + + + + +Automake Projects +autoproject +&automake; +&autoconf; +&libtool; + + +(... to be written ...) + + + + +Autoconf +configure script +config.status script +Makefile.in +config.h.in + + +Makefile.in into Makefile + + + +prefix = @prefix@ +INSTALL = @INSTALL@ +build_triplet = @build@ +CXX = @CXX@ + + + +prefix = /home/bernd/kde3 +INSTALL = /usr/bin/ginstall -c -p +build_triplet = i686-pc-linux-gnu +CXX = g++ + + + +config.h.in into config.h + + + +/* Define if you have libz */ +#undef HAVE_LIBZ +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + + + +/* Define if you have libz */ +#define HAVE_LIBZ 1 +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + + + + + + +Automake + + +(... to be written ...) + + + + + + +&kdevelop;'s &automanag; + +
+A screenshot of the automake manager + + + +
+ +
+ + + +Building and Installing Libraries + + + + + -rpath + + + PIC + + + static + + + plugins: no-undefined + + + + + + +
+ + + + +Custom Makefiles and Build Scripts +Makefile +build.xml + + +(... to be written ...) + + + + + + + +Compiler Options + + +(... to be written ...) + + + + + + + +Make Options + + +(... to be written ...) + + + + +
diff --git a/doc/kdevelop/raw-project-warning.png b/doc/kdevelop/raw-project-warning.png new file mode 100644 index 00000000..c9065815 Binary files /dev/null and b/doc/kdevelop/raw-project-warning.png differ diff --git a/doc/kdevelop/run-button.png b/doc/kdevelop/run-button.png new file mode 100644 index 00000000..51522e90 Binary files /dev/null and b/doc/kdevelop/run-button.png differ diff --git a/doc/kdevelop/script_location.png b/doc/kdevelop/script_location.png new file mode 100644 index 00000000..e5488024 Binary files /dev/null and b/doc/kdevelop/script_location.png differ diff --git a/doc/kdevelop/select-user-interface-0.png b/doc/kdevelop/select-user-interface-0.png new file mode 100644 index 00000000..c98faf71 Binary files /dev/null and b/doc/kdevelop/select-user-interface-0.png differ diff --git a/doc/kdevelop/select-user-interface.png b/doc/kdevelop/select-user-interface.png new file mode 100644 index 00000000..927ad411 Binary files /dev/null and b/doc/kdevelop/select-user-interface.png differ diff --git a/doc/kdevelop/setup.docbook b/doc/kdevelop/setup.docbook new file mode 100644 index 00000000..e5449a99 --- /dev/null +++ b/doc/kdevelop/setup.docbook @@ -0,0 +1,1990 @@ + + + + + BerndPol + + + + +Configuring &kdevelop; + + +&kdevelop; is a very powerful and flexible IDE which offers many ways to tailor it to your needs. To start configuration select SettingsConfigure &kdevelop;.... This will cause the configuration dialog to pop up consisting of a selection window to the left and the configuration dialog on the right hand side whose contents will vary upon the configuration item you did select. + + + + + + + + +Select a configuration item + + + Select a configuration item + + + + + +We will discuss these configurations in a different order, split up into the main topics of General Configuration, Configuring the Documentation, and Advanced Configuration which makes for a more intuitive reading. + + +If you want directly look up a certain configuration item use one of the following links. + + + + General + User Interface + File Templates +Editor + Abbreviations + Scripting + Tools Menu + External Tools + Documentation + Code Snippets + File List + File Selector + C++ Class generator + Formatting + C++ Parsing + + + +General Configuration + + +General configuration concerns the more common tasks of tailoring &kdevelop; as there are: + + + + General Setup + + + Selecting the User Interface + + + +Source Edit Tasks + + Selecting an Editor + + + Selecting a Source Format Style + + + Setting Up the Code Snippets Tool + + + + + Configuring the File Selector + + + + +General Setup + + +The General configuration dialog allows you to define some basic &kdevelop; behaviour which seldom will change in everyday work. This concerns: + + + + +General project options such as + + + + defining a default parent directory &kdevelop; shall use for new projects. + + + deciding whether you want &kdevelop; to automatically load the project you last worked on. + + + + + + +Selecting a font for the most commonly used output view windows, +namely: + + + + +the Messages Output +View &kdevelop; uses to communicate ⪚ compilation progresses, +and + + +the Application Output +View which will show error and state information concerning a running +application. + + + + + + + +Some common behaviour concerning the displayed lines in the +Messages Output View window, namely: + + + +whether long lines will wrap + around, and + + +if directory entry and exit +messages issued by make will be shown. + + + +The level of detail of + messages concerning the compilation process shown in the + Messages Output View window. + + + + + + + + + + + The general configuration dialog + + + + + + +Load last project on +startup + + +Mark this checkbox if you want to continue to work with the last project you worked on. This will cause &kdevelop; to automatically load this project on start-up. It will usually be shown in the state you left work so you can readily proceed. + + + + + + +Default projects directory: + + +By default, &kdevelop; uses a common parent directory for all new +projects. Enter the absolute path of this common directory in the box or +select it from your directory structure. &kdevelop; will place the any new +project here as a subdirectory. + +You may of course change the directory path of a new project at the time you set it up in the &appwizard;. + + + + + +Window font: + + +The Application Output View window is used to display error and state information from applications which are run from inside &kdevelop;. These are informations the applications usually sends to the console when run stand-alone. So you do not need to leave the IDE when testing the application you currently work on. + + +To select a font suitable for the Messages Output View window click the Window Font button showing the currently selected font (it says Luxi Sans in the above illustration). The &kde; standard Select Font dialog will pop up from which you may select the font to be used. + + +On first start-up, &kdevelop; initializes this font setting to the standard font for which your &kde; user has been configured. This setting is fixed, so if you alter PreferencesAppearances & ThemesFonts in the Control Center, this will not effect this &kdevelop; font selection. You will have to explicitely reselect the Messages Output View window font. + + + + + +Compiler Output + + +&kdevelop; preprocesses the messages the Messages Output View window receives during the build processes in order to filter superfluous information. You can control the level of detail &kdevelop; will display using the dropdown box in this field. + + + +Very Short + +Displays only warnings, errors, and the filenames which are compiled. + + + +Short + +Suppresses all compiler flags and formats the output to be more readable. + + + +Full + +Displays all output messages unmodified. + + + + + +There is an alternative way to switch the compiler output detail. Just right click in the Messages Output View window and select the according detail level from the popup menu. + + + + + +Line wrapping + + +By default, &kdevelop; will wrap long lines around in the Messages Output View window so that valuable information will not be easily overlooked. In some cases this will clutter long message lists. Remove the checkbox mark if you do not want the lines wrap around. + + +There is an alternative way to switch the line wrapping. Just &RMB; click in the Messages Output View window and mark/unmark the Line Wrapping entry in the menu which will pop up. + + + + + +Directory navigation +messages + + +The make tool usually will display messages like Entering directory, or Leaving directory when it switches the directories it currently works in. As this clutters the messages list in the Messages Output View window, &kdevelop; suppresses those messages by default. Mark the checkbox if you want to protocol which directories make worked in. + + +Changes in this setting effect the processing of new messages only. Old directory navigation messages will be kept visible when you switch this feature off. + + + + + +UI Designer Integration + + +This let you choose the way you want .ui files to be displayed in &kdevelop;. &kdevelop; comes with its own UI designer called KDeveDesigner that can either be embedded or be run as a separate program. Qt Designer can also be used to edit .ui files. + + + + Use &kdevelop;'s embedded designer + This uses &kdevelop; own designer embedded within &kdevelop; + + Run &kdevelop;'s designer as a separate application + The KDevDesigner application will be run separately in its own window. + + + + + + + KDevDesigner in its own window + + + + + +Run Qt Designer + Qt Designer from your Qt installation will be started externally whenever you click on a .ui file in &kdevelop;. + + + + + +Terminal Emulation + + +You choose here which terminal you want to be integrated within KDevelop. + + + + Use &kde; setting + This uses &kde; setting as set in &kcontrol; in &kde; component Component Chooser tab which sets the default terminal emulator used by all &kde; applications that need a terminal. + + Other + Choose some other terminal different from the default one. + + + + + + + + + + +Selecting the User Interface + + + user interface + switch modes + + switch UI modes + + +As already said in the Available User Interface Modes chapter there are five different ways the &kdevelop; work area may be set up, namely: + + + + Simplified IDEAl window mode + This is a simplified version of the IDEA user interface. It is designed to be simple and clean. It also does not uses docked toolviews. + + IDEAl window mode + This is a clone of the IDEA user interface, similar to the Tabbed pages mode and is default. + + Childframe window mode + All tool views are initially docked to the mainframe. +Editor and browser views will live like toplevel windows within a view area of the mainframe. +A typical example of this user interface mode is MS Visual Studio 6.0. + + Tabbed pages mode + All tool views are initially docked to the mainframe. +Editor and browser views will be stacked in a tab window. +A typical example of this user interface mode is KDEStudio, our friend C++-IDE in the world of KDE. + + Toplevel window mode + All editor, browser and tool views will be toplevel windows (directly on desktop). +The main widget contains the menu, toolbars and statusbar only. +A typical example of this user interface mode is Borland Delphi 6.0. + + + +To switch the user interface mode select Settings Configure &kdevelop;... from the menus. The Customize KDevelop dialog will pop up, where you have to select User Interface in the left hand tree. This will display the following settings dialog to the right. + + + + + + +Select a user interface mode + + Select a user interface mode + + + + + +Select the radio button of the user interface mode you want to switch to, then click OK. + + + +Do not forget to restart &kdevelop; in order to let any of these selections take effect. + + + +When you selected either the Simplified IDEAl window mode or the IDEAl window mode or the Tabbed pages mode two more configuration sections will become available: Use Tabs and Use Close On Hover. These allow to configure under which circumstances tabs will be shown on top of the document windows and whether you may close the document by a click on the tab icon. + + + +In Simplified IDEAl window mode and in IDEAl window mode only yet another configuration section will be available, Toolview Tab Layout which effectively allows to select between different sizes of the toolview tabs which surround the main working area in this mode. + + + + +Configuring the Documents Tab Bar Display + + +In the IDEAl and tabbed pages modes there will be named tabs on top of the document windows by default, so you can easily select different documents with a &LMB; click. If you prefer to provide more space for the document windows in the &kdevelop; main work area, you may change to another behaviour in the Use Tabs configuration section. + + + + + Always + + This is the default — show a tab comprising an icon and the document name on top of any document window in the &kdevelop; main area display. + + + + When more than one + + Do not show a tab when only one document is displayed. If there is more than one document, however, &kdevelop; will display an according tab bar as in the Always selection above. You may want to select this mode if you work on a single document most of the time as this provides more vertical space. + + + + Never + + Never show any document selection tab. You may prefer this mode if you seldom use the mouse to switch between documents. It provides more vertical space for all document windows. To select another the document window or to close any, use the &kdevelop; Window menu. + + + + + + + +Setting Up to Close a Document by a Click On Its +Tab + + +When you configured &kdevelop; to display the documents tab bar, either always or when more than one document is displayed in the main work area, you may add more functionality to the tabs beyond their document selection capability. Use the Use Close On Hover coniguration section for this. + + + + + No + + This is standard behaviour. No extra functionality is added to the tabs. They may be used only to select document windows on &LMB; clicks. + + + + Yes + + When you selected this radio button, &kdevelop; will allow to close a document window by a &LMB; click. Use the mouse to point at the small icon on the on the left tab border. It will change to a close symbol. Now click with the &LMB; on this changed symbol and &kdevelop; will close the according document window. + + + + Yes, Delayed + + After selecting this radio button, &kdevelop; will allow to close a document window as shown in the Yes case above. The icon will not change instantly, however, but there will be a short delay before the close icon shows up. + + + + + + + +Configuring the Toolview Tab Layout + + +The Toolview Tab Layout configuration section will be available in IDEAl mode only. Use these radio buttons to set up the look of the toolview tabs which surround the main working area in this mode. + + + + + Icons + + + Each tab will show an icon only. If the associated toolview is displayed, the tab will open and a descriptive text for this toolview be shown. You may want to use this mode if you work on a monitor with limited resolution. + + + The icons are not very descriptive, however. If you want to find out which toolview is assigned to a given tab, point at it with the mouse and wait a second. A short tooltip will then pop up with the toolview name. + + + + + Text + + This is the default toolview tab display mode. Each tab displays the name of its associated toolwiew. + + + + Text and Icons + + If the standard text toolview display looks too flat to you and you are working on a high-resolution monitor you may want to select this radio button. It will cause the name of the associated toolview be displayed on each tab plus an icon to the left of it, making the tabs easier to distinguish. See the Folded Toolview Tabs illustration below for an example. + + + + + + + +Folded Toolview Tabs + + +If you selected the IDEAl mode toolview tabs to display texts (with or without accompanying icons) you need not worry about them being hidden behind some toolview window. If one of the bottom toolview windows occupies more space than is available to display all (vertical) tabs, they will fold around as this illustration shows: + + + + + + + +Toolview tabs fold to not be hidden behind another view window + + Toolview tabs fold to not be hidden behind another view window + + + + + +The active toolview window must be shown fixed (non-overlap mode), sharing the work area with the other windows, to force such tab folding. Press the small square in the window border to accomplish this as shown in the example. + + + + + + + + +File Templates + + + + + + + +Configure File Templates + + Configure File Templates + + + + + + +Selecting an Editor + +&kdevelop; allows you to select your favorite text editor tool. Mark the Editor entry in the left hand side selections tree of the Configure KDevelop window. The following dialog will be displayed to the right. + + + + + + + +Select an editor + + Select an editor + + + + + +To select a new editor, click on the arrow on the drop down list field. Depending on the editor parts interfaces your &kde; version has compiled in you will be provided with a list of editors you may select from (see the Important note below for this). Click on the editor of your liking and click OK. Currently there are two possibilities: + + + + + Embedded Advanced Text Editor + + This is the &kde; standard Kate editor part. + + + + + Qt Designer Based Text Editor + + This is the editor &Qt; provides in its Designer component. + + + + + +These editor interfaces are fully integrated in the &kdevelop; IDE concept. Particularly the possibility to jump to the offending source code line by just clicking on an error message in the Messages Output View window has been provided. + + + +Changing the editor will not effect already open files. There are two possibilities to proceed. Either close all open text windows and reopen them one by one. Or simply close the whole project and reopen it again. The windows will then automatically open under the new text editor interface. + + + +KDevelop lets you use editor interfaces which have registered with &kde; and that provide a KatePart interface. If you miss one one of the selections shown above check your &kde; installation if the corresponding KPart was correctly installed. + + +What to do if the file has been changed externally: + + + Do nothing + + The file will be marked as externally changed and the user will be asked to verify any attempt to overwrite it. + + + + Alert the user + + A dialog will alert the user that a file has changed and offer the user to reload the file. + + + + Automatically reload the file if safe, alert the user if not + + Any files that are not modified in memory are reloaded and an alert is shown for any conflicts. + + + + + + +Abbreviations for the Word Completion + + +(... to be written ...) + + + + +Scripting + + +(... to be written ...) + + + + +Adding &kde; Standard Applications to the Tools Menu + + +(... to be written ...) + + + + +Adding External Applications to Menus + + +(... to be written ...) + + + +Adding to the Tools Menu + + +(... to be written ...) + + + + +Adding to the File Context Menu + + +(... to be written ...) + + + + +Adding to the Directory Context Menu + + +(... to be written ...) + + + + + + +Selecting a Source Format Style + + +&kdevelop; automatically formats a source text in a predefined style. This style is highly configurable. + + + +The reformat source feature is currently available for C, C++, and &Java; only. Especially you cannot use it for scripting languages like ⪚ PHP. This is because &kdevelop; uses the astyle application to implement this feature. + + + +To set up a specific format style, select Settings Configure &kdevelop;.. from the menubar. The Customize KDevelop dialog will pop up, where you have to select Source Formatter in the left hand tree. This will display a series of three settings dialog tabs to the right, namely a General Formatting Setup, a Indentation Style Setup, and a Other Formatting Setup. + + + +Any style changes apply to newly entered text only. If you want to change the formatting style of an already existing source text you will have to explicitely use the EditReformat Source command. + + + +The exact outcome of these style formatting definitions depends on the editor you use. Currently, most settings are tailored to the Kate editor part (the Embedded Advanced Text Editor). Some other editors (⪚ the Qt editor) may rely on their own configuration settings. You will have to experiment in this case to find out the exact effects of the style settings provided here. + + + +There may be incompatibilities between the configuration style settings provided here and the editor you use up to the extent that in extreme cases it even might destroy your files. Make sure you have a backup of your source files before you try out these settings with an none KDE standard editor. + + + +General Formatting Setup + + +The General tab of the Source Formatter dialog allows you to select one out of five predefined source format styles. + + + + + + + +Source format style general setup + + Source format style general setup + + + + + +A formatted source example will be displayed in the field to the right. If none of the predefined styles is to your liking, you may click the top User defined radio button and define your own source formatting style preferences on the other two tabs which will become available then. + + + +Currently only the predefined source formatting styles will be demonstrated by an example text. If you decide to define your own style, no example display will be available. You have to experiment on an actual source text to tailor the settings to your liking. + + + + + +Indentation Style Setup + + +Proper indentation is the main means to enhance readability of a source text. I you selected the Indentation tab of the Source Formatter dialog you will be presented with a series of indentation formatting choices grouped into three boxes as following. + + + + + + + +Source format indentation style setup + + Source format indentation style setup + + + + + + +Default Settings + +The preset format choices will cause the source text to resemble the +ANSI formatting style: + + +namespace foospace +{ + int Foo() + { + if (isBar) + { + bar(); + return 1; + } + else + return 0; + } +} + + + + + +Defining Indentation Width and Characters + +The radio buttons grouped in the Filling group +define how indents in the source text will be drawn. + + + + Use tabs + + + This will cause the editor to insert a tab character for each +indentation level. The tab width is predefined in the editor settings (8 or +4 character columns usually). Use SettingsConfigure Editor... to redefine it. + + + The actual tab width definition procedure depends on the editor you selected in the Selecting an Editor configuration step. You will have to look up the corresponding editor help to find out. + + + + + Use spaces + + If you select this radio button, the editor will enter a number of spaces for each indentation level. Change the number from the default 2 to the indentation width you prefer. + + + + + + + +Indented Entities + +This defines which of the (C/C++) entities will be formatted with an +extra indent beyond the current indentation level. + +By default only namespaces and +labels will be extra indented. You may want to +experiment with various settings to tailor those extra indents to your +liking. + + + + +Continuation + + +The settings grouped here apply to those cases where the source formatter automatically wraps around long source lines. It takes two special cases in account, namely that in deeply nested indents there should remain enough room for the source and that conditionals should get extra indent levels on continuation to make them stand out properly. + + + +This applies to static word wrap cases only where a fixed maximum line width is used in the source text. If you set up your editor to dynamically wrap around long lines in display only (which is possible in the &kate; editor part) the effects of these settings usually will not show. + + + + + Maximum in statement + + + This setting limits the maximum possible indentation for the continuation lines so that enough space will remain to keep the text readable. No continuation line will ever be indented beyond the number of columns you selected in this field. + + + The default is set to 40 character columns (half a standard 80 column page). You may want to increase this value to account for wider paper (e.g if you use landscape printing for your sources). Or decrease the value accordingly to take larger margin settings of your printouts into account. + + + + + Minimum in conditional + + + Conditionals or source following ⪚ an assignment operator should usually get an extra indent on continuation lines in order to keep the text readable. The amount of this extra indent is defined here. + + + The default is set to Twice current which means that continued conditionals will get an extra indent level of the standard indentation size you selected in the Filling group. You may change this extra indent to another fixed width (including zero) using the arrows or by entering the value directly. + + + + + + + + + + + +Other Formatting Setup + + + + + + +Other source format style settings + + Other source format style settings + + + + + + +Controlling the position of braces + +The radio buttons the (somewhat misnamed) +Brackets group control the position of block delimiting +braces in a (C/C++) source text. There are three possibilities from which +you can select. + + + + Break + + This inserts a line break before each opening brace. Both delimiting braces of any block will be put at the same indentation level as the block head statement. + + +namespace foospace +{ + int Foo() + { + if (isBar) + { + bar(); + return 1; + } + else + return 0; + } +} + + + + + Attach + + + This will keep the opening brace of a block in line with the block head statement. Closing braces will be on the same indentation level as the block head statement. The else of an if statement will be kept in line with the closing brace of the preceding block. + + +namespace foospace { + int Foo() { + if (isBar) { + bar(); + return 1; + } else + return 0; + } +} + + + + + Linux Style + + + This is a compromise of the above listed styles. Functional block delimiting braces will be put on extra lines. Braces opening a block in a conditional or loop statement will be kept in line. + + +namespace foospace +{ + int Foo() + { + if (isBar) { + bar(); + return 1; + } else + return 0; + } +} + + + + + + + + +Controlling Extra Spaces + + +By default &kdevelop; does minimize the use of spaces in source texts. + + + + +if (isBar(fooArg)==barValue) + + +You may enhance readability if you force the source formatter to +insert extra spaces in special positions. + + + + Add spaces around parentheses + + In fact what is meant is to add spaces around the text put in parentheses. This enhances the readabilitiy of function arguments and conditionals. + +if ( isBar( fooArg )==barValue ) + + + + + Add spaces around operators + + This will put spaces around assignment and comparison operators to enhance the readability. + +if (isBar(fooArg) == barValue) + + + + + + + + +Controlling the formatting of one-line constructs + +There are a few cases where you don't want the source formatter to +split a long line apart. For C/C++ code this can be controlled here. + + + + Keep one-line statements + + This keeps single line statements together in some situations even if they exceed a fixed maximum line length. + + + + Keep one-line blocks + + This keeps single line blocks together in some situations even if they exceed a fixed maximum line length. + + + + + + + + + + + + + +Setting Up the Code Snippets Tool + + +When editing in &kdevelop; you can store often used parts of code as Code Snippets. To configure the capabilities of the code snippets part select Settings Configure &kdevelop;.. from the menubar. The Customize KDevelop dialog will pop up, where you have to select Code Snippets in the left hand tree. This will show the following dialog in the right hand side. + + + + + + + +Configuring the code snippets tool + + Configuring the Code Snippets tool + + + + + + +Activate Snippet Preview + +Mark the Show snippet's text in tooltip checkbox +if you want to view the stored text in a tooltip window whenever you keep +the mouse cursor over the title of that snippet. + + + + +Working with Snippet Variables + +The Code Snippets tool allows for a variable text +in predefined places any time you insert a snippet into a file. To +accomplish this Code Snippets provides its own +variables' mechanism. You can set up it's behaviour in the +Variables group. + + + + Delimiter + + The Code Snippets tool distinguishes variables in the text by surrounding the variable name with special delimiter symbols. To use your own delimiter symbol, change the predefined $ character in the Delimiter field. + + + + Input method for variables + + + Single dialog for each variable within a snippet – will in turn pop up a separate dialog for each variable which the tool finds when inserting the selected code snippet. + + + One dialog for all variables within a snippet – will pop up a common dialog where the user has to fill in the values of all variables before the snippet will be inserted + + + + + + + + + + + +File List + + +(... to be written ...) + + + + + +Configuring the File Selector + + +&kdevelop; provides a File Selector plugin which, when +loaded at start-up, allows to navigate to any file or directory in the +system. + + + + + + + +The file selector in IDEAl mode + + The file selector (IDEAl mode) + + + + +The behaviour of the File Selector can be highly +configured. Select Settings +Configure &kdevelop;.. from the +menubar. The Customize KDevelop dialog will pop up, +where you have to select File Selector in the left hand +tree. This will show the following dialog in the right hand side. + + + + + + + +Configuring the file selector + + Configuring the file selector + + + + + + +Configuring the Toolbar + +There is a toolbar on top of the File Selector +which can be configured as usual in the Toolbar +group. + + + Add an Action to the Toolbar + + + Select an item in the right hand Selected actions list after which the new action should be inserted. + + + + + Select the action to be inserted in the left hand Available actions list. + + + + + Click the right (upper) arrow between both lists. + + The action will be removed from the Available actions list and inserted into the Selected actions list below the selected item. + + + + + + Remove an Action from the Toolbar + + + Select the item to be removed in the right hand Selected actions list. + + + + + Click the left (lower) arrow between both lists. + + The selected item will be removed from the Selected actions list and put back into the Available actions list. + + + + + + Reorder the Actions on the Toolbar + + + Select the action to be moved in the right hand Selected actions list. + + + + + Click the up or down arrow to the right of this list. + + The selected item will be moved up or down the Selected actions list. + + + + + + + +Defining When the Contents Should +Change + + +Updating the contents in the File Selector window takes time and resources, esp. when changing to another directory. Therefore File Selector is set up by default in such a way that its contents change only on demand, &ie; when you select another directory or when you explicitely want to refresh its contents. + + + +Click the Reload button in the toolbar to update the contents of the File Selector. This toolbar button is not available by default, however. You must insert it there first. + + + +You can configure the File Selector to immediately reflect certain changes in your work. The settings in the Auto Synchronization group of the configuration dialog are responsible for this. + + + + + When a document becomes active + + If you select this checkbox, the contents in the File Selector window will be updated whenever you go to another already open document, ⪚ when you click on the tab of the according edit window in IDEAl mode. If necessary the File Selector will switch to the directory this file belongs to and update the display to show the actual contents in there. + + + + When a document is opened + + If you select this checkbox, the contents in the File Selector window will be updated whenever a document will be opened, ⪚ by the FileOpen menu. If necessary the File Selector will switch to the directory this file belongs to and update the display to show the actual contents in there. + + + + When the file selector becomes visible + + If you select this checkbox, the contents in the File Selector window will be updated whenever it gets visible again. If necessary it will switch to the directory the actual document belongs to and update the display to show the actual contents in there. + + + + + +You may freely combine these settings to tailor the actualization behaviour of the File Selector to your liking. + + + + + +Controlling the History in the Comboboxes + +There are two comboboxes on top and bottom of the File +Selector contents window which control the directory to be +displayed (top combobox) and the filters to be applied to the file display +(bottom combobox). A history of the most recent settings is kept in the +selection field of each combobox. You can configure the number of history +entries as follows. + + + + Remember locations + + Enter here the maximum number of directory selections the upper combobox shall remember. + + + + Remember filters + + Enter here the maximum number of filter definitions the lower combobox shall remember. + + + + +Controlling What Should be Remembered Between Sessions + + +By default the File Selector is set up so that it shows the display of the most recent session again at the next &kdevelop; start-up. You may change this behaviour in the Session configuration group. + + + +If &kdevelop; was automatically restarted by the &kde; session manager the changes in these settings will have no effect. In this case location and filter settings of the most recent &kde; session will always be restored. + + + + + + Restore location + + + Remove the checkbox mark here if you don't want the displayed location be remembered between sessions. + + + If you selected one of the automatic update settings the displayed location might automatically change regardless what has been remembered from the recent session. + + + + + Restore filters + + + Remove the checkbox mark here if you don't want the filters applied to the display be remembered between sessions. + + + + + + + + + + + +C++ Class Generator + + +(... to be written ...) + + + + + +Formatting + + +(... to be written ...) + + + + + +C++ Parsing + + +(... to be written ...) + + + + + + + + + +Configuring the Documentation + + +&kdevelop; contains a very powerful documentation facility which provides access to several kinds of extensive documentation. In ⪚ IDEAl mode you find a Documentation tab at the right border of the work area. + + + + + + + +The &kdevelop; documentation window in IDEAl mode + + The &kdevelop; documentation window (IDEAl mode) + + + + + +&kdevelop; must have loaded the Documentation plugin in order to view the documentation tree. See the Plugin Tools section for more info. + + + +You may set up contents and behaviour of the various parts of this documentation window if you select Settings Configure &kdevelop;.. from the menubar. The Customize KDevelop dialog will pop up, where you have to select Documentation in the left hand window. + + + +The thus displayed configuration page shows three tabbed configuration dialog pages, namely: + + + + Documentation Collections + Full Text Search + Other + + + +Setting Up Documentation Collections + + +The documentation configuration settings have been divided into a series of documentation collections, each providing access to documentation files of some unique format and content type. These setups control which documentation items will be listed on the Contents page of the &kdevelop; Documentation facility, and how the user may access documentation details by indexed and full text searches. + + +The Documentation tab provides a series of configuration pages which are ordered vertically like a stack of index cards. One page at a time will open after a click on its index card title: + + + &Qt; Documentation Collection + CHM Documentation Collection + Doxygen Documentation Collection + &kdevelop; TOC Documentation Collection + Devhelp Documentation Collection + Custom Documentation Collection + + + + + + + + +Setting up documentation collections + + Setting up documentation collections + + + + + + +Common Documentation Setup Structure + + +All configurations pages on the Documentation tab use a common layout. You will find the currently available documentation items of this type listed on the open page to the left and a set of buttons to the right. + + + + +Buttons to Maintain Documentation List Contents + + +There are three buttons available to maintain the contents of the documentation setup pages: + + + + + Add + + Opens a Documentation Catalog Properties dialog as shown below where you can select the source location of the documentation item to be added and name it. + + + + Edit + + Opens a Documentation Catalog Properties dialog as shown below where you can change the source location of the documentation item previously selected in the list and rename it. + + + + Remove + + Removes the selected documentation entry from the list. + + The entry will be removed from the list only. Actual documentation sources remain untouched. You will have to remove them explicitely by other means. + + + + + + + + + + + + Add or change a documentation item + + + + + +The button to the right of the Location field opens a directory dialog whose entries usually will be filtered according to the file type of the selected configuration page. + + +The Title field may not be accessible, depending on the documentation type to be maintained. + + + + +Documentation List Structure + + +Every documentation setup page shows the listed documentation items in a table with four columns: + + + + + TOC + + + If this check box is marked, this documentation item will show up on the Contents page of the &kdevelop; Documentation facility. + + + Unchecking the TOC check box will in turn disable the Index and Search check boxes (see below). Thus you cannot have documentation collection items indexed but not shown in the contents. + + + + + Index + + + If this check box is marked, an internal index will be built of this documentation item. This provides fast access to the documentation by the use of the Index and (optionally) Finder pages of the &kdevelop; Documentation facility. + + + + The internal index will be built the first time the user selects the Index page. This will delay the first access noticeably, because the index will be read from disk and then cached. + + + All subsequent indexed searches will however use this chache and thus work significally faster. + + + + + + Search + + + If this check box is marked, the contents of this documentation item will be included in the full text search path of the Search page of the &kdevelop; Documentation facility. + + + + &kdevelop; utilizes the htdig application collection to perform full text searches. This search is done over an internal index, the htdig machinery has to build before it can be used. + + + Any change of the Search check box marks will thus effect the search runs only after you rebuilt the index on the Search page of the &kdevelop; Documentation facility. + + + + + + Title + + This is the name of the Documentation item as it will be shown on the Contents page of the &kdevelop; Documentation facility. + + + + + +Former &kdevelop; versions allowed to select the documentation items to be displayed on a per-project basis. This is not available any more. + + + + + + + + +&Qt; Documentation Collections + + +On this configuration page all &Qt; documentation is set up. + + + + + + + +Setting up the &Qt; documentation collection + + Setting up the &Qt; documentation collection + + + + + +Normally &kdevelop; will fill this in on its first start-up. It looks for standard *.xml, or *.dcf documentation files in the &Qt; installation directory. The table to the left lists the files &kdevelop; found by their standard titles. + + + +If you have a non-standard installation, either there will be no information listed at all or the entries will possibly refer to improper locations (⪚ to another &Qt; installation available in your system). You may adjust the entries using the buttons to the right of the list field. + + + +&kdevelop; will use the titles already provided by the installed &Qt; documentation. Hence the Title field in the Documentation Catalog Properties dialog is inaccessible. + + + +By default, not all &Qt; documentation will be shown on the Contents page of the &kdevelop; Documentation facility. Use the TOC check box in the setup table to select the documentation to be shown. + + + +If you want to have some specific &Qt; documentation included in the search indexes or full text search use the Index and Searchcheck boxes in the setup table. + + + + + +Setting Up the CHM Documentation Collection + + +On this configuration page you may collect documentation according to the &Microsoft; CHM help file standard. + + + + + + + +Setting up &Microsoft; CHM standard documentation files + + Setting up &Microsoft; CHM standard documentation files + + + + + +By default, this configuration page will be empty (as shown above). You may add new entries using the buttons to the right of the list field. &kdevelop; will filter *.chm files in the directory dialog associated to the Add and Edit buttons. + + + +For more information on the format of &Microsoft; *.chm files see ⪚ PHP: Documentation - Extended CHM Format at http://de2.php.net/docs-echm.php. + + + + + +Documentation Generated by Doxygen + + +On this configuration page all &API; documentation generated by &doxygen; is set up. + + + + + + + +Setting up Doxygen generated &API; documentation + + Setting up Doxygen generated &API; documentation + + + + + +In short, such an &API; documents the interface to certain library functions. The &API; documentation on this page should be produced by the externally provided &doxygen; tool. + + +&doxygen; generated &API; documentationconsists of a series of html files, starting with index.html. Additionally there may exist tag files which contain information to link to already existing &API; documentations. Thus &kdevelop; will look for index.html and *.tag files when seaching for &doxygen; generated &API; documentation. + + +There are some structural constraints assumed when searching for &doxygen; generated &API; documentation. The directory in which the index.html file resides should contain subdirectories with separate documentation collections. Each of these subdirectories is assumed to contain a .tag file and a html/ subdirectory. + + +You may have a look at $KDEDIR/share/doc/HTML/en/kdelibs-apidocs for an example of such a &doxygen; &API; documentation layout. + + + +The older &kde; KDoc generated &API; format is not directly supported any more. If you still want to use such documentation, you may add it on the Custom Documentation Collection page. + + + +&kdevelop; will have filled in a link to the current &kde; Libraries &API;, provided it found one. There are several ways for &kdevelop; to find out: + + + + + Either you provided the configure command with the + option when you compiled + &kdevelop; (see the How to Obtain a &kdevelop; &API; Documentation chapter). + + + Or the configure command did automatically find a &doxygen; generated &kde; Libraries &API; in one of several standard locations it knows of. + + + Or as a last resort the $KDEDIR/share/doc/HTML/en/kdelibs-apidocs/ was found at the first &kdevelop; startup. + + + + +If &kdevelop; did not find a valid &doxygen; generated &kde; Libraries &API; at its first start-up the Doxygen Documentation Collection list will be empty. + + + +You may add your own &API; documentation entries (⪚ from your current projects) by using the buttons to the right. If you want to have them included in the indexed and/or full text search mark the Index or Search check boxes in the setup table. + + + +&kdevelop; uses the title information from the index.html. Hence the Title field in the Documentation Catalog Properties dialog is inaccessible. + + + + + The &kde; system provides more &API; documentation than the &kde; Libraries &API; only. You will need additional interfaces information if you want to ⪚ include the &kate; part into you programs. For this &kate; part &API; for example you should compile and install the &kde; Base Libraries &API; from the sources (using the make apidox and make install commands on the kdebase sources) and then add an entry to the Doxygen Documentation Collection list like this: + + + + + +Adding a &kde; base &API; to the list + + Adding a &kde; Base &API; to the list + + + + (Of course you should replace the /home/dev/mykde-system/ directory in the Location field example with the path to your &kde; installation.) + + + + +You must put the &API; of your current project into this Doxygen Documentation Collection as well. Former &kdevelop; versions did put it into the documentation tree on a per-project basis. This is not provided any more. + + + + + +Handling Structured Documentation (KDevelopTOC Files) + + +The main bulk of the &kdevelop; documentation facility provides immediate access to structured documentation, local as well as remote ones. You can configure this on the KDevelopTOC Documentation Collection page. + + + + + + + + + Providing KDevelopTOC structured documentation access + + + + + +&kdevelop; comes with a bunch of predefined KDevelopTOC files which are automatically entered in the table at installation time. To keep the display manageable only the most often used will initially be marked for display. If you want to see another documentation, mark the TOC check box in the setup table. + + + +KDevelopTOC files cannot be indexed to perform a full text search because they usually point to a remote location. On the other hand, such a .toc file can have an index manually defined, using the <index> tag. Thus the Index check box will be enabled ony when &kdevelop; finds an <index> tag in the .toc file. (For more detail see the description below in the &kdevelop; TOC Files section.) + + +The Search check box in the setup table will alway be disabled. + + + +You may add new entries using the buttons to the right of the list field. &kdevelop; will filter *.toc files in the directory dialog associated to the Add and Edit buttons. + + + +Other than former &kdevelop; versions will the Remove button not change the *.toc files on disk, so the remove operation is safe now. + + + + + +&kdevelop; TOC Files + + +There is a special feature associated with this. To illustrate, follow these steps: In the documentation tree find an entry shortly below the &Qt;/&kde; documentation (⪚ KDE2 Development Book (kde.org)). Click on the plus sign next to it. A tree will open where you can quickly navigate to subsequent chapters nested several levels deep, all offline. But if you finally select one of the chapters, &kdevelop; will in many cases try to access a remote documentation file. + + + +The rationale behind this is not only to locally navigate remote documentation without wasting net access ressources, but to provide the developer with easy, structured access to the documentation he/she needs. Using these tools one can access almost any local or remote documentation in a structured fashion even if the original is laid out flat or structured in another way. All that is needed is access to files and/or parts of files which are displayable by the Konqueror. + + + +Such structured access is made possible through the use of special table of content files, which are denoted by .toc filename extensions. Any such &kdevelop; TOC file contains an &XML; structured description of the document to be accessed. + + + + +Standard Directory of &kdevelop; TOC Files + + +When &kdevelop; was installed usually a series of predefined .toc files has been put into the $KDEDIR/share/apps/kdevdocumentation/tocs directory. These are fairly simple, structured text files. You may look at them using a text editor or other text display facility. + + + + + + + + + + Basic Structure of &kdevelop; TOC Files + + header + + + + <!DOCTYPE kdeveloptoc> + + + <kdeveloptoc> + + + (title) + + + (base address) + + + (content structure) + + + (index structure) + + + </kdeveloptoc> + + + + This &XML; structure will be parsed by the &kdevelop; Documentation plugin to set up the documentation tree contents and to guide the user in navigating the documentation. It contains all information necessary to display titles and access the documentation file contents. + + + + + title + + + + <title> + (some title string) + </title> + + + + This is the title &kdevelop; will display at the basic levels in the documentation tree. + + + This displayed title cannot be changed by the user. If you want another text be displayed, you must manually change the <title> entry in the .toc file. + + + + + base address + + + + <base href=" + (base document &URL;) + "/> + + + + This &URL; points to the location where all files of this documentation are located. It will be prepended before each section &URL; in the following content structure list. So, if you ⪚ downloaded a documentation from a remote server, all you need to display the files from this new location is to change its <base> &URL;. + + + + + content structure + + + + <tocsect1 name=" + (section title) + " url=" + (section &URL;) + "> + + ... + + <tocsectn name=" + (section title) + " url=" + (section &URL;) + "/> + + ... + + </tocsect1> + + + + All remaining navigation and access information is stored in a series of nested <tocsecti> ... </tocsecti> pairs. Each i denotes a consecutive nesting level down to number n which will correspond to the finally displayed documentation section. + + + Any <tocsecti> entry must have a name="xxx" attribute associated with it (the "xxx" denotes the actual title string). This name will be displayed as level title in the documentation tree. It should correspond to an actual documentation section. + + + There may be an url="" attribute associated with any i nesting level. When the user clicks on a section title in the documentation tree &kdevelop; will try to access the file at the location pointed to by the combined base and section &URL;. + + + The <tocsectn/> entry must have an url="" attribute whatsoever. + This final nested <tocsectn/> does not come in pairs but will immediately be closed by a / before the > bracket. + + + Any address combined of base and section &URL; must point to some displayable text file. Usually this will be an HTML-structured file. It is possible to link to anchor marks within such an HTML file using the standard # notation of the format: /base-url/section-url#anchor-mark. + + + + + index structure + + + + <index> + + + <entry name=" + (index entry title) + " url=" + (index section &URL;) + "/> + + + </index> + + + + Index is a plain list of index entries - pairs of title and &URL;. Index is not mandatory. + + + + + + + + + +DevHelp Documentation + + +DevHelp documentation is another means of structured documentation access. It uses structured table of content files denoted by a .devhelp extension similar to &kdevelop; TOC files to access documentation for the GNOME 2 desktop. + + +You can control which DevHelp files should be accessible on the DevHelp Documentation Collection configuration page. + + + + + + + + + Providing DevHelp documentation + + + + + +DevHelp files originally were accessible on the LiDN website, but this seems to be not maintained for some time now. More recent DevHelp documentation is available at the DevHelp Books Download web page. + + + +When &kdevelop; is installed it will attempt to find all .devhelp files in some standard places in the system, ⪚ in the subdirectories of /opt/gnome/share/. Initially these files will not be marked for display. If you want to see another documentation, mark the TOC check box in the setup table. + + + +You may add new entries using the buttons to the right of the list field. &kdevelop; will filter *.toc files in the directory dialog associated to the Add and Edit buttons. + + + + + +Setting Up Custom Documentation Collections + + +This is for your own purpose. You may add almost any documentation files here, provided they can be displayed by the &konqueror; plugins. + + + + + + + + + Providing custom documentation + + + + + +Usually this collection will be empty at first &kdevelop; startup. We have filled in a deliberate item to show the entry structure. + + +Handling is straightforward here. Use the buttons to the right of the list field to add, edit or remove the document items. &kdevelop; will not filter anything in the directory dialog associated to the Add and Edit buttons. + + + +You will have to explicitely select the items for display in the &kdevelop; documentation facility. Mark the TOC check box of the entry in the setup table. + + + +Custom documention cannot be indexed or searched. Thus the Index and Search check boxes have no effect here as shown above. + + + + + + + +Setting Up Text Search Indexes + + +(... to be written ...) + + + + + + + + + Setting up text search indexes + + + + + + + +Other Documentation Configuration Settings + + +(... to be written ...) + + + + + + + + + +Advanced Configuration + + +(... to be written ...) + + + +Plugin Tools + + +(... to be written ...) + + + + + + diff --git a/doc/kdevelop/split-source-header-navigate.png b/doc/kdevelop/split-source-header-navigate.png new file mode 100644 index 00000000..f4d72868 Binary files /dev/null and b/doc/kdevelop/split-source-header-navigate.png differ diff --git a/doc/kdevelop/split-source-header.png b/doc/kdevelop/split-source-header.png new file mode 100644 index 00000000..d57b306b Binary files /dev/null and b/doc/kdevelop/split-source-header.png differ diff --git a/doc/kdevelop/split-windows.png b/doc/kdevelop/split-windows.png new file mode 100644 index 00000000..3ebb79f5 Binary files /dev/null and b/doc/kdevelop/split-windows.png differ diff --git a/doc/kdevelop/split-workspace.png b/doc/kdevelop/split-workspace.png new file mode 100644 index 00000000..d497ab49 Binary files /dev/null and b/doc/kdevelop/split-workspace.png differ diff --git a/doc/kdevelop/survey-manual.docbook b/doc/kdevelop/survey-manual.docbook new file mode 100644 index 00000000..d9611a03 --- /dev/null +++ b/doc/kdevelop/survey-manual.docbook @@ -0,0 +1,228 @@ + +What This Manual Contains + + +This user manual is intended to describe the contents and use of the &kdevelop; &kdevrelease; Integrated Development Environment (IDE) from a user's point of view. It is not a programming manual, nor does it describe the development process in detail. Its only aim is to guide you in the handling of the IDE. + + +Here you will find information on the following topics: + + + +Getting Started with &kdevelop; — a Guided Tour + +Gives you a quick start on the use of this &IDE;, introducing the basic steps of how to work on a project. + + + +Overview of the Features of + &kdevelop; + +Extends the guided tour in the previous chapter, giving an overall +view of what is built-in within &kdevelop; and gets you acquainted with the +look and feel of this &IDE;. + + + + +Configuring &kdevelop; + +Shows how you can tailor the &IDE; to suit your needs. + + + + +Getting started: the +&appwizard; + +Describes the basics of how to set up a new project in &kdevelop; +using the built-in &appwizard;. + + + + +Editing tools + +All you need to write your source files: using the editor, searching +for text both locally and project-wide, up to integrating new files and +classes into the project. + + + + +The File Browsers + +Demonstrates various tools to look at the structure of your project +and how to access the files you want to work with. + + + + +The Class Browsers + +Describes one of the most powerful tools of &kdevelop; which lets you +navigate through class dependencies and allows you to easily create and +access the classes and methods you need. + + + + + +Documentation + +Shows how to access the rich built-in documentation &kdevelop; +provides and tells you how to create documentation of your project, concise +and powerful &API; documentation providing you an overall view of all your +project sources as well as docbook-based user documentation. + + + + +Building and Project + Management + +Deals with the creation and management of your project; describing the +basics of autoconf and automake as well as how to set up custom make files +and how to use compiler or make options to tailor your application to suit +your needs. + + + + +Advanced Build + Management + +Looks at ways to keep multiple build configurations, to cross-compile +for diverse platforms, or to make an embedded system using the +Qt/embedded library. + + + + +The Debugger Interface + +Describes how to use the integrated gdb +debugger interface so you can hunt down bugs without leaving +&kdevelop;. + + + + + + +Using CVS + +Tells you how you can maintain your project using the CVS versioning +system; a must, especially if many developers work on the same +project. + + + + + + +Some commonly used information has been put into the appendix. Amongst others this consists of: + + + + +Installing &kdevelop; + +Tells you where to obtain &kdevelop; and how to get it up and +running. + + + + + + +In a Nutshell — Tips and +Tricks + +A quick reference to commonly used commands and actions. And a short +guide to solve common problems when working with +&kdevelop;. + + + + +Development on &UNIX; + +A historical overview of &UNIX; program development, the main tools +necessary and why you need an &IDE;. + + + + + + +Configuration Files Used by + &kdevelop; +Lists the files &kdevelop; uses to save its internal + information. This is particularly useful in case something went wrong with + your setup. + + + + +Plugin Tools +Lists the pluggable tools you can use to taylor the capabilities of +&kdevelop; to your needs. + + + + +KDevelop User Interface Mode Examples +Shows user interface modes. + + + +Further Information +Getting Information, reporting Bugs etc. + + + +Changelog +Shows the history of this documentation. + + + +Bibliography +Bibliography + + + + + + + diff --git a/doc/kdevelop/tutorial-debug-tree.png b/doc/kdevelop/tutorial-debug-tree.png new file mode 100644 index 00000000..23c7f2c6 Binary files /dev/null and b/doc/kdevelop/tutorial-debug-tree.png differ diff --git a/doc/kdevelop/tutorial-hello-new.png b/doc/kdevelop/tutorial-hello-new.png new file mode 100644 index 00000000..abbb912d Binary files /dev/null and b/doc/kdevelop/tutorial-hello-new.png differ diff --git a/doc/kdevelop/tutorial-hello-options.png b/doc/kdevelop/tutorial-hello-options.png new file mode 100644 index 00000000..7b9d98cd Binary files /dev/null and b/doc/kdevelop/tutorial-hello-options.png differ diff --git a/doc/kdevelop/tutorial-new-project.png b/doc/kdevelop/tutorial-new-project.png new file mode 100644 index 00000000..8f3aa78d Binary files /dev/null and b/doc/kdevelop/tutorial-new-project.png differ diff --git a/doc/kdevelop/unixdev.docbook b/doc/kdevelop/unixdev.docbook new file mode 100644 index 00000000..d7881afb --- /dev/null +++ b/doc/kdevelop/unixdev.docbook @@ -0,0 +1,386 @@ + + + + + BerndPol + + + + +Development on &UNIX; + +development + + &UNIX; + development + + +Some Historical Remarks + +history +scripting languages + + &UNIX; + history + + &UNIX; + pipe + + &UNIX; + shell + + shell + &UNIX; + + +From the beginning, &UNIX; has maintained two very different development paradigms. One is the world of system and application programming languages, where some source code is translated to machine code by a translation program, usually a compiler or an interpreter. The programming language C is an example. &UNIX; was the first operating system kernel to be written in such a high level language instead of tightly machine-oriented assembler which was common before that time. (In fact, the C language once even was invented to write the &UNIX; kernel and associated programs on a DEC PDP-11 computer.) + + +The other paradigm is the world of scripting languages. This world evolved with the invention of the &UNIX; shell which was the user's interface to the operating system—and at the same time a very high level programming language. A shell script is built from a set of small utility programs like ⪚ grep, sed, or find. Each such utility is designed for some tightly defined job. The trick is that any such utility can be connected to another one via a simple transport mechanism, called a pipe, which directs the output of the foregoing utility into the input of the next processed one. This makes for a very powerful and highly flexible programming tool. + + +As time has gone by, both worlds have evolved. While C is still used mainly as a system programming language, C++ as a variant of C enriched by object-oriented and generic extensions has found its place for the development of complex applications in the 1990's. There are numerous other programming languages, even older ones keep their place—FORTRAN77 and Ada ⪚ still have their stronghold in numerical applications. + + + + + + +Contemporary Scripting Languages + +In the scripting area, there has been a shift away from the shell, which suffers from portability concerns, to languages which unify all commonly needed functionality in their standard libraries, while still being able to interface to the outside through pipes when necessary. + + +All these scripting languages have in common that they are widely portable between &UNIX; variants, Microsoft &Windows;, &MacOS; or even VMS. Also, they all have implementations that are freely distributable. + + + +&perl; + +Perl + + scripting languages + Perl + + +&perl; has become popular as a text processing and system administration language. In the beginning of the World Wide Web, CGI scripts written in &perl; were a widely used method to create dynamic web pages from databases. Today, this method has been replaced mostly by the mod_perl plugin for the &apache; web server. Among &perl;'s strengths are its built-in support for advanced regular expression matching and its rich archive of freely distributed modules. + + +For more information see the Comprehensive Perl Archive Network (CPAN) website. + + + + +Python + +Python + + scripting languages + Python + + +&python; shines by the elegance of its class system and the ease and flexibility with which external libraries can be wrapped in a way that they appear like standard &python; classes and functions. In contrast to &perl;, &python; has a clear and concise embedding &API;, which makes it the language of choice for making C and C++ programs scriptable. + + + + +PHP + +PHP + + scripting languages + PHP + + +&php; was invented as a language directly embeddable into &HTML; pages and consequently has its main uses in delivering dynamic content on the web. + + + + + + +Higher-level Scripting + + +Higher-level &UNIX; applications usually miss the speed and flexibility of the traditional character-oriented shell scripting mechanisms. This is especially true in the world of graphical user interfaces (&GUI;) such as ⪚ &kde;. + + +There have been attempts to provide similar mechanisms which will work on a higher application level, most notably CORBA and, in the &kde; environment, &DCOP;. + + + +The CORBA Protocol + +CORBA + + scripting languages + CORBA + + communication + CORBA + + +CORBA (Common Object Request Broker Architecture) is an attempt to let computer applications work together over networks. It was devised by the private, vendor independent OMG (Object Management Group) standards comittee. + + +CORBA-based programs use the IIOP standard protocol to communicate. Implementations based on IIOP are available on a wide variety of operating systems, programming languages, and networks and are thus highly portable. + + +The main drawback of CORBA is its rather low speed. While this may be tolerable in networks, it is a real hindrance for inter-application communications in a non-networked environment such as &kde; running on a single computer. + + + + + +The &DCOP; Interface + +DCOP + + scripting languages + DCOP + + communication + DCOP + + +Another evolution on &UNIX;-like scripting is the DCOP protocol which was devised for communication between &kde; applications to overcome the limitations of CORBA. + + +&DCOP; stands for Desktop Communication Protocol and is implemented as a simple IPC/RPC mechanism built to operate over sockets. In effect this provides facilities similar to the traditional &UNIX; pipe mechanism. + + +Traditional shell scripting is based on fairly small tool programs which were designed to work on a strictly textual basis. &DCOP; allows elaborate graphical programs to communicate with each other in a quite similar way. This enables ⪚ a &kde; program to send messages to another &kde; program, or receive data from it for its own purposes. + + +There are drawbacks, however. To use &DCOP; a program must be designed to contain a special &DCOP; interface. And the &DCOP; communication process runs somewhat slowly (although a lot faster than CORBA). But it returns much of the power and flexibility of &UNIX; scripting to high-level programs which are based on a graphical user interface. + + +For more information, see the DCOP: Desktop COmmunications Protocol paper or The &DCOP; Desktop Communication Protocol library &API; reference of the &kde; dcop library. + + + + + + + + +Build Systems + + +Except in very simple cases a programming project will consist of a lot of building blocks of source code each put into a separate file for easier maintenance. To make this running one has to effectively translate all this stuff into a few machine language units in a suiting format which allows the operating system to load and execute the program. + + +To accomplish this, the basic tools needed are + + + a text editor to write the source code files, + + + a translating program, usually a compiler to turn the source code into object files, + + + a librarian which collects object files into libraries to reuse them easily without the need to recompile, + + + a linker which binds several object files and libraries together into one executable, + + + a make system which provides some means to manage all this stuff and—not to forget + + + a debugger to (hopefully) find all errors in the program and possibly some other diagnostic tools to get everything running smoothly. + + + + + +When you have a large project consisting of possibly hundreds of source code files, the process of compiling may become quite laborsome. You do not want to recompile all files each time you have changed only some of them. Instead, you only want to compile those files which are affected by the changes. In general, it is not always easily obvious which of the files have to be recompiled. + + +When you ⪚ change a function prototype in a header file, you need to compile every file which includes this header file. If your project contains many such files you may easily miss one or two of them if you have to do the job manually. Thus some means of automization is necessary. + + + +The Make Process + + + make + + Makefile + + rule + + recompilations + + target + + dependencies + + commands + + +A tool which takes care of recompilations is make. It keeps track of all work using a set of rules which describe what to do in case some piece of information (usually a source or object code file) was changed. All rules belonging to a certain project are stored in a so-called Makefile which is processed by make any time you want to update your work. + + +Each rule consists of several building blocks, namely + + + a target, &ie; the file to be built + + + a set of dependencies, basically the names of those files the target depends on (⪚ the name of a source file, where then the target will be the name of the object file to be built) and + + + the commands which are to be executed to make the target (&ie; to compile it or to link other object files together to build an executable progam file). + + + + +Basically the make command will read the rules one after another, check each file in the dependency list of a given target and make this target anew if any one of these files has changed, using the commands listed in that rule. + + +There are several additional possibilities to control such a make process, and a Makefile can thus grow very complex. We cannot go into the details here. However, we recommend that you make yourself accustomed to the syntax of make. Even if you do not normally use it directly, an understanding of the fundamentals of the build system can be useful. See the GNU Make Manual for more information. + +For more &kdevelop; specific detail see the Building and Project Management chapter of this manual. + + +There are several tutorials available, see the references in the Building and project management chapter. + + + + + + + + +&GUI; Development + + + GUI + + graphical user interface + + user interface + GUI + + +Application developers become even more encumbered by having not only to create program libraries and logic, but also to provide an easy to use custom built user interface that is both intuitive and functional. Most programmers receive little to no training in &GUI; development, and as a result user interfaces often are poorly designed. + + +During the years some common design principles have evolved. It is strongly advised to adhere to them. This way your user interfaces will retain a common look and feel that the users of your application will gratefully appreciate. + + +For &kde; &GUI; development there is a style guide available. It is found in the &kde; User Interface Guidelines on the &kde; Developer's Corner page. + + +A short introduction to common &GUI; design principles can be found here. + + + + + + + +Integrating Concepts and Tools – the IDE + + + IDE + + integrated development environment + + development + IDE + + environment + IDE + + +There are separate tools available for almost any step in the programming process—planning, editing, managing files and compilation processes, debugging, documentation and the like. But once the projects grow the programming processes will most likely become quite cumbersome. + + +Much repetitive work has to be done when designing, compiling, and debugging a program. A lot of such work can be saved through the use of templates and scripts. And another lot by keeping these tools easily available and able to communicate with each other under a common &GUI;. + + +For example—would it not be convenient if a debugger were able to open the source file in question in an editor and place the cursor directly at the position of that bug just found? + + +To more easily accomplish such a scheme, Integrated Development Environments (&IDE;s) were devised. Such an &IDE; integrates all templates, tools, and scripts which are commonly needed in the development process into one single environment. + + +For the &kde; platform &kdevelop; is such an &IDE;. It provides a wide range of tools which ease program development and maintenance, even for different programming languages and across platforms. + + + +Basic Features of &kdevelop; &kdevrelease; + + + &kdevelop; + features + + features + + + + + + Manages all development tools needed for C++ programming, such as compiler, linker, debugger and build system. + + + Provides an &appwizard; which generates complete, ready-to-go sample applications. + + + Allows the user to select an integrated editor based on the &kde; programmer's editor &kwrite;, Trolltec's QEditor, or others. + + + A class generator, for creating new classes and integrating them into the current project. + + + File management for sources, headers, documentation &etc; to be included in the project. + + + Assistance in creating application user manuals written with &kde; tools. + + + Automatic &HTML; based &API; documentation for a project's classes with cross-references to the used libraries. + + + Internationalization support, allowing translators to add their target language to a project easily, including support for &kbabel;. + + + Support for managing a project via one of several versioning systems (⪚ &CVS;) by providing an easy-to-use frontend for the most needed functions. + + + An integrated debugger frontend. + + + An integrated shell console emulator. + + + Syntax highlighting in source texts. + + + An auto-code completion facility for class variables, class methods, function arguments and more. + + + Templates for creating various projects (&kcontrol; modules, &kicker; (panel) applets, KIOSlaves, &konqueror; plugins and desktop styles). + + + Four navigation tree views for easily switching between source files, header files, classes and documentation, obviating the need for an external file manager. + + + Cross-compiling support, with the ability to specify different compilers, compiler flags, target architecture, &etc; + + + Support for Qt/Embedded projects (such as the Zaurus and iPAQ). + + + Inclusion of any other program you need for development by adding it to the Tools menu according to your individual needs. + + + + + + + + + diff --git a/doc/kdevelop/wrong-project-location.png b/doc/kdevelop/wrong-project-location.png new file mode 100644 index 00000000..cb9c45a2 Binary files /dev/null and b/doc/kdevelop/wrong-project-location.png differ diff --git a/doc/platform/Mainpage.dox b/doc/platform/Mainpage.dox new file mode 100644 index 00000000..dd69ba92 --- /dev/null +++ b/doc/platform/Mainpage.dox @@ -0,0 +1,148 @@ +/** \file Mainpage.dox + \brief The main page of the doxygen generated %API Documentation +*/ + +/** +\mainpage The KDevelop Platform %API %Documentation + + +KDevelop Platform is set of libraries and tools that are used to build IDEs (Integrated Development Environments), +applications similar to IDEs (web development enviroment, text editors for programmers and designers, etc.) +and/or IDE plugins for all possible purposes. + +Platform provides: +- the plugin architecture (interfaces); +- the common support libraries; +- the generic shell with plugin profiles support. +. + +\section intro Introduction + +This document is targeted at all those that want to build their own IDE or improve KDevelop's source code. +If you are instead looking for a user manual, just go to the help menu of your KDevelop and select KDevelop handbook. +This documentation contains the KDevelop Platform online class reference for the current +development version of KDevelop. Additionally, you +can subscribe or read the mailing list for any additions and/or +modifications to the Platform %API. + +An on-line, updated every 24H, html version of this documentation can be found at: http://www.kdevelop.org/HEAD/doc/platform/html/index.html + +You can also download a local browseable copy form http://www.kdevelop.org/HEAD/doc/platform/kdevplatformdoc.tar.bz2 . It gets updated every single day too. + +More information about the KDevelop Platform architecture in form of tutorials, Wikis, HOWTOs, +and FAQs can be found at +the KDevelop website. + +Quick overviews of the architecture can also be found in the issues of +KDevelop Technotes. + +\section platformapi Platform Libraries API + +- Interfaces Library + (classes)\n + Interfaces and classes that form KDevelop plugin architecture. +- Extension Interfaces Library + (classes)\n + Extension interfaces used by KDevelop plugin architecture. +- Utility Library + (classes)\n + Utility classes for the KDevelop architecture. +- Extra Interfaces Library + (classes)\n + Extra interfaces that are not the part of KDevelop plugin architecture + but that can be implemented by extra plugins or "plugins for plugins". +- Widgets Library + (classes)\n + A collection of widgets. +- Property Editing Library + (classes)\n + A collection of facilities to store and edit the properties of various objects. +- Catalog Library + (classes)\n + The persistant symbol store library working with BerkeleyDb backend. +. + +\section designerapi GUI Designer Integration API + +- KInterfaceDesigner Library + (classes)\n + KInterfaceDesigner classes and interfaces which form the core of GUI Designer integration framework. +- Designer Integration Support Library + (classes)\n + The base classes to implement GUI designer integration in language support plugins. +. + +\section pluginsapi Platform Plugins API + +- Documentation Part Interfaces Library + (classes)\n + Interfaces to implement KDevelop documentation plugins. +. + +\section langapi Programming Language Support API + +- Language Support Interfaces Library + (classes)\n + Interfaces for KDevelop language support facilities. +- Debugger Support Library + (classes)\n + Classes to implement debugger support for a programming language. +. + +\section buildtoolapi Buildtool Support API + +- Buildtool Base Library + (classes)\n + Base classes for KDevelop builtool support plugins. +- Project Manager Interfaces Library + (classes)\n + Interfaces to implement plugins for the KDevelop generic project manager. +- Buildtool Widgets Library + (classes)\n + Widgets commonly used in buildtool support plugins. +- Autotools parser Library + (classes)\n + Parser for Autotools based support plugins. +- QMake parser Library + (classes)\n + Parser for QMake based support plugins. +. + +\section shellapi Shell API + +- Generic Shell + (classes)\n + The Shell - a profile-based implementation of KDevelop plugin architecture. +- Shell Profiles Library + (classes)\n + Plugin profiles implementation for KDevelop shell. +. + +\section PlannedTasks Planned tasks + +Here is a priority ordered list: + -# fix the dispersed fixme + -# reported bugs in bugzilla database + -# fix the dispersed todo all over the code. + . + +\section howTobuildAPIlocalcopy How to build a local copy of this documentation + +This documentation is large and changes with every cvs commit, therefore is not available for download. +To build your local copy of this documentation you need to fetch KDevelop sources and +if you have doxygen >= 1.3.4 and (optionally) PHP >= 4.10 plus a local running webserver then +- make apidox +- make install-apidox (as root) +. + +The advantage of the webserver is that you'll get a search engine in your documentation if you read your +documentation using your local webserver. + +\section License + +Permission is granted to copy, distribute and/or modify this document under +the terms of the GNU Free %Documentation License, Version 1.2 or any later +version published by the Free Software Foundation; For details see +http://www.gnu.org/copyleft/fdl.html . + +*/ diff --git a/doc/std/Makefile.am b/doc/std/Makefile.am new file mode 100644 index 00000000..07f12cde --- /dev/null +++ b/doc/std/Makefile.am @@ -0,0 +1,7 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = kdev3api.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + + diff --git a/doc/std/kdev3api.toc b/doc/std/kdev3api.toc new file mode 100644 index 00000000..28d9cf3a --- /dev/null +++ b/doc/std/kdev3api.toc @@ -0,0 +1,45 @@ + + +KDevelop API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/tools/Makefile.am b/doc/tools/Makefile.am new file mode 100644 index 00000000..4eb7f5af --- /dev/null +++ b/doc/tools/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = index-texi index-python index.xsl \ + toc-gsdoc toc-docbook toc-python + + diff --git a/doc/tools/index-python b/doc/tools/index-python new file mode 100644 index 00000000..96cfcd8f --- /dev/null +++ b/doc/tools/index-python @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +use Getopt::Long; + +my $prefix = ''; +GetOptions( 'prefix=s' => \$prefix ) || die "Wrong options\n"; + +$file = $ARGV[0]; +open(FILE, "$file") || die "File not found: $file\n"; + +print "\n"; + +$ingroup = 0; +while () { + + if (/\\(.+)\<\/a\>/) { +# print "Index: $1, $2, $ingroup\n"; + if ($ingroup) { + $name = "$ingroup, $2"; + } else { + $name = $2; + } + $url = "$prefix/$1"; + print "\n"; + } elsif (/\(.+)/) { +# print "Ingroup: $1\n"; + $ingroup = $1; + } elsif (/\s+\<\/dl>/) { + $ingroup = 0; + } +} + +print "\n"; +close(FILE); + + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\//g; + $str =~ s/\<\/CODE\>//g; + $str =~ s/\//g; + $str =~ s/\<\/TT\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: diff --git a/doc/tools/index-texi b/doc/tools/index-texi new file mode 100755 index 00000000..8aa85184 --- /dev/null +++ b/doc/tools/index-texi @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +use Getopt::Long; + +GetOptions( 'map=s' => \%mapping ) || die "Wrong options\n"; + +for $file (@ARGV) { + + open(FILE, "$file") || die "File not found: $file\n"; + + $indir = 0; + + while () { + + if (/\\(.*)\<\/A\>\<\/H1\>/) { + $index = $mapping{$1}; +# print "Index: $1 => $index\n"; + } elsif (/\/) { + $indir = 1; + } elsif (/\<\/DIR>/) { + $indir = 0; + } elsif ($indir) { + if (/\\([^<]*)\<\/A\>/) { + unless ($lastindex eq $index) { + if ($lastindex) { + print "\n"; + } + print "<$index>\n"; + $lastindex = $index; + } + $name = dehtml($2); + $url = $1; + print STDOUT "\n"; + } + } + } + + close(FILE); +} + +if ($lastindex) { + print "\n"; +} + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\//g; + $str =~ s/\<\/CODE\>//g; + $str =~ s/\//g; + $str =~ s/\<\/TT\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: diff --git a/doc/tools/index.xsl b/doc/tools/index.xsl new file mode 100644 index 00000000..8d3d0a52 --- /dev/null +++ b/doc/tools/index.xsl @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/tools/toc-docbook b/doc/tools/toc-docbook new file mode 100644 index 00000000..6d16f9b3 --- /dev/null +++ b/doc/tools/toc-docbook @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +# Copyright (C) 2001 by Claudiu Costin +# +# +# 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; either version 2 of the License, or +# (at your option) any later version. + +use Getopt::Long; + +my $prefix = ''; +my $depth = 1; +GetOptions( 'prefix=s' => \$prefix, + 'depth=i' => \$depth ) || die "Wrong options\n"; + +$initialdepth = $depth; +$b3=$b2=$b1=""; +$in_processing=0; +while (<>) { + chop; + + if (/Table of Contents<\/B/) { + $in_processing=1; + next; + } + last if (/List of Tables/); + next if (!$in_processing); + + if (/HREF=\"(.+)\"/) { + $url = $1; + } + if (/>(.+)<\/A/) { + $name=$1; + $name =~ s/\"/"e;/g; + $name =~ s/—/-/g; + $name =~ s/^\s*-?\s*//g; + $name =~ s/\.$//g; +# print "NAME $name\n"; + } + + if ($b3 =~ />
<\/DL/i) { + $depth--; + print " "x($depth-1) . "\n" if ($depth != $initialdepth-1); + $b3=$b2; + $b2=$b1; + $b1=$_; + next; + } + + if ($b3 =~ />.*<\/DT/i && $name ne "" && $url ne "") { + if ($b1 =~ />
\n"; + } else { + print " "x($depth-1) . "\n"; + } + } + + # a simulated delay line with 6 cells + $b3=$b2; + $b2=$b1; + $b1=$_; +} diff --git a/doc/tools/toc-gsdoc b/doc/tools/toc-gsdoc new file mode 100644 index 00000000..69785d91 --- /dev/null +++ b/doc/tools/toc-gsdoc @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use Getopt::Long; + +my $prefix = ''; +GetOptions( 'title=s' => \$title, + 'main=s' => \$main ) || die "Wrong options\n"; + +$file = $ARGV[0]; +open(FILE, "$file") || die "File not found: $file\n"; + +print "\n"; + +while () { + + if (/\\(.+)\<\/uref\>\<\/item\>/) { + $name = $1; + $url = "$1.html"; + print " \n"; + } + +} + +print "\n"; diff --git a/doc/tools/toc-python b/doc/tools/toc-python new file mode 100644 index 00000000..c91cdcf2 --- /dev/null +++ b/doc/tools/toc-python @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +use Getopt::Long; + +my $prefix = ''; +GetOptions( 'prefix=s' => \$prefix, + 'title=s' => \$title, + 'main=s' => \$main ) || die "Wrong options\n"; + +$file = $ARGV[0]; +open(FILE, "$file") || die "File not found: $file\n"; + +$prevdepth = 1; +$depth = 1; +print ") { + + if (/^\s*href/ && !/.*\<\/A\>$/i) { + chop; + $_ = $_ . ; + } + if (/\/i) { + $depth++; + } elsif (/\<\/UL\>/i) { + print "/" if ($prevdepth == $depth); + $depth--; + print ">\n(.+)\<\/A\>$/i) { + $url = "$prefix/$1"; + $name = dehtml($2); + $name =~ s/\s+/ /g; + print "/" if ($prevdepth == $depth); + print ">\n\n"; +close(FILE); + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\<(tt|b) class=\"([^\"]*)\"\>//g; + $str =~ s/\<\/(tt|b)\>//g; + $str =~ s/\//g; + $str =~ s/\<\/i\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: diff --git a/doc/tools/toc-texi b/doc/tools/toc-texi new file mode 100755 index 00000000..2be48fa6 --- /dev/null +++ b/doc/tools/toc-texi @@ -0,0 +1,47 @@ +#!/usr/bin/perl + +# Copyright (C) 2001 by Claudiu Costin +# +# +# 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; either version 2 of the License, or +# (at your option) any later version. + +$depth=0; +$buffer=""; + +while (<>) { + chop; + + if ($buffer =~ /
    /i) { + $depth++; + $buffer = $_; + next; + } + if ($buffer =~ /<\/ul>/i) { + $depth--; + print " "x($depth-1) . "\n" if ($depth != 0); + $buffer = $_; + next; + } + + if ($buffer =~ /
  • /i) { + $buffer =~ /HREF=\"([^\"]+)\"/; + $url=$1; + $buffer =~ /\">(.+)<\/A>/; + $text=$1; + $text =~ s///gi; + $text =~ s/<\/tt>//gi; + $text =~ s///gi; + $text =~ s/<\/CODE>//gi; + $text =~ s/
    //gi; + if (/
      /i) { + print " "x($depth-1) . "\n"; + } else { + print " "x($depth-1) . "\n"; + } + } + # a simulated delay line with one cell + $buffer = $_; +} diff --git a/editors/Makefile.am b/editors/Makefile.am new file mode 100644 index 00000000..ae0c79eb --- /dev/null +++ b/editors/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = editor-chooser diff --git a/editors/editor-chooser/Makefile.am b/editors/editor-chooser/Makefile.am new file mode 100644 index 00000000..2cdf58a6 --- /dev/null +++ b/editors/editor-chooser/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdeveditorchooser.la +libkdeveditorchooser_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdeveditorchooser_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdeveditorchooser_la_SOURCES = editorchooser_part.cpp editchooser.ui editorchooser_widget.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdeveditorchooser.desktop + diff --git a/editors/editor-chooser/README.dox b/editors/editor-chooser/README.dox new file mode 100644 index 00000000..4dea700d --- /dev/null +++ b/editors/editor-chooser/README.dox @@ -0,0 +1,8 @@ +/** \class EditorChooserPart +Chooses the text editor to use in KDevelop from a list of all KTextEditor Class interface compliant editors installed in KDE. + +\authors Matthias Hoelzer + +\feature Chooses the text editor to use in KDevelop from a list of all KTextEditor Class interface compliant editors installed in KDE. + +*/ diff --git a/editors/editor-chooser/editchooser.ui b/editors/editor-chooser/editchooser.ui new file mode 100644 index 00000000..66f46b59 --- /dev/null +++ b/editors/editor-chooser/editchooser.ui @@ -0,0 +1,130 @@ + +EditChooser + + + EditChooser + + + + 0 + 0 + 514 + 383 + + + + + unnamed + + + + GroupBox1 + + + &Embedded Editor + + + + unnamed + + + + EditorPart + + + + + TextLabel1 + + + <i>Note:</i> Changing the preferred editor will not affect +already open files. + + + + + + + external_changes_group + + + On External Changes + + + <p><b>Action to take when an open file is changed on disk</b></p> +<p><b>Do nothing</b> - The file will be marked as externally changed and the user will be asked to verify any attempt to overwrite it </p> +<p><b>Alert the user</b> - A dialog will alert the user that a file has changed and offer the user to reload the file</p> +<p><b>Automatically reload</b> - Any files that are not modified in memory are reloaded, and an alert is shown for any conflicts</p> + + + + unnamed + + + + nothing + + + &Do nothing + + + true + + + + + alert + + + true + + + &Alert the user + + + + + reload + + + Automatically reload the file &if safe, alert the user if not + + + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + + + EditorPart + activated(const QString&) + EditChooser + slotEditPartChanged(const QString&) + + + + kdialog.h + + + slotEditPartChanged(const QString &) + + + + diff --git a/editors/editor-chooser/editorchooser_part.cpp b/editors/editor-chooser/editorchooser_part.cpp new file mode 100644 index 00000000..f11a540b --- /dev/null +++ b/editors/editor-chooser/editorchooser_part.cpp @@ -0,0 +1,42 @@ +#include + + +#include +#include +#include +#include + +#include +#include + +#include "editorchooser_part.h" +#include "editorchooser_widget.h" + +typedef KDevGenericFactory EditorChooserFactory; +static const KDevPluginInfo data("kdeveditorchooser"); +K_EXPORT_COMPONENT_FACTORY( libkdeveditorchooser, EditorChooserFactory( data ) ) + +EditorChooserPart::EditorChooserPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name ? name : "EditorChooserPart") +{ + setInstance(EditorChooserFactory::instance()); + + connect(core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(configWidget(KDialogBase*))); +} + + +EditorChooserPart::~EditorChooserPart() +{ +} + + +void EditorChooserPart::configWidget(KDialogBase *dlg) +{ + QVBox *vbox = dlg->addVBoxPage(i18n("Editor"), i18n("Editor"), BarIcon("kate", KIcon::SizeMedium) ); + EditorChooserWidget *w = new EditorChooserWidget(vbox); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); +} + + + +#include "editorchooser_part.moc" diff --git a/editors/editor-chooser/editorchooser_part.h b/editors/editor-chooser/editorchooser_part.h new file mode 100644 index 00000000..15cb2f97 --- /dev/null +++ b/editors/editor-chooser/editorchooser_part.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2001 Matthias Hoelzer-Kluepfel + */ + + +#ifndef __KDEVPART_EDITORCHOOSER_H__ +#define __KDEVPART_EDITORCHOOSER_H__ + + +class KDialogBase; + + +#include + + +class EditorChooserPart : public KDevPlugin +{ + Q_OBJECT + +public: + + EditorChooserPart(QObject *parent, const char *name, const QStringList &); + ~EditorChooserPart(); + + +private slots: + + void configWidget(KDialogBase *dlg); + +}; + + +#endif diff --git a/editors/editor-chooser/editorchooser_widget.cpp b/editors/editor-chooser/editorchooser_widget.cpp new file mode 100644 index 00000000..6c9f7071 --- /dev/null +++ b/editors/editor-chooser/editorchooser_widget.cpp @@ -0,0 +1,132 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + + +#include "editorchooser_widget.h" + + +EditorChooserWidget::EditorChooserWidget(QWidget *parent, const char *name) + : EditChooser(parent, name) +{ + // ask the trader which editors he has to offer + m_offers = KTrader::self()->query("text/plain", "'KTextEditor/Document' in ServiceTypes"); + + // remove the vim-part, it's known to crash + KTrader::OfferList::Iterator it = m_offers.begin(); + while( it != m_offers.end() ) + { + if ( ((*it)->desktopEntryName() == "vimpart") + || ((*it)->desktopEntryName() == "qeditor_part") ) + { + m_offers.remove( it ); + break; + } + ++it; + } + + load(); + slotEditPartChanged(QString()); +} + + +void EditorChooserWidget::load() +{ + EditorPart->clear(); + + // find the editor to use + KConfig *config = kapp->config(); + config->setGroup("Editor"); + QString editor = config->readPathEntry("EmbeddedKTextEditor"); + + // add the entries to the listview + KTrader::OfferList::Iterator it; + int index=-1, current=0; + for (it = m_offers.begin(); it != m_offers.end(); ++it) + { + EditorPart->insertItem((*it)->name()); + if ( (*it)->desktopEntryName() == editor ) + index = current; + ++current; + } + + if (index >=0) + EditorPart->setCurrentItem(index); + + QString dirtyAction = config->readEntry( "DirtyAction" ); + + if ( dirtyAction == "reload" ) + { + reload->setChecked( true ); + } + else if ( dirtyAction == "alert" ) + { + alert->setChecked( true ); + } + else + { + nothing->setChecked( true ); + } +} + + +void EditorChooserWidget::save() +{ + KConfig *config = kapp->config(); + config->setGroup("Editor"); + + KTrader::OfferList::Iterator it; + for (it = m_offers.begin(); it != m_offers.end(); ++it) + if ( EditorPart->currentText() == (*it)->name() ) + { + config->writePathEntry("EmbeddedKTextEditor", (*it)->desktopEntryName()); + } + + if ( reload->isChecked() ) + { + config->writeEntry( "DirtyAction", "reload" ); + } + else if ( alert->isChecked() ) + { + config->writeEntry( "DirtyAction", "alert" ); + } + else + { + config->writeEntry( "DirtyAction", "nothing" ); + } + + config->sync(); +} + + +void EditorChooserWidget::accept() +{ + save(); +} + +void EditorChooserWidget::slotEditPartChanged( const QString & ) +{ + KTrader::OfferList::Iterator it; + for (it = m_offers.begin(); it != m_offers.end(); ++it) + { + if ( EditorPart->currentText() == (*it)->name() ) + { + external_changes_group->setEnabled( (*it)->desktopEntryName() == "katepart" ); + return; + } + } + external_changes_group->setEnabled( false ); +} + + +#include "editorchooser_widget.moc" + + + + diff --git a/editors/editor-chooser/editorchooser_widget.h b/editors/editor-chooser/editorchooser_widget.h new file mode 100644 index 00000000..1688b5c0 --- /dev/null +++ b/editors/editor-chooser/editorchooser_widget.h @@ -0,0 +1,39 @@ +#ifndef __EDITORCHOOSER_WIDGET_H__ +#define __EDITORCHOOSER_WIDGET_H__ + + +#include +#include + +#include "editchooser.h" + + +class EditorChooserWidget : public EditChooser +{ + Q_OBJECT + +public: + + EditorChooserWidget(QWidget *parent=0, const char *name=0); + +public slots: + virtual void slotEditPartChanged(const QString &); + +private slots: + + void load(); + void save(); + + void accept(); + +private: + KTrader::OfferList m_offers; + +}; + + +#endif + + + + diff --git a/editors/editor-chooser/kdeveditorchooser.desktop b/editors/editor-chooser/kdeveditorchooser.desktop new file mode 100644 index 00000000..691c538a --- /dev/null +++ b/editors/editor-chooser/kdeveditorchooser.desktop @@ -0,0 +1,91 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Provides a dialog for Editor selection. +Comment[ca]=Proporciona un diàleg per a la selecció de l'Editor. +Comment[da]=Sørger for en dialog til editor-valg. +Comment[de]=Editor-Auswahl für KDevelop. +Comment[el]=Παρέχει ένα διάλογο για επιλογή επεξεργαστή. +Comment[en_GB]=Provides a dialogue for Editor selection. +Comment[es]=Proporciona un diálogo para la selección de un editor. +Comment[et]=Dialoog redaktori valimiseks. +Comment[eu]=Editorearen hautapenerako elkarrizketa-koadroa eskeintzen du. +Comment[fa]=محاوره‌ای برای گزینش ویرایشگر فراهم می‌کند. +Comment[fr]=Fournit une boîte de dialogue pour la sélection de l'éditeur. +Comment[ga]=Soláthraíonn sé dialóg roghnaithe eagarthóra. +Comment[gl]=Proporciona un diálogo para a selección dun editor. +Comment[hi]=संपादक चयन के लिए एक संवाद उपलब्ध कराता है. +Comment[hu]=A szövegszerkesztő komponens kiválasztását teszi lehetővé. +Comment[is]=Útvegar samtalsglugga fyrir val á ritli +Comment[it]=Fornisce a una finestra per la selezione dell'editor. +Comment[ja]=エディタを選択するためのダイアログを提供します。 +Comment[ms]=Menyediakan dialog untuk pemilihan Penyunting. +Comment[nds]=Stellt en Dialoog för de Editor-Utwahl praat. +Comment[ne]=सम्पादन चयनका लागि संवाद प्रदान गर्दछ +Comment[nl]=Biedt een dialoog om een editor te kiezen. +Comment[pl]=Okno dialogowe do wyboru edytora. +Comment[pt]=Fornece um diálogo para a selecção de Editor. +Comment[pt_BR]=Provê um diálogo para seleção do Editor. +Comment[ru]=Предоставляет диалог выбора редактора. +Comment[sk]=Poskytuje dialógové okno pre voľbu editora. +Comment[sl]=Ponuja pogovorno okno za izbiro urejevalnika +Comment[sr]=Обезбеђује прозор за избор уређивача. +Comment[sr@Latn]=Obezbeđuje prozor za izbor uređivača. +Comment[sv]=Tillhandahåller en dialogruta för val av editor. +Comment[ta]=தொகுப்பாளர் தேர்விற்கான உரையாடலைத் தரும் +Comment[tg]=Ба ихтиёр гузоштани гуфтугӯи интихоби муҳаррир. +Comment[tr]=Düzenleyici seçimi için bir pencere sağlar +Comment[zh_CN]=提供编辑器选择对话框 +Comment[zh_TW]=提供對話框以編輯選擇。 +Name=KDevEditorChooser +Name[da]=KDevelop Editorvælger +Name[de]=Editor-Auswahl (KDevelop) +Name[hi]=के-डेव-एडिटर-चूसर +Name[nds]=KDevelop-Editorutwahl +Name[ne]=केडीई विकास सम्पादक छनोटकर्ता +Name[pl]=KDevWybórEdytora +Name[sk]=KDevEditorVolič +Name[sv]=KDevelop editorväljare +Name[ta]=கெடெவ் தொகுப்பாளர் தேர்வாளர் +Name[tg]=KDevМуҳаррирИнтихобкунанда +Name[zh_TW]=KDevelop 編輯器選擇器 +GenericName=Editor Selection +GenericName[ca]=Selecció de l'Editor +GenericName[da]=Editorvalg +GenericName[de]=Editor-Auswahl +GenericName[el]=Επιλογή επεξεργαστή +GenericName[es]=Selección de un editor +GenericName[et]=Redaktori valimine +GenericName[eu]=Editore-hautapena +GenericName[fa]=گزینش ویرایشگر +GenericName[fr]=Sélection de l'éditeur +GenericName[ga]=Roghnú Eagarthóra +GenericName[gl]=Selección de editor +GenericName[hi]=संपादक चयन +GenericName[hu]=Szerkesztőkomponens-választás +GenericName[it]=Selezione Editor +GenericName[ja]=エディタの選択 +GenericName[ms]=Pemilih Penyunting +GenericName[nds]=Editor-Utwahl +GenericName[ne]=सम्पादक चयन +GenericName[nl]=Editorkiezer +GenericName[pl]=Wybór edytora +GenericName[pt]=Selecção de Editor +GenericName[pt_BR]=Seleção de Editor +GenericName[ru]=Выбор редактора +GenericName[sk]=Voľba editora +GenericName[sl]=Izbira urejevalnika +GenericName[sr]=Избор уређивача +GenericName[sr@Latn]=Izbor uređivača +GenericName[sv]=Val av editor +GenericName[ta]=தொகுப்பாளர் தேர்வு +GenericName[tg]=Интихоби муҳаррир +GenericName[tr]=Düzenleyici Seçimi +GenericName[zh_CN]=编辑器选择 +GenericName[zh_TW]=編輯器選擇 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin +X-KDE-Library=libkdeveditorchooser +X-KDevelop-Version=5 +X-KDevelop-Scope=Core +X-KDevelop-Properties=EditorChooser diff --git a/embedded/Makefile.am b/embedded/Makefile.am new file mode 100644 index 00000000..9bd593c0 --- /dev/null +++ b/embedded/Makefile.am @@ -0,0 +1,13 @@ +## +## Do NOT remove the comments that start with "kdevelop:" +## They are actually directives to the kdevelop plugin system +## +## The include_xxxx variables are controlled by configure.in.in +## + +#kdevelop: VISUALBOYADVANCE_SUBDIR = visualboyadvance +if include_vba +VISUALBOYADVANCE_SUBDIR = visualboyadvance +endif + +SUBDIRS = $(VISUALBOYADVANCE_SUBDIR) \ No newline at end of file diff --git a/embedded/visualboyadvance/Makefile.am b/embedded/visualboyadvance/Makefile.am new file mode 100644 index 00000000..4732b646 --- /dev/null +++ b/embedded/visualboyadvance/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevvisualboyadvance.la +libkdevvisualboyadvance_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevvisualboyadvance_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevvisualboyadvance_la_SOURCES = visualboyadvance_part.cpp vbaconfigwidgetbase.ui vbaconfigwidget.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevvisualboyadvance.desktop + +rcdir = $(kde_datadir)/kdevvisualboyadvance +rc_DATA = kdevpart_visualboyadvance.rc + diff --git a/embedded/visualboyadvance/kdevpart_visualboyadvance.rc b/embedded/visualboyadvance/kdevpart_visualboyadvance.rc new file mode 100644 index 00000000..674cd41f --- /dev/null +++ b/embedded/visualboyadvance/kdevpart_visualboyadvance.rc @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/embedded/visualboyadvance/kdevvisualboyadvance.desktop b/embedded/visualboyadvance/kdevvisualboyadvance.desktop new file mode 100644 index 00000000..bec85456 --- /dev/null +++ b/embedded/visualboyadvance/kdevvisualboyadvance.desktop @@ -0,0 +1,86 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=VisualBoyAdvance is a GameBoyAdvance emulator. http://vboy.emuhq.com/ +Comment[ca]=VisualBoyAdvance és un emulador de GameBoyAdvance. http://vboy.emuhq.com/ +Comment[da]=VisualBoyAdvance er en GameBoyAdvance emulator. http://vboy.emuhq.com/ +Comment[de]=VisualBoy Advance ist ein Emulator für den GameBoy Advance (http://vboy.emuhq.com/) +Comment[el]=Το VisualBoyAdvance είναι ένας εξομοιωτής του GameBoyAdvance. http://vboy.emuhq.com/ +Comment[es]=VisualBoyAdvance es un emulador de GameBoyAdvance. http://vboy.emuhq.com/ +Comment[et]=VisualBoyAdvance on GameBoyAdvance emulaator. http://vboy.emuhq.com/ +Comment[eu]=VisualBoyAdvance GameBoyAdvance-en emulatzaile bat da. http://vboy.emuhq.com/ +Comment[fa]=VisualBoyAdvance یک مقلد GameBoyAdvanc است. http://vboy.emuhq.com/ +Comment[fr]=VisualBoyAdvance est un émulateur de GameBoyAdvance. http://vboy.emuhq.com/ +Comment[ga]=Is aithriseoir GameBoyAdvance é VisualBoyAdvance. Féach ar http://vboy.emuhq.com/ +Comment[gl]=VisualBoyAdvance é un emulador de GameBoyAdvance. http://vboy.emuhq.com/ +Comment[hi]=विज़ुअल-बॉय-एडवांस एक गेम-बॉय-एडवांस एमुलेटर है. http://vboy.emuhq.com/ +Comment[hu]=A VisualBoyAdvance egy emulátor a Game Boy Advance-hoz - http://vboy.emuhq.com/ +Comment[is]=VisualBoyAdvance er GameBoyAdvance hermir. http://vboy.emuhq.com/ +Comment[it]=VisualBoyAdvance è un emulatore per GameBoyAdvance. http://vboy.emuhq.com/ +Comment[ja]=VisualBoyAdvance は、ゲームボーイアドバンスエミュレータです。http://vboy.emuhq.com/ +Comment[ms]=VisualBoyAdvance adalah emulator GameBoyAdvance. http://vboy.emuhq.com/ +Comment[nds]=VisualBoy Advance is en GameBoy-Advance-Emulator (http://vboy.emuhq.com/) +Comment[ne]=VisualBoyAdvance एउटा GameBoyAdvance इमुलेटर हो । http://vboy.emuhq.com/ +Comment[nl]=VisualBoyAdvance is een GameBoyAdvance-emulator (http://vboy.emuhq.com/ +Comment[pl]=VisualBoyAdvance to emulator GameBoyAdvance. http://vboy.emuhq.com/ +Comment[pt]=O VisualBoyAdvance é um emulador do GameBoyAdvance. http://vboy.emuhq.com/ +Comment[pt_BR]=VisualBoyAdvance é um emulador do GameBoyAdvance. http://vboy.emuhq.com/ +Comment[ru]=VisualBoyAdvance - эмулятор GameBoyAdvance. http://vboy.emuhq.com/ +Comment[sk]=VisualBoyAdvance je emulátor GameBoyAdvance. http://vboy.emuhq.com/ +Comment[sl]=VisualBoyAdvance je emulator GameBoyAdvance. http://vboy.emuhq.com/ +Comment[sr]=VisualBoyAdvance je емулатор GameBoyAdvance-а. http://vboy.emuhq.com/ +Comment[sr@Latn]=VisualBoyAdvance je emulator GameBoyAdvance-a. http://vboy.emuhq.com/ +Comment[sv]=VisualBoyAdvance är en emulator för GameBoyAdvance. http://vboy.emuhq.com/ +Comment[ta]=கெடெவ் காட்சியாக்க பாய் அட்வான்ஸ் பொன்மி.. http://vboy.emuhq.com/ +Comment[tg]=VisualBoyAdvance-ин эмулятори GameBoyAdvance мебошад. http://vboy.emuhq.com/ +Comment[tr]=VisualBoyAdvance bir GameBoyAdvance emülatörüdür: http://vboy.emuhq.com/ +Comment[zh_CN]=VisualBoyAdvance 是 GameBoyAdvance 的模拟器。http://vboy.emuhq.com/ +Comment[zh_TW]=VisualBoyAdvance 是一個 GameBoyAdvance 模擬器。http://vboy.emuhq.com/ +Name=KDevVisualBoyAdvance +Name[da]=KDevelop VisualBoyAdvance +Name[de]=VisualBoy Advance (KDevelop) +Name[hi]=के-डेव-विज़ुअल-बॉय-एडवांस +Name[nds]=VisualBoy Advance för KDevelop +Name[sv]=KDevelop Visual Boy Advance +Name[ta]=கெடெவ் காட்சியாக்க பாய் அட்வான்ஸ் +Name[zh_TW]=KDevelop VisualBoyAdvance +GenericName=VisualBoyAdvance Support +GenericName[ca]=Suport per a VisualBoyAdvance +GenericName[da]=VisualBoyAdvance understøttelse +GenericName[de]=Unterstützung für VisualBoy Advance +GenericName[el]=Υποστήριξη VisualBoyAdvance +GenericName[es]=Soporte para VisualBoyAdvance +GenericName[et]=VisualBoyAdvance toetus +GenericName[eu]=VisualBoyAdvance euskarria +GenericName[fa]=پشتیبانی VisualBoyAdvance +GenericName[fr]=Prise en charge de VisualBoyAdvance +GenericName[ga]=Tacaíocht VisualBoyAdvance +GenericName[gl]=Soporte de VisualBoyAdvance +GenericName[hu]=VisualBoyAdvance-támogatás +GenericName[it]=Supporto per VisualBoyAdvance +GenericName[ja]=VisualBoyAdvance サポート +GenericName[ms]=Sokongan VisualBoyAdvance +GenericName[nds]=Unnerstütten för VisualBoy Advance +GenericName[ne]=VisualBoyAdvance समर्थन +GenericName[nl]=Ondersteuning voor VisualBoyAdvance +GenericName[pl]=Obsługa VisualBoyAdvance +GenericName[pt]=Suporte a VisualBoyAdvance +GenericName[pt_BR]=Suporte ao VisualBoyAdvance +GenericName[ru]=Поддержка VisualBoyAdvance +GenericName[sk]=VisualBoyAdvance podpora +GenericName[sl]=Podpora VisualBoyAdvance +GenericName[sr]=Подршка за VisualBoyAdvance +GenericName[sr@Latn]=Podrška za VisualBoyAdvance +GenericName[sv]=Stöd för Visual Boy Advance +GenericName[ta]=காட்சியாக்க பாய் அட்வான்ஸ் ஆதரவு +GenericName[tg]=Ёри намудан ба VisualBoyAdvance +GenericName[tr]=VisualBoyAdvance Desteği +GenericName[zh_CN]=VisualBoyAdvance 支持 +GenericName[zh_TW]=VisualBoyAdvance 支援 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin +X-KDE-Library=libkdevvisualboyadvance +X-KDevelop-Version=5 +X-KDevelop-Scope=Project +Keywords=GBA +Keywords[hi]=जीबीए diff --git a/embedded/visualboyadvance/vbaconfigwidget.cpp b/embedded/visualboyadvance/vbaconfigwidget.cpp new file mode 100644 index 00000000..e9c00c12 --- /dev/null +++ b/embedded/visualboyadvance/vbaconfigwidget.cpp @@ -0,0 +1,144 @@ +/*************************************************************************** + vbaconfigwidget.cpp + ------------------- + begin : Thu Nov 29 2001 + copyright : (C) 2001 by Sandy Meier + email : smeier@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "vbaconfigwidget.h" + +#include +#include +#include +#include +#include + +#include + +#include "domutil.h" + + +using namespace VisualBoyAdvance; + +VBAConfigWidget::VBAConfigWidget(VisualBoyAdvancePart* part,QWidget *parent, const char *name ) : VBAConfigWidgetBase(parent,name) { + m_part = part; + QDomDocument &doc = *m_part->projectDom(); + // read + QString emulator = DomUtil::readEntry(doc, "/kdevvisualadvance/emulator"); + QString binary = DomUtil::readEntry(doc, "/kdevvisualadvance/binary"); + QString graphicFilter = DomUtil::readEntry(doc, "/kdevvisualadvance/graphicFilter"); + QString scaling = DomUtil::readEntry(doc, "/kdevvisualadvance/scaling"); + QString addOptions = DomUtil::readEntry(doc, "/kdevvisualadvance/addOptions"); + bool terminal = DomUtil::readBoolEntry(doc, "/kdevvisualadvance/terminal"); + bool fullscreen = DomUtil::readBoolEntry(doc, "/kdevvisualadvance/fullscreen"); + // set the widgets + + if(emulator.isNull()){ + emuPathEdit->setText("VisualBoyAdvance"); // default + }else{ + emuPathEdit->setText(emulator); + } + binaryEdit->setText(binary); + + // graphic + if(graphicFilter.isNull()){ + normalModeButton->setChecked(true); + }else{ + if(graphicFilter == "-f0"){ + normalModeButton->setChecked(true); + } + if(graphicFilter == "-f1"){ + tvModeButton->setChecked(true); + } + if(graphicFilter == "-f2"){ + salModeButton->setChecked(true); + } + if(graphicFilter == "-f3"){ + superSalModeButton->setChecked(true); + } + if(graphicFilter == "-f4"){ + superEagleModeButton->setChecked(true); + } + } + + // scaling + if(scaling.isNull()){ + scaling1Button->setChecked(true);//default + }else{ + if(scaling == "-1"){ + scaling1Button->setChecked(true); + } + if(scaling == "-2"){ + scaling2Button->setChecked(true); + } + if(scaling == "-3"){ + scaling3Button->setChecked(true); + } + if(scaling == "-4"){ + scaling4Button->setChecked(true); + } + + } + + if(fullscreen){ + fullscreenCheckBox->setChecked(true); + } + if(terminal){ + terminalCheckBox->setChecked(true); + } + + addOptionsEdit->setText(addOptions); + connect(emuPathButton,SIGNAL(clicked()),this,SLOT(emuPathButtonClicked())); +} +VBAConfigWidget::~VBAConfigWidget(){ +} + +void VBAConfigWidget::accept(){ + QDomDocument &doc = *m_part->projectDom(); + + DomUtil::writeEntry(doc, "/kdevvisualadvance/emulator",emuPathEdit->text()); + DomUtil::writeEntry(doc, "/kdevvisualadvance/binary",binaryEdit->text()); + DomUtil::writeEntry(doc, "/kdevvisualadvance/addOptions",addOptionsEdit->text()); + DomUtil::writeBoolEntry(doc, "/kdevvisualadvance/terminal",terminalCheckBox->isChecked()); + DomUtil::writeBoolEntry(doc, "/kdevvisualadvance/fullscreen",fullscreenCheckBox->isChecked()); + + if(normalModeButton->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/graphicFilter","-f0"); + }else if (tvModeButton->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/graphicFilter","-f1"); + }else if (salModeButton->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/graphicFilter","-f2"); + }else if (superSalModeButton->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/graphicFilter","-f3"); + }else if (superEagleModeButton->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/graphicFilter","-f4"); + } + + if(scaling1Button->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/scaling","-1"); + }else if(scaling2Button->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/scaling","-2"); + }else if(scaling3Button->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/scaling","-3"); + }else if(scaling4Button->isChecked()){ + DomUtil::writeEntry(doc, "/kdevvisualadvance/scaling","-4"); + } +} +void VBAConfigWidget::emuPathButtonClicked(){ + QString emu = KFileDialog::getOpenFileName(QDir::homeDirPath()); + if(!emu.isEmpty()){ + emuPathEdit->setText(emu); + } +} + +#include "vbaconfigwidget.moc" diff --git a/embedded/visualboyadvance/vbaconfigwidget.h b/embedded/visualboyadvance/vbaconfigwidget.h new file mode 100644 index 00000000..61866eb6 --- /dev/null +++ b/embedded/visualboyadvance/vbaconfigwidget.h @@ -0,0 +1,42 @@ +/*************************************************************************** + vbaconfigwidget.h - VisualBoy Advance configuration Widget + ------------------- + begin : Thu Nov 29 2001 + copyright : (C) 2001 by Sandy Meier + email : smeier@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef VBACONFIGWIDGET_H +#define VBACONFIGWIDGET_H + +#include +#include "vbaconfigwidgetbase.h" +#include "visualboyadvance_part.h" + +namespace VisualBoyAdvance { +/** + *@author + */ + +class VBAConfigWidget : public VBAConfigWidgetBase { + Q_OBJECT +public: + VBAConfigWidget(VisualBoyAdvancePart* part,QWidget *parent=0, const char *name=0); + ~VBAConfigWidget(); +public slots: + void accept(); + void emuPathButtonClicked(); + private: + VisualBoyAdvancePart* m_part; +}; +} +#endif diff --git a/embedded/visualboyadvance/vbaconfigwidgetbase.ui b/embedded/visualboyadvance/vbaconfigwidgetbase.ui new file mode 100644 index 00000000..fb24e2d7 --- /dev/null +++ b/embedded/visualboyadvance/vbaconfigwidgetbase.ui @@ -0,0 +1,249 @@ + +VBAConfigWidgetBase + + + VBAConfigWigdet + + + + 0 + 0 + 510 + 367 + + + + + unnamed + + + + + binaryEdit + + + + + ButtonGroup3 + + + + 5 + 5 + 0 + 0 + + + + Graphic Filter + + + + unnamed + + + + + normalModeButton + + + Normal mode + + + + + tvModeButton + + + TV mode + + + + + salModeButton + + + 2xSaI + + + + + superSalModeButton + + + Super 2xSal + + + + + superEagleModeButton + + + Super Eagle + + + + + + + TextLabel2 + + + GBA binary: + + + + + emuPathEdit + + + + + TextLabel4 + + + Additional parameters: + + + + + TextLabel3 + + + VisualBoy Advance (emulator): + + + + + emuPathButton + + + + 0 + 0 + 0 + 0 + + + + + 22 + 0 + + + + ... + + + + + ButtonGroup4 + + + + 5 + 5 + 0 + 0 + + + + + 120 + 0 + + + + Scaling + + + + unnamed + + + + + scaling1Button + + + 1x + + + + + scaling2Button + + + 2x + + + + + scaling3Button + + + 3x + + + + + scaling4Button + + + 4x + + + + + + + fullscreenCheckBox + + + Full screen + + + + + terminalCheckBox + + + Start in external terminal + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + + addOptionsEdit + + + + + Spacer2 + + + Vertical + + + Expanding + + + + + + kdialog.h + + + + + diff --git a/embedded/visualboyadvance/visualboyadvance_part.cpp b/embedded/visualboyadvance/visualboyadvance_part.cpp new file mode 100644 index 00000000..ad434b43 --- /dev/null +++ b/embedded/visualboyadvance/visualboyadvance_part.cpp @@ -0,0 +1,77 @@ +#include "visualboyadvance_part.h" + +#include +#include + +#include +#include +#include +#include + +#include "kdevcore.h" +#include "kdevproject.h" +#include "kdevappfrontend.h" +#include "domutil.h" +#include "kdevplugininfo.h" + +#include "vbaconfigwidget.h" + + +using namespace VisualBoyAdvance; + +typedef KDevGenericFactory VisualBoyAdvanceFactory; +static const KDevPluginInfo data("kdevvisualboyadvance"); +K_EXPORT_COMPONENT_FACTORY( libkdevvisualboyadvance, VisualBoyAdvanceFactory( data ) ) + +VisualBoyAdvancePart::VisualBoyAdvancePart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name){ + setInstance(VisualBoyAdvanceFactory::instance()); + + setXMLFile("kdevpart_visualboyadvance.rc"); + + KAction *action; + action = new KAction( i18n("Execute Program"), "exec", Key_F9, + this, SLOT(slotExecute()), + actionCollection(), "build_execute" ); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); +} + + +VisualBoyAdvancePart::~VisualBoyAdvancePart() +{ + +} +void VisualBoyAdvancePart::slotExecute(){ + KDevProject* prj = project(); + QDomDocument &doc = *projectDom(); + QString binary = DomUtil::readEntry(doc, "/kdevvisualadvance/binary"); + QString emulator = DomUtil::readEntry(doc, "/kdevvisualadvance/emulator"); + QString graphicFilter = DomUtil::readEntry(doc, "/kdevvisualadvance/graphicFilter"); + QString scaling = DomUtil::readEntry(doc, "/kdevvisualadvance/scaling"); + QString addOptions = DomUtil::readEntry(doc, "/kdevvisualadvance/addOptions"); + bool terminal = DomUtil::readBoolEntry(doc, "/kdevvisualadvance/terminal"); + bool fullscreen = DomUtil::readBoolEntry(doc, "/kdevvisualadvance/fullscreen"); + + if(emulator.isNull()) emulator = "VisualBoyAdvance"; + QString program = emulator + " " + graphicFilter +" " + scaling + " " + addOptions +" "; + if(fullscreen){ + program += "-F "; + } + + program += prj->projectDirectory() + "/" + binary; + + if (KDevAppFrontend *appFrontend = extension("KDevelop/AppFrontend")) + appFrontend->startAppCommand(QString::QString(), program, terminal); +} + +void VisualBoyAdvancePart::projectConfigWidget(KDialogBase *dlg){ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Run Options"), i18n("Run Options"), BarIcon( "make", KIcon::SizeMedium )); + VBAConfigWidget* w = new VBAConfigWidget(this,vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + + +#include "visualboyadvance_part.moc" diff --git a/embedded/visualboyadvance/visualboyadvance_part.h b/embedded/visualboyadvance/visualboyadvance_part.h new file mode 100644 index 00000000..86903d0b --- /dev/null +++ b/embedded/visualboyadvance/visualboyadvance_part.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2001 Sandy Meier + */ + + +#ifndef __KDEVPART_VISUALBOYADVANCE_H__ +#define __KDEVPART_VISUALBOYADVANCE_H__ + +#include +#include +#include + +namespace VisualBoyAdvance { + class VisualBoyAdvancePart : public KDevPlugin + { + Q_OBJECT + + public: + + VisualBoyAdvancePart(QObject *parent, const char *name, const QStringList &); + ~VisualBoyAdvancePart(); + private slots: + void slotExecute(); + void projectConfigWidget(KDialogBase *dlg); + + }; + +} +#endif diff --git a/kde-development-kdevelop.directory b/kde-development-kdevelop.directory new file mode 100644 index 00000000..add723a6 --- /dev/null +++ b/kde-development-kdevelop.directory @@ -0,0 +1,5 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=KDevelop +Name[ne]=केडीई विकास +Icon=kdevelop diff --git a/kdevassistant.desktop b/kdevassistant.desktop new file mode 100644 index 00000000..c4310dff --- /dev/null +++ b/kdevassistant.desktop @@ -0,0 +1,74 @@ +[Desktop Entry] +Type=Application +Exec=kdevassistant %u +Icon=kdevelop +X-DocPath=kdevelop/index.html +Terminal=false +Name=KDevelop Assistant +Name[br]=Skoazeller KDevelop +Name[ca]=Assistent per a KDevelop +Name[cy]=Cymhorthwr KDevelop +Name[da]=KDevelop assistent +Name[de]=KDevelop-Assistent +Name[el]=Βοηθός KDevelop +Name[es]=Asistente de KDevelop +Name[et]=KDevelopi abiline +Name[eu]=KDevelop laguntzailea +Name[fa]=دستیار KDevelop +Name[fr]=Assistant de KDevelop +Name[it]=Assistente di KDevelop +Name[ja]=KDevelop アシスタント +Name[ms]=Pembantu KDevelop +Name[nds]=KDevelop-Hölper +Name[ne]=केडीई विकास सहायक +Name[nl]=KDevelop Assistent +Name[pl]=Asystent KDevelop +Name[pt]=Assistente do KDevelop +Name[pt_BR]=Assistente do KDevelop +Name[sk]=KDevelop asistent +Name[sl]=Pomočnik za KDevelop +Name[sr]=KDevelop-ов асистент +Name[sr@Latn]=KDevelop-ov asistent +Name[sv]=KDevelop assistent +Name[ta]=Kஉருவாக்கு உதவி +Name[tg]=KDevelop Ассистент +Name[zh_CN]=KDevelop 助手 +Name[zh_TW]=KDevelop 助理 +GenericName=Documentation Viewer +GenericName[br]=Gweler an teuliadur +GenericName[ca]=Visor de documentació +GenericName[da]=Dokumentationsfremviser +GenericName[de]=Dokumentationsbetrachter +GenericName[el]=Προβολέας τεκμηρίωσης +GenericName[es]=Visor de documentación +GenericName[et]=Dokumentatsiooninäitaja +GenericName[eu]=Documentazio ikustailea +GenericName[fa]=مشاهده‌گر مستندات +GenericName[fr]=Afficheur de documentation +GenericName[ga]=Amharcán Doiciméadithe +GenericName[gl]=Visor de documentación +GenericName[hu]=Dokumentációmegjelenítő +GenericName[it]=Visualizzatore documentazione +GenericName[ja]=ドキュメンテーションビューア +GenericName[ms]=Pelihat Dokumentasi +GenericName[nds]=Dokmentatschoonkieker +GenericName[ne]=मिलिसीकरण दृश्यकर्ता +GenericName[nl]=Documentatie Browser +GenericName[pa]=ਦਸਤਾਵੇਜ਼ ਦਰਸ਼ਕ +GenericName[pl]=Przeglądarka dokumentacji +GenericName[pt]=Visualizador de Documentação +GenericName[pt_BR]=Visualizador de Documentação +GenericName[ru]=Просмотр документации +GenericName[sk]=Prezerač dokumentácie +GenericName[sl]=Pregledovalnik dokumentacije +GenericName[sr]=Приказивач документације +GenericName[sr@Latn]=Prikazivač dokumentacije +GenericName[sv]=Dokumentationsvisning +GenericName[ta]=ஆவணமாக்கல் காட்சியமைப்பாளர் +GenericName[tg]=Аз назар бо ҳуҷҷатнок гузарондан +GenericName[tr]=Belge Gösterici +GenericName[zh_CN]=文档查看器 +GenericName[zh_TW]=文件檢視器 +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Development;Documentation;X-KDE-KDevelopIDE; + diff --git a/kdevdesigner/AUTHORS b/kdevdesigner/AUTHORS new file mode 100644 index 00000000..40d295ec --- /dev/null +++ b/kdevdesigner/AUTHORS @@ -0,0 +1,4 @@ +KDevDesigner: Alexander Dymo +Qt Designer Copyright: (C) 2000-2003 Trolltech AS All Rights Reserved + + diff --git a/kdevdesigner/LICENSE.GPL b/kdevdesigner/LICENSE.GPL new file mode 100644 index 00000000..5b6e7c66 --- /dev/null +++ b/kdevdesigner/LICENSE.GPL @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/kdevdesigner/Makefile.am b/kdevdesigner/Makefile.am new file mode 100644 index 00000000..4cc5b44c --- /dev/null +++ b/kdevdesigner/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = shared uilib designer src +#plugins + +EXTRA_DIST = COPYING configure.in.in diff --git a/kdevdesigner/NEWS b/kdevdesigner/NEWS new file mode 100644 index 00000000..0519ecba --- /dev/null +++ b/kdevdesigner/NEWS @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kdevdesigner/README b/kdevdesigner/README new file mode 100644 index 00000000..a9e2cf4b --- /dev/null +++ b/kdevdesigner/README @@ -0,0 +1,25 @@ +KDevDesigner is a port of Qt Designer (code taken from Qt 3.3 distribution) to KDE technologies: +1) XML GUI +2) KParts +3) KFileDialog +4) KIconLoader + +KDevDesigner consists of a part and a shell. +Part can be used in Konqueror and KDevelop to edit and view ui files and projects. +Shell loads a part with "in shell" argument so that the part can create projects and ui files. + +Other important notes: +KDevDesignerPart is Read/Write part which ignores readonly mode. +Designer Editor plugins are not loaded. +Available in system designer plugins are loaded if possible (tested with Qt 3.3 version). + +KDevDesignerPart integration: +KDevDesignerPart implements KInterfaceDesigner interface (defined in kdevelop/lib/external_interfaces). + +WARNING: +If you want to modify this code, try to introduce as few modifications to original Qt Designer code as possible. +Write your own classes and wrappers instead. The goal is to ease syncronization between the port and original Qt Designer. +Feel free to modify kdevdesigner_part.h(cpp) though. + +FUTURE: +Trolltech promises that Qt 4 will have easilly embeddable designer. If that happens, this port will be dropped for KDevelop 4. diff --git a/kdevdesigner/TODO b/kdevdesigner/TODO new file mode 100644 index 00000000..0519ecba --- /dev/null +++ b/kdevdesigner/TODO @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kdevdesigner/designer/Makefile.am b/kdevdesigner/designer/Makefile.am new file mode 100644 index 00000000..5b8372f9 --- /dev/null +++ b/kdevdesigner/designer/Makefile.am @@ -0,0 +1,21 @@ +SUBDIRS = pics + +AM_CXXFLAGS=-DDESIGNER +KDE_CXXFLAGS=-UQT_NO_ASCII_CAST +INCLUDES = -I$(top_srcdir)/kdevdesigner/shared \ + -I$(top_srcdir)/lib/interfaces/external $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libkdevdesignerpart.la +libkdevdesignerpart_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries) +libkdevdesignerpart_la_LIBADD = \ + $(top_builddir)/kdevdesigner/uilib/libkdevqui.la $(top_builddir)/kdevdesigner/shared/libshared.la \ + $(top_builddir)/lib/interfaces/external/libkinterfacedesigner.la -lqassistantclient $(LIB_KFILE) $(LIB_KPARTS) +libkdevdesignerpart_la_SOURCES = kdevdesigner_part.cpp actiondnd.cpp actioneditorimpl.cpp actionlistview.cpp asciivalidator.cpp command.cpp connectionitems.cpp connectiontable.cpp customwidgeteditorimpl.cpp database.cpp dbconnectionimpl.cpp dbconnectionsimpl.cpp defs.cpp designerapp.cpp designerappiface.cpp editfunctionsimpl.cpp filechooser.cpp formfile.cpp formsettingsimpl.cpp formwindow.cpp hierarchyview.cpp iconvieweditorimpl.cpp layout.cpp listboxdnd.cpp listboxeditorimpl.cpp listboxrename.cpp listdnd.cpp listviewdnd.cpp listvieweditorimpl.cpp mainwindow.cpp mainwindowactions.cpp menubareditor.cpp metadatabase.cpp multilineeditorimpl.cpp newformimpl.cpp orderindicator.cpp outputwindow.cpp paletteeditoradvancedimpl.cpp paletteeditorimpl.cpp pixmapchooser.cpp pixmapcollection.cpp popupmenueditor.cpp previewframe.cpp previewwidgetimpl.cpp project.cpp projectsettingsimpl.cpp propertyeditor.cpp propertyobject.cpp qcompletionedit.cpp resource.cpp sizehandle.cpp sourceeditor.cpp sourcefile.cpp startdialogimpl.cpp styledbutton.cpp syntaxhighlighter_html.cpp tableeditorimpl.cpp timestamp.cpp variabledialogimpl.cpp widgetaction.cpp widgetfactory.cpp wizardeditorimpl.cpp workspace.cpp about.ui dbconnection.ui gotolinedialog.ui newform.ui previewwidget.ui variabledialog.ui actioneditor.ui dbconnectioneditor.ui iconvieweditor.ui paletteeditor.ui projectsettings.ui wizardeditor.ui configtoolboxdialog.ui dbconnections.ui listboxeditor.ui paletteeditoradvanced.ui replacedialog.ui connectiondialog.ui editfunctions.ui listeditor.ui pixmapcollectioneditor.ui richtextfontdialog.ui createtemplate.ui finddialog.ui listvieweditor.ui pixmapfunction.ui startdialog.ui customwidgeteditor.ui formsettings.ui multilineeditor.ui preferences.ui tableeditor.ui designeraction.cpp myiconloader.cpp +partrcdir = $(kde_datadir)/kdevdesignerpart +partdesktopdir = $(kde_servicesdir) +partdesktop_DATA = kdevdesigner_part.desktop +partrc_DATA = kdevdesigner_part.rc kdevdesigner_part_sh.rc +noinst_HEADERS = kdevdesigner_part.h designeraction.h myiconloader.h +picsdirdir = $(kde_datadir)/kdevdesignerpart/pics + +KDE_OPTIONS=nofinal diff --git a/kdevdesigner/designer/about.ui b/kdevdesigner/designer/about.ui new file mode 100644 index 00000000..68980df0 --- /dev/null +++ b/kdevdesigner/designer/about.ui @@ -0,0 +1,219 @@ + +AboutDialog +********************************************************************* +** Copyright (C) 2001-2003 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + AboutDialog + + + + 0 + 0 + 544 + 667 + + + + Qt Designer + + + + unnamed + + + 11 + + + 6 + + + + aboutPixmap + + + NoFrame + + + Plain + + + "designer_splash.png" + + + false + + + AlignCenter + + + + + + + aboutVersion + + + Version 3.2 + + + AlignCenter + + + + + + + aboutCopyright + + + Copyright (C) 2000-2003 Trolltech AS. All Rights Reserved. + + + AlignCenter + + + + + + + aboutLicense + + + + 1 + 0 + 0 + 0 + + + + <p>Qt Commercial Edition license holders: This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution.</p><p></p><p>Qt Free Edition users: This program is licensed to you under the terms of the GNU General Public License Version 2. For details, see the file LICENSE.GPL that came with this software distribution.</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> + + + WordBreak|AlignVCenter|AlignLeft + + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + PushButton1 + + + &OK + + + true + + + true + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + + + PushButton1 + clicked() + AboutDialog + accept() + + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/actiondnd.cpp b/kdevdesigner/designer/actiondnd.cpp new file mode 100644 index 00000000..071f0d4b --- /dev/null +++ b/kdevdesigner/designer/actiondnd.cpp @@ -0,0 +1,726 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "actiondnd.h" +#include "command.h" +#include "defs.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "metadatabase.h" +#include "widgetfactory.h" +#include "hierarchyview.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QAction *ActionDrag::the_action = 0; + +ActionDrag::ActionDrag(QAction *action, QWidget *source) +: QStoredDrag("application/x-designer-actions", source) +{ + Q_ASSERT(the_action == 0); + the_action = action; +} + +ActionDrag::ActionDrag(QActionGroup *group, QWidget *source) +: QStoredDrag("application/x-designer-actiongroup", source) +{ + Q_ASSERT(the_action == 0); + the_action = group; +} + +ActionDrag::ActionDrag(const QString &type, QAction *action, QWidget *source) +: QStoredDrag(type, source) +{ + Q_ASSERT(the_action == 0); + the_action = action; +} + +bool ActionDrag::canDecode(QDropEvent *e) +{ + return e->provides( "application/x-designer-actions" ) || + e->provides( "application/x-designer-actiongroup" ) || + e->provides( "application/x-designer-separator" ); +} + +ActionDrag::~ActionDrag() +{ + the_action = 0; +} + +void QDesignerAction::init() +{ + MetaDataBase::addEntry( this ); + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( this ) ); + WidgetFactory::saveDefaultProperties( this, id ); + WidgetFactory::saveChangedProperties( this, id ); +} + +void QDesignerActionGroup::init() +{ + MetaDataBase::addEntry( this ); + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( this ) ); + WidgetFactory::saveDefaultProperties( this, id ); + WidgetFactory::saveChangedProperties( this, id ); +} + +bool QDesignerAction::addTo( QWidget *w ) +{ + if ( !widgetToInsert ) + return QAction::addTo( w ); + + if ( ::qt_cast(w) ) + return FALSE; + + widgetToInsert->reparent( w, QPoint( 0, 0 ), FALSE ); + widgetToInsert->show(); + addedTo( widgetToInsert, w ); + return TRUE; +} + +bool QDesignerAction::removeFrom( QWidget *w ) +{ + if ( !widgetToInsert ) + return QAction::removeFrom( w ); + + remove(); + return TRUE; +} + +void QDesignerAction::remove() +{ + if ( !widgetToInsert ) + return; + MainWindow::self->formWindow()->selectWidget( widgetToInsert, FALSE ); + widgetToInsert->reparent( 0, QPoint( 0, 0 ), FALSE ); +} + +QDesignerToolBarSeparator::QDesignerToolBarSeparator(Orientation o , QToolBar *parent, + const char* name ) + : QWidget( parent, name ) +{ + connect( parent, SIGNAL(orientationChanged(Orientation)), + this, SLOT(setOrientation(Orientation)) ); + setOrientation( o ); + setBackgroundMode( parent->backgroundMode() ); + setBackgroundOrigin( ParentOrigin ); + setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); +} + +void QDesignerToolBarSeparator::setOrientation( Orientation o ) +{ + orient = o; +} + +void QDesignerToolBarSeparator::styleChange( QStyle& ) +{ + setOrientation( orient ); +} + +QSize QDesignerToolBarSeparator::sizeHint() const +{ + int extent = style().pixelMetric( QStyle::PM_DockWindowSeparatorExtent, + this ); + if ( orient == Horizontal ) + return QSize( extent, 0 ); + else + return QSize( 0, extent ); +} + +void QDesignerToolBarSeparator::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); + QStyle::SFlags flags = QStyle::Style_Default; + + if ( orientation() == Horizontal ) + flags |= QStyle::Style_Horizontal; + + style().drawPrimitive( QStyle::PE_DockWindowSeparator, &p, rect(), + colorGroup(), flags ); +} + + + +QSeparatorAction::QSeparatorAction( QObject *parent ) + : QAction( parent, "qt_designer_separator" ), wid( 0 ) +{ +} + +bool QSeparatorAction::addTo( QWidget *w ) +{ + if ( ::qt_cast(w) ) { + QToolBar *tb = (QToolBar*)w; + wid = new QDesignerToolBarSeparator( tb->orientation(), tb ); + return TRUE; + } else if ( ::qt_cast(w) ) { + idx = ( (QPopupMenu*)w )->count(); + ( (QPopupMenu*)w )->insertSeparator( idx ); + return TRUE; + } + return FALSE; +} + +bool QSeparatorAction::removeFrom( QWidget *w ) +{ + if ( ::qt_cast(w) ) { + delete wid; + return TRUE; + } else if ( ::qt_cast(w) ) { + ( (QPopupMenu*)w )->removeItemAt( idx ); + return TRUE; + } + return FALSE; +} + +QWidget *QSeparatorAction::widget() const +{ + return wid; +} + + + +QDesignerToolBar::QDesignerToolBar( QMainWindow *mw ) + : QToolBar( mw ), lastIndicatorPos( -1, -1 ) +{ + insertAnchor = 0; + afterAnchor = TRUE; + setAcceptDrops( TRUE ); + MetaDataBase::addEntry( this ); + lastIndicatorPos = QPoint( -1, -1 ); + indicator = new QDesignerIndicatorWidget( this ); + indicator->hide(); + installEventFilter( this ); + widgetInserting = FALSE; + findFormWindow(); + mw->setDockEnabled( DockTornOff, FALSE ); +} + +QDesignerToolBar::QDesignerToolBar( QMainWindow *mw, Dock dock ) + : QToolBar( QString::null, mw, dock), lastIndicatorPos( -1, -1 ) +{ + insertAnchor = 0; + afterAnchor = TRUE; + setAcceptDrops( TRUE ); + indicator = new QDesignerIndicatorWidget( this ); + indicator->hide(); + MetaDataBase::addEntry( this ); + installEventFilter( this ); + widgetInserting = FALSE; + findFormWindow(); + mw->setDockEnabled( DockTornOff, FALSE ); +} + +void QDesignerToolBar::findFormWindow() +{ + QWidget *w = this; + while ( w ) { + formWindow = ::qt_cast(w); + if ( formWindow ) + break; + w = w->parentWidget(); + } +} + +void QDesignerToolBar::addAction( QAction *a ) +{ + actionList.append( a ); + connect( a, SIGNAL( destroyed() ), this, SLOT( actionRemoved() ) ); + if ( ::qt_cast(a) ) { + ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); + } else if ( ::qt_cast(a) ) { + ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); + } else { + ( (QDesignerAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); + } +} + +static void fixObject( QObject *&o ) +{ + while ( o && o->parent() && !::qt_cast(o->parent()) ) + o = o->parent(); +} + +bool QDesignerToolBar::eventFilter( QObject *o, QEvent *e ) +{ + if ( !o || !e || o->inherits( "QDockWindowHandle" ) || o->inherits( "QDockWindowTitleBar" ) ) + return QToolBar::eventFilter( o, e ); + + if ( o == this && e->type() == QEvent::MouseButtonPress && + ( ( QMouseEvent*)e )->button() == LeftButton ) { + mousePressEvent( (QMouseEvent*)e ); + return TRUE; + } + + if ( o == this ) + return QToolBar::eventFilter( o, e ); + + if ( e->type() == QEvent::MouseButtonPress ) { + QMouseEvent *ke = (QMouseEvent*)e; + fixObject( o ); + if ( !o ) + return FALSE; + buttonMousePressEvent( ke, o ); + return TRUE; + } else if(e->type() == QEvent::ContextMenu ) { + QContextMenuEvent *ce = (QContextMenuEvent*)e; + fixObject( o ); + if( !o ) + return FALSE; + buttonContextMenuEvent( ce, o ); + return TRUE; + } else if ( e->type() == QEvent::MouseMove ) { + QMouseEvent *ke = (QMouseEvent*)e; + fixObject( o ); + if ( !o ) + return FALSE; + buttonMouseMoveEvent( ke, o ); + return TRUE; + } else if ( e->type() == QEvent::MouseButtonRelease ) { + QMouseEvent *ke = (QMouseEvent*)e; + fixObject( o ); + if ( !o ) + return FALSE; + buttonMouseReleaseEvent( ke, o ); + return TRUE; + } else if ( e->type() == QEvent::DragEnter ) { + QDragEnterEvent *de = (QDragEnterEvent*)e; + if (ActionDrag::canDecode(de)) + de->accept(); + } else if ( e->type() == QEvent::DragMove ) { + QDragMoveEvent *de = (QDragMoveEvent*)e; + if (ActionDrag::canDecode(de)) + de->accept(); + } + + return QToolBar::eventFilter( o, e ); +} + +void QDesignerToolBar::paintEvent( QPaintEvent *e ) +{ + QToolBar::paintEvent( e ); + if ( e->rect() != rect() ) + return; + lastIndicatorPos = QPoint( -1, -1 ); +} + +void QDesignerToolBar::contextMenuEvent( QContextMenuEvent *e ) +{ + e->accept(); + QPopupMenu menu( 0 ); + menu.insertItem( i18n( "Delete Toolbar" ), 1 ); + int res = menu.exec( e->globalPos() ); + if ( res != -1 ) { + RemoveToolBarCommand *cmd = new RemoveToolBarCommand( i18n( "Delete Toolbar '%1'" ).arg( name() ), + formWindow, 0, this ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +void QDesignerToolBar::mousePressEvent( QMouseEvent *e ) +{ + widgetInserting = FALSE; + if ( e->button() == LeftButton && + MainWindow::self->currentTool() != POINTER_TOOL && + MainWindow::self->currentTool() != ORDER_TOOL && + MainWindow::self->currentTool() != CONNECT_TOOL && + MainWindow::self->currentTool() != BUDDY_TOOL ) + widgetInserting = TRUE; +} + +void QDesignerToolBar::mouseReleaseEvent( QMouseEvent *e ) +{ + if ( widgetInserting ) + doInsertWidget( mapFromGlobal( e->globalPos() ) ); + widgetInserting = FALSE; +} + +void QDesignerToolBar::buttonMouseReleaseEvent( QMouseEvent *e, QObject *w ) +{ + if ( widgetInserting ) + doInsertWidget( mapFromGlobal( e->globalPos() ) ); + else if ( w->isWidgetType() && formWindow->widgets()->find( w ) ) { + formWindow->clearSelection( FALSE ); + formWindow->selectWidget( w ); + } + widgetInserting = FALSE; +} + +void QDesignerToolBar::buttonContextMenuEvent( QContextMenuEvent *e, QObject *o ) +{ + e->accept(); + QPopupMenu menu( 0 ); + const int ID_DELETE = 1; + const int ID_SEP = 2; + const int ID_DELTOOLBAR = 3; + QMap::Iterator it = actionMap.find( (QWidget*)o ); + if ( it != actionMap.end() && ::qt_cast(*it) ) + menu.insertItem( i18n( "Delete Separator" ), ID_DELETE ); + else + menu.insertItem( i18n( "Delete Item" ), ID_DELETE ); + menu.insertItem( i18n( "Insert Separator" ), ID_SEP ); + menu.insertSeparator(); + menu.insertItem( i18n( "Delete Toolbar" ), ID_DELTOOLBAR ); + int res = menu.exec( e->globalPos() ); + if ( res == ID_DELETE ) { + QMap::Iterator it = actionMap.find( (QWidget*)o ); + if ( it == actionMap.end() ) + return; + QAction *a = *it; + int index = actionList.find( a ); + RemoveActionFromToolBarCommand *cmd = new RemoveActionFromToolBarCommand( + i18n( "Delete Action '%1' From Toolbar '%2'" ). + arg( a->name() ).arg( caption() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( res == ID_SEP ) { + calcIndicatorPos( mapFromGlobal( e->globalPos() ) ); + QAction *a = new QSeparatorAction( 0 ); + int index = actionList.findRef( *actionMap.find( insertAnchor ) ); + if ( index != -1 && afterAnchor ) + ++index; + if ( !insertAnchor ) + index = 0; + + AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( + i18n( "Add Separator to Toolbar '%1'" ). + arg( a->name() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( res == ID_DELTOOLBAR ) { + RemoveToolBarCommand *cmd = new RemoveToolBarCommand( i18n( "Delete Toolbar '%1'" ).arg( name() ), + formWindow, 0, this ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +void QDesignerToolBar::buttonMousePressEvent( QMouseEvent *e, QObject * ) +{ + widgetInserting = FALSE; + + if ( e->button() == MidButton ) + return; + + if ( e->button() == LeftButton && + MainWindow::self->currentTool() != POINTER_TOOL && + MainWindow::self->currentTool() != ORDER_TOOL && + MainWindow::self->currentTool() != CONNECT_TOOL && + MainWindow::self->currentTool() != BUDDY_TOOL ) { + widgetInserting = TRUE; + return; + } + + dragStartPos = e->pos(); +} + +void QDesignerToolBar::removeWidget( QWidget *w ) +{ + QMap::Iterator it = actionMap.find( w ); + if ( it == actionMap.end() ) + return; + QAction *a = *it; + int index = actionList.find( a ); + RemoveActionFromToolBarCommand *cmd = + new RemoveActionFromToolBarCommand( i18n( "Delete Action '%1' From Toolbar '%2'" ). + arg( a->name() ).arg( caption() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + QApplication::sendPostedEvents(); + adjustSize(); +} + +void QDesignerToolBar::buttonMouseMoveEvent( QMouseEvent *e, QObject *o ) +{ + if ( widgetInserting || ( e->state() & LeftButton ) == 0 ) + return; + if ( QABS( QPoint( dragStartPos - e->pos() ).manhattanLength() ) < QApplication::startDragDistance() ) + return; + QMap::Iterator it = actionMap.find( (QWidget*)o ); + if ( it == actionMap.end() ) + return; + QAction *a = *it; + if ( !a ) + return; + int index = actionList.find( a ); + RemoveActionFromToolBarCommand *cmd = + new RemoveActionFromToolBarCommand( i18n( "Delete Action '%1' From Toolbar '%2'" ). + arg( a->name() ).arg( caption() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + QApplication::sendPostedEvents(); + adjustSize(); + + QString type = ::qt_cast(a) ? QString( "application/x-designer-actiongroup" ) : + ::qt_cast(a) ? QString( "application/x-designer-separator" ) : QString( "application/x-designer-actions" ); + QStoredDrag *drag = new ActionDrag( type, a, this ); + drag->setPixmap( a->iconSet().pixmap() ); + if ( ::qt_cast(a) ) { + if ( formWindow->widgets()->find( ( (QDesignerAction*)a )->widget() ) ) + formWindow->selectWidget( ( (QDesignerAction*)a )->widget(), FALSE ); + } + if ( !drag->drag() ) { + AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Action '%1' to Toolbar '%2'" ). + arg( a->name() ).arg( caption() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + lastIndicatorPos = QPoint( -1, -1 ); + indicator->hide(); +} + +#ifndef QT_NO_DRAGANDDROP + +void QDesignerToolBar::dragEnterEvent( QDragEnterEvent *e ) +{ + widgetInserting = FALSE; + lastIndicatorPos = QPoint( -1, -1 ); + if (ActionDrag::canDecode(e)) + e->accept(); +} + +void QDesignerToolBar::dragMoveEvent( QDragMoveEvent *e ) +{ + if (ActionDrag::canDecode(e)) { + e->accept(); + drawIndicator( calcIndicatorPos( e->pos() ) ); + } +} + +void QDesignerToolBar::dragLeaveEvent( QDragLeaveEvent * ) +{ + indicator->hide(); + insertAnchor = 0; + afterAnchor = TRUE; +} + +void QDesignerToolBar::dropEvent( QDropEvent *e ) +{ + if (!ActionDrag::canDecode(e)) + return; + + e->accept(); + + indicator->hide(); + QAction *a = 0; + int index = actionList.findRef( *actionMap.find( insertAnchor ) ); + if ( index != -1 && afterAnchor ) + ++index; + if ( !insertAnchor ) + index = 0; + if ( e->provides( "application/x-designer-actions" ) || + e->provides( "application/x-designer-separator" ) ) { + if ( e->provides( "application/x-designer-actions" ) ) + a = ::qt_cast(ActionDrag::action()); + else + a = ::qt_cast(ActionDrag::action()); + } else { + a = ::qt_cast(ActionDrag::action()); + } + + if ( actionList.findRef( a ) != -1 ) { + QMessageBox::warning( MainWindow::self, i18n( "Insert/Move Action" ), + i18n( "Action '%1' has already been added to this toolbar.\n" + "An Action may only occur once in a given toolbar." ). + arg( a->name() ) ); + return; + } + + AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Action '%1' to Toolbar '%2'" ). + arg( a->name() ).arg( caption() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + + lastIndicatorPos = QPoint( -1, -1 ); +} + +#endif + +void QDesignerToolBar::reInsert() +{ + QAction *a = 0; + actionMap.clear(); + clear(); + for ( a = actionList.first(); a; a = actionList.next() ) { + a->addTo( this ); + if ( ::qt_cast(a) ) { + actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); + if ( ( (QDesignerActionGroup*)a )->widget() ) + ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); + } else if ( ::qt_cast(a) ) { + actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); + ( (QDesignerAction*)a )->widget()->installEventFilter( this ); + } else if ( ::qt_cast(a) ) { + actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); + ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); + } + } + QApplication::sendPostedEvents(); + adjustSize(); +} + +void QDesignerToolBar::actionRemoved() +{ + actionList.removeRef( (QAction*)sender() ); +} + +QPoint QDesignerToolBar::calcIndicatorPos( const QPoint &pos ) +{ + if ( orientation() == Horizontal ) { + QPoint pnt( width() - 2, 0 ); + insertAnchor = 0; + afterAnchor = TRUE; + if ( !children() ) + return pnt; + pnt = QPoint( 13, 0 ); + QObjectListIt it( *children() ); + QObject * obj; + while( (obj=it.current()) != 0 ) { + ++it; + if ( obj->isWidgetType() && + qstrcmp( "qt_dockwidget_internal", obj->name() ) != 0 ) { + QWidget *w = (QWidget*)obj; + if ( w->x() < pos.x() ) { + pnt.setX( w->x() + w->width() + 1 ); + insertAnchor = w; + afterAnchor = TRUE; + } + } + } + return pnt; + } else { + QPoint pnt( 0, height() - 2 ); + insertAnchor = 0; + afterAnchor = TRUE; + if ( !children() ) + return pnt; + pnt = QPoint( 0, 13 ); + QObjectListIt it( *children() ); + QObject * obj; + while( (obj=it.current()) != 0 ) { + ++it; + if ( obj->isWidgetType() && + qstrcmp( "qt_dockwidget_internal", obj->name() ) != 0 ) { + QWidget *w = (QWidget*)obj; + if ( w->y() < pos.y() ) { + pnt.setY( w->y() + w->height() + 1 ); + insertAnchor = w; + afterAnchor = TRUE; + } + } + } + return pnt; + } +} + +void QDesignerToolBar::drawIndicator( const QPoint &pos ) +{ + if ( lastIndicatorPos == pos ) + return; + bool wasVsisible = indicator->isVisible(); + if ( orientation() == Horizontal ) { + indicator->resize( 3, height() ); + if ( pos != QPoint( -1, -1 ) ) + indicator->move( pos.x() - 1, 0 ); + indicator->show(); + indicator->raise(); + lastIndicatorPos = pos; + } else { + indicator->resize( width(), 3 ); + if ( pos != QPoint( -1, -1 ) ) + indicator->move( 0, pos.y() - 1 ); + indicator->show(); + indicator->raise(); + lastIndicatorPos = pos; + } + if ( !wasVsisible ) + QApplication::sendPostedEvents(); +} + +void QDesignerToolBar::doInsertWidget( const QPoint &p ) +{ + if ( formWindow != MainWindow::self->formWindow() ) + return; + calcIndicatorPos( p ); + QWidget *w = WidgetFactory::create( MainWindow::self->currentTool(), this, 0, TRUE ); + installEventFilters( w ); + MainWindow::self->formWindow()->insertWidget( w, TRUE ); + QDesignerAction *a = new QDesignerAction( w, parent() ); + int index = actionList.findRef( *actionMap.find( insertAnchor ) ); + if ( index != -1 && afterAnchor ) + ++index; + if ( !insertAnchor ) + index = 0; + AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Widget '%1' to Toolbar '%2'" ). + arg( w->name() ).arg( caption() ), + formWindow, a, this, index ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + MainWindow::self->resetTool(); +} + +void QDesignerToolBar::clear() +{ + for ( QAction *a = actionList.first(); a; a = actionList.next() ) { + if ( ::qt_cast(a) ) + ( (QDesignerAction*)a )->remove(); + } + QToolBar::clear(); +} + +void QDesignerToolBar::installEventFilters( QWidget *w ) +{ + if ( !w ) + return; + QObjectList *l = w->queryList( "QWidget" ); + for ( QObject *o = l->first(); o; o = l->next() ) + o->installEventFilter( this ); + delete l; +} + +//#include "actiondnd.moc" diff --git a/kdevdesigner/designer/actiondnd.h b/kdevdesigner/designer/actiondnd.h new file mode 100644 index 00000000..fcf37fe9 --- /dev/null +++ b/kdevdesigner/designer/actiondnd.h @@ -0,0 +1,247 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ACTIONDND_H +#define ACTIONDND_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../shared/widgetdatabase.h" + +//class QDesignerPopupMenu; +class QDesignerIndicatorWidget; +class FormWindow; +class QPopupMenu; + +class QDesignerIndicatorWidget : public QWidget +{ + Q_OBJECT + +public: + QDesignerIndicatorWidget( QWidget *p ) + : QWidget( p, "qt_dockwidget_internal" ) { + setBackgroundColor( red ); + } + +}; + +class ActionDrag : public QStoredDrag +{ + Q_OBJECT + +public: + ActionDrag(const QString &type, QAction *action, QWidget *source); + ActionDrag(QAction *action, QWidget *source); + ActionDrag(QActionGroup *group, QWidget *source); + + ~ActionDrag(); + + static bool canDecode(QDropEvent *e); + + static QAction *action() + { + return the_action; + } + +private: + static QAction *the_action; +}; + +class QDesignerActionGroup : public QActionGroup +{ + Q_OBJECT + +public: + QDesignerActionGroup( QObject *parent ) + : QActionGroup( ::qt_cast(parent) ? parent : 0 ), wid( 0 ), idx( -1 ) { init(); } + + void init(); + + QWidget *widget() const { return wid; } + QWidget *widget( QAction *a ) const { return *widgets.find( a ); } + int index() const { return idx; } + +protected: +#if !defined(Q_NO_USING_KEYWORD) + using QActionGroup::addedTo; +#endif + void addedTo( QWidget *w, QWidget * ) { + wid = w; + } + void addedTo( QWidget *w, QWidget *, QAction *a ) { + widgets.insert( a, w ); + } + void addedTo( int index, QPopupMenu * ) { + idx = index; + } + +private: + QWidget *wid; + QMap widgets; + int idx; + +}; + +class QDesignerAction : public QAction +{ + Q_OBJECT + +public: + QDesignerAction( QObject *parent ) + : QAction( ::qt_cast(parent) ? parent : 0 ), wid( 0 ), idx( -1 ), widgetToInsert( 0 ) { init(); } + QDesignerAction( QWidget *w, QObject *parent ) + : QAction( ::qt_cast(parent) ? parent : 0 ), wid( 0 ), idx( -1 ), widgetToInsert( w ) { init(); } + + void init(); + + QWidget *widget() const { return wid; } + int index() const { return idx; } + + bool addTo( QWidget *w ); + bool removeFrom( QWidget *w ); + + void remove(); + bool supportsMenu() const { return !widgetToInsert; } + +protected: + void addedTo( QWidget *w, QWidget * ) { + wid = w; + } + void addedTo( int index, QPopupMenu * ) { + idx = index; + } + +private: + QWidget *wid; + int idx; + QWidget *widgetToInsert; + +}; + +class QDesignerToolBarSeparator : public QWidget +{ + Q_OBJECT + +public: + QDesignerToolBarSeparator( Orientation, QToolBar *parent, const char* name=0 ); + + QSize sizeHint() const; + Orientation orientation() const { return orient; } +public slots: + void setOrientation( Orientation ); +protected: + void styleChange( QStyle& ); + void paintEvent( QPaintEvent * ); +private: + Orientation orient; +}; + + +class QSeparatorAction : public QAction +{ + Q_OBJECT + +public: + QSeparatorAction( QObject *parent ); + + bool addTo( QWidget *w ); + bool removeFrom( QWidget *w ); + QWidget *widget() const; + int index() const; + +private: + QWidget *wid; + int idx; + +}; + + +class QDesignerToolBar : public QToolBar +{ + Q_OBJECT + +public: + QDesignerToolBar( QMainWindow *mw ); + QDesignerToolBar( QMainWindow *mw, Dock dock ); + QPtrList insertedActions() const { return actionList; } + void addAction( QAction *a ); + + void clear(); + void installEventFilters( QWidget *w ); + void insertAction( QWidget *w, QAction *a ) { actionMap.insert( w, a ); } + void insertAction( int index, QAction *a ) { actionList.insert( index, a ); } + void appendAction( QAction *a ) { actionList.append( a ); } + void removeAction( QAction *a ) { actionList.remove( a ); } + void reInsert(); + void removeWidget( QWidget *w ); + +protected: + bool eventFilter( QObject *, QEvent * ); + void paintEvent( QPaintEvent * ); +#ifndef QT_NO_DRAGANDDROP + void dragEnterEvent( QDragEnterEvent * ); + void dragMoveEvent( QDragMoveEvent * ); + void dragLeaveEvent( QDragLeaveEvent * ); + void dropEvent( QDropEvent * ); +#endif + void contextMenuEvent( QContextMenuEvent *e ); + void mousePressEvent( QMouseEvent *e ); + void mouseReleaseEvent( QMouseEvent *e ); + +private slots: + void actionRemoved(); + +private: + void drawIndicator( const QPoint &pos ); + QPoint calcIndicatorPos( const QPoint &pos ); + void buttonContextMenuEvent( QContextMenuEvent *e, QObject *o ); + void buttonMousePressEvent( QMouseEvent *e, QObject *o ); + void buttonMouseMoveEvent( QMouseEvent *e, QObject *o ); + void buttonMouseReleaseEvent( QMouseEvent *e, QObject *o ); + void doInsertWidget( const QPoint &p ); + void findFormWindow(); + +private: + QPoint lastIndicatorPos; + QWidget *insertAnchor; + bool afterAnchor; + QPtrList actionList; + QMap actionMap; + QPoint dragStartPos; + QDesignerIndicatorWidget *indicator; + bool widgetInserting; + FormWindow *formWindow; + +}; + +#endif diff --git a/kdevdesigner/designer/actioneditor.ui b/kdevdesigner/designer/actioneditor.ui new file mode 100644 index 00000000..669c60e0 --- /dev/null +++ b/kdevdesigner/designer/actioneditor.ui @@ -0,0 +1,227 @@ + +ActionEditorBase +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ActionEditorBase + + + + 0 + 0 + 206 + 227 + + + + Edit Actions + + + + + + unnamed + + + 4 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + buttonNewAction + + + + + + "designer_filenew.png" + + + true + + + Create new Action + + + + + buttonDeleteAction + + + + + + "designer_s_editcut.png" + + + true + + + Delete current Action + + + + + buttonConnect + + + + + + "designer_connecttool.png" + + + true + + + Connect current Action + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + listActions + + + + + + + ActionListView +
      actionlistview.h
      + + 200 + 200 + + 0 + + 7 + 7 + 0 + 0 + + "image0" + selectionChanged( QListViewItem * ) + currentChanged( QListViewItem * ) + clicked( QListViewItem * ) +
      +
      + + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + + + listActions + currentChanged( QListViewItem * ) + ActionEditorBase + currentActionChanged(QListViewItem*) + + + listActions + clicked( QListViewItem * ) + ActionEditorBase + currentActionChanged(QListViewItem*) + + + listActions + selectionChanged( QListViewItem * ) + ActionEditorBase + currentActionChanged(QListViewItem*) + + + buttonNewAction + clicked() + ActionEditorBase + newAction() + + + buttonConnect + clicked() + ActionEditorBase + connectionsClicked() + + + buttonDeleteAction + clicked() + ActionEditorBase + deleteAction() + + + + class QListViewItem; + + + init() + destroy() + connectionsClicked() + currentActionChanged( QListViewItem * ) + deleteAction() + newAction() + + + myiconloader.h + +BarIcon2 + + +
      diff --git a/kdevdesigner/designer/actioneditorimpl.cpp b/kdevdesigner/designer/actioneditorimpl.cpp new file mode 100644 index 00000000..589525e4 --- /dev/null +++ b/kdevdesigner/designer/actioneditorimpl.cpp @@ -0,0 +1,320 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "actioneditorimpl.h" +#include "formwindow.h" +#include "metadatabase.h" +#include "actionlistview.h" +#include "connectiondialog.h" +#include "mainwindow.h" +#include "hierarchyview.h" +#include "formfile.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +ActionEditor::ActionEditor( QWidget* parent, const char* name, WFlags fl ) + : ActionEditorBase( parent, name, fl ), currentAction( 0 ), formWindow( 0 ), + explicitlyClosed(false) +{ + listActions->addColumn( i18n( "Actions" ) ); + setEnabled( FALSE ); + buttonConnect->setEnabled( FALSE ); + + QPopupMenu *popup = new QPopupMenu( this ); + popup->insertItem( i18n( "New &Action" ), this, SLOT( newAction() ) ); + popup->insertItem( i18n( "New Action &Group" ), this, SLOT( newActionGroup() ) ); + popup->insertItem( i18n( "New &Dropdown Action Group" ), this, SLOT( newDropDownActionGroup() ) ); + buttonNewAction->setPopup( popup ); + buttonNewAction->setPopupDelay( 0 ); + + connect( listActions, SIGNAL( insertAction() ), this, SLOT( newAction() ) ); + connect( listActions, SIGNAL( insertActionGroup() ), this, SLOT( newActionGroup() ) ); + connect( listActions, SIGNAL( insertDropDownActionGroup() ), this, SLOT( newDropDownActionGroup() ) ); + connect( listActions, SIGNAL( deleteAction() ), this, SLOT( deleteAction() ) ); + connect( listActions, SIGNAL( connectAction() ), this, SLOT( connectionsClicked() ) ); +} + +void ActionEditor::closeEvent( QCloseEvent *e ) +{ + emit hidden(); + e->accept(); +} + +void ActionEditor::currentActionChanged( QListViewItem *i ) +{ + buttonConnect->setEnabled( i != 0 ); + if ( !i ) + return; + currentAction = ( (ActionItem*)i )->action(); + if ( !currentAction ) + currentAction = ( (ActionItem*)i )->actionGroup(); + if ( formWindow && currentAction ) + formWindow->setActiveObject( currentAction ); + MainWindow::self->objectHierarchy()->hierarchyList()->setCurrent( currentAction ); +} + +void ActionEditor::setCurrentAction( QAction *a ) +{ + QListViewItemIterator it( listActions ); + while ( it.current() ) { + if ( ( (ActionItem*)it.current() )->action() == a || ( (ActionItem*)it.current() )->actionGroup() == a ) { + listActions->setCurrentItem( it.current() ); + listActions->ensureItemVisible( it.current() ); + break; + } + ++it; + } +} + +QAction *ActionEditor::newActionEx() +{ + ActionItem *i = new ActionItem( listActions, (bool)FALSE ); + QAction *a = i->action(); + QObject::connect( a, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject* ) ) ); + MetaDataBase::addEntry( i->action() ); + QString n = "Action"; + formWindow->unify( i->action(), n, TRUE ); + i->setText( 0, n ); + i->action()->setName( n ); + i->action()->setText( i->action()->name() ); + MetaDataBase::setPropertyChanged( i->action(), "text", TRUE ); + MetaDataBase::setPropertyChanged( i->action(), "name", TRUE ); + formWindow->actionList().append( i->action() ); + if ( formWindow->formFile() ) + formWindow->formFile()->setModified( TRUE ); + return i->action(); +} + +void ActionEditor::deleteAction() +{ + if ( !currentAction ) + return; + + QListViewItemIterator it( listActions ); + ActionItem *ai = 0; + while ( it.current() ) { + ai = (ActionItem*)it.current(); + if ( ai->action() == currentAction || ai->actionGroup() == currentAction ) { + emit removing( currentAction ); + formWindow->actionList().removeRef( currentAction ); + delete currentAction; + currentAction = 0; + delete it.current(); + break; + } + ++it; + } + if ( formWindow ) { + formWindow->setActiveObject( formWindow->mainContainer() ); + if ( formWindow->formFile() ) + formWindow->formFile()->setModified( TRUE ); + } +} + +void ActionEditor::newAction() +{ + ActionItem *actionParent = (ActionItem*)listActions->selectedItem(); + if ( actionParent ) { + if ( !::qt_cast(actionParent->actionGroup()) ) + actionParent = (ActionItem*)actionParent->parent(); + } + + ActionItem *i = 0; + if ( actionParent ) + i = new ActionItem( actionParent ); + else + i = new ActionItem( listActions, (bool)FALSE ); + QAction *a = i->action(); + QObject::connect( a, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject* ) ) ); + MetaDataBase::addEntry( i->action() ); + QString n = "Action"; + formWindow->unify( i->action(), n, TRUE ); + i->setText( 0, n ); + i->action()->setName( n ); + i->action()->setText( i->action()->name() ); + if ( actionParent && actionParent->actionGroup() && + actionParent->actionGroup()->usesDropDown() ) { + i->action()->setToggleAction( TRUE ); + MetaDataBase::setPropertyChanged( i->action(), "toggleAction", TRUE ); + } + MetaDataBase::setPropertyChanged( i->action(), "text", TRUE ); + MetaDataBase::setPropertyChanged( i->action(), "name", TRUE ); + listActions->setCurrentItem( i ); + if ( !actionParent ) + formWindow->actionList().append( i->action() ); + if ( formWindow->formFile() ) + formWindow->formFile()->setModified( TRUE ); +} + +void ActionEditor::newActionGroup() +{ + ActionItem *actionParent = (ActionItem*)listActions->selectedItem(); + if ( actionParent ) { + if ( !::qt_cast(actionParent->actionGroup()) ) + actionParent = (ActionItem*)actionParent->parent(); + } + + ActionItem *i = 0; + if ( actionParent ) + i = new ActionItem( actionParent, TRUE ); + else + i = new ActionItem( listActions, TRUE ); + QAction *ag = i->actionGroup(); + QObject::connect( ag, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject* ) ) ); + MetaDataBase::addEntry( i->actionGroup() ); + MetaDataBase::setPropertyChanged( i->actionGroup(), "usesDropDown", TRUE ); + QString n = "ActionGroup"; + formWindow->unify( i->action(), n, TRUE ); + i->setText( 0, n ); + i->actionGroup()->setName( n ); + i->actionGroup()->setText( i->actionGroup()->name() ); + MetaDataBase::setPropertyChanged( i->actionGroup(), "text", TRUE ); + MetaDataBase::setPropertyChanged( i->actionGroup(), "name", TRUE ); + listActions->setCurrentItem( i ); + i->setOpen( TRUE ); + if ( !actionParent ) + formWindow->actionList().append( i->actionGroup() ); + if ( formWindow->formFile() ) + formWindow->formFile()->setModified( TRUE ); +} + +void ActionEditor::newDropDownActionGroup() +{ + newActionGroup(); + ( (ActionItem*)listActions->currentItem() )->actionGroup()->setUsesDropDown( TRUE ); +} + +void ActionEditor::setFormWindow( FormWindow *fw ) +{ + listActions->clear(); + formWindow = fw; + if ( !formWindow || + !::qt_cast(formWindow->mainContainer()) ) { + setEnabled( FALSE ); + } else { + setEnabled( TRUE ); + for ( QAction *a = formWindow->actionList().first(); a; a = formWindow->actionList().next() ) { + ActionItem *i = 0; + if ( ::qt_cast(a->parent()) ) + continue; + i = new ActionItem( listActions, a ); + i->setText( 0, a->name() ); + i->setPixmap( 0, a->iconSet().pixmap() ); + // make sure we don't duplicate the connection + QObject::disconnect( a, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject * ) ) ); + QObject::connect( a, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject* ) ) ); + if ( ::qt_cast(a) ) { + insertChildActions( i ); + } + } + if ( listActions->firstChild() ) { + listActions->setCurrentItem( listActions->firstChild() ); + listActions->setSelected( listActions->firstChild(), TRUE ); + } + } +} + +void ActionEditor::insertChildActions( ActionItem *i ) +{ + if ( !i->actionGroup() || !i->actionGroup()->children() ) + return; + QObjectListIt it( *i->actionGroup()->children() ); + while ( it.current() ) { + QObject *o = it.current(); + ++it; + if ( !::qt_cast(o) ) + continue; + QAction *a = (QAction*)o; + ActionItem *i2 = new ActionItem( (QListViewItem*)i, a ); + i->setOpen( TRUE ); + i2->setText( 0, a->name() ); + i2->setPixmap( 0, a->iconSet().pixmap() ); + // make sure we don't duplicate the connection + QObject::disconnect( o, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject * ) ) ); + QObject::connect( o, SIGNAL( destroyed( QObject * ) ), + this, SLOT( removeConnections( QObject * ) ) ); + if ( ::qt_cast(a) ) + insertChildActions( i2 ); + } +} + +void ActionEditor::updateActionName( QAction *a ) +{ + QListViewItemIterator it( listActions ); + while ( it.current() ) { + if ( ( (ActionItem*)it.current() )->action() == a ) + ( (ActionItem*)it.current() )->setText( 0, a->name() ); + else if ( ( (ActionItem*)it.current() )->actionGroup() == a ) + ( (ActionItem*)it.current() )->setText( 0, a->name() ); + ++it; + } +} + +void ActionEditor::updateActionIcon( QAction *a ) +{ + QListViewItemIterator it( listActions ); + while ( it.current() ) { + if ( ( (ActionItem*)it.current() )->action() == a ) + ( (ActionItem*)it.current() )->setPixmap( 0, a->iconSet().pixmap() ); + else if ( ( (ActionItem*)it.current() )->actionGroup() == a ) + ( (ActionItem*)it.current() )->setPixmap( 0, a->iconSet().pixmap() ); + ++it; + } +} + +void ActionEditor::connectionsClicked() +{ + ConnectionDialog dlg( formWindow->mainWindow() ); + dlg.setDefault( currentAction, formWindow ); + dlg.addConnection(); + dlg.exec(); +} + +void ActionEditor::removeConnections( QObject *o ) +{ + QValueList conns = + MetaDataBase::connections( formWindow, o ); + for ( QValueList::Iterator it2 = conns.begin(); + it2 != conns.end(); ++it2 ) + MetaDataBase::removeConnection( formWindow, (*it2).sender, (*it2).signal, + (*it2).receiver, (*it2).slot ); +} diff --git a/kdevdesigner/designer/actioneditorimpl.h b/kdevdesigner/designer/actioneditorimpl.h new file mode 100644 index 00000000..439a8fb8 --- /dev/null +++ b/kdevdesigner/designer/actioneditorimpl.h @@ -0,0 +1,79 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ACTIONEDITORIMPL_H +#define ACTIONEDITORIMPL_H + +#include "actioneditor.h" + +class QAction; +class FormWindow; +class ActionItem; + +class ActionEditor : public ActionEditorBase +{ + Q_OBJECT + +public: + ActionEditor( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + void setFormWindow( FormWindow *fw ); + void updateActionName( QAction *a ); + void updateActionIcon( QAction *a ); + FormWindow *form() const { return formWindow; } + + bool wantToBeShown() const { return !explicitlyClosed; } + void setWantToBeShown( bool b ) { explicitlyClosed = !b; } + + void setCurrentAction( QAction *a ); + QAction *newActionEx(); + +protected: + void closeEvent( QCloseEvent *e ); + +protected slots: + void currentActionChanged( QListViewItem * ); + void deleteAction(); + void newAction(); + void newActionGroup(); + void newDropDownActionGroup(); + void connectionsClicked(); + void removeConnections( QObject *o ); + +signals: + void hidden(); + void removing( QAction * ); + +private: + void insertChildActions( ActionItem *i ); + +private: + QAction *currentAction; + FormWindow *formWindow; + bool explicitlyClosed; + +}; + +#endif // ACTIONEDITORIMPL_H diff --git a/kdevdesigner/designer/actionlistview.cpp b/kdevdesigner/designer/actionlistview.cpp new file mode 100644 index 00000000..53c7e292 --- /dev/null +++ b/kdevdesigner/designer/actionlistview.cpp @@ -0,0 +1,110 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "actiondnd.h" +#include "actionlistview.h" +#include + +#include + +ActionListView::ActionListView( QWidget *parent, const char *name ) + : QListView( parent, name ) +{ + setShowSortIndicator( TRUE ); + setResizeMode( LastColumn ); + setRootIsDecorated( TRUE ); + connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint &, int ) ), + this, SLOT( rmbMenu( QListViewItem *, const QPoint & ) ) ); +} + +ActionItem::ActionItem( QListView *lv, QAction *ac ) + : QListViewItem( lv ), a( 0 ), g( 0 ) +{ + g = ::qt_cast(ac); + if ( !g ) + a = ::qt_cast(ac); + setDragEnabled( TRUE ); +} + +ActionItem::ActionItem( QListViewItem *i, QAction *ac ) + : QListViewItem( i ), a( 0 ), g( 0 ) +{ + g = ::qt_cast(ac); + if ( !g ) + a = ::qt_cast(ac); + setDragEnabled( TRUE ); + moveToEnd(); +} + +void ActionItem::moveToEnd() +{ + QListViewItem *i = this; + while ( i->nextSibling() ) + i = i->nextSibling(); + if ( i != this ) + moveItem( i ); +} + +QDragObject *ActionListView::dragObject() +{ + ActionItem *i = (ActionItem*)currentItem(); + if ( !i ) + return 0; + QStoredDrag *drag = 0; + if ( i->action() ) { + drag = new ActionDrag( i->action(), viewport() ); + drag->setPixmap( i->action()->iconSet().pixmap() ); + } else { + drag = new ActionDrag( i->actionGroup(), viewport() ); + drag->setPixmap( i->actionGroup()->iconSet().pixmap() ); + } + return drag; +} + +void ActionListView::rmbMenu( QListViewItem *i, const QPoint &p ) +{ + QPopupMenu *popup = new QPopupMenu( this ); + popup->insertItem( i18n( "New &Action" ), 0 ); + popup->insertItem( i18n( "New Action &Group" ), 1 ); + popup->insertItem( i18n( "New &Dropdown Action Group" ), 2 ); + if ( i ) { + popup->insertSeparator(); + popup->insertItem( i18n( "&Connect Action..." ), 3 ); + popup->insertSeparator(); + popup->insertItem( i18n( "Delete Action" ), 4 ); + } + int res = popup->exec( p ); + if ( res == 0 ) + emit insertAction(); + else if ( res == 1 ) + emit insertActionGroup(); + else if ( res == 2 ) + emit insertDropDownActionGroup(); + else if ( res == 3 ) + emit connectAction(); + else if ( res == 4 ) + emit deleteAction(); +} diff --git a/kdevdesigner/designer/actionlistview.h b/kdevdesigner/designer/actionlistview.h new file mode 100644 index 00000000..59c48b20 --- /dev/null +++ b/kdevdesigner/designer/actionlistview.h @@ -0,0 +1,81 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ACTIONLISTVIEW_H +#define ACTIONLISTVIEW_H + +#include +#include "actiondnd.h" + +class ActionItem : public QListViewItem +{ +public: + ActionItem( QListView *lv, bool group ) + : QListViewItem( lv ), + a( group ? 0 : new QDesignerAction( 0 ) ), + g( group ? new QDesignerActionGroup( 0 ) : 0 ) { setDragEnabled( TRUE ); } + ActionItem( QListView *lv, QAction *ac ); + ActionItem( QListViewItem *i, QAction *ac ); + ActionItem( ActionItem *parent, bool group = FALSE ) + : QListViewItem( parent ), + a( group ? 0 : new QDesignerAction( parent->actionGroup() ) ), + g( group ? new QDesignerActionGroup( parent->actionGroup() ) : 0 ) { setDragEnabled( TRUE ); moveToEnd(); } + + QDesignerAction *action() const { return a; } + QDesignerActionGroup *actionGroup() const { return g; } + +private: + void moveToEnd(); + +private: + QDesignerAction *a; + QDesignerActionGroup *g; + +}; + +class ActionListView : public QListView +{ + Q_OBJECT + +public: + ActionListView( QWidget *parent = 0, const char *name = 0 ); + +protected: + QDragObject *dragObject(); + +private slots: + void rmbMenu( QListViewItem *i, const QPoint &p ); + +signals: + void insertAction(); + void insertActionGroup(); + void insertDropDownActionGroup(); + void deleteAction(); + void connectAction(); + +}; + +#endif diff --git a/kdevdesigner/designer/asciivalidator.cpp b/kdevdesigner/designer/asciivalidator.cpp new file mode 100644 index 00000000..7642d47f --- /dev/null +++ b/kdevdesigner/designer/asciivalidator.cpp @@ -0,0 +1,94 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "asciivalidator.h" + +#include + +AsciiValidator::AsciiValidator( QObject * parent, const char *name ) + : QValidator( parent, name ), functionName( FALSE ) +{ +} + +AsciiValidator::AsciiValidator( bool funcName, QObject * parent, const char *name ) + : QValidator( parent, name ), functionName( funcName ) +{ +} + +AsciiValidator::AsciiValidator( const QString &allow, QObject * parent, const char *name ) + : QValidator( parent, name ), functionName( FALSE ), allowedChars( allow ) +{ +} + +AsciiValidator::~AsciiValidator() +{ +} + +QValidator::State AsciiValidator::validate( QString &s, int & ) const +{ + bool inParen = FALSE; + bool outParen = FALSE; + if ( !s.isEmpty() && s[0].row() == 0 && s[0].cell() >= '0' && s[0].cell() <= '9' ) + s[0] = '_'; + for ( int i = 0, j = 0; i < (int) s.length(); i++ ) { + uchar r = s[i].row(); + uchar c = s[i].cell(); + + if ( outParen ) { // check if we have 'const' or 'volatile' + static const QString con = " const"; + static const QString vol = " volatile"; + QString mid = s.mid( j ); + if ( !( con.startsWith( mid ) || vol.startsWith( mid ) ) ) + return QValidator::Invalid; + } + + if ( inParen && c != ')' ) + continue; + + if ( r == 0 && ( ( c >= '0' && c <= '9' ) || + ( c >= 'a' && c <= 'z' ) || + ( c >= 'A' && c <= 'Z' ) ) ) + continue; + + if ( functionName ) { + if ( c == '(' ) { + inParen = TRUE; + continue; + } + if ( c == ')' ) { + outParen = TRUE; + j = i + 1; + continue; + } + } + + if ( allowedChars.find( s[ i ] ) != -1 ) + continue; + + s[i] = '_'; + } + return QValidator::Acceptable; +} diff --git a/kdevdesigner/designer/asciivalidator.h b/kdevdesigner/designer/asciivalidator.h new file mode 100644 index 00000000..2cdfe0cb --- /dev/null +++ b/kdevdesigner/designer/asciivalidator.h @@ -0,0 +1,52 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ASCIIVALIDATOR_H +#define ASCIIVALIDATOR_H + + +#include + + +class AsciiValidator: public QValidator +{ + Q_OBJECT +public: + AsciiValidator( QObject * parent, const char *name = 0 ); + AsciiValidator( bool funcName, QObject * parent, const char *name = 0 ); + AsciiValidator( const QString &allow, QObject * parent, const char *name = 0 ); + ~AsciiValidator(); + + QValidator::State validate( QString &, int & ) const; + +private: + bool functionName; + QString allowedChars; + +}; + + +#endif diff --git a/kdevdesigner/designer/command.cpp b/kdevdesigner/designer/command.cpp new file mode 100644 index 00000000..83ec9a77 --- /dev/null +++ b/kdevdesigner/designer/command.cpp @@ -0,0 +1,2473 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "command.h" +#include "formwindow.h" +#include "widgetfactory.h" +#include "propertyeditor.h" +#include "metadatabase.h" +#include +#include "mainwindow.h" +#include "hierarchyview.h" +#include "workspace.h" +#include "actioneditorimpl.h" +#include "actiondnd.h" +#include "formfile.h" +#include "../interfaces/languageinterface.h" +#include "menubareditor.h" +#include "popupmenueditor.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_TABLE +#include +#endif +#include + +#include "kdevdesigner_part.h" + +#include + +CommandHistory::CommandHistory( int s ) + : current( -1 ), steps( s ), savedAt( -1 ) +{ + history.setAutoDelete( TRUE ); + modified = FALSE; + compressedCommand = 0; +} + +void CommandHistory::addCommand( Command *cmd, bool tryCompress ) +{ + if ( tryCompress ) { + if ( !compressedCommand || + compressedCommand->type() != cmd->type() || + !compressedCommand->canMerge( cmd ) ) { + checkCompressedCommand(); + compressedCommand = 0; + } + + if ( compressedCommand ) { + compressedCommand->merge( cmd ); + modified = TRUE; + modificationChanged( modified ); + return; + } + compressedCommand = cmd; + } else { + checkCompressedCommand(); + } + + if ( current < (int)history.count() - 1 ) { + if ( current < savedAt ) + savedAt = -2; + + QPtrList commands; + commands.setAutoDelete( FALSE ); + + for( int i = 0; i <= current; ++i ) { + commands.insert( i, history.at( 0 ) ); + history.take( 0 ); + } + + commands.append( cmd ); + history.clear(); + history = commands; + history.setAutoDelete( TRUE ); + } else { + history.append( cmd ); + } + + if ( (int)history.count() > steps ) { + savedAt--; + history.removeFirst(); + } else { + ++current; + } + + emitUndoRedo(); + modified = TRUE; + modificationChanged( modified ); +} + +void CommandHistory::undo() +{ + checkCompressedCommand(); + compressedCommand = 0; + if ( current > -1 ) { + history.at( current )->unexecute(); + --current; + } + emitUndoRedo(); + modified = savedAt != current; + modificationChanged( modified ); +} + +void CommandHistory::redo() +{ + checkCompressedCommand(); + compressedCommand = 0; + if ( current > -1 ) { + if ( current < (int)history.count() - 1 ) { + ++current; + history.at( current )->execute(); + } + } else { + if ( history.count() > 0 ) { + ++current; + history.at( current )->execute(); + } + } + emitUndoRedo(); + modified = savedAt != current; + modificationChanged( modified ); +} + +void CommandHistory::emitUndoRedo() +{ + Command *undoCmd = 0; + Command *redoCmd = 0; + + if ( current >= 0 && current < (int)history.count() ) + undoCmd = history.at( current ); + if ( current + 1 >= 0 && current + 1 < (int)history.count() ) + redoCmd = history.at( current + 1 ); + + bool ua = (undoCmd != 0); + QString uc; + if ( ua ) + uc = undoCmd->name(); + bool ra = (redoCmd != 0); + QString rc; + if ( ra ) + rc = redoCmd->name(); + emit undoRedoChanged( ua, ra, uc, rc ); +} + +void CommandHistory::setModified( bool m ) +{ + modified = m; + if ( !modified ) + savedAt = current; + modificationChanged( modified ); +} + +bool CommandHistory::isModified() const +{ + return modified; +} + +void CommandHistory::checkCompressedCommand() +{ + if ( compressedCommand && compressedCommand->type() == Command::SetProperty ) { + Command *c = compressedCommand; + compressedCommand = 0; + if ( !( (SetPropertyCommand*)c )->checkProperty() ) { + history.remove( current ); + --current; + emitUndoRedo(); + } + } +} + +// ------------------------------------------------------------ + +Command::Command( const QString &n, FormWindow *fw ) + : cmdName( n ), formWin( fw ) +{ +} + +Command::~Command() +{ +} + +QString Command::name() const +{ + return cmdName; +} + +FormWindow *Command::formWindow() const +{ + return formWin; +} + +void Command::merge( Command * ) +{ +} + +bool Command::canMerge( Command * ) +{ + return FALSE; +} + +// ------------------------------------------------------------ + +ResizeCommand::ResizeCommand( const QString &n, FormWindow *fw, + QWidget *w, const QRect &oldr, const QRect &nr ) + : Command( n, fw ), widget( w ), oldRect( oldr ), newRect( nr ) +{ +} + +void ResizeCommand::execute() +{ + widget->setGeometry( newRect ); + formWindow()->updateSelection( widget ); + formWindow()->emitUpdateProperties( widget ); + if ( WidgetFactory::layoutType( widget ) != WidgetFactory::NoLayout ) + formWindow()->updateChildSelections( widget ); +} + +void ResizeCommand::unexecute() +{ + widget->setGeometry( oldRect ); + formWindow()->updateSelection( widget ); + formWindow()->emitUpdateProperties( widget ); + if ( WidgetFactory::layoutType( widget ) != WidgetFactory::NoLayout ) + formWindow()->updateChildSelections( widget ); +} + +// ------------------------------------------------------------ + +InsertCommand::InsertCommand( const QString &n, FormWindow *fw, + QWidget *w, const QRect &g ) + : Command( n, fw ), widget( w ), geometry( g ) +{ +} + +void InsertCommand::execute() +{ + if ( geometry.size() == QSize( 0, 0 ) ) { + widget->move( geometry.topLeft() ); + widget->adjustSize(); + } else { + QSize s = geometry.size().expandedTo( widget->minimumSize() ); + s = s.expandedTo( widget->minimumSizeHint() ); + QRect r( geometry.topLeft(), s ); + widget->setGeometry( r ); + } + widget->show(); + formWindow()->widgets()->insert( widget, widget ); + formWindow()->clearSelection( FALSE ); + formWindow()->selectWidget( widget ); + formWindow()->mainWindow()->objectHierarchy()->widgetInserted( widget ); +} + +void InsertCommand::unexecute() +{ + widget->hide(); + formWindow()->selectWidget( widget, FALSE ); + formWindow()->widgets()->remove( widget ); + formWindow()->mainWindow()->objectHierarchy()->widgetRemoved( widget ); + } + +// ------------------------------------------------------------ + +MoveCommand::MoveCommand( const QString &n, FormWindow *fw, + const QWidgetList &w, + const QValueList op, + const QValueList np, + QWidget *opr, QWidget *npr ) + : Command( n, fw ), widgets( w ), oldPos( op ), newPos( np ), + oldParent( opr ), newParent( npr ) +{ + widgets.setAutoDelete( FALSE ); +} + +void MoveCommand::merge( Command *c ) +{ + MoveCommand *cmd = (MoveCommand*)c; + newPos = cmd->newPos; +} + +bool MoveCommand::canMerge( Command *c ) +{ + MoveCommand *cmd = (MoveCommand*)c; + return widgets == cmd->widgets; +} + + +void MoveCommand::execute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + if ( !w->parentWidget() || WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ) { + if ( newParent && oldParent && newParent != oldParent ) { + QPoint pos = newParent->mapFromGlobal( w->mapToGlobal( QPoint( 0,0 ) ) ); + w->reparent( newParent, pos, TRUE ); + formWindow()->raiseSelection( w ); + formWindow()->raiseChildSelections( w ); + formWindow()->widgetChanged( w ); + formWindow()->mainWindow()->objectHierarchy()->widgetRemoved( w ); + formWindow()->mainWindow()->objectHierarchy()->widgetInserted( w ); + } + w->move( newPos[ widgets.at() ] ); + } + formWindow()->updateSelection( w ); + formWindow()->updateChildSelections( w ); + formWindow()->emitUpdateProperties( w ); + } +} + +void MoveCommand::unexecute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + if ( !w->parentWidget() || WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ) { + if ( newParent && oldParent && newParent != oldParent ) { + QPoint pos = oldParent->mapFromGlobal( w->mapToGlobal( QPoint( 0,0 ) ) ); + w->reparent( oldParent, pos, TRUE ); + formWindow()->raiseSelection( w ); + formWindow()->raiseChildSelections( w ); + formWindow()->widgetChanged( w ); + formWindow()->mainWindow()->objectHierarchy()->widgetRemoved( w ); + formWindow()->mainWindow()->objectHierarchy()->widgetInserted( w ); + } + w->move( oldPos[ widgets.at() ] ); + } + formWindow()->updateSelection( w ); + formWindow()->updateChildSelections( w ); + formWindow()->emitUpdateProperties( w ); + } +} + +// ------------------------------------------------------------ + +DeleteCommand::DeleteCommand( const QString &n, FormWindow *fw, + const QWidgetList &wl ) + : Command( n, fw ), widgets( wl ) +{ + widgets.setAutoDelete( FALSE ); + QWidgetList copyOfWidgets = widgets; + copyOfWidgets.setAutoDelete(FALSE); + + // Include the children of the selected items when deleting + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + QObjectList *children = w->queryList( "QWidget" ); + for ( QWidget *c = (QWidget *)children->first(); c; c = (QWidget *)children->next() ) { + if ( copyOfWidgets.find( c ) == -1 && formWindow()->widgets()->find( c ) ) { + widgets.insert(widgets.at() + 1, c); + widgets.prev(); + copyOfWidgets.append(c); + } + } + delete children; + } +} + +void DeleteCommand::execute() +{ + formWindow()->setPropertyShowingBlocked( TRUE ); + connections.clear(); + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->hide(); + QString s = w->name(); + s.prepend( "qt_dead_widget_" ); + w->setName( s ); + formWindow()->selectWidget( w, FALSE ); + formWindow()->widgets()->remove( w ); + QValueList conns = MetaDataBase::connections( formWindow(), w ); + connections.insert( w, conns ); + QValueList::Iterator it = conns.begin(); + for ( ; it != conns.end(); ++it ) { + MetaDataBase::removeConnection( formWindow(), (*it).sender, + (*it).signal, (*it).receiver, (*it).slot ); + } + } + formWindow()->setPropertyShowingBlocked( FALSE ); + formWindow()->emitShowProperties(); + formWindow()->mainWindow()->objectHierarchy()->widgetsRemoved( widgets ); + +} + +void DeleteCommand::unexecute() +{ + formWindow()->setPropertyShowingBlocked( TRUE ); + formWindow()->clearSelection( FALSE ); + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->show(); + QString s = w->name(); + s.remove( 0, QString( "qt_dead_widget_" ).length() ); + w->setName( s ); + formWindow()->widgets()->insert( w, w ); + formWindow()->selectWidget( w ); + QValueList conns = *connections.find( w ); + QValueList::Iterator it = conns.begin(); + for ( ; it != conns.end(); ++it ) { + MetaDataBase::addConnection( formWindow(), (*it).sender, + (*it).signal, (*it).receiver, (*it).slot ); + } + } + formWindow()->setPropertyShowingBlocked( FALSE ); + formWindow()->emitShowProperties(); + formWindow()->mainWindow()->objectHierarchy()->widgetsInserted( widgets ); +} + +// ------------------------------------------------------------ + +SetPropertyCommand::SetPropertyCommand( const QString &n, FormWindow *fw, + QObject *w, PropertyEditor *e, + const QString &pn, const QVariant &ov, + const QVariant &nv, const QString &ncut, + const QString &ocut, bool reset ) + : Command( n, fw ), widget( w ), editor( e ), propName( pn ), + oldValue( ov ), newValue( nv ), oldCurrentItemText( ocut ), newCurrentItemText( ncut ), + wasChanged( TRUE ), isResetCommand( reset ) +{ + wasChanged = MetaDataBase::isPropertyChanged( w, propName ); + if ( oldCurrentItemText.isNull() ) + oldCurrentItemText = ""; + if ( newCurrentItemText.isNull() ) + newCurrentItemText = ""; +} + + +void SetPropertyCommand::execute() +{ + if ( !wasChanged ) + MetaDataBase::setPropertyChanged( widget, propName, TRUE ); + if ( isResetCommand ) { + MetaDataBase::setPropertyChanged( widget, propName, FALSE ); + if ( WidgetFactory::resetProperty( widget, propName ) ) { + if ( !formWindow()->isWidgetSelected( widget ) && formWindow() != (QObject *)widget ) + formWindow()->selectWidget( (QObject *)widget ); + if ( editor->widget() != widget ) + editor->setWidget( widget, formWindow() ); + editor->propertyList()->setCurrentProperty( propName ); + PropertyItem *i = (PropertyItem*)editor->propertyList()->currentItem(); + if ( !i ) + return; + i->setValue( widget->property( propName ) ); + i->setChanged( FALSE ); + editor->refetchData(); + editor->emitWidgetChanged(); + return; + } + } + setProperty( newValue, newCurrentItemText ); +} + +void SetPropertyCommand::unexecute() +{ + if ( !wasChanged ) + MetaDataBase::setPropertyChanged( widget, propName, FALSE ); + if ( isResetCommand ) + MetaDataBase::setPropertyChanged( widget, propName, TRUE ); + setProperty( oldValue, oldCurrentItemText ); +} + +bool SetPropertyCommand::canMerge( Command *c ) +{ + SetPropertyCommand *cmd = (SetPropertyCommand*)c; + if ( !widget ) + return FALSE; + const QMetaProperty *p = + widget->metaObject()->property( widget->metaObject()->findProperty( propName, TRUE ), TRUE ); + if ( !p ) { + if ( propName == "toolTip" || propName == "whatsThis" ) + return TRUE; + if ( ::qt_cast((QObject *)widget) ) { + MetaDataBase::CustomWidget *cw = ((CustomWidget*)(QObject*)widget)->customWidget(); + if ( !cw ) + return FALSE; + for ( QValueList::Iterator it = cw->lstProperties.begin(); it != cw->lstProperties.end(); ++it ) { + if ( QString( (*it ).property ) == propName ) { + if ( (*it).type == "String" || (*it).type == "CString" || (*it).type == "Int" || (*it).type == "UInt" ) + return TRUE; + } + } + } + return FALSE; + } + QVariant::Type t = QVariant::nameToType( p->type() ); + return ( cmd->propName == propName && + t == QVariant::String || t == QVariant::CString || t == QVariant::Int || t == QVariant::UInt ); +} + +void SetPropertyCommand::merge( Command *c ) +{ + SetPropertyCommand *cmd = (SetPropertyCommand*)c; + newValue = cmd->newValue; + newCurrentItemText = cmd->newCurrentItemText; +} + +bool SetPropertyCommand::checkProperty() +{ + if ( propName == "name" /*|| propName == "itemName"*/ ) { // ### fix that + QString s = newValue.toString(); + if ( !formWindow()->unify( widget, s, FALSE ) ) { + QMessageBox::information( formWindow()->mainWindow(), + i18n( "Set 'name' Property" ), + i18n( "The name of a widget must be unique.\n" + "'%1' is already used in form '%2',\n" + "so the name has been reverted to '%3'." ). + arg( newValue.toString() ). + arg( formWindow()->name() ). + arg( oldValue.toString() )); + setProperty( oldValue, oldCurrentItemText, FALSE ); + return FALSE; + } + if ( s.isEmpty() ) { + QMessageBox::information( formWindow()->mainWindow(), + i18n( "Set 'name' Property" ), + i18n( "The name of a widget must not be null.\n" + "The name has been reverted to '%1'." ). + arg( oldValue.toString() )); + setProperty( oldValue, oldCurrentItemText, FALSE ); + return FALSE; + } + + if ( ::qt_cast(widget->parent()) ) + formWindow()->mainWindow()->formNameChanged( (FormWindow*)((QWidget*)(QObject*)widget)->parentWidget() ); + } + return TRUE; +} + +void SetPropertyCommand::setProperty( const QVariant &v, const QString ¤tItemText, bool select ) +{ + if ( !widget ) + return; + + if ( !formWindow()->isWidgetSelected( widget ) && !formWindow()->isMainContainer( widget ) && select ) + formWindow()->selectWidget( widget ); + if ( editor->widget() != widget && select ) + editor->setWidget( widget, formWindow() ); + if ( select ) + editor->propertyList()->setCurrentProperty( propName ); + const QMetaProperty *p = + widget->metaObject()->property( widget->metaObject()->findProperty( propName, TRUE ), TRUE ); + if ( !p ) { + if ( propName == "hAlign" ) { + p = widget->metaObject()->property( widget->metaObject()->findProperty( "alignment", TRUE ), TRUE ); + int align = widget->property( "alignment" ).toInt(); + align &= ~( AlignHorizontal_Mask ); + align |= p->keyToValue( currentItemText ); + widget->setProperty( "alignment", QVariant( align ) ); + } else if ( propName == "vAlign" ) { + p = widget->metaObject()->property( widget->metaObject()->findProperty( "alignment", TRUE ), TRUE ); + int align = widget->property( "alignment" ).toInt(); + align &= ~( AlignVertical_Mask ); + align |= p->keyToValue( currentItemText ); + widget->setProperty( "alignment", QVariant( align ) ); + } else if ( propName == "wordwrap" ) { + int align = widget->property( "alignment" ).toInt(); + align &= ~WordBreak; + if ( v.toBool() ) + align |= WordBreak; + widget->setProperty( "alignment", QVariant( align ) ); + } else if ( propName == "layoutSpacing" ) { + QVariant val = v; + if ( val.toString() == "default" ) + val = -1; + MetaDataBase::setSpacing( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ), val.toInt() ); + } else if ( propName == "layoutMargin" ) { + QVariant val = v; + if ( val.toString() == "default" ) + val = -1; + MetaDataBase::setMargin( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ), val.toInt() ); + } else if ( propName == "resizeMode" ) { + MetaDataBase::setResizeMode( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ), currentItemText ); + } else if ( propName == "toolTip" || propName == "whatsThis" || propName == "database" || propName == "frameworkCode" ) { + MetaDataBase::setFakeProperty( editor->widget(), propName, v ); + } else if ( ::qt_cast(editor->widget()) ) { + MetaDataBase::CustomWidget *cw = ((CustomWidget *)(QObject *)widget)->customWidget(); + if ( cw ) { + MetaDataBase::setFakeProperty( editor->widget(), propName, v ); + } + } + editor->refetchData(); + editor->emitWidgetChanged(); + ( ( PropertyItem* )editor->propertyList()->currentItem() )->setChanged( MetaDataBase::isPropertyChanged( widget, propName ) ); +#ifndef QT_NO_SQL + if ( propName == "database" ) { + formWindow()->mainWindow()->objectHierarchy()->databasePropertyChanged( (QWidget*)((QObject *)widget), MetaDataBase::fakeProperty( widget, "database" ).toStringList() ); + } +#endif + return; + } + + if ( p->isSetType() ) { + QStrList strlst; + QStringList lst = QStringList::split( "|", currentItemText ); + QValueListConstIterator it = lst.begin(); + for ( ; it != lst.end(); ++it ) + strlst.append( (*it).latin1() ); + widget->setProperty( propName, p->keysToValue( strlst ) ); + } else if ( p->isEnumType() ) { + widget->setProperty( propName, p->keyToValue( currentItemText ) ); + } else if ( qstrcmp( p->name(), "buddy" ) == 0 ) { + widget->setProperty( propName, currentItemText ); + } else { + QVariant ov; + if ( propName == "name" || propName == "itemName" ) + ov = widget->property( propName ); + int oldSerNum = -1; + if ( v.type() == QVariant::Pixmap ) + oldSerNum = v.toPixmap().serialNumber(); + widget->setProperty( propName, v ); + if ( oldSerNum != -1 && oldSerNum != widget->property( propName ).toPixmap().serialNumber() ) + MetaDataBase::setPixmapKey( formWindow(), + widget->property( propName ).toPixmap().serialNumber(), + MetaDataBase::pixmapKey( formWindow(), oldSerNum ) ); + if ( propName == "cursor" ) { + MetaDataBase::setCursor( (QWidget*)((QObject *)widget), v.toCursor() ); + } + if ( propName == "name" && widget->isWidgetType() ) { + formWindow()->mainWindow()->objectHierarchy()->namePropertyChanged( ((QWidget*)(QObject *)widget), ov ); + if ( formWindow()->isMainContainer( widget ) ) + formWindow()->setName( v.toCString() ); + } + if ( propName == "name" && ::qt_cast((QObject *)widget) && ::qt_cast(formWindow()->mainContainer()) ) { + formWindow()->mainWindow()->actioneditor()->updateActionName( (QAction*)(QObject *)widget ); + } + if ( propName == "iconSet" && ::qt_cast((QObject *)widget) && ::qt_cast(formWindow()->mainContainer()) ) { + formWindow()->mainWindow()->actioneditor()->updateActionIcon( (QAction*)(QObject *)widget ); + } + if ( propName == "caption" ) { + if ( formWindow()->isMainContainer( widget ) ) + formWindow()->setCaption( v.toString() ); + } + if ( propName == "icon" ) { + if ( formWindow()->isMainContainer( widget ) ) + formWindow()->setIcon( v.toPixmap() ); + } + } + editor->refetchData(); + if ( editor->propertyList()->currentItem() && select ) { + ( ( PropertyItem* )editor->propertyList()->currentItem() )->showEditor(); + ( ( PropertyItem* )editor->propertyList()->currentItem() )->setChanged( MetaDataBase::isPropertyChanged( widget, propName ) ); + } + editor->emitWidgetChanged(); + formWindow()->killAccels( widget ); +} + +// ------------------------------------------------------------ + +LayoutHorizontalCommand::LayoutHorizontalCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ) + : Command( n, fw ), layout( wl, parent, fw, layoutBase ) +{ +} + +void LayoutHorizontalCommand::execute() +{ + formWindow()->clearSelection( FALSE ); + layout.doLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void LayoutHorizontalCommand::unexecute() +{ + formWindow()->clearSelection( FALSE ); + layout.undoLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +LayoutHorizontalSplitCommand::LayoutHorizontalSplitCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ) + : Command( n, fw ), layout( wl, parent, fw, layoutBase, TRUE, TRUE ) +{ +} + +void LayoutHorizontalSplitCommand::execute() +{ + formWindow()->clearSelection( FALSE ); + layout.doLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void LayoutHorizontalSplitCommand::unexecute() +{ + formWindow()->clearSelection( FALSE ); + layout.undoLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +LayoutVerticalCommand::LayoutVerticalCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ) + : Command( n, fw ), layout( wl, parent, fw, layoutBase ) +{ +} + +void LayoutVerticalCommand::execute() +{ + formWindow()->clearSelection( FALSE ); + layout.doLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void LayoutVerticalCommand::unexecute() +{ + formWindow()->clearSelection( FALSE ); + layout.undoLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +LayoutVerticalSplitCommand::LayoutVerticalSplitCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ) + : Command( n, fw ), layout( wl, parent, fw, layoutBase, TRUE, TRUE ) +{ +} + +void LayoutVerticalSplitCommand::execute() +{ + formWindow()->clearSelection( FALSE ); + layout.doLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void LayoutVerticalSplitCommand::unexecute() +{ + formWindow()->clearSelection( FALSE ); + layout.undoLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +LayoutGridCommand::LayoutGridCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl, int xres, int yres ) + : Command( n, fw ), layout( wl, parent, fw, layoutBase, QSize( QMAX(5,xres), QMAX(5,yres) ) ) +{ +} + +void LayoutGridCommand::execute() +{ + formWindow()->clearSelection( FALSE ); + layout.doLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void LayoutGridCommand::unexecute() +{ + formWindow()->clearSelection( FALSE ); + layout.undoLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +BreakLayoutCommand::BreakLayoutCommand( const QString &n, FormWindow *fw, + QWidget *layoutBase, const QWidgetList &wl ) + : Command( n, fw ), lb( layoutBase ), widgets( wl ) +{ + WidgetFactory::LayoutType lay = WidgetFactory::layoutType( layoutBase ); + spacing = MetaDataBase::spacing( layoutBase ); + margin = MetaDataBase::margin( layoutBase ); + layout = 0; + if ( lay == WidgetFactory::HBox ) + layout = new HorizontalLayout( wl, layoutBase, fw, layoutBase, FALSE, ::qt_cast(layoutBase) != 0 ); + else if ( lay == WidgetFactory::VBox ) + layout = new VerticalLayout( wl, layoutBase, fw, layoutBase, FALSE, ::qt_cast(layoutBase) != 0 ); + else if ( lay == WidgetFactory::Grid ) + layout = new GridLayout( wl, layoutBase, fw, layoutBase, QSize( QMAX( 5, fw->grid().x()), QMAX( 5, fw->grid().y()) ), FALSE ); +} + +void BreakLayoutCommand::execute() +{ + if ( !layout ) + return; + formWindow()->clearSelection( FALSE ); + layout->breakLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) + w->resize( QMAX( 16, w->width() ), QMAX( 16, w->height() ) ); +} + +void BreakLayoutCommand::unexecute() +{ + if ( !layout ) + return; + formWindow()->clearSelection( FALSE ); + layout->doLayout(); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); + MetaDataBase::setSpacing( WidgetFactory::containerOfWidget( lb ), spacing ); + MetaDataBase::setMargin( WidgetFactory::containerOfWidget( lb ), margin ); +} + +// ------------------------------------------------------------ + +MacroCommand::MacroCommand( const QString &n, FormWindow *fw, + const QPtrList &cmds ) + : Command( n, fw ), commands( cmds ) +{ +} + +void MacroCommand::execute() +{ + for ( Command *c = commands.first(); c; c = commands.next() ) + c->execute(); +} + +void MacroCommand::unexecute() +{ + for ( Command *c = commands.last(); c; c = commands.prev() ) + c->unexecute(); +} + +// ------------------------------------------------------------ + +AddTabPageCommand::AddTabPageCommand( const QString &n, FormWindow *fw, + QTabWidget *tw, const QString &label ) + : Command( n, fw ), tabWidget( tw ), tabLabel( label ) +{ + tabPage = new QDesignerWidget( formWindow(), tabWidget, "TabPage" ); + tabPage->hide(); + index = -1; + MetaDataBase::addEntry( tabPage ); +} + +void AddTabPageCommand::execute() +{ + if ( index == -1 ) + index = ( (QDesignerTabWidget*)tabWidget )->count(); + tabWidget->insertTab( tabPage, tabLabel, index ); + tabWidget->showPage( tabPage ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( tabWidget ); +} + +void AddTabPageCommand::unexecute() +{ + tabWidget->removePage( tabPage ); + tabPage->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( tabWidget ); +} + +// ------------------------------------------------------------ + +MoveTabPageCommand::MoveTabPageCommand( const QString &n, FormWindow *fw, + QTabWidget *tw, QWidget* page, const QString& label, int nIndex, int oIndex ) + : Command( n, fw ), tabWidget( tw ), tabPage( page ), tabLabel( label ) +{ + newIndex = nIndex; + oldIndex = oIndex; +} + +void MoveTabPageCommand::execute() +{ + ((QDesignerTabWidget*)tabWidget )->removePage( tabPage ); + ((QDesignerTabWidget*)tabWidget )->insertTab( tabPage, tabLabel, newIndex ); + ((QDesignerTabWidget*)tabWidget )->showPage( tabPage ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( tabWidget ); +} + +void MoveTabPageCommand::unexecute() +{ + ((QDesignerTabWidget*)tabWidget )->removePage( tabPage ); + ((QDesignerTabWidget*)tabWidget )->insertTab( tabPage, tabLabel, oldIndex ); + ((QDesignerTabWidget*)tabWidget )->showPage( tabPage ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( tabWidget ); +} + +// ------------------------------------------------------------ + +DeleteTabPageCommand::DeleteTabPageCommand( const QString &n, FormWindow *fw, + QTabWidget *tw, QWidget *page ) + : Command( n, fw ), tabWidget( tw ), tabPage( page ) +{ + tabLabel = ( (QDesignerTabWidget*)tabWidget )->pageTitle(); + index = ( (QDesignerTabWidget*)tabWidget )->currentPage(); +} + +void DeleteTabPageCommand::execute() +{ + tabWidget->removePage( tabPage ); + tabPage->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( tabWidget ); +} + +void DeleteTabPageCommand::unexecute() +{ + tabWidget->insertTab( tabPage, tabLabel, index ); + tabWidget->showPage( tabPage ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( tabWidget ); +} + +// ------------------------------------------------------------ + +AddWidgetStackPageCommand::AddWidgetStackPageCommand( const QString &n, FormWindow *fw, + QDesignerWidgetStack *ws ) + : Command( n, fw ), widgetStack( ws ) +{ + stackPage = new QDesignerWidget( formWindow(), widgetStack, "WStackPage" ); + stackPage->hide(); + index = -1; + MetaDataBase::addEntry( stackPage ); +} + +void AddWidgetStackPageCommand::execute() +{ + index = widgetStack->insertPage( stackPage, index ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( 0 ); +} + +void AddWidgetStackPageCommand::unexecute() +{ + index = widgetStack->removePage( stackPage ); + stackPage->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->tabsChanged( 0 ); +} + +DeleteWidgetStackPageCommand::DeleteWidgetStackPageCommand( const QString &n, FormWindow *fw, + QDesignerWidgetStack *ws, QWidget *page ) + : Command( n, fw), widgetStack( ws ), stackPage( page ) +{ + index = -1; +} + +void DeleteWidgetStackPageCommand::execute() +{ + index = widgetStack->removePage( stackPage ); + stackPage->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->widgetRemoved( stackPage ); +} + +void DeleteWidgetStackPageCommand::unexecute() +{ + index = widgetStack->insertPage( stackPage, index ); + widgetStack->raiseWidget( stackPage ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->widgetInserted( stackPage ); +} + +// ------------------------------------------------------------ + +AddWizardPageCommand::AddWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, const QString &label, int i, bool s ) + : Command( n, fw ), wizard( w ), pageLabel( label ) +{ + page = new QDesignerWidget( formWindow(), wizard, "WizardPage" ); + page->hide(); + index = i; + show = s; + MetaDataBase::addEntry( page ); +} + +void AddWizardPageCommand::execute() +{ + if ( index == -1 ) + index = wizard->pageCount(); + wizard->insertPage( page, pageLabel, index ); + if ( show ) + ( (QDesignerWizard*)wizard )->setCurrentPage( ( (QDesignerWizard*)wizard )->pageNum( page ) ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +void AddWizardPageCommand::unexecute() +{ + wizard->removePage( page ); + page->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +// ------------------------------------------------------------ + +DeleteWizardPageCommand::DeleteWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, int i, bool s ) + : Command( n, fw ), wizard( w ), index( i ) +{ + show = s; +} + +void DeleteWizardPageCommand::execute() +{ + page = wizard->page( index ); + pageLabel = wizard->title( page ); + wizard->removePage( page ); + page->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +void DeleteWizardPageCommand::unexecute() +{ + wizard->insertPage( page, pageLabel, index ); + if ( show ) + ( (QDesignerWizard*)wizard )->setCurrentPage( ( (QDesignerWizard*)wizard )->pageNum( page ) ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +// ------------------------------------------------------------ + +RenameWizardPageCommand::RenameWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, int i, const QString& name ) + : Command( n, fw ), wizard( w ), index( i ), label( name ) +{ + +} + +void RenameWizardPageCommand::execute() +{ + page = wizard->page( index ); + QString oldLabel = wizard->title( page ); + + wizard->setTitle( page, label ); + label = oldLabel; + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); +} + +void RenameWizardPageCommand::unexecute() +{ + execute(); +} + +// ------------------------------------------------------------ + +SwapWizardPagesCommand::SwapWizardPagesCommand( const QString &n, FormWindow *fw, QWizard *w, int i1, int i2 ) + : Command( n, fw ), wizard( w ), index1( i1 ), index2( i2 ) +{ +} + +void SwapWizardPagesCommand::execute() +{ + QWidget *page1 = wizard->page( index1 ); + QWidget *page2 = wizard->page( index2 ); + QString page1Label = wizard->title( page1 ); + QString page2Label = wizard->title( page2 ); + wizard->removePage( page1 ); + wizard->removePage( page2 ); + wizard->insertPage( page1, page1Label, index2 ); + wizard->insertPage( page2, page2Label, index1 ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +void SwapWizardPagesCommand::unexecute() +{ + execute(); +} + +// ------------------------------------------------------------ + +MoveWizardPageCommand::MoveWizardPageCommand( const QString &n, FormWindow *fw, QWizard *w, int i1, int i2 ) + : Command( n, fw ), wizard( w ), index1( i1 ), index2( i2 ) +{ +} + +void MoveWizardPageCommand::execute() +{ + QWidget *page = wizard->page( index1 ); + QString pageLabel = wizard->title( page ); + wizard->removePage( page ); + wizard->insertPage( page, pageLabel, index2 ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +void MoveWizardPageCommand::unexecute() +{ + // ###FIX: index1 may be the wrong place + QWidget *page = wizard->page( index2 ); + QString pageLabel = wizard->title( page ); + wizard->removePage( page ); + wizard->insertPage( page, pageLabel, index1 ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->pagesChanged( wizard ); +} + +// ------------------------------------------------------------ + +AddConnectionCommand::AddConnectionCommand( const QString &name, FormWindow *fw, + MetaDataBase::Connection c ) + : Command( name, fw ), connection( c ) +{ +} + +void AddConnectionCommand::execute() +{ + MetaDataBase::addConnection( formWindow(), connection.sender, + connection.signal, connection.receiver, connection.slot ); + if ( connection.receiver == formWindow()->mainContainer() ) + formWindow()->mainWindow()->propertyeditor()->eventList()->setup(); +} + +void AddConnectionCommand::unexecute() +{ + MetaDataBase::removeConnection( formWindow(), connection.sender, + connection.signal, connection.receiver, connection.slot ); + if ( connection.receiver == formWindow()->mainContainer() ) + formWindow()->mainWindow()->propertyeditor()->eventList()->setup(); +} + +// ------------------------------------------------------------ + +RemoveConnectionCommand::RemoveConnectionCommand( const QString &name, FormWindow *fw, + MetaDataBase::Connection c ) + : Command( name, fw ), connection( c ) +{ +} + +void RemoveConnectionCommand::execute() +{ + MetaDataBase::removeConnection( formWindow(), connection.sender, + connection.signal, connection.receiver, connection.slot ); + if ( connection.receiver == formWindow()->mainContainer() ) + formWindow()->mainWindow()->propertyeditor()->eventList()->setup(); +} + +void RemoveConnectionCommand::unexecute() +{ + MetaDataBase::addConnection( formWindow(), connection.sender, + connection.signal, connection.receiver, connection.slot ); + if ( connection.receiver == formWindow()->mainContainer() ) + formWindow()->mainWindow()->propertyeditor()->eventList()->setup(); +} + +// ------------------------------------------------------------ + +AddFunctionCommand::AddFunctionCommand( const QString &name, FormWindow *fw, const QCString &f, + const QString& spec, const QString &a, const QString &t, + const QString &l, const QString &rt ) + : Command( name, fw ), function( f ), specifier( spec ), access( a ), functionType( t ), language( l ), + returnType( rt ) +{ +} + +void AddFunctionCommand::execute() +{ + MetaDataBase::addFunction( formWindow(), function, specifier, access, functionType, language, returnType ); + formWindow()->mainWindow()->functionsChanged(); + + //integration (add - execute) + KInterfaceDesigner::Function f; + f.returnType = returnType; + f.function = function; + f.specifier = specifier; + f.access = access; + f.type = (functionType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + formWindow()->clearSelection(false); + formWindow()->mainWindow()->part()->emitAddedFunction(formWindow()->fileName(), f); + + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void AddFunctionCommand::unexecute() +{ + MetaDataBase::removeFunction( formWindow(), function, specifier, access, functionType, language, returnType ); + formWindow()->mainWindow()->functionsChanged(); + + //integration (add - unexecute) + KInterfaceDesigner::Function f; + f.returnType = returnType; + f.function = function; + f.specifier = specifier; + f.access = access; + f.type = (functionType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + formWindow()->mainWindow()->part()->emitRemovedFunction(formWindow()->fileName(), f); + + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +ChangeFunctionAttribCommand::ChangeFunctionAttribCommand( const QString &name, FormWindow *fw, MetaDataBase::Function f, + const QString &on, const QString &os, + const QString &oa, const QString &ot, const QString &ol, + const QString &ort ) + : Command( name, fw ), oldName( on ), oldSpec( os ), oldAccess( oa ), + oldType( ot ), oldLang( ol ), oldReturnType( ort ) +{ + newName = f.function; + newSpec = f.specifier; + newAccess = f.access; + newType = f.type; + newLang = f.language; + newReturnType = f.returnType; +} + +void ChangeFunctionAttribCommand::execute() +{ + MetaDataBase::changeFunctionAttributes( formWindow(), oldName, newName, newSpec, newAccess, + newType, newLang, newReturnType ); + formWindow()->formFile()->functionNameChanged( oldName, newName ); + formWindow()->formFile()->functionRetTypeChanged( newName, oldReturnType, newReturnType ); + formWindow()->mainWindow()->functionsChanged(); + + //integration (edit - execute) + KInterfaceDesigner::Function f; + f.returnType = newReturnType; + f.function = newName; + f.specifier = newSpec; + f.access = newAccess; + f.type = (newType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + KInterfaceDesigner::Function of; + f.returnType = oldReturnType; + f.function = oldName; + f.specifier = oldSpec; + f.access = oldAccess; + f.type = (oldType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + formWindow()->mainWindow()->part()->emitEditedFunction(formWindow()->fileName(), of, f); + + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void ChangeFunctionAttribCommand::unexecute() +{ + MetaDataBase::changeFunctionAttributes( formWindow(), newName, oldName, oldSpec, oldAccess, + oldType, oldLang, oldReturnType ); + formWindow()->formFile()->functionNameChanged( newName, oldName ); + formWindow()->formFile()->functionRetTypeChanged( oldName, newReturnType, oldReturnType ); + formWindow()->mainWindow()->functionsChanged(); + + //integration (edit - execute) + KInterfaceDesigner::Function f; + f.returnType = newReturnType; + f.function = newName; + f.specifier = newSpec; + f.access = newAccess; + f.type = (newType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + KInterfaceDesigner::Function of; + f.returnType = oldReturnType; + f.function = oldName; + f.specifier = oldSpec; + f.access = oldAccess; + f.type = (oldType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + formWindow()->mainWindow()->part()->emitEditedFunction(formWindow()->fileName(), f, of); + + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +RemoveFunctionCommand::RemoveFunctionCommand( const QString &name, FormWindow *fw, const QCString &f, + const QString& spec, const QString &a, const QString &t, + const QString &l, const QString &rt ) + : Command( name, fw ), function( f ), specifier( spec ), access( a ), functionType( t ), language( l ), + returnType( rt ) +{ + if ( spec.isNull() ) { + QValueList lst = MetaDataBase::functionList( fw ); + for ( QValueList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + if ( MetaDataBase::normalizeFunction( (*it).function ) == + MetaDataBase::normalizeFunction( function ) ) { + specifier = (*it).specifier; + access = (*it).access; + functionType = (*it).type; + returnType = (*it).returnType; + language = (*it).language; + break; + } + } + } +} + +void RemoveFunctionCommand::execute() +{ + MetaDataBase::removeFunction( formWindow(), function, specifier, access, functionType, language, returnType ); + formWindow()->mainWindow()->functionsChanged(); + + //integration (remove - execute) + KInterfaceDesigner::Function f; + f.returnType = returnType; + f.function = function; + f.specifier = specifier; + f.access = access; + f.type = (functionType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + formWindow()->mainWindow()->part()->emitRemovedFunction(formWindow()->fileName(), f); + + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void RemoveFunctionCommand::unexecute() +{ + if ( MetaDataBase::hasFunction( formWindow(), function ) ) + return; + MetaDataBase::addFunction( formWindow(), function, specifier, access, functionType, language, returnType ); + formWindow()->mainWindow()->functionsChanged(); + + //integration (remove - unexecute) + KInterfaceDesigner::Function f; + f.returnType = returnType; + f.function = function; + f.specifier = specifier; + f.access = access; + f.type = (functionType == "slot") ? KInterfaceDesigner::ftQtSlot : KInterfaceDesigner::ftFunction ; + formWindow()->clearSelection(false); + formWindow()->mainWindow()->part()->emitAddedFunction(formWindow()->fileName(), f); + + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +AddVariableCommand::AddVariableCommand( const QString &name, FormWindow *fw, const QString &vn, const QString &a ) + : Command( name, fw ), varName( vn ), access( a ) +{ +} + +void AddVariableCommand::execute() +{ + MetaDataBase::addVariable( formWindow(), varName, access ); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void AddVariableCommand::unexecute() +{ + MetaDataBase::removeVariable( formWindow(), varName ); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +SetVariablesCommand::SetVariablesCommand( const QString &name, FormWindow *fw, + QValueList lst ) + : Command( name, fw ), newList( lst ) +{ + oldList = MetaDataBase::variables( formWindow() ); +} + +void SetVariablesCommand::execute() +{ + MetaDataBase::setVariables( formWindow(), newList ); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void SetVariablesCommand::unexecute() +{ + MetaDataBase::setVariables( formWindow(), oldList ); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +RemoveVariableCommand::RemoveVariableCommand( const QString &name, FormWindow *fw, const QString &vn ) + : Command( name, fw ), varName( vn ) +{ + QValueList lst = MetaDataBase::variables( fw ); + for ( QValueList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + if ( (*it).varName == varName ) { + access = (*it).varAccess; + break; + } + } +} + +void RemoveVariableCommand::execute() +{ + MetaDataBase::removeVariable( formWindow(), varName ); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void RemoveVariableCommand::unexecute() +{ + MetaDataBase::addVariable( formWindow(), varName, access ); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +EditDefinitionsCommand::EditDefinitionsCommand( const QString &name, FormWindow *fw, LanguageInterface *lf, + const QString &n, const QStringList &nl ) + : Command( name, fw ), lIface( lf ), defName( n ), newList( nl ) +{ + oldList = lIface->definitionEntries( defName, formWindow()->mainWindow()->designerInterface() ); +} + +void EditDefinitionsCommand::execute() +{ + lIface->setDefinitionEntries( defName, newList, formWindow()->mainWindow()->designerInterface() ); + lIface->release(); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +void EditDefinitionsCommand::unexecute() +{ + lIface->setDefinitionEntries( defName, oldList, formWindow()->mainWindow()->designerInterface() ); + lIface->release(); + formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + if ( formWindow()->formFile() ) + formWindow()->formFile()->setModified( TRUE ); +} + +// ------------------------------------------------------------ + +LowerCommand::LowerCommand( const QString &name, FormWindow *fw, const QWidgetList &w ) + : Command( name, fw ), widgets( w ) +{ +} + +void LowerCommand::execute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->lower(); + formWindow()->raiseSelection( w ); + } + +} + +void LowerCommand::unexecute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->raise(); + formWindow()->raiseSelection( w ); + } +} + +// ------------------------------------------------------------ + +RaiseCommand::RaiseCommand( const QString &name, FormWindow *fw, const QWidgetList &w ) + : Command( name, fw ), widgets( w ) +{ +} + +void RaiseCommand::execute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->raise(); + formWindow()->raiseSelection( w ); + } + +} + +void RaiseCommand::unexecute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->lower(); + formWindow()->raiseSelection( w ); + } +} + +// ------------------------------------------------------------ + +PasteCommand::PasteCommand( const QString &n, FormWindow *fw, + const QWidgetList &w ) + : Command( n, fw ), widgets( w ) +{ +} + +void PasteCommand::execute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->show(); + formWindow()->selectWidget( w ); + formWindow()->widgets()->insert( w, w ); + formWindow()->mainWindow()->objectHierarchy()->widgetInserted( w ); + } +} + +void PasteCommand::unexecute() +{ + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + w->hide(); + formWindow()->selectWidget( w, FALSE ); + formWindow()->widgets()->remove( w ); + formWindow()->mainWindow()->objectHierarchy()->widgetRemoved( w ); + } + } + +// ------------------------------------------------------------ + +TabOrderCommand::TabOrderCommand( const QString &n, FormWindow *fw, + const QWidgetList &ol, const QWidgetList &nl ) + : Command( n, fw ), oldOrder( ol ), newOrder( nl ) +{ +} + +void TabOrderCommand::merge( Command *c ) +{ + TabOrderCommand *cmd = (TabOrderCommand*)c; + newOrder = cmd->newOrder; +} + +bool TabOrderCommand::canMerge( Command * ) +{ + return TRUE; +} + +void TabOrderCommand::execute() +{ + MetaDataBase::setTabOrder( formWindow(), newOrder ); +} + +void TabOrderCommand::unexecute() +{ + MetaDataBase::setTabOrder( formWindow(), oldOrder ); +} + +// ------------------------------------------------------------ + +PopulateListBoxCommand::PopulateListBoxCommand( const QString &n, FormWindow *fw, + QListBox *lb, const QValueList &items ) + : Command( n, fw ), newItems( items ), listbox( lb ) +{ + QListBoxItem *i = 0; + for ( i = listbox->firstItem(); i; i = i->next() ) { + Item item; + if ( i->pixmap() ) + item.pix = *i->pixmap(); + item.text = i->text(); + oldItems.append( item ); + } +} + +void PopulateListBoxCommand::execute() +{ + listbox->clear(); + for ( QValueList::Iterator it = newItems.begin(); it != newItems.end(); ++it ) { + Item i = *it; + if ( !i.pix.isNull() ) + (void)new QListBoxPixmap( listbox, i.pix, i.text ); + else + (void)new QListBoxText( listbox, i.text ); + } + formWindow()->mainWindow()->propertyeditor()->refetchData(); +} + +void PopulateListBoxCommand::unexecute() +{ + listbox->clear(); + for ( QValueList::Iterator it = oldItems.begin(); it != oldItems.end(); ++it ) { + Item i = *it; + if ( !i.pix.isNull() ) + (void)new QListBoxPixmap( listbox, i.pix, i.text ); + else + (void)new QListBoxText( listbox, i.text ); + } + formWindow()->mainWindow()->propertyeditor()->refetchData(); +} + +// ------------------------------------------------------------ + +PopulateIconViewCommand::PopulateIconViewCommand( const QString &n, FormWindow *fw, + QIconView *iv, const QValueList &items ) + : Command( n, fw ), newItems( items ), iconview( iv ) +{ +#ifndef QT_NO_ICONVIEW + QIconViewItem *i = 0; + for ( i = iconview->firstItem(); i; i = i->nextItem() ) { + Item item; + if ( i->pixmap() ) + item.pix = *i->pixmap(); + item.text = i->text(); + oldItems.append( item ); + } +#endif +} + +void PopulateIconViewCommand::execute() +{ +#ifndef QT_NO_ICONVIEW + iconview->clear(); + for ( QValueList::Iterator it = newItems.begin(); it != newItems.end(); ++it ) { + Item i = *it; + (void)new QIconViewItem( iconview, i.text, i.pix ); + } +#endif +} + +void PopulateIconViewCommand::unexecute() +{ +#ifndef QT_NO_ICONVIEW + iconview->clear(); + for ( QValueList::Iterator it = oldItems.begin(); it != oldItems.end(); ++it ) { + Item i = *it; + (void)new QIconViewItem( iconview, i.text, i.pix ); + } +#endif +} + +// ------------------------------------------------------------ + +PopulateListViewCommand::PopulateListViewCommand( const QString &n, FormWindow *fw, + QListView *lv, QListView *from ) + : Command( n, fw ), listview( lv ) +{ + newItems = new QListView(); + newItems->hide(); + transferItems( from, newItems ); + oldItems = new QListView(); + oldItems->hide(); + transferItems( listview, oldItems ); +} + +void PopulateListViewCommand::execute() +{ + listview->clear(); + transferItems( newItems, listview ); +} + +void PopulateListViewCommand::unexecute() +{ + listview->clear(); + transferItems( oldItems, listview ); +} + +void PopulateListViewCommand::transferItems( QListView *from, QListView *to ) +{ + QHeader *header = to->header(); + while ( header->count() ) + to->removeColumn( 0 ); + QHeader *h2 = from->header(); + for ( int i = 0; i < h2->count(); ++i ) { + to->addColumn( h2->label( i ) ); + if ( h2->iconSet( i ) && !h2->iconSet( i )->pixmap().isNull() ) + header->setLabel( i, *h2->iconSet( i ), h2->label( i ) ); + header->setResizeEnabled( h2->isResizeEnabled( i ), i ); + header->setClickEnabled( h2->isClickEnabled( i ), i ); + } + + QListViewItemIterator it( from ); + QPtrStack fromParents, toParents; + fromParents.push( 0 ); + toParents.push( 0 ); + QPtrStack toLasts; + QListViewItem *fromLast = 0; + toLasts.push( 0 ); + int cols = from->columns(); + to->setSorting( -1 ); + from->setSorting( -1 ); + for ( ; it.current(); ++it ) { + QListViewItem *i = it.current(); + if ( i->parent() == fromParents.top() ) { + QListViewItem *pi = toParents.top(); + QListViewItem *ni = 0; + if ( pi ) + ni = new QListViewItem( pi, toLasts.top() ); + else + ni = new QListViewItem( to, toLasts.top() ); + for ( int c = 0; c < cols; ++c ) { + ni->setText( c, i->text( c ) ); + if ( i->pixmap( c ) ) + ni->setPixmap( c, *i->pixmap( c ) ); + } + toLasts.pop(); + toLasts.push( ni ); + if ( pi ) + pi->setOpen( TRUE ); + } else { + if ( i->parent() == fromLast ) { + fromParents.push( fromLast ); + toParents.push( toLasts.top() ); + toLasts.push( 0 ); + QListViewItem *pi = toParents.top(); + QListViewItem *ni = 0; + if ( pi ) + ni = new QListViewItem( pi ); + else + ni = new QListViewItem( to ); + for ( int c = 0; c < cols; ++c ) { + ni->setText( c, i->text( c ) ); + if ( i->pixmap( c ) ) + ni->setPixmap( c, *i->pixmap( c ) ); + } + toLasts.pop(); + toLasts.push( ni ); + if ( pi ) + pi->setOpen( TRUE ); + } else { + while ( fromParents.top() != i->parent() ) { + fromParents.pop(); + toParents.pop(); + toLasts.pop(); + } + + QListViewItem *pi = toParents.top(); + QListViewItem *ni = 0; + if ( pi ) + ni = new QListViewItem( pi, toLasts.top() ); + else + ni = new QListViewItem( to, toLasts.top() ); + for ( int c = 0; c < cols; ++c ) { + ni->setText( c, i->text( c ) ); + if ( i->pixmap( c ) ) + ni->setPixmap( c, *i->pixmap( c ) ); + } + if ( pi ) + pi->setOpen( TRUE ); + toLasts.pop(); + toLasts.push( ni ); + } + } + fromLast = i; + } +} + + + +// ------------------------------------------------------------ + +PopulateMultiLineEditCommand::PopulateMultiLineEditCommand( const QString &n, FormWindow *fw, + QTextEdit *mle, const QString &txt ) + : Command( n, fw ), newText( txt ), mlined( mle ) +{ + oldText = mlined->text(); + wasChanged = MetaDataBase::isPropertyChanged( mlined, "text" ); +} + +void PopulateMultiLineEditCommand::execute() +{ + mlined->setText( newText ); + MetaDataBase::setPropertyChanged( mlined, "text", TRUE ); + formWindow()->emitUpdateProperties( mlined ); +} + +void PopulateMultiLineEditCommand::unexecute() +{ + mlined->setText( oldText ); + MetaDataBase::setPropertyChanged( mlined, "text", wasChanged ); + formWindow()->emitUpdateProperties( mlined ); +} + +// ------------------------------------------------------------ + +PopulateTableCommand::PopulateTableCommand( const QString &n, FormWindow *fw, QTable *t, + const QValueList &rows, + const QValueList &columns ) + : Command( n, fw ), newRows( rows ), newColumns( columns ), table( t ) +{ +#ifndef QT_NO_TABLE + int i = 0; + QMap columnFields = MetaDataBase::columnFields( table ); + for ( i = 0; i < table->horizontalHeader()->count(); ++i ) { + PopulateTableCommand::Column col; + col.text = table->horizontalHeader()->label( i ); + if ( table->horizontalHeader()->iconSet( i ) ) + col.pix = table->horizontalHeader()->iconSet( i )->pixmap(); + col.field = *columnFields.find( col.text ); + oldColumns.append( col ); + } + for ( i = 0; i < table->verticalHeader()->count(); ++i ) { + PopulateTableCommand::Row row; + row.text = table->verticalHeader()->label( i ); + if ( table->verticalHeader()->iconSet( i ) ) + row.pix = table->verticalHeader()->iconSet( i )->pixmap(); + oldRows.append( row ); + } +#endif +} + +void PopulateTableCommand::execute() +{ +#ifndef QT_NO_TABLE + QMap columnFields; + table->setNumCols( newColumns.count() ); + int i = 0; + for ( QValueList::Iterator cit = newColumns.begin(); cit != newColumns.end(); ++cit, ++i ) { + table->horizontalHeader()->setLabel( i, (*cit).pix, (*cit).text ); + if ( !(*cit).field.isEmpty() ) + columnFields.insert( (*cit).text, (*cit).field ); + } + MetaDataBase::setColumnFields( table, columnFields ); + table->setNumRows( newRows.count() ); + i = 0; + for ( QValueList::Iterator rit = newRows.begin(); rit != newRows.end(); ++rit, ++i ) + table->verticalHeader()->setLabel( i, (*rit).pix, (*rit).text ); +#endif +} + +void PopulateTableCommand::unexecute() +{ +#ifndef QT_NO_TABLE + QMap columnFields; + table->setNumCols( oldColumns.count() ); + int i = 0; + for ( QValueList::Iterator cit = oldColumns.begin(); cit != oldColumns.end(); ++cit, ++i ) { + table->horizontalHeader()->setLabel( i, (*cit).pix, (*cit).text ); + if ( !(*cit).field.isEmpty() ) + columnFields.insert( (*cit).text, (*cit).field ); + } + MetaDataBase::setColumnFields( table, columnFields ); + table->setNumRows( oldRows.count() ); + i = 0; + for ( QValueList::Iterator rit = oldRows.begin(); rit != oldRows.end(); ++rit, ++i ) + table->verticalHeader()->setLabel( i, (*rit).pix, (*rit).text ); +#endif +} + +// ------------------------------------------------------------ + +AddActionToToolBarCommand::AddActionToToolBarCommand( const QString &n, FormWindow *fw, + QAction *a, QDesignerToolBar *tb, int idx ) + : Command( n, fw ), action( a ), toolBar( tb ), index( idx ) +{ +} + +void AddActionToToolBarCommand::execute() +{ + action->addTo( toolBar ); + + if ( ::qt_cast(action) ) { + QString s = ( (QDesignerAction*)action )->widget()->name(); + if ( s.startsWith( "qt_dead_widget_" ) ) { + s.remove( 0, QString( "qt_dead_widget_" ).length() ); + ( (QDesignerAction*)action )->widget()->setName( s ); + } + toolBar->insertAction( ( (QDesignerAction*)action )->widget(), action ); + ( (QDesignerAction*)action )->widget()->installEventFilter( toolBar ); + } else if ( ::qt_cast(action) ) { + if ( ( (QDesignerActionGroup*)action )->usesDropDown() ) { + toolBar->insertAction( ( (QDesignerActionGroup*)action )->widget(), action ); + ( (QDesignerActionGroup*)action )->widget()->installEventFilter( toolBar ); + } + } else if ( ::qt_cast(action) ) { + toolBar->insertAction( ( (QSeparatorAction*)action )->widget(), action ); + ( (QSeparatorAction*)action )->widget()->installEventFilter( toolBar ); + } + if ( !::qt_cast(action) || ( (QActionGroup*)action )->usesDropDown()) { + if ( index == -1 ) + toolBar->appendAction( action ); + else + toolBar->insertAction( index, action ); + toolBar->reInsert(); + QObject::connect( action, SIGNAL( destroyed() ), toolBar, SLOT( actionRemoved() ) ); + } else { + if ( action->children() ) { + QObjectListIt it( *action->children() ); + int i = 0; + while ( it.current() ) { + QObject *o = it.current(); + ++it; + if ( !::qt_cast(o) ) + continue; + // ### fix it for nested actiongroups + if ( ::qt_cast(o) ) { + QDesignerAction *ac = (QDesignerAction*)o; + toolBar->insertAction( ac->widget(), ac ); + ac->widget()->installEventFilter( toolBar ); + if ( index == -1 ) + toolBar->appendAction( ac ); + else + toolBar->insertAction( index + (i++), ac ); + } + QObject::connect( o, SIGNAL( destroyed() ), toolBar, SLOT( actionRemoved() ) ); + } + } + toolBar->reInsert(); + QObject::connect( action, SIGNAL( destroyed() ), toolBar, SLOT( actionRemoved() ) ); + } + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void AddActionToToolBarCommand::unexecute() +{ + if ( ::qt_cast(action) ) { + QString s = ( (QDesignerAction*)action )->widget()->name(); + s.prepend( "qt_dead_widget_" ); + ( (QDesignerAction*)action )->widget()->setName( s ); + } + + toolBar->removeAction( action ); + action->removeFrom( toolBar ); + QObject::disconnect( action, SIGNAL( destroyed() ), toolBar, SLOT( actionRemoved() ) ); + if ( !::qt_cast(action) || ( (QActionGroup*)action )->usesDropDown()) { + action->removeEventFilter( toolBar ); + } else { + if ( action->children() ) { + QObjectListIt it( *action->children() ); + while ( it.current() ) { + QObject *o = it.current(); + ++it; + if ( !::qt_cast(o) ) + continue; + if ( ::qt_cast(o) ) { + o->removeEventFilter( toolBar ); + toolBar->removeAction( (QAction*)o ); + } + QObject::disconnect( o, SIGNAL( destroyed() ), toolBar, SLOT( actionRemoved() ) ); + } + } + } + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +AddToolBarCommand::AddToolBarCommand( const QString &n, FormWindow *fw, QMainWindow *mw ) + : Command( n, fw ), toolBar( 0 ), mainWindow( mw ) +{ +} + +void AddToolBarCommand::execute() +{ + if ( !toolBar ) { + toolBar = new QDesignerToolBar( mainWindow ); + QString n = "Toolbar"; + formWindow()->unify( toolBar, n, TRUE ); + toolBar->setName( n ); + mainWindow->addToolBar( toolBar, n ); + } else { + toolBar->show(); + QString s = toolBar->name(); + s.remove( 0, QString( "qt_dead_widget_" ).length() ); + toolBar->setName( s ); + } + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void AddToolBarCommand::unexecute() +{ + toolBar->hide(); + QString s = toolBar->name(); + s.prepend( "qt_dead_widget_" ); + toolBar->setName( s ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +#ifdef QT_CONTAINER_CUSTOM_WIDGETS +AddContainerPageCommand::AddContainerPageCommand( const QString &n, FormWindow *fw, + QWidget *c, const QString &label ) + : Command( n, fw ), container( c ), index( -1 ), pageLabel( label ), page( 0 ) +{ + WidgetInterface *iface = 0; + widgetManager()->queryInterface( WidgetFactory::classNameOf( container ), &iface ); + if ( !iface ) + return; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&wiface ); + if ( !wiface ) + return; + wClassName = WidgetFactory::classNameOf( container ); +} + +AddContainerPageCommand::~AddContainerPageCommand() +{ + if ( wiface ) + wiface->release(); +} + +void AddContainerPageCommand::execute() +{ + if ( !wiface || !wiface->supportsPages( wClassName ) ) + return; + if ( index == -1 ) + index = wiface->count( wClassName, container ); + if ( !page ) + page = wiface->addPage( wClassName, container, pageLabel, index ); + else + wiface->insertPage( wClassName, container, pageLabel, index, page ); + + MetaDataBase::addEntry( page ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + // #### show and update pages in object hierarchy view +} + +void AddContainerPageCommand::unexecute() +{ + if ( !wiface || !wiface->supportsPages( wClassName ) ) + return; + wiface->removePage( wClassName, container, index ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + // #### show and update pages in object hierarchy view +} + +// ------------------------------------------------------------ + +DeleteContainerPageCommand::DeleteContainerPageCommand( const QString &n, FormWindow *fw, + QWidget *c, int idx ) + : Command( n, fw ), container( c ), index( idx ) +{ + WidgetInterface *iface = 0; + widgetManager()->queryInterface( WidgetFactory::classNameOf( container ), &iface ); + if ( !iface ) + return; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&wiface ); + if ( !wiface ) + return; + wClassName = WidgetFactory::classNameOf( container ); + page = wiface->page( wClassName, container, index ); + pageLabel = wiface->pageLabel( wClassName, container, index ); +} + +DeleteContainerPageCommand::~DeleteContainerPageCommand() +{ + if ( wiface ) + wiface->release(); +} + +void DeleteContainerPageCommand::execute() +{ + if ( !wiface || !wiface->supportsPages( wClassName ) ) + return; + + wiface->removePage( wClassName, container, index ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + // #### show and update pages in object hierarchy view +} + +void DeleteContainerPageCommand::unexecute() +{ + if ( !wiface || !wiface->supportsPages( wClassName ) ) + return; + if ( index == -1 ) + index = wiface->count( wClassName, container ); + + wiface->insertPage( wClassName, container, pageLabel, index, page ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + // #### show and update pages in object hierarchy view +} + +// ------------------------------------------------------------ + +RenameContainerPageCommand::RenameContainerPageCommand( const QString &n, FormWindow *fw, + QWidget *c, int idx, + const QString &label ) + : Command( n, fw ), container( c ), index( idx ), newLabel( label ) +{ + WidgetInterface *iface = 0; + widgetManager()->queryInterface( WidgetFactory::classNameOf( container ), &iface ); + if ( !iface ) + return; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&wiface ); + if ( !wiface ) + return; + wClassName = WidgetFactory::classNameOf( container ); + oldLabel = wiface->pageLabel( wClassName, container, index ); +} + +RenameContainerPageCommand::~RenameContainerPageCommand() +{ + if ( wiface ) + wiface->release(); +} + +void RenameContainerPageCommand::execute() +{ + if ( !wiface || !wiface->supportsPages( wClassName ) ) + return; + wiface->renamePage( wClassName, container, index, newLabel ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + // #### show and update pages in object hierarchy view +} + +void RenameContainerPageCommand::unexecute() +{ + if ( !wiface || !wiface->supportsPages( wClassName ) ) + return; + wiface->renamePage( wClassName, container, index, oldLabel ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + // #### show and update pages in object hierarchy view +} +#endif // QT_CONTAINER_CUSTOM_WIDGETS +// ------------------------------------------------------------ + +AddActionToPopupCommand::AddActionToPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + PopupMenuEditorItem *i, + int idx ) + : Command( n, fw ), menu( m ), item( i ), index( idx ) +{ } + +void AddActionToPopupCommand::execute() +{ + menu->insert( item, index ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void AddActionToPopupCommand::unexecute() +{ + item->hideMenu(); + int i = menu->find( item->action() ); + menu->remove( i ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +RemoveActionFromPopupCommand::RemoveActionFromPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + int idx ) + : AddActionToPopupCommand( n, fw, m, 0, idx ) +{ + item = menu->at( index ); +} + +void RemoveActionFromPopupCommand::execute() +{ + AddActionToPopupCommand::unexecute(); +} + +void RemoveActionFromPopupCommand::unexecute() +{ + AddActionToPopupCommand::execute(); +} + +// ------------------------------------------------------------ + +ExchangeActionInPopupCommand::ExchangeActionInPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + int a, + int b ) + : Command( n, fw ), menu( m ), c( a ), d( b ) +{ } + +void ExchangeActionInPopupCommand::execute() +{ + menu->exchange( c, d ); +} + +void ExchangeActionInPopupCommand::unexecute() +{ + execute(); +} + +// ------------------------------------------------------------ + +ActionEditor *ActionCommand::actionEditor() +{ + // FIXME: handle multiple action editors + return (ActionEditor *) formWindow()->mainWindow()->child( 0, "ActionEditor" ); +} + +// ------------------------------------------------------------ + +RenameActionCommand::RenameActionCommand( const QString &n, + FormWindow *fw, + QAction *a, + PopupMenuEditor *m, + QString nm ) + : ActionCommand( n, fw, a ), menu( m ), newName( nm ) +{ + oldName = action->menuText(); +} + +void RenameActionCommand::execute() +{ + QString actionText = newName; + actionText.replace("&&", "&"); + QString menuText = newName; + action->setText( actionText ); + action->setMenuText( menuText ); + + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void RenameActionCommand::unexecute() +{ + action->setMenuText( oldName ); + action->setText( oldName ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +SetActionIconsCommand::SetActionIconsCommand( const QString &n, + FormWindow *fw, + QAction *a, + PopupMenuEditor *m, + QIconSet &icons ) + : ActionCommand( n, fw, a ), menu( m ), newIcons( icons ) +{ + oldIcons = a->iconSet(); +} + +void SetActionIconsCommand::execute() +{ + action->setIconSet( newIcons ); + ActionEditor *ae = actionEditor(); + if ( ae ) + ae->updateActionIcon( action ); + MetaDataBase::setPropertyChanged( action, "iconSet", TRUE ); +} + +void SetActionIconsCommand::unexecute() +{ + action->setIconSet( oldIcons ); + ActionEditor *ae = actionEditor(); + if ( ae ) + ae->updateActionIcon( action ); + MetaDataBase::setPropertyChanged( action, "iconSet", TRUE ); +} + +// ------------------------------------------------------------ + +AddMenuCommand::AddMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + MenuBarEditorItem *i, + int idx ) + : Command( n, fw ), mb( b ), item( i ), name( 0 ), index( idx ) +{ } + +AddMenuCommand::AddMenuCommand( const QString &n, + FormWindow *fw, + QMainWindow *mw, + const QString &nm ) + : Command( n, fw ), mb( 0 ), item( 0 ), name( nm ), index( -1 ) +{ + if ( mw ) + mb = (MenuBarEditor *)mw->child( 0, "MenuBarEditor" ); +} + +void AddMenuCommand::execute() +{ + QString n; + QMainWindow *mw = (QMainWindow*)formWindow()->mainContainer(); + if ( !mb ) { + mb = new MenuBarEditor( formWindow(), mw ); + mb->setName( "MenuBarEditor" ); + formWindow()->insertWidget( mb, TRUE ); + } + if ( !item ) { + PopupMenuEditor *popup = new PopupMenuEditor( formWindow(), mw ); + popup->setName( "PopupMenuEditor" ); + formWindow()->insertWidget( popup, TRUE ); + mb->insertItem( name, popup, index ); + index = mb->findItem( popup ); + item = mb->item( index ); + } else { + PopupMenuEditor *popup = item->menu(); + popup->setName( item->menuText() ); + formWindow()->insertWidget( popup, TRUE ); + mb->insertItem( item, index ); + } + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void AddMenuCommand::unexecute() +{ + if ( !item ) { + qWarning( "The AddMenuCommand was created without a menu item." ); + return; + } + item->menu()->hide(); + int i = mb->findItem( item ); + formWindow()->removeWidget( item->menu() ); + mb->removeItemAt( i ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +RemoveMenuCommand::RemoveMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + int idx ) + : AddMenuCommand( n, fw, b, 0, idx ) +{ + item = mb->item( index ); +} + +void RemoveMenuCommand::execute() +{ + mb->hideItem( index ); + AddMenuCommand::unexecute(); +} + +void RemoveMenuCommand::unexecute() +{ + AddMenuCommand::execute(); +} + +// ------------------------------------------------------------ + +ExchangeMenuCommand::ExchangeMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + int i, + int j ) + : Command( n, fw ), bar( b ), k( i ), l( j ) +{ } + +void ExchangeMenuCommand::execute() +{ + bar->exchange( k, l ); +} + +void ExchangeMenuCommand::unexecute() +{ + execute(); +} + +// ------------------------------------------------------------ + +MoveMenuCommand::MoveMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + int i, + int j ) + : Command( n, fw ), bar( b ), from( i ), to( j ) +{ } + +void MoveMenuCommand::execute() +{ + bar->hideItem( from ); + MenuBarEditorItem * i = bar->item( from ); + bar->removeItemAt( from ); + int t = ( from > to ? to : to - 1 ); + bar->insertItem( i, t ); +} + +void MoveMenuCommand::unexecute() +{ + bar->hideItem( to ); + int t = ( from > to ? to : to - 1 ); + MenuBarEditorItem * i = bar->item( t ); + bar->removeItemAt( t ); + bar->insertItem( i, from ); +} + +// ------------------------------------------------------------ + +RenameMenuCommand::RenameMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + QString nm, + MenuBarEditorItem *i ) + : Command( n, fw ), bar( b ), item( i ), newName( nm ) +{ + oldName = item->menu()->name(); +} + +QString RenameMenuCommand::makeLegal( const QString &str ) +{ + // remove illegal characters + QString d; + char c = 0, i = 0; + while ( !str.at(i).isNull() ) { + c = str.at(i).latin1(); + if ( c == '-' || c == ' ' ) + d += '_'; + else if ( ( c >= '0' && c <= '9') || ( c >= 'A' && c <= 'Z' ) + || c == '_' || ( c >= 'a' && c <= 'z' ) ) + d += c; + ++i; + } + return d; +} + +void RenameMenuCommand::execute() +{ + PopupMenuEditor *popup = item->menu(); + item->setMenuText( newName ); + QString legal = makeLegal( newName ); + formWindow()->unify( popup, legal, TRUE ); + popup->setName( legal ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void RenameMenuCommand::unexecute() +{ + PopupMenuEditor *popup = item->menu(); + item->setMenuText( oldName ); + popup->setName( oldName ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +AddToolBoxPageCommand::AddToolBoxPageCommand( const QString &n, FormWindow *fw, + QToolBox *tw, const QString &label ) + : Command( n, fw ), toolBox( tw ), toolBoxLabel( label ) +{ + toolBoxPage = new QDesignerWidget( formWindow(), toolBox, "page" ); + toolBoxPage->hide(); + index = -1; + MetaDataBase::addEntry( toolBoxPage ); +} + +void AddToolBoxPageCommand::execute() +{ + index = toolBox->insertItem( index, toolBoxPage, toolBoxLabel); + toolBox->setCurrentIndex( index ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void AddToolBoxPageCommand::unexecute() +{ + toolBox->removeItem( toolBoxPage ); + toolBoxPage->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +// ------------------------------------------------------------ + +DeleteToolBoxPageCommand::DeleteToolBoxPageCommand( const QString &n, FormWindow *fw, + QToolBox *tw, QWidget *page ) + : Command( n, fw ), toolBox( tw ), toolBoxPage( page ) +{ + toolBoxLabel = toolBox->itemLabel( toolBox->currentIndex() ); + index = toolBox->currentIndex(); +} + +void DeleteToolBoxPageCommand::execute() +{ + toolBox->removeItem( toolBoxPage ); + toolBoxPage->hide(); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} + +void DeleteToolBoxPageCommand::unexecute() +{ + index = toolBox->insertItem( index, toolBoxPage, toolBoxLabel ); + toolBox->setCurrentIndex( index ); + formWindow()->emitUpdateProperties( formWindow()->currentWidget() ); + formWindow()->mainWindow()->objectHierarchy()->rebuild(); +} diff --git a/kdevdesigner/designer/command.h b/kdevdesigner/designer/command.h new file mode 100644 index 00000000..ac5e9d5a --- /dev/null +++ b/kdevdesigner/designer/command.h @@ -0,0 +1,1259 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef COMMAND_H +#define COMMAND_H + +#include "metadatabase.h" +#include "layout.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class QWizard; +class QTabWidget; +class Command; +class QWidget; +class FormWindow; +class PropertyEditor; +class QListBox; +class QIconView; +class QTable; +class QAction; +class QDesignerToolBar; +class QMainWindow; +class QTextEdit; +struct LanguageInterface; +class QToolBox; + +class MenuBarEditor; +class MenuBarEditorItem; +class PopupMenuEditor; +class PopupMenuEditorItem; +class ActionEditor; + +class Command : public Qt +{ +public: + Command( const QString &n, FormWindow *fw ); + virtual ~Command(); + + enum Type { + Resize, + Insert, + Move, + Delete, + SetProperty, + LayoutHorizontal, + LayoutVertical, + LayoutHorizontalSplitter, + LayoutVerticalSplitter, + LayoutGrid, + BreakLayout, + Macro, + AddTabPage, + DeleteTabPage, + MoveTabPage, + AddWidgetStackPage, + DeleteWidgetStackPage, + AddWizardPage, + DeleteWizardPage, + SwapWizardPages, + MoveWizardPage, + RenameWizardPage, + AddConnection, + RemoveConnection, + Lower, + Raise, + Paste, + TabOrder, + PopulateListBox, + PopulateIconView, + PopulateListView, + PopulateMultiLineEdit, + PopulateTable, + AddActionToToolBar, + RemoveActionFromToolBar, + AddToolBar, + RemoveToolBar, + AddFunction, + ChangeFunctionAttrib, + RemoveFunction, + AddVariable, + SetVariables, + RemoveVariable, + EditDefinitions, + AddContainerPage, + DeleteContainerPage, + RenameContainerPage, + AddActionToPopup, + RemoveActionFromPopup, + ExchangeActionInPopup, + //MoveActionInPopup, + RenameAction, + SetActionIcons, + AddMenu, + RemoveMenu, + ExchangeMenu, + MoveMenu, + RenameMenu, + AddToolBoxPage, + DeleteToolBoxPage + }; + + QString name() const; + + virtual void execute() = 0; + virtual void unexecute() = 0; + virtual Type type() const = 0; + virtual void merge( Command *c ); + virtual bool canMerge( Command *c ); + + FormWindow *formWindow() const; + +private: + QString cmdName; + FormWindow *formWin; + +}; + +class CommandHistory : public QObject +{ + Q_OBJECT + +public: + CommandHistory( int s ); + + void addCommand( Command *cmd, bool tryCompress = FALSE ); + void undo(); + void redo(); + + void emitUndoRedo(); + + void setModified( bool m ); + bool isModified() const; + +public slots: + void checkCompressedCommand(); + +signals: + void undoRedoChanged( bool undoAvailable, bool redoAvailable, + const QString &undoCmd, const QString &redoCmd ); + void modificationChanged( bool m ); + +private: + QPtrList history; + int current, steps; + bool modified; + int savedAt; + Command *compressedCommand; + +}; + +class ResizeCommand : public Command +{ +public: + ResizeCommand( const QString &n, FormWindow *fw, + QWidget *w, const QRect &oldr, const QRect &nr ); + + void execute(); + void unexecute(); + Type type() const { return Resize; } + +private: + QWidget *widget; + QRect oldRect, newRect; + +}; + +class InsertCommand : public Command +{ +public: + InsertCommand( const QString &n, FormWindow *fw, QWidget *w, const QRect &g ); + + void execute(); + void unexecute(); + Type type() const { return Insert; } + +private: + QWidget *widget; + QRect geometry; + +}; + +class MoveCommand : public Command +{ +public: + MoveCommand( const QString &n, FormWindow *fw, + const QWidgetList &w, + const QValueList op, + const QValueList np, + QWidget *opr, QWidget *npr ); + void execute(); + void unexecute(); + Type type() const { return Move; } + void merge( Command *c ); + bool canMerge( Command *c ); + +private: + QWidgetList widgets; + QValueList oldPos, newPos; + QWidget *oldParent, *newParent; + +}; + +class DeleteCommand : public Command +{ +public: + DeleteCommand( const QString &n, FormWindow *fw, + const QWidgetList &w ); + void execute(); + void unexecute(); + Type type() const { return Delete; } + +private: + QWidgetList widgets; + QMap< QWidget*, QValueList > connections; + +}; + +class SetPropertyCommand : public Command +{ +public: + SetPropertyCommand( const QString &n, FormWindow *fw, + QObject *w, PropertyEditor *e, + const QString &pn, const QVariant &ov, + const QVariant &nv, const QString &ncut, + const QString &ocut, + bool reset = FALSE ); + + void execute(); + void unexecute(); + Type type() const { return SetProperty; } + void merge( Command *c ); + bool canMerge( Command *c ); + bool checkProperty(); + +private: + void setProperty( const QVariant &v, const QString ¤tItemText, bool select = TRUE ); + + QGuardedPtr widget; + PropertyEditor *editor; + QString propName; + QVariant oldValue, newValue; + QString oldCurrentItemText, newCurrentItemText; + bool wasChanged; + bool isResetCommand; + +}; + +class LayoutHorizontalCommand : public Command +{ +public: + LayoutHorizontalCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ); + + void execute(); + void unexecute(); + Type type() const { return LayoutHorizontal; } + +private: + HorizontalLayout layout; + +}; + +class LayoutHorizontalSplitCommand : public Command +{ +public: + LayoutHorizontalSplitCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ); + + void execute(); + void unexecute(); + Type type() const { return LayoutHorizontalSplitter; } + +private: + HorizontalLayout layout; + +}; + +class LayoutVerticalCommand : public Command +{ +public: + LayoutVerticalCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ); + + void execute(); + void unexecute(); + Type type() const { return LayoutVertical; } + +private: + VerticalLayout layout; + +}; + +class LayoutVerticalSplitCommand : public Command +{ +public: + LayoutVerticalSplitCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl ); + + void execute(); + void unexecute(); + Type type() const { return LayoutVerticalSplitter; } + +private: + VerticalLayout layout; + +}; + +class LayoutGridCommand : public Command +{ +public: + LayoutGridCommand( const QString &n, FormWindow *fw, + QWidget *parent, QWidget *layoutBase, + const QWidgetList &wl, int xres, int yres ); + + void execute(); + void unexecute(); + Type type() const { return LayoutGrid; } + +private: + GridLayout layout; + +}; + +class BreakLayoutCommand : public Command +{ +public: + BreakLayoutCommand( const QString &n, FormWindow *fw, + QWidget *layoutBase, const QWidgetList &wl ); + + void execute(); + void unexecute(); + Type type() const { return BreakLayout; } + +private: + Layout *layout; + int spacing; + int margin; + QWidget *lb; + QWidgetList widgets; + +}; + +class MacroCommand : public Command +{ +public: + MacroCommand( const QString &n, FormWindow *fw, + const QPtrList &cmds ); + + void execute(); + void unexecute(); + Type type() const { return Macro; } + +private: + QPtrList commands; + +}; + +class AddTabPageCommand : public Command +{ +public: + AddTabPageCommand( const QString &n, FormWindow *fw, + QTabWidget *tw, const QString &label ); + + void execute(); + void unexecute(); + Type type() const { return AddTabPage; } + +private: + QTabWidget *tabWidget; + int index; + QWidget *tabPage; + QString tabLabel; + +}; + +class DeleteTabPageCommand : public Command +{ +public: + DeleteTabPageCommand( const QString &n, FormWindow *fw, + QTabWidget *tw, QWidget *page ); + + void execute(); + void unexecute(); + Type type() const { return DeleteTabPage; } + +private: + QTabWidget *tabWidget; + int index; + QWidget *tabPage; + QString tabLabel; + +}; + +class MoveTabPageCommand : public Command +{ +public: + MoveTabPageCommand(const QString &n, FormWindow *fw, + QTabWidget *tw, QWidget *page, const QString& label, int nIndex, int oIndex ); + + void execute(); + void unexecute(); + Type type() const { return MoveTabPage; } + +private: + QTabWidget *tabWidget; + int newIndex, oldIndex; + QWidget *tabPage; + QString tabLabel; + +}; +class QDesignerWidgetStack; +class AddWidgetStackPageCommand : public Command +{ +public: + AddWidgetStackPageCommand( const QString &n, FormWindow *fw, + QDesignerWidgetStack *ws ); + + void execute(); + void unexecute(); + Type type() const { return AddWidgetStackPage; } + +private: + QDesignerWidgetStack *widgetStack; + int index; + QWidget *stackPage; +}; + +class DeleteWidgetStackPageCommand : public Command +{ +public: + DeleteWidgetStackPageCommand( const QString &n, FormWindow *fw, + QDesignerWidgetStack *ws, QWidget *page ); + + void execute(); + void unexecute(); + Type type() const { return DeleteWidgetStackPage; } + +private: + QDesignerWidgetStack *widgetStack; + int index; + QWidget *stackPage; +}; + + + +class AddWizardPageCommand : public Command +{ +public: + AddWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, const QString &label, int index = -1, bool show = TRUE ); + + void execute(); + void unexecute(); + Type type() const { return AddWizardPage; } + +private: + QWizard *wizard; + int index; + bool show; + QWidget *page; + QString pageLabel; + +}; + +class DeleteWizardPageCommand : public Command +{ +public: + DeleteWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, int index, bool show = TRUE ); + + void execute(); + void unexecute(); + Type type() const { return DeleteWizardPage; } + +private: + QWizard *wizard; + int index; + bool show; + QWidget *page; + QString pageLabel; + +}; + +class RenameWizardPageCommand : public Command +{ +public: + RenameWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, int index, const QString& name ); + + void execute(); + void unexecute(); + Type type() const { return RenameWizardPage; } + +private: + QWizard *wizard; + int index; + QWidget *page; + QString label; + +}; + +class SwapWizardPagesCommand : public Command +{ +public: + SwapWizardPagesCommand( const QString &n, FormWindow *fw, + QWizard *w, int index1, int index2 ); + + void execute(); + void unexecute(); + Type type() const { return SwapWizardPages; } + +private: + QWizard *wizard; + int index1, index2; + +}; + +class MoveWizardPageCommand : public Command +{ +public: + MoveWizardPageCommand( const QString &n, FormWindow *fw, + QWizard *w, int index1, int index2 ); + + void execute(); + void unexecute(); + Type type() const { return MoveWizardPage; } + +private: + QWizard *wizard; + int index1, index2; + +}; + +class AddConnectionCommand : public Command +{ +public: + AddConnectionCommand( const QString &name, FormWindow *fw, + MetaDataBase::Connection c ); + + void execute(); + void unexecute(); + Type type() const { return AddConnection; } + +private: + MetaDataBase::Connection connection; + +}; + +class RemoveConnectionCommand : public Command +{ +public: + RemoveConnectionCommand( const QString &name, FormWindow *fw, + MetaDataBase::Connection c ); + + void execute(); + void unexecute(); + Type type() const { return RemoveConnection; } + +private: + MetaDataBase::Connection connection; + +}; + + +class AddFunctionCommand : public Command +{ +public: + AddFunctionCommand( const QString &name, FormWindow *fw, const QCString &f, const QString& spec, + const QString &a, const QString &t, const QString &l, const QString &rt ); + + void execute(); + void unexecute(); + Type type() const { return AddFunction; } + +private: + QCString function; + QString specifier; + QString access; + QString functionType; + QString language; + QString returnType; +}; + +class ChangeFunctionAttribCommand : public Command +{ +public: + ChangeFunctionAttribCommand( const QString &name, FormWindow *fw, MetaDataBase::Function f, + const QString &on, const QString &os, const QString &oa, + const QString &ot, const QString &ol, const QString &ort ); + + void execute(); + void unexecute(); + Type type() const { return ChangeFunctionAttrib; } + +private: + QString oldName, newName; + QString oldSpec, newSpec; + QString oldAccess, newAccess; + QString oldType, newType; + QString oldLang, newLang; + QString oldReturnType, newReturnType; +}; + +class RemoveFunctionCommand : public Command +{ +public: + RemoveFunctionCommand( const QString &name, FormWindow *fw, const QCString &f, const QString& spec, + const QString &a, const QString &t, const QString &l, const QString &rt ); + + void execute(); + void unexecute(); + Type type() const { return RemoveFunction; } + +private: + QCString function; + QString specifier; + QString access; + QString functionType; + QString language; + QString returnType; +}; + +class AddVariableCommand : public Command +{ +public: + AddVariableCommand( const QString &name, FormWindow *fw, const QString &vn, const QString &a ); + void execute(); + void unexecute(); + Type type() const { return AddVariable; } + +private: + QString varName; + QString access; +}; + +class SetVariablesCommand : public Command +{ +public: + SetVariablesCommand( const QString &name, FormWindow *fw, QValueList lst ); + void execute(); + void unexecute(); + Type type() const { return SetVariables; } + +private: + QValueList oldList, newList; +}; + +class RemoveVariableCommand : public Command +{ +public: + RemoveVariableCommand( const QString &name, FormWindow *fw, const QString &vn ); + void execute(); + void unexecute(); + Type type() const { return RemoveVariable; } + +private: + QString varName; + QString access; +}; + +class EditDefinitionsCommand : public Command +{ +public: + EditDefinitionsCommand( const QString &name, FormWindow *fw, LanguageInterface *lf, + const QString &n, const QStringList &l ); + void execute(); + void unexecute(); + Type type() const { return EditDefinitions; } + +private: + LanguageInterface *lIface; + QString defName; + QStringList newList, oldList; +}; + +class LowerCommand : public Command +{ +public: + LowerCommand( const QString &name, FormWindow *fw, const QWidgetList &w ); + + void execute(); + void unexecute(); + Type type() const { return Lower; } + +private: + QWidgetList widgets; + +}; + +class RaiseCommand : public Command +{ +public: + RaiseCommand( const QString &name, FormWindow *fw, const QWidgetList &w ); + + void execute(); + void unexecute(); + Type type() const { return Raise; } + +private: + QWidgetList widgets; + +}; + +class PasteCommand : public Command +{ +public: + PasteCommand( const QString &n, FormWindow *fw, const QWidgetList &w ); + + void execute(); + void unexecute(); + Type type() const { return Paste; } + +private: + QWidgetList widgets; + +}; + +class TabOrderCommand : public Command +{ +public: + TabOrderCommand( const QString &n, FormWindow *fw, const QWidgetList &ol, const QWidgetList &nl ); + + void execute(); + void unexecute(); + Type type() const { return TabOrder; } + void merge( Command *c ); + bool canMerge( Command *c ); + +private: + QWidgetList oldOrder, newOrder; + +}; + +class PopulateListBoxCommand : public Command +{ +public: + struct Item + { + QString text; + QPixmap pix; + Q_DUMMY_COMPARISON_OPERATOR( Item ) + }; + + PopulateListBoxCommand( const QString &n, FormWindow *fw, + QListBox *lb, const QValueList &items ); + void execute(); + void unexecute(); + Type type() const { return PopulateListBox; } + + bool operator==( const PopulateListBoxCommand & ) const; + +private: + QValueList oldItems, newItems; + QListBox *listbox; + +}; + +class PopulateIconViewCommand : public Command +{ +public: + struct Item + { + QString text; + QPixmap pix; + Q_DUMMY_COMPARISON_OPERATOR( Item ) + }; + + PopulateIconViewCommand( const QString &n, FormWindow *fw, + QIconView *iv, const QValueList &items ); + void execute(); + void unexecute(); + Type type() const { return PopulateIconView; } + + bool operator==( const PopulateIconViewCommand & ) const; + +private: + QValueList oldItems, newItems; + QIconView *iconview; + +}; + +class PopulateListViewCommand : public Command +{ +public: + PopulateListViewCommand( const QString &n, FormWindow *fw, + QListView *lv, QListView *from ); + void execute(); + void unexecute(); + Type type() const { return PopulateListView; } + static void transferItems( QListView *from, QListView *to ); + + bool operator==( const PopulateListViewCommand & ) const; + +private: + QListView *oldItems, *newItems; + QListView *listview; + +}; + +class PopulateMultiLineEditCommand : public Command +{ +public: + PopulateMultiLineEditCommand( const QString &n, FormWindow *fw, + QTextEdit *mle, const QString &txt ); + void execute(); + void unexecute(); + Type type() const { return PopulateMultiLineEdit; } + +private: + QString newText, oldText; + QTextEdit *mlined; + bool wasChanged; + +}; + +class PopulateTableCommand : public Command +{ +public: + struct Row + { + QString text; + QPixmap pix; + Q_DUMMY_COMPARISON_OPERATOR( Row ) + }; + + struct Column + { + QString text; + QPixmap pix; + QString field; + Q_DUMMY_COMPARISON_OPERATOR( Column ) + }; + + PopulateTableCommand( const QString &n, FormWindow *fw, QTable *t, + const QValueList &rows, + const QValueList &columns ); + + void execute(); + void unexecute(); + Type type() const { return PopulateTable; } + +private: + QValueList oldRows, newRows; + QValueList oldColumns, newColumns; + QTable *table; + +}; + +class AddActionToToolBarCommand : public Command +{ +public: + AddActionToToolBarCommand( const QString &n, FormWindow *fw, + QAction *a, QDesignerToolBar *tb, int idx ); + + void execute(); + void unexecute(); + Type type() const { return AddActionToToolBar; } + +private: + QAction *action; + QDesignerToolBar *toolBar; + int index; + +}; + +class RemoveActionFromToolBarCommand : public AddActionToToolBarCommand +{ +public: + RemoveActionFromToolBarCommand( const QString &n, FormWindow *fw, + QAction *a, QDesignerToolBar *tb, int idx ) + : AddActionToToolBarCommand( n, fw, a, tb, idx ) {} + + void execute() { AddActionToToolBarCommand::unexecute(); } + void unexecute() { AddActionToToolBarCommand::execute(); } + Type type() const { return RemoveActionFromToolBar; } + +}; + +// MenuCommands + +class AddToolBarCommand : public Command +{ +public: + AddToolBarCommand( const QString &n, FormWindow *fw, QMainWindow *mw ); + + void execute(); + void unexecute(); + Type type() const { return AddToolBar; } + +protected: + QDesignerToolBar *toolBar; + QMainWindow *mainWindow; + +}; + +class RemoveToolBarCommand : public AddToolBarCommand +{ +public: + RemoveToolBarCommand( const QString &n, FormWindow *fw, QMainWindow *mw, QDesignerToolBar *tb ) + : AddToolBarCommand( n, fw, mw ) { toolBar = tb; } + + void execute() { AddToolBarCommand::unexecute(); } + void unexecute() { AddToolBarCommand::execute(); } + Type type() const { return RemoveToolBar; } + +}; + +struct QWidgetContainerInterfacePrivate; + +class AddContainerPageCommand : public Command +{ +public: + AddContainerPageCommand( const QString &n, FormWindow *fw, + QWidget *c, const QString &label ); + + ~AddContainerPageCommand(); + + void execute(); + void unexecute(); + Type type() const { return AddContainerPage; } + +private: + QString wClassName; + QWidget *container; + int index; + QString pageLabel; + QWidget *page; + QWidgetContainerInterfacePrivate *wiface; + +}; + +class DeleteContainerPageCommand : public Command +{ +public: + DeleteContainerPageCommand( const QString &n, FormWindow *fw, + QWidget *container, int index ); + ~DeleteContainerPageCommand(); + + void execute(); + void unexecute(); + Type type() const { return DeleteContainerPage; } + +private: + QString wClassName; + QWidget *container; + int index; + QString pageLabel; + QWidget *page; + QWidgetContainerInterfacePrivate *wiface; + +}; + +class RenameContainerPageCommand : public Command +{ +public: + RenameContainerPageCommand( const QString &n, FormWindow *fw, + QWidget *container, int index, + const QString &label ); + ~RenameContainerPageCommand(); + + void execute(); + void unexecute(); + Type type() const { return RenameContainerPage; } + +private: + QString wClassName; + QWidget *container; + int index; + QString oldLabel, newLabel; + QWidgetContainerInterfacePrivate *wiface; + +}; + +class AddActionToPopupCommand : public Command +{ +public: + AddActionToPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + PopupMenuEditorItem *i, + int idx = -1 ); + void execute(); + void unexecute(); + Type type() const { return AddActionToPopup; } +protected: + QString constructName() const; + PopupMenuEditor *menu; + PopupMenuEditorItem *item; + int index; +private: +}; + +class RemoveActionFromPopupCommand : public AddActionToPopupCommand +{ +public: + RemoveActionFromPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + int idx ); + void execute(); + void unexecute(); + Type type() const { return RemoveActionFromPopup; } +protected: +private: +}; + +class ExchangeActionInPopupCommand : public Command +{ +public: + ExchangeActionInPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + int a, + int b ); + void execute(); + void unexecute(); + Type type() const { return ExchangeActionInPopup; } +protected: +private: + PopupMenuEditor *menu; + int c; + int d; +}; +/* +class MoveActionInPopupCommand : public Command +{ +public: + MoveActionInPopupCommand( const QString &n, + FormWindow *fw, + PopupMenuEditor *m, + int a, + int b ); + void execute(); + void unexecute(); + Type type() const { return MoveActionInPopup; } +protected: +private: + PopupMenuEditor *menu; + int from; + int to; +}; +*/ +class ActionCommand : public Command +{ +public: + ActionCommand( const QString &n, + FormWindow *fw, + QAction *a ) + : Command( n, fw ), action( a ) { } + virtual Type type() const = 0; +protected: + ActionEditor *actionEditor(); + QAction *action; +}; + +class RenameActionCommand : public ActionCommand +{ +public: + RenameActionCommand( const QString &n, + FormWindow *fw, + QAction *a, + PopupMenuEditor *m, + QString nm ); + void execute(); + void unexecute(); + Type type() const { return RenameAction; } +private: + PopupMenuEditor *menu; + QString newName; + QString oldName; +}; + +class SetActionIconsCommand : public ActionCommand +{ +public: + SetActionIconsCommand( const QString &n, + FormWindow *fw, + QAction *a, + PopupMenuEditor *m, + QIconSet &icons ); + void execute(); + void unexecute(); + Type type() const { return SetActionIcons; } +protected: + void updateActionEditorItem(); +private: + PopupMenuEditor *menu; + QIconSet newIcons; + QIconSet oldIcons; +}; + +class AddMenuCommand : public Command +{ +public: + AddMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + MenuBarEditorItem *i, + int idx = -1 ); + + AddMenuCommand( const QString &n, + FormWindow *fw, + QMainWindow *mw, + const QString &nm = "Menu" ); + + void execute(); + void unexecute(); + Type type() const { return AddMenu; } +protected: + MenuBarEditor *mb; + MenuBarEditorItem *item; + QString name; + int index; +private: +}; + +class RemoveMenuCommand : public AddMenuCommand +{ +public: + RemoveMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + int idx ); + void execute(); + void unexecute(); + Type type() const { return RemoveMenu; } +protected: +private: +}; + +class ExchangeMenuCommand : public Command +{ +public: + ExchangeMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + int i, + int j ); + void execute(); + void unexecute(); + Type type() const { return ExchangeMenu; } +protected: +private: + MenuBarEditor *bar; + int k; + int l; +}; + + +class MoveMenuCommand : public Command +{ +public: + MoveMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *b, + int i, + int j ); + void execute(); + void unexecute(); + Type type() const { return MoveMenu; } +protected: +private: + MenuBarEditor *bar; + int from; + int to; +}; + +class RenameMenuCommand : public Command +{ +public: + RenameMenuCommand( const QString &n, + FormWindow *fw, + MenuBarEditor *m, + QString nm, + MenuBarEditorItem *i ); + void execute(); + void unexecute(); + Type type() const { return RenameMenu; } + static QString makeLegal( const QString &str ); +private: + MenuBarEditor *bar; + MenuBarEditorItem *item; + QString newName; + QString oldName; +}; + +class AddToolBoxPageCommand : public Command +{ +public: + AddToolBoxPageCommand( const QString &n, FormWindow *fw, + QToolBox *tw, const QString &label ); + + void execute(); + void unexecute(); + Type type() const { return AddToolBoxPage; } + +private: + QToolBox *toolBox; + int index; + QWidget *toolBoxPage; + QString toolBoxLabel; + +}; + +class DeleteToolBoxPageCommand : public Command +{ +public: + DeleteToolBoxPageCommand( const QString &n, FormWindow *fw, + QToolBox *tw, QWidget *page ); + + void execute(); + void unexecute(); + Type type() const { return DeleteToolBoxPage; } + +private: + QToolBox *toolBox; + int index; + QWidget *toolBoxPage; + QString toolBoxLabel; + +}; + +#endif diff --git a/kdevdesigner/designer/configtoolboxdialog.ui b/kdevdesigner/designer/configtoolboxdialog.ui new file mode 100644 index 00000000..ac19357b --- /dev/null +++ b/kdevdesigner/designer/configtoolboxdialog.ui @@ -0,0 +1,326 @@ + +ConfigToolboxDialog +********************************************************************* +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ConfigToolboxDialog + + + + 0 + 0 + 403 + 467 + + + + Configure Toolbox + + + + unnamed + + + + Layout2 + + + + unnamed + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 342 + 0 + + + + + + PushButton3 + + + &OK + + + true + + + + + PushButton4 + + + &Cancel + + + + + + + Layout4 + + + + unnamed + + + + buttonAdd + + + false + + + &Add + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 111 + 0 + + + + + + + Available Tools + + + true + + + true + + + + listViewTools + + + Extended + + + LastColumn + + + + + + + Layout5 + + + + unnamed + + + + buttonRemove + + + false + + + &Remove + + + + + + Common Widgets Page + + + true + + + true + + + + listViewCommon + + + Extended + + + LastColumn + + + + + buttonDown + + + false + + + + + + "designer_s_down.png" + + + + + Spacer4 + + + Horizontal + + + Expanding + + + + 41 + 0 + + + + + + buttonUp + + + false + + + + + + "designer_s_up.png" + + + + + + + + + buttonAdd + clicked() + ConfigToolboxDialog + addTool() + + + buttonRemove + clicked() + ConfigToolboxDialog + removeTool() + + + buttonUp + clicked() + ConfigToolboxDialog + moveToolUp() + + + buttonDown + clicked() + ConfigToolboxDialog + moveToolDown() + + + listViewTools + clicked(QListViewItem*) + ConfigToolboxDialog + currentToolChanged(QListViewItem*) + + + listViewCommon + clicked(QListViewItem*) + ConfigToolboxDialog + currentCommonToolChanged(QListViewItem*) + + + PushButton3 + clicked() + ConfigToolboxDialog + accept() + + + PushButton4 + clicked() + ConfigToolboxDialog + reject() + + + PushButton3 + clicked() + ConfigToolboxDialog + ok() + + + listViewTools + doubleClicked(QListViewItem*) + ConfigToolboxDialog + addTool() + + + + configtoolboxdialog.ui.h + + + addTool() + removeTool() + moveToolUp() + moveToolDown() + currentToolChanged( QListViewItem * i ) + currentCommonToolChanged( QListViewItem * i ) + ok() + + + init() + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/configtoolboxdialog.ui.h b/kdevdesigner/designer/configtoolboxdialog.ui.h new file mode 100644 index 00000000..6b5d55b6 --- /dev/null +++ b/kdevdesigner/designer/configtoolboxdialog.ui.h @@ -0,0 +1,215 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "mainwindow.h" +#include "widgetaction.h" +#include "listviewdnd.h" +#include + +void ConfigToolboxDialog::init() +{ + listViewTools->setSorting( -1 ); + listViewCommon->setSorting( -1 ); + + ListViewDnd *toolsDnd = new ListViewDnd( listViewTools ); + toolsDnd->setDragMode( ListViewDnd::External | ListViewDnd::NullDrop | ListViewDnd::Flat ); + + ListViewDnd *commonDnd = new ListViewDnd( listViewCommon ); + commonDnd->setDragMode( ListViewDnd::Both | ListViewDnd::Move | ListViewDnd::Flat ); + + QObject::connect( toolsDnd, SIGNAL( dropped( QListViewItem * ) ), + commonDnd, SLOT( confirmDrop( QListViewItem * ) ) ); + QObject::connect( commonDnd, SIGNAL( dropped( QListViewItem * ) ), + commonDnd, SLOT( confirmDrop( QListViewItem * ) ) ); + + QDict groups; + QAction *a; + for ( a = MainWindow::self->toolActions.last(); + a; + a = MainWindow::self->toolActions.prev() ) { + QString grp = ( (WidgetAction*)a )->group(); + QListViewItem *parent = groups.find( grp ); + if ( !parent ) { + parent = new QListViewItem( listViewTools ); + parent->setText( 0, grp ); + parent->setOpen( TRUE ); + groups.insert( grp, parent ); + } + QListViewItem *i = new QListViewItem( parent ); + i->setText( 0, a->text() ); + i->setPixmap( 0, a->iconSet().pixmap() ); + } + for ( a = MainWindow::self->commonWidgetsPage.last(); a; + a = MainWindow::self->commonWidgetsPage.prev() ) { + QListViewItem *i = new QListViewItem( listViewCommon ); + i->setText( 0, a->text() ); + i->setPixmap( 0, a->iconSet().pixmap() ); + } + +} + + +void ConfigToolboxDialog::addTool() +{ + QListView *src = listViewTools; + + bool addKids = FALSE; + QListViewItem *nextSibling = 0; + QListViewItem *nextParent = 0; + QListViewItemIterator it = src->firstChild(); + for ( ; *it; it++ ) { + // Hit the nextSibling, turn of child processing + if ( (*it) == nextSibling ) + addKids = FALSE; + + if ( (*it)->isSelected() ) { + if ( (*it)->childCount() == 0 ) { + // Selected, no children + QListViewItem *i = new QListViewItem( listViewCommon, listViewCommon->lastItem() ); + i->setText( 0, (*it)->text(0) ); + i->setPixmap( 0, *((*it)->pixmap(0)) ); + listViewCommon->setCurrentItem( i ); + listViewCommon->ensureItemVisible( i ); + } else if ( !addKids ) { + // Children processing not set, so set it + // Also find the item were we shall quit + // processing children...if any such item + addKids = TRUE; + nextSibling = (*it)->nextSibling(); + nextParent = (*it)->parent(); + while ( nextParent && !nextSibling ) { + nextSibling = nextParent->nextSibling(); + nextParent = nextParent->parent(); + } + } + } else if ( ((*it)->childCount() == 0) && addKids ) { + // Leaf node, and we _do_ process children + QListViewItem *i = new QListViewItem( listViewCommon, listViewCommon->lastItem() ); + i->setText( 0, (*it)->text(0) ); + i->setPixmap( 0, *((*it)->pixmap(0)) ); + listViewCommon->setCurrentItem( i ); + listViewCommon->ensureItemVisible( i ); + } + } +} + + +void ConfigToolboxDialog::removeTool() +{ + QListViewItemIterator it = listViewCommon->firstChild(); + while ( *it ) { + if ( (*it)->isSelected() ) + delete (*it); + else + it++; + } +} + + +void ConfigToolboxDialog::moveToolUp() +{ + QListViewItem *next = 0; + QListViewItem *item = listViewCommon->firstChild(); + for ( int i = 0; i < listViewCommon->childCount(); ++i ) { + next = item->itemBelow(); + if ( item->isSelected() && (i > 0) && !item->itemAbove()->isSelected() ) + item->itemAbove()->moveItem( item ); + item = next; + } +} + + +void ConfigToolboxDialog::moveToolDown() +{ + int count = listViewCommon->childCount(); + QListViewItem *next = 0; + QListViewItem *item = listViewCommon->lastItem(); + for ( int i = 0; i < count; ++i ) { + next = item->itemAbove(); + if ( item->isSelected() && (i > 0) && !item->itemBelow()->isSelected() ) + item->moveItem( item->itemBelow() ); + item = next; + } + + // QListViewItem *item = listViewCommon->firstChild(); + // for ( int i = 0; i < listViewCommon->childCount(); ++i ) { + //if ( item == listViewCommon->currentItem() ) { + // item->moveItem( item->itemBelow() ); + // currentCommonToolChanged( item ); + // break; + //} + //item = item->itemBelow(); + // } +} + + +void ConfigToolboxDialog::currentToolChanged( QListViewItem *i ) +{ + bool canAdd = FALSE; + QListViewItemIterator it = listViewTools->firstChild(); + for ( ; *it; it++ ) { + if ( (*it)->isSelected() ) { + canAdd = TRUE; + break; + } + } + buttonAdd->setEnabled( canAdd || ( i && i->isSelected() ) ); +} + + +void ConfigToolboxDialog::currentCommonToolChanged( QListViewItem *i ) +{ + buttonUp->setEnabled( (bool) (i && i->itemAbove()) ); + buttonDown->setEnabled( (bool) (i && i->itemBelow()) ); + + bool canRemove = FALSE; + QListViewItemIterator it = listViewCommon->firstChild(); + for ( ; *it; it++ ) { + if ( (*it)->isSelected() ) { + canRemove = TRUE; + break; + } + } + buttonRemove->setEnabled( canRemove || ( i && i->isSelected() ) ); +} + + +void ConfigToolboxDialog::ok() +{ + MainWindow::self->commonWidgetsPage.clear(); + QListViewItem *item = listViewCommon->firstChild(); + for ( int j = 0; j < listViewCommon->childCount(); item = item->itemBelow(), ++j ) { + QAction *a = 0; + for ( a = MainWindow::self->toolActions.last(); + a; + a = MainWindow::self->toolActions.prev() ) { + if ( a->text() == item->text( 0 ) ) + break; + } + if ( a ) + MainWindow::self->commonWidgetsPage.insert( j, a ); + } +} diff --git a/kdevdesigner/designer/connectiondialog.ui b/kdevdesigner/designer/connectiondialog.ui new file mode 100644 index 00000000..c8cc9c4f --- /dev/null +++ b/kdevdesigner/designer/connectiondialog.ui @@ -0,0 +1,219 @@ + +ConnectionDialog +********************************************************************* +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ConnectionDialog + + + + 0 + 0 + 600 + 365 + + + + View & Edit Connections + + + + unnamed + + + 11 + + + 6 + + + + PushButton1 + + + &New + + + + + TextLabel1 + + + + 5 + 4 + 0 + 0 + + + + &Connections: + + + connectionsTable + + + + + PushButton2 + + + &Delete + + + + + PushButton3 + + + &Cancel + + + + + PushButton7 + + + &OK + + + true + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + buttonEditSlots + + + &Edit Slots... + + + + + connectionsTable + + + + + + + ConnectionTable +
      connectiontable.h
      + + 50 + 50 + + 0 + + 7 + 7 + 0 + 0 + + "image0" +
      +
      + + + 789c9597c972e3480e40eff5158ec2ada203cd3549c6c41cbcc9b6bccabbddd1078014bdcb9b6449ee987f9f240072caac9e4357d6c1cf5812890490f4ef3f562e8ff6577efcfeed7d4ad3bb72a5bca5b7951fd5ece969f9c79ffffeebdbf7285a69fec7f14af4fdb76fdf47d39572e5e079326e00c10304f24ff8b9c7d463ee71d9e3aac7e31ed70d67dc2ce1cb9e7cd0e3c957863eaff778d4b3bfe8c97be781a71eaff5f8e82bf37ecfff4dc314364b58fdb966096ff6ecf77af6b70d1771b3841f1b8ef366099ff7ec17bdf8faf7970847cd12f9b2e344f8b563890f5e3a96fda0ea98c45fdc71299c765c354c67c249bb1fcd3a56ff271d8b3d9d1b271a0f1d742c725874acfe9d70eef3a9f65bc2e47fa3f16a7d55411d6a3e4e1b0e03bf349e8171144a7e49ceeb295239cb79c3384ccdff76c7b23f14c269e8ccdfa9716ef6b5b18f407857d88585e57bbf65b39f18971a0fc8fd7b6fc624f723e524f9e3d2b8d4f391d49ba74ae5bed585a3c8e49b1d6b7c929f701ca5e65feac10b9dd967c2519485a9dcaf33ce952110cea3caec23e53830f9863045b5ca79ae1c8741263cec58eb59ed390ecd3e378e8d651e44651c85527f20f51cd55eae5c1b27a1f823b9bf388c0b65b831a6b090fd24be384bc24098a6d65fb5ca29ed58fd5f35eccbaf34ff320f922819ab3e487e93d4b3d6eb9b711d4abda0f44352a685d5f39d709db2ca296c380dd2c238366ee5605c1acb3c96f2d3feff148ed25aeb0d1e955d60fd22f94a63178632df79d5d8fa95971d8b9cee5b8e647ec1d038567b40e1a4d567a9d73475b1f14ecb5a7f2cf94a9d4b343eba304e357e3814ce5c6afd22f33b2d5c6ee7295bb6fc4abda4e40af3f7d972a4f52df79bb223ebff79cb2a2736e650ce470fc2652b67b9cfb4726dff5d195776bead96adbf1e3bd67a9779928ebbfdc898357f34346ee7c3a0658d07359eba5922d7fbaebd3fdd6f6e3c567d96f9e4c22cb4780a63eb7f90f7c525596cf11c1a2791ce9bd8d869bd93e4dba55eaeefc781b1dd17ee1b9b3e4b3e9dcbfcc4107f9fc671a4ef9dcc139765763fa4f6943965947a7355b3c45eceebc65965fb851deb79655e662ecfcddf93716172999759966791f67f689ceb79e9a363951f1b9b3d1e76acf36fcf98544e529fdebc954b3f67d42ce1eb86f3465df3fb2e5c14a5d53b2b53a0f316773ad6f922f32c2fa9cd9fdc6f5e79d6f8768d13ebc79d96559fe47dcd6b8a63cdcfbb71126bfcd21f45e0f5f57dbb357691c63f342e2cbea063d597f7b808c9e6151e1993c573d1b2de0fc8fd1711151a1fdf187324f393671debfe92df22a134d67e93fb2a1cd93c05630ef4fe48f25d641c683de2b171a8f399ef3a56f989b1bd273c6dd9f697f7bcc85b7dca8da348be4f41fabf2838b1f7e9cc38d5f715e4fd2888439b9f53639ba72cf55a701b3f0c8cad3ff9de38b57c4bfd15a5678d6f646cfd87857166ef95f46b51f9fdf57c609cda7b756edcbee7ceb850a671c7faf7809e7fccb9d63b6c1b93d5f7ac63d5d7fcd41c245a8fabc685e68f1f8c49ef93e5bda4c0fbd7f9b16b4c5a9ff060ccf63e4b3d52c889c6433bc685da33195bbfc2bd31dbfc947aa5982bf37fddb1c623f39c7cbbda7c94f889cac4ea4df24f55c9367fe43da47159da3c907ea39ac74ebfdfe5fe39e0dac9f71f4abed87fb02993d42b475562effb5dcb36ff243fec3f3f327d4fd1384db5ffd68c9db1bc579cb6faf8619cdafe321f39f39f33721fb46bec4cfe699c19cf3bd6f3ad1ae7c6f2de71ce2549fe71a9dcc917c685324b7eb8aac6767ff27dc763cf92afd1b4590848c8586285e3deaafc6fd94b61346df5b1c61bbcc53bbcff9bf5808ff884136ff5acfadef70dbee02bbee13b4e71861f38c7052ef1d3af555cc375dcc04d1c6069fae47dbfe2166ee30e0e7117f7701f0ff0108f7084c77882a77886e7788197a6cf3e922baf7d8d018618618c895f293acc30c702478000403831fdd247f90e8c019450610c63a8e1066efd4f15dcc13d3cc0a3d77f8256bff2fa531cc233bcc02bbcc13b4c61061f3087052ce11356c5ff1aac9bfed8ebcf701736bc741306b005dbb00343d8853def611f0ee0d0eb1fc1e827fd0f38861338f5becfe01c2ee0d26b5ec13504de4708d12ffa7388bd2481141c64907bed020f0909604944fc8bfe924a4ca8a231d5e2fb956ee896eee8deeb3fd0e32ffa0b7ac29426f041fed4f442afdee28dde694a33faa0f9aff1d0829618d327add21aadd3066dfafd06b445dbb443c3be3eedd21eed7bfd033aa4231ad1319dd0299dd1395dd0255dfd8dff6b0a28c4042af27fcc907fafc879ed73ff199053f145bfc207463c666062e6d2dfd9d2db2db9a20b1e73cd377cfbe5be4a5fb1eb7cc7f7fcc08ffcc4137ee6177ee5377ee729cff883e7bcf8a91ed8d7f7069ef1923f7995d7789d37789307bc4557bccd3b3ce45ddefba9defc4fbebecfe1fffce305eff1fe4ff50c3ea2015e00f93dd7fcb9beae35ff5bf2da5dbf788b676f71891398c03a8c7a6b1d267effcbfff5e33fe8f7fffcebdb7f01520e2ea3 + + + + + PushButton1 + clicked() + ConnectionDialog + addConnection() + + + PushButton7 + clicked() + ConnectionDialog + okClicked() + + + PushButton3 + clicked() + ConnectionDialog + cancelClicked() + + + PushButton2 + clicked() + ConnectionDialog + deleteClicked() + + + buttonEditSlots + clicked() + ConnectionDialog + editSlots() + + + + qptrlist.h + connectionitems.h + connectiondialog.ui.h + + + QPtrList<ConnectionContainer> connections; + QObject *defaultSender; + QObject *defaultReceiver; + + + init() + addConnection() + addConnection( QObject * sender, QObject * receiver, const QString & signal, const QString & slot ) + updateConnectionState( ConnectionContainer * c ) + okClicked() + cancelClicked() + deleteClicked() + editSlots() + setDefault( QObject * sender, QObject * receiver ) + updateEditSlotsButton() + updateConnectionContainers() + ensureConnectionVisible() + + +
      diff --git a/kdevdesigner/designer/connectiondialog.ui.h b/kdevdesigner/designer/connectiondialog.ui.h new file mode 100644 index 00000000..3c6cd932 --- /dev/null +++ b/kdevdesigner/designer/connectiondialog.ui.h @@ -0,0 +1,318 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + +#include "mainwindow.h" +#include "formwindow.h" +#include "editfunctionsimpl.h" + +static const char *valid_connection[] = { + "16 14 7 1", + ". c none", + "# c #00c000", + "a c #008000", + "b c #004000", + "c c #000000", + "d c #c0fcc0", + "e c #400000", + "...............d", + "..............d#", + ".............d#a", + "............d#ab", + "...........d#abc", + "..da......d#abc.", + ".d##a....d#abe..", + "cba##a..d#abc...", + ".cba##ad#abe....", + "..eba###abe.....", + "...cba#abc......", + "....cbabc.......", + ".....cec........", + "................" +}; + +static const char * invalid_connection[] = { + "17 18 7 1", + " c None", + ". c #000000", + "+ c #C3C3C3", + "@ c #FFFFFF", + "# c #C00000", + "$ c #FFC0C0", + "% c #FF0000", + " ", + " . ", + " ... ", + " .+.. ", + " ...+@+.. ", + "..+@@@+#.. ", + ".@@@@$#%#.. ", + ".@@$$#%##.. ", + " .$%%%##.... ", + " .%%%##. .. ", + " .%#.. .. ", + " .. .. ", + " .. ", + " .. ", + " .. ", + " .. ", + " ", + " " +}; + +static QPixmap *invalidConnection = 0; +static QPixmap *validConnection = 0; + +void ConnectionDialog::init() +{ + connect( connectionsTable, SIGNAL( currentChanged( int, int ) ), + this, SLOT( updateEditSlotsButton() ) ); + connect( connectionsTable, SIGNAL( resorted() ), + this, SLOT( updateConnectionContainers() ) ); + buttonEditSlots->setEnabled( FALSE ); + + if ( !invalidConnection ) { + invalidConnection = new QPixmap( invalid_connection ); + validConnection = new QPixmap( valid_connection ); + } + + QValueList conns = + MetaDataBase::connections( MainWindow::self->formWindow() ); + for ( QValueList::Iterator it = conns.begin(); + it != conns.end(); ++it ) { + ConnectionContainer *c = addConnection( (*it).sender, (*it).receiver, + (*it).signal, (*it).slot ); + c->setModified( FALSE ); + updateConnectionState( c ); + } + + defaultSender = defaultReceiver = 0; + connectionsTable->setCurrentCell( 0, 0 ); +} + +void ConnectionDialog::addConnection() +{ + addConnection( defaultSender, defaultReceiver, QString::null, QString::null ); + ensureConnectionVisible(); +} + +ConnectionContainer *ConnectionDialog::addConnection( QObject *sender, QObject *receiver, + const QString &signal, + const QString &slot ) +{ + connectionsTable->insertRows( connectionsTable->numRows() ); + + int row = connectionsTable->numRows() - 1; + SenderItem *se; + SignalItem *si; + ReceiverItem *re; + SlotItem *sl; + connectionsTable->setItem( row, 0, + ( se = new SenderItem( connectionsTable, + MainWindow::self->formWindow() ) ) ); + connectionsTable->setItem( row, 1, + ( si = new SignalItem( connectionsTable, + MainWindow::self->formWindow() ) ) ); + connectionsTable->setItem( row, 2, + ( re = new ReceiverItem( connectionsTable, + MainWindow::self->formWindow() ) ) ); + connectionsTable->setItem( row, 3, + ( sl = new SlotItem( connectionsTable, + MainWindow::self->formWindow() ) ) ); + + si->setSender( se ); + re->setSender( se ); + sl->setSender( se ); + se->setSender( se ); + + se->setSignal( si ); + re->setSignal( si ); + sl->setSignal( si ); + si->setSignal( si ); + + se->setReceiver( re ); + si->setReceiver( re ); + sl->setReceiver( re ); + re->setReceiver( re ); + + se->setSlot( sl ); + si->setSlot( sl ); + re->setSlot( sl ); + sl->setSlot( sl ); + + connect( re, SIGNAL( currentReceiverChanged( QObject * ) ), + this, SLOT( updateEditSlotsButton() ) ); + + ConnectionContainer *c = new ConnectionContainer( this, se, si, re, sl, row ); + connections.append( c ); + connect( c, SIGNAL( changed( ConnectionContainer * ) ), + this, SLOT( updateConnectionState( ConnectionContainer * ) ) ); + + connectionsTable->setCurrentCell( row, 0 ); + + connectionsTable->verticalHeader()->setLabel( row, *invalidConnection, QString::null ); + + if ( sender ) + se->setSenderEx( sender ); + defaultSender = sender; + if ( receiver ) + re->setReceiverEx( receiver ); + defaultReceiver = receiver; + + if ( !signal.isEmpty() && !slot.isEmpty() ) { + si->setCurrentItem( signal ); + sl->signalChanged( signal ); + sl->setCurrentItem( slot ); + } + + c->setModified( TRUE ); + return c; +} + +void ConnectionDialog::updateConnectionState( ConnectionContainer *c ) +{ + c->repaint(); + if ( c->isValid() ) + connectionsTable->verticalHeader()->setLabel( c->row(), + *validConnection, QString::null ); + else + connectionsTable->verticalHeader()->setLabel( c->row(), + *invalidConnection, QString::null ); +} + + +void ConnectionDialog::okClicked() +{ + QValueList oldConnections = + MetaDataBase::connections( MainWindow::self->formWindow() ); + QPtrList newConnectionCmds; + QPtrList oldConnectionCmds; + for ( ConnectionContainer *c = connections.first(); c; c = connections.next() ) { + MetaDataBase::Connection conn; + + // find sender widget + conn.sender = MainWindow::self->formWindow()->child( c->senderItem()->currentText() ); + if ( !conn.sender ) // if no sender widget, find sender action + conn.sender = MainWindow::self->formWindow()->findAction( c->senderItem()->currentText() ); + + // find receiver widget + conn.receiver = MainWindow::self->formWindow()->child( c->receiverItem()->currentText() ); + if ( !conn.receiver ) // if no receiver widget, find receiver action + conn.receiver = MainWindow::self->formWindow()->findAction( c->receiverItem()->currentText() ); + + conn.signal = c->signalItem()->currentText(); + conn.slot = c->slotItem()->currentText(); + AddConnectionCommand *cmd = new AddConnectionCommand( i18n( "Add Signal/Slot " + "Connection" ), + MainWindow::self->formWindow(), + conn ); + newConnectionCmds.append( cmd ); + } + + + QValueList conns = + MetaDataBase::connections( MainWindow::self->formWindow() ); + for ( QValueList::Iterator it = conns.begin(); + it != conns.end(); ++it ) { + RemoveConnectionCommand *cmd = new RemoveConnectionCommand( i18n( "Remove Signal/Slot " + "Connection" ), + MainWindow::self-> + formWindow(), *it ); + oldConnectionCmds.append( cmd ); + } + + MacroCommand *cmd1 = new MacroCommand( i18n( "Add Signal/Slot Connections" ), + MainWindow::self->formWindow(), + newConnectionCmds ); + MacroCommand *cmd2 = new MacroCommand( i18n( "Remove Signal/Slot Connections" ), + MainWindow::self->formWindow(), + oldConnectionCmds ); + QPtrList cmds; + cmds.append( cmd2 ); + cmds.append( cmd1 ); + MacroCommand *cmd = new MacroCommand( i18n( "Edit Signal/Slot Connections" ), + MainWindow::self->formWindow(), + cmds ); + MainWindow::self->formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + + accept(); +} + + +void ConnectionDialog::cancelClicked() +{ + reject(); +} + + +void ConnectionDialog::deleteClicked() +{ + int cr = connectionsTable->currentRow(); + connections.remove( cr ); + connectionsTable->removeRow( cr ); + int i = 0; + for ( ConnectionContainer *c = connections.first(); c; c = connections.next() ) + c->setRow( i++ ); +} + + +void ConnectionDialog::editSlots() +{ + EditFunctions dlg( this, MainWindow::self->formWindow(), TRUE ); + dlg.exec(); + int currentCol = connectionsTable->currentColumn(); + connectionsTable->setCurrentCell( connectionsTable->currentRow(), 0 ); + for ( ConnectionContainer *c = connections.first(); c; c = connections.next() ) { + if ( c->receiverItem()->currentText() != + QString( MainWindow::self->formWindow()->mainContainer()->name() ) ) + continue; + c->slotItem()->customSlotsChanged(); + } + connectionsTable->setCurrentCell( connectionsTable->currentRow(), currentCol ); +} + +void ConnectionDialog::setDefault( QObject *sender, QObject *receiver ) +{ + defaultSender = sender; + defaultReceiver = receiver; +} + +void ConnectionDialog::updateEditSlotsButton() +{ + if ( connectionsTable->currentRow() < 0 || + connectionsTable->currentRow() > (int)connections.count() - 1 ) + return; + ConnectionContainer *c = connections.at( connectionsTable->currentRow() ); + if ( !c || !c->receiverItem() ) + return; + buttonEditSlots->setEnabled( c->receiverItem()->currentText() == + QString( MainWindow::self->formWindow()-> + mainContainer()->name() ) ); +} + +void ConnectionDialog::updateConnectionContainers() +{ + QPtrList newContainers; + for ( int i = 0; i < connectionsTable->numRows(); ++i ) { + for ( ConnectionContainer *c = connections.first(); c; c = connections.next() ) { + if ( c->senderItem() == connectionsTable->item( i, 0 ) ) { + newContainers.append( c ); + c->setRow( i ); + updateConnectionState(c); + break; + } + } + } + connections = newContainers; + updateEditSlotsButton(); +} + +void ConnectionDialog::ensureConnectionVisible() +{ + connectionsTable->ensureCellVisible( connectionsTable->numRows() - 1, 0 ); +} diff --git a/kdevdesigner/designer/connectionitems.cpp b/kdevdesigner/designer/connectionitems.cpp new file mode 100644 index 00000000..197eef65 --- /dev/null +++ b/kdevdesigner/designer/connectionitems.cpp @@ -0,0 +1,517 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "connectionitems.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "metadatabase.h" +#include "widgetfactory.h" +#include "project.h" +#include +#include +#include +#include +#include +#include +#include + +static const char* const ignore_slots[] = { + "destroyed()", + "setCaption(const QString&)", + "setIcon(const QPixmap&)", + "setIconText(const QString&)", + "setMouseTracking(bool)", + "clearFocus()", + "setUpdatesEnabled(bool)", + "update()", + "update(int,int,int,int)", + "update(const QRect&)", + "repaint()", + "repaint(bool)", + "repaint(int,int,int,int,bool)", + "repaint(const QRect&,bool)", + "repaint(const QRegion&,bool)", + "show()", + "hide()", + "iconify()", + "showMinimized()", + "showMaximized()", + "showFullScreen()", + "showNormal()", + "polish()", + "constPolish()", + "raise()", + "lower()", + "stackUnder(QWidget*)", + "move(int,int)", + "move(const QPoint&)", + "resize(int,int)", + "resize(const QSize&)", + "setGeometry(int,int,int,int)", + "setGeometry(const QRect&)", + "focusProxyDestroyed()", + "showExtension(bool)", + "setUpLayout()", + "showDockMenu(const QPoint&)", + "init()", + "destroy()", + "deleteLater()", + 0 +}; + +ConnectionItem::ConnectionItem( QTable *table, FormWindow *fw ) + : QComboTableItem( table, QStringList(), FALSE ), formWindow( fw ), conn( 0 ) +{ + setReplaceable( FALSE ); +} + +void ConnectionItem::senderChanged( QObject * ) +{ + emit changed(); + QWidget *w = table()->cellWidget( row(), col() ); + if ( w ) + setContentFromEditor( w ); +} + +void ConnectionItem::receiverChanged( QObject * ) +{ + emit changed(); + QWidget *w = table()->cellWidget( row(), col() ); + if ( w ) + setContentFromEditor( w ); +} + +void ConnectionItem::signalChanged( const QString & ) +{ + emit changed(); + QWidget *w = table()->cellWidget( row(), col() ); + if ( w ) + setContentFromEditor( w ); +} + +void ConnectionItem::slotChanged( const QString & ) +{ + emit changed(); + QWidget *w = table()->cellWidget( row(), col() ); + if ( w ) + setContentFromEditor( w ); +} + +void ConnectionItem::setSender( SenderItem *i ) +{ + connect( i, SIGNAL( currentSenderChanged( QObject * ) ), + this, SLOT( senderChanged( QObject * ) ) ); +} + +void ConnectionItem::setReceiver( ReceiverItem *i ) +{ + connect( i, SIGNAL( currentReceiverChanged( QObject * ) ), + this, SLOT( receiverChanged( QObject * ) ) ); +} + +void ConnectionItem::setSignal( SignalItem *i ) +{ + connect( i, SIGNAL( currentSignalChanged( const QString & ) ), + this, SLOT( signalChanged( const QString & ) ) ); +} + +void ConnectionItem::setSlot( SlotItem *i ) +{ + connect( i, SIGNAL( currentSlotChanged( const QString & ) ), + this, SLOT( slotChanged( const QString & ) ) ); +} + +void ConnectionItem::paint( QPainter *p, const QColorGroup &cg, + const QRect &cr, bool selected ) +{ + p->fillRect( 0, 0, cr.width(), cr.height(), + selected ? cg.brush( QColorGroup::Highlight ) + : cg.brush( QColorGroup::Base ) ); + + int w = cr.width(); + int h = cr.height(); + + int x = 0; + + if ( currentText()[0] == '<' ) + p->setPen( QObject::red ); + else if ( selected ) + p->setPen( cg.highlightedText() ); + else + p->setPen( cg.text() ); + + QFont f( p->font() ); + QFont oldf( p->font() ); + if ( conn && conn->isModified() ) { + f.setBold( TRUE ); + p->setFont( f ); + } + + p->drawText( x + 2, 0, w - x - 4, h, alignment(), currentText() ); + p->setFont( oldf ); +} + +void ConnectionItem::setConnection( ConnectionContainer *c ) +{ + conn = c; +} + +// ------------------------------------------------------------------ + +static void appendChildActions( QAction *action, QStringList &lst ) +{ + QObjectListIt it( *action->children() ); + while ( it.current() ) { + QObject *o = it.current(); + ++it; + if ( !::qt_cast(o) ) + continue; + lst << o->name(); + if ( o->children() && ::qt_cast(o) ) + appendChildActions( (QAction*)o, lst ); + } +} + +static QStringList flatActions( const QPtrList &l ) +{ + QStringList lst; + + QPtrListIterator it( l ); + while ( it.current() ) { + QAction *action = it.current(); + lst << action->name(); + if ( action->children() && ::qt_cast(action) ) + appendChildActions( action, lst ); + ++it; + } + + return lst; +} + +// ------------------------------------------------------------------ + +SenderItem::SenderItem( QTable *table, FormWindow *fw ) + : ConnectionItem( table, fw ) +{ + QStringList lst; + + QPtrDictIterator it( *formWindow->widgets() ); + while ( it.current() ) { + if ( lst.find( it.current()->name() ) != lst.end() ) { + ++it; + continue; + } + if ( !QString( it.current()->name() ).startsWith( "qt_dead_widget_" ) && + !::qt_cast(it.current()) && + !::qt_cast(it.current()) && + !::qt_cast(it.current()) && + qstrcmp( it.current()->name(), "central widget" ) != 0 ) { + lst << it.current()->name(); + } + ++it; + } + + lst += flatActions( formWindow->actionList() ); + + lst.prepend( "" ); + lst.sort(); + setStringList( lst ); +} + +QWidget *SenderItem::createEditor() const +{ + QComboBox *cb = (QComboBox*)ConnectionItem::createEditor(); + cb->listBox()->setMinimumWidth( cb->fontMetrics().width( "01234567890123456789012345678901234567890123456789" ) ); + connect( cb, SIGNAL( activated( const QString & ) ), + this, SLOT( senderChanged( const QString & ) ) ); + return cb; +} + +void SenderItem::setSenderEx( QObject *sender ) +{ + setCurrentItem( sender->name() ); + emit currentSenderChanged( sender ); +} + +void SenderItem::senderChanged( const QString &sender ) +{ + QObject *o = formWindow->child( sender, "QObject" ); + if ( !o ) + o = formWindow->findAction( sender ); + if ( !o ) + return; + emit currentSenderChanged( o ); +} + + + +// ------------------------------------------------------------------ + +ReceiverItem::ReceiverItem( QTable *table, FormWindow *fw ) + : ConnectionItem( table, fw ) +{ + QStringList lst; + + QPtrDictIterator it( *formWindow->widgets() ); + while ( it.current() ) { + if ( lst.find( it.current()->name() ) != lst.end() ) { + ++it; + continue; + } + if ( !QString( it.current()->name() ).startsWith( "qt_dead_widget_" ) && + !::qt_cast(it.current()) && + !::qt_cast(it.current()) && + !::qt_cast(it.current()) && + qstrcmp( it.current()->name(), "central widget" ) != 0 ) { + lst << it.current()->name(); + } + ++it; + } + + lst += flatActions( formWindow->actionList() ); + + lst.prepend( "" ); + lst.sort(); + setStringList( lst ); +} + +QWidget *ReceiverItem::createEditor() const +{ + QComboBox *cb = (QComboBox*)ConnectionItem::createEditor(); + cb->listBox()->setMinimumWidth( cb->fontMetrics().width( "01234567890123456789012345678901234567890123456789" ) ); + connect( cb, SIGNAL( activated( const QString & ) ), + this, SLOT( receiverChanged( const QString & ) ) ); + return cb; +} + +void ReceiverItem::setReceiverEx( QObject *receiver ) +{ + setCurrentItem( receiver->name() ); + emit currentReceiverChanged( receiver ); +} + +void ReceiverItem::receiverChanged( const QString &receiver ) +{ + QObject *o = formWindow->child( receiver, "QObject" ); + if ( !o ) + o = formWindow->findAction( receiver ); + if ( !o ) + return; + emit currentReceiverChanged( o ); +} + + + +// ------------------------------------------------------------------ + +SignalItem::SignalItem( QTable *table, FormWindow *fw ) + : ConnectionItem( table, fw ) +{ + QStringList lst; + lst << ""; + lst.sort(); + setStringList( lst ); +} + +void SignalItem::senderChanged( QObject *sender ) +{ + QStrList sigs = sender->metaObject()->signalNames( TRUE ); + sigs.remove( "destroyed()" ); + sigs.remove( "destroyed(QObject*)" ); + sigs.remove( "accessibilityChanged(int)" ); + sigs.remove( "accessibilityChanged(int,int)" ); + + QStringList lst = QStringList::fromStrList( sigs ); + + if ( ::qt_cast(sender) ) { + MetaDataBase::CustomWidget *w = ( (CustomWidget*)sender )->customWidget(); + for ( QValueList::Iterator it = w->lstSignals.begin(); + it != w->lstSignals.end(); ++it ) + lst << MetaDataBase::normalizeFunction( *it ); + } + + if ( sender == formWindow->mainContainer() ) { + QStringList extra = MetaDataBase::signalList( formWindow ); + if ( !extra.isEmpty() ) + lst += extra; + } + + lst.prepend( "" ); + + lst.sort(); + setStringList( lst ); + + ConnectionItem::senderChanged( sender ); +} + +QWidget *SignalItem::createEditor() const +{ + QComboBox *cb = (QComboBox*)ConnectionItem::createEditor(); + cb->listBox()->setMinimumWidth( cb->fontMetrics().width( "01234567890123456789012345678901234567890123456789" ) ); + connect( cb, SIGNAL( activated( const QString & ) ), + this, SIGNAL( currentSignalChanged( const QString & ) ) ); + return cb; +} + +// ------------------------------------------------------------------ + +SlotItem::SlotItem( QTable *table, FormWindow *fw ) + : ConnectionItem( table, fw ) +{ + QStringList lst; + lst << ""; + lst.sort(); + setStringList( lst ); + + lastReceiver = 0; + lastSignal = ""; +} + +void SlotItem::receiverChanged( QObject *receiver ) +{ + lastReceiver = receiver; + updateSlotList(); + ConnectionItem::receiverChanged( receiver ); +} + +void SlotItem::signalChanged( const QString &signal ) +{ + lastSignal = signal; + updateSlotList(); + ConnectionItem::signalChanged( signal ); +} + +bool SlotItem::ignoreSlot( const char* slot ) const +{ +#ifndef QT_NO_SQL + if ( qstrcmp( slot, "update()" ) == 0 && + ::qt_cast(lastReceiver) ) + return FALSE; +#endif + + for ( int i = 0; ignore_slots[i]; i++ ) { + if ( qstrcmp( slot, ignore_slots[i] ) == 0 ) + return TRUE; + } + + if ( !formWindow->isMainContainer( (QWidget*)lastReceiver ) ) { + if ( qstrcmp( slot, "close()" ) == 0 ) + return TRUE; + } + + if ( qstrcmp( slot, "setFocus()" ) == 0 ) + if ( lastReceiver->isWidgetType() && + ( (QWidget*)lastReceiver )->focusPolicy() == QWidget::NoFocus ) + return TRUE; + + return FALSE; +} + +void SlotItem::updateSlotList() +{ + QStringList lst; + if ( !lastReceiver || lastSignal == "" ) { + lst << ""; + lst.sort(); + setStringList( lst ); + return; + } + + QString signal = MetaDataBase::normalizeFunction( lastSignal ); + int n = lastReceiver->metaObject()->numSlots( TRUE ); + QStringList slts; + + for( int i = 0; i < n; ++i ) { + // accept only public slots. For the form window, also accept protected slots + const QMetaData* md = lastReceiver->metaObject()->slot( i, TRUE ); + if ( ( (lastReceiver->metaObject()->slot( i, TRUE )->access == QMetaData::Public) || + (formWindow->isMainContainer( (QWidget*)lastReceiver ) && + lastReceiver->metaObject()->slot(i, TRUE)->access == + QMetaData::Protected) ) && + !ignoreSlot( md->name ) && + checkConnectArgs( signal.latin1(), lastReceiver, md->name ) ) + if ( lst.find( md->name ) == lst.end() ) + lst << MetaDataBase::normalizeFunction( md->name ); + } + + LanguageInterface *iface = + MetaDataBase::languageInterface( formWindow->project()->language() ); + if ( !iface || iface->supports( LanguageInterface::ConnectionsToCustomSlots ) ) { + if ( formWindow->isMainContainer( (QWidget*)lastReceiver ) ) { + QValueList moreSlots = MetaDataBase::slotList( formWindow ); + if ( !moreSlots.isEmpty() ) { + for ( QValueList::Iterator it = moreSlots.begin(); + it != moreSlots.end(); ++it ) { + QCString s = (*it).function; + if ( !s.data() ) + continue; + s = MetaDataBase::normalizeFunction( s ); + if ( checkConnectArgs( signal.latin1(), lastReceiver, s ) ) { + if ( lst.find( (*it).function ) == lst.end() ) + lst << s; + } + } + } + } + } + + if ( ::qt_cast(lastReceiver) ) { + MetaDataBase::CustomWidget *w = ( (CustomWidget*)lastReceiver )->customWidget(); + for ( QValueList::Iterator it = w->lstSlots.begin(); + it != w->lstSlots.end(); ++it ) { + QCString s = (*it).function; + if ( !s.data() ) + continue; + s = MetaDataBase::normalizeFunction( s ); + if ( checkConnectArgs( signal.latin1(), lastReceiver, s ) ) { + if ( lst.find( (*it).function ) == lst.end() ) + lst << s; + } + } + } + + lst.prepend( "" ); + lst.sort(); + setStringList( lst ); +} + +QWidget *SlotItem::createEditor() const +{ + QComboBox *cb = (QComboBox*)ConnectionItem::createEditor(); + cb->listBox()->setMinimumWidth( cb->fontMetrics().width( "01234567890123456789012345678901234567890123456789" ) ); + connect( cb, SIGNAL( activated( const QString & ) ), + this, SIGNAL( currentSlotChanged( const QString & ) ) ); + return cb; +} + +void SlotItem::customSlotsChanged() +{ + QString currSlot = currentText(); + updateSlotList(); + setCurrentItem( "" ); + setCurrentItem( currSlot ); + emit currentSlotChanged( currentText() ); +} diff --git a/kdevdesigner/designer/connectionitems.h b/kdevdesigner/designer/connectionitems.h new file mode 100644 index 00000000..2442e475 --- /dev/null +++ b/kdevdesigner/designer/connectionitems.h @@ -0,0 +1,220 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef CONNECTIONITEMS_H +#define CONNECTIONITEMS_H + +class FormWindow; + +#include + +class SenderItem; +class ReceiverItem; +class SignalItem; +class SlotItem; +class ConnectionContainer; + + +class ConnectionItem : public QObject, + public QComboTableItem +{ + Q_OBJECT + +public: + ConnectionItem( QTable *table, FormWindow *fw ); + + void paint( QPainter *p, const QColorGroup &cg, + const QRect &cr, bool selected ); + + void setSender( SenderItem *i ); + void setReceiver( ReceiverItem *i ); + void setSignal( SignalItem *i ); + void setSlot( SlotItem *i ); + void setConnection( ConnectionContainer *c ); + +public slots: + virtual void senderChanged( QObject *sender ); + virtual void receiverChanged( QObject *receiver ); + virtual void signalChanged( const QString &sig ); + virtual void slotChanged( const QString &slot ); + +signals: + void changed(); + +protected: + FormWindow *formWindow; + +private: + ConnectionContainer *conn; + +}; + +// ------------------------------------------------------------------ + +class SenderItem : public ConnectionItem +{ + Q_OBJECT + +public: + SenderItem( QTable *table, FormWindow *fw ); + QWidget *createEditor() const; + void setSenderEx( QObject *sender ); + +signals: + void currentSenderChanged( QObject *sender ); + +private slots: + void senderChanged( const QString &sender ); + +}; + +// ------------------------------------------------------------------ + +class ReceiverItem : public ConnectionItem +{ + Q_OBJECT + +public: + ReceiverItem( QTable *table, FormWindow *fw ); + QWidget *createEditor() const; + void setReceiverEx( QObject *receiver ); + +signals: + void currentReceiverChanged( QObject *receiver ); + +private slots: + void receiverChanged( const QString &receiver ); + +}; + +// ------------------------------------------------------------------ + +class SignalItem : public ConnectionItem +{ + Q_OBJECT + +public: + SignalItem( QTable *table, FormWindow *fw ); + + void senderChanged( QObject *sender ); + QWidget *createEditor() const; + +signals: + void currentSignalChanged( const QString & ); + +}; + +// ------------------------------------------------------------------ + +class SlotItem : public ConnectionItem +{ + Q_OBJECT + +public: + SlotItem( QTable *table, FormWindow *fw ); + + void receiverChanged( QObject *receiver ); + void signalChanged( const QString &signal ); + QWidget *createEditor() const; + + void customSlotsChanged(); + +signals: + void currentSlotChanged( const QString & ); + +private: + void updateSlotList(); + bool ignoreSlot( const char* slot ) const; + +private: + QObject *lastReceiver; + QString lastSignal; + +}; + +// ------------------------------------------------------------------ + +class ConnectionContainer : public QObject +{ + Q_OBJECT + +public: + ConnectionContainer( QObject *parent, SenderItem *i1, SignalItem *i2, + ReceiverItem *i3, SlotItem *i4, int r ) + : QObject( parent ), mod( FALSE ), se( i1 ), si( i2 ), + re( i3 ), sl( i4 ), rw ( r ) { + i1->setConnection( this ); + i2->setConnection( this ); + i3->setConnection( this ); + i4->setConnection( this ); + connect( i1, SIGNAL( changed() ), this, SLOT( somethingChanged() ) ); + connect( i2, SIGNAL( changed() ), this, SLOT( somethingChanged() ) ); + connect( i3, SIGNAL( changed() ), this, SLOT( somethingChanged() ) ); + connect( i4, SIGNAL( changed() ), this, SLOT( somethingChanged() ) ); + } + + bool isModified() const { return mod; } + void setModified( bool b ) { mod = b; repaint(); } + bool isValid() const { + return se->currentText()[0] != '<' && + si->currentText()[0] != '<' && + re->currentText()[0] != '<' && + sl->currentText()[0] != '<'; + } + + void repaint() { + se->table()->updateCell( se->row(), se->col() ); + si->table()->updateCell( si->row(), si->col() ); + re->table()->updateCell( re->row(), re->col() ); + sl->table()->updateCell( sl->row(), sl->col() ); + } + + int row() const { return rw; } + void setRow( int r ) { rw = r; } + + SenderItem *senderItem() const { return se; } + SignalItem *signalItem() const { return si; } + ReceiverItem *receiverItem() const { return re; } + SlotItem *slotItem() const { return sl; } + +public slots: + void somethingChanged() { mod = TRUE; emit changed( this ); } + +signals: + void changed( ConnectionContainer *c ); + +private: + bool mod; + SenderItem *se; + SignalItem *si; + ReceiverItem *re; + SlotItem *sl; + int rw; + +}; + + +#endif diff --git a/kdevdesigner/designer/connectiontable.cpp b/kdevdesigner/designer/connectiontable.cpp new file mode 100644 index 00000000..7fed1b07 --- /dev/null +++ b/kdevdesigner/designer/connectiontable.cpp @@ -0,0 +1,56 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "connectiontable.h" + +#include + +ConnectionTable::ConnectionTable( QWidget *parent, const char *name ) + : QTable( 0, 4, parent, name ) +{ + setSorting( TRUE ); + setShowGrid( FALSE ); + setFocusStyle( FollowStyle ); + setSelectionMode( SingleRow ); + horizontalHeader()->setLabel( 0, i18n( "Sender" ) ); + horizontalHeader()->setLabel( 1, i18n( "Signal" ) ); + horizontalHeader()->setLabel( 2, i18n( "Receiver" ) ); + horizontalHeader()->setLabel( 3, i18n( "Slot" ) ); + setColumnStretchable( 0, TRUE ); + setColumnStretchable( 1, TRUE ); + setColumnStretchable( 2, TRUE ); + setColumnStretchable( 3, TRUE ); +} + +void ConnectionTable::sortColumn( int col, bool ascending, bool ) +{ + horizontalHeader()->setSortIndicator( col, ascending ); + if ( isEditing() ) + endEdit( currEditRow(), currEditCol(), FALSE, FALSE ); + QTable::sortColumn( col, ascending, TRUE ); + setCurrentCell( 0, 0 ); + emit resorted(); +} diff --git a/kdevdesigner/designer/connectiontable.h b/kdevdesigner/designer/connectiontable.h new file mode 100644 index 00000000..288b544f --- /dev/null +++ b/kdevdesigner/designer/connectiontable.h @@ -0,0 +1,46 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef CONNECTIONTABLE_H +#define CONNECTIONTABLE_H + +#include + +class ConnectionTable : public QTable +{ + Q_OBJECT + +public: + ConnectionTable( QWidget *parent, const char *name ); + + void sortColumn( int col, bool ascending, bool wholeRows ); + +signals: + void resorted(); + +}; + +#endif diff --git a/kdevdesigner/designer/createtemplate.ui b/kdevdesigner/designer/createtemplate.ui new file mode 100644 index 00000000..761873cc --- /dev/null +++ b/kdevdesigner/designer/createtemplate.ui @@ -0,0 +1,195 @@ + +CreateTemplate +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + CreateTemplate + + + + 0 + 0 + 347 + 248 + + + + Create Template + + + true + + + + unnamed + + + 11 + + + 6 + + + + TextLabel1 + + + Template &name: + + + editName + + + + + editName + + + Name of the new template + + + Enter the name of the new template + + + + + listClass + + + Class of the new template + + + Enter the name of the class which should be used as the template's base class + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonCreate + + + C&reate + + + true + + + Creates the new template + + + + + PushButton1 + + + &Cancel + + + Closes the Dialog + + + + + + + TextLabel2 + + + &Baseclass for template: + + + listClass + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + buttonCreate + clicked() + CreateTemplate + accept() + + + PushButton1 + clicked() + CreateTemplate + reject() + + + + + klineedit.h + + diff --git a/kdevdesigner/designer/customwidgeteditor.ui b/kdevdesigner/designer/customwidgeteditor.ui new file mode 100644 index 00000000..4d0e301a --- /dev/null +++ b/kdevdesigner/designer/customwidgeteditor.ui @@ -0,0 +1,1378 @@ + +CustomWidgetEditorBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + CustomWidgetEditorBase + + + + 0 + 0 + 712 + 386 + + + + Edit Custom Widgets + + + true + + + <b>Edit Custom Widgets</b><p>Add or delete custom widgets from <i>Qt Designer</i>'s database, and edit the properties of existing widgets.</p> + + + + unnamed + + + 11 + + + 6 + + + + boxWidgets + + + The list of all custom widgets known to Qt Designer. + + + + + buttonNewWidget + + + &New Widget + + + Add new custom widget. + + + <b>Create an empty custom widget and add it to the list.</b><p>New custom widgets have a default name and header file, which must both be changed to appropriate values.</p> + + + + + buttonDeleteWidget + + + &Delete Widget + + + Delete custom widget + + + <b>Delete the selected custom widget.</b><p>You can only delete widgets that are not used in any open form.</p> + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonCancel + + + &Close + + + true + + + Closes the Dialog. + + + + + + + Vertical Spacing1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + buttonLoad + + + &Load Descriptions... + + + Loads widget description file + + + <b>Load Descriptions</b><p>Loads a file which contains descriptions of custom widgets, so that these custom widgets can be used in the Qt Designer.</p> +<p>Since it is a lot of work to type in all the information for custom widgets, you should consider using the createcw tool which is in $QTDIR/tools/designer/tools/createcw. Using createcw you can create custom widget description files for your custom widgets without the need to type in all the information manually. For more information about the README file in the createcw directory</p> + + + + + buttonSave + + + &Save Descriptions... + + + Saves widget description file + + + <b>Save Descriptions</b><p>Saves all the descriptions of the shown custom widgets to a file which can then be used to import the custom widgets elsewhere. + + + + + TabWidget1 + + + Change the properties of the selected custom widget. + + + + Widget2 + + + De&finition + + + + unnamed + + + 11 + + + 6 + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + previewPixmap + + + + + + + + buttonChoosePixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + <b>Select a pixmap file.</b><p>The pixmap will be used to represent the widget in forms.</p> + + + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + editHeader + + + Enter filename + + + <b>Change the header file's name for the selected custom widget.</b><p>The header file will be included by forms using the widget.</p> + + + + + buttonChooseHeader + + + + 30 + 22 + + + + ... + + + Choose headerfile + + + Look for the header file using a file dialog. + + + + + + Global + + + + + Local + + + + localGlobalCombo + + + Select access + + + <b>Change how the include file will be included.</b><p>Global include files will be included using &lt;&gt;-brackets, while local files will included using quotation marks.</p> + + + + + + + editClass + + + Change classname + + + <b>Enter the classname for the selected custom widget.</b><p>A class of that name must be defined in the header file.</p> + + + + + Label11 + + + Heade&rfile: + + + editHeader + + + + + Label10 + + + Cl&ass: + + + editClass + + + + + Label2 + + + Pixmap: + + + + + Label7 + + + Si&ze hint: + + + spinWidth + + + + + TextLabel1_2 + + + Size p&olicy: + + + sizeHor + + + + + + Fixed + + + + + Minimum + + + + + Maximum + + + + + Preferred + + + + + MinimumExpanding + + + + + Expanding + + + + sizeVer + + + Vertical Sizepolicy + + + Choose the Vertical size policy + + + + + spinWidth + + + 32767 + + + -1 + + + -1 + + + Size hint width + + + <b>Set the size hint for the selected widget.</b><p>The size hint provides the recommended size for the widget. Enter a sizehint of -1/-1 if no size is recommended.</p> + + + + + spinHeight + + + 32767 + + + -1 + + + -1 + + + Size hint height + + + <b>Set the size hint for the selected widget.</b><p>The size hint provides the recommended size for the widget. Enter a sizehint of -1/-1 if no size is recommended.</p> + + + + + + Fixed + + + + + Minimum + + + + + Maximum + + + + + Preferred + + + + + MinimumExpanding + + + + + Expanding + + + + sizeHor + + + Horizontal Sizepolicy + + + Choose the horizontal size policy for the widget + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + checkContainer + + + Con&tainer widget + + + Container Widget + + + <p><b>Container Widget</b></p> +<p>If this custom widget is able to contain other widgets (children), check this checkbox.</p> + + + + + + + Widget3 + + + Si&gnals + + + + unnamed + + + 11 + + + 6 + + + + listSignals + + + The list of all the signals that the selected widget can emit. + + + + + Layout40 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonAddSignal + + + N&ew Signal + + + true + + + Add new signal + + + <b>Add a new signal for the current custom widget.</b><p>An argument list should be provided in the signal's name, and the name must be unique.</p> + + + + + buttonRemoveSignal + + + Dele&te Signal + + + true + + + Delete signal + + + <b>Delete the signal.</b><p>All connections using this signal will also be deleted.</p> + + + + + + + Layout38 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + S&ignal: + + + editSignal + + + + + editSignal + + + Change signal name + + + <b>Change the name of the selected slot.</b><p>An argument list should be provided in the signal's name, and the name must be unique.</p> + + + + + + + + + Widget4 + + + S&lots + + + + unnamed + + + 11 + + + 6 + + + + + Slot + + + true + + + true + + + + + Access + + + true + + + true + + + + listSlots + + + true + + + true + + + The list of all the custom widget's slots. + + + + + TextLabel2 + + + Sl&ot: + + + editSlot + + + + + editSlot + + + Change slot name + + + <b>Change the name of the selected slot.</b><p>An argument list should be provided in the signal's name, and the name must be unique.</p> + + + + + TextLabel3 + + + &Access: + + + comboAccess + + + + + + public + + + + + protected + + + + comboAccess + + + Change slot access + + + <b>Change the slot's access policy.</b><p>You can only connect to the widget's public slots.</p> + + + + + Layout7 + + + + unnamed + + + 0 + + + 6 + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonAddSlot + + + N&ew Slot + + + true + + + Add new slot + + + <b>Add a new slot to the current custom widget.</b><p>An argument list should be provided in the signal's name, and the name must be unique.</p> + + + + + buttonRemoveSlot + + + Dele&te Slot + + + true + + + Delete slot + + + <b>Delete the slot.</b><p>All connections using this slot will also be deleted.</p> + + + + + + + + + Widget5 + + + &Properties + + + + unnamed + + + 11 + + + 6 + + + + Layout7_2 + + + + unnamed + + + 0 + + + 6 + + + + Spacer2_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonAddProperty + + + N&ew Property + + + true + + + Add new property + + + <b>Add a new property to the current custom widget.</b><p>The properties must be implemented in the class using Qt's property system.</p> + + + + + buttonRemoveProperty + + + Dele&te Property + + + true + + + Delete property + + + Deletes the selected property. + + + + + + + + String + + + + + CString + + + + + StringList + + + + + Bool + + + + + Int + + + + + UInt + + + + + Font + + + + + Color + + + + + Rect + + + + + Point + + + + + Size + + + + + Pixmap + + + + + Palette + + + + + Cursor + + + + + SizePolicy + + + + comboType + + + Select property type + + + <b>Select the type of the property.</b><p>The property must be implemented in the class using Qt's property system.</p><p>You can use integer types to support enumeration properties in the property editor.</p> + + + + + + Property + + + true + + + true + + + + + Type + + + true + + + true + + + + listProperties + + + true + + + true + + + <b>The list of the current widget's properties.</b><p>The properties of the custom widget can be changed in the property editor.</p> + + + + + editProperty + + + Change property name + + + <b>Enter a name for the property.</b><p>The properties must be implemented in the class using Qt's property system.</p> + + + + + TextLabel2_2 + + + P&roperty name: + + + editProperty + + + + + TextLabel3_2 + + + T&ype: + + + comboType + + + + + + + + + + boxWidgets + selectionChanged(QListBoxItem*) + CustomWidgetEditorBase + currentWidgetChanged(QListBoxItem*) + + + boxWidgets + currentChanged(QListBoxItem*) + CustomWidgetEditorBase + currentWidgetChanged(QListBoxItem*) + + + buttonNewWidget + clicked() + CustomWidgetEditorBase + addWidgetClicked() + + + buttonDeleteWidget + clicked() + CustomWidgetEditorBase + deleteWidgetClicked() + + + editClass + textChanged(const QString&) + CustomWidgetEditorBase + classNameChanged(const QString&) + + + editHeader + textChanged(const QString&) + CustomWidgetEditorBase + headerFileChanged(const QString&) + + + spinWidth + valueChanged(int) + CustomWidgetEditorBase + widthChanged(int) + + + spinHeight + valueChanged(int) + CustomWidgetEditorBase + heightChanged(int) + + + buttonChoosePixmap + clicked() + CustomWidgetEditorBase + pixmapChoosen() + + + localGlobalCombo + highlighted(int) + CustomWidgetEditorBase + includePolicyChanged(int) + + + buttonChooseHeader + clicked() + CustomWidgetEditorBase + chooseHeader() + + + buttonCancel + clicked() + CustomWidgetEditorBase + closeClicked() + + + listSignals + currentChanged(QListBoxItem*) + CustomWidgetEditorBase + currentSignalChanged(QListBoxItem*) + + + listSignals + selectionChanged(QListBoxItem*) + CustomWidgetEditorBase + currentSignalChanged(QListBoxItem*) + + + buttonRemoveSignal + clicked() + CustomWidgetEditorBase + removeSignal() + + + editSignal + textChanged(const QString&) + CustomWidgetEditorBase + signalNameChanged(const QString&) + + + listSlots + currentChanged(QListViewItem*) + CustomWidgetEditorBase + currentSlotChanged(QListViewItem*) + + + listSlots + selectionChanged(QListViewItem*) + CustomWidgetEditorBase + currentSlotChanged(QListViewItem*) + + + buttonRemoveSlot + clicked() + CustomWidgetEditorBase + removeSlot() + + + editSlot + textChanged(const QString&) + CustomWidgetEditorBase + slotNameChanged(const QString&) + + + comboAccess + activated(const QString&) + CustomWidgetEditorBase + slotAccessChanged(const QString&) + + + listProperties + currentChanged(QListViewItem*) + CustomWidgetEditorBase + currentPropertyChanged(QListViewItem*) + + + listProperties + selectionChanged(QListViewItem*) + CustomWidgetEditorBase + currentPropertyChanged(QListViewItem*) + + + buttonRemoveProperty + clicked() + CustomWidgetEditorBase + removeProperty() + + + editProperty + textChanged(const QString&) + CustomWidgetEditorBase + propertyNameChanged(const QString&) + + + comboType + activated(const QString&) + CustomWidgetEditorBase + propertyTypeChanged(const QString&) + + + buttonLoad + clicked() + CustomWidgetEditorBase + loadDescription() + + + buttonSave + clicked() + CustomWidgetEditorBase + saveDescription() + + + sizeHor + activated(int) + CustomWidgetEditorBase + horDataChanged(int) + + + sizeVer + activated(int) + CustomWidgetEditorBase + verDataChanged(int) + + + buttonAddProperty + clicked() + CustomWidgetEditorBase + addProperty() + + + checkContainer + toggled(bool) + CustomWidgetEditorBase + widgetIsContainer(bool) + + + buttonAddSignal + clicked() + CustomWidgetEditorBase + addSignal() + + + buttonAddSlot + clicked() + CustomWidgetEditorBase + addSlot() + + init() + destroy() + addProperty() + addSignal() + addWidgetClicked() + chooseHeader() + classNameChanged( const QString & ) + closeClicked() + currentPropertyChanged( QListViewItem * ) + currentSignalChanged( QListBoxItem * ) + currentSlotChanged( QListViewItem * ) + currentWidgetChanged( QListBoxItem * ) + deleteWidgetClicked() + headerFileChanged( const QString & ) + heightChanged( int ) + horDataChanged(int) + includePolicyChanged( int ) + loadDescription() + addSlot() + pixmapChoosen() + propertyNameChanged( const QString & ) + propertyTypeChanged( const QString & ) + removeProperty() + removeSignal() + removeSlot() + saveDescription() + signalNameChanged( const QString & ) + slotAccessChanged( const QString & ) + slotNameChanged( const QString & ) + verDataChanged(int) + widgetIsContainer(bool) + widthChanged( int ) + + + buttonCancel + boxWidgets + buttonNewWidget + buttonDeleteWidget + buttonLoad + buttonSave + TabWidget1 + editClass + editHeader + buttonChooseHeader + localGlobalCombo + buttonChoosePixmap + spinWidth + spinHeight + sizeHor + sizeVer + checkContainer + helpButton + listSignals + buttonAddSignal + buttonRemoveSignal + editSignal + listSlots + buttonAddSlot + buttonRemoveSlot + editSlot + comboAccess + listProperties + buttonAddProperty + buttonRemoveProperty + editProperty + comboType + + diff --git a/kdevdesigner/designer/customwidgeteditorimpl.cpp b/kdevdesigner/designer/customwidgeteditorimpl.cpp new file mode 100644 index 00000000..dc0ed1a8 --- /dev/null +++ b/kdevdesigner/designer/customwidgeteditorimpl.cpp @@ -0,0 +1,842 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "customwidgeteditorimpl.h" +#include "defs.h" +#include "pixmapchooser.h" +#include "mainwindow.h" +#include "asciivalidator.h" +#include "resource.h" +#include "widgetfactory.h" +#include "widgetdatabase.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +CustomWidgetEditor::CustomWidgetEditor( QWidget *parent, MainWindow *mw ) + : CustomWidgetEditorBase( parent, 0, TRUE ), mainWindow( mw ) +{ + connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + checkTimer = new QTimer( this ); + connect( checkTimer, SIGNAL( timeout() ), + this, SLOT( checkWidgetName() ) ); + + editClass->setEnabled( FALSE ); + editHeader->setEnabled( FALSE ); + buttonChooseHeader->setEnabled( FALSE ); + buttonChoosePixmap->setEnabled( FALSE ); + spinWidth->setEnabled( FALSE ); + spinHeight->setEnabled( FALSE ); + sizeHor->setEnabled( FALSE ); + sizeVer->setEnabled( FALSE ); + checkContainer->setEnabled( FALSE ); + localGlobalCombo->setEnabled( FALSE ); + editClass->setValidator( new AsciiValidator( QString(":"), editClass ) ); + editSignal->setValidator( new AsciiValidator( TRUE, editSignal ) ); + editSlot->setValidator( new AsciiValidator( TRUE, editSignal ) ); + editProperty->setValidator( new AsciiValidator( editSignal ) ); + editSignal->setEnabled( FALSE ); + buttonRemoveSignal->setEnabled( FALSE ); + + setupDefinition(); + setupSignals(); + setupSlots(); + setupProperties(); +} + +void CustomWidgetEditor::setupDefinition() +{ + QPtrList *lst = MetaDataBase::customWidgets(); + for ( MetaDataBase::CustomWidget *w = lst->first(); w; w = lst->next() ) { + QListBoxItem *i; + if ( w->pixmap ) + i = new QListBoxPixmap( boxWidgets, *w->pixmap, w->className ); + else + i = new QListBoxText( boxWidgets, w->className ); + customWidgets.insert( i, w ); + } + + if ( boxWidgets->firstItem() ) { + boxWidgets->setCurrentItem( boxWidgets->firstItem() ); + boxWidgets->setSelected( boxWidgets->firstItem(), TRUE ); + } + oldItem = 0; +} + +void CustomWidgetEditor::setupSignals() +{ + editSignal->setEnabled( FALSE ); + buttonRemoveSignal->setEnabled( FALSE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w ) + return; + listSignals->clear(); + for ( QValueList::Iterator it = w->lstSignals.begin(); it != w->lstSignals.end(); ++it ) + listSignals->insertItem( QString( *it ) ); + if ( listSignals->firstItem() ) { + listSignals->setCurrentItem( listSignals->firstItem() ); + listSignals->setSelected( listSignals->firstItem(), TRUE ); + } +} + +void CustomWidgetEditor::setupSlots() +{ + editSlot->setEnabled( FALSE ); + comboAccess->setEnabled( FALSE ); + buttonRemoveSlot->setEnabled( FALSE ); + + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w ) + return; + listSlots->clear(); + for ( QValueList::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) + (void)new QListViewItem( listSlots, (*it).function, (*it).access ); + + if ( listSlots->firstChild() ) { + listSlots->setCurrentItem( listSlots->firstChild() ); + listSlots->setSelected( listSlots->firstChild(), TRUE ); + } +} + +void CustomWidgetEditor::setupProperties() +{ + editProperty->setEnabled( FALSE ); + comboType->setEnabled( FALSE ); + buttonRemoveProperty->setEnabled( FALSE ); + + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w ) + return; + listProperties->clear(); + for ( QValueList::Iterator it = w->lstProperties.begin(); it != w->lstProperties.end(); ++it ) + (void)new QListViewItem( listProperties, (*it).property, (*it).type ); + + if ( listProperties->firstChild() ) { + listProperties->setCurrentItem( listProperties->firstChild() ); + listProperties->setSelected( listProperties->firstChild(), TRUE ); + } +} + +void CustomWidgetEditor::currentWidgetChanged( QListBoxItem *i ) +{ + checkTimer->stop(); + checkWidgetName(); + + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) { + buttonChooseHeader->setEnabled( FALSE ); + editClass->setEnabled( FALSE ); + editHeader->setEnabled( FALSE ); + buttonChoosePixmap->setEnabled( FALSE ); + spinWidth->setEnabled( FALSE ); + spinHeight->setEnabled( FALSE ); + localGlobalCombo->setEnabled( FALSE ); + sizeHor->setEnabled( FALSE ); + sizeVer->setEnabled( FALSE ); + checkContainer->setEnabled( FALSE ); + return; + } + + buttonChooseHeader->setEnabled( TRUE ); + editClass->setEnabled( TRUE ); + editHeader->setEnabled( TRUE ); + buttonChoosePixmap->setEnabled( TRUE ); + spinWidth->setEnabled( TRUE ); + spinHeight->setEnabled( TRUE ); + localGlobalCombo->setEnabled( TRUE ); + sizeHor->setEnabled( TRUE ); + sizeVer->setEnabled( TRUE ); + checkContainer->setEnabled( TRUE ); + + editClass->blockSignals( TRUE ); + editClass->setText( w->className ); + editClass->blockSignals( FALSE ); + editHeader->setText( w->includeFile ); + localGlobalCombo->setCurrentItem( (int)w->includePolicy ); + if ( w->pixmap ) + previewPixmap->setPixmap( *w->pixmap ); + else + previewPixmap->setText( "" ); + spinWidth->setValue( w->sizeHint.width() ); + spinHeight->setValue( w->sizeHint.height() ); + sizeHor->setCurrentItem( size_type_to_int( w->sizePolicy.horData() ) ); + sizeVer->setCurrentItem( size_type_to_int( w->sizePolicy.verData() ) ); + checkContainer->setChecked( w->isContainer ); + + setupSignals(); + setupSlots(); + setupProperties(); +} + +void CustomWidgetEditor::addWidgetClicked() +{ + oldItem = 0; + checkTimer->stop(); + checkWidgetName(); + + MetaDataBase::CustomWidget *w = new MetaDataBase::CustomWidget; + QString s = w->className; + if ( !MetaDataBase::addCustomWidget( w ) ) { + QMessageBox::information( this, i18n( "Adding Custom Widget" ), + i18n( "Custom widget names must be unique.\n" + "A custom widget called '%1' already exists, so it is not possible " + "to add another widget with this name." ).arg( s ) ); + return; + } + + QListBoxPixmap *i = new QListBoxPixmap( boxWidgets, *w->pixmap, w->className ); + customWidgets.insert( i, w ); + + boxWidgets->setCurrentItem( i ); + boxWidgets->setSelected( i, TRUE ); +} + +void CustomWidgetEditor::classNameChanged( const QString &s ) +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + WidgetDatabase::customWidgetClassNameChanged( w->className, s ); + + checkTimer->stop(); + boxWidgets->blockSignals( TRUE ); + oldName = w->className; + w->className = s; + QListBoxItem *old = i; + if ( w->pixmap ) + boxWidgets->changeItem( *w->pixmap, s, boxWidgets->currentItem() ); + else + boxWidgets->changeItem( s, boxWidgets->currentItem() ); + i = boxWidgets->item( boxWidgets->currentItem() ); + oldItem = i; + customWidgets.insert( i, w ); + customWidgets.remove( old ); + boxWidgets->blockSignals( FALSE ); + checkTimer->start( 1000, TRUE ); +} + +void CustomWidgetEditor::deleteWidgetClicked() +{ + oldItem = 0; + checkTimer->stop(); + checkWidgetName(); + + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + + if ( mainWindow->isCustomWidgetUsed( w ) ) { + QMessageBox::information( mainWindow, i18n( "Removing Custom Widget" ), + i18n( "The custom widget '%1' is in use, so it cannot be removed." ). + arg( w->className ) ); + return; + } + + if ( !i || !w ) + return; + + MetaDataBase::CustomWidget *cw = MetaDataBase::customWidget( mainWindow->currentTool() ); + if ( cw == w ) + mainWindow->resetTool(); + + MetaDataBase::removeCustomWidget( w ); + customWidgets.remove( i ); + delete i; + + i = boxWidgets->item( boxWidgets->currentItem() ); + if ( i ) { + boxWidgets->setCurrentItem( i ); + boxWidgets->setSelected( i, TRUE ); + } +} + +void CustomWidgetEditor::headerFileChanged( const QString &s ) +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + w->includeFile = s; +} + +void CustomWidgetEditor::heightChanged( int h ) +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + w->sizeHint.setHeight( h ); + updateCustomWidgetSizes(); +} + +void CustomWidgetEditor::includePolicyChanged( int p ) +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + w->includePolicy = (MetaDataBase::CustomWidget::IncludePolicy)p; +} + +void CustomWidgetEditor::pixmapChoosen() +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + QPixmap pix = qChoosePixmap( this ); + if ( pix.isNull() ) + return; + delete w->pixmap; + w->pixmap = new QPixmap( pix ); + + boxWidgets->blockSignals( TRUE ); + QListBoxItem *old = i; + boxWidgets->changeItem( *w->pixmap, w->className, boxWidgets->currentItem() ); + i = boxWidgets->item( boxWidgets->currentItem() ); + customWidgets.insert( i, w ); + customWidgets.remove( old ); + boxWidgets->blockSignals( FALSE ); + previewPixmap->setPixmap( *w->pixmap ); +} + +void CustomWidgetEditor::widthChanged( int wid ) +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + w->sizeHint.setWidth( wid ); + updateCustomWidgetSizes(); +} + +MetaDataBase::CustomWidget *CustomWidgetEditor::findWidget( QListBoxItem *i ) +{ + if ( !i ) + return 0; + + QMap::Iterator it = customWidgets.find( i ); + if ( it == customWidgets.end() ) + return 0; + return *it; +} + +void CustomWidgetEditor::chooseHeader() +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + QString h = KFileDialog::getOpenFileName( QString::null, i18n( "*.h *.h++ *.hxx *.hh|Header Files" ), this ); + if ( h.isEmpty() ) + return; + editHeader->setText( h ); + localGlobalCombo->setCurrentItem( (int)MetaDataBase::CustomWidget::Global ); +} + +void CustomWidgetEditor::checkWidgetName() +{ + QListBoxItem *i = oldItem ? oldItem : boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + oldItem = 0; + if ( !i || !w ) + return; + + if ( MetaDataBase::isWidgetNameUsed( w ) ) { + QString s = w->className; + w->className = oldName; + QMessageBox::information( this, i18n( "Renaming Custom Widget" ), + i18n( "Custom widget names must be unique.\n" + "A custom widget called '%1' already exists, so it is not possible " + "to rename this widget with this name." ).arg( s ) ); + if ( i != boxWidgets->item( boxWidgets->currentItem() ) ) { + boxWidgets->setCurrentItem( i ); + qApp->processEvents(); + } + editClass->setText( w->className ); + classNameChanged( w->className ); + } +} + +void CustomWidgetEditor::closeClicked() +{ + oldItem = 0; + checkTimer->stop(); + checkWidgetName(); + accept(); +} + +void CustomWidgetEditor::currentSignalChanged( QListBoxItem *i ) +{ + editSignal->blockSignals( TRUE ); + editSignal->setText( "" ); + editSignal->blockSignals( FALSE ); + + if ( !i ) { + editSignal->setEnabled( FALSE ); + buttonRemoveSignal->setEnabled( FALSE ); + return; + } + + editSignal->blockSignals( TRUE ); + editSignal->setEnabled( TRUE ); + buttonRemoveSignal->setEnabled( TRUE ); + editSignal->setText( i->text() ); + editSignal->blockSignals( FALSE ); +} + +void CustomWidgetEditor::addSignal() +{ + QListBoxItem *i = new QListBoxText( listSignals, "signal()" ); + listSignals->setCurrentItem( i ); + listSignals->setSelected( i, TRUE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( w ) + w->lstSignals.append( i->text().latin1() ); +} + +void CustomWidgetEditor::removeSignal() +{ + QString s = listSignals->currentText(); + delete listSignals->item( listSignals->currentItem() ); + if ( listSignals->currentItem() != -1 ) + listSignals->setSelected( listSignals->currentItem(), TRUE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( w ) + w->lstSignals.remove( s.latin1() ); +} + +void CustomWidgetEditor::signalNameChanged( const QString &s ) +{ + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w || listSignals->currentItem() == -1 ) + return; + + QValueList::Iterator it = w->lstSignals.find( listSignals->currentText().latin1() ); + if ( it != w->lstSignals.end() ) + w->lstSignals.remove( it ); + listSignals->blockSignals( TRUE ); + listSignals->changeItem( s, listSignals->currentItem() ); + listSignals->blockSignals( FALSE ); + w->lstSignals.append( s.latin1() ); +} + +void CustomWidgetEditor::slotAccessChanged( const QString &s ) +{ + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w || !listSlots->currentItem() ) + return; + + MetaDataBase::Function slot; + slot.function = listSlots->currentItem()->text( 0 ); + slot.access = listSlots->currentItem()->text( 1 ); + QValueList::Iterator it = w->lstSlots.find( slot ); + if ( it != w->lstSlots.end() ) + w->lstSlots.remove( it ); + listSlots->currentItem()->setText( 1, s ); + slot.function = listSlots->currentItem()->text( 0 ); + slot.access = listSlots->currentItem()->text( 1 ); + w->lstSlots.append( slot ); +} + +void CustomWidgetEditor::slotNameChanged( const QString &s ) +{ + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w || !listSlots->currentItem() ) + return; + + MetaDataBase::Function slot; + slot.function = listSlots->currentItem()->text( 0 ); + slot.access = listSlots->currentItem()->text( 1 ); + slot.type = "slot"; + QValueList::Iterator it = w->lstSlots.find( slot ); + if ( it != w->lstSlots.end() ) + w->lstSlots.remove( it ); + listSlots->currentItem()->setText( 0, s ); + slot.function = listSlots->currentItem()->text( 0 ); + slot.access = listSlots->currentItem()->text( 1 ); + w->lstSlots.append( slot ); +} + +void CustomWidgetEditor::addSlot() +{ + QListViewItem *i = new QListViewItem( listSlots, "slot()", "public" ); + listSlots->setCurrentItem( i ); + listSlots->setSelected( i, TRUE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( w ) { + MetaDataBase::Function slot; + slot.function = "slot()"; + slot.access = "public"; + slot.type = "slot"; + w->lstSlots.append( slot ); + } +} + +void CustomWidgetEditor::removeSlot() +{ + MetaDataBase::Function slot; + slot.function = "1 2 3"; + if ( listSlots->currentItem() ) { + slot.function = listSlots->currentItem()->text( 0 ); + slot.access = listSlots->currentItem()->text( 1 ); + } + delete listSlots->currentItem(); + if ( listSlots->currentItem() ) + listSlots->setSelected( listSlots->currentItem(), TRUE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( w && slot.function != "1 2 3" ) + w->lstSlots.remove( slot ); +} + +void CustomWidgetEditor::currentSlotChanged( QListViewItem *i ) +{ + editSlot->blockSignals( TRUE ); + editSlot->setText( "" ); + editSignal->blockSignals( FALSE ); + + if ( !i ) { + editSlot->setEnabled( FALSE ); + comboAccess->setEnabled( FALSE ); + buttonRemoveSlot->setEnabled( FALSE ); + return; + } + + editSlot->setEnabled( TRUE ); + comboAccess->setEnabled( TRUE ); + buttonRemoveSlot->setEnabled( TRUE ); + editSlot->blockSignals( TRUE ); + comboAccess->blockSignals( TRUE ); + editSlot->setText( i->text( 0 ) ); + if ( i->text( 1 ) == i18n( "protected" ) ) + comboAccess->setCurrentItem( 1 ); + else + comboAccess->setCurrentItem( 0 ); + editSlot->blockSignals( FALSE ); + comboAccess->blockSignals( FALSE ); +} + +void CustomWidgetEditor::propertyTypeChanged( const QString &s ) +{ + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w || !listProperties->currentItem() ) + return; + + MetaDataBase::Property property; + property.property = listProperties->currentItem()->text( 0 ); + property.type = listProperties->currentItem()->text( 1 ); + QValueList::Iterator it = w->lstProperties.find( property ); + if ( it != w->lstProperties.end() ) + w->lstProperties.remove( it ); + listProperties->currentItem()->setText( 1, s ); + property.property = listProperties->currentItem()->text( 0 ); + property.type = listProperties->currentItem()->text( 1 ); + w->lstProperties.append( property ); +} + +void CustomWidgetEditor::propertyNameChanged( const QString &s ) +{ + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( !w || !listProperties->currentItem() ) + return; + + MetaDataBase::Property property; + property.property = listProperties->currentItem()->text( 0 ); + property.type = listProperties->currentItem()->text( 1 ); + QValueList::Iterator it = w->lstProperties.find( property ); + if ( it != w->lstProperties.end() ) + w->lstProperties.remove( it ); + listProperties->currentItem()->setText( 0, s ); + property.property = listProperties->currentItem()->text( 0 ); + property.type = listProperties->currentItem()->text( 1 ); + w->lstProperties.append( property ); +} + +void CustomWidgetEditor::addProperty() +{ + QListViewItem *i = new QListViewItem( listProperties, "property", "String" ); + listProperties->setCurrentItem( i ); + listProperties->setSelected( i, TRUE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( w ) { + MetaDataBase::Property prop; + prop.property = "property"; + prop.type = "String"; + w->lstProperties.append( prop ); + } +} + +void CustomWidgetEditor::removeProperty() +{ + MetaDataBase::Property property; + property.property = "1 2 3"; + if ( listProperties->currentItem() ) { + property.property = listProperties->currentItem()->text( 0 ); + property.type = listProperties->currentItem()->text( 1 ); + } + delete listProperties->currentItem(); + if ( listProperties->currentItem() ) + listProperties->setSelected( listProperties->currentItem(), TRUE ); + MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); + if ( w && property.property != "1 2 3" ) + w->lstProperties.remove( property ); +} + +void CustomWidgetEditor::currentPropertyChanged( QListViewItem *i ) +{ + editProperty->blockSignals( TRUE ); + editProperty->setText( "" ); + editSignal->blockSignals( FALSE ); + + if ( !i ) { + editProperty->setEnabled( FALSE ); + comboType->setEnabled( FALSE ); + buttonRemoveProperty->setEnabled( FALSE ); + return; + } + + editProperty->setEnabled( TRUE ); + comboType->setEnabled( TRUE ); + buttonRemoveProperty->setEnabled( TRUE ); + editProperty->blockSignals( TRUE ); + comboType->blockSignals( TRUE ); + editProperty->setText( i->text( 0 ) ); + + for ( int j = 0; j < comboType->count(); ++j ) { + if ( i->text( 1 ) == comboType->text( j ) ) { + comboType->setCurrentItem( j ); + break; + } + } + editProperty->blockSignals( FALSE ); + comboType->blockSignals( FALSE ); +} + +static QString makeIndent2( int indent ) +{ + QString s; + s.fill( ' ', indent * 4 ); + return s; +} + +static QString entitize2( const QString &s ) +{ + QString s2 = s; + s2 = s2.replace( "\"", """ ); + s2 = s2.replace( "&", "&" ); + s2 = s2.replace( ">", ">" ); + s2 = s2.replace( "<", "<" ); + s2 = s2.replace( "'", "'" ); + return s2; +} + +void CustomWidgetEditor::saveDescription() +{ + QString fn = KFileDialog::getSaveFileName( QString::null, i18n( "*.cw|Custom-Widget Description\n*|All Files" ), this ); + if ( fn.isEmpty() ) + return; + + if ( QFileInfo( fn ).extension() != "cw" ) + fn += ".cw"; + QFile f( fn ); + if ( !f.open( IO_WriteOnly ) ) + return; + + QTextStream ts( &f ); + ts.setCodec( QTextCodec::codecForName( "UTF-8" ) ); + int indent = 0; + + ts << "" << endl; + + ts << makeIndent2( indent ) << "" << endl; + indent++; + + QPtrList *lst = MetaDataBase::customWidgets(); + for ( MetaDataBase::CustomWidget *w = lst->first(); w; w = lst->next() ) { + ts << makeIndent2( indent ) << "" << endl; + indent++; + ts << makeIndent2( indent ) << "" << w->className << "" << endl; + ts << makeIndent2( indent ) << "
      includePolicy == MetaDataBase::CustomWidget::Local ? "local" : "global" ) + << "\">" << w->includeFile << "
      " << endl; + ts << makeIndent2( indent ) << "" << endl; + indent++; + ts << makeIndent2( indent ) << "" << w->sizeHint.width() << "" << endl; + ts << makeIndent2( indent ) << "" << w->sizeHint.height() << "" << endl; + indent--; + ts << makeIndent2( indent ) << "" << endl; + ts << makeIndent2( indent ) << "" << (int)w->isContainer << "" << endl; + ts << makeIndent2( indent ) << "" << endl; + indent++; + ts << makeIndent2( indent ) << "" << (int)w->sizePolicy.horData() << "" << endl; + ts << makeIndent2( indent ) << "" << (int)w->sizePolicy.verData() << "" << endl; + indent--; + ts << makeIndent2( indent ) << "" << endl; + ts << makeIndent2( indent ) << "" << endl; + indent++; + Resource::saveImageData( w->pixmap->convertToImage(), ts, indent ); + indent--; + ts << makeIndent2( indent ) << "" << endl; + if ( !w->lstSignals.isEmpty() ) { + for ( QValueList::Iterator it = w->lstSignals.begin(); it != w->lstSignals.end(); ++it ) + ts << makeIndent2( indent ) << "" << entitize2( *it ) << "" << endl; + } + if ( !w->lstSlots.isEmpty() ) { + for ( QValueList::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) + ts << makeIndent2( indent ) << "" << entitize2( (*it).function ) << "" << endl; + } + if ( !w->lstProperties.isEmpty() ) { + for ( QValueList::Iterator it = w->lstProperties.begin(); it != w->lstProperties.end(); ++it ) + ts << makeIndent2( indent ) << "" << entitize2( (*it).property ) << "" << endl; + } + indent--; + ts << makeIndent2( indent ) << "
      " << endl; + } + + indent--; + ts << makeIndent2( indent ) << "
      " << endl; + ts << "
      " << endl; +} + +void CustomWidgetEditor::loadDescription() +{ + QString fn = KFileDialog::getOpenFileName( QString::null, i18n( "*.cw|Custom-Widget Description\n*|All Files" ), this ); + if ( fn.isEmpty() ) + return; + + QFile f( fn ); + if ( !f.open( IO_ReadOnly ) ) + return; + + QDomDocument doc; + QString errMsg; + int errLine; + if ( !doc.setContent( &f, &errMsg, &errLine ) ) { + qDebug( QString("Parse error: ") + errMsg + QString(" in line %d"), errLine ); + return; + } + + QDomElement firstWidget = doc.firstChild().toElement().firstChild().toElement(); + + while ( firstWidget.tagName() != "customwidgets" ) + firstWidget = firstWidget.nextSibling().toElement(); + + Resource::loadCustomWidgets( firstWidget, 0 ); + boxWidgets->clear(); + setupDefinition(); + setupSignals(); + setupSlots(); + setupProperties(); +} + +void CustomWidgetEditor::updateCustomWidgetSizes() +{ + if ( cwLst.isEmpty() ) + cwLst = *mainWindow->queryList( "CustomWidget" ); + for ( QObject *o = cwLst.first(); o; o = cwLst.next() ) + ( (QWidget*)o )->updateGeometry(); +} + +void CustomWidgetEditor::horDataChanged( int a ) +{ + QSizePolicy::SizeType st = int_to_size_type( a ); + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + QSizePolicy osp = w->sizePolicy; + w->sizePolicy.setHorData( st ); + if ( cwLst.isEmpty() ) + cwLst = *mainWindow->queryList( "CustomWidget" ); + for ( QObject *o = cwLst.first(); o; o = cwLst.next() ) { + CustomWidget *cw = (CustomWidget*)o; + if ( cw->realClassName() == boxWidgets->currentText() ) { + if ( cw->sizePolicy() == osp ) + cw->setSizePolicy( w->sizePolicy ); + } + } +} + +void CustomWidgetEditor::verDataChanged( int a ) +{ + QSizePolicy::SizeType st = int_to_size_type( a ); + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + QSizePolicy osp = w->sizePolicy; + w->sizePolicy.setVerData( st ); + if ( cwLst.isEmpty() ) + cwLst = *mainWindow->queryList( "CustomWidget" ); + for ( QObject *o = cwLst.first(); o; o = cwLst.next() ) { + CustomWidget *cw = (CustomWidget*)o; + if ( cw->realClassName() == boxWidgets->currentText() ) { + if ( cw->sizePolicy() == osp ) + cw->setSizePolicy( w->sizePolicy ); + } + } +} + +void CustomWidgetEditor::widgetIsContainer( bool b ) +{ + QListBoxItem *i = boxWidgets->item( boxWidgets->currentItem() ); + MetaDataBase::CustomWidget *w = findWidget( i ); + if ( !i || !w ) + return; + + w->isContainer = b; + WidgetDatabaseRecord *r = WidgetDatabase::at( w->id ); + if ( r ) + r->isContainer = b; +} diff --git a/kdevdesigner/designer/customwidgeteditorimpl.h b/kdevdesigner/designer/customwidgeteditorimpl.h new file mode 100644 index 00000000..cdbf402f --- /dev/null +++ b/kdevdesigner/designer/customwidgeteditorimpl.h @@ -0,0 +1,98 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef CUSTOMWIDGETEDITORIMPL_H +#define CUSTOMWIDGETEDITORIMPL_H + +#include "customwidgeteditor.h" +#include "metadatabase.h" + +#include +#include + +class QTimer; +class QListBoxItem; +class MainWindow; + +class CustomWidgetEditor : public CustomWidgetEditorBase +{ + Q_OBJECT + +public: + CustomWidgetEditor( QWidget *parent , MainWindow *mw); + +protected slots: + void addWidgetClicked(); + void classNameChanged( const QString & ); + void currentWidgetChanged( QListBoxItem * ); + void deleteWidgetClicked(); + void headerFileChanged( const QString & ); + void heightChanged( int ); + void includePolicyChanged( int ); + void pixmapChoosen(); + void widthChanged( int ); + void chooseHeader(); + void checkWidgetName(); + void closeClicked(); + void currentSignalChanged( QListBoxItem *i ); + void addSignal(); + void removeSignal(); + void signalNameChanged( const QString &s ); + void slotAccessChanged( const QString & ); + void slotNameChanged( const QString & ); + void addSlot(); + void removeSlot(); + void currentSlotChanged( QListViewItem * ); + void propertyTypeChanged( const QString & ); + void propertyNameChanged( const QString & ); + void addProperty(); + void removeProperty(); + void currentPropertyChanged( QListViewItem * ); + void saveDescription(); + void loadDescription(); + void horDataChanged( int ); + void verDataChanged( int ); + void widgetIsContainer( bool ); + +private: + MetaDataBase::CustomWidget *findWidget( QListBoxItem *i ); + void setupDefinition(); + void setupSignals(); + void setupSlots(); + void setupProperties(); + void updateCustomWidgetSizes(); + +private: + QMap customWidgets; + QString oldName; + QTimer *checkTimer; + QListBoxItem *oldItem; + MainWindow *mainWindow; + QObjectList cwLst; + +}; + +#endif diff --git a/kdevdesigner/designer/database.cpp b/kdevdesigner/designer/database.cpp new file mode 100644 index 00000000..a92a04c8 --- /dev/null +++ b/kdevdesigner/designer/database.cpp @@ -0,0 +1,122 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#if defined(DESIGNER) +#include "database.h" +#else +#include "database2.h" +#endif + +#ifndef QT_NO_SQL + +#if defined(DESIGNER) +#include "formwindow.h" +#include "mainwindow.h" +#endif + +#include +#include +#include +#include + +DatabaseSupport::DatabaseSupport() +{ + con = 0; + frm = 0; + parent = 0; +} + +void DatabaseSupport::initPreview( const QString &connection, const QString &table, QObject *o, + const QMap &databaseControls ) +{ + tbl = table; + dbControls = databaseControls; + parent = o; + + if ( connection != "(default)" ) + con = QSqlDatabase::database( connection ); + else + con = QSqlDatabase::database(); + frm = new QSqlForm( o, table ); + for ( QMap::Iterator it = dbControls.begin(); it != dbControls.end(); ++it ) { + QObject *chld = parent->child( it.key(), "QWidget" ); + if ( !chld ) + continue; + frm->insert( (QWidget*)chld, *it ); + } +} + +QDesignerDataBrowser::QDesignerDataBrowser( QWidget *parent, const char *name ) + : QDataBrowser( parent, name ) +{ +} + +bool QDesignerDataBrowser::event( QEvent* e ) +{ + bool b = QDataBrowser::event( e ); +#if defined(DESIGNER) + if ( MainWindow::self->isPreviewing() ) { +#endif + if ( e->type() == QEvent::Show ) { + if ( con ) { + QSqlCursor* cursor = new QSqlCursor( tbl, TRUE, con ); + setSqlCursor( cursor, TRUE ); + setForm( frm ); + refresh(); + first(); + } + return TRUE; + } +#if defined(DESIGNER) + } +#endif + return b; +} + +QDesignerDataView::QDesignerDataView( QWidget *parent, const char *name ) + : QDataView( parent, name ) +{ +} + +bool QDesignerDataView::event( QEvent* e ) +{ + bool b = QDataView::event( e ); +#if defined(DESIGNER) + if ( MainWindow::self->isPreviewing() ) { +#endif + if ( e->type() == QEvent::Show ) { + setForm( frm ); + readFields(); + return TRUE; + } +#if defined(DESIGNER) + } +#endif + return b; +} + + +#endif diff --git a/kdevdesigner/designer/database.h b/kdevdesigner/designer/database.h new file mode 100644 index 00000000..530085fb --- /dev/null +++ b/kdevdesigner/designer/database.h @@ -0,0 +1,83 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DATABASE_H +#define DATABASE_H + +#include "qfeatures.h" + +#ifndef QT_NO_SQL +#include +#include +#include +#include + +class QSqlDatabase; +class QSqlForm; + +class DatabaseSupport +{ +public: + DatabaseSupport(); + virtual ~DatabaseSupport() {} + + void initPreview( const QString &connection, const QString &table, QObject *o, + const QMap &databaseControls ); + +protected: + QSqlDatabase* con; + QSqlForm* frm; + QString tbl; + QMap dbControls; + QObject *parent; + +}; + +class QDesignerDataBrowser : public QDataBrowser, public DatabaseSupport +{ + Q_OBJECT + +public: + QDesignerDataBrowser( QWidget *parent, const char *name ); + +protected: + bool event( QEvent* e ); +}; + +class QDesignerDataView : public QDataView, public DatabaseSupport +{ + Q_OBJECT + +public: + QDesignerDataView( QWidget *parent, const char *name ); + +protected: + bool event( QEvent* e ); + +}; +#endif + +#endif diff --git a/kdevdesigner/designer/dbconnection.ui b/kdevdesigner/designer/dbconnection.ui new file mode 100644 index 00000000..19a0e216 --- /dev/null +++ b/kdevdesigner/designer/dbconnection.ui @@ -0,0 +1,222 @@ + +DatabaseConnectionWidget +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + DatabaseConnectionWidget + + + + 0 + 0 + 199 + 185 + + + + Edit Database Connection + + + + unnamed + + + 0 + + + 6 + + + + TextLabel3 + + + &Database name: + + + editDatabase + + + + + TextLabel4 + + + &Username: + + + editUsername + + + + + TextLabel4_2 + + + &Password: + + + editPassword + + + + + TextLabel2 + + + D&river: + + + comboDriver + + + + + editName + + + false + + + + + TextLabel5 + + + &Hostname: + + + editHostname + + + + + comboDriver + + + false + + + true + + + + + TextLabel1 + + + &Name: + + + editName + + + + + editHostname + + + false + + + + + TextLabel1_2 + + + P&ort: + + + editPort + + + + + editUsername + + + false + + + + + editPassword + + + false + + + Password + + + + + editDatabase + + + false + + + + + editPort + + + false + + + Default + + + 65535 + + + -1 + + + -1 + + + + + + + + editName + comboDriver + editDatabase + editUsername + editPassword + editHostname + editPort + + + init() + destroy() + + + diff --git a/kdevdesigner/designer/dbconnectioneditor.ui b/kdevdesigner/designer/dbconnectioneditor.ui new file mode 100644 index 00000000..64b77387 --- /dev/null +++ b/kdevdesigner/designer/dbconnectioneditor.ui @@ -0,0 +1,147 @@ + +DatabaseConnectionEditorBase +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + DatabaseConnectionEditorBase + + + + 0 + 0 + 393 + 286 + + + + Connect + + + + unnamed + + + 11 + + + 6 + + + + PushButton2 + + + &Cancel + + + + + PushButton1 + + + &OK + + + true + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + grp + + + Connection Details + + + + unnamed + + + 11 + + + 6 + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + PushButton2 + clicked() + DatabaseConnectionEditorBase + reject() + + + PushButton1 + clicked() + DatabaseConnectionEditorBase + accept() + + init() + destroy() + + + PushButton1 + PushButton2 + + diff --git a/kdevdesigner/designer/dbconnectionimpl.cpp b/kdevdesigner/designer/dbconnectionimpl.cpp new file mode 100644 index 00000000..4867ed39 --- /dev/null +++ b/kdevdesigner/designer/dbconnectionimpl.cpp @@ -0,0 +1,80 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "dbconnectionimpl.h" +#include "dbconnection.h" +#include "project.h" +#include "asciivalidator.h" +#include +#include +#include +#include +#include +#include + +DatabaseConnectionEditor::DatabaseConnectionEditor( DatabaseConnection* connection, QWidget* parent, + const char* name, bool modal, WFlags fl ) + : DatabaseConnectionEditorBase( parent, name, modal, fl ), conn( connection ) +{ + connectionWidget = new DatabaseConnectionWidget( grp ); + grpLayout->addWidget( connectionWidget, 0, 0 ); + init(); +} + +DatabaseConnectionEditor::~DatabaseConnectionEditor() +{ +} + +void DatabaseConnectionEditor::accept() +{ +#ifndef QT_NO_SQL + conn->setUsername( connectionWidget->editUsername->text() ); + conn->setPassword( connectionWidget->editPassword->text() ); + conn->setHostname( connectionWidget->editHostname->text() ); +#endif + DatabaseConnectionEditorBase::accept(); +} + +void DatabaseConnectionEditor::init() +{ + connectionWidget->editName->setEnabled( FALSE ); + connectionWidget->editName->setValidator( new AsciiValidator( connectionWidget->editName ) ); + connectionWidget->editName->setText( conn->name() ); + connectionWidget->comboDriver->setEnabled( FALSE ); + connectionWidget->comboDriver->lineEdit()->setText( conn->driver() ); + connectionWidget->editDatabase->setEnabled( FALSE ); + connectionWidget->editDatabase->setText( conn->database() ); + connectionWidget->editUsername->setEnabled( TRUE ); + connectionWidget->editUsername->setText( conn->username() ); + connectionWidget->editPassword->setEnabled( TRUE ); + connectionWidget->editPassword->setText( "" ); + connectionWidget->editHostname->setEnabled( TRUE ); + connectionWidget->editHostname->setText( conn->hostname() ); + connectionWidget->editPort->setEnabled( TRUE ); + connectionWidget->editPort->setValue( conn->port() ); + connectionWidget->editUsername->setFocus(); + connectionWidget->editUsername->selectAll(); +} diff --git a/kdevdesigner/designer/dbconnectionimpl.h b/kdevdesigner/designer/dbconnectionimpl.h new file mode 100644 index 00000000..daef2c21 --- /dev/null +++ b/kdevdesigner/designer/dbconnectionimpl.h @@ -0,0 +1,57 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DBCONNECTIONIMPL_H +#define DBCONNECTIONIMPL_H + +#include "dbconnectioneditor.h" + +class DatabaseConnection; +class DatabaseConnectionWidget; +class QGridLayout; + +class DatabaseConnectionEditor : public DatabaseConnectionEditorBase +{ + Q_OBJECT + +public: + DatabaseConnectionEditor( DatabaseConnection* connection, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~DatabaseConnectionEditor(); + +public slots: + void accept(); +private: + void init(); + +private: + DatabaseConnection *conn; + QGridLayout* lay; + DatabaseConnectionWidget* connectionWidget; + +}; + +#endif // DBCONNECTIONIMPL_H diff --git a/kdevdesigner/designer/dbconnections.ui b/kdevdesigner/designer/dbconnections.ui new file mode 100644 index 00000000..847c00b1 --- /dev/null +++ b/kdevdesigner/designer/dbconnections.ui @@ -0,0 +1,321 @@ + +DatabaseConnectionBase +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + DatabaseConnectionBase + + + + 0 + 0 + 512 + 309 + + + + Edit Database Connections + + + true + + + + unnamed + + + 11 + + + 6 + + + + buttonNew + + + &New Connection + + + + + listConnections + + + + + buttonDelete + + + &Delete Connection + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonClose + + + &Close + + + true + + + Close the dialog and discard any changes. + + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + grp + + + Connection + + + + unnamed + + + 11 + + + 6 + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + Spacer4 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonConnect + + + false + + + Connec&t + + + + + Spacer5 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + buttonClose + clicked() + DatabaseConnectionBase + accept() + + + buttonNew + clicked() + DatabaseConnectionBase + newConnection() + + + buttonDelete + clicked() + DatabaseConnectionBase + deleteConnection() + + + buttonConnect + clicked() + DatabaseConnectionBase + doConnect() + + + listConnections + highlighted(const QString&) + DatabaseConnectionBase + currentConnectionChanged(const QString&) + + + listConnections + selected(const QString&) + DatabaseConnectionBase + currentConnectionChanged(const QString&) + + init() + destroy() + currentConnectionChanged( const QString & ) + deleteConnection() + newConnection() + connectionNameChanged( const QString & ) + doConnect() + + + buttonClose + listConnections + buttonNew + buttonDelete + buttonConnect + buttonHelp + + diff --git a/kdevdesigner/designer/dbconnectionsimpl.cpp b/kdevdesigner/designer/dbconnectionsimpl.cpp new file mode 100644 index 00000000..6f059336 --- /dev/null +++ b/kdevdesigner/designer/dbconnectionsimpl.cpp @@ -0,0 +1,196 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "dbconnectionsimpl.h" +#include +#include +#include +#include "project.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "mainwindow.h" +#include "asciivalidator.h" + +#include + +static bool blockChanges = FALSE; + +/* + * Constructs a DatabaseConnectionsEditor which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +DatabaseConnectionsEditor::DatabaseConnectionsEditor( Project *pro, QWidget* parent, const char* name, bool modal, WFlags fl ) + : DatabaseConnectionBase( parent, name, modal, fl ), project( pro ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + connectionWidget = new DatabaseConnectionWidget( grp ); + grpLayout->addWidget( connectionWidget, 0, 0 ); +#ifndef QT_NO_SQL + QPtrList lst = project->databaseConnections(); + for ( DatabaseConnection *conn = lst.first(); conn; conn = lst.next() ) + listConnections->insertItem( conn->name() ); + connectionWidget->comboDriver->insertStringList( QSqlDatabase::drivers() ); +#endif + connectionWidget->editName->setValidator( new AsciiValidator( connectionWidget->editName ) ); + enableAll( FALSE ); +} + +DatabaseConnectionsEditor::~DatabaseConnectionsEditor() +{ +} + +void DatabaseConnectionsEditor::deleteConnection() +{ + if ( listConnections->currentItem() == -1 ) + return; + project->removeDatabaseConnection( listConnections->currentText() ); + delete listConnections->item( listConnections->currentItem() ); + if ( listConnections->count() ) { + listConnections->setCurrentItem( 0 ); + currentConnectionChanged( listConnections->currentText() ); + } else { + enableAll( FALSE ); + } + project->saveConnections(); +} + +void DatabaseConnectionsEditor::newConnection() +{ + blockChanges = TRUE; + enableAll( TRUE ); + QString n( "(default)" ); + if ( project->databaseConnection( n ) ) { + n = "connection"; + int i = 2; + while ( project->databaseConnection( n + QString::number( i ) ) ) + ++i; + n = n + QString::number( i ); + } + connectionWidget->editName->setText( n ); + listConnections->clearSelection(); + buttonConnect->setDefault( TRUE ); + connectionWidget->editName->setFocus(); + blockChanges = FALSE; +} + +void DatabaseConnectionsEditor::doConnect() +{ +#ifndef QT_NO_SQL + if ( listConnections->currentItem() == -1 || + !listConnections->item( listConnections->currentItem() )->isSelected() ) { // new connection + // ### do error checking for duplicated connection names + DatabaseConnection *conn = new DatabaseConnection( project ); + conn->setName( connectionWidget->editName->text() ); + conn->setDriver( connectionWidget->comboDriver->lineEdit()->text() ); + conn->setDatabase( connectionWidget->editDatabase->text() ); + conn->setUsername( connectionWidget->editUsername->text() ); + conn->setPassword( connectionWidget->editPassword->text() ); + conn->setHostname( connectionWidget->editHostname->text() ); + conn->setPort( connectionWidget->editPort->value() ); + if ( conn->refreshCatalog() ) { + project->addDatabaseConnection( conn ); + listConnections->insertItem( conn->name() ); + listConnections->setCurrentItem( listConnections->count() - 1 ); + project->saveConnections(); + } else { + QMessageBox::warning( MainWindow::self, i18n( "Connection" ), + i18n( "Could not connect to the database.\n" + "Please ensure that the database server is running " + "and that all the connection information is correct.\n" + "[ " + conn->lastError() + " ]" ) ); + delete conn; + } + } else { // sync // ### should this do something else? right now it just overwrites all info about the connection... + DatabaseConnection *conn = project->databaseConnection( listConnections->currentText() ); + conn->setName( connectionWidget->editName->text() ); + conn->setDriver( connectionWidget->comboDriver->lineEdit()->text() ); + conn->setDatabase( connectionWidget->editDatabase->text() ); + conn->setUsername( connectionWidget->editUsername->text() ); + conn->setPassword( connectionWidget->editPassword->text() ); + conn->setHostname( connectionWidget->editHostname->text() ); + conn->setPort( connectionWidget->editPort->value() ); + conn->refreshCatalog(); + project->saveConnections(); + } +#endif +} + +void DatabaseConnectionsEditor::currentConnectionChanged( const QString &s ) +{ +#ifndef QT_NO_SQL + DatabaseConnection *conn = project->databaseConnection( s ); + blockChanges = TRUE; + enableAll( conn != 0 ); + connectionWidget->editName->setEnabled( FALSE ); + blockChanges = FALSE; + if ( !conn ) + return; + blockChanges = TRUE; + connectionWidget->editName->setText( conn->name() ); + blockChanges = FALSE; + connectionWidget->comboDriver->lineEdit()->setText( conn->driver() ); + connectionWidget->editDatabase->setText( conn->database() ); + connectionWidget->editUsername->setText( conn->username() ); + connectionWidget->editPassword->setText( conn->password() ); + connectionWidget->editHostname->setText( conn->hostname() ); + connectionWidget->editPort->setValue( conn->port() ); +#endif +} + +void DatabaseConnectionsEditor::connectionNameChanged( const QString &s ) +{ + if ( listConnections->currentItem() == 0 || blockChanges ) + return; + listConnections->changeItem( s, listConnections->currentItem() ); +} + +void DatabaseConnectionsEditor::enableAll( bool b ) +{ + connectionWidget->editName->setEnabled( b ); + connectionWidget->editName->setText( "" ); + connectionWidget->comboDriver->setEnabled( b ); + connectionWidget->comboDriver->lineEdit()->setText( "" ); + connectionWidget->editDatabase->setEnabled( b ); + connectionWidget->editDatabase->setText( "" ); + connectionWidget->editUsername->setEnabled( b ); + connectionWidget->editUsername->setText( "" ); + connectionWidget->editPassword->setEnabled( b ); + connectionWidget->editPassword->setText( "" ); + connectionWidget->editHostname->setEnabled( b ); + connectionWidget->editHostname->setText( "" ); + connectionWidget->editPort->setEnabled( b ); + connectionWidget->editPort->setValue( -1 ); + buttonConnect->setEnabled( b ); +} diff --git a/kdevdesigner/designer/dbconnectionsimpl.h b/kdevdesigner/designer/dbconnectionsimpl.h new file mode 100644 index 00000000..fdb70427 --- /dev/null +++ b/kdevdesigner/designer/dbconnectionsimpl.h @@ -0,0 +1,60 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DBCONNECTIONSIMPL_H +#define DBCONNECTIONSIMPL_H + +#include "dbconnections.h" +#include "dbconnection.h" + +class Project; + +class DatabaseConnectionsEditor : public DatabaseConnectionBase +{ + Q_OBJECT + +public: + DatabaseConnectionsEditor( Project *pro, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~DatabaseConnectionsEditor(); + +protected slots: + void deleteConnection(); + void newConnection(); + void doConnect(); + void currentConnectionChanged( const QString & ); + void connectionNameChanged( const QString &s ); + +private: + void enableAll( bool b ); + +private: + Project *project; + DatabaseConnectionWidget* connectionWidget; + +}; + +#endif // DBCONNECTIONSIMPL_H diff --git a/kdevdesigner/designer/defs.cpp b/kdevdesigner/designer/defs.cpp new file mode 100644 index 00000000..11b3dca0 --- /dev/null +++ b/kdevdesigner/designer/defs.cpp @@ -0,0 +1,84 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "defs.h" + +int size_type_to_int( QSizePolicy::SizeType t ) +{ + if ( t == QSizePolicy::Fixed ) + return 0; + if ( t == QSizePolicy::Minimum ) + return 1; + if ( t == QSizePolicy::Maximum ) + return 2; + if ( t == QSizePolicy::Preferred ) + return 3; + if ( t == QSizePolicy::MinimumExpanding ) + return 4; + if ( t == QSizePolicy::Expanding ) + return 5; + if ( t == QSizePolicy::Ignored ) + return 6; + return 0; +} + +QString size_type_to_string( QSizePolicy::SizeType t ) +{ + if ( t == QSizePolicy::Fixed ) + return "Fixed"; + if ( t == QSizePolicy::Minimum ) + return "Minimum"; + if ( t == QSizePolicy::Maximum ) + return "Maximum"; + if ( t == QSizePolicy::Preferred ) + return "Preferred"; + if ( t == QSizePolicy::MinimumExpanding ) + return "MinimumExpanding"; + if ( t == QSizePolicy::Expanding ) + return "Expanding"; + if ( t == QSizePolicy::Ignored ) + return "Ignored"; + return QString(); +} + +QSizePolicy::SizeType int_to_size_type( int i ) +{ + if ( i == 0 ) + return QSizePolicy::Fixed; + if ( i == 1 ) + return QSizePolicy::Minimum; + if ( i == 2 ) + return QSizePolicy::Maximum; + if ( i == 3 ) + return QSizePolicy::Preferred; + if ( i == 4 ) + return QSizePolicy::MinimumExpanding; + if ( i == 5 ) + return QSizePolicy::Expanding; + if ( i == 6 ) + return QSizePolicy::Ignored; + return QSizePolicy::Preferred; +} diff --git a/kdevdesigner/designer/defs.h b/kdevdesigner/designer/defs.h new file mode 100644 index 00000000..80a11671 --- /dev/null +++ b/kdevdesigner/designer/defs.h @@ -0,0 +1,42 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DEFS_H +#define DEFS_H + +#include +#include + +#define POINTER_TOOL 32000 +#define CONNECT_TOOL 32001 +#define ORDER_TOOL 32002 +#define BUDDY_TOOL 32004 + +int size_type_to_int( QSizePolicy::SizeType t ); +QString size_type_to_string( QSizePolicy::SizeType t ); +QSizePolicy::SizeType int_to_size_type( int i ); + +#endif diff --git a/kdevdesigner/designer/designer_pch.h b/kdevdesigner/designer/designer_pch.h new file mode 100644 index 00000000..6b53f984 --- /dev/null +++ b/kdevdesigner/designer/designer_pch.h @@ -0,0 +1,44 @@ +/* + * This is a precompiled header file for use in Xcode / Mac GCC / + * GCC >= 3.4 / VC to greatly speed the building of Qt Designer. It may + * also be of use to people developing their own project, but it is + * probably better to define your own header. Use of this header is + * currently UNSUPPORTED. + */ + +#if defined __cplusplus + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "command.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "metadatabase.h" +#include "project.h" +#include "widgetfactory.h" + +#endif diff --git a/kdevdesigner/designer/designeraction.cpp b/kdevdesigner/designer/designeraction.cpp new file mode 100644 index 00000000..2cdcd5eb --- /dev/null +++ b/kdevdesigner/designer/designeraction.cpp @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "designeraction.h" + +DesignerAction::~DesignerAction() +{ +} + +void DesignerAction::setDisabled( bool d ) +{ + QAction::setEnabled(!d); + emit actionEnabled(!d); +} + +void DesignerAction::setEnabled( bool e ) +{ + QAction::setEnabled(e); + emit actionEnabled(e); +} + +#if QT_VERSION < 0x030300 +void DesignerAction::activate() +{ + if ( isToggleAction() ) { + return; + } + emit activated(); +} +#endif + +#include "designeraction.moc" diff --git a/kdevdesigner/designer/designeraction.h b/kdevdesigner/designer/designeraction.h new file mode 100644 index 00000000..db8f7901 --- /dev/null +++ b/kdevdesigner/designer/designeraction.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DESIGNERACTION_H +#define DESIGNERACTION_H + +#include + +class DesignerAction : public QAction +{ +Q_OBJECT +public: + DesignerAction(QObject *parent = 0, const char *name = 0) + :QAction(parent, name) {} + DesignerAction ( const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 ) + :QAction(menuText, accel, parent, name) {} + DesignerAction ( const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 ) + :QAction(icon, menuText, accel, parent, name) {} + DesignerAction ( const QString & text, const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ) + :QAction(text, icon, menuText, accel, parent, name, toggle) {} + DesignerAction ( const QString & text, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ) + :QAction(text, menuText, accel, parent, name, toggle) {} + DesignerAction ( QObject * parent, const char * name, bool toggle ) + :QAction(parent, name, toggle) {} + ~DesignerAction(); + + virtual void setEnabled(bool e); + virtual void setDisabled(bool d); +#if QT_VERSION < 0x030300 + virtual void activate(); +#endif + +signals: + void actionEnabled(bool e); + +}; + +#endif diff --git a/kdevdesigner/designer/designerapp.cpp b/kdevdesigner/designer/designerapp.cpp new file mode 100644 index 00000000..480bc65b --- /dev/null +++ b/kdevdesigner/designer/designerapp.cpp @@ -0,0 +1,176 @@ + /********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "designerappiface.h" +#include "designerapp.h" +#include "mainwindow.h" +#include "formwindow.h" + +#include + +#include +#include +#include +#include + +#ifdef Q_WS_WIN +#include +#include +#endif + +static QSplashScreen *splash = 0; + +void set_splash_status( const QString &txt ) +{ + if ( !splash ) + return; + QString splashText = "Licensed to " + + QString::fromLatin1( QT_PRODUCT_LICENSEE ) + "\n" + + txt; + splash->message( splashText, Qt::AlignRight|Qt::AlignTop ); +} + +DesignerApplication::DesignerApplication( int &argc, char **argv ) + : QApplication( argc, argv ) +{ +#if defined(Q_WS_WIN) + if ( winVersion() & Qt::WV_NT_based ) + DESIGNER_OPENFILE = RegisterWindowMessage((TCHAR*)"QT_DESIGNER_OPEN_FILE"); + else + DESIGNER_OPENFILE = RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"); +#endif +} + +QSplashScreen *DesignerApplication::showSplash() +{ + QRect screen = QApplication::desktop()->screenGeometry(); + QSettings config; + config.insertSearchPath( QSettings::Windows, "/Trolltech" ); + + QRect mainRect; + QString keybase = settingsKey(); + bool show = config.readBoolEntry( keybase + "SplashScreen", TRUE ); + mainRect.setX( config.readNumEntry( keybase + "Geometries/MainwindowX", 0 ) ); + mainRect.setY( config.readNumEntry( keybase + "Geometries/MainwindowY", 0 ) ); + mainRect.setWidth( config.readNumEntry( keybase + "Geometries/MainwindowWidth", 500 ) ); + mainRect.setHeight( config.readNumEntry( keybase + "Geometries/MainwindowHeight", 500 ) ); + screen = QApplication::desktop()->screenGeometry( QApplication::desktop()->screenNumber( mainRect.center() ) ); + + if ( show ) { + splash = new QSplashScreen( UserIcon("designer_splash.png") ); + splash->show(); + set_splash_status( "Initializing..." ); + } + + return splash; +} + +void DesignerApplication::closeSplash() +{ + splash->hide(); +} + +static QString *settings_key = 0; +static QString *old_settings_key = 0; + +QString DesignerApplication::settingsKey() +{ + if ( !settings_key ) + settings_key = new QString( "/Qt Designer/" + + QString::number( (QT_VERSION >> 16) & 0xff ) + + "." + QString::number( (QT_VERSION >> 8) & 0xff ) + "/" ); + return *settings_key; +} + +QString DesignerApplication::oldSettingsKey() +{ + if ( !old_settings_key ) { + int majorVer = (QT_VERSION >> 16) & 0xff; + int minorVer = (QT_VERSION >> 8) & 0xff; + + // If minorVer is 0 (e.g. 4.0) then we don't want to read the + // old settings, too much might have changed. + if ( !minorVer == 0 ) + minorVer--; + + old_settings_key = new QString( "/Qt Designer/" + + QString::number( majorVer ) + + "." + QString::number( minorVer ) + "/" ); + } + return *old_settings_key; +} + +void DesignerApplication::setSettingsKey( const QString &key ) +{ + if ( !settings_key ) + settings_key = new QString( key ); + else + *settings_key = key; +} + +#if defined(Q_WS_WIN) +bool DesignerApplication::winEventFilter( MSG *msg ) +{ + if ( msg->message == DESIGNER_OPENFILE ) { + QFile f( QDir::homeDirPath() + "/.designerargs" ); + QFileInfo fi(f); + if ( fi.lastModified() == lastMod ) + return QApplication::winEventFilter( msg ); + lastMod = fi.lastModified(); + f.open( IO_ReadOnly ); + QString args; + f.readLine( args, f.size() ); + QStringList lst = QStringList::split( " ", args ); + + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + QString arg = (*it).stripWhiteSpace(); + if ( arg[0] != '-' ) { + QObjectList* l = MainWindow::self->queryList( "FormWindow" ); + FormWindow* fw = (FormWindow*) l->first(); + FormWindow* totop = 0; + bool haveit = FALSE; + while ( fw ) { + haveit = haveit || fw->fileName() == arg; + if ( haveit ) + totop = fw; + + fw = (FormWindow*) l->next(); + } + + if ( !haveit ) { + FlashWindow( MainWindow::self->winId(), TRUE ); + MainWindow::self->openFormWindow( arg ); + } else if ( totop ) { + totop->setFocus(); + } + delete l; + } + } + return TRUE; + } + return QApplication::winEventFilter( msg ); +} +#endif diff --git a/kdevdesigner/designer/designerapp.h b/kdevdesigner/designer/designerapp.h new file mode 100644 index 00000000..d78d55af --- /dev/null +++ b/kdevdesigner/designer/designerapp.h @@ -0,0 +1,58 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DESIGNERAPP_H +#define DESIGNERAPP_H + +class QSplashScreen; + +#include + +class DesignerApplication : public QApplication +{ +public: + const char *className() const { return "DesignerApplication"; } + + DesignerApplication( int &argc, char **argv ); + + QSplashScreen *showSplash(); + static void closeSplash(); + + static QString settingsKey(); + static QString oldSettingsKey(); + static void setSettingsKey( const QString &key ); + +protected: + QDateTime lastMod; + +#if defined(Q_WS_WIN) + bool winEventFilter( MSG *msg ); + uint DESIGNER_OPENFILE; +#endif + +}; + +#endif diff --git a/kdevdesigner/designer/designerappiface.cpp b/kdevdesigner/designer/designerappiface.cpp new file mode 100644 index 00000000..798f45b6 --- /dev/null +++ b/kdevdesigner/designer/designerappiface.cpp @@ -0,0 +1,1093 @@ + /********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include +#include +#include "designerappiface.h" +#include "mainwindow.h" +#include "project.h" +#include "formwindow.h" +#include "workspace.h" +#include "widgetfactory.h" +#include "command.h" +#include "outputwindow.h" +#include "../shared/widgetdatabase.h" +#include +#include +#include +#include +#include "pixmapcollection.h" +#include "hierarchyview.h" +#include +#include +#include "popupmenueditor.h" +#include "menubareditor.h" + +DesignerInterfaceImpl::DesignerInterfaceImpl( MainWindow *mw ) + : mainWindow( mw ) +{ +} + +QRESULT DesignerInterfaceImpl::queryInterface( const QUuid &uuid, QUnknownInterface** iface ) +{ + *iface = 0; + + if ( uuid == IID_QUnknown ) + *iface = (QUnknownInterface*)this; + else if ( uuid == IID_QComponentInformation ) + *iface = (QComponentInformationInterface*)this; + else if ( uuid == IID_Designer ) + *iface = (DesignerInterface*)this; + else + return QE_NOINTERFACE; + + (*iface)->addRef(); + return QS_OK; +} + + +DesignerProject *DesignerInterfaceImpl::currentProject() const +{ + return mainWindow->currProject()->iFace(); +} + +DesignerFormWindow *DesignerInterfaceImpl::currentForm() const +{ + if ( mainWindow->formWindow() ) + return mainWindow->formWindow()->iFace(); + return 0; +} + +DesignerSourceFile *DesignerInterfaceImpl::currentSourceFile() const +{ + if ( mainWindow->sourceFile() ) + return mainWindow->sourceFile()->iFace(); + return 0; +} + +QPtrList DesignerInterfaceImpl::projectList() const +{ + return mainWindow->projectList(); +} + +void DesignerInterfaceImpl::showStatusMessage( const QString &text, int ms ) const +{ + if ( text.isEmpty() ) { + mainWindow->statusBar()->clear(); + return; + } + if ( ms ) + mainWindow->statusMessage( text/*, ms*/ ); + else + mainWindow->statusMessage( text ); +} + +DesignerDock *DesignerInterfaceImpl::createDock() const +{ + return 0; +} + +DesignerOutputDock *DesignerInterfaceImpl::outputDock() const +{ + return mainWindow->outputWindow() ? mainWindow->outputWindow()->iFace() : 0; +} + +void DesignerInterfaceImpl::setModified( bool b, QWidget *window ) +{ + mainWindow->setModified( b, window ); +} + +void DesignerInterfaceImpl::updateFunctionList() +{ + mainWindow->updateFunctionList(); + if ( mainWindow->objectHierarchy()->sourceEditor() ) + mainWindow->objectHierarchy()->updateClassBrowsers(); +} + +void DesignerInterfaceImpl::onProjectChange( QObject *receiver, const char *slot ) +{ + QObject::connect( mainWindow, SIGNAL( projectChanged() ), receiver, slot ); +} + +void DesignerInterfaceImpl::onFormChange( QObject *receiver, const char *slot ) +{ + QObject::connect( mainWindow, SIGNAL( formWindowChanged() ), receiver, slot ); + QObject::connect( mainWindow, SIGNAL( editorChanged() ), receiver, slot ); +} + +bool DesignerInterfaceImpl::singleProjectMode() const +{ + return mainWindow->singleProjectMode(); +} + +void DesignerInterfaceImpl::showError( QWidget *widget, + int line, const QString &message ) +{ + mainWindow->showErrorMessage( widget, line, message ); +} + +void DesignerInterfaceImpl::runFinished() +{ + mainWindow->finishedRun(); +} + +void DesignerInterfaceImpl::showStackFrame( QWidget *w, int line ) +{ + mainWindow->showStackFrame( w, line ); +} + +void DesignerInterfaceImpl::showDebugStep( QWidget *w, int line ) +{ + mainWindow->showDebugStep( w, line ); +} + +void DesignerInterfaceImpl::runProjectPrecondition() +{ + mainWindow->runProjectPrecondition(); +} + +void DesignerInterfaceImpl::runProjectPostcondition( QObjectList *l ) +{ + mainWindow->runProjectPostcondition( l ); +} + +DesignerProjectImpl::DesignerProjectImpl( Project *pr ) + : project( pr ) +{ +} + +QPtrList DesignerProjectImpl::formList() const +{ + QPtrList list; + QObjectList *forms = project->formList(); + if ( !forms ) + return list; + + QPtrListIterator it( *forms ); + while ( it.current() ) { + QObject *obj = it.current(); + ++it; + QWidget *par = ::qt_cast(obj->parent()); + if ( !obj->isWidgetType() || !par ) + continue; + + list.append( ((FormWindow*)par)->iFace() ); + } + + delete forms; + return list; +} + +QString DesignerProjectImpl::formFileName( const QString &form ) const +{ + for ( QPtrListIterator forms = project->formFiles(); + forms.current(); ++forms ) { + if ( QString( forms.current()->formName() ) == form ) + return forms.current()->fileName(); + } + return QString::null; +} + +QStringList DesignerProjectImpl::formNames() const +{ + QStringList l; + for ( QPtrListIterator forms = project->formFiles(); + forms.current(); ++forms ) { + FormFile* f = forms.current(); + if ( f->isFake() ) + continue; + l << f->formName(); + } + return l; +} + +void DesignerProjectImpl::addForm( DesignerFormWindow * ) +{ +} + +void DesignerProjectImpl::removeForm( DesignerFormWindow * ) +{ +} + +QString DesignerProjectImpl::fileName() const +{ + return project->fileName(); +} + +void DesignerProjectImpl::setFileName( const QString & ) +{ +} + +QString DesignerProjectImpl::projectName() const +{ + return project->projectName(); +} + +void DesignerProjectImpl::setProjectName( const QString & ) +{ +} + +QString DesignerProjectImpl::databaseFile() const +{ + return QString::null; +} + +void DesignerProjectImpl::setDatabaseFile( const QString & ) +{ +} + +void DesignerProjectImpl::setupDatabases() const +{ + MainWindow::self->editDatabaseConnections(); +} + +QPtrList DesignerProjectImpl::databaseConnections() const +{ + QPtrList lst; +#ifndef QT_NO_SQL + QPtrList conns = project->databaseConnections(); + for ( DatabaseConnection *d = conns.first(); d; d = conns.next() ) + lst.append( d->iFace() ); +#endif + return lst; +} + +void DesignerProjectImpl::addDatabase( DesignerDatabase * ) +{ +} + +void DesignerProjectImpl::removeDatabase( DesignerDatabase * ) +{ +} + +void DesignerProjectImpl::save() const +{ +} + +void DesignerProjectImpl::setLanguage( const QString &l ) +{ + project->setLanguage( l ); +} + +QString DesignerProjectImpl::language() const +{ + return project->language(); +} + +void DesignerProjectImpl::setCustomSetting( const QString &key, const QString &value ) +{ + project->setCustomSetting( key, value ); +} + +QString DesignerProjectImpl::customSetting( const QString &key ) const +{ + if ( key == "QTSCRIPT_PACKAGES" ) { + QString s = getenv( "QTSCRIPT_PACKAGES" ); + QString s2 = project->customSetting( "QUICK_PACKAGES" ); + if ( !s.isEmpty() && !s2.isEmpty() ) +#if defined(Q_OS_WIN32) + s += ";"; +#else + s += ":"; +#endif + s += s2; + return s; + } + return project->customSetting( key ); +} + +DesignerPixmapCollection *DesignerProjectImpl::pixmapCollection() const +{ + return project->pixmapCollection()->iFace(); +} + +void DesignerProjectImpl::breakPoints( QMap > &bps ) const +{ + MainWindow::self->saveAllBreakPoints(); + for ( QPtrListIterator sources = project->sourceFiles(); + sources.current(); ++sources ) { + SourceFile* f = sources.current(); + bps.insert( project->makeRelative( f->fileName() ) + " ", MetaDataBase::breakPoints( f ) ); + } + for ( QPtrListIterator forms = project->formFiles(); + forms.current(); ++forms ) { + if ( forms.current()->formWindow() ) + bps.insert( QString( forms.current()->formWindow()->name() ) + "
      ", MetaDataBase::breakPoints( forms.current()->formWindow() ) ); + } +} + +QString DesignerProjectImpl::breakPointCondition( QObject *o, int line ) const +{ + return MetaDataBase::breakPointCondition( MainWindow::self->findRealObject( o ), line ); +} + +void DesignerProjectImpl::setBreakPointCondition( QObject *o, int line, const QString &condition ) +{ + MetaDataBase::setBreakPointCondition( MainWindow::self->findRealObject( o ), line, condition ); +} + +void DesignerProjectImpl::clearAllBreakpoints() const +{ + QValueList empty; + for ( QPtrListIterator sources = project->sourceFiles(); + sources.current(); ++sources ) { + SourceFile* f = sources.current(); + MetaDataBase::setBreakPoints( f, empty ); + } + for ( QPtrListIterator forms = project->formFiles(); + forms.current(); ++forms ) { + if ( forms.current()->formWindow() ) + MetaDataBase::setBreakPoints( forms.current()->formWindow(), empty ); + MainWindow::self->resetBreakPoints(); + } +} + +void DesignerProjectImpl::setIncludePath( const QString &platform, const QString &path ) +{ + project->setIncludePath( platform, path ); +} + +void DesignerProjectImpl::setLibs( const QString &platform, const QString &path ) +{ + project->setLibs( platform, path ); +} + +void DesignerProjectImpl::setDefines( const QString &platform, const QString &path ) +{ + project->setDefines( platform, path ); +} + +void DesignerProjectImpl::setConfig( const QString &platform, const QString &config ) +{ + project->setConfig( platform, config ); +} + +void DesignerProjectImpl::setTemplate( const QString &t ) +{ + project->setTemplate( t ); +} + +QString DesignerProjectImpl::config( const QString &platform ) const +{ + return project->config( platform ); +} + +QString DesignerProjectImpl::libs( const QString &platform ) const +{ + return project->libs( platform ); +} + +QString DesignerProjectImpl::defines( const QString &platform ) const +{ + return project->defines( platform ); +} + +QString DesignerProjectImpl::includePath( const QString &platform ) const +{ + return project->includePath( platform ); +} + +QString DesignerProjectImpl::templte() const +{ + return project->templte(); +} + +bool DesignerProjectImpl::isGenericObject( QObject *o ) const +{ + return !!project->fakeFormFileFor( o ); +} + + + + + + + +#ifndef QT_NO_SQL +DesignerDatabaseImpl::DesignerDatabaseImpl( DatabaseConnection *d ) + : db( d ) +{ +} + +QString DesignerDatabaseImpl::name() const +{ + return db->name(); +} + +void DesignerDatabaseImpl::setName( const QString & ) +{ +} + +QString DesignerDatabaseImpl::driver() const +{ + return db->driver(); +} + +void DesignerDatabaseImpl::setDriver( const QString & ) +{ +} + +QString DesignerDatabaseImpl::database() const +{ + return db->database(); +} + +void DesignerDatabaseImpl::setDatabase( const QString & ) +{ +} + +QString DesignerDatabaseImpl::userName() const +{ + return db->username(); +} + +void DesignerDatabaseImpl::setUserName( const QString & ) +{ +} + +QString DesignerDatabaseImpl::password() const +{ + return db->password(); +} + +void DesignerDatabaseImpl::setPassword( const QString & ) +{ +} + +QString DesignerDatabaseImpl::hostName() const +{ + return db->hostname(); +} + +void DesignerDatabaseImpl::setHostName( const QString & ) +{ +} + +QStringList DesignerDatabaseImpl::tables() const +{ + return db->tables(); +} + +QMap DesignerDatabaseImpl::fields() const +{ + return db->fields(); +} + +void DesignerDatabaseImpl::open( bool suppressDialog ) const +{ + db->open( suppressDialog ); +} + +void DesignerDatabaseImpl::close() const +{ + db->close(); +} + +void DesignerDatabaseImpl::setFields( const QMap & ) +{ +} + +void DesignerDatabaseImpl::setTables( const QStringList & ) +{ +} + +QSqlDatabase* DesignerDatabaseImpl::connection() +{ + return db->connection(); +} +#endif + + + +DesignerPixmapCollectionImpl::DesignerPixmapCollectionImpl( PixmapCollection *coll ) + : pixCollection( coll ) +{ +} + +void DesignerPixmapCollectionImpl::addPixmap( const QPixmap &p, const QString &name, bool force ) +{ + PixmapCollection::Pixmap pix; + pix.pix = p; + pix.name = name; + pixCollection->addPixmap( pix, force ); + FormWindow *fw = MainWindow::self->formWindow(); + if ( fw ) + MetaDataBase::setPixmapKey( fw, p.serialNumber(), name ); +} + +QPixmap DesignerPixmapCollectionImpl::pixmap( const QString &name ) const +{ + return pixCollection->pixmap( name ); +} + + + +DesignerFormWindowImpl::DesignerFormWindowImpl( FormWindow *fw ) + : formWindow( fw ) +{ +} + +QString DesignerFormWindowImpl::name() const +{ + return formWindow->name(); + } + +void DesignerFormWindowImpl::setName( const QString &n ) +{ + formWindow->setName( n ); +} + +QString DesignerFormWindowImpl::fileName() const +{ + return formWindow->fileName(); +} + +void DesignerFormWindowImpl::setFileName( const QString & ) +{ +} + +void DesignerFormWindowImpl::save() const +{ +} + +bool DesignerFormWindowImpl::isModified() const +{ + return formWindow->commandHistory()->isModified(); +} + +void DesignerFormWindowImpl::insertWidget( QWidget * ) +{ +} + +QWidget *DesignerFormWindowImpl::create( const char *className, QWidget *parent, const char *name ) +{ + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( className ), parent, name ); + formWindow->insertWidget( w, TRUE ); + formWindow->killAccels( formWindow->mainContainer() ); + return w; +} + +void DesignerFormWindowImpl::removeWidget( QWidget * ) +{ +} + +QWidgetList DesignerFormWindowImpl::widgets() const +{ + return QWidgetList(); +} + +void DesignerFormWindowImpl::undo() +{ +} + +void DesignerFormWindowImpl::redo() +{ +} + +void DesignerFormWindowImpl::cut() +{ +} + +void DesignerFormWindowImpl::copy() +{ +} + +void DesignerFormWindowImpl::paste() +{ +} + +void DesignerFormWindowImpl::adjustSize() +{ +} + +void DesignerFormWindowImpl::editConnections() +{ +} + +void DesignerFormWindowImpl::checkAccels() +{ +} + +void DesignerFormWindowImpl::layoutH() +{ + formWindow->layoutHorizontal(); +} + +void DesignerFormWindowImpl::layoutV() +{ +} + +void DesignerFormWindowImpl::layoutHSplit() +{ +} + +void DesignerFormWindowImpl::layoutVSplit() +{ +} + +void DesignerFormWindowImpl::layoutG() +{ + formWindow->layoutGrid(); +} + +void DesignerFormWindowImpl::layoutHContainer( QWidget* w ) +{ + formWindow->layoutHorizontalContainer( w ); +} + +void DesignerFormWindowImpl::layoutVContainer( QWidget* w ) +{ + formWindow->layoutVerticalContainer( w ); +} + +void DesignerFormWindowImpl::layoutGContainer( QWidget* w ) +{ + formWindow->layoutGridContainer( w ); +} + +void DesignerFormWindowImpl::breakLayout() +{ +} + +void DesignerFormWindowImpl::selectWidget( QWidget * w ) +{ + formWindow->selectWidget( w, TRUE ); +} + +void DesignerFormWindowImpl::selectAll() +{ +} + +void DesignerFormWindowImpl::clearSelection() +{ + formWindow->clearSelection(); +} + +bool DesignerFormWindowImpl::isWidgetSelected( QWidget * ) const +{ + return FALSE; +} + +QWidgetList DesignerFormWindowImpl::selectedWidgets() const +{ + return formWindow->selectedWidgets(); +} + +QWidget *DesignerFormWindowImpl::currentWidget() const +{ + return formWindow->currentWidget(); +} + +QWidget *DesignerFormWindowImpl::form() const +{ + return formWindow; +} + + +void DesignerFormWindowImpl::setCurrentWidget( QWidget * ) +{ +} + +QPtrList DesignerFormWindowImpl::actionList() const +{ + return QPtrList(); +} + +QAction *DesignerFormWindowImpl::createAction( const QString& text, const QIconSet& icon, const QString& menuText, int accel, + QObject* parent, const char* name, bool toggle ) +{ + QDesignerAction *a = new QDesignerAction( parent ); + a->setName( name ); + a->setText( text ); + if ( !icon.isNull() && !icon.pixmap().isNull() ) + a->setIconSet( icon ); + a->setMenuText( menuText ); + a->setAccel( accel ); + a->setToggleAction( toggle ); + return a; +} + +void DesignerFormWindowImpl::addAction( QAction *a ) +{ + if ( formWindow->actionList().findRef( a ) != -1 ) + return; + formWindow->actionList().append( a ); + MetaDataBase::addEntry( a ); + setPropertyChanged( a, "name", TRUE ); + setPropertyChanged( a, "text", TRUE ); + setPropertyChanged( a, "menuText", TRUE ); + setPropertyChanged( a, "accel", TRUE ); + if ( !a->iconSet().isNull() && !a->iconSet().pixmap().isNull() ) + setPropertyChanged( a, "iconSet", TRUE ); +} + +void DesignerFormWindowImpl::removeAction( QAction *a ) +{ + formWindow->actionList().removeRef( a ); +} + +void DesignerFormWindowImpl::preview() const +{ +} + +void DesignerFormWindowImpl::addConnection( QObject *sender, const char *signal, QObject *receiver, const char *slot ) +{ + MetaDataBase::addConnection( formWindow, sender, signal, receiver, slot ); +} + +void DesignerFormWindowImpl::addFunction( const QCString &function, const QString &specifier, + const QString &access, const QString &type, + const QString &language, const QString &returnType ) +{ + MetaDataBase::addFunction( formWindow, function, specifier, access, type, language, returnType ); + formWindow->mainWindow()->functionsChanged(); +} + + + +void DesignerFormWindowImpl::setProperty( QObject *o, const char *property, const QVariant &value ) +{ + int id = o->metaObject()->findProperty( property, TRUE ); + const QMetaProperty* p = o->metaObject()->property( id, TRUE ); + if ( p && p->isValid() ) + o->setProperty( property, value ); + else + MetaDataBase::setFakeProperty( o, property, value ); +} + +QVariant DesignerFormWindowImpl::property( QObject *o, const char *prop ) const +{ + int id = o->metaObject()->findProperty( prop, TRUE ); + const QMetaProperty* p = o->metaObject()->property( id, TRUE ); + if ( p && p->isValid() ) + return o->property( prop ); + return MetaDataBase::fakeProperty( o, prop ); +} + +void DesignerFormWindowImpl::setPropertyChanged( QObject *o, const char *property, bool changed ) +{ + MetaDataBase::setPropertyChanged( o, property, changed ); +} + +bool DesignerFormWindowImpl::isPropertyChanged( QObject *o, const char *property ) const +{ + return MetaDataBase::isPropertyChanged( o, property ); +} + +void DesignerFormWindowImpl::setColumnFields( QObject *o, const QMap &f ) +{ + MetaDataBase::setColumnFields( o, f ); +} + +QStringList DesignerFormWindowImpl::implementationIncludes() const +{ + QValueList includes = MetaDataBase::includes( formWindow ); + QStringList lst; + for ( QValueList::Iterator it = includes.begin(); it != includes.end(); ++it ) { + MetaDataBase::Include inc = *it; + if ( inc.implDecl != "in implementation" ) + continue; + QString s = inc.header; + if ( inc.location == "global" ) { + s.prepend( "<" ); + s.append( ">" ); + } else { + s.prepend( "\"" ); + s.append( "\"" ); + } + lst << s; + } + return lst; +} + +QStringList DesignerFormWindowImpl::declarationIncludes() const +{ + QValueList includes = MetaDataBase::includes( formWindow ); + QStringList lst; + for ( QValueList::Iterator it = includes.begin(); it != includes.end(); ++it ) { + MetaDataBase::Include inc = *it; + if ( inc.implDecl == "in implementation" ) + continue; + QString s = inc.header; + if ( inc.location == "global" ) { + s.prepend( "<" ); + s.append( ">" ); + } else { + s.prepend( "\"" ); + s.append( "\"" ); + } + lst << s; + } + return lst; +} + +void DesignerFormWindowImpl::setImplementationIncludes( const QStringList &lst ) +{ + QValueList oldIncludes = MetaDataBase::includes( formWindow ); + QValueList includes; + for ( QValueList::Iterator it = oldIncludes.begin(); it != oldIncludes.end(); ++it ) { + MetaDataBase::Include inc = *it; + if ( inc.implDecl == "in implementation" ) + continue; + includes << inc; + } + + for ( QStringList::ConstIterator sit = lst.begin(); sit != lst.end(); ++sit ) { + QString s = *sit; + if ( s.startsWith( "#include" ) ) + s.remove( (uint)0, 8 ); + s = s.simplifyWhiteSpace(); + if ( s[ 0 ] != '<' && s[ 0 ] != '"' ) { + s.prepend( "\"" ); + s.append( "\"" ); + } + if ( s[ 0 ] == '<' ) { + s.remove( (uint)0, 1 ); + s.remove( s.length() - 1, 1 ); + MetaDataBase::Include inc; + inc.header = s; + inc.implDecl = "in implementation"; + inc.location = "global"; + includes << inc; + } else { + s.remove( (uint)0, 1 ); + s.remove( s.length() - 1, 1 ); + MetaDataBase::Include inc; + inc.header = s; + inc.implDecl = "in implementation"; + inc.location = "local"; + includes << inc; + } + } + MetaDataBase::setIncludes( formWindow, includes ); + formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup(); +} + +void DesignerFormWindowImpl::setDeclarationIncludes( const QStringList &lst ) +{ + QValueList oldIncludes = MetaDataBase::includes( formWindow ); + QValueList includes; + for ( QValueList::Iterator it = oldIncludes.begin(); it != oldIncludes.end(); ++it ) { + MetaDataBase::Include inc = *it; + if ( inc.implDecl == "in declaration" ) + continue; + includes << inc; + } + + for ( QStringList::ConstIterator sit = lst.begin(); sit != lst.end(); ++sit ) { + QString s = *sit; + if ( s.startsWith( "#include" ) ) + s.remove( (uint)0, 8 ); + s = s.simplifyWhiteSpace(); + if ( s[ 0 ] != '<' && s[ 0 ] != '"' ) { + s.prepend( "\"" ); + s.append( "\"" ); + } + if ( s[ 0 ] == '<' ) { + s.remove( (uint)0, 1 ); + s.remove( s.length() - 1, 1 ); + MetaDataBase::Include inc; + inc.header = s; + inc.implDecl = "in declaration"; + inc.location = "global"; + includes << inc; + } else { + s.remove( (uint)0, 1 ); + s.remove( s.length() - 1, 1 ); + MetaDataBase::Include inc; + inc.header = s; + inc.implDecl = "in declaration"; + inc.location = "local"; + includes << inc; + } + } + MetaDataBase::setIncludes( formWindow, includes ); + formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup(); +} + +QStringList DesignerFormWindowImpl::forwardDeclarations() const +{ + return MetaDataBase::forwards( formWindow ); +} + +void DesignerFormWindowImpl::setForwardDeclarations( const QStringList &lst ) +{ + MetaDataBase::setForwards( formWindow, lst ); + formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup(); +} + +QStringList DesignerFormWindowImpl::signalList() const +{ + return MetaDataBase::signalList( formWindow ); +} + +void DesignerFormWindowImpl::setSignalList( const QStringList &lst ) +{ + MetaDataBase::setSignalList( formWindow, lst ); + formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup(); +} + +void DesignerFormWindowImpl::onModificationChange( QObject *receiver, const char *slot ) +{ + QObject::connect( formWindow, SIGNAL( modificationChanged( bool, FormWindow * ) ), receiver, slot ); +} + +void DesignerFormWindowImpl::addMenu( const QString &text, const QString &name ) +{ + if ( !::qt_cast(formWindow->mainContainer()) ) + return; + + QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); + PopupMenuEditor *popup = new PopupMenuEditor( formWindow, mw ); + QString n = name; + formWindow->unify( popup, n, TRUE ); + popup->setName( n ); + MenuBarEditor *mb = (MenuBarEditor *)mw->child( 0, "MenuBarEditor" ); + if ( !mb ) { + mb = new MenuBarEditor( formWindow, mw ); + mb->setName( "MenuBar" ); + MetaDataBase::addEntry( mb ); + } + mb->insertItem( text, popup ); + MetaDataBase::addEntry( popup ); +} + +void DesignerFormWindowImpl::addMenuAction( const QString &menu, QAction *a ) +{ + if ( !::qt_cast(formWindow->mainContainer()) ) + return; + QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); + if ( !mw->child( 0, "MenuBarEditor" ) ) + return; + PopupMenuEditor *popup = (PopupMenuEditor*)mw->child( menu, "PopupMenuEditor" ); + if ( !popup ) + return; + popup->insert( a ); +} + +void DesignerFormWindowImpl::addMenuSeparator( const QString &menu ) +{ + if ( !::qt_cast(formWindow->mainContainer()) ) + return; + QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); + if ( !mw->child( 0, "MenuBarEditor" ) ) + return; + PopupMenuEditor *popup = (PopupMenuEditor*)mw->child( menu, "PopupMenuEditor" ); + if ( !popup ) + return; + QAction *a = new QSeparatorAction( 0 ); + popup->insert( a ); +} + +void DesignerFormWindowImpl::addToolBar( const QString &text, const QString &name ) +{ + if ( !::qt_cast(formWindow->mainContainer()) ) + return; + QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); + QToolBar *tb = new QDesignerToolBar( mw ); + QString n = name; + formWindow->unify( tb, n, TRUE ); + tb->setName( n ); + mw->addToolBar( tb, text ); +} + +void DesignerFormWindowImpl::addToolBarAction( const QString &tbn, QAction *a ) +{ + if ( !::qt_cast(formWindow->mainContainer()) ) + return; + QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); + QDesignerToolBar *tb = (QDesignerToolBar*)mw->child( tbn, "QDesignerToolBar" ); + if ( !tb ) + return; + a->addTo( tb ); + tb->addAction( a ); +} + +void DesignerFormWindowImpl::addToolBarSeparator( const QString &tbn ) +{ + if ( !::qt_cast(formWindow->mainContainer()) ) + return; + QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); + QDesignerToolBar *tb = (QDesignerToolBar*)mw->child( tbn, "QDesignerToolBar" ); + if ( !tb ) + return; + QAction *a = new QSeparatorAction( 0 ); + a->addTo( tb ); + tb->addAction( a ); +} + +DesignerDockImpl::DesignerDockImpl() +{ +} + +QDockWindow *DesignerDockImpl::dockWindow() const +{ + return 0; +} + +DesignerOutputDockImpl::DesignerOutputDockImpl( OutputWindow *ow ) + : outWin( ow ) +{ +} + +QWidget *DesignerOutputDockImpl::addView( const QString &title ) +{ + QWidget *page = new QWidget( outWin ); + outWin->addTab( page, title ); + return page; +} + +void DesignerOutputDockImpl::appendDebug( const QString &s ) +{ + outWin->appendDebug( s ); +} + +void DesignerOutputDockImpl::clearDebug() +{ +} + +void DesignerOutputDockImpl::appendError( const QString &s, int l ) +{ + QStringList ls; + ls << s; + QValueList ll; + ll << l; + outWin->setErrorMessages( ls, ll, FALSE, QStringList(), QObjectList() ); +} + +void DesignerOutputDockImpl::clearError() +{ +} + +DesignerSourceFileImpl::DesignerSourceFileImpl( SourceFile *e ) + : ed( e ) +{ +} + +QString DesignerSourceFileImpl::fileName() const +{ + return ed->fileName(); +} diff --git a/kdevdesigner/designer/designerappiface.h b/kdevdesigner/designer/designerappiface.h new file mode 100644 index 00000000..a9eace16 --- /dev/null +++ b/kdevdesigner/designer/designerappiface.h @@ -0,0 +1,277 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DESIGNERAPPIFACE_H +#define DESIGNERAPPIFACE_H + +#include "../interfaces/designerinterface.h" +#include "project.h" + +class FormWindow; +class MainWindow; +class Project; +class OutputWindow; +class SourceFile; + +class DesignerInterfaceImpl : public DesignerInterface +{ +public: + DesignerInterfaceImpl( MainWindow *mw ); + + DesignerProject *currentProject() const; + DesignerFormWindow *currentForm() const; + DesignerSourceFile *currentSourceFile() const; + QPtrList projectList() const; + void showStatusMessage( const QString &, int ms = 0 ) const; + DesignerDock *createDock() const; + DesignerOutputDock *outputDock() const; + void setModified( bool b, QWidget *window ); + void updateFunctionList(); + + void onProjectChange( QObject *receiver, const char *slot ); + void onFormChange( QObject *receiver, const char *slot ); + + bool singleProjectMode() const; + void showError( QWidget *widget, int line, const QString &message ); + void runFinished(); + void showStackFrame( QWidget *w, int line ); + void showDebugStep( QWidget *w, int line ); + void runProjectPrecondition(); + void runProjectPostcondition( QObjectList *l ); + + + QRESULT queryInterface( const QUuid &uuid, QUnknownInterface** iface ); + Q_REFCOUNT + +private: + MainWindow *mainWindow; + +}; + +class DesignerProjectImpl: public DesignerProject +{ +public: + DesignerProjectImpl( Project *pr ); + + QPtrList formList() const; + QStringList formNames() const; + QString formFileName( const QString &form ) const; + void addForm( DesignerFormWindow * ); + void removeForm( DesignerFormWindow * ); + QString fileName() const; + void setFileName( const QString & ); + QString projectName() const; + void setProjectName( const QString & ); + QString databaseFile() const; + void setDatabaseFile( const QString & ); + void setupDatabases() const; + QPtrList databaseConnections() const; + void addDatabase( DesignerDatabase * ); + void removeDatabase( DesignerDatabase * ); + void save() const; + void setLanguage( const QString & ); + QString language() const; + void setCustomSetting( const QString &key, const QString &value ); + QString customSetting( const QString &key ) const; + DesignerPixmapCollection *pixmapCollection() const; + void breakPoints( QMap > &bps ) const; + QString breakPointCondition( QObject *o, int line ) const; + void setBreakPointCondition( QObject *o, int line, const QString &condition ); + void clearAllBreakpoints() const; + void setIncludePath( const QString &platform, const QString &path ); + void setLibs( const QString &platform, const QString &path ); + void setDefines( const QString &platform, const QString &path ); + void setConfig( const QString &platform, const QString &config ); + void setTemplate( const QString &t ); + QString config( const QString &platform ) const; + QString libs( const QString &platform ) const; + QString defines( const QString &platform ) const; + QString includePath( const QString &platform ) const; + QString templte() const; + bool isGenericObject( QObject *o ) const; + +private: + Project *project; + +}; + +#ifndef QT_NO_SQL +class QSqlDatabase; + +class DesignerDatabaseImpl: public DesignerDatabase +{ +public: + DesignerDatabaseImpl( DatabaseConnection *d ); + + QString name() const; + void setName( const QString & ); + QString driver() const; + void setDriver( const QString & ); + QString database() const; + void setDatabase( const QString & ); + QString userName() const; + void setUserName( const QString & ); + QString password() const; + void setPassword( const QString & ); + QString hostName() const; + void setHostName( const QString & ); + QStringList tables() const; + void setTables( const QStringList & ); + QMap fields() const; + void setFields( const QMap & ); + void open( bool suppressDialog = TRUE ) const; + void close() const; + QSqlDatabase* connection(); +private: + DatabaseConnection *db; + +}; +#endif + +class DesignerPixmapCollectionImpl : public DesignerPixmapCollection +{ +public: + DesignerPixmapCollectionImpl( PixmapCollection *coll ); + void addPixmap( const QPixmap &p, const QString &name, bool force ); + QPixmap pixmap( const QString &name ) const; + +private: + PixmapCollection *pixCollection; + +}; + +class DesignerFormWindowImpl: public DesignerFormWindow +{ +public: + DesignerFormWindowImpl( FormWindow *fw ); + + QString name() const; + void setName( const QString &n ); + QString fileName() const; + void setFileName( const QString & ); + void save() const; + bool isModified() const; + void insertWidget( QWidget * ); + QWidget *create( const char *className, QWidget *parent, const char *name ); + void removeWidget( QWidget * ); + QWidgetList widgets() const; + void undo(); + void redo(); + void cut(); + void copy(); + void paste(); + void adjustSize(); + void editConnections(); + void checkAccels(); + void layoutH(); + void layoutV(); + void layoutHSplit(); + void layoutVSplit(); + void layoutG(); + void layoutHContainer( QWidget* w ); + void layoutVContainer( QWidget* w ); + void layoutGContainer( QWidget* w ); + void breakLayout(); + void selectWidget( QWidget * ); + void selectAll(); + void clearSelection(); + bool isWidgetSelected( QWidget * ) const; + QWidgetList selectedWidgets() const; + QWidget *currentWidget() const; + QWidget *form() const; + void setCurrentWidget( QWidget * ); + QPtrList actionList() const; + QAction *createAction( const QString& text, const QIconSet& icon, const QString& menuText, int accel, + QObject* parent, const char* name = 0, bool toggle = FALSE ); + void addAction( QAction * ); + void removeAction( QAction * ); + void preview() const; + void addFunction( const QCString &function, const QString& specifier, const QString &access, + const QString &type, const QString &language, const QString &returnType ); + void addConnection( QObject *sender, const char *signal, QObject *receiver, const char *slot ); + void setProperty( QObject *o, const char *property, const QVariant &value ); + QVariant property( QObject *o, const char *property ) const; + void setPropertyChanged( QObject *o, const char *property, bool changed ); + bool isPropertyChanged( QObject *o, const char *property ) const; + void setColumnFields( QObject *o, const QMap & ); + QStringList implementationIncludes() const; + QStringList declarationIncludes() const; + void setImplementationIncludes( const QStringList &lst ); + void setDeclarationIncludes( const QStringList &lst ); + QStringList forwardDeclarations() const; + void setForwardDeclarations( const QStringList &lst ); + QStringList signalList() const; + void setSignalList( const QStringList &lst ); + void addMenu( const QString &text, const QString &name ); + void addMenuAction( const QString &menu, QAction *a ); + void addMenuSeparator( const QString &menu ); + void addToolBar( const QString &text, const QString &name ); + void addToolBarAction( const QString &tb, QAction *a ); + void addToolBarSeparator( const QString &tb ); + + void onModificationChange( QObject *receiver, const char *slot ); + +private: + FormWindow *formWindow; + +}; + +class DesignerDockImpl: public DesignerDock +{ +public: + DesignerDockImpl(); + + QDockWindow *dockWindow() const; +}; + +class DesignerOutputDockImpl: public DesignerOutputDock +{ +public: + DesignerOutputDockImpl( OutputWindow *ow ); + + QWidget *addView( const QString &pageName ); + void appendDebug( const QString & ); + void clearDebug(); + void appendError( const QString &, int ); + void clearError(); + +private: + OutputWindow *outWin; + +}; + +class DesignerSourceFileImpl : public DesignerSourceFile +{ +public: + DesignerSourceFileImpl( SourceFile *e ); + QString fileName() const; + +private: + SourceFile *ed; + +}; + +#endif diff --git a/kdevdesigner/designer/editfunctions.ui b/kdevdesigner/designer/editfunctions.ui new file mode 100644 index 00000000..2cecdcb1 --- /dev/null +++ b/kdevdesigner/designer/editfunctions.ui @@ -0,0 +1,714 @@ + +EditFunctionsBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + EditFunctionsBase + + + + 0 + 0 + 600 + 371 + + + + Edit Functions + + + true + + + <b>Edit Functions</b><p>Add, edit or delete the current form's slots or functions.</p><p>Click the <b>Add Function</b>-button to create a new function; enter a name, choose an access mode and specify if it should be a slot or normal function.</p><p>Select an entry from the list and click the <b>Delete Function</b>-button to remove a function; in case of a slot all connections using this slot will also be removed.</p> + + + + unnamed + + + 11 + + + 6 + + + + + Function + + + true + + + true + + + + + Return Type + + + true + + + true + + + + + Specifier + + + true + + + true + + + + + Access + + + true + + + true + + + + + Type + + + true + + + true + + + + + In Use + + + true + + + true + + + + functionListView + + + + 7 + 7 + 0 + 0 + + + + StyledPanel + + + Sunken + + + true + + + true + + + <b>This form's functions.</b><p>Select the function you want to change or delete.</p> + + + + + Layout11 + + + + unnamed + + + 6 + + + + showOnlySlots + + + StrongFocus + + + Only d&isplay slots + + + Change displaying mode for functions + + + <b>Check this button if only the slots should be displayed</b><p>Otherwise all functions, i.e. normal C++ functions and slots are displayed.</p> + + + + + + Vertical Spacing1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + addFunction + + + &New Function + + + Add new function + + + <b>Add a new function.</b><p>New functions have a default name and public access.</p> + + + + + deleteFunction + + + &Delete Function + + + Delete function + + + <b>Delete the selected function.</b><p>All connections using this function are also removed.</p> + + + + + + + boxProperties + + + + 5 + 5 + 0 + 0 + + + + Function Properties + + + + unnamed + + + 11 + + + 6 + + + + Layout14 + + + + unnamed + + + 0 + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + Label8 + + + &Function: + + + AlignVCenter|AlignRight + + + functionName + + + + + functionName + + + + 7 + 0 + 0 + 0 + + + + Change function name + + + <b>Change the name of the selected function.</b><p>The name should include the argument list and must be syntactically correct.</p> + + + + + labelType + + + &Return type: + + + AlignVCenter|AlignRight + + + editType + + + + + editType + + + + 5 + 0 + 0 + 0 + + + + Change the return type of the function + + + <b>Change the return type of the selected function.</b><p>Specifiy here the datatype which should be returned by the function.</p> + + + + + + + Spacer6_2 + + + Vertical + + + Fixed + + + + 20 + 16 + + + + + + Layout13 + + + + unnamed + + + 0 + + + + Label9_2 + + + S&pecifier: + + + AlignVCenter|AlignRight + + + functionSpecifier + + + + + + non virtual + + + + + virtual + + + + + pure virtual + + + + + static + + + + functionSpecifier + + + + 1 + 0 + 0 + 0 + + + + Change function access + + + <b>Change the access policy of the function</b><p>All functions are created virtual and should be reimplemented in subclasses.</p> + + + + + TextLabel1 + + + &Access: + + + WordBreak|AlignVCenter|AlignRight + + + functionAccess + + + + + + public + + + + + protected + + + + + private + + + + functionAccess + + + + 1 + 0 + 0 + 0 + + + + Change function access + + + <b>Change the access policy of the function</b><p>All functions are created virtual and should be reimplemented in subclasses.</p> + + + + + TextLabel1_2 + + + &Type: + + + AlignVCenter|AlignRight + + + functionType + + + + + + slot + + + + + function + + + + functionType + + + Change function type + + + <b>Change the type of the function.</b><p>The type specifies if the function is either a slot or a normal C++ function.</p> + + + + + Spacer5 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okButton + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + cancelButton + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + cancelButton + clicked() + EditFunctionsBase + reject() + + + okButton + clicked() + EditFunctionsBase + okClicked() + + + deleteFunction + clicked() + EditFunctionsBase + functionRemove() + + + addFunction + clicked() + EditFunctionsBase + functionAdd() + + + functionName + textChanged(const QString&) + EditFunctionsBase + currentTextChanged(const QString&) + + + functionListView + selectionChanged(QListViewItem*) + EditFunctionsBase + currentItemChanged(QListViewItem*) + + + functionListView + currentChanged(QListViewItem*) + EditFunctionsBase + currentItemChanged(QListViewItem*) + + + editType + textChanged(const QString&) + EditFunctionsBase + currentReturnTypeChanged(const QString&) + + + functionSpecifier + activated(const QString&) + EditFunctionsBase + currentSpecifierChanged(const QString&) + + + functionAccess + activated(const QString&) + EditFunctionsBase + currentAccessChanged(const QString&) + + + functionType + activated(const QString&) + EditFunctionsBase + currentTypeChanged(const QString&) + + + showOnlySlots + toggled(bool) + EditFunctionsBase + displaySlots(bool) + + + + functionName + editType + functionSpecifier + functionAccess + functionType + helpButton + okButton + cancelButton + functionListView + showOnlySlots + addFunction + deleteFunction + + + currentItemChanged( QListViewItem * ) + currentSpecifierChanged( const QString & ) + currentTextChanged( const QString & ) + currentReturnTypeChanged( const QString & ) + destroy() + init() + currentAccessChanged( const QString & ) + currentTypeChanged( const QString & ) + okClicked() + functionAdd() + functionRemove() + displaySlots( bool ) + + + diff --git a/kdevdesigner/designer/editfunctionsimpl.cpp b/kdevdesigner/designer/editfunctionsimpl.cpp new file mode 100644 index 00000000..19506e22 --- /dev/null +++ b/kdevdesigner/designer/editfunctionsimpl.cpp @@ -0,0 +1,534 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "editfunctionsimpl.h" +#include "formwindow.h" +#include "metadatabase.h" +#include "asciivalidator.h" +#include "mainwindow.h" +#include "hierarchyview.h" +#include "project.h" + +#include +#include +#include "kdevdesigner_part.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +EditFunctions::EditFunctions( QWidget *parent, FormWindow *fw, bool justSlots ) + : EditFunctionsBase( parent, 0, TRUE ), formWindow( fw ) +{ + connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + + id = 0; + functList.clear(); + + QValueList functionList = MetaDataBase::functionList( fw ); + for ( QValueList::Iterator it = functionList.begin(); it != functionList.end(); ++it ) { + QListViewItem *i = new QListViewItem( functionListView ); + + i->setPixmap( 0, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()) ); + i->setText( 0, (*it).function ); + i->setText( 1, (*it).returnType ); + i->setText( 2, (*it).specifier ); + i->setText( 3, (*it).access ); + i->setText( 4, (*it).type ); + + FunctItem fui; + fui.id = id; + fui.oldName = (*it).function; + fui.newName = fui.oldName; + fui.oldRetTyp = (*it).returnType; + fui.retTyp = fui.oldRetTyp; + fui.oldSpec = (*it).specifier; + fui.spec = fui.oldSpec; + fui.oldAccess = (*it).access; + fui.access = fui.oldAccess; + fui.oldType = (*it).type; + fui.type = fui.oldType; + functList.append( fui ); + + functionIds.insert( i, id ); + id++; + + if ( (*it).type == "slot" ) { + if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).function ).latin1() ) ) + i->setText( 5, i18n( "Yes" ) ); + else + i->setText( 5, i18n( "No" ) ); + } else { + i->setText( 5, "---" ); + } + } + + boxProperties->setEnabled( FALSE ); + functionName->setValidator( new AsciiValidator( TRUE, functionName ) ); + + if ( functionListView->firstChild() ) + functionListView->setCurrentItem( functionListView->firstChild() ); + + showOnlySlots->setChecked( justSlots ); + lastType = "function"; + + // Enable rename for all QListViewItems + QListViewItemIterator lvit = functionListView->firstChild(); + for ( ; *lvit; lvit++ ) + (*lvit)->setRenameEnabled( 0, TRUE ); + + // Connect listview signal to signal-relay + QObject::connect( functionListView, + SIGNAL( itemRenamed( QListViewItem*, int, const QString & ) ), + this, + SLOT( emitItemRenamed(QListViewItem*, int, const QString&) ) ); + + // Connect signal-relay to QLineEdit "functionName" + QObjectList *l = parent->queryList( "QLineEdit", "functionName" ); + QObject *obj; + QObjectListIt itemsLineEditIt( *l ); + while ( (obj = itemsLineEditIt.current()) != 0 ) { + ++itemsLineEditIt; + QObject::connect( this, + SIGNAL( itemRenamed( const QString & ) ), + obj, + SLOT( setText( const QString & ) ) ); + } + delete l; +} + +void EditFunctions::okClicked() +{ + QValueList functionList = MetaDataBase::functionList( formWindow ); + QString n = i18n( "Add/Remove functions of '%1'" ).arg( formWindow->name() ); + QPtrList commands; + QValueList::Iterator fit; + if ( !functionList.isEmpty() ) { + for ( fit = functionList.begin(); fit != functionList.end(); ++fit ) { + bool functionFound = FALSE; + QValueList::Iterator it = functList.begin(); + for ( ; it != functList.end(); ++it ) { + if ( MetaDataBase::normalizeFunction( (*it).oldName ) == + MetaDataBase::normalizeFunction( (*fit).function ) ) { + functionFound = TRUE; + break; + } + } + if ( !functionFound ) + commands.append( new RemoveFunctionCommand( i18n( "Remove Function" ), + formWindow, (*fit).function, (*fit).specifier, + (*fit).access, + (*fit).type, + formWindow->project()->language(), + (*fit).returnType ) ); + } + } + + bool invalidFunctions = FALSE; + QValueList invalidItems; + + if ( !functList.isEmpty() ) { + QStrList lst; + QValueList::Iterator it = functList.begin(); + for ( ; it != functList.end(); ++it ) { + MetaDataBase::Function function; + function.function = (*it).newName; + function.returnType = (*it).retTyp; + function.specifier = (*it).spec; + function.access = (*it).access; + function.type = (*it).type; + function.language = formWindow->project()->language(); + if ( function.returnType.isEmpty() ) + function.returnType = "void"; + QString s = function.function; + s = s.simplifyWhiteSpace(); + bool startNum = s[ 0 ] >= '0' && s[ 0 ] <= '9'; + bool noParens = s.contains( '(' ) != 1 || s.contains( ')' ) != 1; + bool illegalSpace = s.find( ' ' ) != -1 && s.find( ' ' ) < s.find( '(' ); + + if ( startNum || noParens || illegalSpace || lst.find( function.function ) != -1 ) { + invalidFunctions = TRUE; + invalidItems.append( (*it) ); + continue; + } + bool functionFound = FALSE; + for ( fit = functionList.begin(); fit != functionList.end(); ++fit ) { + if ( MetaDataBase::normalizeFunction( (*fit).function ) == + MetaDataBase::normalizeFunction( (*it).oldName ) ) { + functionFound = TRUE; + break; + } + } + if ( !functionFound ) + commands.append( new AddFunctionCommand( i18n( "Add Function" ), + formWindow, function.function, function.specifier, + function.access, + function.type, formWindow->project()->language(), + function.returnType ) ); + if ( MetaDataBase::normalizeFunction( (*it).newName ) != MetaDataBase::normalizeFunction( (*it).oldName ) || + (*it).spec != (*it).oldSpec || (*it).access != (*it).oldAccess || (*it).type != (*it).oldType || + (*it).retTyp != (*it).oldRetTyp ) { + QString normalizedOldName = MetaDataBase::normalizeFunction( (*it).oldName ); + if ((*it).oldName.endsWith("const")) // make sure we get the 'const' when we remove the old name + normalizedOldName += " const"; + commands.append( new ChangeFunctionAttribCommand( i18n( "Change Function Attributes" ), + formWindow, function, normalizedOldName, + (*it).oldSpec, (*it).oldAccess, (*it).oldType, + formWindow->project()->language(), (*it).oldRetTyp ) ); + } + lst.append( function.function ); + } + } + + if ( invalidFunctions ) { + if ( QMessageBox::information( this, i18n( "Edit Functions" ), + i18n( "Some syntactically incorrect functions have been defined.\n" + "Remove these functions?" ), i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) { + QValueList::Iterator it = functList.begin(); + while ( it != functList.end() ) { + bool found = FALSE; + QValueList::Iterator vit = invalidItems.begin(); + for ( ; vit != invalidItems.end(); ++vit ) { + if ( (*vit).newName == (*it).newName ) { + invalidItems.remove( vit ); + found = TRUE; + break; + } + } + if ( found ) { + int delId = (*it).id; + it = functList.remove( it ); + QMap::Iterator fit = functionIds.begin(); + while ( fit != functionIds.end() ) { + if ( *fit == delId ) { + QListViewItem *litem = fit.key(); + functionIds.remove( fit ); + delete litem; + if ( functionListView->currentItem() ) + functionListView->setSelected( functionListView->currentItem(), TRUE ); + currentItemChanged( functionListView->currentItem() ); + break; + } + ++fit; + } + } + else + ++it; + } + if ( functionListView->firstChild() ) { + functionListView->setCurrentItem( functionListView->firstChild() ); + functionListView->setSelected( functionListView->firstChild(), TRUE ); + } + } + formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + return; + } + + if ( !commands.isEmpty() ) { + MacroCommand *cmd = new MacroCommand( n, formWindow, commands ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + + formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + accept(); +} + +void EditFunctions::functionAdd( const QString &access, const QString &type ) +{ + QListViewItem *i = new QListViewItem( functionListView ); + i->setPixmap( 0, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()) ); + i->setRenameEnabled( 0, TRUE ); + i->setText( 1, "void" ); + i->setText( 2, "virtual" ); + + if ( access.isEmpty() ) + i->setText( 3, "public" ); + else + i->setText( 3, access ); + + if( type.isEmpty() ) { + if ( showOnlySlots->isChecked() ) + i->setText( 4, "slot" ); + else { + i->setText( 4, lastType ); + } + } else { + i->setText( 4, type ); + } + + if ( i->text( 4 ) == "slot" ) { + i->setText( 0, "newSlot()" ); + if ( MetaDataBase::isSlotUsed( formWindow, "newSlot()" ) ) + i->setText( 5, i18n( "Yes" ) ); + else + i->setText( 5, i18n( "No" ) ); + } else { + i->setText( 0, "newFunction()" ); + i->setText( 5, "---" ); + } + + functionListView->setCurrentItem( i ); + functionListView->setSelected( i, TRUE ); + functionListView->ensureItemVisible( i ); + functionName->setFocus(); + functionName->selectAll(); + + FunctItem fui; + fui.id = id; + fui.oldName = i->text( 0 ); + fui.newName = fui.oldName; + fui.oldRetTyp = i->text( 1 ); + fui.retTyp = fui.oldRetTyp; + fui.oldSpec = i->text ( 2 ); + fui.spec = fui.oldSpec; + fui.oldAccess = i->text( 3 ); + fui.access = fui.oldAccess; + fui.oldType = i->text( 4 ); + fui.type = fui.oldType; + lastType = fui.oldType; + functList.append( fui ); + functionIds.insert( i, id ); + id++; +} + +void EditFunctions::functionRemove() +{ + if ( !functionListView->currentItem() ) + return; + + functionListView->blockSignals( TRUE ); + removedFunctions << MetaDataBase::normalizeFunction( functionListView->currentItem()->text( 0 ) ); + int delId = functionIds[ functionListView->currentItem() ]; + QValueList::Iterator it = functList.begin(); + while ( it != functList.end() ) { + if ( (*it).id == delId ) { + functList.remove( it ); + break; + } + ++it; + } + functionIds.remove( functionListView->currentItem() ); + delete functionListView->currentItem(); + if ( functionListView->currentItem() ) + functionListView->setSelected( functionListView->currentItem(), TRUE ); + functionListView->blockSignals( FALSE ); + currentItemChanged( functionListView->currentItem() ); +} + +void EditFunctions::currentItemChanged( QListViewItem *i ) +{ + functionName->blockSignals( TRUE ); + functionName->setText( "" ); + functionAccess->setCurrentItem( 0 ); + functionName->blockSignals( FALSE ); + + if ( !i ) { + boxProperties->setEnabled( FALSE ); + return; + } + + functionName->blockSignals( TRUE ); + functionName->setText( i->text( 0 ) ); + editType->setText( i->text( 1 ) ); + QString specifier = i->text( 2 ); + QString access = i->text( 3 ); + QString type = i->text( 4 ); + if ( specifier == "pure virtual" ) + functionSpecifier->setCurrentItem( 2 ); + else if ( specifier == "non virtual" ) + functionSpecifier->setCurrentItem( 0 ); + else if ( specifier == "virtual" ) + functionSpecifier->setCurrentItem( 1 ); + else + functionSpecifier->setCurrentItem( 3 ); + if ( access == "private" ) + functionAccess->setCurrentItem( 2 ); + else if ( access == "protected" ) + functionAccess->setCurrentItem( 1 ); + else + functionAccess->setCurrentItem( 0 ); + if ( type == "slot" ) + functionType->setCurrentItem( 0 ); + else + functionType->setCurrentItem( 1 ); + + functionName->blockSignals( FALSE ); + boxProperties->setEnabled( TRUE ); +} + +void EditFunctions::currentTextChanged( const QString &txt ) +{ + if ( !functionListView->currentItem() ) + return; + + changeItem( functionListView->currentItem(), Name, txt ); + functionListView->currentItem()->setText( 0, txt ); + + if ( functionListView->currentItem()->text( 4 ) == "slot" ) { + if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( txt.latin1() ).latin1() ) ) + functionListView->currentItem()->setText( 5, i18n( "Yes" ) ); + else + functionListView->currentItem()->setText( 5, i18n( "No" ) ); + } else { + functionListView->currentItem()->setText( 5, "---" ); + } +} + +void EditFunctions::currentSpecifierChanged( const QString& s ) +{ + if ( !functionListView->currentItem() ) + return; + + changeItem( functionListView->currentItem(), Specifier, s ); + functionListView->currentItem()->setText( 2, s ); +} + +void EditFunctions::currentAccessChanged( const QString& a ) +{ + if ( !functionListView->currentItem() ) + return; + changeItem( functionListView->currentItem(), Access, a ); + functionListView->currentItem()->setText( 3, a ); +} + + +void EditFunctions::currentReturnTypeChanged( const QString &type ) +{ + if ( !functionListView->currentItem() ) + return; + changeItem( functionListView->currentItem(), ReturnType, type ); + functionListView->currentItem()->setText( 1, type ); +} + +void EditFunctions::currentTypeChanged( const QString &type ) +{ + if ( !functionListView->currentItem() ) + return; + changeItem( functionListView->currentItem(), Type, type ); + lastType = type; + functionListView->currentItem()->setText( 4, type ); + if ( type == "slot" ) { + if ( MetaDataBase::isSlotUsed( formWindow, + MetaDataBase::normalizeFunction( functionListView->currentItem()->text( 0 ).latin1() ).latin1() ) ) + functionListView->currentItem()->setText( 5, i18n( "Yes" ) ); + else + functionListView->currentItem()->setText( 5, i18n( "No" ) ); + } else { + functionListView->currentItem()->setText( 5, "---" ); + } +} + +void EditFunctions::changeItem( QListViewItem *item, Attribute a, const QString &nV ) +{ + int itemId; + QMap::Iterator fit = functionIds.find( item ); + if ( fit != functionIds.end() ) + itemId = *fit; + else + return; + + QValueList::Iterator it = functList.begin(); + for ( ; it != functList.end(); ++it ) { + if ( (*it).id == itemId ) { + switch( a ) { + case Name: + (*it).newName = nV; + break; + case Specifier: + (*it).spec = nV; + break; + case Access: + (*it).access = nV; + break; + case ReturnType: + (*it).retTyp = nV; + break; + case Type: + (*it).type = nV; + break; + } + } + } +} + +void EditFunctions::setCurrentFunction( const QString &function ) +{ + QListViewItemIterator it( functionListView ); + while ( it.current() ) { + if ( MetaDataBase::normalizeFunction( it.current()->text( 0 ) ) == function ) { + functionListView->setCurrentItem( it.current() ); + functionListView->setSelected( it.current(), TRUE ); + currentItemChanged( it.current() ); + return; + } + ++it; + } +} + +void EditFunctions::displaySlots( bool justSlots ) +{ + functionIds.clear(); + functionListView->clear(); + for ( QValueList::Iterator it = functList.begin(); it != functList.end(); ++it ) { + if ( (*it).type == "function" && justSlots ) + continue; + QListViewItem *i = new QListViewItem( functionListView ); + functionIds.insert( i, (*it).id ); + i->setPixmap( 0, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()) ); + i->setText( 0, (*it).newName ); + i->setText( 1, (*it).retTyp ); + i->setText( 2, (*it).spec ); + i->setText( 3, (*it).access ); + i->setText( 4, (*it).type ); + + if ( (*it).type == "slot" ) { + if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).newName ).latin1() ) ) + i->setText( 5, i18n( "Yes" ) ); + else + i->setText( 5, i18n( "No" ) ); + } else { + i->setText( 5, "---" ); + } + } + + if ( functionListView->firstChild() ) + functionListView->setSelected( functionListView->firstChild(), TRUE ); +} + +void EditFunctions::emitItemRenamed( QListViewItem *, int, const QString & text ) +{ + emit itemRenamed( text ); // Relay signal ( to QLineEdit ) +} diff --git a/kdevdesigner/designer/editfunctionsimpl.h b/kdevdesigner/designer/editfunctionsimpl.h new file mode 100644 index 00000000..f19f9d72 --- /dev/null +++ b/kdevdesigner/designer/editfunctionsimpl.h @@ -0,0 +1,94 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef EDITFUNCTIONSIMPL_H +#define EDITFUNCTIONSIMPL_H + +#include "editfunctions.h" +#include "hierarchyview.h" +#include "metadatabase.h" +#include + +class FormWindow; +class QListViewItem; + +class EditFunctions : public EditFunctionsBase +{ + Q_OBJECT + +public: + EditFunctions( QWidget *parent, FormWindow *fw, bool showOnlySlots = FALSE ); + + void setCurrentFunction( const QString &function ); + void functionAdd( const QString &access = QString::null, + const QString &type = QString::null ); + void functionAdd() { functionAdd( "public" ); } + +signals: + void itemRenamed(const QString &); + +protected slots: + void okClicked(); + void functionRemove(); + void currentItemChanged( QListViewItem * ); + void currentTextChanged( const QString &txt ); + void currentSpecifierChanged( const QString &s ); + void currentAccessChanged( const QString &a ); + void currentReturnTypeChanged( const QString &type ); + void currentTypeChanged( const QString &type ); + void displaySlots( bool justSlots ); + void emitItemRenamed( QListViewItem *, int, const QString & ); + +private: + enum Attribute { Name, Specifier, Access, ReturnType, Type }; + struct FunctItem { + int id; + QString oldName; + QString newName; + QString oldRetTyp; + QString retTyp; + QString spec; + QString oldSpec; + QString access; + QString oldAccess; + QString type; + QString oldType; + + Q_DUMMY_COMPARISON_OPERATOR( FunctItem ) + }; + + void changeItem( QListViewItem *item, Attribute a, const QString &nV ); + + FormWindow *formWindow; + QMap functionIds; + QStringList removedFunctions; + QValueList itemList; + QValueList functList; + int id; + QString lastType; +}; + +#endif diff --git a/kdevdesigner/designer/filechooser.cpp b/kdevdesigner/designer/filechooser.cpp new file mode 100644 index 00000000..5a882b37 --- /dev/null +++ b/kdevdesigner/designer/filechooser.cpp @@ -0,0 +1,90 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "filechooser.h" +#include +#include +#include +#include + +#include + +FileChooser::FileChooser( QWidget *parent, const char *name ) + : QWidget( parent, name ), md( File ) +{ + QHBoxLayout *layout = new QHBoxLayout( this ); + layout->setMargin( 0 ); + + lineEdit = new QLineEdit( this, "filechooser_lineedit" ); + layout->addWidget( lineEdit ); + + connect( lineEdit, SIGNAL( textChanged( const QString & ) ), + this, SIGNAL( fileNameChanged( const QString & ) ) ); + + button = new QPushButton( "...", this, "filechooser_button" ); + button->setFixedWidth( button->fontMetrics().width( " ... " ) ); + layout->addWidget( button ); + + connect( button, SIGNAL( clicked() ), + this, SLOT( chooseFile() ) ); + + setFocusProxy( lineEdit ); +} + +void FileChooser::setMode( Mode m ) +{ + md = m; +} + +FileChooser::Mode FileChooser::mode() const +{ + return md; +} + +void FileChooser::setFileName( const QString &fn ) +{ + lineEdit->setText( fn ); +} + +QString FileChooser::fileName() const +{ + return lineEdit->text(); +} + +void FileChooser::chooseFile() +{ + QString fn; + if ( mode() == File ) + fn = KFileDialog::getOpenFileName( lineEdit->text(), QString::null, this ); + else + fn = KFileDialog::getExistingDirectory( lineEdit->text(),this ); + + if ( !fn.isEmpty() ) { + lineEdit->setText( fn ); + emit fileNameChanged( fn ); + } +} + diff --git a/kdevdesigner/designer/filechooser.h b/kdevdesigner/designer/filechooser.h new file mode 100644 index 00000000..6647a1d5 --- /dev/null +++ b/kdevdesigner/designer/filechooser.h @@ -0,0 +1,68 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef FILECHOOSER_H +#define FILECHOOSER_H + +#include + +class QLineEdit; +class QPushButton; + +class FileChooser : public QWidget +{ + Q_OBJECT + + Q_ENUMS( Mode ) + Q_PROPERTY( Mode mode READ mode WRITE setMode ) + Q_PROPERTY( QString fileName READ fileName WRITE setFileName ) + +public: + FileChooser( QWidget *parent = 0, const char *name = 0); + + enum Mode { File, Directory }; + + QString fileName() const; + Mode mode() const; + +public slots: + void setFileName( const QString &fn ); + void setMode( Mode m ); + +signals: + void fileNameChanged( const QString & ); + +private slots: + void chooseFile(); + +private: + QLineEdit *lineEdit; + QPushButton *button; + Mode md; + +}; + +#endif diff --git a/kdevdesigner/designer/finddialog.ui b/kdevdesigner/designer/finddialog.ui new file mode 100644 index 00000000..3923d1ef --- /dev/null +++ b/kdevdesigner/designer/finddialog.ui @@ -0,0 +1,274 @@ + +FindDialog +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + FindDialog + + + + 0 + 0 + 285 + 189 + + + + Find Text + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + F&ind: + + + comboFind + + + + + comboFind + + + + 7 + 0 + 0 + 0 + + + + true + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + PushButton1 + + + &Find + + + true + + + + + PushButton2 + + + &Close + + + + + + + ButtonGroup2 + + + Direction + + + + unnamed + + + 11 + + + 6 + + + + radioForward + + + Forwar&d + + + true + + + + + radioBackward + + + Bac&kward + + + + + + + ButtonGroup1 + + + Options + + + + unnamed + + + 11 + + + 6 + + + + checkWords + + + &Whole words only + + + + + checkCase + + + Case &sensitive + + + + + checkBegin + + + Start at &beginning + + + + + + + + + PushButton1 + clicked() + FindDialog + doFind() + + + PushButton2 + clicked() + FindDialog + reject() + + + + comboFind + checkWords + checkCase + checkBegin + radioForward + radioBackward + PushButton1 + PushButton2 + + + qlineedit.h + ../interfaces/editorinterface.h + finddialog.ui.h + + + struct EditorInterface; + + + EditorInterface *editor; + QObject *formWindow; + + + init() + destroy() + doFind() + setEditor( EditorInterface * e, QObject * fw ) + + + diff --git a/kdevdesigner/designer/finddialog.ui.h b/kdevdesigner/designer/finddialog.ui.h new file mode 100644 index 00000000..c9b4f230 --- /dev/null +++ b/kdevdesigner/designer/finddialog.ui.h @@ -0,0 +1,61 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +void FindDialog::init() +{ + editor = 0; + formWindow = 0; +} + +void FindDialog::destroy() +{ + if ( editor ) + editor->release(); +} + +void FindDialog::doFind() +{ + if ( !editor ) + return; + + if ( !editor->find( comboFind->currentText(), checkCase->isChecked(), + checkWords->isChecked(), radioForward->isChecked(), !checkBegin->isChecked() ) ) + checkBegin->setChecked( TRUE ); + else + checkBegin->setChecked( FALSE ); + +} + +void FindDialog::setEditor( EditorInterface * e, QObject * fw ) +{ + if ( fw != formWindow ) + checkBegin->setChecked( TRUE ); + formWindow = fw; + if ( editor ) + editor->release(); + editor = e; + editor->addRef(); +} diff --git a/kdevdesigner/designer/formfile.cpp b/kdevdesigner/designer/formfile.cpp new file mode 100644 index 00000000..cde7eb8b --- /dev/null +++ b/kdevdesigner/designer/formfile.cpp @@ -0,0 +1,905 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "formfile.h" +#include "timestamp.h" +#include "project.h" +#include "formwindow.h" +#include "command.h" +#include "sourceeditor.h" +#include "mainwindow.h" +#include "../interfaces/languageinterface.h" +#include "resource.h" +#include "workspace.h" +#include +#include +#include +#include "propertyeditor.h" +#include +#include +#include "designerappiface.h" +#include + +#include +#include +#include "kdevdesigner_part.h" + +static QString make_func_pretty( const QString &s ) +{ + QString res = s; + if ( res.find( ")" ) - res.find( "(" ) == 1 ) + return res; + res.replace( "(", "( " ); + res.replace( ")", " )" ); + res.replace( "&", " &" ); + res.replace( "*", " *" ); + res.replace( ",", ", " ); + res.replace( ":", " : " ); + res = res.simplifyWhiteSpace(); + res.replace( " : : ", "::" ); + res.replace( ">>", "> >" ); + return res; +} + +FormFile::FormFile( const QString &fn, bool temp, Project *p, const char *name ) + : filename( fn ), fileNameTemp( temp ), pro( p ), fw( 0 ), ed( 0 ), + timeStamp( 0, fn + codeExtension() ), codeEdited( FALSE ), pkg( FALSE ), + cm( FALSE ), codeFileStat( None ) +{ + MetaDataBase::addEntry( this ); + fake = qstrcmp( name, "qt_fakewindow" ) == 0; + //codeFileStat = FormFile::None; + pro->addFormFile( this ); + loadCode(); + if ( !temp ) + checkFileName( FALSE ); + + connect(this, SIGNAL(somethingChanged(FormFile* )), this, SLOT(emitNewStatus(FormFile* ))); +} + +FormFile::~FormFile() +{ + pro->removeFormFile( this ); + if ( formWindow() ) + formWindow()->setFormFile( 0 ); +} + +void FormFile::setFormWindow( FormWindow *f ) +{ + if ( f == fw ) + return; + if ( fw ) + fw->setFormFile( 0 ); + fw = f; + if ( fw ) + fw->setFormFile( this ); + parseCode( cod, FALSE ); + QTimer::singleShot( 0, this, SLOT( notifyFormWindowChange() ) ); +} + +void FormFile::setEditor( SourceEditor *e ) +{ + ed = e; +} + +void FormFile::setFileName( const QString &fn ) +{ + if ( fn == filename ) + return; + if ( fn.isEmpty() ) { + fileNameTemp = TRUE; + if ( filename.find( "unnamed" ) != 0 ) + filename = createUnnamedFileName(); + return; + } else { + fileNameTemp = FALSE; + } + filename = fn; + timeStamp.setFileName( filename + codeExtension() ); + cod = ""; + loadCode(); +} + +void FormFile::setCode( const QString &c ) +{ + cod = c; +} + +FormWindow *FormFile::formWindow() const +{ + return fw; +} + +SourceEditor *FormFile::editor() const +{ + return ed; +} + +QString FormFile::fileName() const +{ + return filename; +} + +QString FormFile::absFileName() const +{ + return pro->makeAbsolute( filename ); +} + +QString FormFile::codeFile() const +{ + QString codeExt = codeExtension(); + if ( codeExt.isEmpty() ) + return ""; + return filename + codeExt; +} + +QString FormFile::code() +{ + return cod; +} + +bool FormFile::save( bool withMsgBox, bool ignoreModified ) +{ + if ( fileNameTemp ) + return saveAs(); + if ( !ignoreModified && !isModified() ) + return TRUE; + if ( ed ) + ed->save(); + + if ( formWindow() && isModified( WFormWindow ) ) { + if ( withMsgBox ) { + if ( !formWindow()->checkCustomWidgets() ) + return FALSE; + } + + if ( QFile::exists( pro->makeAbsolute( filename ) ) ) { + QString fn( pro->makeAbsolute( filename ) ); +#if defined(Q_OS_WIN32) + fn += ".bak"; +#else + fn += "~"; +#endif + QFile f( pro->makeAbsolute( filename ) ); + if ( f.open( IO_ReadOnly ) ) { + QFile f2( fn ); + if ( f2.open( IO_WriteOnly | IO_Translate ) ) { + QCString data( f.size() ); + f.readBlock( data.data(), f.size() ); + f2.writeBlock( data ); + } else { + QMessageBox::warning( MainWindow::self, i18n( "Save" ), + i18n( "The file %1 could not be saved" ).arg( codeFile() ) ); + } + } + } + } + + if ( isModified( WFormCode ) ) { + if ( QFile::exists( pro->makeAbsolute( codeFile() ) ) ) { + QString fn( pro->makeAbsolute( codeFile() ) ); +#if defined(Q_OS_WIN32) + fn += ".bak"; +#else + fn += "~"; +#endif + QFile f( pro->makeAbsolute( codeFile() ) ); + if ( f.open( IO_ReadOnly ) ) { + QFile f2( fn ); + if ( f2.open( IO_WriteOnly | IO_Translate) ) { + QCString data( f.size() ); + f.readBlock( data.data(), f.size() ); + f2.writeBlock( data ); + } else if ( qApp->type() != QApplication::Tty ) { + QMessageBox::warning( MainWindow::self, i18n( "Save" ), + i18n( "The file %1 could not be saved" ).arg( codeFile() ) ); + } + } + } + } + + if ( formWindow() ) { + Resource resource( MainWindow::self ); + resource.setWidget( formWindow() ); + bool formCodeOnly = isModified( WFormCode ) && !isModified( WFormWindow ); + if ( !resource.save( pro->makeAbsolute( filename ), formCodeOnly ) ) { + if ( MainWindow::self ) + MainWindow::self->statusMessage( i18n( "Failed to save file '%1'.").arg( formCodeOnly ? codeFile(): filename ) ); + if ( formCodeOnly ) + return FALSE; + return saveAs(); + } + if ( MainWindow::self ) + MainWindow::self->statusMessage( i18n( "'%1' saved."). + arg( formCodeOnly ? codeFile() : filename )); + } else { + if ( !Resource::saveFormCode(this, MetaDataBase::languageInterface(pro->language())) ) + return FALSE; + } + timeStamp.update(); + setModified( FALSE ); + return TRUE; +} + +bool FormFile::saveAs( bool ignoreModified ) +{ + QString f = pro->makeAbsolute( fileName() ); + if ( fileNameTemp && formWindow() ) { + f = QString( formWindow()->name() ).lower(); + f.replace( "::", "_" ); + f = pro->makeAbsolute( f + ".ui" ); + } + bool saved = FALSE; + if ( ignoreModified ) { + QString dir = QStringList::split( ':', pro->iFace()->customSetting( "QTSCRIPT_PACKAGES" ) ).first(); + f = QFileInfo( f ).fileName(); + f.prepend( dir + "/" ); + } + QString fn; + while ( !saved ) { + fn = KFileDialog::getSaveFileName( f, + i18n( "*.ui|Qt User-Interface Files" ) + "\n" + + i18n( "*|All Files" ), MainWindow::self, /*0,*/ + i18n( "Save Form '%1' As").arg( formName() )/*, + MainWindow::self ? &MainWindow::self->lastSaveFilter : 0*/ ); + if ( fn.isEmpty() ) + return FALSE; + QFileInfo fi( fn ); + if ( fi.extension() != "ui" ) + fn += ".ui"; + fileNameTemp = FALSE; + filename = pro->makeRelative( fn ); + QFileInfo relfi( filename ); + if ( relfi.exists() ) { + if ( QMessageBox::warning( MainWindow::self, i18n( "File Already Exists" ), + i18n( "The file already exists. Do you wish to overwrite it?" ), + QMessageBox::Yes, + QMessageBox::No ) == QMessageBox::Yes ) { + saved = TRUE; + } else { + filename = f; + } + + } else { + saved = TRUE; + } + } + if ( !checkFileName( TRUE ) ) { + filename = f; + return FALSE; + } + pro->setModified( TRUE ); + timeStamp.setFileName( pro->makeAbsolute( codeFile() ) ); + if ( ed && formWindow() ) + ed->setCaption( i18n( "Edit %1" ).arg( formWindow()->name() ) ); + setModified( TRUE ); + if ( pro->isDummy() ) + fw->mainWindow()->addRecentlyOpenedFile( fn ); + return save( TRUE, ignoreModified ); +} + +bool FormFile::close() +{ + if ( editor() ) { + editor()->save(); + editor()->close(); + } + if ( formWindow() ) + return formWindow()->close(); + return TRUE; +} + +bool FormFile::closeEvent() +{ + if ( !isModified() && fileNameTemp ) { + pro->removeFormFile( this ); + return TRUE; + } + + if ( !isModified() ) + return TRUE; + + if ( editor() ) + editor()->save(); + + switch ( QMessageBox::warning( MainWindow::self, i18n( "Save Form" ), + i18n( "Save changes to form '%1'?" ).arg( filename ), + i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) { + case 0: // save + if ( !save() ) + return FALSE; + case 1: // don't save + loadCode(); + if ( ed ) + ed->editorInterface()->setText( cod ); + if ( fileNameTemp ) + pro->removeFormFile( this ); + if ( MainWindow::self ) + MainWindow::self->workspace()->update(); + break; + case 2: // cancel + return FALSE; + default: + break; + } + + setModified( FALSE ); + if ( MainWindow::self ) + MainWindow::self->updateFunctionList(); + setCodeEdited( FALSE ); + return TRUE; +} + +void FormFile::setModified( bool m, int who ) +{ + if ( ( who & WFormWindow ) == WFormWindow ) + setFormWindowModified( m ); + if ( ( who & WFormCode ) == WFormCode ) + setCodeModified( m ); +} + +bool FormFile::isModified( int who ) +{ + if ( who == WFormWindow ) + return isFormWindowModified(); + if ( who == WFormCode ) + return isCodeModified(); + return isCodeModified() || isFormWindowModified(); +} + +bool FormFile::isFormWindowModified() const +{ + if ( !formWindow() || !formWindow()->commandHistory() ) + return FALSE; + return formWindow()->commandHistory()->isModified(); +} + +bool FormFile::isCodeModified() const +{ + if ( !editor() ) + return cm; + return editor()->isModified(); +} + +void FormFile::setFormWindowModified( bool m ) +{ + bool b = isFormWindowModified(); + if ( m == b ) + return; + if ( !formWindow() || !formWindow()->commandHistory() ) + return; + formWindow()->commandHistory()->setModified( m ); + emit somethingChanged( this ); +} + +void FormFile::setCodeModified( bool m ) +{ + bool b = isCodeModified(); + if ( m == b ) + return; + emit somethingChanged( this ); + cm = m; + if ( !editor() ) + return; + editor()->setModified( m ); +} + +void FormFile::showFormWindow() +{ + if ( !MainWindow::self ) + return; + if ( formWindow() ) { + if ( ( formWindow()->hasFocus() || + MainWindow::self->qWorkspace()->activeWindow() == formWindow() ) && + MainWindow::self->propertyeditor()->formWindow() != formWindow() ) { + MainWindow::self->propertyeditor()->setWidget( formWindow()->currentWidget(), formWindow() ); + MainWindow::self->objectHierarchy()->setFormWindow( formWindow(), + formWindow()->currentWidget() ); + } + formWindow()->setFocus(); + return; + } + MainWindow::self->openFormWindow( pro->makeAbsolute( filename ), TRUE, this ); +} + +bool FormFile::setupUihFile( bool askForUih ) +{ + if ( !pro->isCpp() || !askForUih ) { + if ( !hasFormCode() ) { + createFormCode(); + setModified( TRUE ); + } + codeFileStat = FormFile::Ok; + return TRUE; + } + if ( codeFileStat != FormFile::Ok && !ed ) { + if ( hasFormCode() ) { + int i = QMessageBox::information( MainWindow::self, i18n( "Using ui.h File" ), + i18n( "An \"ui.h\" file for this form already exists.\n" + "Do you want to use it or create a new one?" ), + i18n( "Use Existing" ), i18n( "Create New" ), + i18n( "Cancel" ), 2, 2 ); + if ( i == 2 ) + return FALSE; + if ( i == 1 ) + createFormCode(); + } else { + if ( QMessageBox::Yes != QMessageBox::information( MainWindow::self, i18n( "Creating ui.h file" ), + i18n( "Do you want to create an new \"ui.h\" file?" ), + QMessageBox::Yes, QMessageBox::No ) ) + return FALSE; + createFormCode(); + } + setModified( TRUE ); + } + codeFileStat = FormFile::Ok; + return TRUE; +} + +SourceEditor *FormFile::showEditor( bool askForUih ) +{ + if ( !MainWindow::self ) + return 0; + showFormWindow(); + //emit signal to the embedding IDE if there is one and return 0 because + //no source editing is possible + emit fw->mainWindow()->part()->emitEditSource(fw->fileName()); + return 0; +/* if ( !setupUihFile( askForUih ) ) + return 0; + return MainWindow::self->openSourceEditor();*/ +} + +static int ui_counter = 0; +QString FormFile::createUnnamedFileName() +{ + return QString( "unnamed" ) + QString::number( ++ui_counter ) + QString( ".ui" ); +} + +QString FormFile::codeExtension() const +{ + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( iface ) + return iface->formCodeExtension(); + return ""; +} + +QString FormFile::codeComment() const +{ + return QString( "/****************************************************************************\n" + "** ui.h extension file, included from the uic-generated form implementation.\n" + "**\n" + "** If you want to add, delete, or rename functions or slots, use\n" + "** Qt Designer to update this file, preserving your code.\n" + "**\n" + "** You should not define a constructor or destructor in this file.\n" + "** Instead, write your code in functions called init() and destroy().\n" + "** These will automatically be called by the form's constructor and\n" + "** destructor.\n" + "*****************************************************************************/\n" ); +} + +bool FormFile::hasFormCode() const +{ + return !cod.isEmpty() && cod != QString( codeComment() ); +} + +int FormFile::codeFileState() const +{ + return hasFormCode() ? codeFileStat : None; +} + +void FormFile::setCodeFileState( UihState s ) +{ + codeFileStat = s; +} + +void FormFile::createFormCode() +{ + if ( !formWindow() ) + return; + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( !iface ) + return; + if ( pro->isCpp() ) + cod = codeComment(); + QValueList functionList = MetaDataBase::functionList( formWindow() ); + for ( QValueList::Iterator it = functionList.begin(); it != functionList.end(); ++it ) { + cod += (!cod.isEmpty() ? "\n\n" : "") + + iface->createFunctionStart( formWindow()->name(), make_func_pretty((*it).function), + (*it).returnType.isEmpty() ? + QString( "void" ) : + (*it).returnType, (*it).access ) + + "\n" + iface->createEmptyFunction(); + } + parseCode( cod, FALSE ); +} + +void FormFile::load() +{ + showFormWindow(); + code(); +} + +bool FormFile::loadCode() +{ + QFile f( pro->makeAbsolute( codeFile() ) ); + if ( !f.open( IO_ReadOnly ) ) { + cod = ""; + setCodeFileState( FormFile::None ); + return FALSE; + } + QTextStream ts( &f ); + cod = ts.read(); + parseCode( cod, FALSE ); + if ( hasFormCode() && codeFileStat != FormFile::Ok ) + setCodeFileState( FormFile::Deleted ); + timeStamp.update(); + return TRUE; +} + +bool FormFile::isCodeEdited() const +{ + return codeEdited; +} + +void FormFile::setCodeEdited( bool b ) +{ + codeEdited = b; +} + +void FormFile::parseCode( const QString &txt, bool allowModify ) +{ + if ( !formWindow() ) + return; + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( !iface ) + return; + QValueList functions; + QValueList newFunctions, oldFunctions; + oldFunctions = MetaDataBase::functionList( formWindow() ); + iface->functions( txt, &functions ); + QMap funcs; + for ( QValueList::Iterator it = functions.begin(); + it != functions.end(); ++it ) { + bool found = FALSE; + for ( QValueList::Iterator fit = oldFunctions.begin(); + fit != oldFunctions.end(); ++fit ) { + QString f( (*fit).function ); + if ( MetaDataBase::normalizeFunction( f ) == + MetaDataBase::normalizeFunction( (*it).name ) ) { + found = TRUE; + MetaDataBase::Function function; + function.function = make_func_pretty( (*it).name ); + function.specifier = (*fit).specifier; + function.type = (*fit).type; + if ( !pro->isCpp() ) + function.access = (*it).access; + else + function.access = (*fit).access; + function.language = (*fit).language; + function.returnType = (*it).returnType; + newFunctions << function; + funcs.insert( (*it).name, (*it).body ); + oldFunctions.remove( fit ); + break; + } + } + if ( !found ) { + MetaDataBase::Function function; + function.function = make_func_pretty( (*it).name ); + function.specifier = "virtual"; + function.access = "public"; + function.language = pro->language(); + function.returnType = (*it).returnType; + if ( function.returnType == "void" ) + function.type = "slot"; + else + function.type = "function"; + if ( function.function == "init()" || function.function == "destroy()" ) { + function.type = "function"; + function.access = "private"; + function.specifier = "non virtual"; + } + newFunctions << function; + funcs.insert( (*it).name, (*it).body ); + if ( allowModify ) + setFormWindowModified( TRUE ); + } + } + + if ( allowModify && oldFunctions.count() > 0 ) + setFormWindowModified( TRUE ); + + MetaDataBase::setFunctionList( formWindow(), newFunctions ); +} + +void FormFile::syncCode() +{ + if ( !editor() ) + return; + parseCode( editor()->editorInterface()->text(), TRUE ); + cod = editor()->editorInterface()->text(); +} + +void FormFile::checkTimeStamp() +{ + if ( timeStamp.isUpToDate() ) + return; + timeStamp.update(); + if ( codeEdited ) { + if ( QMessageBox::information( MainWindow::self, i18n( "Qt Designer" ), + i18n( "File '%1' has been changed outside Qt Designer.\n" + "Do you want to reload it?" ).arg( timeStamp.fileName() ), + i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) { + QFile f( timeStamp.fileName() ); + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + editor()->editorInterface()->setText( ts.read() ); + editor()->save(); + if ( MainWindow::self ) + MainWindow::self->functionsChanged(); + } + } + } else { + loadCode(); + } +} + +bool FormFile::isUihFileUpToDate() +{ + if ( timeStamp.isUpToDate() ) + return TRUE; + if ( !editor() ) { + MainWindow::self->editSource(); + qDebug( "parse Code" ); + parseCode( editor()->editorInterface()->text(), TRUE ); + } + checkTimeStamp(); + return FALSE; +} + +void FormFile::addFunctionCode( MetaDataBase::Function function ) +{ + if ( pro->isCpp() && !hasFormCode() && !codeEdited ) + return; + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( !iface ) + return; + + QValueList funcs; + iface->functions( cod, &funcs ); + bool hasFunc = FALSE; + for ( QValueList::Iterator it = funcs.begin(); + it != funcs.end(); ++it ) { + if ( MetaDataBase::normalizeFunction( (*it).name ) == MetaDataBase::normalizeFunction( function.function ) ) { + hasFunc = TRUE; + break; + } + } + + if ( !hasFunc ) { + if ( !codeEdited && !timeStamp.isUpToDate() ) + loadCode(); + MetaDataBase::MetaInfo mi = MetaDataBase::metaInfo( formWindow() ); + QString cn; + if ( mi.classNameChanged ) + cn = mi.className; + if ( cn.isEmpty() ) + cn = formWindow()->name(); + QString body = "\n\n" + iface->createFunctionStart( cn, + make_func_pretty( function.function ), + function.returnType.isEmpty() ? + QString( "void" ) : + function.returnType, function.access ) + + "\n" + iface->createEmptyFunction(); + cod += body; + if ( codeEdited ) { + setModified( TRUE ); + emit somethingChanged( this ); + } + } +} + +void FormFile::removeFunctionCode( MetaDataBase::Function function ) +{ + if ( pro->isCpp() && !hasFormCode() && !codeEdited ) + return; + + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( !iface ) + return; + + checkTimeStamp(); + QString sourceCode = code(); + if ( sourceCode.isEmpty() ) + return; + QValueList functions; + iface->functions( sourceCode, &functions ); + QString fu = MetaDataBase::normalizeFunction( function.function ); + for ( QValueList::Iterator fit = functions.begin(); fit != functions.end(); ++fit ) { + if ( MetaDataBase::normalizeFunction( (*fit).name ) == fu ) { + int line = 0; + int start = 0; + while ( line < (*fit).start - 1 ) { + start = sourceCode.find( '\n', start ); + if ( start == -1 ) + return; + start++; + line++; + } + if ( start == -1 ) + return; + int end = start; + while ( line < (*fit).end + 1 ) { + end = sourceCode.find( '\n', end ); + if ( end == -1 ) { + if ( line <= (*fit).end ) + end = sourceCode.length() - 1; + else + return; + } + end++; + line++; + } + if ( end < start ) + return; + sourceCode.remove( start, end - start ); + setCode( sourceCode ); + } + } +} + +void FormFile::functionNameChanged( const QString &oldName, const QString &newName ) +{ + if ( !cod.isEmpty() ) { + QString funcStart = QString( formWindow()->name() ) + QString( "::" ); + int i = cod.find( funcStart + oldName ); + if ( i != -1 ) { + cod.remove( i + funcStart.length(), oldName.length() ); + cod.insert( i + funcStart.length(), newName ); + } + } +} + +void FormFile::functionRetTypeChanged( const QString &fuName, const QString &oldType, const QString &newType ) +{ + if ( !cod.isEmpty() ) { + QString oldFunct = oldType + " " + QString( formWindow()->name() ) + "::" + fuName; + QString newFunct = newType + " " + QString( formWindow()->name() ) + "::" + fuName; + + int i = cod.find( oldFunct ); + if ( i != -1 ) { + cod.remove( i, oldFunct.length() ); + cod.insert( i, newFunct ); + } + } +} + +QString FormFile::formName() const +{ + FormFile* that = (FormFile*) this; + if ( formWindow() ) { + that->cachedFormName = formWindow()->name(); + return cachedFormName; + } + if ( !cachedFormName.isNull() ) + return cachedFormName; + QFile f( pro->makeAbsolute( filename ) ); + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + QString line; + QString className; + while ( !ts.eof() ) { + line = ts.readLine(); + if ( !className.isEmpty() ) { + int end = line.find( "" ); + if ( end == -1 ) { + className += line; + } else { + className += line.left( end ); + break; + } + continue; + } + int start; + if ( ( start = line.find( "" ) ) != -1 ) { + int end = line.find( "" ); + if ( end == -1 ) { + className = line.mid( start + 7 ); + } else { + className = line.mid( start + 7, end - ( start + 7 ) ); + break; + } + } + } + that->cachedFormName = className; + } + if ( cachedFormName.isEmpty() ) + that->cachedFormName = filename; + return cachedFormName; +} + +void FormFile::formWindowChangedSomehow() +{ + emit somethingChanged( this ); +} + +bool FormFile::checkFileName( bool allowBreak ) +{ + FormFile *ff = pro->findFormFile( filename, this ); + if ( ff ) + QMessageBox::warning( MainWindow::self, i18n( "Invalid Filename" ), + i18n( "The project already contains a form with a\n" + "filename of '%1'. Please choose a new filename." ).arg( filename ) ); + while ( ff ) { + QString fn; + while ( fn.isEmpty() ) { + fn = KFileDialog::getSaveFileName( pro->makeAbsolute( fileName() ), + i18n( "*.ui|Qt User-Interface Files" ) + "\n" + + i18n( "*|All Files" ), MainWindow::self,/* 0,*/ + i18n( "Save Form '%1' As"). + arg( formWindow()->name() )/*, + MainWindow::self ? &MainWindow::self->lastSaveFilter : 0 */); + if ( allowBreak && fn.isEmpty() ) + return FALSE; + } + filename = pro->makeRelative( fn ); + ff = pro->findFormFile( filename, this ); + } + return TRUE; +} + +void FormFile::addConnection( const QString &sender, const QString &signal, + const QString &receiver, const QString &slot ) +{ + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( iface ) + iface->addConnection( sender, signal, receiver, slot, &cod ); + if ( ed ) + ed->editorInterface()->setText( cod ); +} + +void FormFile::removeConnection( const QString &sender, const QString &signal, + const QString &receiver, const QString &slot ) +{ + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + if ( iface ) + iface->removeConnection( sender, signal, receiver, slot, &cod ); + if ( ed ) + ed->editorInterface()->setText( cod ); +} + +void FormFile::notifyFormWindowChange() +{ + if ( fw ) + pro->formOpened( fw ); +} + +void FormFile::emitNewStatus(FormFile *file) +{ + fw->mainWindow()->part()->emitNewStatus(fileName(), isModified()); +} diff --git a/kdevdesigner/designer/formfile.h b/kdevdesigner/designer/formfile.h new file mode 100644 index 00000000..65d0f389 --- /dev/null +++ b/kdevdesigner/designer/formfile.h @@ -0,0 +1,145 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef FORMFILE_H +#define FORMFILE_H + +#include +#include "timestamp.h" +#include "metadatabase.h" + +class Project; +class FormWindow; +class SourceEditor; + +class FormFile : public QObject +{ + Q_OBJECT + friend class SourceEditor; + +public: + enum Who { + WFormWindow = 1, + WFormCode = 2, + WAnyOrAll = WFormWindow | WFormCode + }; + + enum UihState { None, Ok, Deleted }; + + FormFile( const QString &fn, bool temp, Project *p, const char *name = 0 ); + ~FormFile(); + + void setFormWindow( FormWindow *f ); + void setEditor( SourceEditor *e ); + void setFileName( const QString &fn ); + void setCode( const QString &c ); + void setModified( bool m, int who = WAnyOrAll ); + void setCodeEdited( bool b ); + + FormWindow *formWindow() const; + SourceEditor *editor() const; + QString fileName() const; + QString absFileName() const; + + bool supportsCodeFile() const { return !codeExtension().isEmpty(); } + QString codeComment() const; + QString codeFile() const; + QString code(); + bool isCodeEdited() const; + + bool loadCode(); + void load(); + bool save( bool withMsgBox = TRUE, bool ignoreModified = FALSE ); + bool saveAs( bool ignoreModified = FALSE ); + bool close(); + bool closeEvent(); + bool isModified( int who = WAnyOrAll ); + bool hasFormCode() const; + void createFormCode(); + void syncCode(); + void checkTimeStamp(); + bool isUihFileUpToDate(); + void addFunctionCode( MetaDataBase::Function function ); + void removeFunctionCode( MetaDataBase::Function function ); + void functionNameChanged( const QString &oldName, const QString &newName ); + void functionRetTypeChanged( const QString &fuName, const QString &oldType, const QString &newType ); + + void showFormWindow(); + SourceEditor *showEditor( bool askForUih = TRUE ); + + static QString createUnnamedFileName(); + QString formName() const; + + bool isFake() const { return fake; } + + void parseCode( const QString &txt, bool allowModify ); + + void addConnection( const QString &sender, const QString &signal, + const QString &receiver, const QString &slot ); + void removeConnection( const QString &sender, const QString &signal, + const QString &receiver, const QString &slot ); + + bool hasTempFileName() const { return fileNameTemp; } + void setCodeFileState( UihState ); + int codeFileState() const; + bool setupUihFile( bool askForUih = TRUE ); + + Project *project() const { return pro; } + +signals: + void somethingChanged( FormFile* ); + +private slots: + void formWindowChangedSomehow(); + void notifyFormWindowChange(); + void emitNewStatus(FormFile* file); + +private: + bool isFormWindowModified() const; + bool isCodeModified() const; + void setFormWindowModified( bool m ); + void setCodeModified( bool m ); + QString codeExtension() const; + bool checkFileName( bool allowBreak ); + +private: + QString filename; + bool fileNameTemp; + Project *pro; + FormWindow *fw; + SourceEditor *ed; + QString cod; + TimeStamp timeStamp; + bool codeEdited; + QString cachedFormName; + bool fake; + bool pkg; + bool cm; + UihState codeFileStat; + +}; + +#endif diff --git a/kdevdesigner/designer/formsettings.ui b/kdevdesigner/designer/formsettings.ui new file mode 100644 index 00000000..c1d6be27 --- /dev/null +++ b/kdevdesigner/designer/formsettings.ui @@ -0,0 +1,549 @@ + +FormSettingsBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + FormSettingsBase + + + + 0 + 0 + 597 + 458 + + + + Form Settings + + + true + + + <b>Form Settings</b><p>Change settings for the form. Settings like <b>Comment</b> and <b>Author</b> are for your own use and are not required.</p> + + + + unnamed + + + 11 + + + 6 + + + + ButtonGroup1 + + + Pixmaps + + + + unnamed + + + 11 + + + 6 + + + + radioPixmapInline + + + Save in&line + + + true + + + Save pixmaps in the .ui files + + + <b>Save Inline</b><p>Saves the pixmaps as binary data in the .ui files. Pixmaps saved like this are not shared between forms. We recommend using Project image files instead. + + + + + radioProjectImageFile + + + Project &image file + + + Use the Project's Image file for pixmaps + + + <b>Use the Project's Image file for pixmaps</b> +<p>Each project may have a collection of pixmaps. If you use a project, we recommend that you use this option since it shares the images and is the fastest and most efficient way to use pixmaps in your forms.</p> + + + + + editPixmapFunction + + + false + + + Specify Pixmap-Loader function (only the function's name, no parentheses.) + + + <b>Specify Pixmap-Loader function</b><p>Specify the function which should be used for loading a pixmap in the generated code. <em>Only enter the function's name, without parentheses.</em> + + + + + radioPixmapFunction + + + Use &function: + + + Use the given function for pixmaps + + + <b>Use a given function for pixmaps</b><p>If you choose this option you must define a function in the line edit at the right which will be used in the generated code for loading pixmaps. When choosing a pixmap in <i>Qt Designer</i> you will be asked to specify the arguments which will be passed to the function in the generated code.<p> This approach makes it possible to use your own icon-loader function for loading pixmaps. <i>Qt Designer</i> cannot preview the correct image if you use your own function. + + + + + + + GroupBox1 + + + Box + + + Sunken + + + Settings + + + + unnamed + + + 11 + + + 6 + + + + editClassName + + + Change class name + + + <b>Enter the name of the class that will be created.</b><p><em>classname.h</em> and <em>classname.cpp</em> will be generated as C++ output when it is compiled by uic.</p> + + + + + TextLabel1_2 + + + A&uthor: + + + editAuthor + + + + + editAuthor + + + Enter your name + + + Enter your name. + + + + + TextLabel1 + + + Class &name: + + + editClassName + + + + + TextLabel2 + + + Co&mment: + + + editComment + + + + + editComment + + + Enter a comment about the form. + + + + + Spacer1 + + + Vertical + + + Expanding + + + + + + + GroupBox2 + + + La&youts + + + + unnamed + + + 11 + + + 6 + + + + spinMargin + + + 11 + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + + TextLabel2_2 + + + D&efault spacing: + + + spinSpacing + + + + + checkLayoutFunctions + + + Use func&tions: + + + Use functions to get the margin and spacing + + + <b>Use a given function for margin and/or spacing</b><p>If you choose this option you must define functions in the line edit below which will be used in the generated code for getting the margin and spacing value. <i>Qt Designer</i> cannot preview the correct margin or spacing if you use your own function. Instead, the default values will be used for preview. + + + + + spinSpacing + + + 6 + + + + + Spacer4 + + + Horizontal + + + Expanding + + + + + TextLabel1_3 + + + Default mar&gin: + + + spinMargin + + + + + spaFuLabel + + + false + + + S&pacing: + + + editSpacingFunction + + + + + marFuLabel + + + false + + + + 5 + 5 + 0 + 0 + + + + Ma&rgin: + + + editMarginFunction + + + + + Spacer5 + + + Horizontal + + + Expanding + + + + + editSpacingFunction + + + false + + + Specify spacing function (only the function's name, no parentheses.) + + + <b>Specify spacing function</b><p>Specify the function which should be used for getting the spacing in the generated code. <em>Only enter the function's name, without parentheses.</em> + + + + + editMarginFunction + + + false + + + + 5 + 0 + 0 + 0 + + + + Specify margin function (only the function's name, no parentheses.) + + + <b>Specify margin function</b><p>Specify the function which should be used for getting the margin in the generated code. <em>Only enter the function's name, without parentheses.</em> + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + buttonCancel + clicked() + FormSettingsBase + reject() + + + buttonOk + clicked() + FormSettingsBase + okClicked() + + + radioPixmapFunction + toggled(bool) + editPixmapFunction + setEnabled(bool) + + + checkLayoutFunctions + toggled(bool) + editSpacingFunction + setEnabled(bool) + + + checkLayoutFunctions + toggled(bool) + editMarginFunction + setEnabled(bool) + + + checkLayoutFunctions + toggled(bool) + marFuLabel + setEnabled(bool) + + + checkLayoutFunctions + toggled(bool) + spaFuLabel + setEnabled(bool) + + + + editClassName + editComment + editAuthor + radioPixmapInline + radioPixmapFunction + editPixmapFunction + radioProjectImageFile + spinMargin + spinSpacing + checkLayoutFunctions + editMarginFunction + editSpacingFunction + buttonOk + buttonCancel + buttonHelp + + + okClicked() + + + diff --git a/kdevdesigner/designer/formsettingsimpl.cpp b/kdevdesigner/designer/formsettingsimpl.cpp new file mode 100644 index 00000000..ce76dde7 --- /dev/null +++ b/kdevdesigner/designer/formsettingsimpl.cpp @@ -0,0 +1,118 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "formsettingsimpl.h" +#include "formwindow.h" +#include "metadatabase.h" +#include "command.h" +#include "asciivalidator.h" +#include "mainwindow.h" +#include "project.h" + +#include +#include +#include +#include +#include +#include +#include + +FormSettings::FormSettings( QWidget *parent, FormWindow *fw ) + : FormSettingsBase( parent, 0, TRUE ), formwindow( fw ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + MetaDataBase::MetaInfo info = MetaDataBase::metaInfo( fw ); + if ( info.classNameChanged && !info.className.isEmpty() ) + editClassName->setText( info.className ); + else + editClassName->setText( fw->name() ); + editComment->setText( info.comment ); + editAuthor->setText( info.author ); + + editClassName->setValidator( new AsciiValidator( QString( ":" ), editClassName ) ); + editPixmapFunction->setValidator( new AsciiValidator( QString( ":" ), editPixmapFunction ) ); + + if ( formwindow->savePixmapInline() ) + radioPixmapInline->setChecked( TRUE ); + else if ( formwindow->savePixmapInProject() ) + radioProjectImageFile->setChecked( TRUE ); + else + radioPixmapFunction->setChecked( TRUE ); + editPixmapFunction->setText( formwindow->pixmapLoaderFunction() ); + radioProjectImageFile->setEnabled( !fw->project()->isDummy() ); + spinSpacing->setValue( formwindow->layoutDefaultSpacing() ); + spinMargin->setValue( formwindow->layoutDefaultMargin() ); + editSpacingFunction->setValidator( new AsciiValidator( QString( ":" ), editSpacingFunction ) ); + editMarginFunction->setValidator( new AsciiValidator( QString( ":" ), editMarginFunction ) ); + checkLayoutFunctions->setChecked( formwindow->hasLayoutFunctions() ); + editSpacingFunction->setText( formwindow->spacingFunction() ); + editMarginFunction->setText( formwindow->marginFunction() ); +} + +void FormSettings::okClicked() +{ + MetaDataBase::MetaInfo info; + info.className = editClassName->text(); + info.classNameChanged = info.className != QString( formwindow->name() ); + info.comment = editComment->text(); + info.author = editAuthor->text(); + MetaDataBase::setMetaInfo( formwindow, info ); + + formwindow->commandHistory()->setModified( TRUE ); + + if ( formwindow->savePixmapInline() ) { + MetaDataBase::clearPixmapArguments( formwindow ); + MetaDataBase::clearPixmapKeys( formwindow ); + } else if ( formwindow->savePixmapInProject() ) { + MetaDataBase::clearPixmapArguments( formwindow ); + } else { + MetaDataBase::clearPixmapKeys( formwindow ); + } + + if ( radioPixmapInline->isChecked() ) { + formwindow->setSavePixmapInline( TRUE ); + formwindow->setSavePixmapInProject( FALSE ); + } else if ( radioProjectImageFile->isChecked() ){ + formwindow->setSavePixmapInline( FALSE ); + formwindow->setSavePixmapInProject( TRUE ); + } else { + formwindow->setSavePixmapInline( FALSE ); + formwindow->setSavePixmapInProject( FALSE ); + } + + if ( checkLayoutFunctions->isChecked() ) + formwindow->hasLayoutFunctions( TRUE ); + else + formwindow->hasLayoutFunctions( FALSE ); + + formwindow->setPixmapLoaderFunction( editPixmapFunction->text() ); + formwindow->setLayoutDefaultSpacing( spinSpacing->value() ); + formwindow->setSpacingFunction( editSpacingFunction->text() ); + formwindow->setLayoutDefaultMargin( spinMargin->value() ); + formwindow->setMarginFunction( editMarginFunction->text() ); + + accept(); +} diff --git a/kdevdesigner/designer/formsettingsimpl.h b/kdevdesigner/designer/formsettingsimpl.h new file mode 100644 index 00000000..08750fbc --- /dev/null +++ b/kdevdesigner/designer/formsettingsimpl.h @@ -0,0 +1,49 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef FORMSETTINGSIMPL_H +#define FORMSETTINGSIMPL_H + +#include "formsettings.h" + +class FormWindow; + +class FormSettings : public FormSettingsBase +{ + Q_OBJECT + +public: + FormSettings( QWidget *parent, FormWindow *fw ); + +protected slots: + void okClicked(); + +private: + FormWindow *formwindow; + +}; + +#endif diff --git a/kdevdesigner/designer/formwindow.cpp b/kdevdesigner/designer/formwindow.cpp new file mode 100644 index 00000000..d9de42cc --- /dev/null +++ b/kdevdesigner/designer/formwindow.cpp @@ -0,0 +1,2775 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "formwindow.h" +#include "defs.h" +#include "mainwindow.h" +#include "widgetfactory.h" +#include "sizehandle.h" +#include "metadatabase.h" +#include "resource.h" +#include "layout.h" +#include "connectiondialog.h" +#include +#include "pixmapchooser.h" +#include "orderindicator.h" +#include "hierarchyview.h" +#include "designerappiface.h" +#include "menubareditor.h" +#define NO_STATIC_COLORS +#include "globaldefs.h" + +#include + +#include +#include +#include "kdevdesigner_part.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FormWindow should be able to work to some limited degree +// (existance, loading) without a MainWindow. Functions which require +// a MainWindow in theory should never be called if no MainWindow +// exists. These macros are used to let us know if that happens anyway +// and to ensure that we don't crash +#define CHECK_MAINWINDOW Q_ASSERT( mainWindow() ); if ( !mainWindow() ) return +#define CHECK_MAINWINDOW_VALUE( v ) Q_ASSERT( mainWindow() ); if ( !mainWindow() ) return v + +static void setCursorToAll( const QCursor &c, QWidget *start ) +{ + start->setCursor( c ); + QObjectList *l = (QObjectList*)start->children(); + if ( l ) { + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && !::qt_cast(o) ) + setCursorToAll( c, ( (QWidget*)o ) ); + } + } +} + +static void restoreCursors( QWidget *start, FormWindow *fw ) +{ + if ( fw->widgets()->find( start ) ) + start->setCursor( MetaDataBase::cursor( start ) ); + else + start->setCursor( Qt::ArrowCursor ); + QObjectList *l = (QObjectList*)start->children(); + if ( l ) { + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && !::qt_cast(o) ) + restoreCursors( ( (QWidget*)o ), fw ); + } + } +} + +#if defined(Q_WS_WIN32) // #### needed for the workaround for repaint problem on windows +#include +static void flickerfree_update( QWidget *w ) +{ + InvalidateRect( w->winId(), 0, FALSE ); +} +#endif + +/*! + \class FormWindow formwindow.h + \brief Editor window for a form + + The FormWindow is the widget which is used as editor for forms. It + handles inserting, deleting, moving, resizing, etc. of widgets. + + Normally multiple formwindows are used at the same time in the + Designer. So each formwindow has its own undo/redo buffer, etc. + + Also the formwindow has some signals to inform e.g. about selection + changes which is interesting for the PropertyEditor. + + For handling the events of the child widgets (moving, etc.) the + handleMousePress(), etc. functions are called from the application + event filter which is implemented in MainWindow::eventFilter(). +*/ + +FormWindow::FormWindow( FormFile *f, MainWindow *mw, QWidget *parent, const char *name ) + : QWidget( parent, name, WDestructiveClose ), mainwindow( mw ), + commands( 100 ), pixInline( TRUE ), pixProject( FALSE ) +{ + ff = f; + init(); + initSlots(); +} + +FormWindow::FormWindow( FormFile *f, QWidget *parent, const char *name ) + : QWidget( parent, name, WDestructiveClose ), mainwindow( 0 ), + commands( 100 ), pixInline( TRUE ) +{ + ff = f; + init(); +} + +void FormWindow::init() +{ + setWFlags(getWFlags() & Qt::WStyle_Maximize); + + fake = qstrcmp( name(), "qt_fakewindow" ) == 0; + MetaDataBase::addEntry( this ); + ff->setFormWindow( this ); + iface = 0; + proj = 0; + propertyWidget = 0; + toolFixed = FALSE; + checkedSelectionsForMove = FALSE; + mContainer = 0; + startWidget = endWidget = 0; + currTool = POINTER_TOOL; + unclippedPainter = 0; + widgetPressed = FALSE; + drawRubber = FALSE; + setFocusPolicy( ClickFocus ); + sizePreviewLabel = 0; + checkSelectionsTimer = new QTimer( this, "checkSelectionsTimer" ); + connect( checkSelectionsTimer, SIGNAL( timeout() ), + this, SLOT( invalidCheckedSelections() ) ); + updatePropertiesTimer = new QTimer( this ); + connect( updatePropertiesTimer, SIGNAL( timeout() ), + this, SLOT( updatePropertiesTimerDone() ) ); + showPropertiesTimer = new QTimer( this ); + //!!!! + connect( showPropertiesTimer, SIGNAL( timeout() ), + this, SLOT( showPropertiesTimerDone() ) ); + selectionChangedTimer = new QTimer( this ); + connect( selectionChangedTimer, SIGNAL( timeout() ), + this, SLOT( selectionChangedTimerDone() ) ); + windowsRepaintWorkaroundTimer = new QTimer( this ); + connect( windowsRepaintWorkaroundTimer, SIGNAL( timeout() ), + this, SLOT( windowsRepaintWorkaroundTimerTimeout() ) ); + insertParent = 0; + connect( &commands, SIGNAL( undoRedoChanged( bool, bool, const QString &, const QString & ) ), + this, SIGNAL( undoRedoChanged( bool, bool, const QString &, const QString & ) ) ); + propShowBlocked = FALSE; + + setIcon( SmallIcon( "designer_form.png" , KDevDesignerPartFactory::instance()) ); + + connect( &commands, SIGNAL( modificationChanged( bool ) ), + this, SLOT( modificationChanged( bool ) ) ); + buffer = 0; + + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QFrame" ), this ); + setMainContainer( w ); + propertyWidget = w; + targetContainer = 0; + hadOwnPalette = FALSE; + + defSpacing = BOXLAYOUT_DEFAULT_SPACING; + defMargin = BOXLAYOUT_DEFAULT_MARGIN; + hasLayoutFunc = FALSE; +} + +void FormWindow::setMainWindow( MainWindow *w ) +{ + mainwindow = w; + MetaDataBase::addEntry( this ); + initSlots(); +} + +void FormWindow::initSlots() +{ + if ( isFake() ) + return; + Q_ASSERT( project() || MainWindow::self ); + if ( !project() && !MainWindow::self ) + return; + Project *p = project() ? project() : MainWindow::self->currProject(); + if ( p && p->isCpp() ) { + QString code = formFile()->code(); + if ( code.isEmpty() ) + formFile()->setCode( formFile()->codeComment() ); + } +} + +FormWindow::~FormWindow() +{ + if ( MainWindow::self && MainWindow::self->objectHierarchy()->formWindow() == this ) + MainWindow::self->objectHierarchy()->setFormWindow( 0, 0 ); + + MetaDataBase::clear( this ); + if ( ff ) + ff->setFormWindow( 0 ); + delete iface; +} + +void FormWindow::closeEvent( QCloseEvent *e ) +{ + QGuardedPtr that = this; + if ( ff->closeEvent() && ( !that || ( mainwindow && mainwindow->unregisterClient( this ) ) ) ) + e->accept(); + else + e->ignore(); +} + +void FormWindow::paintGrid( QWidget *w, QPaintEvent *e ) +{ + if ( !mainWindow() || !mainWindow()->showGrid() ) + return; + QPixmap grid; + QString grid_name; + grid_name.sprintf("FormWindowGrid_%d_%d", mainWindow()->grid().x(), mainWindow()->grid().y()); + if( !QPixmapCache::find( grid_name, grid ) ) { + grid = QPixmap( 350 + ( 350 % mainWindow()->grid().x() ), 350 + ( 350 % mainWindow()->grid().y() ) ); + grid.fill( colorGroup().color( QColorGroup::Foreground ) ); + QBitmap mask( grid.width(), grid.height() ); + mask.fill( color0 ); + QPainter p( &mask ); + p.setPen( color1 ); + for ( int y = 0; y < grid.width(); y += mainWindow()->grid().y()) { + for ( int x = 0; x < grid.height(); x += mainWindow()->grid().x() ) { + p.drawPoint( x, y ); + } + } + grid.setMask( mask ); + QPixmapCache::insert( grid_name, grid ); + } + QPainter p( w ); + p.setClipRegion( e->rect() ); + p.drawTiledPixmap( QRect( 0, 0, width(), height() ), grid ); +} + +/*! For operations like drawing a rubber band or drawing the rect + when inserting a new widget, a unclipped painter (which draws also + on child widgets) is needed. This method does all the initialization. +*/ + +void FormWindow::beginUnclippedPainter( bool doNot ) +{ + endUnclippedPainter(); + bool unclipped = testWFlags( WPaintUnclipped ); + setWFlags( WPaintUnclipped ); + unclippedPainter = new QPainter; + unclippedPainter->begin( this ); + if ( !unclipped ) + clearWFlags( WPaintUnclipped ); + if ( doNot ) { + unclippedPainter->setPen( QPen( color0, 2 ) ); + unclippedPainter->setRasterOp( NotROP ); + } +} + +/*! + Gets rid of an open unclipped painter. + + \sa beginUnclippedPainter() +*/ + +void FormWindow::endUnclippedPainter() +{ + if ( unclippedPainter ) + unclippedPainter->end(); + delete unclippedPainter; + unclippedPainter = 0; +} + +QPoint FormWindow::gridPoint( const QPoint &p ) +{ + return QPoint( ( p.x() / grid().x() ) * grid().x(), + ( p.y() / grid().y() ) * grid().y() ); +} + +void FormWindow::drawSizePreview( const QPoint &pos, const QString& text ) +{ + unclippedPainter->save(); + unclippedPainter->setPen( QPen( colorGroup().foreground(), 1 )); + unclippedPainter->setRasterOp( CopyROP ); + if ( !sizePreviewPixmap.isNull() ) + unclippedPainter->drawPixmap( sizePreviewPos, sizePreviewPixmap ); + if ( text.isNull() ) { + sizePreviewPixmap = QPixmap(); // set null again + unclippedPainter->restore(); + return; + } + QRect r = fontMetrics().boundingRect( 0, 0, 0, 0, AlignCenter, text ); + r = QRect( pos + QPoint( 10, 10 ), r.size() + QSize( 5, 5 ) ); + + checkPreviewGeometry( r ); + + sizePreviewPos = r.topLeft(); + sizePreviewPixmap = QPixmap::grabWindow( winId(), r.x(), r.y(), r.width(), r.height() ); + unclippedPainter->setBrush( QColor( 255, 255, 128 ) ); + unclippedPainter->drawRect( r ); + unclippedPainter->drawText( r, AlignCenter, text ); + unclippedPainter->restore(); +} + +void FormWindow::insertWidget() +{ + CHECK_MAINWINDOW; + if ( !insertParent ) + return; + + if ( currTool == POINTER_TOOL ) + return; + + bool useSizeHint = !oldRectValid || ( currRect.width() < 2 && currRect.height() < 2 ); + Orientation orient = Horizontal; + QString n = WidgetDatabase::className( currTool ); + if ( useSizeHint && ( n == "Spacer" || n == "QSlider" || n == "Line" || n == "QScrollBar" ) ) { + QPopupMenu m( mainWindow() ); + m.insertItem( i18n( "&Horizontal" ) ); + int ver = m.insertItem( i18n( "&Vertical" ) ); + int r = m.exec( QCursor::pos() ); + if ( r == ver ) + orient = Vertical; + } + + + QWidget *w = WidgetFactory::create( currTool, insertParent, 0, TRUE, &currRect, orient ); + if ( !w ) + return; + + if ( !savePixmapInline() && currTool == WidgetDatabase::idFromClassName( "PixmapLabel" ) ) { // ### what to do for pixmaps in project + QPixmap pix; + // we have to force the pixmap to get a new and unique serial number. Unfortunately detatch() doesn't do that + pix.convertFromImage( SmallIcon( "designer_image.png" , KDevDesignerPartFactory::instance()).convertToImage() ); + ( (QLabel*)w )->setPixmap( pix ); + } + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf(w) ); + if ( WidgetDatabase::isCustomWidget( id ) ) { + QWhatsThis::add( w, i18n("A %1 (custom widget) " + "

      Click Edit Custom Widgets... in the Tools|Custom " + "menu to add and change custom widgets. You can add " + "properties as well as signals and slots to integrate custom widgets into " + "Qt Designer, and provide a pixmap which will be used to represent " + "the widget on the form.

      ") + .arg(WidgetDatabase::toolTip( id )) ); + QToolTip::add( w, i18n("A %1 (custom widget)").arg(WidgetDatabase::toolTip( id )) ); + } else { + QString tt = WidgetDatabase::toolTip( id ); + QString wt = WidgetDatabase::whatsThis( id ); + if ( !wt.isEmpty() && !tt.isEmpty() ) + QWhatsThis::add( w, QString("A %1

      %2

      ").arg( tt ).arg( wt ) ); + } + + QString s = w->name(); + unify( w, s, TRUE ); + w->setName( s ); + insertWidget( w ); + QRect r( currRect ); + if ( !oldRectValid || + ( currRect.width() < 2 && currRect.height() < 2 ) ) + r = QRect( rectAnchor, QSize( 0, 0 ) ); + + QPoint p = r.topLeft(); + p = mapToGlobal( p ); + p = insertParent->mapFromGlobal( p ); + r = QRect( p, r.size() ); + + if ( useSizeHint ) { + if ( n == "Spacer" ) { + if ( orient == Vertical ) { + r.setWidth( 20 ); + r.setHeight( 40 ); + } else { + r.setWidth( 40 ); + r.setHeight( 20 ); + } + } else { + r.setWidth( w->sizeHint().width() ); + r.setHeight( w->sizeHint().height() ); + } + } + + if ( r.width() < 2 * grid().x() ) + r.setWidth( 2 * grid().x() ); + if ( r.height() < 2 * grid().y() ) + r.setHeight( 2 * grid().y() ); + + const QObjectList *l = insertParent->children(); + QObjectListIt it( *l ); + QWidgetList lst; + if ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ) ) { + for ( ; it.current(); ) { + QObject *o = it.current(); + ++it; + if ( o->isWidgetType() && + ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets.find( (QWidget*)o ) && o != w ) { + QRect r2( ( (QWidget*)o )->pos(), + ( (QWidget*)o )->size() ); + if ( r.contains( r2 ) ) + lst.append( (QWidget*)o ); + } + } + } + + if ( !lst.isEmpty() ) { + QWidget *pw = WidgetFactory::containerOfWidget( w ); + if (pw) { + QValueList op, np; + for ( QWidget *i = lst.first(); i; i = lst.next() ) { + op.append( i->pos() ); + QPoint pos = pw->mapFromGlobal( i->mapToGlobal( QPoint( 0, 0 ) ) ); + pos -= r.topLeft(); + np.append( pos ); + } + + MoveCommand *mv = new MoveCommand( i18n( "Reparent Widgets" ), this, + lst, op, np, insertParent, pw ); + + if ( !toolFixed ) + mainwindow->resetTool(); + else + setCursorToAll( CrossCursor, w ); + + InsertCommand *cmd = new InsertCommand( i18n( "Insert %1" ).arg( w->name() ), this, w, r ); + + QPtrList commands; + commands.append( mv ); + commands.append( cmd ); + + MacroCommand *mc = new MacroCommand( i18n( "Insert %1" ).arg( w->name() ), this, commands ); + commandHistory()->addCommand( mc ); + mc->execute(); + } + } else { + if ( !toolFixed ) + mainwindow->resetTool(); + else + setCursorToAll( CrossCursor, w ); + + InsertCommand *cmd = new InsertCommand( i18n( "Insert %1" ).arg( w->name() ), this, w, r ); + commandHistory()->addCommand( cmd ); + cmd->execute(); + } + + TemplateWizardInterface *iface = mainWindow()->templateWizardInterface( w->className() ); + if ( iface ) { + iface->setup( w->className(), w, iFace(), mainWindow()->designerInterface() ); + iface->release(); + } +} + +void FormWindow::insertWidget( QWidget *w, bool checkName ) +{ + if ( !w ) + return; + if ( checkName ) { + QString s = w->name(); + unify( w, s, TRUE ); + w->setName( s ); + } + + MetaDataBase::addEntry( w ); + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf(w) ); + if ( WidgetDatabase::isCustomWidget( id ) ) { + QWhatsThis::add( w, i18n("A %1 (custom widget) " + "

      Click Edit Custom Widgets... in the Tools|Custom " + "menu to add and change custom widgets. You can add " + "properties as well as signals and slots to integrate custom widgets into " + "Qt Designer, and provide a pixmap which will be used to represent " + "the widget on the form.

      ") + .arg(WidgetDatabase::toolTip( id )) ); + QToolTip::add( w, i18n("A %1 (custom widget)").arg(WidgetDatabase::toolTip( id )) ); + } else { + QString tt = WidgetDatabase::toolTip( id ); + QString wt = WidgetDatabase::whatsThis( id ); + if ( !wt.isEmpty() && !tt.isEmpty() ) + QWhatsThis::add( w, QString("A %1

      %2

      ").arg( tt ).arg( wt ) ); + } + + restoreCursors( w, this ); + widgets()->insert( w, w ); + w->show(); +} + +void FormWindow::removeWidget( QWidget *w ) +{ + MetaDataBase::removeEntry( w ); + widgets()->take( w ); +} + +void FormWindow::handleContextMenu( QContextMenuEvent *e, QWidget *w ) +{ + CHECK_MAINWINDOW; + switch ( currTool ) { + case POINTER_TOOL: { + if ( !isMainContainer( w ) && qstrcmp( w->name(), "central widget" ) != 0 ) { // press on a child widget + raiseChildSelections( w ); // raise selections and select widget + selectWidget( w ); + // if widget is laid out, find the first non-laid out super-widget + QWidget *realWidget = w; // but store the original one + while ( w->parentWidget() && + ( WidgetFactory::layoutType( w->parentWidget()) != WidgetFactory::NoLayout || + !insertedWidgets.find(w) ) ) + w = w->parentWidget(); + if ( ::qt_cast(mainContainer()) && ((QMainWindow*)mainContainer())->centralWidget() == realWidget ) { + e->accept(); + mainwindow->popupFormWindowMenu( e->globalPos(), this ); + } else { + e->accept(); + mainwindow->popupWidgetMenu( e->globalPos(), this, realWidget); + } + } else { + e->accept(); + clearSelection(); + mainwindow->popupFormWindowMenu( e->globalPos(), this ); + } + break; } + default: + break; + } +} + +void FormWindow::handleMousePress( QMouseEvent *e, QWidget *w ) +{ + CHECK_MAINWINDOW; + checkedSelectionsForMove = FALSE; + checkSelectionsTimer->stop(); + if ( !sizePreviewLabel ) { + sizePreviewLabel = new QLabel( this ); + sizePreviewLabel->hide(); + sizePreviewLabel->setBackgroundColor( QColor( 255, 255, 128 ) ); + sizePreviewLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); + } + + switch ( currTool ) { + case POINTER_TOOL: + if ( !isMainContainer( w ) && qstrcmp( w->name(), "central widget" ) != 0 ) { // press on a child widget + // if the clicked widget is not in a layout, raise it + if ( !w->parentWidget() || WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ) + w->raise(); + if ( ( e->state() & ControlButton ) ) { // with control pressed, always start rubber band selection + drawRubber = TRUE; + currRect = QRect( 0, 0, -1, -1 ); + startRectDraw( mapFromGlobal( e->globalPos() ), e->globalPos(), this, Rubber ); + break; + } + + bool sel = isWidgetSelected( w ); + if ( !( ( e->state() & ControlButton ) || ( e->state() & ShiftButton ) ) ) { // control not pressed... + if ( !sel ) { // ...and widget no selectted: unselect all + clearSelection( FALSE ); + } else { // ...widget selected + // only if widget has a layout (it is a layout meta widget or a laid out container!), unselect its childs + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout ) { + QObjectList *l = w->queryList( "QWidget" ); + setPropertyShowingBlocked( TRUE ); + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( !o->isWidgetType() ) + continue; + if ( insertedWidgets.find( (QWidget*)o ) ) + selectWidget( (QWidget*)o, FALSE ); + } + setPropertyShowingBlocked( FALSE ); + delete l; + } + } + qApp->processEvents(); + } + if ( ( ( e->state() & ControlButton ) || ( e->state() & ShiftButton ) ) && + sel && e->button() == LeftButton ) { // control pressed and selected, unselect widget + selectWidget( w, FALSE ); + break; + } + + raiseChildSelections( w ); // raise selections and select widget + selectWidget( w ); + + // if widget is laid out, find the first non-laid out super-widget + while ( w->parentWidget() && + ( WidgetFactory::layoutType( w->parentWidget()) != WidgetFactory::NoLayout || !insertedWidgets.find(w) ) ) + w = w->parentWidget(); + + if ( e->button() == LeftButton ) { // left button: store original geometry and more as the widget might start moving + widgetPressed = TRUE; + widgetGeom = QRect( w->pos(), w->size() ); + oldPressPos = w->mapFromGlobal( e->globalPos() ); + origPressPos = oldPressPos; + checkedSelectionsForMove = FALSE; + moving.clear(); + if ( w->parentWidget() && !isMainContainer( w->parentWidget() ) && !isCentralWidget( w->parentWidget() ) ) { + targetContainer = w->parentWidget(); + hadOwnPalette = w->parentWidget()->ownPalette(); + restorePalette = w->parentWidget()->palette(); + } + } + } else { // press was on the formwindow + if ( e->button() == LeftButton ) { // left button: start rubber selection and show formwindow properties + drawRubber = TRUE; + if ( !( ( e->state() & ControlButton ) || ( e->state() & ShiftButton ) ) ) { + clearSelection( FALSE ); + QObject *opw = propertyWidget; + propertyWidget = mainContainer(); + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + } + currRect = QRect( 0, 0, -1, -1 ); + startRectDraw( mapFromGlobal( e->globalPos() ), e->globalPos(), this, Rubber ); + } + } + break; + case CONNECT_TOOL: + case BUDDY_TOOL: + if ( e->button() != LeftButton ) + break; + validForBuddy = FALSE; + if ( currTool == BUDDY_TOOL ) { + if ( !::qt_cast(w) ) + break; + clearSelection( FALSE ); + validForBuddy = TRUE; + mainWindow()->statusMessage( i18n( "Set buddy for '%1' to..." ).arg( w->name() ) ); + } else { + mainWindow()->statusMessage( i18n( "Connect '%1' with..." ).arg( w->name() ) ); + } + saveBackground(); + startPos = mapFromGlobal( e->globalPos() ); + currentPos = startPos; + startWidget = designerWidget( w ); + endWidget = startWidget; + beginUnclippedPainter( FALSE ); + drawConnectionLine(); + break; + case ORDER_TOOL: + if ( !isMainContainer( w ) ) { // press on a child widget + orderedWidgets.removeRef( w ); + orderedWidgets.append( w ); + for ( QWidget *wid = orderedWidgets.last(); wid; wid = orderedWidgets.prev() ) { + int i = stackedWidgets.findRef( wid ); + if ( i != -1 ) { + stackedWidgets.removeRef( wid ); + stackedWidgets.insert( 0, wid ); + } + } + QWidgetList oldl = MetaDataBase::tabOrder( this ); + TabOrderCommand *cmd = new TabOrderCommand( i18n( "Change Tab Order" ), this, oldl, stackedWidgets ); + cmd->execute(); + commandHistory()->addCommand( cmd, TRUE ); + updateOrderIndicators(); + } + break; + default: // any insert widget tool + if ( e->button() == LeftButton ) { + insertParent = WidgetFactory::containerOfWidget( mainContainer() ); // default parent for new widget is the formwindow + if ( !isMainContainer( w ) ) { // press was not on formwindow, check if we can find another parent + QWidget *wid = w; + for (;;) { + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( wid ) ); + if ( ( WidgetDatabase::isContainer( id ) || wid == mainContainer() ) && + !::qt_cast(wid) && !::qt_cast(wid) ) { + insertParent = WidgetFactory::containerOfWidget( wid ); // found another parent, store it + break; + } else { + wid = wid->parentWidget(); + if ( !wid ) + break; + } + } + } + startRectDraw( w->mapFromGlobal( e->globalPos() ), e->globalPos(), w, Insert ); + } + break; + } +} + +void FormWindow::handleMouseDblClick( QMouseEvent *, QWidget *w ) +{ + CHECK_MAINWINDOW; + switch ( currTool ) { + case ORDER_TOOL: + if ( !isMainContainer( w ) ) { // press on a child widget + orderedWidgets.clear(); + orderedWidgets.append( w ); + for ( QWidget *wid = orderedWidgets.last(); wid; wid = orderedWidgets.prev() ) { + int i = stackedWidgets.findRef( wid ); + if ( i != -1 ) { + stackedWidgets.removeRef( wid ); + stackedWidgets.insert( 0, wid ); + } + } + QWidgetList oldl = MetaDataBase::tabOrder( this ); + TabOrderCommand *cmd = new TabOrderCommand( i18n( "Change Tab Order" ), this, oldl, stackedWidgets ); + cmd->execute(); + commandHistory()->addCommand( cmd, TRUE ); + updateOrderIndicators(); + } + default: + if ( !WidgetFactory::isPassiveInteractor( w ) && + ( isMainContainer( w ) || w == this ) ) + mainWindow()->editSource(); + break; + } +} + +void FormWindow::handleMouseMove( QMouseEvent *e, QWidget *w ) +{ + CHECK_MAINWINDOW; + if ( ( e->state() & LeftButton ) != LeftButton ) + return; + + QWidget *newendWidget = endWidget, *oldendWidget = endWidget, *wid; + bool drawRecRect; + switch ( currTool ) { + case POINTER_TOOL: + if ( widgetPressed && allowMove( w ) ) { // we are prepated for a move + + // if widget is laid out, find the first non-laid out super-widget + while ( w->parentWidget() && + ( WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout || !insertedWidgets.find(w ) ) ) + w = w->parentWidget(); + + // calc correct position + QPoint pos = w->mapFromGlobal( e->globalPos() ); + +#if 0 + QPoint mpos = w->mapToParent( pos ); + // check if we are not outside the visible area, else correct coords + if ( mpos.x() < 0 ) + pos.setX( w->mapFromParent( QPoint( 0, mpos.y() ) ).x() ); + if ( mpos.y() < 0 ) + pos.setY( w->mapFromParent( QPoint( mpos.x(), 0 ) ).y() ); + if ( mpos.x() > w->parentWidget()->width() ) + pos.setX( w->mapFromParent( QPoint( w->parentWidget()->width(), mpos.y() ) ).x() ); + if ( mpos.y() > w->parentWidget()->height() ) + pos.setY( w->mapFromParent( QPoint( mpos.x(), w->parentWidget()->height() ) ).y() ); +#endif + + // calc move distance and store it + QPoint d = oldPressPos - pos; + if ( QABS( d.x() ) < grid().x() ) + d.setX( 0 ); + if ( QABS( d.y() ) < grid().y() ) + d.setY( 0 ); + if ( d.x() == 0 ) + pos.setX( oldPressPos.x() ); + if ( d.y() == 0 ) + pos.setY( oldPressPos.y() ); + oldPressPos = pos; + + // snap to grid + int x = widgetGeom.x() - d.x(); + widgetGeom.setX( x ); + x = ( x / grid().x() ) * grid().x(); + int y = widgetGeom.y() - d.y(); + widgetGeom.setY( y ); + y = ( y / grid().y() ) * grid().y(); + QPoint p = w->pos(); + + if ( x - p.x() != 0 || y - p.y() != 0 ) { // if we actually have to move + if ( !checkedSelectionsForMove ) { // if not checked yet, check if the correct widget are selected... + if ( !isWidgetSelected( w ) ) { // and unselect others. Only siblings can be moved at the same time + setPropertyShowingBlocked( TRUE ); + selectWidget( w ); + setPropertyShowingBlocked( FALSE ); + } + checkSelectionsForMove( w ); + } + + // check whether we would have to reparent the selection and highlight the possible new parent container + QMapConstIterator it = moving.begin(); + QWidget* wa = containerAt( e->globalPos(), it.key() ); + if ( wa && !isMainContainer( wa ) && !isCentralWidget( wa ) ) { + wa = WidgetFactory::containerOfWidget( wa ); + // ok, looks like we moved onto a container + + if ( wa != targetContainer ) { + if ( targetContainer ) { + if ( hadOwnPalette ) + targetContainer->setPalette( restorePalette ); + else + targetContainer->unsetPalette(); + } + targetContainer = wa; + hadOwnPalette = wa->ownPalette(); + restorePalette = wa->palette(); + wa->setPaletteBackgroundColor( wa->colorGroup().midlight() ); + } + } + else if ( targetContainer ) { + if( hadOwnPalette ) + targetContainer->setPalette( restorePalette ); + else + targetContainer->unsetPalette(); + targetContainer = 0; + } + + // finally move the selected widgets and show/update preview label + moveSelectedWidgets( x - p.x(), y - p.y() ); + sizePreviewLabel->setText( i18n( "%1/%2" ).arg( w->pos().x() ).arg( w->pos().y() ) ); + sizePreviewLabel->adjustSize(); + QRect lg( mapFromGlobal( e->globalPos() ) + QPoint( 16, 16 ), sizePreviewLabel->size() ); + checkPreviewGeometry( lg ); + sizePreviewLabel->setGeometry( lg ); + sizePreviewLabel->raise(); + sizePreviewLabel->show(); +#if defined(Q_WS_WIN32) + windowsRepaintWorkaroundTimer->start( 100, TRUE ); +#endif + } else { // if we don't need to move, do some indication + QRect lg( mapFromGlobal( e->globalPos() ) + QPoint( 16, 16 ), sizePreviewLabel->size() ); + checkPreviewGeometry( lg ); + sizePreviewLabel->move( lg.x(), lg.y() ); + } + + oldPressPos += ( p - w->pos() ); + } else if ( drawRubber ) { // draw rubber if we are in rubber-selection mode + continueRectDraw( mapFromGlobal( e->globalPos() ), e->globalPos(), this, Rubber ); + } + break; + case CONNECT_TOOL: + restoreConnectionLine(); + wid = qApp->widgetAt( e->globalPos(), TRUE ); + if ( wid ) + wid = designerWidget( wid ); + if ( wid && ( isMainContainer( wid ) || insertedWidgets.find( wid ) ) && wid->isVisibleTo( this ) ) + newendWidget = wid; + if ( ::qt_cast(newendWidget) || ::qt_cast(newendWidget) ) + newendWidget = (QWidget*)endWidget; + drawRecRect = newendWidget != endWidget; + if ( newendWidget && + ( isMainContainer( newendWidget ) || insertedWidgets.find( newendWidget ) ) && !isCentralWidget( newendWidget ) ) + endWidget = newendWidget; + mainWindow()->statusMessage( i18n( "Connect '%1' to '%2'" ).arg( startWidget->name() ). + arg( endWidget->name() ) ); + currentPos = mapFromGlobal( e->globalPos() ); + qApp->processEvents(); + if ( drawRecRect ) + restoreRect( QRect( mapToForm( ( (QWidget*)oldendWidget )->parentWidget(), ( (QWidget*)oldendWidget )->pos() ), + ( (QWidget*)oldendWidget )->size() ) ); + drawConnectionLine(); + break; + case BUDDY_TOOL: + if ( !validForBuddy ) + break; + restoreConnectionLine(); + wid = qApp->widgetAt( e->globalPos(), TRUE ); + if ( wid ) + wid = designerWidget( wid ); + if ( wid && canBeBuddy( wid ) && wid->isVisibleTo( this ) ) + newendWidget = wid; + else + newendWidget = 0; + if ( ::qt_cast(newendWidget) || ::qt_cast(newendWidget) ) + newendWidget = (QWidget*)endWidget; + drawRecRect = newendWidget != endWidget; + if ( !newendWidget ) + endWidget = newendWidget; + else if ( insertedWidgets.find( newendWidget ) && !isCentralWidget( newendWidget ) ) + endWidget = newendWidget; + if ( endWidget ) + mainWindow()->statusMessage( i18n( "Set buddy '%1' to '%2'" ).arg( startWidget->name() ). + arg( endWidget->name() ) ); + else + mainWindow()->statusMessage( i18n( "Set buddy '%1' to ..." ).arg( startWidget->name() ) ); + currentPos = mapFromGlobal( e->globalPos() ); + qApp->processEvents(); + if ( drawRecRect && oldendWidget ) + restoreRect( QRect( mapToForm( ( (QWidget*)oldendWidget )->parentWidget(), ( (QWidget*)oldendWidget )->pos() ), + ( (QWidget*)oldendWidget )->size() ) ); + drawConnectionLine(); + break; + case ORDER_TOOL: + break; + default: // we are in an insert-widget tool + if ( insertParent ) // draw insert rect + continueRectDraw( w->mapFromGlobal( e->globalPos() ), e->globalPos(), w, Insert ); + break; + } +} + +void FormWindow::handleMouseRelease( QMouseEvent *e, QWidget *w ) +{ + CHECK_MAINWINDOW; + if ( e->button() != LeftButton ) + return; + + switch ( currTool ) { + case POINTER_TOOL: + if ( widgetPressed && allowMove( w ) ) { // we moved the widget + sizePreviewLabel->hide(); + + if ( moving.isEmpty() || w->pos() == *moving.find(w) ) + break; + + // restore targetContainer + if ( targetContainer ) { + if( hadOwnPalette ) + targetContainer->setPalette( restorePalette ); + else + targetContainer->unsetPalette(); + } + + // tell property editor to update + if ( propertyWidget && propertyWidget->isWidgetType() && !isMainContainer( propertyWidget ) ) + emitUpdateProperties( propertyWidget ); + + QMapConstIterator it = moving.begin(); + QWidget *oldParent = it.key()->parentWidget(); + QWidget *newParent = oldParent; + // check whether we have to reparent the selection + QWidget* wa = containerAt( e->globalPos(), it.key() ); + if ( wa ) { + wa = WidgetFactory::containerOfWidget( wa ); + // ok, looks like we moved onto a container + + // check whether we really have different parents. + if ( wa == it.key()->parentWidget() ) + goto make_move_command; + + // break layout if necessary + if ( WidgetFactory::layoutType( wa ) != WidgetFactory::NoLayout ) { + if ( QMessageBox::information( mainWindow(), i18n( "Inserting Widget" ), + i18n( "You tried to insert a widget into the " + "layout Container Widget '%1'.\n" + "This is not possible. " + "In order to insert the widget, the layout of '%1'\n" + "must first be broken.\n" + "Break the layout or cancel the operation?" ). + arg( wa->name() ). + arg( wa->name() ), i18n( "&Break Layout" ), i18n( "&Cancel" ) ) ) + goto make_move_command; // cancel + breakLayout( wa ); + } + + // doesn't need to be a command, the MoveCommand does reparenting too + bool emitSelChanged = FALSE; + for ( QMap::Iterator it = moving.begin(); it != moving.end(); ++it ) { + QWidget *i = it.key(); + if ( !emitSelChanged && ::qt_cast(i) ) { + if ( ::qt_cast(i->parentWidget()) || ::qt_cast(wa) ) + emitSelChanged = TRUE; + if ( !::qt_cast(wa) ) { + MetaDataBase::setPropertyChanged( i, "buttonGroupId", FALSE ); + if ( ::qt_cast(i->parentWidget()) ) + ( (QButtonGroup*)i->parentWidget() )->remove( (QButton*)i ); + } + } + QPoint pos = wa->mapFromGlobal( i->mapToGlobal( QPoint(0,0) ) ); + i->reparent( wa, pos, TRUE ); + raiseSelection( i ); + raiseChildSelections( i ); + widgetChanged( i ); + mainWindow()->objectHierarchy()->widgetRemoved( i ); + mainWindow()->objectHierarchy()->widgetInserted( i ); + } + if ( emitSelChanged ) { + emit showProperties( wa ); + emit showProperties( propertyWidget ); + } + newParent = wa; + } + + make_move_command: + QWidgetList widgets; // collect the widgets and its old and new positions which have been moved + QValueList oldPos, newPos; + for ( it = moving.begin(); it != moving.end(); ++it ) { + widgets.append( it.key() ); + oldPos.append( *it ); + newPos.append( it.key()->pos() ); + } + // add move command, don't execute it, this is just a summary of the operations we did during the move-event handling + commandHistory()->addCommand( new MoveCommand( i18n( "Move" ), + this, widgets, + oldPos, newPos, oldParent, newParent ) ); + } else if ( drawRubber ) { // we were drawing a rubber selection + endRectDraw(); // get rid of the rectangle + blockSignals( TRUE ); + selectWidgets(); // select widgets which intersect the rect + blockSignals( FALSE ); + emitSelectionChanged(); // inform about selection changes + if ( propertyWidget ) + emitShowProperties( propertyWidget ); + } + break; + case CONNECT_TOOL: + case BUDDY_TOOL: + restoreConnectionLine(); + if ( startWidget ) + restoreRect( QRect( mapToForm( ( (QWidget*)startWidget )->parentWidget(), + ( (QWidget*)startWidget )->pos() ), + ((QWidget*)startWidget )->size() ) ); + if ( endWidget ) + restoreRect( QRect( mapToForm( ( (QWidget*)endWidget )->parentWidget(), + ( (QWidget*)endWidget )->pos() ), + ( (QWidget*)endWidget )->size() ) ); + endUnclippedPainter(); + qApp->processEvents(); + + if ( startWidget && endWidget ) { + if ( currTool == CONNECT_TOOL ) + editConnections(); + else if ( currTool == BUDDY_TOOL && validForBuddy && startWidget != endWidget ) { + QString oldBuddy = startWidget->property( "buddy" ).toString(); + if ( oldBuddy.isNull() ) + oldBuddy = ""; + SetPropertyCommand *cmd = new SetPropertyCommand( i18n( "Set Buddy for %1" ).arg( startWidget->name() ), + this, startWidget, mainWindow()->propertyeditor(), + "buddy", startWidget->property( "buddy" ), + endWidget->name(), endWidget->name(), + oldBuddy ); + commandHistory()->addCommand( cmd, TRUE ); + cmd->execute(); + emitUpdateProperties( startWidget ); + } + } + if ( !toolFixed ) + mainwindow->resetTool(); + startWidget = endWidget = 0; + mainWindow()->statusBar()->clear(); + break; + case ORDER_TOOL: + break; + default: // any insert widget tool is active + if ( insertParent ) { // we should insert the new widget now + endRectDraw(); + if ( WidgetFactory::layoutType( insertParent ) != WidgetFactory::NoLayout ) { + if ( QMessageBox::information( mainWindow(), i18n( "Inserting Widget" ), + i18n( "You tried to insert a widget into the " + "layout Container Widget '%1'.\n" + "This is not possible. " + "In order to insert the widget, the layout of '%1'\n" + "must first be broken.\n" + "Break the layout or cancel the operation?" ). + arg( insertParent->name() ). + arg( insertParent->name() ), i18n( "&Break Layout" ), i18n( "&Cancel" ) ) == 0 ) { + breakLayout( insertParent ); + } else { + if ( !toolFixed ) + mainWindow()->resetTool(); + break; + } + } + insertWidget(); // so do it + } + break; + } + widgetPressed = FALSE; + drawRubber = FALSE; + insertParent = 0; + delete buffer; + buffer = 0; +} + +void FormWindow::handleKeyPress( QKeyEvent *e, QWidget *w ) +{ + CHECK_MAINWINDOW; + e->ignore(); + checkSelectionsTimer->stop(); + if ( !checkedSelectionsForMove && + ( e->key() == Key_Left || + e->key() == Key_Right || + e->key() == Key_Up || + e->key() == Key_Down ) && + propertyWidget->isWidgetType() ) + checkSelectionsForMove( (QWidget*)propertyWidget ); + checkSelectionsTimer->start( 1000, TRUE ); + if ( e->key() == Key_Left || e->key() == Key_Right || + e->key() == Key_Up || e->key() == Key_Down ) { + QWidgetList widgets; + QValueList oldPos, newPos; + for ( WidgetSelection *s = selections.first(); s; s = selections.next() ) { + if ( s->isUsed() ) { + int dx = 0, dy = 0; + bool control = e->state() & ControlButton; + + switch ( e->key() ) { + case Key_Left: { + e->accept(); + if ( control ) + dx = -1; + else + dx = -grid().x(); + } break; + case Key_Right: { + e->accept(); + if ( control ) + dx = 1; + else + dx = grid().x(); + } break; + case Key_Up: { + e->accept(); + if ( control ) + dy = -1; + else + dy = -grid().y(); + } break; + case Key_Down: { + e->accept(); + if ( control ) + dy = 1; + else + dy = grid().y(); + } break; + default: + break; + } + + widgets.append( s->widget() ); + oldPos.append( s->widget()->pos() ); + newPos.append( s->widget()->pos() + QPoint( dx, dy ) ); + } + } + if ( !widgets.isEmpty() ) { + MoveCommand *cmd = new MoveCommand( i18n( "Move" ), this, + widgets, oldPos, newPos, 0, 0 ); + commandHistory()->addCommand( cmd, TRUE ); + cmd->execute(); + } + } + if ( !e->isAccepted() ) { + QObjectList *l = queryList( "QWidget" ); + if ( !l ) + return; + if ( l->find( w ) != -1 ) + e->accept(); + delete l; + } + +} + +void FormWindow::handleKeyRelease( QKeyEvent *e, QWidget * ) +{ + e->ignore(); +} + +void FormWindow::selectWidget( QObject *o, bool select ) +{ + CHECK_MAINWINDOW; + if ( !o->isWidgetType() ) { + // ########### do QObject stuff + return; + } + + QWidget *w = (QWidget*)o; + + if ( isMainContainer( w ) ) { + QObject *opw = propertyWidget; + propertyWidget = mainContainer(); + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + emitShowProperties( propertyWidget ); + return; + } + + if ( ::qt_cast(mainContainer()) && w == ( (QMainWindow*)mainContainer() )->centralWidget() ) { + QObject *opw = propertyWidget; + propertyWidget = mainContainer(); + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + emitShowProperties( propertyWidget ); + return; + } + + if ( ::qt_cast(o) ) + return; + + if ( select ) { + QObject *opw = propertyWidget; + propertyWidget = w; + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + if ( !isPropertyShowingBlocked() ) + emitShowProperties( propertyWidget ); + WidgetSelection *s = usedSelections.find( w ); + if ( s ) { + s->show(); + return; + } + + for ( WidgetSelection *s2 = selections.first(); s2; s2 = selections.next() ) { + if ( !s2->isUsed() ) { + s = s2; + } + } + + if ( !s ) { + s = new WidgetSelection( this, &usedSelections ); + selections.append( s ); + } + + s->setWidget( w ); + emitSelectionChanged(); + } else { + WidgetSelection *s = usedSelections.find( w ); + if ( s ) + s->setWidget( 0 ); + QObject *opw = propertyWidget; + if ( !usedSelections.isEmpty() ) + propertyWidget = QPtrDictIterator( usedSelections ).current()->widget(); + else + propertyWidget = mainContainer(); + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + if ( !isPropertyShowingBlocked() ) + emitShowProperties( propertyWidget ); + emitSelectionChanged(); + } +} + +QPoint FormWindow::grid() const +{ + if ( !mainWindow() || !mainWindow()->snapGrid() ) + return QPoint( 1, 1 ); + return mainWindow()->grid(); +} + +void FormWindow::updateSelection( QWidget *w ) +{ + WidgetSelection *s = usedSelections.find( w ); + if ( !w->isVisibleTo( this ) ) + selectWidget( w, FALSE ); + else if ( s ) + s->updateGeometry(); +} + +void FormWindow::raiseSelection( QWidget *w ) +{ + WidgetSelection *s = usedSelections.find( w ); + if ( s ) + s->show(); +} + +void FormWindow::repaintSelection( QWidget *w ) +{ + WidgetSelection *s = usedSelections.find( w ); + if ( s ) + s->update(); +} + +void FormWindow::clearSelection( bool changePropertyDisplay ) +{ + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) + it.current()->setWidget( 0, FALSE ); + + usedSelections.clear(); + if ( changePropertyDisplay ) { + QObject *opw = propertyWidget; + propertyWidget = mainContainer(); + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + emitShowProperties( propertyWidget ); + } + emitSelectionChanged(); +} + +void FormWindow::startRectDraw( const QPoint &p, const QPoint &global, QWidget *, RectType t ) +{ + QPoint pos( p ); + pos = mapFromGlobal( global ); + oldRectValid = FALSE; + beginUnclippedPainter( TRUE ); + if ( t == Rubber ) + unclippedPainter->setPen( QPen( color0, 1 ) ); + if ( t == Insert ) + rectAnchor = gridPoint( pos ); + else if ( t == Rubber ) + rectAnchor = pos; + currRect = QRect( rectAnchor, QPoint( 0, 0 ) ); + if ( t == Insert ) + drawSizePreview( pos, i18n("Use Size Hint") ); +} + +void FormWindow::continueRectDraw( const QPoint &p, const QPoint &global, QWidget *, RectType t ) +{ + QPoint pos =p; + pos = mapFromGlobal( global ); + QPoint p2; + if ( t == Insert ) + p2 = gridPoint( pos ); + else if ( t == Rubber ) + p2 = pos; + QRect r( rectAnchor, p2 ); + r = r.normalize(); + + if ( currRect == r ) { + QString t = i18n( "%1/%2" ); + t = t.arg( r.width() - 1 ).arg( r.height() - 1 ); + drawSizePreview( pos, t ); + return; + } + + if ( oldRectValid ) + unclippedPainter->drawRect( currRect ); + if ( r.width() > 1 || r.height() > 1 ) { + oldRectValid = TRUE; + currRect = r; + if ( t == Insert ) { + QString t = i18n( "%1/%2" ); + t = t.arg( r.width() - 1 ).arg( r.height() - 1 ); + drawSizePreview( pos, t ); + } + unclippedPainter->setClipRegion( QRegion( rect() ).subtract( QRect( sizePreviewPos, sizePreviewPixmap.size() ) ) ); + unclippedPainter->drawRect( currRect ); + unclippedPainter->setClipping( FALSE ); + } else { + oldRectValid = FALSE; + if ( t == Insert ) + drawSizePreview( pos, i18n("Use Size Hint") ); + } +} + +void FormWindow::endRectDraw() +{ + if ( !unclippedPainter ) + return; + + if ( oldRectValid ) + unclippedPainter->drawRect( currRect ); + drawSizePreview( QPoint(-1,-1), QString::null ); + endUnclippedPainter(); +} + +void FormWindow::selectWidgets() +{ + QObjectList *l = mainContainer()->queryList( "QWidget" ); + if ( l ) { + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets[ (void*)o ] ) { + QPoint p = ( (QWidget*)o )->mapToGlobal( QPoint(0,0) ); + p = mapFromGlobal( p ); + QRect r( p, ( (QWidget*)o )->size() ); + if ( r.intersects( currRect ) && !r.contains( currRect ) ) + selectWidget( (QWidget*)o ); + } + } + delete l; + } + emitSelectionChanged(); +} + +bool FormWindow::isWidgetSelected( QObject *w ) +{ + if ( w->isWidgetType() ) + return usedSelections.find( (QWidget*)w ) != 0; + return FALSE; // #### do stuff for QObjects +} + +void FormWindow::moveSelectedWidgets( int dx, int dy ) +{ + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) { + WidgetSelection *s = it.current(); + QWidget *w = s->widget(); + if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) + continue; + w->move( w->x() + dx, w->y() + dy ); + s->updateGeometry(); + updateChildSelections( w ); + } +} + +CommandHistory *FormWindow::commandHistory() +{ + return &commands; +} + +void FormWindow::undo() +{ + commandHistory()->undo(); +} + +void FormWindow::redo() +{ + commandHistory()->redo(); +} + +void FormWindow::raiseChildSelections( QWidget *w ) +{ + QObjectList *l = w->queryList( "QWidget" ); + if ( !l || !l->first() ) { + delete l; + return; + } + + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) { + if ( l->findRef( it.current()->widget() ) != -1 ) + it.current()->show(); + } + delete l; +} + +void FormWindow::updateChildSelections( QWidget *w ) +{ + QObjectList *l = w->queryList( "QWidget" ); + if ( l ) { + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && + insertedWidgets.find( (QWidget*)o ) ) + updateSelection( (QWidget*)o ); + } + delete l; + } +} + +void FormWindow::checkSelectionsForMove( QWidget *w ) +{ + checkedSelectionsForMove = TRUE; + + QObjectList *l = w->parentWidget()->queryList( "QWidget", 0, FALSE, FALSE ); + moving.clear(); + if ( l ) { + QPtrDictIterator it( usedSelections ); + WidgetSelection *sel; + while ( ( sel = it.current() ) != 0 ) { + if ( it.current()->widget() == mainContainer() ) + continue; + ++it; + if ( l->find( sel->widget() ) == -1 ) { + if ( WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) + sel->setWidget( 0 ); + } else { + if ( WidgetFactory::layoutType( sel->widget()->parentWidget() ) == WidgetFactory::NoLayout ) { + moving.insert( sel->widget(), sel->widget()->pos() ); + sel->widget()->raise(); + raiseChildSelections( sel->widget() ); + raiseSelection( sel->widget() ); + } + } + } + delete l; + } +} + +void FormWindow::deleteWidgets() +{ + CHECK_MAINWINDOW; + QWidgetList widgets; + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) { + QWidget *tb = 0; + if ( !( tb = mainWindow()->isAToolBarChild( it.current()->widget() ) ) ) + widgets.append( it.current()->widget() ); + else + ( (QDesignerToolBar*)tb )->removeWidget( it.current()->widget() ); + } + + if ( widgets.isEmpty() ) + return; + + DeleteCommand *cmd = new DeleteCommand( i18n( "Delete" ), this, widgets ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::editAdjustSize() +{ + QPtrList commands; + QWidgetList widgets = selectedWidgets(); + if ( widgets.isEmpty() ) { + QRect oldr = geometry(); + mainContainer()->adjustSize(); + resize( mainContainer()->size() ); + // check whether our own size constraint hit us + if ( size() != mainContainer()->size() ) + mainContainer()->resize( size() ); + QRect nr = geometry(); + if ( oldr != nr ) { + ResizeCommand *cmd = new ResizeCommand( i18n( "Adjust Size" ), this, this, oldr, nr ); + commandHistory()->addCommand( cmd ); + } + return; + } + for ( QWidget* w = widgets.first(); w; w = widgets.next() ) { + if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) + continue; + QRect oldr = w->geometry(); + w->adjustSize(); + QRect nr = w->geometry(); + if ( oldr != nr ) + commands.append( new ResizeCommand( i18n("Adjust Size"), this, w, oldr, nr ) ); + } + + if ( commands.isEmpty() ) + return; + for ( WidgetSelection *s = selections.first(); s; s = selections.next() ) + s->updateGeometry(); + + MacroCommand *cmd = new MacroCommand( i18n( "Adjust Size" ), this, commands ); + commandHistory()->addCommand( cmd ); +} + + +QWidgetList FormWindow::selectedWidgets() const +{ + QWidgetList widgets; + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) + widgets.append( it.current()->widget() ); + return widgets; +} + +void FormWindow::widgetChanged( QObject *w ) +{ + if ( w->isWidgetType() ) + updateSelection( (QWidget*)w ); + // ########## do QObject stuff +} + +QLabel *FormWindow::sizePreview() const +{ + if ( !sizePreviewLabel ) { + ( (FormWindow*)this )->sizePreviewLabel = new QLabel( (FormWindow*)this ); + ( (FormWindow*)this )->sizePreviewLabel->hide(); + ( (FormWindow*)this )->sizePreviewLabel->setBackgroundColor( QColor( 255, 255, 128 ) ); + ( (FormWindow*)this )->sizePreviewLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); + } + return sizePreviewLabel; +} + +void FormWindow::invalidCheckedSelections() +{ + checkedSelectionsForMove = FALSE; +} + +void FormWindow::checkPreviewGeometry( QRect &r ) +{ + if ( !rect().contains( r ) ) { + if ( r.left() < rect().left() ) + r.moveTopLeft( QPoint( 0, r.top() ) ); + if ( r.right() > rect().right() ) + r.moveBottomRight( QPoint( rect().right(), r.bottom() ) ); + if ( r.top() < rect().top() ) + r.moveTopLeft( QPoint( r.left(), rect().top() ) ); + if ( r.bottom() > rect().bottom() ) + r.moveBottomRight( QPoint( r.right(), rect().bottom() ) ); + } +} + +void FormWindow::focusInEvent( QFocusEvent * ){ + + if (ff) + ff->checkTimeStamp(); +} + +void FormWindow::focusOutEvent( QFocusEvent * ) +{ + if ( propertyWidget && !isMainContainer( propertyWidget ) && !isWidgetSelected( propertyWidget ) ) { + QObject *opw = propertyWidget; + propertyWidget = mainContainer(); + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + } +} + +void FormWindow::resizeEvent( QResizeEvent *e ) +{ + QWidget::resizeEvent( e ); + if ( currTool == ORDER_TOOL ) + repositionOrderIndicators(); + if ( isVisible() ) + formFile()->setModified( TRUE, FormFile::WFormWindow ); + +#if defined(Q_WS_WIN32) + windowsRepaintWorkaroundTimer->start( 100, TRUE ); +#endif +} + +void FormWindow::windowsRepaintWorkaroundTimerTimeout() +{ +#if defined(Q_WS_WIN32) + QObjectList *l = queryList( "QWidget" ); + for ( QObject *o = l->first(); o; o = l->next() ) { + flickerfree_update( (QWidget*)o ); + } + flickerfree_update( this ); + delete l; +#endif +} + +QPtrDict *FormWindow::widgets() +{ + return &insertedWidgets; +} + +QWidget *FormWindow::designerWidget( QObject *o ) const +{ + if ( !o || !o->isWidgetType() ) + return 0; + QWidget *w = (QWidget*)o; + while ( w && !isMainContainer( w ) && !insertedWidgets[ (void*)w ] || isCentralWidget( w ) ) + w = (QWidget*)w->parent(); + return w; +} + +void FormWindow::emitShowProperties( QObject *w ) +{ + if ( w ) { + QObject *opw = propertyWidget; + propertyWidget = w; + if ( opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + } + showPropertiesTimer->stop(); +// showPropertiesTimer->start( 0, TRUE ); + showPropertiesTimerDone(); +} + +void FormWindow::emitUpdateProperties( QObject *w ) +{ + if ( w == propertyWidget ) { + updatePropertiesTimer->stop(); + updatePropertiesTimer->start( 0, TRUE ); + } +} + +void FormWindow::emitSelectionChanged() +{ + selectionChangedTimer->stop(); + selectionChangedTimer->start( 0, TRUE ); +} + +void FormWindow::updatePropertiesTimerDone() +{ + CHECK_MAINWINDOW; + if ( propertyWidget && mainWindow()->formWindow() == this ) + emit updateProperties( propertyWidget ); +} + +void FormWindow::showPropertiesTimerDone() +{ + CHECK_MAINWINDOW; + if ( propertyWidget && mainWindow()->formWindow() == this ) + emit showProperties( propertyWidget ); +} + +void FormWindow::selectionChangedTimerDone() +{ + emit selectionChanged(); +} + +void FormWindow::currentToolChanged() +{ + CHECK_MAINWINDOW; + toolFixed = FALSE; + int t = mainwindow->currentTool(); + if ( currTool == t && t != ORDER_TOOL ) + return; + + // tool cleanup + switch ( currTool ) { + case ORDER_TOOL: + hideOrderIndicators(); + break; + case CONNECT_TOOL: + case BUDDY_TOOL: + restoreConnectionLine(); + if ( startWidget ) + restoreRect( QRect( mapToForm( ( (QWidget*)startWidget )->parentWidget(), + ( (QWidget*)startWidget )->pos() ), + ( (QWidget*)startWidget )->size() ) ); + if ( endWidget ) + restoreRect( QRect( mapToForm( ( (QWidget*)endWidget )->parentWidget(), + ( (QWidget*)endWidget )->pos() ), + ( (QWidget*)endWidget )->size() ) ); + endUnclippedPainter(); + break; + case POINTER_TOOL: + break; + default: + if ( insertParent ) + endRectDraw(); + break; + } + + startWidget = endWidget = 0; + widgetPressed = FALSE; + drawRubber = FALSE; + insertParent = 0; + delete buffer; + buffer = 0; + + currTool = t; + + if ( hasFocus() ) + clearSelection( FALSE ); + + mainWindow()->statusBar()->clear(); + + // tool setup + switch ( currTool ) { + case POINTER_TOOL: + if ( propertyWidget && !isMainContainer( propertyWidget ) && !isWidgetSelected( propertyWidget ) ) + emitShowProperties( mainContainer() ); + restoreCursors( this, this ); + break; + case ORDER_TOOL: + if ( mainWindow()->formWindow() == this ) { + mainWindow()->statusMessage( i18n( "Click widgets to change the tab order...") ); + orderedWidgets.clear(); + showOrderIndicators(); + if ( mainWindow()->formWindow() == this ) + emitShowProperties( mainContainer() ); + setCursorToAll( ArrowCursor, this ); + } + break; + case CONNECT_TOOL: + case BUDDY_TOOL: + if ( currTool == CONNECT_TOOL ) + mainWindow()->statusMessage( i18n( "Drag a line to create a connection...") ); + else + mainWindow()->statusMessage( i18n( "Drag a line to set a buddy...") ); + setCursorToAll( CrossCursor, this ); + if ( mainWindow()->formWindow() == this ) + emitShowProperties( mainContainer() ); + break; + default: + mainWindow()->statusMessage( i18n( "Click on the form to insert a %1..." ).arg( WidgetDatabase::toolTip( currTool ).lower() ) ); + setCursorToAll( CrossCursor, this ); + if ( mainWindow()->formWindow() == this ) + emitShowProperties( mainContainer() ); + break; + } +} + +void FormWindow::showOrderIndicators() +{ + hideOrderIndicators(); + orderIndicators.setAutoDelete( TRUE ); + QObjectList *l = mainContainer()->queryList( "QWidget" ); + stackedWidgets = MetaDataBase::tabOrder( this ); + if ( l ) { + int order = 1; + for ( QObject *o = l->first(); o; o = l->next() ) { + QWidget* w = (QWidget*) o; + if ( w->isShown() && + insertedWidgets[ (void*)w ] && + w->focusPolicy() != NoFocus ) { + OrderIndicator* ind = new OrderIndicator( order++, w, this ); + orderIndicators.append( ind ); + if ( stackedWidgets.findRef( w ) == -1 ) + stackedWidgets.append( w ); + } + } + delete l; + } + updateOrderIndicators(); +} + +void FormWindow::hideOrderIndicators() +{ + orderIndicators.clear(); +} + +void FormWindow::updateOrderIndicators() +{ + int order = 1; + for ( QWidget *w = stackedWidgets.first(); w; w = stackedWidgets.next() ) { + for ( OrderIndicator* i = orderIndicators.first(); i; i = orderIndicators.next() ) + i->setOrder( order, w ); + order++; + } +} + +void FormWindow::repositionOrderIndicators() +{ + for ( OrderIndicator* i = orderIndicators.first(); i; i = orderIndicators.next() ) + i->reposition(); +} + + +void FormWindow::updateUndoInfo() +{ + commandHistory()->emitUndoRedo(); +} + +bool FormWindow::checkCustomWidgets() +{ + QStringList missingCustomWidgets; + QPtrDictIterator it( insertedWidgets ); + for ( ; it.current(); ++it ) { + if ( it.current()->isA( "CustomWidget" ) ) { + QString className = WidgetFactory::classNameOf( it.current() ); + if ( !MetaDataBase::hasCustomWidget( className ) ) + missingCustomWidgets << className; + } + } + + if ( !missingCustomWidgets.isEmpty() ) { + QString txt = i18n( "The following custom widgets are used in '%1',\n" + "but are not known to Qt Designer:\n" ).arg( name() ); + for ( QStringList::Iterator sit = missingCustomWidgets.begin(); sit != missingCustomWidgets.end(); ++sit ) + txt += " " + *sit + "\n"; + txt += i18n( "If you save this form and generate code for it using uic, \n" + "the generated code will not compile.\n" + "Do you want to save this form now?" ); + if ( QMessageBox::information( mainWindow(), i18n( "Save Form" ), txt ) == 1 ) + return FALSE; + } + return TRUE; +} + +void FormWindow::setPropertyShowingBlocked( bool b ) +{ + propShowBlocked = b; +} + +bool FormWindow::isPropertyShowingBlocked() const +{ + return propShowBlocked; +} + +int FormWindow::numSelectedWidgets() const +{ + return usedSelections.count(); +} + +QString FormWindow::copy() +{ + CHECK_MAINWINDOW_VALUE( QString::null ); + Resource resource( mainWindow() ); + resource.setWidget( this ); + return resource.copy(); +} + +void FormWindow::lowerWidgets() +{ + QWidgetList widgets; + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) + widgets.append( it.current()->widget() ); + + LowerCommand *cmd = new LowerCommand( i18n( "Lower" ), this, widgets ); + cmd->execute(); + commandHistory()->addCommand( cmd ); +} + +void find_accel( const QString &txt, QMap &accels, QWidget *w ) +{ + int i = txt.find( "&" ); + if ( i == -1 ) + return; + QChar c = txt[ i + 1 ]; + if ( c.isNull() || c == '&' ) + return; + c = c.lower(); + QMap::Iterator it = accels.find( c ); + if ( it == accels.end() ) { + QWidgetList wl; + wl.append( w ); + accels.insert( c, wl ); + } else { + QWidgetList *wl = &*it; + wl->append( w ); + } +} + +void FormWindow::checkAccels() +{ + CHECK_MAINWINDOW; + QMap accels; + QObjectList *l = mainContainer()->queryList( "QWidget" ); + if ( l ) { + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets[ (void*)o ] ) { + QWidget *w = (QWidget*)o; + const QMetaProperty* text = + w->metaObject()->property( w->metaObject()->findProperty( "text", TRUE ), TRUE ); + const QMetaProperty* title = + w->metaObject()->property( w->metaObject()->findProperty( "title", TRUE ), TRUE ); + const QMetaProperty* pageTitle = + w->metaObject()->property( w->metaObject()->findProperty( "pageTitle", TRUE ), TRUE ); + if ( text ) + find_accel( w->property( "text" ).toString(), accels, w ); + if ( title ) + find_accel( w->property( "title" ).toString(), accels, w ); + if ( pageTitle ) + find_accel( w->property( "pageTitle" ).toString(), accels, w ); + } else if ( ::qt_cast(o) ) { + ((MenuBarEditor *)o)->checkAccels( accels ); + } + } + delete l; + } + + bool ok = TRUE; + QWidget *wid; + for ( QMap::Iterator it = accels.begin(); it != accels.end(); ++it ) { + if ( (*it).count() > 1 ) { + ok = FALSE; + switch ( QMessageBox::information( mainWindow(), i18n( "Check Accelerators" ), + i18n( "Accelerator '%1' is used once.", "Accelerator '%1' is used %n times.", (*it).count() + ).arg( it.key().upper() ), + i18n( "&Select" ), + i18n( "&Cancel" ), QString::null, 2 ) ) { + case 0: // select + clearSelection( FALSE ); + for ( wid = (*it).first(); wid; wid = (*it).next() ) + selectWidget( wid, TRUE ); + return; + case 1: // cancel + return; + } + } + } + + if ( ok ) + QMessageBox::information( mainWindow(), i18n( "Check Accelerators" ), + i18n( "No accelerator is used more than once." ) ); +} + +void FormWindow::raiseWidgets() +{ + QWidgetList widgets; + QPtrDictIterator it( usedSelections ); + for ( ; it.current(); ++it ) + widgets.append( it.current()->widget() ); + + RaiseCommand *cmd = new RaiseCommand( i18n( "Raise" ), this, widgets ); + cmd->execute(); + commandHistory()->addCommand( cmd ); +} + +void FormWindow::paste( const QString &cb, QWidget *parent ) +{ + CHECK_MAINWINDOW; + Resource resource( mainWindow() ); + resource.setWidget( this ); + resource.paste( cb, parent ); +} + +void FormWindow::selectAll() +{ + checkedSelectionsForMove = FALSE; + blockSignals( TRUE ); + QObjectList *l = mainContainer()->queryList( "QWidget" ); + if ( l ) { + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets[ (void*)o ] ) { + selectWidget( (QWidget*)o ); + } + } + delete l; + } + + blockSignals( FALSE ); + emitSelectionChanged(); + if ( propertyWidget ) + emitShowProperties( propertyWidget ); + emitSelectionChanged(); +} + +void FormWindow::layoutHorizontal() +{ + QWidgetList widgets( selectedWidgets() ); + LayoutHorizontalCommand *cmd = new LayoutHorizontalCommand( i18n( "Lay Out Horizontally" ), + this, mainContainer(), 0, widgets ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutVertical() +{ + QWidgetList widgets( selectedWidgets() ); + LayoutVerticalCommand *cmd = new LayoutVerticalCommand( i18n( "Lay Out Vertically" ), + this, mainContainer(), 0, widgets ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutHorizontalSplit() +{ + QWidgetList widgets( selectedWidgets() ); + LayoutHorizontalSplitCommand *cmd = new LayoutHorizontalSplitCommand( i18n( "Lay Out Horizontally (in splitter)" ), + this, mainContainer(), 0, widgets ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutVerticalSplit() +{ + QWidgetList widgets( selectedWidgets() ); + LayoutVerticalSplitCommand *cmd = new LayoutVerticalSplitCommand( i18n( "Lay Out Vertically (in splitter)" ), + this, mainContainer(), 0, widgets ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutGrid() +{ + int xres = grid().x(); + int yres = grid().y(); + + QWidgetList widgets( selectedWidgets() ); + LayoutGridCommand *cmd = new LayoutGridCommand( i18n( "Lay Out in a Grid" ), + this, mainContainer(), 0, widgets, xres, yres ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutHorizontalContainer( QWidget *w ) +{ + if ( w == this ) + w = mainContainer(); + QObjectList *l = (QObjectList*)WidgetFactory::containerOfWidget(w)->children(); + if ( !l ) + return; + QWidgetList widgets; + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && + ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets.find( (QWidget*)o ) ) + widgets.append( (QWidget*)o ); + } + LayoutHorizontalCommand *cmd = new LayoutHorizontalCommand( i18n( "Lay Out Children Horizontally" ), + this, mainContainer(), w, widgets ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutVerticalContainer( QWidget *w ) +{ + if ( w == this ) + w = mainContainer(); + QObjectList *l = (QObjectList*)WidgetFactory::containerOfWidget(w)->children(); + if ( !l ) + return; + QWidgetList widgets; + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && + ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets.find( (QWidget*)o ) ) + widgets.append( (QWidget*)o ); + } + LayoutVerticalCommand *cmd = new LayoutVerticalCommand( i18n( "Lay Out Children Vertically" ), + this, mainContainer(), w, widgets ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::layoutGridContainer( QWidget *w ) +{ + if ( w == this ) + w = mainContainer(); + int xres = grid().x(); + int yres = grid().y(); + + QObjectList *l = (QObjectList*)WidgetFactory::containerOfWidget(w)->children(); + if ( !l ) + return; + QWidgetList widgets; + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && + ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets.find( (QWidget*)o ) ) + widgets.append( (QWidget*)o ); + } + LayoutGridCommand *cmd = new LayoutGridCommand( i18n( "Lay Out Children in a Grid" ), + this, mainContainer(), w, widgets, xres, yres ); + clearSelection( FALSE ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void FormWindow::breakLayout( QWidget *w ) +{ + if ( w == this ) + w = mainContainer(); + w = WidgetFactory::containerOfWidget( w ); + QPtrList commands; + + for (;;) { + if ( !w || w == this ) + break; + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout && + WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ) ) { + Command *cmd = breakLayoutCommand( w ); + if ( cmd ) + commands.insert( 0, cmd ); + if ( !::qt_cast(w) && !::qt_cast(w) ) + break; + } + w = w->parentWidget(); + } + + if ( commands.isEmpty() ) + return; + + clearSelection( FALSE ); + MacroCommand *cmd = new MacroCommand( i18n( "Break Layout" ), this, commands ); + commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +BreakLayoutCommand *FormWindow::breakLayoutCommand( QWidget *w ) +{ + CHECK_MAINWINDOW_VALUE( 0 ); + QObjectList *l = (QObjectList*)w->children(); + if ( !l ) + return 0; + + QWidgetList widgets; + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && + !mainWindow()->isAToolBarChild( (QWidget*)o ) && + ( (QWidget*)o )->isVisibleTo( this ) && + insertedWidgets.find( (QWidget*)o ) ) + widgets.append( (QWidget*)o ); + } + return new BreakLayoutCommand( i18n( "Break Layout" ), this, WidgetFactory::widgetOfContainer( w ), widgets ); +} + +int FormWindow::numVisibleWidgets() const +{ + QPtrDictIterator it( insertedWidgets ); + int visible = 0; + for ( ; it.current(); ++it ) { + if ( it.current()->isVisibleTo( (FormWindow*)this ) ) + visible++; + } + return visible; +} + +bool FormWindow::hasInsertedChildren( QWidget *w ) const +{ + if ( !w ) + return FALSE; + w = WidgetFactory::containerOfWidget( w ); + if ( !w ) + return FALSE; + QObjectList *l = w->queryList( "QWidget" ); + if ( !l || !l->first() ) { + delete l; + return FALSE; + } + + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o->isWidgetType() && + ( (QWidget*)o )->isVisibleTo( (FormWindow*)this ) && + insertedWidgets.find( (QWidget*)o ) ) { + delete l; + return TRUE; + } + } + + delete l; + return FALSE; +} + +bool FormWindow::allowMove( QWidget *w ) +{ + w = w->parentWidget(); + while ( w ) { + if ( ( isMainContainer( w ) || insertedWidgets.find( w ) ) && WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) + return TRUE; + w = w->parentWidget(); + } + return FALSE; +} + + +void FormWindow::editConnections() +{ + CHECK_MAINWINDOW; + buffer = 0; + if ( !startWidget || !endWidget ) + return; + + ConnectionDialog dlg( mainwindow ); + mainWindow()->statusMessage( i18n( "Edit connections...") ); + dlg.addConnection( startWidget, endWidget, QString::null, QString::null ); + QTimer::singleShot( 0, &dlg, SLOT(ensureConnectionVisible()) ); + dlg.exec(); +} + +void FormWindow::saveBackground() +{ + if ( buffer ) + delete buffer; + buffer = new QPixmap( width(), height() ); + *buffer = QPixmap::grabWindow( winId() ); +} + +void FormWindow::restoreConnectionLine() +{ + if (!unclippedPainter || !buffer) // designer will occasionally crash if buffer is not tested to be non-zero + return; + + int a =QABS( startPos.x() - currentPos.x() ); + int b = QABS( startPos.y() - currentPos.y() ); + QRect r( startPos, currentPos ); + + if ( a < 32 || b < 32 ) { // special case: vertical or horizontal line + r = r.normalize(); + unclippedPainter->drawPixmap( r.x() - 2, r.y() - 2, *buffer, + r.x() - 2, r.y() - 2, r.width() + 4, r.height() + 4 ); + return; + } + + if ( a <= 0 ) + a = 1; + if ( b <= 0 ) + b = 1; + int w, h; + if ( b > a ) { + h = 64; + w = ( a * h ) / b; + } else { + w = 64; + h = ( b * w ) / a; + } + + int dx = 2 * w / 3; + int dy = 2 * h / 3; + QPoint p( startPos ); + + if ( r.x() > r.right() ) { + dx = dx * -1; + p.setX( p.x() - 64 ); + r.moveBy( -64, 0 ); + } + if ( r.y() > r.bottom() ) { + dy = dy * -1; + p.setY( p.y() - 64 ); + r.moveBy( 0, -64 ); + } + + w = h = 64; + r = r.normalize(); + while ( r.contains( p ) ) { + unclippedPainter->drawPixmap( p, *buffer, QRect( p, QSize( w, h ) ) ); + unclippedPainter->setPen( red ); + p.setX( p.x() + dx ); + p.setY( p.y() + dy ); + } + + unclippedPainter->drawPixmap( startPos.x() - 10, startPos.y() - 10, *buffer, + startPos.x() - 10, startPos.y() - 10, 20, 20 ); +} + +void FormWindow::restoreRect( const QRect &rect ) +{ + if (!unclippedPainter || !buffer) + return; + + QRect r( rect ); + r = r.normalize(); + + r = QRect( r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4 ); + + unclippedPainter->drawPixmap( r.x() - 2, r.y() - 2, *buffer, r.x() - 2, r.y() - 2, r.width() + 4, 4 ); + unclippedPainter->drawPixmap( r.x() - 2, r.y() - 2, *buffer, r.x() - 2, r.y() - 2, 4, r.height() + 4 ); + unclippedPainter->drawPixmap( r.x() - 2, r.y() + r.height() - 3, *buffer, r.x() - 2, r.y() + r.height() - 3, r.width() + 4, 5 ); + unclippedPainter->drawPixmap( r.x() + r.width() - 2, r.y(), *buffer, r.x() + r.width() - 2, r.y(), 4, r.height() + 4 ); +} + +void FormWindow::drawConnectionLine() +{ + if ( !unclippedPainter ) + return; + + unclippedPainter->setPen( QPen( white, 2 ) ); + unclippedPainter->drawLine( startPos, currentPos ); + if ( validForBuddy ) + unclippedPainter->setPen( QPen( darkRed, 1 ) ); + else + unclippedPainter->setPen( QPen( darkCyan, 1 ) ); + unclippedPainter->drawLine( startPos, currentPos ); + + if ( validForBuddy ) + unclippedPainter->setPen( QPen( darkGreen, 1 ) ); + else + unclippedPainter->setPen( QPen( magenta, 1 ) ); + if ( startWidget ) { + QWidget *s = (QWidget*)startWidget; + QPoint p = mapToForm( s, QPoint(0,0) ); + unclippedPainter->drawRect( QRect( p + QPoint( 2, 2 ), s->size() - QSize( 4, 4 ) ) ); + } + if ( endWidget ) { + QWidget *e = (QWidget*)endWidget; + QPoint p = mapToForm( e, QPoint(0,0) ); + unclippedPainter->drawRect( QRect( p + QPoint( 2, 2 ), e->size() - QSize( 4, 4 ) ) ); + } +} + +QString FormWindow::fileName() const +{ + return ff->absFileName(); +} + +void FormWindow::setFileName( const QString &fn ) +{ + ff->setFileName( fn ); + emit fileNameChanged( ff->fileName(), this ); +} + +void FormWindow::modificationChanged( bool m ) +{ + emit modificationChanged( m, this ); + emit modificationChanged( m, ff->fileName() ); +} + +bool FormWindow::unify( QObject *w, QString &s, bool changeIt ) +{ + bool found = !isMainContainer( w ) && qstrcmp( name(), s.latin1() ) == 0; + if ( !found ) { + QString orig = s; + int num = 1; + QPtrDictIterator it( insertedWidgets ); + for ( ; it.current();) { + if ( it.current() != w && + qstrcmp( it.current()->name(), s.latin1() ) == 0 ) { + found = TRUE; + if ( !changeIt ) + break; + s = orig + "_" + QString::number( ++num ); + it.toFirst(); + } else { + ++it; + } + } + if ( !found ) { + QPtrList al; + QAction *a = 0; + for ( a = actions.first(); a; a = actions.next() ) { + QObjectList *l = a->queryList( "QAction" ); + al.append( a ); + for ( QObject *ao = l->first(); ao; ao = l->next() ) + al.append( (QAction*)ao ); + delete l; + } + for ( a = al.first(); a; a = al.next() ) { + if ( a != w && + qstrcmp( a->name(), s.latin1() ) == 0 ) { + found = TRUE; + if ( !changeIt ) + break; + s = orig + "_" + QString::number( ++num ); + a = actions.first(); + } + } + } + if ( ::qt_cast(mainContainer()) && !found ) { + QObjectList *l = mainContainer()->queryList( "PopupMenuEditor" ); + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o != w && + qstrcmp ( o->name(), s.latin1() ) == 0 ) { + found = TRUE; + if ( !changeIt ) + break; + s = orig + "_" + QString::number( ++num ); + o = l->first(); + } + } + delete l; + } + if ( ::qt_cast(mainContainer()) ) { + if ( !found ) { + QObjectList *l = mainContainer()->queryList( "QDockWindow", 0, TRUE ); + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o != w && + qstrcmp( o->name(), s.latin1() ) == 0 ) { + found = TRUE; + if ( !changeIt ) + break; + s = orig + "_" + QString::number( ++num ); + o = l->first(); + } + } + delete l; + } + } + } + + if ( !found ) + return TRUE; + return FALSE; +} + +bool FormWindow::isCustomWidgetUsed( MetaDataBase::CustomWidget *w ) +{ + QPtrDictIterator it( insertedWidgets ); + for ( ; it.current(); ++it ) { + if ( it.current()->isA( "CustomWidget" ) ) { + if ( qstrcmp( WidgetFactory::classNameOf( it.current() ), w->className.utf8() ) == 0 ) + return TRUE; + } + } + + return FALSE; +} + +bool FormWindow::isDatabaseWidgetUsed() const +{ +#ifndef QT_NO_SQL + QStringList dbClasses; + dbClasses << "QDataTable"; // add more here + QPtrDictIterator it( insertedWidgets ); + for ( ; it.current(); ++it ) { + QString c( it.current()->className() ); + if ( dbClasses.contains( c ) > 0 ) { + return TRUE; + } + } +#endif + return FALSE; +} + +bool FormWindow::isDatabaseAware() const +{ +#ifndef QT_NO_SQL + if ( QString(mContainer->className()) == "QDesignerDataBrowser" || QString(mContainer->className()) == "QDesignerDataView" ) + return TRUE; + return isDatabaseWidgetUsed(); +#else + return FALSE; +#endif +} + +void FormWindow::visibilityChanged() +{ + if ( currTool != ORDER_TOOL ) { + emitUpdateProperties( currentWidget() ); + } else { + updateOrderIndicators(); + repositionOrderIndicators(); + } +} + + +/*! + Maps \a pos in \a w's coordinates to the form's coordinate system. + + This is the equivalent to mapFromGlobal(w->mapToGlobal(pos) ) but + avoids the two roundtrips to the X-Server on Unix/X11. + */ +QPoint FormWindow::mapToForm( const QWidget* w, const QPoint& pos ) const +{ + QPoint p = pos; + const QWidget* i = w; + while ( i && !i->isTopLevel() && !isMainContainer( (QWidget*)i ) ) { + p = i->mapToParent( p ); + i = i->parentWidget(); + } + return mapFromGlobal( w->mapToGlobal( pos ) ); +} + +static int widgetDepth( QWidget *w ) +{ + int d = -1; + while ( w && !w->isTopLevel() ) { + d++; + w = w->parentWidget(); + } + + return d; +} + +static bool isChildOf( QWidget *c, QWidget *p ) +{ + while ( c && !c->isTopLevel() ) { + if ( c == p ) + return TRUE; + c = c->parentWidget(); + } + return FALSE; +} + +QWidget *FormWindow::containerAt( const QPoint &pos, QWidget *notParentOf ) +{ + QPtrDictIterator it( insertedWidgets ); + QWidget *container = 0; + int depth = -1; + QWidgetList selected = selectedWidgets(); + if ( rect().contains( mapFromGlobal( pos ) ) ) { + container = mainContainer(); + depth = widgetDepth( container ); + } + + for ( ; it.current(); ++it ) { + if ( ::qt_cast(it.current()) + || ::qt_cast(it.current()) ) + continue; + if ( !it.current()->isVisibleTo( this ) ) + continue; + if ( selected.find( it.current() ) != -1 ) + continue; + if ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( it.current() ) ) ) && + it.current() != mainContainer() ) + continue; + + // the rectangles of all ancestors of the container must contain the insert position + QWidget *w = it.current(); + while ( w && !w->isTopLevel() ) { + if ( !w->rect().contains( ( w->mapFromGlobal( pos ) ) ) ) + break; + w = w->parentWidget(); + } + if ( !( w == 0 || w->isTopLevel() ) ) continue; // we did not get through the full while loop + + int wd = widgetDepth( it.current() ); + if ( wd == depth && container ) { + if ( ( (QObjectList*)it.current()->parentWidget()->children() )->find( it.current() ) > + ( (QObjectList*)container->parentWidget()->children() )->find( container ) ) + wd++; + } + if ( wd > depth && !isChildOf( it.current(), notParentOf ) ) { + depth = wd; + container = it.current(); + } + } + + return container; +} + +bool FormWindow::isMainContainer( QObject *w ) const +{ + return w && w->isWidgetType() && ( w == (QWidget*)this || w == mainContainer() ); +} + +void FormWindow::setMainContainer( QWidget *w ) +{ + bool resetPropertyWidget = isMainContainer( propertyWidget ); + if ( mContainer ) + insertedWidgets.remove( mContainer ); + if ( propertyWidget == mContainer ) + propertyWidget = 0; + delete mContainer; + mContainer = w; + insertedWidgets.insert( mContainer, mContainer ); + delete layout(); + QHBoxLayout *l = new QHBoxLayout( this ); + l->addWidget( w ); + if ( resetPropertyWidget ) { + QObject *opw = propertyWidget; + propertyWidget = mContainer; + if ( opw && opw->isWidgetType() ) + repaintSelection( (QWidget*)opw ); + } + if ( project() ) { + LanguageInterface *iface = MetaDataBase::languageInterface( project()->language() ); + if ( iface && !project()->isCpp() && !isFake() ) { + if ( !MetaDataBase::hasFunction( this, "init()" ) ) + MetaDataBase::addFunction( this, "init()", "", "private", "function", + project()->language(), "void" ); + if ( !MetaDataBase::hasFunction( this, "destroy()" ) ) + MetaDataBase::addFunction( this, "destroy()", "", "private", "function", + project()->language(), "void" ); + if ( !MetaDataBase::hasConnection( this, mainContainer(), "shown()", mainContainer(), "init" ) ) + MetaDataBase::addConnection( this, mainContainer(), "shown()", mainContainer(), "init" ); + if ( !MetaDataBase::hasConnection( this, mainContainer(), "destroyed()", mainContainer(), "destroy" ) ) + MetaDataBase::addConnection( this, mainContainer(), "destroyed()", + mainContainer(), "destroy" ); + } + } +} + +bool FormWindow::savePixmapInline() const +{ + return pixInline; +} + +bool FormWindow::savePixmapInProject() const +{ + return pixProject; +} + +QString FormWindow::pixmapLoaderFunction() const +{ + return pixLoader; +} + +void FormWindow::setSavePixmapInline( bool b ) +{ + pixInline = b; + if ( b ) + pixProject = FALSE; +} + +void FormWindow::setSavePixmapInProject( bool b ) +{ + pixProject = b; + if ( b ) + pixInline = FALSE; +} + +void FormWindow::setPixmapLoaderFunction( const QString &func ) +{ + pixLoader = func; +} + +void FormWindow::setActiveObject( QObject *o ) +{ + emitShowProperties( o ); + propertyWidget = o; +} + +void FormWindow::setProject( Project *pro ) +{ + proj = pro; +} + +Project *FormWindow::project() const +{ + return proj; +} + +QAction *FormWindow::findAction( const QString &name ) +{ + for ( QAction *a = actionList().first(); a; a = actionList().next() ) { + if ( QString( a->name() ) == name ) + return a; + QAction *ac = (QAction*)a->child( name.latin1(), "QAction" ); + if ( ac ) + return ac; + } + return 0; +} + +void FormWindow::killAccels( QObject *top ) +{ + QObjectList *l = top->queryList( "QAccel" ); + if ( !l ) + return; + for ( QObject *o = l->first(); o; o = l->next() ) + ( (QAccel*)o )->setEnabled( FALSE ); + delete l; +} + +DesignerFormWindow *FormWindow::iFace() +{ + if ( !iface ) + iface = new DesignerFormWindowImpl( this ); + return iface; +} + +bool FormWindow::isCentralWidget( QObject *w ) const +{ + if ( !::qt_cast(mainContainer()) ) + return FALSE; + return w == ( (QMainWindow*)mainContainer() )->centralWidget(); +} + +int FormWindow::layoutDefaultSpacing() const +{ + return defSpacing; +} + +int FormWindow::layoutDefaultMargin() const +{ + return defMargin; +} + +void FormWindow::setLayoutDefaultSpacing( int s ) +{ + defSpacing = s; +} + +void FormWindow::setLayoutDefaultMargin( int s ) +{ + defMargin = s; +} + +void FormWindow::setSpacingFunction( const QString &funct ) +{ + spacFunction = funct; +} + +QString FormWindow::spacingFunction() const +{ + return spacFunction; +} + +void FormWindow::hasLayoutFunctions( bool b ) +{ + hasLayoutFunc = b; +} + +bool FormWindow::hasLayoutFunctions() const +{ + return hasLayoutFunc; +} + +void FormWindow::setMarginFunction( const QString &funct ) +{ + margFunction = funct; +} + +QString FormWindow::marginFunction() const +{ + return margFunction; +} + +FormFile *FormWindow::formFile() const +{ + return ff; +} + +void FormWindow::setFormFile( FormFile *f ) +{ + ff = f; + if ( ff ) + connect( this, SIGNAL( modificationChanged(bool, const QString&) ), ff, SLOT( formWindowChangedSomehow() ) ); +} + +bool FormWindow::canBeBuddy( const QWidget *w ) const +{ + return w->focusPolicy() != QWidget::NoFocus; +} + +bool FormWindow::event( QEvent *e ) +{ + if (e->type() == QEvent::ShowMaximized) + { +#if QT_VERSION >= 0x030300 + if ( isMaximized() ) + setWindowState( windowState() & ~WindowMaximized | WindowActive); +#endif + return true; + } + return QWidget::event(e); +} diff --git a/kdevdesigner/designer/formwindow.h b/kdevdesigner/designer/formwindow.h new file mode 100644 index 00000000..782a26c3 --- /dev/null +++ b/kdevdesigner/designer/formwindow.h @@ -0,0 +1,322 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef FORMWINDOW_H +#define FORMWINDOW_H + +#include "command.h" +#include "metadatabase.h" +#include "sizehandle.h" +#include "actiondnd.h" + +#include +#include +#include +#include +#include + +class QPaintEvent; +class QMouseEvent; +class QKeyEvent; +class QPainter; +class QLabel; +class MainWindow; +class QTimer; +class QFocusEvent; +class QCloseEvent; +class Resource; +class QResizeEvent; +class BreakLayoutCommand; +class QPixmap; +class QSizeGrip; +class Project; +struct DesignerFormWindow; +class FormFile; + +#if defined(Q_CC_MSVC) || defined(Q_FULL_TEMPLATE_INSTANTIATION) +#include "orderindicator.h" +#else +class OrderIndicator; +#endif + +class FormWindow : public QWidget +{ + Q_OBJECT + Q_PROPERTY( QString fileName READ fileName WRITE setFileName ) + +public: + FormWindow( FormFile *f, MainWindow *mw, QWidget *parent, const char *name = 0 ); + FormWindow( FormFile *f, QWidget *parent, const char *name = 0 ); + ~FormWindow(); + + void init(); + virtual void setMainWindow( MainWindow *w ); + + virtual QString fileName() const; + virtual void setFileName( const QString &fn ); + + virtual QPoint grid() const; + virtual QPoint gridPoint( const QPoint &p ); + + virtual CommandHistory *commandHistory(); + + virtual void undo(); + virtual void redo(); + virtual QString copy(); + virtual void paste( const QString &cb, QWidget *parent ); + virtual void lowerWidgets(); + virtual void raiseWidgets(); + virtual void checkAccels(); + + virtual void layoutHorizontal(); + virtual void layoutVertical(); + virtual void layoutHorizontalSplit(); + virtual void layoutVerticalSplit(); + virtual void layoutGrid(); + + virtual void layoutHorizontalContainer( QWidget *w ); + virtual void layoutVerticalContainer( QWidget *w ); + virtual void layoutGridContainer( QWidget *w ); + + virtual void breakLayout( QWidget *w ); + + virtual void selectWidget( QObject *w, bool select = TRUE ); + virtual void selectAll(); + virtual void updateSelection( QWidget *w ); + virtual void raiseSelection( QWidget *w ); + virtual void repaintSelection( QWidget *w ); + virtual void clearSelection( bool changePropertyDisplay = TRUE ); + virtual void selectWidgets(); + bool isWidgetSelected( QObject *w ); + virtual void updateChildSelections( QWidget *w ); + virtual void raiseChildSelections( QWidget *w ); + + virtual void emitUpdateProperties( QObject *w ); + virtual void emitShowProperties( QObject *w = 0 ); + virtual void emitSelectionChanged(); + + virtual void setPropertyShowingBlocked( bool b ); + bool isPropertyShowingBlocked() const; + + virtual QLabel *sizePreview() const; + virtual void checkPreviewGeometry( QRect &r ); + + virtual QPtrDict *widgets(); + virtual QWidgetList selectedWidgets() const; + + virtual QWidget *designerWidget( QObject *o ) const; + + virtual void handleContextMenu( QContextMenuEvent *e, QWidget *w ); + virtual void handleMousePress( QMouseEvent *e, QWidget *w ); + virtual void handleMouseRelease( QMouseEvent *e, QWidget *w ); + virtual void handleMouseDblClick( QMouseEvent *e, QWidget *w ); + virtual void handleMouseMove( QMouseEvent *e, QWidget *w ); + virtual void handleKeyPress( QKeyEvent *e, QWidget *w ); + virtual void handleKeyRelease( QKeyEvent *e, QWidget *w ); + + virtual void updateUndoInfo(); + + virtual MainWindow *mainWindow() const { return mainwindow; } + + bool checkCustomWidgets(); + virtual void insertWidget( QWidget *w, bool checkName = FALSE ); + virtual void removeWidget( QWidget *w ); + virtual void deleteWidgets(); + virtual void editAdjustSize(); + virtual void editConnections(); + + virtual int numSelectedWidgets() const; + virtual int numVisibleWidgets() const; + + virtual bool hasInsertedChildren( QWidget *w ) const; + + virtual QWidget *currentWidget() const { return propertyWidget && propertyWidget->isWidgetType() ? (QWidget*)propertyWidget : 0; } // ##### + virtual bool unify( QObject *w, QString &s, bool changeIt ); + + virtual bool isCustomWidgetUsed( MetaDataBase::CustomWidget *w ); + virtual bool isDatabaseWidgetUsed() const; + virtual bool isDatabaseAware() const; + + virtual QPoint mapToForm( const QWidget* w, const QPoint& ) const; + + bool isMainContainer( QObject *w ) const; + bool isCentralWidget( QObject *w ) const; + QWidget *mainContainer() const { return mContainer; } + void setMainContainer( QWidget *w ); + + void paintGrid( QWidget *w, QPaintEvent *e ); + + bool savePixmapInline() const; + QString pixmapLoaderFunction() const; + void setSavePixmapInline( bool b ); + void setPixmapLoaderFunction( const QString &func ); + + bool savePixmapInProject() const; + void setSavePixmapInProject( bool b ); + + void setToolFixed() { toolFixed = TRUE; } + + void setActiveObject( QObject *o ); + + QPtrList &actionList() { return actions; } + QAction *findAction( const QString &name ); + + void setProject( Project *pro ); + Project *project() const; + + void killAccels( QObject *top ); + + DesignerFormWindow *iFace(); + + int layoutDefaultSpacing() const; + int layoutDefaultMargin() const; + void setLayoutDefaultSpacing( int s ); + void setLayoutDefaultMargin( int s ); + QString spacingFunction() const; + QString marginFunction() const; + void setSpacingFunction( const QString &func ); + void setMarginFunction( const QString &func ); + bool hasLayoutFunctions() const; + void hasLayoutFunctions( bool b ); + + void initSlots(); + FormFile *formFile() const; + void setFormFile( FormFile *f ); + + bool isFake() const { return fake; } + bool canBeBuddy( const QWidget* ) const; + +public slots: + virtual void widgetChanged( QObject *w ); + virtual void currentToolChanged(); + virtual void visibilityChanged(); + virtual void modificationChanged( bool m ); + +signals: + void showProperties( QObject *w ); + void updateProperties( QObject *w ); + void undoRedoChanged( bool undoAvailable, bool redoAvailable, + const QString &undoCmd, const QString &redoCmd ); + void selectionChanged(); + void modificationChanged( bool m, FormWindow *fw ); + void modificationChanged( bool m, const QString &s ); + void fileNameChanged( const QString &s, FormWindow *fw ); + +protected: + virtual void closeEvent( QCloseEvent *e ); + virtual void focusInEvent( QFocusEvent *e ); + virtual void focusOutEvent( QFocusEvent *e ); + virtual void resizeEvent( QResizeEvent *e ); + void mouseDoubleClickEvent( QMouseEvent *e ) { handleMouseDblClick( e, mainContainer() ); } + virtual bool event( QEvent *e ); + +private: + enum RectType { Insert, Rubber }; + + void beginUnclippedPainter( bool doNot ); + void endUnclippedPainter(); + void drawConnectionLine(); + void drawSizePreview( const QPoint &pos, const QString& text ); + + void insertWidget(); + void moveSelectedWidgets( int dx, int dy ); + + void startRectDraw( const QPoint &p, const QPoint &global, QWidget *w, RectType t ); + void continueRectDraw( const QPoint &p, const QPoint &global, QWidget *w, RectType t ); + void endRectDraw(); + + void checkSelectionsForMove( QWidget *w ); + BreakLayoutCommand *breakLayoutCommand( QWidget *w ); + + bool allowMove( QWidget *w ); + + void saveBackground(); + void restoreConnectionLine(); + void restoreRect( const QRect &rect ) ; + + void showOrderIndicators(); + void updateOrderIndicators(); + void repositionOrderIndicators(); + void hideOrderIndicators(); + + QWidget *containerAt( const QPoint &pos, QWidget *notParentOf ); + +private slots: + void invalidCheckedSelections(); + void updatePropertiesTimerDone(); + void showPropertiesTimerDone(); + void selectionChangedTimerDone(); + void windowsRepaintWorkaroundTimerTimeout(); + +private: + int currTool; + bool oldRectValid, widgetPressed, drawRubber, checkedSelectionsForMove; + bool validForBuddy; + QRect currRect; + QPoint rectAnchor; + QPainter *unclippedPainter; + QPoint sizePreviewPos; + QPixmap sizePreviewPixmap; + MainWindow *mainwindow; + QPtrList selections; + QPtrDict usedSelections; + QRect widgetGeom, rubber; + QPoint oldPressPos, origPressPos; + CommandHistory commands; + QMap moving; + QWidget *insertParent; + QObject *propertyWidget; + QLabel *sizePreviewLabel; + QTimer *checkSelectionsTimer; + QPtrDict insertedWidgets; + bool propShowBlocked; + QTimer* updatePropertiesTimer, *showPropertiesTimer, *selectionChangedTimer, + *windowsRepaintWorkaroundTimer; + QPoint startPos, currentPos; + QWidget *startWidget, *endWidget; + QPixmap *buffer; + QPtrList orderIndicators; + QWidgetList orderedWidgets; + QWidgetList stackedWidgets; + QWidget *mContainer; + bool pixInline, pixProject; + QString pixLoader; + bool toolFixed; + QPtrList actions; + Project *proj; + DesignerFormWindow *iface; + QWidget* targetContainer; + QPalette restorePalette; + bool hadOwnPalette; + int defSpacing, defMargin; + QString spacFunction, margFunction; + bool hasLayoutFunc; + FormFile *ff; + bool fake; + +}; + +#endif diff --git a/kdevdesigner/designer/gotolinedialog.ui b/kdevdesigner/designer/gotolinedialog.ui new file mode 100644 index 00000000..f2acf011 --- /dev/null +++ b/kdevdesigner/designer/gotolinedialog.ui @@ -0,0 +1,169 @@ + +GotoLineDialog +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* +../interfaces/editorinterface.h +gotolinedialog.ui.h +struct EditorInterface; +EditorInterface *editor; + + + + GotoLineDialog + + + + 0 + 0 + 243 + 85 + + + + Goto Line + + + + unnamed + + + 11 + + + 6 + + + + TextLabel1 + + + &Line: + + + spinLine + + + + + spinLine + + + + 7 + 0 + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + PushButton2 + + + &Goto + + + true + + + + + PushButton1 + + + &Close + + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + PushButton1 + clicked() + GotoLineDialog + reject() + + + PushButton2 + clicked() + GotoLineDialog + gotoLine() + + init() + destroy() + gotoLine() + setEditor( EditorInterface * e ) + + diff --git a/kdevdesigner/designer/gotolinedialog.ui.h b/kdevdesigner/designer/gotolinedialog.ui.h new file mode 100644 index 00000000..9ee0ef39 --- /dev/null +++ b/kdevdesigner/designer/gotolinedialog.ui.h @@ -0,0 +1,50 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +void GotoLineDialog::init() +{ + editor = 0; +} + +void GotoLineDialog::destroy() +{ + if ( editor ) + editor->release(); +} + +void GotoLineDialog::gotoLine() +{ + if ( editor ) + editor->gotoLine( spinLine->value() - 1 ); + accept(); +} + +void GotoLineDialog::setEditor( EditorInterface *e ) +{ + editor = e; + editor->addRef(); +} + diff --git a/kdevdesigner/designer/hierarchyview.cpp b/kdevdesigner/designer/hierarchyview.cpp new file mode 100644 index 00000000..8c204ac3 --- /dev/null +++ b/kdevdesigner/designer/hierarchyview.cpp @@ -0,0 +1,1508 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "hierarchyview.h" +#include "formwindow.h" +#include "globaldefs.h" +#include "mainwindow.h" +#include "command.h" +#include "widgetfactory.h" +#include "widgetdatabase.h" +#include "project.h" +#include "sourceeditor.h" +#include "propertyeditor.h" +#include "editfunctionsimpl.h" +#include "listeditor.h" +#include "actiondnd.h" +#include "actioneditorimpl.h" +#include "variabledialogimpl.h" +#include "popupmenueditor.h" +#include "menubareditor.h" + +#include +#include "kdevdesigner_part.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../interfaces/languageinterface.h" +#include +#include +#include + +#include + +QListViewItem *newItem = 0; + +static QPluginManager *classBrowserInterfaceManager = 0; + +HierarchyItem::HierarchyItem( Type type, QListViewItem *parent, QListViewItem *after, + const QString &txt1, const QString &txt2, const QString &txt3 ) + : QListViewItem( parent, after, txt1, txt2, txt3 ), typ( type ) +{ +} + +HierarchyItem::HierarchyItem( Type type, QListView *parent, QListViewItem *after, + const QString &txt1, const QString &txt2, const QString &txt3 ) + : QListViewItem( parent, after, txt1, txt2, txt3 ), typ( type ) +{ +} + +void HierarchyItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) +{ + QColorGroup g( cg ); + g.setColor( QColorGroup::Base, backgroundColor() ); + g.setColor( QColorGroup::Foreground, Qt::black ); + g.setColor( QColorGroup::Text, Qt::black ); + QString txt = text( 0 ); + if ( rtti() == Function && + MainWindow::self->currProject()->isCpp() && + ( txt == "init()" || txt == "destroy()" ) ) { + listView()->setUpdatesEnabled( FALSE ); + if ( txt == "init()" ) + setText( 0, txt + " " + "(Constructor)" ); + else + setText( 0, txt + " " + "(Destructor)" ); + QListViewItem::paintCell( p, g, column, width, align ); + setText( 0, txt ); + listView()->setUpdatesEnabled( TRUE ); + } else { + QListViewItem::paintCell( p, g, column, width, align ); + } + p->save(); + p->setPen( QPen( cg.dark(), 1 ) ); + if ( column == 0 ) + p->drawLine( 0, 0, 0, height() - 1 ); + if ( listView()->firstChild() != this ) { + if ( nextSibling() != itemBelow() && itemBelow()->depth() < depth() ) { + int d = depth() - itemBelow()->depth(); + p->drawLine( -listView()->treeStepSize() * d, height() - 1, 0, height() - 1 ); + } + } + p->drawLine( 0, height() - 1, width, height() - 1 ); + p->drawLine( width - 1, 0, width - 1, height() ); + p->restore(); +} + +QColor HierarchyItem::backgroundColor() +{ + updateBackColor(); + return backColor; +} + +void HierarchyItem::updateBackColor() +{ + if ( listView()->firstChild() == this ) { + backColor = *backColor1; + return; + } + + QListViewItemIterator it( this ); + --it; + if ( it.current() ) { + if ( ( ( HierarchyItem*)it.current() )->backColor == *backColor1 ) + backColor = *backColor2; + else + backColor = *backColor1; + } else { + backColor = *backColor1; + } +} + +void HierarchyItem::setObject( QObject *o ) +{ + obj = o; +} + +QObject *HierarchyItem::object() const +{ + return obj; +} + +void HierarchyItem::okRename( int col ) +{ + if ( newItem == this ) + newItem = 0; + QListViewItem::okRename( col ); +} + +void HierarchyItem::cancelRename( int col ) +{ + if ( newItem == this ) { + newItem = 0; + QListViewItem::cancelRename( col ); + delete this; + return; + } + QListViewItem::cancelRename( col ); +} + + + + +HierarchyList::HierarchyList( QWidget *parent, FormWindow *fw, bool doConnects ) + : QListView( parent ), formWindow( fw ) +{ + DesignerFormPix = SmallIcon( "designer_form.png" , KDevDesignerPartFactory::instance()); + DesignerLayoutPix = SmallIcon( "designer_layout.png" , KDevDesignerPartFactory::instance()); + DesignerFolderPix = SmallIcon( "designer_folder.png" , KDevDesignerPartFactory::instance()); + DesignerEditSlotsPix = SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()); + + init_colors(); + + setDefaultRenameAction( Accept ); + header()->setMovingEnabled( FALSE ); + header()->setStretchEnabled( TRUE ); + normalMenu = 0; + tabWidgetMenu = 0; + addColumn( i18n( "Name" ) ); + addColumn( i18n( "Class" ) ); + QPalette p( palette() ); + p.setColor( QColorGroup::Base, QColor( *backColor2 ) ); + (void)*selectedBack; // hack + setPalette( p ); + disconnect( header(), SIGNAL( sectionClicked( int ) ), + this, SLOT( changeSortColumn( int ) ) ); + setSorting( -1 ); + setHScrollBarMode( AlwaysOff ); + setVScrollBarMode( AlwaysOn ); + if ( doConnects ) { + connect( this, SIGNAL( clicked( QListViewItem * ) ), + this, SLOT( objectClicked( QListViewItem * ) ) ); + connect( this, SIGNAL( doubleClicked( QListViewItem * ) ), + this, SLOT( objectDoubleClicked( QListViewItem * ) ) ); + connect( this, SIGNAL( returnPressed( QListViewItem * ) ), + this, SLOT( objectClicked( QListViewItem * ) ) ); + connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint&, int ) ), + this, SLOT( showRMBMenu( QListViewItem *, const QPoint & ) ) ); + } + deselect = TRUE; + setColumnWidthMode( 1, Manual ); +} + +void HierarchyList::keyPressEvent( QKeyEvent *e ) +{ + if ( e->key() == Key_Shift || e->key() == Key_Control ) + deselect = FALSE; + else + deselect = TRUE; + QListView::keyPressEvent( e ); +} + +void HierarchyList::keyReleaseEvent( QKeyEvent *e ) +{ + deselect = TRUE; + QListView::keyReleaseEvent( e ); +} + +void HierarchyList::viewportMousePressEvent( QMouseEvent *e ) +{ + if ( e->state() & ShiftButton || e->state() & ControlButton ) + deselect = FALSE; + else + deselect = TRUE; + QListView::viewportMousePressEvent( e ); +} + +void HierarchyList::viewportMouseReleaseEvent( QMouseEvent *e ) +{ + QListView::viewportMouseReleaseEvent( e ); +} + +QObject *HierarchyList::handleObjectClick( QListViewItem *i ) +{ + if ( !i ) + return 0; + + QObject *o = findObject( i ); + if ( !o ) + return 0; + if ( formWindow == o ) { + if ( deselect ) + formWindow->clearSelection( FALSE ); + formWindow->emitShowProperties( formWindow ); + return 0; + } + if ( o->isWidgetType() ) { + QWidget *w = (QWidget*)o; + if ( !formWindow->widgets()->find( w ) ) { + if ( ::qt_cast(w->parent()) ) { + if (::qt_cast(w->parent()->parent()) ) { + ((QTabWidget*)w->parent()->parent())->showPage( w ); + o = (QWidget*)w->parent()->parent(); + formWindow->emitUpdateProperties( formWindow->currentWidget() ); + } else if ( ::qt_cast(w->parent()->parent()) ) { + ((QDesignerWizard*)w->parent()->parent())-> + setCurrentPage( ( (QDesignerWizard*)w->parent()->parent() )->pageNum( w ) ); + o = (QWidget*)w->parent()->parent(); + formWindow->emitUpdateProperties( formWindow->currentWidget() ); + } else { + ( (QWidgetStack*)w->parent() )->raiseWidget( w ); + if ( (QWidgetStack*)w->parent()->isA( "QDesignerWidgetStack" ) ) + ( (QDesignerWidgetStack*)w->parent() )->updateButtons(); + } + } else if ( ::qt_cast(w) || ::qt_cast(w) ) { + formWindow->setActiveObject( w ); + } else if ( ::qt_cast(w) ) { + return 0; // ### we could try to find our menu bar and change the currentMenu to our index + } else { + return 0; + } + } + } else if ( ::qt_cast(o) ) { + MainWindow::self->actioneditor()->setCurrentAction( (QAction*)o ); + deselect = TRUE; + } + + if ( deselect ) + formWindow->clearSelection( FALSE ); + + return o; +} + + +void HierarchyList::objectDoubleClicked( QListViewItem *i ) +{ + QObject *o = handleObjectClick( i ); + if ( !o ) + return; + if ( o->isWidgetType() && ( (QWidget*)o )->isVisibleTo( formWindow ) ) { + QWidget *w = (QWidget*)o; + if ( !w->parentWidget() || + WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ) + w->raise(); + formWindow->selectWidget( w, TRUE ); + } +} + +void HierarchyList::objectClicked( QListViewItem *i ) +{ + QObject *o = handleObjectClick( i ); + if ( !o ) + return; + if ( o->isWidgetType() && ( (QWidget*)o )->isVisibleTo( formWindow ) ) { + QWidget *w = (QWidget*)o; + formWindow->selectWidget( w, TRUE ); + } +} + +QObject *HierarchyList::findObject( QListViewItem *i ) +{ + return ( (HierarchyItem*)i )->object(); +} + +QListViewItem *HierarchyList::findItem( QObject *o ) +{ + QListViewItemIterator it( this ); + while ( it.current() ) { + if ( ( (HierarchyItem*)it.current() )->object() == o ) + return it.current(); + ++it; + } + return 0; +} + +QObject *HierarchyList::current() const +{ + if ( currentItem() ) + return ( (HierarchyItem*)currentItem() )->object(); + return 0; +} + +void HierarchyList::changeNameOf( QObject *o, const QString &name ) +{ + QListViewItem *item = findItem( o ); + if ( !item ) + return; + item->setText( 0, name ); +} + + +void HierarchyList::changeDatabaseOf( QObject *o, const QString &info ) +{ +#ifndef QT_NO_SQL + if ( !formWindow->isDatabaseAware() ) + return; + QListViewItem *item = findItem( o ); + if ( !item ) + return; + item->setText( 2, info ); +#endif +} + +static QPtrList *widgetStacks = 0; + +void HierarchyList::setup() +{ + if ( !formWindow || formWindow->isFake() ) + return; + clear(); + QWidget *w = formWindow->mainContainer(); +#ifndef QT_NO_SQL + if ( formWindow->isDatabaseAware() ) { + if ( columns() == 2 ) { + addColumn( i18n( "Database" ) ); + header()->resizeSection( 0, 1 ); + header()->resizeSection( 1, 1 ); + header()->resizeSection( 2, 1 ); + header()->adjustHeaderSize(); + } + } else { + if ( columns() == 3 ) { + removeColumn( 2 ); + } + } +#endif + if ( !widgetStacks ) + widgetStacks = new QPtrList; + if ( w ) + insertObject( w, 0 ); + widgetStacks->clear(); +} + +void HierarchyList::setOpen( QListViewItem *i, bool b ) +{ + QListView::setOpen( i, b ); +} + +void HierarchyList::insertObject( QObject *o, QListViewItem *parent ) +{ + if ( QString( o->name() ).startsWith( "qt_dead_widget_" ) ) + return; + bool fakeMainWindow = FALSE; + if ( ::qt_cast(o) ) { + QObject *cw = ( (QMainWindow*)o )->centralWidget(); + if ( cw ) { + o = cw; + fakeMainWindow = TRUE; + } + } + QListViewItem *item = 0; + QString className = WidgetFactory::classNameOf( o ); + if ( ::qt_cast(o) ) { + switch ( WidgetFactory::layoutType( (QWidget*)o ) ) { + case WidgetFactory::HBox: + className = "HBox"; + break; + case WidgetFactory::VBox: + className = "VBox"; + break; + case WidgetFactory::Grid: + className = "Grid"; + break; + default: + break; + } + } + + QString dbInfo; +#ifndef QT_NO_SQL + dbInfo = MetaDataBase::fakeProperty( o, "database" ).toStringList().join("."); +#endif + + QString name = o->name(); + if ( ::qt_cast(o->parent()) ) { + if ( ::qt_cast(o->parent()->parent()) ) + name = ( (QTabWidget*)o->parent()->parent() )->tabLabel( (QWidget*)o ); + else if ( ::qt_cast(o->parent()->parent()) ) + name = ( (QWizard*)o->parent()->parent() )->title( (QWidget*)o ); + } + + QToolBox *tb; + if ( o->parent() && o->parent()->parent() && + (tb = ::qt_cast(o->parent()->parent()->parent())) ) + name = tb->itemLabel( tb->indexOf((QWidget*)o) ); + + if ( fakeMainWindow ) { + name = o->parent()->name(); + className = "QMainWindow"; + } + + if ( !parent ) + item = new HierarchyItem( HierarchyItem::Widget, this, 0, name, className, dbInfo ); + else + item = new HierarchyItem( HierarchyItem::Widget, parent, 0, name, className, dbInfo ); + item->setOpen( TRUE ); + if ( !parent ) + item->setPixmap( 0, DesignerFormPix ); + else if ( ::qt_cast(o) ) + item->setPixmap( 0, DesignerLayoutPix ); + else + item->setPixmap( 0, WidgetDatabase::iconSet( + WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( o ) ) ). + pixmap( QIconSet::Small, QIconSet::Normal ) ); + if ( ::qt_cast(o) ) + item->setPixmap( 0, ( (QAction*)o )->iconSet().pixmap() ); + + ( (HierarchyItem*)item )->setObject( o ); + const QObjectList *l = o->children(); + if ( ::qt_cast(o) ) + l = 0; + if ( l ) { + QObjectListIt it( *l ); + it.toLast(); + for ( ; it.current(); --it ) { + if ( !it.current()->isWidgetType() || + ( (QWidget*)it.current() )->isHidden() ) + continue; + if ( !formWindow->widgets()->find( (QWidget*)it.current() ) ) { + if ( ::qt_cast(it.current()->parent()) || + ::qt_cast(it.current()) ) { + QObject *obj = it.current(); + QDesignerTabWidget *tw = ::qt_cast(it.current()->parent()); + QDesignerWizard *dw = ::qt_cast(it.current()->parent()); + QWidgetStack *stack = 0; + if ( dw || tw || ::qt_cast(obj) ) + stack = (QWidgetStack*)obj; + else + stack = (QWidgetStack*)obj->parent(); + if ( widgetStacks->findRef( stack ) != -1 ) + continue; + widgetStacks->append( stack ); + QObjectList *l2 = stack->queryList( "QWidget", 0, TRUE, FALSE ); + for ( obj = l2->last(); obj; obj = l2->prev() ) { + if ( qstrcmp( obj->className(), + "QWidgetStackPrivate::Invisible" ) == 0 || + ( tw && !tw->tabBar()->tab( stack->id( (QWidget*)obj ) ) ) || + ( dw && dw->isPageRemoved( (QWidget*)obj ) ) ) + continue; + if ( qstrcmp( obj->name(), "designer_wizardstack_button" ) == 0 ) + continue; + if ( stack->id( (QWidget*)obj ) == -1 ) + continue; + insertObject( obj, item ); + } + delete l2; + } else if ( ::qt_cast(it.current()->parent()) ) { + if ( !::qt_cast(it.current()) ) + continue; + QToolBox *tb = (QToolBox*)it.current()->parent(); + for ( int i = tb->count() - 1; i >= 0; --i ) + insertObject( tb->item( i ), item ); + } + continue; + } + insertObject( it.current(), item ); + } + } + + if ( fakeMainWindow ) { + QObjectList *l = o->parent()->queryList( "QDesignerToolBar" ); + QObject *obj; + for ( obj = l->first(); obj; obj = l->next() ) + insertObject( obj, item ); + delete l; + l = o->parent()->queryList( "MenuBarEditor" ); + for ( obj = l->first(); obj; obj = l->next() ) + insertObject( obj, item ); + delete l; + } else if ( ::qt_cast(o) || ::qt_cast(o) ) { + QPtrList actions; + if ( ::qt_cast(o) ) + actions = ( (QDesignerToolBar*)o )->insertedActions(); + else + ( (PopupMenuEditor*)o )->insertedActions( actions ); + + QPtrListIterator it( actions ); + it.toLast(); + while ( it.current() ) { + QAction *a = it.current(); + if ( ::qt_cast(a) ) { + QDesignerAction *da = (QDesignerAction*)a; + if ( da->supportsMenu() ) + insertObject( da, item ); + else + insertObject( da->widget(), item ); + } else if ( ::qt_cast(a) ) { + insertObject( a, item ); + } + --it; + } + } else if ( ::qt_cast(o) && o->children() ) { + QObjectList *l = (QObjectList*)o->children(); + for ( QObject *obj = l->last(); obj; obj = l->prev() ) { + if ( ::qt_cast(obj) ) { + QDesignerAction *da = (QDesignerAction*)obj; + if ( da->supportsMenu() ) + insertObject( da, item ); + else + insertObject( da->widget(), item ); + } else if ( ::qt_cast(obj) ) { + insertObject( obj, item ); + } + } + } else if ( ::qt_cast(o) ) { + MenuBarEditor *mb = (MenuBarEditor*)o; + for ( int i = mb->count() -1; i >= 0; --i ) { + MenuBarEditorItem *md = mb->item( i ); + if ( !md || !md->menu() ) + continue; + insertObject( md->menu(), item ); + } + } +} + +void HierarchyList::setCurrent( QObject *o ) +{ + QListViewItemIterator it( this ); + while ( it.current() ) { + if ( ( (HierarchyItem*)it.current() )->object() == o ) { + blockSignals( TRUE ); + setCurrentItem( it.current() ); + ensureItemVisible( it.current() ); + blockSignals( FALSE ); + return; + } + ++it; + } +} + +void HierarchyList::showRMBMenu( QListViewItem *i, const QPoint & p ) +{ + if ( !i ) + return; + + QObject *o = findObject( i ); + if ( !o ) + return; + + if ( !o->isWidgetType() || + ( o != formWindow && !formWindow->widgets()->find( (QWidget*)o ) ) ) + return; + + QWidget *w = (QWidget*)o; + if ( w->isVisibleTo( formWindow ) ) { + if ( !::qt_cast(w) && !::qt_cast(w) ) { + if ( !normalMenu ) + normalMenu = formWindow->mainWindow()->setupNormalHierarchyMenu( this ); + normalMenu->popup( p ); + } else { + if ( !tabWidgetMenu ) + tabWidgetMenu = + formWindow->mainWindow()->setupTabWidgetHierarchyMenu( + this, SLOT( addTabPage() ), + SLOT( removeTabPage() ) ); + tabWidgetMenu->popup( p ); + } + } +} + +void HierarchyList::addTabPage() +{ + QObject *o = current(); + if ( !o || !o->isWidgetType() ) + return; + QWidget *w = (QWidget*)o; + if ( ::qt_cast(w) ) { + QTabWidget *tw = (QTabWidget*)w; + AddTabPageCommand *cmd = new AddTabPageCommand( i18n( "Add Page to %1" ). + arg( tw->name() ), formWindow, + tw, "Tab" ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( ::qt_cast(w) ) { + QWizard *wiz = (QWizard*)formWindow->mainContainer(); + AddWizardPageCommand *cmd = new AddWizardPageCommand( i18n( "Add Page to %1" ). + arg( wiz->name() ), formWindow, + wiz, "Page" ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +void HierarchyList::removeTabPage() +{ + QObject *o = current(); + if ( !o || !o->isWidgetType() ) + return; + QWidget *w = (QWidget*)o; + if ( ::qt_cast(w) ) { + QTabWidget *tw = (QTabWidget*)w; + if ( tw->currentPage() ) { + QDesignerTabWidget *dtw = (QDesignerTabWidget*)tw; + DeleteTabPageCommand *cmd = + new DeleteTabPageCommand( i18n( "Delete Page %1 of %2" ). + arg( dtw->pageTitle() ).arg( tw->name() ), + formWindow, tw, tw->currentPage() ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } else if ( ::qt_cast(w) ) { + QWizard *wiz = (QWizard*)formWindow->mainContainer(); + if ( wiz->currentPage() ) { + QDesignerWizard *dw = (QDesignerWizard*)wiz; + DeleteWizardPageCommand *cmd = + new DeleteWizardPageCommand( i18n( "Delete Page %1 of %2" ). + arg( dw->pageTitle() ).arg( wiz->name() ), + formWindow, wiz, + wiz->indexOf( wiz->currentPage() ), TRUE ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } +} + +// ------------------------------------------------------------ + +FormDefinitionView::FormDefinitionView( QWidget *parent, FormWindow *fw ) + : HierarchyList( parent, fw, TRUE ) +{ + header()->hide(); + removeColumn( 1 ); + connect( this, SIGNAL( itemRenamed( QListViewItem *, int, const QString & ) ), + this, SLOT( renamed( QListViewItem * ) ) ); + popupOpen = FALSE; +} + +void FormDefinitionView::setup() +{ + if ( popupOpen || !formWindow ) + return; + if ( !formWindow->project()->isCpp() ) + return; + QListViewItem *i = firstChild(); + while ( i ) { + if ( i->rtti() == HierarchyItem::DefinitionParent ) { + QListViewItem *a = i; + i = i->nextSibling(); + delete a; + continue; + } + i = i->nextSibling(); + } + + LanguageInterface *lIface = MetaDataBase::languageInterface( formWindow->project()->language() ); + if ( lIface ) { + QStringList defs = lIface->definitions(); + for ( QStringList::Iterator dit = defs.begin(); dit != defs.end(); ++dit ) { + HierarchyItem *itemDef = new HierarchyItem( HierarchyItem::DefinitionParent, this, 0, + i18n( *dit ), QString::null, QString::null ); + itemDef->setPixmap( 0, DesignerFolderPix ); + itemDef->setOpen( TRUE ); + QStringList entries = + lIface->definitionEntries( *dit, formWindow->mainWindow()->designerInterface() ); + HierarchyItem *item = 0; + for ( QStringList::Iterator eit = entries.begin(); eit != entries.end(); ++eit ) { + item = new HierarchyItem( HierarchyItem::Definition, + itemDef, item, *eit, QString::null, QString::null ); + item->setRenameEnabled( 0, TRUE ); + } + } + lIface->release(); + } + setupVariables(); + refresh(); +} + +void FormDefinitionView::setupVariables() +{ + bool pubOpen, protOpen, privOpen; + pubOpen = protOpen = privOpen = TRUE; + QListViewItem *i = firstChild(); + while ( i ) { + if ( i->rtti() == HierarchyItem::VarParent ) { + QListViewItem *a = i; + i = i->firstChild(); + while ( i ) { + if ( i->rtti() == HierarchyItem::VarPublic ) + pubOpen = i->isOpen(); + else if ( i->rtti() == HierarchyItem::VarProtected ) + protOpen = i->isOpen(); + else if ( i->rtti() == HierarchyItem::VarPrivate ) + privOpen = i->isOpen(); + i = i->nextSibling(); + } + delete a; + break; + } + i = i->nextSibling(); + } + + HierarchyItem *itemVar = new HierarchyItem( HierarchyItem::VarParent, this, 0, i18n( "Class Variables" ), + QString::null, QString::null ); + itemVar->setPixmap( 0, DesignerFolderPix ); + itemVar->setOpen( TRUE ); + + itemVarPriv = new HierarchyItem( HierarchyItem::VarPrivate, itemVar, 0, i18n( "private" ), + QString::null, QString::null ); + itemVarProt = new HierarchyItem( HierarchyItem::VarProtected, itemVar, 0, i18n( "protected" ), + QString::null, QString::null ); + itemVarPubl = new HierarchyItem( HierarchyItem::VarPublic, itemVar, 0, i18n( "public" ), + QString::null, QString::null ); + + QValueList varList = MetaDataBase::variables( formWindow ); + QValueList::Iterator it = --( varList.end() ); + if ( !varList.isEmpty() && itemVar ) { + for (;;) { + QListViewItem *item = 0; + if ( (*it).varAccess == "public" ) + item = new HierarchyItem( HierarchyItem::Variable, itemVarPubl, 0, (*it).varName, + QString::null, QString::null ); + else if ( (*it).varAccess == "private" ) + item = new HierarchyItem( HierarchyItem::Variable, itemVarPriv, 0, (*it).varName, + QString::null, QString::null ); + else // default is protected + item = new HierarchyItem( HierarchyItem::Variable, itemVarProt, 0, (*it).varName, + QString::null, QString::null ); + item->setPixmap( 0, DesignerEditSlotsPix ); + if ( it == varList.begin() ) + break; + --it; + } + } + itemVar->setOpen( TRUE ); + itemVarPriv->setOpen( privOpen ); + itemVarProt->setOpen( protOpen ); + itemVarPubl->setOpen( pubOpen ); +} + +void FormDefinitionView::refresh() +{ + if ( popupOpen || !formWindow || !formWindow->project()->isCpp() ) + return; + + bool fuPub, fuProt, fuPriv, slPub, slProt, slPriv; + fuPub = fuProt = fuPriv = slPub = slProt = slPriv = TRUE; + QListViewItem *i = firstChild(); + while ( i ) { + if ( i->rtti() == HierarchyItem::SlotParent || + i->rtti() == HierarchyItem::FunctParent ) { + QListViewItem *a = i; + i = i->firstChild(); + while ( i ) { + switch( i->rtti() ) { + case HierarchyItem::FunctPublic: + fuPub = i->isOpen(); + case HierarchyItem::FunctProtected: + fuProt = i->isOpen(); + break; + case HierarchyItem::FunctPrivate: + fuPriv = i->isOpen(); + break; + case HierarchyItem::SlotPublic: + slPub = i->isOpen(); + if ( slPub ) + break; + case HierarchyItem::SlotProtected: + slProt = i->isOpen(); + break; + case HierarchyItem::SlotPrivate: + slPriv = i->isOpen(); + } + i = i->nextSibling(); + } + i = a->nextSibling(); + delete a; + continue; + } + i = i->nextSibling(); + } + + + itemFunct = new HierarchyItem( HierarchyItem::FunctParent, + this, 0, i18n( "Functions" ), QString::null, QString::null ); + itemFunct->moveItem( i ); + itemFunct->setPixmap( 0, DesignerFolderPix ); + itemFunctPriv = new HierarchyItem( HierarchyItem::FunctPrivate, itemFunct, 0, + i18n( "private" ), QString::null, QString::null ); + itemFunctProt = new HierarchyItem( HierarchyItem::FunctProtected, itemFunct, 0, + i18n( "protected" ), QString::null, QString::null ); + itemFunctPubl = new HierarchyItem( HierarchyItem::FunctPublic, itemFunct, 0, + i18n( "public" ), QString::null, QString::null ); + + itemSlots = new HierarchyItem( HierarchyItem::SlotParent, + this, 0, i18n( "Slots" ), QString::null, QString::null ); + itemSlots->setPixmap( 0, DesignerFolderPix ); + itemPrivate = new HierarchyItem( HierarchyItem::SlotPrivate, itemSlots, 0, i18n( "private" ), + QString::null, QString::null ); + itemProtected = new HierarchyItem( HierarchyItem::SlotProtected, itemSlots, 0, i18n( "protected" ), + QString::null, QString::null ); + itemPublic = new HierarchyItem( HierarchyItem::SlotPublic, itemSlots, 0, i18n( "public" ), + QString::null, QString::null ); + + QValueList functionList = MetaDataBase::functionList( formWindow ); + QValueList::Iterator it = --( functionList.end() ); + if ( !functionList.isEmpty() && itemFunct ) { + for (;;) { + QListViewItem *item = 0; + if ( (*it).type == "slot" ) { + if ( (*it).access == "protected" ) + item = new HierarchyItem( HierarchyItem::Slot, itemProtected, 0, (*it).function, + QString::null, QString::null ); + else if ( (*it).access == "private" ) + item = new HierarchyItem( HierarchyItem::Slot, itemPrivate, 0, (*it).function, + QString::null, QString::null ); + else // default is public + item = new HierarchyItem( HierarchyItem::Slot, itemPublic, 0, (*it).function, + QString::null, QString::null ); + } else { + if ( (*it).access == "protected" ) + item = new HierarchyItem( HierarchyItem::Function, itemFunctProt, 0, (*it).function, + QString::null, QString::null ); + else if ( (*it).access == "private" ) + item = new HierarchyItem( HierarchyItem::Function, itemFunctPriv, 0, (*it).function, + QString::null, QString::null ); + else // default is public + item = new HierarchyItem( HierarchyItem::Function, itemFunctPubl, 0, (*it).function, + QString::null, QString::null ); + } + item->setPixmap( 0, DesignerEditSlotsPix ); + if ( it == functionList.begin() ) + break; + --it; + } + } + + itemFunct->setOpen( TRUE ); + itemFunctPubl->setOpen( fuPub ); + itemFunctProt->setOpen( fuProt ); + itemFunctPriv->setOpen( fuPriv ); + + itemSlots->setOpen( TRUE ); + itemPublic->setOpen( slPub ); + itemProtected->setOpen( slProt ); + itemPrivate->setOpen( slPriv ); +} + + +void FormDefinitionView::setCurrent( QWidget * ) +{ +} + +void FormDefinitionView::objectClicked( QListViewItem *i ) +{ + if ( !i ) + return; + if ( (i->rtti() == HierarchyItem::Slot) || (i->rtti() == HierarchyItem::Function) ) + { + formWindow->clearSelection(false); + formWindow->mainWindow()->part()->emitEditFunction(formWindow->fileName(), i->text( 0 )); + } +// formWindow->mainWindow()->editFunction( i->text( 0 ) ); +} + +static HierarchyItem::Type getChildType( int type ) +{ + switch ( (HierarchyItem::Type)type ) { + case HierarchyItem::Widget: + qWarning( "getChildType: Inserting childs dynamically to Widget or SlotParent is not allowed!" ); + break; + case HierarchyItem::SlotParent: + case HierarchyItem::SlotPublic: + case HierarchyItem::SlotProtected: + case HierarchyItem::SlotPrivate: + case HierarchyItem::Slot: + return HierarchyItem::Slot; + case HierarchyItem::DefinitionParent: + case HierarchyItem::Definition: + return HierarchyItem::Definition; + case HierarchyItem::Event: + case HierarchyItem::EventFunction: + return HierarchyItem::Event; + case HierarchyItem::FunctParent: + case HierarchyItem::FunctPublic: + case HierarchyItem::FunctProtected: + case HierarchyItem::FunctPrivate: + case HierarchyItem::Function: + return HierarchyItem::Function; + case HierarchyItem::VarParent: + case HierarchyItem::VarPublic: + case HierarchyItem::VarProtected: + case HierarchyItem::VarPrivate: + case HierarchyItem::Variable: + return HierarchyItem::Variable; + } + return (HierarchyItem::Type)type; +} + +void HierarchyList::insertEntry( QListViewItem *i, const QPixmap &pix, const QString &s ) +{ + QListViewItem *after = i->firstChild(); + while ( after && after->nextSibling() ) + after = after->nextSibling(); + HierarchyItem *item = new HierarchyItem( getChildType( i->rtti() ), i, after, s, + QString::null, QString::null ); + if ( !pix.isNull() ) + item->setPixmap( 0, pix ); + item->setRenameEnabled( 0, TRUE ); + setCurrentItem( item ); + ensureItemVisible( item ); + qApp->processEvents(); + newItem = item; + item->startRename( 0 ); +} + +void FormDefinitionView::contentsMouseDoubleClickEvent( QMouseEvent *e ) +{ + QListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); + if ( !i ) + return; + + if ( i->rtti() == HierarchyItem::SlotParent || i->rtti() == HierarchyItem::FunctParent || + i->rtti() == HierarchyItem::VarParent ) + return; + + HierarchyItem::Type t = getChildType( i->rtti() ); + if ( (int)t == i->rtti() ) + i = i->parent(); + + if ( formWindow->project()->isCpp() ) + switch( i->rtti() ) { + case HierarchyItem::FunctPublic: + execFunctionDialog( "public", "function", TRUE ); + break; + case HierarchyItem::FunctProtected: + execFunctionDialog( "protected", "function", TRUE ); + break; + case HierarchyItem::FunctPrivate: + execFunctionDialog( "private", "function", TRUE ); + break; + case HierarchyItem::SlotPublic: + execFunctionDialog( "public", "slot", TRUE ); + break; + case HierarchyItem::SlotProtected: + execFunctionDialog( "protected", "slot", TRUE ); + break; + case HierarchyItem::SlotPrivate: + execFunctionDialog( "private", "slot", TRUE ); + break; + case HierarchyItem::VarPublic: + case HierarchyItem::VarProtected: + case HierarchyItem::VarPrivate: { + VariableDialog varDia( formWindow, this ); + QListViewItem *i = selectedItem(); + if ( i ) + varDia.setCurrentItem( i->text( 0 ) ); + varDia.exec(); + break; + } + default: + insertEntry( i ); + } else + insertEntry( i ); +} + +void FormDefinitionView::execFunctionDialog( const QString &access, const QString &type, bool addFunc ) +{ + FormFile *formFile = formWindow->formFile(); + if ( !formFile || !formFile->isUihFileUpToDate() ) + return; + + // refresh the functions list in the metadatabase + SourceEditor *editor = formFile->editor(); + if ( editor ) + editor->refresh( TRUE ); + + EditFunctions dlg( this, formWindow ); + if ( addFunc ) + dlg.functionAdd( access, type ); + dlg.exec(); +} + +void FormDefinitionView::showRMBMenu( QListViewItem *i, const QPoint &pos ) +{ + if ( !i ) + return; + + const int EDIT = 1; + const int NEW = 2; + const int DEL = 3; + const int PROPS = 4; + const int GOIMPL = 5; + + QPopupMenu menu; + bool insertDelete = FALSE; + + if ( i->rtti() == HierarchyItem::FunctParent || i->rtti() == HierarchyItem::SlotParent || + i->rtti() == HierarchyItem::VarParent ) { + menu.insertItem( SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()), i18n( "Edit..." ), EDIT ); + } else + menu.insertItem( SmallIcon( "designer_filenew.png" , KDevDesignerPartFactory::instance()), i18n( "New..." ), NEW ); + if ( i->rtti() == HierarchyItem::DefinitionParent || i->rtti() == HierarchyItem::Variable || + i->rtti() == HierarchyItem::Definition ) { + menu.insertItem( SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()), i18n( "Edit..." ), EDIT ); + } + if ( i->rtti() == HierarchyItem::Function || i->rtti() == HierarchyItem::Slot ) { + if ( formWindow->project()->isCpp() ) + menu.insertItem( SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()), i18n( "Properties" ), PROPS ); + if ( MetaDataBase::hasEditor( formWindow->project()->language() ) ) + menu.insertItem( i18n( "Goto Implementation" ), GOIMPL ); + insertDelete = TRUE; + } + if ( insertDelete || i->rtti() == HierarchyItem::Variable || + i->rtti() == HierarchyItem::Function || i->rtti() == HierarchyItem::Slot || + i->rtti() == HierarchyItem::Definition ) { + menu.insertSeparator(); + menu.insertItem( SmallIcon( "designer_editcut.png" , KDevDesignerPartFactory::instance()), i18n( "Delete" ), DEL ); + } + popupOpen = TRUE; + int res = menu.exec( pos ); + popupOpen = FALSE; + if ( res == -1 ) + return; + + if ( res == EDIT ) { + switch( i->rtti() ) { + case HierarchyItem::FunctParent: + execFunctionDialog( "public", "function", FALSE ); + break; + case HierarchyItem::SlotParent: + execFunctionDialog( "public", "slot", FALSE ); + break; + case HierarchyItem::VarParent: + case HierarchyItem::VarPublic: + case HierarchyItem::VarProtected: + case HierarchyItem::VarPrivate: + case HierarchyItem::Variable: { + VariableDialog varDia( formWindow, this ); + QListViewItem *i = selectedItem(); + if ( i ) + varDia.setCurrentItem( i->text( 0 ) ); + if ( varDia.exec() == QDialog::Accepted ) + formWindow->commandHistory()->setModified( TRUE ); + break; + } + case HierarchyItem::Definition: + case HierarchyItem::DefinitionParent: + LanguageInterface *lIface = MetaDataBase::languageInterface( formWindow->project()->language() ); + if ( !lIface ) + return; + if ( i->rtti() == HierarchyItem::Definition ) + i = i->parent(); + ListEditor dia( this, 0, TRUE ); + dia.setCaption( i18n( "Edit %1" ).arg( i->text( 0 ) ) ); + QStringList entries = lIface->definitionEntries( i->text( 0 ), MainWindow::self->designerInterface() ); + dia.setList( entries ); + dia.exec(); + Command *cmd = new EditDefinitionsCommand( i18n( "Edit %1" ).arg( i->text( 0 )), formWindow, + lIface, i->text( 0 ), dia.items() ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } else if ( res == NEW ) { + HierarchyItem::Type t = getChildType( i->rtti() ); + if ( (int)t == i->rtti() ) + i = i->parent(); + switch( i->rtti() ) { + case HierarchyItem::SlotPublic: + execFunctionDialog( "public", "slot", TRUE ); + break; + case HierarchyItem::SlotProtected: + execFunctionDialog( "protected", "slot", TRUE ); + break; + case HierarchyItem::SlotPrivate: + execFunctionDialog( "private" , "slot", TRUE ); + break; + case HierarchyItem::FunctPublic: + execFunctionDialog( "public", "function", TRUE ); + break; + case HierarchyItem::FunctProtected: + execFunctionDialog( "protected", "function", TRUE ); + break; + case HierarchyItem::FunctPrivate: + execFunctionDialog( "private" , "function", TRUE ); + break; + default: + insertEntry( i ); + } + } else if ( res == DEL ) { + if ( i->rtti() == HierarchyItem::Slot || i->rtti() == HierarchyItem::Function ) { + + QCString funct( MetaDataBase::normalizeFunction( i->text( 0 ) ).latin1() ); + Command *cmd = new RemoveFunctionCommand( i18n( "Remove Function" ), formWindow, funct, + QString::null, QString::null, QString::null, + QString::null, formWindow->project()->language() ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + } else if ( i->rtti() == HierarchyItem::Variable ) { + Command *cmd = new RemoveVariableCommand( i18n( "Remove Variable" ), formWindow, + i->text( 0 ) ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else { + QListViewItem *p = i->parent(); + delete i; + save( p, 0 ); + } + } else if ( res == PROPS ) { + if ( i->rtti() == HierarchyItem::Slot || + i->rtti() == HierarchyItem::Function ) { + EditFunctions dlg( this, formWindow ); + dlg.setCurrentFunction( MetaDataBase::normalizeFunction( i->text( 0 ) ) ); + dlg.exec(); + } + } else if ( res == GOIMPL ) { + if ( i->rtti() == HierarchyItem::Slot || + i->rtti() == HierarchyItem::Function ) { + formWindow->clearSelection(false); + formWindow->mainWindow()->part()->emitEditFunction(formWindow->fileName(), i->text( 0 )); +// formWindow->mainWindow()->editFunction( i->text( 0 ) ); + } + } +} + +void FormDefinitionView::renamed( QListViewItem *i ) +{ + if ( newItem == i ) + newItem = 0; + if ( !i->parent() ) + return; + save( i->parent(), i ); +} + + +void FormDefinitionView::save( QListViewItem *p, QListViewItem *i ) +{ + if ( i && i->text( 0 ).isEmpty() ) { + delete i; + return; + } + + if ( i && i->rtti() == HierarchyItem::Variable ) { + i->setRenameEnabled( 0, FALSE ); + QString varName = i->text( 0 ); + varName = varName.simplifyWhiteSpace(); + if ( varName[(int)varName.length() - 1] != ';' ) + varName += ";"; + if ( MetaDataBase::hasVariable( formWindow, varName ) ) { + QMessageBox::information( this, i18n( "Edit Variables" ), + i18n( "This variable has already been declared." ) ); + } else { + if ( p->rtti() == HierarchyItem::VarPublic ) + addVariable( varName, "public" ); + else if ( p->rtti() == HierarchyItem::VarProtected ) + addVariable( varName, "protected" ); + else if ( p->rtti() == HierarchyItem::VarPrivate ) + addVariable( varName, "private" ); + } + } else { + LanguageInterface *lIface = MetaDataBase::languageInterface( formWindow->project()->language() ); + if ( !lIface ) + return; + QStringList lst; + i = p->firstChild(); + while ( i ) { + lst << i->text( 0 ); + i = i->nextSibling(); + } + Command *cmd = new EditDefinitionsCommand( i18n( "Edit %1" ).arg( p->text( 0 ) ), formWindow, + lIface, p->text( 0 ), lst ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +void FormDefinitionView::addVariable( const QString &varName, const QString &access ) +{ + Command *cmd = new AddVariableCommand( i18n( "Add Variable" ), formWindow, + varName, access ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +// ------------------------------------------------------------ + +HierarchyView::HierarchyView( QWidget *parent ) + : QTabWidget( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | + WStyle_Tool |WStyle_MinMax | WStyle_SysMenu ) +{ + formwindow = 0; + editor = 0; + listview = new HierarchyList( this, formWindow() ); + fView = new FormDefinitionView( this, formWindow() ); + if ( !MainWindow::self->singleProjectMode() ) { + addTab( listview, i18n( "Objects" ) ); + setTabToolTip( listview, i18n( "List of all widgets and objects of the current form in hierarchical order" ) ); + addTab( fView, i18n( "Members" ) ); + setTabToolTip( fView, i18n( "List of all members of the current form" ) ); + } else { + listview->hide(); + fView->hide(); + } + + if ( !classBrowserInterfaceManager ) { + classBrowserInterfaceManager = + new QPluginManager( IID_ClassBrowser, QApplication::libraryPaths(), + MainWindow::self->pluginDirectory() ); + } + + classBrowsers = new QMap(); + QStringList langs = MetaDataBase::languages(); + for ( QStringList::Iterator it = langs.begin(); it != langs.end(); ++it ) { + QInterfacePtr ciface = 0; + classBrowserInterfaceManager->queryInterface( *it, &ciface ); + if ( ciface ) { + ClassBrowser cb( ciface->createClassBrowser( this ), ciface ); + addTab( cb.lv, i18n( "Class Declarations" ) ); + setTabToolTip( cb.lv, i18n( "List of all classes and its declarations of the current source file" ) ); + ciface->onClick( this, SLOT( jumpTo( const QString &, const QString &, int ) ) ); + classBrowsers->insert( *it, cb ); + setTabEnabled( cb.lv, FALSE ); + } + } +} + +HierarchyView::~HierarchyView() +{ +} + +void HierarchyView::clear() +{ + listview->clear(); + fView->clear(); + for ( QMap::Iterator it = classBrowsers->begin(); + it != classBrowsers->end(); ++it ) { + (*it).iface->clear(); + } +} + +void HierarchyView::setFormWindow( FormWindow *fw, QObject *o ) +{ + bool fake = fw && qstrcmp( fw->name(), "qt_fakewindow" ) == 0; + if ( fw == 0 || o == 0 ) { + listview->clear(); + fView->clear(); + listview->setFormWindow( fw ); + fView->setFormWindow( fw ); + formwindow = 0; + editor = 0; + } + + setTabEnabled( listview, TRUE ); + setTabEnabled( fView, fw && fw->project()->isCpp() ); + + if ( fw == formwindow ) { + if ( fw ) { + if ( !fake ) + listview->setCurrent( (QWidget*)o ); + else + listview->clear(); + if ( MainWindow::self->qWorkspace()->activeWindow() == fw ) + showPage( listview ); + else if ( fw->project()->isCpp() ) + showPage( fView ); + else + showClasses( fw->formFile()->editor() ); + } + } + + formwindow = fw; + if ( !fake ) { + listview->setFormWindow( fw ); + } else { + listview->setFormWindow( 0 ); + listview->clear(); + } + + fView->setFormWindow( fw ); + if ( !fake ) { + listview->setup(); + listview->setCurrent( (QWidget*)o ); + } + fView->setup(); + + for ( QMap::Iterator it = classBrowsers->begin(); + it != classBrowsers->end(); ++it ) { + (*it).iface->clear(); + setTabEnabled( (*it).lv, fw && !fw->project()->isCpp() ); + } + + if ( MainWindow::self->qWorkspace()->activeWindow() == fw ) + showPage( listview ); + else if ( fw && fw->project()->isCpp() ) + showPage( fView ); + else if ( fw ) + showClasses( fw->formFile()->editor() ); + + editor = 0; +} + +void HierarchyView::showClasses( SourceEditor *se ) +{ + if ( !se->object() ) + return; + + lastSourceEditor = se; + QTimer::singleShot( 100, this, SLOT( showClassesTimeout() ) ); +} + +void HierarchyView::showClassesTimeout() +{ + if ( !lastSourceEditor ) + return; + SourceEditor *se = (SourceEditor*)lastSourceEditor; + if ( !se->object() ) + return; + if ( se->formWindow() && se->formWindow()->project()->isCpp() ) { + setFormWindow( se->formWindow(), se->formWindow()->currentWidget() ); + MainWindow::self->propertyeditor()->setWidget( se->formWindow()->currentWidget(), + se->formWindow() ); + return; + } + + setTabEnabled( listview, !!se->formWindow() && !se->formWindow()->isFake() ); + setTabEnabled( fView, FALSE ); + + formwindow = 0; + listview->setFormWindow( 0 ); + fView->setFormWindow( 0 ); + listview->clear(); + fView->clear(); + if ( !se->formWindow() ) + MainWindow::self->propertyeditor()->setWidget( 0, 0 ); + editor = se; + + for ( QMap::Iterator it = classBrowsers->begin(); + it != classBrowsers->end(); ++it ) { + if ( it.key() == se->project()->language() ) { + (*it).iface->update( se->text() ); + setTabEnabled( (*it).lv, TRUE ); + showPage( (*it).lv ); + } else { + setTabEnabled( (*it).lv, FALSE ); + (*it).iface->clear(); + } + } +} + +void HierarchyView::updateClassBrowsers() +{ + if ( !editor ) + return; + for ( QMap::Iterator it = classBrowsers->begin(); + it != classBrowsers->end(); ++it ) { + if ( it.key() == editor->project()->language() ) + (*it).iface->update( editor->text() ); + else + (*it).iface->clear(); + } +} + +FormWindow *HierarchyView::formWindow() const +{ + return formwindow; +} + +void HierarchyView::closeEvent( QCloseEvent *e ) +{ + emit hidden(); + e->accept(); +} + +void HierarchyView::widgetInserted( QWidget * ) +{ + listview->setup(); +} + +void HierarchyView::widgetRemoved( QWidget * ) +{ + listview->setup(); +} + +void HierarchyView::widgetsInserted( const QWidgetList & ) +{ + listview->setup(); +} + +void HierarchyView::widgetsRemoved( const QWidgetList & ) +{ + listview->setup(); +} + +void HierarchyView::namePropertyChanged( QWidget *w, const QVariant & ) +{ + QWidget *w2 = w; + if ( ::qt_cast(w) ) + w2 = ( (QMainWindow*)w )->centralWidget(); + listview->changeNameOf( w2, w->name() ); +} + + +void HierarchyView::databasePropertyChanged( QWidget *w, const QStringList& info ) +{ +#ifndef QT_NO_SQL + QString i = info.join( "." ); + listview->changeDatabaseOf( w, i ); +#endif +} + + +void HierarchyView::tabsChanged( QTabWidget * ) +{ + listview->setup(); +} + +void HierarchyView::pagesChanged( QWizard * ) +{ + listview->setup(); +} + +void HierarchyView::rebuild() +{ + listview->setup(); +} + +void HierarchyView::closed( FormWindow *fw ) +{ + if ( fw == formwindow ) { + listview->clear(); + fView->clear(); + } +} + +void HierarchyView::updateFormDefinitionView() +{ + fView->setup(); +} + +void HierarchyView::jumpTo( const QString &func, const QString &clss, int type ) +{ + if ( !editor ) + return; + if ( type == ClassBrowserInterface::Class ) + editor->setClass( func ); + else + editor->setFunction( func, clss ); +} + +HierarchyView::ClassBrowser::ClassBrowser( QListView *l, ClassBrowserInterface *i ) + : lv( l ), iface( i ) +{ +} + +HierarchyView::ClassBrowser::~ClassBrowser() +{ +} diff --git a/kdevdesigner/designer/hierarchyview.h b/kdevdesigner/designer/hierarchyview.h new file mode 100644 index 00000000..ffd269b7 --- /dev/null +++ b/kdevdesigner/designer/hierarchyview.h @@ -0,0 +1,249 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef HIRARCHYVIEW_H +#define HIRARCHYVIEW_H + +#include +#include +#include +#include +#include +#include "../interfaces/classbrowserinterface.h" + +class FormWindow; +class QCloseEvent; +class QPopupMenu; +class QKeyEvent; +class QMouseEvent; +class QWizard; +class SourceEditor; + +class HierarchyItem : public QListViewItem +{ +public: + enum Type { + Widget, + SlotParent, + SlotPublic, + SlotProtected, + SlotPrivate, + Slot, + DefinitionParent, + Definition, + Event, + EventFunction, + FunctParent, + FunctPublic, + FunctProtected, + FunctPrivate, + Function, + VarParent, + VarPublic, + VarProtected, + VarPrivate, + Variable + }; + + HierarchyItem( Type type, QListViewItem *parent, QListViewItem *after, + const QString &txt1, const QString &txt2, const QString &txt3 ); + HierarchyItem( Type type, QListView *parent, QListViewItem *after, + const QString &txt1, const QString &txt2, const QString &txt3 ); + + void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ); + void updateBackColor(); + + void setObject( QObject *o ); + QObject *object() const; + + void setText( int col, const QString &txt ) { if ( !txt.isEmpty() ) QListViewItem::setText( col, txt ); } + + int rtti() const { return (int)typ; } + +private: + void okRename( int col ); + void cancelRename( int col ); + +private: + QColor backgroundColor(); + QColor backColor; + QObject *obj; + Type typ; + +}; + +class HierarchyList : public QListView +{ + Q_OBJECT + +public: + HierarchyList( QWidget *parent, FormWindow *fw, bool doConnects = TRUE ); + + virtual void setup(); + virtual void setCurrent( QObject *o ); + void setOpen( QListViewItem *i, bool b ); + void changeNameOf( QObject *o, const QString &name ); + void changeDatabaseOf( QObject *o, const QString &info ); + void setFormWindow( FormWindow *fw ) { formWindow = fw; } + void drawContentsOffset( QPainter *p, int ox, int oy, + int cx, int cy, int cw, int ch ) { + setUpdatesEnabled( FALSE ); + triggerUpdate(); + setUpdatesEnabled( TRUE ); + QListView::drawContentsOffset( p, ox, oy, cx, cy, cw, ch ); + } + + void insertEntry( QListViewItem *i, const QPixmap &pix = QPixmap(), const QString &s = QString::null ); + +protected: + void keyPressEvent( QKeyEvent *e ); + void keyReleaseEvent( QKeyEvent *e ); + void viewportMousePressEvent( QMouseEvent *e ); + void viewportMouseReleaseEvent( QMouseEvent *e ); + +public slots: + void addTabPage(); + void removeTabPage(); + +private: + void insertObject( QObject *o, QListViewItem *parent ); + QObject *findObject( QListViewItem *i ); + QListViewItem *findItem( QObject *o ); + QObject *current() const; + QObject *handleObjectClick( QListViewItem *i ); + +private slots: + virtual void objectClicked( QListViewItem *i ); + virtual void objectDoubleClicked( QListViewItem *i ); + virtual void showRMBMenu( QListViewItem *, const QPoint & ); + +protected: + FormWindow *formWindow; + QPopupMenu *normalMenu, *tabWidgetMenu; + bool deselect; + + QPixmap DesignerFormPix; + QPixmap DesignerLayoutPix; + QPixmap DesignerFolderPix; + QPixmap DesignerEditSlotsPix; + +}; + +class FormDefinitionView : public HierarchyList +{ + Q_OBJECT + +public: + FormDefinitionView( QWidget *parent, FormWindow *fw ); + + void setup(); + void setupVariables(); + void refresh(); + void setCurrent( QWidget *w ); + +protected: + void contentsMouseDoubleClickEvent( QMouseEvent *e ); + +private: + void save( QListViewItem *p, QListViewItem *i ); + void execFunctionDialog( const QString &access, const QString &type, bool addFunc ); + void addVariable( const QString &varName, const QString &access ); + +private slots: + void objectClicked( QListViewItem *i ); + void showRMBMenu( QListViewItem *, const QPoint & ); + void renamed( QListViewItem *i ); + +private: + bool popupOpen; + HierarchyItem *itemSlots, *itemPrivate, *itemProtected, *itemPublic; + HierarchyItem *itemFunct, *itemFunctPriv, *itemFunctProt, *itemFunctPubl; + HierarchyItem *itemVar, *itemVarPriv, *itemVarProt, *itemVarPubl; +}; + + +class HierarchyView : public QTabWidget +{ + Q_OBJECT + +public: + HierarchyView( QWidget *parent ); + ~HierarchyView(); + + void setFormWindow( FormWindow *fw, QObject *o ); + FormWindow *formWindow() const; + SourceEditor *sourceEditor() const { return editor; } + void clear(); + + void showClasses( SourceEditor *se ); + void updateClassBrowsers(); + + void widgetInserted( QWidget *w ); + void widgetRemoved( QWidget *w ); + void widgetsInserted( const QWidgetList &l ); + void widgetsRemoved( const QWidgetList &l ); + void namePropertyChanged( QWidget *w, const QVariant &old ); + void databasePropertyChanged( QWidget *w, const QStringList& info ); + void tabsChanged( QTabWidget *w ); + void pagesChanged( QWizard *w ); + void rebuild(); + void closed( FormWindow *fw ); + void updateFormDefinitionView(); + + FormDefinitionView *formDefinitionView() const { return fView; } + HierarchyList *hierarchyList() const { return listview; } + +protected slots: + void jumpTo( const QString &func, const QString &clss,int type ); + void showClassesTimeout(); + +protected: + void closeEvent( QCloseEvent *e ); + +signals: + void hidden(); + +private: + struct ClassBrowser + { + ClassBrowser( QListView * = 0, ClassBrowserInterface * = 0 ); + ~ClassBrowser(); + QListView *lv; + QInterfacePtr iface; + + Q_DUMMY_COMPARISON_OPERATOR( ClassBrowser ) + }; + FormWindow *formwindow; + HierarchyList *listview; + FormDefinitionView *fView; + SourceEditor *editor; + QMap *classBrowsers; + QGuardedPtr lastSourceEditor; + +}; + + +#endif diff --git a/kdevdesigner/designer/iconvieweditor.ui b/kdevdesigner/designer/iconvieweditor.ui new file mode 100644 index 00000000..e06367f1 --- /dev/null +++ b/kdevdesigner/designer/iconvieweditor.ui @@ -0,0 +1,461 @@ + +IconViewEditorBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + IconViewEditorBase + + + + 0 + 0 + 567 + 321 + + + + Edit Iconview + + + true + + + <b>Edit Iconview</b><p>Add, edit or delete items in the icon view.</p><p>Click the <b>New Item</b>-button to create a new item, then enter text and choose a pixmap.</p><p>Select an item from the view and click the <b>Delete Item</b>-button to remove the item from the iconview.</p> + + + + unnamed + + + 11 + + + 6 + + + + Layout6 + + + + unnamed + + + 0 + + + 6 + + + + preview + + + All items in the iconview. + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + itemNew + + + &New Item + + + Add an item + + + Create a new item for the iconview. + + + + + itemDelete + + + &Delete Item + + + Delete item + + + Delete the selected item. + + + + + Vertical Spacing1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + GroupBox1 + + + + 0 + 5 + 0 + 0 + + + + &Item Properties + + + + unnamed + + + 11 + + + 6 + + + + Label1 + + + &Text: + + + itemText + + + + + itemText + + + + 0 + 0 + + + + Change text + + + Change the text for the selected item. + + + + + Label2 + + + &Pixmap: + + + itemChoosePixmap + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + itemPixmap + + + Label4 + + + + + itemDeletePixmap + + + + 30 + 22 + + + + + + + "designer_s_editcut.png" + + + Delete Pixmap + + + Delete the selected item's pixmap. + + + + + itemChoosePixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + Select a pixmap file for the current item. + + + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonApply + + + &Apply + + + true + + + Apply all changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + itemNew + clicked() + IconViewEditorBase + insertNewItem() + + + itemDelete + clicked() + IconViewEditorBase + deleteCurrentItem() + + + itemText + textChanged( const QString & ) + IconViewEditorBase + currentTextChanged(const QString&) + + + buttonOk + clicked() + IconViewEditorBase + okClicked() + + + buttonApply + clicked() + IconViewEditorBase + applyClicked() + + + buttonCancel + clicked() + IconViewEditorBase + cancelClicked() + + + itemChoosePixmap + clicked() + IconViewEditorBase + choosePixmap() + + + preview + selectionChanged(QIconViewItem*) + IconViewEditorBase + currentItemChanged(QIconViewItem*) + + + preview + currentChanged(QIconViewItem*) + IconViewEditorBase + currentItemChanged(QIconViewItem*) + + + itemDeletePixmap + clicked() + IconViewEditorBase + deletePixmap() + + + + buttonOk + buttonCancel + preview + itemNew + itemDelete + itemText + itemDeletePixmap + itemChoosePixmap + buttonHelp + buttonApply + + + init() + destroy() + applyClicked() + cancelClicked() + choosePixmap() + currentItemChanged( QIconViewItem * ) + currentTextChanged( const QString & ) + deleteCurrentItem() + insertNewItem() + deletePixmap() + okClicked() + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/iconvieweditorimpl.cpp b/kdevdesigner/designer/iconvieweditorimpl.cpp new file mode 100644 index 00000000..10e2fb7d --- /dev/null +++ b/kdevdesigner/designer/iconvieweditorimpl.cpp @@ -0,0 +1,165 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "iconvieweditorimpl.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "pixmapchooser.h" + +#include +#include +#include +#include +#include + +#include + +IconViewEditor::IconViewEditor( QWidget *parent, QWidget *editWidget, FormWindow *fw ) + : IconViewEditorBase( parent, 0, TRUE ), formwindow( fw ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + iconview = (QIconView*)editWidget; + + itemText->setText( "" ); + itemText->setEnabled( FALSE ); + itemPixmap->setText( "" ); + itemChoosePixmap->setEnabled( FALSE ); + itemDeletePixmap->setEnabled( FALSE ); + + QIconViewItem *i = 0; + for ( i = iconview->firstItem(); i; i = i->nextItem() ) { + (void)new QIconViewItem( preview, i->text(), *i->pixmap() ); + } + + if ( preview->firstItem() ) + preview->setCurrentItem( preview->firstItem() ); +} + +void IconViewEditor::insertNewItem() +{ + QIconViewItem *i = new QIconViewItem( preview, i18n( "New Item" ) ); + preview->setCurrentItem( i ); + preview->setSelected( i, TRUE ); + itemText->setFocus(); + itemText->selectAll(); +} + +void IconViewEditor::deleteCurrentItem() +{ + delete preview->currentItem(); + if ( preview->currentItem() ) + preview->setSelected( preview->currentItem(), TRUE ); +} + +void IconViewEditor::currentItemChanged( QIconViewItem *i ) +{ + itemText->blockSignals( TRUE ); + itemText->setText( "" ); + itemPixmap->setText( "" ); + itemText->blockSignals( FALSE ); + + if ( !i ) { + itemText->setEnabled( FALSE ); + itemChoosePixmap->setEnabled( FALSE ); + return; + } + + itemText->blockSignals( TRUE ); + itemText->setEnabled( TRUE ); + itemChoosePixmap->setEnabled( TRUE ); + itemDeletePixmap->setEnabled( i->pixmap() && !i->pixmap()->isNull() ); + + itemText->setText( i->text() ); + if ( i->pixmap() ) + itemPixmap->setPixmap( *i->pixmap() ); + itemText->blockSignals( FALSE ); +} + +void IconViewEditor::currentTextChanged( const QString &txt ) +{ + if ( !preview->currentItem() ) + return; + + preview->currentItem()->setText( txt ); +} + +void IconViewEditor::okClicked() +{ + applyClicked(); + accept(); +} + +void IconViewEditor::cancelClicked() +{ + reject(); +} + +void IconViewEditor::applyClicked() +{ + QIconViewItem *i = 0; + QValueList items; + for ( i = preview->firstItem(); i; i = i->nextItem() ) { + PopulateIconViewCommand::Item item; + if ( i->pixmap() ) + item.pix = *i->pixmap(); + item.text = i->text(); + items.append( item ); + } + + PopulateIconViewCommand *cmd = new PopulateIconViewCommand( i18n( "Edit the Items of '%1'" ).arg( iconview->name() ), + formwindow, iconview, items ); + cmd->execute(); + formwindow->commandHistory()->addCommand( cmd ); +} + +void IconViewEditor::choosePixmap() +{ + if ( !preview->currentItem() ) + return; + + QPixmap pix; + if ( preview->currentItem()->pixmap() ) + pix = qChoosePixmap( this, formwindow, *preview->currentItem()->pixmap() ); + else + pix = qChoosePixmap( this, formwindow, QPixmap() ); + + if ( pix.isNull() ) + return; + + preview->currentItem()->setPixmap( pix ); + itemPixmap->setPixmap( pix ); + itemDeletePixmap->setEnabled( TRUE ); +} + +void IconViewEditor::deletePixmap() +{ + if ( !preview->currentItem() ) + return; + + preview->currentItem()->setPixmap( QPixmap() ); + itemPixmap->setText( "" ); + itemDeletePixmap->setEnabled( FALSE ); +} diff --git a/kdevdesigner/designer/iconvieweditorimpl.h b/kdevdesigner/designer/iconvieweditorimpl.h new file mode 100644 index 00000000..49e17570 --- /dev/null +++ b/kdevdesigner/designer/iconvieweditorimpl.h @@ -0,0 +1,58 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ICONVIEWEDITORIMPL_H +#define ICONVIEWEDITORIMPL_H + +#include "iconvieweditor.h" + +class FormWindow; + +class IconViewEditor : public IconViewEditorBase +{ + Q_OBJECT + +public: + IconViewEditor( QWidget *parent, QWidget *editWidget, FormWindow *fw ); + +protected slots: + void insertNewItem(); + void deleteCurrentItem(); + void currentItemChanged( QIconViewItem * ); + void currentTextChanged( const QString & ); + void okClicked(); + void cancelClicked(); + void applyClicked(); + void choosePixmap(); + void deletePixmap(); + +private: + QIconView *iconview; + FormWindow *formwindow; + +}; + +#endif diff --git a/kdevdesigner/designer/kdevdesigner_part.cpp b/kdevdesigner/designer/kdevdesigner_part.cpp new file mode 100644 index 00000000..a806dffc --- /dev/null +++ b/kdevdesigner/designer/kdevdesigner_part.cpp @@ -0,0 +1,565 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "kdevdesigner_part.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mainwindow.h" +#include "designeraction.h" +#include "formwindow.h" + +KDevDesignerPart::KDevDesignerPart( QWidget *parentWidget, const char *// widgetName + , + QObject *parent, const char *name, const QStringList &args ) + : KInterfaceDesigner::Designer(parent, name) +{ + setInstance( KDevDesignerPartFactory::instance() ); + + m_widget = new MainWindow( this, true ); + m_widget->reparent(parentWidget, QPoint(0,0)); + setupDesignerWindow(); + + setWidget(m_widget); + + setupActions(); + if (args.contains("in shell")) + setXMLFile("kdevdesigner_part_sh.rc"); + else + setXMLFile("kdevdesigner_part.rc"); + + setReadWrite(true); + setModified(false); + + connect(m_widget, SIGNAL(formModified(bool )), this, SLOT(formModified(bool))); +} + +void KDevDesignerPart::setupDesignerWindow() +{ + m_widget->menuBar()->hide(); + m_widget->layoutToolBar->hide(); + m_widget->projectToolBar->hide(); + m_widget->toolsToolBar->hide(); + m_widget->statusBar()->hide(); +} + +static QIconSet createPartIconSet( const QString &name ) +{ + QIconSet ic( BarIcon( "" + name, KDevDesignerPartFactory::instance() ) ); + QString prefix = "designer_"; + int right = name.length() - prefix.length(); + ic.setPixmap( BarIcon( prefix + "d_" + name.right( right ), KDevDesignerPartFactory::instance() ), + QIconSet::Small, QIconSet::Disabled ); + return ic; +} + +void KDevDesignerPart::setupActions( ) +{ + KAction *action; + action = KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + action = KStdAction::open(this, SLOT(fileOpen()), actionCollection()); + action = KStdAction::close(this, SLOT(fileClose()), actionCollection()); + stateSync(action, m_widget->actionFileClose); + action = KStdAction::save(this, SLOT(save()), actionCollection()); + stateSync(action, m_widget->actionFileSave); + action = KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); + stateSync(action, m_widget->actionFileSaveAs); + action = new KAction(i18n("Save Al&l"), 0, this, SLOT(fileSaveAs()), actionCollection(), "file_saveall"); + stateSync(action, m_widget->actionFileSaveAll); + new KAction(i18n("Create &Template..."), 0, this, SLOT(fileCreateTemplate()), actionCollection(), "file_createtemplate"); + + action = KStdAction::undo(this, SLOT(editUndo()), actionCollection()); + stateSync(action, m_widget->actionEditUndo); + action = KStdAction::redo(this, SLOT(editRedo()), actionCollection()); + stateSync(action, m_widget->actionEditRedo); + action = KStdAction::cut(this, SLOT(editCut()), actionCollection()); + stateSync(action, m_widget->actionEditCut); + action = KStdAction::copy(this, SLOT(editCopy()), actionCollection()); + stateSync(action, m_widget->actionEditCopy); + action = KStdAction::paste(this, SLOT(editPaste()), actionCollection()); + stateSync(action, m_widget->actionEditPaste); + action = new KAction(i18n("&Delete"), Key_Delete, this, SLOT(editDelete()), actionCollection(), "edit_delete"); + stateSync(action, m_widget->actionEditDelete); + action = KStdAction::selectAll(this, SLOT(editSelectAll()), actionCollection()); + stateSync(action, m_widget->actionEditSelectAll); + action = new KAction(i18n("Chec&k Accelerators"), ALT + Key_R, this, SLOT(editAccels()), actionCollection(), "edit_accels"); + stateSync(action, m_widget->actionEditAccels); + action = new KAction(i18n("S&lots..."), createPartIconSet("designer_editslots.png"), 0, this, SLOT(editFunctions()), actionCollection(), "edit_functions"); + stateSync(action, m_widget->actionEditFunctions); + action = new KAction(i18n("Co&nnections..."), createPartIconSet("designer_connecttool.png"), 0, this, SLOT(editConnections()), actionCollection(), "edit_connections"); + stateSync(action, m_widget->actionEditConnections); + action = new KAction(i18n("&Form Settings..."), 0, this, SLOT(editFormSettings()), actionCollection(), "edit_formsettings"); + stateSync(action, m_widget->actionEditFormSettings); + + action = new KAction(i18n("&Add File..."), 0, this, SLOT(projectAddFile()), actionCollection(), "project_addfile"); + stateSync(action, m_widget->actionProjectAddFile); + action = new KAction(i18n("&Image Collection..."), 0, this, SLOT(projectImageCollection()), actionCollection(), "project_imagecollection"); + stateSync(action, m_widget->actionEditPixmapCollection); + action = new KAction(i18n("&Database Connections..."), 0, this, SLOT(projectDatabaseCollections()), actionCollection(), "project_databasecollections"); + stateSync(action, m_widget->actionEditDatabaseConnections); + action = new KAction(i18n("&Designer Project Settings..."), 0, this, SLOT(projectSettings()), actionCollection(), "project_settings"); + stateSync(action, m_widget->actionEditProjectSettings); + + KRadioAction *toggle; + toggle = new KRadioAction(i18n("&Pointer"), createPartIconSet("designer_pointer.png"), Key_F2, actionCollection(), "tools_pointer"); + setupToolsAction(toggle, m_widget->actionPointerTool); + pointerAction = toggle; + toggle = new KRadioAction(i18n("&Connect Signal/Slots"), createPartIconSet("designer_connecttool.png"), Key_F3, actionCollection(), "tools_connect"); + setupToolsAction(toggle, m_widget->actionConnectTool); + toggle = new KRadioAction(i18n("Tab &Order"), createPartIconSet("designer_ordertool.png"), Key_F4, actionCollection(), "tools_taborder"); + setupToolsAction(toggle, m_widget->actionOrderTool); + toggle = new KRadioAction(i18n("Set &Buddy"), createPartIconSet("designer_setbuddy.png"), Key_F12, actionCollection(), "tools_setbuddy"); + setupToolsAction(toggle, m_widget->actionBuddyTool); + new KAction(i18n("Configure Toolbox..."), 0, this, SLOT(toolsConfigureToolbox()), actionCollection(), "tools_toolbox"); + new KAction(i18n("Edit &Custom Widgets..."), 0, this, SLOT(toolsEditCustomWidgets()), actionCollection(), "tools_editcustomwidgets"); + + action = new KAction(i18n("Adjust &Size"), createPartIconSet("designer_adjustsize.png"), CTRL + Key_J, this, SLOT(layoutAdjustSize()), actionCollection(), "layout_adjustsize"); + stateSync(action, m_widget->actionEditAdjustSize); + action = new KAction(i18n("Lay Out &Horizontally"), createPartIconSet("designer_edithlayout.png"), CTRL + Key_H, this, SLOT(layoutHLayout()), actionCollection(), "layout_h"); + stateSync(action, m_widget->actionEditHLayout); + action = new KAction(i18n("Lay Out &Vertically"), createPartIconSet("designer_editvlayout.png"), CTRL + Key_V, this, SLOT(layoutVLayout()), actionCollection(), "layout_v"); + stateSync(action, m_widget->actionEditVLayout); + action = new KAction(i18n("Lay Out in &Grid"), createPartIconSet("designer_editgrid.png"), CTRL + Key_G, this, SLOT(layoutGridLayout()), actionCollection(), "layout_grid"); + stateSync(action, m_widget->actionEditGridLayout); + action = new KAction(i18n("Lay Out Horizontally (in S&plitter)"), createPartIconSet("designer_editvlayoutsplit.png"), 0, this, SLOT(layoutSplitHLayout()), actionCollection(), "layout_splith"); + stateSync(action, m_widget->actionEditSplitHorizontal); + action = new KAction(i18n("Lay Out Vertically (in Sp&litter)"), createPartIconSet("designer_edithlayoutsplit.png"), 0, this, SLOT(layoutSplitVLayout()), actionCollection(), "layout_splitv"); + stateSync(action, m_widget->actionEditSplitVertical); + action = new KAction(i18n("&Break Layout"), createPartIconSet("designer_editbreaklayout.png"), CTRL + Key_B, this, SLOT(layoutBreak()), actionCollection(), "layout_break"); + stateSync(action, m_widget->actionEditBreakLayout); + toggle = new KRadioAction(i18n("Add Spacer"), createPartIconSet("designer_spacer.png"), 0, actionCollection(), "layout_spacer"); + setupToolsAction(toggle, m_widget->actionInsertSpacer); + + action = new KAction(i18n("Preview &Form"), CTRL + Key_T, this, SLOT(windowPreview()), actionCollection(), "window_preview"); + stateSync(action, m_widget->actionPreview); + action = new KAction(i18n("Ne&xt Form"), CTRL + Key_F6, this, SLOT(windowNext()), actionCollection(), "window_next"); + stateSync(action, m_widget->actionWindowNext); + action = new KAction(i18n("Pre&vious Form"), CTRL + SHIFT + Key_F6, this, SLOT(windowPrev()), actionCollection(), "window_prev"); + stateSync(action, m_widget->actionWindowPrevious); + + action = KStdAction::preferences(this, SLOT(editPreferences()), actionCollection()); + action->setText(i18n("Configure &KDevDesigner...")); + stateSync(action, m_widget->actionEditPreferences); +} + +KDevDesignerPart::~KDevDesignerPart() +{ +} + +void KDevDesignerPart::setReadWrite(bool rw) +{ + ReadWritePart::setReadWrite(rw); +} + +void KDevDesignerPart::setModified(bool modified) +{ +/* KAction *save = actionCollection()->action(KStdAction::stdName(KStdAction::Save)); + if (!save) + return; + if (modified) + save->setEnabled(true); + else + save->setEnabled(false);*/ + + ReadWritePart::setModified(modified); +} + +bool KDevDesignerPart::openFile() +{ + m_widget->fileOpen("", "", m_file); + return true; +} + +bool KDevDesignerPart::saveFile() +{ + if (isReadWrite() == false) + return false; + m_widget->actionFileSaveAll->activate(); + return true; +} + +void KDevDesignerPart::stateSync( KAction * kaction, QAction * qaction ) +{ + if (!qaction) + return; + kaction->setEnabled(qaction->isEnabled()); + DesignerAction *ac = dynamic_cast(qaction); + if (!ac) + return; + connect(ac, SIGNAL(actionEnabled(bool )), kaction, SLOT(setEnabled(bool ))); +} + +void KDevDesignerPart::setupToolsAction( KRadioAction * toggle, QAction * action ) +{ + if (!action) + return; + + toggle->setGroup("tools"); + toggle->setExclusiveGroup("tools"); + connect(action, SIGNAL(toggled(bool )), this, SLOT(setToggleActionChecked(bool ))); + connect(toggle, SIGNAL(toggled(bool)), this, SLOT(setToggleActionOn(bool))); + toggle->setChecked(action->isOn()); + m_actionMap[action] = toggle; + m_actionMap2[toggle] = action; +} + + +// It's usually safe to leave the factory code alone.. with the +// notable exception of the KAboutData data +#include +#include + +KInstance* KDevDesignerPartFactory::s_instance = 0L; +KAboutData* KDevDesignerPartFactory::s_about = 0L; + +KDevDesignerPartFactory::KDevDesignerPartFactory() + : KParts::Factory() +{ +} + +KDevDesignerPartFactory::~KDevDesignerPartFactory() +{ + delete s_instance; + delete s_about; + + s_instance = 0L; +} + +KParts::Part* KDevDesignerPartFactory::createPartObject( QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, + const char *classname, const QStringList &args ) +{ + // Create an instance of our Part + KDevDesignerPart* obj = new KDevDesignerPart( parentWidget, widgetName, parent, name, args ); + + // See if we are to be read-write or not + if (QCString(classname) == "KParts::ReadOnlyPart") + obj->setReadWrite(false); + + return obj; +} + +KInstance* KDevDesignerPartFactory::instance() +{ + if( !s_instance ) + { + s_about = new KAboutData("kdevdesignerpart", I18N_NOOP("KDevDesignerPart"), "0.1"); + s_about->addAuthor("Alexander Dymo", 0, "cloudtemple@mksat.net"); + s_about->addAuthor("Trolltech AS", 0, "info@trolltech.com"); + s_instance = new KInstance(s_about); + } + return s_instance; +} + +extern "C" +{ + void* init_libkdevdesignerpart() + { + return new KDevDesignerPartFactory; + } +} + +//actions + +void KDevDesignerPart::fileNew( ) +{ + if (!m_widget->actionNewFile) + { + qWarning("wrong m_widget->actionNewFile"); + return; + } + m_widget->actionNewFile->activate(); +} + +void KDevDesignerPart::fileOpen() +{ + m_widget->fileOpen(); +} + +void KDevDesignerPart::fileSaveAs() +{ + m_widget->actionFileSaveAs->activate(); +} + +void KDevDesignerPart::fileClose( ) +{ + m_widget->actionFileClose->activate(); +} + +void KDevDesignerPart::fileCreateTemplate( ) +{ + m_widget->fileCreateTemplate(); +} + +void KDevDesignerPart::editUndo( ) +{ + m_widget->actionEditUndo->activate(); +} + +void KDevDesignerPart::editRedo( ) +{ + m_widget->actionEditRedo->activate(); +} + +void KDevDesignerPart::editCut( ) +{ + m_widget->actionEditCut->activate(); +} + +void KDevDesignerPart::editPaste( ) +{ + m_widget->actionEditPaste->activate(); +} + +void KDevDesignerPart::editCopy( ) +{ + m_widget->actionEditCopy->activate(); +} + +void KDevDesignerPart::editDelete( ) +{ + m_widget->actionEditDelete->activate(); +} + +void KDevDesignerPart::editSelectAll( ) +{ + m_widget->actionEditSelectAll->activate(); +} + +void KDevDesignerPart::editAccels( ) +{ + m_widget->actionEditAccels->activate(); +} + +void KDevDesignerPart::editFunctions( ) +{ + m_widget->actionEditFunctions->activate(); +} + +void KDevDesignerPart::editConnections( ) +{ + m_widget->actionEditConnections->activate(); +} + +void KDevDesignerPart::editFormSettings( ) +{ + m_widget->actionEditFormSettings->activate(); +} + +void KDevDesignerPart::editPreferences( ) +{ + m_widget->actionEditPreferences->activate(); +} + +void KDevDesignerPart::projectAddFile( ) +{ + m_widget->actionProjectAddFile->activate(); +} + +void KDevDesignerPart::projectImageCollection( ) +{ + m_widget->actionEditPixmapCollection->activate(); +} + +void KDevDesignerPart::projectDatabaseCollections( ) +{ + m_widget->actionEditDatabaseConnections->activate(); +} + +void KDevDesignerPart::projectSettings( ) +{ + m_widget->actionEditProjectSettings->activate(); +} + +void KDevDesignerPart::toolsConfigureToolbox( ) +{ + m_widget->toolsConfigure(); +} + +void KDevDesignerPart::layoutAdjustSize( ) +{ + m_widget->actionEditAdjustSize->activate(); +} + +void KDevDesignerPart::layoutHLayout( ) +{ + m_widget->actionEditHLayout->activate(); +} + +void KDevDesignerPart::layoutVLayout( ) +{ + m_widget->actionEditVLayout->activate(); +} + +void KDevDesignerPart::layoutGridLayout( ) +{ + m_widget->actionEditGridLayout->activate(); +} + +void KDevDesignerPart::layoutSplitHLayout( ) +{ + m_widget->actionEditSplitHorizontal->activate(); +} + +void KDevDesignerPart::layoutSplitVLayout( ) +{ + m_widget->actionEditSplitVertical->activate(); +} + +void KDevDesignerPart::layoutBreak( ) +{ + m_widget->actionEditBreakLayout->activate(); +} + +void KDevDesignerPart::windowPreview( ) +{ + m_widget->actionPreview->activate(); +} + +void KDevDesignerPart::windowNext( ) +{ + m_widget->actionWindowNext->activate(); +} + +void KDevDesignerPart::windowPrev( ) +{ + m_widget->actionWindowPrevious->activate(); +} + +void KDevDesignerPart::statusMessage( const QString & msg ) +{ + emit setStatusBarText(msg); +} + +void KDevDesignerPart::setToggleActionChecked( bool b) +{ + if (!sender()) + return; + const QAction *action = dynamic_cast(sender()); + if (!action) + return; + if (b) + { + if (action == m_widget->actionPointerTool) + pointerAction->setChecked(true); + return; + } + KRadioAction *kaction = m_actionMap[action]; + if (!kaction) + return; +// kdDebug() << "untoggle action: " << kaction->text() << endl; + kaction->blockSignals(true); + kaction->setChecked(b); + kaction->blockSignals(false); +} + +void KDevDesignerPart::setToggleActionOn( bool b ) +{ + if (!sender()) + return; + const KRadioAction *action = dynamic_cast(sender()); + if (!action) + return; +// kdDebug() << (b?QString("toggle"):QString("untoggle")) << " action: " << action->text() << endl; + QAction *qaction = m_actionMap2[action]; + if (!qaction) + return; + disconnect(qaction, SIGNAL(toggled(bool )), this, SLOT(setToggleActionChecked(bool ))); + qaction->setOn(b); + connect(qaction, SIGNAL(toggled(bool )), this, SLOT(setToggleActionChecked(bool ))); +} + +void KDevDesignerPart::openProject( const QString & // projectFile + ) +{ + //TODO: implement + return; +} + +KInterfaceDesigner::DesignerType KDevDesignerPart::designerType( ) +{ + return KInterfaceDesigner::QtDesigner; +} + +void KDevDesignerPart::emitAddedFunction( const QString & form, KInterfaceDesigner::Function func ) +{ + kdDebug() << "KDevDesignerPart::emitAddedFunction: form " << form << ", function: " << func.function << endl; + emit addedFunction(designerType(), form, func); +} + +void KDevDesignerPart::emitRemovedFunction( const QString & form, KInterfaceDesigner::Function func ) +{ + kdDebug() << "KDevDesignerPart::emitRemovedFunction: form " << form << ", function: " << func.function << endl; + emit removedFunction(designerType(), form, func); +} + +void KDevDesignerPart::emitEditedFunction( const QString & form, KInterfaceDesigner::Function oldFunc, KInterfaceDesigner::Function func ) +{ + kdDebug() << "KDevDesignerPart::emitEditedFunction: form " << form + << ", old function: " << oldFunc.function + << ", function: " << func.function << endl; + +// m_widget->formWindow()->clearSelection(false); + emit editedFunction(designerType(), form, oldFunc, func); +} + +void KDevDesignerPart::emitEditFunction(const QString &formName, const QString &functionName) +{ + kdDebug() << "KDevDesignerPart::emitEditedFunction: form " << formName + << ", function: " << functionName << endl; + emit editFunction(designerType(), formName, functionName); +} + +void KDevDesignerPart::formModified(bool b) +{ + kdDebug() << "KDevDesignerPart::formModified " << b << endl; + setModified(b); +} + +void KDevDesignerPart::emitEditSource(const QString &formName) +{ + emit editSource(designerType(), formName); +} + +void KDevDesignerPart::emitNewStatus(const QString &formName, int status) +{ + emit newStatus(formName, status); +} + +void KDevDesignerPart::toolsEditCustomWidgets( ) +{ + m_widget->toolsCustomWidget(); +} + +#include "kdevdesigner_part.moc" diff --git a/kdevdesigner/designer/kdevdesigner_part.desktop b/kdevdesigner/designer/kdevdesigner_part.desktop new file mode 100644 index 00000000..2451bd55 --- /dev/null +++ b/kdevdesigner/designer/kdevdesigner_part.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Name=KDevDesignerPart +Name[da]=KDevelop Designer-part +Name[el]=ΤμήμαKDevDesigner +Name[nds]=Kdevelop-Makerkomponent +Name[ne]=केडीई विकास डिजाइनर भाग +Name[sv]=KDevelop designerdel +Name[ta]=கேமேம்பாட்டு வடிவமைப்பாளர் பகுதி +Name[tg]=KDevҚисми дизайнгар +Name[zh_TW]=KDevelop 設計元件 +MimeType=application/x-designer +ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart +X-KDE-Library=libkdevdesignerpart +Type=Service +InitialPreference=10 + diff --git a/kdevdesigner/designer/kdevdesigner_part.h b/kdevdesigner/designer/kdevdesigner_part.h new file mode 100644 index 00000000..70712210 --- /dev/null +++ b/kdevdesigner/designer/kdevdesigner_part.h @@ -0,0 +1,146 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _KDEVDESIGNERPART_H_ +#define _KDEVDESIGNERPART_H_ + +#include + +#include +#include + +#include "designer.h" + +class QWidget; +class QPainter; +class KURL; +class MainWindow; +class KAction; +class QAction; +class KRadioAction; + +class KDevDesignerPart : public KInterfaceDesigner::Designer +{ + Q_OBJECT +public: + KDevDesignerPart(QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, const QStringList &args); + virtual ~KDevDesignerPart(); + + virtual void setReadWrite(bool rw); + virtual void setModified(bool modified); + + void statusMessage(const QString &msg); + + //KInterfaceDesigner::Designer methods + virtual void openProject(const QString &projectFile); + virtual KInterfaceDesigner::DesignerType designerType(); + + void emitAddedFunction(const QString &form, KInterfaceDesigner::Function func); + void emitEditedFunction(const QString &form, KInterfaceDesigner::Function oldFunc, KInterfaceDesigner::Function func); + void emitRemovedFunction(const QString &form, KInterfaceDesigner::Function func); + + void emitEditFunction(const QString &formName, const QString &functionName); + void emitEditSource(const QString &formName); + + void emitNewStatus(const QString &formName, int status); + +protected: + virtual bool openFile(); + virtual bool saveFile(); + + void setupDesignerWindow(); + void setupActions(); + + void stateSync(KAction *kaction, QAction *qaction); + void setupToolsAction(KRadioAction *toggle, QAction *action); + +protected slots: + void setToggleActionChecked(bool b); + void setToggleActionOn(bool b); + + void fileNew(); + void fileOpen(); + void fileClose(); + void fileSaveAs(); + void fileCreateTemplate(); + + void editUndo(); + void editRedo(); + void editCut(); + void editCopy(); + void editPaste(); + void editDelete(); + void editSelectAll(); + void editAccels(); + void editFunctions(); + void editConnections(); + void editFormSettings(); + void editPreferences(); + + void projectAddFile(); + void projectImageCollection(); + void projectDatabaseCollections(); + void projectSettings(); + + void toolsConfigureToolbox(); + void toolsEditCustomWidgets(); + + void layoutAdjustSize(); + void layoutHLayout(); + void layoutVLayout(); + void layoutGridLayout(); + void layoutSplitHLayout(); + void layoutSplitVLayout(); + void layoutBreak(); + + void windowPreview(); + void windowNext(); + void windowPrev(); + + void formModified(bool b); +private: + MainWindow *m_widget; + + QMap m_actionMap; + QMap m_actionMap2; + KRadioAction* pointerAction; +}; + +class KInstance; +class KAboutData; + +class KDevDesignerPartFactory : public KParts::Factory +{ + Q_OBJECT +public: + KDevDesignerPartFactory(); + virtual ~KDevDesignerPartFactory(); + virtual KParts::Part* createPartObject( QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, + const char *classname, const QStringList &args ); + static KInstance* instance(); + +private: + static KInstance* s_instance; + static KAboutData* s_about; +}; + +#endif // _KDEVDESIGNERPART_H_ diff --git a/kdevdesigner/designer/kdevdesigner_part.rc b/kdevdesigner/designer/kdevdesigner_part.rc new file mode 100644 index 00000000..71adcdc9 --- /dev/null +++ b/kdevdesigner/designer/kdevdesigner_part.rc @@ -0,0 +1,121 @@ + + + + &File + + + + + + &Edit + + + + + + + + + + + + + + + + + + + &Project + + + + + + + + &Tools + + + + + + + + + + &Layout + + + + + + + + + + + + + &Settings + + + + &Window + + + + + + + + + + +Main Toolbar + + + + + + + + + + + + +Layout Toolbar + + + + + + + + + + + + +Tools Toolbar + + + + + + + diff --git a/kdevdesigner/designer/kdevdesigner_part_sh.rc b/kdevdesigner/designer/kdevdesigner_part_sh.rc new file mode 100644 index 00000000..eb6b503b --- /dev/null +++ b/kdevdesigner/designer/kdevdesigner_part_sh.rc @@ -0,0 +1,116 @@ + + + + &File + + + + + + + + + + + + + + &Edit + + + + + + + + + + + + + + + + + + &Project + + + + + + + + &Tools + + + + + + + + + + &Layout + + + + + + + + + + + + + &Settings + + + + &Window + + + + + + + + +File Toolbar + + + + + +Edit Toolbar + + + + + + + + +Layout Toolbar + + + + + + + + + + + + +Tools Toolbar + + + + + + + diff --git a/kdevdesigner/designer/layout.cpp b/kdevdesigner/designer/layout.cpp new file mode 100644 index 00000000..2926b4f6 --- /dev/null +++ b/kdevdesigner/designer/layout.cpp @@ -0,0 +1,1017 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "formwindow.h" +#include "layout.h" +#include +#include "widgetfactory.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +bool operator<( const QGuardedPtr &p1, const QGuardedPtr &p2 ) +{ + return p1.operator->() < p2.operator->(); +} + +/*! + \class Layout layout.h + \brief Baseclass for layouting widgets in the Designer + + Classes derived from this abstract base class are used for layouting + operations in the Designer. + +*/ + +/*! \a p specifies the parent of the layoutBase \a lb. The parent + might be changed in setup(). If the layoutBase is a + container, the parent and the layoutBase are the same. Also they + always have to be a widget known to the designer (e.g. in the case + of the tabwidget parent and layoutBase are the tabwidget and not the + page which actually gets laid out. For actual usage the correct + widget is found later by Layout.) + */ + +Layout::Layout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup, bool splitter ) + : widgets( wl ), parent( p ), formWindow( fw ), isBreak( !doSetup ), useSplitter( splitter ) +{ + widgets.setAutoDelete( FALSE ); + layoutBase = lb; + if ( !doSetup && layoutBase ) + oldGeometry = layoutBase->geometry(); +} + +/*! The widget list we got in the constructor might contain too much + widgets (like widgets with different parents, already laid out + widgets, etc.). Here we set up the list and so the only the "best" + widgets get laid out. +*/ + +void Layout::setup() +{ + startPoint = QPoint( 32767, 32767 ); + QValueList lists; + QWidget *lastParent = 0; + QWidgetList *lastList = 0; + QWidget *w = 0; + + // Go through all widgets of the list we got. As we can only + // layout widgets which have the same parent, we first do some + // sorting which means create a list for each parent containing + // its child here. After that we keep working on the list of + // childs which has the most entries. + // Widgets which are already laid out are thrown away here too + for ( w = widgets.first(); w; w = widgets.next() ) { + if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) + continue; + if ( lastParent != w->parentWidget() ) { + lastList = 0; + lastParent = w->parentWidget(); + QValueList::Iterator it = lists.begin(); + for ( ; it != lists.end(); ++it ) { + if ( ( *it ).first()->parentWidget() == w->parentWidget() ) + lastList = &( *it ); + } + if ( !lastList ) { + QWidgetList l; + l.setAutoDelete( FALSE ); + lists.append( l ); + lastList = &lists.last(); + } + } + lastList->append( w ); + } + + // So, now find the list with the most entries + lastList = 0; + QValueList::Iterator it = lists.begin(); + for ( ; it != lists.end(); ++it ) { + if ( !lastList || ( *it ).count() > lastList->count() ) + lastList = &( *it ); + } + + // If we found no list (because no widget did fit at all) or the + // best list has only one entry and we do not layout a container, + // we leave here. + if ( !lastList || ( lastList->count() < 2 && + ( !layoutBase || + ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) && + layoutBase != formWindow->mainContainer() ) ) + ) ) { + widgets.clear(); + startPoint = QPoint( 0, 0 ); + return; + } + + // Now we have a new and clean widget list, which makes sense + // to layout + widgets = *lastList; + // Also use the only correct parent later, so store it + parent = WidgetFactory::widgetOfContainer( widgets.first()->parentWidget() ); + // Now calculate the position where the layout-meta-widget should + // be placed and connect to widgetDestroyed() signals of the + // widgets to get informed if one gets deleted to be able to + // handle that and do not crash in this case + for ( w = widgets.first(); w; w = widgets.next() ) { + connect( w, SIGNAL( destroyed() ), + this, SLOT( widgetDestroyed() ) ); + startPoint = QPoint( QMIN( startPoint.x(), w->x() ), + QMIN( startPoint.y(), w->y() ) ); + geometries.insert( w, QRect( w->pos(), w->size() ) ); + // Change the Z-order, as saving/loading uses the Z-order for + // writing/creating widgets and this has to be the same as in + // the layout. Else saving + loading will give different results + w->raise(); + } +} + +void Layout::widgetDestroyed() +{ + if ( sender() && sender()->isWidgetType() ) + widgets.removeRef( (QWidget*)sender() ); +} + +bool Layout::prepareLayout( bool &needMove, bool &needReparent ) +{ + if ( !widgets.count() ) + return FALSE; + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) + w->raise(); + needMove = !layoutBase; + needReparent = needMove || ::qt_cast(layoutBase) || ::qt_cast(layoutBase); + if ( !layoutBase ) { + if ( !useSplitter ) + layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( "QLayoutWidget" ), + WidgetFactory::containerOfWidget( parent ) ); + else + layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( "QSplitter" ), + WidgetFactory::containerOfWidget( parent ) ); + } else { + WidgetFactory::deleteLayout( layoutBase ); + } + + return TRUE; +} + +void Layout::finishLayout( bool needMove, QLayout *layout ) +{ + if ( needMove ) + layoutBase->move( startPoint ); + QRect g( QRect( layoutBase->pos(), layoutBase->size() ) ); + if ( WidgetFactory::layoutType( layoutBase->parentWidget() ) == WidgetFactory::NoLayout && !isBreak ) + layoutBase->adjustSize(); + else if ( isBreak ) + layoutBase->setGeometry( oldGeometry ); + oldGeometry = g; + layoutBase->show(); + layout->activate(); + formWindow->insertWidget( layoutBase ); + formWindow->selectWidget( layoutBase ); + QString n = layoutBase->name(); + if ( n.find( "qt_dead_widget_" ) != -1 ) { + n.remove( 0, QString( "qt_dead_widget_" ).length() ); + layoutBase->setName( n ); + } +} + +void Layout::undoLayout() +{ + if ( !widgets.count() ) + return; + QMap, QRect>::Iterator it = geometries.begin(); + for ( ; it != geometries.end(); ++it ) { + if ( !it.key() ) + continue; + it.key()->reparent( WidgetFactory::containerOfWidget( parent ), 0, ( *it ).topLeft(), it.key()->isVisibleTo( formWindow ) ); + it.key()->resize( ( *it ).size() ); + } + formWindow->selectWidget( layoutBase, FALSE ); + WidgetFactory::deleteLayout( layoutBase ); + if ( parent != layoutBase && !::qt_cast(layoutBase) ) { + layoutBase->hide(); + QString n = layoutBase->name(); + n.prepend( "qt_dead_widget_" ); + layoutBase->setName( n ); + } else { + layoutBase->setGeometry( oldGeometry ); + } + if ( widgets.first() ) + formWindow->selectWidget( widgets.first() ); + else + formWindow->selectWidget( formWindow ); +} + +void Layout::breakLayout() +{ + QMap rects; + if ( !widgets.isEmpty() ) { + QWidget *w; + for ( w = widgets.first(); w; w = widgets.next() ) + rects.insert( w, w->geometry() ); + } + WidgetFactory::deleteLayout( layoutBase ); + bool needReparent = qstrcmp( layoutBase->className(), "QLayoutWidget" ) == 0 || + qstrcmp( layoutBase->className(), "QSplitter" ) == 0 || + ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) && + layoutBase != formWindow->mainContainer() ); + bool needResize = qstrcmp( layoutBase->className(), "QSplitter" ) == 0; + bool add = geometries.isEmpty(); + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + if ( needReparent ) + w->reparent( layoutBase->parentWidget(), 0, + layoutBase->pos() + w->pos(), TRUE ); + if ( needResize ) { + QMap::Iterator it = rects.find( w ); + if ( it != rects.end() ) + w->setGeometry( QRect( layoutBase->pos() + (*it).topLeft(), (*it).size() ) ); + } + if ( add ) + geometries.insert( w, QRect( w->pos(), w->size() ) ); + } + if ( needReparent ) { + layoutBase->hide(); + parent = layoutBase->parentWidget(); + QString n = layoutBase->name(); + n.prepend( "qt_dead_widget_" ); + layoutBase->setName( n ); + } else { + parent = layoutBase; + } + if ( widgets.first() && widgets.first()->isVisibleTo( formWindow ) ) + formWindow->selectWidget( widgets.first() ); + else + formWindow->selectWidget( formWindow ); +} + +class HorizontalLayoutList : public QWidgetList +{ +public: + HorizontalLayoutList( const QWidgetList &l ) + : QWidgetList( l ) {} + + int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ) { + QWidget *w1 = (QWidget*)item1; + QWidget *w2 = (QWidget*)item2; + if ( w1->x() == w2->x() ) + return 0; + if ( w1->x() > w2->x() ) + return 1; + return -1; + } + +}; + +HorizontalLayout::HorizontalLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup, bool splitter ) + : Layout( wl, p, fw, lb, doSetup, splitter ) +{ + if ( doSetup ) + setup(); +} + +void HorizontalLayout::setup() +{ + HorizontalLayoutList l( widgets ); + l.sort(); + widgets = l; + Layout::setup(); +} + +void HorizontalLayout::doLayout() +{ + bool needMove, needReparent; + if ( !prepareLayout( needMove, needReparent ) ) + return; + + QHBoxLayout *layout = (QHBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::HBox ); + + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + if ( needReparent && w->parent() != layoutBase ) + w->reparent( layoutBase, 0, QPoint( 0, 0 ), FALSE ); + if ( !useSplitter ) { + if ( qstrcmp( w->className(), "Spacer" ) == 0 ) + layout->addWidget( w, 0, ( (Spacer*)w )->alignment() ); + else + layout->addWidget( w ); + if ( ::qt_cast(w) ) + ( (QLayoutWidget*)w )->updateSizePolicy(); + } + w->show(); + } + + if ( ::qt_cast(layoutBase) ) + ( (QSplitter*)layoutBase )->setOrientation( Qt::Horizontal ); + + finishLayout( needMove, layout ); +} + + + + +class VerticalLayoutList : public QWidgetList +{ +public: + VerticalLayoutList( const QWidgetList &l ) + : QWidgetList( l ) {} + + int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ) { + QWidget *w1 = (QWidget*)item1; + QWidget *w2 = (QWidget*)item2; + if ( w1->y() == w2->y() ) + return 0; + if ( w1->y() > w2->y() ) + return 1; + return -1; + } + +}; + +VerticalLayout::VerticalLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup, bool splitter ) + : Layout( wl, p, fw, lb, doSetup, splitter ) +{ + if ( doSetup ) + setup(); +} + +void VerticalLayout::setup() +{ + VerticalLayoutList l( widgets ); + l.sort(); + widgets = l; + Layout::setup(); +} + +void VerticalLayout::doLayout() +{ + bool needMove, needReparent; + if ( !prepareLayout( needMove, needReparent ) ) + return; + + QVBoxLayout *layout = (QVBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::VBox ); + + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + if ( needReparent && w->parent() != layoutBase ) + w->reparent( layoutBase, 0, QPoint( 0, 0 ), FALSE ); + if ( !useSplitter ) { + if ( qstrcmp( w->className(), "Spacer" ) == 0 ) + layout->addWidget( w, 0, ( (Spacer*)w )->alignment() ); + else + layout->addWidget( w ); + if ( ::qt_cast(w) ) + ( (QLayoutWidget*)w )->updateSizePolicy(); + } + w->show(); + } + + if ( ::qt_cast(layoutBase) ) + ( (QSplitter*)layoutBase )->setOrientation( Qt::Vertical ); + + finishLayout( needMove, layout ); +} + + + + + +class Grid +{ +public: + Grid( int rows, int cols ); + ~Grid(); + + QWidget* cell( int row, int col ) const { return cells[ row * ncols + col]; } + void setCell( int row, int col, QWidget* w ) { cells[ row*ncols + col] = w; } + void setCells( QRect c, QWidget* w ) { + for ( int rows = c.bottom()-c.top(); rows >= 0; rows--) + for ( int cols = c.right()-c.left(); cols >= 0; cols--) { + setCell(c.top()+rows, c.left()+cols, w); + } + } + int numRows() const { return nrows; } + int numCols() const { return ncols; } + + void simplify(); + bool locateWidget( QWidget* w, int& row, int& col, int& rowspan, int& colspan ); + +private: + void merge(); + int countRow( int r, int c ) const; + int countCol( int r, int c ) const; + void setRow( int r, int c, QWidget* w, int count ); + void setCol( int r, int c, QWidget* w, int count ); + bool isWidgetStartCol( int c ) const; + bool isWidgetEndCol( int c ) const; + bool isWidgetStartRow( int r ) const; + bool isWidgetEndRow( int r ) const; + bool isWidgetTopLeft( int r, int c ) const; + void extendLeft(); + void extendRight(); + void extendUp(); + void extendDown(); + QWidget** cells; + bool* cols; + bool* rows; + int nrows, ncols; + +}; + +Grid::Grid( int r, int c ) + : nrows( r ), ncols( c ) +{ + cells = new QWidget*[ r * c ]; + memset( cells, 0, sizeof( cells ) * r * c ); + rows = new bool[ r ]; + cols = new bool[ c ]; + +} + +Grid::~Grid() +{ + delete [] cells; + delete [] cols; + delete [] rows; +} + +int Grid::countRow( int r, int c ) const +{ + QWidget* w = cell( r, c ); + int i = c + 1; + while ( i < ncols && cell( r, i ) == w ) + i++; + return i - c; +} + +int Grid::countCol( int r, int c ) const +{ + QWidget* w = cell( r, c ); + int i = r + 1; + while ( i < nrows && cell( i, c ) == w ) + i++; + return i - r; +} + +void Grid::setCol( int r, int c, QWidget* w, int count ) +{ + for (int i = 0; i < count; i++ ) + setCell( r + i, c, w ); +} + +void Grid::setRow( int r, int c, QWidget* w, int count ) +{ + for (int i = 0; i < count; i++ ) + setCell( r, c + i, w ); +} + +bool Grid::isWidgetStartCol( int c ) const +{ + int r; + for ( r = 0; r < nrows; r++ ) { + if ( cell( r, c ) && ( (c==0) || (cell( r, c) != cell( r, c-1) )) ) { + return TRUE; + } + } + return FALSE; +} + +bool Grid::isWidgetEndCol( int c ) const +{ + int r; + for ( r = 0; r < nrows; r++ ) { + if ( cell( r, c ) && ((c == ncols-1) || (cell( r, c) != cell( r, c+1) )) ) + return TRUE; + } + return FALSE; +} + +bool Grid::isWidgetStartRow( int r ) const +{ + int c; + for ( c = 0; c < ncols; c++ ) { + if ( cell( r, c ) && ( (r==0) || (cell( r, c) != cell( r-1, c) )) ) + return TRUE; + } + return FALSE; +} + +bool Grid::isWidgetEndRow( int r ) const +{ + int c; + for ( c = 0; c < ncols; c++ ) { + if ( cell( r, c ) && ((r == nrows-1) || (cell( r, c) != cell( r+1, c) )) ) + return TRUE; + } + return FALSE; +} + + +bool Grid::isWidgetTopLeft( int r, int c ) const +{ + QWidget* w = cell( r, c ); + if ( !w ) + return FALSE; + return ( !r || cell( r-1, c) != w ) && (!c || cell( r, c-1) != w); +} + +void Grid::extendLeft() +{ + int r,c,i; + for ( c = 1; c < ncols; c++ ) { + for ( r = 0; r < nrows; r++ ) { + QWidget* w = cell( r, c ); + if ( !w ) + continue; + int cc = countCol( r, c); + int stretch = 0; + for ( i = c-1; i >= 0; i-- ) { + if ( cell( r, i ) ) + break; + if ( countCol( r, i ) < cc ) + break; + if ( isWidgetEndCol( i ) ) + break; + if ( isWidgetStartCol( i ) ) { + stretch = c - i; + break; + } + } + if ( stretch ) { + for ( i = 0; i < stretch; i++ ) + setCol( r, c-i-1, w, cc ); + } + } + } +} + + +void Grid::extendRight() +{ + int r,c,i; + for ( c = ncols - 2; c >= 0; c-- ) { + for ( r = 0; r < nrows; r++ ) { + QWidget* w = cell( r, c ); + if ( !w ) + continue; + int cc = countCol( r, c); + int stretch = 0; + for ( i = c+1; i < ncols; i++ ) { + if ( cell( r, i ) ) + break; + if ( countCol( r, i ) < cc ) + break; + if ( isWidgetStartCol( i ) ) + break; + if ( isWidgetEndCol( i ) ) { + stretch = i - c; + break; + } + } + if ( stretch ) { + for ( i = 0; i < stretch; i++ ) + setCol( r, c+i+1, w, cc ); + } + } + } + +} + +void Grid::extendUp() +{ + int r,c,i; + for ( r = 1; r < nrows; r++ ) { + for ( c = 0; c < ncols; c++ ) { + QWidget* w = cell( r, c ); + if ( !w ) + continue; + int cr = countRow( r, c); + int stretch = 0; + for ( i = r-1; i >= 0; i-- ) { + if ( cell( i, c ) ) + break; + if ( countRow( i, c ) < cr ) + break; + if ( isWidgetEndRow( i ) ) + break; + if ( isWidgetStartRow( i ) ) { + stretch = r - i; + break; + } + } + if ( stretch ) { + for ( i = 0; i < stretch; i++ ) + setRow( r-i-1, c, w, cr ); + } + } + } +} + +void Grid::extendDown() +{ + int r,c,i; + for ( r = nrows - 2; r >= 0; r-- ) { + for ( c = 0; c < ncols; c++ ) { + QWidget* w = cell( r, c ); + if ( !w ) + continue; + int cr = countRow( r, c); + int stretch = 0; + for ( i = r+1; i < nrows; i++ ) { + if ( cell( i, c ) ) + break; + if ( countRow( i, c ) < cr ) + break; + if ( isWidgetStartRow( i ) ) + break; + if ( isWidgetEndRow( i ) ) { + stretch = i - r; + break; + } + } + if ( stretch ) { + for ( i = 0; i < stretch; i++ ) + setRow( r+i+1, c, w, cr ); + } + } + } + +} + +void Grid::simplify() +{ + extendLeft(); + extendRight(); + extendUp(); + extendDown(); + merge(); +} + + +void Grid::merge() +{ + int r,c; + for ( c = 0; c < ncols; c++ ) + cols[c] = FALSE; + + for ( r = 0; r < nrows; r++ ) + rows[r] = FALSE; + + for ( c = 0; c < ncols; c++ ) { + for ( r = 0; r < nrows; r++ ) { + if ( isWidgetTopLeft( r, c ) ) { + rows[r] = TRUE; + cols[c] = TRUE; + } + } + } +} + +bool Grid::locateWidget( QWidget* w, int& row, int& col, int& rowspan, int & colspan ) +{ + int r,c, r2, c2; + for ( c = 0; c < ncols; c++ ) { + for ( r = 0; r < nrows; r++ ) { + if ( cell( r, c ) == w ) { + row = 0; + for ( r2 = 1; r2 <= r; r2++ ) { + if ( rows[ r2-1 ] ) + row++; + } + col = 0; + for ( c2 = 1; c2 <= c; c2++ ) { + if ( cols[ c2-1 ] ) + col++; + } + rowspan = 0; + for ( r2 = r ; r2 < nrows && cell( r2, c) == w; r2++ ) { + if ( rows[ r2 ] ) + rowspan++; + } + colspan = 0; + for ( c2 = c; c2 < ncols && cell( r, c2) == w; c2++ ) { + if ( cols[ c2] ) + colspan++; + } + return TRUE; + } + } + } + return FALSE; +} + + + + +GridLayout::GridLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, const QSize &res, bool doSetup ) + : Layout( wl, p, fw, lb, doSetup ), resolution( res ) +{ + grid = 0; + if ( doSetup ) + setup(); +} + +GridLayout::~GridLayout() +{ + delete grid; +} + +void GridLayout::doLayout() +{ + bool needMove, needReparent; + if ( !prepareLayout( needMove, needReparent ) ) + return; + + QDesignerGridLayout *layout = (QDesignerGridLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::Grid ); + + if ( !grid ) + buildGrid(); + + QWidget* w; + int r, c, rs, cs; + for ( w = widgets.first(); w; w = widgets.next() ) { + if ( grid->locateWidget( w, r, c, rs, cs) ) { + if ( needReparent && w->parent() != layoutBase ) + w->reparent( layoutBase, 0, QPoint( 0, 0 ), FALSE ); + if ( rs * cs == 1 ) { + layout->addWidget( w, r, c, ::qt_cast(w) ? ( (Spacer*)w )->alignment() : 0 ); + } else { + layout->addMultiCellWidget( w, r, r+rs-1, c, c+cs-1, ::qt_cast(w) ? ( (Spacer*)w )->alignment() : 0 ); + } + if ( ::qt_cast(w) ) + ( (QLayoutWidget*)w )->updateSizePolicy(); + w->show(); + } else { + qWarning("ooops, widget '%s' does not fit in layout", w->name() ); + } + } + finishLayout( needMove, layout ); +} + +void GridLayout::setup() +{ + Layout::setup(); + buildGrid(); +} + +void GridLayout::buildGrid() +{ + if ( !widgets.count() ) + return; + + // Pixel to cell conversion: + // By keeping a list of start'n'stop values (x & y) for each widget, + // it is possible to create a very small grid of cells to represent + // the widget layout. + // ----------------------------------------------------------------- + + // We need a list of both start and stop values for x- & y-axis + QValueVector x( widgets.count()*2 ); + QValueVector y( widgets.count()*2 ); + + // Using push_back would look nicer, but operator[] is much faster + int index = 0; + QWidget* w = 0; + for ( w = widgets.first(); w; w = widgets.next() ) { + QRect widgetPos = w->geometry(); + x[index] = widgetPos.left(); + x[index+1] = widgetPos.right(); + y[index] = widgetPos.top(); + y[index+1] = widgetPos.bottom(); + index += 2; + } + + qHeapSort(x); + qHeapSort(y); + + // Remove duplicate x enteries (Remove next, if equal to current) + if ( !x.empty() ) { + for (QValueVector::iterator current = x.begin() ; + (current != x.end()) && ((current+1) != x.end()) ; ) + if ( (*current == *(current+1)) ) + x.erase(current+1); + else + current++; + } + + // Remove duplicate y enteries (Remove next, if equal to current) + if ( !y.empty() ) { + for (QValueVector::iterator current = y.begin() ; + (current != y.end()) && ((current+1) != y.end()) ; ) + if ( (*current == *(current+1)) ) + y.erase(current+1); + else + current++; + } + + // Create the smallest grid possible to represent the current layout + // Since no widget will be placed in the last row and column, we'll + // skip them to increase speed even further + delete grid; + grid = new Grid( y.size()-1, x.size()-1 ); + + // Mark the cells in the grid that contains a widget + for ( w = widgets.first(); w; w = widgets.next() ) { + QRect c(0,0,0,0), widgetPos = w->geometry(); + // From left til right (not including) + for (uint cw=0; cwsetCells(c, w); // Mark cellblock + } + grid->simplify(); +} + + + + + + + +Spacer::Spacer( QWidget *parent, const char *name ) + : QWidget( parent, name, WMouseNoMask ), + orient( Vertical ), interactive(TRUE), sh( QSize(20,20) ) +{ + setSizeType( Expanding ); + setAutoMask( TRUE ); +} + +void Spacer::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); + p.setPen( Qt::blue ); + + if ( orient == Horizontal ) { + const int dist = 3; + const int amplitude = QMIN( 3, height() / 3 ); + const int base = height() / 2; + int i = 0; + p.setPen( white ); + for ( i = 0; i < width() / 3 +2; ++i ) + p.drawLine( i * dist, base - amplitude, i * dist + dist / 2, base + amplitude ); + p.setPen( blue ); + for ( i = 0; i < width() / 3 +2; ++i ) + p.drawLine( i * dist + dist / 2, base + amplitude, i * dist + dist, base - amplitude ); + p.drawLine( 0, 0, 0, height() ); + p.drawLine( width() - 1, 0, width() - 1, height()); + } else { + const int dist = 3; + const int amplitude = QMIN( 3, width() / 3 ); + const int base = width() / 2; + int i = 0; + p.setPen( white ); + for ( i = 0; i < height() / 3 +2; ++i ) + p.drawLine( base - amplitude, i * dist, base + amplitude,i * dist + dist / 2 ); + p.setPen( blue ); + for ( i = 0; i < height() / 3 +2; ++i ) + p.drawLine( base + amplitude, i * dist + dist / 2, base - amplitude, i * dist + dist ); + p.drawLine( 0, 0, width(), 0 ); + p.drawLine( 0, height() - 1, width(), height() - 1 ); + } +} + +void Spacer::resizeEvent( QResizeEvent* e) +{ + QWidget::resizeEvent( e ); + if ( !parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout ) + sh = size(); +} + +void Spacer::updateMask() +{ + QRegion r( rect() ); + if ( orient == Horizontal ) { + const int amplitude = QMIN( 3, height() / 3 ); + const int base = height() / 2; + r = r.subtract( QRect(1, 0, width() - 2, base - amplitude ) ); + r = r.subtract( QRect(1, base + amplitude, width() - 2, height() - base - amplitude ) ); + } else { + const int amplitude = QMIN( 3, width() / 3 ); + const int base = width() / 2; + r = r.subtract( QRect(0, 1, base - amplitude, height() - 2 ) ); + r = r.subtract( QRect( base + amplitude, 1, width() - base - amplitude, height() - 2 ) ); + } + setMask( r ); +} + +void Spacer::setSizeType( SizeType t ) +{ + QSizePolicy sizeP; + if ( orient == Vertical ) + sizeP = QSizePolicy( QSizePolicy::Minimum, (QSizePolicy::SizeType)t ); + else + sizeP = QSizePolicy( (QSizePolicy::SizeType)t, QSizePolicy::Minimum ); + setSizePolicy( sizeP ); +} + + +Spacer::SizeType Spacer::sizeType() const +{ + if ( orient == Vertical ) + return (SizeType)sizePolicy().verData(); + return (SizeType)sizePolicy().horData(); +} + +int Spacer::alignment() const +{ + if ( orient == Vertical ) + return AlignHCenter; + return AlignVCenter; +} + +QSize Spacer::minimumSize() const +{ + QSize s = QSize( 20,20 ); + if ( sizeType() == Expanding ) + if ( orient == Vertical ) + s.rheight() = 0; + else + s.rwidth() = 0; + return s; +} + +QSize Spacer::sizeHint() const +{ + return sh; +} + + +void Spacer::setSizeHint( const QSize &s ) +{ + sh = s; + if ( !parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout ) + resize( sizeHint() ); + updateGeometry(); +} + +Qt::Orientation Spacer::orientation() const +{ + return orient; +} + +void Spacer::setOrientation( Qt::Orientation o ) +{ + if ( orient == o ) + return; + + SizeType st = sizeType(); + orient = o; + setSizeType( st ); + if ( interactive ) { + sh = QSize( sh.height(), sh.width() ); + if (!parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout ) + resize( height(), width() ); + } + updateMask(); + update(); + updateGeometry(); +} + + +void QDesignerGridLayout::addWidget( QWidget *w, int row, int col, int align_ ) +{ + items.insert( w, Item(row, col, 1, 1) ); + QGridLayout::addWidget( w, row, col, align_ ); +} + +void QDesignerGridLayout::addMultiCellWidget( QWidget *w, int fromRow, int toRow, + int fromCol, int toCol, int align_ ) +{ + items.insert( w, Item(fromRow, fromCol, toRow - fromRow + 1, toCol - fromCol +1) ); + QGridLayout::addMultiCellWidget( w, fromRow, toRow, fromCol, toCol, align_ ); +} diff --git a/kdevdesigner/designer/layout.h b/kdevdesigner/designer/layout.h new file mode 100644 index 00000000..2ead5d0d --- /dev/null +++ b/kdevdesigner/designer/layout.h @@ -0,0 +1,188 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LAYOUT_H +#define LAYOUT_H + +#include +#include +#include +#include +#include +#include +#include + +class FormWindow; +class QPaintEvent; + +class Layout : public QObject +{ + Q_OBJECT + +public: + Layout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup = TRUE, bool splitter = FALSE ); + virtual ~Layout() {} + + virtual void doLayout() = 0; + virtual void undoLayout(); + virtual void breakLayout(); + virtual bool prepareLayout( bool &needMove, bool &needReparent ); + virtual void finishLayout( bool needMove, QLayout *layout ); + +protected: + QWidgetList widgets; + QWidget *parent; + QPoint startPoint; + QMap, QRect> geometries; + QWidget *layoutBase; + FormWindow *formWindow; + QRect oldGeometry; + bool isBreak; + bool useSplitter; + +protected: + virtual void setup(); + +protected slots: + void widgetDestroyed(); + +}; + +class HorizontalLayout : public Layout +{ +public: + HorizontalLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup = TRUE, bool splitter = FALSE ); + + void doLayout(); + +protected: + void setup(); + +}; + +class VerticalLayout : public Layout +{ +public: + VerticalLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup = TRUE, bool splitter = FALSE ); + + void doLayout(); + +protected: + void setup(); + +}; + +class Grid; + +class GridLayout : public Layout +{ +public: + GridLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, const QSize &res, bool doSetup = TRUE ); + ~GridLayout(); + + void doLayout(); + +protected: + void setup(); + +protected: + void buildGrid(); + QSize resolution; + Grid* grid; + +}; + +class Spacer : public QWidget +{ + Q_OBJECT + + Q_OVERRIDE( QCString name ) + Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) + Q_ENUMS( SizeType ) + Q_PROPERTY( SizeType sizeType READ sizeType WRITE setSizeType ) + Q_PROPERTY( QSize sizeHint READ sizeHint WRITE setSizeHint DESIGNABLE true STORED true ) + Q_OVERRIDE( QRect geometry DESIGNABLE false ) + +private: + enum { HSize = 6, HMask = 0x3f, VMask = HMask << HSize, + MayGrow = 1, ExpMask = 2, MayShrink = 4 }; + +public: + enum SizeType { Fixed = 0, + Minimum = MayGrow, + Maximum = MayShrink, + Preferred = MayGrow|MayShrink , + MinimumExpanding = Minimum|ExpMask, + Expanding = MinimumExpanding|MayShrink }; + + Spacer( QWidget *parent, const char *name ); + + QSize minimumSize() const; + QSize sizeHint() const; + void setSizeType( SizeType t ); + SizeType sizeType() const; + int alignment() const; + Orientation orientation() const; + void setOrientation( Orientation o ); + void setInteraciveMode( bool b ) { interactive = b; }; + void setSizeHint( const QSize &s ); + +protected: + void paintEvent( QPaintEvent *e ); + void resizeEvent( QResizeEvent* e ); + void updateMask(); + Qt::Orientation orient; + bool interactive; + QSize sh; +}; + +class QDesignerGridLayout : public QGridLayout +{ + Q_OBJECT +public: + QDesignerGridLayout( QWidget *parent ) : QGridLayout( parent ){}; + QDesignerGridLayout( QLayout *parentLayout ) : QGridLayout( parentLayout ){}; + + void addWidget( QWidget *, int row, int col, int align = 0 ); + void addMultiCellWidget( QWidget *, int fromRow, int toRow, + int fromCol, int toCol, int align = 0 ); + + struct Item + { + Item(): row(0), column(0),rowspan(1),colspan(1){} + Item( int r, int c, int rs, int cs): row(r), column(c), rowspan(rs), colspan(cs){} + int row; + int column; + int rowspan; + int colspan; + Q_DUMMY_COMPARISON_OPERATOR( Item ) + }; + + QMap items; +}; + + +#endif diff --git a/kdevdesigner/designer/listboxdnd.cpp b/kdevdesigner/designer/listboxdnd.cpp new file mode 100644 index 00000000..a83ace44 --- /dev/null +++ b/kdevdesigner/designer/listboxdnd.cpp @@ -0,0 +1,305 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "listboxdnd.h" +#include +#include +#include +#include +#include + +// The Dragobject Declaration --------------------------------------- +class ListBoxItemDrag : public QStoredDrag +{ +public: + ListBoxItemDrag( ListBoxItemList & items, bool sendPtr = FALSE, QListBox * parent = 0, const char * name = 0 ); + ~ListBoxItemDrag() {}; + static bool canDecode( QDragMoveEvent * event ); + static bool decode( QDropEvent * event, QListBox * parent, QListBoxItem * insertPoint ); + enum ItemType { ListBoxText = 1, ListBoxPixmap = 2 }; +}; +// ------------------------------------------------------------------ + +ListBoxDnd::ListBoxDnd( QListBox * eventSource, const char * name ) + : ListDnd( eventSource, name ) { } + +void ListBoxDnd::confirmDrop( QListBoxItem * ) +{ + dropConfirmed = TRUE; +} + +bool ListBoxDnd::dropEvent( QDropEvent * event ) +{ + if ( dragInside ) { + + if ( dMode & NullDrop ) { // combined with Move, a NullDrop will delete an item + event->accept(); + emit dropped( 0 ); // a NullDrop + return TRUE; + } + + QPoint pos = event->pos(); + QListBoxItem * after = itemAt( pos ); + + if ( ListBoxItemDrag::decode( event, (QListBox *) src, after ) ) { + event->accept(); + QListBox * src = (QListBox *) this->src; + QListBoxItem * item = ( after ? after->next() : src->firstItem() ); + src->setCurrentItem( item ); + emit dropped( item ); // ###FIX: Supports only one item! + } + } + + line->hide(); + dragInside = FALSE; + + return TRUE; +} + +bool ListBoxDnd::mouseMoveEvent( QMouseEvent * event ) +{ + if ( event->state() & LeftButton ) { + if ( ( event->pos() - mousePressPos ).manhattanLength() > 3 ) { + + ListBoxItemList list; + buildList( list ); + ListBoxItemDrag * dragobject = new ListBoxItemDrag( list, (dMode & Internal), (QListBox *) src ); + + // Emit signal for all dragged items + QListBoxItem * i = list.first(); + while ( i ) { + emit dragged( i ); + i = list.next(); + } + + if ( dMode & Move ) { + removeList( list ); // "hide" items + } + + dragobject->dragCopy(); + + if ( dMode & Move ) { + if ( dropConfirmed ) { + // ###FIX: memleak ? in internal mode, only pointers are transfered... + //list.setAutoDelete( TRUE ); + list.clear(); + dropConfirmed = FALSE; + } + insertList( list ); // "show" items + } + } + } + return FALSE; +} + +int ListBoxDnd::buildList( ListBoxItemList & list ) +{ + QListBoxItem * i = ((QListBox *)src)->firstItem(); + while ( i ) { + if ( i->isSelected() ) { + ((QListBox *)src)->setSelected( i, FALSE ); + list.append( i ); + } + i = i->next(); + } + return list.count(); +} + +void ListBoxDnd::insertList( ListBoxItemList & list ) +{ + QListBoxItem * i = list.first(); + while ( i ) { + ((QListBox *)src)->insertItem( i, i->prev() ); + i = list.next(); + } +} + +void ListBoxDnd::removeList( ListBoxItemList & list ) +{ + QListBoxItem * i = list.first(); + while ( i ) { + ((QListBox *)src)->takeItem( i ); // remove item from QListBox + i = list.next(); + } +} + +void ListBoxDnd::updateLine( const QPoint & dragPos ) +{ + QListBox * src = (QListBox *) this->src; + QListBoxItem *item = itemAt( dragPos ); + + int ypos = item ? + ( src->itemRect( item ).bottom() - ( line->height() / 2 ) ) : + ( src->itemRect( ((QListBox *)src)->firstItem() ).top() ); + + line->resize( src->viewport()->width(), line->height() ); + line->move( 0, ypos ); +} + +QListBoxItem * ListBoxDnd::itemAt( QPoint pos ) +{ + QListBox * src = (QListBox *) this->src; + QListBoxItem * result = src->itemAt( pos ); + QListBoxItem * last = src->item( src->count() - 1 ); + int i = src->index( result ); + + if ( result && ( pos.y() < (src->itemRect(result).top() + src->itemHeight(i)/2) ) ) + result = result->prev(); + else if ( !result && pos.y() > src->itemRect( last ).bottom() ) + result = last; + + return result; +} + +bool ListBoxDnd::canDecode( QDragEnterEvent * event ) +{ + return ListBoxItemDrag::canDecode( event ); +} + + +// ------------------------------------------------------------------ +// The Dragobject Implementation ------------------------------------ +// ------------------------------------------------------------------ + +ListBoxItemDrag::ListBoxItemDrag( ListBoxItemList & items, bool sendPtr, QListBox * parent, const char * name ) + : QStoredDrag( "qt/listboxitem", parent, name ) +{ + // ### FIX! + QByteArray data( sizeof( Q_INT32 ) + sizeof( QListBoxItem ) * items.count() ); + QDataStream stream( data, IO_WriteOnly ); + + stream << items.count(); + stream << (Q_UINT8) sendPtr; // just transfer item pointer; omit data + + QListBoxItem * i = items.first(); + + if ( sendPtr ) { + + while ( i ) { + + stream << (Q_ULONG) i; //###FIX: demands sizeof(ulong) >= sizeof(void*) + i = items.next(); + + } + + } else { + + while ( i ) { + + Q_UINT8 b = 0; + + b = (Q_UINT8) ( i->text() != QString::null ); // does item have text ? + stream << b; + if ( b ) { + stream << i->text(); + } + + b = (Q_UINT8) ( !!i->pixmap() ); // does item have a pixmap ? + stream << b; + if ( b ) { + stream << ( *i->pixmap() ); + } + + stream << (Q_UINT8) i->isSelectable(); + + i = items.next(); + } + + } + + setEncodedData( data ); +} + +bool ListBoxItemDrag::canDecode( QDragMoveEvent * event ) +{ + return event->provides( "qt/listboxitem" ); +} + +bool ListBoxItemDrag::decode( QDropEvent * event, QListBox * parent, QListBoxItem * after ) +{ + QByteArray data = event->encodedData( "qt/listboxitem" ); + + if ( data.size() ) { + event->accept(); + QDataStream stream( data, IO_ReadOnly ); + + int count = 0; + stream >> count; + + Q_UINT8 recievePtr = 0; // data contains just item pointers; no data + stream >> recievePtr; + + QListBoxItem * item = 0; + + if ( recievePtr ) { + + for( int i = 0; i < count; i++ ) { + + Q_ULONG p = 0; //###FIX: demands sizeof(ulong) >= sizeof(void*) + stream >> p; + item = (QListBoxItem *) p; + + parent->insertItem( item, after ); + + } + + } else { + + for ( int i = 0; i < count; i++ ) { + + Q_UINT8 hasText = 0; + QString text; + stream >> hasText; + if ( hasText ) { + stream >> text; + } + + Q_UINT8 hasPixmap = 0; + QPixmap pixmap; + stream >> hasPixmap; + if ( hasPixmap ) { + stream >> pixmap; + } + + Q_UINT8 isSelectable = 0; + stream >> isSelectable; + + if ( hasPixmap ) { + item = new QListBoxPixmap( parent, pixmap, text, after ); + } else { + item = new QListBoxText( parent, text, after ); + } + + item->setSelectable( isSelectable ); + + } + + } + + return TRUE; + } + return FALSE; +} diff --git a/kdevdesigner/designer/listboxdnd.h b/kdevdesigner/designer/listboxdnd.h new file mode 100644 index 00000000..c0f91845 --- /dev/null +++ b/kdevdesigner/designer/listboxdnd.h @@ -0,0 +1,63 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LISTBOXDND_H +#define LISTBOXDND_H + +#include +#include +#include "listdnd.h" + +typedef QPtrList ListBoxItemList; + +class ListBoxDnd : public ListDnd +{ + Q_OBJECT +public: + // dragModes are enumerated in ListDnd + ListBoxDnd( QListBox * eventSource, const char * name = 0 ); + +signals: + void dropped( QListBoxItem * ); + void dragged( QListBoxItem * ); + +public slots: + void confirmDrop( QListBoxItem * ); + +protected: + virtual bool dropEvent( QDropEvent * event ); + virtual bool mouseMoveEvent( QMouseEvent * event ); + virtual void updateLine( const QPoint & pos ); + virtual bool canDecode( QDragEnterEvent * event ); + +private: + QListBoxItem * itemAt( QPoint pos ); + int buildList( ListBoxItemList & list ); + void insertList( ListBoxItemList & list ); + void removeList( ListBoxItemList & list ); +}; + +#endif //LISTBOXDND_H diff --git a/kdevdesigner/designer/listboxeditor.ui b/kdevdesigner/designer/listboxeditor.ui new file mode 100644 index 00000000..ce3d4b79 --- /dev/null +++ b/kdevdesigner/designer/listboxeditor.ui @@ -0,0 +1,457 @@ + +ListBoxEditorBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ListBoxEditorBase + + + + 0 + 0 + 482 + 229 + + + + Edit Listbox + + + true + + + <b>Edit Listbox</b><p>Add, edit or delete items in the listbox.</p><p>Click the <b>New Item</b>-button to create a new listbox entry, then enter text and choose a pixmap.</p><p>Select an item from the list and click the <b>Delete Item</b>-button to remove the item from the list.</p> + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonApply + + + &Apply + + + true + + + Apply all changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + preview + + + Delete Item + + + The list of items. + + + + + GroupBox1 + + + &Item Properties + + + + unnamed + + + 11 + + + 6 + + + + Label2 + + + &Pixmap: + + + itemChoosePixmap + + + + + itemPixmap + + + Label4 + + + + + itemDeletePixmap + + + + 30 + 22 + + + + + + + "designer_s_editcut.png" + + + Delete Pixmap + + + Delete the selected item's pixmap. + + + + + itemChoosePixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + Choose a pixmap file for the selected item. + + + + + Label1 + + + &Text: + + + itemText + + + + + itemText + + + + 0 + 0 + + + + Change text + + + Change the selected item's text. + + + + + + + itemNew + + + &New Item + + + Add an item + + + <b>Add a new item.</b><p>New items are appended to the list.</p> + + + + + itemDelete + + + &Delete Item + + + Delete Item + + + Delete the selected item + + + + + Vertical Spacing1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + itemUp + + + + + + "designer_s_up.png" + + + Move up + + + Moves the selected item up. + + + + + itemDown + + + + + + "designer_s_down.png" + + + Move down + + + Move the selected item down. + + + + + + + itemNew + clicked() + ListBoxEditorBase + insertNewItem() + + + itemDelete + clicked() + ListBoxEditorBase + deleteCurrentItem() + + + itemText + textChanged( const QString & ) + ListBoxEditorBase + currentTextChanged(const QString&) + + + buttonOk + clicked() + ListBoxEditorBase + okClicked() + + + buttonApply + clicked() + ListBoxEditorBase + applyClicked() + + + buttonCancel + clicked() + ListBoxEditorBase + cancelClicked() + + + itemChoosePixmap + clicked() + ListBoxEditorBase + choosePixmap() + + + itemDeletePixmap + clicked() + ListBoxEditorBase + deletePixmap() + + + itemUp + clicked() + ListBoxEditorBase + moveItemUp() + + + itemDown + clicked() + ListBoxEditorBase + moveItemDown() + + + preview + selectionChanged(QListBoxItem*) + ListBoxEditorBase + currentItemChanged(QListBoxItem*) + + + preview + currentChanged( QListBoxItem * ) + ListBoxEditorBase + currentItemChanged(QListBoxItem*) + + + + buttonOk + buttonCancel + preview + itemNew + itemDelete + itemUp + itemDown + itemText + itemDeletePixmap + itemChoosePixmap + helpButton + buttonApply + + + init() + destroy() + insertNewItem() + deleteCurrentItem() + currentItemChanged( QListBoxItem * ) + currentTextChanged( const QString & ) + okClicked() + cancelClicked() + applyClicked() + choosePixmap() + deletePixmap() + moveItemUp() + moveItemDown() + + + myiconloader.h + +BarIcon2 + + diff --git a/kdevdesigner/designer/listboxeditorimpl.cpp b/kdevdesigner/designer/listboxeditorimpl.cpp new file mode 100644 index 00000000..d19f22b2 --- /dev/null +++ b/kdevdesigner/designer/listboxeditorimpl.cpp @@ -0,0 +1,245 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "listboxeditorimpl.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "pixmapchooser.h" +#include "command.h" +#include "listboxdnd.h" +#include "listboxrename.h" + +#include +#include +#include +#include +#include + +#include + +ListBoxEditor::ListBoxEditor( QWidget *parent, QWidget *editWidget, FormWindow *fw ) + : ListBoxEditorBase( parent, 0, TRUE ), formwindow( fw ) +{ + connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + listbox = (QListBox*)editWidget; + + itemText->setText( "" ); + itemText->setEnabled( FALSE ); + itemPixmap->setText( "" ); + itemChoosePixmap->setEnabled( FALSE ); + itemDeletePixmap->setEnabled( FALSE ); + + QListBoxItem *i = 0; + for ( i = listbox->firstItem(); i; i = i->next() ) { + if ( i->pixmap() ) + (void)new QListBoxPixmap( preview, *i->pixmap(), i->text() ); + else + (void)new QListBoxText( preview, i->text() ); + } + + if ( preview->firstItem() ) + preview->setCurrentItem( preview->firstItem() ); + + ListBoxDnd *editorDnd = new ListBoxDnd( preview ); + editorDnd->setDragMode( ListBoxDnd::Internal | ListBoxDnd::Move ); + QObject::connect( editorDnd, SIGNAL( dropped( QListBoxItem * ) ), + editorDnd, SLOT( confirmDrop( QListBoxItem * ) ) ); + + ListBoxRename *editorRename = new ListBoxRename( preview ); + + QObjectList *l = parent->queryList( "QLineEdit", "itemText" ); + QObjectListIt it( *l ); + QObject *obj; + while ( (obj = it.current()) != 0 ) { + ++it; + QObject::connect( editorRename, + SIGNAL( itemTextChanged( const QString & ) ), + obj, + SLOT( setText( const QString & ) ) ); + } + delete l; + +} + +void ListBoxEditor::insertNewItem() +{ + QListBoxItem *i = new QListBoxText( preview, i18n("New Item") ); + preview->setCurrentItem( i ); + preview->setSelected( i, TRUE ); + itemText->setFocus(); + itemText->selectAll(); +} + +void ListBoxEditor::deleteCurrentItem() +{ + delete preview->item( preview->currentItem() ); + if ( preview->currentItem() != -1 ) + preview->setSelected( preview->currentItem(), TRUE ); +} + +void ListBoxEditor::currentItemChanged( QListBoxItem *i ) +{ + itemText->blockSignals( TRUE ); + itemText->setText( "" ); + itemPixmap->setText( "" ); + itemText->blockSignals( FALSE ); + + if ( !i ) { + itemText->setEnabled( FALSE ); + itemChoosePixmap->setEnabled( FALSE ); + itemDeletePixmap->setEnabled( FALSE ); + return; + } + + itemText->blockSignals( TRUE ); + itemText->setEnabled( TRUE ); + itemChoosePixmap->setEnabled( TRUE ); + itemDeletePixmap->setEnabled( i->pixmap() && !i->pixmap()->isNull() ); + + itemText->setText( i->text() ); + if ( i->pixmap() ) + itemPixmap->setPixmap( *i->pixmap() ); + itemText->blockSignals( FALSE ); +} + +void ListBoxEditor::currentTextChanged( const QString &txt ) +{ + if ( preview->currentItem() == -1 ) + return; + + preview->blockSignals( TRUE ); + if ( preview->item( preview->currentItem() )->pixmap() ) + preview->changeItem( *preview->item( preview->currentItem() )->pixmap(), txt, preview->currentItem() ); + else + preview->changeItem( txt, preview->currentItem() ); + preview->blockSignals( FALSE ); +} + +void ListBoxEditor::okClicked() +{ + applyClicked(); + accept(); +} + +void ListBoxEditor::cancelClicked() +{ + reject(); +} + +void ListBoxEditor::applyClicked() +{ + QListBoxItem *i = 0; + QValueList items; + for ( i = preview->firstItem(); i; i = i->next() ) { + PopulateListBoxCommand::Item item; + if ( i->pixmap() ) + item.pix = *i->pixmap(); + item.text = i->text(); + items.append( item ); + } + + PopulateListBoxCommand *cmd = new PopulateListBoxCommand( i18n( "Edit the Items of '%1'" ).arg( listbox->name() ), + formwindow, listbox, items ); + cmd->execute(); + formwindow->commandHistory()->addCommand( cmd ); +} + +void ListBoxEditor::choosePixmap() +{ + if ( preview->currentItem() == -1 ) + return; + + QPixmap pix; + if ( preview->item( preview->currentItem() )->pixmap() ) + pix = qChoosePixmap( this, formwindow, *preview->item( preview->currentItem() )->pixmap() ); + else + pix = qChoosePixmap( this, formwindow, QPixmap() ); + + if ( pix.isNull() ) + return; + + QString txt = preview->item( preview->currentItem() )->text(); + preview->changeItem( pix, txt, preview->currentItem() ); + itemDeletePixmap->setEnabled( TRUE ); +} + +void ListBoxEditor::moveItemUp() +{ + if ( preview->currentItem() < 1 ) + return; + + QListBoxItem *i = preview->item( preview->currentItem() ); + bool hasPix = (i->pixmap() != 0); + QPixmap pix; + if ( hasPix ) + pix = *i->pixmap(); + QString txt = i->text(); + + QListBoxItem *p = i->prev(); + if ( p->pixmap() ) + preview->changeItem( *p->pixmap(), p->text(), preview->currentItem() ); + else + preview->changeItem( p->text(), preview->currentItem() ); + + if ( hasPix ) + preview->changeItem( pix, txt, preview->currentItem() - 1 ); + else + preview->changeItem( txt, preview->currentItem() - 1 ); +} + +void ListBoxEditor::moveItemDown() +{ + if ( preview->currentItem() == -1 || preview->currentItem() > (int)preview->count() - 2 ) + return; + + QListBoxItem *i = preview->item( preview->currentItem() ); + bool hasPix = (i->pixmap() != 0); + QPixmap pix; + if ( hasPix ) + pix = *i->pixmap(); + QString txt = i->text(); + + QListBoxItem *n = i->next(); + if ( n->pixmap() ) + preview->changeItem( *n->pixmap(), n->text(), preview->currentItem() ); + else + preview->changeItem( n->text(), preview->currentItem() ); + + if ( hasPix ) + preview->changeItem( pix, txt, preview->currentItem() + 1 ); + else + preview->changeItem( txt, preview->currentItem() + 1 ); +} + +void ListBoxEditor::deletePixmap() +{ + if ( preview->currentItem() == -1 ) + return; + + QListBoxItem *i = preview->item( preview->currentItem() ); + preview->changeItem( i->text(), preview->currentItem() ); + itemDeletePixmap->setEnabled( FALSE ); +} diff --git a/kdevdesigner/designer/listboxeditorimpl.h b/kdevdesigner/designer/listboxeditorimpl.h new file mode 100644 index 00000000..3719bc59 --- /dev/null +++ b/kdevdesigner/designer/listboxeditorimpl.h @@ -0,0 +1,61 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LISTBOXEDITORIMPL_H +#define LISTBOXEDITORIMPL_H + +class QListBox; +class FormWindow; + +#include "listboxeditor.h" + +class ListBoxEditor : public ListBoxEditorBase +{ + Q_OBJECT + +public: + ListBoxEditor( QWidget *parent, QWidget *editWidget, FormWindow *fw ); + +protected slots: + void insertNewItem(); + void deleteCurrentItem(); + void currentItemChanged( QListBoxItem * ); + void currentTextChanged( const QString & ); + void okClicked(); + void cancelClicked(); + void applyClicked(); + void choosePixmap(); + void moveItemUp(); + void moveItemDown(); + void deletePixmap(); + +private: + QListBox *listbox; + FormWindow *formwindow; + +}; + +#endif diff --git a/kdevdesigner/designer/listboxrename.cpp b/kdevdesigner/designer/listboxrename.cpp new file mode 100644 index 00000000..464ef412 --- /dev/null +++ b/kdevdesigner/designer/listboxrename.cpp @@ -0,0 +1,157 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include +#include +#include +#include "listboxrename.h" + +class EditableListBoxItem : public QListBoxItem +{ +public: + void setText( const QString & text ) + { + QListBoxItem::setText( text ); + } +}; + +ListBoxRename::ListBoxRename( QListBox * eventSource, const char * name ) + : QObject( eventSource, name ), + clickedItem( 0 ), activity( FALSE ) +{ + src = eventSource; + src->installEventFilter( this ); + ed = new QLineEdit( src->viewport() ); + ed->hide(); + ed->setFrame( FALSE ); + + QObject::connect( ed, SIGNAL( returnPressed() ), + this, SLOT( renameClickedItem() ) ); +} + +bool ListBoxRename::eventFilter( QObject *, QEvent * event ) +{ + switch ( event->type() ) { + + case QEvent::MouseButtonPress: + { + QPoint pos = ((QMouseEvent *) event)->pos(); + + if ( clickedItem && + clickedItem->isSelected() && + (clickedItem == src->itemAt( pos )) ) { + QTimer::singleShot( 500, this, SLOT( showLineEdit() ) ); + activity = FALSE; // no drags or clicks for 500 ms before we start the renaming + } else { // new item clicked + activity = TRUE; + clickedItem = src->itemAt( pos ); + ed->hide(); + } + } + break; + + case QEvent::MouseMove: + + if ( ((QMouseEvent *) event)->state() & Qt::LeftButton ) { + activity = TRUE; // drag + } + break; + + case QEvent::KeyPress: + + switch ( ((QKeyEvent *) event)->key() ) { + + case Qt::Key_F2: + + activity = FALSE; + clickedItem = src->item( src->currentItem() ); + showLineEdit(); + break; + + case Qt::Key_Escape: + if ( !ed->isHidden() ) { + hideLineEdit(); // abort rename + return TRUE; + } + break; + + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_PageUp: + case Qt::Key_PageDown: + + if ( !ed->isHidden() ) + return TRUE; // Filter out the keystrokes + break; + + } + break; + + case QEvent::Resize: + + if ( clickedItem && ed && !ed->isHidden() ) { + QRect rect = src->itemRect( clickedItem ); + ed->resize( rect.right() - rect.left() - 1, + rect.bottom() - rect.top() - 1 ); + } + break; + + default: + break; + } + + return FALSE; +} + +void ListBoxRename::showLineEdit() +{ + if ( !clickedItem || activity ) + return; + QRect rect = src->itemRect( clickedItem ); + ed->resize( rect.right() - rect.left() - 1, + rect.bottom() - rect.top() - 1 ); + ed->move( rect.left() + 1, rect.top() + 1 ); + ed->setText( clickedItem->text() ); + ed->selectAll(); + ed->show(); + ed->setFocus(); +} + +void ListBoxRename::hideLineEdit() +{ + ed->hide(); + clickedItem = 0; + src->setFocus(); +} + +void ListBoxRename::renameClickedItem() +{ + if ( clickedItem && ed ) { + ( (EditableListBoxItem *) clickedItem )->setText( ed->text() ); + emit itemTextChanged( ed->text() ); + } + hideLineEdit(); +} diff --git a/kdevdesigner/designer/listboxrename.h b/kdevdesigner/designer/listboxrename.h new file mode 100644 index 00000000..cdb6d67b --- /dev/null +++ b/kdevdesigner/designer/listboxrename.h @@ -0,0 +1,57 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LISTBOXRENAME_H +#define LISTBOXRENAME_H + +#include +#include + +class QLineEdit; + +class ListBoxRename : public QObject +{ + Q_OBJECT +public: + ListBoxRename( QListBox * eventSource, const char * name = 0 ); + bool eventFilter( QObject *, QEvent * event ); + +signals: + void itemTextChanged( const QString & ); + +public slots: + void showLineEdit(); + void hideLineEdit(); + void renameClickedItem(); + +private: + QListBoxItem * clickedItem; + QListBox * src; + QLineEdit * ed; + bool activity; +}; + +#endif //LISTBOXRENAME_H diff --git a/kdevdesigner/designer/listdnd.cpp b/kdevdesigner/designer/listdnd.cpp new file mode 100644 index 00000000..34562e6f --- /dev/null +++ b/kdevdesigner/designer/listdnd.cpp @@ -0,0 +1,142 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "listdnd.h" +#include +#include + +ListDnd::ListDnd( QScrollView * eventSource, const char * name ) + : QObject( eventSource, name ), + dragInside( FALSE ), dragDelete( TRUE ), dropConfirmed( FALSE ), dMode( Both ) +{ + src = eventSource; + src->setAcceptDrops( TRUE ); + src->installEventFilter( this ); + src->viewport()->installEventFilter( this ); + + line = new QWidget( src->viewport(), 0, Qt::WStyle_NoBorder | WStyle_StaysOnTop ); + line->setBackgroundColor( Qt::black ); + line->resize( src->viewport()->width(), 2 ); + line->hide(); +} + +void ListDnd::setDragMode( int mode ) +{ + dMode = mode; +} + +int ListDnd::dragMode() const +{ + return dMode; +} + +bool ListDnd::eventFilter( QObject *, QEvent * event ) +{ + switch ( event->type() ) { + case QEvent::DragEnter: + return dragEnterEvent( (QDragEnterEvent *) event ); + case QEvent::DragLeave: + return dragLeaveEvent( (QDragLeaveEvent *) event ); + case QEvent::DragMove: + return dragMoveEvent( (QDragMoveEvent *) event ); + case QEvent::Drop: + return dropEvent( (QDropEvent *) event ); + case QEvent::MouseButtonPress: + return mousePressEvent( (QMouseEvent *) event ); + case QEvent::MouseMove: + return mouseMoveEvent( (QMouseEvent *) event ); + default: + break; + } + return FALSE; +} + + +bool ListDnd::dragEnterEvent( QDragEnterEvent * event ) +{ + if ( dMode == None ) { + return TRUE; + } + + bool ok = ( ( ( dMode & Both ) == Both ) || + ( ( dMode & Internal ) && ( event->source() == src ) ) || + ( ( dMode & External ) && ( event->source() != src ) ) ); + + if ( ok && canDecode( event ) ) { + event->accept(); + dragInside = TRUE; + if ( !( dMode & NullDrop ) ) { + updateLine( event->pos() ); + line->show(); + } + } + return TRUE; +} + +bool ListDnd::dragLeaveEvent( QDragLeaveEvent * ) +{ + dragInside = FALSE; + line->hide(); + return TRUE; +} + +bool ListDnd::dragMoveEvent( QDragMoveEvent * event ) +{ + if ( dragInside && dMode && !( dMode & NullDrop ) ) { + updateLine( event->pos() ); + } + return TRUE; +} + +bool ListDnd::dropEvent( QDropEvent * ) +{ + // do nothing + return FALSE; +} + +bool ListDnd::mousePressEvent( QMouseEvent * event ) +{ + if ( event->button() == LeftButton ) + mousePressPos = event->pos(); + return FALSE; +} + +bool ListDnd::mouseMoveEvent( QMouseEvent * ) +{ + // do nothing + return FALSE; +} + +void ListDnd::updateLine( const QPoint & ) +{ + // do nothing +} + +bool ListDnd::canDecode( QDragEnterEvent * ) +{ + // do nothing + return FALSE; +} diff --git a/kdevdesigner/designer/listdnd.h b/kdevdesigner/designer/listdnd.h new file mode 100644 index 00000000..9e3e6351 --- /dev/null +++ b/kdevdesigner/designer/listdnd.h @@ -0,0 +1,63 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LISTDND_H +#define LISTDND_H + +#include +#include + +class ListDnd : public QObject +{ + Q_OBJECT +public: + enum DragMode { None = 0, External = 1, Internal = 2, Both = 3, Move = 4, NullDrop = 8 }; + ListDnd( QScrollView * eventSource, const char * name = 0 ); + void setDragMode( int mode ); + int dragMode() const; + bool eventFilter( QObject *, QEvent * event ); + +protected: + virtual bool dragEnterEvent( QDragEnterEvent * event ); + virtual bool dragLeaveEvent( QDragLeaveEvent * ); + virtual bool dragMoveEvent( QDragMoveEvent * event ); + virtual bool dropEvent( QDropEvent * event ); + virtual bool mousePressEvent( QMouseEvent * event ); + virtual bool mouseMoveEvent( QMouseEvent * event ); + virtual void updateLine( const QPoint & dragPos ); + virtual bool canDecode( QDragEnterEvent * event ); + + QScrollView * src; + QWidget * line; + QPoint mousePressPos; + QPoint dragPos; + bool dragInside; + bool dragDelete; + bool dropConfirmed; + int dMode; +}; + +#endif // LISTDND_H diff --git a/kdevdesigner/designer/listeditor.ui b/kdevdesigner/designer/listeditor.ui new file mode 100644 index 00000000..6118ba2b --- /dev/null +++ b/kdevdesigner/designer/listeditor.ui @@ -0,0 +1,179 @@ + +ListEditor +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ListEditor + + + + 0 + 0 + 331 + 301 + + + + Edit + + + + unnamed + + + 11 + + + 6 + + + + + Column 1 + + + true + + + true + + + + listview + + + Extended + + + AllColumns + + + + + PushButton1 + + + &Add + + + + + PushButton2 + + + &Remove + + + + + PushButton3 + + + Re&name + + + + + PushButton4 + + + &Close + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + PushButton1 + clicked() + ListEditor + addItem() + + + PushButton2 + clicked() + ListEditor + removeItems() + + + PushButton4 + clicked() + ListEditor + accept() + + + listview + itemRenamed(QListViewItem*,int) + ListEditor + renamed(QListViewItem*) + + + PushButton3 + clicked() + ListEditor + renameItem() + + + + listeditor.ui.h + + + class QStringList; + + + init() + setList( const QStringList & l ) + addItem() + renamed( QListViewItem * i ) + removeItems() + items() + renameItem() + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/listeditor.ui.h b/kdevdesigner/designer/listeditor.ui.h new file mode 100644 index 00000000..bba06104 --- /dev/null +++ b/kdevdesigner/designer/listeditor.ui.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + +#include +#include + +void ListEditor::init() +{ + listview->header()->hide(); + listview->setSorting( -1 ); + listview->setDefaultRenameAction( QListView::Accept ); +} + +void ListEditor::setList( const QStringList &l ) +{ + QListViewItem *i = 0; + for ( QStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) { + i = new QListViewItem( listview, i ); + i->setText( 0, *it ); + i->setRenameEnabled( 0, TRUE ); + } +} + +void ListEditor::addItem() +{ + QListViewItem *i = new QListViewItem( listview, listview->lastItem() ); + i->setRenameEnabled( 0, TRUE ); + qApp->processEvents(); + i->startRename( 0 ); +} + +void ListEditor::renamed( QListViewItem *i ) +{ + if ( i && i->text( 0 ).isEmpty() ) + i->startRename( 0 ); +} + +void ListEditor::removeItems() +{ + QListViewItemIterator it( listview ); + QListViewItem *i = 0; + while ( ( i = it.current() ) ) { + ++it; + if ( i->isSelected() ) + delete i; + } +} + +QStringList ListEditor::items() +{ + QStringList l; + QListViewItemIterator it( listview ); + QListViewItem *i = 0; + while ( ( i = it.current() ) ) { + ++it; + if ( !i->text( 0 ).isEmpty() ) + l << i->text( 0 ); + } + return l; +} + +void ListEditor::renameItem() +{ + QListViewItem *i = listview->currentItem(); + if ( i ) + i->startRename( 0 ); +} diff --git a/kdevdesigner/designer/listviewdnd.cpp b/kdevdesigner/designer/listviewdnd.cpp new file mode 100644 index 00000000..b4098237 --- /dev/null +++ b/kdevdesigner/designer/listviewdnd.cpp @@ -0,0 +1,432 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "listviewdnd.h" +#include +#include +#include +#include +#include + +// The Dragobject Declaration --------------------------------------- +class ListViewItemDrag : public QStoredDrag +{ +public: + enum DropRelation { Sibling, Child }; + ListViewItemDrag( ListViewItemList & items, QWidget * parent = 0, const char * name = 0 ); + ~ListViewItemDrag() {}; + static bool canDecode( QDragMoveEvent * event ); + static bool decode( QDropEvent * event, QListView * parent, QListViewItem * insertPoint, DropRelation dr ); +}; +// ------------------------------------------------------------------ + +ListViewDnd::ListViewDnd( QListView * eventSource, const char * name ) + : ListDnd( eventSource, name ) { } + +void ListViewDnd::confirmDrop( QListViewItem * ) +{ + dropConfirmed = TRUE; +} + +bool ListViewDnd::dropEvent( QDropEvent * event ) +{ + if ( dragInside ) { + + if ( dMode & NullDrop ) { // combined with Move, a NullDrop will delete an item + event->accept(); + emit dropped( 0 ); // a NullDrop + return TRUE; + } + + QPoint pos = event->pos(); + + ListViewItemDrag::DropRelation dr = ListViewItemDrag::Sibling; + QListViewItem *item = itemAt( pos ); + int dpos = dropDepth( item, pos ); + + if ( item ) { + if ( dpos > item->depth() && !(dMode & Flat) ) { + // Child node + dr = ListViewItemDrag::Child; + } else if ( dpos < item->depth() ) { + // Parent(s) Sibling + while ( item && (item->depth() > dpos) ) + item = item->parent(); + } + } + + if ( ListViewItemDrag::decode( event, (QListView *) src, item, dr ) ) { + event->accept(); + emit dropped( 0 ); // Use ID instead of item? + } + } + + line->hide(); + dragInside = FALSE; + + return TRUE; +} + +bool ListViewDnd::mouseMoveEvent( QMouseEvent * event ) +{ + if ( event->state() & LeftButton ) { + if ( ( event->pos() - mousePressPos ).manhattanLength() > 3 ) { + ListViewItemList list; + + if ( dMode & Flat ) + buildFlatList( list ); + else + buildTreeList( list ); + + ListViewItemDrag * dragobject = new ListViewItemDrag( list, (QListView *) src ); + + if ( dMode & Move ) { + disabledItems = list; + setVisibleItems( FALSE ); + } + + dragobject->dragCopy(); + + if ( dMode & Move ) { + // Did the target accept the drop? + if ( dropConfirmed ) { + // Shouldn't autoDelete handle this? + for( list.first(); list.current(); list.next() ) + delete list.current(); + dropConfirmed = FALSE; + } else { + // Reenable disabled items since + // drag'n'drop was aborted + setVisibleItems( TRUE ); + } + disabledItems.clear(); + } + } + } + return FALSE; +} + +int ListViewDnd::buildFlatList( ListViewItemList & list ) +{ + bool addKids = FALSE; + QListViewItem *nextSibling = 0; + QListViewItem *nextParent = 0; + QListViewItemIterator it = ((QListView *)src)->firstChild(); + for ( ; *it; it++ ) { + // Hit the nextSibling, turn of child processing + if ( (*it) == nextSibling ) + addKids = FALSE; + + if ( (*it)->isSelected() ) { + if ( (*it)->childCount() == 0 ) { + // Selected, no children + list.append( *it ); + } else if ( !addKids ) { + // Children processing not set, so set it + // Also find the item were we shall quit + // processing children...if any such item + addKids = TRUE; + nextSibling = (*it)->nextSibling(); + nextParent = (*it)->parent(); + while ( nextParent && !nextSibling ) { + nextSibling = nextParent->nextSibling(); + nextParent = nextParent->parent(); + } + } + } else if ( ((*it)->childCount() == 0) && addKids ) { + // Leaf node, and we _do_ process children + list.append( *it ); + } + } + return list.count(); +} + +int ListViewDnd::buildTreeList( ListViewItemList & list ) +{ + QListViewItemIterator it = ((QListView *)src)->firstChild(); + for ( ; *it; it++ ) { + if ( (*it)->isSelected() ) + list.append( *it ); + } + return list.count(); +} + +void ListViewDnd::setVisibleItems( bool b ) +{ + if ( disabledItems.isEmpty() ) + return; + + disabledItems.first(); + do { + disabledItems.current()->setVisible( b ); + } while ( disabledItems.next() ); +} + +void ListViewDnd::updateLine( const QPoint & dragPos ) +{ + QListViewItem * item = itemAt(dragPos); + QListView * src = (QListView *) this->src; + + int ypos = item ? + ( src->itemRect( item ).bottom() - ( line->height() / 2 ) ) : + ( src->itemRect( src->firstChild() ).top() ); + + int xpos = dropDepth( item, dragPos ) * src->treeStepSize(); + line->resize( src->viewport()->width() - xpos, line->height() ); + line->move( xpos, ypos ); +} + +QListViewItem * ListViewDnd::itemAt( QPoint pos ) +{ + QListView * src = (QListView *) this->src; + int headerHeight = (int)(src->header()->height()); + pos.ry() -= headerHeight; + QListViewItem * result = src->itemAt( pos ); + + if ( result && ( pos.ry() < (src->itemPos(result) + result->height()/2) ) ) + result = result->itemAbove(); + + // Wind back if has parent, and we're in flat mode + while ( result && result->parent() && (dMode & Flat) ) + result = result->parent(); + + // Wind back if has parent, and we're in flat mode + while ( result && !result->isVisible() && result->parent() ) + result = result->parent(); + + if ( !result && src->firstChild() && (pos.y() > src->itemRect(src->firstChild()).bottom()) ) { + result = src->lastItem(); + if ( !result->isVisible() ) + // Handle special case where last item is actually hidden + result = result->itemAbove(); + } + + return result; +} + +int ListViewDnd::dropDepth( QListViewItem * item, QPoint pos ) +{ + if ( !item || (dMode & Flat) ) + return 0; + + int result = 0; + int itemDepth = item->depth(); + int indentSize = ((QListView *)src)->treeStepSize(); + int itemLeft = indentSize * itemDepth; + int childMargin = indentSize*2; + if ( pos.x() > itemLeft + childMargin ) { + result = itemDepth + 1; + } else if ( pos.x() < itemLeft ) { + result = pos.x() / indentSize; + } else { + result = itemDepth; + } + return result; +} + +bool ListViewDnd::canDecode( QDragEnterEvent * event ) +{ + return ListViewItemDrag::canDecode( event ); +} + +// ------------------------------------------------------------------ +// The Dragobject Implementation ------------------------------------ +// ------------------------------------------------------------------ + +QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ); +QDataStream & operator>> ( QDataStream & stream, QListViewItem & item ); + +ListViewItemDrag::ListViewItemDrag( ListViewItemList & items, QWidget * parent, const char * name ) + : QStoredDrag( "qt/listviewitem", parent, name ) +{ + // ### FIX! + QByteArray data( sizeof( Q_INT32 ) + sizeof( QListViewItem ) * items.count() ); + QDataStream stream( data, IO_WriteOnly ); + + stream << items.count(); + + QListViewItem *i = items.first(); + while ( i ) { + stream << *i; + i = items.next(); + } + + setEncodedData( data ); +} + +bool ListViewItemDrag::canDecode( QDragMoveEvent * event ) +{ + return event->provides( "qt/listviewitem" ); +} + +bool ListViewItemDrag::decode( QDropEvent * event, QListView * parent, QListViewItem * insertPoint, DropRelation dr ) +{ + QByteArray data = event->encodedData( "qt/listviewitem" ); + QListViewItem* itemParent = insertPoint ? insertPoint->parent() : 0; + + // Change from sibling (default) to child creation + if ( insertPoint && dr == Child ) { + itemParent = insertPoint; + insertPoint = 0; + } + + if ( data.size() ) { + event->accept(); + QDataStream stream( data, IO_ReadOnly ); + + int count = 0; + stream >> count; + + for( int i = 0; i < count; i++ ) { + if ( itemParent ) { + insertPoint = new QListViewItem( itemParent, insertPoint ); + itemParent->setOpen( TRUE ); + } else { // No parent for insertPoint, use QListView + insertPoint = new QListViewItem( parent, insertPoint ); + } + stream >> *insertPoint; + } + return TRUE; + } + return FALSE; +} + + +QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ) +{ + int columns = item.listView()->columns(); + stream << columns; + + Q_UINT8 b = 0; + + int i; + for ( i = 0; i < columns; i++ ) { + b = (Q_UINT8) ( item.text( i ) != QString::null ); // does column i have a string ? + stream << b; + if ( b ) { + stream << item.text( i ); + } + } + + for ( i = 0; i < columns; i++ ) { + b = (Q_UINT8) ( !!item.pixmap( i ) ); // does column i have a pixmap ? + stream << b; + if ( b ) { + stream << ( *item.pixmap( i ) ); + } + } + + stream << (Q_UINT8) item.isOpen(); + stream << (Q_UINT8) item.isSelectable(); + stream << (Q_UINT8) item.isExpandable(); + stream << (Q_UINT8) item.dragEnabled(); + stream << (Q_UINT8) item.dropEnabled(); + stream << (Q_UINT8) item.isVisible(); + + for ( i = 0; i < columns; i++ ) { + stream << (Q_UINT8) item.renameEnabled( i ); + } + + stream << (Q_UINT8) item.multiLinesEnabled(); + stream << item.childCount(); + + if ( item.childCount() > 0 ) { + QListViewItem * child = item.firstChild(); + while ( child ) { + stream << ( *child ); // recursive call + child = child->nextSibling(); + } + } + + return stream; +} + +QDataStream & operator>> ( QDataStream & stream, QListViewItem & item ) +{ + Q_INT32 columns; + stream >> columns; + + Q_UINT8 b = 0; + + QString text; + int i; + for ( i = 0; i < columns; i++ ) { + stream >> b; + if ( b ) { // column i has string ? + stream >> text; + item.setText( i, text ); + } + } + + QPixmap pixmap; + for ( i = 0; i < columns; i++ ) { + stream >> b; // column i has pixmap ? + if ( b ) { + stream >> pixmap; + item.setPixmap( i, pixmap ); + } + } + + stream >> b; + item.setOpen( b ); + + stream >> b; + item.setSelectable( b ); + + stream >> b; + item.setExpandable( b ); + + stream >> b; + item.setDragEnabled( b ); + + stream >> b; + item.setDropEnabled( b ); + + stream >> b; + item.setVisible( b ); + + for ( i = 0; i < columns; i++ ) { + stream >> b; + item.setRenameEnabled( i, b ); + } + + stream >> b; + item.setMultiLinesEnabled( b ); + + int childCount; + stream >> childCount; + + QListViewItem *child = 0; + QListViewItem *prevchild = 0; + for ( i = 0; i < childCount; i++ ) { + child = new QListViewItem( &item, prevchild ); + stream >> ( *child ); + item.insertItem( child ); + prevchild = child; + } + + return stream; +} diff --git a/kdevdesigner/designer/listviewdnd.h b/kdevdesigner/designer/listviewdnd.h new file mode 100644 index 00000000..52b18091 --- /dev/null +++ b/kdevdesigner/designer/listviewdnd.h @@ -0,0 +1,66 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LISTVIEWDND_H +#define LISTVIEWDND_H + +#include +#include +#include "listdnd.h" + +class QWidget; +class QListView; +typedef QPtrList ListViewItemList; + +class ListViewDnd : public ListDnd +{ + Q_OBJECT +public: + enum DragMode { Flat = 16 }; // see ListDnd::DragMode + + ListViewDnd( QListView * eventSource, const char * name = 0 ); + +signals: + void dropped( QListViewItem * ); + +public slots: + void confirmDrop( QListViewItem * ); + +protected: + virtual bool dropEvent( QDropEvent * event ); + virtual bool mouseMoveEvent( QMouseEvent * event ); + virtual void updateLine( const QPoint & pos ); + virtual bool canDecode( QDragEnterEvent * event ); +private: + QListViewItem * itemAt( QPoint pos ); + int dropDepth( QListViewItem * item, QPoint pos ); + int buildFlatList( ListViewItemList & list ); + int buildTreeList( ListViewItemList & list ); + void setVisibleItems( bool b ); + ListViewItemList disabledItems; +}; + +#endif //LISTVIEWDND_H diff --git a/kdevdesigner/designer/listvieweditor.ui b/kdevdesigner/designer/listvieweditor.ui new file mode 100644 index 00000000..d9e87240 --- /dev/null +++ b/kdevdesigner/designer/listvieweditor.ui @@ -0,0 +1,935 @@ + +ListViewEditorBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ListViewEditorBase + + + + 0 + 0 + 567 + 398 + + + + Edit Listview + + + true + + + <b>Edit Listview</b><p>Use the controls on the <b>Items</b>-tab to add, edit or delete items in the listview. Change the column configuration of the listview using the controls on the <b>Columns</b>-tab.</p>Click the <b>New Item</b>-button to create a new item, then enter text and add a pixmap.</p><p>Select an item from the list and click the <b>Delete Item</b>-button to remove the item from the list.</p> + + + + unnamed + + + 11 + + + 6 + + + + tabWidget + + + + Widget10 + + + &Items + + + + unnamed + + + 11 + + + 6 + + + + itemDelete + + + &Delete Item + + + Delete item + + + <b>Deletes the selected item.</b><p>Any sub-items are also deleted.</p> + + + + + GroupBox1 + + + + 0 + 5 + 0 + 0 + + + + Item Properties + + + + unnamed + + + 11 + + + 6 + + + + Label2 + + + Pi&xmap: + + + itemChoosePixmap + + + + + Label1 + + + &Text: + + + itemText + + + + + itemText + + + + 0 + 0 + + + + Change text + + + <b>Change the text of the item.</b><p>The text will be changed in the current column of the selected item.</p> + + + + + itemColumn + + + Change column + + + <b>Select the current column.</b><p>The item's text and pixmap will be changed for the current column</p> + + + + + Label4 + + + Colu&mn: + + + itemColumn + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + itemPixmap + + + Label4 + + + + + itemDeletePixmap + + + + 30 + 22 + + + + + + + "designer_s_editcut.png" + + + Delete Pixmap + + + <b>Delete the selected item's pixmap.</b><p>The pixmap in the current column of the selected item will be deleted.</p> + + + + + itemChoosePixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + <b>Select a pixmap file for the item.</b><p>The pixmap will be changed in the current column of the selected item.</p> + + + + + + + + + itemNew + + + &New Item + + + Add an item + + + <b>Adds a new item to the list.</b><p>The item will be inserted at the top of the list and can be moved using the up- and down-buttons.</p> + + + + + itemsPreview + + + The list of items. + + + + + itemNewSub + + + New &Subitem + + + Add a subitem + + + <b>Create a new sub-item for the selected item.</b><p>New sub-items are inserted at the top of the list of sub-items, and new levels are created automatically.</p> + + + + + Vertical Spacing1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + itemUp + + + + + + "designer_s_up.png" + + + Move up + + + <b>Move the selected item up.</b><p>The item will be moved within its level in the hierarchy.</p> + + + + + itemDown + + + + + + "designer_s_down.png" + + + Move down + + + <b>Move the selected item down.</b><p>The item will be moved within its level in the hierarchy.</p> + + + + + itemLeft + + + + + + "designer_s_left.png" + + + Move left + + + <b>Move the selected item one level up.</b><p>This will also change the level of the item's sub-items.</p> + + + + + itemRight + + + + + + "designer_s_right.png" + + + Move right + + + <b>Move the selected item one level down.</b><p>This will also change the level of the item's sub-items.</p> + + + + + + + Widget11 + + + Co&lumns + + + + unnamed + + + 11 + + + 6 + + + + GroupBox1 + + + Column Properties + + + + unnamed + + + 11 + + + 6 + + + + Label2 + + + &Pixmap: + + + colChoosePixmap + + + + + colPixmap + + + Label4 + + + + + colDeletePixmap + + + + 30 + 22 + + + + + + + "designer_s_editcut.png" + + + Delete Pixmap + + + Delete the pixmap of the selected column. + + + + + colChoosePixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + <b>Select a pixmap file for the selected column.</b><p>The pixmap will be displayed in the header of the listview.</p> + + + + + Label1 + + + &Text: + + + colText + + + + + colText + + + + 0 + 0 + + + + Enter column text + + + <b>Enter the text for the selected column.</b><p>The text will be displayed in the header of the listview.</p> + + + + + colClickable + + + Clicka&ble + + + If this option is checked, the selected column will react to mouse clicks on the header. + + + + + colResizable + + + Re&sizable + + + The column's width will be resizable if this option is checked. + + + + + + + colDelete + + + &Delete Column + + + Delete column + + + Deletes the selected Column. + + + + + colDown + + + + + + "designer_s_down.png" + + + Move down + + + <b>Move the selected item down.</b><p>The top-most column will be the first column in the list.</p> + + + + + colNew + + + &New Column + + + Add a Column + + + <b>Create a new column.</b><p>New columns are appended at the end of (right of) the list and may be moved using the up- and down-buttons.</p> + + + + + colUp + + + + + + "designer_s_up.png" + + + Move up + + + <b>Move the selected item up.</b><p>The top-most column will be the first column in the list.</p> + + + + + colPreview + + + The list of columns. + + + + + Vertical Spacing2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okButton + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + applyButton + + + &Apply + + + true + + + Apply all changes. + + + + + cancelButton + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + cancelButton + clicked() + ListViewEditorBase + reject() + + + itemNew + clicked() + ListViewEditorBase + itemNewClicked() + + + itemDelete + clicked() + ListViewEditorBase + itemDeleteClicked() + + + itemUp + clicked() + ListViewEditorBase + itemUpClicked() + + + itemDown + clicked() + ListViewEditorBase + itemDownClicked() + + + itemColumn + valueChanged(int) + ListViewEditorBase + itemColChanged(int) + + + itemText + textChanged(const QString&) + ListViewEditorBase + itemTextChanged(const QString&) + + + itemDeletePixmap + clicked() + ListViewEditorBase + itemPixmapDeleted() + + + itemChoosePixmap + clicked() + ListViewEditorBase + itemPixmapChoosen() + + + colNew + clicked() + ListViewEditorBase + newColumnClicked() + + + colDelete + clicked() + ListViewEditorBase + deleteColumnClicked() + + + colUp + clicked() + ListViewEditorBase + columnUpClicked() + + + colDown + clicked() + ListViewEditorBase + columnDownClicked() + + + colText + textChanged(const QString&) + ListViewEditorBase + columnTextChanged(const QString&) + + + colDeletePixmap + clicked() + ListViewEditorBase + columnPixmapDeleted() + + + colChoosePixmap + clicked() + ListViewEditorBase + columnPixmapChosen() + + + colResizable + toggled(bool) + ListViewEditorBase + columnResizable(bool) + + + colClickable + toggled(bool) + ListViewEditorBase + columnClickable(bool) + + + tabWidget + selected(const QString&) + ListViewEditorBase + initTabPage(const QString&) + + + okButton + clicked() + ListViewEditorBase + okClicked() + + + applyButton + clicked() + ListViewEditorBase + applyClicked() + + + colPreview + currentChanged(QListBoxItem*) + ListViewEditorBase + currentColumnChanged(QListBoxItem*) + + + colPreview + selectionChanged(QListBoxItem*) + ListViewEditorBase + currentColumnChanged(QListBoxItem*) + + + itemsPreview + currentChanged(QListViewItem*) + ListViewEditorBase + currentItemChanged(QListViewItem*) + + + itemsPreview + selectionChanged(QListViewItem*) + ListViewEditorBase + currentItemChanged(QListViewItem*) + + + itemNewSub + clicked() + ListViewEditorBase + itemNewSubClicked() + + + itemLeft + clicked() + ListViewEditorBase + itemLeftClicked() + + + itemRight + clicked() + ListViewEditorBase + itemRightClicked() + + + + okButton + cancelButton + tabWidget + itemsPreview + itemNew + itemNewSub + itemDelete + itemUp + itemDown + itemLeft + itemRight + itemColumn + itemText + itemDeletePixmap + itemChoosePixmap + helpButton + applyButton + colPreview + colNew + colDelete + colUp + colDown + colText + colDeletePixmap + colChoosePixmap + colClickable + colResizable + + + init() + destroy() + applyClicked() + columnClickable(bool) + columnDownClicked() + columnPixmapChosen() + columnPixmapDeleted() + columnResizable(bool) + columnTextChanged(const QString &) + columnUpClicked() + currentColumnChanged(QListBoxItem*) + currentItemChanged(QListViewItem*) + deleteColumnClicked() + initTabPage(const QString &) + itemColChanged(int) + itemDeleteClicked() + itemDownClicked() + itemLeftClicked() + itemNewClicked() + itemNewSubClicked() + itemPixmapChoosen() + itemPixmapDeleted() + itemTextChanged(const QString &) + itemUpClicked() + newColumnClicked() + itemRightClicked() + okClicked() + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/listvieweditorimpl.cpp b/kdevdesigner/designer/listvieweditorimpl.cpp new file mode 100644 index 00000000..78055f92 --- /dev/null +++ b/kdevdesigner/designer/listvieweditorimpl.cpp @@ -0,0 +1,650 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "formwindow.h" +#include "mainwindow.h" +#include "listvieweditorimpl.h" +#include "pixmapchooser.h" +#include "command.h" +#include "listviewdnd.h" +#include "listboxdnd.h" +#include "listboxrename.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +ListViewEditor::ListViewEditor( QWidget *parent, QListView *lv, FormWindow *fw ) + : ListViewEditorBase( parent, 0, TRUE ), listview( lv ), formwindow( fw ) +{ + connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + itemText->setEnabled( FALSE ); + itemChoosePixmap->setEnabled( FALSE ); + itemDeletePixmap->setEnabled( FALSE ); + itemColumn->setEnabled( FALSE ); + + setupColumns(); + PopulateListViewCommand::transferItems( listview, itemsPreview ); + setupItems(); + + itemsPreview->setShowSortIndicator( listview->showSortIndicator() ); + itemsPreview->setAllColumnsShowFocus( listview->allColumnsShowFocus() ); + itemsPreview->setRootIsDecorated( listview->rootIsDecorated() ); + + if ( itemsPreview->firstChild() ) { + itemsPreview->setCurrentItem( itemsPreview->firstChild() ); + itemsPreview->setSelected( itemsPreview->firstChild(), TRUE ); + } + + // Clamp on drag and drop to QListView + ListViewDnd *itemsDnd = new ListViewDnd( itemsPreview ); + itemsDnd->setDragMode( ListViewDnd::Internal | ListViewDnd::Move ); + QObject::connect( itemsDnd, SIGNAL( dropped( QListViewItem * ) ), + itemsDnd, SLOT( confirmDrop( QListViewItem * ) ) ); + + // Enable rename for all QListViewItems + QListViewItemIterator it = ((QListView *)itemsPreview)->firstChild(); + for ( ; *it; it++ ) + (*it)->setRenameEnabled( 0, TRUE ); + + // Connect listview signal to signal-relay + QObject::connect( itemsPreview, + SIGNAL( itemRenamed( QListViewItem*, int, const QString & ) ), + this, + SLOT( emitItemRenamed(QListViewItem*, int, const QString&) ) ); + + // Connect signal-relay to QLineEdit "itemText" + QObjectList *l = parent->queryList( "QLineEdit", "itemText" ); + QObject *obj; + QObjectListIt itemsLineEditIt( *l ); + while ( (obj = itemsLineEditIt.current()) != 0 ) { + ++itemsLineEditIt; + QObject::connect( this, + SIGNAL( itemRenamed( const QString & ) ), + obj, + SLOT( setText( const QString & ) ) ); + } + delete l; + + // Clamp on drag and drop to QListBox + ListBoxDnd *columnsDnd = new ListBoxDnd( colPreview ); + columnsDnd->setDragMode( ListBoxDnd::Internal | ListBoxDnd::Move ); + QObject::connect( columnsDnd, SIGNAL( dropped( QListBoxItem * ) ), + columnsDnd, SLOT( confirmDrop( QListBoxItem * ) ) ); + + // Clamp on rename to QListBox + ListBoxRename *columnsRename = new ListBoxRename( colPreview ); + QObject::connect( columnsRename, + SIGNAL( itemTextChanged( const QString & ) ), + this, + SLOT( columnTextChanged( const QString & ) ) ); + + // Find QLineEdit "colText" and connect + l = parent->queryList( "QLineEdit", "colText" ); + QObjectListIt columnsLineEditIt( *l ); + while ( (obj = columnsLineEditIt.current()) != 0 ) { + ++columnsLineEditIt; + QObject::connect( columnsRename, + SIGNAL( itemTextChanged( const QString & ) ), + obj, + SLOT( setText( const QString & ) ) ); + } + delete l; +} + +void ListViewEditor::applyClicked() +{ + setupItems(); + PopulateListViewCommand *cmd = new PopulateListViewCommand( i18n( "Edit the Items and Columns of '%1'" ).arg( listview->name() ), + formwindow, listview, itemsPreview ); + cmd->execute(); + formwindow->commandHistory()->addCommand( cmd ); +} + +void ListViewEditor::okClicked() +{ + applyClicked(); + accept(); +} + +void ListViewEditor::columnClickable( bool b ) +{ + Column *c = findColumn( colPreview->item( colPreview->currentItem() ) ); + if ( !c ) + return; + c->clickable = b; +} + +void ListViewEditor::columnDownClicked() +{ + if ( colPreview->currentItem() == -1 || + colPreview->currentItem() > (int)colPreview->count() - 2 ) + return; + + colPreview->clearSelection(); + QListBoxItem *i = colPreview->item( colPreview->currentItem() ); + QListBoxItem *below = i->next(); + + colPreview->takeItem( i ); + colPreview->insertItem( i, below ); + + colPreview->setCurrentItem( i ); + colPreview->setSelected( i, TRUE ); +} + +void ListViewEditor::columnPixmapChosen() +{ + Column *c = findColumn( colPreview->item( colPreview->currentItem() ) ); + if ( !c ) + return; + + QPixmap pix; + if ( colPixmap->pixmap() ) + pix = qChoosePixmap( this, formwindow, *colPixmap->pixmap() ); + else + pix = qChoosePixmap( this, formwindow, QPixmap() ); + + if ( pix.isNull() ) + return; + + c->pixmap = pix; + colPreview->blockSignals( TRUE ); + if ( !c->pixmap.isNull() ) + colPreview->changeItem( c->pixmap, c->text, colPreview->index( c->item ) ); + else + colPreview->changeItem( c->text, colPreview->index( c->item ) ); + c->item = colPreview->item( colPreview->currentItem() ); + colPixmap->setPixmap( c->pixmap ); + colPreview->blockSignals( FALSE ); + colDeletePixmap->setEnabled( TRUE ); +} + +void ListViewEditor::columnPixmapDeleted() +{ + Column *c = findColumn( colPreview->item( colPreview->currentItem() ) ); + if ( !c ) + return; + + c->pixmap = QPixmap(); + colPreview->blockSignals( TRUE ); + if ( !c->pixmap.isNull() ) + colPreview->changeItem( c->pixmap, c->text, colPreview->index( c->item ) ); + else + colPreview->changeItem( c->text, colPreview->index( c->item ) ); + c->item = colPreview->item( colPreview->currentItem() ); + colPixmap->setText( "" ); + colPreview->blockSignals( FALSE ); + colDeletePixmap->setEnabled( FALSE ); +} + +void ListViewEditor::columnResizable( bool b ) +{ + Column *c = findColumn( colPreview->item( colPreview->currentItem() ) ); + if ( !c ) + return; + c->resizable = b; +} + +void ListViewEditor::columnTextChanged( const QString &txt ) +{ + Column *c = findColumn( colPreview->item( colPreview->currentItem() ) ); + if ( !c ) + return; + + c->text = txt; + colPreview->blockSignals( TRUE ); + if ( !c->pixmap.isNull() ) + colPreview->changeItem( c->pixmap, c->text, colPreview->index( c->item ) ); + else + colPreview->changeItem( c->text, colPreview->index( c->item ) ); + c->item = colPreview->item( colPreview->currentItem() ); + colPreview->blockSignals( FALSE ); +} + +void ListViewEditor::columnUpClicked() +{ + if ( colPreview->currentItem() <= 0 ) + return; + + colPreview->clearSelection(); + QListBoxItem *i = colPreview->item( colPreview->currentItem() ); + QListBoxItem *above = i->prev(); + + colPreview->takeItem( above ); + colPreview->insertItem( above, i ); + + colPreview->setCurrentItem( i ); + colPreview->setSelected( i, TRUE ); +} + +void ListViewEditor::currentColumnChanged( QListBoxItem *i ) +{ + Column *c = findColumn( i ); + if ( !i || !c ) { + colText->setEnabled( FALSE ); + colPixmap->setEnabled( FALSE ); + colDeletePixmap->setEnabled( FALSE ); + colText->blockSignals( TRUE ); + colText->setText( "" ); + colText->blockSignals( FALSE ); + colClickable->setEnabled( FALSE ); + colResizable->setEnabled( FALSE ); + return; + } + + colText->setEnabled( TRUE ); + colPixmap->setEnabled( TRUE ); + colDeletePixmap->setEnabled( i->pixmap() && !i->pixmap()->isNull() ); + colClickable->setEnabled( TRUE ); + colResizable->setEnabled( TRUE ); + + colText->blockSignals( TRUE ); + colText->setText( c->text ); + colText->blockSignals( FALSE ); + if ( !c->pixmap.isNull() ) + colPixmap->setPixmap( c->pixmap ); + else + colPixmap->setText( "" ); + colClickable->setChecked( c->clickable ); + colResizable->setChecked( c->resizable ); +} + +void ListViewEditor::newColumnClicked() +{ + Column col; + col.text = i18n( "New Column" ); + col.pixmap = QPixmap(); + col.clickable = TRUE; + col.resizable = TRUE; + if ( !col.pixmap.isNull() ) + col.item = new QListBoxPixmap( colPreview, col.pixmap, col.text ); + else + col.item = new QListBoxText( colPreview, col.text ); + columns.append( col ); + colPreview->setCurrentItem( col.item ); + colPreview->setSelected( col.item, TRUE ); +} + +void ListViewEditor::deleteColumnClicked() +{ + QListBoxItem *i = colPreview->item( colPreview->currentItem() ); + if ( !i ) + return; + + for ( QValueList::Iterator it = columns.begin(); it != columns.end(); ++it ) { + if ( ( *it ).item == i ) { + delete (*it).item; + columns.remove( it ); + break; + } + } + + if ( colPreview->currentItem() != -1 ) + colPreview->setSelected( colPreview->currentItem(), TRUE ); +} + +void ListViewEditor::currentItemChanged( QListViewItem *i ) +{ + if ( !i ) { + itemText->setEnabled( FALSE ); + itemChoosePixmap->setEnabled( FALSE ); + itemDeletePixmap->setEnabled( FALSE ); + itemColumn->setEnabled( FALSE ); + return; + } + + itemText->setEnabled( TRUE ); + itemChoosePixmap->setEnabled( TRUE ); + itemDeletePixmap->setEnabled( i->pixmap( itemColumn->value() ) && + !i->pixmap( itemColumn->value() )->isNull() ); + itemColumn->setEnabled( TRUE ); + + displayItem( i, itemColumn->value() ); +} + +void ListViewEditor::displayItem( QListViewItem *i, int col ) +{ + itemText->blockSignals( TRUE ); + itemText->setText( i->text( col ) ); + itemText->blockSignals( FALSE ); + + itemPixmap->blockSignals( TRUE ); + if ( i->pixmap( col ) ) + itemPixmap->setPixmap( *i->pixmap( col ) ); + else + itemPixmap->setText( "" ); + itemPixmap->blockSignals( FALSE ); +} + +void ListViewEditor::itemColChanged( int col ) +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + displayItem( i, col ); + itemDeletePixmap->setEnabled( i->pixmap( col ) && !i->pixmap( col )->isNull() ); +} + +void ListViewEditor::itemDeleteClicked() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + delete i; + if ( itemsPreview->firstChild() ) { + itemsPreview->setCurrentItem( itemsPreview->firstChild() ); + itemsPreview->setSelected( itemsPreview->firstChild(), TRUE ); + } +} + +void ListViewEditor::itemDownClicked() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + QListViewItemIterator it( i ); + QListViewItem *parent = i->parent(); + it++; + while ( it.current() ) { + if ( it.current()->parent() == parent ) + break; + it++; + } + + if ( !it.current() ) + return; + QListViewItem *other = it.current(); + + i->moveItem( other ); +} + +void ListViewEditor::itemNewClicked() +{ + QListViewItem *item = new QListViewItem( itemsPreview ); + item->setText( 0, i18n( "Item" ) ); + item->setRenameEnabled( 0, TRUE ); + itemsPreview->setCurrentItem( item ); + itemsPreview->setSelected( item, TRUE ); + itemText->setFocus(); + itemText->selectAll(); +} + +void ListViewEditor::itemNewSubClicked() +{ + QListViewItem *parent = itemsPreview->currentItem(); + QListViewItem *item = 0; + if ( parent ) { + item = new QListViewItem( parent ); + parent->setOpen( TRUE ); + } else { + item = new QListViewItem( itemsPreview ); + } + item->setText( 0, i18n( "Subitem" ) ); + item->setRenameEnabled( 0, TRUE ); + itemsPreview->setCurrentItem( item ); + itemsPreview->setSelected( item, TRUE ); +} + +void ListViewEditor::itemPixmapChoosen() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + QPixmap pix; + if ( itemPixmap->pixmap() ) + pix = qChoosePixmap( this, formwindow, *itemPixmap->pixmap() ); + else + pix = qChoosePixmap( this, formwindow, QPixmap() ); + + if ( pix.isNull() ) + return; + + i->setPixmap( itemColumn->value(), QPixmap( pix ) ); + itemPixmap->setPixmap( pix ); + itemDeletePixmap->setEnabled( TRUE ); +} + +void ListViewEditor::itemPixmapDeleted() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + i->setPixmap( itemColumn->value(), QPixmap() ); + itemPixmap->setText( "" ); + itemDeletePixmap->setEnabled( FALSE ); +} + +void ListViewEditor::itemTextChanged( const QString &txt ) +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + i->setText( itemColumn->value(), txt ); +} + +void ListViewEditor::itemUpClicked() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + QListViewItemIterator it( i ); + QListViewItem *parent = i->parent(); + --it; + while ( it.current() ) { + if ( it.current()->parent() == parent ) + break; + --it; + } + + if ( !it.current() ) + return; + QListViewItem *other = it.current(); + + other->moveItem( i ); +} + +void ListViewEditor::itemRightClicked() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + QListViewItemIterator it( i ); + QListViewItem *parent = i->parent(); + parent = parent ? parent->firstChild() : itemsPreview->firstChild(); + if ( !parent ) + return; + it++; + while ( it.current() ) { + if ( it.current()->parent() == parent ) + break; + it++; + } + + if ( !it.current() ) + return; + QListViewItem *other = it.current(); + + for ( int c = 0; c < itemsPreview->columns(); ++c ) { + QString s = i->text( c ); + i->setText( c, other->text( c ) ); + other->setText( c, s ); + QPixmap pix; + if ( i->pixmap( c ) ) + pix = *i->pixmap( c ); + if ( other->pixmap( c ) ) + i->setPixmap( c, *other->pixmap( c ) ); + else + i->setPixmap( c, QPixmap() ); + other->setPixmap( c, pix ); + } + + itemsPreview->setCurrentItem( other ); + itemsPreview->setSelected( other, TRUE ); +} + +void ListViewEditor::itemLeftClicked() +{ + QListViewItem *i = itemsPreview->currentItem(); + if ( !i ) + return; + + QListViewItemIterator it( i ); + QListViewItem *parent = i->parent(); + if ( !parent ) + return; + parent = parent->parent(); + --it; + while ( it.current() ) { + if ( it.current()->parent() == parent ) + break; + --it; + } + + if ( !it.current() ) + return; + QListViewItem *other = it.current(); + + for ( int c = 0; c < itemsPreview->columns(); ++c ) { + QString s = i->text( c ); + i->setText( c, other->text( c ) ); + other->setText( c, s ); + QPixmap pix; + if ( i->pixmap( c ) ) + pix = *i->pixmap( c ); + if ( other->pixmap( c ) ) + i->setPixmap( c, *other->pixmap( c ) ); + else + i->setPixmap( c, QPixmap() ); + other->setPixmap( c, pix ); + } + + itemsPreview->setCurrentItem( other ); + itemsPreview->setSelected( other, TRUE ); +} + +void ListViewEditor::setupColumns() +{ + QHeader *h = listview->header(); + for ( int i = 0; i < (int)h->count(); ++i ) { + Column col; + col.text = h->label( i ); + col.pixmap = QPixmap(); + if ( h->iconSet( i ) ) + col.pixmap = h->iconSet( i )->pixmap(); + col.clickable = h->isClickEnabled( i ); + col.resizable = h->isResizeEnabled( i ); + if ( !col.pixmap.isNull() ) + col.item = new QListBoxPixmap( colPreview, col.pixmap, col.text ); + else + col.item = new QListBoxText( colPreview, col.text ); + columns.append( col ); + } + + colText->setEnabled( FALSE ); + colPixmap->setEnabled( FALSE ); + colClickable->setEnabled( FALSE ); + colResizable->setEnabled( FALSE ); + + if ( colPreview->firstItem() ) + colPreview->setCurrentItem( colPreview->firstItem() ); + numColumns = colPreview->count(); +} + +void ListViewEditor::setupItems() +{ + itemColumn->setMinValue( 0 ); + itemColumn->setMaxValue( QMAX( numColumns - 1, 0 ) ); + int i = 0; + QHeader *header = itemsPreview->header(); + for ( QListBoxItem *item = colPreview->firstItem(); item; item = item->next() ) { + Column *col = findColumn( item ); + if ( !col ) + continue; + if ( i >= itemsPreview->columns() ) + itemsPreview->addColumn( col->text ); + header->setLabel( i, col->pixmap, col->text ); + header->setResizeEnabled( col->resizable, i ); + header->setClickEnabled( col->clickable, i ); + ++i; + } + while ( itemsPreview->columns() > i ) + itemsPreview->removeColumn( i ); + + itemColumn->setValue( QMIN( numColumns - 1, itemColumn->value() ) ); +} + +ListViewEditor::Column *ListViewEditor::findColumn( QListBoxItem *i ) +{ + if ( !i ) + return 0; + + for ( QValueList::Iterator it = columns.begin(); it != columns.end(); ++it ) { + if ( ( *it ).item == i ) + return &( *it ); + } + + return 0; +} + +void ListViewEditor::initTabPage( const QString &page ) +{ + numColumns = colPreview->count(); + if ( page == i18n( "&Items" ) ) { + setupItems(); + if ( numColumns == 0 ) { + itemNew->setEnabled( FALSE ); + itemNewSub->setEnabled( FALSE ); + itemText->setEnabled( FALSE ); + itemChoosePixmap->setEnabled( FALSE ); + itemDeletePixmap->setEnabled( FALSE ); + itemColumn->setEnabled( FALSE ); + } else { + itemNew->setEnabled( TRUE ); + itemNewSub->setEnabled( TRUE ); + } + } +} + +void ListViewEditor::emitItemRenamed( QListViewItem *, int, const QString & text ) +{ + emit itemRenamed( text ); // Relay signal ( to QLineEdit ) +} diff --git a/kdevdesigner/designer/listvieweditorimpl.h b/kdevdesigner/designer/listvieweditorimpl.h new file mode 100644 index 00000000..476e47ca --- /dev/null +++ b/kdevdesigner/designer/listvieweditorimpl.h @@ -0,0 +1,102 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LISTVIEWEDITORIMPL_H +#define LISTVIEWEDITORIMPL_H + +#include "listvieweditor.h" + +#include +#include +#include + +class FormWindow; + +class ListViewEditor : public ListViewEditorBase +{ + Q_OBJECT + +public: + ListViewEditor( QWidget *parent, QListView *lv, FormWindow *fw ); + +signals: + void itemRenamed(const QString &); + +protected slots: + void applyClicked(); + void columnClickable(bool); + void columnDownClicked(); + void columnPixmapChosen(); + void columnPixmapDeleted(); + void columnResizable(bool); + void columnTextChanged(const QString &); + void columnUpClicked(); + void currentColumnChanged(QListBoxItem*); + void currentItemChanged(QListViewItem*); + void deleteColumnClicked(); + void itemColChanged(int); + void itemDeleteClicked(); + void itemDownClicked(); + void itemNewClicked(); + void itemNewSubClicked(); + void itemPixmapChoosen(); + void itemPixmapDeleted(); + void itemTextChanged(const QString &); + void itemUpClicked(); + void itemLeftClicked(); + void itemRightClicked(); + void newColumnClicked(); + void okClicked(); + void initTabPage(const QString &page); + void emitItemRenamed(QListViewItem*, int, const QString&); // signal relay + +private: + struct Column + { + QListBoxItem *item; + QString text; + QPixmap pixmap; + bool clickable, resizable; + Q_DUMMY_COMPARISON_OPERATOR( Column ) + }; + +private: + void setupColumns(); + void setupItems(); + Column *findColumn( QListBoxItem *i ); + void transferItems( QListView *from, QListView *to ); + void displayItem( QListViewItem *i, int col ); + +private: + QListView *listview; + QValueList columns; + int numColumns; + FormWindow *formwindow; + +}; + + +#endif diff --git a/kdevdesigner/designer/mainwindow.cpp b/kdevdesigner/designer/mainwindow.cpp new file mode 100644 index 00000000..530d9b07 --- /dev/null +++ b/kdevdesigner/designer/mainwindow.cpp @@ -0,0 +1,3784 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "designerappiface.h" +#include "designerapp.h" + +#include "mainwindow.h" +#include "defs.h" +#include "globaldefs.h" +#include "formwindow.h" +#include "widgetdatabase.h" +#include "widgetfactory.h" +#include "propertyeditor.h" +#include "metadatabase.h" +#include "resource.h" +#include "hierarchyview.h" +#include "newformimpl.h" +#include "workspace.h" +#include "about.h" +#include "multilineeditorimpl.h" +#include "wizardeditorimpl.h" +#include "outputwindow.h" +#include "actioneditorimpl.h" +#include "actiondnd.h" +#include "project.h" +#include "projectsettingsimpl.h" +#include "qwidgetfactory.h" +#include "pixmapcollection.h" +#include "qcompletionedit.h" +#include "sourcefile.h" +#include "orderindicator.h" +#include +#include "widgetaction.h" +#include "propertyobject.h" +#include "popupmenueditor.h" +#include "menubareditor.h" + +#include "startdialog.h" +#include "createtemplate.h" +#include "editfunctions.h" +//#include "connectionviewer.h" +#include "formsettings.h" +#include "preferences.h" +#include "pixmapcollectioneditor.h" +#ifndef QT_NO_SQL +#include "dbconnectionimpl.h" +#endif +//#include "connectioneditor.h" +#include "customwidgeteditorimpl.h" +#include "paletteeditorimpl.h" +#include "listboxeditorimpl.h" +#include "listvieweditorimpl.h" +#include "iconvieweditorimpl.h" +#include "tableeditorimpl.h" +#include "multilineeditor.h" +#include "finddialog.h" +#include "replacedialog.h" +#include "gotolinedialog.h" +#include "designeraction.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kdevdesigner_part.h" + +static bool mblockNewForms = FALSE; +extern QMap *qwf_forms; +extern QString *qwf_language; +extern bool qwf_execute_code; +extern bool qwf_stays_on_top; +extern void set_splash_status( const QString &txt ); +extern QObject* qwf_form_object; +extern QString *qwf_plugin_dir; + +MainWindow *MainWindow::self = 0; + +QString assistantPath() +{ + QString path = QDir::cleanDirPath( QString( qInstallPathBins() ) + + QDir::separator() ); + return path; +} + + +static QString textNoAccel( const QString& text) +{ + QString t = text; + int i; + while ( (i = t.find('&') )>= 0 ) { + t.remove(i,1); + } + return t; +} + + +MainWindow::MainWindow( KDevDesignerPart *part, bool asClient, bool single, const QString &plgDir ) + : QMainWindow( 0, "designer_mainwindow"/*, WType_TopLevel | (single ? 0 : WDestructiveClose) | WGroupLeader*/ ), + grd( 10, 10 ), sGrid( TRUE ), snGrid( TRUE ), restoreConfig( TRUE ), splashScreen( TRUE ), + fileFilter( i18n( "Qt User-Interface Files (*.ui)" ) ), client( asClient ), + previewing( FALSE ), databaseAutoEdit( FALSE ), autoSaveEnabled( FALSE ), autoSaveInterval( 1800 ), m_part(part) +{ +// extern void qInitImages_designercore(); +// qInitImages_designercore(); + + self = this; + setPluginDirectory( plgDir ); + customWidgetToolBar = customWidgetToolBar2 = 0; + guiStuffVisible = TRUE; + editorsReadOnly = FALSE; + sSignalHandlers = TRUE; + init_colors(); + shStartDialog = FALSE; + + desInterface = new DesignerInterfaceImpl( this ); + desInterface->addRef(); + inDebugMode = FALSE; + savePluginPaths = FALSE; + + updateFunctionsTimer = new QTimer( this ); + connect( updateFunctionsTimer, SIGNAL( timeout() ), + this, SLOT( doFunctionsChanged() ) ); + + autoSaveTimer = new QTimer( this ); + connect( autoSaveTimer, SIGNAL( timeout() ), + this, SLOT( fileSaveAll() ) ); + + set_splash_status( "Loading Plugins..." ); + setupPluginManagers(); + +/* if ( !single ) + qApp->setMainWidget( this );*/ + QWidgetFactory::addWidgetFactory( new CustomWidgetFactory ); +#ifndef Q_WS_MACX + setIcon( BarIcon( "designer_appicon.png", KDevDesignerPartFactory::instance() ) ); +#endif + + actionGroupTools = 0; + prefDia = 0; + windowMenu = 0; + hierarchyView = 0; + actionEditor = 0; + currentProject = 0; + wspace = 0; + oWindow = 0; + singleProject = single; + + statusBar()->clear(); +#if defined(QT_NON_COMMERCIAL) + statusBar()->addWidget( new QLabel(i18n("Ready - This is the non-commercial version of Qt - " + "For commercial evaluations, use the help menu to register with Trolltech."), statusBar()), 1 ); +#else + statusBar()->addWidget( new QLabel("Ready", statusBar()), 1 ); +#endif + + + set_splash_status( "Setting up GUI..." ); + setupMDI(); + setupMenuBar(); + + setupToolbox(); + + setupFileActions(); + setupEditActions(); + setupProjectActions(); + setupSearchActions(); + layoutToolBar = new QToolBar( this, "Layout" ); + layoutToolBar->setCloseMode( QDockWindow::Undocked ); + addToolBar( layoutToolBar, i18n( "Layout" ) ); + interpreterPluginManager = 0; + setupToolActions(); + setupLayoutActions(); + setupPreviewActions(); + setupOutputWindow(); + setupActionManager(); + setupWindowActions(); + + setupWorkspace(); + setupHierarchyView(); + setupPropertyEditor(); + setupActionEditor(); + + setupHelpActions(); + + setupRMBMenus(); + + connect( this, SIGNAL( projectChanged() ), this, SLOT( emitProjectSignals() ) ); + connect( this, SIGNAL( hasActiveWindow(bool) ), this, SLOT( emitProjectSignals() ) ); + + emit hasActiveForm( FALSE ); + emit hasActiveWindow( FALSE ); + + lastPressWidget = 0; + qApp->installEventFilter( this ); + + QSize as( qApp->desktop()->size() ); + as -= QSize( 30, 30 ); + resize( QSize( 1200, 1000 ).boundedTo( as ) ); + + connect( qApp->clipboard(), SIGNAL( dataChanged() ), + this, SLOT( clipboardChanged() ) ); + clipboardChanged(); + layoutChilds = FALSE; + layoutSelected = FALSE; + breakLayout = FALSE; + backPix = TRUE; + + set_splash_status( "Loading User Settings..." ); + readConfig(); + // hack to make WidgetFactory happy (so it knows QWidget and QDialog for resetting properties) + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QWidget" ), this, 0, FALSE ); + delete w; + w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QDialog" ), this, 0, FALSE ); + delete w; + w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QLabel" ), this, 0, FALSE ); + delete w; + w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QTabWidget" ), this, 0, FALSE ); + delete w; + w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QFrame" ), this, 0, FALSE ); + delete w; + setAppropriate( (QDockWindow*)actionEditor->parentWidget(), FALSE ); + actionEditor->parentWidget()->hide(); + + assistant = new QAssistantClient( assistantPath(), this ); + + statusBar()->setSizeGripEnabled( TRUE ); + set_splash_status( "Initialization Done." ); +/* if ( shStartDialog ) + QTimer::singleShot( 0, this, SLOT( showStartDialog() ));*/ + + if ( autoSaveEnabled ) + autoSaveTimer->start( autoSaveInterval * 1000 ); + + setFocusPolicy( StrongFocus ); +} + +MainWindow::~MainWindow() +{ + QValueList::Iterator tit; + for ( tit = preferenceTabs.begin(); tit != preferenceTabs.end(); ++tit ) { + Tab t = *tit; + delete t.w; + } + for ( tit = projectTabs.begin(); tit != projectTabs.end(); ++tit ) { + Tab t = *tit; + delete t.w; + } + + QMap< QAction*, Project* >::Iterator it = projects.begin(); + while ( it != projects.end() ) { + Project *p = *it; + ++it; + delete p; + } + projects.clear(); + + delete oWindow; + oWindow = 0; + + desInterface->release(); + desInterface = 0; + + delete actionPluginManager; + delete preferencePluginManager; + delete projectSettingsPluginManager; + delete interpreterPluginManager; + delete templateWizardPluginManager; + delete editorPluginManager; + delete sourceTemplatePluginManager; + + MetaDataBase::clearDataBase(); + if(self == this) + self = 0; +} + +void MainWindow::setupMDI() +{ + QVBox *vbox = new QVBox( this ); + setCentralWidget( vbox ); + vbox->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + vbox->setMargin( 1 ); + vbox->setLineWidth( 1 ); + qworkspace = new QWorkspace( vbox ); + qworkspace->setPaletteBackgroundPixmap( UserIcon( "designer_background.png", KDevDesignerPartFactory::instance() ) ); + qworkspace->setScrollBarsEnabled( TRUE ); + connect( qworkspace, SIGNAL( windowActivated( QWidget * ) ), + this, SLOT( activeWindowChanged( QWidget * ) ) ); + lastActiveFormWindow = 0; + qworkspace->setAcceptDrops( TRUE ); +} + +void MainWindow::setupMenuBar() +{ + menubar = menuBar(); +} + +void MainWindow::setupPropertyEditor() +{ + QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( QDockWindow::Always ); + propertyEditor = new PropertyEditor( dw ); + addToolBar( dw, Qt::DockRight ); + dw->setWidget( propertyEditor ); + dw->setFixedExtentWidth( 250 ); + dw->setCaption( i18n( "Property Editor/Signal Handlers" ) ); + QWhatsThis::add( propertyEditor, + i18n("The Property Editor" + "

      You can change the appearance and behavior of the selected widget in the " + "property editor.

      " + "

      You can set properties for components and forms at design time and see the " + "immediately see the effects of the changes. " + "Each property has its own editor which (depending on the property) can be used " + "to enter " + "new values, open a special dialog, or to select values from a predefined list. " + "Click F1 to get detailed help for the selected property.

      " + "

      You can resize the columns of the editor by dragging the separators in the " + "list's header.

      " + "

      Signal Handlers

      " + "

      In the Signal Handlers tab you can define connections between " + "the signals emitted by widgets and the slots in the form. " + "(These connections can also be made using the connection tool.)" ) ); + dw->show(); +} + +void MainWindow::setupOutputWindow() +{ + QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( QDockWindow::Always ); + addToolBar( dw, Qt::DockBottom ); + oWindow = new OutputWindow( dw ); + dw->setWidget( oWindow ); + dw->setFixedExtentHeight( 150 ); + dw->setCaption( i18n( "Output Window" ) ); +} + +void MainWindow::setupHierarchyView() +{ + if ( hierarchyView ) + return; + QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( QDockWindow::Always ); + hierarchyView = new HierarchyView( dw ); + addToolBar( dw, Qt::DockRight ); + dw->setWidget( hierarchyView ); + + dw->setCaption( i18n( "Object Explorer" ) ); + dw->setFixedExtentWidth( 250 ); + QWhatsThis::add( hierarchyView, + i18n("The Object Explorer" + "

      The Object Explorer provides an overview of the relationships " + "between the widgets in a form. You can use the clipboard functions using " + "a context menu for each item in the view. It is also useful for selecting widgets " + "in forms that have complex layouts.

      " + "

      The columns can be resized by dragging the separator in the list's header.

      " + "

      The second tab shows all the form's slots, class variables, includes, etc.

      ") ); + dw->show(); +} + +void MainWindow::setupWorkspace() +{ + QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( QDockWindow::Always ); + QVBox *vbox = new QVBox( dw ); + QCompletionEdit *edit = new QCompletionEdit( vbox ); + QToolTip::add( edit, i18n( "Start typing the buffer you want to switch to here (ALT+B)" ) ); + QAccel *a = new QAccel( this ); + a->connectItem( a->insertItem( ALT + Key_B ), edit, SLOT( setFocus() ) ); + wspace = new Workspace( vbox, this ); + wspace->setBufferEdit( edit ); + wspace->setCurrentProject( currentProject ); + addToolBar( dw, Qt::DockRight ); + dw->setWidget( vbox ); + + dw->setCaption( i18n( "Project Overview" ) ); + QWhatsThis::add( wspace, i18n("The Project Overview Window" + "

      The Project Overview Window displays all the current " + "project, including forms and source files.

      " + "

      Use the search field to rapidly switch between files.

      ")); + dw->setFixedExtentHeight( 100 ); + dw->show(); +} + +void MainWindow::setupActionEditor() +{ + QDockWindow *dw = new QDockWindow( QDockWindow::OutsideDock, this, 0 ); + addDockWindow( dw, Qt::DockTornOff ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( QDockWindow::Always ); + actionEditor = new ActionEditor( dw ); + dw->setWidget( actionEditor ); + actionEditor->show(); + dw->setCaption( i18n( "Action Editor" ) ); + QWhatsThis::add( actionEditor, i18n("The Action Editor" + "

      The Action Editor is used to add actions and action groups to " + "a form, and to connect actions to slots. Actions and action " + "groups can be dragged into menus and into toolbars, and may " + "feature keyboard shortcuts and tooltips. If actions have pixmaps " + "these are displayed on toolbar buttons and besides their names in " + "menus.

      " ) ); + dw->hide(); + setAppropriate( dw, FALSE ); +} + +void MainWindow::setupToolbox() +{ + QDockWindow *dw = new QDockWindow( QDockWindow::InDock, this ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( QDockWindow::Always ); + addToolBar( dw, Qt::DockLeft ); + toolBox = new QToolBox( dw ); + dw->setWidget( toolBox ); + dw->setFixedExtentWidth( 160 ); + dw->setCaption( i18n( "Toolbox" ) ); + dw->show(); + setDockEnabled( dw, Qt::DockTop, FALSE ); + setDockEnabled( dw, Qt::DockBottom, FALSE ); + commonWidgetsToolBar = new QToolBar( "Common Widgets", 0, toolBox, FALSE, "Common Widgets" ); + commonWidgetsToolBar->setFrameStyle( QFrame::NoFrame ); + commonWidgetsToolBar->setOrientation( Qt::Vertical ); + commonWidgetsToolBar->setBackgroundMode(PaletteBase); + toolBox->addItem( commonWidgetsToolBar, "Common Widgets" ); +} + +void MainWindow::setupRMBMenus() +{ + rmbWidgets = new QPopupMenu( this ); + actionEditCut->addTo( rmbWidgets ); + actionEditCopy->addTo( rmbWidgets ); + actionEditPaste->addTo( rmbWidgets ); + actionEditDelete->addTo( rmbWidgets ); +#if 0 + rmbWidgets->insertSeparator(); + actionEditLower->addTo( rmbWidgets ); + actionEditRaise->addTo( rmbWidgets ); +#endif + rmbWidgets->insertSeparator(); + actionEditAdjustSize->addTo( rmbWidgets ); + actionEditHLayout->addTo( rmbWidgets ); + actionEditVLayout->addTo( rmbWidgets ); + actionEditGridLayout->addTo( rmbWidgets ); + actionEditSplitHorizontal->addTo( rmbWidgets ); + actionEditSplitVertical->addTo( rmbWidgets ); + actionEditBreakLayout->addTo( rmbWidgets ); + rmbWidgets->insertSeparator(); + if ( !singleProjectMode() ) + actionEditConnections->addTo( rmbWidgets ); + actionEditSource->addTo( rmbWidgets ); + + rmbFormWindow = new QPopupMenu( this ); + actionEditPaste->addTo( rmbFormWindow ); + actionEditSelectAll->addTo( rmbFormWindow ); + actionEditAccels->addTo( rmbFormWindow ); + rmbFormWindow->insertSeparator(); + actionEditAdjustSize->addTo( rmbFormWindow ); + actionEditHLayout->addTo( rmbFormWindow ); + actionEditVLayout->addTo( rmbFormWindow ); + actionEditGridLayout->addTo( rmbFormWindow ); + actionEditBreakLayout->addTo( rmbFormWindow ); + rmbFormWindow->insertSeparator(); + if ( !singleProjectMode() ) { + actionEditFunctions->addTo( rmbFormWindow ); + actionEditConnections->addTo( rmbFormWindow ); + } + actionEditSource->addTo( rmbFormWindow ); + rmbFormWindow->insertSeparator(); + actionEditFormSettings->addTo( rmbFormWindow ); +} + +void MainWindow::toolSelected( QAction* action ) +{ + actionCurrentTool = action; + emit currentToolChanged(); + if ( formWindow() ) + formWindow()->commandHistory()->emitUndoRedo(); +} + +int MainWindow::currentTool() const +{ + if ( !actionCurrentTool ) + return POINTER_TOOL; + return QString::fromLatin1(actionCurrentTool->name()).toInt(); +} + +void MainWindow::runProjectPrecondition() +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + e->save(); + e->saveBreakPoints(); + } + fileSaveProject(); + + if ( currentTool() == ORDER_TOOL ) + resetTool(); + oWindow->clearErrorMessages(); + oWindow->clearDebug(); + oWindow->showDebugTab(); + previewing = TRUE; +} + +void MainWindow::runProjectPostcondition( QObjectList *l ) +{ + inDebugMode = TRUE; + debuggingForms = *l; + enableAll( FALSE ); + for ( SourceEditor *e2 = sourceEditors.first(); e2; e2 = sourceEditors.next() ) { + if ( e2->project() == currentProject ) + e2->editorInterface()->setMode( EditorInterface::Debugging ); + } +} + +QWidget* MainWindow::previewFormInternal( QStyle* style, QPalette* palet ) +{ + qwf_execute_code = FALSE; + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) + e->save(); + if ( currentTool() == ORDER_TOOL ) + resetTool(); + + FormWindow *fw = formWindow(); + if ( !fw ) + return 0; + + QStringList databases; + QPtrDictIterator wit( *fw->widgets() ); + while ( wit.current() ) { + QStringList lst = MetaDataBase::fakeProperty( wit.current(), "database" ).toStringList(); + if ( !lst.isEmpty() ) + databases << lst [ 0 ]; + ++wit; + } + + if ( fw->project() ) { + QStringList::ConstIterator it; + for ( it = databases.begin(); it != databases.end(); ++it ) + fw->project()->openDatabase( *it, FALSE ); + } + QApplication::setOverrideCursor( WaitCursor ); + + QCString s; + QBuffer buffer( s ); + buffer.open( IO_WriteOnly ); + Resource resource( this ); + resource.setWidget( fw ); + QValueList images; + resource.save( &buffer ); + + buffer.close(); + buffer.open( IO_ReadOnly ); + + QWidget *w = QWidgetFactory::create( &buffer ); + if ( w ) { + previewedForm = w; + if ( palet ) { + if ( style ) + style->polish( *palet ); + w->setPalette( *palet ); + } + + if ( style ) + w->setStyle( style ); + + QObjectList *l = w->queryList( "QWidget" ); + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( style ) + ( (QWidget*)o )->setStyle( style ); + } + delete l; + + w->move( fw->mapToGlobal( QPoint(0,0) ) ); + ((MainWindow*)w )->setWFlags( WDestructiveClose ); + previewing = TRUE; + w->show(); + previewing = FALSE; + QApplication::restoreOverrideCursor(); + return w; + } + QApplication::restoreOverrideCursor(); + return 0; +} + +void MainWindow::previewForm() +{ + QWidget* w = previewFormInternal(); + if ( w ) + w->show(); +} + +void MainWindow::previewForm( const QString & style ) +{ + QStyle* st = QStyleFactory::create( style ); + QWidget* w = 0; + if ( style == "Motif" ) { + QPalette p( QColor( 192, 192, 192 ) ); + w = previewFormInternal( st, &p ); + } else if ( style == "Windows" ) { + QPalette p( QColor( 212, 208, 200 ) ); + w = previewFormInternal( st, &p ); + } else if ( style == "Platinum" ) { + QPalette p( QColor( 220, 220, 220 ) ); + w = previewFormInternal( st, &p ); + } else if ( style == "CDE" ) { + QPalette p( QColor( 75, 123, 130 ) ); + p.setColor( QPalette::Active, QColorGroup::Base, QColor( 55, 77, 78 ) ); + p.setColor( QPalette::Inactive, QColorGroup::Base, QColor( 55, 77, 78 ) ); + p.setColor( QPalette::Disabled, QColorGroup::Base, QColor( 55, 77, 78 ) ); + p.setColor( QPalette::Active, QColorGroup::Highlight, Qt::white ); + p.setColor( QPalette::Active, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) ); + p.setColor( QPalette::Inactive, QColorGroup::Highlight, Qt::white ); + p.setColor( QPalette::Inactive, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) ); + p.setColor( QPalette::Disabled, QColorGroup::Highlight, Qt::white ); + p.setColor( QPalette::Disabled, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) ); + p.setColor( QPalette::Active, QColorGroup::Foreground, Qt::white ); + p.setColor( QPalette::Active, QColorGroup::Text, Qt::white ); + p.setColor( QPalette::Active, QColorGroup::ButtonText, Qt::white ); + p.setColor( QPalette::Inactive, QColorGroup::Foreground, Qt::white ); + p.setColor( QPalette::Inactive, QColorGroup::Text, Qt::white ); + p.setColor( QPalette::Inactive, QColorGroup::ButtonText, Qt::white ); + p.setColor( QPalette::Disabled, QColorGroup::Foreground, Qt::lightGray ); + p.setColor( QPalette::Disabled, QColorGroup::Text, Qt::lightGray ); + p.setColor( QPalette::Disabled, QColorGroup::ButtonText, Qt::lightGray ); + + w = previewFormInternal( st, &p ); + } else if ( style == "SGI" ) { + QPalette p( QColor( 220, 220, 220 ) ); + w = previewFormInternal( st, &p ); + } else if ( style == "MotifPlus" ) { + QColor gtkfg(0x00, 0x00, 0x00); + QColor gtkdf(0x75, 0x75, 0x75); + QColor gtksf(0xff, 0xff, 0xff); + QColor gtkbs(0xff, 0xff, 0xff); + QColor gtkbg(0xd6, 0xd6, 0xd6); + QColor gtksl(0x00, 0x00, 0x9c); + QColorGroup active(gtkfg, // foreground + gtkbg, // button + gtkbg.light(), // light + gtkbg.dark(142), // dark + gtkbg.dark(110), // mid + gtkfg, // text + gtkfg, // bright text + gtkbs, // base + gtkbg), // background + disabled(gtkdf, // foreground + gtkbg, // button + gtkbg.light(), // light + gtkbg.dark(156), // dark + gtkbg.dark(110), // mid + gtkdf, // text + gtkdf, // bright text + gtkbs, // base + gtkbg); // background + + QPalette pal(active, disabled, active); + + pal.setColor(QPalette::Active, QColorGroup::Highlight, + gtksl); + pal.setColor(QPalette::Active, QColorGroup::HighlightedText, + gtksf); + pal.setColor(QPalette::Inactive, QColorGroup::Highlight, + gtksl); + pal.setColor(QPalette::Inactive, QColorGroup::HighlightedText, + gtksf); + pal.setColor(QPalette::Disabled, QColorGroup::Highlight, + gtksl); + pal.setColor(QPalette::Disabled, QColorGroup::HighlightedText, + gtkdf); + w = previewFormInternal( st, &pal ); + } else { + w = previewFormInternal( st ); + } + + if ( !w ) + return; + w->insertChild( st ); + w->show(); +} + +void MainWindow::helpContents() +{ + QWidget *focusWidget = qApp->focusWidget(); + bool showClassDocu = TRUE; + while ( focusWidget ) { + if ( focusWidget->isA( "PropertyList" ) ) { + showClassDocu = FALSE; + break; + } + focusWidget = focusWidget->parentWidget(); + } + + QString source = "designer-manual.html"; + if ( propertyDocumentation.isEmpty() ) { + QString indexFile = documentationPath() + "/propertyindex"; + QFile f( indexFile ); + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + while ( !ts.eof() ) { + QString s = ts.readLine(); + int from = s.find( "\"" ); + if ( from == -1 ) + continue; + int to = s.findRev( "\"" ); + if ( to == -1 ) + continue; + propertyDocumentation[ s.mid( from + 1, to - from - 1 ) ] = s.mid( to + 2 ) + "-prop"; + } + f.close(); + } + } + + if ( propertyEditor->widget() && !showClassDocu ) { + if ( !propertyEditor->currentProperty().isEmpty() ) { + QMetaObject* mo = propertyEditor->metaObjectOfCurrentProperty(); + QString s; + QString cp = propertyEditor->currentProperty(); + if ( cp == "layoutMargin" ) { + source = propertyDocumentation[ "QLayout/margin" ]; + } else if ( cp == "layoutSpacing" ) { + source = propertyDocumentation[ "QLayout/spacing" ]; + } else if ( cp == "toolTip" ) { + source = "qtooltip.html#details"; + } else if ( mo && qstrcmp( mo->className(), "Spacer" ) == 0 ) { + if ( cp != "name" ) + source = "qsizepolicy.html#SizeType"; + else + source = propertyDocumentation[ "QObject/name" ]; + } else { + while ( mo && !propertyDocumentation.contains( ( s = QString( mo->className() ) + "/" + cp ) ) ) + mo = mo->superClass(); + if ( mo ) + source = "p:" + propertyDocumentation[s]; + } + } + + QString classname = WidgetFactory::classNameOf( propertyEditor->widget() ); + if ( source.isEmpty() || source == "designer-manual.html" ) { + if ( classname.lower() == "spacer" ) + source = "qspaceritem.html#details"; + else if ( classname == "QLayoutWidget" ) + source = "layout.html"; + else + source = QString( WidgetFactory::classNameOf( propertyEditor->widget() ) ).lower() + ".html#details"; + } + } else if ( propertyEditor->widget() ) { + source = QString( WidgetFactory::classNameOf( propertyEditor->widget() ) ).lower() + ".html#details"; + } + + if ( !source.isEmpty() ) + assistant->showPage( documentationPath() + source ); +} + +void MainWindow::helpManual() +{ + assistant->showPage( documentationPath() + "/designer-manual.html" ); +} + +void MainWindow::helpAbout() +{ + AboutDialog dlg( this, 0, TRUE ); + if ( singleProjectMode() ) { + dlg.aboutPixmap->setText( "" ); + dlg.aboutVersion->setText( "" ); + dlg.aboutCopyright->setText( "" ); + LanguageInterface *iface = MetaDataBase::languageInterface( eProject->language() ); + dlg.aboutLicense->setText( iface->aboutText() ); + } + dlg.aboutVersion->setText(QString("Version ") + QString(QT_VERSION_STR)); + dlg.resize( dlg.width(), dlg.layout()->heightForWidth(dlg.width()) ); + dlg.exec(); +} + +void MainWindow::helpAboutQt() +{ + QMessageBox::aboutQt( this, "Qt Designer" ); +} + +#if defined(_WS_WIN_) +#include +#include +#endif + +void MainWindow::helpRegister() +{ +#if defined(_WS_WIN_) + HKEY key; + HKEY subkey; + long res; + DWORD type; + DWORD size = 255; + QString command; + QString sub( "htmlfile\\shell" ); +#if defined(UNICODE) + if ( QApplication::winVersion() & Qt::WV_NT_based ) { + unsigned char data[256]; + res = RegOpenKeyExW( HKEY_CLASSES_ROOT, NULL, 0, KEY_READ, &key ); + res = RegOpenKeyExW( key, (TCHAR*)sub.ucs2(), 0, KEY_READ, &subkey ); + res = RegQueryValueExW( subkey, NULL, NULL, &type, data, &size ); + command = qt_winQString( data ) + "\\command"; + size = 255; + res = RegOpenKeyExW( subkey, (TCHAR*)command.ucs2(), 0, KEY_READ, &subkey ); + res = RegQueryValueExW( subkey, NULL, NULL, &type, data, &size ); + command = qt_winQString( data ); + } else +#endif + { + unsigned char data[256]; + res = RegOpenKeyExA( HKEY_CLASSES_ROOT, NULL, 0, KEY_READ, &key ); + res = RegOpenKeyExA( key, sub.local8Bit(), 0, KEY_READ, &subkey ); + res = RegQueryValueExA( subkey, NULL, NULL, &type, data, &size ); + command = QString::fromLocal8Bit( (const char*) data ) + "\\command"; + size = 255; + res = RegOpenKeyExA( subkey, command.local8Bit(), 0, KEY_READ, &subkey ); + res = RegQueryValueExA( subkey, NULL, NULL, &type, data, &size ); + command = QString::fromLocal8Bit( (const char*) data ); + } + + res = RegCloseKey( subkey ); + res = RegCloseKey( key ); + + QProcess process( command + " www.trolltech.com/products/download/eval/evaluation.html" ); + if ( !process.start() ) + QMessageBox::information( this, "Register Qt", "Launching your web browser failed.\n" + "To register Qt, point your browser to www.trolltech.com/products/download/eval/evaluation.html" ); +#endif +} + +void MainWindow::showProperties( QObject *o ) +{ + if ( !o->isWidgetType() ) { + propertyEditor->setWidget( o, lastActiveFormWindow ); + if ( lastActiveFormWindow ) + hierarchyView->setFormWindow( lastActiveFormWindow, lastActiveFormWindow->mainContainer() ); + else + hierarchyView->setFormWindow( 0, 0 ); + return; + } + QWidget *w = (QWidget*)o; + setupHierarchyView(); + FormWindow *fw = (FormWindow*)isAFormWindowChild( w ); + if ( fw ) { + if ( fw->numSelectedWidgets() > 1 ) { + QWidgetList wl = fw->selectedWidgets(); + if ( wl.first() != w ) { + wl.removeRef( w ); + wl.insert( 0, w ); + } + propertyEditor->setWidget( new PropertyObject( wl ), fw ); + } else { + propertyEditor->setWidget( w, fw ); + } + hierarchyView->setFormWindow( fw, w ); + } else { + propertyEditor->setWidget( 0, 0 ); + hierarchyView->setFormWindow( 0, 0 ); + } + + if ( currentTool() == POINTER_TOOL && fw && + ( !qworkspace->activeWindow() || !::qt_cast(qworkspace->activeWindow()) ) ) + fw->setFocus(); +} + +void MainWindow::resetTool() +{ + actionPointerTool->setOn( TRUE ); +} + +void MainWindow::updateProperties( QObject * ) +{ + if ( propertyEditor ) + propertyEditor->refetchData(); +} + +bool MainWindow::eventFilter( QObject *o, QEvent *e ) +{ + if ( ::qt_cast(o) || ::qt_cast(o) || + ( o && + ( ::qt_cast(o->parent()) || + ::qt_cast(o->parent()) ) ) ) { + + if ( e->type() == QEvent::Accel && ::qt_cast(o) ) { + return TRUE; // consume accel events + } else if ( e->type() == QEvent::MouseButtonPress && ::qt_cast(o) ) { + QPoint pos = ((QMouseEvent*)e)->pos(); + MenuBarEditor *m = ::qt_cast(o); + showProperties( o ); + if ( m->findItem( pos ) >= m->count() ) + m->setFocus(); + } else if ( e->type() == QEvent::MouseButtonPress && ::qt_cast(o) ) { + PopupMenuEditor *m = ::qt_cast(o); + PopupMenuEditorItem *i = m->at( ((QMouseEvent*)e)->pos() ); + if ( m->find( i->action() ) != -1 && !i->isSeparator() ) + showProperties( i->action() ); + } + return QMainWindow::eventFilter( o, e ); + } + + if ( !o || !e || !o->isWidgetType() ) + return QMainWindow::eventFilter( o, e ); + + QWidget *w = 0; + bool passiveInteractor; + switch ( e->type() ) { + case QEvent::AccelOverride: + if ( ( (QKeyEvent*)e )->key() == Key_F1 && + ( ( (QKeyEvent*)e )->state() & ShiftButton ) != ShiftButton ) { + w = (QWidget*)o; + while ( w ) { + if ( ::qt_cast(w) ) + break; + w = w->parentWidget( TRUE ); + } + if ( w ) { + propertyEditor->propertyList()->showCurrentWhatsThis(); + ( (QKeyEvent*)e )->accept(); + return TRUE; + } + } + break; + case QEvent::Accel: + if ( ( ( (QKeyEvent*)e )->key() == Key_A || + ( (QKeyEvent*)e )->key() == Key_E ) && + ( (QKeyEvent*)e )->state() & ControlButton ) { + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (QKeyEvent*)e )->ignore(); + return TRUE; + } + } + break; + case QEvent::ContextMenu: + case QEvent::MouseButtonPress: + if ( o && currentTool() == POINTER_TOOL && + ( ::qt_cast(o) || + ::qt_cast(o) || + ::qt_cast(o) || + ( ::qt_cast(o) || + ::qt_cast(o) || + ::qt_cast(o) ) && + o->parent() + && ( ::qt_cast(o->parent()) + || ::qt_cast(o->parent())) ) ) { + QWidget *w = (QWidget*)o; + if ( ::qt_cast(w) || + ::qt_cast(w) || + ::qt_cast(w) || + ::qt_cast(w) ) + w = w->parentWidget(); + QWidget *pw = w->parentWidget(); + while ( pw ) { + if ( ::qt_cast(pw) ) { + ( (FormWindow*)pw )->emitShowProperties( w ); + if ( !::qt_cast(o) ) + return ( !::qt_cast(o) && + !::qt_cast(o) && + !::qt_cast(o) && + !::qt_cast(o) ); + } + pw = pw->parentWidget(); + } + } + if ( o && ( ::qt_cast(o) || o->inherits("QDockWindowHandle") ) + && e->type() == QEvent::ContextMenu ) + break; + if ( isAToolBarChild( o ) && currentTool() != CONNECT_TOOL && currentTool() != BUDDY_TOOL ) + break; + if ( ::qt_cast(o) ) + break; + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + if ( !w->hasFocus() ) + w->setFocus(); + passiveInteractor = WidgetFactory::isPassiveInteractor( o ); + if ( !passiveInteractor || currentTool() != ORDER_TOOL ) { + if( e->type() == QEvent::ContextMenu ) { + ( (FormWindow*)w )->handleContextMenu( (QContextMenuEvent*)e, + ( (FormWindow*)w )->designerWidget( o ) ); + return TRUE; + } else { + ( (FormWindow*)w )->handleMousePress( (QMouseEvent*)e, + ( (FormWindow*)w )->designerWidget( o ) ); + } + } + lastPressWidget = (QWidget*)o; + if ( passiveInteractor ) + QTimer::singleShot( 0, formWindow(), SLOT( visibilityChanged() ) ); + if ( currentTool() == CONNECT_TOOL || currentTool() == BUDDY_TOOL ) + return TRUE; + return !passiveInteractor; + case QEvent::MouseButtonRelease: + lastPressWidget = 0; + if ( isAToolBarChild( o ) && currentTool() != CONNECT_TOOL && currentTool() != BUDDY_TOOL ) + break; + if ( ::qt_cast(o) ) + break; + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + passiveInteractor = WidgetFactory::isPassiveInteractor( o ); + if ( !passiveInteractor ) + ( (FormWindow*)w )->handleMouseRelease( (QMouseEvent*)e, + ( (FormWindow*)w )->designerWidget( o ) ); + if ( passiveInteractor ) { + QTimer::singleShot( 0, this, SLOT( selectionChanged() ) ); + QTimer::singleShot( 0, formWindow(), SLOT( visibilityChanged() ) ); + } + return !passiveInteractor; + case QEvent::MouseMove: + if ( isAToolBarChild( o ) && currentTool() != CONNECT_TOOL && currentTool() != BUDDY_TOOL ) + break; + w = isAFormWindowChild( o ); + if ( lastPressWidget != (QWidget*)o && w && + !::qt_cast(o) && !::qt_cast(o) && + !::qt_cast(o) && !::qt_cast(o) && + !::qt_cast(o) ) + return TRUE; + if ( o && ::qt_cast(o) ) + break; + if ( lastPressWidget != (QWidget*)o || + ( !w || ::qt_cast(o) ) || + ::qt_cast(o) ) + break; + passiveInteractor = WidgetFactory::isPassiveInteractor( o ); + if ( !passiveInteractor ) + ( (FormWindow*)w )->handleMouseMove( (QMouseEvent*)e, + ( (FormWindow*)w )->designerWidget( o ) ); + return !passiveInteractor; + case QEvent::KeyPress: + if ( ( (QKeyEvent*)e )->key() == Key_Escape && currentTool() != POINTER_TOOL ) { + resetTool(); + return FALSE; + } + if ( ( (QKeyEvent*)e )->key() == Key_Escape && incrementalSearch->hasFocus() ) { + if ( ::qt_cast(qWorkspace()->activeWindow()) ) { + qWorkspace()->activeWindow()->setFocus(); + return TRUE; + } + } + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + ( (FormWindow*)w )->handleKeyPress( (QKeyEvent*)e, ( (FormWindow*)w )->designerWidget( o ) ); + if ( ((QKeyEvent*)e)->isAccepted() ) + return TRUE; + break; + case QEvent::MouseButtonDblClick: + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) { + if ( ::qt_cast(o) && ((QToolButton*)o)->isOn() && + o->parent() && ::qt_cast(o->parent()) && formWindow() ) + formWindow()->setToolFixed(); + break; + } + if ( currentTool() == ORDER_TOOL ) { + ( (FormWindow*)w )->handleMouseDblClick( (QMouseEvent*)e, + ( (FormWindow*)w )->designerWidget( o ) ); + return TRUE; + } + if ( !WidgetFactory::isPassiveInteractor( o ) && ( (FormWindow*)w )->formFile() ) + return openEditor( ( (FormWindow*)w )->designerWidget( o ), (FormWindow*)w ); + return TRUE; + case QEvent::KeyRelease: + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + ( (FormWindow*)w )->handleKeyRelease( (QKeyEvent*)e, ( (FormWindow*)w )->designerWidget( o ) ); + if ( ((QKeyEvent*)e)->isAccepted() ) + return TRUE; + break; + case QEvent::Hide: + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + if ( ( (FormWindow*)w )->isWidgetSelected( (QWidget*)o ) ) + ( (FormWindow*)w )->selectWidget( (QWidget*)o, FALSE ); + break; + case QEvent::Enter: + case QEvent::Leave: + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + return TRUE; + case QEvent::Resize: + case QEvent::Move: + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + if ( WidgetFactory::layoutType( (QWidget*)o->parent() ) != WidgetFactory::NoLayout ) { + ( (FormWindow*)w )->updateSelection( (QWidget*)o ); + if ( e->type() != QEvent::Resize ) + ( (FormWindow*)w )->updateChildSelections( (QWidget*)o ); + } + break; + case QEvent::Close: + if ( o->isWidgetType() && (QWidget*)o == (QWidget*)previewedForm ) { + if ( lastActiveFormWindow && lastActiveFormWindow->project() ) { + QStringList lst = + MetaDataBase::fakeProperty( lastActiveFormWindow, "database" ).toStringList(); + lastActiveFormWindow->project()->closeDatabase( lst[ 0 ] ); + } + } + break; + case QEvent::DragEnter: + if ( o == qWorkspace() || o == workspace() || o == workspace()->viewport() ) { + workspace()->contentsDragEnterEvent( (QDragEnterEvent*)e ); + return TRUE; + } + break; + case QEvent::DragMove: + if ( o == qWorkspace() || o == workspace() || o == workspace()->viewport() ) { + workspace()->contentsDragMoveEvent( (QDragMoveEvent*)e ); + return TRUE; + } + break; + case QEvent::Drop: + if ( o == qWorkspace() || o == workspace() || o == workspace()->viewport() ) { + workspace()->contentsDropEvent( (QDropEvent*)e ); + return TRUE; + } + break; + case QEvent::Show: + if ( o != this ) + break; + if ( ((QShowEvent*)e)->spontaneous() ) + break; + QApplication::sendPostedEvents( qworkspace, QEvent::ChildInserted ); + showEvent( (QShowEvent*)e ); + checkTempFiles(); + return TRUE; + case QEvent::Wheel: + if ( !( w = isAFormWindowChild( o ) ) || + ::qt_cast(o) || + ::qt_cast(o) ) + break; + return TRUE; + case QEvent::FocusIn: + if ( !::qt_cast(o) && isAFormWindowChild( o ) ) + return TRUE; //FIXME + if ( hierarchyView->formDefinitionView()->isRenaming() + && ( o->inherits( "Editor" ) || ::qt_cast(o) ) ) + QApplication::sendPostedEvents(); + if ( o->inherits( "Editor" ) ) { + QWidget *w = (QWidget*)o; + while ( w ) { + if ( ::qt_cast(w) ) + break; + w = w->parentWidget( TRUE ); + } + if ( ::qt_cast(w) ) + ( (SourceEditor*)w )->checkTimeStamp(); + } else if ( ::qt_cast(o) ) { + FormWindow *fw = (FormWindow*)o; + if ( fw->formFile() && fw->formFile()->editor() ) + fw->formFile()->editor()->checkTimeStamp(); + } + break; + case QEvent::FocusOut: + if ( !::qt_cast(o) && isAFormWindowChild( o ) ) + return TRUE; + break; + default: + return QMainWindow::eventFilter( o, e ); + } + + return QMainWindow::eventFilter( o, e ); +} + +QWidget *MainWindow::isAFormWindowChild( QObject *o ) const +{ + if ( ::qt_cast(o->parent()) && !::qt_cast(o) ) + return 0; + while ( o ) { + if ( ::qt_cast(o) ) + return (QWidget*)o; + o = o->parent(); + } + return 0; +} + +QWidget *MainWindow::isAToolBarChild( QObject *o ) const +{ + while ( o ) { + if ( ::qt_cast(o) ) + return (QWidget*)o; + if ( ::qt_cast(o) ) + return 0; + o = o->parent(); + } + return 0; +} + +FormWindow *MainWindow::formWindow() +{ + if ( qworkspace->activeWindow() ) { + FormWindow *fw = 0; + if ( ::qt_cast(qworkspace->activeWindow()) ) + fw = (FormWindow*)qworkspace->activeWindow(); + else if ( lastActiveFormWindow && + qworkspace->windowList().find( lastActiveFormWindow ) != -1) + fw = lastActiveFormWindow; + return fw; + } + return 0; +} + +void MainWindow::emitProjectSignals() +{ + emit hasNonDummyProject( !currentProject->isDummy() ); + emit hasActiveWindowOrProject( !!qworkspace->activeWindow() || !currentProject->isDummy() ); +} + +void MainWindow::insertFormWindow( FormWindow *fw ) +{ + if ( fw ) + QWhatsThis::add( fw, i18n( "The Form Window" + "

      Use the various tools to add widgets or to change the layout " + "and behavior of the components in the form. Select one or multiple " + "widgets to move them or lay them out. If a single widget is chosen it can " + "be resized using the resize handles.

      " + "

      Changes in the Property Editor are visible at design time, " + "and you can preview the form in different styles.

      " + "

      You can change the grid resolution, or turn the grid off in the " + "Preferences dialog in the Edit menu." + "

      You can have several forms open, and all open forms are listed " + "in the Form List.") ); + + connect( fw, SIGNAL( showProperties( QObject * ) ), + this, SLOT( showProperties( QObject * ) ) ); + connect( fw, SIGNAL( updateProperties( QObject * ) ), + this, SLOT( updateProperties( QObject * ) ) ); + connect( this, SIGNAL( currentToolChanged() ), + fw, SLOT( currentToolChanged() ) ); + connect( fw, SIGNAL( selectionChanged() ), + this, SLOT( selectionChanged() ) ); + connect( fw, SIGNAL( undoRedoChanged( bool, bool, const QString &, const QString & ) ), + this, SLOT( updateUndoRedo( bool, bool, const QString &, const QString & ) ) ); + + if ( !mblockNewForms ) { + } else { + fw->setProject( currentProject ); + } + fw->show(); + fw->currentToolChanged(); + if ( fw->caption().isEmpty() && qstrlen( fw->name() ) ) + fw->setCaption( fw->name() ); + fw->mainContainer()->setCaption( fw->caption() ); + WidgetFactory::saveDefaultProperties( fw->mainContainer(), + WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( fw->mainContainer() ) ) ); + activeWindowChanged( fw ); + emit formWindowsChanged(); + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->project() == fw->project() ) + e->resetContext(); + } +} + +void MainWindow::createNewProject( const QString &lang ) +{ + Project *pro = new Project( "", "", projectSettingsPluginManager ); + pro->setLanguage( lang ); + + + if ( !openProjectSettings( pro ) ) { + delete pro; + return; + } + + if ( !pro->isValid() ) { + QMessageBox::information( this, i18n("New Project"), i18n( "Cannot create an invalid project." ) ); + delete pro; + return; + } + + QAction *a = new QAction( pro->makeRelative( pro->fileName() ), + pro->makeRelative( pro->fileName() ), 0, actionGroupProjects, 0, TRUE ); + projects.insert( a, pro ); + addRecentlyOpened( pro->makeAbsolute( pro->fileName() ), recentlyProjects ); + projectSelected( a ); +} + + +bool MainWindow::unregisterClient( FormWindow *w ) +{ + propertyEditor->closed( w ); + objectHierarchy()->closed( w ); + if ( w == lastActiveFormWindow ) + lastActiveFormWindow = 0; + + QPtrList waitingForDelete; + waitingForDelete.setAutoDelete( TRUE ); + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->object() == w ) + waitingForDelete.append( e ); + } + + if ( actionEditor->form() == w ) { + actionEditor->setFormWindow( 0 ); + actionEditor->parentWidget()->hide(); + } + + return TRUE; +} + +void MainWindow::activeWindowChanged( QWidget *w ) +{ + QWidget *old = formWindow(); + if ( ::qt_cast(w) ) { + FormWindow *fw = (FormWindow*)w; + FormWindow *ofw = lastActiveFormWindow; + lastActiveFormWindow = fw; + lastActiveFormWindow->updateUndoInfo(); + emit hasActiveForm( TRUE ); + if ( formWindow() ) { + formWindow()->emitShowProperties(); + emit formModified( formWindow()->commandHistory()->isModified() ); + if ( currentTool() != POINTER_TOOL ) + formWindow()->clearSelection(); + } + workspace()->activeFormChanged( fw ); + setAppropriate( (QDockWindow*)actionEditor->parentWidget(), + ::qt_cast(lastActiveFormWindow->mainContainer()) ); + if ( appropriate( (QDockWindow*)actionEditor->parentWidget() ) ) { + if ( actionEditor->wantToBeShown() ) + actionEditor->parentWidget()->show(); + } else { + QWidget *mc = 0; + if ( ofw && (mc = ofw->mainContainer()) && ::qt_cast(mc) ) + actionEditor->setWantToBeShown( !actionEditor->parentWidget()->isHidden() ); + actionEditor->parentWidget()->hide(); + } + + actionEditor->setFormWindow( lastActiveFormWindow ); + if ( wspace && fw->project() && fw->project() != currentProject ) { + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) { + if ( *it == fw->project() ) { + projectSelected( it.key() ); + break; + } + } + } + emit formWindowChanged(); + + } else if ( w == propertyEditor ) { + propertyEditor->resetFocus(); + } else if ( !lastActiveFormWindow ) { + emit formWindowChanged(); + emit hasActiveForm( FALSE ); + actionEditUndo->setEnabled( FALSE ); + actionEditRedo->setEnabled( FALSE ); + } + + if ( !w ) { + emit formWindowChanged(); + emit hasActiveForm( FALSE ); + propertyEditor->clear(); + hierarchyView->clear(); + updateUndoRedo( FALSE, FALSE, QString::null, QString::null ); + } + + selectionChanged(); + + if ( ::qt_cast(w) ) { + SourceEditor *se = (SourceEditor*)w; + QGuardedPtr fw = se->formWindow(); + if ( se->formWindow() && + lastActiveFormWindow != fw ) { + activeWindowChanged( se->formWindow() ); + } + actionSearchFind->setEnabled( TRUE ); + actionSearchIncremetal->setEnabled( TRUE ); + actionSearchReplace->setEnabled( TRUE ); + actionSearchGotoLine->setEnabled( TRUE ); + incrementalSearch->setEnabled( TRUE ); + + actionEditUndo->setEnabled( FALSE ); + actionEditRedo->setEnabled( FALSE ); + actionEditCut->setEnabled( TRUE ); + actionEditCopy->setEnabled( TRUE ); + actionEditPaste->setEnabled( TRUE ); + actionEditSelectAll->setEnabled( TRUE ); + actionEditUndo->setMenuText( i18n( "&Undo" ) ); + actionEditUndo->setToolTip( textNoAccel( actionEditUndo->menuText()) ); + actionEditRedo->setMenuText( i18n( "&Redo" ) ); + actionEditRedo->setToolTip( textNoAccel( actionEditRedo->menuText()) ); + if ( hierarchyView->sourceEditor() != w ) + hierarchyView->showClasses( se ); + actionEditor->setFormWindow( 0 ); + if ( wspace && se->project() && se->project() != currentProject ) { + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) { + if ( *it == se->project() ) { + projectSelected( it.key() ); + break; + } + } + } + workspace()->activeEditorChanged( se ); + } else { + actionSearchFind->setEnabled( FALSE ); + actionSearchIncremetal->setEnabled( FALSE ); + actionSearchReplace->setEnabled( FALSE ); + actionSearchGotoLine->setEnabled( FALSE ); + incrementalSearch->setEnabled( FALSE ); + } + + if ( currentTool() == ORDER_TOOL && w != old ) + emit currentToolChanged(); + + emit hasActiveWindow( !!qworkspace->activeWindow() ); +} + +void MainWindow::updateUndoRedo( bool undoAvailable, bool redoAvailable, + const QString &undoCmd, const QString &redoCmd ) +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) + return; // do not set a formWindow related command + actionEditUndo->setEnabled( undoAvailable ); + actionEditRedo->setEnabled( redoAvailable ); + if ( !undoCmd.isEmpty() ) + actionEditUndo->setMenuText( i18n( "&Undo: %1" ).arg( undoCmd ) ); + else + actionEditUndo->setMenuText( i18n( "&Undo: Not Available" ) ); + if ( !redoCmd.isEmpty() ) + actionEditRedo->setMenuText( i18n( "&Redo: %1" ).arg( redoCmd ) ); + else + actionEditRedo->setMenuText( i18n( "&Redo: Not Available" ) ); + + actionEditUndo->setToolTip( textNoAccel( actionEditUndo->menuText()) ); + actionEditRedo->setToolTip( textNoAccel( actionEditRedo->menuText()) ); + + if ( currentTool() == ORDER_TOOL ) { + actionEditUndo->setEnabled( FALSE ); + actionEditRedo->setEnabled( FALSE ); + } +} + +void MainWindow::updateEditorUndoRedo() +{ + if ( !qWorkspace()->activeWindow() || + !::qt_cast(qWorkspace()->activeWindow()) ) + return; + SourceEditor *editor = (SourceEditor*)qWorkspace()->activeWindow(); + actionEditUndo->setEnabled( editor->editIsUndoAvailable() ); + actionEditRedo->setEnabled( editor->editIsRedoAvailable() ); +} + +QWorkspace *MainWindow::qWorkspace() const +{ + return qworkspace; +} + +void MainWindow::popupFormWindowMenu( const QPoint & gp, FormWindow *fw ) +{ + QValueList ids; + QMap commands; + + setupRMBSpecialCommands( ids, commands, fw ); + setupRMBProperties( ids, commands, fw ); + + qApp->processEvents(); + int r = rmbFormWindow->exec( gp ); + + handleRMBProperties( r, commands, fw ); + handleRMBSpecialCommands( r, commands, fw ); + + for ( QValueList::ConstIterator i = ids.begin(); i != ids.end(); ++i ) + rmbFormWindow->removeItem( *i ); +} + +void MainWindow::popupWidgetMenu( const QPoint &gp, FormWindow * /*fw*/, QWidget * w) +{ + QValueList ids; + QMap commands; + + setupRMBSpecialCommands( ids, commands, w ); + setupRMBProperties( ids, commands, w ); + + qApp->processEvents(); + int r = rmbWidgets->exec( gp ); + + handleRMBProperties( r, commands, w ); + handleRMBSpecialCommands( r, commands, w ); + + for ( QValueList::ConstIterator i = ids.begin(); i != ids.end(); ++i ) + rmbWidgets->removeItem( *i ); +} + +void MainWindow::setupRMBProperties( QValueList &ids, QMap &props, QWidget *w ) +{ + const QMetaProperty* text = w->metaObject()->property( w->metaObject()->findProperty( "text", TRUE ), TRUE ); + if ( text && qstrcmp( text->type(), "QString") != 0 ) + text = 0; + const QMetaProperty* title = w->metaObject()->property( w->metaObject()->findProperty( "title", TRUE ), TRUE ); + if ( title && qstrcmp( title->type(), "QString") != 0 ) + title = 0; + const QMetaProperty* pagetitle = + w->metaObject()->property( w->metaObject()->findProperty( "pageTitle", TRUE ), TRUE ); + if ( pagetitle && qstrcmp( pagetitle->type(), "QString") != 0 ) + pagetitle = 0; + const QMetaProperty* pixmap = + w->metaObject()->property( w->metaObject()->findProperty( "pixmap", TRUE ), TRUE ); + if ( pixmap && qstrcmp( pixmap->type(), "QPixmap") != 0 ) + pixmap = 0; + + if ( text && text->designable(w) || + title && title->designable(w) || + pagetitle && pagetitle->designable(w) || + pixmap && pixmap->designable(w) ) { + int id = 0; + if ( ids.isEmpty() ) + ids << rmbWidgets->insertSeparator(0); + if ( pixmap && pixmap->designable(w) ) { + ids << ( id = rmbWidgets->insertItem( i18n("Choose Pixmap..."), -1, 0) ); + props.insert( "pixmap", id ); + } + if ( text && text->designable(w) && !::qt_cast(w) ) { + ids << ( id = rmbWidgets->insertItem( i18n("Edit Text..."), -1, 0) ); + props.insert( "text", id ); + } + if ( title && title->designable(w) ) { + ids << ( id = rmbWidgets->insertItem( i18n("Edit Title..."), -1, 0) ); + props.insert( "title", id ); + } + if ( pagetitle && pagetitle->designable(w) ) { + ids << ( id = rmbWidgets->insertItem( i18n("Edit Page Title..."), -1, 0) ); + props.insert( "pagetitle", id ); + } + } +} + +#ifdef QT_CONTAINER_CUSTOM_WIDGETS +static QWidgetContainerInterfacePrivate *containerWidgetInterface( QWidget *w ) +{ + WidgetInterface *iface = 0; + widgetManager()->queryInterface( WidgetFactory::classNameOf( w ), &iface ); + if ( !iface ) + return 0; + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( !iface2 ) + return 0; + iface->release(); + return iface2; +} +#endif + +void MainWindow::setupRMBSpecialCommands( QValueList &ids, + QMap &commands, QWidget *w ) +{ + int id; + + if ( ::qt_cast(w) ) { + if ( ids.isEmpty() ) + ids << rmbWidgets->insertSeparator( 0 ); + if ( ( (QDesignerTabWidget*)w )->count() > 1) { + ids << ( id = rmbWidgets->insertItem( i18n("Delete Page"), -1, 0 ) ); + commands.insert( "remove", id ); + } + ids << ( id = rmbWidgets->insertItem( i18n("Add Page"), -1, 0 ) ); + commands.insert( "add", id ); + } else if ( ::qt_cast(w) ) { + if ( ids.isEmpty() ) + ids << rmbWidgets->insertSeparator( 0 ); + if ( ( (QDesignerWidgetStack*)w )->count() > 1) { + ids << ( id = rmbWidgets->insertItem( i18n("Previous Page"), -1, 0 ) ); + commands.insert( "prevpage", id ); + ids << ( id = rmbWidgets->insertItem( i18n("Next Page"), -1, 0 ) ); + ids << rmbWidgets->insertSeparator( 0 ); + commands.insert( "nextpage", id ); + ids << ( id = rmbWidgets->insertItem( i18n("Delete Page"), -1, 0 ) ); + commands.insert( "remove", id ); + } + ids << ( id = rmbWidgets->insertItem( i18n("Add Page"), -1, 0 ) ); + commands.insert( "add", id ); + } else if ( ::qt_cast(w) ) { + if ( ids.isEmpty() ) + ids << rmbWidgets->insertSeparator( 0 ); + if ( ( (QToolBox*)w )->count() > 1 ) { + ids << ( id = rmbWidgets->insertItem( i18n("Delete Page"), -1, 0 ) ); + commands.insert( "remove", id ); + } + ids << ( id = rmbWidgets->insertItem( i18n("Add Page"), -1, 0 ) ); + commands.insert( "add", id ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + } else if ( WidgetDatabase:: + isCustomPluginWidget( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ) ) ) { + QWidgetContainerInterfacePrivate *iface = containerWidgetInterface( w ); + if ( iface && iface->supportsPages( WidgetFactory::classNameOf( w ) ) ) { + if ( ids.isEmpty() ) + ids << rmbWidgets->insertSeparator( 0 ); + + if ( iface->count( WidgetFactory::classNameOf( w ), w ) > 1 ) { + ids << ( id = rmbWidgets->insertItem( i18n( "Delete Page" ), -1, 0 ) ); + commands.insert( "remove", id ); + } + ids << ( id = rmbWidgets->insertItem( i18n("Add Page"), -1, 0 ) ); + commands.insert( "add", id ); + if ( iface->currentIndex( WidgetFactory::classNameOf( w ), w ) != -1 ) { + ids << ( id = rmbWidgets->insertItem( i18n("Rename Current Page..."), -1, 0 ) ); + commands.insert( "rename", id ); + } + } + if ( iface ) + iface->release(); +#endif // QT_CONTAINER_CUSTOM_WIDGETS + } + + if ( WidgetFactory::hasSpecialEditor( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ), w ) ) { + if ( ids.isEmpty() ) + ids << rmbWidgets->insertSeparator( 0 ); + ids << ( id = rmbWidgets->insertItem( i18n("Edit..."), -1, 0 ) ); + commands.insert( "edit", id ); + } +} + +void MainWindow::setupRMBSpecialCommands( QValueList &ids, + QMap &commands, FormWindow *fw ) +{ + int id; + + if ( ::qt_cast(fw->mainContainer()) ) { + if ( ids.isEmpty() ) + ids << rmbFormWindow->insertSeparator( 0 ); + + if ( ( (QWizard*)fw->mainContainer() )->pageCount() > 1) { + ids << ( id = rmbFormWindow->insertItem( i18n("Delete Page"), -1, 0 ) ); + commands.insert( "remove", id ); + } + + ids << ( id = rmbFormWindow->insertItem( i18n("Add Page"), -1, 0 ) ); + commands.insert( "add", id ); + + ids << ( id = rmbFormWindow->insertItem( i18n("Edit Page Title..."), -1, 0 ) ); + commands.insert( "rename", id ); + + ids << ( id = rmbFormWindow->insertItem( i18n("Edit Pages..."), -1, 0 ) ); + commands.insert( "edit", id ); + + } else if ( ::qt_cast(fw->mainContainer()) ) { + if ( ids.isEmpty() ) + ids << rmbFormWindow->insertSeparator( 0 ); + ids << ( id = rmbFormWindow->insertItem( i18n( "Add Menu Item" ), -1, 0 ) ); + commands.insert( "add_menu_item", id ); + ids << ( id = rmbFormWindow->insertItem( i18n( "Add Toolbar" ), -1, 0 ) ); + commands.insert( "add_toolbar", id ); + } +} + +void MainWindow::handleRMBProperties( int id, QMap &props, QWidget *w ) +{ + if ( id == props[ "text" ] ) { + bool ok = FALSE; + bool oldDoWrap = FALSE; + if ( ::qt_cast(w) ) { + int align = w->property( "alignment" ).toInt(); + if ( align & WordBreak ) + oldDoWrap = TRUE; + } + bool doWrap = oldDoWrap; + + QString text; + if ( ::qt_cast(w) || ::qt_cast(w) || ::qt_cast(w) ) { + text = MultiLineEditor::getText( this, w->property( "text" ).toString(), !::qt_cast(w), &doWrap ); + ok = !text.isNull(); + } else { + text = QInputDialog::getText( i18n("Text"), i18n( "New text" ), + QLineEdit::Normal, w->property("text").toString(), &ok, this ); + } + if ( ok ) { + if ( oldDoWrap != doWrap ) { + QString pn( i18n( "Set 'wordwrap' of '%1'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "wordwrap", QVariant( oldDoWrap, 0 ), + QVariant( doWrap, 0 ), QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE ); + } + + QString pn( i18n( "Set the 'text' of '%1'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "text", w->property( "text" ), + text, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "text", TRUE ); + } + } else if ( id == props[ "title" ] ) { + bool ok = FALSE; + QString title = QInputDialog::getText( i18n("Title"), i18n( "New title" ), + QLineEdit::Normal, w->property("title").toString(), &ok, this ); + if ( ok ) { + QString pn( i18n( "Set the 'title' of '%2'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "title", w->property( "title" ), + title, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "title", TRUE ); + } + } else if ( id == props[ "pagetitle" ] ) { + bool ok = FALSE; + QString text = QInputDialog::getText( i18n("Page Title"), i18n( "New page title" ), + QLineEdit::Normal, w->property("pageTitle").toString(), &ok, this ); + if ( ok ) { + QString pn( i18n( "Set the 'pageTitle' of '%2'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "pageTitle", + w->property( "pageTitle" ), + text, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "pageTitle", TRUE ); + } + } else if ( id == props[ "pixmap" ] ) { + QPixmap oldPix = w->property( "pixmap" ).toPixmap(); + QPixmap pix = qChoosePixmap( this, formWindow(), oldPix ); + if ( !pix.isNull() ) { + QString pn( i18n( "Set the 'pixmap' of '%2'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "pixmap", w->property( "pixmap" ), + pix, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "pixmap", TRUE ); + } + } +} + +void MainWindow::handleRMBSpecialCommands( int id, QMap &commands, QWidget *w ) +{ + if ( ::qt_cast(w) ) { + QTabWidget *tw = (QTabWidget*)w; + if ( id == commands[ "add" ] ) { + AddTabPageCommand *cmd = + new AddTabPageCommand( i18n( "Add Page to %1" ).arg( tw->name() ), formWindow(), + tw, "Tab" ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( id == commands[ "remove" ] ) { + if ( tw->currentPage() ) { + QDesignerTabWidget *dtw = (QDesignerTabWidget*)tw; + DeleteTabPageCommand *cmd = + new DeleteTabPageCommand( i18n( "Delete Page %1 of %2" ). + arg( dtw->pageTitle() ).arg( tw->name() ), + formWindow(), tw, tw->currentPage() ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } + } else if ( ::qt_cast(w) ) { + QToolBox *tb = (QToolBox*)w; + if ( id == commands[ "add" ] ) { + AddToolBoxPageCommand *cmd = + new AddToolBoxPageCommand( i18n( "Add Page to %1" ).arg( tb->name() ), + formWindow(), + tb, "Page" ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( id == commands[ "remove" ] ) { + if ( tb->currentItem() ) { + DeleteToolBoxPageCommand *cmd = + new DeleteToolBoxPageCommand( i18n( "Delete Page %1 of %2" ). + arg( tb->itemLabel( tb->currentIndex() ) ). + arg( tb->name() ), + formWindow(), tb, tb->currentItem() ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } + } else if ( ::qt_cast(w) ) { + QDesignerWidgetStack *ws = (QDesignerWidgetStack*)w; + if ( id == commands[ "add" ] ) { + AddWidgetStackPageCommand *cmd = + new AddWidgetStackPageCommand( i18n( "Add Page to %1" ).arg( ws->name() ), + formWindow(), ws ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( id == commands[ "remove" ] ) { + if ( ws->visibleWidget() ) { + DeleteWidgetStackPageCommand *cmd = + new DeleteWidgetStackPageCommand( i18n( "Delete Page %1 of %2" ). + arg( ws->currentPage() ).arg( ws->name() ), + formWindow(), ws, ws->visibleWidget() ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } else if ( id == commands[ "nextpage" ] ) { + int currentPage = w->property( "currentPage" ).toInt(); + QString pn( i18n( "Raise next page of '%2'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = + new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "currentPage", currentPage, + currentPage + 1, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "currentPage", TRUE ); + } else if ( id == commands[ "prevpage" ] ) { + int currentPage = w->property( "currentPage" ).toInt(); + QString pn( i18n( "Raise previous page of '%2'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = + new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "currentPage", currentPage, + currentPage -1, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "currentPage", TRUE ); + } +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + } else if ( WidgetDatabase:: + isCustomPluginWidget( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ) ) ) { + if ( id == commands[ "add" ] ) { + AddContainerPageCommand *cmd = + new AddContainerPageCommand( i18n( "Add Page to %1" ).arg( w->name() ), + formWindow(), w, "Page" ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( id == commands[ "remove" ] ) { + QWidgetContainerInterfacePrivate *iface = containerWidgetInterface( w ); + if ( iface ) { + QString wClassName = WidgetFactory::classNameOf( w ); + int index = iface->currentIndex( wClassName, w ); + DeleteContainerPageCommand *cmd = + new DeleteContainerPageCommand( i18n( "Delete Page %1 of %2" ). + arg( iface->pageLabel( wClassName, + w, index ) ). + arg( w->name() ), + formWindow(), w, index ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + iface->release(); + } + } else if ( id == commands[ "rename" ] ) { + QWidgetContainerInterfacePrivate *iface = containerWidgetInterface( w ); + if ( iface ) { + bool ok = FALSE; + QString wClassName = WidgetFactory::classNameOf( w ); + int index = iface->currentIndex( wClassName, w ); + QString text = QInputDialog::getText( i18n("Page Title"), i18n( "New page title" ), + QLineEdit::Normal, + iface->pageLabel( wClassName, w, + index ), + &ok, this ); + if ( ok ) { + RenameContainerPageCommand *cmd = + new RenameContainerPageCommand( i18n( "Rename Page %1 to %2" ). + arg( iface-> + pageLabel( wClassName, w, + index ) ). + arg( text ), formWindow(), + w, index, text ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + iface->release(); + } + } +#endif // QT_CONTAINER_CUSTOM_WIDGETS + } + + if ( WidgetFactory::hasSpecialEditor( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ), w ) ) { + if ( id == commands[ "edit" ] ) + WidgetFactory::editWidget( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ), this, w, formWindow() ); + } +} + +void MainWindow::handleRMBSpecialCommands( int id, QMap &commands, FormWindow *fw ) +{ + if ( ::qt_cast(fw->mainContainer()) ) { + QWizard *wiz = (QWizard*)fw->mainContainer(); + if ( id == commands[ "add" ] ) { + AddWizardPageCommand *cmd = + new AddWizardPageCommand( i18n( "Add Page to %1" ).arg( wiz->name() ), + formWindow(), wiz, "WizardPage" ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( id == commands[ "remove" ] ) { + if ( wiz->currentPage() ) { + QDesignerWizard *dw = (QDesignerWizard*)wiz; + DeleteWizardPageCommand *cmd = + new DeleteWizardPageCommand( i18n( "Delete Page %1 of %2" ). + arg( dw->pageTitle() ).arg( wiz->name() ), + formWindow(), wiz, + wiz->indexOf( wiz->currentPage() ) ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } else if ( id == commands[ "edit" ] ) { + WizardEditor *e = new WizardEditor( this, wiz, fw ); + e->exec(); + delete e; + } else if ( id == commands[ "rename" ] ) { + + bool ok = FALSE; + QDesignerWizard *dw = (QDesignerWizard*)wiz; + QString text = QInputDialog::getText( i18n("Page Title"), i18n( "New page title" ), + QLineEdit::Normal, dw->pageTitle(), &ok, this ); + if ( ok ) { + QString pn( i18n( "Rename page %1 of %2" ).arg( dw->pageTitle() ).arg( wiz->name() ) ); + RenameWizardPageCommand *cmd = + new RenameWizardPageCommand( pn, formWindow() + , wiz, wiz->indexOf( wiz->currentPage() ), text ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } + } else if ( ::qt_cast(fw->mainContainer()) ) { + QMainWindow *mw = (QMainWindow*)fw->mainContainer(); + if ( id == commands[ "add_toolbar" ] ) { + AddToolBarCommand *cmd = + new AddToolBarCommand( i18n( "Add Toolbar to '%1'" ).arg( formWindow()->name() ), + formWindow(), mw ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( id == commands[ "add_menu_item" ] ) { + AddMenuCommand *cmd = + new AddMenuCommand( i18n( "Add Menu to '%1'" ).arg( formWindow()->name() ), + formWindow(), mw ); + formWindow()->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + } +} + +void MainWindow::clipboardChanged() +{ + QString text( qApp->clipboard()->text() ); + QString start( "" ); + actionEditPaste->setEnabled( text.left( start.length() ) == start ); +} + +void MainWindow::selectionChanged() +{ + layoutChilds = FALSE; + layoutSelected = FALSE; + breakLayout = FALSE; + if ( !formWindow() ) { + actionEditCut->setEnabled( FALSE ); + actionEditCopy->setEnabled( FALSE ); + actionEditDelete->setEnabled( FALSE ); + actionEditAdjustSize->setEnabled( FALSE ); + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditSplitHorizontal->setEnabled( FALSE ); + actionEditSplitVertical->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + actionEditBreakLayout->setEnabled( FALSE ); + actionEditLower->setEnabled( FALSE ); + actionEditRaise->setEnabled( FALSE ); + actionEditAdjustSize->setEnabled( FALSE ); + return; + } + + int selectedWidgets = formWindow()->numSelectedWidgets(); + bool enable = selectedWidgets > 0; + actionEditCut->setEnabled( enable ); + actionEditCopy->setEnabled( enable ); + actionEditDelete->setEnabled( enable ); + actionEditLower->setEnabled( enable ); + actionEditRaise->setEnabled( enable ); + + actionEditAdjustSize->setEnabled( FALSE ); + actionEditSplitHorizontal->setEnabled( FALSE ); + actionEditSplitVertical->setEnabled( FALSE ); + + enable = FALSE; + QWidgetList widgets = formWindow()->selectedWidgets(); + if ( selectedWidgets > 1 ) { + int unlaidout = 0; + int laidout = 0; + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + if ( !w->parentWidget() || WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ) + unlaidout++; + else + laidout++; + } + actionEditHLayout->setEnabled( unlaidout > 1 ); + actionEditVLayout->setEnabled( unlaidout > 1 ); + actionEditSplitHorizontal->setEnabled( unlaidout > 1 ); + actionEditSplitVertical->setEnabled( unlaidout > 1 ); + actionEditGridLayout->setEnabled( unlaidout > 1 ); + actionEditBreakLayout->setEnabled( laidout > 0 ); + actionEditAdjustSize->setEnabled( laidout > 0 ); + layoutSelected = unlaidout > 1; + breakLayout = laidout > 0; + } else if ( selectedWidgets == 1 ) { + QWidget *w = widgets.first(); + bool isContainer = WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ) || + w == formWindow()->mainContainer(); + actionEditAdjustSize->setEnabled( !w->parentWidget() || + WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ); + + if ( !isContainer ) { + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) { + actionEditBreakLayout->setEnabled( !isAToolBarChild( w ) ); + breakLayout = TRUE; + } else { + actionEditBreakLayout->setEnabled( FALSE ); + } + } else { + if ( WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) { + if ( !formWindow()->hasInsertedChildren( w ) ) { + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + actionEditBreakLayout->setEnabled( FALSE ); + } else { + actionEditHLayout->setEnabled( TRUE ); + actionEditVLayout->setEnabled( TRUE ); + actionEditGridLayout->setEnabled( TRUE ); + actionEditBreakLayout->setEnabled( FALSE ); + layoutChilds = TRUE; + } + if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) { + actionEditBreakLayout->setEnabled( !isAToolBarChild( w ) ); + breakLayout = TRUE; + } + } else { + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + actionEditBreakLayout->setEnabled( !isAToolBarChild( w ) ); + breakLayout = TRUE; + } + } + } else if ( selectedWidgets == 0 ) { + actionEditAdjustSize->setEnabled( TRUE ); + QWidget *w = formWindow()->mainContainer(); + if ( WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) { + if ( !formWindow()->hasInsertedChildren( w ) ) { + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + actionEditBreakLayout->setEnabled( FALSE ); + } else { + actionEditHLayout->setEnabled( TRUE ); + actionEditVLayout->setEnabled( TRUE ); + actionEditGridLayout->setEnabled( TRUE ); + actionEditBreakLayout->setEnabled( FALSE ); + layoutChilds = TRUE; + } + } else { + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + actionEditBreakLayout->setEnabled( TRUE ); + breakLayout = TRUE; + } + } else { + actionEditHLayout->setEnabled( FALSE ); + actionEditVLayout->setEnabled( FALSE ); + actionEditGridLayout->setEnabled( FALSE ); + actionEditBreakLayout->setEnabled( FALSE ); + } +} + +static QString fixArgs( const QString &s2 ) +{ + QString s = s2; + return s.replace( ',', ';' ); +} + +void MainWindow::writeConfig() +{ + QSettings config; + + // No search path for unix, only needs application name + config.insertSearchPath( QSettings::Windows, "/Trolltech" ); + + QString keybase = DesignerApplication::settingsKey(); + + if (savePluginPaths) { + QStringList pluginPaths = QApplication::libraryPaths(); + config.writeEntry( keybase + "PluginPaths", pluginPaths ); + } + config.writeEntry( keybase + "RestoreWorkspace", restoreConfig ); + config.writeEntry( keybase + "SplashScreen", splashScreen ); + config.writeEntry( keybase + "ShowStartDialog", shStartDialog ); + config.writeEntry( keybase + "FileFilter", fileFilter ); + config.writeEntry( keybase + "TemplatePath", templPath ); + config.writeEntry( keybase + "RecentlyOpenedFiles", recentlyFiles ); + config.writeEntry( keybase + "RecentlyOpenedProjects", recentlyProjects ); + config.writeEntry( keybase + "DatabaseAutoEdit", databaseAutoEdit ); + + config.writeEntry( keybase + "AutoSave/Enabled", autoSaveEnabled ); + config.writeEntry( keybase + "AutoSave/Interval", autoSaveInterval ); + + config.writeEntry( keybase + "Grid/Snap", snGrid ); + config.writeEntry( keybase + "Grid/Show", sGrid ); + config.writeEntry( keybase + "Grid/x", grid().x() ); + config.writeEntry( keybase + "Grid/y", grid().y() ); + config.writeEntry( keybase + "LastToolPage", + toolBox->itemLabel( toolBox->currentIndex() ) ); + + config.writeEntry( keybase + "Background/UsePixmap", backPix ); + config.writeEntry( keybase + "Background/Color", (int)qworkspace->backgroundColor().rgb() ); + if ( qworkspace->backgroundPixmap() ) + qworkspace->backgroundPixmap()->save( QDir::home().absPath() + "/.designer/" + "background.xpm", "PNG" ); + + config.writeEntry( keybase + "Geometries/MainwindowX", x() ); + config.writeEntry( keybase + "Geometries/MainwindowY", y() ); + config.writeEntry( keybase + "Geometries/MainwindowWidth", width() ); + config.writeEntry( keybase + "Geometries/MainwindowHeight", height() ); + config.writeEntry( keybase + "Geometries/MainwindowMaximized", isMaximized() ); + config.writeEntry( keybase + "Geometries/PropertyEditorX", propertyEditor->parentWidget()->x() ); + config.writeEntry( keybase + "Geometries/PropertyEditorY", propertyEditor->parentWidget()->y() ); + config.writeEntry( keybase + "Geometries/PropertyEditorWidth", propertyEditor->parentWidget()->width() ); + config.writeEntry( keybase + "Geometries/PropertyEditorHeight", propertyEditor->parentWidget()->height() ); + config.writeEntry( keybase + "Geometries/HierarchyViewX", hierarchyView->parentWidget()->x() ); + config.writeEntry( keybase + "Geometries/HierarchyViewY", hierarchyView->parentWidget()->y() ); + config.writeEntry( keybase + "Geometries/HierarchyViewWidth", hierarchyView->parentWidget()->width() ); + config.writeEntry( keybase + "Geometries/HierarchyViewHeight", hierarchyView->parentWidget()->height() ); + config.writeEntry( keybase + "Geometries/WorkspaceX", wspace->parentWidget()->x() ); + config.writeEntry( keybase + "Geometries/WorkspaceY", wspace->parentWidget()->y() ); + config.writeEntry( keybase + "Geometries/WorkspaceWidth", wspace->parentWidget()->width() ); + config.writeEntry( keybase + "Geometries/WorkspaceHeight", wspace->parentWidget()->height() ); + + config.writeEntry( keybase + "View/TextLabels", usesTextLabel() ); + config.writeEntry( keybase + "View/BigIcons", usesBigPixmaps() ); + + QString mwlKey = "MainwindowLayout"; + if ( singleProjectMode() ) + mwlKey += "S"; + QString mainWindowLayout; + QTextStream ts( &mainWindowLayout, IO_WriteOnly ); + ts << *this; + config.writeEntry( keybase + mwlKey, mainWindowLayout ); + + + QPtrList *lst = MetaDataBase::customWidgets(); + config.writeEntry( keybase + "CustomWidgets/num", (int)lst->count() ); + int j = 0; + QDir::home().mkdir( ".designer" ); + for ( MetaDataBase::CustomWidget *w = lst->first(); w; w = lst->next() ) { + QStringList l; + l << w->className; + l << w->includeFile; + l << QString::number( (int)w->includePolicy ); + l << QString::number( w->sizeHint.width() ); + l << QString::number( w->sizeHint.height() ); + l << QString::number( w->lstSignals.count() ); + for ( QValueList::ConstIterator it = w->lstSignals.begin(); it != w->lstSignals.end(); ++it ) + l << QString( fixArgs( *it ) ); + l << QString::number( w->lstSlots.count() ); + for ( QValueList::ConstIterator it2 = w->lstSlots.begin(); it2 != w->lstSlots.end(); ++it2 ) { + l << fixArgs( (*it2).function ); + l << (*it2).access; + } + l << QString::number( w->lstProperties.count() ); + for ( QValueList::ConstIterator it3 = w->lstProperties.begin(); it3 != w->lstProperties.end(); ++it3 ) { + l << (*it3).property; + l << (*it3).type; + } + l << QString::number( size_type_to_int( w->sizePolicy.horData() ) ); + l << QString::number( size_type_to_int( w->sizePolicy.verData() ) ); + l << QString::number( (int)w->isContainer ); + config.writeEntry( keybase + "CustomWidgets/Widget" + QString::number( j++ ), l, ',' ); + w->pixmap->save( QDir::home().absPath() + "/.designer/" + w->className, "XPM" ); + } + + QStringList l; + for ( QAction *a = commonWidgetsPage.first(); a; a = commonWidgetsPage.next() ) + l << a->text(); + config.writeEntry( keybase + "ToolBox/CommonWidgets", l ); +} + +static QString fixArgs2( const QString &s2 ) +{ + QString s = s2; + return s.replace( ';', ',' ); +} + +void MainWindow::readConfig() +{ + QString keybase = DesignerApplication::settingsKey(); + QSettings config; + config.insertSearchPath( QSettings::Windows, "/Trolltech" ); + + bool ok; + bool readPreviousConfig = FALSE; + QString backPixName( QDir::home().absPath() + "/.designer/" + "background.xpm" ); + restoreConfig = config.readBoolEntry( keybase + "RestoreWorkspace", TRUE, &ok ); + if ( !ok ) { + keybase = DesignerApplication::oldSettingsKey(); + restoreConfig = config.readBoolEntry( keybase + "RestoreWorkspace", TRUE, &ok ); + if ( !ok ) { + if ( oWindow ) { + oWindow->shuttingDown(); + ( (QDockWindow*)oWindow->parent() )->hide(); + } + QPixmap pix; + pix.load( backPixName ); + if ( !pix.isNull() ) + qworkspace->setBackgroundPixmap( pix ); + return; + } + readPreviousConfig = TRUE; + } + if ( !readPreviousConfig ) { + fileFilter = config.readEntry( keybase + "FileFilter", fileFilter ); + templPath = config.readEntry( keybase + "TemplatePath", QString::null ); + databaseAutoEdit = config.readBoolEntry( keybase + "DatabaseAutoEdit", databaseAutoEdit ); + shStartDialog = config.readBoolEntry( keybase + "ShowStartDialog", shStartDialog ); + autoSaveEnabled = config.readBoolEntry( keybase + "AutoSave/Enabled", autoSaveEnabled ); + autoSaveInterval = config.readNumEntry( keybase + "AutoSave/Interval", autoSaveInterval ); + } + + if ( restoreConfig || readPreviousConfig ) { + QString s = config.readEntry( keybase + "LastToolPage" ); + for ( int i = 0; i < toolBox->count(); ++i ) { + if ( toolBox->itemLabel(i) == s ) { + toolBox->setCurrentIndex( i ); + break; + } + } + // We know that the oldSettingsKey() will return 3.1 + if ( keybase == DesignerApplication::oldSettingsKey() ) { + if (keybase.contains("3.1")) + recentlyFiles = config.readListEntry( keybase + "RecentlyOpenedFiles", ',' ); + else + recentlyFiles = config.readListEntry(keybase + "RecentlyOpenedFiles"); + + if ( recentlyFiles.count() == 1 && recentlyFiles[0].isNull() ) + recentlyFiles.clear(); + if (keybase.contains("3.1")) + recentlyProjects = config.readListEntry( keybase + "RecentlyOpenedProjects", ',' ); + else + recentlyProjects = config.readListEntry( keybase + "RecentlyOpenedProjects"); + if ( recentlyProjects.count() == 1 && recentlyProjects[0].isNull() ) + recentlyProjects.clear(); + } else { + recentlyFiles = config.readListEntry( keybase + "RecentlyOpenedFiles" ); + recentlyProjects = config.readListEntry( keybase + "RecentlyOpenedProjects" ); + } + + backPix = config.readBoolEntry( keybase + "Background/UsePixmap", TRUE ) | readPreviousConfig; + if ( backPix ) { + QPixmap pix; + pix.load( backPixName ); + if ( !pix.isNull() ) + qworkspace->setBackgroundPixmap( pix ); + } else { + qworkspace->setBackgroundColor( QColor( (QRgb)config.readNumEntry( keybase + "Background/Color" ) ) ); + } + + if ( !readPreviousConfig ) { + splashScreen = config.readBoolEntry( keybase + "SplashScreen", TRUE ); + + sGrid = config.readBoolEntry( keybase + "Grid/Show", TRUE ); + snGrid = config.readBoolEntry( keybase + "Grid/Snap", TRUE ); + grd.setX( config.readNumEntry( keybase + "Grid/x", 10 ) ); + grd.setY( config.readNumEntry( keybase + "Grid/y", 10 ) ); + + if ( !config.readBoolEntry( DesignerApplication::settingsKey() + "Geometries/MainwindowMaximized", FALSE ) ) { + QRect r( pos(), size() ); + r.setX( config.readNumEntry( keybase + "Geometries/MainwindowX", r.x() ) ); + r.setY( config.readNumEntry( keybase + "Geometries/MainwindowY", r.y() ) ); + r.setWidth( config.readNumEntry( keybase + "Geometries/MainwindowWidth", r.width() ) ); + r.setHeight( config.readNumEntry( keybase + "Geometries/MainwindowHeight", r.height() ) ); + + QRect desk = QApplication::desktop()->geometry(); + QRect inter = desk.intersect( r ); + resize( r.size() ); + if ( inter.width() * inter.height() > ( r.width() * r.height() / 20 ) ) { + move( r.topLeft() ); + } + } + setUsesTextLabel( config.readBoolEntry( keybase + "View/TextLabels", FALSE ) ); + setUsesBigPixmaps( FALSE /*config.readBoolEntry( "BigIcons", FALSE )*/ ); // ### disabled for now + } + } + int num = config.readNumEntry( keybase + "CustomWidgets/num" ); + for ( int j = 0; j < num; ++j ) { + MetaDataBase::CustomWidget *w = new MetaDataBase::CustomWidget; + QStringList l = config.readListEntry( keybase + "CustomWidgets/Widget" + QString::number( j ), ',' ); + w->className = l[ 0 ]; + w->includeFile = l[ 1 ]; + w->includePolicy = (MetaDataBase::CustomWidget::IncludePolicy)l[ 2 ].toInt(); + w->sizeHint.setWidth( l[ 3 ].toInt() ); + w->sizeHint.setHeight( l[ 4 ].toInt() ); + uint c = 5; + if ( l.count() > c ) { + int numSignals = l[ c ].toInt(); + c++; + for ( int i = 0; i < numSignals; ++i, c++ ) + w->lstSignals.append( fixArgs2( l[ c ] ).latin1() ); + } + if ( l.count() > c ) { + int numSlots = l[ c ].toInt(); + c++; + for ( int i = 0; i < numSlots; ++i ) { + MetaDataBase::Function slot; + slot.function = fixArgs2( l[ c ] ); + c++; + slot.access = l[ c ]; + c++; + w->lstSlots.append( slot ); + } + } + if ( l.count() > c ) { + int numProperties = l[ c ].toInt(); + c++; + for ( int i = 0; i < numProperties; ++i ) { + MetaDataBase::Property prop; + prop.property = l[ c ]; + c++; + prop.type = l[ c ]; + c++; + w->lstProperties.append( prop ); + } + } if ( l.count() > c ) { + QSizePolicy::SizeType h, v; + h = int_to_size_type( l[ c++ ].toInt() ); + v = int_to_size_type( l[ c++ ].toInt() ); + w->sizePolicy = QSizePolicy( h, v ); + } + if ( l.count() > c ) { + w->isContainer = (bool)l[ c++ ].toInt(); + } + w->pixmap = new QPixmap( BarIcon( QDir::home().absPath() + "/.designer/" + w->className , KDevDesignerPartFactory::instance()) ); + MetaDataBase::addCustomWidget( w ); + } + if ( num > 0 ) + rebuildCustomWidgetGUI(); + + if ( !restoreConfig ) + return; + +#ifndef Q_WS_MAC + /* I'm sorry to make this not happen on the Mac, but it seems to hang somewhere deep + in QLayout, it gets into a very large loop - and seems it has to do with clever + things the designer does ###Sam */ + QApplication::sendPostedEvents(); +#endif + + if ( !readPreviousConfig ) { + QString mwlKey = "MainwindowLayout"; + if ( singleProjectMode() ) + mwlKey += "S"; + QString mainWindowLayout = config.readEntry( keybase + mwlKey ); + QTextStream ts( &mainWindowLayout, IO_ReadOnly ); + ts >> *this; + } + if ( readPreviousConfig && oWindow ) { + oWindow->shuttingDown(); + ( (QDockWindow*)oWindow->parent() )->hide(); + } + + rebuildCustomWidgetGUI(); + + QStringList l = config.readListEntry( keybase + "ToolBox/CommonWidgets" ); + if ( !l.isEmpty() ) { + QPtrList lst; + commonWidgetsPage.clear(); + for ( QStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) { + for ( QAction *a = toolActions.first(); a; a = toolActions.next() ) { + if ( *it == a->text() ) { + lst.append( a ); + break; + } + } + } + if ( lst != commonWidgetsPage ) { + commonWidgetsPage = lst; + rebuildCommonWidgetsToolBoxPage(); + } + } +} + +HierarchyView *MainWindow::objectHierarchy() const +{ + if ( !hierarchyView ) + ( (MainWindow*)this )->setupHierarchyView(); + return hierarchyView; +} + +QPopupMenu *MainWindow::setupNormalHierarchyMenu( QWidget *parent ) +{ + QPopupMenu *menu = new QPopupMenu( parent ); + + actionEditCut->addTo( menu ); + actionEditCopy->addTo( menu ); + actionEditPaste->addTo( menu ); + actionEditDelete->addTo( menu ); + + return menu; +} + +QPopupMenu *MainWindow::setupTabWidgetHierarchyMenu( QWidget *parent, const char *addSlot, const char *removeSlot ) +{ + QPopupMenu *menu = new QPopupMenu( parent ); + + menu->insertItem( i18n( "Add Page" ), parent, addSlot ); + menu->insertItem( i18n( "Delete Page" ), parent, removeSlot ); + menu->insertSeparator(); + actionEditCut->addTo( menu ); + actionEditCopy->addTo( menu ); + actionEditPaste->addTo( menu ); + actionEditDelete->addTo( menu ); + + return menu; +} + +void MainWindow::closeEvent( QCloseEvent *e ) +{ + if ( singleProject ) { + hide(); + e->ignore(); + return; + } + + QWidgetList windows = qWorkspace()->windowList(); + QWidgetListIt wit( windows ); + while ( wit.current() ) { + QWidget *w = wit.current(); + ++wit; + if ( ::qt_cast(w) ) { + if ( ( (FormWindow*)w )->formFile()->editor() ) + windows.removeRef( ( (FormWindow*)w )->formFile()->editor() ); + if ( ( (FormWindow*)w )->formFile()->formWindow() ) + windows.removeRef( ( (FormWindow*)w )->formFile()->formWindow() ); + if ( !( (FormWindow*)w )->formFile()->close() ) { + e->ignore(); + return; + } + } else if ( ::qt_cast(w) ) { + if ( !( (SourceEditor*)w )->close() ) { + e->ignore(); + return; + } + } + w->close(); + } + + QMapConstIterator it = projects.begin(); + while( it != projects.end() ) { + Project *pro = it.data(); + ++it; + if ( pro->isModified() ) { + switch ( QMessageBox::warning( this, i18n( "Save Project Settings" ), + i18n( "Save changes to '%1'?" ).arg( pro->fileName() ), + i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) { + case 0: // save + pro->save(); + break; + case 1: // don't save + break; + case 2: // cancel + e->ignore(); + return; + default: + break; + } + } + } + + writeConfig(); + hide(); + e->accept(); + + if ( client ) { + QDir home( QDir::homeDirPath() ); + home.remove( ".designerpid" ); + } +} + +Workspace *MainWindow::workspace() const +{ + if ( !wspace ) + ( (MainWindow*)this )->setupWorkspace(); + return wspace; +} + +PropertyEditor *MainWindow::propertyeditor() const +{ + if ( !propertyEditor ) + ( (MainWindow*)this )->setupPropertyEditor(); + return propertyEditor; +} + +ActionEditor *MainWindow::actioneditor() const +{ + if ( !actionEditor ) + ( (MainWindow*)this )->setupActionEditor(); + return actionEditor; +} + +bool MainWindow::openEditor( QWidget *w, FormWindow *f ) +{ + if ( f && !f->project()->isCpp() && !WidgetFactory::isPassiveInteractor( w ) ) { + QString defSignal = WidgetFactory::defaultSignal( w ); + if ( defSignal.isEmpty() ) { + editSource(); + } else { + QString s = QString( w->name() ) + "_" + defSignal; + LanguageInterface *iface = MetaDataBase::languageInterface( f->project()->language() ); + if ( iface ) { + QStrList sigs = iface->signalNames( w ); + QString fullSignal; + for ( int i = 0; i < (int)sigs.count(); ++i ) { + QString sig = sigs.at( i ); + if ( sig.left( sig.find( '(' ) ) == defSignal ) { + fullSignal = sig; + break; + } + } + + if ( !fullSignal.isEmpty() ) { + QString signl = fullSignal; + fullSignal = fullSignal.mid( fullSignal.find( '(' ) + 1 ); + fullSignal.remove( (int)fullSignal.length() - 1, 1 ); + fullSignal = iface->createArguments( fullSignal.simplifyWhiteSpace() ); + s += "(" + fullSignal + ")"; + if ( !MetaDataBase::hasFunction( f, s.latin1() ) ) + MetaDataBase::addFunction( f, s.latin1(), "", "public", "slot", + f->project()->language(), "void" ); + s = s.left( s.find( '(' ) ).latin1(); + if ( !MetaDataBase::hasConnection( f, w, defSignal.latin1(), f->mainContainer(), s.latin1() ) ) { + MetaDataBase::Connection conn; + conn.sender = w; + conn.receiver = f->mainContainer(); + conn.signal = signl; + conn.slot = s; + AddConnectionCommand *cmd = + new AddConnectionCommand( i18n( "Add Connection" ), f, conn ); + f->commandHistory()->addCommand( cmd ); + cmd->execute(); + f->formFile()->setModified( TRUE ); + } + } + } + editFunction( s, TRUE ); + } + return TRUE; + } + if ( WidgetFactory::hasSpecialEditor( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ), w ) ) { + statusMessage( i18n( "Edit %1..." ).arg( w->className() ) ); + WidgetFactory::editWidget( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ), + this, w, formWindow() ); + statusBar()->clear(); + return TRUE; + } + + const QMetaProperty* text = w->metaObject()->property( w->metaObject()->findProperty( "text", TRUE ), TRUE ); + const QMetaProperty* title = w->metaObject()->property( w->metaObject()->findProperty( "title", TRUE ), TRUE ); + if ( text && text->designable(w) ) { + bool ok = FALSE; + bool oldDoWrap = FALSE; + if ( ::qt_cast(w) ) { + int align = w->property( "alignment" ).toInt(); + if ( align & WordBreak ) + oldDoWrap = TRUE; + } + bool doWrap = oldDoWrap; + + QString text; + if ( ::qt_cast(w) || ::qt_cast(w) || ::qt_cast(w) ) { + text = MultiLineEditor::getText( this, w->property( "text" ).toString(), + !::qt_cast(w), &doWrap ); + ok = !text.isNull(); + } else { + text = QInputDialog::getText( i18n("Text"), i18n( "New text" ), + QLineEdit::Normal, w->property("text").toString(), &ok, this ); + } + if ( ok ) { + if ( oldDoWrap != doWrap ) { + QString pn( i18n( "Set 'wordwrap' of '%1'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "wordwrap", QVariant( oldDoWrap, 0 ), + QVariant( doWrap, 0 ), QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE ); + } + + QString pn( i18n( "Set the 'text' of '%1'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "text", w->property( "text" ), + text, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "text", TRUE ); + } + return TRUE; + } + if ( title && title->designable(w) ) { + bool ok = FALSE; + QString text; + text = QInputDialog::getText( i18n("Title"), i18n( "New title" ), QLineEdit::Normal, w->property("title").toString(), &ok, this ); + if ( ok ) { + QString pn( i18n( "Set the 'title' of '%2'" ).arg( w->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, + "title", w->property( "title" ), + text, QString::null, QString::null ); + cmd->execute(); + formWindow()->commandHistory()->addCommand( cmd ); + MetaDataBase::setPropertyChanged( w, "title", TRUE ); + } + return TRUE; + } + + if ( !WidgetFactory::isPassiveInteractor( w ) ) + editSource(); + + return TRUE; +} + +void MainWindow::rebuildCustomWidgetGUI() +{ + customWidgetToolBar->clear(); + customWidgetMenu->clear(); + customWidgetToolBar2->clear(); + int count = 0; + + QPtrListIterator it( toolActions ); + QAction *action; + while ( ( action = it.current() ) ) { + ++it; + if ( ( (WidgetAction*)action )->group() == "Custom Widgets" ) + delete action; + } + + QPtrList *lst = MetaDataBase::customWidgets(); + + actionToolsCustomWidget->addTo( customWidgetMenu ); + customWidgetMenu->insertSeparator(); + + for ( MetaDataBase::CustomWidget *w = lst->first(); w; w = lst->next() ) { + WidgetAction* a = new WidgetAction( "Custom Widgets", actionGroupTools, QString::number( w->id ).latin1() ); + a->setToggleAction( TRUE ); + a->setText( w->className ); + a->setIconSet( *w->pixmap ); + a->setStatusTip( i18n( "Insert a %1 (custom widget)" ).arg( w->className ) ); + a->setWhatsThis( i18n("%1 (custom widget)" + "

      Click Edit Custom Widgets... in the Tools|Custom menu to " + "add and change custom widgets. You can add properties as well as " + "signals and slots to integrate them into Qt Designer, " + "and provide a pixmap which will be used to represent the widget on the form.

      ").arg( w->className ) ); + + a->addTo( customWidgetToolBar ); + a->addTo( customWidgetToolBar2 ); + a->addTo( customWidgetMenu ); + count++; + } + QWidget *wid; + customWidgetToolBar2->setStretchableWidget( ( wid = new QWidget( customWidgetToolBar2 ) ) ); + wid->setBackgroundMode( customWidgetToolBar2->backgroundMode() ); + + if ( count == 0 ) + customWidgetToolBar->hide(); + else if ( customWidgetToolBar->isVisible() ) + customWidgetToolBar->show(); +} + +void MainWindow::rebuildCommonWidgetsToolBoxPage() +{ + toolBox->setUpdatesEnabled( FALSE ); + commonWidgetsToolBar->setUpdatesEnabled( FALSE ); + commonWidgetsToolBar->clear(); + for ( QAction *a = commonWidgetsPage.first(); a; a = commonWidgetsPage.next() ) + a->addTo( commonWidgetsToolBar ); + QWidget *w; + commonWidgetsToolBar->setStretchableWidget( ( w = new QWidget( commonWidgetsToolBar ) ) ); + w->setBackgroundMode( commonWidgetsToolBar->backgroundMode() ); + toolBox->setUpdatesEnabled( TRUE ); + commonWidgetsToolBar->setUpdatesEnabled( TRUE ); +} + +bool MainWindow::isCustomWidgetUsed( MetaDataBase::CustomWidget *wid ) +{ + QWidgetList windows = qWorkspace()->windowList(); + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + if ( ::qt_cast(w) ) { + if ( ( (FormWindow*)w )->isCustomWidgetUsed( wid ) ) + return TRUE; + } + } + return FALSE; +} + +void MainWindow::setGrid( const QPoint &p ) +{ + if ( p == grd ) + return; + grd = p; + QWidgetList windows = qWorkspace()->windowList(); + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + if ( !::qt_cast(w) ) + continue; + ( (FormWindow*)w )->mainContainer()->update(); + } +} + +void MainWindow::setShowGrid( bool b ) +{ + if ( b == sGrid ) + return; + sGrid = b; + QWidgetList windows = qWorkspace()->windowList(); + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + if ( !::qt_cast(w) ) + continue; + ( (FormWindow*)w )->mainContainer()->update(); + } +} + +void MainWindow::setSnapGrid( bool b ) +{ + if ( b == snGrid ) + return; + snGrid = b; +} + +QString MainWindow::documentationPath() const +{ + return QString( qInstallPathDocs() ) + "/html/"; +} + +void MainWindow::windowsMenuActivated( int id ) +{ + QWidget* w = qworkspace->windowList().at( id ); + if ( w ) + w->setFocus(); +} + +void MainWindow::projectSelected( QAction *a ) +{ + a->setOn( TRUE ); + if ( currentProject ) + currentProject->setActive( FALSE ); + Project *p = *projects.find( a ); + p->setActive( TRUE ); + if ( currentProject == p ) + return; + currentProject = p; + if ( wspace ) + wspace->setCurrentProject( currentProject ); +} + +void MainWindow::openProject( const QString &fn ) +{ + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) { + if ( (*it)->fileName() == fn ) { + projectSelected( it.key() ); + return; + } + } + QApplication::setOverrideCursor( waitCursor ); + Project *pro = new Project( fn, "", projectSettingsPluginManager ); + pro->setModified( FALSE ); + QAction *a = new QAction( pro->projectName(), pro->projectName(), 0, actionGroupProjects, 0, TRUE ); + projects.insert( a, pro ); + projectSelected( a ); + QApplication::restoreOverrideCursor(); +} + +void MainWindow::checkTempFiles() +{ + QString s = QDir::homeDirPath() + "/.designer"; + QString baseName = s+ "/saved-form-"; + if ( !QFile::exists( baseName + "1.ui" ) ) + return; + DesignerApplication::closeSplash(); + QDir d( s ); + d.setNameFilter( "*.ui" ); + QStringList lst = d.entryList(); + QApplication::restoreOverrideCursor(); + bool load = QMessageBox::information( this, i18n( "Restoring Last Session" ), + i18n( "Qt Designer found some temporary saved files, which were\n" + "written when Qt Designer crashed last time. Do you want to\n" + "load these files?" ), i18n( "&Yes" ), i18n( "&No" ) ) == 0; + QApplication::setOverrideCursor( waitCursor ); + for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) { + if ( load ) + openFormWindow( s + "/" + *it, FALSE ); + d.remove( *it ); + } +} + +void MainWindow::showDialogHelp() +{ + QWidget *w = (QWidget*)sender(); + w = w->topLevelWidget(); + + QString link = documentationPath() + "/designer-manual-13.html#"; + + if ( ::qt_cast(w) || ::qt_cast(w) ) // own doc for startdialog? + link += "dialog-file-new"; + else if ( ::qt_cast(w) ) + link += "dialog-file-create-template"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-functions"; +// else if ( ::qt_cast(w) ) + else if ( w->inherits("ConnectionViewerBase") ) + link += "dialog-view-connections"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-form-settings"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-preferences"; + else if ( ::qt_cast(w) ) + link += "dialog-image-collection"; +// else if ( ::qt_cast(w) ) + else if ( w->inherits( "DatabaseConnectionBase" ) ) + link += "dialog-edit-database-connections"; + else if ( ::qt_cast(w) ) + link += "dialog-project-settings"; + else if ( ::qt_cast(w) ) + link += "dialog-find-text"; + else if ( ::qt_cast(w) ) + link += "dialog-replace-text"; + else if ( ::qt_cast(w) ) + link += "dialog-go-to-line"; +// else if ( ::qt_cast(w) ) + else if ( w->inherits("ConnectionEditorBase") ) + link += "dialog-edit-connections"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-custom-widgets"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-palette"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-listbox"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-listview"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-iconview"; + else if ( ::qt_cast(w) ) + link += "dialog-edit-table"; + else if ( ::qt_cast(w) ) + link += "dialog-text"; + + else { + QMessageBox::information( this, i18n( "Help" ), + i18n( "There is no help available for this dialog at the moment." ) ); + return; + } + + assistant->showPage( link ); +} + +void MainWindow::setupActionManager() +{ + actionPluginManager = new QPluginManager( IID_Action, QApplication::libraryPaths(), pluginDirectory() ); + + QStringList lst = actionPluginManager->featureList(); + for ( QStringList::ConstIterator ait = lst.begin(); ait != lst.end(); ++ait ) { + ActionInterface *iface = 0; + actionPluginManager->queryInterface( *ait, &iface ); + if ( !iface ) + continue; + + iface->connectTo( desInterface ); + QAction *a = iface->create( *ait, this ); + if ( !a ) + continue; + + QString grp = iface->group( *ait ); + if ( grp.isEmpty() ) + grp = "3rd party actions"; + QPopupMenu *menu = 0; + QToolBar *tb = 0; + + if ( !( menu = (QPopupMenu*)child( grp.latin1(), "QPopupMenu" ) ) ) { + menu = new QPopupMenu( this, grp.latin1() ); + menuBar()->insertItem( i18n( grp ), menu ); + } + if ( !( tb = (QToolBar*)child( grp.latin1(), "QToolBar" ) ) ) { + tb = new QToolBar( this, grp.latin1() ); + tb->setCloseMode( QDockWindow::Undocked ); + addToolBar( tb, grp ); + } + + if ( iface->location( *ait, ActionInterface::Menu ) ) + a->addTo( menu ); + if ( iface->location( *ait, ActionInterface::Toolbar ) ) + a->addTo( tb ); + + iface->release(); + } +} + +void MainWindow::editFunction( const QString &func, bool rereadSource ) +{ + if ( !formWindow() ) + return; + + if ( formWindow()->formFile()->codeFileState() != FormFile::Ok ) + if ( !formWindow()->formFile()->setupUihFile(FALSE) ) + return; + + QString lang = currentProject->language(); + if ( !MetaDataBase::hasEditor( lang ) ) { + QMessageBox::information( this, i18n( "Edit Source" ), + i18n( "There is no plugin for editing %1 code installed.\n" + "Note: Plugins are not available in static Qt configurations." ).arg( lang ) ); + return; + } + + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->language() == lang && e->formWindow() == formWindow() ) { + e->show(); + e->setFunction( func ); + return; + } + } + + createSourceEditor( formWindow(), formWindow()->project(), lang, func, rereadSource ); +} + +void MainWindow::setupRecentlyFilesMenu() +{ + recentlyFilesMenu->clear(); + int id = 0; + for ( QStringList::ConstIterator it = recentlyFiles.begin(); it != recentlyFiles.end(); ++it ) { + recentlyFilesMenu->insertItem( *it, id ); + id++; + } +} + +void MainWindow::setupRecentlyProjectsMenu() +{ + recentlyProjectsMenu->clear(); + int id = 0; + for ( QStringList::ConstIterator it = recentlyProjects.begin(); it != recentlyProjects.end(); ++it ) { + recentlyProjectsMenu->insertItem( *it, id ); + id++; + } +} + +QPtrList MainWindow::projectList() const +{ + QPtrList list; + QMapConstIterator it = projects.begin(); + + while( it != projects.end() ) { + Project *p = it.data(); + ++it; + list.append( p->iFace() ); + } + + return list; +} + +QStringList MainWindow::projectNames() const +{ + QStringList res; + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) + res << (*it)->projectName(); + return res; +} + +QStringList MainWindow::projectFileNames() const +{ + QStringList res; + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) + res << (*it)->makeRelative( (*it)->fileName() ); + return res; +} + +Project *MainWindow::findProject( const QString &projectName ) const +{ + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) { + if ( (*it)->projectName() == projectName ) + return *it; + } + return 0; +} + +void MainWindow::setCurrentProject( Project *pro ) +{ + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) { + if ( *it == pro ) { + projectSelected( it.key() ); + return; + } + } +} + +void MainWindow::setCurrentProjectByFilename( const QString& proFilename ) +{ + for ( QMap::ConstIterator it = projects.begin(); it != projects.end(); ++it ) { + if ( (*it)->makeRelative( (*it)->fileName() ) == proFilename ) { + projectSelected( it.key() ); + return; + } + } +} + + +void MainWindow::recentlyFilesMenuActivated( int id ) +{ + if ( id != -1 ) { + if ( !QFile::exists( *recentlyFiles.at( id ) ) ) { + QMessageBox::warning( this, i18n( "Open File" ), + i18n( "Could not open '%1'. File does not exist." ). + arg( *recentlyFiles.at( id ) ) ); + recentlyFiles.remove( recentlyFiles.at( id ) ); + return; + } + fileOpen( "", "", *recentlyFiles.at( id ) ); + QString fn( *recentlyFiles.at( id ) ); + addRecentlyOpened( fn, recentlyFiles ); + } +} + +void MainWindow::recentlyProjectsMenuActivated( int id ) +{ + if ( id != -1 ) { + if ( !QFile::exists( *recentlyProjects.at( id ) ) ) { + QMessageBox::warning( this, i18n( "Open Project" ), + i18n( "Could not open '%1'. File does not exist." ). + arg( *recentlyProjects.at( id ) ) ); + recentlyProjects.remove( recentlyProjects.at( id ) ); + return; + } + openProject( *recentlyProjects.at( id ) ); + QString fn( *recentlyProjects.at( id ) ); + addRecentlyOpened( fn, recentlyProjects ); + } +} + +void MainWindow::addRecentlyOpened( const QString &fn, QStringList &lst ) +{ + QFileInfo fi( fn ); + fi.convertToAbs(); + QString f = fi.filePath(); + if ( lst.find( f ) != lst.end() ) + lst.remove( f ); + if ( lst.count() >= 10 ) + lst.pop_back(); + lst.prepend( f ); +} + +TemplateWizardInterface * MainWindow::templateWizardInterface( const QString& className ) +{ + TemplateWizardInterface* iface = 0; + templateWizardPluginManager->queryInterface( className, & iface ); + return iface; +} + +void MainWindow::setupPluginManagers() +{ + editorPluginManager = new QPluginManager( IID_Editor, QApplication::libraryPaths(), "/kdevdesigner" ); + MetaDataBase::setEditor( editorPluginManager->featureList() ); + + templateWizardPluginManager = + new QPluginManager( IID_TemplateWizard, QApplication::libraryPaths(), pluginDirectory() ); + + MetaDataBase::setupInterfaceManagers( "/designer" ); + preferencePluginManager = + new QPluginManager( IID_Preference, QApplication::libraryPaths(), pluginDirectory() ); + projectSettingsPluginManager = + new QPluginManager( IID_ProjectSettings, QApplication::libraryPaths(), pluginDirectory() ); + sourceTemplatePluginManager = + new QPluginManager( IID_SourceTemplate, QApplication::libraryPaths(), pluginDirectory() ); + + if ( preferencePluginManager ) { + QStringList lst = preferencePluginManager->featureList(); + for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) { + PreferenceInterface *i = 0; + preferencePluginManager->queryInterface( *it, &i ); + if ( !i ) + continue; + i->connectTo( designerInterface() ); + PreferenceInterface::Preference *pf = i->preference(); + if ( pf ) + addPreferencesTab( pf->tab, pf->title, pf->receiver, pf->init_slot, pf->accept_slot ); + i->deletePreferenceObject( pf ); + + i->release(); + } + } + if ( projectSettingsPluginManager ) { + QStringList lst = projectSettingsPluginManager->featureList(); + for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) { + ProjectSettingsInterface *i = 0; + projectSettingsPluginManager->queryInterface( *it, &i ); + if ( !i ) + continue; + i->connectTo( designerInterface() ); + + ProjectSettingsInterface::ProjectSettings *pf = i->projectSetting(); + if ( pf ) + addProjectTab( pf->tab, pf->title, pf->receiver, pf->init_slot, pf->accept_slot ); + i->deleteProjectSettingsObject( pf ); + i->release(); + } + } +} + +void MainWindow::addPreferencesTab( QWidget *tab, const QString &title, QObject *receiver, const char *init_slot, const char *accept_slot ) +{ + Tab t; + t.w = tab; + t.title = title; + t.receiver = receiver; + t.init_slot = init_slot; + t.accept_slot = accept_slot; + preferenceTabs << t; +} + +void MainWindow::addProjectTab( QWidget *tab, const QString &title, QObject *receiver, const char *init_slot, const char *accept_slot ) +{ + Tab t; + t.w = tab; + t.title = title; + t.receiver = receiver; + t.init_slot = init_slot; + t.accept_slot = accept_slot; + projectTabs << t; +} + +void MainWindow::setModified( bool b, QWidget *window ) +{ + QWidget *w = window; + while ( w ) { + if ( ::qt_cast(w) ) { + ( (FormWindow*)w )->modificationChanged( b ); + return; + } else if ( ::qt_cast(w) ) { + FormWindow *fw = ( (SourceEditor*)w )->formWindow(); + if ( fw && !fw->isFake() ) { + //fw->commandHistory()->setModified( b ); + //fw->modificationChanged( b ); + fw->formFile()->setModified( b, FormFile::WFormCode ); + wspace->update( fw->formFile() ); + } else { + wspace->update(); + } + return; + } + w = w->parentWidget( TRUE ); + } +} + +void MainWindow::editorClosed( SourceEditor *e ) +{ + sourceEditors.take( sourceEditors.findRef( e ) ); +} + +void MainWindow::functionsChanged() +{ + updateFunctionsTimer->start( 0, TRUE ); +} + +void MainWindow::doFunctionsChanged() +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) + e->refresh( FALSE ); + hierarchyView->formDefinitionView()->refresh(); +} + +void MainWindow::updateFunctionList() +{ + if ( !qWorkspace()->activeWindow() || !::qt_cast(qWorkspace()->activeWindow()) ) + return; + SourceEditor *se = (SourceEditor*)qWorkspace()->activeWindow(); + se->save(); + hierarchyView->formDefinitionView()->refresh(); + if ( !currentProject->isCpp() && se->formWindow() ) { + LanguageInterface *iface = MetaDataBase::languageInterface( currentProject->language() ); + if ( !iface ) + return; + QValueList conns; + iface->connections( se->text(), &conns ); + MetaDataBase::setupConnections( se->formWindow(), conns ); + propertyEditor->eventList()->setup(); + } +} + +void MainWindow::updateWorkspace() +{ + wspace->setCurrentProject( currentProject ); +} + +void MainWindow::showDebugStep( QObject *o, int line ) +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) + e->clearStep(); + if ( !o || line == -1 ) + return; + showSourceLine( o, line, Step ); +} + +void MainWindow::showStackFrame( QObject *o, int line ) +{ + if ( !o || line == -1 ) + return; + showSourceLine( o, line, StackFrame ); +} + +void MainWindow::showErrorMessage( QObject *o, int errorLine, const QString &errorMessage ) +{ + if ( o ) { + errorLine--; // ###### + QValueList l; + l << ( errorLine + 1 ); + QStringList l2; + l2 << errorMessage; + QObjectList ol; + ol.append( o ); + QStringList ll; + ll << currentProject->locationOfObject( o ); + oWindow->setErrorMessages( l2, l, TRUE, ll, ol ); + showSourceLine( o, errorLine, Error ); + } +} + +void MainWindow::finishedRun() +{ + inDebugMode = FALSE; + previewing = FALSE; + debuggingForms.clear(); + enableAll( TRUE ); + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->project() == currentProject ) + e->editorInterface()->setMode( EditorInterface::Editing ); + e->clearStackFrame(); + } + outputWindow()->clearErrorMessages(); +} + +void MainWindow::enableAll( bool enable ) +{ + menuBar()->setEnabled( enable ); + QObjectList *l = queryList( "QDockWindow" ); + for ( QObject *o = l->first(); o; o = l->next() ) { + if ( o == wspace->parentWidget() || + o == oWindow->parentWidget() || + o == hierarchyView->parentWidget() ) + continue; + ( (QWidget*)o )->setEnabled( enable ); + } + delete l; +} + +void MainWindow::showSourceLine( QObject *o, int line, LineMode lm ) +{ + QWidgetList windows = qworkspace->windowList(); + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + FormWindow *fw = 0; + SourceEditor *se = 0; + SourceFile *sf = 0; + if ( ::qt_cast(w) ) { + fw = (FormWindow*)w; + } else if ( ::qt_cast(w) ) { + se = (SourceEditor*)w; + if ( !se->object() ) + continue; + if ( se->formWindow() ) + fw = se->formWindow(); + else + sf = se->sourceFile(); + } + + if ( fw ) { + if ( fw->project() != currentProject ) + continue; + if ( qstrcmp( fw->name(), o->name() ) == 0 || + fw->isFake() && currentProject->objectForFakeForm( fw ) == o ) { + if ( se ) { + switch ( lm ) { + case Error: + se->editorInterface()->setError( line ); + break; + case Step: + se->editorInterface()->setStep( line ); + break; + case StackFrame: + se->editorInterface()->setStackFrame( line ); + break; + } + return; + } else { + fw->showNormal(); + fw->setFocus(); + lastActiveFormWindow = fw; + qApp->processEvents(); + se = editSource(); + if ( se ) { + switch ( lm ) { + case Error: + se->editorInterface()->setError( line ); + break; + case Step: + se->editorInterface()->setStep( line ); + break; + case StackFrame: + se->editorInterface()->setStackFrame( line ); + break; + } + return; + } + } + } + } else if ( se ) { + if ( o != sf ) + continue; + switch ( lm ) { + case Error: + se->editorInterface()->setError( line ); + break; + case Step: + se->editorInterface()->setStep( line ); + break; + case StackFrame: + se->editorInterface()->setStackFrame( line ); + break; + } + return; + } + } + + if ( ::qt_cast(o) ) { + for ( QPtrListIterator sources = currentProject->sourceFiles(); + sources.current(); ++sources ) { + SourceFile* f = sources.current(); + if ( f == o ) { + SourceEditor *se = editSource( f ); + if ( se ) { + switch ( lm ) { + case Error: + se->editorInterface()->setError( line ); + break; + case Step: + se->editorInterface()->setStep( line ); + break; + case StackFrame: + se->editorInterface()->setStackFrame( line ); + break; + } + } + return; + } + } + } + + FormFile *ff = currentProject->fakeFormFileFor( o ); + FormWindow *fw = 0; + if ( ff ) + fw = ff->formWindow(); + + if ( !fw && !qwf_forms ) { + qWarning( "MainWindow::showSourceLine: qwf_forms is NULL!" ); + return; + } + + mblockNewForms = TRUE; + if ( !fw ) + openFormWindow( currentProject->makeAbsolute( *qwf_forms->find( (QWidget*)o ) ) ); + else + fw->formFile()->showEditor( FALSE ); + qApp->processEvents(); // give all views the chance to get the formwindow + SourceEditor *se = editSource(); + if ( se ) { + switch ( lm ) { + case Error: + se->editorInterface()->setError( line ); + break; + case Step: + se->editorInterface()->setStep( line ); + break; + case StackFrame: + se->editorInterface()->setStackFrame( line ); + break; + } + } + mblockNewForms = FALSE; +} + + +QObject *MainWindow::findRealObject( QObject *o ) +{ + QWidgetList windows = qWorkspace()->windowList(); + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + if ( ::qt_cast(w) && QString( w->name() ) == QString( o->name() ) ) + return w; + else if ( ::qt_cast(w) && ( (SourceEditor*)w )->formWindow() && + QString( ( (SourceEditor*)w )->formWindow()->name() ) == QString( o->name() ) ) + return w; + else if ( ::qt_cast(w) && ( (SourceEditor*)w )->sourceFile() && + ( (SourceEditor*)w )->sourceFile() == o ) + return o; + } + return 0; +} + +void MainWindow::formNameChanged( FormWindow *fw ) +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->object() == fw ) + e->refresh( TRUE ); + if ( e->project() == fw->project() ) + e->resetContext(); + } +} + +void MainWindow::breakPointsChanged() +{ + if ( !inDebugMode ) + return; + if ( !qWorkspace()->activeWindow() || !::qt_cast(qWorkspace()->activeWindow()) ) + return; + SourceEditor *e = (SourceEditor*)qWorkspace()->activeWindow(); + if ( !e->object() || !e->project() ) + return; + if ( e->project() != currentProject ) + return; + + if ( !interpreterPluginManager ) { + interpreterPluginManager = + new QPluginManager( IID_Interpreter, + QApplication::libraryPaths(), + "/qsa" ); + } + + InterpreterInterface *iiface = 0; + if ( interpreterPluginManager ) { + QString lang = currentProject->language(); + iiface = 0; + interpreterPluginManager->queryInterface( lang, &iiface ); + if ( !iiface ) + return; + } + + e->saveBreakPoints(); + + for ( QObject *o = debuggingForms.first(); o; o = debuggingForms.next() ) { + if ( qstrcmp( o->name(), e->object()->name() ) == 0 ) { + iiface->setBreakPoints( o, MetaDataBase::breakPoints( e->object() ) ); + break; + } + } + + for ( e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->project() == currentProject && e->sourceFile() ) { + QValueList bps = MetaDataBase::breakPoints( e->sourceFile() ); + iiface->setBreakPoints( e->object(), bps ); + } + } + + iiface->release(); +} + +int MainWindow::currentLayoutDefaultSpacing() const +{ + if ( ( (MainWindow*)this )->formWindow() ) + return ( (MainWindow*)this )->formWindow()->layoutDefaultSpacing(); + return BOXLAYOUT_DEFAULT_SPACING; +} + +int MainWindow::currentLayoutDefaultMargin() const +{ + if ( ( (MainWindow*)this )->formWindow() ) + return ( (MainWindow*)this )->formWindow()->layoutDefaultMargin(); + return BOXLAYOUT_DEFAULT_MARGIN; +} + +void MainWindow::saveAllBreakPoints() +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + e->save(); + e->saveBreakPoints(); + } +} + +void MainWindow::resetBreakPoints() +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) + e->resetBreakPoints(); +} + +SourceFile *MainWindow::sourceFile() +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( qworkspace->activeWindow() == e ) { + if ( e->sourceFile() ) + return e->sourceFile(); + } + } + return 0; +} + +bool MainWindow::openProjectSettings( Project *pro ) +{ + ProjectSettings dia( pro, this, 0, TRUE ); + SenderObject *senderObject = new SenderObject( designerInterface() ); + QValueList::ConstIterator it; + for ( it = projectTabs.begin(); it != projectTabs.end(); ++it ) { + Tab t = *it; + if ( t.title != pro->language() ) + continue; + dia.tabWidget->addTab( t.w, t.title ); + if ( t.receiver ) { + connect( dia.buttonOk, SIGNAL( clicked() ), senderObject, SLOT( emitAcceptSignal() ) ); + connect( senderObject, SIGNAL( acceptSignal( QUnknownInterface * ) ), t.receiver, t.accept_slot ); + connect( senderObject, SIGNAL( initSignal( QUnknownInterface * ) ), t.receiver, t.init_slot ); + senderObject->emitInitSignal(); + disconnect( senderObject, SIGNAL( initSignal( QUnknownInterface * ) ), t.receiver, t.init_slot ); + } + } + + if ( singleProject ) + dia.tabWidget->setTabEnabled( dia.tabSettings, FALSE ); + + int res = dia.exec(); + + delete senderObject; + + for ( it = projectTabs.begin(); it != projectTabs.end(); ++it ) { + Tab t = *it; + dia.tabWidget->removePage( t.w ); + t.w->reparent( 0, QPoint(0,0), FALSE ); + } + + return res == QDialog::Accepted; +} + +void MainWindow::popupProjectMenu( const QPoint &pos ) +{ + projectMenu->exec( pos ); +} + +QStringList MainWindow::sourceTemplates() const +{ + return sourceTemplatePluginManager->featureList(); +} + +SourceTemplateInterface* MainWindow::sourceTemplateInterface( const QString& templ ) +{ + SourceTemplateInterface *iface = 0; + sourceTemplatePluginManager->queryInterface( templ, &iface); + return iface; +} + +QString MainWindow::whatsThisFrom( const QString &key ) +{ + if ( menuHelpFile.isEmpty() ) { + QString fn( documentationPath() ); + fn += "/designer-manual-11.html"; + QFile f( fn ); + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + menuHelpFile = ts.read(); + } + } + + int i = menuHelpFile.find( key ); + if ( i == -1 ) + return QString::null; + int start = i; + int end = i; + start = menuHelpFile.findRev( "
    • ", i ) + 4; + end = menuHelpFile.find( '\n', i ) - 1; + return menuHelpFile.mid( start, end - start + 1 ); +} + +void MainWindow::setSingleProject( Project *pro ) +{ + if ( eProject ) { + Project *pro = eProject; + pro->save(); + QWidgetList windows = qWorkspace()->windowList(); + qWorkspace()->blockSignals( TRUE ); + QWidgetListIt wit( windows ); + while ( wit.current() ) { + QWidget *w = wit.current(); + ++wit; + if ( ::qt_cast(w) ) { + if ( ( (FormWindow*)w )->project() == pro ) { + if ( ( (FormWindow*)w )->formFile()->editor() ) + windows.removeRef( ( (FormWindow*)w )->formFile()->editor() ); + ( (FormWindow*)w )->formFile()->close(); + } + } else if ( ::qt_cast(w) ) { + ( (SourceEditor*)w )->close(); + } + } + hierarchyView->clear(); + windows = qWorkspace()->windowList(); + qWorkspace()->blockSignals( FALSE ); + currentProject = 0; + updateUndoRedo( FALSE, FALSE, QString::null, QString::null ); + } + + singleProject = TRUE; + projects.clear(); + QAction *a = new QAction( i18n( pro->name() ), i18n( pro->name() ), 0, + actionGroupProjects, 0, TRUE ); + eProject = pro; + projects.insert( a, eProject ); + a->setOn( TRUE ); + actionGroupProjects->removeFrom( projectMenu ); + actionGroupProjects->removeFrom( projectToolBar ); + currentProject = eProject; + currentProject->designerCreated(); +} + +void MainWindow::shuttingDown() +{ + outputWindow()->shuttingDown(); +} + +void MainWindow::showGUIStuff( bool b ) +{ + if ( (bool)guiStuffVisible == b ) + return; + guiStuffVisible = b; + if ( !b ) { + setAppropriate( (QDockWindow*)toolBox->parentWidget(), FALSE ); + toolBox->parentWidget()->hide(); + for ( QToolBar *tb = widgetToolBars.first(); tb; tb = widgetToolBars.next() ) { + tb->hide(); + setAppropriate( tb, FALSE ); + } + propertyEditor->setPropertyEditorEnabled( FALSE ); + setAppropriate( layoutToolBar, FALSE ); + layoutToolBar->hide(); + setAppropriate( toolsToolBar, FALSE ); + toolsToolBar->hide(); + menubar->removeItem( toolsMenuId ); + menubar->removeItem( toolsMenuId + 1 ); + menubar->removeItem( toolsMenuId + 2 ); + disconnect( this, SIGNAL( hasActiveForm(bool) ), actionEditAccels, SLOT( setEnabled(bool) ) ); + disconnect( this, SIGNAL( hasActiveForm(bool) ), actionEditFunctions, SLOT( setEnabled(bool) ) ); + disconnect( this, SIGNAL( hasActiveForm(bool) ), actionEditConnections, SLOT( setEnabled(bool) ) ); + disconnect( this, SIGNAL( hasActiveForm(bool) ), actionEditSource, SLOT( setEnabled(bool) ) ); + disconnect( this, SIGNAL( hasActiveForm(bool) ), actionEditFormSettings, SLOT( setEnabled(bool) ) ); + actionEditFormSettings->setEnabled( FALSE ); + actionEditSource->setEnabled( FALSE ); + actionEditConnections->setEnabled( FALSE ); + actionEditFunctions->setEnabled( FALSE ); + actionEditAccels->setEnabled( FALSE ); + ( (QDockWindow*)propertyEditor->parentWidget() )-> + setCaption( i18n( "Signal Handlers" ) ); + actionGroupNew->removeFrom( fileMenu ); + actionGroupNew->removeFrom( projectToolBar ); + actionFileSave->removeFrom( fileMenu ); + actionFileSave->removeFrom( projectToolBar ); + actionFileExit->removeFrom( fileMenu ); + actionNewFile->addTo( fileMenu ); + actionNewFile->addTo( projectToolBar ); + actionFileSave->addTo( fileMenu ); + actionFileSave->addTo( projectToolBar ); + actionFileExit->addTo( fileMenu ); + } else { + setAppropriate( (QDockWindow*)toolBox->parentWidget(), TRUE ); + toolBox->parentWidget()->show(); + for ( QToolBar *tb = widgetToolBars.first(); tb; tb = widgetToolBars.next() ) { + setAppropriate( tb, TRUE ); + tb->hide(); + } + propertyEditor->setPropertyEditorEnabled( TRUE ); + setAppropriate( layoutToolBar, TRUE ); + layoutToolBar->show(); + setAppropriate( toolsToolBar, TRUE ); + toolsToolBar->show(); + menubar->insertItem( i18n( "&Tools" ), toolsMenu, toolsMenuId, toolsMenuIndex ); + menubar->insertItem( i18n( "&Layout" ), layoutMenu, toolsMenuId + 1, toolsMenuIndex + 1 ); + menubar->insertItem( i18n( "&Preview" ), previewMenu, toolsMenuId + 2, toolsMenuIndex + 2 ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditAccels, SLOT( setEnabled(bool) ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditFunctions, SLOT( setEnabled(bool) ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditConnections, SLOT( setEnabled(bool) ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditSource, SLOT( setEnabled(bool) ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditFormSettings, SLOT( setEnabled(bool) ) ); + actionEditFormSettings->setEnabled( TRUE ); + actionEditSource->setEnabled( TRUE ); + actionEditConnections->setEnabled( TRUE ); + actionEditFunctions->setEnabled( TRUE ); + actionEditAccels->setEnabled( TRUE ); + ( (QDockWindow*)propertyEditor->parentWidget() )-> + setCaption( i18n( "Property Editor/Signal Handlers" ) ); + actionFileSave->removeFrom( fileMenu ); + actionFileSave->removeFrom( projectToolBar ); + actionFileExit->removeFrom( fileMenu ); + actionGroupNew->addTo( fileMenu ); + actionGroupNew->addTo( projectToolBar ); + actionFileSave->addTo( fileMenu ); + actionFileSave->addTo( projectToolBar ); + actionFileExit->addTo( fileMenu ); + } +} + +void MainWindow::setEditorsReadOnly( bool b ) +{ + editorsReadOnly = b; +} + +void MainWindow::setPluginDirectory( const QString &pd ) +{ + pluginDir = pd; + if ( !qwf_plugin_dir ) + qwf_plugin_dir = new QString( pd ); + else + *qwf_plugin_dir = pd; +} + +void MainWindow::toggleSignalHandlers( bool show ) +{ + if ( sSignalHandlers == show ) + return; + sSignalHandlers = show; + propertyEditor->setSignalHandlersEnabled( show ); +} + +void MainWindow::statusMessage( const QString &msg ) +{ + m_part->statusMessage(msg); +} diff --git a/kdevdesigner/designer/mainwindow.h b/kdevdesigner/designer/mainwindow.h new file mode 100644 index 00000000..43a4974a --- /dev/null +++ b/kdevdesigner/designer/mainwindow.h @@ -0,0 +1,511 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "metadatabase.h" +#include "../interfaces/actioninterface.h" // for GCC 2.7.* compatibility +#include "../interfaces/editorinterface.h" +#include "../interfaces/templatewizardiface.h" +#include "../interfaces/languageinterface.h" +#include "../interfaces/filterinterface.h" +#include "../interfaces/interpreterinterface.h" +#include "../interfaces/preferenceinterface.h" +#include "../interfaces/projectsettingsiface.h" +#include "../interfaces/sourcetemplateiface.h" +#include "sourceeditor.h" + +#include +#include +#include +#include +#include +#include + +class QToolBox; +class PropertyEditor; +class QWorkspace; +class QMenuBar; +class FormWindow; +class QPopupMenu; +class HierarchyView; +class QCloseEvent; +class Workspace; +class ActionEditor; +class Project; +class OutputWindow; +class QTimer; +class FindDialog; +struct DesignerProject; +class ReplaceDialog; +class GotoLineDialog; +class SourceFile; +class FormFile; +class QAssistantClient; +class DesignerAction; + +#if defined(Q_FULL_TEMPLATE_INSTANTIATION) +#include +#else +class QToolBar; +#endif +class Preferences; + +class KDevDesignerPart; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + enum LineMode { Error, Step, StackFrame }; + + MainWindow( KDevDesignerPart *part, bool asClient, bool single = FALSE, const QString &plgDir = "/designer" ); + ~MainWindow(); + + HierarchyView *objectHierarchy() const; + Workspace *workspace() const; + PropertyEditor *propertyeditor() const; + ActionEditor *actioneditor() const; + + void resetTool(); + int currentTool() const; + + FormWindow *formWindow(); + + bool unregisterClient( FormWindow *w ); + void editorClosed( SourceEditor *e ); + QWidget *isAFormWindowChild( QObject *o ) const; + QWidget *isAToolBarChild( QObject *o ) const; + + void insertFormWindow( FormWindow *fw ); + QWorkspace *qWorkspace() const; + + void popupFormWindowMenu( const QPoint &gp, FormWindow *fw ); + void popupWidgetMenu( const QPoint &gp, FormWindow *fw, QWidget *w ); + + QPopupMenu *setupNormalHierarchyMenu( QWidget *parent ); + QPopupMenu *setupTabWidgetHierarchyMenu( QWidget *parent, const char *addSlot, const char *removeSlot ); + + FormWindow *openFormWindow( const QString &fn, bool validFileName = TRUE, FormFile *ff = 0 ); + bool isCustomWidgetUsed( MetaDataBase::CustomWidget *w ); + + void setGrid( const QPoint &p ); + void setShowGrid( bool b ); + void setSnapGrid( bool b ); + QPoint grid() const { return grd; } + bool showGrid() const { return sGrid; } + bool snapGrid() const { return snGrid && sGrid; } + + QString documentationPath() const; + + static MainWindow *self; + + QString templatePath() const { return templPath; } + + void editFunction( const QString &func, bool rereadSource = FALSE ); + + bool isPreviewing() const { return previewing; } + + Project *currProject() const { return currentProject; } + + FormWindow *activeForm() const { return lastActiveFormWindow; } + + TemplateWizardInterface* templateWizardInterface( const QString& className ); + QStringList sourceTemplates() const; + SourceTemplateInterface* sourceTemplateInterface( const QString& templ ); + QUnknownInterface* designerInterface() const { return desInterface; } + QPtrList projectList() const; + QStringList projectNames() const; + QStringList projectFileNames() const; + Project *findProject( const QString &projectName ) const; + void setCurrentProject( Project *pro ); + void setCurrentProjectByFilename( const QString& proFilename ); + OutputWindow *outputWindow() const { return oWindow; } + void addPreferencesTab( QWidget *tab, const QString &title, QObject *receiver, const char *init_slot, const char *accept_slot ); + void addProjectTab( QWidget *tab, const QString &title, QObject *receiver, const char *init_slot, const char *accept_slot ); + void setModified( bool b, QWidget *window ); + void functionsChanged(); + void updateFunctionList(); + void updateWorkspace(); + void runProjectPrecondition(); + void runProjectPostcondition( QObjectList *l ); + + void formNameChanged( FormWindow *fw ); + + int currentLayoutDefaultSpacing() const; + int currentLayoutDefaultMargin() const; + + void saveAllBreakPoints(); + void resetBreakPoints(); + + SourceFile *sourceFile(); + void createNewProject( const QString &lang ); + + void popupProjectMenu( const QPoint &pos ); + QObject *findRealObject( QObject *o ); + + void setSingleProject( Project *pro ); + bool singleProjectMode() const { return singleProject; } + + void showSourceLine( QObject *o, int line, LineMode lm ); + + void shuttingDown(); + void showGUIStuff( bool b ); + void setEditorsReadOnly( bool b ); + bool areEditorsReadOnly() const { return editorsReadOnly; } + void toggleSignalHandlers( bool show ); + bool showSignalHandlers() const { return sSignalHandlers; } + void writeConfig(); + + void openProject( const QString &fn ); + void setPluginDirectory( const QString &pd ); + QString pluginDirectory() const { return pluginDir; } + + QAssistantClient* assistantClient() const { return assistant; } + + void addRecentlyOpenedFile( const QString &fn ) { addRecentlyOpened( fn, recentlyFiles ); } + + void statusMessage(const QString &msg); + + //integration + KDevDesignerPart *part() const { return m_part; } + +public slots: + void showProperties( QObject *w ); + void updateProperties( QObject *w ); + void showDialogHelp(); + void showDebugStep( QObject *o, int line ); + void showStackFrame( QObject *o, int line ); + void showErrorMessage( QObject *o, int line, const QString &errorMessage ); + void finishedRun(); + void breakPointsChanged(); + +signals: + void currentToolChanged(); + void hasActiveForm( bool ); + void hasActiveWindow( bool ); + void hasActiveWindowOrProject( bool ); + void hasNonDummyProject( bool ); + void formModified( bool ); + void formWindowsChanged(); + void formWindowChanged(); + void projectChanged(); + void editorChanged(); + +protected: + bool eventFilter( QObject *o, QEvent *e ); + void closeEvent( QCloseEvent *e ); + +public slots: + void fileNew(); + void fileNewDialog(); + void fileNewFile(); + void fileClose(); + void fileQuit(); + void fileCloseProject(); // not visible in menu, called from fileClose + void fileOpen(); + void fileOpen( const QString &filter, const QString &extension, const QString &filename = "" , bool inProject = TRUE ); + bool fileSave(); + bool fileSaveForm(); // not visible in menu, called from fileSave + bool fileSaveProject(); // not visible in menu, called from fileSaveProject + bool fileSaveAs(); + void fileSaveAll(); + void fileCreateTemplate(); + +public slots: + void editUndo(); + void editRedo(); + void editCut(); + void editCopy(); + void editPaste(); + void editDelete(); + void editSelectAll(); + void editLower(); + void editRaise(); + void editAdjustSize(); + void editLayoutHorizontal(); + void editLayoutVertical(); + void editLayoutHorizontalSplit(); + void editLayoutVerticalSplit(); + void editLayoutGrid(); + void editLayoutContainerHorizontal(); + void editLayoutContainerVertical(); + void editLayoutContainerGrid(); + void editBreakLayout(); + void editAccels(); + void editFunctions(); + void editConnections(); + SourceEditor *editSource(); + SourceEditor *editSource( SourceFile *f ); + SourceEditor *openSourceEditor(); + SourceEditor *createSourceEditor( QObject *object, Project *project, + const QString &lang = QString::null, + const QString &func = QString::null, + bool rereadSource = FALSE ); + void editFormSettings(); + void editProjectSettings(); + void editPixmapCollection(); + void editDatabaseConnections(); + void editPreferences(); + + void projectInsertFile(); + + void searchFind(); + void searchIncremetalFindMenu(); + void searchIncremetalFind(); + void searchIncremetalFindNext(); + void searchReplace(); + void searchGotoLine(); + + void previewForm(); + void previewForm( const QString& ); + + void toolsCustomWidget(); + void toolsConfigure(); + + void helpContents(); + void helpManual(); + void helpAbout(); + void helpAboutQt(); + void helpRegister(); + +private slots: + void activeWindowChanged( QWidget *w ); + void updateUndoRedo( bool, bool, const QString &, const QString & ); + void updateEditorUndoRedo(); + + void toolSelected( QAction* ); + + void clipboardChanged(); + void selectionChanged(); + + void windowsMenuActivated( int id ); + void setupWindowActions(); + + void createNewTemplate(); + void projectSelected( QAction *a ); + + void setupRecentlyFilesMenu(); + void setupRecentlyProjectsMenu(); + void recentlyFilesMenuActivated( int id ); + void recentlyProjectsMenuActivated( int id ); + + void emitProjectSignals(); + + void showStartDialog(); + +private: + void setupMDI(); + void setupMenuBar(); + void setupEditActions(); + void setupProjectActions(); + void setupSearchActions(); + void setupToolActions(); + void setupLayoutActions(); + void setupFileActions(); + void setupPreviewActions(); + void setupHelpActions(); + void setupRMBMenus(); + + void setupPropertyEditor(); + void setupHierarchyView(); + void setupWorkspace(); + void setupActionEditor(); + void setupOutputWindow(); + void setupToolbox(); + + void setupActionManager(); + void setupPluginManagers(); + + void enableAll( bool enable ); + + QWidget* previewFormInternal( QStyle* style = 0, QPalette* pal = 0 ); + + void readConfig(); + + void setupRMBProperties( QValueList &ids, QMap &props, QWidget *w ); + void handleRMBProperties( int id, QMap &props, QWidget *w ); + void setupRMBSpecialCommands( QValueList &ids, QMap &commands, QWidget *w ); + void handleRMBSpecialCommands( int id, QMap &commands, QWidget *w ); + void setupRMBSpecialCommands( QValueList &ids, QMap &commands, FormWindow *w ); + void handleRMBSpecialCommands( int id, QMap &commands, FormWindow *w ); + bool openEditor( QWidget *w, FormWindow *fw ); + void rebuildCustomWidgetGUI(); + void rebuildCommonWidgetsToolBoxPage(); + void checkTempFiles(); + + void addRecentlyOpened( const QString &fn, QStringList &lst ); + + QString whatsThisFrom( const QString &key ); + +private slots: + void doFunctionsChanged(); + bool openProjectSettings( Project *pro ); + +private: + struct Tab + { + QWidget *w; + QString title; + QObject *receiver; + const char *init_slot, *accept_slot; + Q_DUMMY_COMPARISON_OPERATOR( Tab ) + }; + +private: + PropertyEditor *propertyEditor; + HierarchyView *hierarchyView; + Workspace *wspace; + QWidget *lastPressWidget; + QWorkspace *qworkspace; + QMenuBar *menubar; + QGuardedPtr lastActiveFormWindow; + bool breakLayout, layoutChilds, layoutSelected; + QPoint grd; + bool sGrid, snGrid; + bool restoreConfig; + bool backPix; + bool splashScreen; + QString fileFilter; + + QMap projects; + DesignerAction *actionEditUndo, *actionEditRedo, *actionEditCut, *actionEditCopy, + *actionEditPaste, *actionEditDelete, + *actionEditAdjustSize, + *actionEditHLayout, *actionEditVLayout, *actionEditGridLayout, + *actionEditSplitHorizontal, *actionEditSplitVertical, + *actionEditSelectAll, *actionEditBreakLayout, *actionEditFunctions, *actionEditConnections, + *actionEditLower, *actionEditRaise; + QAction *actionInsertSpacer; + QActionGroup *actionGroupTools, *actionGroupProjects; + QAction* actionPointerTool, *actionConnectTool, *actionOrderTool, *actionBuddyTool; + QAction* actionCurrentTool; + DesignerAction *actionHelpContents, *actionHelpAbout, *actionHelpAboutQt, *actionHelpWhatsThis; + DesignerAction *actionHelpManual; +#if defined(QT_NON_COMMERCIAL) + DesignerAction *actionHelpRegister; +#endif + DesignerAction *actionToolsCustomWidget, *actionEditPreferences; + DesignerAction *actionWindowTile, *actionWindowCascade, *actionWindowClose, *actionWindowCloseAll; + DesignerAction *actionWindowNext, *actionWindowPrevious; + DesignerAction *actionEditFormSettings, *actionEditAccels; + DesignerAction *actionEditSource, *actionNewFile, *actionFileSave, *actionFileExit; + DesignerAction *actionFileClose, *actionFileSaveAs, *actionFileSaveAll; + DesignerAction *actionSearchFind, *actionSearchIncremetal, *actionSearchReplace, *actionSearchGotoLine; + DesignerAction *actionProjectAddFile, *actionEditPixmapCollection, *actionEditDatabaseConnections, + *actionEditProjectSettings, *actionPreview; + QActionGroup *actionGroupNew; + + QPopupMenu *rmbWidgets; + QPopupMenu *rmbFormWindow; + QPopupMenu *customWidgetMenu, *windowMenu, *fileMenu, *recentlyFilesMenu, *recentlyProjectsMenu; + QPopupMenu *toolsMenu, *layoutMenu, *previewMenu; + QToolBar *customWidgetToolBar, *layoutToolBar, *projectToolBar, *customWidgetToolBar2, *toolsToolBar; + QToolBar *commonWidgetsToolBar; + QPtrList widgetToolBars; + + Preferences *prefDia; + QMap propertyDocumentation; + bool client; + QString templPath; + ActionEditor *actionEditor; + Project *currentProject; + QPluginManager *actionPluginManager; + QPluginManager *editorPluginManager; + QPluginManager *templateWizardPluginManager; + QPluginManager *interpreterPluginManager; + QPluginManager *preferencePluginManager; + QPluginManager *projectSettingsPluginManager; + QPluginManager *sourceTemplatePluginManager; + QPtrList sourceEditors; + bool previewing; + QUnknownInterface *desInterface; + QStringList recentlyFiles; + QStringList recentlyProjects; + OutputWindow *oWindow; + QValueList preferenceTabs; + QValueList projectTabs; + bool databaseAutoEdit; + QTimer *updateFunctionsTimer; + QTimer *autoSaveTimer; + bool autoSaveEnabled; + int autoSaveInterval; + QLineEdit *incrementalSearch; + QGuardedPtr findDialog; + QGuardedPtr replaceDialog; + QGuardedPtr gotoLineDialog; + Project *eProject; + bool inDebugMode; + QObjectList debuggingForms; + QString lastOpenFilter; + QGuardedPtr previewedForm; + QPopupMenu *projectMenu; + QString menuHelpFile; + bool singleProject; + QToolBox *toolBox; + int toolsMenuId, toolsMenuIndex; + uint guiStuffVisible : 1; + uint editorsReadOnly : 1; + uint savePluginPaths : 1; + QAssistantClient *assistant; + bool shStartDialog; + QString pluginDir; + bool sSignalHandlers; + + KDevDesignerPart *m_part; + +public: + QString lastSaveFilter; + QPtrList toolActions; + QPtrList commonWidgetsPage; + +friend class KDevDesignerPart; +}; + +class SenderObject : public QObject +{ + Q_OBJECT + +public: + SenderObject( QUnknownInterface *i ) : iface( i ) { iface->addRef(); } + ~SenderObject() { iface->release(); } + +public slots: + void emitInitSignal() { emit initSignal( iface ); } + void emitAcceptSignal() { emit acceptSignal( iface ); } + +signals: + void initSignal( QUnknownInterface * ); + void acceptSignal( QUnknownInterface * ); + +private: + QUnknownInterface *iface; + +}; + +#endif diff --git a/kdevdesigner/designer/mainwindowactions.cpp b/kdevdesigner/designer/mainwindowactions.cpp new file mode 100644 index 00000000..d6ed0982 --- /dev/null +++ b/kdevdesigner/designer/mainwindowactions.cpp @@ -0,0 +1,2067 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "mainwindow.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "defs.h" +#include "project.h" +#include "widgetdatabase.h" +#include "widgetfactory.h" +#include "preferences.h" +#include "formwindow.h" +#include "newformimpl.h" +#include "resource.h" +#include "projectsettingsimpl.h" +#include "workspace.h" +#include "createtemplate.h" +#include "hierarchyview.h" +#include "editfunctionsimpl.h" +#include "finddialog.h" +#include "replacedialog.h" +#include "gotolinedialog.h" +#include "formsettingsimpl.h" +#include "pixmapcollectioneditor.h" +#include "styledbutton.h" +#include "customwidgeteditorimpl.h" +#ifndef QT_NO_SQL +#include "dbconnectionsimpl.h" +#include "dbconnectionimpl.h" +#endif +#include "widgetaction.h" +#include +#include "startdialogimpl.h" +#include "designerappiface.h" +#include "connectiondialog.h" +#include "configtoolboxdialog.h" +#include "designeraction.h" + +#include "kdevdesigner_part.h" + +static const char * whatsthis_image[] = { + "16 16 3 1", + " c None", + "o c #000000", + "a c #000080", + "o aaaaa ", + "oo aaa aaa ", + "ooo aaa aaa", + "oooo aa aa", + "ooooo aa aa", + "oooooo a aaa", + "ooooooo aaa ", + "oooooooo aaa ", + "ooooooooo aaa ", + "ooooo aaa ", + "oo ooo ", + "o ooo aaa ", + " ooo aaa ", + " ooo ", + " ooo ", + " ooo "}; + +const QString toolbarHelp = "

      Toolbars contain a number of buttons to " +"provide quick access to often used functions.%1" +"
      Click on the toolbar handle to hide the toolbar, " +"or drag and place the toolbar to a different location.

      "; + +static QIconSet createIconSet( const QString &name ) +{ + QIconSet ic( BarIcon( "" + name, KDevDesignerPartFactory::instance() ) ); + QString prefix = "designer_"; + int right = name.length() - prefix.length(); + ic.setPixmap( BarIcon( prefix + "d_" + name.right( right ), KDevDesignerPartFactory::instance() ), + QIconSet::Small, QIconSet::Disabled ); + return ic; +} + +void MainWindow::setupEditActions() +{ + actionEditUndo = new DesignerAction( i18n("Undo"), createIconSet( "designer_undo.png" ),i18n("&Undo: Not Available"), CTRL + Key_Z, this, 0 ); + actionEditUndo->setStatusTip( i18n( "Undoes the last action" ) ); + actionEditUndo->setWhatsThis( whatsThisFrom( "Edit|Undo" ) ); + connect( actionEditUndo, SIGNAL( activated() ), this, SLOT( editUndo() ) ); + actionEditUndo->setEnabled( FALSE ); + + actionEditRedo = new DesignerAction( i18n( "Redo" ), createIconSet("designer_redo.png"), i18n( "&Redo: Not Available" ), CTRL + Key_Y, this, 0 ); + actionEditRedo->setStatusTip( i18n( "Redoes the last undone operation") ); + actionEditRedo->setWhatsThis( whatsThisFrom( "Edit|Redo" ) ); + connect( actionEditRedo, SIGNAL( activated() ), this, SLOT( editRedo() ) ); + actionEditRedo->setEnabled( FALSE ); + + actionEditCut = new DesignerAction( i18n( "Cut" ), createIconSet("designer_editcut.png"), i18n( "Cu&t" ), CTRL + Key_X, this, 0 ); + actionEditCut->setStatusTip( i18n( "Cuts the selected widgets and puts them on the clipboard" ) ); + actionEditCut->setWhatsThis( whatsThisFrom( "Edit|Cut" ) ); + connect( actionEditCut, SIGNAL( activated() ), this, SLOT( editCut() ) ); + actionEditCut->setEnabled( FALSE ); + + actionEditCopy = new DesignerAction( i18n( "Copy" ), createIconSet("designer_editcopy.png"), i18n( "&Copy" ), CTRL + Key_C, this, 0 ); + actionEditCopy->setStatusTip( i18n( "Copies the selected widgets to the clipboard" ) ); + actionEditCopy->setWhatsThis( whatsThisFrom( "Edit|Copy" ) ); + connect( actionEditCopy, SIGNAL( activated() ), this, SLOT( editCopy() ) ); + actionEditCopy->setEnabled( FALSE ); + + actionEditPaste = new DesignerAction( i18n( "Paste" ), createIconSet("designer_editpaste.png"), i18n( "&Paste" ), CTRL + Key_V, this, 0 ); + actionEditPaste->setStatusTip( i18n( "Pastes the clipboard's contents" ) ); + actionEditPaste->setWhatsThis( whatsThisFrom( "Edit|Paste" ) ); + connect( actionEditPaste, SIGNAL( activated() ), this, SLOT( editPaste() ) ); + actionEditPaste->setEnabled( FALSE ); + + actionEditDelete = new DesignerAction( i18n( "Delete" ), QPixmap(), i18n( "&Delete" ), Key_Delete, this, 0 ); + actionEditDelete->setStatusTip( i18n( "Deletes the selected widgets" ) ); + actionEditDelete->setWhatsThis( whatsThisFrom( "Edit|Delete" ) ); + connect( actionEditDelete, SIGNAL( activated() ), this, SLOT( editDelete() ) ); + actionEditDelete->setEnabled( FALSE ); +#ifdef Q_WS_MAC + QAction *macDelete = new DesignerAction( i18n( "Delete" ), QPixmap(), i18n( "&Delete" ), Key_Backspace, this, 0 ); + connect( macDelete, SIGNAL( activated() ), this, SLOT( editDelete() ) ); +#endif + + actionEditSelectAll = new DesignerAction( i18n( "Select All" ), QPixmap(), i18n( "Select &All" ), CTRL + Key_A, this, 0 ); + actionEditSelectAll->setStatusTip( i18n( "Selects all widgets" ) ); + actionEditSelectAll->setWhatsThis( whatsThisFrom( "Edit|Select All" ) ); + connect( actionEditSelectAll, SIGNAL( activated() ), this, SLOT( editSelectAll() ) ); + actionEditSelectAll->setEnabled( TRUE ); + + actionEditRaise = new DesignerAction( i18n( "Bring to Front" ), createIconSet("designer_editraise.png"), i18n( "Bring to &Front" ), 0, this, 0 ); + actionEditRaise->setStatusTip( i18n( "Raises the selected widgets" ) ); + actionEditRaise->setWhatsThis( i18n( "Raises the selected widgets" ) ); + connect( actionEditRaise, SIGNAL( activated() ), this, SLOT( editRaise() ) ); + actionEditRaise->setEnabled( FALSE ); + + actionEditLower = new DesignerAction( i18n( "Send to Back" ), createIconSet("designer_editlower.png"), i18n( "Send to &Back" ), 0, this, 0 ); + actionEditLower->setStatusTip( i18n( "Lowers the selected widgets" ) ); + actionEditLower->setWhatsThis( i18n( "Lowers the selected widgets" ) ); + connect( actionEditLower, SIGNAL( activated() ), this, SLOT( editLower() ) ); + actionEditLower->setEnabled( FALSE ); + + actionEditAccels = new DesignerAction( i18n( "Check Accelerators" ), QPixmap(), + i18n( "Chec&k Accelerators" ), ALT + Key_R, this, 0 ); + actionEditAccels->setStatusTip( i18n("Checks if the accelerators used in the form are unique") ); + actionEditAccels->setWhatsThis( whatsThisFrom( "Edit|Check Accelerator" ) ); + connect( actionEditAccels, SIGNAL( activated() ), this, SLOT( editAccels() ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditAccels, SLOT( setEnabled(bool) ) ); + + actionEditFunctions = new DesignerAction( i18n( "Slots" ), createIconSet("designer_editslots.png"), + i18n( "S&lots..." ), 0, this, 0 ); + actionEditFunctions->setStatusTip( i18n("Opens a dialog for editing slots") ); + actionEditFunctions->setWhatsThis( whatsThisFrom( "Edit|Slots" ) ); + connect( actionEditFunctions, SIGNAL( activated() ), this, SLOT( editFunctions() ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditFunctions, SLOT( setEnabled(bool) ) ); + + actionEditConnections = new DesignerAction( i18n( "Connections" ), createIconSet("designer_connecttool.png"), + i18n( "Co&nnections..." ), 0, this, 0 ); + actionEditConnections->setStatusTip( i18n("Opens a dialog for editing connections") ); + actionEditConnections->setWhatsThis( whatsThisFrom( "Edit|Connections" ) ); + connect( actionEditConnections, SIGNAL( activated() ), this, SLOT( editConnections() ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditConnections, SLOT( setEnabled(bool) ) ); + + actionEditSource = new DesignerAction( i18n( "Source" ), QIconSet(), + i18n( "&Source..." ), CTRL + Key_E, this, 0 ); + actionEditSource->setStatusTip( i18n("Opens an editor to edit the form's source code") ); + actionEditSource->setWhatsThis( whatsThisFrom( "Edit|Source" ) ); + connect( actionEditSource, SIGNAL( activated() ), this, SLOT( editSource() ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditSource, SLOT( setEnabled(bool) ) ); + + actionEditFormSettings = new DesignerAction( i18n( "Form Settings" ), QPixmap(), + i18n( "&Form Settings..." ), 0, this, 0 ); + actionEditFormSettings->setStatusTip( i18n("Opens a dialog to change the form's settings") ); + actionEditFormSettings->setWhatsThis( whatsThisFrom( "Edit|Form Settings" ) ); + connect( actionEditFormSettings, SIGNAL( activated() ), this, SLOT( editFormSettings() ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), actionEditFormSettings, SLOT( setEnabled(bool) ) ); + + actionEditPreferences = new DesignerAction( i18n( "Preferences" ), QPixmap(), + i18n( "Preferences..." ), 0, this, 0 ); + actionEditPreferences->setStatusTip( i18n("Opens a dialog to change preferences") ); + actionEditPreferences->setWhatsThis( whatsThisFrom( "Edit|Preferences" ) ); + connect( actionEditPreferences, SIGNAL( activated() ), this, SLOT( editPreferences() ) ); + +/* QToolBar *tb = new QToolBar( this, "Edit" ); + tb->setCloseMode( QDockWindow::Undocked ); + QWhatsThis::add( tb, i18n( "The Edit toolbar%1").arg(i18n(toolbarHelp).arg("")) ); + addToolBar( tb, i18n( "Edit" ) ); + actionEditUndo->addTo( tb ); + actionEditRedo->addTo( tb ); + tb->addSeparator(); + actionEditCut->addTo( tb ); + actionEditCopy->addTo( tb ); + actionEditPaste->addTo( tb );*/ +#if 0 + tb->addSeparator(); + actionEditLower->addTo( tb ); + actionEditRaise->addTo( tb ); +#endif + + QPopupMenu *menu = new QPopupMenu( this, "Edit" ); + connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateEditorUndoRedo() ) ); + menubar->insertItem( i18n( "&Edit" ), menu ); + actionEditUndo->addTo( menu ); + actionEditRedo->addTo( menu ); + menu->insertSeparator(); + actionEditCut->addTo( menu ); + actionEditCopy->addTo( menu ); + actionEditPaste->addTo( menu ); + actionEditDelete->addTo( menu ); + actionEditSelectAll->addTo( menu ); + actionEditAccels->addTo( menu ); +#if 0 + menu->insertSeparator(); + actionEditLower->addTo( menu ); + actionEditRaise->addTo( menu ); +#endif + menu->insertSeparator(); + if ( !singleProjectMode() ) { + actionEditFunctions->addTo( menu ); + actionEditConnections->addTo( menu ); + } + actionEditFormSettings->addTo( menu ); + menu->insertSeparator(); + actionEditPreferences->addTo( menu ); +} + +void MainWindow::setupSearchActions() +{ + actionSearchFind = new DesignerAction( i18n( "Find" ), createIconSet( "designer_searchfind.png" ), + i18n( "&Find..." ), CTRL + Key_F, this, 0 ); + connect( actionSearchFind, SIGNAL( activated() ), this, SLOT( searchFind() ) ); + actionSearchFind->setEnabled( FALSE ); + actionSearchFind->setWhatsThis( whatsThisFrom( "Search|Find" ) ); + + actionSearchIncremetal = new DesignerAction( i18n( "Find Incremental" ), QIconSet(), + i18n( "Find &Incremental" ), ALT + Key_I, this, 0 ); + connect( actionSearchIncremetal, SIGNAL( activated() ), this, SLOT( searchIncremetalFindMenu() ) ); + actionSearchIncremetal->setEnabled( FALSE ); + actionSearchIncremetal->setWhatsThis( whatsThisFrom( "Search|Find Incremental" ) ); + + actionSearchReplace = new DesignerAction( i18n( "Replace" ), QIconSet(), + i18n( "&Replace..." ), CTRL + Key_R, this, 0 ); + connect( actionSearchReplace, SIGNAL( activated() ), this, SLOT( searchReplace() ) ); + actionSearchReplace->setEnabled( FALSE ); + actionSearchReplace->setWhatsThis( whatsThisFrom( "Search|Replace" ) ); + + actionSearchGotoLine = new DesignerAction( i18n( "Goto Line" ), QIconSet(), + i18n( "&Goto Line..." ), ALT + Key_G, this, 0 ); + connect( actionSearchGotoLine, SIGNAL( activated() ), this, SLOT( searchGotoLine() ) ); + actionSearchGotoLine->setEnabled( FALSE ); + actionSearchGotoLine->setWhatsThis( whatsThisFrom( "Search|Goto line" ) ); + +/* QToolBar *tb = new QToolBar( this, "Search" ); + tb->setCloseMode( QDockWindow::Undocked ); + addToolBar( tb, i18n( "Search" ) ); + + actionSearchFind->addTo( tb );*/ + incrementalSearch = new QLineEdit( 0 ); + incrementalSearch->hide(); + QToolTip::add( incrementalSearch, i18n( "Incremental search (Alt+I)" ) ); + connect( incrementalSearch, SIGNAL( textChanged( const QString & ) ), + this, SLOT( searchIncremetalFind() ) ); + connect( incrementalSearch, SIGNAL( returnPressed() ), + this, SLOT( searchIncremetalFindNext() ) ); + incrementalSearch->setEnabled( FALSE ); + + QPopupMenu *menu = new QPopupMenu( this, "Search" ); + menubar->insertItem( i18n( "&Search" ), menu ); + actionSearchFind->addTo( menu ); + actionSearchIncremetal->addTo( menu ); + actionSearchReplace->addTo( menu ); + menu->insertSeparator(); + actionSearchGotoLine->addTo( menu ); +} + +void MainWindow::setupLayoutActions() +{ + if ( !actionGroupTools ) { + actionGroupTools = new QActionGroup( this ); + actionGroupTools->setExclusive( TRUE ); + connect( actionGroupTools, SIGNAL( selected(QAction*) ), this, SLOT( toolSelected(QAction*) ) ); + } + + actionEditAdjustSize = new DesignerAction( i18n( "Adjust Size" ), createIconSet("designer_adjustsize.png"), + i18n( "Adjust &Size" ), CTRL + Key_J, this, 0 ); + actionEditAdjustSize->setStatusTip(i18n("Adjusts the size of the selected widget") ); + actionEditAdjustSize->setWhatsThis( whatsThisFrom( "Layout|Adjust Size" ) ); + connect( actionEditAdjustSize, SIGNAL( activated() ), this, SLOT( editAdjustSize() ) ); + actionEditAdjustSize->setEnabled( FALSE ); + + actionEditHLayout = new DesignerAction( i18n( "Lay Out Horizontally" ), createIconSet("designer_edithlayout.png"), + i18n( "Lay Out &Horizontally" ), CTRL + Key_H, this, 0 ); + actionEditHLayout->setStatusTip(i18n("Lays out the selected widgets horizontally") ); + actionEditHLayout->setWhatsThis( whatsThisFrom( "Layout|Lay Out Horizontally" ) ); + connect( actionEditHLayout, SIGNAL( activated() ), this, SLOT( editLayoutHorizontal() ) ); + actionEditHLayout->setEnabled( FALSE ); + + actionEditVLayout = new DesignerAction( i18n( "Lay Out Vertically" ), createIconSet("designer_editvlayout.png"), + i18n( "Lay Out &Vertically" ), CTRL + Key_L, this, 0 ); + actionEditVLayout->setStatusTip(i18n("Lays out the selected widgets vertically") ); + actionEditVLayout->setWhatsThis( whatsThisFrom( "Layout|Lay Out Vertically" ) ); + connect( actionEditVLayout, SIGNAL( activated() ), this, SLOT( editLayoutVertical() ) ); + actionEditVLayout->setEnabled( FALSE ); + + actionEditGridLayout = new DesignerAction( i18n( "Lay Out in a Grid" ), createIconSet("designer_editgrid.png"), + i18n( "Lay Out in a &Grid" ), CTRL + Key_G, this, 0 ); + actionEditGridLayout->setStatusTip(i18n("Lays out the selected widgets in a grid") ); + actionEditGridLayout->setWhatsThis( whatsThisFrom( "Layout|Lay Out in a Grid" ) ); + connect( actionEditGridLayout, SIGNAL( activated() ), this, SLOT( editLayoutGrid() ) ); + actionEditGridLayout->setEnabled( FALSE ); + + actionEditSplitHorizontal = new DesignerAction( i18n( "Lay Out Horizontally (in Splitter)" ), createIconSet("designer_editvlayoutsplit.png"), + i18n( "Lay Out Horizontally (in S&plitter)" ), 0, this, 0 ); + actionEditSplitHorizontal->setStatusTip(i18n("Lays out the selected widgets horizontally in a splitter") ); + actionEditSplitHorizontal->setWhatsThis( whatsThisFrom( "Layout|Lay Out Horizontally (in Splitter)" ) ); + connect( actionEditSplitHorizontal, SIGNAL( activated() ), this, SLOT( editLayoutHorizontalSplit() ) ); + actionEditSplitHorizontal->setEnabled( FALSE ); + + actionEditSplitVertical = new DesignerAction( i18n( "Lay Out Vertically (in Splitter)" ), createIconSet("designer_edithlayoutsplit.png"), + i18n( "Lay Out Vertically (in Sp&litter)" ), 0, this, 0 ); + actionEditSplitVertical->setStatusTip(i18n("Lays out the selected widgets vertically in a splitter") ); + actionEditSplitVertical->setWhatsThis( whatsThisFrom( "Layout|Lay Out Vertically (in Splitter)" ) ); + connect( actionEditSplitVertical, SIGNAL( activated() ), this, SLOT( editLayoutVerticalSplit() ) ); + actionEditSplitVertical->setEnabled( FALSE ); + + actionEditBreakLayout = new DesignerAction( i18n( "Break Layout" ), createIconSet("designer_editbreaklayout.png"), + i18n( "&Break Layout" ), CTRL + Key_B, this, 0 ); + actionEditBreakLayout->setStatusTip(i18n("Breaks the selected layout") ); + actionEditBreakLayout->setWhatsThis( whatsThisFrom( "Layout|Break Layout" ) ); + connect( actionEditBreakLayout, SIGNAL( activated() ), this, SLOT( editBreakLayout() ) ); + actionEditBreakLayout->setEnabled( FALSE ); + + int id = WidgetDatabase::idFromClassName( "Spacer" ); + actionInsertSpacer = new WidgetAction( i18n( "Layout" ), actionGroupTools, QString::number( id ).latin1() ); + actionInsertSpacer->setToggleAction( TRUE ); + actionInsertSpacer->setText( WidgetDatabase::className( id ) ); + actionInsertSpacer->setMenuText( i18n( "Add %1").arg( WidgetDatabase::className( id ) ) ); + actionInsertSpacer->setIconSet( WidgetDatabase::iconSet( id ) ); + actionInsertSpacer->setToolTip( WidgetDatabase::toolTip( id ) ); + actionInsertSpacer->setStatusTip( i18n( "Insert a %1").arg(WidgetDatabase::toolTip( id )) ); + actionInsertSpacer->setWhatsThis( i18n("A %1

      %2

      " + "

      Click to insert a single %3," + "or double click to keep the tool selected.") + .arg(WidgetDatabase::toolTip( id )) + .arg(WidgetDatabase::whatsThis( id )) + .arg(WidgetDatabase::toolTip( id ) )); + + actionInsertSpacer->addTo( commonWidgetsToolBar ); + commonWidgetsPage.append( actionInsertSpacer ); + QWidget *w; + commonWidgetsToolBar->setStretchableWidget( ( w = new QWidget( commonWidgetsToolBar ) ) ); + w->setBackgroundMode( commonWidgetsToolBar->backgroundMode() ); + QWhatsThis::add( layoutToolBar, i18n( "The Layout toolbar%1" ).arg(i18n(toolbarHelp).arg("")) ); + actionEditAdjustSize->addTo( layoutToolBar ); + layoutToolBar->addSeparator(); + actionEditHLayout->addTo( layoutToolBar ); + actionEditVLayout->addTo( layoutToolBar ); + actionEditGridLayout->addTo( layoutToolBar ); + actionEditSplitHorizontal->addTo( layoutToolBar ); + actionEditSplitVertical->addTo( layoutToolBar ); + actionEditBreakLayout->addTo( layoutToolBar ); + layoutToolBar->addSeparator(); + actionInsertSpacer->addTo( layoutToolBar ); + + QPopupMenu *menu = new QPopupMenu( this, "Layout" ); + layoutMenu = menu; + menubar->insertItem( i18n( "&Layout" ), menu, toolsMenuId + 1 ); + actionEditAdjustSize->addTo( menu ); + menu->insertSeparator(); + actionEditHLayout->addTo( menu ); + actionEditVLayout->addTo( menu ); + actionEditGridLayout->addTo( menu ); + actionEditSplitHorizontal->addTo( menu ); + actionEditSplitVertical->addTo( menu ); + actionEditBreakLayout->addTo( menu ); + menu->insertSeparator(); + actionInsertSpacer->addTo( menu ); +} + +void MainWindow::setupToolActions() +{ + if ( !actionGroupTools ) { + actionGroupTools = new QActionGroup( this ); + actionGroupTools->setExclusive( TRUE ); + connect( actionGroupTools, SIGNAL( selected(QAction*) ), + this, SLOT( toolSelected(QAction*) ) ); + } + + actionPointerTool = new DesignerAction( i18n("Pointer"), createIconSet("designer_pointer.png"), + i18n("&Pointer"), Key_F2, + actionGroupTools, + QString::number(POINTER_TOOL).latin1(), TRUE ); + actionPointerTool->setStatusTip( i18n("Selects the pointer tool") ); + actionPointerTool->setWhatsThis( whatsThisFrom( "Tools|Pointer" ) ); + + actionConnectTool = new DesignerAction( i18n("Connect Signal/Slots"), + createIconSet("designer_connecttool.png"), + i18n("&Connect Signal/Slots"), + singleProjectMode() ? 0 : Key_F3, + actionGroupTools, + QString::number(CONNECT_TOOL).latin1(), TRUE ); + actionConnectTool->setStatusTip( i18n("Selects the connection tool") ); + actionConnectTool->setWhatsThis( whatsThisFrom( "Tools|Connect Signals and Slots" ) ); + + actionOrderTool = new DesignerAction( i18n("Tab Order"), createIconSet("designer_ordertool.png"), + i18n("Tab &Order"), Key_F4, + actionGroupTools, + QString::number(ORDER_TOOL).latin1(), TRUE ); + actionOrderTool->setStatusTip( i18n("Selects the tab order tool") ); + actionOrderTool->setWhatsThis( whatsThisFrom( "Tools|Tab Order" ) ); + + actionBuddyTool = new DesignerAction( i18n( "Set Buddy" ), createIconSet( "designer_setbuddy.png" ), + i18n( "Set &Buddy" ), Key_F12, + actionGroupTools, QString::number( BUDDY_TOOL ).latin1(), + TRUE ); + actionBuddyTool->setStatusTip( i18n( "Sets a buddy to a label" ) ); + actionBuddyTool->setWhatsThis( whatsThisFrom( "Tools|Set Buddy" ) ); + + QToolBar *tb = new QToolBar( this, "Tools" ); + tb->setCloseMode( QDockWindow::Undocked ); + toolsToolBar = tb; + QWhatsThis::add( tb, i18n( "The Tools toolbar%1" ).arg(i18n(toolbarHelp).arg("")) ); + + addToolBar( tb, i18n( "Tools" ), QMainWindow::DockTop, FALSE ); + actionPointerTool->addTo( tb ); + if ( !singleProjectMode() ) + actionConnectTool->addTo( tb ); + actionOrderTool->addTo( tb ); + actionBuddyTool->addTo( tb ); + + QPopupMenu *mmenu = new QPopupMenu( this, "Tools" ); + toolsMenu = mmenu; + toolsMenuId = 100; + menubar->insertItem( i18n( "&Tools" ), mmenu, toolsMenuId ); + toolsMenuIndex = menubar->indexOf( toolsMenuId ); + actionPointerTool->addTo( mmenu ); + if ( !singleProjectMode() ) + actionConnectTool->addTo( mmenu ); + actionOrderTool->addTo( mmenu ); + actionBuddyTool->addTo( mmenu ); + mmenu->insertSeparator(); + + customWidgetToolBar = 0; + customWidgetMenu = 0; + + actionToolsCustomWidget = new DesignerAction( i18n("Custom Widgets"), + createIconSet( "designer_customwidget.png" ), + i18n("Edit &Custom Widgets..."), 0, this, 0 ); + actionToolsCustomWidget->setStatusTip( i18n("Opens a dialog to add and change " + "custom widgets") ); + actionToolsCustomWidget->setWhatsThis( whatsThisFrom( "Tools|Custom|Edit Custom" + "Widgets" ) ); + connect( actionToolsCustomWidget, SIGNAL( activated() ), + this, SLOT( toolsCustomWidget() ) ); + + for ( int j = 0; j < WidgetDatabase::numWidgetGroups(); ++j ) { + QString grp = WidgetDatabase::widgetGroup( j ); + if ( !WidgetDatabase::isGroupVisible( grp ) || + WidgetDatabase::isGroupEmpty( grp ) ) + continue; + QToolBar *tb = new QToolBar( this, grp.latin1() ); + tb->setCloseMode( QDockWindow::Undocked ); + widgetToolBars.append( tb ); + bool plural = grp[(int)grp.length()-1] == 's'; + if ( plural ) { + QWhatsThis::add( tb, i18n( "The %1%2" ).arg(grp).arg(i18n(toolbarHelp). + arg( i18n(" Click on a button to insert a single widget, " + "or double click to insert multiple %1.") ).arg(grp)) ); + } else { + QWhatsThis::add( tb, i18n( "The %1 Widgets%2" ).arg(grp).arg(i18n(toolbarHelp). + arg( i18n(" Click on a button to insert a single %1 widget, " + "or double click to insert multiple widgets.") ).arg(grp)) ); + } + addToolBar( tb, grp ); + tb->hide(); + QPopupMenu *menu = new QPopupMenu( this, grp.latin1() ); + mmenu->insertItem( grp, menu ); + + QToolBar *tb2 = new QToolBar( grp, 0, toolBox, FALSE, grp.latin1() ); + tb2->setFrameStyle( QFrame::NoFrame ); + tb2->setOrientation( Qt::Vertical ); + tb2->setBackgroundMode( PaletteBase ); + toolBox->addItem( tb2, grp ); + + if ( grp == "Custom" ) { + if ( !customWidgetMenu ) + actionToolsCustomWidget->addTo( menu ); + else + menu->insertSeparator(); + customWidgetMenu = menu; + customWidgetToolBar = tb; + } + + for ( int i = 0; i < WidgetDatabase::count(); ++i ) { + if ( WidgetDatabase::group( i ) != grp ) + continue; // only widgets, i.e. not forms and temp stuff + WidgetAction* a = + new WidgetAction( grp, actionGroupTools, QString::number( i ).latin1() ); + a->setToggleAction( TRUE ); + QString atext = WidgetDatabase::className( i ); + if ( atext[0] == 'Q' ) + atext = atext.mid(1); + while ( atext.length() && atext[0] >= 'a' && atext[0] <= 'z' ) + atext = atext.mid(1); + if ( atext.isEmpty() ) + atext = WidgetDatabase::className( i ); + a->setText( atext ); + QString ttip = WidgetDatabase::toolTip( i ); + a->setIconSet( WidgetDatabase::iconSet( i ) ); + a->setToolTip( ttip ); + if ( !WidgetDatabase::isWhatsThisLoaded() ) + WidgetDatabase::loadWhatsThis( documentationPath() ); + a->setStatusTip( i18n( "Insert a %1").arg(WidgetDatabase::className( i )) ); + + QString whats = i18n("A %1").arg( WidgetDatabase::className( i ) ); + if ( !WidgetDatabase::whatsThis( i ).isEmpty() ) + whats += QString("

      %1

      ").arg(WidgetDatabase::whatsThis( i )); + a->setWhatsThis( whats+ i18n("

      Double click on this tool to keep it selected.

      ") ); + + if ( grp != "KDE" ) + a->addTo( tb ); + a->addTo( menu ); + a->addTo( tb2 ); + if ( WidgetDatabase::isCommon( i ) ) { + a->addTo( commonWidgetsToolBar ); + commonWidgetsPage.append( a ); + } + } + QWidget *w; + tb2->setStretchableWidget( ( w = new QWidget( tb2 ) ) ); + w->setBackgroundMode( tb2->backgroundMode() ); + } + + if ( !customWidgetToolBar ) { + QToolBar *tb = new QToolBar( this, "Custom Widgets" ); + tb->setCloseMode( QDockWindow::Undocked ); + QWhatsThis::add( tb, i18n( "The Custom Widgets toolbar%1" + "

      Click Edit Custom Widgets..." + "in the Tools|Custom menu to " + "add and change custom widgets

      " ). + arg(i18n(toolbarHelp). + arg( i18n(" Click on the buttons to insert a single widget, " + "or double click to insert multiple widgets.") )) ); + addToolBar( tb, i18n( "Custom" ) ); + tb->hide(); + widgetToolBars.append( tb ); + customWidgetToolBar = tb; + QPopupMenu *menu = new QPopupMenu( this, "Custom Widgets" ); + mmenu->insertItem( "Custom", menu ); + customWidgetMenu = menu; + customWidgetToolBar->hide(); + actionToolsCustomWidget->addTo( customWidgetMenu ); + customWidgetMenu->insertSeparator(); + QToolBar *tb2 = new QToolBar( "Custom Widgets", 0, + toolBox, FALSE, "Custom Widgets" ); + tb2->setBackgroundMode(PaletteBase); + tb2->setOrientation( Qt::Vertical ); + tb2->setFrameStyle( QFrame::NoFrame ); + toolBox->addItem( tb2, "Custom Widgets" ); + customWidgetToolBar2 = tb2; + } + + QAction *a = new DesignerAction( i18n( "Configure Toolbox" ), i18n( "Configure Toolbox..." ), 0, this ); + a->setStatusTip( i18n( "Opens a dialog to configure the common " + "widgets page of the toolbox") ); + connect( a, SIGNAL( activated() ), this, SLOT( toolsConfigure() ) ); + mmenu->insertSeparator(); + a->addTo( mmenu ); + resetTool(); +} + +void MainWindow::setupFileActions() +{ + QToolBar* tb = new QToolBar( this, "File" ); + tb->setCloseMode( QDockWindow::Undocked ); + projectToolBar = tb; + + QWhatsThis::add( tb, i18n( "The File toolbar%1" ).arg(i18n(toolbarHelp).arg("")) ); + addToolBar( tb, i18n( "File" ) ); + fileMenu = new QPopupMenu( this, "File" ); + menubar->insertItem( i18n( "&File" ), fileMenu ); + + DesignerAction *a = 0; + + if ( !singleProject ) { + DesignerAction *a = new DesignerAction( this, 0 ); + a->setText( i18n( "New" ) ); + a->setToolTip( i18n( "New dialog or file" ) ); + a->setMenuText( i18n( "&New..." ) ); + a->setIconSet( createIconSet("designer_filenew.png") ); + a->setAccel( CTRL + Key_N ); + a->setStatusTip( i18n( "Creates a new project, form or source file." ) ); + a->setWhatsThis( whatsThisFrom( "File|New" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); + a->addTo( tb ); + a->addTo( fileMenu ); + actionNewFile = a; + } else { + actionGroupNew = new QActionGroup( this, 0, FALSE ); + QActionGroup* a = actionGroupNew; + ( (QActionGroup*)a )->setUsesDropDown( TRUE ); + a->setText( i18n( "New" ) ); + a->setMenuText( i18n( "&New..." ) ); + a->setIconSet( createIconSet("designer_form.png") ); + a->setStatusTip( i18n( "Creates a new dialog or file" ) ); + a->setWhatsThis( whatsThisFrom( "File|New" ) ); + + QAction *newForm = new DesignerAction( a, 0 ); + newForm->setText( i18n( "New Dialog" ) ); + newForm->setMenuText( i18n( "&Dialog..." ) ); + newForm->setIconSet( createIconSet("designer_form.png") ); + newForm->setAccel( CTRL + Key_N ); + newForm->setStatusTip( i18n( "Creates a new dialog." ) ); + connect( newForm, SIGNAL( activated() ), this, SLOT( fileNewDialog() ) ); + + DesignerAction *newFile = new DesignerAction( a, 0 ); + newFile->setText( i18n( "New File" ) ); + newFile->setMenuText( i18n( "&File..." ) ); + newFile->setIconSet( createIconSet("designer_filenew.png") ); + newFile->setAccel( ALT + Key_N ); + newFile->setStatusTip( i18n( "Creates a new file." ) ); + connect( newFile, SIGNAL( activated() ), this, SLOT( fileNewFile() ) ); + actionNewFile = newFile; + + a->addTo( tb ); + a->addTo( fileMenu ); + + fileMenu->insertSeparator(); + } + + a = new DesignerAction( this, 0 ); + a->setText( i18n( "Open" ) ); + a->setMenuText( i18n( "&Open..." ) ); + a->setIconSet( createIconSet("designer_fileopen.png") ); + a->setAccel( CTRL + Key_O ); + a->setStatusTip( i18n( "Opens an existing project, form or source file ") ); + a->setWhatsThis( whatsThisFrom( "File|Open" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); + if ( !singleProject ) { + a->addTo( tb ); + a->addTo( fileMenu ); + fileMenu->insertSeparator(); + } + + + a = new DesignerAction( this, 0 ); + actionFileClose = a; + a->setText( i18n( "Close" ) ); + a->setMenuText( i18n( "&Close" ) ); + a->setStatusTip( i18n( "Closes the current project or document" ) ); + a->setWhatsThis(whatsThisFrom( "File|Close" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) ); + connect( this, SIGNAL( hasActiveWindowOrProject(bool) ), a, SLOT( setEnabled(bool) ) ); + if ( !singleProject ) { + a->addTo( fileMenu ); + fileMenu->insertSeparator(); + } + + a = new DesignerAction( this, 0 ); + actionFileSave = a; + a->setText( i18n( "Save" ) ); + a->setMenuText( i18n( "&Save" ) ); + a->setIconSet( createIconSet("designer_filesave.png") ); + a->setAccel( CTRL + Key_S ); + a->setStatusTip( i18n( "Saves the current project or document" ) ); + a->setWhatsThis(whatsThisFrom( "File|Save" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) ); + connect( this, SIGNAL( hasActiveWindowOrProject(bool) ), a, SLOT( setEnabled(bool) ) ); + a->addTo( tb ); + a->addTo( fileMenu ); + + a = new DesignerAction( this, 0 ); + actionFileSaveAs = a; + a->setText( i18n( "Save As" ) ); + a->setMenuText( i18n( "Save &As..." ) ); + a->setStatusTip( i18n( "Saves the current form with a new filename" ) ); + a->setWhatsThis( whatsThisFrom( "File|Save As" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); + connect( this, SIGNAL( hasActiveWindow(bool) ), a, SLOT( setEnabled(bool) ) ); + if ( !singleProject ) + a->addTo( fileMenu ); + + a = new DesignerAction( this, 0 ); + actionFileSaveAll = a; + a->setText( i18n( "Save All" ) ); + a->setMenuText( i18n( "Sa&ve All" ) ); + a->setStatusTip( i18n( "Saves all open documents" ) ); + a->setWhatsThis( whatsThisFrom( "File|Save All" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAll() ) ); + connect( this, SIGNAL( hasActiveWindowOrProject(bool) ), a, SLOT( setEnabled(bool) ) ); + if ( !singleProject ) { + a->addTo( fileMenu ); + fileMenu->insertSeparator(); + } + + a = new DesignerAction( this, 0 ); + a->setText( i18n( "Create Template" ) ); + a->setMenuText( i18n( "Create &Template..." ) ); + a->setStatusTip( i18n( "Creates a new template" ) ); + a->setWhatsThis( whatsThisFrom( "File|Create Template" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( fileCreateTemplate() ) ); + if ( !singleProject ) + a->addTo( fileMenu ); + + if ( !singleProject ) + fileMenu->insertSeparator(); + + recentlyFilesMenu = new QPopupMenu( this ); + recentlyProjectsMenu = new QPopupMenu( this ); + + if ( !singleProject ) { + fileMenu->insertItem( i18n( "Recently Opened Files " ), recentlyFilesMenu ); + fileMenu->insertItem( i18n( "Recently Opened Projects" ), recentlyProjectsMenu ); + } + + connect( recentlyFilesMenu, SIGNAL( aboutToShow() ), + this, SLOT( setupRecentlyFilesMenu() ) ); + connect( recentlyProjectsMenu, SIGNAL( aboutToShow() ), + this, SLOT( setupRecentlyProjectsMenu() ) ); + connect( recentlyFilesMenu, SIGNAL( activated( int ) ), + this, SLOT( recentlyFilesMenuActivated( int ) ) ); + connect( recentlyProjectsMenu, SIGNAL( activated( int ) ), + this, SLOT( recentlyProjectsMenuActivated( int ) ) ); + + if ( !singleProject ) + fileMenu->insertSeparator(); + + a = new DesignerAction( this, 0 ); + actionFileExit = a; + if ( !singleProjectMode() ) { + a->setText( i18n( "Exit" ) ); + a->setMenuText( i18n( "E&xit" ) ); + a->setStatusTip( i18n( "Quits the application and prompts to save any changed forms, source files or project settings" ) ); + a->setWhatsThis( whatsThisFrom( "File|Exit" ) ); + } else { + a->setText( i18n( "Close" ) ); + a->setMenuText( i18n( "&Close" ) ); + } + connect( a, SIGNAL( activated() ), this, SLOT( fileQuit() ) ); + a->addTo( fileMenu ); +} + +void MainWindow::setupProjectActions() +{ + projectMenu = new QPopupMenu( this, "Project" ); + menubar->insertItem( i18n( "Pr&oject" ), projectMenu ); + + QActionGroup *ag = new QActionGroup( this, 0 ); + ag->setText( i18n( "Active Project" ) ); + ag->setMenuText( i18n( "Active Project" ) ); + ag->setExclusive( TRUE ); + ag->setUsesDropDown( TRUE ); + connect( ag, SIGNAL( selected( QAction * ) ), this, SLOT( projectSelected( QAction * ) ) ); + connect( ag, SIGNAL( selected( QAction * ) ), this, SIGNAL( projectChanged() ) ); + DesignerAction *a = new DesignerAction( i18n( "" ), i18n( "" ), 0, ag, 0, TRUE ); + eProject = new Project( "", i18n( "" ), projectSettingsPluginManager, TRUE ); + projects.insert( a, eProject ); + a->setOn( TRUE ); + ag->addTo( projectMenu ); + ag->addTo( projectToolBar ); + actionGroupProjects = ag; + + if ( !singleProject ) + projectMenu->insertSeparator(); + + a = new DesignerAction( i18n( "Add File" ), QPixmap(), i18n( "&Add File..." ), 0, this, 0 ); + actionProjectAddFile = a; + a->setStatusTip( i18n("Adds a file to the current project") ); + a->setWhatsThis( whatsThisFrom( "Project|Add File" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( projectInsertFile() ) ); + a->setEnabled( FALSE ); + connect( this, SIGNAL( hasNonDummyProject(bool) ), a, SLOT( setEnabled(bool) ) ); + if ( !singleProject ) + a->addTo( projectMenu ); + + actionEditPixmapCollection = new DesignerAction( i18n( "Image Collection..." ), QPixmap(), + i18n( "&Image Collection..." ), 0, this, 0 ); + actionEditPixmapCollection->setStatusTip( i18n("Opens a dialog for editing the current project's image collection") ); + actionEditPixmapCollection->setWhatsThis( whatsThisFrom( "Project|Image Collection" ) ); + connect( actionEditPixmapCollection, SIGNAL( activated() ), this, SLOT( editPixmapCollection() ) ); + actionEditPixmapCollection->setEnabled( FALSE ); + connect( this, SIGNAL( hasNonDummyProject(bool) ), actionEditPixmapCollection, SLOT( setEnabled(bool) ) ); + actionEditPixmapCollection->addTo( projectMenu ); + +#ifndef QT_NO_SQL + actionEditDatabaseConnections = new DesignerAction( i18n( "Database Connections..." ), QPixmap(), + i18n( "&Database Connections..." ), 0, this, 0 ); + actionEditDatabaseConnections->setStatusTip( i18n("Opens a dialog for editing the current project's database connections") ); + actionEditDatabaseConnections->setWhatsThis( whatsThisFrom( "Project|Database Connections" ) ); + connect( actionEditDatabaseConnections, SIGNAL( activated() ), this, SLOT( editDatabaseConnections() ) ); + //actionEditDatabaseConnections->setEnabled( FALSE ); + //connect( this, SIGNAL( hasNonDummyProject(bool) ), actionEditDatabaseConnections, SLOT( setEnabled(bool) ) ); + if ( !singleProject ) + actionEditDatabaseConnections->addTo( projectMenu ); +#endif + + actionEditProjectSettings = new DesignerAction( i18n( "Project Settings..." ), QPixmap(), + i18n( "&Project Settings..." ), 0, this, 0 ); + actionEditProjectSettings->setStatusTip( i18n("Opens a dialog to change the project's settings") ); + actionEditProjectSettings->setWhatsThis( whatsThisFrom( "Project|Project Settings" ) ); + connect( actionEditProjectSettings, SIGNAL( activated() ), this, SLOT( editProjectSettings() ) ); + actionEditProjectSettings->setEnabled( FALSE ); + connect( this, SIGNAL( hasNonDummyProject(bool) ), actionEditProjectSettings, SLOT( setEnabled(bool) ) ); + actionEditProjectSettings->addTo( projectMenu ); + +} + +void MainWindow::setupPreviewActions() +{ + DesignerAction* a = 0; + QPopupMenu *menu = new QPopupMenu( this, "Preview" ); + layoutMenu = menu; + menubar->insertItem( i18n( "&Preview" ), menu, toolsMenuId + 2 ); + + a = new DesignerAction( i18n( "Preview Form" ), QPixmap(), i18n( "Preview &Form" ), 0, this, 0 ); + actionPreview = a; + a->setAccel( CTRL + Key_T ); + a->setStatusTip( i18n("Opens a preview") ); + a->setWhatsThis( whatsThisFrom( "Preview|Preview Form" ) ); + connect( a, SIGNAL( activated() ), this, SLOT( previewForm() ) ); + connect( this, SIGNAL( hasActiveForm(bool) ), a, SLOT( setEnabled(bool) ) ); + a->addTo( menu ); + + menu->insertSeparator(); + + QSignalMapper *mapper = new QSignalMapper( this ); + connect( mapper, SIGNAL(mapped(const QString&)), this, SLOT(previewForm(const QString&)) ); + QStringList styles = QStyleFactory::keys(); + for ( QStringList::Iterator it = styles.begin(); it != styles.end(); ++it ) { + QString info; + if ( *it == "Motif" ) + info = i18n( "The preview will use the Motif look and feel which is used as the default style on most UNIX systems." ); + else if ( *it == "Windows" ) + info = i18n( "The preview will use the Windows look and feel." ); + else if ( *it == "Platinum" ) + info = i18n( "The preview will use the Platinum look and feel which is similar to the Macintosh GUI style." ); + else if ( *it == "CDE" ) + info = i18n( "The preview will use the CDE look and feel which is similar to some versions of the Common Desktop Environment." ); + else if ( *it == "SGI" ) + info = i18n( "The preview will use the Motif look and feel which is used as the default style on SGI systems." ); + else if ( *it == "MotifPlus" ) + info = i18n( "The preview will use the advanced Motif look and feel used by the GIMP toolkit (GTK) on Linux." ); + + a = new DesignerAction( i18n( "Preview Form in %1 Style" ).arg( *it ), QPixmap(), + i18n( "... in %1 Style" ).arg( *it ), 0, this, 0 ); + a->setStatusTip( i18n("Opens a preview in %1 style").arg( *it ) ); + a->setWhatsThis( i18n("Open a preview in %1 style." + "

      Use the preview to test the design and " + "signal-slot connections of the current form. %2

      ").arg( *it ).arg( info ) ); + mapper->setMapping( a, *it ); + connect( a, SIGNAL(activated()), mapper, SLOT(map()) ); + connect( this, SIGNAL( hasActiveForm(bool) ), a, SLOT( setEnabled(bool) ) ); + a->addTo( menu ); + } +} + +void MainWindow::setupWindowActions() +{ +/* static bool windowActionsSetup = FALSE; + if ( !windowActionsSetup ) { + windowActionsSetup = TRUE; +*/ + actionWindowTile = new DesignerAction( i18n( "Tile" ), i18n( "&Tile" ), 0, this ); + actionWindowTile->setStatusTip( i18n("Tiles the windows so that they are all visible") ); + actionWindowTile->setWhatsThis( whatsThisFrom( "Window|Tile" ) ); + connect( actionWindowTile, SIGNAL( activated() ), qworkspace, SLOT( tile() ) ); + actionWindowCascade = new DesignerAction( i18n( "Cascade" ), i18n( "&Cascade" ), 0, this ); + actionWindowCascade->setStatusTip( i18n("Cascades the windows so that all their title bars are visible") ); + actionWindowCascade->setWhatsThis( whatsThisFrom( "Window|Cascade" ) ); + connect( actionWindowCascade, SIGNAL( activated() ), qworkspace, SLOT( cascade() ) ); + + actionWindowClose = new DesignerAction( i18n( "Close" ), i18n( "Cl&ose" ), CTRL + Key_F4, this ); + actionWindowClose->setStatusTip( i18n( "Closes the active window") ); + actionWindowClose->setWhatsThis( whatsThisFrom( "Window|Close" ) ); + connect( actionWindowClose, SIGNAL( activated() ), qworkspace, SLOT( closeActiveWindow() ) ); + + actionWindowCloseAll = new DesignerAction( i18n( "Close All" ), i18n( "Close Al&l" ), 0, this ); + actionWindowCloseAll->setStatusTip( i18n( "Closes all form windows") ); + actionWindowCloseAll->setWhatsThis( whatsThisFrom( "Window|Close All" ) ); + connect( actionWindowCloseAll, SIGNAL( activated() ), qworkspace, SLOT( closeAllWindows() ) ); + + actionWindowNext = new DesignerAction( i18n( "Next" ), i18n( "Ne&xt" ), CTRL + Key_F6, this ); + actionWindowNext->setStatusTip( i18n( "Activates the next window" ) ); + actionWindowNext->setWhatsThis( whatsThisFrom( "Window|Next" ) ); + connect( actionWindowNext, SIGNAL( activated() ), qworkspace, SLOT( activateNextWindow() ) ); + + actionWindowPrevious = new DesignerAction( i18n( "Previous" ), i18n( "Pre&vious" ), CTRL + SHIFT + Key_F6, this ); + actionWindowPrevious->setStatusTip( i18n( "Activates the previous window" ) ); + actionWindowPrevious->setWhatsThis( whatsThisFrom( "Window|Previous" ) ); + connect( actionWindowPrevious, SIGNAL( activated() ), qworkspace, SLOT( activatePreviousWindow() ) ); + // } + + if ( !windowMenu ) { + windowMenu = new QPopupMenu( this, "Window" ); + menubar->insertItem( i18n( "&Window" ), windowMenu ); + connect( windowMenu, SIGNAL( aboutToShow() ), + this, SLOT( setupWindowActions() ) ); + } else { + windowMenu->clear(); + } + + actionWindowClose->addTo( windowMenu ); + actionWindowCloseAll->addTo( windowMenu ); + windowMenu->insertSeparator(); + actionWindowNext->addTo( windowMenu ); + actionWindowPrevious->addTo( windowMenu ); + windowMenu->insertSeparator(); + actionWindowTile->addTo( windowMenu ); + actionWindowCascade->addTo( windowMenu ); + windowMenu->insertSeparator(); + windowMenu->insertItem( i18n( "Vie&ws" ), createDockWindowMenu( NoToolBars ) ); + windowMenu->insertItem( i18n( "Tool&bars" ), createDockWindowMenu( OnlyToolBars ) ); + QWidgetList windows = qworkspace->windowList(); + if ( windows.count() && formWindow() ) + windowMenu->insertSeparator(); + int j = 0; + for ( int i = 0; i < int( windows.count() ); ++i ) { + QWidget *w = windows.at( i ); + if ( !::qt_cast(w) && !::qt_cast(w) ) + continue; + if ( ::qt_cast(w) && ( ( (FormWindow*)w )->isFake() ) ) + continue; + j++; + QString itemText; + if ( j < 10 ) + itemText = QString("&%1 ").arg( j ); + if ( ::qt_cast(w) ) + itemText += w->name(); + else + itemText += w->caption(); + + int id = windowMenu->insertItem( itemText, this, SLOT( windowsMenuActivated( int ) ) ); + windowMenu->setItemParameter( id, i ); + windowMenu->setItemChecked( id, qworkspace->activeWindow() == windows.at( i ) ); + } +} + +void MainWindow::setupHelpActions() +{ + actionHelpContents = new DesignerAction( i18n( "Contents" ), i18n( "&Contents" ), Key_F1, this, 0 ); + actionHelpContents->setStatusTip( i18n("Opens the online help") ); + actionHelpContents->setWhatsThis( whatsThisFrom( "Help|Contents" ) ); + connect( actionHelpContents, SIGNAL( activated() ), this, SLOT( helpContents() ) ); + + actionHelpManual = new DesignerAction( i18n( "Manual" ), i18n( "&Manual" ), CTRL + Key_M, this, 0 ); + actionHelpManual->setStatusTip( i18n("Opens the Qt Designer manual") ); + actionHelpManual->setWhatsThis( whatsThisFrom( "Help|Manual" ) ); + connect( actionHelpManual, SIGNAL( activated() ), this, SLOT( helpManual() ) ); + + actionHelpAbout = new DesignerAction( i18n("About"), QPixmap(), i18n("&About"), 0, this, 0 ); + actionHelpAbout->setStatusTip( i18n("Displays information about Qt Designer") ); + actionHelpAbout->setWhatsThis( whatsThisFrom( "Help|About" ) ); + connect( actionHelpAbout, SIGNAL( activated() ), this, SLOT( helpAbout() ) ); + + actionHelpAboutQt = new DesignerAction( i18n("About Qt"), QPixmap(), i18n("About &Qt"), 0, this, 0 ); + actionHelpAboutQt->setStatusTip( i18n("Displays information about the Qt Toolkit") ); + actionHelpAboutQt->setWhatsThis( whatsThisFrom( "Help|About Qt" ) ); + connect( actionHelpAboutQt, SIGNAL( activated() ), this, SLOT( helpAboutQt() ) ); + +#if 0 //defined(QT_NON_COMMERCIAL) + // ### not used anymore -- should be deleted? + actionHelpRegister = new DesignerAction( i18n("Register Qt"), QPixmap(), i18n("&Register Qt..."), 0, this, 0 ); + actionHelpRegister->setStatusTip( i18n("Opens a web browser at the evaluation form on www.trolltech.com") ); + actionHelpRegister->setWhatsThis( i18n("Register with Trolltech") ); + connect( actionHelpRegister, SIGNAL( activated() ), this, SLOT( helpRegister() ) ); +#endif + + actionHelpWhatsThis = new DesignerAction( i18n("What's This?"), QIconSet( whatsthis_image, whatsthis_image ), + i18n("What's This?"), SHIFT + Key_F1, this, 0 ); + actionHelpWhatsThis->setStatusTip( i18n("\"What's This?\" context sensitive help") ); + actionHelpWhatsThis->setWhatsThis( whatsThisFrom( "Help|What's This?" ) ); + connect( actionHelpWhatsThis, SIGNAL( activated() ), this, SLOT( whatsThis() ) ); + +/* QToolBar *tb = new QToolBar( this, "Help" ); + tb->setCloseMode( QDockWindow::Undocked ); + QWhatsThis::add( tb, i18n( "The Help toolbar%1" ).arg(i18n(toolbarHelp).arg("") )); + addToolBar( tb, i18n( "Help" ) ); + actionHelpWhatsThis->addTo( tb );*/ + + QPopupMenu *menu = new QPopupMenu( this, "Help" ); + menubar->insertSeparator(); + menubar->insertItem( i18n( "&Help" ), menu ); + actionHelpContents->addTo( menu ); + actionHelpManual->addTo( menu ); + menu->insertSeparator(); + actionHelpAbout->addTo( menu ); + actionHelpAboutQt->addTo( menu ); +#if 0 //defined(QT_NON_COMMERCIAL) + // ### not used anymore -- should be deleted? + actionHelpRegister->addTo( menu ); +#endif + + menu->insertSeparator(); + actionHelpWhatsThis->addTo( menu ); +} + +void MainWindow::fileNew() +{ + statusMessage( i18n( "Create a new project, form or source file...") ); + NewForm dlg( this, projectNames(), currentProject->projectName(), templatePath() ); + dlg.exec(); + statusBar()->clear(); +} + +void MainWindow::fileNewDialog() +{ + static int forms = 0; + QString n = "Dialog" + QString::number( ++forms ); + while ( currentProject->findFormFile( n + ".ui" ) ) + n = "Dialog" + QString::number( ++forms ); + FormWindow *fw = 0; + FormFile *ff = new FormFile( n + ".ui", FALSE, currentProject ); + fw = new FormWindow( ff, MainWindow::self, MainWindow::self->qWorkspace(), n ); + ff->setModified( TRUE ); + currentProject->setModified( TRUE ); + workspace()->update(); + fw->setProject( currentProject ); + MetaDataBase::addEntry( fw ); + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QDialog" ), fw, n.latin1() ); + fw->setMainContainer( w ); + fw->setCaption( n ); + fw->resize( 600, 480 ); + insertFormWindow( fw ); + fw->killAccels( fw ); + fw->project()->setModified( TRUE ); + fw->setFocus(); + fw->setSavePixmapInProject( TRUE ); + fw->setSavePixmapInline( FALSE ); +} + +void MainWindow::fileNewFile() +{ + QString name = QInputDialog::getText( i18n( "Name of File" ), i18n( "Enter the name of the new source file:" ) ); + if ( name.isEmpty() ) + return; + if ( name.right( 3 ) != ".qs" ) + name += ".qs"; + SourceFile *f = new SourceFile( name, FALSE, currentProject ); + MainWindow::self->editSource( f ); + f->setModified( TRUE ); + currentProject->setModified( TRUE ); + workspace()->update(); +} + +void MainWindow::fileQuit() +{ + close(); + if ( !singleProjectMode() ) + qApp->closeAllWindows(); +} + +void MainWindow::fileClose() +{ + if ( !currentProject->isDummy() ) { + fileCloseProject(); + } else { + QWidget *w = qworkspace->activeWindow(); + if ( w ) { + if ( ::qt_cast(w) ) + ( (FormWindow*)w )->formFile()->close(); + else if ( ::qt_cast(w) ) + ( (SourceEditor*)w )->close(); + } + } +} + + +void MainWindow::fileCloseProject() +{ + if ( currentProject->isDummy() ) + return; + Project *pro = currentProject; + QAction* a = 0; + QAction* lastValid = 0; + for ( QMap::Iterator it = projects.begin(); it != projects.end(); ++it ) { + if ( it.data() == pro ) { + a = it.key(); + if ( lastValid ) + break; + } + lastValid = it.key(); + } + if ( a ) { + if ( pro->isModified() ) { + switch ( QMessageBox::warning( this, i18n( "Save Project Settings" ), + i18n( "Save changes to '%1'?" ).arg( pro->fileName() ), + i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) { + case 0: // save + pro->save(); + break; + case 1: // don't save + break; + case 2: // cancel + return; + default: + break; + } + } + + QWidgetList windows = qWorkspace()->windowList(); + qWorkspace()->blockSignals( TRUE ); + QWidgetListIt wit( windows ); + while ( wit.current() ) { + QWidget *w = wit.current(); + ++wit; + if ( ::qt_cast(w) ) { + if ( ( (FormWindow*)w )->project() == pro ) { + if ( ( (FormWindow*)w )->formFile()->editor() ) + windows.removeRef( ( (FormWindow*)w )->formFile()->editor() ); + if ( !( (FormWindow*)w )->formFile()->close() ) + return; + } + } else if ( ::qt_cast(w) ) { + if ( !( (SourceEditor*)w )->close() ) + return; + } + } + hierarchyView->clear(); + windows = qWorkspace()->windowList(); + qWorkspace()->blockSignals( FALSE ); + actionGroupProjects->removeChild( a ); + projects.remove( a ); + delete a; + currentProject = 0; + if ( lastValid ) { + projectSelected( lastValid ); + statusMessage( i18n( "Selected project '%1'" ).arg( currentProject->projectName() ) ); + } + if ( !windows.isEmpty() ) { + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + if ( !::qt_cast(w) ) + continue; + w->setFocus(); + activeWindowChanged( w ); + break; + } + } else { + emit hasActiveWindow( FALSE ); + emit hasActiveForm( FALSE ); + updateUndoRedo( FALSE, FALSE, QString::null, QString::null ); + } + } +} + +void MainWindow::fileOpen() // as called by the menu +{ + fileOpen( "", "", "", FALSE ); +} + +void MainWindow::projectInsertFile() +{ + fileOpen( "", "" ); +} + +void MainWindow::fileOpen( const QString &filter, const QString &extension, const QString &fn, bool inProject ) +{ + statusMessage( i18n( "Open a file...") ); + + QPluginManager manager( IID_ImportFilter, QApplication::libraryPaths(), pluginDirectory() ); + + Project* project = inProject ? currentProject : eProject; + + QStringList additionalSources; + + { + QStringList filterlist; + if ( filter.isEmpty() ) { + if ( !inProject ) + filterlist << i18n( "*.ui *.pro|Designer Files" ); + filterlist << i18n( "*.ui|Qt User-Interface Files" ); + if ( !inProject ) + filterlist << i18n( "*.pro|QMAKE Project Files" ); + QStringList list = manager.featureList(); + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + filterlist << *it; + LanguageInterface *iface = MetaDataBase::languageInterface( project->language() ); + if ( iface ) { + filterlist += iface->fileFilterList(); + additionalSources += iface->fileExtensionList(); + } + filterlist << i18n( "*|All Files" ); + } else { + filterlist << filter; + } + + QString filters = filterlist.join( "\n" ); + + QStringList filenames; + if ( fn.isEmpty() ) { + if ( !inProject ) { + QString f = KFileDialog::getOpenFileName( QString::null, filters, this, /*0,*/ + i18n("Open" )/*, &lastOpenFilter */); + filenames << f; + } else { + filenames = KFileDialog::getOpenFileNames( QString::null, filters, this, /*0,*/ + i18n("Add")/*, &lastOpenFilter */); + } + } else { + filenames << fn; + } + + for ( QStringList::Iterator fit = filenames.begin(); fit != filenames.end(); ++fit ) { + QString filename = *fit; + if ( !filename.isEmpty() ) { + QFileInfo fi( filename ); + + if ( fi.extension( FALSE ) == "pro" && ( extension.isEmpty() || extension.find( ";pro" ) != -1 ) ) { + addRecentlyOpened( filename, recentlyProjects ); + openProject( filename ); + } else if ( fi.extension( FALSE ) == "ui" && ( extension.isEmpty() || extension.find( ";ui" ) != -1 ) ) { + if ( !inProject ) + setCurrentProject( eProject ); + openFormWindow( filename ); + addRecentlyOpened( filename, recentlyFiles ); + } else if ( !extension.isEmpty() && extension.find( ";" + fi.extension( FALSE ) ) != -1 || + additionalSources.find( fi.extension( FALSE ) ) != additionalSources.end() ) { + SourceFile *sf = project->findSourceFile( project->makeRelative( filename ) ); + if ( !sf ) + sf = new SourceFile( project->makeRelative( filename ), FALSE, project ); + editSource( sf ); + } else if ( extension.isEmpty() ) { + QString filter; + for ( QStringList::Iterator it2 = filterlist.begin(); it2 != filterlist.end(); ++it2 ) { + if ( (*it2).contains( "." + fi.extension( FALSE ), FALSE ) ) { + filter = *it2; + break; + } + } + + ImportFilterInterface* iface = 0; + manager.queryInterface( filter, &iface ); + if ( !iface ) { + statusMessage( i18n( "No import filter is available to import '%1'"). + arg( filename )/*, 3000*/ ); + return; + } + statusMessage( i18n( "Importing '%1' using import filter ...").arg( filename ) ); + QStringList list = iface->import( filter, filename ); + iface->release(); + if ( list.isEmpty() ) { + statusMessage( i18n( "Nothing to load in '%1'").arg( filename )/*, 3000*/ ); + return; + } + if ( !inProject ) + setCurrentProject( eProject ); + addRecentlyOpened( filename, recentlyFiles ); + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { + openFormWindow( *it, FALSE ); + QFile::remove( *it ); + } + statusBar()->clear(); + } + } + } + } +} + +FormWindow *MainWindow::openFormWindow( const QString &filename, bool validFileName, FormFile *ff ) +{ + if ( filename.isEmpty() ) + return 0; + + bool makeNew = FALSE; + + if ( !QFile::exists( filename ) ) { + makeNew = TRUE; + } else { + QFile f( filename ); + f.open( IO_ReadOnly ); + QTextStream ts( &f ); + makeNew = ts.read().length() < 2; + } + if ( makeNew ) { + fileNew(); + if ( formWindow() ) + formWindow()->setFileName( filename ); + return formWindow(); + } + + statusMessage( i18n( "Reading file '%1'...").arg( filename ) ); + FormFile *ff2 = currentProject->findFormFile( currentProject->makeRelative(filename) ); + if ( ff2 && ff2->formWindow() ) { + ff2->formWindow()->setFocus(); + return ff2->formWindow(); + } + + if ( ff2 ) + ff = ff2; + QApplication::setOverrideCursor( WaitCursor ); + Resource resource( this ); + if ( !ff ) + ff = new FormFile( currentProject->makeRelative( filename ), FALSE, currentProject ); + bool b = resource.load( ff ) && (FormWindow*)resource.widget(); + if ( !validFileName && resource.widget() ) + ( (FormWindow*)resource.widget() )->setFileName( QString::null ); + QApplication::restoreOverrideCursor(); + if ( b ) { + rebuildCustomWidgetGUI(); + statusMessage( i18n( "Loaded file '%1'").arg( filename )/*, 3000 */); + } else { + statusMessage( i18n( "Failed to load file '%1'").arg( filename )/*, 5000 */); + QMessageBox::information( this, i18n("Load File"), i18n("Could not load file '%1'.").arg( filename ) ); + delete ff; + } + return (FormWindow*)resource.widget(); +} + +bool MainWindow::fileSave() +{ + + if ( !currentProject->isDummy() ) + return fileSaveProject(); + return fileSaveForm(); +} + +bool MainWindow::fileSaveForm() +{ + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->object() == formWindow() || e == qWorkspace()->activeWindow() ) { + e->save(); + } + } + + FormWindow *fw = 0; + + QWidget *w = qWorkspace()->activeWindow(); + if ( w ) { + if ( ::qt_cast(w) ) { + SourceEditor *se = (SourceEditor*)w; + if ( se->formWindow() ) + fw = se->formWindow(); + else if ( se->sourceFile() ) { + se->sourceFile()->save(); + return TRUE; + } + } + } + + if ( !fw ) + fw = formWindow(); + if ( !fw || !fw->formFile()->save() ) + return FALSE; + QApplication::restoreOverrideCursor(); + return TRUE; +} + +bool MainWindow::fileSaveProject() +{ + currentProject->save(); + statusMessage( i18n( "Project '%1' saved.").arg( currentProject->projectName() )/*, 3000 */); + return TRUE; +} + +bool MainWindow::fileSaveAs() +{ + statusMessage( i18n( "Enter a filename..." ) ); + + QWidget *w = qworkspace->activeWindow(); + if ( !w ) + return TRUE; + if ( ::qt_cast(w) ) + return ( (FormWindow*)w )->formFile()->saveAs(); + else if ( ::qt_cast(w) ) + return ( (SourceEditor*)w )->saveAs(); + return FALSE; +} + +void MainWindow::fileSaveAll() +{ + for ( QMap::Iterator it = projects.begin(); it != projects.end(); ++it ) + (*it)->save(); +} + +void MainWindow::fileCreateTemplate() +{ + CreateTemplate dia( this, 0, TRUE ); + + int i = 0; + for ( i = 0; i < WidgetDatabase::count(); ++i ) { + if ( WidgetDatabase::isForm( i ) && WidgetDatabase::group( i ) != "Temp") { + dia.listClass->insertItem( WidgetDatabase::className( i ) ); + } + } + for ( i = 0; i < WidgetDatabase::count(); ++i ) { + if ( WidgetDatabase::isContainer( i ) && !WidgetDatabase::isForm(i) && + WidgetDatabase::className( i ) != "QTabWidget" && WidgetDatabase::group( i ) != "Temp" ) { + dia.listClass->insertItem( WidgetDatabase::className( i ) ); + } + } + + QPtrList *lst = MetaDataBase::customWidgets(); + for ( MetaDataBase::CustomWidget *w = lst->first(); w; w = lst->next() ) { + if ( w->isContainer ) + dia.listClass->insertItem( w->className ); + } + + dia.editName->setText( i18n( "NewTemplate" ) ); + connect( dia.buttonCreate, SIGNAL( clicked() ), + this, SLOT( createNewTemplate() ) ); + dia.exec(); +} + +void MainWindow::createNewTemplate() +{ + CreateTemplate *dia = (CreateTemplate*)sender()->parent(); + QString fn = dia->editName->text(); + QString cn = dia->listClass->currentText(); + if ( fn.isEmpty() || cn.isEmpty() ) { + QMessageBox::information( this, i18n( "Create Template" ), i18n( "Could not create the template." ) ); + return; + } + + QStringList templRoots; + const char *qtdir = getenv( "QTDIR" ); + if(qtdir) + templRoots << qtdir; + templRoots << qInstallPathData(); + if(qtdir) //try the tools/designer directory last! + templRoots << (QString(qtdir) + "/tools/designer"); + QFile f; + for ( QStringList::Iterator it = templRoots.begin(); it != templRoots.end(); ++it ) { + if ( QFile::exists( (*it) + "/templates/" )) { + QString tmpfn = (*it) + "/templates/" + fn + ".ui"; + f.setName(tmpfn); + if(f.open(IO_WriteOnly)) + break; + } + } + if ( !f.isOpen() ) { + QMessageBox::information( this, i18n( "Create Template" ), i18n( "Could not create the template." ) ); + return; + } + QTextStream ts( &f ); + + ts << "" << endl; + ts << "" << endl; + ts << "" << cn << "" << endl; + ts << "" << endl; + ts << " name" << endl; + ts << " " << cn << "Form" << endl; + ts << "" << endl; + ts << "" << endl; + ts << " geometry" << endl; + ts << " " << endl; + ts << " 300" << endl; + ts << " 400" << endl; + ts << " " << endl; + ts << "" << endl; + ts << "" << endl; + ts << "" << endl; + + dia->editName->setText( i18n( "NewTemplate" ) ); + + f.close(); +} + +void MainWindow::editUndo() +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (SourceEditor*)qWorkspace()->activeWindow() )->editUndo(); + return; + } + if ( formWindow() ) + formWindow()->undo(); +} + +void MainWindow::editRedo() +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (SourceEditor*)qWorkspace()->activeWindow() )->editRedo(); + return; + } + if ( formWindow() ) + formWindow()->redo(); +} + +void MainWindow::editCut() +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (SourceEditor*)qWorkspace()->activeWindow() )->editCut(); + return; + } + editCopy(); + editDelete(); +} + +void MainWindow::editCopy() +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (SourceEditor*)qWorkspace()->activeWindow() )->editCopy(); + return; + } + if ( formWindow() ) + qApp->clipboard()->setText( formWindow()->copy() ); +} + +void MainWindow::editPaste() +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (SourceEditor*)qWorkspace()->activeWindow() )->editPaste(); + return; + } + if ( !formWindow() ) + return; + + QWidget *w = formWindow()->mainContainer(); + QWidgetList l( formWindow()->selectedWidgets() ); + if ( l.count() == 1 ) { + w = l.first(); + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout || + ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ) && + w != formWindow()->mainContainer() ) ) + w = formWindow()->mainContainer(); + } + + if ( w && WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) { + formWindow()->paste( qApp->clipboard()->text(), WidgetFactory::containerOfWidget( w ) ); + hierarchyView->widgetInserted( 0 ); + formWindow()->commandHistory()->setModified( TRUE ); + } else { + QMessageBox::information( this, i18n( "Paste Error" ), + i18n( "Cannot paste widgets. Designer could not find a container\n" + "to paste into which does not contain a layout. Break the layout\n" + "of the container you want to paste into and select this container\n" + "and then paste again." ) ); + } +} + +void MainWindow::editDelete() +{ + if ( formWindow() ) + formWindow()->deleteWidgets(); +} + +void MainWindow::editSelectAll() +{ + if ( qWorkspace()->activeWindow() && + ::qt_cast(qWorkspace()->activeWindow()) ) { + ( (SourceEditor*)qWorkspace()->activeWindow() )->editSelectAll(); + return; + } + if ( formWindow() ) + formWindow()->selectAll(); +} + + +void MainWindow::editLower() +{ + if ( formWindow() ) + formWindow()->lowerWidgets(); +} + +void MainWindow::editRaise() +{ + if ( formWindow() ) + formWindow()->raiseWidgets(); +} + +void MainWindow::editAdjustSize() +{ + if ( formWindow() ) + formWindow()->editAdjustSize(); +} + +void MainWindow::editLayoutHorizontal() +{ + if ( layoutChilds ) + editLayoutContainerHorizontal(); + else if ( layoutSelected && formWindow() ) + formWindow()->layoutHorizontal(); +} + +void MainWindow::editLayoutVertical() +{ + if ( layoutChilds ) + editLayoutContainerVertical(); + else if ( layoutSelected && formWindow() ) + formWindow()->layoutVertical(); +} + +void MainWindow::editLayoutHorizontalSplit() +{ + if ( layoutChilds ) + ; // no way to do that + else if ( layoutSelected && formWindow() ) + formWindow()->layoutHorizontalSplit(); +} + +void MainWindow::editLayoutVerticalSplit() +{ + if ( layoutChilds ) + ; // no way to do that + else if ( layoutSelected && formWindow() ) + formWindow()->layoutVerticalSplit(); +} + +void MainWindow::editLayoutGrid() +{ + if ( layoutChilds ) + editLayoutContainerGrid(); + else if ( layoutSelected && formWindow() ) + formWindow()->layoutGrid(); +} + +void MainWindow::editLayoutContainerVertical() +{ + if ( !formWindow() ) + return; + QWidget *w = formWindow()->mainContainer(); + QWidgetList l( formWindow()->selectedWidgets() ); + if ( l.count() == 1 ) + w = l.first(); + if ( w ) + formWindow()->layoutVerticalContainer( w ); +} + +void MainWindow::editLayoutContainerHorizontal() +{ + if ( !formWindow() ) + return; + QWidget *w = formWindow()->mainContainer(); + QWidgetList l( formWindow()->selectedWidgets() ); + if ( l.count() == 1 ) + w = l.first(); + if ( w ) + formWindow()->layoutHorizontalContainer( w ); +} + +void MainWindow::editLayoutContainerGrid() +{ + if ( !formWindow() ) + return; + QWidget *w = formWindow()->mainContainer(); + QWidgetList l( formWindow()->selectedWidgets() ); + if ( l.count() == 1 ) + w = l.first(); + if ( w ) + formWindow()->layoutGridContainer( w ); +} + +void MainWindow::editBreakLayout() +{ + if ( !formWindow() || !breakLayout ) + return; + QWidget *w = formWindow()->mainContainer(); + if ( formWindow()->currentWidget() ) + w = formWindow()->currentWidget(); + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout || + w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) { + formWindow()->breakLayout( w ); + return; + } else { + QWidgetList widgets = formWindow()->selectedWidgets(); + for ( w = widgets.first(); w; w = widgets.next() ) { + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout || + w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) + break; + } + if ( w ) { + formWindow()->breakLayout( w ); + return; + } + } + + w = formWindow()->mainContainer(); + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout || + w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) + formWindow()->breakLayout( w ); +} + +void MainWindow::editAccels() +{ + if ( !formWindow() ) + return; + formWindow()->checkAccels(); +} + +void MainWindow::editFunctions() +{ + if ( !formWindow() ) + return; + + statusMessage( i18n( "Edit the current form's slots..." ) ); + EditFunctions dlg( this, formWindow(), TRUE ); + dlg.exec(); + statusBar()->clear(); +} + +void MainWindow::editConnections() +{ + if ( !formWindow() ) + return; + + statusMessage( i18n( "Edit the current form's connections..." ) ); + ConnectionDialog dlg( this ); + dlg.exec(); + + statusBar()->clear(); +} + +SourceEditor *MainWindow::editSource() +{ + if ( !formWindow() ) + return 0; + return formWindow()->formFile()->showEditor(); +} + +SourceEditor *MainWindow::openSourceEditor() +{ + if ( !formWindow() ) + return 0; + + QString lang = currentProject->language(); + if ( !MetaDataBase::hasEditor( lang ) ) { + QMessageBox::information( this, i18n( "Edit Source" ), + i18n( "There is no plugin for editing %1 code installed.\n" + "Note: Plugins are not available in static Qt configurations." ).arg( lang ) ); + return 0; + } + + SourceEditor *editor = 0; + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) { + if ( e->language() == lang && e->formWindow() == formWindow() ) { + editor = e; + break; + } + } + + if ( !editor ) + editor = createSourceEditor( formWindow(), formWindow()->project(), lang ); + return editor; +} + +SourceEditor *MainWindow::editSource( SourceFile *f ) +{ + QString lang = currentProject->language(); + if ( !MetaDataBase::hasEditor( lang ) ) { + QMessageBox::information( this, i18n( "Edit Source" ), + i18n( "There is no plugin for editing %1 code installed.\n" + "Note: Plugins are not available in static Qt configurations." ).arg( lang ) ); + return 0; + } + + SourceEditor *editor = 0; + if ( f ) + editor = f->editor(); + if ( !editor ) + editor = createSourceEditor( f, currentProject, lang ); + editor->setActiveWindow(); + editor->setFocus(); + return editor; +} + +SourceEditor *MainWindow::createSourceEditor( QObject *object, Project *project, + const QString &lang, const QString &func, + bool rereadSource ) +{ + SourceEditor *editor = 0; + EditorInterface *eIface = 0; + editorPluginManager->queryInterface( lang, &eIface ); + if ( !eIface ) + return 0; + LanguageInterface *lIface = MetaDataBase::languageInterface( lang ); + if ( !lIface ) + return 0; + QApplication::setOverrideCursor( WaitCursor ); + editor = new SourceEditor( qWorkspace(), eIface, lIface ); + eIface->release(); + lIface->release(); + + editor->setLanguage( lang ); + sourceEditors.append( editor ); + QApplication::restoreOverrideCursor(); + + if ( editor->object() != object ) + editor->setObject( object, project ); + else if ( rereadSource ) + editor->refresh( FALSE ); + + editor->show(); + editor->setFocus(); + if ( !func.isEmpty() ) + editor->setFunction( func ); + emit editorChanged(); + + return editor; +} + +void MainWindow::editFormSettings() +{ + if ( !formWindow() ) + return; + + statusMessage( i18n( "Edit the current form's settings..." ) ); + FormSettings dlg( this, formWindow() ); + dlg.exec(); + statusBar()->clear(); +} + +void MainWindow::editProjectSettings() +{ + openProjectSettings( currentProject ); + wspace->setCurrentProject( currentProject ); +} + +void MainWindow::editPixmapCollection() +{ + PixmapCollectionEditor dia( this, 0, TRUE ); + dia.setProject( currentProject ); + dia.exec(); +} + +void MainWindow::editDatabaseConnections() +{ +#ifndef QT_NO_SQL + DatabaseConnectionsEditor dia( currentProject, this, 0, TRUE ); + dia.exec(); +#endif +} + +void MainWindow::editPreferences() +{ + statusMessage( i18n( "Edit preferences..." ) ); + Preferences *dia = new Preferences( this, 0, TRUE ); + prefDia = dia; + connect( dia->helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + dia->buttonColor->setEditor( StyledButton::ColorEditor ); + dia->buttonPixmap->setEditor( StyledButton::PixmapEditor ); + dia->groupBoxGrid->setChecked( sGrid ); + dia->checkBoxSnapGrid->setChecked( snGrid ); + dia->spinGridX->setValue( grid().x() ); + dia->spinGridY->setValue( grid().y() ); + dia->checkBoxWorkspace->setChecked( restoreConfig ); + dia->checkBoxTextLabels->setChecked( usesTextLabel() ); + dia->buttonColor->setColor( qworkspace->backgroundColor() ); + QString pluginPaths = QApplication::libraryPaths().join("\n"); + dia->textEditPluginPaths->setText(pluginPaths); + if ( qworkspace->backgroundPixmap() ) + dia->buttonPixmap->setPixmap( *qworkspace->backgroundPixmap() ); + if ( backPix ) + dia->radioPixmap->setChecked( TRUE ); + else + dia->radioColor->setChecked( TRUE ); + dia->checkBoxSplash->setChecked( splashScreen ); + dia->checkAutoEdit->setChecked( !databaseAutoEdit ); + dia->checkBoxStartDialog->setChecked( shStartDialog ); + dia->checkBoxAutoSave->setChecked( autoSaveEnabled ); + int h = autoSaveInterval / 3600; + int m = ( autoSaveInterval - h * 3600 ) / 60; + int s = autoSaveInterval - ( h * 3600 + m * 60 ); + QTime t( h, m, s ); + dia->timeEditAutoSave->setTime( t ); + + SenderObject *senderObject = new SenderObject( designerInterface() ); + QValueList::Iterator it; + for ( it = preferenceTabs.begin(); it != preferenceTabs.end(); ++it ) { + Tab t = *it; + dia->tabWidget->addTab( t.w, t.title ); + if ( t.receiver ) { + connect( dia->buttonOk, SIGNAL( clicked() ), senderObject, SLOT( emitAcceptSignal() ) ); + connect( senderObject, SIGNAL( acceptSignal( QUnknownInterface * ) ), t.receiver, t.accept_slot ); + connect( senderObject, SIGNAL( initSignal( QUnknownInterface * ) ), t.receiver, t.init_slot ); + senderObject->emitInitSignal(); + disconnect( senderObject, SIGNAL( initSignal( QUnknownInterface * ) ), t.receiver, t.init_slot ); + } + } + + if ( dia->exec() == QDialog::Accepted ) { + setSnapGrid( dia->checkBoxSnapGrid->isChecked() ); + setShowGrid( dia->groupBoxGrid->isChecked() ); + setGrid( QPoint( dia->spinGridX->value(), + dia->spinGridY->value() ) ); + restoreConfig = dia->checkBoxWorkspace->isChecked(); + setUsesTextLabel( dia->checkBoxTextLabels->isChecked() ); + if (dia->textEditPluginPaths->isModified()) { + pluginPaths = dia->textEditPluginPaths->text(); + QApplication::setLibraryPaths(QStringList::split("\n", pluginPaths)); + savePluginPaths = TRUE; + } + + if ( dia->radioPixmap->isChecked() && dia->buttonPixmap->pixmap() ) { + qworkspace->setBackgroundPixmap( *dia->buttonPixmap->pixmap() ); + backPix = TRUE; + } else { + qworkspace->setBackgroundColor( dia->buttonColor->color() ); + backPix = FALSE; + } + splashScreen = dia->checkBoxSplash->isChecked(); + databaseAutoEdit = !dia->checkAutoEdit->isChecked(); + shStartDialog = dia->checkBoxStartDialog->isChecked(); + autoSaveEnabled = dia->checkBoxAutoSave->isChecked(); + QTime time = dia->timeEditAutoSave->time(); + autoSaveInterval = time.hour() * 3600 + time.minute() * 60 + time.second(); + if ( autoSaveEnabled ) + autoSaveTimer->start( autoSaveInterval * 1000 ); + else + autoSaveTimer->stop(); + } + delete senderObject; + for ( it = preferenceTabs.begin(); it != preferenceTabs.end(); ++it ) { + Tab t = *it; + dia->tabWidget->removePage( t.w ); + t.w->reparent( 0, QPoint(0,0), FALSE ); + } + + for ( SourceEditor *e = sourceEditors.first(); e; e = sourceEditors.next() ) + e->configChanged(); + + delete dia; + prefDia = 0; + statusBar()->clear(); +} + +void MainWindow::searchFind() +{ + if ( !qWorkspace()->activeWindow() || + !::qt_cast(qWorkspace()->activeWindow()) ) + return; + + if ( !findDialog ) + findDialog = new FindDialog( this, 0, FALSE ); + findDialog->show(); + findDialog->raise(); + findDialog->setEditor( ( (SourceEditor*)qWorkspace()->activeWindow() )->editorInterface(), + ( (SourceEditor*)qWorkspace()->activeWindow() )->object() ); + findDialog->comboFind->setFocus(); + findDialog->comboFind->lineEdit()->selectAll(); +} + +void MainWindow::searchIncremetalFindMenu() +{ + incrementalSearch->selectAll(); + incrementalSearch->setFocus(); +} + +void MainWindow::searchIncremetalFind() +{ + if ( !qWorkspace()->activeWindow() || + !::qt_cast(qWorkspace()->activeWindow()) ) + return; + + ( (SourceEditor*)qWorkspace()->activeWindow() )->editorInterface()->find( incrementalSearch->text(), + FALSE, FALSE, TRUE, FALSE ); +} + +void MainWindow::searchIncremetalFindNext() +{ + if ( !qWorkspace()->activeWindow() || + !::qt_cast(qWorkspace()->activeWindow()) ) + return; + + ( (SourceEditor*)qWorkspace()->activeWindow() )->editorInterface()->find( incrementalSearch->text(), + FALSE, FALSE, TRUE, TRUE ); +} + +void MainWindow::searchReplace() +{ + if ( !qWorkspace()->activeWindow() || + !::qt_cast(qWorkspace()->activeWindow()) ) + return; + + if ( !replaceDialog ) + replaceDialog = new ReplaceDialog( this, 0, FALSE ); + replaceDialog->show(); + replaceDialog->raise(); + replaceDialog->setEditor( ( (SourceEditor*)qWorkspace()->activeWindow() )->editorInterface(), + ( (SourceEditor*)qWorkspace()->activeWindow() )->object() ); + replaceDialog->comboFind->setFocus(); + replaceDialog->comboFind->lineEdit()->selectAll(); +} + +void MainWindow::searchGotoLine() +{ + if ( !qWorkspace()->activeWindow() || + !::qt_cast(qWorkspace()->activeWindow()) ) + return; + + if ( !gotoLineDialog ) + gotoLineDialog = new GotoLineDialog( this, 0, FALSE ); + gotoLineDialog->show(); + gotoLineDialog->raise(); + gotoLineDialog->setEditor( ( (SourceEditor*)qWorkspace()->activeWindow() )->editorInterface() ); + gotoLineDialog->spinLine->setFocus(); + gotoLineDialog->spinLine->setMinValue( 1 ); + gotoLineDialog->spinLine->setMaxValue( ( (SourceEditor*)qWorkspace()->activeWindow() )->numLines() ); + gotoLineDialog->spinLine->selectAll(); +} + +void MainWindow::toolsCustomWidget() +{ + statusMessage( i18n( "Edit custom widgets..." ) ); + CustomWidgetEditor edit( this, this ); + edit.exec(); + rebuildCustomWidgetGUI(); + statusBar()->clear(); +} + +void MainWindow::toolsConfigure() +{ + ConfigToolboxDialog dlg( this ); + if ( dlg.exec() != QDialog::Accepted ) + return; + rebuildCommonWidgetsToolBoxPage(); +} + +void MainWindow::showStartDialog() +{ + if ( singleProjectMode() ) + return; + for ( int i = 1; i < qApp->argc(); ++i ) { + QString arg = qApp->argv()[i]; + if ( arg[0] != '-' ) + return; + } + StartDialog *sd = new StartDialog( this, templatePath() ); + sd->setRecentlyFiles( recentlyFiles ); + sd->setRecentlyProjects( recentlyProjects ); + sd->exec(); + shStartDialog = sd->showDialogInFuture(); +} diff --git a/kdevdesigner/designer/menubareditor.cpp b/kdevdesigner/designer/menubareditor.cpp new file mode 100644 index 00000000..33cf923e --- /dev/null +++ b/kdevdesigner/designer/menubareditor.cpp @@ -0,0 +1,1129 @@ +/********************************************************************** +** Copyright (C) 2003 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "command.h" +#include "formwindow.h" +#include "menubareditor.h" +#include "popupmenueditor.h" + +#include + +extern void find_accel( const QString &txt, QMap &accels, QWidget *w ); + +// Drag Object Declaration ------------------------------------------- + +class MenuBarEditorItemPtrDrag : public QStoredDrag +{ +public: + MenuBarEditorItemPtrDrag( MenuBarEditorItem * item, + QWidget * parent = 0, + const char * name = 0 ); + ~MenuBarEditorItemPtrDrag() {}; + static bool canDecode( QDragMoveEvent * e ); + static bool decode( QDropEvent * e, MenuBarEditorItem ** i ); +}; + +// Drag Object Implementation --------------------------------------- + +MenuBarEditorItemPtrDrag::MenuBarEditorItemPtrDrag( MenuBarEditorItem * item, + QWidget * parent, + const char * name ) + : QStoredDrag( "qt/menubareditoritemptr", parent, name ) +{ + QByteArray data( sizeof( Q_LONG ) ); + QDataStream stream( data, IO_WriteOnly ); + stream << ( Q_LONG ) item; + setEncodedData( data ); +} + +bool MenuBarEditorItemPtrDrag::canDecode( QDragMoveEvent * e ) +{ + return e->provides( "qt/menubareditoritemptr" ); +} + +bool MenuBarEditorItemPtrDrag::decode( QDropEvent * e, MenuBarEditorItem ** i ) +{ + QByteArray data = e->encodedData( "qt/menubareditoritemptr" ); + QDataStream stream( data, IO_ReadOnly ); + + if ( !data.size() ) + return FALSE; + + Q_LONG p = 0; + stream >> p; + *i = ( MenuBarEditorItem *) p; + + return TRUE; +} + +// MenuBarEditorItem --------------------------------------------------- + +MenuBarEditorItem::MenuBarEditorItem( MenuBarEditor * bar, QObject * parent, const char * name ) + : QObject( parent, name ), + menuBar( bar ), + popupMenu( 0 ), + visible( TRUE ), + separator( FALSE ), + removable( FALSE ) +{ } + +MenuBarEditorItem::MenuBarEditorItem( PopupMenuEditor * menu, MenuBarEditor * bar, + QObject * parent, const char * name ) + : QObject( parent, name ), + menuBar( bar ), + popupMenu( menu ), + visible( TRUE ), + separator( FALSE ), + removable( TRUE ) +{ + text = menu->name(); +} + +MenuBarEditorItem::MenuBarEditorItem( QActionGroup * actionGroup, MenuBarEditor * bar, + QObject * parent, const char * name ) + : QObject( parent, name ), + menuBar( bar ), + popupMenu( 0 ), + visible( TRUE ), + separator( FALSE ), + removable( TRUE ) +{ + text = actionGroup->menuText(); + popupMenu = new PopupMenuEditor( menuBar->formWindow(), menuBar ); + popupMenu->insert( actionGroup ); +} + +MenuBarEditorItem::MenuBarEditorItem( MenuBarEditorItem * item, QObject * parent, const char * name ) + : QObject( parent, name ), + menuBar( item->menuBar ), + popupMenu( 0 ), + text( item->text ), + visible( item->visible ), + separator( item->separator ), + removable( item->removable ) +{ + popupMenu = new PopupMenuEditor( menuBar->formWindow(), item->popupMenu, menuBar ); +} + +// MenuBarEditor -------------------------------------------------------- + +int MenuBarEditor::clipboardOperation = 0; +MenuBarEditorItem * MenuBarEditor::clipboardItem = 0; + +MenuBarEditor::MenuBarEditor( FormWindow * fw, QWidget * parent, const char * name ) + : QMenuBar( parent, name ), + formWnd( fw ), + draggedItem( 0 ), + currentIndex( 0 ), + itemHeight( 0 ), + separatorWidth( 32 ), + hideWhenEmpty( TRUE ), + hasSeparator( FALSE ) +{ + setAcceptDrops( TRUE ); + setFocusPolicy( StrongFocus ); + + addItem.setMenuText( i18n("new menu") ); + addSeparator.setMenuText( i18n("new separator") ); + + lineEdit = new QLineEdit( this, "menubar lineedit" ); + lineEdit->hide(); + lineEdit->setFrameStyle(QFrame::Plain | QFrame::NoFrame); + lineEdit->polish(); + lineEdit->setBackgroundMode(PaletteButton); + lineEdit->setBackgroundOrigin(ParentOrigin); + lineEdit->installEventFilter( this ); + + dropLine = new QWidget( this, "menubar dropline", Qt::WStyle_NoBorder | WStyle_StaysOnTop ); + dropLine->setBackgroundColor( Qt::red ); + dropLine->hide(); + + setMinimumHeight( fontMetrics().height() + 2 * borderSize() ); +} + +MenuBarEditor::~MenuBarEditor() +{ + itemList.setAutoDelete( TRUE ); +} + +FormWindow * MenuBarEditor::formWindow() +{ + return formWnd; +} + +MenuBarEditorItem * MenuBarEditor::createItem( int index, bool addToCmdStack ) +{ + MenuBarEditorItem * i = + new MenuBarEditorItem( new PopupMenuEditor( formWnd, ( QWidget * ) parent() ), this ); + if ( addToCmdStack ) { + AddMenuCommand * cmd = new AddMenuCommand( i18n( "Add Menu" ), formWnd, this, i, index ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else { + AddMenuCommand cmd( i18n( "Add Menu" ), formWnd, this, i, index ); + cmd.execute(); + } + return i; +} + +void MenuBarEditor::insertItem( MenuBarEditorItem * item, int index ) +{ + item->menu()->parentMenu = this; + + if ( index != -1 ) + itemList.insert( index, item ); + else + itemList.append( item ); + + if ( hideWhenEmpty && itemList.count() == 1 ) + show(); // calls resizeInternals(); + else + resizeInternals(); + + if ( isVisible() ) + update(); +} + +void MenuBarEditor::insertItem( QString text, PopupMenuEditor * menu, int index ) +{ + MenuBarEditorItem * item = new MenuBarEditorItem( menu, this ); + if ( !text.isNull() ) + item->setMenuText( text ); + insertItem( item, index ); +} + +void MenuBarEditor::insertItem( QString text, QActionGroup * group, int index ) +{ + MenuBarEditorItem * item = new MenuBarEditorItem( group, this ); + if ( !text.isNull() ) + item->setMenuText( text ); + insertItem( item, index ); +} + + +void MenuBarEditor::insertSeparator( int index ) +{ + if ( hasSeparator ) + return; + + MenuBarEditorItem * i = createItem( index ); + i->setSeparator( TRUE ); + i->setMenuText( i18n( "separator" ) ); + hasSeparator = TRUE; +} + +void MenuBarEditor::removeItemAt( int index ) +{ + removeItem( item( index ) ); +} + +void MenuBarEditor::removeItem( MenuBarEditorItem * item ) +{ + if ( item && + item->isRemovable() && + itemList.removeRef( item ) ) { + + if ( item->isSeparator() ) + hasSeparator = FALSE; + + if ( hideWhenEmpty && itemList.count() == 0 ) + hide(); + else + resizeInternals(); + + int n = count() + 1; + if ( currentIndex >= n ) + currentIndex = n; + + if ( isVisible() ) + update(); + } +} + +int MenuBarEditor::findItem( MenuBarEditorItem * item ) +{ + return itemList.findRef( item ); +} + +int MenuBarEditor::findItem( PopupMenuEditor * menu ) +{ + MenuBarEditorItem * i = itemList.first(); + + while ( i ) { + if ( i->menu() == menu ) + return itemList.at(); + i = itemList.next(); + } + + return -1; +} + +int MenuBarEditor::findItem( QPoint & pos ) +{ + int x = borderSize(); + int dx = 0; + int y = 0; + int w = width(); + QSize s; + QRect r; + + MenuBarEditorItem * i = itemList.first(); + + while ( i ) { + + if ( i->isVisible() ) { + + s = itemSize( i ); + dx = s.width(); + + if ( x + dx > w && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + + r = QRect( x, y, s.width(), s.height() ); + + if ( r.contains( pos ) ) + return itemList.at(); + + addItemSizeToCoords( i, x, y, w ); + } + + i = itemList.next(); + } + + // check add item + s = itemSize( &addItem ); + dx = s.width(); + + if ( x + dx > w && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + + r = QRect( x, y, s.width(), s.height() ); + + if ( r.contains( pos ) ) + return itemList.count(); + + return itemList.count() + 1; +} + +MenuBarEditorItem * MenuBarEditor::item( int index ) +{ + if ( index == -1 ) + return itemList.at( currentIndex ); + + int c = itemList.count(); + if ( index == c ) + return &addItem; + else if ( index > c ) + return &addSeparator; + + return itemList.at( index ); +} + +int MenuBarEditor::count() +{ + return itemList.count(); +} + +int MenuBarEditor::current() +{ + return currentIndex; +} + +void MenuBarEditor::cut( int index ) +{ + if ( clipboardItem && clipboardOperation == Cut ) + delete clipboardItem; + + clipboardOperation = Cut; + clipboardItem = itemList.at( index ); + + if ( clipboardItem == &addItem || clipboardItem == &addSeparator ) { + clipboardOperation = None; + clipboardItem = 0; + return; // do nothing + } + + RemoveMenuCommand * cmd = new RemoveMenuCommand( i18n( "Cut Menu" ), formWnd, this, index ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void MenuBarEditor::copy( int index ) +{ + if ( clipboardItem && clipboardOperation == Cut ) + delete clipboardItem; + + clipboardOperation = Copy; + clipboardItem = itemList.at( index ); + + if ( clipboardItem == &addItem || clipboardItem == &addSeparator ) { + clipboardOperation = None; + clipboardItem = 0; + } +} + +void MenuBarEditor::paste( int index ) +{ + if ( clipboardItem && clipboardOperation ) { + MenuBarEditorItem * i = new MenuBarEditorItem( clipboardItem ); + AddMenuCommand * cmd = new AddMenuCommand( i18n( "Paste Menu" ), formWnd, this, i, index ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +void MenuBarEditor::exchange( int a, int b ) +{ + MenuBarEditorItem * ia = itemList.at( a ); + MenuBarEditorItem * ib = itemList.at( b ); + if ( !ia || !ib || + ia == &addItem || ia == &addSeparator || + ib == &addItem || ib == &addSeparator ) + return; // do nothing + itemList.replace( b, ia ); + itemList.replace( a, ib ); +} + +void MenuBarEditor::showLineEdit( int index ) +{ + if ( index == -1 ) + index = currentIndex; + + MenuBarEditorItem * i = 0; + + if ( (uint) index >= itemList.count() ) + i = &addItem; + else + i = itemList.at( index ); + + if ( i && i->isSeparator() ) + return; + + // open edit field for item name + lineEdit->setText( i->menuText() ); + lineEdit->selectAll(); + QPoint pos = itemPos( index ); + lineEdit->move( pos.x() + borderSize(), pos.y() - ( borderSize() / 2 ) ); + lineEdit->resize( itemSize( i ) ); + lineEdit->show(); + lineEdit->setFocus(); +} + +void MenuBarEditor::showItem( int index ) +{ + if ( index == -1 ) + index = currentIndex; + + if ( (uint)index < itemList.count() ) { + MenuBarEditorItem * i = itemList.at( index ); + if ( i->isSeparator() || draggedItem ) + return; + PopupMenuEditor * m = i->menu(); + QPoint pos = itemPos( index ); + m->move( pos.x(), pos.y() + itemHeight - 1 ); + m->raise(); + m->show(); + setFocus(); + } +} + +void MenuBarEditor::hideItem( int index ) +{ + if ( index == -1 ) + index = currentIndex; + + if ( (uint)index < itemList.count() ) { + PopupMenuEditor * m = itemList.at( index )->menu(); + m->hideSubMenu(); + m->hide(); + } +} + +void MenuBarEditor::focusItem( int index ) +{ + if ( index == -1 ) + index = currentIndex; + + if ( (uint)index < itemList.count() ) { + PopupMenuEditor * m = itemList.at( index )->menu(); + m->setFocus(); + m->update(); + update(); + } +} + +void MenuBarEditor::deleteItem( int index ) +{ + if ( index == -1 ) + index = currentIndex; + + if ( (uint)index < itemList.count() ) { + RemoveMenuCommand * cmd = new RemoveMenuCommand( i18n( "Delete Menu" ), + formWnd, + this, + currentIndex ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +QSize MenuBarEditor::sizeHint() const +{ + return QSize( parentWidget()->width(), heightForWidth( parentWidget()->width() ) ); +} + +int MenuBarEditor::heightForWidth( int max_width ) const +{ + MenuBarEditor * that = ( MenuBarEditor * ) this; + int x = borderSize(); + int y = 0; + + QPainter p( this ); + that->itemHeight = that->itemSize( &(that->addItem) ).height(); + + MenuBarEditorItem * i = that->itemList.first(); + while ( i ) { + if ( i->isVisible() ) + that->addItemSizeToCoords( i, x, y, max_width ); + i = that->itemList.next(); + } + + that->addItemSizeToCoords( &(that->addItem), x, y, max_width ); + that->addItemSizeToCoords( &(that->addSeparator), x, y, max_width ); + + return y + itemHeight; +} + +void MenuBarEditor::show() +{ + QWidget::show(); + resizeInternals(); + + QResizeEvent e( parentWidget()->size(), parentWidget()->size() ); + QApplication::sendEvent( parentWidget(), &e ); +} + +void MenuBarEditor::checkAccels( QMap &accels ) +{ + QString t; + MenuBarEditorItem * i = itemList.first(); + while ( i ) { + t = i->menuText(); + find_accel( t, accels, this ); + // do not check the accelerators in the popup menus + i = itemList.next(); + } +} + +// public slots + +void MenuBarEditor::cut() +{ + cut( currentIndex ); +} + +void MenuBarEditor::copy() +{ + copy( currentIndex ); +} + +void MenuBarEditor::paste() +{ + paste( currentIndex ); +} + +// protected + +bool MenuBarEditor::eventFilter( QObject * o, QEvent * e ) +{ + if ( o == lineEdit && e->type() == QEvent::FocusOut ) { + leaveEditMode(); + lineEdit->hide(); + update(); + } else if ( e->type() == QEvent::LayoutHint ) { + resize( sizeHint() ); + } + return QMenuBar::eventFilter( o, e ); +} + +void MenuBarEditor::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); + QRect r = rect(); + style().drawPrimitive( QStyle::PE_PanelMenuBar, &p, + r, colorGroup() ); + drawItems( p ); +} + +void MenuBarEditor::mousePressEvent( QMouseEvent * e ) +{ + mousePressPos = e->pos(); + hideItem(); + lineEdit->hide(); + currentIndex = findItem( mousePressPos ); + showItem(); + update(); + e->accept(); +} + +void MenuBarEditor::mouseDoubleClickEvent( QMouseEvent * e ) +{ + mousePressPos = e->pos(); + currentIndex = findItem( mousePressPos ); + lineEdit->hide(); + if ( currentIndex > (int)itemList.count() ) { + insertSeparator(); + update(); + } else { + showLineEdit(); + } +} + +void MenuBarEditor::mouseMoveEvent( QMouseEvent * e ) +{ + if ( e->state() & Qt::LeftButton ) { + if ( ( e->pos() - mousePressPos ).manhattanLength() > 3 ) { + bool itemCreated = FALSE; + bool isSeparator = FALSE; + draggedItem = item( findItem( mousePressPos ) ); + if ( draggedItem == &addItem ) { + draggedItem = createItem(); + itemCreated = TRUE; + } else if ( draggedItem == &addSeparator ) { + if (hasSeparator) // we can only have one separator + return; + draggedItem = createItem(); + draggedItem->setSeparator( TRUE ); + draggedItem->setMenuText( "separator" ); + isSeparator = TRUE; + itemCreated = TRUE; + } else { + isSeparator = draggedItem->isSeparator(); + } + + MenuBarEditorItemPtrDrag * d = + new MenuBarEditorItemPtrDrag( draggedItem, this ); + d->setPixmap( createTextPixmap( draggedItem->menuText() ) ); + hideItem(); + draggedItem->setVisible( FALSE ); + update(); + + // If the item is dropped in the same list, + // we will have two instances of the same pointer + // in the list. + itemList.find( draggedItem ); + QLNode * node = itemList.currentNode(); + dropConfirmed = FALSE; + d->dragCopy(); // dragevents and stuff happens + if ( draggedItem ) { // item was not dropped + if ( itemCreated ) { + removeItem( draggedItem ); + } else { + hideItem(); + draggedItem->setVisible( TRUE ); + draggedItem = 0; + showItem(); + } + } else if ( dropConfirmed ) { // item was dropped + dropConfirmed = FALSE; + hideItem(); + itemList.takeNode( node )->setVisible( TRUE ); + hasSeparator = isSeparator || hasSeparator; + showItem(); + } else { + hasSeparator = isSeparator || hasSeparator; + } + update(); + } + } +} + +void MenuBarEditor::dragEnterEvent( QDragEnterEvent * e ) +{ + if ( MenuBarEditorItemPtrDrag::canDecode( e ) ) { + e->accept(); + dropLine->show(); + } +} + +void MenuBarEditor::dragLeaveEvent( QDragLeaveEvent * ) +{ + dropLine->hide(); +} + +void MenuBarEditor::dragMoveEvent( QDragMoveEvent * e ) +{ + + QPoint pos = e->pos(); + dropLine->move( snapToItem( pos ) ); + + int idx = findItem( pos ); + if ( currentIndex != idx ) { + hideItem(); + currentIndex = idx; + showItem(); + } +} + +void MenuBarEditor::dropEvent( QDropEvent * e ) +{ + MenuBarEditorItem * i = 0; + + if ( MenuBarEditorItemPtrDrag::decode( e, &i ) ) { + draggedItem = 0; + hideItem(); + dropInPlace( i, e->pos() ); + e->accept(); + } + + dropLine->hide(); +} + +void MenuBarEditor::keyPressEvent( QKeyEvent * e ) +{ + if ( lineEdit->isHidden() ) { // In navigation mode + switch ( e->key() ) { + + case Qt::Key_Delete: + hideItem(); + deleteItem(); + showItem(); + break; + + case Qt::Key_Left: + e->accept(); + navigateLeft( e->state() & Qt::ControlButton ); + return; + + case Qt::Key_Right: + e->accept(); + navigateRight( e->state() & Qt::ControlButton ); + return; // no update + + case Qt::Key_Down: + e->accept(); + focusItem(); + return; // no update + + case Qt::Key_PageUp: + currentIndex = 0; + break; + + case Qt::Key_PageDown: + currentIndex = itemList.count(); + break; + + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_F2: + e->accept(); + enterEditMode(); + return; // no update + + case Qt::Key_Up: + case Qt::Key_Alt: + case Qt::Key_Shift: + case Qt::Key_Control: + case Qt::Key_Escape: + e->ignore(); + setFocus(); // FIXME: this is because some other widget get the focus when CTRL is pressed + return; // no update + + case Qt::Key_C: + if ( e->state() & Qt::ControlButton && currentIndex < (int)itemList.count() ) { + copy( currentIndex ); + break; + } + + case Qt::Key_X: + if ( e->state() & Qt::ControlButton && currentIndex < (int)itemList.count() ) { + hideItem(); + cut( currentIndex ); + showItem(); + break; + } + + case Qt::Key_V: + if ( e->state() & Qt::ControlButton ) { + hideItem(); + paste( currentIndex < (int)itemList.count() ? currentIndex + 1: itemList.count() ); + showItem(); + break; + } + + default: + if ( e->ascii() >= 32 || e->ascii() == 0 ) { + showLineEdit(); + QApplication::sendEvent( lineEdit, e ); + e->accept(); + } else { + e->ignore(); + } + return; + } + } else { // In edit mode + + switch ( e->key() ) { + case Qt::Key_Control: + e->ignore(); + return; + case Qt::Key_Enter: + case Qt::Key_Return: + leaveEditMode(); + case Qt::Key_Escape: + lineEdit->hide(); + setFocus(); + break; + } + } + e->accept(); + update(); +} + +void MenuBarEditor::focusOutEvent( QFocusEvent * e ) +{ + QWidget * fw = qApp->focusWidget(); + if ( e->lostFocus() && !::qt_cast(fw) ) + hideItem(); + update(); +} + +void MenuBarEditor::resizeInternals() +{ + dropLine->resize( 2, itemHeight ); + updateGeometry(); +} + +void MenuBarEditor::drawItems( QPainter & p ) +{ + QPoint pos( borderSize(), 0 ); + uint c = 0; + + p.setPen( colorGroup().buttonText() ); + + MenuBarEditorItem * i = itemList.first(); + while ( i ) { + if ( i->isVisible() ) + drawItem( p, i, c++, pos ); // updates x y + i = itemList.next(); + } + + p.setPen( darkBlue ); + drawItem( p, &addItem, c++, pos ); + if ( !hasSeparator ) + drawItem( p, &addSeparator, c, pos ); +} + +void MenuBarEditor::drawItem( QPainter & p, + MenuBarEditorItem * i, + int idx, + QPoint & pos ) +{ + int w = itemSize( i ).width(); + + // If the item passes the right border, and it is not the first item on the line + if ( pos.x() + w > width() && pos.x() > borderSize() ) { // wrap + pos.ry() += itemHeight; + pos.setX( borderSize() ); + } + + if ( i->isSeparator() ) { + drawSeparator( p, pos ); + } else { + int flags = QPainter::AlignLeft | QPainter::AlignVCenter | + Qt::ShowPrefix | Qt::SingleLine; + p.drawText( pos.x() + borderSize(), pos.y(), w - borderSize(), itemHeight, + flags, i->menuText() ); + } + + if ( hasFocus() && idx == currentIndex && !draggedItem ) + p.drawWinFocusRect( pos.x(), pos.y() + 1, w, itemHeight - 2 ); + + pos.rx() += w; +} + +void MenuBarEditor::drawSeparator( QPainter & p, QPoint & pos ) +{ + p.save(); + p.setPen( darkBlue ); + + int left = pos.x(); + int top = pos.y() + 2; + int right = left + separatorWidth - 1; + int bottom = pos.y() + itemHeight - 4; + + p.drawLine( left, top, left, bottom ); + p.drawLine( right, top, right, bottom ); + + p.fillRect( left, pos.y() + borderSize() * 2, + separatorWidth - 1, itemHeight - borderSize() * 4, + QBrush( darkBlue, Qt::Dense5Pattern ) ); + + p.restore(); +} + +QSize MenuBarEditor::itemSize( MenuBarEditorItem * i ) +{ + if ( i->isSeparator() ) + return QSize( separatorWidth, itemHeight ); + QRect r = fontMetrics().boundingRect( i->menuText().remove( "&") ); + return QSize( r.width() + borderSize() * 2, r.height() + borderSize() * 4 ); +} + +void MenuBarEditor::addItemSizeToCoords( MenuBarEditorItem * i, int & x, int & y, int w ) +{ + int dx = itemSize( i ).width(); + if ( x + dx > w && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + x += dx; +} + +QPoint MenuBarEditor::itemPos( int index ) +{ + int x = borderSize(); + int y = 0; + int w = width(); + int dx = 0; + int c = 0; + + MenuBarEditorItem * i = itemList.first(); + + while ( i ) { + if ( i->isVisible() ) { + dx = itemSize( i ).width(); + if ( x + dx > w && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + if ( c == index ) + return QPoint( x, y ); + x += dx; + c++; + } + i = itemList.next(); + } + dx = itemSize( &addItem ).width(); + if ( x + dx > width() && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + + return QPoint( x, y ); +} + +QPoint MenuBarEditor::snapToItem( const QPoint & pos ) +{ + int x = borderSize(); + int y = 0; + int dx = 0; + + MenuBarEditorItem * n = itemList.first(); + + while ( n ) { + if ( n->isVisible() ) { + dx = itemSize( n ).width(); + if ( x + dx > width() && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + if ( pos.y() > y && + pos.y() < y + itemHeight && + pos.x() < x + dx / 2 ) { + return QPoint( x, y ); + } + x += dx; + } + n = itemList.next(); + } + + return QPoint( x, y ); +} + +void MenuBarEditor::dropInPlace( MenuBarEditorItem * i, const QPoint & pos ) +{ + int x = borderSize(); + int y = 0; + int dx = 0; + int idx = 0; + + MenuBarEditorItem * n = itemList.first(); + + while ( n ) { + if ( n->isVisible() ) { + dx = itemSize( n ).width(); + if ( x + dx > width() && x > borderSize() ) { + y += itemHeight; + x = borderSize(); + } + if ( pos.y() > y && + pos.y() < y + itemHeight && + pos.x() < x + dx / 2 ) + break; + x += dx; + } + n = itemList.next(); + idx++; + } + + hideItem(); + Command * cmd = 0; + int iidx = itemList.findRef( i ); + if ( iidx != -1 ) { // internal dnd + cmd = new MoveMenuCommand( i18n( "Item Dragged" ), formWnd, this, iidx, idx ); + item( iidx )->setVisible( TRUE ); + } else { + cmd = new AddMenuCommand( i18n( "Add Menu" ), formWnd, this, i, idx ); + dropConfirmed = TRUE; // let mouseMoveEvent set the item visible + } + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + currentIndex = ( iidx >= 0 && iidx < idx ) ? idx - 1 : idx; + showItem(); +} + + +void MenuBarEditor::safeDec() +{ + do { + currentIndex--; + } while ( currentIndex > 0 && !( item( currentIndex )->isVisible() ) ); +} + +void MenuBarEditor::safeInc() +{ + int max = (int)itemList.count(); + if ( !hasSeparator ) + max += 1; + if ( currentIndex < max ) { + do { + currentIndex++; + // skip invisible items + } while ( currentIndex < max && !( item( currentIndex )->isVisible() ) ); + } +} + +void MenuBarEditor::navigateLeft( bool ctrl ) +{ + // FIXME: handle invisible items + if ( currentIndex > 0 ) { + hideItem(); + if ( ctrl ) { + ExchangeMenuCommand * cmd = new ExchangeMenuCommand( i18n( "Move Menu Left" ), + formWnd, + this, + currentIndex, + currentIndex - 1 ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + safeDec(); + } else { + safeDec(); + } + showItem(); + } + update(); +} + +void MenuBarEditor::navigateRight( bool ctrl ) +{ +// FIXME: handle invisible items + hideItem(); + if ( ctrl ) { + if ( currentIndex < ( (int)itemList.count() - 1 ) ) { + ExchangeMenuCommand * cmd = new ExchangeMenuCommand( i18n( "Move Menu Right" ), + formWnd, + this, + currentIndex, + currentIndex + 1 ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + safeInc(); + } + } else { + safeInc(); + } + showItem(); + update(); +} + +void MenuBarEditor::enterEditMode() +{ + if ( currentIndex > (int)itemList.count() ) { + insertSeparator(); + } else { + showLineEdit(); + } +} + +void MenuBarEditor::leaveEditMode() +{ + MenuBarEditorItem * i = 0; + if ( currentIndex >= (int)itemList.count() ) { + i = createItem(); + // do not put rename on cmd stack + RenameMenuCommand rename( i18n( "Rename Menu" ), formWnd, this, lineEdit->text(), i ); + rename.execute(); + } else { + i = itemList.at( currentIndex ); + RenameMenuCommand * cmd = + new RenameMenuCommand( i18n( "Rename Menu" ), formWnd, this, lineEdit->text(), i ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + showItem(); +} + +QPixmap MenuBarEditor::createTextPixmap( const QString &text ) +{ + QSize sz( fontMetrics().boundingRect( text ).size() ); + QPixmap pix( sz.width() + 20, sz.height() * 2 ); + pix.fill( white ); + QPainter p( &pix, this ); + p.drawText( 2, 0, pix.width(), pix.height(), 0, text ); + p.end(); + QBitmap bm( pix.size() ); + bm.fill( color0 ); + p.begin( &bm ); + p.setPen( color1 ); + p.drawText( 2, 0, pix.width(), pix.height(), 0, text ); + p.end(); + pix.setMask( bm ); + return pix; +} diff --git a/kdevdesigner/designer/menubareditor.h b/kdevdesigner/designer/menubareditor.h new file mode 100644 index 00000000..c8dc2b63 --- /dev/null +++ b/kdevdesigner/designer/menubareditor.h @@ -0,0 +1,198 @@ +/********************************************************************** +** Copyright (C) 2003 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef MENUBAREDITOR_H +#define MENUBAREDITOR_H + +#include +#include + +class PopupMenuEditor; +class MenuBarEditor; +class QActionGroup; + +class MenuBarEditorItem : public QObject +{ + Q_OBJECT + + friend class MenuBarEditor; + + MenuBarEditorItem( MenuBarEditor * bar = 0, QObject * parent = 0, const char * name = 0 ); + +public: + MenuBarEditorItem( PopupMenuEditor * menu, MenuBarEditor * bar, + QObject * parent = 0, const char * name = 0); + MenuBarEditorItem( QActionGroup * actionGroup, MenuBarEditor * bar, + QObject * parent = 0, const char * name = 0); + MenuBarEditorItem( MenuBarEditorItem * item, + QObject * parent = 0, const char * name = 0); + ~MenuBarEditorItem() { }; + + PopupMenuEditor * menu() { return popupMenu; } + + void setMenuText( const QString t ) { text = t; }; + QString menuText() { return text; } + + void setVisible( bool enable ) { visible = enable; } + bool isVisible() { return visible; } + + void setRemovable( bool enable ) { removable = enable; } + bool isRemovable() { return removable; } + + bool isSeparator() { return separator; } +protected: + void setSeparator( bool enable ) { separator = enable; } + +private: + MenuBarEditor * menuBar; + PopupMenuEditor * popupMenu; + QString text; + uint visible : 1; + uint separator : 1; + uint removable : 1; +}; + +class QLineEdit; +class FormWindow; + +class MenuBarEditor : public QMenuBar +{ + Q_OBJECT + +public: + MenuBarEditor( FormWindow * fw, QWidget * parent = 0, const char * name = 0 ); + ~MenuBarEditor(); + + FormWindow * formWindow(); + + MenuBarEditorItem * createItem( int index = -1, bool addToCmdStack = TRUE ); + void insertItem( MenuBarEditorItem * item, int index = -1 ); + void insertItem( QString text, PopupMenuEditor * menu, int index = -1 ); + void insertItem( QString text, QActionGroup * group, int index = -1 ); + + void insertSeparator( int index = -1 ); + + void removeItemAt( int index ); + void removeItem( MenuBarEditorItem * item ); + + int findItem( MenuBarEditorItem * item ); + int findItem( PopupMenuEditor * menu ); + int findItem( QPoint & pos ); + + MenuBarEditorItem * item( int index = -1 ); + + int count(); + int current(); + + void cut( int index ); + void copy( int index ); + void paste( int index ); + void exchange( int a, int b ); + + void showLineEdit( int index = -1); + void showItem( int index = -1 ); + void hideItem( int index = -1 ); + void focusItem( int index = -1 ); + void deleteItem( int index = -1 ); + + QSize sizeHint() const; + QSize minimumSize() const { return sizeHint(); } + QSize minimumSizeHint() const { return sizeHint(); } + int heightForWidth( int max_width ) const; + + void show(); + + void checkAccels( QMap &accels ); + +public slots: + void cut(); + void copy(); + void paste(); + +protected: + bool eventFilter( QObject * o, QEvent * e ); + void paintEvent( QPaintEvent * e ); + void mousePressEvent( QMouseEvent * e ); + void mouseDoubleClickEvent( QMouseEvent * e ); + void mouseMoveEvent( QMouseEvent * e ); + void dragEnterEvent( QDragEnterEvent * e ); + void dragLeaveEvent( QDragLeaveEvent * e ); + void dragMoveEvent( QDragMoveEvent * e ); + void dropEvent( QDropEvent * e ); + void keyPressEvent( QKeyEvent * e ); + void focusOutEvent( QFocusEvent * e ); + void resizeEvent( QResizeEvent * e ) { QFrame::resizeEvent( e ); } + + void resizeInternals(); + + void drawItems( QPainter & p ); + void drawItem( QPainter & p, MenuBarEditorItem * i, int idx, QPoint & pos ); + void drawSeparator( QPainter & p, QPoint & pos ); + + QSize itemSize( MenuBarEditorItem * i ); + void addItemSizeToCoords( MenuBarEditorItem * i, int & x, int & y, int w ); + + QPoint itemPos( int index ); + QPoint snapToItem( const QPoint & pos ); + void dropInPlace( MenuBarEditorItem * i, const QPoint & pos ); + + void safeDec(); + void safeInc(); + + void navigateLeft( bool ctrl ); + void navigateRight( bool ctrl ); + void enterEditMode(); + void leaveEditMode(); + + QPixmap createTextPixmap( const QString &text ); + int borderSize() const { return margin() + 4; } // add 4 pixels to the margin + +private: + FormWindow * formWnd; + QLineEdit * lineEdit; + QWidget * dropLine; + QPtrList itemList; + MenuBarEditorItem addItem; + MenuBarEditorItem addSeparator; + MenuBarEditorItem * draggedItem; + QPoint mousePressPos; + int currentIndex; + int itemHeight; + int separatorWidth; + bool hideWhenEmpty; + bool hasSeparator; + bool dropConfirmed; + + enum ClipboardOperation { + None = 0, + Cut = 1, + Copy = 2 + }; + static int clipboardOperation; + static MenuBarEditorItem * clipboardItem; +}; + +#endif //MENUBAREDITOR_H diff --git a/kdevdesigner/designer/metadatabase.cpp b/kdevdesigner/designer/metadatabase.cpp new file mode 100644 index 00000000..3a97b680 --- /dev/null +++ b/kdevdesigner/designer/metadatabase.cpp @@ -0,0 +1,1692 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "metadatabase.h" +#include "widgetfactory.h" +#include "formwindow.h" +#include "parser.h" +#include "widgetdatabase.h" +#include "formfile.h" +#include "propertyobject.h" +#include "project.h" +#include "mainwindow.h" + +#include "kdevdesigner_part.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class MetaDataBaseRecord +{ +public: + QObject *object; + QStringList changedProperties; + QMap fakeProperties; + QMap propertyComments; + int spacing, margin; + QString resizeMode; + QValueList connections; + QValueList functionList; + QValueList includes; + QValueList variables; + QStringList forwards, sigs; + QWidgetList tabOrder; + MetaDataBase::MetaInfo metaInfo; + QCursor cursor; + QMap pixmapArguments; + QMap pixmapKeys; + QMap columnFields; + QValueList breakPoints; + QMap breakPointConditions; + QString exportMacro; +}; + +static QPtrDict *db = 0; +static QPtrList *cWidgets = 0; +static bool doUpdate = TRUE; +static QStringList langList; +static QStringList editorLangList; +static QPluginManager *languageInterfaceManager = 0; + +/*! + \class MetaDataBase metadatabase.h + \brief Database which stores meta data of widgets + + The MetaDataBase stores meta information of widgets, which are not + stored directly in widgets (properties). This is e.g. the + information which properties have been modified. +*/ + +MetaDataBase::MetaDataBase() +{ +} + +inline void setupDataBase() +{ + if ( !db || !cWidgets ) { + db = new QPtrDict( 1481 ); + db->setAutoDelete( TRUE ); + cWidgets = new QPtrList; + cWidgets->setAutoDelete( TRUE ); + } +} + +void MetaDataBase::clearDataBase() +{ + delete db; + db = 0; + delete cWidgets; + cWidgets = 0; +} + +void MetaDataBase::addEntry( QObject *o ) +{ + if ( !o ) + return; + setupDataBase(); + if ( db->find( o ) ) + return; + MetaDataBaseRecord *r = new MetaDataBaseRecord; + r->object = o; + r->spacing = r->margin = -1; + db->insert( (void*)o, r ); + + WidgetFactory::initChangedProperties( o ); +} + +void MetaDataBase::removeEntry( QObject *o ) +{ + setupDataBase(); + db->remove( o ); +} + +void MetaDataBase::setPropertyChanged( QObject *o, const QString &property, bool changed ) +{ + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) { + ( (PropertyObject*)o )->mdPropertyChanged( property, changed ); + return; + } + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + if ( changed ) { + if ( r->changedProperties.findIndex( property ) == -1 ) + r->changedProperties.append( property ); + } else { + if ( r->changedProperties.findIndex( property ) != -1 ) + r->changedProperties.remove( property ); + } + + if ( doUpdate && + ( property == "hAlign" || property == "vAlign" || property == "wordwrap" ) ) { + doUpdate = FALSE; + setPropertyChanged( o, "alignment", changed || + isPropertyChanged( o, "hAlign" ) || + isPropertyChanged( o, "vAlign" ) || + isPropertyChanged( o, "wordwrap" ) ); + doUpdate = TRUE; + } + + if ( doUpdate && property == "alignment" ) { + doUpdate = FALSE; + setPropertyChanged( o, "hAlign", changed ); + setPropertyChanged( o, "vAlign", changed ); + setPropertyChanged( o, "wordwrap", changed ); + doUpdate = TRUE; + } +} + +bool MetaDataBase::isPropertyChanged( QObject *o, const QString &property ) +{ + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) + return ( (PropertyObject*)o )->mdIsPropertyChanged( property ); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return FALSE; + } + + return r->changedProperties.findIndex( property ) != -1; +} + +QStringList MetaDataBase::changedProperties( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QStringList(); + } + + QStringList lst( r->changedProperties ); + return lst; +} + +void MetaDataBase::setPropertyComment( QObject *o, const QString &property, const QString &comment ) +{ + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) { + ( (PropertyObject*)o )->mdSetPropertyComment( property, comment ); + return; + } + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->propertyComments.insert( property, comment ); +} + +QString MetaDataBase::propertyComment( QObject *o, const QString &property ) +{ + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) + return ( (PropertyObject*)o )->mdPropertyComment( property ); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QString::null; + } + + return *r->propertyComments.find( property ); +} + +void MetaDataBase::setFakeProperty( QObject *o, const QString &property, const QVariant& value ) +{ + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) { + ( (PropertyObject*)o )->mdSetFakeProperty( property, value ); + return; + } + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + r->fakeProperties[property] = value; +} + +QVariant MetaDataBase::fakeProperty( QObject * o, const QString &property) +{ + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) + return ( (PropertyObject*)o )->mdFakeProperty( property ); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QVariant(); + } + QMap::Iterator it = r->fakeProperties.find( property ); + if ( it != r->fakeProperties.end() ) + return r->fakeProperties[property]; + return WidgetFactory::defaultValue( o, property ); + +} + +QMap* MetaDataBase::fakeProperties( QObject* o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return 0; + } + return &r->fakeProperties; +} + +void MetaDataBase::setSpacing( QObject *o, int spacing ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r || !o->isWidgetType() ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->spacing = spacing; + QLayout * layout = 0; + WidgetFactory::layoutType( (QWidget*)o, layout ); + if ( layout ) { + int spadef = 6; + if ( MainWindow::self->formWindow() ) + spadef = MainWindow::self->formWindow()->layoutDefaultSpacing(); + if ( spacing == -1 ) + layout->setSpacing( spadef ); + else + layout->setSpacing( spacing ); + } +} + +int MetaDataBase::spacing( QObject *o ) +{ + if ( !o ) + return -1; + setupDataBase(); + if ( ::qt_cast(o) ) + o = ( (QMainWindow*)o )->centralWidget(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r || !o->isWidgetType() ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return -1; + } + + return r->spacing; +} + +void MetaDataBase::setMargin( QObject *o, int margin ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r || !o->isWidgetType() ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->margin = margin; + QLayout * layout = 0; + WidgetFactory::layoutType( (QWidget*)o, layout ); + + bool isInnerLayout = TRUE; + + QWidget *widget = (QWidget*)o; + if ( widget && !::qt_cast(widget) && + ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( widget ) ) ) || + widget && widget->parentWidget() && ::qt_cast(widget->parentWidget()) ) ) + isInnerLayout = FALSE; + + + if ( layout ) { + int mardef = 11; + if ( MainWindow::self->formWindow() ) + mardef = MainWindow::self->formWindow()->layoutDefaultMargin(); + if ( margin == -1 ) { + if ( isInnerLayout ) + layout->setMargin( 1 ); + else + layout->setMargin( QMAX( 1, mardef ) ); + } + else + layout->setMargin( QMAX( 1, margin ) ); + } +} + +int MetaDataBase::margin( QObject *o ) +{ + if ( !o ) + return -1; + setupDataBase(); + if ( ::qt_cast(o) ) + o = ( (QMainWindow*)o )->centralWidget(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r || !o->isWidgetType() ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return -1; + } + return r->margin; +} + +void MetaDataBase::setResizeMode( QObject *o, const QString &mode ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r || !o->isWidgetType() ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->resizeMode = mode; +} + +QString MetaDataBase::resizeMode( QObject *o ) +{ + if ( !o ) + return QString::null; + setupDataBase(); + if ( ::qt_cast(o) ) + o = ( (QMainWindow*)o )->centralWidget(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r || !o->isWidgetType() ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QString::null; + } + return r->resizeMode; +} + +void MetaDataBase::addConnection( QObject *o, QObject *sender, const QCString &signal, + QObject *receiver, const QCString &slot, bool addCode ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + if ( !(sender && receiver) ) + return; + Connection conn; + conn.sender = sender; + conn.signal = signal; + conn.receiver = receiver; + conn.slot = slot; + r->connections.append( conn ); + if ( addCode ) { + QString rec = receiver->name(); + if ( ::qt_cast(o) && receiver == ( (FormWindow*)o )->mainContainer() ) + rec = "this"; + QString sen = sender->name(); + if ( ::qt_cast(o) && sender == ( (FormWindow*)o )->mainContainer() ) + sen = "this"; + FormFile *ff = 0; + if ( ::qt_cast(o) ) + ff = (FormFile*)o; + else if ( ::qt_cast(o) ) + ff = ( (FormWindow*)o )->formFile(); + ff->addConnection( sen, signal, rec, slot ); + } +} + +void MetaDataBase::removeConnection( QObject *o, QObject *sender, const QCString &signal, + QObject *receiver, const QCString &slot ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + if ( !(sender && receiver) ) + return; + for ( QValueList::Iterator it = r->connections.begin(); it != r->connections.end(); ++it ) { + Connection conn = *it; + if ( conn.sender == sender && + conn.signal == signal && + conn.receiver == receiver && + conn.slot == slot ) { + r->connections.remove( it ); + break; + } + } + if ( ::qt_cast(o) ) { + QString rec = receiver->name(); + if ( receiver == ( (FormWindow*)o )->mainContainer() ) + rec = "this"; + ( (FormWindow*)o )->formFile()->removeConnection( sender->name(), signal, rec, slot ); + } +} + +void MetaDataBase::setupConnections( QObject *o, const QValueList &conns ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + if ( !::qt_cast(o) ) + return; + + FormFile *formfile = (FormFile*)o; + + r->connections.clear(); + + for ( QValueList::ConstIterator cit = conns.begin(); + cit != conns.end(); ++cit ) { + // #### get the correct sender object out of Bla.Blub.sender + QString senderName = (*cit).sender; + if ( senderName.find( '.' ) != -1 ) + senderName = senderName.mid( senderName.findRev( '.' ) + 1 ); + QObject *sender = 0; + if ( formfile->formWindow() ) + sender = formfile->formWindow()->child( senderName ); + if ( !sender && formfile->isFake() ) + sender = formfile->project()->objectForFakeFormFile( formfile ); + if ( !sender && senderName == "this" ) + sender = formfile->formWindow() ? + formfile->formWindow()->mainContainer() : + formfile->project()->objectForFakeFormFile( formfile ); + if ( !sender ) + continue; + MetaDataBase::addConnection( formfile->formWindow() ? + (QObject*)formfile->formWindow() : + (QObject*)formfile, + sender, + (*cit).signal.latin1(), + formfile->formWindow() ? + formfile->formWindow()->mainContainer() : + formfile->project()->objectForFakeFormFile( formfile ), + (*cit).slot.latin1(), + FALSE ); + } +} + +bool MetaDataBase::hasConnection( QObject *o, QObject *sender, const QCString &signal, + QObject *receiver, const QCString &slot ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return FALSE; + } + + for ( QValueList::Iterator it = r->connections.begin(); it != r->connections.end(); ++it ) { + Connection conn = *it; + if ( conn.sender == sender && + conn.signal == signal && + conn.receiver == receiver && + conn.slot == slot ) + return TRUE; + } + return FALSE; +} + + +QValueList MetaDataBase::connections( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + return r->connections; +} + +QValueList MetaDataBase::connections( QObject *o, QObject *sender, + QObject *receiver ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + QValueList::Iterator it = r->connections.begin(); + QValueList ret; + QValueList::Iterator conn; + while ( ( conn = it ) != r->connections.end() ) { + ++it; + if ( (*conn).sender == sender && + (*conn).receiver == receiver ) + ret << *conn; + } + + return ret; +} + +QValueList MetaDataBase::connections( QObject *o, QObject *object ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + QValueList::Iterator it = r->connections.begin(); + QValueList ret; + QValueList::Iterator conn; + while ( ( conn = it ) != r->connections.end() ) { + ++it; + if ( (*conn).sender == object || + (*conn).receiver == object ) + ret << *conn; + } + return ret; +} + +void MetaDataBase::doConnections( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + QObject *sender = 0, *receiver = 0; + QObjectList *l = 0; + QValueList::Iterator it = r->connections.begin(); + for ( ; it != r->connections.end(); ++it ) { + Connection conn = *it; + if ( qstrcmp( conn.sender->name(), o->name() ) == 0 ) { + sender = o; + } else { + l = o->queryList( 0, conn.sender->name(), FALSE ); + if ( !l || !l->first() ) { + delete l; + continue; + } + sender = l->first(); + delete l; + } + if ( qstrcmp( conn.receiver->name(), o->name() ) == 0 ) { + receiver = o; + } else { + l = o->queryList( 0, conn.receiver->name(), FALSE ); + if ( !l || !l->first() ) { + delete l; + continue; + } + receiver = l->first(); + delete l; + } + QString s = "2""%1"; + s = s.arg( conn.signal ); + QString s2 = "1""%1"; + s2 = s2.arg( conn.slot ); + + QStrList signalList = sender->metaObject()->signalNames( TRUE ); + QStrList slotList = receiver->metaObject()->slotNames( TRUE ); + + // avoid warnings + if ( signalList.find( conn.signal ) == -1 || + slotList.find( conn.slot ) == -1 ) + continue; + + QObject::connect( sender, s, receiver, s2 ); + } +} + +bool MetaDataBase::hasSlot( QObject *o, const QCString &slot, bool onlyCustom ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return FALSE; + } + + if ( !onlyCustom ) { + QStrList slotList = o->metaObject()->slotNames( TRUE ); + if ( slotList.find( slot ) != -1 ) + return TRUE; + + if ( ::qt_cast(o) ) { + o = ( (FormWindow*)o )->mainContainer(); + slotList = o->metaObject()->slotNames( TRUE ); + if ( slotList.find( slot ) != -1 ) + return TRUE; + } + + //if ( ::qt_cast(o) ) { + if ( o->inherits( "CustomWidget" ) ) { + MetaDataBase::CustomWidget *w = ( (::CustomWidget*)o )->customWidget(); + for ( QValueList::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) { + QCString s = (*it).function; + if ( !s.data() ) + continue; + if ( s == slot ) + return TRUE; + } + } + } + + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + Function f = *it; + if ( normalizeFunction( f.function ) == normalizeFunction( slot ) && f.type == "slot" ) + return TRUE; + } + + return FALSE; +} + +bool MetaDataBase::isSlotUsed( QObject *o, const QCString &slot ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return FALSE; + } + + QValueList conns = connections( o ); + for ( QValueList::Iterator it = conns.begin(); it != conns.end(); ++it ) { + if ( (*it).slot == slot ) + return TRUE; + } + return FALSE; +} + + +void MetaDataBase::addFunction( QObject *o, const QCString &function, const QString &specifier, + const QString &access, const QString &type, const QString &language, + const QString &returnType ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + Function f; + f.function = function; + f.specifier = specifier; + f.access = access; + f.type = type; + f.language = language; + f.returnType = returnType; + QValueList::Iterator it = r->functionList.find( f ); + if ( it != r->functionList.end() ) + r->functionList.remove( it ); + r->functionList.append( f ); + ( (FormWindow*)o )->formFile()->addFunctionCode( f ); +} + +void MetaDataBase::setFunctionList( QObject *o, const QValueList &functionList ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + r->functionList = functionList; +} + +void MetaDataBase::removeFunction( QObject *o, const QCString &function, const QString &specifier, + const QString &access, const QString &type, const QString &language, + const QString &returnType ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + if ( MetaDataBase::normalizeFunction( (*it).function ) == + MetaDataBase::normalizeFunction( function ) && + (*it).specifier == specifier && + (*it).access == access && + (*it).type == type && + ( language.isEmpty() || (*it).language == language ) && + ( returnType.isEmpty() || (*it).returnType == returnType ) ) { + ( (FormWindow*)o )->formFile()->removeFunctionCode( *it ); + r->functionList.remove( it ); + break; + } + } +} + +void MetaDataBase::removeFunction( QObject *o, const QString &function ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + if ( normalizeFunction( (*it).function ) == normalizeFunction( function ) ) { + ( (FormWindow*)o )->formFile()->removeFunctionCode( *it ); + r->functionList.remove( it ); + break; + } + } +} + +QValueList MetaDataBase::functionList( QObject *o, bool onlyFunctions ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + if ( !onlyFunctions ) + return r->functionList; + QValueList fList; + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + if ( (*it).type == "function" ) + fList.append( *it ); + } + return fList; +} + +QValueList MetaDataBase::slotList( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + QValueList slotList; + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + if ( (*it).type == "slot" ) + slotList.append( *it ); + } + return slotList; +} + +void MetaDataBase::changeFunction( QObject *o, const QString &function, const QString &newName, + const QString &returnType ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + Function f = *it; + if ( normalizeFunction( f.function ) == normalizeFunction( function ) ) { + (*it).function = newName; + if ( !returnType.isNull() ) + (*it).returnType = returnType; + return; + } + } +} + +void MetaDataBase::changeFunctionAttributes( QObject *o, const QString &oldName, const QString &newName, + const QString &specifier, const QString &access, + const QString &type, const QString &language, + const QString &returnType ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + Function f = *it; + if ( normalizeFunction( f.function ) == normalizeFunction( oldName ) ) { + (*it).function = newName; + (*it).specifier = specifier; + (*it).access = access; + (*it).type = type; + (*it).language = language; + (*it).returnType = returnType; + return; + } + } +} + +bool MetaDataBase::hasFunction( QObject *o, const QCString &function, bool onlyCustom ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return FALSE; + } + + if ( !onlyCustom ) { + QStrList functionList = o->metaObject()->slotNames( TRUE ); + if ( functionList.find( function ) != -1 ) + return TRUE; + + if ( ::qt_cast(o) ) { + o = ( (FormWindow*)o )->mainContainer(); + functionList = o->metaObject()->slotNames( TRUE ); + if ( functionList.find( function ) != -1 ) + return TRUE; + } + + //if ( ::qt_cast(o) ) { + if ( o->inherits( "CustomWidget" ) ) { + MetaDataBase::CustomWidget *w = ( (::CustomWidget*)o )->customWidget(); + for ( QValueList::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) { + QCString s = (*it).function; + if ( !s.data() ) + continue; + if ( s == function ) + return TRUE; + } + } + } + + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + Function f = *it; + if ( normalizeFunction( f.function ) == normalizeFunction( function ) ) + return TRUE; + } + + return FALSE; +} + +QString MetaDataBase::languageOfFunction( QObject *o, const QCString &function ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QString::null; + } + + QString fu = normalizeFunction( function ); + for ( QValueList::Iterator it = r->functionList.begin(); it != r->functionList.end(); ++it ) { + if ( fu == normalizeFunction( (*it).function ) ) + return (*it).language; + } + return QString::null; +} + +bool MetaDataBase::addCustomWidget( CustomWidget *wid ) +{ + setupDataBase(); + + for ( CustomWidget *w = cWidgets->first(); w; w = cWidgets->next() ) { + if ( *wid == *w ) { + for ( QValueList::ConstIterator it = wid->lstSignals.begin(); it != wid->lstSignals.end(); ++it ) { + if ( !w->hasSignal( *it ) ) + w->lstSignals.append( *it ); + } + for ( QValueList::ConstIterator it2 = wid->lstSlots.begin(); it2 != wid->lstSlots.end(); ++it2 ) { + if ( !w->hasSlot( MetaDataBase::normalizeFunction( (*it2).function ).latin1() ) ) + w->lstSlots.append( *it2 ); + } + for ( QValueList::ConstIterator it3 = wid->lstProperties.begin(); it3 != wid->lstProperties.end(); ++it3 ) { + if ( !w->hasProperty( (*it3).property ) ) + w->lstProperties.append( *it3 ); + } + delete wid; + return FALSE; + } + } + + + WidgetDatabaseRecord *r = new WidgetDatabaseRecord; + r->name = wid->className; + r->group = WidgetDatabase::widgetGroup( "Custom" ); + r->toolTip = wid->className; + r->icon = new QIconSet( *wid->pixmap, *wid->pixmap ); + r->isContainer = wid->isContainer; + wid->id = WidgetDatabase::addCustomWidget( r ); + cWidgets->append( wid ); + return TRUE; +} + +void MetaDataBase::removeCustomWidget( CustomWidget *w ) +{ + cWidgets->removeRef( w ); +} + +QPtrList *MetaDataBase::customWidgets() +{ + setupDataBase(); + return cWidgets; +} + +MetaDataBase::CustomWidget *MetaDataBase::customWidget( int id ) +{ + for ( CustomWidget *w = cWidgets->first(); w; w = cWidgets->next() ) { + if ( id == w->id ) + return w; + } + return 0; +} + +bool MetaDataBase::isWidgetNameUsed( CustomWidget *wid ) +{ + for ( CustomWidget *w = cWidgets->first(); w; w = cWidgets->next() ) { + if ( w == wid ) + continue; + if ( wid->className == w->className ) + return TRUE; + } + return FALSE; +} + +bool MetaDataBase::hasCustomWidget( const QString &className ) +{ + for ( CustomWidget *w = cWidgets->first(); w; w = cWidgets->next() ) { + if ( w->className == className ) + return TRUE; + } + return FALSE; +} + +void MetaDataBase::setTabOrder( QWidget *w, const QWidgetList &order ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*) w ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + w, w->name(), w->className() ); + return; + } + + r->tabOrder = order; +} + +QWidgetList MetaDataBase::tabOrder( QWidget *w ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*) w ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + w, w->name(), w->className() ); + return QWidgetList(); + } + + return r->tabOrder; +} + +void MetaDataBase::setIncludes( QObject *o, const QValueList &incs ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->includes = incs; +} + +QValueList MetaDataBase::includes( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + + return r->includes; +} + +void MetaDataBase::setForwards( QObject *o, const QStringList &fwds ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->forwards = fwds; +} + +QStringList MetaDataBase::forwards( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QStringList(); + } + + return r->forwards; +} + +void MetaDataBase::setVariables( QObject *o, const QValueList &vars ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->variables = vars; +} + +void MetaDataBase::addVariable( QObject *o, const QString &name, const QString &access ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + Variable v; + v.varName = name; + v.varAccess = access; + r->variables << v; +} + +void MetaDataBase::removeVariable( QObject *o, const QString &name ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + QValueList::Iterator it = r->variables.begin(); + for ( ; it != r->variables.end(); ++it ) { + if ( (*it).varName == name ) { + r->variables.remove( it ); + break; + } + } +} + +QValueList MetaDataBase::variables( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + + return r->variables; +} + +bool MetaDataBase::hasVariable( QObject *o, const QString &name ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return FALSE; + } + + QValueList::Iterator it = r->variables.begin(); + for ( ; it != r->variables.end(); ++it ) { + if ( extractVariableName( name ) == extractVariableName( (*it).varName ) ) + return TRUE; + } + return FALSE; +} + +QString MetaDataBase::extractVariableName( const QString &name ) +{ + QString n = name.right( name.length() - name.findRev( ' ' ) - 1 ); + if ( n[ 0 ] == '*' || n[ 0 ] == '&' ) + n[ 0 ] = ' '; + if ( n[ (int)n.length() - 1 ] == ';' ) + n[ (int)n.length() - 1 ] = ' '; + return n.simplifyWhiteSpace(); +} + +void MetaDataBase::setSignalList( QObject *o, const QStringList &sigs ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->sigs.clear(); + + for ( QStringList::ConstIterator it = sigs.begin(); it != sigs.end(); ++it ) { + QString s = (*it).simplifyWhiteSpace(); + bool hasSemicolon = s.endsWith( ";" ); + if ( hasSemicolon ) + s = s.left( s.length() - 1 ); + int p = s.find( '(' ); + if ( p < 0 ) + p = s.length(); + int sp = s.find( ' ' ); + if ( sp >= 0 && sp < p ) { + s = s.mid( sp+1 ); + p -= sp + 1; + } + if ( p == (int) s.length() ) + s += "()"; + if ( hasSemicolon ) + s += ";"; + r->sigs << s; + } +} + +QStringList MetaDataBase::signalList( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QStringList(); + } + + return r->sigs; +} + +void MetaDataBase::setMetaInfo( QObject *o, MetaInfo mi ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->metaInfo = mi; +} + +MetaDataBase::MetaInfo MetaDataBase::metaInfo( QObject *o ) +{ + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return MetaInfo(); + } + + return r->metaInfo; +} + + + + +MetaDataBase::CustomWidget::CustomWidget() +{ + className = "MyCustomWidget"; + includeFile = "mywidget.h"; + includePolicy = Local; + sizeHint = QSize( -1, -1 ); + pixmap = new QPixmap( BarIcon( "designer_customwidget.png", KDevDesignerPartFactory::instance() ) ); + id = -1; + sizePolicy = QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + isContainer = FALSE; +} + +MetaDataBase::CustomWidget::CustomWidget( const CustomWidget &w ) +{ + className = w.className; + includeFile = w.includeFile; + includePolicy = w.includePolicy; + sizeHint = w.sizeHint; + if ( w.pixmap ) + pixmap = new QPixmap( *w.pixmap ); + else + pixmap = 0; + id = w.id; + isContainer = w.isContainer; +} + +void MetaDataBase::setCursor( QWidget *w, const QCursor &c ) +{ + setupDataBase(); + if ( w->isA( "PropertyObject" ) ) { + ( (PropertyObject*)w )->mdSetCursor( c ); + return; + } + MetaDataBaseRecord *r = db->find( (void*)w ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + w, w->name(), w->className() ); + return; + } + + r->cursor = c; +} + +QCursor MetaDataBase::cursor( QWidget *w ) +{ + setupDataBase(); + if ( w->isA( "PropertyObject" ) ) + return ( (PropertyObject*)w )->mdCursor(); + MetaDataBaseRecord *r = db->find( (void*)w ); + if ( !r ) { + w->unsetCursor(); + return w->cursor(); + } + + return r->cursor; +} + +bool MetaDataBase::CustomWidget::operator==( const CustomWidget &w ) const +{ + return className == w.className; +} + +MetaDataBase::CustomWidget &MetaDataBase::CustomWidget::operator=( const CustomWidget &w ) +{ + delete pixmap; + className = w.className; + includeFile = w.includeFile; + includePolicy = w.includePolicy; + sizeHint = w.sizeHint; + if ( w.pixmap ) + pixmap = new QPixmap( *w.pixmap ); + else + pixmap = 0; + lstSignals = w.lstSignals; + lstSlots = w.lstSlots; + lstProperties = w.lstProperties; + id = w.id; + isContainer = w.isContainer; + return *this; +} + +bool MetaDataBase::CustomWidget::hasSignal( const QCString &signal ) const +{ + QStrList sigList = QWidget::staticMetaObject()->signalNames( TRUE ); + if ( sigList.find( signal ) != -1 ) + return TRUE; + for ( QValueList::ConstIterator it = lstSignals.begin(); it != lstSignals.end(); ++it ) { + if ( normalizeFunction( *it ) == normalizeFunction( signal ) ) + return TRUE; + } + return FALSE; +} + +bool MetaDataBase::CustomWidget::hasSlot( const QCString &slot ) const +{ + QStrList slotList = QWidget::staticMetaObject()->slotNames( TRUE ); + if ( slotList.find( normalizeFunction( slot ) ) != -1 ) + return TRUE; + + for ( QValueList::ConstIterator it = lstSlots.begin(); it != lstSlots.end(); ++it ) { + if ( normalizeFunction( (*it).function ) == normalizeFunction( slot ) ) + return TRUE; + } + return FALSE; +} + +bool MetaDataBase::CustomWidget::hasProperty( const QCString &prop ) const +{ + QStrList propList = QWidget::staticMetaObject()->propertyNames( TRUE ); + if ( propList.find( prop ) != -1 ) + return TRUE; + + for ( QValueList::ConstIterator it = lstProperties.begin(); it != lstProperties.end(); ++it ) { + if ( (*it).property == prop ) + return TRUE; + } + return FALSE; +} + +void MetaDataBase::setPixmapArgument( QObject *o, int pixmap, const QString &arg ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->pixmapArguments.remove( pixmap ); + r->pixmapArguments.insert( pixmap, arg ); +} + +QString MetaDataBase::pixmapArgument( QObject *o, int pixmap ) +{ + if ( !o ) + return QString::null; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QString::null; + } + + return *r->pixmapArguments.find( pixmap ); +} + +void MetaDataBase::clearPixmapArguments( QObject *o ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->pixmapArguments.clear(); +} + + +void MetaDataBase::setPixmapKey( QObject *o, int pixmap, const QString &arg ) +{ + if ( !o ) + return; + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) { + ( (PropertyObject*)o )->mdSetPixmapKey( pixmap, arg ); + return; + } + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->pixmapKeys.remove( pixmap ); + r->pixmapKeys.insert( pixmap, arg ); +} + +QString MetaDataBase::pixmapKey( QObject *o, int pixmap ) +{ + if ( !o ) + return QString::null; + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) + return ( (PropertyObject*)o )->mdPixmapKey( pixmap ); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QString::null; + } + + QString s = *r->pixmapKeys.find( pixmap ); + if ( !s.isNull() ) + return s; + if ( !o->isWidgetType() ) + return s; + QWidget *w = (QWidget*)o; + if ( w->icon() ) + return *r->pixmapKeys.find( w->icon()->serialNumber() ); + return s; +} + +void MetaDataBase::clearPixmapKeys( QObject *o ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->pixmapKeys.clear(); +} + + + +void MetaDataBase::setColumnFields( QObject *o, const QMap &columnFields ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->columnFields = columnFields; +} + +QMap MetaDataBase::columnFields( QObject *o ) +{ + if ( !o ) + return QMap(); + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QMap(); + } + + return r->columnFields; +} + +void MetaDataBase::setEditor( const QStringList &langs ) +{ + editorLangList = langs; +} + +bool MetaDataBase::hasEditor( const QString &lang ) +{ + return editorLangList.find( lang ) != editorLangList.end(); +} + +void MetaDataBase::setupInterfaceManagers( const QString &plugDir ) +{ + if ( !languageInterfaceManager ) { + languageInterfaceManager = + new QPluginManager( IID_Language, + QApplication::libraryPaths(), +// kapp->dirs()->resourceDirs("qtplugins"), + plugDir ); + + langList = languageInterfaceManager->featureList(); + langList.remove( "C++" ); + langList << "C++"; + } +} + +QStringList MetaDataBase::languages() +{ + return langList; +} + +QString MetaDataBase::normalizeFunction( const QString &f ) +{ + return Parser::cleanArgs( f ); +} + +LanguageInterface *MetaDataBase::languageInterface( const QString &lang ) +{ + LanguageInterface* iface = 0; + languageInterfaceManager->queryInterface( lang, &iface ); + return iface; +} + +void MetaDataBase::clear( QObject *o ) +{ + if ( !o ) + return; + setupDataBase(); + db->remove( (void*)o ); + for ( QPtrDictIterator it( *( (FormWindow*)o )->widgets() ); it.current(); ++it ) + db->remove( (void*)it.current() ); +} + +void MetaDataBase::setBreakPoints( QObject *o, const QValueList &l ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->breakPoints = l; + + QMap::Iterator it = r->breakPointConditions.begin(); + while ( it != r->breakPointConditions.end() ) { + int line = it.key(); + ++it; + if ( r->breakPoints.find( line ) == r->breakPoints.end() ) + r->breakPointConditions.remove( r->breakPointConditions.find( line ) ); + } +} + +QValueList MetaDataBase::breakPoints( QObject *o ) +{ + if ( !o ) + return QValueList(); + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QValueList(); + } + + return r->breakPoints; +} + +void MetaDataBase::setBreakPointCondition( QObject *o, int line, const QString &condition ) +{ + if ( !o ) + return; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + r->breakPointConditions.replace( line, condition ); +} + +QString MetaDataBase::breakPointCondition( QObject *o, int line ) +{ + if ( !o ) + return QString::null; + setupDataBase(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return QString::null; + } + QMap::Iterator it = r->breakPointConditions.find( line ); + if ( it == r->breakPointConditions.end() ) + return QString::null; + return *it; +} + +void MetaDataBase::setExportMacro( QObject *o, const QString ¯o ) +{ + if ( !o ) + return; + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) { + ( (PropertyObject*)o )->mdSetExportMacro( macro ); + return; + } + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return; + } + + r->exportMacro = macro; +} + +QString MetaDataBase::exportMacro( QObject *o ) +{ + if ( !o ) + return ""; + setupDataBase(); + if ( o->isA( "PropertyObject" ) ) + return ( (PropertyObject*)o )->mdExportMacro(); + MetaDataBaseRecord *r = db->find( (void*)o ); + if ( !r ) { + qWarning( "No entry for %p (%s, %s) found in MetaDataBase", + o, o->name(), o->className() ); + return ""; + } + + return r->exportMacro; +} + +bool MetaDataBase::hasObject( QObject *o ) +{ + return !!db->find( o ); +} diff --git a/kdevdesigner/designer/metadatabase.h b/kdevdesigner/designer/metadatabase.h new file mode 100644 index 00000000..f7ce5088 --- /dev/null +++ b/kdevdesigner/designer/metadatabase.h @@ -0,0 +1,269 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef METADATABASE_H +#define METADATABASE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pixmapchooser.h" +#include "../interfaces/languageinterface.h" + +class QObject; +class QPixmap; +struct LanguageInterface; + +class MetaDataBase +{ +public: + struct Connection + { + QObject *sender, *receiver; + QCString signal, slot; + bool operator==( const Connection &c ) const { + return sender == c.sender && receiver == c.receiver && + signal == c.signal && slot == c.slot ; + } + }; + + struct Function + { + QString returnType; + QCString function; + QString specifier; + QString access; + QString type; + QString language; + bool operator==( const Function &f ) const { + return ( returnType == f.returnType && + function == f.function && + specifier == f.specifier && + access == f.access && + type == f.type && + language == f.language + ); + } + }; + + struct Property + { + QCString property; + QString type; + bool operator==( const Property &p ) const { + return property == p.property && + type == p.type; + } + }; + + struct CustomWidget + { + CustomWidget(); + CustomWidget( const CustomWidget &w ); + ~CustomWidget() { delete pixmap; } // inlined to work around 2.7.2.3 bug + bool operator==( const CustomWidget &w ) const; + CustomWidget &operator=( const CustomWidget &w ); + + bool hasSignal( const QCString &signal ) const; + bool hasSlot( const QCString &slot ) const; + bool hasProperty( const QCString &prop ) const; + + enum IncludePolicy { Global, Local }; + QString className; + QString includeFile; + IncludePolicy includePolicy; + QSize sizeHint; + QSizePolicy sizePolicy; + QPixmap *pixmap; + QValueList lstSignals; + QValueList lstSlots; + QValueList lstProperties; + int id; + bool isContainer; + }; + + struct Include + { + Include() : header(), location(), implDecl( "in implementation" ) {} + QString header; + QString location; + bool operator==( const Include &i ) const { + return header == i.header && location == i.location; + } + QString implDecl; + }; + + struct Variable + { + QString varName; + QString varAccess; + bool operator==( const Variable &v ) const { + return varName == v.varName && + varAccess == v.varAccess; + } + }; + + struct MetaInfo + { + MetaInfo() : classNameChanged( FALSE ) { } + QString className; + bool classNameChanged; + QString comment; + QString author; + }; + + MetaDataBase(); + static void clearDataBase(); + + static void addEntry( QObject *o ); + static void removeEntry( QObject *o ); + static void setPropertyChanged( QObject *o, const QString &property, bool changed ); + static bool isPropertyChanged( QObject *o, const QString &property ); + static void setPropertyComment( QObject *o, const QString &property, const QString &comment ); + static QString propertyComment( QObject *o, const QString &property ); + static QStringList changedProperties( QObject *o ); + + static void setFakeProperty( QObject *o, const QString &property, const QVariant& value ); + static QVariant fakeProperty( QObject * o, const QString &property ); + static QMap* fakeProperties( QObject* o ); + + static void setSpacing( QObject *o, int spacing ); + static int spacing( QObject *o ); + static void setMargin( QObject *o, int margin ); + static int margin( QObject *o ); + + static void setResizeMode( QObject *o, const QString &mode ); + static QString resizeMode( QObject *o ); + + static void addConnection( QObject *o, QObject *sender, const QCString &signal, + QObject *receiver, const QCString &slot, bool addCode = TRUE ); + static void removeConnection( QObject *o, QObject *sender, const QCString &signal, + QObject *receiver, const QCString &slot ); + static bool hasConnection( QObject *o, QObject *sender, const QCString &signal, + QObject *receiver, const QCString &slot ); + static void setupConnections( QObject *o, const QValueList &conns ); + static QValueList connections( QObject *o ); + static QValueList connections( QObject *o, QObject *sender, QObject *receiver ); + static QValueList connections( QObject *o, QObject *object ); + static void doConnections( QObject *o ); + + static void addFunction( QObject *o, const QCString &function, const QString &specifier, + const QString &access, const QString &type, const QString &language, + const QString &returnType ); + static void removeFunction( QObject *o, const QCString &function, const QString &specifier, + const QString &access, const QString &type, const QString &language, + const QString &returnType ); + static void removeFunction( QObject *o, const QString &function ); + static QValueList functionList( QObject *o, bool onlyFunctions = FALSE ); + static QValueList slotList( QObject *o ); + static bool isSlotUsed( QObject *o, const QCString &slot ); + static bool hasFunction( QObject *o, const QCString &function, bool onlyCustom = FALSE ); + static bool hasSlot( QObject *o, const QCString &slot, bool onlyCustom = FALSE ); + static void changeFunction( QObject *o, const QString &function, const QString &newName, + const QString &returnType ); + static void changeFunctionAttributes( QObject *o, const QString &oldName, const QString &newName, + const QString &specifier, const QString &access, + const QString &type, const QString &language, + const QString &returnType ); + static QString languageOfFunction( QObject *o, const QCString &function ); + static void setFunctionList( QObject *o, const QValueList &functionList ); + + + static bool addCustomWidget( CustomWidget *w ); + static void removeCustomWidget( CustomWidget *w ); + static QPtrList *customWidgets(); + static CustomWidget *customWidget( int id ); + static bool isWidgetNameUsed( CustomWidget *w ); + static bool hasCustomWidget( const QString &className ); + + static void setTabOrder( QWidget *w, const QWidgetList &order ); + static QWidgetList tabOrder( QWidget *w ); + + static void setIncludes( QObject *o, const QValueList &incs ); + static QValueList includes( QObject *o ); + + static void setForwards( QObject *o, const QStringList &fwds ); + static QStringList forwards( QObject *o ); + + static void setVariables( QObject *o, const QValueList &vars ); + static void addVariable( QObject *o, const QString &name, const QString &access ); + static void removeVariable( QObject *o, const QString &name ); + static QValueList variables( QObject *o ); + static bool hasVariable( QObject *o, const QString &name ); + static QString extractVariableName( const QString &name ); + + static void setSignalList( QObject *o, const QStringList &sigs ); + static QStringList signalList( QObject *o ); + + static void setMetaInfo( QObject *o, MetaInfo mi ); + static MetaInfo metaInfo( QObject *o ); + + static void setCursor( QWidget *w, const QCursor &c ); + static QCursor cursor( QWidget *w ); + + static void setPixmapArgument( QObject *o, int pixmap, const QString &arg ); + static QString pixmapArgument( QObject *o, int pixmap ); + static void clearPixmapArguments( QObject *o ); + + static void setPixmapKey( QObject *o, int pixmap, const QString &arg ); + static QString pixmapKey( QObject *o, int pixmap ); + static void clearPixmapKeys( QObject *o ); + + static void setColumnFields( QObject *o, const QMap &columnFields ); + static QMap columnFields( QObject *o ); + + static void setEditor( const QStringList &langs ); + static bool hasEditor( const QString &lang ); + + static void setupInterfaceManagers( const QString &plugDir ); + static QStringList languages(); + + static LanguageInterface *languageInterface( const QString &lang ); + + static QString normalizeFunction( const QString &f ); + + static void clear( QObject *o ); + + static void setBreakPoints( QObject *o, const QValueList &l ); + static void setBreakPointCondition( QObject *o, int line, const QString &condition ); + static QValueList breakPoints( QObject *o ); + static QString breakPointCondition( QObject *o, int line ); + + static void setExportMacro( QObject *o, const QString ¯o ); + static QString exportMacro( QObject *o ); + + static bool hasObject( QObject *o ); + +}; + +#endif diff --git a/kdevdesigner/designer/multilineeditor.ui b/kdevdesigner/designer/multilineeditor.ui new file mode 100644 index 00000000..3a28f795 --- /dev/null +++ b/kdevdesigner/designer/multilineeditor.ui @@ -0,0 +1,181 @@ + +MultiLineEditorBase +********************************************************************* +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + MultiLineEditorBase + + + + 0 + 0 + 598 + 307 + + + + Edit Text + + + <b>Multiline Edit</b><p>This is a simple richtext editor. To improve its usability it provides toolbar items for the most common html tags: by clicking on a toolbar item, the corresponding tag will be written to the editor, where you can insert your text. If you have already written some text and want to format it, hilight it and click on the desired button. To improve visualization this editor also supports a simple html-syntax-highlighting scheme. + + + + unnamed + + + 11 + + + 6 + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + OkButton + + + &OK + + + false + + + true + + + true + + + + + applyButton + + + &Apply + + + + + cancelButton + + + &Cancel + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + helpButton + + + &Help + + + + + + + + + + + menuBar + + + + + + + OkButton + clicked() + MultiLineEditorBase + okClicked() + + + applyButton + clicked() + MultiLineEditorBase + applyClicked() + + + cancelButton + clicked() + MultiLineEditorBase + cancelClicked() + + + + applyClicked() + okClicked() + cancelClicked() + + + diff --git a/kdevdesigner/designer/multilineeditorimpl.cpp b/kdevdesigner/designer/multilineeditorimpl.cpp new file mode 100644 index 00000000..3d7f5afc --- /dev/null +++ b/kdevdesigner/designer/multilineeditorimpl.cpp @@ -0,0 +1,415 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "multilineeditorimpl.h" +#include "formwindow.h" +#include "command.h" +#include "mainwindow.h" +#include "richtextfontdialog.h" +#include "syntaxhighlighter_html.h" +#include "widgetfactory.h" + +#include +#include "kdevdesigner_part.h" + +#include +#include <./private/qrichtext_p.h> +#include +#include +#include +#include +#include +#include + +#include + +ToolBarItem::ToolBarItem( QWidget *parent, QWidget *toolBar, + const QString &label, const QString &tagstr, + const QIconSet &icon, const QKeySequence &key ) + : QAction( parent ) +{ + setIconSet( icon ); + setText( label ); + setAccel( key ); + addTo( toolBar ); + tag = tagstr; + connect( this, SIGNAL( activated() ), this, SLOT( wasActivated() ) ); +} + +ToolBarItem::~ToolBarItem() +{ + +} + +void ToolBarItem::wasActivated() +{ + emit clicked( tag ); +} + +TextEdit::TextEdit( QWidget *parent, const char *name ) + : QTextEdit( parent, name ) +{ + setTextFormat( Qt::PlainText ); +} + +QTextParagraph* TextEdit::paragraph() +{ + QTextCursor *tc = new QTextCursor( QTextEdit::document() ); + return tc->paragraph(); +} + + +MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, QWidget *parent, QWidget *editWidget, + FormWindow *fw, const QString &text ) + : MultiLineEditorBase( parent, 0, WType_Dialog | WShowModal ), formwindow( fw ), doWrap( FALSE ) +{ + callStatic = call_static; + + if ( callStatic ) + applyButton->hide(); + + textEdit = new TextEdit( centralWidget(), "textedit" ); + Layout4->insertWidget( 0, textEdit ); + + if ( richtextMode ) { + QPopupMenu *stylesMenu = new QPopupMenu( this ); + menuBar->insertItem( i18n( "&Styles" ), stylesMenu ); + + basicToolBar = new QToolBar( i18n( "Basics" ), this, DockTop ); + + ToolBarItem *it = new ToolBarItem( this, basicToolBar, i18n( "Italic" ), + "i", BarIcon( "designer_textitalic.png", KDevDesignerPartFactory::instance() ), CTRL+Key_I ); + it->addTo( stylesMenu ); + connect( it, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *b = new ToolBarItem( this, basicToolBar, i18n( "Bold" ), + "b", BarIcon( "designer_textbold.png", KDevDesignerPartFactory::instance() ), CTRL+Key_B ); + b->addTo( stylesMenu ); + connect( b, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *ul = new ToolBarItem( this, basicToolBar, i18n( "Underline" ), + "u", BarIcon( "designer_textunderline.png" , KDevDesignerPartFactory::instance()), CTRL+Key_U ); + ul->addTo( stylesMenu ); + connect( ul, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *tt = new ToolBarItem( this, basicToolBar, i18n( "Typewriter" ), + "tt", BarIcon( "designer_textteletext.png", KDevDesignerPartFactory::instance() ) ); + tt->addTo( stylesMenu ); + connect( tt, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + basicToolBar->addSeparator(); + + QPopupMenu *layoutMenu = new QPopupMenu( this ); + menuBar->insertItem( i18n( "&Layout" ), layoutMenu ); + + QAction *brAction = new QAction( this ); + brAction->setIconSet( BarIcon( "designer_textlinebreak.png", KDevDesignerPartFactory::instance() ) ); + brAction->setText( i18n("Break" ) ); + brAction->addTo( basicToolBar ); + brAction->addTo( layoutMenu ); + connect( brAction, SIGNAL( activated() ) , this, SLOT( insertBR() ) ); + + ToolBarItem *p = new ToolBarItem( this, basicToolBar, i18n( "Paragraph" ), + "p", BarIcon( "designer_textparagraph.png", KDevDesignerPartFactory::instance() ) ); + p->addTo( layoutMenu ); + connect( p, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + layoutMenu->insertSeparator(); + basicToolBar->addSeparator(); + + ToolBarItem *al = new ToolBarItem( this, basicToolBar, i18n( "Align left" ), + "p align=\"left\"", BarIcon( "designer_textleft.png", KDevDesignerPartFactory::instance() ) ); + al->addTo( layoutMenu ); + connect( al, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *ac = new ToolBarItem( this, basicToolBar, i18n( "Align center" ), + "p align=\"center\"", BarIcon( "designer_textcenter.png", KDevDesignerPartFactory::instance() ) ); + ac->addTo( layoutMenu ); + connect( ac, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *ar = new ToolBarItem( this, basicToolBar, i18n( "Align right" ), + "p align=\"right\"", BarIcon( "designer_textright.png", KDevDesignerPartFactory::instance() ) ); + ar->addTo( layoutMenu ); + connect( ar, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *block = new ToolBarItem( this, basicToolBar, i18n( "Blockquote" ), + "blockquote", BarIcon( "designer_textjustify.png", KDevDesignerPartFactory::instance() ) ); + block->addTo( layoutMenu ); + connect( block, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + + QPopupMenu *fontMenu = new QPopupMenu( this ); + menuBar->insertItem( i18n( "&Font" ), fontMenu ); + + fontToolBar = new QToolBar( "Fonts", this, DockTop ); + + QAction *fontAction = new QAction( this ); + fontAction->setIconSet( BarIcon( "designer_textfont.png", KDevDesignerPartFactory::instance() ) ); + fontAction->setText( i18n("Font" ) ); + fontAction->addTo( fontToolBar ); + fontAction->addTo( fontMenu ); + connect( fontAction, SIGNAL( activated() ) , this, SLOT( showFontDialog() ) ); + + + ToolBarItem *fp1 = new ToolBarItem( this, fontToolBar, i18n( "Fontsize +1" ), + "font size=\"+1\"", BarIcon( "designer_textlarger.png", KDevDesignerPartFactory::instance() ) ); + connect( fp1, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *fm1 = new ToolBarItem( this, fontToolBar, i18n( "Fontsize -1" ), + "font size=\"-1\"", BarIcon( "designer_textsmaller.png", KDevDesignerPartFactory::instance() ) ); + connect( fm1, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *h1 = new ToolBarItem( this, fontToolBar, i18n( "Headline 1" ), + "h1", BarIcon( "designer_texth1.png", KDevDesignerPartFactory::instance() ) ); + connect( h1, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *h2 = new ToolBarItem( this, fontToolBar, i18n( "Headline 2" ), + "h2", BarIcon( "designer_texth2.png", KDevDesignerPartFactory::instance() ) ); + connect( h2, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + ToolBarItem *h3 = new ToolBarItem( this, fontToolBar, i18n( "Headline 3" ), + "h3", BarIcon( "designer_texth3.png", KDevDesignerPartFactory::instance() ) ); + connect( h3, SIGNAL( clicked( const QString& ) ), + this, SLOT( insertTags( const QString& ))); + + QPopupMenu *optionsMenu = new QPopupMenu( this ); + menuBar->insertItem( i18n( "O&ptions" ), optionsMenu ); + + optionsToolBar = new QToolBar( "Options", this, DockTop ); + wrapAction = new QAction( this ); + wrapAction->setToggleAction( TRUE ); + wrapAction->setIconSet( BarIcon( "designer_wordwrap.png", KDevDesignerPartFactory::instance() ) ); + wrapAction->setText( i18n( "Word Wrapping" ) ); + wrapAction->addTo( optionsToolBar ); + wrapAction->addTo( optionsMenu ); + connect( wrapAction, SIGNAL( toggled( bool ) ), this, SLOT( changeWrapMode( bool ) ) ); + + oldDoWrap = doWrap; + wrapAction->setOn( doWrap ); + + connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + textEdit->document()->setFormatter( new QTextFormatterBreakInWords ); + textEdit->document()->setUseFormatCollection( FALSE ); + textEdit->document()->setPreProcessor( new SyntaxHighlighter_HTML ); + + if ( !callStatic && ::qt_cast(editWidget) ) { + mlined = (QTextEdit*)editWidget; + mlined->setReadOnly( TRUE ); + + const QMetaProperty *wordWrap = mlined->metaObject()->property( + mlined->metaObject()->findProperty( "wordWrap", TRUE ), TRUE ); + oldWrapMode = 0; + oldWrapString = "NoWrap"; + if ( wordWrap ) { + oldWrapMode = mlined->property( "wordWrap" ); + oldWrapString = QString( wordWrap->valueToKey( oldWrapMode.toInt() ) ); + if ( oldWrapString != "NoWrap" ) + doWrap = TRUE; + } + textEdit->setAlignment( mlined->alignment() ); + textEdit->setWordWrap( mlined->wordWrap() ); + textEdit->setWrapColumnOrWidth( mlined->wrapColumnOrWidth() ); + textEdit->setWrapPolicy( mlined->wrapPolicy() ); + textEdit->setText( mlined->text() ); + if ( !mlined->text().isEmpty() ) + textEdit->selectAll(); + } else { + textEdit->setText( text ); + textEdit->selectAll(); + } + } else { + textEdit->setText( text ); + textEdit->selectAll(); + } + textEdit->setFocus(); +} + +int MultiLineEditor::exec() +{ + res = 1; + show(); + qApp->enter_loop(); + return res; +} + +void MultiLineEditor::okClicked() +{ + applyClicked(); + close(); +} + +void MultiLineEditor::applyClicked() +{ + if ( !callStatic ) { + PopulateMultiLineEditCommand *cmd = new PopulateMultiLineEditCommand( i18n( "Set the Text of '%1'" ).arg( mlined->name() ), + formwindow, mlined, textEdit->text() ); + cmd->execute(); + formwindow->commandHistory()->addCommand( cmd ); + + if ( oldDoWrap != doWrap ) { + QString pn( i18n( "Set 'wordWrap' of '%2'" ).arg( mlined->name() ) ); + SetPropertyCommand *propcmd; + if ( doWrap ) + propcmd = new SetPropertyCommand( pn, formwindow, + mlined, MainWindow::self->propertyeditor(), + "wordWrap", WidgetFactory::property( mlined, "wordWrap" ), + QVariant( 1 ), "WidgetWidth", oldWrapString ); + else + propcmd = new SetPropertyCommand( pn, formwindow, + mlined, MainWindow::self->propertyeditor(), + "wordWrap", WidgetFactory::property( mlined, "wordWrap" ), + QVariant( 0 ), "NoWrap", oldWrapString ); + + propcmd->execute(); + formwindow->commandHistory()->addCommand( propcmd, TRUE ); + } + textEdit->setFocus(); + } + else { + staticText = textEdit->text(); + } +} + +void MultiLineEditor::cancelClicked() +{ + res = 0; + close(); +} + +void MultiLineEditor::closeEvent( QCloseEvent *e ) +{ + qApp->exit_loop(); + MultiLineEditorBase::closeEvent( e ); +} + +void MultiLineEditor::insertTags( const QString &tag ) +{ + int pfrom, pto, ifrom, ito; + QString tagend( tag.simplifyWhiteSpace() ); + tagend.remove( tagend.find( ' ', 0 ), tagend.length() ); + if ( textEdit->hasSelectedText() ) { + textEdit->getSelection( &pfrom, &ifrom, &pto, &ito ); + QString buf = textEdit->selectedText(); + buf = QString( "<%1>%3" ).arg( tag ).arg( tagend ).arg( buf ); + textEdit->removeSelectedText(); + textEdit->insertAt( buf, pfrom, ifrom ); + textEdit->setCursorPosition( pto, ito + 2 + tag.length() ); + } + else { + int para, index; + textEdit->getCursorPosition( ¶, &index ); + textEdit->insert( QString( "<%1>" ).arg( tag ).arg( tagend ) ); + index += 2 + tag.length(); + textEdit->setCursorPosition( para, index ); + } +} + +void MultiLineEditor::insertBR() +{ + textEdit->insert( "
      " ); +} + +void MultiLineEditor::showFontDialog() +{ + bool selText = FALSE; + int pfrom, pto, ifrom, ito; + if ( textEdit->hasSelectedText() ) { + textEdit->getSelection( &pfrom, &ifrom, &pto, &ito ); + selText = TRUE; + } + RichTextFontDialog *fd = new RichTextFontDialog( this ); + if ( fd->exec() == QDialog::Accepted ) { + QString size, font; + if ( fd->getSize() != "0" ) + size = "size=\"" + fd->getSize() + "\""; + QString color; + if ( !fd->getColor().isEmpty() && fd->getColor() != "#000000" ) + color = "color=\"" + fd->getColor() + "\""; + if ( fd->getFont() != "default" ) + font = "face=\"" + fd->getFont() + "\""; + QString tag( QString( "font %1 %2 %3" ) + .arg( color ).arg( size ).arg( font ) ); + + if ( selText ) + textEdit->setSelection( pfrom, ifrom, pto, ito ); + insertTags( tag.simplifyWhiteSpace() ); + } + else if ( selText ) + textEdit->setSelection( pfrom, ifrom, pto, ito ); +} + +QString MultiLineEditor::getStaticText() +{ + return staticText.stripWhiteSpace(); +} + +QString MultiLineEditor::getText( QWidget *parent, const QString &text, bool richtextMode, bool *useWrap ) +{ + MultiLineEditor medit( TRUE, richtextMode, parent, 0, 0, text ); + if ( richtextMode ) + medit.setUseWrapping( *useWrap ); + if ( medit.exec() == QDialog::Accepted ) { + *useWrap = medit.useWrapping(); + return medit.getStaticText(); + } + return QString::null; +} + +void MultiLineEditor::changeWrapMode( bool b ) +{ + doWrap = b; + if ( doWrap && !callStatic ) { + if ( oldDoWrap ) + textEdit->setProperty( "wordWrap", oldWrapMode ); + else + textEdit->setWordWrap( QTextEdit::WidgetWidth ); + } else { + textEdit->setWordWrap( QTextEdit::NoWrap ); + } +} + +bool MultiLineEditor::useWrapping() const +{ + return doWrap; +} + +void MultiLineEditor::setUseWrapping( bool b ) +{ + doWrap = b; + wrapAction->setOn( doWrap ); +} diff --git a/kdevdesigner/designer/multilineeditorimpl.h b/kdevdesigner/designer/multilineeditorimpl.h new file mode 100644 index 00000000..5abf5339 --- /dev/null +++ b/kdevdesigner/designer/multilineeditorimpl.h @@ -0,0 +1,109 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef MULTILINEEDITORIMPL_H +#define MULTILINEEDITORIMPL_H + +#include +#include +#include +#include "multilineeditor.h" + +class FormWindow; +class QToolBar; +class QTextDocument; + +class TextEdit : public QTextEdit +{ + Q_OBJECT + +public: + TextEdit( QWidget *parent = 0, const char *name = 0 ); + QTextDocument *document() const { return QTextEdit::document(); } + QTextParagraph *paragraph(); + +}; + +class ToolBarItem : public QAction +{ + Q_OBJECT + +public: + ToolBarItem( QWidget *parent, QWidget *toolBar, + const QString &label, const QString &tagstr, + const QIconSet &icon, const QKeySequence &key = 0 ); + ~ToolBarItem(); +signals: + void clicked( const QString &t ); + +protected slots: + void wasActivated(); +private: + QString tag; +}; + + +class MultiLineEditor : public MultiLineEditorBase +{ + Q_OBJECT + +public: + MultiLineEditor( bool call_static, bool richtextMode, QWidget *parent, QWidget *editWidget, + FormWindow *fw, const QString &text = QString::null ); + bool useWrapping() const; + void setUseWrapping( bool ); + static QString getText( QWidget *parent, const QString &text, bool richtextMode, bool *useWrap ); + int exec(); + +protected slots: + void okClicked(); + void applyClicked(); + void cancelClicked(); + void insertTags( const QString& ); + void insertBR(); + void showFontDialog(); + void changeWrapMode( bool ); + + void closeEvent( QCloseEvent *e ); + +private: + QString getStaticText(); + TextEdit *textEdit; + QTextEdit *mlined; + FormWindow *formwindow; + QToolBar *basicToolBar; + QToolBar *fontToolBar; + QToolBar *optionsToolBar; + QAction *wrapAction; + int res; + QString staticText; + bool callStatic; + bool oldDoWrap, doWrap; + QVariant oldWrapMode; + QString oldWrapString; +}; + +#endif diff --git a/kdevdesigner/designer/myiconloader.cpp b/kdevdesigner/designer/myiconloader.cpp new file mode 100644 index 00000000..b33a6299 --- /dev/null +++ b/kdevdesigner/designer/myiconloader.cpp @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "myiconloader.h" +#include "kdevdesigner_part.h" +#include + +QPixmap BarIcon2( const QString & name ) +{ + return BarIcon(name, KDevDesignerPartFactory::instance()); +} + +QPixmap SmallIcon2( const QString & name) +{ + return SmallIcon(name, KDevDesignerPartFactory::instance()); +} diff --git a/kdevdesigner/designer/myiconloader.h b/kdevdesigner/designer/myiconloader.h new file mode 100644 index 00000000..f93dee16 --- /dev/null +++ b/kdevdesigner/designer/myiconloader.h @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef MY_ICON_LOADER +#define MY_ICON_LOADER + +#include +#include + +class KInstance; + +QPixmap BarIcon2 (const QString &name); +QPixmap SmallIcon2 (const QString &name); + + +#endif diff --git a/kdevdesigner/designer/newform.ui b/kdevdesigner/designer/newform.ui new file mode 100644 index 00000000..cdfae7e4 --- /dev/null +++ b/kdevdesigner/designer/newform.ui @@ -0,0 +1,238 @@ + +NewFormBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + NewFormBase + + + + 0 + 0 + 557 + 436 + + + + New File + + + true + + + <b>New Form</b><p>Select a template for the new form and click the <b>OK</b>-button to create it.</p> + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Create a new form using the selected template. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog without creating a new form. + + + + + + + templateView + + + 120 + + + Adjust + + + false + + + true + + + Displays a list of the available templates. + + + + + labelProject + + + &Insert into: + + + projectCombo + + + + + projectCombo + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + buttonOk + clicked() + NewFormBase + accept() + + + buttonCancel + clicked() + NewFormBase + reject() + + + projectCombo + activated(const QString&) + NewFormBase + projectChanged(const QString&) + + + templateView + currentChanged(QIconViewItem*) + NewFormBase + itemChanged(QIconViewItem*) + + + templateView + doubleClicked(QIconViewItem*) + NewFormBase + accept() + + + templateView + returnPressed(QIconViewItem*) + NewFormBase + accept() + + + + templateView + helpButton + buttonOk + buttonCancel + + + itemChanged( QIconViewItem * ) + projectChanged( const QString & ) + + + diff --git a/kdevdesigner/designer/newformimpl.cpp b/kdevdesigner/designer/newformimpl.cpp new file mode 100644 index 00000000..9ff44d01 --- /dev/null +++ b/kdevdesigner/designer/newformimpl.cpp @@ -0,0 +1,414 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "newformimpl.h" +#include "mainwindow.h" +#include "metadatabase.h" +#include "project.h" +#include "formwindow.h" +#include "widgetfactory.h" +#include "widgetdatabase.h" +#include "actioneditorimpl.h" +#include "hierarchyview.h" +#include "resource.h" +#include "projectsettingsimpl.h" +#include "sourcefile.h" + +#include +#include "kdevdesigner_part.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int forms = 0; + +ProjectItem::ProjectItem( QIconView *view, const QString &text ) + : NewItem( view, text ) +{ +} + +void ProjectItem::insert( Project * ) +{ + MainWindow::self->createNewProject( lang ); +} + + + +FormItem::FormItem( QIconView *view, const QString &text ) + : NewItem( view, text ) +{ +} + +void FormItem::insert( Project *pro ) +{ + QString n = "Form" + QString::number( ++forms ); + FormWindow *fw = 0; + FormFile *ff = new FormFile( FormFile::createUnnamedFileName(), TRUE, pro ); + fw = new FormWindow( ff, MainWindow::self, MainWindow::self->qWorkspace(), n ); + fw->setProject( pro ); + MetaDataBase::addEntry( fw ); + if ( fType == Widget ) { + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QWidget" ), + fw, n.latin1() ); + fw->setMainContainer( w ); + } else if ( fType == Dialog ) { + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QDialog" ), fw, n.latin1() ); + fw->setMainContainer( w ); + } else if ( fType == Wizard ) { + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QWizard" ), + fw, n.latin1() ); + fw->setMainContainer( w ); + } else if ( fType == MainWindow ) { + QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( "QMainWindow" ), + fw, n.latin1() ); + fw->setMainContainer( w ); + } + + fw->setCaption( n ); + fw->resize( 600, 480 ); + MainWindow::self->insertFormWindow( fw ); + + TemplateWizardInterface *iface = + MainWindow::self->templateWizardInterface( fw->mainContainer()->className() ); + if ( iface ) { + iface->setup( fw->mainContainer()->className(), fw->mainContainer(), + fw->iFace(), MainWindow::self->designerInterface() ); + iface->release(); + } + + // the wizard might have changed a lot, lets update everything + MainWindow::self->actioneditor()->setFormWindow( fw ); + MainWindow::self->objectHierarchy()->setFormWindow( fw, fw ); + MainWindow::self->objectHierarchy()->formDefinitionView()->refresh(); + MainWindow::self->objectHierarchy()->rebuild(); + fw->killAccels( fw ); + fw->project()->setModified( TRUE ); + fw->setFocus(); + if ( !pro->isDummy() ) { + fw->setSavePixmapInProject( TRUE ); + fw->setSavePixmapInline( FALSE ); + } +} + + + +CustomFormItem::CustomFormItem( QIconView *view, const QString &text ) + : NewItem( view, text ) +{ +} + +static void unifyFormName( FormWindow *fw, QWorkspace *qworkspace ) +{ + QStringList lst; + QWidgetList windows = qworkspace->windowList(); + for ( QWidget *w =windows.first(); w; w = windows.next() ) { + if ( w == fw ) + continue; + lst << w->name(); + } + + if ( lst.findIndex( fw->name() ) == -1 ) + return; + QString origName = fw->name(); + QString n = origName; + int i = 1; + while ( lst.findIndex( n ) != -1 ) { + n = origName + QString::number( i++ ); + } + fw->setName( n ); + fw->setCaption( n ); +} + +void CustomFormItem::insert( Project *pro ) +{ + QString filename = templateFileName(); + if ( !filename.isEmpty() && QFile::exists( filename ) ) { + Resource resource( MainWindow::self ); + FormFile *ff = new FormFile( filename, TRUE, pro ); + if ( !resource.load( ff ) ) { + QMessageBox::information( MainWindow::self, i18n("Load Template"), + i18n("Could not load form description from template '%1'" ).arg( filename ) ); + delete ff; + return; + } + ff->setFileName( QString::null ); + if ( MainWindow::self->formWindow() ) { + MainWindow::self->formWindow()->setFileName( QString::null ); + unifyFormName( MainWindow::self->formWindow(), MainWindow::self->qWorkspace() ); + if ( !pro->isDummy() ) { + MainWindow::self->formWindow()->setSavePixmapInProject( TRUE ); + MainWindow::self->formWindow()->setSavePixmapInline( FALSE ); + } + } + } +} + + + +SourceFileItem::SourceFileItem( QIconView *view, const QString &text ) + : NewItem( view, text ), visible( TRUE ) +{ +} + +void SourceFileItem::insert( Project *pro ) +{ + SourceFile *f = new SourceFile( SourceFile::createUnnamedFileName( ext ), TRUE, pro ); + MainWindow::self->editSource( f ); +} + +void SourceFileItem::setProject( Project *pro ) +{ + QIconView *iv = iconView(); + bool v = lang == pro->language(); + if ( !iv || v == visible ) + return; + visible = v; + if ( !visible ) + iv->takeItem( this ); + else + iv->insertItem( this ); +} + + + +SourceTemplateItem::SourceTemplateItem( QIconView *view, const QString &text ) + : NewItem( view, text ), visible( TRUE ) +{ +} + +void SourceTemplateItem::insert( Project *pro ) +{ + SourceTemplateInterface *siface = MainWindow::self->sourceTemplateInterface( text() ); + if ( !siface ) + return; + SourceTemplateInterface::Source src = siface->create( text(), MainWindow::self->designerInterface() ); + SourceFile *f = 0; + if ( src.type == SourceTemplateInterface::Source::Invalid ) + return; + if ( src.type == SourceTemplateInterface::Source::FileName ) + f = new SourceFile( src.filename, FALSE, pro ); + else + f = new SourceFile( SourceFile::createUnnamedFileName( src.extension ), TRUE, pro ); + if ( f->isAccepted()) { + f->setText( src.code ); + MainWindow::self->editSource( f ); + f->setModified( TRUE ); + } else { + delete f; + } +} + +void SourceTemplateItem::setProject( Project *pro ) +{ + QIconView *iv = iconView(); + bool v = !pro->isDummy() && lang == pro->language(); + if ( !iv || v == visible ) + return; + visible = v; + if ( !visible ) + iv->takeItem( this ); + else + iv->insertItem( this ); +} + +void NewForm::insertTemplates( QIconView *tView, + const QString &templatePath ) +{ + QStringList::Iterator it; + QStringList languages = MetaDataBase::languages(); + if ( !MainWindow::self->singleProjectMode() ) { + for ( it = languages.begin(); it != languages.end(); ++it ) { + ProjectItem *pi = new ProjectItem( tView, i18n("%1 Project" ).arg( *it ) ); + allItems.append( pi ); + pi->setLanguage( *it ); + pi->setPixmap( BarIcon( "designer_project.png" , KDevDesignerPartFactory::instance()) ); + pi->setDragEnabled( FALSE ); + } + } + QIconViewItem *cur = 0; + FormItem *fi = new FormItem( tView,i18n( "Dialog" ) ); + allItems.append( fi ); + fi->setFormType( FormItem::Dialog ); + fi->setPixmap( BarIcon( "designer_newform.png" , KDevDesignerPartFactory::instance()) ); + fi->setDragEnabled( FALSE ); + cur = fi; + if ( !MainWindow::self->singleProjectMode() ) { + fi = new FormItem( tView,i18n( "Wizard" ) ); + allItems.append( fi ); + fi->setFormType( FormItem::Wizard ); + fi->setPixmap( BarIcon( "designer_newform.png" , KDevDesignerPartFactory::instance()) ); + fi->setDragEnabled( FALSE ); + fi = new FormItem( tView, i18n( "Widget" ) ); + allItems.append( fi ); + fi->setFormType( FormItem::Widget ); + fi->setPixmap( BarIcon( "designer_newform.png" , KDevDesignerPartFactory::instance()) ); + fi->setDragEnabled( FALSE ); + fi = new FormItem( tView, i18n( "Main Window" ) ); + allItems.append( fi ); + fi->setFormType( FormItem::MainWindow ); + fi->setPixmap( BarIcon( "designer_newform.png" , KDevDesignerPartFactory::instance()) ); + fi->setDragEnabled( FALSE ); + + QString templPath = templatePath; + QStringList templRoots; + const char *qtdir = getenv( "QTDIR" ); + if(qtdir) + templRoots << qtdir; + templRoots << qInstallPathData(); + if(qtdir) //try the tools/designer directory last! + templRoots << (QString(qtdir) + "/tools/designer"); + for ( QStringList::Iterator it = templRoots.begin(); it != templRoots.end(); ++it ) { + QString path = (*it) + "/templates"; + if ( QFile::exists( path )) { + templPath = path; + break; + } + } + if ( !templPath.isEmpty() ) { + QDir dir( templPath ); + const QFileInfoList *filist = dir.entryInfoList( QDir::DefaultFilter, QDir::DirsFirst | QDir::Name ); + if ( filist ) { + QFileInfoListIterator it( *filist ); + QFileInfo *fi; + while ( ( fi = it.current() ) != 0 ) { + ++it; + if ( !fi->isFile() || fi->extension() != "ui" ) + continue; + QString name = fi->baseName(); + name = name.replace( '_', ' ' ); + CustomFormItem *ci = new CustomFormItem( tView, name ); + allItems.append( ci ); + ci->setDragEnabled( FALSE ); + ci->setPixmap( BarIcon( "designer_newform.png" , KDevDesignerPartFactory::instance()) ); + ci->setTemplateFile( fi->absFilePath() ); + } + } + } + } + + for ( it = languages.begin(); it != languages.end(); ++it ) { + LanguageInterface *iface = MetaDataBase::languageInterface( *it ); + if ( iface ) { + QMap extensionMap; + iface->preferedExtensions( extensionMap ); + for ( QMap::Iterator eit = extensionMap.begin(); + eit != extensionMap.end(); ++eit ) { + SourceFileItem * si = new SourceFileItem( tView, *eit ); + allItems.append( si ); + si->setExtension( eit.key() ); + si->setLanguage( *it ); + si->setPixmap( BarIcon( "designer_filenew.png", KDevDesignerPartFactory::instance() ) ); + si->setDragEnabled( FALSE ); + } + iface->release(); + } + } + + if ( !MainWindow::self->singleProjectMode() ) { + QStringList sourceTemplates = MainWindow::self->sourceTemplates(); + for ( QStringList::Iterator sit = sourceTemplates.begin(); sit != sourceTemplates.end(); ++sit ) { + SourceTemplateInterface *siface = MainWindow::self->sourceTemplateInterface( *sit ); + if ( !siface ) + continue; + SourceTemplateItem * si = new SourceTemplateItem( tView, *sit ); + allItems.append( si ); + si->setTemplate( *sit ); + si->setLanguage( siface->language( *sit ) ); + si->setPixmap( BarIcon( "designer_filenew.png", KDevDesignerPartFactory::instance() ) ); + si->setDragEnabled( FALSE ); + siface->release(); + } + } + + tView->viewport()->setFocus(); + tView->setCurrentItem( cur ); + + if ( MainWindow::self->singleProjectMode() ) + adjustSize(); +} + +NewForm::NewForm( QIconView *templateView, const QString &templatePath ) +{ + insertTemplates( templateView, templatePath ); + projectChanged( i18n( "" ) ); +} + +NewForm::NewForm( QWidget *parent, const QStringList& projects, + const QString& currentProject, const QString &templatePath ) + : NewFormBase( parent, 0, TRUE ) +{ + connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + + projectCombo->insertStringList( projects ); + projectCombo->setCurrentText( currentProject ); + + insertTemplates( templateView, templatePath ); + + projectChanged( projectCombo->currentText() ); +} + +void NewForm::accept() +{ + if ( !templateView->currentItem() ) + return; + Project *pro = MainWindow::self->findProject( projectCombo->currentText() ); + if ( !pro ) + return; + MainWindow::self->setCurrentProject( pro ); + NewFormBase::accept(); + ( (NewItem*)templateView->currentItem() )->insert( pro ); +} + +void NewForm::projectChanged( const QString &project ) +{ + Project *pro = MainWindow::self->findProject( project ); + if ( !pro ) + return; + QIconViewItem *i; + for ( i = allItems.first(); i; i = allItems.next() ) + ( (NewItem*)i )->setProject( pro ); + templateView->setCurrentItem( templateView->firstItem() ); + templateView->arrangeItemsInGrid( TRUE ); +} + +void NewForm::itemChanged( QIconViewItem *item ) +{ + labelProject->setEnabled( item->rtti() != NewItem::ProjectType ); + projectCombo->setEnabled( item->rtti() != NewItem::ProjectType ); +} + +QPtrList NewForm::allViewItems() +{ + return allItems; +} diff --git a/kdevdesigner/designer/newformimpl.h b/kdevdesigner/designer/newformimpl.h new file mode 100644 index 00000000..acd597bf --- /dev/null +++ b/kdevdesigner/designer/newformimpl.h @@ -0,0 +1,164 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef NEWFORMIMPL_H +#define NEWFORMIMPL_H + +#include "newform.h" +#include + +class Project; + +class NewItem : public QIconViewItem +{ +public: + enum Type { + ProjectType, + Form, + CustomForm, + SourceFileType, + SourceTemplateType + }; + + NewItem( QIconView *view, const QString &text ) + : QIconViewItem( view, text ) {} + virtual void insert( Project *pro ) = 0; + virtual void setProject( Project * ) {} + +}; + +class ProjectItem : public NewItem +{ +public: + ProjectItem( QIconView *view, const QString &text ); + void insert( Project *pro ); + int rtti() const { return (int)ProjectType; } + + void setLanguage( const QString &l ) { lang = l; } + QString language() const { return lang; } + +private: + QString lang; + +}; + +class FormItem : public NewItem +{ +public: + enum FormType { + Widget, + Dialog, + Wizard, + MainWindow + }; + + FormItem( QIconView *view, const QString &text ); + void insert( Project *pro ); + int rtti() const { return (int)Form; } + + void setFormType( FormType ft ) { fType = ft; } + FormType formType() const { return fType; } + +private: + FormType fType; + +}; + +class CustomFormItem : public NewItem +{ +public: + CustomFormItem( QIconView *view, const QString &text ); + void insert( Project *pro ); + int rtti() const { return (int)CustomForm; } + + void setTemplateFile( const QString &tf ) { templFile = tf; } + QString templateFileName() const { return templFile; } + +private: + QString templFile; + +}; + +class SourceFileItem : public NewItem +{ +public: + SourceFileItem( QIconView *view, const QString &text ); + void insert( Project *pro ); + int rtti() const { return (int)SourceFileType; } + + void setExtension( const QString &e ) { ext = e; } + QString extension() const { return ext; } + void setLanguage( const QString &l ) { lang = l; } + void setProject( Project *pro ); + +private: + QString ext; + QString lang; + bool visible; + +}; + +class SourceTemplateItem : public NewItem +{ +public: + SourceTemplateItem( QIconView *view, const QString &text ); + void insert( Project *pro ); + int rtti() const { return (int)SourceTemplateType; } + + void setTemplate( const QString &t ) { templ = t; } + QString tenplate() const { return templ; } + void setLanguage( const QString &l ) { lang = l; } + void setProject( Project *pro ); + +private: + QString templ; + QString lang; + bool visible; + +}; + +class NewForm : public NewFormBase +{ + Q_OBJECT + +public: + NewForm( QIconView *templateView, const QString &templatePath ); + NewForm( QWidget *parent, const QStringList& projects, + const QString& currentProject, const QString &templatePath ); + void insertTemplates( QIconView*, const QString& ); + void accept(); + QPtrList allViewItems(); + +protected slots: + void projectChanged( const QString &project ); + void itemChanged( QIconViewItem *item ); + +private: + QPtrList allItems; + +}; + +#endif diff --git a/kdevdesigner/designer/orderindicator.cpp b/kdevdesigner/designer/orderindicator.cpp new file mode 100644 index 00000000..08ed16b8 --- /dev/null +++ b/kdevdesigner/designer/orderindicator.cpp @@ -0,0 +1,112 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler need this here + +#include "orderindicator.h" +#include "formwindow.h" + +#include +#include +#include + +OrderIndicator::OrderIndicator( int i, QWidget* w, FormWindow *fw ) + : QWidget( fw, "order_indicator", WMouseNoMask ), formWindow( fw ) +{ + order = -1; + widget = w; + setBackgroundMode( NoBackground ); + setAutoMask( TRUE ); + setOrder( i, w ); +} + + +OrderIndicator::~OrderIndicator() +{ +} + + +void OrderIndicator::setOrder( int i, QWidget* wid ) +{ + if ( widget != wid ) + return; + if ( !wid->isVisibleTo( formWindow ) ) { + hide(); + return; + } + + if ( order == i ) { + show(); + raise(); + return; + } + order = i; + int w = fontMetrics().width( QString::number( i ) ) + 10; + int h = fontMetrics().lineSpacing() * 3 / 2; + QFont f( font() ); + f.setBold( TRUE ); + setFont( f ); + resize( QMAX( w, h ), h ); + update(); // in case the size didn't change + reposition(); + show(); + raise(); +} + +void OrderIndicator::reposition() +{ + QPoint p =parentWidget()->mapFromGlobal( widget->mapToGlobal( widget->rect().topLeft() ) ); + move( p - QPoint( width()/3, height()/3 ) ); +} + + +void OrderIndicator::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); + p.setPen( white ); + p.setBrush( blue ); + p.drawEllipse( rect() ); + p.drawText( rect(), AlignCenter, QString::number( order ) ); +} + + +void OrderIndicator::updateMask() +{ + QBitmap bm( size() ); + bm.fill( color0 ); + { + QPainter p( &bm, this ); + p.setPen( color1 ); + p.setBrush( color1 ); + p.drawEllipse( rect() ); + } + setMask( bm ); +} + +void OrderIndicator::mousePressEvent( QMouseEvent *e ) +{ + QApplication::sendEvent( widget, e ); +} diff --git a/kdevdesigner/designer/orderindicator.h b/kdevdesigner/designer/orderindicator.h new file mode 100644 index 00000000..35962b7a --- /dev/null +++ b/kdevdesigner/designer/orderindicator.h @@ -0,0 +1,57 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ORDERINDICATOR_H +#define ORDERINDICATOR_H + +#include + +class FormWindow; + +class OrderIndicator : public QWidget +{ + Q_OBJECT + +public: + OrderIndicator( int i, QWidget* w, FormWindow* fw ); + ~OrderIndicator(); + + void setOrder( int i, QWidget* w ); + void reposition(); + +protected: + void paintEvent( QPaintEvent * ); + void mousePressEvent( QMouseEvent *e ); + void updateMask(); + +private: + int order; + QWidget* widget; + FormWindow *formWindow; + +}; + +#endif diff --git a/kdevdesigner/designer/outputwindow.cpp b/kdevdesigner/designer/outputwindow.cpp new file mode 100644 index 00000000..f51a54a3 --- /dev/null +++ b/kdevdesigner/designer/outputwindow.cpp @@ -0,0 +1,209 @@ +/********************************************************************** +** Copyright (C) 2001-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "outputwindow.h" +#include "designerappiface.h" +#include "metadatabase.h" +#include "mainwindow.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +static QTextEdit *debugoutput = 0; +bool debugToStderr = FALSE; + +QtMsgHandler OutputWindow::oldMsgHandler = 0; + +OutputWindow::OutputWindow( QWidget *parent ) + : QTabWidget( parent, "output_window" ), debugView( 0 ), errorView( 0 ) +{ + setupDebug(); + setupError(); + iface = new DesignerOutputDockImpl( this ); +} + +OutputWindow::~OutputWindow() +{ + debugoutput = debugView = 0; + errorView = 0; + if ( !debugToStderr ) + qInstallMsgHandler( oldMsgHandler ); + delete iface; +} + +void OutputWindow::shuttingDown() +{ + if ( !debugToStderr ) + qInstallMsgHandler( oldMsgHandler ); +} + +void OutputWindow::setupError() +{ + errorView = new QListView( this, "OutputWindow::errorView" ); + errorView->setSorting( -1 ); + connect( errorView, SIGNAL( currentChanged( QListViewItem* ) ), + this, SLOT( currentErrorChanged( QListViewItem* ) ) ); + connect( errorView, SIGNAL( clicked( QListViewItem* ) ), + this, SLOT( currentErrorChanged( QListViewItem* ) ) ); + + if ( MetaDataBase::languages().count() > 1 ) + addTab( errorView, i18n( "Warnings/Errors" ) ); + else + errorView->hide(); + errorView->addColumn( i18n( "Type" ) ); + errorView->addColumn( i18n( "Message" ) ); + errorView->addColumn( i18n( "Line" ) ); + errorView->addColumn( i18n( "Location" ) ); + errorView->setResizeMode( QListView::LastColumn ); + errorView->setColumnWidth( 0, errorView->fontMetrics().width( "WARNING1234" ) ); + errorView->setColumnWidth( 1, errorView->fontMetrics().width( "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP" ) ); + errorView->setColumnWidth( 2, errorView->fontMetrics().width( "9999999" ) ); + errorView->setColumnAlignment( 2, Qt::AlignRight ); + errorView->setAllColumnsShowFocus( TRUE ); +} + +static void debugMessageOutput( QtMsgType type, const char *msg ) +{ + QString s( msg ); + s += "\n"; + + if ( type != QtFatalMsg ) { + if ( debugoutput && debugoutput->isVisible() ) + debugoutput->append( s ); + else if ( OutputWindow::oldMsgHandler && OutputWindow::oldMsgHandler != debugMessageOutput ) + (*OutputWindow::oldMsgHandler)( type, msg ); + else + fputs( s.latin1(), stderr ); + } else { + fputs( s.latin1(), stderr ); + abort(); + } + + qApp->flush(); +} + +void OutputWindow::setupDebug() +{ + debugoutput = debugView = new QTextEdit( this, "OutputWindow::debugView" ); + //debugView->setReadOnly( TRUE ); + addTab( debugView, "Debug Output" ); + + if ( !debugToStderr ) + oldMsgHandler = qInstallMsgHandler( debugMessageOutput ); +} + +void OutputWindow::setErrorMessages( const QStringList &errors, const QValueList &lines, + bool clear, const QStringList &locations, + const QObjectList &locationObjects ) +{ + if ( clear ) + errorView->clear(); + QStringList::ConstIterator mit = errors.begin(); + QValueList::ConstIterator lit = lines.begin(); + QStringList::ConstIterator it = locations.begin(); + QObjectList objects = (QObjectList)locationObjects; + QObject *o = objects.first(); + QListViewItem *after = 0; + for ( ; lit != lines.end() && mit != errors.end(); ++lit, ++mit, ++it, o = objects.next() ) + after = new ErrorItem( errorView, after, *mit, *lit, *it, o ); + setCurrentPage( 1 ); +} + +DesignerOutputDock *OutputWindow::iFace() +{ + return iface; +} + +void OutputWindow::appendDebug( const QString &text ) +{ + debugView->append( text + "\n" ); +} + +void OutputWindow::clearErrorMessages() +{ + errorView->clear(); +} + +void OutputWindow::clearDebug() +{ + debugView->clear(); +} + +void OutputWindow::showDebugTab() +{ + showPage( debugView ); +} + +void OutputWindow::currentErrorChanged( QListViewItem *i ) +{ + if ( !i ) + return; + ErrorItem *ei = (ErrorItem*)i; + ei->setRead( TRUE ); + MainWindow::self->showSourceLine( ei->location(), ei->line() - 1, MainWindow::Error ); +} + + + +ErrorItem::ErrorItem( QListView *parent, QListViewItem *after, const QString &message, int line, + const QString &locationString, QObject *locationObject ) + : QListViewItem( parent, after ) +{ + setMultiLinesEnabled( TRUE ); + QString m( message ); + type = m.startsWith( "Warning: " ) ? Warning : Error; + m = m.mid( m.find( ':' ) + 1 ); + setText( 0, type == Error ? "Error" : "Warning" ); + setText( 1, m ); + setText( 2, QString::number( line ) ); + setText( 3, locationString ); + object = locationObject; + read = !after; + if ( !after ) { + parent->setSelected( this, TRUE ); + parent->setCurrentItem( this ); + } +} + +void ErrorItem::paintCell( QPainter *p, const QColorGroup & cg, + int column, int width, int alignment ) +{ + QColorGroup g( cg ); + g.setColor( QColorGroup::Text, type == Error ? Qt::red : Qt::darkYellow ); + if ( !read ) { + QFont f( p->font() ); + f.setBold( TRUE ); + p->setFont( f ); + } + QListViewItem::paintCell( p, g, column, width, alignment ); +} diff --git a/kdevdesigner/designer/outputwindow.h b/kdevdesigner/designer/outputwindow.h new file mode 100644 index 00000000..e61c92c0 --- /dev/null +++ b/kdevdesigner/designer/outputwindow.h @@ -0,0 +1,98 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef OUTPUTWINDOW_H +#define OUTPUTWINDOW_H + +#include +#include +#include +#include + +struct DesignerOutputDock; +class QTextEdit; +class QListView; + +class ErrorItem : public QListViewItem +{ +public: + enum Type { Error, Warning }; + + ErrorItem( QListView *parent, QListViewItem *after, const QString &message, int line, + const QString &locationString, QObject *locationObject ); + + void paintCell( QPainter *, const QColorGroup & cg, + int column, int width, int alignment ); + + void setRead( bool b ) { read = b; repaint(); } + + QObject *location() const { return object; } + int line() const { return text( 2 ).toInt(); } + +private: + QObject *object; + Type type; + bool read; + +}; + +class OutputWindow : public QTabWidget +{ + Q_OBJECT + +public: + OutputWindow( QWidget *parent ); + ~OutputWindow(); + + void setErrorMessages( const QStringList &errors, const QValueList &lines, + bool clear, const QStringList &locations, + const QObjectList &locationObjects ); + void appendDebug( const QString& ); + void clearErrorMessages(); + void clearDebug(); + void showDebugTab(); + + DesignerOutputDock *iFace(); + + void shuttingDown(); + + static QtMsgHandler oldMsgHandler; + +private slots: + void currentErrorChanged( QListViewItem *i ); + +private: + void setupError(); + void setupDebug(); + + QTextEdit *debugView; + QListView *errorView; + + DesignerOutputDock *iface; + +}; + +#endif diff --git a/kdevdesigner/designer/paletteeditor.ui b/kdevdesigner/designer/paletteeditor.ui new file mode 100644 index 00000000..8a87f0ea --- /dev/null +++ b/kdevdesigner/designer/paletteeditor.ui @@ -0,0 +1,496 @@ + +PaletteEditorBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + PaletteEditorBase + + + + 0 + 0 + 449 + 443 + + + + + 7 + 7 + + + + Edit Palette + + + + unnamed + + + 11 + + + 6 + + + + groupAutoPalette + + + + 5 + 4 + + + + Build Palette + + + AlignAuto + + + + unnamed + + + 11 + + + 6 + + + + labelMainColor + + + + 1 + 1 + + + + + 50 + 0 + + + + 1 + + + 0 + + + 0 + + + &3-D effects: + + + AlignAuto|AlignVCenter + + + buttonMainColor + + + + + buttonMainColor + + + + 0 + 0 + + + + StrongFocus + + + false + + + Choose a color + + + Choose the effect-color for the generated palette. + + + + + labelMainColor2 + + + + 1 + 1 + + + + + 50 + 0 + + + + 1 + + + 0 + + + 0 + + + Back&ground: + + + AlignAuto|AlignVCenter + + + buttonMainColor2 + + + + + buttonMainColor2 + + + + 0 + 0 + + + + StrongFocus + + + false + + + Choose a color + + + Choose the background color for the generated palette. + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + btnAdvanced + + + &Tune Palette... + + + + + + + GroupBox126 + + + + 5 + 7 + + + + Preview + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Select &palette: + + + paletteCombo + + + + + + Active Palette + + + + + Inactive Palette + + + + + Disabled Palette + + + + paletteCombo + + + + + + + previewFrame + + + + 7 + 7 + + + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing11 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + StyledButton +
      styledbutton.h
      + + 40 + 25 + + 0 + + 5 + 5 + + "image0" + clicked() + changed() + color + pixmap + scale +
      + + PreviewFrame +
      previewframe.h
      + + 200 + 200 + + 0 + + 5 + 5 + + "image1" +
      +
      + + + 789c9dd2cb8e9b301406e07d9e0225bba89a09601350d505302c5b7559a9eac23e6672b363620c0ca9faeef53949da2e2a55eab123f9e38f2f217e5e475f3e7f8cd6cf8bde0b7f8008f6c2456b3518337ffdf6e1fb62992451e8691ac5cb778be55304d1277b6e71fc12c6ab0d157222e61bd8e4c812196f6216535a13f318624a6764b2495842e99558249014c81e99c6294b69d3376291424ae9806431638cd28628183081f4489e70ce13e4852878c129ad905992f18cd291283295517a466ed32ddfa64847945bb595c80e99a739cf29d54499ab9c528b2c58c10b86344428540148400a26b8a0541241b482d215523299494a0551c9562ae409091c32e0c82351410b942aa4e22a53941e882d36e41ed966d8903b2215f215f99a6143b6442afaafff5aff485658622584a091941256948443d1cabbdd6ebf3f28753c09a9e9cdc1fe703c9e4ea19f689a0430fa4c8908082be093d08d016bbb0bbd5e7ceafade5b30de19d083b3fa9e008cd39b9fafd69495b473af7fcfb15325c1d61eea0afaf005ddf97b5295c658a866338f97591babef7340fa396c6c5ca9e7fe650807d0bf566b4262299986ba335a3b4a2cc84b69ac85b1b673037d8fabf95b023a9c09cc7530e104dd5419ed6e27083fb09a7c752db5a9bd31cde4ec634ed8a39aebbe337618c3f6fdc5dee6d8b0bb0d6b5b8b1fad43d78fe4e14e3f6aace8e29d9d736777fea3c686eee0138c9726d4d00c548df7a315ff750f7ebc5ffc04a0e5308d + + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + + + buttonMainColor2 + clicked() + PaletteEditorBase + onChoose2ndMainColor() + + + paletteCombo + activated(int) + PaletteEditorBase + paletteSelected(int) + + + btnAdvanced + clicked() + PaletteEditorBase + onTune() + + + buttonOk + clicked() + PaletteEditorBase + accept() + + + buttonCancel + clicked() + PaletteEditorBase + reject() + + + buttonMainColor + changed() + PaletteEditorBase + onChooseMainColor() + + + buttonMainColor + clicked() + PaletteEditorBase + onChooseMainColor() + + + buttonMainColor2 + changed() + PaletteEditorBase + onChoose2ndMainColor() + + init() + destroy() + onTune() + onChoose2ndMainColor() + onChooseMainColor() + paletteSelected(int) + + + buttonOk + buttonCancel + buttonMainColor + buttonMainColor2 + btnAdvanced + paletteCombo + buttonHelp + +
      diff --git a/kdevdesigner/designer/paletteeditoradvanced.ui b/kdevdesigner/designer/paletteeditoradvanced.ui new file mode 100644 index 00000000..faa211c1 --- /dev/null +++ b/kdevdesigner/designer/paletteeditoradvanced.ui @@ -0,0 +1,748 @@ + +PaletteEditorAdvancedBase +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + PaletteEditorAdvancedBase + + + true + + + + 0 + 0 + 327 + 341 + + + + Tune Palette + + + true + + + <b>Edit Palette</b><p>Change the current widget or form's palette.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p> + + + + unnamed + + + 11 + + + 6 + + + + Layout14 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + MShape + + + MShadow + + + Select &palette: + + + paletteCombo + + + + + + Active Palette + + + + + Inactive Palette + + + + + Disabled Palette + + + + paletteCombo + + + + + + + ButtonGroup1 + + + + 5 + 4 + + + + Auto + + + + unnamed + + + 11 + + + 6 + + + + checkBuildInactive + + + Build the &inactive palette from the active palette + + + true + + + + + checkBuildDisabled + + + Build the &disabled palette from the active palette + + + true + + + + + + + groupCentral + + + Central Color Roles + + + + unnamed + + + 11 + + + 6 + + + + + Background + + + + + Foreground + + + + + Button + + + + + Base + + + + + Text + + + + + BrightText + + + + + ButtonText + + + + + Highlight + + + + + HighlightText + + + + + Link + + + + + LinkVisited + + + + comboCentral + + + Choose the central color role + + + <b>Select a color role.</b><p>Available central color roles are: <ul> <li>Background - general background color.</li> <li>Foreground - general foreground color. </li> <li>Base - used as the background color for example, for text entry widgets; it is usually white or another light color. </li> <li>Text - the forground color used with Base. Usually this is the same as the Foreground, in which case it must provide good contrast both with the Background and with the Base. </li> <li>Button - general button background color; useful where buttons need a background different from Background, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color used to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from Foreground and contrasts well with, for example, black. </li> </ul> </p> + + + + + Layout32_2 + + + + unnamed + + + 0 + + + 6 + + + + Horizontal_Spacing1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + labelPixmap + + + + 1 + 1 + + + + Choose pi&xmap: + + + buttonPixmap + + + + + buttonPixmap + + + + 0 + 0 + + + + TabFocus + + + true + + + Select a pixmap + + + Choose a pixmap file for the selected central color role. + + + + + labelCentral + + + + 1 + 1 + + + + + 0 + 0 + + + + &Select color: + + + buttonCentral + + + + + buttonCentral + + + + 0 + 0 + + + + TabFocus + + + false + + + Choose a color + + + Choose a color for the selected central color role. + + + + + + + + + groupEffect + + + 3-D Shadow Effects + + + + unnamed + + + 11 + + + 6 + + + + Layout32_3 + + + + unnamed + + + 0 + + + 6 + + + + checkBuildEffect + + + Build &from button color: + + + true + + + Generate shadings + + + Check to let 3D-effect colors be calculated from the button-color. + + + + + + Light + + + + + Midlight + + + + + Mid + + + + + Dark + + + + + Shadow + + + + comboEffect + + + Choose 3D-effect color role + + + <b>Select a color effect role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul> + + + + + + + Layout31_2 + + + + unnamed + + + 0 + + + 6 + + + + Horizontal_Spacing3 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + labelEffect + + + + 1 + 1 + + + + + 0 + 0 + + + + Select co&lor: + + + buttonEffect + + + + + buttonEffect + + + + 0 + 0 + + + + TabFocus + + + false + + + Choose a color + + + Choose a color for the selected effect color role. + + + + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal_Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + StyledButton +
      styledbutton.h
      + + 40 + 25 + + 0 + + 5 + 5 + + "image0" + clicked() + changed() + color + pixmap + scale +
      +
      + + + 789c9dd2cb8e9b301406e07d9e0225bba89a09601350d505302c5b7559a9eac23e6672b363620c0ca9faeef53949da2e2a55eab123f9e38f2f217e5e475f3e7f8cd6cf8bde0b7f8008f6c2456b3518337ffdf6e1fb62992451e8691ac5cb778be55304d1277b6e71fc12c6ab0d157222e61bd8e4c812196f6216535a13f318624a6764b2495842e99558249014c81e99c6294b69d3376291424ae9806431638cd28628183081f4489e70ce13e4852878c129ad905992f18cd291283295517a466ed32ddfa64847945bb595c80e99a739cf29d54499ab9c528b2c58c10b86344428540148400a26b8a0541241b482d215523299494a0551c9562ae409091c32e0c82351410b942aa4e22a53941e882d36e41ed966d8903b2215f215f99a6143b6442afaafff5aff485658622584a091941256948443d1cabbdd6ebf3f28753c09a9e9cdc1fe703c9e4ea19f689a0430fa4c8908082be093d08d016bbb0bbd5e7ceafade5b30de19d083b3fa9e008cd39b9fafd69495b473af7fcfb15325c1d61eea0afaf005ddf97b5295c658a866338f97591babef7340fa396c6c5ca9e7fe650807d0bf566b4262299986ba335a3b4a2cc84b69ac85b1b673037d8fabf95b023a9c09cc7530e104dd5419ed6e27083fb09a7c752db5a9bd31cde4ec634ed8a39aebbe337618c3f6fdc5dee6d8b0bb0d6b5b8b1fad43d78fe4e14e3f6aace8e29d9d736777fea3c686eee0138c9726d4d00c548df7a315ff750f7ebc5ffc04a0e5308d + + + + + buttonOk + clicked() + PaletteEditorAdvancedBase + accept() + + + buttonCancel + clicked() + PaletteEditorAdvancedBase + reject() + + + paletteCombo + activated(int) + PaletteEditorAdvancedBase + paletteSelected(int) + + + comboCentral + activated(int) + PaletteEditorAdvancedBase + onCentral(int) + + + buttonPixmap + clicked() + PaletteEditorAdvancedBase + onChoosePixmap() + + + buttonCentral + clicked() + PaletteEditorAdvancedBase + onChooseCentralColor() + + + buttonEffect + clicked() + PaletteEditorAdvancedBase + onChooseEffectColor() + + + comboEffect + activated(int) + PaletteEditorAdvancedBase + onEffect(int) + + + checkBuildEffect + toggled(bool) + PaletteEditorAdvancedBase + onToggleBuildEffects(bool) + + + buttonHelp + clicked() + PaletteEditorAdvancedBase + showHelp() + + + checkBuildEffect + toggled(bool) + comboEffect + setDisabled(bool) + + + checkBuildEffect + toggled(bool) + buttonEffect + setDisabled(bool) + + + checkBuildInactive + toggled(bool) + PaletteEditorAdvancedBase + onToggleBuildInactive(bool) + + + checkBuildDisabled + toggled(bool) + PaletteEditorAdvancedBase + onToggleBuildDisabled(bool) + + init() + destroy() + onToggleBuildDisabled(bool) + onCentral(int) + onChooseCentralColor() + onChooseEffectColor() + onChoosePixmap() + onEffect(int) + onToggleBuildEffects(bool) + onToggleBuildInactive(bool) + paletteSelected(int) + showHelp() + + + buttonOk + buttonCancel + paletteCombo + checkBuildInactive + checkBuildDisabled + comboCentral + buttonPixmap + buttonCentral + checkBuildEffect + comboEffect + buttonEffect + buttonHelp + +
      diff --git a/kdevdesigner/designer/paletteeditoradvancedimpl.cpp b/kdevdesigner/designer/paletteeditoradvancedimpl.cpp new file mode 100644 index 00000000..8faebba4 --- /dev/null +++ b/kdevdesigner/designer/paletteeditoradvancedimpl.cpp @@ -0,0 +1,643 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "paletteeditoradvancedimpl.h" +#include "styledbutton.h" +#include "mainwindow.h" +#include "formwindow.h" + +#include +#include +#include +#include +#include +#include +#include + +/*! + Class used by PaletteEditor for bold combobox items +*/ + +class BoldListBoxText : public QListBoxText +{ +public: + BoldListBoxText( QString text, QListBox* lb = 0 ); + +protected: + virtual void paint( QPainter* ); +}; + +BoldListBoxText::BoldListBoxText( QString text, QListBox* lb ) + : QListBoxText( lb ) +{ + setText( text ); +} + +void BoldListBoxText::paint( QPainter* painter ) +{ + QFont f = painter->font(); + f.setBold( TRUE ); + painter->setFont( f ); + + QListBoxText::paint( painter ); +} + +PaletteEditorAdvanced::PaletteEditorAdvanced( FormWindow *fw, QWidget * parent, + const char * name, bool modal, WFlags f ) + : PaletteEditorAdvancedBase( parent, name, modal, f ), formWindow( fw ), selectedPalette(0) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + + buttonPixmap->setEditor( StyledButton::PixmapEditor ); + + editPalette = QApplication::palette(); + setPreviewPalette( editPalette ); + + buttonPixmap->setFormWindow( formWindow ); + + // force toggle event + checkBuildEffect->setChecked(FALSE); + checkBuildEffect->setChecked(TRUE); +} + +PaletteEditorAdvanced::~PaletteEditorAdvanced() +{ +} + +void PaletteEditorAdvanced::onToggleBuildInactive( bool v ) +{ + if (selectedPalette == 1) { + groupCentral->setDisabled(v); + groupEffect->setDisabled(v); + } + + if (v) { + buildInactive(); + updateStyledButtons(); + } +} + +void PaletteEditorAdvanced::onToggleBuildDisabled( bool v ) +{ + if (selectedPalette == 2) { + groupCentral->setDisabled(v); + groupEffect->setDisabled(v); + } + + if (v) { + buildDisabled(); + updateStyledButtons(); + } +} + +void PaletteEditorAdvanced::paletteSelected(int p) +{ + selectedPalette = p; + + if(p == 1) { // inactive + groupCentral->setDisabled(checkBuildInactive->isChecked()); + groupEffect->setDisabled(checkBuildInactive->isChecked()); + } + else if (p == 2) { // disabled + groupCentral->setDisabled(checkBuildDisabled->isChecked()); + groupEffect->setDisabled(checkBuildDisabled->isChecked()); + } + else { + groupCentral->setEnabled(TRUE); + groupEffect->setEnabled(TRUE); + } + updateStyledButtons(); +} + +void PaletteEditorAdvanced::onChooseCentralColor() +{ + switch(selectedPalette) { + case 0: + default: + mapToActiveCentralRole( buttonCentral->color() ); + break; + case 1: + mapToInactiveCentralRole( buttonCentral->color() ); + break; + case 2: + mapToDisabledCentralRole( buttonCentral->color() ); + break; + } + updateStyledButtons(); +} + +void PaletteEditorAdvanced::onChooseEffectColor() +{ + switch(selectedPalette) { + case 0: + default: + mapToActiveEffectRole( buttonEffect->color() ); + break; + case 1: + mapToInactiveEffectRole( buttonEffect->color() ); + break; + case 2: + mapToDisabledEffectRole( buttonEffect->color() ); + break; + } + updateStyledButtons(); +} + +void PaletteEditorAdvanced::onChoosePixmap() +{ + if (buttonPixmap->pixmap()) { + switch(selectedPalette) { + case 0: + default: + mapToActivePixmapRole( *buttonPixmap->pixmap() ); + break; + case 1: + mapToInactivePixmapRole( *buttonPixmap->pixmap() ); + break; + case 2: + mapToDisabledPixmapRole( *buttonPixmap->pixmap() ); + break; + } + } + updateStyledButtons(); +} + +void PaletteEditorAdvanced::onToggleBuildEffects( bool on ) +{ + if (!on) return; + buildActiveEffect(); + buildInactiveEffect(); + buildDisabledEffect(); +} + +QColorGroup::ColorRole PaletteEditorAdvanced::centralFromItem( int item ) +{ + switch( item ) { + case 0: + return QColorGroup::Background; + case 1: + return QColorGroup::Foreground; + case 2: + return QColorGroup::Button; + case 3: + return QColorGroup::Base; + case 4: + return QColorGroup::Text; + case 5: + return QColorGroup::BrightText; + case 6: + return QColorGroup::ButtonText; + case 7: + return QColorGroup::Highlight; + case 8: + return QColorGroup::HighlightedText; + case 9: + return QColorGroup::Link; + case 10: + return QColorGroup::LinkVisited; + default: + return QColorGroup::NColorRoles; + } +} + +QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item ) +{ + switch( item ) { + case 0: + return QColorGroup::Light; + case 1: + return QColorGroup::Midlight; + case 2: + return QColorGroup::Mid; + case 3: + return QColorGroup::Dark; + case 4: + return QColorGroup::Shadow; + default: + return QColorGroup::NColorRoles; + } +} + +void PaletteEditorAdvanced::onCentral( int item ) +{ + QPixmap* p = 0; + QColor c; + + switch(selectedPalette) { + case 0: + default: + c = editPalette.active().color( centralFromItem(item) ); + p = editPalette.active().brush( centralFromItem(item) ).pixmap(); + break; + case 1: + c = editPalette.inactive().color( centralFromItem(item) ); + p = editPalette.inactive().brush( centralFromItem(item) ).pixmap(); + break; + case 2: + c = editPalette.disabled().color( centralFromItem(item) ); + p = editPalette.disabled().brush( centralFromItem(item) ).pixmap(); + break; + } + + buttonCentral->setColor(c); + + if (p) + buttonPixmap->setPixmap( *p ); + else + buttonPixmap->setPixmap( QPixmap() ); +} + +void PaletteEditorAdvanced::onEffect( int item ) +{ + QColor c; + switch(selectedPalette) { + case 0: + default: + c = editPalette.active().color( effectFromItem(item) ); + break; + case 1: + editPalette.inactive().color( effectFromItem(item) ); + break; + case 2: + editPalette.disabled().color( effectFromItem(item) ); + break; + } + buttonEffect->setColor(c); +} + +void PaletteEditorAdvanced::mapToActiveCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.active(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setActive( cg ); + + buildActiveEffect(); + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToActiveEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.active(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setActive( cg ); + + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToActivePixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.active(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + editPalette.setActive( cg ); + + + buildActiveEffect(); + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactiveCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.inactive(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setInactive( cg ); + + buildInactiveEffect(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactiveEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.inactive(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setInactive( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactivePixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.inactive(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + editPalette.setInactive( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.disabled(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.disabled(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setDisabled( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledPixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.disabled(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + + editPalette.setDisabled( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::buildActiveEffect() +{ + QColorGroup cg = editPalette.active(); + QColor btn = cg.color( QColorGroup::Button ); + + QPalette temp( btn, btn ); + + for (int i = 0; i<5; i++) + cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + + editPalette.setActive( cg ); + setPreviewPalette( editPalette ); + + updateStyledButtons(); +} + +void PaletteEditorAdvanced::buildInactive() +{ + editPalette.setInactive( editPalette.active() ); + buildInactiveEffect(); +} + +void PaletteEditorAdvanced::buildInactiveEffect() +{ + QColorGroup cg = editPalette.inactive(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setInactive( cg ); + setPreviewPalette( editPalette ); + updateStyledButtons(); +} + +void PaletteEditorAdvanced::buildDisabled() +{ + QColorGroup cg = editPalette.active(); + cg.setColor( QColorGroup::ButtonText, darkGray ); + cg.setColor( QColorGroup::Foreground, darkGray ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); +} + +void PaletteEditorAdvanced::buildDisabledEffect() +{ + QColorGroup cg = editPalette.disabled(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setDisabled( cg ); + setPreviewPalette( editPalette ); + updateStyledButtons(); +} + +void PaletteEditorAdvanced::setPreviewPalette( const QPalette& pal ) +{ + QColorGroup cg; + + switch (selectedPalette) { + case 0: + default: + cg = pal.active(); + break; + case 1: + cg = pal.inactive(); + break; + case 2: + cg = pal.disabled(); + break; + } + previewPalette.setActive( cg ); + previewPalette.setInactive( cg ); + previewPalette.setDisabled( cg ); +} + +void PaletteEditorAdvanced::updateStyledButtons() +{ + QColor central, effect; + QPixmap *pm = 0; + switch (selectedPalette) { + case 0: + default: + central = editPalette.active().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.active().color( effectFromItem( comboEffect->currentItem() ) ); + pm = editPalette.active().brush( centralFromItem( comboCentral->currentItem() ) ).pixmap(); + break; + case 1: + central = editPalette.inactive().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.inactive().color( effectFromItem( comboEffect->currentItem() ) ); + pm = editPalette.inactive().brush( centralFromItem( comboCentral->currentItem() ) ).pixmap(); + break; + case 2: + central = editPalette.disabled().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.disabled().color( effectFromItem( comboEffect->currentItem() ) ); + pm = editPalette.disabled().brush( centralFromItem( comboCentral->currentItem() ) ).pixmap(); + break; + } + + buttonCentral->setColor(central); + buttonEffect->setColor(effect); + if ( pm && !pm->isNull() ) + buttonPixmap->setPixmap( *pm ); + else + buttonPixmap->setPixmap(QPixmap()); +} + +void PaletteEditorAdvanced::setPal( const QPalette& pal ) +{ + editPalette = pal; + setPreviewPalette( pal ); + updateStyledButtons(); +} + +QPalette PaletteEditorAdvanced::pal() const +{ + return editPalette; +} + +void PaletteEditorAdvanced::setupBackgroundMode( BackgroundMode mode ) +{ + int initRole = 0; + + switch( mode ) { + case PaletteBackground: + initRole = 0; + break; + case PaletteForeground: + initRole = 1; + break; + case PaletteButton: + initRole = 2; + break; + case PaletteBase: + initRole = 3; + break; + case PaletteText: + initRole = 4; + break; + case PaletteBrightText: + initRole = 5; + break; + case PaletteButtonText: + initRole = 6; + break; + case PaletteHighlight: + initRole = 7; + break; + case PaletteHighlightedText: + initRole = 8; + break; + case PaletteLight: + initRole = 9; + break; + case PaletteMidlight: + initRole = 10; + break; + case PaletteDark: + initRole = 11; + break; + case PaletteMid: + initRole = 12; + break; + case PaletteShadow: + initRole = 13; + break; + default: + initRole = -1; + break; + } + + if ( initRole <= -1 ) return; + + if (initRole > 8 ) { + comboEffect->setCurrentItem( initRole - 9 ); + if ( comboEffect->listBox() ) { + QString text = comboEffect->currentText(); + comboEffect->listBox()->changeItem( new BoldListBoxText( text ), initRole - 9 ); + } + } + else { + comboCentral->setCurrentItem( initRole ); + if ( comboCentral->listBox() ) { + QString text = comboCentral->currentText(); + comboCentral->listBox()->changeItem( new BoldListBoxText( text ), initRole ); + } + } +} + +QPalette PaletteEditorAdvanced::getPalette( bool *ok, const QPalette &init, + BackgroundMode mode, QWidget* parent, + const char* name, FormWindow *fw ) +{ + PaletteEditorAdvanced* dlg = new PaletteEditorAdvanced( fw, parent, name, TRUE ); + dlg->setupBackgroundMode( mode ); + + if ( init != QPalette() ) + dlg->setPal( init ); + int resultCode = dlg->exec(); + + QPalette result = init; + if ( resultCode == QDialog::Accepted ) { + if ( ok ) + *ok = TRUE; + result = dlg->pal(); + } else { + if ( ok ) + *ok = FALSE; + } + delete dlg; + return result; +} diff --git a/kdevdesigner/designer/paletteeditoradvancedimpl.h b/kdevdesigner/designer/paletteeditoradvancedimpl.h new file mode 100644 index 00000000..4f7076df --- /dev/null +++ b/kdevdesigner/designer/paletteeditoradvancedimpl.h @@ -0,0 +1,96 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PALETTEEDITORADVANCEDIMPL_H +#define PALETTEEDITORADVANCEDIMPL_H + +#include "paletteeditoradvanced.h" + +class FormWindow; + +class PaletteEditorAdvanced : public PaletteEditorAdvancedBase +{ + Q_OBJECT +public: + PaletteEditorAdvanced( FormWindow *fw, QWidget * parent=0, const char * name=0, + bool modal=FALSE, WFlags f=0 ); + ~PaletteEditorAdvanced(); + + static QPalette getPalette( bool *ok, const QPalette &pal, BackgroundMode mode = PaletteBackground, + QWidget* parent = 0, const char* name = 0, FormWindow *fw = 0 ); + +protected slots: + void paletteSelected(int); + + void onCentral( int ); + void onEffect( int ); + + void onChooseCentralColor(); + void onChooseEffectColor(); + void onChoosePixmap(); + + void onToggleBuildEffects( bool ); + void onToggleBuildInactive( bool ); + void onToggleBuildDisabled( bool ); + +protected: + void mapToActiveCentralRole( const QColor& ); + void mapToActiveEffectRole( const QColor& ); + void mapToActivePixmapRole( const QPixmap& ); + void mapToInactiveCentralRole( const QColor& ); + void mapToInactiveEffectRole( const QColor& ); + void mapToInactivePixmapRole( const QPixmap& ); + void mapToDisabledCentralRole( const QColor& ); + void mapToDisabledEffectRole( const QColor& ); + void mapToDisabledPixmapRole( const QPixmap& ); + + + void buildPalette(); + void buildActiveEffect(); + void buildInactive(); + void buildInactiveEffect(); + void buildDisabled(); + void buildDisabledEffect(); + +private: + void setPreviewPalette( const QPalette& ); + void updateStyledButtons(); + void setupBackgroundMode( BackgroundMode ); + + QPalette pal() const; + void setPal( const QPalette& ); + + QColorGroup::ColorRole centralFromItem( int ); + QColorGroup::ColorRole effectFromItem( int ); + QPalette editPalette; + QPalette previewPalette; + + FormWindow *formWindow; + + int selectedPalette; +}; + +#endif diff --git a/kdevdesigner/designer/paletteeditorimpl.cpp b/kdevdesigner/designer/paletteeditorimpl.cpp new file mode 100644 index 00000000..56e6fd2f --- /dev/null +++ b/kdevdesigner/designer/paletteeditorimpl.cpp @@ -0,0 +1,304 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "paletteeditorimpl.h" +#include "paletteeditoradvancedimpl.h" +#include "previewframe.h" +#include "styledbutton.h" +#include "mainwindow.h" +#include "formwindow.h" + +#include +#include +#include +#include + +PaletteEditor::PaletteEditor( FormWindow *fw, QWidget * parent, const char * name, bool modal, WFlags f ) + : PaletteEditorBase( parent, name, modal, f ), formWindow( fw ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + + editPalette = QApplication::palette(); + setPreviewPalette( editPalette ); + + buttonMainColor->setColor( editPalette.active().color( QColorGroup::Button ) ); + buttonMainColor2->setColor( editPalette.active().color( QColorGroup::Background ) ); +} + +PaletteEditor::~PaletteEditor() +{ +} + +void PaletteEditor::onTune() +{ + bool ok; + QPalette pal = PaletteEditorAdvanced::getPalette( &ok, editPalette, backgroundMode, this, "tune_palette", formWindow); + if (!ok) return; + + editPalette = pal; + setPreviewPalette( editPalette ); +} + +void PaletteEditor::onChooseMainColor() +{ + buildPalette(); +} + +void PaletteEditor::onChoose2ndMainColor() +{ + buildPalette(); +} + +void PaletteEditor::paletteSelected(int) +{ + setPreviewPalette(editPalette); +} + +QColorGroup::ColorRole PaletteEditor::centralFromItem( int item ) +{ + switch( item ) + { + case 0: + return QColorGroup::Background; + case 1: + return QColorGroup::Foreground; + case 2: + return QColorGroup::Button; + case 3: + return QColorGroup::Base; + case 4: + return QColorGroup::Text; + case 5: + return QColorGroup::BrightText; + case 6: + return QColorGroup::ButtonText; + case 7: + return QColorGroup::Highlight; + case 8: + return QColorGroup::HighlightedText; + default: + return QColorGroup::NColorRoles; + } +} + +QColorGroup::ColorRole PaletteEditor::effectFromItem( int item ) +{ + switch( item ) + { + case 0: + return QColorGroup::Light; + case 1: + return QColorGroup::Midlight; + case 2: + return QColorGroup::Mid; + case 3: + return QColorGroup::Dark; + case 4: + return QColorGroup::Shadow; + default: + return QColorGroup::NColorRoles; + } +} + +void PaletteEditor::buildPalette() +{ + int i; + QColorGroup cg; + QColor btn = buttonMainColor->color(); + QColor back = buttonMainColor2->color(); + QPalette automake( btn, back ); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) ); + + editPalette.setActive( cg ); + buildActiveEffect(); + + cg = editPalette.inactive(); + + QPalette temp( editPalette.active().color( QColorGroup::Button ), + editPalette.active().color( QColorGroup::Background ) ); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) ); + + editPalette.setInactive( cg ); + buildInactiveEffect(); + + cg = editPalette.disabled(); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) ); + + editPalette.setDisabled( cg ); + buildDisabledEffect(); + + updateStyledButtons(); +} + +void PaletteEditor::buildActiveEffect() +{ + QColorGroup cg = editPalette.active(); + QColor btn = cg.color( QColorGroup::Button ); + + QPalette temp( btn, btn ); + + for (int i = 0; i<5; i++) + cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + + editPalette.setActive( cg ); + setPreviewPalette( editPalette ); + + updateStyledButtons(); +} + +void PaletteEditor::buildInactive() +{ + editPalette.setInactive( editPalette.active() ); + buildInactiveEffect(); +} + +void PaletteEditor::buildInactiveEffect() +{ + QColorGroup cg = editPalette.inactive(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setInactive( cg ); + setPreviewPalette( editPalette ); + updateStyledButtons(); +} + +void PaletteEditor::buildDisabled() +{ + QColorGroup cg = editPalette.active(); + cg.setColor( QColorGroup::ButtonText, darkGray ); + cg.setColor( QColorGroup::Foreground, darkGray ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); +} + +void PaletteEditor::buildDisabledEffect() +{ + QColorGroup cg = editPalette.disabled(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setDisabled( cg ); + setPreviewPalette( editPalette ); + updateStyledButtons(); +} + +void PaletteEditor::setPreviewPalette( const QPalette& pal ) +{ + QColorGroup cg; + + switch (paletteCombo->currentItem()) { + case 0: + default: + cg = pal.active(); + break; + case 1: + cg = pal.inactive(); + break; + case 2: + cg = pal.disabled(); + break; + } + previewPalette.setActive( cg ); + previewPalette.setInactive( cg ); + previewPalette.setDisabled( cg ); + + previewFrame->setPreviewPalette(previewPalette); +} + +void PaletteEditor::updateStyledButtons() +{ + buttonMainColor->setColor( editPalette.active().color( QColorGroup::Button )); + buttonMainColor2->setColor( editPalette.active().color( QColorGroup::Background )); +} + +void PaletteEditor::setPal( const QPalette& pal ) +{ + editPalette = pal; + setPreviewPalette( pal ); + updateStyledButtons(); +} + +QPalette PaletteEditor::pal() const +{ + return editPalette; +} + +QPalette PaletteEditor::getPalette( bool *ok, const QPalette &init, BackgroundMode mode, + QWidget* parent, const char* name, FormWindow *fw ) +{ + PaletteEditor* dlg = new PaletteEditor( fw, parent, name, TRUE ); + dlg->setupBackgroundMode( mode ); + + if ( init != QPalette() ) + dlg->setPal( init ); + int resultCode = dlg->exec(); + + QPalette result = init; + if ( resultCode == QDialog::Accepted ) { + if ( ok ) + *ok = TRUE; + result = dlg->pal(); + } else { + if ( ok ) + *ok = FALSE; + } + delete dlg; + return result; +} diff --git a/kdevdesigner/designer/paletteeditorimpl.h b/kdevdesigner/designer/paletteeditorimpl.h new file mode 100644 index 00000000..fc3ee231 --- /dev/null +++ b/kdevdesigner/designer/paletteeditorimpl.h @@ -0,0 +1,76 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PALETTEEDITORIMPL_H +#define PALETTEEDITORIMPL_H + +#include "paletteeditor.h" + +class FormWindow; + +class PaletteEditor : public PaletteEditorBase +{ + Q_OBJECT + +public: + PaletteEditor( FormWindow *fw, QWidget * parent=0, const char * name=0, bool modal=FALSE, WFlags f=0 ); + ~PaletteEditor(); + + static QPalette getPalette( bool *ok, const QPalette &pal, BackgroundMode mode = PaletteBackground, + QWidget* parent = 0, const char* name = 0, FormWindow *fw = 0 ); + +protected slots: + void onChooseMainColor(); + void onChoose2ndMainColor(); + void onTune(); + void paletteSelected(int); + +protected: + void buildPalette(); + void buildActiveEffect(); + void buildInactive(); + void buildInactiveEffect(); + void buildDisabled(); + void buildDisabledEffect(); + +private: + void setPreviewPalette( const QPalette& ); + void updateStyledButtons(); + void setupBackgroundMode( BackgroundMode mode ) { backgroundMode = mode; } + + QPalette pal() const; + void setPal( const QPalette& ); + + QColorGroup::ColorRole centralFromItem( int ); + QColorGroup::ColorRole effectFromItem( int ); + QPalette editPalette; + QPalette previewPalette; + + FormWindow *formWindow; + BackgroundMode backgroundMode; +}; + +#endif diff --git a/kdevdesigner/designer/pics/Makefile.am b/kdevdesigner/designer/pics/Makefile.am new file mode 100644 index 00000000..8749186b --- /dev/null +++ b/kdevdesigner/designer/pics/Makefile.am @@ -0,0 +1,2 @@ +picsdirdir = $(kde_datadir)/kdevdesignerpart/pics +picsdir_DATA = designer_adjustsize.png designer_appicon.png designer_arrow.png designer_background.png designer_book.png designer_buttongroup.png designer_checkbox.png designer_combobox.png designer_connecttool.png designer_cross.png designer_customwidget.png designer_d_adjustsize.png designer_d_book.png designer_d_buttongroup.png designer_d_checkbox.png designer_d_combobox.png designer_d_connecttool.png designer_d_customwidget.png designer_d_databrowser.png designer_d_datatable.png designer_d_dataview.png designer_d_dateedit.png designer_d_datetimeedit.png designer_d_dial.png designer_d_down.png designer_d_editbreaklayout.png designer_d_editcopy.png designer_d_editcut.png designer_d_editdelete.png designer_d_editgrid.png designer_d_edithlayout.png designer_d_edithlayoutsplit.png designer_d_editlower.png designer_d_editpaste.png designer_d_editraise.png designer_d_editslots.png designer_d_editvlayout.png designer_d_editvlayoutsplit.png designer_d_filenew.png designer_d_fileopen.png designer_d_filesave.png designer_d_folder.png designer_d_form.png designer_d_frame.png designer_d_groupbox.png designer_d_help.png designer_d_home.png designer_d_iconview.png designer_d_image.png designer_d_label.png designer_d_layout.png designer_d_lcdnumber.png designer_d_left.png designer_d_line.png designer_d_lineedit.png designer_d_listbox.png designer_d_listview.png designer_d_multilineedit.png designer_d_newform.png designer_d_ordertool.png designer_d_pixlabel.png designer_d_pointer.png designer_d_print.png designer_d_progress.png designer_d_project.png designer_d_pushbutton.png designer_d_radiobutton.png designer_d_redo.png designer_d_richtextedit.png designer_d_right.png designer_d_scrollbar.png designer_d_searchfind.png designer_d_setbuddy.png designer_d_slider.png designer_d_spacer.png designer_d_spinbox.png designer_d_table.png designer_d_tabwidget.png designer_d_textbold.png designer_d_textbrowser.png designer_d_textcenter.png designer_d_textedit.png designer_d_textfont.png designer_d_texth1.png designer_d_texth2.png designer_d_texth3.png designer_d_textitalic.png designer_d_textjustify.png designer_d_textlarger.png designer_d_textleft.png designer_d_textlinebreak.png designer_d_textparagraph.png designer_d_textright.png designer_d_textsmaller.png designer_d_textteletext.png designer_d_textunderline.png designer_d_textview.png designer_d_timeedit.png designer_d_toolbox.png designer_d_toolbutton.png designer_d_undo.png designer_d_up.png designer_d_widgetstack.png designer_d_wizarddata.png designer_d_wizarddialog.png designer_d_wordwrap.png designer_databrowser.png designer_datatable.png designer_dataview.png designer_dateedit.png designer_datetimeedit.png designer_dial.png designer_down.png designer_editbreaklayout.png designer_editcopy.png designer_editcut.png designer_editdelete.png designer_editgrid.png designer_edithlayout.png designer_edithlayoutsplit.png designer_editlower.png designer_editpaste.png designer_editraise.png designer_editslots.png designer_editvlayout.png designer_editvlayoutsplit.png designer_filenew.png designer_fileopen.png designer_filesave.png designer_folder.png designer_form.png designer_frame.png designer_groupbox.png designer_hand.png designer_help.png designer_home.png designer_hsplit.png designer_ibeam.png designer_iconview.png designer_image.png designer_label.png designer_layout.png designer_lcdnumber.png designer_left.png designer_line.png designer_lineedit.png designer_listbox.png designer_listview.png designer_multilineedit.png designer_newform.png designer_no.png designer_object.png designer_ordertool.png designer_pixlabel.png designer_pointer.png designer_print.png designer_progress.png designer_project.png designer_pushbutton.png designer_qtlogo.png designer_radiobutton.png designer_redo.png designer_resetproperty.png designer_richtextedit.png designer_right.png designer_s_down.png designer_s_editcut.png designer_s_left.png designer_s_right.png designer_s_up.png designer_scrollbar.png designer_searchfind.png designer_setbuddy.png designer_sizeall.png designer_sizeb.png designer_sizef.png designer_sizeh.png designer_sizev.png designer_slider.png designer_spacer.png designer_spinbox.png designer_splash.png designer_table.png designer_tabwidget.png designer_textbold.png designer_textbrowser.png designer_textcenter.png designer_textedit.png designer_textfont.png designer_texth1.png designer_texth2.png designer_texth3.png designer_textitalic.png designer_textjustify.png designer_textlarger.png designer_textleft.png designer_textlinebreak.png designer_textparagraph.png designer_textright.png designer_textsmaller.png designer_textteletext.png designer_textunderline.png designer_textview.png designer_timeedit.png designer_toolbox.png designer_toolbutton.png designer_undo.png designer_up.png designer_uparrow.png designer_vsplit.png designer_wait.png designer_widgetstack.png designer_wizarddata.png designer_wizarddialog.png designer_wordwrap.png diff --git a/kdevdesigner/designer/pics/designer_adjustsize.png b/kdevdesigner/designer/pics/designer_adjustsize.png new file mode 100644 index 00000000..6ade1e22 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_adjustsize.png differ diff --git a/kdevdesigner/designer/pics/designer_appicon.png b/kdevdesigner/designer/pics/designer_appicon.png new file mode 100644 index 00000000..7aadcbad Binary files /dev/null and b/kdevdesigner/designer/pics/designer_appicon.png differ diff --git a/kdevdesigner/designer/pics/designer_arrow.png b/kdevdesigner/designer/pics/designer_arrow.png new file mode 100644 index 00000000..53921d83 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_arrow.png differ diff --git a/kdevdesigner/designer/pics/designer_background.png b/kdevdesigner/designer/pics/designer_background.png new file mode 100644 index 00000000..27d2e997 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_background.png differ diff --git a/kdevdesigner/designer/pics/designer_book.png b/kdevdesigner/designer/pics/designer_book.png new file mode 100644 index 00000000..dd850abb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_book.png differ diff --git a/kdevdesigner/designer/pics/designer_buttongroup.png b/kdevdesigner/designer/pics/designer_buttongroup.png new file mode 100644 index 00000000..d89e28fd Binary files /dev/null and b/kdevdesigner/designer/pics/designer_buttongroup.png differ diff --git a/kdevdesigner/designer/pics/designer_checkbox.png b/kdevdesigner/designer/pics/designer_checkbox.png new file mode 100644 index 00000000..ab6f53e0 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_checkbox.png differ diff --git a/kdevdesigner/designer/pics/designer_combobox.png b/kdevdesigner/designer/pics/designer_combobox.png new file mode 100644 index 00000000..7d4890a7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_combobox.png differ diff --git a/kdevdesigner/designer/pics/designer_connecttool.png b/kdevdesigner/designer/pics/designer_connecttool.png new file mode 100644 index 00000000..fca6748f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_connecttool.png differ diff --git a/kdevdesigner/designer/pics/designer_cross.png b/kdevdesigner/designer/pics/designer_cross.png new file mode 100644 index 00000000..d5e9f0c7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_cross.png differ diff --git a/kdevdesigner/designer/pics/designer_customwidget.png b/kdevdesigner/designer/pics/designer_customwidget.png new file mode 100644 index 00000000..ab790e1f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_customwidget.png differ diff --git a/kdevdesigner/designer/pics/designer_d_adjustsize.png b/kdevdesigner/designer/pics/designer_d_adjustsize.png new file mode 100644 index 00000000..d61ca7af Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_adjustsize.png differ diff --git a/kdevdesigner/designer/pics/designer_d_book.png b/kdevdesigner/designer/pics/designer_d_book.png new file mode 100644 index 00000000..5517f0c4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_book.png differ diff --git a/kdevdesigner/designer/pics/designer_d_buttongroup.png b/kdevdesigner/designer/pics/designer_d_buttongroup.png new file mode 100644 index 00000000..1e451a88 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_buttongroup.png differ diff --git a/kdevdesigner/designer/pics/designer_d_checkbox.png b/kdevdesigner/designer/pics/designer_d_checkbox.png new file mode 100644 index 00000000..1415eabb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_checkbox.png differ diff --git a/kdevdesigner/designer/pics/designer_d_combobox.png b/kdevdesigner/designer/pics/designer_d_combobox.png new file mode 100644 index 00000000..5fb44eff Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_combobox.png differ diff --git a/kdevdesigner/designer/pics/designer_d_connecttool.png b/kdevdesigner/designer/pics/designer_d_connecttool.png new file mode 100644 index 00000000..76a3b5f5 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_connecttool.png differ diff --git a/kdevdesigner/designer/pics/designer_d_customwidget.png b/kdevdesigner/designer/pics/designer_d_customwidget.png new file mode 100644 index 00000000..5ea648fb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_customwidget.png differ diff --git a/kdevdesigner/designer/pics/designer_d_databrowser.png b/kdevdesigner/designer/pics/designer_d_databrowser.png new file mode 100644 index 00000000..c1155c8c Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_databrowser.png differ diff --git a/kdevdesigner/designer/pics/designer_d_datatable.png b/kdevdesigner/designer/pics/designer_d_datatable.png new file mode 100644 index 00000000..7060dc3a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_datatable.png differ diff --git a/kdevdesigner/designer/pics/designer_d_dataview.png b/kdevdesigner/designer/pics/designer_d_dataview.png new file mode 100644 index 00000000..c507d416 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_dataview.png differ diff --git a/kdevdesigner/designer/pics/designer_d_dateedit.png b/kdevdesigner/designer/pics/designer_d_dateedit.png new file mode 100644 index 00000000..162e63a8 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_dateedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_datetimeedit.png b/kdevdesigner/designer/pics/designer_d_datetimeedit.png new file mode 100644 index 00000000..83dc2fc3 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_datetimeedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_dial.png b/kdevdesigner/designer/pics/designer_d_dial.png new file mode 100644 index 00000000..a84869e4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_dial.png differ diff --git a/kdevdesigner/designer/pics/designer_d_down.png b/kdevdesigner/designer/pics/designer_d_down.png new file mode 100644 index 00000000..57b407e4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_down.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editbreaklayout.png b/kdevdesigner/designer/pics/designer_d_editbreaklayout.png new file mode 100644 index 00000000..2a36d67d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editbreaklayout.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editcopy.png b/kdevdesigner/designer/pics/designer_d_editcopy.png new file mode 100644 index 00000000..500758d4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editcopy.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editcut.png b/kdevdesigner/designer/pics/designer_d_editcut.png new file mode 100644 index 00000000..8d50ae0a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editcut.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editdelete.png b/kdevdesigner/designer/pics/designer_d_editdelete.png new file mode 100644 index 00000000..f4d0f7a1 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editdelete.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editgrid.png b/kdevdesigner/designer/pics/designer_d_editgrid.png new file mode 100644 index 00000000..ad2b87b9 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editgrid.png differ diff --git a/kdevdesigner/designer/pics/designer_d_edithlayout.png b/kdevdesigner/designer/pics/designer_d_edithlayout.png new file mode 100644 index 00000000..dacaf82e Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_edithlayout.png differ diff --git a/kdevdesigner/designer/pics/designer_d_edithlayoutsplit.png b/kdevdesigner/designer/pics/designer_d_edithlayoutsplit.png new file mode 100644 index 00000000..00a96055 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_edithlayoutsplit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editlower.png b/kdevdesigner/designer/pics/designer_d_editlower.png new file mode 100644 index 00000000..a0a16b40 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editlower.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editpaste.png b/kdevdesigner/designer/pics/designer_d_editpaste.png new file mode 100644 index 00000000..d31071e9 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editpaste.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editraise.png b/kdevdesigner/designer/pics/designer_d_editraise.png new file mode 100644 index 00000000..5f7f04b9 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editraise.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editslots.png b/kdevdesigner/designer/pics/designer_d_editslots.png new file mode 100644 index 00000000..cd791b43 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editslots.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editvlayout.png b/kdevdesigner/designer/pics/designer_d_editvlayout.png new file mode 100644 index 00000000..ed202af7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editvlayout.png differ diff --git a/kdevdesigner/designer/pics/designer_d_editvlayoutsplit.png b/kdevdesigner/designer/pics/designer_d_editvlayoutsplit.png new file mode 100644 index 00000000..54ee44c0 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_editvlayoutsplit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_filenew.png b/kdevdesigner/designer/pics/designer_d_filenew.png new file mode 100644 index 00000000..d5e7061b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_filenew.png differ diff --git a/kdevdesigner/designer/pics/designer_d_fileopen.png b/kdevdesigner/designer/pics/designer_d_fileopen.png new file mode 100644 index 00000000..343f0039 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_fileopen.png differ diff --git a/kdevdesigner/designer/pics/designer_d_filesave.png b/kdevdesigner/designer/pics/designer_d_filesave.png new file mode 100644 index 00000000..5d1476d2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_filesave.png differ diff --git a/kdevdesigner/designer/pics/designer_d_folder.png b/kdevdesigner/designer/pics/designer_d_folder.png new file mode 100644 index 00000000..4bed3caf Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_folder.png differ diff --git a/kdevdesigner/designer/pics/designer_d_form.png b/kdevdesigner/designer/pics/designer_d_form.png new file mode 100644 index 00000000..9f89d654 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_form.png differ diff --git a/kdevdesigner/designer/pics/designer_d_frame.png b/kdevdesigner/designer/pics/designer_d_frame.png new file mode 100644 index 00000000..09b21b21 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_frame.png differ diff --git a/kdevdesigner/designer/pics/designer_d_groupbox.png b/kdevdesigner/designer/pics/designer_d_groupbox.png new file mode 100644 index 00000000..e7e01083 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_groupbox.png differ diff --git a/kdevdesigner/designer/pics/designer_d_help.png b/kdevdesigner/designer/pics/designer_d_help.png new file mode 100644 index 00000000..8f9d1826 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_help.png differ diff --git a/kdevdesigner/designer/pics/designer_d_home.png b/kdevdesigner/designer/pics/designer_d_home.png new file mode 100644 index 00000000..b3906a4f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_home.png differ diff --git a/kdevdesigner/designer/pics/designer_d_iconview.png b/kdevdesigner/designer/pics/designer_d_iconview.png new file mode 100644 index 00000000..a07b2b75 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_iconview.png differ diff --git a/kdevdesigner/designer/pics/designer_d_image.png b/kdevdesigner/designer/pics/designer_d_image.png new file mode 100644 index 00000000..f7cb29c3 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_image.png differ diff --git a/kdevdesigner/designer/pics/designer_d_label.png b/kdevdesigner/designer/pics/designer_d_label.png new file mode 100644 index 00000000..bfbd5b88 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_label.png differ diff --git a/kdevdesigner/designer/pics/designer_d_layout.png b/kdevdesigner/designer/pics/designer_d_layout.png new file mode 100644 index 00000000..090b4bb2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_layout.png differ diff --git a/kdevdesigner/designer/pics/designer_d_lcdnumber.png b/kdevdesigner/designer/pics/designer_d_lcdnumber.png new file mode 100644 index 00000000..786747e6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_lcdnumber.png differ diff --git a/kdevdesigner/designer/pics/designer_d_left.png b/kdevdesigner/designer/pics/designer_d_left.png new file mode 100644 index 00000000..50d03bbe Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_left.png differ diff --git a/kdevdesigner/designer/pics/designer_d_line.png b/kdevdesigner/designer/pics/designer_d_line.png new file mode 100644 index 00000000..25b0daeb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_line.png differ diff --git a/kdevdesigner/designer/pics/designer_d_lineedit.png b/kdevdesigner/designer/pics/designer_d_lineedit.png new file mode 100644 index 00000000..9d34ce97 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_lineedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_listbox.png b/kdevdesigner/designer/pics/designer_d_listbox.png new file mode 100644 index 00000000..d80c7900 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_listbox.png differ diff --git a/kdevdesigner/designer/pics/designer_d_listview.png b/kdevdesigner/designer/pics/designer_d_listview.png new file mode 100644 index 00000000..c5d9be3e Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_listview.png differ diff --git a/kdevdesigner/designer/pics/designer_d_multilineedit.png b/kdevdesigner/designer/pics/designer_d_multilineedit.png new file mode 100644 index 00000000..a62e6622 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_multilineedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_newform.png b/kdevdesigner/designer/pics/designer_d_newform.png new file mode 100644 index 00000000..ace61302 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_newform.png differ diff --git a/kdevdesigner/designer/pics/designer_d_ordertool.png b/kdevdesigner/designer/pics/designer_d_ordertool.png new file mode 100644 index 00000000..61bdc7ef Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_ordertool.png differ diff --git a/kdevdesigner/designer/pics/designer_d_pixlabel.png b/kdevdesigner/designer/pics/designer_d_pixlabel.png new file mode 100644 index 00000000..21e1f492 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_pixlabel.png differ diff --git a/kdevdesigner/designer/pics/designer_d_pointer.png b/kdevdesigner/designer/pics/designer_d_pointer.png new file mode 100644 index 00000000..e6903eb6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_pointer.png differ diff --git a/kdevdesigner/designer/pics/designer_d_print.png b/kdevdesigner/designer/pics/designer_d_print.png new file mode 100644 index 00000000..6a72a764 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_print.png differ diff --git a/kdevdesigner/designer/pics/designer_d_progress.png b/kdevdesigner/designer/pics/designer_d_progress.png new file mode 100644 index 00000000..25d857a6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_progress.png differ diff --git a/kdevdesigner/designer/pics/designer_d_project.png b/kdevdesigner/designer/pics/designer_d_project.png new file mode 100644 index 00000000..b265eae0 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_project.png differ diff --git a/kdevdesigner/designer/pics/designer_d_pushbutton.png b/kdevdesigner/designer/pics/designer_d_pushbutton.png new file mode 100644 index 00000000..635f35cb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_pushbutton.png differ diff --git a/kdevdesigner/designer/pics/designer_d_radiobutton.png b/kdevdesigner/designer/pics/designer_d_radiobutton.png new file mode 100644 index 00000000..e86eb8c1 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_radiobutton.png differ diff --git a/kdevdesigner/designer/pics/designer_d_redo.png b/kdevdesigner/designer/pics/designer_d_redo.png new file mode 100644 index 00000000..6e993cc6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_redo.png differ diff --git a/kdevdesigner/designer/pics/designer_d_richtextedit.png b/kdevdesigner/designer/pics/designer_d_richtextedit.png new file mode 100644 index 00000000..ba7ada19 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_richtextedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_right.png b/kdevdesigner/designer/pics/designer_d_right.png new file mode 100644 index 00000000..9dbf2dd6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_right.png differ diff --git a/kdevdesigner/designer/pics/designer_d_scrollbar.png b/kdevdesigner/designer/pics/designer_d_scrollbar.png new file mode 100644 index 00000000..9a818970 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_scrollbar.png differ diff --git a/kdevdesigner/designer/pics/designer_d_searchfind.png b/kdevdesigner/designer/pics/designer_d_searchfind.png new file mode 100644 index 00000000..e85e33fe Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_searchfind.png differ diff --git a/kdevdesigner/designer/pics/designer_d_setbuddy.png b/kdevdesigner/designer/pics/designer_d_setbuddy.png new file mode 100644 index 00000000..fe816aa2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_setbuddy.png differ diff --git a/kdevdesigner/designer/pics/designer_d_slider.png b/kdevdesigner/designer/pics/designer_d_slider.png new file mode 100644 index 00000000..a1ad5d5b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_slider.png differ diff --git a/kdevdesigner/designer/pics/designer_d_spacer.png b/kdevdesigner/designer/pics/designer_d_spacer.png new file mode 100644 index 00000000..15319d99 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_spacer.png differ diff --git a/kdevdesigner/designer/pics/designer_d_spinbox.png b/kdevdesigner/designer/pics/designer_d_spinbox.png new file mode 100644 index 00000000..cafbe012 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_spinbox.png differ diff --git a/kdevdesigner/designer/pics/designer_d_table.png b/kdevdesigner/designer/pics/designer_d_table.png new file mode 100644 index 00000000..a95bde12 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_table.png differ diff --git a/kdevdesigner/designer/pics/designer_d_tabwidget.png b/kdevdesigner/designer/pics/designer_d_tabwidget.png new file mode 100644 index 00000000..0f0bad0d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_tabwidget.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textbold.png b/kdevdesigner/designer/pics/designer_d_textbold.png new file mode 100644 index 00000000..6e8a5cf5 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textbold.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textbrowser.png b/kdevdesigner/designer/pics/designer_d_textbrowser.png new file mode 100644 index 00000000..b4315f90 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textbrowser.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textcenter.png b/kdevdesigner/designer/pics/designer_d_textcenter.png new file mode 100644 index 00000000..7a66036d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textcenter.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textedit.png b/kdevdesigner/designer/pics/designer_d_textedit.png new file mode 100644 index 00000000..69314141 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textfont.png b/kdevdesigner/designer/pics/designer_d_textfont.png new file mode 100644 index 00000000..beb2112b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textfont.png differ diff --git a/kdevdesigner/designer/pics/designer_d_texth1.png b/kdevdesigner/designer/pics/designer_d_texth1.png new file mode 100644 index 00000000..87d7e157 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_texth1.png differ diff --git a/kdevdesigner/designer/pics/designer_d_texth2.png b/kdevdesigner/designer/pics/designer_d_texth2.png new file mode 100644 index 00000000..e90437b2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_texth2.png differ diff --git a/kdevdesigner/designer/pics/designer_d_texth3.png b/kdevdesigner/designer/pics/designer_d_texth3.png new file mode 100644 index 00000000..1c7eefe5 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_texth3.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textitalic.png b/kdevdesigner/designer/pics/designer_d_textitalic.png new file mode 100644 index 00000000..d2c07fad Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textitalic.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textjustify.png b/kdevdesigner/designer/pics/designer_d_textjustify.png new file mode 100644 index 00000000..3fb3cc34 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textjustify.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textlarger.png b/kdevdesigner/designer/pics/designer_d_textlarger.png new file mode 100644 index 00000000..ecc35f54 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textlarger.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textleft.png b/kdevdesigner/designer/pics/designer_d_textleft.png new file mode 100644 index 00000000..90dc0248 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textleft.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textlinebreak.png b/kdevdesigner/designer/pics/designer_d_textlinebreak.png new file mode 100644 index 00000000..4566f59e Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textlinebreak.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textparagraph.png b/kdevdesigner/designer/pics/designer_d_textparagraph.png new file mode 100644 index 00000000..a7ef75c7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textparagraph.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textright.png b/kdevdesigner/designer/pics/designer_d_textright.png new file mode 100644 index 00000000..ee89b93b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textright.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textsmaller.png b/kdevdesigner/designer/pics/designer_d_textsmaller.png new file mode 100644 index 00000000..d4251de0 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textsmaller.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textteletext.png b/kdevdesigner/designer/pics/designer_d_textteletext.png new file mode 100644 index 00000000..d80af143 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textteletext.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textunderline.png b/kdevdesigner/designer/pics/designer_d_textunderline.png new file mode 100644 index 00000000..cab0b788 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textunderline.png differ diff --git a/kdevdesigner/designer/pics/designer_d_textview.png b/kdevdesigner/designer/pics/designer_d_textview.png new file mode 100644 index 00000000..05ce9c69 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_textview.png differ diff --git a/kdevdesigner/designer/pics/designer_d_timeedit.png b/kdevdesigner/designer/pics/designer_d_timeedit.png new file mode 100644 index 00000000..955144ec Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_timeedit.png differ diff --git a/kdevdesigner/designer/pics/designer_d_toolbox.png b/kdevdesigner/designer/pics/designer_d_toolbox.png new file mode 100644 index 00000000..e1f84471 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_toolbox.png differ diff --git a/kdevdesigner/designer/pics/designer_d_toolbutton.png b/kdevdesigner/designer/pics/designer_d_toolbutton.png new file mode 100644 index 00000000..08e309a7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_toolbutton.png differ diff --git a/kdevdesigner/designer/pics/designer_d_undo.png b/kdevdesigner/designer/pics/designer_d_undo.png new file mode 100644 index 00000000..22ac97f2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_undo.png differ diff --git a/kdevdesigner/designer/pics/designer_d_up.png b/kdevdesigner/designer/pics/designer_d_up.png new file mode 100644 index 00000000..4c3ab7c9 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_up.png differ diff --git a/kdevdesigner/designer/pics/designer_d_widgetstack.png b/kdevdesigner/designer/pics/designer_d_widgetstack.png new file mode 100644 index 00000000..c62f8e15 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_widgetstack.png differ diff --git a/kdevdesigner/designer/pics/designer_d_wizarddata.png b/kdevdesigner/designer/pics/designer_d_wizarddata.png new file mode 100644 index 00000000..fb540b87 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_wizarddata.png differ diff --git a/kdevdesigner/designer/pics/designer_d_wizarddialog.png b/kdevdesigner/designer/pics/designer_d_wizarddialog.png new file mode 100644 index 00000000..b83ca7e6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_wizarddialog.png differ diff --git a/kdevdesigner/designer/pics/designer_d_wordwrap.png b/kdevdesigner/designer/pics/designer_d_wordwrap.png new file mode 100644 index 00000000..8a299033 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_d_wordwrap.png differ diff --git a/kdevdesigner/designer/pics/designer_databrowser.png b/kdevdesigner/designer/pics/designer_databrowser.png new file mode 100644 index 00000000..1dd95782 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_databrowser.png differ diff --git a/kdevdesigner/designer/pics/designer_datatable.png b/kdevdesigner/designer/pics/designer_datatable.png new file mode 100644 index 00000000..5b3bfc76 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_datatable.png differ diff --git a/kdevdesigner/designer/pics/designer_dataview.png b/kdevdesigner/designer/pics/designer_dataview.png new file mode 100644 index 00000000..5f6aad33 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_dataview.png differ diff --git a/kdevdesigner/designer/pics/designer_dateedit.png b/kdevdesigner/designer/pics/designer_dateedit.png new file mode 100644 index 00000000..48286bec Binary files /dev/null and b/kdevdesigner/designer/pics/designer_dateedit.png differ diff --git a/kdevdesigner/designer/pics/designer_datetimeedit.png b/kdevdesigner/designer/pics/designer_datetimeedit.png new file mode 100644 index 00000000..68a56737 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_datetimeedit.png differ diff --git a/kdevdesigner/designer/pics/designer_dial.png b/kdevdesigner/designer/pics/designer_dial.png new file mode 100644 index 00000000..260033c2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_dial.png differ diff --git a/kdevdesigner/designer/pics/designer_down.png b/kdevdesigner/designer/pics/designer_down.png new file mode 100644 index 00000000..3269deca Binary files /dev/null and b/kdevdesigner/designer/pics/designer_down.png differ diff --git a/kdevdesigner/designer/pics/designer_editbreaklayout.png b/kdevdesigner/designer/pics/designer_editbreaklayout.png new file mode 100644 index 00000000..badbb8e7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editbreaklayout.png differ diff --git a/kdevdesigner/designer/pics/designer_editcopy.png b/kdevdesigner/designer/pics/designer_editcopy.png new file mode 100644 index 00000000..2f931cb2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editcopy.png differ diff --git a/kdevdesigner/designer/pics/designer_editcut.png b/kdevdesigner/designer/pics/designer_editcut.png new file mode 100644 index 00000000..a911482d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editcut.png differ diff --git a/kdevdesigner/designer/pics/designer_editdelete.png b/kdevdesigner/designer/pics/designer_editdelete.png new file mode 100644 index 00000000..9f0491dd Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editdelete.png differ diff --git a/kdevdesigner/designer/pics/designer_editgrid.png b/kdevdesigner/designer/pics/designer_editgrid.png new file mode 100644 index 00000000..f2b18e8a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editgrid.png differ diff --git a/kdevdesigner/designer/pics/designer_edithlayout.png b/kdevdesigner/designer/pics/designer_edithlayout.png new file mode 100644 index 00000000..1a2b1504 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_edithlayout.png differ diff --git a/kdevdesigner/designer/pics/designer_edithlayoutsplit.png b/kdevdesigner/designer/pics/designer_edithlayoutsplit.png new file mode 100644 index 00000000..cba102bc Binary files /dev/null and b/kdevdesigner/designer/pics/designer_edithlayoutsplit.png differ diff --git a/kdevdesigner/designer/pics/designer_editlower.png b/kdevdesigner/designer/pics/designer_editlower.png new file mode 100644 index 00000000..50605f27 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editlower.png differ diff --git a/kdevdesigner/designer/pics/designer_editpaste.png b/kdevdesigner/designer/pics/designer_editpaste.png new file mode 100644 index 00000000..b1b7f853 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editpaste.png differ diff --git a/kdevdesigner/designer/pics/designer_editraise.png b/kdevdesigner/designer/pics/designer_editraise.png new file mode 100644 index 00000000..f1572517 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editraise.png differ diff --git a/kdevdesigner/designer/pics/designer_editslots.png b/kdevdesigner/designer/pics/designer_editslots.png new file mode 100644 index 00000000..b86bddb6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editslots.png differ diff --git a/kdevdesigner/designer/pics/designer_editvlayout.png b/kdevdesigner/designer/pics/designer_editvlayout.png new file mode 100644 index 00000000..f4cd3f9c Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editvlayout.png differ diff --git a/kdevdesigner/designer/pics/designer_editvlayoutsplit.png b/kdevdesigner/designer/pics/designer_editvlayoutsplit.png new file mode 100644 index 00000000..0180cf5a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_editvlayoutsplit.png differ diff --git a/kdevdesigner/designer/pics/designer_filenew.png b/kdevdesigner/designer/pics/designer_filenew.png new file mode 100644 index 00000000..9520080e Binary files /dev/null and b/kdevdesigner/designer/pics/designer_filenew.png differ diff --git a/kdevdesigner/designer/pics/designer_fileopen.png b/kdevdesigner/designer/pics/designer_fileopen.png new file mode 100644 index 00000000..30052901 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_fileopen.png differ diff --git a/kdevdesigner/designer/pics/designer_filesave.png b/kdevdesigner/designer/pics/designer_filesave.png new file mode 100644 index 00000000..c137165b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_filesave.png differ diff --git a/kdevdesigner/designer/pics/designer_folder.png b/kdevdesigner/designer/pics/designer_folder.png new file mode 100644 index 00000000..bab6df0f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_folder.png differ diff --git a/kdevdesigner/designer/pics/designer_form.png b/kdevdesigner/designer/pics/designer_form.png new file mode 100644 index 00000000..08268bf7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_form.png differ diff --git a/kdevdesigner/designer/pics/designer_frame.png b/kdevdesigner/designer/pics/designer_frame.png new file mode 100644 index 00000000..c070b9c4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_frame.png differ diff --git a/kdevdesigner/designer/pics/designer_groupbox.png b/kdevdesigner/designer/pics/designer_groupbox.png new file mode 100644 index 00000000..4025b4dc Binary files /dev/null and b/kdevdesigner/designer/pics/designer_groupbox.png differ diff --git a/kdevdesigner/designer/pics/designer_hand.png b/kdevdesigner/designer/pics/designer_hand.png new file mode 100644 index 00000000..ac01ee60 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_hand.png differ diff --git a/kdevdesigner/designer/pics/designer_help.png b/kdevdesigner/designer/pics/designer_help.png new file mode 100644 index 00000000..2ab2c25d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_help.png differ diff --git a/kdevdesigner/designer/pics/designer_home.png b/kdevdesigner/designer/pics/designer_home.png new file mode 100644 index 00000000..806d11d2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_home.png differ diff --git a/kdevdesigner/designer/pics/designer_hsplit.png b/kdevdesigner/designer/pics/designer_hsplit.png new file mode 100644 index 00000000..232faf14 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_hsplit.png differ diff --git a/kdevdesigner/designer/pics/designer_ibeam.png b/kdevdesigner/designer/pics/designer_ibeam.png new file mode 100644 index 00000000..6074c89f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_ibeam.png differ diff --git a/kdevdesigner/designer/pics/designer_iconview.png b/kdevdesigner/designer/pics/designer_iconview.png new file mode 100644 index 00000000..13b8f153 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_iconview.png differ diff --git a/kdevdesigner/designer/pics/designer_image.png b/kdevdesigner/designer/pics/designer_image.png new file mode 100644 index 00000000..29854df6 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_image.png differ diff --git a/kdevdesigner/designer/pics/designer_label.png b/kdevdesigner/designer/pics/designer_label.png new file mode 100644 index 00000000..5d7d7b4c Binary files /dev/null and b/kdevdesigner/designer/pics/designer_label.png differ diff --git a/kdevdesigner/designer/pics/designer_layout.png b/kdevdesigner/designer/pics/designer_layout.png new file mode 100644 index 00000000..168eb1f8 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_layout.png differ diff --git a/kdevdesigner/designer/pics/designer_lcdnumber.png b/kdevdesigner/designer/pics/designer_lcdnumber.png new file mode 100644 index 00000000..64eda5e4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_lcdnumber.png differ diff --git a/kdevdesigner/designer/pics/designer_left.png b/kdevdesigner/designer/pics/designer_left.png new file mode 100644 index 00000000..e58177f4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_left.png differ diff --git a/kdevdesigner/designer/pics/designer_line.png b/kdevdesigner/designer/pics/designer_line.png new file mode 100644 index 00000000..5c64dfb5 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_line.png differ diff --git a/kdevdesigner/designer/pics/designer_lineedit.png b/kdevdesigner/designer/pics/designer_lineedit.png new file mode 100644 index 00000000..75fc890f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_lineedit.png differ diff --git a/kdevdesigner/designer/pics/designer_listbox.png b/kdevdesigner/designer/pics/designer_listbox.png new file mode 100644 index 00000000..d467fc9f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_listbox.png differ diff --git a/kdevdesigner/designer/pics/designer_listview.png b/kdevdesigner/designer/pics/designer_listview.png new file mode 100644 index 00000000..d71cc1c9 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_listview.png differ diff --git a/kdevdesigner/designer/pics/designer_multilineedit.png b/kdevdesigner/designer/pics/designer_multilineedit.png new file mode 100644 index 00000000..e2f08995 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_multilineedit.png differ diff --git a/kdevdesigner/designer/pics/designer_newform.png b/kdevdesigner/designer/pics/designer_newform.png new file mode 100644 index 00000000..37779c13 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_newform.png differ diff --git a/kdevdesigner/designer/pics/designer_no.png b/kdevdesigner/designer/pics/designer_no.png new file mode 100644 index 00000000..8bacc044 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_no.png differ diff --git a/kdevdesigner/designer/pics/designer_object.png b/kdevdesigner/designer/pics/designer_object.png new file mode 100644 index 00000000..cc4192ed Binary files /dev/null and b/kdevdesigner/designer/pics/designer_object.png differ diff --git a/kdevdesigner/designer/pics/designer_ordertool.png b/kdevdesigner/designer/pics/designer_ordertool.png new file mode 100644 index 00000000..ad122839 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_ordertool.png differ diff --git a/kdevdesigner/designer/pics/designer_pixlabel.png b/kdevdesigner/designer/pics/designer_pixlabel.png new file mode 100644 index 00000000..32b90d82 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_pixlabel.png differ diff --git a/kdevdesigner/designer/pics/designer_pointer.png b/kdevdesigner/designer/pics/designer_pointer.png new file mode 100644 index 00000000..67e38a36 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_pointer.png differ diff --git a/kdevdesigner/designer/pics/designer_print.png b/kdevdesigner/designer/pics/designer_print.png new file mode 100644 index 00000000..57e3e532 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_print.png differ diff --git a/kdevdesigner/designer/pics/designer_progress.png b/kdevdesigner/designer/pics/designer_progress.png new file mode 100644 index 00000000..44ae094e Binary files /dev/null and b/kdevdesigner/designer/pics/designer_progress.png differ diff --git a/kdevdesigner/designer/pics/designer_project.png b/kdevdesigner/designer/pics/designer_project.png new file mode 100644 index 00000000..6a0fb96f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_project.png differ diff --git a/kdevdesigner/designer/pics/designer_pushbutton.png b/kdevdesigner/designer/pics/designer_pushbutton.png new file mode 100644 index 00000000..61f779ce Binary files /dev/null and b/kdevdesigner/designer/pics/designer_pushbutton.png differ diff --git a/kdevdesigner/designer/pics/designer_qtlogo.png b/kdevdesigner/designer/pics/designer_qtlogo.png new file mode 100644 index 00000000..4e1a1472 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_qtlogo.png differ diff --git a/kdevdesigner/designer/pics/designer_radiobutton.png b/kdevdesigner/designer/pics/designer_radiobutton.png new file mode 100644 index 00000000..10c1d8c3 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_radiobutton.png differ diff --git a/kdevdesigner/designer/pics/designer_redo.png b/kdevdesigner/designer/pics/designer_redo.png new file mode 100644 index 00000000..abdad26c Binary files /dev/null and b/kdevdesigner/designer/pics/designer_redo.png differ diff --git a/kdevdesigner/designer/pics/designer_resetproperty.png b/kdevdesigner/designer/pics/designer_resetproperty.png new file mode 100644 index 00000000..cc0d6a26 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_resetproperty.png differ diff --git a/kdevdesigner/designer/pics/designer_richtextedit.png b/kdevdesigner/designer/pics/designer_richtextedit.png new file mode 100644 index 00000000..73573a8a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_richtextedit.png differ diff --git a/kdevdesigner/designer/pics/designer_right.png b/kdevdesigner/designer/pics/designer_right.png new file mode 100644 index 00000000..5f2f7036 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_right.png differ diff --git a/kdevdesigner/designer/pics/designer_s_down.png b/kdevdesigner/designer/pics/designer_s_down.png new file mode 100644 index 00000000..908e55e1 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_s_down.png differ diff --git a/kdevdesigner/designer/pics/designer_s_editcut.png b/kdevdesigner/designer/pics/designer_s_editcut.png new file mode 100644 index 00000000..7cf5a9eb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_s_editcut.png differ diff --git a/kdevdesigner/designer/pics/designer_s_left.png b/kdevdesigner/designer/pics/designer_s_left.png new file mode 100644 index 00000000..e6e19f8f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_s_left.png differ diff --git a/kdevdesigner/designer/pics/designer_s_right.png b/kdevdesigner/designer/pics/designer_s_right.png new file mode 100644 index 00000000..bfccda6b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_s_right.png differ diff --git a/kdevdesigner/designer/pics/designer_s_up.png b/kdevdesigner/designer/pics/designer_s_up.png new file mode 100644 index 00000000..97705d47 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_s_up.png differ diff --git a/kdevdesigner/designer/pics/designer_scrollbar.png b/kdevdesigner/designer/pics/designer_scrollbar.png new file mode 100644 index 00000000..466c58de Binary files /dev/null and b/kdevdesigner/designer/pics/designer_scrollbar.png differ diff --git a/kdevdesigner/designer/pics/designer_searchfind.png b/kdevdesigner/designer/pics/designer_searchfind.png new file mode 100644 index 00000000..3f369fdb Binary files /dev/null and b/kdevdesigner/designer/pics/designer_searchfind.png differ diff --git a/kdevdesigner/designer/pics/designer_setbuddy.png b/kdevdesigner/designer/pics/designer_setbuddy.png new file mode 100644 index 00000000..c1edb89b Binary files /dev/null and b/kdevdesigner/designer/pics/designer_setbuddy.png differ diff --git a/kdevdesigner/designer/pics/designer_sizeall.png b/kdevdesigner/designer/pics/designer_sizeall.png new file mode 100644 index 00000000..fa2a266a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_sizeall.png differ diff --git a/kdevdesigner/designer/pics/designer_sizeb.png b/kdevdesigner/designer/pics/designer_sizeb.png new file mode 100644 index 00000000..ac5235b0 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_sizeb.png differ diff --git a/kdevdesigner/designer/pics/designer_sizef.png b/kdevdesigner/designer/pics/designer_sizef.png new file mode 100644 index 00000000..28a30c29 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_sizef.png differ diff --git a/kdevdesigner/designer/pics/designer_sizeh.png b/kdevdesigner/designer/pics/designer_sizeh.png new file mode 100644 index 00000000..7b8abd3a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_sizeh.png differ diff --git a/kdevdesigner/designer/pics/designer_sizev.png b/kdevdesigner/designer/pics/designer_sizev.png new file mode 100644 index 00000000..80b3d8b2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_sizev.png differ diff --git a/kdevdesigner/designer/pics/designer_slider.png b/kdevdesigner/designer/pics/designer_slider.png new file mode 100644 index 00000000..525bd1ca Binary files /dev/null and b/kdevdesigner/designer/pics/designer_slider.png differ diff --git a/kdevdesigner/designer/pics/designer_spacer.png b/kdevdesigner/designer/pics/designer_spacer.png new file mode 100644 index 00000000..926e8afc Binary files /dev/null and b/kdevdesigner/designer/pics/designer_spacer.png differ diff --git a/kdevdesigner/designer/pics/designer_spinbox.png b/kdevdesigner/designer/pics/designer_spinbox.png new file mode 100644 index 00000000..7ae20630 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_spinbox.png differ diff --git a/kdevdesigner/designer/pics/designer_splash.png b/kdevdesigner/designer/pics/designer_splash.png new file mode 100644 index 00000000..d3b62a17 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_splash.png differ diff --git a/kdevdesigner/designer/pics/designer_table.png b/kdevdesigner/designer/pics/designer_table.png new file mode 100644 index 00000000..4bbd9c2d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_table.png differ diff --git a/kdevdesigner/designer/pics/designer_tabwidget.png b/kdevdesigner/designer/pics/designer_tabwidget.png new file mode 100644 index 00000000..1254bb63 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_tabwidget.png differ diff --git a/kdevdesigner/designer/pics/designer_textbold.png b/kdevdesigner/designer/pics/designer_textbold.png new file mode 100644 index 00000000..7f4f7344 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textbold.png differ diff --git a/kdevdesigner/designer/pics/designer_textbrowser.png b/kdevdesigner/designer/pics/designer_textbrowser.png new file mode 100644 index 00000000..090e2f84 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textbrowser.png differ diff --git a/kdevdesigner/designer/pics/designer_textcenter.png b/kdevdesigner/designer/pics/designer_textcenter.png new file mode 100644 index 00000000..5c68b09c Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textcenter.png differ diff --git a/kdevdesigner/designer/pics/designer_textedit.png b/kdevdesigner/designer/pics/designer_textedit.png new file mode 100644 index 00000000..823d0818 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textedit.png differ diff --git a/kdevdesigner/designer/pics/designer_textfont.png b/kdevdesigner/designer/pics/designer_textfont.png new file mode 100644 index 00000000..a4de87a4 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textfont.png differ diff --git a/kdevdesigner/designer/pics/designer_texth1.png b/kdevdesigner/designer/pics/designer_texth1.png new file mode 100644 index 00000000..1c3aa2fd Binary files /dev/null and b/kdevdesigner/designer/pics/designer_texth1.png differ diff --git a/kdevdesigner/designer/pics/designer_texth2.png b/kdevdesigner/designer/pics/designer_texth2.png new file mode 100644 index 00000000..ba73121d Binary files /dev/null and b/kdevdesigner/designer/pics/designer_texth2.png differ diff --git a/kdevdesigner/designer/pics/designer_texth3.png b/kdevdesigner/designer/pics/designer_texth3.png new file mode 100644 index 00000000..1d9f8732 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_texth3.png differ diff --git a/kdevdesigner/designer/pics/designer_textitalic.png b/kdevdesigner/designer/pics/designer_textitalic.png new file mode 100644 index 00000000..68e2b44c Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textitalic.png differ diff --git a/kdevdesigner/designer/pics/designer_textjustify.png b/kdevdesigner/designer/pics/designer_textjustify.png new file mode 100644 index 00000000..6e746c80 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textjustify.png differ diff --git a/kdevdesigner/designer/pics/designer_textlarger.png b/kdevdesigner/designer/pics/designer_textlarger.png new file mode 100644 index 00000000..89960939 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textlarger.png differ diff --git a/kdevdesigner/designer/pics/designer_textleft.png b/kdevdesigner/designer/pics/designer_textleft.png new file mode 100644 index 00000000..72b27652 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textleft.png differ diff --git a/kdevdesigner/designer/pics/designer_textlinebreak.png b/kdevdesigner/designer/pics/designer_textlinebreak.png new file mode 100644 index 00000000..081a49e0 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textlinebreak.png differ diff --git a/kdevdesigner/designer/pics/designer_textparagraph.png b/kdevdesigner/designer/pics/designer_textparagraph.png new file mode 100644 index 00000000..dcd0b3ea Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textparagraph.png differ diff --git a/kdevdesigner/designer/pics/designer_textright.png b/kdevdesigner/designer/pics/designer_textright.png new file mode 100644 index 00000000..d7186722 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textright.png differ diff --git a/kdevdesigner/designer/pics/designer_textsmaller.png b/kdevdesigner/designer/pics/designer_textsmaller.png new file mode 100644 index 00000000..10953d9a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textsmaller.png differ diff --git a/kdevdesigner/designer/pics/designer_textteletext.png b/kdevdesigner/designer/pics/designer_textteletext.png new file mode 100644 index 00000000..c0204636 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textteletext.png differ diff --git a/kdevdesigner/designer/pics/designer_textunderline.png b/kdevdesigner/designer/pics/designer_textunderline.png new file mode 100644 index 00000000..3477ccb3 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textunderline.png differ diff --git a/kdevdesigner/designer/pics/designer_textview.png b/kdevdesigner/designer/pics/designer_textview.png new file mode 100644 index 00000000..ec2270c3 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_textview.png differ diff --git a/kdevdesigner/designer/pics/designer_timeedit.png b/kdevdesigner/designer/pics/designer_timeedit.png new file mode 100644 index 00000000..01b37888 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_timeedit.png differ diff --git a/kdevdesigner/designer/pics/designer_toolbox.png b/kdevdesigner/designer/pics/designer_toolbox.png new file mode 100644 index 00000000..2ab71dc7 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_toolbox.png differ diff --git a/kdevdesigner/designer/pics/designer_toolbutton.png b/kdevdesigner/designer/pics/designer_toolbutton.png new file mode 100644 index 00000000..25d240a1 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_toolbutton.png differ diff --git a/kdevdesigner/designer/pics/designer_undo.png b/kdevdesigner/designer/pics/designer_undo.png new file mode 100644 index 00000000..839a823f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_undo.png differ diff --git a/kdevdesigner/designer/pics/designer_up.png b/kdevdesigner/designer/pics/designer_up.png new file mode 100644 index 00000000..e4373122 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_up.png differ diff --git a/kdevdesigner/designer/pics/designer_uparrow.png b/kdevdesigner/designer/pics/designer_uparrow.png new file mode 100644 index 00000000..eefe4a00 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_uparrow.png differ diff --git a/kdevdesigner/designer/pics/designer_vsplit.png b/kdevdesigner/designer/pics/designer_vsplit.png new file mode 100644 index 00000000..b820c19f Binary files /dev/null and b/kdevdesigner/designer/pics/designer_vsplit.png differ diff --git a/kdevdesigner/designer/pics/designer_wait.png b/kdevdesigner/designer/pics/designer_wait.png new file mode 100644 index 00000000..5d8cfed2 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_wait.png differ diff --git a/kdevdesigner/designer/pics/designer_widgetstack.png b/kdevdesigner/designer/pics/designer_widgetstack.png new file mode 100644 index 00000000..c326de81 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_widgetstack.png differ diff --git a/kdevdesigner/designer/pics/designer_wizarddata.png b/kdevdesigner/designer/pics/designer_wizarddata.png new file mode 100644 index 00000000..9493e3b1 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_wizarddata.png differ diff --git a/kdevdesigner/designer/pics/designer_wizarddialog.png b/kdevdesigner/designer/pics/designer_wizarddialog.png new file mode 100644 index 00000000..a22dc88a Binary files /dev/null and b/kdevdesigner/designer/pics/designer_wizarddialog.png differ diff --git a/kdevdesigner/designer/pics/designer_wordwrap.png b/kdevdesigner/designer/pics/designer_wordwrap.png new file mode 100644 index 00000000..29513c32 Binary files /dev/null and b/kdevdesigner/designer/pics/designer_wordwrap.png differ diff --git a/kdevdesigner/designer/pixmapchooser.cpp b/kdevdesigner/designer/pixmapchooser.cpp new file mode 100644 index 00000000..aaac22c0 --- /dev/null +++ b/kdevdesigner/designer/pixmapchooser.cpp @@ -0,0 +1,231 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler needs this here + +#include +#include +#include +#include +#include + +#include "kdevdesigner_part.h" + +#include "pixmapchooser.h" +#include "formwindow.h" +#if defined(DESIGNER) && !defined(RESOURCE) +#include "pixmapfunction.h" +#endif +#include "metadatabase.h" +#include "mainwindow.h" +#include "pixmapcollectioneditor.h" +#include "pixmapcollection.h" +#include "project.h" + +#include +#include +#include +#include +#include +#include + +#if defined(DESIGNER) +static ImageIconProvider *imageIconProvider = 0; +#endif + +PixmapView::PixmapView( QWidget *parent ) + : QScrollView( parent ) +{ + viewport()->setBackgroundMode( PaletteBase ); +} + +void PixmapView::setPixmap( const QPixmap &pix ) +{ + pixmap = pix; + resizeContents( pixmap.size().width(), pixmap.size().height() ); + viewport()->repaint( FALSE ); +} + +void PixmapView::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) +{ + p->fillRect( cx, cy, cw, ch, colorGroup().brush( QColorGroup::Base ) ); + p->drawPixmap( 0, 0, pixmap ); +} + +void PixmapView::previewUrl( const QUrl &u ) +{ + if ( u.isLocalFile() ) { + QString path = u.path(); + QPixmap pix( path ); + if ( !pix.isNull() ) + setPixmap( pix ); + } else { + qWarning( "Previewing remote files not supported." ); + } +} + +static void buildImageFormatList( QString &filter, QString &all ) +{ + all = qApp->translate( "qChoosePixmap", "All Pixmaps (" ); + for ( uint i = 0; i < QImageIO::outputFormats().count(); i++ ) { + QString outputFormat = QImageIO::outputFormats().at( i ); + QString outputExtension; + if ( outputFormat != "JPEG" ) + outputExtension = outputFormat.lower(); + else + outputExtension = "jpg;*.jpeg"; + filter += qApp->translate( "qChoosePixmap", "%1-Pixmaps (%2)\n" ). + arg( outputFormat ).arg( "*." + outputExtension); + all += "*." + outputExtension + ";"; + } + filter.prepend( all + qApp->translate( "qChoosePixmap", ")\n" ) ); + filter += qApp->translate( "qChoosePixmap", "All Files (*)" ); + +} +QStringList qChoosePixmaps( QWidget *parent ) +{ +/* if ( !imageIconProvider && !QFileDialog::iconProvider() ) + QFileDialog::setIconProvider( ( imageIconProvider = new ImageIconProvider ) ); + + QString filter; + QString all; + buildImageFormatList( filter, all ); + + QFileDialog fd( QString::null, filter, parent, 0, TRUE ); + fd.setMode( QFileDialog::ExistingFiles ); + fd.setContentsPreviewEnabled( TRUE ); + PixmapView *pw = new PixmapView( &fd ); + fd.setContentsPreview( pw, pw ); + fd.setViewMode( QFileDialog::List ); + fd.setPreviewMode( QFileDialog::Contents ); + fd.setCaption( qApp->translate( "qChoosePixmap", "Choose Images..." ) ); + if ( fd.exec() == QDialog::Accepted ) + return fd.selectedFiles(); + return QStringList();*/ + QStringList mimetypes = KImageIO::mimeTypes( KImageIO::Reading ); + KFileDialog dlg(QString::null, mimetypes.join(" "), parent, "filedialog", true); + dlg.setOperationMode( KFileDialog::Opening ); + dlg.setCaption( qApp->translate( "qChoosePixmap", "Choose Images..." ) ); + dlg.setMode( KFile::Files ); + KImageFilePreview *ip = new KImageFilePreview( &dlg ); + dlg.setPreviewWidget( ip ); + if (dlg.exec()) + return dlg.selectedFiles(); + return QStringList(); +} + +QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw, const QPixmap &old, QString *fn ) +{ +#if defined(DESIGNER) + if ( !fw || fw->savePixmapInline() ) { +/* if ( !imageIconProvider && !QFileDialog::iconProvider() ) + QFileDialog::setIconProvider( ( imageIconProvider = new ImageIconProvider ) ); + + QString filter; + QString all; + buildImageFormatList( filter, all ); + + QFileDialog fd( QString::null, filter, parent, 0, TRUE ); + fd.setContentsPreviewEnabled( TRUE ); + PixmapView *pw = new PixmapView( &fd ); + fd.setContentsPreview( pw, pw ); + fd.setViewMode( QFileDialog::List ); + fd.setPreviewMode( QFileDialog::Contents ); + fd.setCaption( qApp->translate( "qChoosePixmap", "Choose Pixmap" ) ); + if ( fd.exec() == QDialog::Accepted ) { + QPixmap pix( fd.selectedFile() ); + if ( fn ) + *fn = fd.selectedFile(); + MetaDataBase::setPixmapArgument( fw, pix.serialNumber(), fd.selectedFile() ); + return pix; + }*/ + QStringList mimetypes = KImageIO::mimeTypes( KImageIO::Reading ); + KFileDialog dlg(QString::null, mimetypes.join(" "), parent, "filedialog", true); + dlg.setOperationMode( KFileDialog::Opening ); + dlg.setCaption( qApp->translate( "qChoosePixmap", "Choose Pixmap" ) ); + dlg.setMode( KFile::File ); + KImageFilePreview *ip = new KImageFilePreview( &dlg ); + dlg.setPreviewWidget( ip ); + if (dlg.exec()) + { + QPixmap pix( dlg.selectedURL().path() ); + if ( fn ) + *fn = dlg.selectedURL().path(); + MetaDataBase::setPixmapArgument( fw, pix.serialNumber(), dlg.selectedURL().path() ); + return pix; + } + } else if ( fw && fw->savePixmapInProject() ) { + PixmapCollectionEditor dia( parent, 0, TRUE ); + dia.setProject( fw->project() ); + dia.setChooserMode( TRUE ); + dia.setCurrentItem( MetaDataBase::pixmapKey( fw, old.serialNumber() ) ); + if ( dia.exec() == QDialog::Accepted ) { + QPixmap pix( fw->project()->pixmapCollection()->pixmap( dia.viewPixmaps->currentItem()->text() ) ); + MetaDataBase::setPixmapKey( fw, pix.serialNumber(), dia.viewPixmaps->currentItem()->text() ); + return pix; + } + } else { + PixmapFunction dia( parent, 0, TRUE ); + QObject::connect( dia.helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + dia.labelFunction->setText( fw->pixmapLoaderFunction() + "(" ); + dia.editArguments->setText( MetaDataBase::pixmapArgument( fw, old.serialNumber() ) ); + dia.editArguments->setFocus(); + if ( dia.exec() == QDialog::Accepted ) { + QPixmap pix; + // we have to force the pixmap to get a new and unique serial number. Unfortunately detatch() doesn't do that + pix.convertFromImage( BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ).convertToImage() ); + + MetaDataBase::setPixmapArgument( fw, pix.serialNumber(), dia.editArguments->text() ); + return pix; + } + } +#else + Q_UNUSED( parent ); + Q_UNUSED( fw ); + Q_UNUSED( old ); +#endif + return QPixmap(); +} + +ImageIconProvider::ImageIconProvider( QWidget *parent, const char *name ) + : QFileIconProvider( parent, name ), imagepm( BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ) ) +{ + fmts = QImage::inputFormats(); +} + +ImageIconProvider::~ImageIconProvider() +{ +} + +const QPixmap * ImageIconProvider::pixmap( const QFileInfo &fi ) +{ + QString ext = fi.extension().upper(); + if ( fmts.contains( ext ) ) { + return &imagepm; + } else { + return QFileIconProvider::pixmap( fi ); + } +} diff --git a/kdevdesigner/designer/pixmapchooser.h b/kdevdesigner/designer/pixmapchooser.h new file mode 100644 index 00000000..cea45bfd --- /dev/null +++ b/kdevdesigner/designer/pixmapchooser.h @@ -0,0 +1,72 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PIXMAPCHOOSER_H +#define PIXMAPCHOOSER_H + +#include +#include +#include +#include + +class FormWindow; + +class PixmapView : public QScrollView, + public QFilePreview +{ + Q_OBJECT + +public: + PixmapView( QWidget *parent ); + void setPixmap( const QPixmap &pix ); + void drawContents( QPainter *p, int, int, int, int ); + void previewUrl( const QUrl &u ); + +private: + QPixmap pixmap; + +}; + +class ImageIconProvider : public QFileIconProvider +{ + Q_OBJECT + +public: + ImageIconProvider( QWidget *parent = 0, const char *name = 0 ); + ~ImageIconProvider(); + + const QPixmap *pixmap( const QFileInfo &fi ); + +private: + QStrList fmts; + QPixmap imagepm; + +}; + +QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw = 0, const QPixmap &old = QPixmap(), QString *fn = 0 ); +QStringList qChoosePixmaps( QWidget *parent ); + +#endif diff --git a/kdevdesigner/designer/pixmapcollection.cpp b/kdevdesigner/designer/pixmapcollection.cpp new file mode 100644 index 00000000..c8b14ffa --- /dev/null +++ b/kdevdesigner/designer/pixmapcollection.cpp @@ -0,0 +1,180 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "pixmapcollection.h" +#include "project.h" +#include "mainwindow.h" +#include +#include +#include +#include +#include + +PixmapCollection::PixmapCollection( Project *pro ) + : project( pro ) +{ + iface = new DesignerPixmapCollectionImpl( this ); + mimeSourceFactory = new QMimeSourceFactory(); +} + +PixmapCollection::~PixmapCollection() +{ + delete mimeSourceFactory; + delete iface; +} + +bool PixmapCollection::addPixmap( const Pixmap &pix, bool force ) +{ + Pixmap pixmap = pix; + savePixmap( pixmap ); + + if ( !force ) { + for ( QValueList::Iterator it = pixList.begin(); it != pixList.end(); ++it ) { + if ( (*it).name == pixmap.name ) + return FALSE; + } + } + + pixList.append( pixmap ); + mimeSourceFactory->setPixmap( pixmap.name, pixmap.pix ); + project->setModified( TRUE ); + return TRUE; +} + +void PixmapCollection::removePixmap( const QString &name ) +{ + for ( QValueList::Iterator it = pixList.begin(); it != pixList.end(); ++it ) { + if ( (*it).name == name ) { + pixList.remove( it ); + break; + } + } + project->setModified( TRUE ); +} + +QValueList PixmapCollection::pixmaps() const +{ + return pixList; +} + +QString PixmapCollection::unifyName( const QString &n ) +{ + QString name = n; + bool restart = FALSE; + int added = 1; + + for ( QValueList::Iterator it = pixList.begin(); it != pixList.end(); ++it ) { + if ( restart ) + it = pixList.begin(); + restart = FALSE; + if ( name == (*it).name ) { + name = n; + name += "_" + QString::number( added ); + ++added; + restart = TRUE; + } + } + + return name; +} + +void PixmapCollection::setActive( bool b ) +{ + if ( b ) + QMimeSourceFactory::defaultFactory()->addFactory( mimeSourceFactory ); + else + QMimeSourceFactory::defaultFactory()->removeFactory( mimeSourceFactory ); +} + +QPixmap PixmapCollection::pixmap( const QString &name ) +{ + for ( QValueList::Iterator it = pixList.begin(); it != pixList.end(); ++it ) { + if ( (*it).name == name ) + return (*it).pix; + } + return QPixmap(); +} + +void PixmapCollection::savePixmap( Pixmap &pix ) +{ + if ( pix.absname == imageDir() + "/" + pix.name ) + return; // no need to save, it is already there + QString rel = project->makeRelative( pix.absname ); + if ( rel[0] == '/' || ( rel[1] == ':' && rel[2] == '/' ) ) { // only save if file is outside the project + mkdir(); + pix.name = unifyName( QFileInfo( pix.absname ).baseName() ) + ".png"; + pix.absname = imageDir() + "/" + pix.name; + pix.pix.save( pix.absname, "PNG" ); + } else if ( rel.isEmpty() ) { + mkdir(); + pix.name = unifyName( pix.name ); + pix.absname = imageDir() + "/" + pix.name; + pix.pix.save( pix.absname, "PNG" ); + } +} + +QString PixmapCollection::imageDir() const +{ + return QFileInfo( project->fileName() ).dirPath( TRUE ) + "/images"; +} + +void PixmapCollection::mkdir() +{ + QString f = project->fileName(); + QDir d( QFileInfo( f ).dirPath( TRUE ) ); + d.mkdir( "images" ); +} + +void PixmapCollection::load( const QString& filename ) +{ + if ( filename.isEmpty() ) + return; + QString absfile; + if ( filename[0] == '/' ) + absfile = filename; + else + absfile = QFileInfo( project->fileName() ).dirPath( TRUE ) + "/" + filename; + + QPixmap pm( absfile ); + if ( pm.isNull() ) + return; + + Pixmap pix; + pix.name = QFileInfo( absfile ).fileName(); + pix.absname = absfile; + pix.pix = pm; + addPixmap( pix, TRUE ); +} + +DesignerPixmapCollection *PixmapCollection::iFace() +{ + return iface; +} + +bool PixmapCollection::isEmpty() const +{ + return pixList.isEmpty(); +} diff --git a/kdevdesigner/designer/pixmapcollection.h b/kdevdesigner/designer/pixmapcollection.h new file mode 100644 index 00000000..ed36ecb8 --- /dev/null +++ b/kdevdesigner/designer/pixmapcollection.h @@ -0,0 +1,80 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PIXMAPCOLLECTION_H +#define PIXMAPCOLLECTION_H + +#include +#include +#include +#include "designerappiface.h" + +class QMimeSourceFactory; +class Project; + +class PixmapCollection +{ +public: + struct Pixmap + { + QPixmap pix; + QString name; + QString absname; + Q_DUMMY_COMPARISON_OPERATOR( Pixmap ) + }; + + PixmapCollection( Project *pro ); + ~PixmapCollection(); + + bool addPixmap( const Pixmap &pix, bool force = TRUE ); + void removePixmap( const QString &name ); + QPixmap pixmap( const QString &name ); + + QValueList pixmaps() const; + bool isEmpty() const; + + void setActive( bool b ); + + void load( const QString& filename ); + + DesignerPixmapCollection *iFace(); + +private: + QString unifyName( const QString &n ); + void savePixmap( Pixmap &pix ); + + QString imageDir() const; + void mkdir(); + +private: + QValueList pixList; + QMimeSourceFactory *mimeSourceFactory; + Project *project; + DesignerPixmapCollectionImpl *iface; + +}; + +#endif diff --git a/kdevdesigner/designer/pixmapcollectioneditor.ui b/kdevdesigner/designer/pixmapcollectioneditor.ui new file mode 100644 index 00000000..c4888193 --- /dev/null +++ b/kdevdesigner/designer/pixmapcollectioneditor.ui @@ -0,0 +1,218 @@ + +PixmapCollectionEditor +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + PixmapCollectionEditor + + + + 0 + 0 + 455 + 260 + + + + Manage Image Collection + + + + unnamed + + + 11 + + + 6 + + + + viewPixmaps + + + Adjust + + + false + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + PushButton2 + + + &Add... + + + + + PushButton3 + + + &Delete + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + + + buttonCancel + + + &Cancel + + + + + buttonClose + + + C&lose + + + true + + + + + + + + + PushButton2 + clicked() + PixmapCollectionEditor + addPixmap() + + + PushButton3 + clicked() + PixmapCollectionEditor + removePixmap() + + + viewPixmaps + currentChanged(QIconViewItem*) + PixmapCollectionEditor + currentChanged(QIconViewItem*) + + + buttonOk + clicked() + PixmapCollectionEditor + accept() + + + buttonCancel + clicked() + PixmapCollectionEditor + reject() + + + buttonClose + clicked() + PixmapCollectionEditor + accept() + + + + PushButton2 + PushButton3 + viewPixmaps + buttonClose + + + pixmapcollection.h + pixmapchooser.h + project.h + qfileinfo.h + qimage.h + qpixmap.h + pixmapcollectioneditor.ui.h + + + class Project; + + + Project *project; + bool chooser; + + + init() + destroy() + addPixmap() + removePixmap() + updateView() + currentChanged(QIconViewItem * i) + setChooserMode(bool c) + setCurrentItem(const QString & name) + setProject(Project * pro) + scaledPixmap(const QPixmap & p) + + + diff --git a/kdevdesigner/designer/pixmapcollectioneditor.ui.h b/kdevdesigner/designer/pixmapcollectioneditor.ui.h new file mode 100644 index 00000000..4d82f3f3 --- /dev/null +++ b/kdevdesigner/designer/pixmapcollectioneditor.ui.h @@ -0,0 +1,150 @@ +#include +/********************************************************************** +** Copyright (C) 2001-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +void PixmapCollectionEditor::init() +{ + project = 0; + setChooserMode( FALSE ); +} + +void PixmapCollectionEditor::destroy() +{ +} + +void PixmapCollectionEditor::addPixmap() +{ + if ( !project ) + return; + + QString f; + QStringList pixmaps = qChoosePixmaps( this ); + if ( pixmaps.isEmpty() ) + return; + + QString lastName; + for ( QStringList::ConstIterator it = pixmaps.begin(); it != pixmaps.end(); ++it ) { + QPixmap pm( *it ); + if ( pm.isNull() ) + continue; + PixmapCollection::Pixmap pixmap; + pixmap.pix = pm; + QFileInfo fi ( *it ); + pixmap.name = fi.fileName(); + pixmap.absname = fi.filePath(); + if ( !project->pixmapCollection()->addPixmap( pixmap, FALSE ) ) + continue; + lastName = pixmap.name; + } + + updateView(); + QIconViewItem *item = viewPixmaps->findItem( lastName ); + if ( item ) { + viewPixmaps->setCurrentItem( item ); + viewPixmaps->ensureItemVisible( item ); + } + +} + +void PixmapCollectionEditor::removePixmap() +{ + if ( !project || !viewPixmaps->currentItem() ) + return; + project->pixmapCollection()->removePixmap( viewPixmaps->currentItem()->text() ); + updateView(); +} + +void PixmapCollectionEditor::updateView() +{ + if ( !project ) + return; + + viewPixmaps->clear(); + + QValueList pixmaps = project->pixmapCollection()->pixmaps(); + for ( QValueList::Iterator it = pixmaps.begin(); it != pixmaps.end(); ++it ) { + // #### might need to scale down the pixmap + QIconViewItem *item = new QIconViewItem( viewPixmaps, (*it).name, scaledPixmap( (*it).pix ) ); + //item->setRenameEnabled( TRUE ); // this will be a bit harder to implement + item->setDragEnabled( FALSE ); + item->setDropEnabled( FALSE ); + } + viewPixmaps->setCurrentItem( viewPixmaps->firstItem() ); + currentChanged( viewPixmaps->firstItem() ); +} + +void PixmapCollectionEditor::currentChanged( QIconViewItem * i ) +{ + buttonOk->setEnabled( !!i ); +} + +void PixmapCollectionEditor::setChooserMode( bool c ) +{ + chooser = c; + if ( chooser ) { + buttonClose->hide(); + buttonOk->show(); + buttonCancel->show(); + buttonOk->setEnabled( FALSE ); + buttonOk->setDefault( TRUE ); + connect( viewPixmaps, SIGNAL( doubleClicked( QIconViewItem * ) ), buttonOk, SIGNAL( clicked() ) ); + connect( viewPixmaps, SIGNAL( returnPressed( QIconViewItem * ) ), buttonOk, SIGNAL( clicked() ) ); + setCaption( i18n( "Choose Image" ) ); + } else { + buttonClose->show(); + buttonOk->hide(); + buttonCancel->hide(); + buttonClose->setDefault( TRUE ); + } + updateView(); +} + +void PixmapCollectionEditor::setCurrentItem( const QString & name ) +{ + QIconViewItem *i = viewPixmaps->findItem( name ); + if ( i ) { + viewPixmaps->setCurrentItem( i ); + currentChanged( i ); + } +} + +void PixmapCollectionEditor::setProject( Project * pro ) +{ + project = pro; + updateView(); +} + +QPixmap PixmapCollectionEditor::scaledPixmap( const QPixmap & p ) +{ + QPixmap pix( p ); + if ( pix.width() < 50 && pix.height() < 50 ) + return pix; + QImage img; + img = pix; + img = img.smoothScale( 50, 50 ); + pix.convertFromImage( img ); + return pix; +} diff --git a/kdevdesigner/designer/pixmapfunction.ui b/kdevdesigner/designer/pixmapfunction.ui new file mode 100644 index 00000000..7eb5fb94 --- /dev/null +++ b/kdevdesigner/designer/pixmapfunction.ui @@ -0,0 +1,976 @@ + +PixmapFunction +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + PixmapFunction + + + + 0 + 0 + 305 + 120 + + + + Choose Pixmap + + + true + + + + unnamed + + + 11 + + + 6 + + + + TextLabel3 + + + &Enter arguments for loading the pixmap: + + + editArguments + + + + + Frame9 + + + StyledPanel + + + Sunken + + + 2 + + + + + + + + unnamed + + + 2 + + + 0 + + + + labelFunction + + + + + + 0 + 0 + 0 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 233 + 233 + 233 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 128 + 128 + 128 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 242 + 242 + 242 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 0 + 0 + 0 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 242 + 242 + 242 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + + QPixmap( + + + + + editArguments + + + + + + 0 + 0 + 0 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 233 + 233 + 233 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 170 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 211 + 211 + 211 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 128 + 128 + 128 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 242 + 242 + 242 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 170 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 211 + 211 + 211 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 0 + 0 + 0 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 242 + 242 + 242 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 170 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 211 + 211 + 211 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + + false + + + + + TextLabel5 + + + + + + 0 + 0 + 0 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 233 + 233 + 233 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 128 + 128 + 128 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 242 + 242 + 242 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 0 + 0 + 0 + + + 211 + 211 + 211 + + + 255 + 255 + 255 + + + 242 + 242 + 242 + + + 105 + 105 + 105 + + + 140 + 140 + 140 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + + ) + + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + true + + + + + + + + + buttonOk + clicked() + PixmapFunction + accept() + + + buttonCancel + clicked() + PixmapFunction + reject() + + + + + klineedit.h + + diff --git a/kdevdesigner/designer/popupmenueditor.cpp b/kdevdesigner/designer/popupmenueditor.cpp new file mode 100644 index 00000000..198880f9 --- /dev/null +++ b/kdevdesigner/designer/popupmenueditor.cpp @@ -0,0 +1,1469 @@ +/********************************************************************** +** Copyright (C) 2003 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "actiondnd.h" +#include "actioneditorimpl.h" +#include "command.h" +#include "formfile.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "metadatabase.h" +#include "pixmapchooser.h" +#include "popupmenueditor.h" +#include "menubareditor.h" + +#include + +// Drag Object Declaration ------------------------------------------- + +class PopupMenuEditorItemPtrDrag : public QStoredDrag +{ +public: + PopupMenuEditorItemPtrDrag( PopupMenuEditorItem * item, QWidget * parent = 0, + const char * name = 0 ); + ~PopupMenuEditorItemPtrDrag() {}; + static bool canDecode( QDragMoveEvent * e ); + static bool decode( QDropEvent * e, PopupMenuEditorItem ** i ); +}; + +// Drag Object Implementation --------------------------------------- + +PopupMenuEditorItemPtrDrag::PopupMenuEditorItemPtrDrag( PopupMenuEditorItem * item, + QWidget * parent, const char * name ) + : QStoredDrag( "qt/popupmenueditoritemptr", parent, name ) +{ + QByteArray data( sizeof( Q_LONG ) ); + QDataStream stream( data, IO_WriteOnly ); + stream << ( Q_LONG ) item; + setEncodedData( data ); +} + +bool PopupMenuEditorItemPtrDrag::canDecode( QDragMoveEvent * e ) +{ + return e->provides( "qt/popupmenueditoritemptr" ); +} + +bool PopupMenuEditorItemPtrDrag::decode( QDropEvent * e, PopupMenuEditorItem ** i ) +{ + QByteArray data = e->encodedData( "qt/popupmenueditoritemptr" ); + QDataStream stream( data, IO_ReadOnly ); + + if ( !data.size() ) + return FALSE; + + Q_LONG p = 0; + stream >> p; + *i = ( PopupMenuEditorItem *) p; + + return TRUE; +} + +// PopupMenuEditorItem Implementation ----------------------------------- + +PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditor * menu, QObject * parent, const char * name ) + : QObject( parent, name ), + a( 0 ), + s( 0 ), + m( menu ), + separator( FALSE ), + removable( FALSE ) +{ + init(); + a = new QAction( this ); + QObject::connect( a, SIGNAL( destroyed() ), this, SLOT( selfDestruct() ) ); +} + + +PopupMenuEditorItem::PopupMenuEditorItem( QAction * action, PopupMenuEditor * menu, + QObject * parent, const char * name ) + : QObject( parent, name ), + a( action ), + s( 0 ), + m( menu ), + separator( FALSE ), + removable( TRUE ) +{ + init(); + if ( /*a->name() == "qt_separator_action" ||*/ ::qt_cast(a) ) + separator = TRUE; + if ( a && a->children() ) + a->installEventFilter( this ); +} + +PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditorItem * item, PopupMenuEditor * menu, + QObject * parent, const char * name ) + : QObject( parent, name ), + a( item->a ), + s( 0 ), + m( menu ), + separator( item->separator ), + removable( item->removable ) +{ + init(); + if ( ::qt_cast(a) ) + a->installEventFilter( this ); +} + +PopupMenuEditorItem::~PopupMenuEditorItem() +{ + +} + +void PopupMenuEditorItem::init() +{ + if ( a ) { + QObject::connect( a, SIGNAL( destroyed() ), this, SLOT( selfDestruct() ) ); + if ( m && !isSeparator() ) { + s = new PopupMenuEditor( m->formWindow(), m ); + QString n = "PopupMenuEditor"; + m->formWindow()->unify( s, n, TRUE ); + s->setName( n ); + MetaDataBase::addEntry( s ); + } + } +} + +PopupMenuEditorItem::ItemType PopupMenuEditorItem::type() const +{ + if ( separator ) + return Separator; + else if ( a ) + return Action; + return Unknown; +} + +void PopupMenuEditorItem::setVisible( bool enable ) +{ + if ( a ) + a->setVisible( enable ); +} + +bool PopupMenuEditorItem::isVisible() const +{ + QActionGroup *g = ::qt_cast(a); + if ( g ) + return ( g->isVisible() && g->usesDropDown() ); + else if ( a ) + return a->isVisible(); + return FALSE; +} + +void PopupMenuEditorItem::showMenu( int x, int y ) +{ + if ( ( !separator ) && s ) { + s->move( x, y ); + s->show(); + s->raise(); + } +} + +void PopupMenuEditorItem::hideMenu() +{ + if ( s ) { + s->hideSubMenu(); + s->hide(); + } +} + +void PopupMenuEditorItem::focusOnMenu() +{ + if ( s ) { + s->showSubMenu(); + s->setFocus(); + } +} + +int PopupMenuEditorItem::count() const +{ + if ( s ) { + return s->count(); + } else if ( ::qt_cast(a) ) { + const QObjectList * l = a->children(); + if ( l ) + return l->count(); + } + return 0; +} + +bool PopupMenuEditorItem::eventFilter( QObject * o, QEvent * event ) +{ + if ( ! ::qt_cast( o ) ) + return FALSE; + if ( event->type() == QEvent::ChildInserted ) { + QChildEvent * ce = ( QChildEvent * ) event; + QObject * c = ce->child(); + QAction * action = ::qt_cast( c ); + if ( s->find( action ) != -1 ) // avoid duplicates + return FALSE; + QActionGroup * actionGroup = ::qt_cast( c ); + if ( actionGroup ) + s->insert( actionGroup ); + else if ( action ) + s->insert( action ); + } + return FALSE; +} + +void PopupMenuEditorItem::selfDestruct() +{ + hideMenu(); + int i = m->find( s ); + if ( i != -1 && i < m->count() ) + m->remove( i ); // remove this item + a = 0; // the selfDestruct call was caused by the deletion of the action + delete this; +} + +// PopupMenuEditor Implementation ----------------------------------- + +PopupMenuEditorItem * PopupMenuEditor::draggedItem = 0; +int PopupMenuEditor::clipboardOperation = 0; +PopupMenuEditorItem * PopupMenuEditor::clipboardItem = 0; + +PopupMenuEditor::PopupMenuEditor( FormWindow * fw, QWidget * parent, const char * name ) + : QWidget( 0, name, WStyle_Customize | WStyle_NoBorder | WRepaintNoErase | WResizeNoErase ), + formWnd( fw ), + parentMenu( parent ), + iconWidth( 0 ), + textWidth( 0 ), + accelWidth( 0 ), + arrowWidth( 30 ), + borderSize( 2 ), + currentField( 1 ), + currentIndex( 0 ) +{ + init(); +} + +PopupMenuEditor::PopupMenuEditor( FormWindow * fw, PopupMenuEditor * menu, + QWidget * parent, const char * name ) + : QWidget( 0, name, WStyle_Customize | WStyle_NoBorder | WRepaintNoErase ), + formWnd( fw ), + parentMenu( parent ), + iconWidth( menu->iconWidth ), + textWidth( menu->textWidth ), + accelWidth( menu->accelWidth ), + arrowWidth( menu->arrowWidth ), + borderSize( menu->borderSize ), + currentField( menu->currentField ), + currentIndex( menu->currentIndex ) +{ + init(); + PopupMenuEditorItem * i; + for ( i = menu->itemList.first(); i; i = menu->itemList.next() ) { + PopupMenuEditorItem * n = new PopupMenuEditorItem( i, this ); + itemList.append( n ); + } +} + +PopupMenuEditor::~PopupMenuEditor() +{ + itemList.setAutoDelete( TRUE ); +} + +void PopupMenuEditor::init() +{ + reparent( ( QMainWindow * ) formWnd->mainContainer(), pos() ); + + addItem.action()->setMenuText( i18n("new item") ); + addSeparator.action()->setMenuText( i18n("new separator") ); + + setAcceptDrops( TRUE ); + setFocusPolicy( StrongFocus ); + + lineEdit = new QLineEdit( this ); + lineEdit->hide(); + lineEdit->setFrameStyle(QFrame::Plain | QFrame::NoFrame); + lineEdit->polish(); + lineEdit->setBackgroundOrigin(ParentOrigin); + lineEdit->setBackgroundMode(PaletteButton); + lineEdit->installEventFilter( this ); + + dropLine = new QWidget( this, 0, Qt::WStyle_NoBorder | WStyle_StaysOnTop ); + dropLine->setBackgroundColor( Qt::red ); + dropLine->hide(); + + hide(); +} + +void PopupMenuEditor::insert( PopupMenuEditorItem * item, int index ) +{ + if ( !item ) + return; + if ( index == -1 ) { + itemList.append( item ); + if ( isVisible() ) + currentIndex = itemList.count() - 1; + } else { + itemList.insert( index, item ); + if ( isVisible() ) + currentIndex = index; + } + item->m = this; + item->s->parentMenu = this; + resizeToContents(); + if ( isVisible() && parentMenu ) + parentMenu->update(); // draw arrow in parent menu + emit inserted( item->action() ); +} + +void PopupMenuEditor::insert( QAction * action, int index ) +{ + if ( !action ) + return; + insert( new PopupMenuEditorItem( action, this, 0, action->name() ), index ); +} + +void PopupMenuEditor::insert( QActionGroup * actionGroup, int index ) +{ + if ( !actionGroup ) + return; + bool dropdown = actionGroup->usesDropDown(); + PopupMenuEditorItem *i = new PopupMenuEditorItem( (QAction *)actionGroup, this, 0, + QString( actionGroup->name() ) + "Menu" ); + QActionGroup *g = 0; + QObjectList *l = actionGroup->queryList( "QAction", 0, FALSE, FALSE ); + QObjectListIterator it( *l ); + insert( i, index ); + for ( ; it.current(); ++it ) { + g = ::qt_cast(it.current()); + if ( g ) { + if ( dropdown ) + i->s->insert( g ); + else + insert( g ); + } else { + i->s->insert( (QAction*)it.current() ); + } + } + delete l; +} + +int PopupMenuEditor::find( const QAction * action ) +{ + PopupMenuEditorItem * i = itemList.first(); + while ( i ) { + if ( i->action() == action ) + return itemList.at(); + i = itemList.next(); + } + return -1; +} + +int PopupMenuEditor::find( PopupMenuEditor * menu ) +{ + PopupMenuEditorItem * i = itemList.first(); + while ( i ) { + if ( i->subMenu() == menu ) + return itemList.at(); + i = itemList.next(); + } + return -1; +} + +int PopupMenuEditor::count() +{ + return itemList.count(); +} + +PopupMenuEditorItem * PopupMenuEditor::at( int index ) +{ + return itemList.at( index ); +} + +void PopupMenuEditor::exchange( int a, int b ) +{ + PopupMenuEditorItem * ia = itemList.at( a ); + PopupMenuEditorItem * ib = itemList.at( b ); + if ( !ia || !ib || + ia == &addItem || ia == &addSeparator || + ib == &addItem || ib == &addSeparator ) + return; // do nothing + itemList.replace( b, ia ); + itemList.replace( a, ib ); +} + +void PopupMenuEditor::cut( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + + if ( clipboardItem && clipboardOperation == Cut ) + delete clipboardItem; + + clipboardOperation = Cut; + clipboardItem = itemList.at( idx ); + + if ( clipboardItem == &addItem || clipboardItem == &addSeparator ) { + clipboardOperation = None; + clipboardItem = 0; + return; // do nothing + } + + RemoveActionFromPopupCommand * cmd = + new RemoveActionFromPopupCommand( i18n( "Cut Item" ), formWnd, this, idx ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); +} + +void PopupMenuEditor::copy( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + + if ( clipboardItem && clipboardOperation == Cut ) + delete clipboardItem; + + clipboardOperation = Copy; + clipboardItem = itemList.at( idx ); + + if ( clipboardItem == &addItem || clipboardItem == &addSeparator ) { + clipboardOperation = None; + clipboardItem = 0; + } +} + +void PopupMenuEditor::paste( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + + if ( clipboardItem && clipboardOperation ) { + PopupMenuEditorItem * n = new PopupMenuEditorItem( clipboardItem, this ); + AddActionToPopupCommand * cmd = + new AddActionToPopupCommand( i18n( "Paste Item" ), formWnd, this, n, idx ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } +} + +void PopupMenuEditor::insertedActions( QPtrList & list ) +{ + QAction * a = 0; + PopupMenuEditorItem * i = itemList.first(); + + while ( i ) { + a = i->action(); + if ( a ) + list.append( a ); + i = itemList.next(); + } +} + +void PopupMenuEditor::show() +{ + resizeToContents(); + QWidget::show(); +} + +void PopupMenuEditor::choosePixmap( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + + PopupMenuEditorItem * i = 0; + QAction * a = 0; + + if ( idx < (int)itemList.count() ) { + i = itemList.at( idx ); + a = i->action(); + } else { + createItem(); + } + + hide(); // qChoosePixmap hides the menu + QIconSet icons( qChoosePixmap( 0, formWnd, 0, 0 ) ); + SetActionIconsCommand * cmd = + new SetActionIconsCommand( i18n( "Set Icon" ), formWnd, a, this, icons ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + show(); + setFocus(); +} + +void PopupMenuEditor::showLineEdit( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + + PopupMenuEditorItem * i = 0; + + if ( idx >= (int)itemList.count() ) + i = &addItem; + else + i = itemList.at( idx ); + + // open edit currentField for item name + lineEdit->setText( i->action()->menuText() ); + lineEdit->selectAll(); + lineEdit->setGeometry( borderSize + iconWidth, borderSize + itemPos( i ), + textWidth, itemHeight( i ) ); + lineEdit->show(); + lineEdit->setFocus(); +} + +void PopupMenuEditor::setAccelerator( int key, Qt::ButtonState state, int index ) +{ + // FIXME: make this a command + + int idx = ( index == -1 ? currentIndex : index ); + + if ( key == Qt::Key_Shift || + key == Qt::Key_Control || + key == Qt::Key_Alt || + key == Qt::Key_Meta || + key == Qt::Key_unknown ) + return; // ignore these keys when they are pressed + + PopupMenuEditorItem * i = 0; + + if ( idx >= (int)itemList.count() ) + i = createItem(); + else + i = itemList.at( idx ); + + int shift = ( state & Qt::ShiftButton ? Qt::SHIFT : 0 ); + int ctrl = ( state & Qt::ControlButton ? Qt::CTRL : 0 ); + int alt = ( state & Qt::AltButton ? Qt::ALT : 0 ); + int meta = ( state & Qt::MetaButton ? Qt::META : 0 ); + + QAction * a = i->action(); + QKeySequence ks = a->accel(); + int keys[4] = { ks[0], ks[1], ks[2], ks[3] }; + int n = 0; + while ( n < 4 && ks[n++] ); + n--; + if ( n < 4 ) + keys[n] = key | shift | ctrl | alt | meta; + a->setAccel( QKeySequence( keys[0], keys[1], keys[2], keys[3] ) ); + MetaDataBase::setPropertyChanged( a, "accel", TRUE ); + resizeToContents(); +} + +void PopupMenuEditor::resizeToContents() +{ + QSize s = contentsSize(); + dropLine->resize( s.width(), 2 ); + s.rwidth() += borderSize * 2; + s.rheight() += borderSize * 2; + resize( s ); +} + +void PopupMenuEditor::showSubMenu() +{ + if ( currentIndex < (int)itemList.count() ) { + itemList.at( currentIndex )->showMenu( pos().x() + width() - borderSize * 3, + pos().y() + itemPos( at( currentIndex ) ) + + borderSize * 2 ); + setFocus(); // Keep focus in this widget + } +} + +void PopupMenuEditor::hideSubMenu() +{ + if ( currentIndex < (int)itemList.count() ) + itemList.at( currentIndex )->hideMenu(); +} + +void PopupMenuEditor::focusOnSubMenu() +{ + if ( currentIndex < (int)itemList.count() ) + itemList.at( currentIndex )->focusOnMenu(); +} + +// This function has no undo. It is only here to remove an item when its action was +// removed from the action editor. +// Use removeItem to put the command on the command stack. +void PopupMenuEditor::remove( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + PopupMenuEditorItem * i = itemList.at( idx ); + if ( i && i->isRemovable() ) { + itemList.remove( idx ); + int n = itemList.count() + 1; + if ( currentIndex >= n ) + currentIndex = itemList.count() + 1; + emit removed( i->action() ); + resizeToContents(); + } +} + +PopupMenuEditorItem * PopupMenuEditor::createItem( QAction * a ) +{ + ActionEditor * ae = (ActionEditor *) formWindow()->mainWindow()->child( 0, "ActionEditor" ); + if ( !a ) + a = ae->newActionEx(); + PopupMenuEditorItem * i = new PopupMenuEditorItem( a, this ); + QString n = QString( a->name() ) + "Item"; + formWindow()->unify( i, n, FALSE ); + i->setName( n ); + AddActionToPopupCommand * cmd = + new AddActionToPopupCommand( i18n( "Add Item" ), formWnd, this, i ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + return i; +} + +void PopupMenuEditor::removeItem( int index ) +{ + int idx = ( index == -1 ? currentIndex : index ); + if ( idx < (int)itemList.count() ) { + RemoveActionFromPopupCommand * cmd = new RemoveActionFromPopupCommand( i18n( "Remove Item" ), + formWnd, + this, + idx ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + if ( itemList.count() == 0 && parentMenu ) + parentMenu->update(); + resizeToContents(); + } +} + +PopupMenuEditorItem * PopupMenuEditor::currentItem() +{ + int count = itemList.count(); + if ( currentIndex < count ) + return itemList.at( currentIndex ); + else if ( currentIndex == count ) + return &addItem; + return &addSeparator; +} + +PopupMenuEditorItem * PopupMenuEditor::itemAt( int y ) +{ + PopupMenuEditorItem * i = itemList.first(); + int iy = 0; + + while ( i ) { + iy += itemHeight( i ); + if ( iy > y ) + return i; + i = itemList.next(); + } + iy += itemHeight( &addItem ); + if ( iy > y ) + return &addItem; + return &addSeparator; +} + +void PopupMenuEditor::setFocusAt( const QPoint & pos ) +{ + hideSubMenu(); + lineEdit->hide(); + + currentIndex = 0; + int iy = 0; + PopupMenuEditorItem * i = itemList.first(); + + while ( i ) { + iy += itemHeight( i ); + if ( iy > pos.y() ) + break; + i = itemList.next(); + currentIndex++; + } + + iy += itemHeight( &addItem ); + if ( iy <= pos.y() ) + currentIndex++; + + if ( currentIndex < (int)itemList.count() ) { + if ( pos.x() < iconWidth ) + currentField = 0; + else if ( pos.x() < iconWidth + textWidth ) + currentField = 1; + else + currentField = 2; + } else { + currentField = 1; + } + + showSubMenu(); +} + +bool PopupMenuEditor::eventFilter( QObject * o, QEvent * e ) +{ + if ( o == lineEdit && e->type() == QEvent::FocusOut ) { + leaveEditMode( 0 ); + update(); + } + return QWidget::eventFilter( o, e ); +} + +void PopupMenuEditor::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); + p.save(); + QRegion reg( rect() ); + QRegion mid( borderSize, borderSize, + rect().width() - borderSize * 2, rect().height() - borderSize * 2 ); + reg -= mid; + p.setClipRegion( reg ); + style().drawPrimitive( QStyle::PE_PanelPopup, &p, rect(), colorGroup() ); + p.restore(); + drawItems( &p ); +} + +void PopupMenuEditor::mousePressEvent( QMouseEvent * e ) +{ + mousePressPos = e->pos(); + setFocusAt( mousePressPos ); + e->accept(); + update(); +} + +void PopupMenuEditor::mouseDoubleClickEvent( QMouseEvent * ) +{ + setFocusAt( mousePressPos ); + if ( currentItem() == &addSeparator ) { + PopupMenuEditorItem * i = createItem( new QSeparatorAction( 0 ) ); + i->setSeparator( TRUE ); + return; + } + if ( currentField == 0 ) { + choosePixmap(); + resizeToContents(); + } else if ( currentField == 1 ) { + showLineEdit(); + } +} + +void PopupMenuEditor::mouseMoveEvent( QMouseEvent * e ) +{ + if ( e->state() & Qt::LeftButton ) { + if ( ( e->pos() - mousePressPos ).manhattanLength() > 3 ) { + draggedItem = itemAt( mousePressPos.y() ); + if ( draggedItem == &addItem ) { + draggedItem = createItem(); + RenameActionCommand cmd( i18n( "Rename Item" ), formWnd, draggedItem->action(), + this, "Unnamed" ); + cmd.execute(); + // FIXME: start rename after drop + } else if ( draggedItem == &addSeparator ) { + draggedItem = createItem( new QSeparatorAction( 0 ) ); + draggedItem->setSeparator( TRUE ); + } + + PopupMenuEditorItemPtrDrag * d = + new PopupMenuEditorItemPtrDrag( draggedItem, this ); + + hideSubMenu(); + + draggedItem->setVisible( FALSE ); + resizeToContents(); + + // If the item is dropped in the same list, + // we will have two instances of the same pointer + // in the list. We use node instead. + int idx = itemList.find( draggedItem ); + QLNode * node = itemList.currentNode(); + + d->dragCopy(); // dragevents and stuff happens + + if ( draggedItem ) { // item was not dropped + draggedItem->setVisible( TRUE ); + draggedItem = 0; + if ( hasFocus() ) { + hideSubMenu(); + resizeToContents(); + showSubMenu(); + } + } else { // item was dropped + itemList.takeNode( node )->setVisible( TRUE ); + if ( currentIndex > 0 && currentIndex > idx ) + --currentIndex; + // the drop might happen in another menu, so we'll resize + // and show the submenu there + } + } + } +} + +void PopupMenuEditor::dragEnterEvent( QDragEnterEvent * e ) +{ + if ( e->provides( "qt/popupmenueditoritemptr" ) || + e->provides( "application/x-designer-actions" ) || + e->provides( "application/x-designer-actiongroup" ) ) { + e->accept(); + dropLine->show(); + } +} + +void PopupMenuEditor::dragLeaveEvent( QDragLeaveEvent * ) +{ + dropLine->hide(); +} + +void PopupMenuEditor::dragMoveEvent( QDragMoveEvent * e ) +{ + QPoint pos = e->pos(); + dropLine->move( borderSize, snapToItem( pos.y() ) ); + + if ( currentItem() != itemAt( pos.y() ) ) { + hideSubMenu(); + setFocusAt( pos ); + showSubMenu(); + } +} + +void PopupMenuEditor::dropEvent( QDropEvent * e ) +{ + if ( !( e->provides( "qt/popupmenueditoritemptr" ) || + e->provides( "application/x-designer-actions" ) || + e->provides( "application/x-designer-actiongroup" ) ) ) + return; + + // Hide the sub menu of the current item, but do it later + if ( currentIndex < (int)itemList.count() ) { + PopupMenuEditor *s = itemList.at( currentIndex )->s; + QTimer::singleShot( 0, s, SLOT( hide() ) ); + } + + draggedItem = 0; + PopupMenuEditorItem * i = 0; + + if ( e->provides( "qt/popupmenueditoritemptr" ) ) { + PopupMenuEditorItemPtrDrag::decode( e, &i ); + } else { + if ( e->provides( "application/x-designer-actiongroup" ) ) { + QActionGroup * g = ::qt_cast(ActionDrag::action()); + if ( g->usesDropDown() ) { + i = new PopupMenuEditorItem( g, this ); + QString n = QString( g->name() ) + "Item"; + formWindow()->unify( i, n, FALSE ); + i->setName( n ); + QObjectList *l = g->queryList( "QAction", 0, FALSE, FALSE ); + QObjectListIterator it( *l ); + for ( ; it.current(); ++it ) { + g = ::qt_cast(it.current()); + if ( g ) + i->s->insert( g ); + else + i->s->insert( (QAction*)it.current() ); + } + delete l; + } else { + dropInPlace( g, e->pos().y() ); + } + } else if ( e->provides( "application/x-designer-actions" ) ) { + QAction *a = ::qt_cast(ActionDrag::action()); + i = new PopupMenuEditorItem( a, this ); + } + } + + if ( i ) { + dropInPlace( i, e->pos().y() ); + QTimer::singleShot( 0, this, SLOT( resizeToContents() ) ); + } + + QTimer::singleShot( 0, this, SLOT( showSubMenu() ) ); + QTimer::singleShot( 0, this, SLOT( setFocus() ) ); + dropLine->hide(); + e->accept(); +} + +void PopupMenuEditor::keyPressEvent( QKeyEvent * e ) +{ + if ( lineEdit->isHidden() ) { // In navigation mode + + switch ( e->key() ) { + + case Qt::Key_Delete: + hideSubMenu(); + removeItem(); + showSubMenu(); + break; + + case Qt::Key_Backspace: + clearCurrentField(); + break; + + case Qt::Key_Up: + navigateUp( e->state() & Qt::ControlButton ); + break; + + case Qt::Key_Down: + navigateDown( e->state() & Qt::ControlButton ); + break; + + case Qt::Key_Left: + navigateLeft(); + break; + + case Qt::Key_Right: + navigateRight(); + break; + + case Qt::Key_PageUp: + currentIndex = 0; + break; + + case Qt::Key_PageDown: + currentIndex = itemList.count(); + break; + + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_F2: + enterEditMode( e ); + // move on + case Qt::Key_Alt: + case Qt::Key_Shift: + case Qt::Key_Control: + // do nothing + return; + + case Qt::Key_Escape: + currentField = 0; + navigateLeft(); + break; + + case Qt::Key_C: + if ( e->state() & Qt::ControlButton && + currentIndex < (int)itemList.count() ) { + copy( currentIndex ); + break; + } + + case Qt::Key_X: + if ( e->state() & Qt::ControlButton && + currentIndex < (int)itemList.count() ) { + hideSubMenu(); + cut( currentIndex ); + showSubMenu(); + break; + } + + case Qt::Key_V: + if ( e->state() & Qt::ControlButton ) { + hideSubMenu(); + paste( currentIndex < (int)itemList.count() ? currentIndex + 1: itemList.count() ); + showSubMenu(); + break; + } + + default: + if ( currentItem()->isSeparator() ) + return; + if ( currentField == 1 ) { + showLineEdit(); + QApplication::sendEvent( lineEdit, e ); + e->accept(); + return; + } else if ( currentField == 2 ) { + setAccelerator( e->key(), e->state() ); + showSubMenu(); + } + break; + + } + + } else { // In edit mode + switch ( e->key() ) { + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_Escape: + leaveEditMode( e ); + e->accept(); + return; + } + } + update(); +} + +void PopupMenuEditor::focusInEvent( QFocusEvent * ) +{ + showSubMenu(); + update(); + parentMenu->update(); +} + +void PopupMenuEditor::focusOutEvent( QFocusEvent * ) +{ + QWidget * fw = qApp->focusWidget(); + if ( !fw || ( !::qt_cast(fw) && fw != lineEdit ) ) { + hideSubMenu(); + if ( fw && ::qt_cast(fw) ) + return; + QWidget * w = this; + while ( w && w != fw && ::qt_cast(w) ) { // hide all popups + w->hide(); + w = ((PopupMenuEditor *)w)->parentEditor(); + } + } +} + +void PopupMenuEditor::drawItem( QPainter * p, PopupMenuEditorItem * i, + const QRect & r, int f ) const +{ + int x = r.x(); + int y = r.y(); + int h = r.height(); + + p->fillRect( r, colorGroup().brush( QColorGroup::Background ) ); + + if ( i->isSeparator() ) { + style().drawPrimitive( QStyle::PE_Separator, p, + QRect( r.x(), r.y() + 2, r.width(), 1 ), + colorGroup(), QStyle::Style_Sunken | f ); + return; + } + + const QAction * a = i->action(); + if ( a->isToggleAction() && a->isOn() ) { + style().drawPrimitive( QStyle::PE_CheckMark, p, + QRect( x , y, iconWidth, h ), + colorGroup(), f ); + } else { + QPixmap icon = a->iconSet().pixmap( QIconSet::Automatic, QIconSet::Normal ); + p->drawPixmap( x + ( iconWidth - icon.width() ) / 2, + y + ( h - icon.height() ) / 2, + icon ); + } + x += iconWidth; + p->drawText( x, y, textWidth, h, + QPainter::AlignLeft | + QPainter::AlignVCenter | + Qt::ShowPrefix | + Qt::SingleLine, + a->menuText() ); + + x += textWidth + borderSize * 3; + p->drawText( x, y, accelWidth, h, + QPainter::AlignLeft | QPainter::AlignVCenter, + a->accel() ); + if ( i->count() ) // Item has submenu + style().drawPrimitive( QStyle::PE_ArrowRight, p, + QRect( r.width() - arrowWidth, r.y(), arrowWidth, r.height() ), + colorGroup(), f ); +} + +void PopupMenuEditor::drawWinFocusRect( QPainter * p, const QRect & r ) const +{ + if ( currentIndex < (int)itemList.count() && + ((PopupMenuEditor*)this)->itemList.at( currentIndex )->isSeparator() ) { + p->drawWinFocusRect( borderSize, r.y(), width() - borderSize * 2, r.height() ); + return; + } + int y = r.y(); + int h = r.height(); + if ( currentField == 0 ) + p->drawWinFocusRect( borderSize + 1, y, iconWidth - 2, h ); + else if ( currentField == 1 ) + p->drawWinFocusRect( borderSize + iconWidth, y, textWidth, h ); + else if ( currentField == 2 ) + p->drawWinFocusRect( borderSize + iconWidth + textWidth + + borderSize * 3, y, accelWidth, h ); +} + +void PopupMenuEditor::drawItems( QPainter * p ) +{ + int flags = 0; + int idx = 0; + + QColorGroup enabled = colorGroup(); + QColorGroup disabled = palette().disabled(); + QRect focus; + QRect rect( borderSize, borderSize, width() - borderSize * 2, 0 ); + + PopupMenuEditorItem * i = itemList.first(); + while ( i ) { + if ( i->isVisible() ) { + rect.setHeight( itemHeight( i ) ); + if ( idx == currentIndex ) + focus = rect; + if ( i->action()->isEnabled() ) { + flags = QStyle::Style_Enabled; + p->setPen( enabled.buttonText() ); + } else { + flags = QStyle::Style_Default; + p->setPen( disabled.buttonText() ); + } + drawItem( p, i, rect, flags ); + rect.moveBy( 0, rect.height() ); + } + i = itemList.next(); + idx++; + } + + // Draw the "add item" and "add separator" items + p->setPen( darkBlue ); + rect.setHeight( itemHeight( &addItem ) ); + if ( idx == currentIndex ) + focus = rect; + drawItem( p, &addItem, rect, QStyle::Style_Default ); + rect.moveBy( 0, rect.height() ); + idx++; + rect.setHeight( itemHeight( &addSeparator ) ); + if ( idx == currentIndex ) + focus = rect; + drawItem( p, &addSeparator, rect, QStyle::Style_Default ); + idx++; + + if ( hasFocus() && !draggedItem ) + drawWinFocusRect( p, focus ); +} + +QSize PopupMenuEditor::contentsSize() +{ + QRect textRect = fontMetrics().boundingRect( addSeparator.action()->menuText() ); + textWidth = textRect.width(); + accelWidth = textRect.height(); // default size + iconWidth = textRect.height(); + + int w = 0; + int h = itemHeight( &addItem ) + itemHeight( &addSeparator ); + PopupMenuEditorItem * i = itemList.first(); + QAction * a = 0; + while ( i ) { + if ( i->isVisible() ) { + if ( !i->isSeparator() ) { + a = i->action(); + w = a->iconSet().pixmap( QIconSet::Automatic, QIconSet::Normal ).rect().width() + + borderSize; // padding + iconWidth = QMAX( iconWidth, w ); + w = fontMetrics().boundingRect( a->menuText() ).width(); + textWidth = QMAX( textWidth, w ); + w = fontMetrics().boundingRect( a->accel() ).width() + 2; // added padding? + accelWidth = QMAX( accelWidth, w ); + } + h += itemHeight( i ); + } + i = itemList.next(); + } + + int width = iconWidth + textWidth + borderSize * 3 + accelWidth + arrowWidth; + return QSize( width, h ); +} + +int PopupMenuEditor::itemHeight( const PopupMenuEditorItem * item ) const +{ + if ( !item || ( item && !item->isVisible() ) ) + return 0; + if ( item->isSeparator() ) + return 4; // FIXME: hardcoded ( get from styles )r + int padding = + borderSize * 6; + QAction * a = item->action(); + int h = a->iconSet().pixmap( QIconSet::Automatic, QIconSet::Normal ).rect().height(); + h = QMAX( h, fontMetrics().boundingRect( a->menuText() ).height() + padding ); + h = QMAX( h, fontMetrics().boundingRect( a->accel() ).height() + padding ); + return h; +} + +int PopupMenuEditor::itemPos( const PopupMenuEditorItem * item ) const +{ + PopupMenuEditor * that = ( PopupMenuEditor * ) this; + int y = 0; + PopupMenuEditorItem * i = that->itemList.first(); + while ( i ) { + if ( i == item ) + return y; + y += itemHeight( i ); + i = that->itemList.next(); + } + return y; +} + +int PopupMenuEditor::snapToItem( int y ) +{ + int iy = 0; + int dy = 0; + + PopupMenuEditorItem * i = itemList.first(); + + while ( i ) { + dy = itemHeight( i ); + if ( iy + dy / 2 > y ) + return iy; + iy += dy; + i = itemList.next(); + } + + return iy; +} + +void PopupMenuEditor::dropInPlace( PopupMenuEditorItem * i, int y ) +{ + int iy = 0; + int dy = 0; + int idx = 0; + + PopupMenuEditorItem * n = itemList.first(); + + while ( n ) { + dy = itemHeight( n ); + if ( iy + dy / 2 > y ) + break; + iy += dy; + idx++; + n = itemList.next(); + } + int same = itemList.findRef( i ); + AddActionToPopupCommand * cmd = new AddActionToPopupCommand( i18n( "Drop Item" ), formWnd, this, i, idx ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + currentIndex = ( same >= 0 && same < idx ) ? idx - 1 : idx; + currentField = 1; +} + +void PopupMenuEditor::dropInPlace( QActionGroup * g, int y ) +{ + if (!g->children()) + return; + QObjectList l = *g->children(); + for ( int i = 0; i < (int)l.count(); ++i ) { + QAction *a = ::qt_cast(l.at(i)); + QActionGroup *g = ::qt_cast(l.at(i)); + if ( g ) + dropInPlace( g, y ); + else if ( a ) + dropInPlace( new PopupMenuEditorItem( a, this ), y ); + } +} + +void PopupMenuEditor::safeDec() +{ + do { + currentIndex--; + } while ( currentIndex > 0 && !currentItem()->isVisible() ); + if ( currentIndex == 0 && + !currentItem()->isVisible() && + parentMenu ) { + parentMenu->setFocus(); + } +} + +void PopupMenuEditor::safeInc() +{ + int max = itemList.count() + 1; + if ( currentIndex < max ) { + do { + currentIndex++; + } while ( currentIndex < max && !currentItem()->isVisible() ); // skip invisible items + } +} + +void PopupMenuEditor::clearCurrentField() +{ + if ( currentIndex >= (int)itemList.count() ) + return; // currentIndex is addItem or addSeparator + PopupMenuEditorItem * i = currentItem(); + hideSubMenu(); + if ( i->isSeparator() ) + return; + if ( currentField == 0 ) { + QIconSet icons( 0 ); + SetActionIconsCommand * cmd = new SetActionIconsCommand( i18n( "Remove Icon" ), + formWnd, + i->action(), + this, + icons ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } else if ( currentField == 2 ) { + i->action()->setAccel( 0 ); + } + resizeToContents(); + showSubMenu(); + return; +} + +void PopupMenuEditor::navigateUp( bool ctrl ) +{ + if ( currentIndex > 0 ) { + hideSubMenu(); + if ( ctrl ) { + ExchangeActionInPopupCommand * cmd = + new ExchangeActionInPopupCommand( i18n( "Move Item Up" ), + formWnd, + this, + currentIndex, + currentIndex - 1 ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + safeDec(); + } else { + safeDec(); + } + showSubMenu(); + } else if ( parentMenu ) { + parentMenu->setFocus(); + parentMenu->update(); + } +} + +void PopupMenuEditor::navigateDown( bool ctrl ) +{ + hideSubMenu(); + if ( ctrl ) { + if ( currentIndex < ( (int)itemList.count() - 1 ) ) { // safe index + ExchangeActionInPopupCommand * cmd = + new ExchangeActionInPopupCommand( i18n( "Move Item Down" ), + formWnd, + this, + currentIndex, + currentIndex + 1 ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + safeInc(); + } + } else { // ! Ctrl + safeInc(); + } + if ( currentIndex >= (int)itemList.count() ) + currentField = 1; + showSubMenu(); +} + +void PopupMenuEditor::navigateLeft() +{ + if ( currentItem()->isSeparator() || + currentIndex >= (int)itemList.count() || + currentField == 0 ) { + if ( parentMenu ) { + hideSubMenu(); + parentMenu->setFocus(); + } else if ( !currentItem()->isSeparator() ) { + currentField = 2; + } + } else { + currentField--; + } +} + +void PopupMenuEditor::navigateRight() +{ + if ( !currentItem()->isSeparator() && + currentIndex < (int)itemList.count() ) { + if ( currentField == 2 ) { + focusOnSubMenu(); + } else { + currentField++; + currentField %= 3; + } + } +} + +void PopupMenuEditor::enterEditMode( QKeyEvent * e ) +{ + PopupMenuEditorItem * i = currentItem(); + + if ( i == &addSeparator ) { + i = createItem( new QSeparatorAction( 0 ) ); + } else if ( i->isSeparator() ) { + return; + } else if ( currentField == 0 ) { + choosePixmap(); + } else if ( currentField == 1 ) { + showLineEdit(); + return; + } else {// currentField == 2 + setAccelerator( e->key(), e->state() ); + } + showSubMenu(); + return; +} + +void PopupMenuEditor::leaveEditMode( QKeyEvent * e ) +{ + setFocus(); + lineEdit->hide(); + + PopupMenuEditorItem * i = 0; + if ( e && e->key() == Qt::Key_Escape ) { + update(); + return; + } + + if ( currentIndex >= (int)itemList.count() ) { + // new item was created + QAction * a = formWnd->mainWindow()->actioneditor()->newActionEx(); + QString actionText = lineEdit->text(); + actionText.replace("&&", "&"); + QString menuText = lineEdit->text(); + a->setText( actionText ); + a->setMenuText( menuText ); + i = createItem( a ); + QString n = constructName( i ); + formWindow()->unify( a, n, TRUE ); + a->setName( n ); + MetaDataBase::addEntry( a ); + MetaDataBase::setPropertyChanged( a, "menuText", TRUE ); + ActionEditor *ae = (ActionEditor*)formWindow()->mainWindow()->child( 0, "ActionEditor" ); + if ( ae ) + ae->updateActionName( a ); + } else { + i = itemList.at( currentIndex ); + RenameActionCommand * cmd = new RenameActionCommand( i18n( "Rename Item" ), + formWnd, + i->action(), + this, + lineEdit->text() ); + formWnd->commandHistory()->addCommand( cmd ); + cmd->execute(); + } + resizeToContents(); + + if ( !i ) + return; + + if ( i->isSeparator() ) + hideSubMenu(); + else + showSubMenu(); +} + +QString PopupMenuEditor::constructName( PopupMenuEditorItem *item ) +{ + QString s; + QString name = item->action()->menuText(); + QWidget *e = parentEditor(); + PopupMenuEditor *p = ::qt_cast(e); + if ( p ) { + int idx = p->find( item->m ); + PopupMenuEditorItem * i = ( idx > -1 ? p->at( idx ) : 0 ); + s = ( i ? QString( i->action()->name() ).remove( "Action" ) : QString( "" ) ); + } else { + MenuBarEditor *b = ::qt_cast(e); + if ( b ) { + int idx = b->findItem( item->m ); + MenuBarEditorItem * i = ( idx > -1 ? b->item( idx ) : 0 ); + s = ( i ? i->menuText().lower() : QString( "" ) ); + } + } + // replace illegal characters + + return ( RenameMenuCommand::makeLegal( s ) + + RenameMenuCommand::makeLegal( name ) + "Action" ); +} diff --git a/kdevdesigner/designer/popupmenueditor.h b/kdevdesigner/designer/popupmenueditor.h new file mode 100644 index 00000000..ca14205b --- /dev/null +++ b/kdevdesigner/designer/popupmenueditor.h @@ -0,0 +1,235 @@ +/********************************************************************** +** Copyright (C) 2003 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef POPUPMENUEDITOR_H +#define POPUPMENUEDITOR_H + +#include +#include +#include + +class PopupMenuEditor; +class QMenuItem; + +class PopupMenuEditorItem : public QObject +{ + Q_OBJECT + + friend class PopupMenuEditor; + + PopupMenuEditorItem( PopupMenuEditor * menu = 0, QObject * parent = 0, const char * name = 0 ); + +public: + enum ItemType { + Unknown = -1, + Separator = 0, + Action = 1 + }; + + PopupMenuEditorItem( QAction * action, PopupMenuEditor * menu, + QObject * parent = 0, const char * name = 0 ); + PopupMenuEditorItem( PopupMenuEditorItem * item, PopupMenuEditor * menu, + QObject * parent = 0, const char * name = 0 ); + ~PopupMenuEditorItem(); + + void init(); + + ItemType type() const; + QAction * action() const { return a; } + + void setVisible( bool enable ); + bool isVisible() const; + + void setSeparator( bool enable ) { separator = enable; } + bool isSeparator() const { return separator; } + + void setRemovable( bool enable ) { removable = enable; } + bool isRemovable() const { return removable; } + + void showMenu( int x, int y ); + void hideMenu(); + void focusOnMenu(); + PopupMenuEditor * subMenu() const { return s; } + + int count() const; + + bool eventFilter( QObject *, QEvent * event ); + +public slots: + void selfDestruct(); + +protected: + +private: + QAction * a; + PopupMenuEditor * s; + PopupMenuEditor * m; + uint separator : 1; + uint removable : 1; +}; + +class FormWindow; +class MainWindow; +class QLineEdit; + +#include + +class PopupMenuEditor : public QWidget +{ + Q_OBJECT + + friend class PopupMenuEditorItem; + friend class MenuBarEditor; + friend class Resource; + +public: + PopupMenuEditor( FormWindow * fw, QWidget * parent = 0, const char * name = 0 ); + PopupMenuEditor( FormWindow * fw, PopupMenuEditor * menu, QWidget * parent, const char * name = 0 ); + ~PopupMenuEditor(); + + void init(); + + void insert( PopupMenuEditorItem * item, int index = -1 ); + void insert( QAction * action, int index = -1 ); + void insert( QActionGroup * actionGroup, int index = -1 ); + int find( const QAction * action ); + int find( PopupMenuEditor * menu ); + int count(); + PopupMenuEditorItem * at( int index ); + PopupMenuEditorItem * at( QPoint pos ) { return itemAt( pos.y() ); } + void exchange( int a, int b ); + + void cut( int index ); + void copy( int index ); + void paste( int index ); + + void insertedActions( QPtrList & list ); + + void show(); + void choosePixmap( int index = -1 ); + void showLineEdit( int index = -1); + void setAccelerator( int key, Qt::ButtonState state, int index = -1 ); + + FormWindow * formWindow() { return formWnd; } + bool isCreatingAccelerator() { return ( currentField == 2 ); } + + QPtrList * items() { return &itemList; } + + QWidget * parentEditor() { return parentMenu; } + +signals: + void inserted( QAction * ); + void removed( QAction * ); + +public slots: + + void cut() { cut( currentIndex ); } + void copy() { copy( currentIndex ); } + void paste() { paste( currentIndex ); } + + void remove( int index ); + void remove( QAction * a ) { remove( find( a ) ); } + + void resizeToContents(); + void showSubMenu(); + void hideSubMenu(); + void focusOnSubMenu(); + +protected: + PopupMenuEditorItem * createItem( QAction * a = 0 ); + void removeItem( int index = -1 ); + PopupMenuEditorItem * currentItem(); + PopupMenuEditorItem * itemAt( int y ); + void setFocusAt( const QPoint & pos ); + + bool eventFilter( QObject * o, QEvent * e ); + void paintEvent( QPaintEvent * e ); + void mousePressEvent( QMouseEvent * e ); + void mouseDoubleClickEvent( QMouseEvent * e ); + void mouseMoveEvent( QMouseEvent * e ); + void dragEnterEvent( QDragEnterEvent * e ); + void dragLeaveEvent( QDragLeaveEvent * e ); + void dragMoveEvent( QDragMoveEvent * e ); + void dropEvent( QDropEvent * e ); + void keyPressEvent( QKeyEvent * e ); + void focusInEvent( QFocusEvent * e ); + void focusOutEvent( QFocusEvent * e ); + + void drawItems( QPainter * p ); + void drawItem( QPainter * p, PopupMenuEditorItem * i, const QRect & r, int f ) const; + void drawWinFocusRect( QPainter * p, const QRect & r ) const; + + QSize contentsSize(); + int itemHeight( const PopupMenuEditorItem * item ) const; + int itemPos( const PopupMenuEditorItem * item ) const; + + int snapToItem( int y ); + void dropInPlace( PopupMenuEditorItem * i, int y ); + void dropInPlace( QActionGroup * g, int y ); + + void safeDec(); + void safeInc(); + + void clearCurrentField(); + void navigateUp( bool ctrl ); + void navigateDown( bool ctrl ); + void navigateLeft(); + void navigateRight(); + void enterEditMode( QKeyEvent * e ); + void leaveEditMode( QKeyEvent * e ); + + QString constructName( PopupMenuEditorItem *item ); + +private: + FormWindow * formWnd; + QLineEdit * lineEdit; + QWidget * dropLine; + QPtrList itemList; + PopupMenuEditorItem addItem; + PopupMenuEditorItem addSeparator; + QWidget * parentMenu; + + int iconWidth; + int textWidth; + int accelWidth; + int arrowWidth; + int borderSize; + + int currentField; + int currentIndex; + QPoint mousePressPos; + static PopupMenuEditorItem * draggedItem; + + enum ClipboardOperation { + None = 0, + Cut = 1, + Copy = 2 + }; + static int clipboardOperation; + static PopupMenuEditorItem * clipboardItem; +}; + +#endif //POPUPMENUEDITOR_H diff --git a/kdevdesigner/designer/preferences.ui b/kdevdesigner/designer/preferences.ui new file mode 100644 index 00000000..58cc7def --- /dev/null +++ b/kdevdesigner/designer/preferences.ui @@ -0,0 +1,648 @@ + +Preferences +********************************************************************* +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + Preferences + + + + 0 + 0 + 482 + 480 + + + + Preferences + + + true + + + <b>Preferences</b><p>Change the preferences of Qt Designer. There is always one tab with general preferences. There may be additional tabs, depending on which plugins are installed.</p> + + + + unnamed + + + 11 + + + 6 + + + + tabWidget + + + + pageGeneral + + + General + + + + unnamed + + + + groupBox4 + + + File Saving + + + + unnamed + + + + checkBoxAutoSave + + + Enable auto sa&ve + + + true + + + + + layout3 + + + + unnamed + + + + textLabelAutoSave + + + Auto save &interval: + + + timeEditAutoSave + + + + + timeEditAutoSave + + + + + + + + + + + + buttonGroup2 + + + Plu&gin Paths + + + + unnamed + + + + textEditPluginPaths + + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + A splash screen is displayed when starting Qt Designer if this option is checked. + + + + + GroupBox5 + + + Ge&neral + + + + unnamed + + + 11 + + + 6 + + + + checkBoxWorkspace + + + Restore last &workspace on startup + + + true + + + Restore last workspace + + + The current workspace settings will be restored the next time you start Qt Designer if this option is checked. + + + + + checkBoxSplash + + + Show &splash screen on startup + + + true + + + Show Splashscreen + + + A splash screen is displayed when starting Qt Designer if this option is checked. + + + + + checkBoxStartDialog + + + Show start &dialog + + + true + + + + + checkAutoEdit + + + Disable data&base auto-edit in preview + + + true + + + + + checkBoxTextLabels + + + Show toolbutton lab&els + + + Text Labels + + + Text labels will be used in the toolbars if this is checked. + + + + + + + groupBoxGrid + + + G&rid + + + true + + + + + + + unnamed + + + 11 + + + 6 + + + + checkBoxSnapGrid + + + Sn&ap to grid + + + true + + + Snap to the grid + + + <b>Customize the grid-settings for all forms.</b><p>When <b>Snap to Grid</b> is checked, the widgets snap to the grid using the the X/Y resolution.</p> + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + spinGridX + + + 50 + + + 5 + + + 10 + + + Grid resolution + + + <b>Customize the grid-settings for all forms.</b><p>When <b>Show Grid</b> is checked, a grid is shown on all forms using the X/Y resolution.</p> + + + + + spinGridY + + + 50 + + + 5 + + + 10 + + + Grid resolution + + + <b>Customize the grid-settings for all forms.</b><p>When <b>Show Grid</b> is checked, a grid is shown on all forms using the X/Y resolution.</p> + + + + + Label1 + + + Grid-&X: + + + spinGridX + + + + + Label1_2 + + + Grid-&Y: + + + spinGridY + + + + + + + + + ButtonGroup1 + + + Backgro&und + + + + unnamed + + + 11 + + + 6 + + + + buttonColor + + + false + + + + 0 + 0 + 0 + 0 + + + + TabFocus + + + false + + + Choose a color + + + Select a color in the color dialog. + + + + + radioColor + + + NoFocus + + + Co&lor + + + Use a background color + + + Use a background color. + + + + + radioPixmap + + + &Pixmap + + + true + + + Use a background pixmap + + + Use a background pixmap. + + + + + buttonPixmap + + + + 0 + 0 + 0 + 0 + + + + TabFocus + + + false + + + Select a pixmap + + + Choose a pixmap file. + + + + + + + + + + Layout6 + + + + unnamed + + + 0 + + + 6 + + + + helpButton + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonCancel + + + &Cancel + + + true + + + false + + + Close the dialog and discard any changes. + + + + + + + + + StyledButton +
      styledbutton.h
      + + 40 + 25 + + 0 + + 5 + 5 + 0 + 0 + + "image0" + clicked() + changed() + color + pixmap + scale +
      +
      + + + 789c9dd2cb8e9b301406e07d9e0225bba89a09601350d505302c5b7559a9eac23e6672b363620c0ca9faeef53949da2e2a55eab123f9e38f2f217e5e475f3e7f8cd6cf8bde0b7f8008f6c2456b3518337ffdf6e1fb62992451e8691ac5cb778be55304d1277b6e71fc12c6ab0d157222e61bd8e4c812196f6216535a13f318624a6764b2495842e99558249014c81e99c6294b69d3376291424ae9806431638cd28628183081f4489e70ce13e4852878c129ad905992f18cd291283295517a466ed32ddfa64847945bb595c80e99a739cf29d54499ab9c528b2c58c10b86344428540148400a26b8a0541241b482d215523299494a0551c9562ae409091c32e0c82351410b942aa4e22a53941e882d36e41ed966d8903b2215f215f99a6143b6442afaafff5aff485658622584a091941256948443d1cabbdd6ebf3f28753c09a9e9cdc1fe703c9e4ea19f689a0430fa4c8908082be093d08d016bbb0bbd5e7ceafade5b30de19d083b3fa9e008cd39b9fafd69495b473af7fcfb15325c1d61eea0afaf005ddf97b5295c658a866338f97591babef7340fa396c6c5ca9e7fe650807d0bf566b4262299986ba335a3b4a2cc84b69ac85b1b673037d8fabf95b023a9c09cc7530e104dd5419ed6e27083fb09a7c752db5a9bd31cde4ec634ed8a39aebbe337618c3f6fdc5dee6d8b0bb0d6b5b8b1fad43d78fe4e14e3f6aace8e29d9d736777fea3c686eee0138c9726d4d00c548df7a315ff750f7ebc5ffc04a0e5308d + + + + + buttonOk + clicked() + Preferences + accept() + + + buttonCancel + clicked() + Preferences + reject() + + + radioColor + toggled(bool) + buttonColor + setEnabled(bool) + + + radioPixmap + toggled(bool) + buttonPixmap + setEnabled(bool) + + + + buttonOk + buttonCancel + tabWidget + radioColor + radioPixmap + buttonColor + buttonPixmap + checkBoxSnapGrid + spinGridX + spinGridY + checkBoxWorkspace + checkBoxSplash + checkBoxStartDialog + checkAutoEdit + checkBoxTextLabels + helpButton + + + init() + destroy() + + + + styledbutton.h + styledbutton.h + +
      diff --git a/kdevdesigner/designer/previewframe.cpp b/kdevdesigner/designer/previewframe.cpp new file mode 100644 index 00000000..2d14fb7b --- /dev/null +++ b/kdevdesigner/designer/previewframe.cpp @@ -0,0 +1,57 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include +#include + +#include "previewframe.h" + +PreviewFrame::PreviewFrame( QWidget *parent, const char *name ) + : QVBox( parent, name ) +{ + setMinimumSize(200, 200); + setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + setLineWidth(1); + + PreviewWorkspace * w = new PreviewWorkspace( this ); + w->setEraseColor(colorGroup().dark()); + previewWidget = new PreviewWidget( w ); + previewWidget->move( 10, 10 ); +} + +void PreviewFrame::setPreviewPalette(QPalette pal) +{ + previewWidget->setPalette(pal); +} + +void PreviewWorkspace::paintEvent( QPaintEvent* ) +{ + QPainter p ( this ); + p.setPen( QPen( white ) ); + p.drawText ( 0, height() / 2, width(), height(), AlignHCenter, + "The moose in the noose\nate the goose who was loose." ); +} + diff --git a/kdevdesigner/designer/previewframe.h b/kdevdesigner/designer/previewframe.h new file mode 100644 index 00000000..632e8b9a --- /dev/null +++ b/kdevdesigner/designer/previewframe.h @@ -0,0 +1,59 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PREVIEWFRAME_H +#define PREVIEWFRAME_H + +#include +#include + +#include "previewwidgetimpl.h" + +class PreviewWorkspace : public QWorkspace +{ + Q_OBJECT +public: + PreviewWorkspace( QWidget* parent = 0, const char* name = 0 ) + : QWorkspace( parent, name ) {} + ~PreviewWorkspace() {} + +protected: + void paintEvent( QPaintEvent* ); +}; + +class PreviewFrame : public QVBox +{ + Q_OBJECT + +public: + PreviewFrame( QWidget *parent = 0, const char *name = 0 ); + void setPreviewPalette(QPalette); + +private: + PreviewWidget *previewWidget; +}; + +#endif diff --git a/kdevdesigner/designer/previewwidget.ui b/kdevdesigner/designer/previewwidget.ui new file mode 100644 index 00000000..f297d2d4 --- /dev/null +++ b/kdevdesigner/designer/previewwidget.ui @@ -0,0 +1,304 @@ + +PreviewWidgetBase +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + PreviewWidgetBase + + + + 0 + 0 + 378 + 236 + + + + + 1 + 1 + + + + Preview Window + + + + unnamed + + + 11 + + + 6 + + + + Layout6 + + + + unnamed + + + 0 + + + 6 + + + + Layout17 + + + + unnamed + + + 0 + + + 6 + + + + ButtonGroup1 + + + ButtonGroup + + + + unnamed + + + 11 + + + 6 + + + + RadioButton1 + + + RadioButton1 + + + true + + + + + RadioButton2 + + + RadioButton2 + + + + + RadioButton3 + + + RadioButton3 + + + + + + + ButtonGroup2 + + + ButtonGroup2 + + + + unnamed + + + 11 + + + 6 + + + + CheckBox1 + + + CheckBox1 + + + true + + + + + CheckBox2 + + + CheckBox2 + + + + + + + ProgressBar1 + + + 50 + + + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + LineEdit + + + + + + ComboBox + + + + ComboBox1 + + + + + Layout13 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox1 + + + + + PushButton1 + + + PushButton + + + + + + + ScrollBar1 + + + Horizontal + + + + + Slider1 + + + Horizontal + + + + + textView + + + + 32767 + 50 + + + + <p> +<a href="http://www.trolltech.com/">http://www.trolltech.com</a> +</p> +<p> +<a href="http://www.kde.org/">http://www.kde.org</a> +</p> + + + + + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + init() + destroy() + + diff --git a/kdevdesigner/designer/previewwidgetimpl.cpp b/kdevdesigner/designer/previewwidgetimpl.cpp new file mode 100644 index 00000000..2c2c6528 --- /dev/null +++ b/kdevdesigner/designer/previewwidgetimpl.cpp @@ -0,0 +1,65 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "qobjectlist.h" +#include "previewwidgetimpl.h" + +PreviewWidget::PreviewWidget( QWidget *parent, const char *name ) + : PreviewWidgetBase( parent, name ) +{ + // install event filter on child widgets + QObjectList *l = queryList("QWidget"); + QObjectListIt it(*l); + QObject * obj; + while ((obj = it.current()) != 0) { + ++it; + obj->installEventFilter(this); + ((QWidget*)obj)->setFocusPolicy(NoFocus); + } +} + +void PreviewWidget::closeEvent(QCloseEvent *e) +{ + e->ignore(); +} + +bool PreviewWidget::eventFilter(QObject *, QEvent *e) +{ + switch ( e->type() ) { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::Enter: + case QEvent::Leave: + return TRUE; // ignore; + default: + break; + } + return FALSE; +} diff --git a/kdevdesigner/designer/previewwidgetimpl.h b/kdevdesigner/designer/previewwidgetimpl.h new file mode 100644 index 00000000..63227cdd --- /dev/null +++ b/kdevdesigner/designer/previewwidgetimpl.h @@ -0,0 +1,43 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PREVIEWWIDGETIMPL_H +#define PREVIEWWIDGETIMPL_H + +#include "previewwidget.h" + +class PreviewWidget : public PreviewWidgetBase +{ + Q_OBJECT + +public: + PreviewWidget( QWidget *parent = 0, const char *name = 0 ); + + void closeEvent(QCloseEvent *); + bool eventFilter(QObject *, QEvent *); +}; + +#endif diff --git a/kdevdesigner/designer/project.cpp b/kdevdesigner/designer/project.cpp new file mode 100644 index 00000000..2a261d20 --- /dev/null +++ b/kdevdesigner/designer/project.cpp @@ -0,0 +1,1558 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +**1 This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "project.h" +#include "formwindow.h" +#include "designerappiface.h" +#include "../interfaces/languageinterface.h" +#include "pixmapcollection.h" +#ifndef QT_NO_SQL +#include "dbconnectionimpl.h" +#endif +#include "resource.h" +#include +#include "outputwindow.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mainwindow.h" +#include + +#ifndef QT_NO_SQL +#include +#include +#include +#endif + +#include +#ifdef Q_OS_UNIX +# include +#endif + +#include + +#ifndef QT_NO_SQL +DatabaseConnection::~DatabaseConnection() +{ + delete iface; +} + +bool DatabaseConnection::refreshCatalog() +{ +#ifndef QT_NO_SQL + if ( loaded ) + return TRUE; + if ( !open() ) + return FALSE; + tbls = conn->tables( QSql::TableType( QSql::Tables | QSql::Views ) ); + flds.clear(); + for ( QStringList::Iterator it = tbls.begin(); it != tbls.end(); ++it ) { + QSqlRecord fil = conn->record( *it ); + QStringList lst; + for ( uint j = 0; j < fil.count(); ++j ) + lst << fil.field( j )->name(); + flds.insert( *it, lst ); + } + loaded = TRUE; + conn->close(); + return loaded; +#else + return FALSE; +#endif +} + +#ifndef QT_NO_SQL +void DatabaseConnection::remove() +{ + if ( nm == "(default)" ) + QSqlDatabase::removeDatabase( QSqlDatabase::defaultConnection ); + else + QSqlDatabase::removeDatabase( nm ); + // the above will effectively delete the current connection + conn = 0; +} +#endif + +bool DatabaseConnection::open( bool suppressDialog ) +{ +#ifndef QT_NO_SQL + // register our name, if nec + if ( nm == "(default)" ) { + if ( !QSqlDatabase::contains() ) // default doesn't exists? + conn = QSqlDatabase::addDatabase( drv ); + else + conn = QSqlDatabase::database(); + } else { + if ( !QSqlDatabase::contains( nm ) ) + conn = QSqlDatabase::addDatabase( drv, nm ); + else + conn = QSqlDatabase::database( nm ); + } + conn->setDatabaseName( dbName ); + conn->setUserName( uname ); + conn->setPassword( pword ); + conn->setHostName( hname ); + conn->setPort( prt ); + bool success = conn->open(); + for( ; suppressDialog == FALSE ; ) { + bool done = FALSE; + if ( !success ) { + DatabaseConnectionEditor dia( this, 0 , 0 , TRUE ); + switch( dia.exec() ) { + case QDialog::Accepted: + done = FALSE; + break; + case QDialog::Rejected: + done = TRUE; + break; + } + } + if ( done ) + break; + conn->setUserName( uname ); + conn->setPassword( pword ); + conn->setHostName( hname ); + conn->setPort( prt ); + success = conn->open(); + if ( !success ) { + switch( QMessageBox::warning( project->messageBoxParent(), i18n( "Connection" ), + i18n( "Could not connect to the database.\n" + "Press 'OK' to continue or 'Cancel' to " + "specify different\nconnection information.\n" ) + + QString( "[" + conn->lastError().driverText() + "\n" + + conn->lastError().databaseText() + "]\n" ), + i18n( "&OK" ), + i18n( "&Cancel" ), QString::null, 0, 1 ) ) { + case 0: // OK or Enter + continue; + case 1: // Cancel or Escape + done = TRUE; + break; + } + } else + break; + if ( done ) + break; + } + if ( !success ) { + dbErr = conn->lastError().driverText() + "\n" + conn->lastError().databaseText(); + remove(); + } + return success; +#else + return FALSE; +#endif +} + +void DatabaseConnection::close() +{ + if ( !loaded ) + return; +#ifndef QT_NO_SQL + if ( conn ) { + conn->close(); + } +#endif +} + +DesignerDatabase *DatabaseConnection::iFace() +{ + if ( !iface ) + iface = new DesignerDatabaseImpl( this ); + return iface; +} + +#endif + +//////// + +bool Project::isDummy() const +{ + return isDummyProject; +} + +Project::Project( const QString &fn, const QString &pName, + QPluginManager *pm, bool isDummy, + const QString &l ) + : proName( pName ), projectSettingsPluginManager( pm ), isDummyProject( isDummy ) +{ + modified = TRUE; + pixCollection = new PixmapCollection( this ); + iface = 0; + lang = l; + is_cpp = lang == "C++"; + cfg.insert( "(all)", "qt warn_on release" ); + templ = "app"; + setFileName( fn ); + if ( !pName.isEmpty() ) + proName = pName; + sourcefiles.setAutoDelete( TRUE ); + modified = FALSE; + objs.setAutoDelete( FALSE ); + fakeFormFiles.setAutoDelete( FALSE ); +} + +Project::~Project() +{ + if ( singleProjectMode() ) + removeTempProject(); + delete iface; + delete pixCollection; +} + +void Project::setModified( bool b ) +{ + modified = b; + emit projectModified(); +} + +#ifndef QT_NO_SQL +DatabaseConnection *Project::databaseConnection( const QString &name ) +{ + for ( DatabaseConnection *conn = dbConnections.first(); + conn; + conn = dbConnections.next() ) { + if ( conn->name() == name ) + return conn; + } + return 0; +} +#endif + +void Project::setFileName( const QString &fn, bool doClear ) +{ + if ( fn == filename ) + return; + + if ( singleProjectMode() ) { + QString qsa = QString( getenv( "HOME" ) ) + QString( "/.qsa" ); + if ( !QFile::exists( qsa ) ) { + QDir d; + d.mkdir( qsa ); + } + if ( fn == singleProFileName ) + return; + singleProFileName = fn; + static int counter = 0; + QString str_counter = QString::number( counter++ ); + str_counter = "/.qsa/" + str_counter; + LanguageInterface *iface = MetaDataBase::languageInterface( language() ); + filename = QString( getenv( "HOME" ) + str_counter + QString( "tmp_" ) + + QFileInfo( fn ).baseName() + "/" + QFileInfo( fn ).baseName() + ".pro" ); + removeTempProject(); + if ( iface && iface->supports( LanguageInterface::CompressProject ) ) { + filename = iface->uncompressProject( makeAbsolute( singleProFileName ), + QString( getenv( "HOME" ) + + str_counter + QString( "tmp_" ) + + QFileInfo( fn ).baseName() ) ); + proName = makeAbsolute( singleProFileName ); + } + } else { + filename = fn; + if ( !filename.endsWith( ".pro" ) ) + filename += ".pro"; + proName = filename; + } + + + if ( proName.contains( '.' ) ) + proName = proName.left( proName.find( '.' ) ); + + if ( !doClear ) + return; + clear(); + if ( QFile::exists( filename ) ) + parse(); +} + +QString Project::fileName( bool singlePro ) const +{ + if ( singlePro ) + return singleProFileName; + return filename; +} + +QString Project::databaseDescription() const +{ + return dbFile; +} + +QString Project::projectName() const +{ + return proName; +} + +static QString parse_part( const QString &part ) +{ + QString res; + bool inName = FALSE; + QString currName; + for ( int i = 0; i < (int)part.length(); ++i ) { + QChar c = part[ i ]; + if ( !inName ) { + if ( c != ' ' && c != '\t' && c != '\n' && c != '=' && c != '\\' && c != '+' ) + inName = TRUE; + else + continue; + } + if ( inName ) { + if ( c == '\n' ) + break; + res += c; + } + } + return res; +} + +QStringList parse_multiline_part( const QString &contents, const QString &key, int *start = 0 ) +{ + if ( start ) + *start = -1; + QString lastWord; + // Account for things like win32: SOURCES + int extraWhiteSpaceCount = 0; + int braceCount = 0; + for ( int i = 0; i < (int)contents.length(); ++i ) { + QChar c( contents[ i ] ); + switch ( c ) { + case '{': + braceCount++; + lastWord = ""; + break; + case '}': + braceCount--; + lastWord = ""; + break; + case ' ': case '\t': + if (!key.startsWith(lastWord)) { + lastWord = ""; + extraWhiteSpaceCount = 0; + } else { + extraWhiteSpaceCount++; + } + break; + case '\\': case '\n': + lastWord = ""; + break; + default: + lastWord += c; + } + + // ### we should read the 'bla { SOURCES= ... }' stuff as well (braceCount > 0) + if ( lastWord == key && braceCount == 0 ) { + if ( start ) + *start = i - lastWord.length() - extraWhiteSpaceCount + 1; + QStringList lst; + bool inName = FALSE; + QString currName; + bool hadEqual = FALSE; + for ( ; i < (int)contents.length(); ++i ) { + c = contents[ i ]; + if ( !hadEqual && c != '=' ) + continue; + if ( !hadEqual ) { + hadEqual = TRUE; + continue; + } + if ( ( c.isLetter() || c.isDigit() || c == '.' || c == '/' || c == '_' || c == '\\' || + c == '\"' || c == '\'' || c == '=' || + c == '$' || c == '-' || c == '(' || c == ')' || c == ':' || c == '+' || c == ',' || c == '~' ) && + c != ' ' && c != '\t' && c != '\n' ) { + if ( !inName ) + currName = QString::null; + if ( c != '\\' || contents[i+1] != '\n' ) { + currName += c; + inName = TRUE; + } + } else { + if ( inName ) { + inName = FALSE; + if ( currName.simplifyWhiteSpace() != "\\" ) + lst.append( currName ); + } + if ( c == '\n' && i > 0 && contents[ (int)i - 1 ] != '\\' ) + break; + } + } + return lst; + } + } + + return QStringList(); +} + +void Project::parse() +{ + QFile f( filename ); + if ( !f.exists() || !f.open( IO_ReadOnly ) ) + return; + QTextStream ts( &f ); + QString contents = ts.read(); + f.close(); + + proName = QFileInfo( filename ).baseName(); + + QStringList::ConstIterator it; + + int i = contents.find( "LANGUAGE" ); + if ( i != -1 ) { + lang = ""; + is_cpp = FALSE; + QString part = contents.mid( i + QString( "LANGUAGE" ).length() ); + lang = parse_part( part ); + is_cpp = lang == "C++"; + } + + i = contents.find( "DBFILE" ); + if ( i != -1 ) { + dbFile = ""; + QString part = contents.mid( i + QString( "DBFILE" ).length() ); + dbFile = parse_part( part ); + } + + QStringList uifiles = parse_multiline_part( contents, "FORMS" ); + uifiles += parse_multiline_part( contents, "INTERFACES" ); // compatibility + for ( it = uifiles.begin(); it != uifiles.end(); ++it ) { + if ( (*it).startsWith( "__APPOBJ" ) ) + continue; + (void) new FormFile( *it, FALSE, this ); + } + + + i = contents.find( "TEMPLATE" ); + if ( i != -1 ) { + templ = ""; + QString part = contents.mid( i + QString( "TEMPLATE" ).length() ); + templ = parse_part( part ); + } + + readPlatformSettings( contents, "CONFIG", cfg ); + readPlatformSettings( contents, "LIBS", lbs ); + readPlatformSettings( contents, "INCLUDEPATH", inclPath ); + readPlatformSettings( contents, "DEFINES", defs ); + readPlatformSettings( contents, "SOURCES", sources ); + readPlatformSettings( contents, "HEADERS", headers ); + + LanguageInterface *iface = MetaDataBase::languageInterface( lang ); + if ( iface ) { + QStringList sourceKeys; + iface->sourceProjectKeys( sourceKeys ); + for ( QStringList::Iterator it = sourceKeys.begin(); it != sourceKeys.end(); ++it ) { + QStringList lst = parse_multiline_part( contents, *it ); + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + (void) new SourceFile( *it, FALSE, this ); + } + } + + updateCustomSettings(); + + for ( it = csList.begin(); it != csList.end(); ++it ) { + i = contents.find( *it ); + if ( i != -1 ) { + QString val = ""; + QString part = contents.mid( i + QString( *it ).length() ); + val = parse_part( part ); + customSettings.replace( *it, val ); + } + } + + loadConnections(); + + QStringList images = parse_multiline_part( contents, "IMAGES" ); + + // ### remove that for the final - this is beta-compatibility + if ( images.isEmpty() && QDir( QFileInfo( filename ).dirPath( TRUE ) + "/images" ).exists() ) { + images = QDir( QFileInfo( filename ).dirPath( TRUE ) + "/images" ).entryList(); + for ( int i = 0; i < (int)images.count(); ++i ) + images[ i ].prepend( "images/" ); + modified = TRUE; + } + + for ( QStringList::ConstIterator pit = images.begin(); pit != images.end(); ++pit ) + pixCollection->load( *pit ); +} + +void Project::clear() +{ + dbFile = ""; + proName = "unnamed"; + desc = ""; +} + +bool Project::removeSourceFile( SourceFile *sf ) +{ + if ( !sourcefiles.containsRef( sf ) ) + return FALSE; + if ( !sf->close() ) + return FALSE; + sourcefiles.removeRef( sf ); + modified = TRUE; + emit sourceFileRemoved( sf ); + return TRUE; +} + +void Project::setDatabaseDescription( const QString &db ) +{ + dbFile = db; +} + +void Project::setDescription( const QString &s ) +{ + desc = s; +} + +QString Project::description() const +{ + return desc; +} + + +bool Project::isValid() const +{ + // #### do more checking here? + if ( filename.isEmpty() || proName.isEmpty() ) + return FALSE; + + return TRUE; +} + +QString Project::makeAbsolute( const QString &f ) +{ + if ( isDummy() ) + return f; + QString encodedUrl = QFileInfo( filename ).dirPath( TRUE ); + QUrl::encode( encodedUrl ); + QUrl u( encodedUrl, f ); + return u.path(); +} + +QString Project::makeRelative( const QString &f ) +{ + if ( isDummy() ) + return f; + QString p = QFileInfo( filename ).dirPath( TRUE ); + QString f2 = f; + if ( f2.left( p.length() ) == p ) + f2.remove( 0, p.length() + 1 ); + return f2; +} + +static void remove_contents( QString &contents, const QString &s ) +{ + int i = contents.find( s ); + if ( i != -1 ) { + int start = i; + int end = contents.find( '\n', i ); + if ( end == -1 ) + end = contents.length() - 1; + contents.remove( start, end - start + 1 ); + } +} + +static void remove_multiline_contents( QString &contents, const QString &s, int *strt = 0 ) +{ + int i = contents.find( s ); + if ( strt ) + *strt = i; + int start = i; + bool lastWasBackspash = FALSE; + if ( i != -1 && ( i == 0 || contents[ i - 1 ] != '{' || contents[ i - 1 ] != ':' ) ) { + for ( ; i < (int)contents.length(); ++i ) { + if ( contents[ i ] == '\n' && !lastWasBackspash ) + break; + lastWasBackspash = ( contents[ i ] == '\\' || + lastWasBackspash && ( contents[ i ] == ' ' || contents[ i ] == '\t' ) ); + } + contents.remove( start, i - start + 1 ); + } +} + +void Project::save( bool onlyProjectFile ) +{ + bool anythingModified = FALSE; + + // save sources and forms + if ( !onlyProjectFile ) { + + saveConnections(); + + for ( SourceFile *sf = sourcefiles.first(); sf; sf = sourcefiles.next() ) { + anythingModified = anythingModified || sf->isModified(); + if ( !sf->save() ) + return; + } + + for ( FormFile *ff = formfiles.first(); ff; ff = formfiles.next() ) { + anythingModified = anythingModified || ff->isModified(); + if ( !ff->save() ) + return; + } + } + + if ( isDummy() || filename.isEmpty() ) + return; + + if ( !modified ) { + if ( singleProjectMode() ) { + LanguageInterface *iface = MetaDataBase::languageInterface( language() ); + if ( iface && iface->supports( LanguageInterface::CompressProject ) ) + iface->compressProject( makeAbsolute( filename ), singleProFileName, anythingModified ); + } + return; + } + + QFile f( filename ); + QString original = ""; + + // read the existing file + bool hasPreviousContents = FALSE; + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + original = ts.read(); + f.close(); + hasPreviousContents = TRUE; + remove_contents( original, "{SOURCES+=" ); // ### compatibility with early 3.0 betas + remove_contents( original, "DBFILE" ); + remove_contents( original, "LANGUAGE" ); + remove_contents( original, "TEMPLATE" ); + removePlatformSettings( original, "CONFIG" ); + removePlatformSettings( original, "DEFINES" ); + removePlatformSettings( original, "LIBS" ); + removePlatformSettings( original, "INCLUDEPATH" ); + removePlatformSettings( original, "SOURCES" ); + removePlatformSettings( original, "HEADERS" ); + remove_multiline_contents( original, "FORMS" ); + remove_multiline_contents( original, "INTERFACES" ); // compatibility + remove_multiline_contents( original, "IMAGES" ); + for ( QStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) + remove_contents( original, *it ); + } + + // the contents of the saved file + QString contents; + + // template + contents += "TEMPLATE\t= " + templ + "\n"; + + // language + contents += "LANGUAGE\t= " + lang + "\n"; + contents += "\n"; + + // config + writePlatformSettings( contents, "CONFIG", cfg ); + LanguageInterface *iface = MetaDataBase::languageInterface( lang ); + if ( iface ) { + QStringList sourceKeys; + iface->sourceProjectKeys( sourceKeys ); + for ( QStringList::Iterator spit = sourceKeys.begin(); spit != sourceKeys.end(); ++spit ) + remove_multiline_contents( contents, *spit ); + } + contents += "\n"; + + // libs, defines, includes + writePlatformSettings( contents, "LIBS", lbs ); + writePlatformSettings( contents, "DEFINES", defs ); + writePlatformSettings( contents, "INCLUDEPATH", inclPath ); + writePlatformSettings( contents, "SOURCES", sources ); + writePlatformSettings( contents, "HEADERS", headers ); + + // unix + if ( !hasPreviousContents ) { + contents += + "unix {\n" + " UI_DIR = .ui\n" + " MOC_DIR = .moc\n" + " OBJECTS_DIR = .obj\n" + "}\n"; + } + contents += "\n"; + + // sources + if ( !sourcefiles.isEmpty() && iface ) { + QMap sourceToKey; + for ( SourceFile *f = sourcefiles.first(); f; f = sourcefiles.next() ) { + QString key = iface->projectKeyForExtension( QFileInfo( f->fileName() ).extension() ); + QStringList lst = sourceToKey[ key ]; + lst << makeRelative( f->fileName() ); + sourceToKey.replace( key, lst ); + } + + for ( QMap::Iterator skit = sourceToKey.begin(); + skit != sourceToKey.end(); ++skit ) { + QString part = skit.key() + "\t+= "; + QStringList lst = *skit; + for ( QStringList::Iterator sit = lst.begin(); sit != lst.end(); ++sit ) { + part += *sit; + part += ++sit != lst.end() ? " \\\n\t" : ""; + --sit; + } + part += "\n"; + contents += part; + } + } + + // forms and interfaces + if ( !formfiles.isEmpty() ) { + contents += "FORMS\t= "; + for ( QPtrListIterator fit = formfiles; fit.current(); ++fit ) { + contents += fit.current()->fileName() + + (fit != formfiles.last() ? " \\\n\t" : ""); + } + contents += "\n"; + } + + // images + if ( !pixCollection->isEmpty() ) { + contents += "IMAGES\t= "; + QValueList pixmaps = pixCollection->pixmaps(); + for ( QValueList::Iterator it = pixmaps.begin(); + it != pixmaps.end(); ++it ) { + contents += makeRelative( (*it).absname ); + contents += ++it != pixmaps.end() ? " \\\n\t" : ""; + --it; + } + contents += "\n"; + } + + // database + if ( !dbFile.isEmpty() ) + contents += "DBFILE\t= " + dbFile + "\n"; + contents += "\n"; + + // custom settings + for ( QStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) { + QString val = *customSettings.find( *it ); + if ( !val.isEmpty() ) + contents += *it + "\t= " + val + "\n"; + } + + if ( !f.open( IO_WriteOnly | IO_Translate ) ) { + QMessageBox::warning( messageBoxParent(), + "Save Project Failed", "Couldn't write project file " + filename ); + return; + } + + QTextStream os( &f ); + os << contents; + if (hasPreviousContents) + os << original; + + f.close(); + + setModified( FALSE ); + + if ( singleProjectMode() ) { + LanguageInterface *iface = MetaDataBase::languageInterface( language() ); + if ( iface && iface->supports( LanguageInterface::CompressProject ) ) + iface->compressProject( makeAbsolute( filename ), singleProFileName, TRUE ); + } +} + +#ifndef QT_NO_SQL +QPtrList Project::databaseConnections() const +{ + return dbConnections; +} +#endif + +#ifndef QT_NO_SQL +void Project::setDatabaseConnections( const QPtrList &lst ) +{ + dbConnections = lst; +} +#endif + +#ifndef QT_NO_SQL +void Project::addDatabaseConnection( DatabaseConnection *conn ) +{ + dbConnections.append( conn ); + modified = TRUE; +} +#endif + +#ifndef QT_NO_SQL +void Project::removeDatabaseConnection( const QString &c ) +{ + for ( DatabaseConnection *conn = dbConnections.first(); conn; conn = dbConnections.next() ) { + if ( conn->name() == c ) { + conn->remove(); + dbConnections.removeRef( conn ); + delete conn; + return; + } + } +} +#endif + +#ifndef QT_NO_SQL +QStringList Project::databaseConnectionList() +{ + QStringList lst; + for ( DatabaseConnection *conn = dbConnections.first(); conn; conn = dbConnections.next() ) + lst << conn->name(); + return lst; +} +#endif + +#ifndef QT_NO_SQL +QStringList Project::databaseTableList( const QString &connection ) +{ + DatabaseConnection *conn = databaseConnection( connection ); + if ( !conn ) { + return QStringList(); + } + return conn->tables(); +} +#endif + +#ifndef QT_NO_SQL +QStringList Project::databaseFieldList( const QString &connection, const QString &table ) +{ + DatabaseConnection *conn = databaseConnection( connection ); + if ( !conn ) + return QStringList(); + return conn->fields( table ); +} +#endif + +#ifndef QT_NO_SQL +static QString makeIndent( int indent ) +{ + QString s; + s.fill( ' ', indent * 4 ); + return s; +} +#endif + +#ifndef QT_NO_SQL +static void saveSingleProperty( QTextStream &ts, const QString& name, const QString& value, int indent ) +{ + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << value << "" << endl; + --indent; + ts << makeIndent( indent ) << "" << endl; +} +#endif + +void Project::saveConnections() +{ +#ifndef QT_NO_SQL + if ( dbFile.isEmpty() ) { + QFileInfo fi( fileName() ); + setDatabaseDescription( fi.baseName() + ".db" ); + } + + QFile f( makeAbsolute( dbFile ) ); + + if ( dbConnections.isEmpty() ) { + if ( f.exists() ) + f.remove(); + setDatabaseDescription( "" ); + modified = TRUE; + return; + } + + /* .db xml */ + if ( f.open( IO_WriteOnly | IO_Translate ) ) { + QTextStream ts( &f ); + ts.setCodec( QTextCodec::codecForName( "UTF-8" ) ); + ts << "" << endl; + + /* db connections */ + int indent = 0; + for ( DatabaseConnection *conn = dbConnections.first(); conn; conn = dbConnections.next() ) { + ts << makeIndent( indent ) << "" << endl; + ++indent; + saveSingleProperty( ts, "name", conn->name(), indent ); + saveSingleProperty( ts, "driver", conn->driver(), indent ); + saveSingleProperty( ts, "database", conn->database(), indent ); + saveSingleProperty( ts, "username", conn->username(), indent ); + saveSingleProperty( ts, "hostname", conn->hostname(), indent ); + saveSingleProperty( ts, "port", QString::number( conn->port() ), indent ); + + /* connection tables */ + QStringList tables = conn->tables(); + for ( QStringList::Iterator it = tables.begin(); + it != tables.end(); ++it ) { + ts << makeIndent( indent ) << "" << endl; + ++indent; + saveSingleProperty( ts, "name", (*it), indent ); + + /* tables fields */ + QStringList fields = conn->fields( *it ); + for ( QStringList::Iterator it2 = fields.begin(); + it2 != fields.end(); ++it2 ) { + ts << makeIndent( indent ) << "" << endl; + ++indent; + saveSingleProperty( ts, "name", (*it2), indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + + --indent; + ts << makeIndent( indent ) << "
      " << endl; + } + + --indent; + ts << makeIndent( indent ) << "
      " << endl; + } + + ts << "
      " << endl; + f.close(); + } +#endif +} + +#ifndef QT_NO_SQL +static QDomElement loadSingleProperty( QDomElement e, const QString& name ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); + !n.isNull(); + n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" && n.toElement().attribute("name") == name ) + return n; + } + return n; +} +#endif + +void Project::loadConnections() +{ +#ifndef QT_NO_SQL + if ( dbFile.isEmpty() || !QFile::exists( makeAbsolute( dbFile ) ) ) + return; + + QFile f( makeAbsolute( dbFile ) ); + if ( f.open( IO_ReadOnly ) ) { + QDomDocument doc; + QString errMsg; + int errLine; + if ( doc.setContent( &f, &errMsg, &errLine ) ) { + QDomElement e; + e = doc.firstChild().toElement(); + + /* connections */ + QDomNodeList connections = e.toElement().elementsByTagName( "connection" ); + for ( uint i = 0; i < connections.length(); i++ ) { + QDomElement connection = connections.item(i).toElement(); + QDomElement connectionName = loadSingleProperty( connection, "name" ); + QDomElement connectionDriver = loadSingleProperty( connection, "driver" ); + QDomElement connectionDatabase = loadSingleProperty( connection, + "database" ); + QDomElement connectionUsername = loadSingleProperty( connection, + "username" ); + QDomElement connectionHostname = loadSingleProperty( connection, + "hostname" ); + QDomElement connectionPort = loadSingleProperty( connection, + "port" ); + + DatabaseConnection *conn = new DatabaseConnection( this ); + conn->setName( connectionName.firstChild().firstChild().toText().data() ); + conn->setDriver( connectionDriver.firstChild().firstChild().toText().data() ); + conn->setDatabase( connectionDatabase.firstChild().firstChild().toText().data() ); + conn->setUsername( connectionUsername.firstChild().firstChild().toText().data() ); + conn->setHostname( connectionHostname.firstChild().firstChild().toText().data() ); + conn->setPort( QString( connectionPort.firstChild().firstChild().toText().data() ).toInt() ); + + /* connection tables */ + QDomNodeList tables = connection.toElement().elementsByTagName( "table" ); + for ( uint j = 0; j < tables.length(); j++ ) { + QDomElement table = tables.item(j).toElement(); + QDomElement tableName = loadSingleProperty( table, "name" ); + conn->addTable( tableName.firstChild().firstChild().toText().data() ); + + /* table fields */ + QStringList fieldList; + QDomNodeList fields = table.toElement().elementsByTagName( "field" ); + for ( uint k = 0; k < fields.length(); k++ ) { + QDomElement field = fields.item(k).toElement(); + QDomElement fieldName = loadSingleProperty( field, "name" ); + fieldList.append( fieldName.firstChild().firstChild().toText().data() ); + } + conn->setFields( tableName.firstChild().firstChild().toText().data(), + fieldList ); + } + + dbConnections.append( conn ); + } + } else { + qDebug( QString("Parse error: ") + errMsg + QString(" in line %d"), errLine ); + } + f.close(); + } +#endif +} + +/*! Opens the database \a connection. The connection remains open and +can be closed again with closeDatabase(). +*/ + +bool Project::openDatabase( const QString &connection, bool suppressDialog ) +{ +#ifndef QT_NO_SQL + DatabaseConnection *conn = databaseConnection( connection ); + if ( connection.isEmpty() && !conn ) + conn = databaseConnection( "(default)" ); + if ( !conn ) + return FALSE; + bool b = conn->open( suppressDialog ); + return b; +#else + Q_UNUSED( connection ); + Q_UNUSED( suppressDialog ); + return FALSE; +#endif +} + +/*! Closes the database \a connection. +*/ +void Project::closeDatabase( const QString &connection ) +{ +#ifndef QT_NO_SQL + DatabaseConnection *conn = databaseConnection( connection ); + if ( connection.isEmpty() && !conn ) + conn = databaseConnection( "(default)" ); + if ( !conn ) + return; + conn->close(); +#else + Q_UNUSED( connection ); +#endif +} + +// void Project::formClosed( FormWindow *fw ) +// { +// formWindows.remove( fw ); +// } + +QObjectList *Project::formList( bool resolveFakeObjects ) const +{ + QObjectList *l = new QObjectList; + for ( QPtrListIterator forms(formfiles); forms.current(); ++forms ) { + FormFile* f = forms.current(); + if ( f->formWindow() ) { + if ( resolveFakeObjects && f->formWindow()->isFake() ) + l->append( objectForFakeForm( f->formWindow() ) ); + else + l->append( f->formWindow()->child( 0, "QWidget" ) ); + } else if ( f->isFake() ) { + l->append( objectForFakeFormFile( f ) ); + } + } + return l; +} + +DesignerProject *Project::iFace() +{ + if ( !iface ) + iface = new DesignerProjectImpl( this ); + return iface; +} + +void Project::setLanguage( const QString &l ) +{ + if ( l == lang ) + return; + lang = l; + is_cpp = lang == "C++"; + updateCustomSettings(); + modified = TRUE; +} + +QString Project::language() const +{ + return lang; +} + +void Project::setCustomSetting( const QString &key, const QString &value ) +{ + customSettings.remove( key ); + customSettings.insert( key, value ); + modified = TRUE; +} + +QString Project::customSetting( const QString &key ) const +{ + return *customSettings.find( key ); +} + +void Project::updateCustomSettings() +{ + if ( !projectSettingsPluginManager ) + return; + +/* + ProjectSettingsInterface *iface = 0; + projectSettingsPluginManager->queryInterface( lang, (QUnknownInterface**)&iface ); + if ( !iface ) + return; + csList = iface->projectSettings(); + iface->release(); +*/ + + QInterfacePtr iface; + projectSettingsPluginManager->queryInterface( lang, &iface ); + if ( !iface ) + return; + csList = iface->projectSettings(); + customSettings.clear(); + +} + +void Project::setActive( bool b ) +{ + pixCollection->setActive( b ); +} + +void Project::addSourceFile( SourceFile *sf ) +{ + sourcefiles.append( sf ); + modified = TRUE; + emit sourceFileAdded( sf ); +} + + +SourceFile* Project::findSourceFile( const QString& filename, SourceFile *ignore ) const +{ + QPtrListIterator it(sourcefiles); + while ( it.current() ) { + if ( it.current() != ignore && it.current()->fileName() == filename ) + return it.current(); + ++it; + } + return 0; +} + +FormFile* Project::findFormFile( const QString& filename, FormFile *ignore ) const +{ + QPtrListIterator it(formfiles); + while ( it.current() ) { + if ( it.current() != ignore && it.current()->fileName() == filename ) + return it.current(); + ++it; + } + return 0; +} + +void Project::setIncludePath( const QString &platform, const QString &path ) +{ + if ( inclPath[platform] == path ) + return; + inclPath.replace( platform, path ); + modified = TRUE; +} + +void Project::setLibs( const QString &platform, const QString &path ) +{ + lbs.replace( platform, path ); +} + +void Project::setDefines( const QString &platform, const QString &path ) +{ + defs.replace( platform, path ); +} + +void Project::setConfig( const QString &platform, const QString &config ) +{ + cfg.replace( platform, config ); +} + +QString Project::config( const QString &platform ) const +{ + return cfg[ platform ]; +} + +QString Project::libs( const QString &platform ) const +{ + return lbs[ platform ]; +} + +QString Project::defines( const QString &platform ) const +{ + return defs[ platform ]; +} + +QString Project::includePath( const QString &platform ) const +{ + return inclPath[ platform ]; +} + +QString Project::templte() const +{ + return templ; +} + +void Project::setTemplate( const QString &t ) +{ + templ = t; +} + +void Project::readPlatformSettings( const QString &contents, + const QString &setting, + QMap &res ) +{ + const QString platforms[] = { "", "win32", "unix", "mac", QString::null }; + for ( int i = 0; platforms[ i ] != QString::null; ++i ) { + QString p = platforms[ i ]; + if ( !p.isEmpty() ) + p += ":"; + QStringList lst = parse_multiline_part( contents, p + setting ); + QString s = lst.join( " " ); + QString key = platforms[ i ]; + if ( key.isEmpty() ) + key = "(all)"; + res.replace( key, s ); + } +} + +void Project::removePlatformSettings( QString &contents, const QString &setting ) +{ + const QString platforms[] = { "win32", "unix", "mac", "", QString::null }; + for ( int i = 0; platforms[ i ] != QString::null; ++i ) { + QString p = platforms[ i ]; + if ( !p.isEmpty() ) + p += ":"; + remove_multiline_contents( contents, p + setting ); + } +} + +void Project::writePlatformSettings( QString &contents, const QString &setting, + const QMap &input ) +{ + const QString platforms[] = { "", "win32", "unix", "mac", QString::null }; + int i; + LanguageInterface *iface = MetaDataBase::languageInterface( lang ); + if (iface && (setting == "SOURCES" || setting == "HEADERS")) // The (all) part will be saved later on + i = 1; + else + i = 0; + for (; platforms[ i ] != QString::null; ++i ) { + QString p = platforms[ i ]; + if ( !p.isEmpty() ) + p += ":"; + QString key = platforms[ i ]; + if ( key.isEmpty() ) + key = "(all)"; + QMap::ConstIterator it = input.find( key ); + if ( it == input.end() || (*it).isEmpty() ) + continue; + contents += p + setting + "\t+= " + *it + "\n"; + } +} + +void Project::addFormFile( FormFile *ff ) +{ + formfiles.append( ff ); + modified = TRUE; + emit formFileAdded( ff ); +} + +bool Project::removeFormFile( FormFile *ff ) +{ + if ( !formfiles.containsRef( ff ) ) + return FALSE; + if ( !ff->close() ) + return FALSE; + formfiles.removeRef( ff ); + modified = TRUE; + emit formFileRemoved( ff ); + return TRUE; +} + +void Project::addObject( QObject *o ) +{ + bool wasModified = modified; + objs.append( o ); + FormFile *ff = new FormFile( "", FALSE, this, "qt_fakewindow" ); + ff->setFileName( "__APPOBJ" + QString( o->name() ) + ".ui" ); + fakeFormFiles.insert( (void*)o, ff ); + MetaDataBase::addEntry( o ); + if ( hasGUI() ) { + QWidget *parent = MainWindow::self ? MainWindow::self->qWorkspace() : 0; + FormWindow *fw = new FormWindow( ff, MainWindow::self, parent, "qt_fakewindow" ); + fw->setProject( this ); + if ( QFile::exists( ff->absFileName() ) ) + Resource::loadExtraSource( ff, ff->absFileName(), + MetaDataBase::languageInterface( language() ), FALSE ); + if ( MainWindow::self ) + fw->setMainWindow( MainWindow::self ); + if ( MainWindow::self ) { + QApplication::sendPostedEvents( MainWindow::self->qWorkspace(), QEvent::ChildInserted ); + connect( fw, + SIGNAL( undoRedoChanged( bool, bool, const QString &, const QString & ) ), + MainWindow::self, + SLOT( updateUndoRedo( bool, bool, const QString &, const QString & ) ) + ); + } + if ( fw->parentWidget() ) { + fw->parentWidget()->setFixedSize( 1, 1 ); + fw->show(); + } + } else { + if ( QFile::exists( ff->absFileName() ) ) + Resource::loadExtraSource( ff, ff->absFileName(), + MetaDataBase::languageInterface( language() ), FALSE ); + } + emit objectAdded( o ); + modified = wasModified; +} + +void Project::setObjects( const QObjectList &ol ) +{ + for ( QObjectListIt it( ol ); it.current(); ++it ) + addObject( it.current() ); +} + +void Project::removeObject( QObject *o ) +{ + bool wasModified = modified; + objs.removeRef( o ); + MetaDataBase::removeEntry( o ); + fakeFormFiles.remove( (void*)o ); + emit objectRemoved( o ); + modified = wasModified; +} + +QObjectList Project::objects() const +{ + return objs; +} + +FormFile *Project::fakeFormFileFor( QObject *o ) const +{ + return fakeFormFiles.find( (void*)o ); +} + +QObject *Project::objectForFakeForm( FormWindow *fw ) const +{ + for ( QPtrDictIterator it( fakeFormFiles ); it.current(); ++it ) { + if ( it.current()->formWindow() == fw || + it.current() == fw->formFile() ) + return (QObject*)it.currentKey(); + } + return 0; +} + +QObject *Project::objectForFakeFormFile( FormFile *ff ) const +{ + for ( QPtrDictIterator it( fakeFormFiles ); it.current(); ++it ) { + if ( it.current() == ff ) + return (QObject*)it.currentKey(); + } + return 0; +} + +void Project::removeTempProject() +{ + if ( !singleProjectMode() ) + return; + QDir d( QFileInfo( filename ).dirPath() ); + if ( !d.exists( QFileInfo( filename ).dirPath() ) ) + return; + QStringList files = d.entryList( QDir::Files ); + QStringList::Iterator it; + for ( it = files.begin(); it != files.end(); ++it ) { + d.remove( *it ); + } + if ( d.exists( QFileInfo( filename ).dirPath() + "/images" ) ) { + d = QDir( QFileInfo( filename ).dirPath() + "/images" ); + files = d.entryList( QDir::Files ); + for ( it = files.begin(); it != files.end(); ++it ) + d.remove( *it ); + d = QDir( QFileInfo( filename ).dirPath() ); + d.remove( "images" ); + } + d.remove( QFileInfo( filename ).dirPath() ); +#if defined(Q_OS_UNIX) + // ##### implement for all platforms, ideally should be in Qt + ::rmdir( QFile::encodeName( d.absPath() ) ); +#endif +} + +void Project::addAndEditFunction( const QString &function, const QString &functionBody, bool openDeveloper ) +{ + for ( SourceFile *f = sourcefiles.first(); f; f = sourcefiles.next() ) { + if ( QFileInfo( f->fileName() ).baseName() == "main" ) { + QValueList funcs; + LanguageInterface *iface = MetaDataBase::languageInterface( language() ); + if ( !iface ) + return; + iface->functions( f->text(), &funcs ); + QString func = function; + int i = func.find( '(' ); + if ( i != -1 ) + func = func.left( i ); + + bool found = FALSE; + for ( QValueList::Iterator it = funcs.begin(); + it != funcs.end(); ++it ) { + if ( (*it).name.left( (*it).name.find( '(' ) ) == func ) { + found = TRUE; + break; + } + } + + if ( !found ) { + QString code = f->text(); + if ( functionBody.isEmpty() ) + code += "\n\n" + iface->createFunctionStart( "", func, "", "" ) + "()\n{\n\n}\n"; + else + code += "\n\n" + iface->createFunctionStart( "", func, "", "" ) + + "()\n" + functionBody + "\n"; + f->setText( code ); + if ( f->editor() ) + f->editor()->refresh( FALSE ); + } + + if ( openDeveloper ) { + if ( MainWindow::self ) + MainWindow::self->editSource( f ); + f->editor()->setFunction( func, "" ); + } + + break; + } + } +} + +bool Project::hasParentObject( QObject *o ) +{ + for ( QObject *p = objs.first(); p; p = objs.next() ) { + QObject *c = p->child( o->name(), o->className() ); + if ( c ) + return TRUE; + } + return FALSE; +} + +QString Project::qualifiedName( QObject *o ) +{ + QString name = o->name(); + QObject *p = o->parent(); + while ( p ) { + name.prepend( QString( p->name() ) + "." ); + if ( objs.findRef( p ) != -1 ) + break; + p = p->parent(); + } + return name; +} + +bool Project::singleProjectMode() const +{ + return !MainWindow::self || MainWindow::self->singleProjectMode(); +} + +QWidget *Project::messageBoxParent() const +{ + return MainWindow::self; +} + +void Project::designerCreated() +{ + for ( FormFile *ff = formfiles.first(); ff; ff = formfiles.next() ) { + FormWindow *fw = ff->formWindow(); + if ( !fw || fw->mainWindow() ) + continue; + fw->setMainWindow( MainWindow::self ); + connect( fw, SIGNAL( undoRedoChanged( bool, bool, const QString &, + const QString & ) ), + MainWindow::self, SLOT( updateUndoRedo( bool, bool, + const QString &, const QString & ) ) ); + fw->reparent( MainWindow::self->qWorkspace(), QPoint( 0, 0 ), FALSE ); + QApplication::sendPostedEvents( MainWindow::self->qWorkspace(), + QEvent::ChildInserted ); + fw->parentWidget()->setFixedSize( 1, 1 ); + fw->show(); + } +} + +void Project::formOpened( FormWindow *fw ) +{ + if ( fw->isFake() ) + return; + emit newFormOpened( fw ); +} + +QString Project::locationOfObject( QObject *o ) +{ + if ( !o ) + return QString::null; + + if ( MainWindow::self ) { + QWidgetList windows = MainWindow::self->qWorkspace()->windowList(); + for ( QWidget *w = windows.first(); w; w = windows.next() ) { + FormWindow *fw = ::qt_cast(w); + SourceEditor *se = ::qt_cast(w); + if ( fw ) { + if ( fw->isFake() ) + return objectForFakeForm( fw )->name() + QString( " [Source]" ); + else + return fw->name() + QString( " [Source]" ); + } else if ( se ) { + if ( !se->object() ) + continue; + if ( se->formWindow() ) + return se->formWindow()->name() + QString( " [Source]" ); + else + return makeRelative( se->sourceFile()->fileName() ); + } + } + } + + if ( ::qt_cast(o) ) { + for ( QPtrListIterator sources = sourceFiles(); + sources.current(); ++sources ) { + SourceFile* f = sources.current(); + if ( f == o ) + return makeRelative( f->fileName() ); + } + } + + extern QMap *qwf_forms; + if ( !qwf_forms ) { + qWarning( "Project::locationOfObject: qwf_forms is NULL!" ); + return QString::null; + } + + QString s = makeRelative( *qwf_forms->find( (QWidget*)o ) ); + s += " [Source]"; + return s; +} + +bool Project::hasGUI() const +{ + return qApp->type() != QApplication::Tty; +} diff --git a/kdevdesigner/designer/project.h b/kdevdesigner/designer/project.h new file mode 100644 index 00000000..a2606ffa --- /dev/null +++ b/kdevdesigner/designer/project.h @@ -0,0 +1,273 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PROJECT_H +#define PROJECT_H + +#include + +#include +#include +#include +#include +#include +#include "../interfaces/projectsettingsiface.h" +#include "sourcefile.h" +#include "formfile.h" +#include +#include +#include "formfile.h" + +class QObjectList; +struct DesignerProject; +struct DesignerDatabase; +class PixmapCollection; +class Project; + +#ifndef QT_NO_SQL +class QSqlDatabase; + +class DatabaseConnection +{ +public: + DatabaseConnection( Project *p ) : +#ifndef QT_NO_SQL + conn( 0 ), +#endif + project( p ), loaded( FALSE ), iface( 0 ) {} + ~DatabaseConnection(); + + bool refreshCatalog(); + bool open( bool suppressDialog = TRUE ); + void close(); + DesignerDatabase *iFace(); + + bool isLoaded() const { return loaded; } + void setName( const QString& n ) { nm = n; } + QString name() const { return nm; } + void setDriver( const QString& d ) { drv = d; } + QString driver() const { return drv; } + void setDatabase( const QString& db ) { dbName = db; } + QString database() const { return dbName; } + void setUsername( const QString& u ) { uname = u; } + QString username() const { return uname; } + void setPassword( const QString& p ) { pword = p; } + QString password() const { return pword; } + void setHostname( const QString& h ) { hname = h; } + QString hostname() const { return hname; } + void setPort( int p ) { prt = p; } + int port() const { return prt; } + QString lastError() const { return dbErr; } + void addTable( const QString& t ) { tbls.append(t); } + void setFields( const QString& t, const QStringList& f ) { flds[t] = f; } + QStringList tables() const { return tbls; } + QStringList fields( const QString& t ) { return flds[t]; } + QMap fields() { return flds; } +#ifndef QT_NO_SQL + QSqlDatabase* connection() const { return conn; } + void remove(); +#endif + +private: + QString nm; + QString drv, dbName, uname, pword, hname; + QString dbErr; + int prt; + QStringList tbls; + QMap flds; +#ifndef QT_NO_SQL + QSqlDatabase *conn; +#endif + Project *project; + bool loaded; + DesignerDatabase *iface; +}; + +#endif + +class Project : public QObject +{ + Q_OBJECT + friend class DatabaseConnection; + +public: + Project( const QString &fn, const QString &pName = QString::null, + QPluginManager *pm = 0, bool isDummy = FALSE, + const QString &l = "C++" ); + ~Project(); + + void setFileName( const QString &fn, bool doClear = TRUE ); + QString fileName( bool singlePro = FALSE ) const; + QString projectName() const; + + void setDatabaseDescription( const QString &db ); + QString databaseDescription() const; + + void setDescription( const QString &s ); + QString description() const; + + void setLanguage( const QString &l ); + QString language() const; + + + bool isValid() const; + + // returns TRUE if this project is the project + bool isDummy() const; + + QString makeAbsolute( const QString &f ); + QString makeRelative( const QString &f ); + + void save( bool onlyProjectFile = FALSE ); + +#ifndef QT_NO_SQL + QPtrList databaseConnections() const; + void setDatabaseConnections( const QPtrList &lst ); + void addDatabaseConnection( DatabaseConnection *conn ); + void removeDatabaseConnection( const QString &conn ); + DatabaseConnection *databaseConnection( const QString &name ); + QStringList databaseConnectionList(); + QStringList databaseTableList( const QString &connection ); + QStringList databaseFieldList( const QString &connection, const QString &table ); +#endif + void saveConnections(); + void loadConnections(); + + bool openDatabase( const QString &connection, bool suppressDialog = TRUE ); + void closeDatabase( const QString &connection ); + + QObjectList *formList( bool resolveFakeObjects = FALSE ) const; + + DesignerProject *iFace(); + + void setCustomSetting( const QString &key, const QString &value ); + QString customSetting( const QString &key ) const; + + PixmapCollection *pixmapCollection() const { return pixCollection; } + + void setActive( bool b ); + + QPtrListIterator sourceFiles() const { return QPtrListIterator(sourcefiles); } + void addSourceFile( SourceFile *sf ); + bool removeSourceFile( SourceFile *sf ); + SourceFile* findSourceFile( const QString& filename, SourceFile *ignore = 0 ) const; + + QPtrListIterator formFiles() const { return QPtrListIterator(formfiles); } + void addFormFile( FormFile *ff ); + bool removeFormFile( FormFile *ff ); + FormFile* findFormFile( const QString& filename, FormFile *ignore = 0 ) const; + + void setIncludePath( const QString &platform, const QString &path ); + void setLibs( const QString &platform, const QString &path ); + void setDefines( const QString &platform, const QString &path ); + void setConfig( const QString &platform, const QString &config ); + void setTemplate( const QString &t ); + + QString config( const QString &platform ) const; + QString libs( const QString &platform ) const; + QString defines( const QString &platform ) const; + QString includePath( const QString &platform ) const; + QString templte() const; + + bool isModified() const { return !isDummy() && modified; } + void setModified( bool b ); + + void addObject( QObject *o ); + void setObjects( const QObjectList &ol ); + void removeObject( QObject *o ); + QObjectList objects() const; + FormFile *fakeFormFileFor( QObject *o ) const; + QObject *objectForFakeForm( FormWindow *fw ) const; + QObject *objectForFakeFormFile( FormFile *ff ) const; + + void addAndEditFunction( const QString &functionName, const QString &functionBody, + bool openDeveloper ); + + void removeTempProject(); + bool hasParentObject( QObject *o ); + QString qualifiedName( QObject *o ); + + bool isCpp() const { return is_cpp; } + + void designerCreated(); + + void formOpened( FormWindow *fw ); + + QString locationOfObject( QObject *o ); + + bool hasGUI() const; + +signals: + void projectModified(); + void sourceFileAdded( SourceFile* ); + void sourceFileRemoved( SourceFile* ); + void formFileAdded( FormFile* ); + void formFileRemoved( FormFile* ); + void objectAdded( QObject * ); + void objectRemoved( QObject * ); + void newFormOpened( FormWindow *fw ); + +private: + void parse(); + void clear(); + void updateCustomSettings(); + void readPlatformSettings( const QString &contents, + const QString &setting, + QMap &res ); + void removePlatformSettings( QString &contents, const QString &setting ); + void writePlatformSettings( QString &contents, const QString &setting, + const QMap &input ); + bool singleProjectMode() const; + QWidget *messageBoxParent() const; + +private: + QString filename; + QString proName; + QString desc; + QString dbFile; +#ifndef QT_NO_SQL + QPtrList dbConnections; +#endif + QString lang; + DesignerProject *iface; + QMap customSettings; + QStringList csList; + QPluginManager *projectSettingsPluginManager; + PixmapCollection *pixCollection; + QPtrList sourcefiles; + QPtrList formfiles; + QMap inclPath, defs, lbs, cfg, sources, headers; + QString templ; + bool isDummyProject; + bool modified; + QObjectList objs; + QPtrDict fakeFormFiles; + QString singleProFileName; + bool is_cpp; + +}; + +#endif diff --git a/kdevdesigner/designer/projectsettings.ui b/kdevdesigner/designer/projectsettings.ui new file mode 100644 index 00000000..258b7739 --- /dev/null +++ b/kdevdesigner/designer/projectsettings.ui @@ -0,0 +1,301 @@ + +ProjectSettingsBase +********************************************************************* +** Copyright (C) 2001-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ProjectSettingsBase + + + + 0 + 0 + 375 + 224 + + + + Project Settings + + + true + + + + unnamed + + + 11 + + + 6 + + + + tabWidget + + + + tabSettings + + + &Settings + + + + unnamed + + + + TextLabel1_2 + + + &Project file: + + + editProjectFile + + + + + TextLabel1_3 + + + &Language: + + + comboLanguage + + + + + buttonDatabaseFile_2 + + + ... + + + + + editDatabaseFile + + + + + TextLabel1_2_2_2 + + + &Database file: + + + editDatabaseFile + + + + + comboLanguage + + + false + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + editProjectFile + + + + + buttonProject + + + ... + + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 21 + 71 + + + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + buttonProject + clicked() + ProjectSettingsBase + chooseProjectFile() + + + buttonOk + clicked() + ProjectSettingsBase + okClicked() + + + buttonCancel + clicked() + ProjectSettingsBase + reject() + + + buttonHelp + clicked() + ProjectSettingsBase + helpClicked() + + + comboLanguage + activated(const QString&) + ProjectSettingsBase + languageChanged(const QString&) + + + + tabWidget + editProjectFile + comboLanguage + buttonHelp + buttonOk + buttonCancel + + + chooseDatabaseFile() + chooseProjectFile() + destroy() + helpClicked() + init() + languageChanged( const QString & ) + okClicked() + + + diff --git a/kdevdesigner/designer/projectsettingsimpl.cpp b/kdevdesigner/designer/projectsettingsimpl.cpp new file mode 100644 index 00000000..a1a2b6b1 --- /dev/null +++ b/kdevdesigner/designer/projectsettingsimpl.cpp @@ -0,0 +1,126 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "projectsettingsimpl.h" +#include "project.h" +#include "formwindow.h" +#include "metadatabase.h" +#include "mainwindow.h" +#include "asciivalidator.h" +#include "mainwindow.h" +#include "sourcefile.h" +#include "workspace.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a ProjectSettings which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +ProjectSettings::ProjectSettings( Project *pro, QWidget* parent, const char* name, bool modal, WFlags fl ) + : ProjectSettingsBase( parent, name, modal, fl ), project( pro ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + + editProjectFile->setFocus(); + + if ( project->isDummy() ) { + editProjectFile->setEnabled( FALSE ); + editProjectFile->setText( project->projectName() ); + } else { + if ( project->fileName().isEmpty() || project->fileName() == ".pro" ) { + editProjectFile->setText( tr( "unnamed.pro" ) ); + editProjectFile->selectAll(); + } else { + editProjectFile->setText( project->fileName() ); + } + } + + editDatabaseFile->setText( project->databaseDescription() ); + + comboLanguage->insertStringList( MetaDataBase::languages() ); + for ( int j = 0; j < (int)comboLanguage->count(); ++j ) { + if ( project->language() == comboLanguage->text( j ) ) { + comboLanguage->setCurrentItem( j ); + break; + } + } +} + +/* + * Destroys the object and frees any allocated resources + */ +ProjectSettings::~ProjectSettings() +{ +} + +void ProjectSettings::chooseDatabaseFile() +{ + QString fn = KFileDialog::getSaveFileName( editDatabaseFile->text(), i18n( "*.db|Database Files\n*|All Files" ), this ); + if ( fn.isEmpty() ) + return; + editDatabaseFile->setText( fn ); +} + +void ProjectSettings::chooseProjectFile() +{ + QString fn = KFileDialog::getSaveFileName( editDatabaseFile->text(), i18n( "*.pro|Project Files\n*|All Files" ), this ); + if ( fn.isEmpty() ) + return; + editProjectFile->setText( fn ); +} + +void ProjectSettings::helpClicked() +{ +} + +void ProjectSettings::okClicked() +{ + // ### check for validity + project->setFileName( editProjectFile->text(), FALSE ); + project->setDatabaseDescription( editDatabaseFile->text() ); + project->setLanguage( comboLanguage->text( comboLanguage->currentItem() ) ); + project->setModified( TRUE ); + accept(); +} + +void ProjectSettings::languageChanged( const QString & ) +{ +} diff --git a/kdevdesigner/designer/projectsettingsimpl.h b/kdevdesigner/designer/projectsettingsimpl.h new file mode 100644 index 00000000..3833d813 --- /dev/null +++ b/kdevdesigner/designer/projectsettingsimpl.h @@ -0,0 +1,56 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PROJECTSETTINGSIMPL_H +#define PROJECTSETTINGSIMPL_H + +#include "projectsettings.h" + +class Project; +class QListViewItem; +class FormWindow; +class SourceFile; + +class ProjectSettings : public ProjectSettingsBase +{ + Q_OBJECT + +public: + ProjectSettings( Project *pro, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ProjectSettings(); + +protected slots: + void chooseDatabaseFile(); + void chooseProjectFile(); + void helpClicked(); + void okClicked(); + void languageChanged( const QString &lang ); + +private: + Project *project; +}; + +#endif diff --git a/kdevdesigner/designer/propertyeditor.cpp b/kdevdesigner/designer/propertyeditor.cpp new file mode 100644 index 00000000..06b8f93b --- /dev/null +++ b/kdevdesigner/designer/propertyeditor.cpp @@ -0,0 +1,4332 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler needs this here + +#include "propertyeditor.h" +#include "formwindow.h" +#include "command.h" +#include "metadatabase.h" +#include "propertyobject.h" +#include +#include "widgetfactory.h" +#include "globaldefs.h" +#include "defs.h" +#include "asciivalidator.h" +#include "paletteeditorimpl.h" +#include "multilineeditorimpl.h" +#include "mainwindow.h" +#include "project.h" +#include "hierarchyview.h" +#include "database.h" +#include "menubareditor.h" + +#include +#include +#include +#include "kdevdesigner_part.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // FIXME: obsolete +#include +#include +#include + +#include + + +static QFontDatabase *fontDataBase = 0; +QString assistantPath(); + +#ifdef Q_WS_MAC +#include +static void setupStyle(QWidget *w) +{ + static QStyle *windowsStyle = 0; + if(!windowsStyle) + windowsStyle = new QWindowsStyle; + w->setStyle(windowsStyle); +} +#else +#define setupStyle(x) +#endif + +static void cleanupFontDatabase() +{ + delete fontDataBase; + fontDataBase = 0; +} + +static QStringList getFontList() +{ + if ( !fontDataBase ) { + fontDataBase = new QFontDatabase; + qAddPostRoutine( cleanupFontDatabase ); + } + return fontDataBase->families(); +} + + +class PropertyWhatsThis : public QWhatsThis +{ +public: + PropertyWhatsThis( PropertyList *l ); + QString text( const QPoint &pos ); + bool clicked( const QString& href ); + +private: + PropertyList *propertyList; + +}; + +PropertyWhatsThis::PropertyWhatsThis( PropertyList *l ) + : QWhatsThis( l->viewport() ), propertyList( l ) +{ +} + +QString PropertyWhatsThis::text( const QPoint &pos ) +{ + return propertyList->whatsThisAt( pos ); +} + +bool PropertyWhatsThis::clicked( const QString& href ) +{ + if ( !href.isEmpty() ) { + QAssistantClient *ac = MainWindow::self->assistantClient(); + ac->showPage( QString( qInstallPathDocs() ) + "/html/" + href ); + } + return FALSE; // do not hide window +} + + +/*! + \class PropertyItem propertyeditor.h + \brief Base class for all property items + + This is the base class for each property item for the + PropertyList. A simple property item has just a name and a value to + provide an editor for a datatype. But more complex datatypes might + provide an expandable item for editing single parts of the + datatype. See hasSubItems(), initChildren() for that. +*/ + +/*! If this item should be a child of another property item, specify + \a prop as the parent item. +*/ + +PropertyItem::PropertyItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ) + : QListViewItem( l, after ), listview( l ), property( prop ), propertyName( propName ) +{ + setSelectable( FALSE ); + open = FALSE; + setText( 0, propertyName ); + changed = FALSE; + setText( 1, "" ); + resetButton = 0; +} + +PropertyItem::~PropertyItem() +{ + if ( resetButton ) + delete resetButton->parentWidget(); + resetButton = 0; +} + +void PropertyItem::toggle() +{ +} + +void PropertyItem::updateBackColor() +{ + if ( itemAbove() && this != listview->firstChild() ) { + if ( ( ( PropertyItem*)itemAbove() )->backColor == *backColor1 ) + backColor = *backColor2; + else + backColor = *backColor1; + } else { + backColor = *backColor1; + } + if ( listview->firstChild() == this ) + backColor = *backColor1; +} + +QColor PropertyItem::backgroundColor() +{ + updateBackColor(); + if ( (QListViewItem*)this == listview->currentItem() ) + return *selectedBack; + return backColor; +} + +/*! If a subclass is a expandable item, this is called when the child +items should be created. +*/ + +void PropertyItem::createChildren() +{ +} + +/*! If a subclass is a expandable item, this is called when the child +items should be initialized. +*/ + +void PropertyItem::initChildren() +{ +} + +void PropertyItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) +{ + QColorGroup g( cg ); + g.setColor( QColorGroup::Base, backgroundColor() ); + g.setColor( QColorGroup::Foreground, Qt::black ); + g.setColor( QColorGroup::Text, Qt::black ); + int indent = 0; + if ( column == 0 ) { + indent = 20 + ( property ? 20 : 0 ); + p->fillRect( 0, 0, width, height(), backgroundColor() ); + p->save(); + p->translate( indent, 0 ); + } + + if ( isChanged() && column == 0 ) { + p->save(); + QFont f = p->font(); + f.setBold( TRUE ); + p->setFont( f ); + } + + if ( !hasCustomContents() || column != 1 ) { + QListViewItem::paintCell( p, g, column, width - indent, align ); + } else { + p->fillRect( 0, 0, width, height(), backgroundColor() ); + drawCustomContents( p, QRect( 0, 0, width, height() ) ); + } + + if ( isChanged() && column == 0 ) + p->restore(); + if ( column == 0 ) + p->restore(); + if ( hasSubItems() && column == 0 ) { + p->save(); + p->setPen( cg.foreground() ); + p->setBrush( cg.base() ); + p->drawRect( 5, height() / 2 - 4, 9, 9 ); + p->drawLine( 7, height() / 2, 11, height() / 2 ); + if ( !isOpen() ) + p->drawLine( 9, height() / 2 - 2, 9, height() / 2 + 2 ); + p->restore(); + } + p->save(); + p->setPen( QPen( cg.dark(), 1 ) ); + p->drawLine( 0, height() - 1, width, height() - 1 ); + p->drawLine( width - 1, 0, width - 1, height() ); + p->restore(); + + if ( listview->currentItem() == this && column == 0 && + !listview->hasFocus() && !listview->viewport()->hasFocus() ) + paintFocus( p, cg, QRect( 0, 0, width, height() ) ); +} + +void PropertyItem::paintBranches( QPainter * p, const QColorGroup & cg, + int w, int y, int h ) +{ + QColorGroup g( cg ); + g.setColor( QColorGroup::Base, backgroundColor() ); + QListViewItem::paintBranches( p, g, w, y, h ); +} + +void PropertyItem::paintFocus( QPainter *p, const QColorGroup &cg, const QRect &r ) +{ + p->save(); + QApplication::style().drawPrimitive(QStyle::PE_Panel, p, r, cg, + QStyle::Style_Sunken, QStyleOption(1,1) ); + p->restore(); +} + +/*! Subclasses which are expandable items have to return TRUE + here. Default is FALSE. +*/ + +bool PropertyItem::hasSubItems() const +{ + return FALSE; +} + +/*! Returns the parent property item here if this is a child or 0 + otherwise. + */ + +PropertyItem *PropertyItem::propertyParent() const +{ + return property; +} + +bool PropertyItem::isOpen() const +{ + return open; +} + +void PropertyItem::setOpen( bool b ) +{ + if ( b == open ) + return; + open = b; + + if ( !open ) { + children.setAutoDelete( TRUE ); + children.clear(); + children.setAutoDelete( FALSE ); + qApp->processEvents(); + listview->updateEditorSize(); + return; + } + + createChildren(); + initChildren(); + qApp->processEvents(); + listview->updateEditorSize(); +} + +/*! Subclasses have to show the editor of the item here +*/ + +void PropertyItem::showEditor() +{ + createResetButton(); + resetButton->parentWidget()->show(); +} + +/*! Subclasses have to hide the editor of the item here +*/ + +void PropertyItem::hideEditor() +{ + createResetButton(); + resetButton->parentWidget()->hide(); +} + +/*! This is called to init the value of the item. Reimplement in + subclasses to init the editor +*/ + +void PropertyItem::setValue( const QVariant &v ) +{ + val = v; +} + +QVariant PropertyItem::value() const +{ + return val; +} + +bool PropertyItem::isChanged() const +{ + return changed; +} + +void PropertyItem::setChanged( bool b, bool updateDb ) +{ + if ( propertyParent() ) + return; + if ( changed == b ) + return; + changed = b; + repaint(); + if ( updateDb ) { + MetaDataBase::setPropertyChanged( listview->propertyEditor()->widget(), name(), changed ); + } + updateResetButtonState(); +} + +QString PropertyItem::name() const +{ + return propertyName; +} + +void PropertyItem::createResetButton() +{ + if ( resetButton ) { + resetButton->parentWidget()->lower(); + return; + } + const QPixmap DesignerResetPix = SmallIcon( "designer_resetproperty.png" , KDevDesignerPartFactory::instance()); + + QHBox *hbox = new QHBox( listview->viewport() ); + hbox->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + hbox->setLineWidth( 1 ); + resetButton = new QPushButton( hbox ); + setupStyle( resetButton ); + resetButton->setPixmap( DesignerResetPix ); + resetButton->setFixedWidth( resetButton->sizeHint().width() ); + hbox->layout()->setAlignment( Qt::AlignRight ); + listview->addChild( hbox ); + hbox->hide(); + QObject::connect( resetButton, SIGNAL( clicked() ), + listview, SLOT( resetProperty() ) ); + QToolTip::add( resetButton, i18n( "Reset the property to its default value" ) ); + QWhatsThis::add( resetButton, i18n( "Click this button to reset the property to its default value" ) ); + updateResetButtonState(); +} + +void PropertyItem::updateResetButtonState() +{ + if ( !resetButton ) + return; + if ( propertyParent() || !WidgetFactory::canResetProperty( listview->propertyEditor()->widget(), name() ) ) + resetButton->setEnabled( FALSE ); + else + resetButton->setEnabled( isChanged() ); +} + +/*! Call this to place/resize the item editor correctly (normally + call it from showEditor()) +*/ + +void PropertyItem::placeEditor( QWidget *w ) +{ + createResetButton(); + QRect r = listview->itemRect( this ); + if ( !r.size().isValid() ) { + listview->ensureItemVisible( this ); +#if defined(Q_WS_WIN) + listview->repaintContents( FALSE ); +#endif + r = listview->itemRect( this ); + } + r.setX( listview->header()->sectionPos( 1 ) ); + r.setWidth( listview->header()->sectionSize( 1 ) - 1 ); + r.setWidth( r.width() - resetButton->width() - 2 ); + r = QRect( listview->viewportToContents( r.topLeft() ), r.size() ); + w->resize( r.size() ); + listview->moveChild( w, r.x(), r.y() ); + resetButton->parentWidget()->resize( resetButton->sizeHint().width() + 10, r.height() ); + listview->moveChild( resetButton->parentWidget(), r.x() + r.width() - 8, r.y() ); + resetButton->setFixedHeight( QMAX( 0, r.height() - 3 ) ); +} + +/*! This should be called by subclasses if the user changed the value + of the property and this value should be applied to the widget property +*/ + +void PropertyItem::notifyValueChange() +{ + if ( !propertyParent() ) { + listview->valueChanged( this ); + setChanged( TRUE ); + if ( hasSubItems() ) + initChildren(); + } else { + propertyParent()->childValueChanged( this ); + setChanged( TRUE ); + } +} + +/*! If a subclass is a expandable item reimplement this as this is + always called if a child item changed its value. So update the + display of the item here then. +*/ + +void PropertyItem::childValueChanged( PropertyItem * ) +{ +} + +/*! When adding a child item, call this (normally from addChildren() +*/ + +void PropertyItem::addChild( PropertyItem *i ) +{ + children.append( i ); +} + +int PropertyItem::childCount() const +{ + return children.count(); +} + +PropertyItem *PropertyItem::child( int i ) const +{ + // ARRRRRRRRG + return ( (PropertyItem*)this )->children.at( i ); +} + +/*! If the contents of the item is not displayable with a text, but + you want to draw it yourself (using drawCustomContents()), return + TRUE here. +*/ + +bool PropertyItem::hasCustomContents() const +{ + return FALSE; +} + +/*! + \sa hasCustomContents() +*/ + +void PropertyItem::drawCustomContents( QPainter *, const QRect & ) +{ +} + +QString PropertyItem::currentItem() const +{ + return QString::null; +} + +int PropertyItem::currentIntItem() const +{ + return -1; +} + +void PropertyItem::setCurrentItem( const QString & ) +{ +} + +void PropertyItem::setCurrentItem( int ) +{ +} + +int PropertyItem::currentIntItemFromObject() const +{ + return -1; +} + +QString PropertyItem::currentItemFromObject() const +{ + return QString::null; +} + +void PropertyItem::setFocus( QWidget *w ) +{ + if ( !qApp->focusWidget() || + listview->propertyEditor()->formWindow() && + ( !MainWindow::self->isAFormWindowChild( qApp->focusWidget() ) && + !qApp->focusWidget()->inherits( "Editor" ) ) ) + w->setFocus(); +} + +void PropertyItem::setText( int col, const QString &t ) +{ + QString txt( t ); + if ( col == 1 ) + txt = txt.replace( "\n", " " ); + QListViewItem::setText( col, txt ); +} + +// -------------------------------------------------------------- + +PropertyTextItem::PropertyTextItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool comment, bool multiLine, bool ascii, bool a ) + : PropertyItem( l, after, prop, propName ), withComment( comment ), + hasMultiLines( multiLine ), asciiOnly( ascii ), accel( a ) +{ + lin = 0; + box = 0; +} + +QLineEdit *PropertyTextItem::lined() +{ + if ( lin ) + return lin; + if ( hasMultiLines ) { + box = new QHBox( listview->viewport() ); + box->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + box->setLineWidth( 2 ); + box->hide(); + } + + lin = 0; + if ( hasMultiLines ) + lin = new QLineEdit( box ); + else + lin = new QLineEdit( listview->viewport() ); + + if ( asciiOnly ) { + if ( PropertyItem::name() == "name" ) { + lin->setValidator( new AsciiValidator( QString(":"), lin, "ascii_validator" ) ); + if ( listview->propertyEditor()->formWindow()->isFake() ) + lin->setEnabled( FALSE ); + } else { + lin->setValidator( new AsciiValidator( QString("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" + "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9" + "\xaa\xab\xac\xad\xae\xaf\xb1\xb2\xb3" + "\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc" + "\xbd\xbe\xbf"), lin, "ascii_validator" ) ); + } + } if ( !hasMultiLines ) { + lin->hide(); + } else { + button = new QPushButton( "...", box ); + setupStyle( button ); + button->setFixedWidth( 20 ); + connect( button, SIGNAL( clicked() ), + this, SLOT( getText() ) ); + lin->setFrame( FALSE ); + } + connect( lin, SIGNAL( returnPressed() ), + this, SLOT( setValue() ) ); + connect( lin, SIGNAL( textChanged( const QString & ) ), + this, SLOT( setValue() ) ); + if ( PropertyItem::name() == "name" || PropertyItem::name() == "itemName" ) + connect( lin, SIGNAL( returnPressed() ), + listview->propertyEditor()->formWindow()->commandHistory(), + SLOT( checkCompressedCommand() ) ); + lin->installEventFilter( listview ); + return lin; +} + +PropertyTextItem::~PropertyTextItem() +{ + delete (QLineEdit*)lin; + lin = 0; + delete (QHBox*)box; + box = 0; +} + +void PropertyTextItem::setChanged( bool b, bool updateDb ) +{ + PropertyItem::setChanged( b, updateDb ); + if ( withComment && childCount() > 0 ) + ( (PropertyTextItem*)PropertyItem::child( 0 ) )->lined()->setEnabled( b ); +} + +bool PropertyTextItem::hasSubItems() const +{ + return withComment; +} + +void PropertyTextItem::childValueChanged( PropertyItem *child ) +{ + if ( PropertyItem::name() != "name" ) + MetaDataBase::setPropertyComment( listview->propertyEditor()->widget(), + PropertyItem::name(), child->value().toString() ); + else + MetaDataBase::setExportMacro( listview->propertyEditor()->widget(), child->value().toString() ); + listview->propertyEditor()->formWindow()->commandHistory()->setModified( TRUE ); +} + +void PropertyTextItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !lin || lin->text().length() == 0 ) { + lined()->blockSignals( TRUE ); + lined()->setText( value().toString() ); + lined()->blockSignals( FALSE ); + } + + QWidget* w; + if ( hasMultiLines ) + w = box; + else + w= lined(); + + placeEditor( w ); + if ( !w->isVisible() || !lined()->hasFocus() ) { + w->show(); + setFocus( lined() ); + } +} + +void PropertyTextItem::createChildren() +{ + PropertyTextItem *i = new PropertyTextItem( listview, this, this, + PropertyItem::name() == "name" ? + "export macro" : "comment", FALSE, FALSE, + PropertyItem::name() == "name" ); + i->lined()->setEnabled( isChanged() ); + addChild( i ); +} + +void PropertyTextItem::initChildren() +{ + if ( !childCount() ) + return; + PropertyItem *item = PropertyItem::child( 0 ); + if ( item ) { + if ( PropertyItem::name() != "name" ) + item->setValue( MetaDataBase::propertyComment( listview->propertyEditor()->widget(), + PropertyItem::name() ) ); + else + item->setValue( MetaDataBase::exportMacro( listview->propertyEditor()->widget() ) ); + } +} + +void PropertyTextItem::hideEditor() +{ + PropertyItem::hideEditor(); + QWidget* w; + if ( hasMultiLines ) + w = box; + else + w = lined(); + + w->hide(); +} + +void PropertyTextItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + if ( lin ) { + lined()->blockSignals( TRUE ); + int oldCursorPos; + oldCursorPos = lin->cursorPosition(); + lined()->setText( v.toString() ); + if ( oldCursorPos < (int)lin->text().length() ) + lin->setCursorPosition( oldCursorPos ); + lined()->blockSignals( FALSE ); + } + setText( 1, v.toString() ); + PropertyItem::setValue( v ); +} + +void PropertyTextItem::setValue() +{ + setText( 1, lined()->text() ); + QVariant v; + if ( accel ) { + v = QVariant( QKeySequence( lined()->text() ) ); + if ( v.toString().isNull() ) + return; // not yet valid input + } else { + v = lined()->text(); + } + PropertyItem::setValue( v ); + notifyValueChange(); +} + +void PropertyTextItem::getText() +{ + bool richText = !::qt_cast(listview->propertyEditor()->widget()) || + ( text( 0 ) == "whatsThis" ); + bool doWrap = FALSE; + QString txt = MultiLineEditor::getText( listview, value().toString(), richText, &doWrap ); + if ( !txt.isEmpty() ) { + setText( 1, txt ); + PropertyItem::setValue( txt ); + notifyValueChange(); + lined()->blockSignals( TRUE ); + lined()->setText( txt ); + lined()->blockSignals( FALSE ); + } +} + +// -------------------------------------------------------------- + +PropertyDoubleItem::PropertyDoubleItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + lin = 0; +} + +QLineEdit *PropertyDoubleItem::lined() +{ + if ( lin ) + return lin; + lin = new QLineEdit( listview->viewport() ); + lin->setValidator( new QDoubleValidator( lin, "double_validator" ) ); + + connect( lin, SIGNAL( returnPressed() ), + this, SLOT( setValue() ) ); + connect( lin, SIGNAL( textChanged( const QString & ) ), + this, SLOT( setValue() ) ); + lin->installEventFilter( listview ); + return lin; +} + +PropertyDoubleItem::~PropertyDoubleItem() +{ + delete (QLineEdit*)lin; + lin = 0; +} + +void PropertyDoubleItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !lin ) { + lined()->blockSignals( TRUE ); + lined()->setText( QString::number( value().toDouble() ) ); + lined()->blockSignals( FALSE ); + } + QWidget* w = lined(); + + placeEditor( w ); + if ( !w->isVisible() || !lined()->hasFocus() ) { + w->show(); + setFocus( lined() ); + } +} + + +void PropertyDoubleItem::hideEditor() +{ + PropertyItem::hideEditor(); + QWidget* w = lined(); + w->hide(); +} + +void PropertyDoubleItem::setValue( const QVariant &v ) +{ + if ( value() == v ) + return; + if ( lin ) { + lined()->blockSignals( TRUE ); + int oldCursorPos; + oldCursorPos = lin->cursorPosition(); + lined()->setText( QString::number( v.toDouble() ) ); + if ( oldCursorPos < (int)lin->text().length() ) + lin->setCursorPosition( oldCursorPos ); + lined()->blockSignals( FALSE ); + } + setText( 1, QString::number( v.toDouble() ) ); + PropertyItem::setValue( v ); +} + +void PropertyDoubleItem::setValue() +{ + setText( 1, lined()->text() ); + QVariant v = lined()->text().toDouble(); + PropertyItem::setValue( v ); + notifyValueChange(); +} + + +// -------------------------------------------------------------- + +PropertyDateItem::PropertyDateItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + lin = 0; +} + +QDateEdit *PropertyDateItem::lined() +{ + if ( lin ) + return lin; + lin = new QDateEdit( listview->viewport() ); + QObjectList *l = lin->queryList( "QLineEdit" ); + for ( QObject *o = l->first(); o; o = l->next() ) + o->installEventFilter( listview ); + delete l; + connect( lin, SIGNAL( valueChanged( const QDate & ) ), + this, SLOT( setValue() ) ); + return lin; +} + +PropertyDateItem::~PropertyDateItem() +{ + delete (QDateEdit*)lin; + lin = 0; +} + +void PropertyDateItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !lin ) { + lined()->blockSignals( TRUE ); + lined()->setDate( value().toDate() ); + lined()->blockSignals( FALSE ); + } + placeEditor( lin ); + if ( !lin->isVisible() ) { + lin->show(); + setFocus( lin ); + } +} + +void PropertyDateItem::hideEditor() +{ + PropertyItem::hideEditor(); + if ( lin ) + lin->hide(); +} + +void PropertyDateItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + if ( lin ) { + lined()->blockSignals( TRUE ); + if ( lined()->date() != v.toDate() ) + lined()->setDate( v.toDate() ); + lined()->blockSignals( FALSE ); + } + setText( 1, v.toDate().toString( ::Qt::ISODate ) ); + PropertyItem::setValue( v ); +} + +void PropertyDateItem::setValue() +{ + setText( 1, lined()->date().toString( ::Qt::ISODate ) ); + QVariant v; + v = lined()->date(); + PropertyItem::setValue( v ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyTimeItem::PropertyTimeItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + lin = 0; +} + +QTimeEdit *PropertyTimeItem::lined() +{ + if ( lin ) + return lin; + lin = new QTimeEdit( listview->viewport() ); + connect( lin, SIGNAL( valueChanged( const QTime & ) ), + this, SLOT( setValue() ) ); + QObjectList *l = lin->queryList( "QLineEdit" ); + for ( QObject *o = l->first(); o; o = l->next() ) + o->installEventFilter( listview ); + delete l; + return lin; +} + +PropertyTimeItem::~PropertyTimeItem() +{ + delete (QTimeEdit*)lin; + lin = 0; +} + +void PropertyTimeItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !lin ) { + lined()->blockSignals( TRUE ); + lined()->setTime( value().toTime() ); + lined()->blockSignals( FALSE ); + } + placeEditor( lin ); + if ( !lin->isVisible() ) { + lin->show(); + setFocus( lin ); + } +} + +void PropertyTimeItem::hideEditor() +{ + PropertyItem::hideEditor(); + if ( lin ) + lin->hide(); +} + +void PropertyTimeItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + if ( lin ) { + lined()->blockSignals( TRUE ); + if ( lined()->time() != v.toTime() ) + lined()->setTime( v.toTime() ); + lined()->blockSignals( FALSE ); + } + setText( 1, v.toTime().toString( ::Qt::ISODate ) ); + PropertyItem::setValue( v ); +} + +void PropertyTimeItem::setValue() +{ + setText( 1, lined()->time().toString( ::Qt::ISODate ) ); + QVariant v; + v = lined()->time(); + PropertyItem::setValue( v ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyDateTimeItem::PropertyDateTimeItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + lin = 0; +} + +QDateTimeEdit *PropertyDateTimeItem::lined() +{ + if ( lin ) + return lin; + lin = new QDateTimeEdit( listview->viewport() ); + connect( lin, SIGNAL( valueChanged( const QDateTime & ) ), + this, SLOT( setValue() ) ); + QObjectList *l = lin->queryList( "QLineEdit" ); + for ( QObject *o = l->first(); o; o = l->next() ) + o->installEventFilter( listview ); + delete l; + return lin; +} + +PropertyDateTimeItem::~PropertyDateTimeItem() +{ + delete (QDateTimeEdit*)lin; + lin = 0; +} + +void PropertyDateTimeItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !lin ) { + lined()->blockSignals( TRUE ); + lined()->setDateTime( value().toDateTime() ); + lined()->blockSignals( FALSE ); + } + placeEditor( lin ); + if ( !lin->isVisible() ) { + lin->show(); + setFocus( lin ); + } +} + +void PropertyDateTimeItem::hideEditor() +{ + PropertyItem::hideEditor(); + if ( lin ) + lin->hide(); +} + +void PropertyDateTimeItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + if ( lin ) { + lined()->blockSignals( TRUE ); + if ( lined()->dateTime() != v.toDateTime() ) + lined()->setDateTime( v.toDateTime() ); + lined()->blockSignals( FALSE ); + } + setText( 1, v.toDateTime().toString( ::Qt::ISODate ) ); + PropertyItem::setValue( v ); +} + +void PropertyDateTimeItem::setValue() +{ + setText( 1, lined()->dateTime().toString( ::Qt::ISODate ) ); + QVariant v; + v = lined()->dateTime(); + PropertyItem::setValue( v ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyBoolItem::PropertyBoolItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + comb = 0; +} + +QComboBox *PropertyBoolItem::combo() +{ + if ( comb ) + return comb; + comb = new QComboBox( FALSE, listview->viewport() ); + comb->hide(); + comb->insertItem( i18n( "False" ) ); + comb->insertItem( i18n( "True" ) ); + connect( comb, SIGNAL( activated( int ) ), + this, SLOT( setValue() ) ); + comb->installEventFilter( listview ); + return comb; +} + +PropertyBoolItem::~PropertyBoolItem() +{ + delete (QComboBox*)comb; + comb = 0; +} + +void PropertyBoolItem::toggle() +{ + bool b = value().toBool(); + setValue( QVariant( !b, 0 ) ); + setValue(); +} + +void PropertyBoolItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !comb ) { + combo()->blockSignals( TRUE ); + if ( value().toBool() ) + combo()->setCurrentItem( 1 ); + else + combo()->setCurrentItem( 0 ); + combo()->blockSignals( FALSE ); + } + placeEditor( combo() ); + if ( !combo()->isVisible() || !combo()->hasFocus() ) { + combo()->show(); + setFocus( combo() ); + } +} + +void PropertyBoolItem::hideEditor() +{ + PropertyItem::hideEditor(); + combo()->hide(); +} + +void PropertyBoolItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + if ( comb ) { + combo()->blockSignals( TRUE ); + if ( v.toBool() ) + combo()->setCurrentItem( 1 ); + else + combo()->setCurrentItem( 0 ); + combo()->blockSignals( FALSE ); + } + QString tmp = i18n( "True" ); + if ( !v.toBool() ) + tmp = i18n( "False" ); + setText( 1, tmp ); + PropertyItem::setValue( v ); +} + +void PropertyBoolItem::setValue() +{ + if ( !comb ) + return; + setText( 1, combo()->currentText() ); + bool b = combo()->currentItem() == 0 ? (bool)FALSE : (bool)TRUE; + PropertyItem::setValue( QVariant( b, 0 ) ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyIntItem::PropertyIntItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool s ) + : PropertyItem( l, after, prop, propName ), signedValue( s ) +{ + spinBx = 0; +} + +QSpinBox *PropertyIntItem::spinBox() +{ + if ( spinBx ) + return spinBx; + if ( signedValue ) + spinBx = new QSpinBox( -INT_MAX, INT_MAX, 1, listview->viewport() ); + else + spinBx = new QSpinBox( 0, INT_MAX, 1, listview->viewport() ); + spinBx->hide(); + spinBx->installEventFilter( listview ); + QObjectList *ol = spinBx->queryList( "QLineEdit" ); + if ( ol && ol->first() ) + ol->first()->installEventFilter( listview ); + delete ol; + connect( spinBx, SIGNAL( valueChanged( int ) ), + this, SLOT( setValue() ) ); + return spinBx; +} + +PropertyIntItem::~PropertyIntItem() +{ + delete (QSpinBox*)spinBx; + spinBx = 0; +} + +void PropertyIntItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !spinBx ) { + spinBox()->blockSignals( TRUE ); + if ( signedValue ) + spinBox()->setValue( value().toInt() ); + else + spinBox()->setValue( value().toUInt() ); + spinBox()->blockSignals( FALSE ); + } + placeEditor( spinBox() ); + if ( !spinBox()->isVisible() || !spinBox()->hasFocus() ) { + spinBox()->show(); + setFocus( spinBox() ); + } +} + +void PropertyIntItem::hideEditor() +{ + PropertyItem::hideEditor(); + spinBox()->hide(); +} + +void PropertyIntItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + if ( spinBx ) { + spinBox()->blockSignals( TRUE ); + if ( signedValue ) + spinBox()->setValue( v.toInt() ); + else + spinBox()->setValue( v.toUInt() ); + spinBox()->blockSignals( FALSE ); + } + + if ( signedValue ) + setText( 1, QString::number( v.toInt() ) ); + else + setText( 1, QString::number( v.toUInt() ) ); + PropertyItem::setValue( v ); +} + +void PropertyIntItem::setValue() +{ + if ( !spinBx ) + return; + setText( 1, QString::number( spinBox()->value() ) ); + if ( signedValue ) + PropertyItem::setValue( spinBox()->value() ); + else + PropertyItem::setValue( (uint)spinBox()->value() ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyLayoutItem::PropertyLayoutItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + spinBx = 0; +} + +PropertyLayoutItem::~PropertyLayoutItem() +{ + delete (QSpinBox*)spinBx; + spinBx = 0; +} + +QSpinBox* PropertyLayoutItem::spinBox() +{ + if ( spinBx ) + return spinBx; + spinBx = new QSpinBox( -1, INT_MAX, 1, listview->viewport() ); + spinBx->setSpecialValueText( i18n( "default" ) ); + spinBx->hide(); + spinBx->installEventFilter( listview ); + QObjectList *ol = spinBx->queryList( "QLineEdit" ); + if ( ol && ol->first() ) + ol->first()->installEventFilter( listview ); + delete ol; + connect( spinBx, SIGNAL( valueChanged( int ) ), + this, SLOT( setValue() ) ); + return spinBx; +} + +void PropertyLayoutItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !spinBx ) { + spinBox()->blockSignals( TRUE ); + spinBox()->setValue( value().toInt() ); + spinBox()->blockSignals( TRUE ); + } + placeEditor( spinBox() ); + if ( !spinBox()->isVisible() || !spinBox()->hasFocus() ) { + spinBox()->show(); + setFocus( spinBox() ); + } +} + +void PropertyLayoutItem::hideEditor() +{ + PropertyItem::hideEditor(); + spinBox()->hide(); +} + +void PropertyLayoutItem::setValue( const QVariant &v ) +{ + if ( spinBx ) { + spinBox()->blockSignals( TRUE ); + spinBox()->setValue( v.toInt() ); + spinBox()->blockSignals( FALSE ); + } + QString s = v.toString(); + if ( v.toInt() == -1 ) + s = spinBox()->specialValueText(); + setText( 1, s ); + PropertyItem::setValue( v ); +} + +void PropertyLayoutItem::setValue() +{ + if ( !spinBx ) + return; + PropertyItem::setValue( spinBox()->value() ); + notifyValueChange(); +} + + +// -------------------------------------------------------------- + +PropertyListItem::PropertyListItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool e ) + : PropertyItem( l, after, prop, propName ), editable( e ) +{ + comb = 0; + oldInt = -1; +} + +QComboBox *PropertyListItem::combo() +{ + if ( comb ) + return comb; + comb = new QComboBox( editable, listview->viewport() ); + comb->hide(); + connect( comb, SIGNAL( activated( int ) ), + this, SLOT( setValue() ) ); + comb->installEventFilter( listview ); + if ( editable ) { + QObjectList *ol = comb->queryList( "QLineEdit" ); + if ( ol && ol->first() ) + ol->first()->installEventFilter( listview ); + delete ol; + } + return comb; +} + +PropertyListItem::~PropertyListItem() +{ + delete (QComboBox*)comb; + comb = 0; +} + +void PropertyListItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !comb ) { + combo()->blockSignals( TRUE ); + combo()->clear(); + combo()->insertStringList( value().toStringList() ); + combo()->blockSignals( FALSE ); + } + placeEditor( combo() ); + if ( !combo()->isVisible() || !combo()->hasFocus() ) { + combo()->show(); + setFocus( combo() ); + } +} + +void PropertyListItem::hideEditor() +{ + PropertyItem::hideEditor(); + combo()->hide(); +} + +void PropertyListItem::setValue( const QVariant &v ) +{ + if ( comb ) { + combo()->blockSignals( TRUE ); + combo()->clear(); + combo()->insertStringList( v.toStringList() ); + combo()->blockSignals( FALSE ); + } + setText( 1, v.toStringList().first() ); + PropertyItem::setValue( v ); +} + +void PropertyListItem::setValue() +{ + if ( !comb ) + return; + setText( 1, combo()->currentText() ); + QStringList lst; + for ( uint i = 0; i < combo()->listBox()->count(); ++i ) + lst << combo()->listBox()->item( i )->text(); + PropertyItem::setValue( lst ); + notifyValueChange(); + oldInt = currentIntItem(); + oldString = currentItem(); +} + +QString PropertyListItem::currentItem() const +{ + return ( (PropertyListItem*)this )->combo()->currentText(); +} + +void PropertyListItem::setCurrentItem( const QString &s ) +{ + if ( comb && currentItem().lower() == s.lower() ) + return; + + if ( !comb ) { + combo()->blockSignals( TRUE ); + combo()->clear(); + combo()->insertStringList( value().toStringList() ); + combo()->blockSignals( FALSE ); + } + for ( uint i = 0; i < combo()->listBox()->count(); ++i ) { + if ( combo()->listBox()->item( i )->text().lower() == s.lower() ) { + combo()->setCurrentItem( i ); + setText( 1, combo()->currentText() ); + break; + } + } + oldInt = currentIntItem(); + oldString = currentItem(); +} + +void PropertyListItem::addItem( const QString &s ) +{ + combo()->insertItem( s ); +} + +void PropertyListItem::setCurrentItem( int i ) +{ + if ( comb && i == combo()->currentItem() ) + return; + + if ( !comb ) { + combo()->blockSignals( TRUE ); + combo()->clear(); + combo()->insertStringList( value().toStringList() ); + combo()->blockSignals( FALSE ); + } + combo()->setCurrentItem( i ); + setText( 1, combo()->currentText() ); + oldInt = currentIntItem(); + oldString = currentItem(); +} + +int PropertyListItem::currentIntItem() const +{ + return ( (PropertyListItem*)this )->combo()->currentItem(); +} + +int PropertyListItem::currentIntItemFromObject() const +{ + return oldInt; +} + +QString PropertyListItem::currentItemFromObject() const +{ + return oldString; +} + +// -------------------------------------------------------------- + +PropertyCoordItem::PropertyCoordItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, Type t ) + : PropertyItem( l, after, prop, propName ), typ( t ) +{ + lin = 0; + +} + +QLineEdit *PropertyCoordItem::lined() +{ + if ( lin ) + return lin; + lin = new QLineEdit( listview->viewport() ); + lin->setReadOnly( TRUE ); + lin->installEventFilter( listview ); + lin->hide(); + return lin; +} + +void PropertyCoordItem::createChildren() +{ + PropertyItem *i = this; + if ( typ == Rect || typ == Point ) { + i = new PropertyIntItem( listview, i, this, i18n( "x" ), TRUE ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "y" ), TRUE ); + addChild( i ); + } + if ( typ == Rect || typ == Size ) { + i = new PropertyIntItem( listview, i, this, i18n( "width" ), TRUE ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "height" ), TRUE ); + addChild( i ); + } +} + +void PropertyCoordItem::initChildren() +{ + PropertyItem *item = 0; + for ( int i = 0; i < childCount(); ++i ) { + item = PropertyItem::child( i ); + if ( item->name() == i18n( "x" ) ) { + if ( typ == Rect ) + item->setValue( val.toRect().x() ); + else if ( typ == Point ) + item->setValue( val.toPoint().x() ); + } else if ( item->name() == i18n( "y" ) ) { + if ( typ == Rect ) + item->setValue( val.toRect().y() ); + else if ( typ == Point ) + item->setValue( val.toPoint().y() ); + } else if ( item->name() == i18n( "width" ) ) { + if ( typ == Rect ) + item->setValue( val.toRect().width() ); + else if ( typ == Size ) + item->setValue( val.toSize().width() ); + } else if ( item->name() == i18n( "height" ) ) { + if ( typ == Rect ) + item->setValue( val.toRect().height() ); + else if ( typ == Size ) + item->setValue( val.toSize().height() ); + } + } +} + +PropertyCoordItem::~PropertyCoordItem() +{ + delete (QLineEdit*)lin; + lin = 0; +} + +void PropertyCoordItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !lin ) + lined()->setText( text( 1 ) ); + placeEditor( lined() ); + if ( !lined()->isVisible() || !lined()->hasFocus() ) { + lined()->show(); + setFocus( lined() ); + } +} + +void PropertyCoordItem::hideEditor() +{ + PropertyItem::hideEditor(); + lined()->hide(); +} + +void PropertyCoordItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + QString s; + if ( typ == Rect ) + s = "[ " + QString::number( v.toRect().x() ) + ", " + QString::number( v.toRect().y() ) + ", " + + QString::number( v.toRect().width() ) + ", " + QString::number( v.toRect().height() ) + " ]"; + else if ( typ == Point ) + s = "[ " + QString::number( v.toPoint().x() ) + ", " + + QString::number( v.toPoint().y() ) + " ]"; + else if ( typ == Size ) + s = "[ " + QString::number( v.toSize().width() ) + ", " + + QString::number( v.toSize().height() ) + " ]"; + setText( 1, s ); + if ( lin ) + lined()->setText( s ); + PropertyItem::setValue( v ); +} + +bool PropertyCoordItem::hasSubItems() const +{ + return TRUE; +} + +void PropertyCoordItem::childValueChanged( PropertyItem *child ) +{ + if ( typ == Rect ) { + QRect r = value().toRect(); + if ( child->name() == i18n( "x" ) ) + r.moveBy( -r.x() + child->value().toInt(), 0 ); + else if ( child->name() == i18n( "y" ) ) + r.moveBy( 0, -r.y() + child->value().toInt() ); + else if ( child->name() == i18n( "width" ) ) + r.setWidth( child->value().toInt() ); + else if ( child->name() == i18n( "height" ) ) + r.setHeight( child->value().toInt() ); + setValue( r ); + } else if ( typ == Point ) { + QPoint r = value().toPoint(); + if ( child->name() == i18n( "x" ) ) + r.setX( child->value().toInt() ); + else if ( child->name() == i18n( "y" ) ) + r.setY( child->value().toInt() ); + setValue( r ); + } else if ( typ == Size ) { + QSize r = value().toSize(); + if ( child->name() == i18n( "width" ) ) + r.setWidth( child->value().toInt() ); + else if ( child->name() == i18n( "height" ) ) + r.setHeight( child->value().toInt() ); + setValue( r ); + } + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyPixmapItem::PropertyPixmapItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, Type t ) + : PropertyItem( l, after, prop, propName ), type( t ) +{ + box = new QHBox( listview->viewport() ); + box->hide(); + pixPrev = new QLabel( box ); + pixPrev->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Minimum ) ); + pixPrev->setBackgroundColor( pixPrev->colorGroup().color( QColorGroup::Base ) ); + button = new QPushButton( "...", box ); + setupStyle( button ); + button->setFixedWidth( 20 ); + box->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + box->setLineWidth( 2 ); + pixPrev->setFrameStyle( QFrame::NoFrame ); + box->installEventFilter( listview ); + connect( button, SIGNAL( clicked() ), + this, SLOT( getPixmap() ) ); +} + +PropertyPixmapItem::~PropertyPixmapItem() +{ + delete (QHBox*)box; +} + +void PropertyPixmapItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() ) { + box->show(); + listView()->viewport()->setFocus(); + } +} + +void PropertyPixmapItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +void PropertyPixmapItem::setValue( const QVariant &v ) +{ + QString s; + if ( type == Pixmap ) + pixPrev->setPixmap( v.toPixmap() ); + else if ( type == IconSet ) + pixPrev->setPixmap( v.toIconSet().pixmap() ); + else + pixPrev->setPixmap( v.toImage() ); + PropertyItem::setValue( v ); + repaint(); +} + +void PropertyPixmapItem::getPixmap() +{ + QPixmap pix = qChoosePixmap( listview, listview->propertyEditor()->formWindow(), value().toPixmap() ); + if ( !pix.isNull() ) { + if ( type == Pixmap ) + setValue( pix ); + else if ( type == IconSet ) + setValue( QIconSet( pix ) ); + else + setValue( pix.convertToImage() ); + + notifyValueChange(); + } +} + +bool PropertyPixmapItem::hasCustomContents() const +{ + return TRUE; +} + +void PropertyPixmapItem::drawCustomContents( QPainter *p, const QRect &r ) +{ + QPixmap pix; + if ( type == Pixmap ) + pix = value().toPixmap(); + else if ( type == IconSet ) + pix = value().toIconSet().pixmap(); + else + pix = value().toImage(); + + if ( !pix.isNull() ) { + p->save(); + p->setClipRect( QRect( QPoint( (int)(p->worldMatrix().dx() + r.x()), + (int)(p->worldMatrix().dy() + r.y()) ), + r.size() ) ); + p->drawPixmap( r.x(), r.y() + ( r.height() - pix.height() ) / 2, pix ); + p->restore(); + } +} + + +// -------------------------------------------------------------- + +PropertyColorItem::PropertyColorItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool children ) + : PropertyItem( l, after, prop, propName ), withChildren( children ) +{ + box = new QHBox( listview->viewport() ); + box->hide(); + colorPrev = new QFrame( box ); + button = new QPushButton( "...", box ); + setupStyle( button ); + button->setFixedWidth( 20 ); + box->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + box->setLineWidth( 2 ); + colorPrev->setFrameStyle( QFrame::Plain | QFrame::Box ); + colorPrev->setLineWidth( 2 ); + QPalette pal = colorPrev->palette(); + QColorGroup cg = pal.active(); + cg.setColor( QColorGroup::Foreground, cg.color( QColorGroup::Base ) ); + pal.setActive( cg ); + pal.setInactive( cg ); + pal.setDisabled( cg ); + colorPrev->setPalette( pal ); + box->installEventFilter( listview ); + connect( button, SIGNAL( clicked() ), + this, SLOT( getColor() ) ); +} + +void PropertyColorItem::createChildren() +{ + PropertyItem *i = this; + i = new PropertyIntItem( listview, i, this, i18n( "Red" ), TRUE ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "Green" ), TRUE ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "Blue" ), TRUE ); + addChild( i ); +} + +void PropertyColorItem::initChildren() +{ + PropertyItem *item = 0; + for ( int i = 0; i < childCount(); ++i ) { + item = PropertyItem::child( i ); + if ( item->name() == i18n( "Red" ) ) + item->setValue( val.toColor().red() ); + else if ( item->name() == i18n( "Green" ) ) + item->setValue( val.toColor().green() ); + else if ( item->name() == i18n( "Blue" ) ) + item->setValue( val.toColor().blue() ); + } +} + +PropertyColorItem::~PropertyColorItem() +{ + delete (QHBox*)box; +} + +void PropertyColorItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() ) { + box->show(); + listView()->viewport()->setFocus(); + } +} + +void PropertyColorItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +void PropertyColorItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + QString s; + setText( 1, v.toColor().name() ); + colorPrev->setBackgroundColor( v.toColor() ); + PropertyItem::setValue( v ); +} + +bool PropertyColorItem::hasSubItems() const +{ + return withChildren; +} + +void PropertyColorItem::childValueChanged( PropertyItem *child ) +{ + QColor c( val.toColor() ); + if ( child->name() == i18n( "Red" ) ) + c.setRgb( child->value().toInt(), c.green(), c.blue() ); + else if ( child->name() == i18n( "Green" ) ) + c.setRgb( c.red(), child->value().toInt(), c.blue() ); + else if ( child->name() == i18n( "Blue" ) ) + c.setRgb( c.red(), c.green(), child->value().toInt() ); + setValue( c ); + notifyValueChange(); +} + +void PropertyColorItem::getColor() +{ + QColor c = QColorDialog::getColor( val.asColor(), listview ); + if ( c.isValid() ) { + setValue( c ); + notifyValueChange(); + } +} + +bool PropertyColorItem::hasCustomContents() const +{ + return TRUE; +} + +void PropertyColorItem::drawCustomContents( QPainter *p, const QRect &r ) +{ + p->save(); + p->setPen( QPen( black, 1 ) ); + p->setBrush( val.toColor() ); + p->drawRect( r.x() + 2, r.y() + 2, r.width() - 5, r.height() - 5 ); + p->restore(); +} + +// -------------------------------------------------------------- + +PropertyFontItem::PropertyFontItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + box = new QHBox( listview->viewport() ); + box->hide(); + lined = new QLineEdit( box ); + button = new QPushButton( "...", box ); + setupStyle( button ); + button->setFixedWidth( 20 ); + box->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + box->setLineWidth( 2 ); + lined->setFrame( FALSE ); + lined->setReadOnly( TRUE ); + box->setFocusProxy( lined ); + box->installEventFilter( listview ); + lined->installEventFilter( listview ); + button->installEventFilter( listview ); + connect( button, SIGNAL( clicked() ), + this, SLOT( getFont() ) ); +} + +void PropertyFontItem::createChildren() +{ + PropertyItem *i = this; + i = new PropertyListItem( listview, i, this, i18n( "Family" ), FALSE ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "Point Size" ), TRUE ); + addChild( i ); + i = new PropertyBoolItem( listview, i, this, i18n( "Bold" ) ); + addChild( i ); + i = new PropertyBoolItem( listview, i, this, i18n( "Italic" ) ); + addChild( i ); + i = new PropertyBoolItem( listview, i, this, i18n( "Underline" ) ); + addChild( i ); + i = new PropertyBoolItem( listview, i, this, i18n( "Strikeout" ) ); + addChild( i ); +} + +void PropertyFontItem::initChildren() +{ + PropertyItem *item = 0; + for ( int i = 0; i < childCount(); ++i ) { + item = PropertyItem::child( i ); + if ( item->name() == i18n( "Family" ) ) { + ( (PropertyListItem*)item )->setValue( getFontList() ); + ( (PropertyListItem*)item )->setCurrentItem( val.toFont().family() ); + } else if ( item->name() == i18n( "Point Size" ) ) + item->setValue( val.toFont().pointSize() ); + else if ( item->name() == i18n( "Bold" ) ) + item->setValue( QVariant( val.toFont().bold(), 0 ) ); + else if ( item->name() == i18n( "Italic" ) ) + item->setValue( QVariant( val.toFont().italic(), 0 ) ); + else if ( item->name() == i18n( "Underline" ) ) + item->setValue( QVariant( val.toFont().underline(), 0 ) ); + else if ( item->name() == i18n( "Strikeout" ) ) + item->setValue( QVariant( val.toFont().strikeOut(), 0 ) ); + } +} + +PropertyFontItem::~PropertyFontItem() +{ + delete (QHBox*)box; +} + +void PropertyFontItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() || !lined->hasFocus() ) { + box->show(); + setFocus( lined ); + } +} + +void PropertyFontItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +void PropertyFontItem::setValue( const QVariant &v ) +{ + if ( value() == v ) + return; + + setText( 1, v.toFont().family() + "-" + QString::number( v.toFont().pointSize() ) ); + lined->setText( v.toFont().family() + "-" + QString::number( v.toFont().pointSize() ) ); + PropertyItem::setValue( v ); +} + +void PropertyFontItem::getFont() +{ + bool ok = FALSE; + QFont f = QFontDialog::getFont( &ok, val.toFont(), listview ); + if ( ok && f != val.toFont() ) { + setValue( f ); + notifyValueChange(); + } +} + +bool PropertyFontItem::hasSubItems() const +{ + return TRUE; +} + +void PropertyFontItem::childValueChanged( PropertyItem *child ) +{ + QFont f = val.toFont(); + if ( child->name() == i18n( "Family" ) ) + f.setFamily( ( (PropertyListItem*)child )->currentItem() ); + else if ( child->name() == i18n( "Point Size" ) ) + f.setPointSize( child->value().toInt() ); + else if ( child->name() == i18n( "Bold" ) ) + f.setBold( child->value().toBool() ); + else if ( child->name() == i18n( "Italic" ) ) + f.setItalic( child->value().toBool() ); + else if ( child->name() == i18n( "Underline" ) ) + f.setUnderline( child->value().toBool() ); + else if ( child->name() == i18n( "Strikeout" ) ) + f.setStrikeOut( child->value().toBool() ); + setValue( f ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyDatabaseItem::PropertyDatabaseItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool wField ) + : PropertyItem( l, after, prop, propName ), withField( wField ) +{ + box = new QHBox( listview->viewport() ); + box->hide(); + lined = new QLineEdit( box ); + button = new QPushButton( "...", box ); + setupStyle( button ); + button->setFixedWidth( 20 ); + box->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + box->setLineWidth( 2 ); + lined->setFrame( FALSE ); + lined->setReadOnly( TRUE ); + box->setFocusProxy( lined ); + box->installEventFilter( listview ); + lined->installEventFilter( listview ); + button->installEventFilter( listview ); +} + +void PropertyDatabaseItem::createChildren() +{ + PropertyItem *i = this; + i = new PropertyListItem( listview, i, this, i18n( "Connection" ), TRUE ); + addChild( i ); + i = new PropertyListItem( listview, i, this, i18n( "Table" ), TRUE ); + addChild( i ); + if ( withField ) { + i = new PropertyListItem( listview, i, this, i18n( "Field" ), TRUE ); + addChild( i ); + } +} + +void PropertyDatabaseItem::initChildren() +{ +#ifndef QT_NO_SQL + PropertyItem *item = 0; + QStringList lst = value().toStringList(); + QString conn, table; + for ( int i = 0; i < childCount(); ++i ) { + item = PropertyItem::child( i ); + if ( item->name() == i18n( "Connection" ) ) { + QStringList cl = listview->propertyEditor()->formWindow()->project()->databaseConnectionList(); + if ( !cl.isEmpty() ) + item->setValue( cl ); + else if ( lst.count() > 0 ) + item->setValue( QStringList( lst[ 0 ] ) ); + else if ( withField ) + item->setValue( QStringList( MetaDataBase::fakeProperty( listview->propertyEditor()->formWindow()->mainContainer(), + "database" ).toStringList()[ 0 ] ) ); + + if ( lst.count() > 0 && !lst[ 0 ].isEmpty() ) + item->setCurrentItem( lst[ 0 ] ); + else if ( !isChanged() && withField ) + item->setCurrentItem( MetaDataBase::fakeProperty( listview->propertyEditor()->formWindow()->mainContainer(), + "database" ).toStringList()[ 0 ] ); + else + item->setCurrentItem( 0 ); + conn = item->currentItem(); + } else if ( item->name() == i18n( "Table" ) ) { + QStringList cl = listview->propertyEditor()->formWindow()->project()->databaseTableList( conn ); + if ( !cl.isEmpty() ) + item->setValue( cl ); + else if ( lst.count() > 1 ) + item->setValue( QStringList( lst[ 1 ] ) ); + else if ( withField ) { + QStringList fakeLst = MetaDataBase::fakeProperty( listview->propertyEditor()->formWindow()->mainContainer(), "database" ).toStringList(); + if ( fakeLst.count() > 1 ) + item->setValue( fakeLst[ 1 ] ); + } + + if ( lst.count() > 1 && !lst[ 1 ].isEmpty() ) + item->setCurrentItem( lst[ 1 ] ); + else if ( !isChanged() && withField ) { + QStringList fakeLst = MetaDataBase::fakeProperty( listview->propertyEditor()->formWindow()->mainContainer(), "database" ).toStringList(); + if ( fakeLst.count() > 1 ) + item->setCurrentItem( fakeLst[ 1 ] ); + else + item->setCurrentItem( 0 ); + } else + item->setCurrentItem( 0 ); + table = item->currentItem(); + } else if ( item->name() == i18n( "Field" ) ) { + QStringList cl = listview->propertyEditor()->formWindow()->project()->databaseFieldList( conn, table ); + if ( !cl.isEmpty() ) + item->setValue( cl ); + else if ( lst.count() > 2 ) + item->setValue( QStringList( lst[ 2 ] ) ); + if ( lst.count() > 2 && !lst[ 2 ].isEmpty() ) + item->setCurrentItem( lst[ 2 ] ); + else + item->setCurrentItem( 0 ); + } + } +#endif +} + +PropertyDatabaseItem::~PropertyDatabaseItem() +{ + delete (QHBox*)box; +} + +void PropertyDatabaseItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() || !lined->hasFocus() ) { + box->show(); + setFocus( lined ); + } +} + +void PropertyDatabaseItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +void PropertyDatabaseItem::setValue( const QVariant &v ) +{ + if ( value() == v ) + return; + + QStringList lst = v.toStringList(); + QString s = lst.join( "." ); + setText( 1, s ); + lined->setText( s ); + PropertyItem::setValue( v ); +} + +bool PropertyDatabaseItem::hasSubItems() const +{ + return TRUE; +} + +void PropertyDatabaseItem::childValueChanged( PropertyItem *c ) +{ +#ifndef QT_NO_SQL + QStringList lst; + lst << ( (PropertyListItem*)PropertyItem::child( 0 ) )->currentItem() + << ( (PropertyListItem*)PropertyItem::child( 1 ) )->currentItem(); + if ( withField ) + lst << ( (PropertyListItem*)PropertyItem::child( 2 ) )->currentItem(); + if ( c == PropertyItem::child( 0 ) ) { // if the connection changed + lst[ 0 ] = ( (PropertyListItem*)c )->currentItem(); + PropertyItem::child( 1 )->setValue( listview->propertyEditor()->formWindow()->project()->databaseTableList( lst[ 0 ] ) ); + if ( withField ) + PropertyItem::child( 2 )->setValue( listview->propertyEditor()->formWindow()->project()->databaseFieldList( lst[ 0 ], lst[ 1 ] ) ); + } else if ( withField && c == PropertyItem::child( 1 ) ) { // if the table changed + lst[ 1 ] = ( (PropertyListItem*)c )->currentItem(); + if ( withField ) + PropertyItem::child( 2 )->setValue( listview->propertyEditor()->formWindow()->project()->databaseFieldList( lst[ 0 ], lst[ 1 ] ) ); + } + lst.clear(); + lst << ( (PropertyListItem*)PropertyItem::child( 0 ) )->currentItem() + << ( (PropertyListItem*)PropertyItem::child( 1 ) )->currentItem(); + if ( withField ) + lst << ( (PropertyListItem*)PropertyItem::child( 2 ) )->currentItem(); + setValue( lst ); + notifyValueChange(); +#else + Q_UNUSED( c ); +#endif +} + +// -------------------------------------------------------------- + +PropertySizePolicyItem::PropertySizePolicyItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + lin = 0; +} + +QLineEdit *PropertySizePolicyItem::lined() +{ + if ( lin ) + return lin; + lin = new QLineEdit( listview->viewport() ); + lin->hide(); + lin->setReadOnly( TRUE ); + return lin; +} + +void PropertySizePolicyItem::createChildren() +{ + QStringList lst; + lst << "Fixed" << "Minimum" << "Maximum" << "Preferred" << "MinimumExpanding" << "Expanding" << "Ignored"; + + PropertyItem *i = this; + i = new PropertyListItem( listview, i, this, i18n( "hSizeType" ), FALSE ); + i->setValue( lst ); + addChild( i ); + i = new PropertyListItem( listview, i, this, i18n( "vSizeType" ), FALSE ); + i->setValue( lst ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "horizontalStretch" ), TRUE ); + addChild( i ); + i = new PropertyIntItem( listview, i, this, i18n( "verticalStretch" ), TRUE ); + addChild( i ); +} + +void PropertySizePolicyItem::initChildren() +{ + PropertyItem *item = 0; + QSizePolicy sp = val.toSizePolicy(); + for ( int i = 0; i < childCount(); ++i ) { + item = PropertyItem::child( i ); + if ( item->name() == i18n( "hSizeType" ) ) + ( (PropertyListItem*)item )->setCurrentItem( size_type_to_int( sp.horData() ) ); + else if ( item->name() == i18n( "vSizeType" ) ) + ( (PropertyListItem*)item )->setCurrentItem( size_type_to_int( sp.verData() ) ); + else if ( item->name() == i18n( "horizontalStretch" ) ) + ( (PropertyIntItem*)item )->setValue( sp.horStretch() ); + else if ( item->name() == i18n( "verticalStretch" ) ) + ( (PropertyIntItem*)item )->setValue( sp.verStretch() ); + } +} + +PropertySizePolicyItem::~PropertySizePolicyItem() +{ + delete (QLineEdit*)lin; +} + +void PropertySizePolicyItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( lined() ); + if ( !lined()->isVisible() || !lined()->hasFocus() ) { + lined()->show(); + listView()->viewport()->setFocus(); + } +} + +void PropertySizePolicyItem::hideEditor() +{ + PropertyItem::hideEditor(); + lined()->hide(); +} + +void PropertySizePolicyItem::setValue( const QVariant &v ) +{ + if ( value() == v ) + return; + + QString s = i18n( "%1/%2/%3/%4" ); + s = s.arg( size_type_to_string( v.toSizePolicy().horData() ) ). + arg( size_type_to_string( v.toSizePolicy().verData() ) ). + arg( v.toSizePolicy().horStretch() ). + arg( v.toSizePolicy().verStretch() ); + setText( 1, s ); + lined()->setText( s ); + PropertyItem::setValue( v ); +} + +void PropertySizePolicyItem::childValueChanged( PropertyItem *child ) +{ + QSizePolicy sp = val.toSizePolicy(); + if ( child->name() == i18n( "hSizeType" ) ) + sp.setHorData( int_to_size_type( ( ( PropertyListItem*)child )->currentIntItem() ) ); + else if ( child->name() == i18n( "vSizeType" ) ) + sp.setVerData( int_to_size_type( ( ( PropertyListItem*)child )->currentIntItem() ) ); + else if ( child->name() == i18n( "horizontalStretch" ) ) + sp.setHorStretch( ( ( PropertyIntItem*)child )->value().toInt() ); + else if ( child->name() == i18n( "verticalStretch" ) ) + sp.setVerStretch( ( ( PropertyIntItem*)child )->value().toInt() ); + setValue( sp ); + notifyValueChange(); +} + +bool PropertySizePolicyItem::hasSubItems() const +{ + return TRUE; +} + +// -------------------------------------------------------------- + +PropertyPaletteItem::PropertyPaletteItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + box = new QHBox( listview->viewport() ); + box->hide(); + palettePrev = new QLabel( box ); + button = new QPushButton( "...", box ); + setupStyle( button ); + button->setFixedWidth( 20 ); + box->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + box->setLineWidth( 2 ); + palettePrev->setFrameStyle( QFrame::NoFrame ); + box->installEventFilter( listview ); + connect( button, SIGNAL( clicked() ), + this, SLOT( getPalette() ) ); +} +PropertyPaletteItem::~PropertyPaletteItem() +{ + delete (QHBox*)box; +} + +void PropertyPaletteItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() ) { + box->show(); + listView()->viewport()->setFocus(); + } +} + +void PropertyPaletteItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +void PropertyPaletteItem::setValue( const QVariant &v ) +{ + QString s; + palettePrev->setPalette( v.toPalette() ); + PropertyItem::setValue( v ); + repaint(); +} + +void PropertyPaletteItem::getPalette() +{ + if ( !listview->propertyEditor()->widget()->isWidgetType() ) + return; + bool ok = FALSE; + QWidget *w = (QWidget*)listview->propertyEditor()->widget(); + if ( ::qt_cast(w) ) + w = ( (QScrollView*)w )->viewport(); + QPalette pal = PaletteEditor::getPalette( &ok, val.toPalette(), +#if defined(QT_NON_COMMERCIAL) + w->backgroundMode(), listview->topLevelWidget(), +#else + w->backgroundMode(), listview, +#endif + "choose_palette", listview->propertyEditor()->formWindow() ); + if ( !ok ) + return; + setValue( pal ); + notifyValueChange(); +} + +bool PropertyPaletteItem::hasCustomContents() const +{ + return TRUE; +} + +void PropertyPaletteItem::drawCustomContents( QPainter *p, const QRect &r ) +{ + QPalette pal( value().toPalette() ); + p->save(); + p->setClipRect( QRect( QPoint( (int)(p->worldMatrix().dx() + r.x()), + (int)(p->worldMatrix().dy() + r.y()) ), + r.size() ) ); + QRect r2( r ); + r2.setX( r2.x() + 2 ); + r2.setY( r2.y() + 2 ); + r2.setWidth( r2.width() - 3 ); + r2.setHeight( r2.height() - 3 ); + p->setPen( QPen( black, 1 ) ); + p->setBrush( pal.active().background() ); + p->drawRect( r2 ); + p->restore(); +} + +// -------------------------------------------------------------- + +PropertyCursorItem::PropertyCursorItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + comb = 0; +} + +QComboBox *PropertyCursorItem::combo() +{ + if ( comb ) + return comb; + comb = new QComboBox( FALSE, listview->viewport() ); + comb->hide(); + QBitmap cur; + + const QPixmap ArrowPix = SmallIcon( "designer_arrow.png" , KDevDesignerPartFactory::instance()); + const QPixmap UpArrowPix = SmallIcon( "designer_uparrow.png" , KDevDesignerPartFactory::instance()); + const QPixmap CrossPix = SmallIcon( "designer_cross.png" , KDevDesignerPartFactory::instance()); + const QPixmap WaitPix = SmallIcon( "designer_wait.png" , KDevDesignerPartFactory::instance()); + const QPixmap IBeamPix = SmallIcon( "designer_ibeam.png" , KDevDesignerPartFactory::instance()); + const QPixmap SizeVPix = SmallIcon( "designer_sizev.png" , KDevDesignerPartFactory::instance()); + const QPixmap SizeHPix = SmallIcon( "designer_sizeh.png" , KDevDesignerPartFactory::instance()); + const QPixmap SizeFPix = SmallIcon( "designer_sizef.png" , KDevDesignerPartFactory::instance()); + const QPixmap SizeBPix = SmallIcon( "designer_sizeb.png" , KDevDesignerPartFactory::instance()); + const QPixmap SizeAllPix = SmallIcon( "designer_sizeall.png" , KDevDesignerPartFactory::instance()); + const QPixmap VSplitPix = SmallIcon( "designer_vsplit.png" , KDevDesignerPartFactory::instance()); + const QPixmap HSplitPix = SmallIcon( "designer_hsplit.png" , KDevDesignerPartFactory::instance()); + const QPixmap HandPix = SmallIcon( "designer_hand.png" , KDevDesignerPartFactory::instance()); + const QPixmap NoPix = SmallIcon( "designer_no.png" , KDevDesignerPartFactory::instance()); + + comb->insertItem( ArrowPix, i18n("Arrow"), QObject::ArrowCursor); + comb->insertItem( UpArrowPix, i18n("Up-Arrow"), QObject::UpArrowCursor ); + comb->insertItem( CrossPix, i18n("Cross"), QObject::CrossCursor ); + comb->insertItem( WaitPix, i18n("Waiting"), QObject::WaitCursor ); + comb->insertItem( IBeamPix, i18n("iBeam"), QObject::IbeamCursor ); + comb->insertItem( SizeVPix, i18n("Size Vertical"), QObject::SizeVerCursor ); + comb->insertItem( SizeHPix, i18n("Size Horizontal"), QObject::SizeHorCursor ); + comb->insertItem( SizeFPix, i18n("Size Slash"), QObject::SizeBDiagCursor ); + comb->insertItem( SizeBPix, i18n("Size Backslash"), QObject::SizeFDiagCursor ); + comb->insertItem( SizeAllPix, i18n("Size All"), QObject::SizeAllCursor ); + cur = QBitmap( 25, 25, 1 ); + cur.setMask( cur ); + comb->insertItem( cur, i18n("Blank"), QObject::BlankCursor ); + comb->insertItem( VSplitPix, i18n("Split Vertical"), QObject::SplitVCursor ); + comb->insertItem( HSplitPix, i18n("Split Horizontal"), QObject::SplitHCursor ); + comb->insertItem( HandPix, i18n("Pointing Hand"), QObject::PointingHandCursor ); + comb->insertItem( NoPix, i18n("Forbidden"), QObject::ForbiddenCursor ); + + connect( comb, SIGNAL( activated( int ) ), + this, SLOT( setValue() ) ); + comb->installEventFilter( listview ); + return comb; +} + +PropertyCursorItem::~PropertyCursorItem() +{ + delete (QComboBox*)comb; +} + +void PropertyCursorItem::showEditor() +{ + PropertyItem::showEditor(); + if ( !comb ) { + combo()->blockSignals( TRUE ); + combo()->setCurrentItem( (int)value().toCursor().shape() ); + combo()->blockSignals( FALSE ); + } + placeEditor( combo() ); + if ( !combo()->isVisible() || !combo()->hasFocus() ) { + combo()->show(); + setFocus( combo() ); + } +} + +void PropertyCursorItem::hideEditor() +{ + PropertyItem::hideEditor(); + combo()->hide(); +} + +void PropertyCursorItem::setValue( const QVariant &v ) +{ + if ( ( !hasSubItems() || !isOpen() ) + && value() == v ) + return; + + combo()->blockSignals( TRUE ); + combo()->setCurrentItem( (int)v.toCursor().shape() ); + combo()->blockSignals( FALSE ); + setText( 1, combo()->currentText() ); + PropertyItem::setValue( v ); +} + +void PropertyCursorItem::setValue() +{ + if ( !comb ) + return; + if ( QVariant( QCursor( combo()->currentItem() ) ) == val ) + return; + setText( 1, combo()->currentText() ); + PropertyItem::setValue( QCursor( combo()->currentItem() ) ); + notifyValueChange(); +} + +// -------------------------------------------------------------- + +PropertyKeysequenceItem::PropertyKeysequenceItem( PropertyList *l, + PropertyItem *after, + PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ), + k1( 0 ), k2( 0 ), k3( 0 ), k4( 0 ), num( 0 ), mouseEnter( FALSE ) +{ + box = new QHBox( listview->viewport() ); + box->hide(); + sequence = new QLineEdit( box ); + connect( sequence, SIGNAL(textChanged( const QString & )), + this, SLOT(setValue()) ); + sequence->installEventFilter( this ); +} + +PropertyKeysequenceItem::~PropertyKeysequenceItem() +{ + delete (QHBox*)box; +} + +void PropertyKeysequenceItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() ) { + box->show(); + sequence->setFocus(); + } +} + +void PropertyKeysequenceItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +bool PropertyKeysequenceItem::eventFilter( QObject *o, QEvent *e ) +{ + Q_UNUSED( o ); + if ( e->type() == QEvent::KeyPress ) { + QKeyEvent *k = (QKeyEvent *)e; + if ( !mouseEnter && + (k->key() == QObject::Key_Up || + k->key() == QObject::Key_Down) ) + return FALSE; + handleKeyEvent( k ); + return TRUE; + } else if ( (e->type() == QEvent::FocusIn) || + (e->type() == QEvent::MouseButtonPress) ) { + mouseEnter = ( listview->lastEvent() == PropertyList::MouseEvent ) || + (e->type() == QEvent::MouseButtonPress); + return TRUE; + } + + // Lets eat accelerators now.. + if ( e->type() == QEvent::Accel || + e->type() == QEvent::AccelOverride || + e->type() == QEvent::KeyRelease ) + return TRUE; + return FALSE; +} + +void PropertyKeysequenceItem::handleKeyEvent( QKeyEvent *e ) +{ + int nextKey = e->key(); + + if ( num > 3 || + nextKey == QObject::Key_Control || + nextKey == QObject::Key_Shift || + nextKey == QObject::Key_Meta || + nextKey == QObject::Key_Alt ) + return; + + nextKey |= translateModifiers( e->state() ); + switch( num ) { + case 0: + k1 = nextKey; + break; + case 1: + k2 = nextKey; + break; + case 2: + k3 = nextKey; + break; + case 3: + k4 = nextKey; + break; + default: + break; + } + num++; + QKeySequence ks( k1, k2, k3, k4 ); + sequence->setText( ks ); +} + +int PropertyKeysequenceItem::translateModifiers( int state ) +{ + int result = 0; + if ( state & QObject::ShiftButton ) + result |= QObject::SHIFT; + if ( state & QObject::ControlButton ) + result |= QObject::CTRL; + if ( state & QObject::MetaButton ) + result |= QObject::META; + if ( state & QObject::AltButton ) + result |= QObject::ALT; + return result; +} + +void PropertyKeysequenceItem::setValue() +{ + QVariant v; + v = QVariant( QKeySequence(sequence->text()) ); + if ( v.toString().isNull() ) + return; + setText( 1, sequence->text() ); + PropertyItem::setValue( v ); + if ( sequence->hasFocus() ) + notifyValueChange(); + setChanged( TRUE ); +} + +void PropertyKeysequenceItem::setValue( const QVariant &v ) +{ + QKeySequence ks = v.toKeySequence(); + if ( sequence ) { + sequence->setText( ks ); + } + num = ks.count(); + k1 = ks[0]; + k2 = ks[1]; + k3 = ks[2]; + k4 = ks[3]; + setText( 1, ks ); + PropertyItem::setValue( v ); +} + +// -------------------------------------------------------------- + +EnumPopup::EnumPopup( QWidget *parent, const char *name, WFlags f ) + : QFrame( parent, name, f ) +{ + setLineWidth( 1 ); + setFrameStyle( Panel | Plain ); + setPaletteBackgroundColor( Qt::white ); + popLayout = new QVBoxLayout( this, 3 ); + checkBoxList.setAutoDelete( TRUE ); +} + +EnumPopup::~EnumPopup() +{ +} + +void EnumPopup::insertEnums( QValueList lst ) +{ + while ( checkBoxList.count() ) + checkBoxList.removeFirst(); + + itemList = lst; + QCheckBox *cb; + QValueListConstIterator it = itemList.begin(); + for ( ; it != itemList.end(); ++it ) { + cb = new QCheckBox( this ); + cb->setText( (*it).key ); + cb->setChecked( (*it).selected ); + if ( it == itemList.begin() ) + cb->setFocus(); + checkBoxList.append( cb ); + cb->resize( width(), cb->height() ); + popLayout->addWidget( cb ); + } +} + +void EnumPopup::keyPressEvent( QKeyEvent *e ) +{ + if ( e->key() == Key_Escape ) { + hide(); + emit hidden(); + } else if ( e->key() == Key_Enter || e->key() == Key_Return ) { + closeWidget(); + } +} + +void EnumPopup::closeWidget() +{ + QPtrListIterator it( checkBoxList ); + int i = 0; + while ( it.current() != 0 ) { + itemList[i].selected = (*it)->isChecked(); + ++it; + ++i; + } + close(); + emit closed(); +} + +QValueList EnumPopup::enumList() const +{ + return itemList; +} + +EnumBox::EnumBox( QWidget *parent, const char *name ) + : QComboBox( parent, name ) +{ + pop = new EnumPopup( this, "popup", QObject::WType_Popup ); + connect( pop, SIGNAL( hidden() ), this, SLOT( popupHidden() ) ); + connect( pop, SIGNAL( closed() ), this, SLOT( popupClosed() ) ); + popupShown = FALSE; + arrowDown = FALSE; +} + +void EnumBox::popupHidden() +{ + popupShown = FALSE; +} + +void EnumBox::popupClosed() +{ + popupShown = FALSE; + emit valueChanged(); +} + +void EnumBox::paintEvent( QPaintEvent * ) +{ + QPainter p( this ); + const QColorGroup & g = colorGroup(); + p.setPen(g.text()); + + QStyle::SFlags flags = QStyle::Style_Default; + if (isEnabled()) + flags |= QStyle::Style_Enabled; + if (hasFocus()) + flags |= QStyle::Style_HasFocus; + + if ( width() < 5 || height() < 5 ) { + qDrawShadePanel( &p, rect().x(), rect().y(), rect().width(), rect().height(), g, FALSE, 2, + &g.brush( QColorGroup::Button ) ); + return; + } + style().drawComplexControl( QStyle::CC_ComboBox, &p, this, rect(), g, + flags, QStyle::SC_All, + (arrowDown ? + QStyle::SC_ComboBoxArrow : + QStyle::SC_None )); + + QRect re = style().querySubControlMetrics( QStyle::CC_ComboBox, this, + QStyle::SC_ComboBoxEditField ); + re = QStyle::visualRect(re, this); + p.setClipRect( re ); + + if ( !str.isNull() ) { + p.save(); + p.setFont(font()); + QFontMetrics fm(font()); + int x = re.x(), y = re.y() + fm.ascent(); + p.drawText( x, y, str ); + p.restore(); + } +} + +void EnumBox::insertEnums( QValueList lst ) +{ + pop->insertEnums( lst ); +} + +QValueList EnumBox::enumList() const +{ + return pop->enumList(); +} + +void EnumBox::popup() +{ + if ( popupShown ) { + pop->closeWidget(); + popupShown = FALSE; + return; + } + pop->move( ((QWidget*)parent())->mapToGlobal( geometry().bottomLeft() ) ); + pop->setMinimumWidth( width() ); + emit aboutToShowPopup(); + pop->show(); + popupShown = TRUE; +} + +void EnumBox::mousePressEvent( QMouseEvent *e ) +{ + if ( e->button() != LeftButton ) + return; + + QRect arrowRect = style().querySubControlMetrics( QStyle::CC_ComboBox, this, + QStyle::SC_ComboBoxArrow); + arrowRect = QStyle::visualRect(arrowRect, this); + + arrowRect.setHeight( QMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); + + if ( arrowRect.contains( e->pos() ) ) { + arrowDown = TRUE; + repaint( FALSE ); + } + + popup(); + QTimer::singleShot( 100, this, SLOT( restoreArrow() ) ); +} + +void EnumBox::keyPressEvent( QKeyEvent *e ) +{ + if ( e->key() == Key_Space ) { + popup(); + QTimer::singleShot( 100, this, SLOT( restoreArrow() ) ); + } else if ( e->key() == Key_Enter || e->key() == Key_Return ) { + popup(); + } +} + +void EnumBox::restoreArrow() +{ + arrowDown = FALSE; + repaint( FALSE ); +} + +void EnumBox::setText( const QString &text ) +{ + str = text; + repaint( FALSE ); +} + + + +PropertyEnumItem::PropertyEnumItem( PropertyList *l, + PropertyItem *after, + PropertyItem *prop, + const QString &propName ) + : PropertyItem( l, after, prop, propName ) +{ + box = new EnumBox( listview->viewport() ); + box->hide(); + box->installEventFilter( listview ); + connect( box, SIGNAL( aboutToShowPopup() ), this, SLOT( insertEnums() ) ); + connect( box, SIGNAL( valueChanged() ), this, SLOT( setValue() ) ); +} + +PropertyEnumItem::~PropertyEnumItem() +{ + delete (EnumBox*)box; +} + +void PropertyEnumItem::showEditor() +{ + PropertyItem::showEditor(); + placeEditor( box ); + if ( !box->isVisible() ) { + box->show(); + box->setText( enumString ); + listView()->viewport()->setFocus(); + } + box->setFocus(); +} + +void PropertyEnumItem::hideEditor() +{ + PropertyItem::hideEditor(); + box->hide(); +} + +void PropertyEnumItem::setValue( const QVariant &v ) +{ + enumString = ""; + enumList.clear(); + QStringList lst = v.toStringList(); + QValueListConstIterator it = lst.begin(); + for ( ; it != lst.end(); ++it ) + enumList.append( EnumItem( *it, FALSE ) ); + enumList.first().selected = TRUE; + enumString = enumList.first().key; + box->setText( enumString ); + setText( 1, enumString ); + PropertyItem::setValue( v ); +} + +void PropertyEnumItem::insertEnums() +{ + box->insertEnums( enumList ); +} + +void PropertyEnumItem::setValue() +{ + enumList = box->enumList(); + enumString = ""; + QValueListConstIterator it = enumList.begin(); + for ( ; it != enumList.end(); ++it ) { + if ( (*it).selected ) + enumString += "|" + (*it).key; + } + if ( !enumString.isEmpty() ) + enumString.replace( 0, 1, "" ); + + box->setText( enumString ); + setText( 1, enumString ); + notifyValueChange(); +} + +void PropertyEnumItem::setCurrentValues( QStrList lst ) +{ + enumString =""; + QStrList::ConstIterator it = lst.begin(); + QValueList::Iterator eit = enumList.begin(); + for ( ; eit != enumList.end(); ++eit ) { + (*eit).selected = FALSE; + for ( it = lst.begin(); it != lst.end(); ++it ) { + if ( QString( *it ) == (*eit).key ) { + (*eit).selected = TRUE; + enumString += "|" + (*eit).key; + break; + } + } + } + if ( !enumString.isEmpty() ) + enumString.replace( 0, 1, "" ); + box->setText( enumString ); + setText( 1, enumString ); +} + +QString PropertyEnumItem::currentItem() const +{ + return enumString; +} + +QString PropertyEnumItem::currentItemFromObject() const +{ + return enumString; +} + +// -------------------------------------------------------------- + +/*! + \class PropertyList propertyeditor.h + \brief PropertyList is a QListView derived class which is used for editing widget properties + + This class is used for widget properties. It has to be child of a + PropertyEditor. + + To initialize it for editing a widget call setupProperties() which + iterates through the properties of the current widget (see + PropertyEditor::widget()) and builds the list. + + To update the item values, refetchData() can be called. + + If the value of an item has been changed by the user, and this + change should be applied to the widget's property, valueChanged() + has to be called. + + To set the value of an item, setPropertyValue() has to be called. +*/ + +PropertyList::PropertyList( PropertyEditor *e ) + : QListView( e ), editor( e ) +{ + init_colors(); + + whatsThis = new PropertyWhatsThis( this ); + showSorted = FALSE; + header()->setMovingEnabled( FALSE ); + header()->setStretchEnabled( TRUE ); + setResizePolicy( QScrollView::Manual ); + viewport()->setAcceptDrops( TRUE ); + viewport()->installEventFilter( this ); + addColumn( i18n( "Property" ) ); + addColumn( i18n( "Value" ) ); + connect( header(), SIGNAL( sizeChange( int, int, int ) ), + this, SLOT( updateEditorSize() ) ); + disconnect( header(), SIGNAL( sectionClicked( int ) ), + this, SLOT( changeSortColumn( int ) ) ); + connect( header(), SIGNAL( sectionClicked( int ) ), + this, SLOT( toggleSort() ) ); + connect( this, SIGNAL( pressed( QListViewItem *, const QPoint &, int ) ), + this, SLOT( itemPressed( QListViewItem *, const QPoint &, int ) ) ); + connect( this, SIGNAL( doubleClicked( QListViewItem * ) ), + this, SLOT( toggleOpen( QListViewItem * ) ) ); + setSorting( -1 ); + setHScrollBarMode( AlwaysOff ); + setVScrollBarMode( AlwaysOn ); + setColumnWidthMode( 1, Manual ); + mousePressed = FALSE; + pressItem = 0; + theLastEvent = MouseEvent; + header()->installEventFilter( this ); +} + +void PropertyList::toggleSort() +{ + showSorted = !showSorted; + editor->clear(); + editor->setup(); +} + +void PropertyList::resizeEvent( QResizeEvent *e ) +{ + QListView::resizeEvent( e ); + if ( currentItem() ) + ( ( PropertyItem* )currentItem() )->showEditor(); +} + +static QVariant::Type type_to_variant( const QString &s ) +{ + if ( s == "Invalid " ) + return QVariant::Invalid; + if ( s == "Map" ) + return QVariant::Map; + if ( s == "List" ) + return QVariant::List; + if ( s == "String" ) + return QVariant::String; + if ( s == "StringList" ) + return QVariant::StringList; + if ( s == "Font" ) + return QVariant::Font; + if ( s == "Pixmap" ) + return QVariant::Pixmap; + if ( s == "Brush" ) + return QVariant::Brush; + if ( s == "Rect" ) + return QVariant::Rect; + if ( s == "Size" ) + return QVariant::Size; + if ( s == "Color" ) + return QVariant::Color; + if ( s == "Palette" ) + return QVariant::Palette; + if ( s == "ColorGroup" ) + return QVariant::ColorGroup; + if ( s == "IconSet" ) + return QVariant::IconSet; + if ( s == "Point" ) + return QVariant::Point; + if ( s == "Image" ) + return QVariant::Image; + if ( s == "Int" ) + return QVariant::Int; + if ( s == "UInt" ) + return QVariant::UInt; + if ( s == "Bool" ) + return QVariant::Bool; + if ( s == "Double" ) + return QVariant::Double; + if ( s == "CString" ) + return QVariant::CString; + if ( s == "PointArray" ) + return QVariant::PointArray; + if ( s == "Region" ) + return QVariant::Region; + if ( s == "Bitmap" ) + return QVariant::Bitmap; + if ( s == "Cursor" ) + return QVariant::Cursor; + if ( s == "SizePolicy" ) + return QVariant::SizePolicy; + if ( s == "Date" ) + return QVariant::Date; + if ( s == "Time" ) + return QVariant::Time; + if ( s == "DateTime" ) + return QVariant::DateTime; + return QVariant::Invalid; +} + +#ifndef QT_NO_SQL +static bool parent_is_data_aware( QWidget *w ) +{ + QWidget *p = w ? w->parentWidget() : 0; + while ( p && !p->isTopLevel() ) { + if ( ::qt_cast(p) || ::qt_cast(p) ) + return TRUE; + p = p->parentWidget(); + } + return FALSE; +} +#endif + +/*! Sets up the property list by adding an item for each designable +property of the widget which is just edited. +*/ + +void PropertyList::setupProperties() +{ + if ( !editor->widget() ) + return; + bool allProperties = !::qt_cast(editor->widget()); + QStrList lst = editor->widget()->metaObject()->propertyNames( allProperties ); + PropertyItem *item = 0; + QMap unique; + QObject *w = editor->widget(); + QStringList valueSet; + bool parentHasLayout = + w->isWidgetType() && + !editor->formWindow()->isMainContainer( (QWidget*)w ) && ( (QWidget*)w )->parentWidget() && + WidgetFactory::layoutType( ( (QWidget*)w )->parentWidget() ) != WidgetFactory::NoLayout; + for ( QPtrListIterator it( lst ); it.current(); ++it ) { + const QMetaProperty* p = + editor->widget()->metaObject()-> + property( editor->widget()->metaObject()->findProperty( it.current(), allProperties), allProperties ); + if ( !p ) + continue; + if ( unique.contains( QString::fromLatin1( it.current() ) ) ) + continue; + if ( ::qt_cast(editor->widget()) || + ::qt_cast(editor->widget()) ) { + if ( qstrcmp( p->name(), "minimumHeight" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "minimumWidth" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumHeight" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumWidth" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "geometry" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "sizePolicy" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "minimumSize" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumSize" ) == 0 ) + continue; + } + unique.insert( QString::fromLatin1( it.current() ), TRUE ); + if ( editor->widget()->isWidgetType() && + editor->formWindow()->isMainContainer( (QWidget*)editor->widget() ) ) { + if ( qstrcmp( p->name(), "geometry" ) == 0 ) + continue; + } else { // hide some toplevel-only stuff + if ( qstrcmp( p->name(), "icon" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "iconText" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "caption" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "sizeIncrement" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "baseSize" ) == 0 ) + continue; + if ( parentHasLayout && qstrcmp( p->name(), "geometry" ) == 0 ) + continue; + if ( ::qt_cast(w) || ::qt_cast(w) ) { + if ( qstrcmp( p->name(), "sizePolicy" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "minimumHeight" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "minimumWidth" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumHeight" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumWidth" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "geometry" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "minimumSize" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumSize" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "enabled" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "paletteForegroundColor" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "paletteBackgroundColor" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "paletteBackgroundPixmap" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "palette" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "font" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "cursor" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "mouseTracking" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "focusPolicy" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "acceptDrops" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "autoMask" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "backgroundOrigin" ) == 0 ) + continue; + } + } + if ( ::qt_cast(w) ) { + if ( qstrcmp( p->name(), "usesDropDown" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "toggleAction" ) == 0 ) + continue; + } + if ( qstrcmp( p->name(), "minimumHeight" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "minimumWidth" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumHeight" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "maximumWidth" ) == 0 ) + continue; + if ( qstrcmp( p->name(), "buttonGroupId" ) == 0 ) { // #### remove this when designable in Q_PROPERTY can take a function (isInButtonGroup() in this case) + if ( !editor->widget()->isWidgetType() || + !editor->widget()->parent() || + !::qt_cast(editor->widget()->parent()) ) + continue; + } + + bool isPropertyObject = w->isA( "PropertyObject" ); + + if ( ( p->designable(w) || + isPropertyObject && p->designable( ( (PropertyObject*)w )->widgetList().first() ) ) && + ( !isPropertyObject || qstrcmp( p->name(), "name" ) != 0 ) ) { + if ( p->isSetType() ) { + if ( QString( p->name() ) == "alignment" ) { + QStringList lst; + lst << p->valueToKey( AlignAuto ) + << p->valueToKey( AlignLeft ) + << p->valueToKey( AlignHCenter ) + << p->valueToKey( AlignRight ) + << p->valueToKey( AlignJustify ); + item = new PropertyListItem( this, item, 0, "hAlign", FALSE ); + item->setValue( lst ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "hAlign" ) ) + item->setChanged( TRUE, FALSE ); + if ( !::qt_cast(editor->widget()) ) { + lst.clear(); + lst << p->valueToKey( AlignTop ) + << p->valueToKey( AlignVCenter ) + << p->valueToKey( AlignBottom ); + item = new PropertyListItem( this, item, 0, "vAlign", FALSE ); + item->setValue( lst ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "vAlign" ) ) + item->setChanged( TRUE, FALSE ); + item = new PropertyBoolItem( this, item, 0, "wordwrap" ); + if ( ::qt_cast(w) ) + item->setVisible( FALSE ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "wordwrap" ) ) + item->setChanged( TRUE, FALSE ); + } + } else { + QStrList lst( p->enumKeys() ); + QStringList l; + QPtrListIterator it( lst ); + while ( it.current() != 0 ) { + l << QString(*it); + ++it; + } + item = new PropertyEnumItem( this, item, 0, p->name() ); + item->setValue( l ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), p->name() ) ) + item->setChanged( TRUE, FALSE ); + } + } else if ( p->isEnumType() ) { + QStrList l = p->enumKeys(); + QStringList lst; + for ( uint i = 0; i < l.count(); ++i ) { + QString k = l.at( i ); + // filter out enum-masks + if ( k[0] == 'M' && k[1].category() == QChar::Letter_Uppercase ) + continue; + lst << k; + } + item = new PropertyListItem( this, item, 0, p->name(), FALSE ); + item->setValue( lst ); + } else { + QVariant::Type t = QVariant::nameToType( p->type() ); + if ( !addPropertyItem( item, p->name(), t ) ) + continue; + } + } + if ( item && !p->isSetType() ) { + if ( valueSet.findIndex( item->name() ) == -1 ) { + setPropertyValue( item ); + valueSet << item->name(); + } + if ( MetaDataBase::isPropertyChanged( editor->widget(), p->name() ) ) + item->setChanged( TRUE, FALSE ); + } + } + + if ( !::qt_cast(w) && !::qt_cast(w) && !::qt_cast(w) && + w->isWidgetType() && WidgetFactory::layoutType( (QWidget*)w ) != WidgetFactory::NoLayout ) { + item = new PropertyLayoutItem( this, item, 0, "layoutSpacing" ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "layoutSpacing" ) + || MetaDataBase::spacing( editor->widget() ) != -1 ) + layoutInitValue( item, TRUE ); + else + layoutInitValue( item ); + item = new PropertyLayoutItem( this, item, 0, "layoutMargin" ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "layoutMargin" ) + || MetaDataBase::margin( editor->widget() ) != -1 ) + layoutInitValue( item, TRUE ); + else + layoutInitValue( item ); + QWidget *widget = (QWidget*)w; + if ( ( !::qt_cast(widget) && + widget->parentWidget() && ::qt_cast(widget->parentWidget()) ) ) { + item = new PropertyListItem( this, item, 0, "resizeMode", FALSE ); + QStringList lst; + lst << "Auto" << "FreeResize" << "Minimum" << "Fixed"; + item->setValue( lst ); + setPropertyValue( item ); + QString resizeMod = MetaDataBase::resizeMode( editor->widget() ); + if ( !resizeMod.isEmpty() && + resizeMod != WidgetFactory::defaultCurrentItem( editor->widget(), "resizeMode" ) ) { + item->setChanged( TRUE, FALSE ); + MetaDataBase::setPropertyChanged( editor->widget(), "resizeMode", TRUE ); + } + } + } + + if ( !::qt_cast(w) && !::qt_cast(w) && + !::qt_cast(w) && !::qt_cast(w) ) { + item = new PropertyTextItem( this, item, 0, "toolTip", TRUE, FALSE ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "toolTip" ) ) + item->setChanged( TRUE, FALSE ); + item = new PropertyTextItem( this, item, 0, "whatsThis", TRUE, TRUE ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "whatsThis" ) ) + item->setChanged( TRUE, FALSE ); + } + +#ifndef QT_NO_SQL + if ( !::qt_cast(editor->widget()) && !::qt_cast(editor->widget()) && + !::qt_cast(editor->widget()) && parent_is_data_aware( ::qt_cast(editor->widget()) ) ) { + item = new PropertyDatabaseItem( this, item, 0, "database", editor->formWindow()->mainContainer() != w ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "database" ) ) + item->setChanged( TRUE, FALSE ); + } + + if ( ::qt_cast(editor->widget()) || ::qt_cast(editor->widget()) || + ::qt_cast(editor->widget()) ) { + item = new PropertyDatabaseItem( this, item, 0, "database", FALSE ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "database" ) ) + item->setChanged( TRUE, FALSE ); + item = new PropertyBoolItem( this, item, 0, "frameworkCode" ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), "frameworkCode" ) ) + item->setChanged( TRUE, FALSE ); + } +#endif + + if ( w->isA("PropertyObject") ) { + const QWidgetList wl = ( (PropertyObject*)w )->widgetList(); + QPtrListIterator wIt( wl ); + while ( *wIt ) { + if ( (*wIt)->inherits("CustomWidget") ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)*wIt )->customWidget(); + setupCusWidgetProperties( cw, unique, item ); + } + ++wIt; + } + } else if ( w->inherits( "CustomWidget" ) ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)w )->customWidget(); + setupCusWidgetProperties( cw, unique, item ); + } + + setCurrentItem( firstChild() ); + + if ( showSorted ) { + setSorting( 0 ); + sort(); + setSorting( -1 ); + setCurrentItem( firstChild() ); + qApp->processEvents(); + } + + updateEditorSize(); +} + +void PropertyList::setupCusWidgetProperties( MetaDataBase::CustomWidget *cw, + QMap &unique, + PropertyItem *&item ) +{ + if ( !cw ) + return; + + for ( QValueList::Iterator it = + cw->lstProperties.begin(); it != cw->lstProperties.end(); ++it ) { + if ( unique.contains( QString( (*it).property ) ) ) + continue; + unique.insert( QString( (*it).property ), TRUE ); + addPropertyItem( item, (*it).property, type_to_variant( (*it).type ) ); + setPropertyValue( item ); + if ( MetaDataBase::isPropertyChanged( editor->widget(), (*it).property ) ) + item->setChanged( TRUE, FALSE ); + } +} + +bool PropertyList::addPropertyItem( PropertyItem *&item, const QCString &name, QVariant::Type t ) +{ + if ( name == "buddy" ) { + PropertyListItem *itm = new PropertyListItem( this, item, 0, name, TRUE ); + QPtrDict *widgets = editor->formWindow()->widgets(); + QPtrDictIterator it( *widgets ); + QStringList l; + l << ""; + while ( it.current() ) { + if ( editor->formWindow()->canBeBuddy( it.current() ) ) { + if ( l.find( it.current()->name() ) == l.end() ) + l << it.current()->name(); + } + ++it; + } + l.sort(); + itm->setValue( l ); + item = itm; + return TRUE; + } + + switch ( t ) { + case QVariant::String: + item = new PropertyTextItem( this, item, 0, name, TRUE, + ::qt_cast(editor->widget()) || + ::qt_cast(editor->widget()) || + ::qt_cast(editor->widget()) ); + break; + case QVariant::CString: + item = new PropertyTextItem( this, item, 0, + name, name == "name" && + editor->widget() == editor->formWindow()->mainContainer(), + FALSE, TRUE ); + break; + case QVariant::Bool: + item = new PropertyBoolItem( this, item, 0, name ); + break; + case QVariant::Font: + item = new PropertyFontItem( this, item, 0, name ); + break; + case QVariant::Int: + if ( name == "accel" ) + item = new PropertyTextItem( this, item, 0, name, FALSE, FALSE, FALSE, TRUE ); + else if ( name == "layoutSpacing" || name == "layoutMargin" ) + item = new PropertyLayoutItem( this, item, 0, name ); + else if ( name == "resizeMode" ) + item = new PropertyListItem( this, item, 0, name, TRUE ); + else + item = new PropertyIntItem( this, item, 0, name, TRUE ); + break; + case QVariant::Double: + item = new PropertyDoubleItem( this, item, 0, name ); + break; + case QVariant::KeySequence: + item = new PropertyKeysequenceItem( this, item, 0, name ); + break; + case QVariant::UInt: + item = new PropertyIntItem( this, item, 0, name, FALSE ); + break; + case QVariant::StringList: + item = new PropertyListItem( this, item, 0, name, TRUE ); + break; + case QVariant::Rect: + item = new PropertyCoordItem( this, item, 0, name, PropertyCoordItem::Rect ); + break; + case QVariant::Point: + item = new PropertyCoordItem( this, item, 0, name, PropertyCoordItem::Point ); + break; + case QVariant::Size: + item = new PropertyCoordItem( this, item, 0, name, PropertyCoordItem::Size ); + break; + case QVariant::Color: + item = new PropertyColorItem( this, item, 0, name, TRUE ); + break; + case QVariant::Pixmap: + item = new PropertyPixmapItem( this, item, 0, name, PropertyPixmapItem::Pixmap ); + break; + case QVariant::IconSet: + item = new PropertyPixmapItem( this, item, 0, name, PropertyPixmapItem::IconSet ); + break; + case QVariant::Image: + item = new PropertyPixmapItem( this, item, 0, name, PropertyPixmapItem::Image ); + break; + case QVariant::SizePolicy: + item = new PropertySizePolicyItem( this, item, 0, name ); + break; + case QVariant::Palette: + item = new PropertyPaletteItem( this, item, 0, name ); + break; + case QVariant::Cursor: + item = new PropertyCursorItem( this, item, 0, name ); + break; + case QVariant::Date: + item = new PropertyDateItem( this, item, 0, name ); + break; + case QVariant::Time: + item = new PropertyTimeItem( this, item, 0, name ); + break; + case QVariant::DateTime: + item = new PropertyDateTimeItem( this, item, 0, name ); + break; + default: + return FALSE; + } + return TRUE; +} + +void PropertyList::paintEmptyArea( QPainter *p, const QRect &r ) +{ + p->fillRect( r, *backColor2 ); +} + +void PropertyList::setCurrentItem( QListViewItem *i ) +{ + if ( !i ) + return; + + if ( currentItem() ) + ( (PropertyItem*)currentItem() )->hideEditor(); + QListView::setCurrentItem( i ); + ( (PropertyItem*)currentItem() )->showEditor(); +} + +void PropertyList::updateEditorSize() +{ + if ( currentItem() ) + ( ( PropertyItem* )currentItem() )->showEditor(); +} + +/*! This has to be called if the value if \a i should be set as + property to the currently edited widget. +*/ + +void PropertyList::valueChanged( PropertyItem *i ) +{ + if ( !editor->widget() ) + return; + QString pn( i18n( "Set '%1' of '%2'" ).arg( i->name() ).arg( editor->widget()->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, editor->formWindow(), + editor->widget(), editor, + i->name(), WidgetFactory::property( editor->widget(), i->name() ), + i->value(), i->currentItem(), i->currentItemFromObject() ); + + cmd->execute(); + editor->formWindow()->commandHistory()->addCommand( cmd, TRUE ); +} + +void PropertyList::layoutInitValue( PropertyItem *i, bool changed ) +{ + if ( !editor->widget() ) + return; + QString pn( i18n( "Set '%1' of '%2'" ).arg( i->name() ).arg( editor->widget()->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, editor->formWindow(), + editor->widget(), editor, + i->name(), WidgetFactory::property( editor->widget(), i->name() ), + i->value(), i->currentItem(), i->currentItemFromObject() ); + cmd->execute(); + if ( i->value().toString() != "-1" ) + changed = TRUE; + i->setChanged( changed ); +} + +void PropertyList::itemPressed( QListViewItem *i, const QPoint &p, int c ) +{ + if ( !i ) + return; + PropertyItem *pi = (PropertyItem*)i; + if ( !pi->hasSubItems() ) + return; + + if ( c == 0 && viewport()->mapFromGlobal( p ).x() < 20 ) + toggleOpen( i ); +} + +void PropertyList::toggleOpen( QListViewItem *i ) +{ + if ( !i ) + return; + PropertyItem *pi = (PropertyItem*)i; + if ( pi->hasSubItems() ) { + pi->setOpen( !pi->isOpen() ); + } else { + pi->toggle(); + } +} + +bool PropertyList::eventFilter( QObject *o, QEvent *e ) +{ + if ( !o || !e ) + return TRUE; + + PropertyItem *i = (PropertyItem*)currentItem(); + if ( e->type() == QEvent::KeyPress ) + theLastEvent = KeyEvent; + else if ( e->type() == QEvent::MouseButtonPress ) + theLastEvent = MouseEvent; + + if ( o != this &&e->type() == QEvent::KeyPress ) { + QKeyEvent *ke = (QKeyEvent*)e; + if ( ( ke->key() == Key_Up || ke->key() == Key_Down ) && + ( o != this || o != viewport() ) && + !( ke->state() & ControlButton ) ) { + QApplication::sendEvent( this, (QKeyEvent*)e ); + return TRUE; + } else if ( ( !::qt_cast(o) || + ( ::qt_cast(o) && ( (QLineEdit*)o )->isReadOnly() ) ) && + i && i->hasSubItems() ) { + if ( !i->isOpen() && + ( ke->key() == Key_Plus || + ke->key() == Key_Right )) + i->setOpen( TRUE ); + else if ( i->isOpen() && + ( ke->key() == Key_Minus || + ke->key() == Key_Left ) ) + i->setOpen( FALSE ); + } else if ( ( ke->key() == Key_Return || ke->key() == Key_Enter ) && ::qt_cast(o) ) { + QKeyEvent ke2( QEvent::KeyPress, Key_Space, 0, 0 ); + QApplication::sendEvent( o, &ke2 ); + return TRUE; + } + } else if ( e->type() == QEvent::FocusOut && ::qt_cast(o) && editor->formWindow() ) { + QTimer::singleShot( 100, editor->formWindow()->commandHistory(), SLOT( checkCompressedCommand() ) ); + } else if ( o == viewport() ) { + QMouseEvent *me; + PropertyListItem* i; + switch ( e->type() ) { + case QEvent::MouseButtonPress: + me = (QMouseEvent*)e; + i = (PropertyListItem*) itemAt( me->pos() ); + if ( i && ( ::qt_cast(i) || ::qt_cast(i) ) ) { + pressItem = i; + pressPos = me->pos(); + mousePressed = TRUE; + } + break; + case QEvent::MouseMove: + me = (QMouseEvent*)e; + if ( me && me->state() & LeftButton && mousePressed) { + + i = (PropertyListItem*) itemAt( me->pos() ); + if ( i && i == pressItem ) { + + if (( pressPos - me->pos() ).manhattanLength() > QApplication::startDragDistance() ){ + if ( ::qt_cast(i) ) { + QColor col = i->value().asColor(); + QColorDrag *drg = new QColorDrag( col, this ); + QPixmap pix( 25, 25 ); + pix.fill( col ); + QPainter p( &pix ); + p.drawRect( 0, 0, pix.width(), pix.height() ); + p.end(); + drg->setPixmap( pix ); + mousePressed = FALSE; + drg->dragCopy(); + } + else if ( ::qt_cast(i) ) { + QPixmap pix = i->value().asPixmap(); + if( !pix.isNull() ) { + QImage img = pix.convertToImage(); + QImageDrag *drg = new QImageDrag( img, this ); + drg->setPixmap( pix ); + mousePressed = FALSE; + drg->dragCopy(); + } + } + } + } + } + break; + default: + break; + } + } else if ( o == header() ) { + if ( e->type() == QEvent::ContextMenu ) { + ((QContextMenuEvent *)e)->accept(); + QPopupMenu menu( 0 ); + menu.setCheckable( TRUE ); + const int cat_id = 1; + const int alpha_id = 2; + menu.insertItem( i18n( "Sort &Categorized" ), cat_id ); + int alpha = menu.insertItem( i18n( "Sort &Alphabetically" ), alpha_id ); + if ( showSorted ) + menu.setItemChecked( alpha_id, TRUE ); + else + menu.setItemChecked( cat_id, TRUE ); + int res = menu.exec( ( (QContextMenuEvent*)e )->globalPos() ); + if ( res != -1 ) { + bool newShowSorted = ( res == alpha ); + if ( showSorted != newShowSorted ) { + showSorted = newShowSorted; + editor->clear(); + editor->setup(); + } + } + return TRUE; + } + } + + return QListView::eventFilter( o, e ); +} + +/*! This method re-initializes each item of the property list. +*/ + +void PropertyList::refetchData() +{ + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) { + PropertyItem *i = (PropertyItem*)it.current(); + if ( !i->propertyParent() ) + setPropertyValue( i ); + if ( i->hasSubItems() ) + i->initChildren(); + bool changed = MetaDataBase::isPropertyChanged( editor->widget(), i->name() ); + if ( ( i->name() == "layoutSpacing" || i->name() == "layoutMargin" ) ) { + if ( i->value().toString() != "-1" ) + i->setChanged( TRUE, FALSE ); + else + i->setChanged( FALSE, FALSE ); + } + else if ( changed != i->isChanged() ) + i->setChanged( changed, FALSE ); + } + updateEditorSize(); +} + +static void clearAlignList( QStrList &l ) +{ + if ( l.count() == 1 ) + return; + if ( l.find( "AlignAuto" ) != -1 ) + l.remove( "AlignAuto" ); + if ( l.find( "WordBreak" ) != -1 ) + l.remove( "WordBreak" ); +} + +/*! This method initializes the value of the item \a i to the value + of the corresponding property. +*/ + +void PropertyList::setPropertyValue( PropertyItem *i ) +{ + const QMetaProperty *p = + editor->widget()->metaObject()-> + property( editor->widget()->metaObject()->findProperty( i->name(), TRUE), TRUE ); + if ( !p ) { + if ( i->name() == "hAlign" ) { + int align = editor->widget()->property( "alignment" ).toInt(); + p = editor->widget()->metaObject()-> + property( editor->widget()->metaObject()->findProperty( "alignment", TRUE ), TRUE ); + align &= ~AlignVertical_Mask; + QStrList l = p->valueToKeys( align ); + clearAlignList( l ); + ( (PropertyListItem*)i )->setCurrentItem( l.last() ); + } else if ( i->name() == "vAlign" ) { + int align = editor->widget()->property( "alignment" ).toInt(); + p = editor->widget()->metaObject()-> + property( editor->widget()->metaObject()->findProperty( "alignment", TRUE ), TRUE ); + align &= ~AlignHorizontal_Mask; + ( (PropertyListItem*)i )->setCurrentItem( p->valueToKeys( align ).last() ); + } else if ( i->name() == "wordwrap" ) { + int align = editor->widget()->property( "alignment" ).toInt(); + if ( align & WordBreak ) + i->setValue( QVariant( TRUE, 0 ) ); + else + i->setValue( QVariant( FALSE, 0 ) ); + } else if ( i->name() == "layoutSpacing" ) { + ( (PropertyLayoutItem*)i )->setValue( MetaDataBase::spacing( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ) ) ); + } else if ( i->name() == "layoutMargin" ) { + ( (PropertyLayoutItem*)i )->setValue( MetaDataBase::margin( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ) ) ); + } else if ( i->name() == "resizeMode" ) { + ( (PropertyListItem*)i )->setCurrentItem( MetaDataBase::resizeMode( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ) ) ); + } else if ( i->name() == "toolTip" || i->name() == "whatsThis" || i->name() == "database" || i->name() == "frameworkCode" ) { + i->setValue( MetaDataBase::fakeProperty( editor->widget(), i->name() ) ); + } else if ( editor->widget()->inherits( "CustomWidget" ) ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)editor->widget() )->customWidget(); + if ( !cw ) + return; + i->setValue( MetaDataBase::fakeProperty( editor->widget(), i->name() ) ); + } + return; + } + if ( p->isSetType() ) + ( (PropertyEnumItem*)i )->setCurrentValues( p->valueToKeys( editor->widget()->property( i->name() ).toInt() ) ); + else if ( p->isEnumType() ) + ( (PropertyListItem*)i )->setCurrentItem( p->valueToKey( editor->widget()->property( i->name() ).toInt() ) ); + else if ( qstrcmp( p->name(), "buddy" ) == 0 ) + ( (PropertyListItem*)i )->setCurrentItem( editor->widget()->property( i->name() ).toString() ); + else + i->setValue( editor->widget()->property( i->name() ) ); +} + +void PropertyList::setCurrentProperty( const QString &n ) +{ + if ( currentItem() && currentItem()->text( 0 ) == n || + currentItem() && ( (PropertyItem*)currentItem() )->propertyParent() && + ( (PropertyItem*)currentItem() )->propertyParent()->text( 0 ) == n ) + return; + + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) { + if ( it.current()->text( 0 ) == n ) { + setCurrentItem( it.current() ); + break; + } + } +} + +PropertyEditor *PropertyList::propertyEditor() const +{ + return editor; +} + +void PropertyList::resetProperty() +{ + if ( !currentItem() ) + return; + PropertyItem *i = (PropertyItem*)currentItem(); + if ( !MetaDataBase::isPropertyChanged( editor->widget(), i->PropertyItem::name() ) ) + return; + QString pn( i18n( "Reset '%1' of '%2'" ).arg( i->name() ).arg( editor->widget()->name() ) ); + SetPropertyCommand *cmd = new SetPropertyCommand( pn, editor->formWindow(), + editor->widget(), editor, + i->name(), i->value(), + WidgetFactory::defaultValue( editor->widget(), i->name() ), + WidgetFactory::defaultCurrentItem( editor->widget(), i->name() ), + i->currentItem(), TRUE ); + cmd->execute(); + editor->formWindow()->commandHistory()->addCommand( cmd, FALSE ); + if ( i->hasSubItems() ) + i->initChildren(); +} + +void PropertyList::viewportDragEnterEvent( QDragEnterEvent *e ) +{ + PropertyListItem *i = (PropertyListItem*) itemAt( e->pos() ); + if( !i ) { + e->ignore(); + return; + } + + if ( ::qt_cast(i) && QColorDrag::canDecode( e ) ) + e->accept(); + else if ( ::qt_cast(i) && QImageDrag::canDecode( e ) ) + e->accept(); + else + e->ignore(); +} + +void PropertyList::viewportDragMoveEvent ( QDragMoveEvent *e ) +{ + PropertyListItem *i = (PropertyListItem*) itemAt( e->pos() ); + if( !i ) { + e->ignore(); + return; + } + + if ( ::qt_cast(i) && QColorDrag::canDecode( e ) ) + e->accept(); + else if ( ::qt_cast(i) && QImageDrag::canDecode( e ) ) + e->accept(); + else + e->ignore(); +} + +void PropertyList::viewportDropEvent ( QDropEvent *e ) +{ + PropertyListItem *i = (PropertyListItem*) itemAt( e->pos() ); + if( !i ) { + e->ignore(); + return; + } + + if ( ::qt_cast(i) && QColorDrag::canDecode( e ) ) { + QColor color; + QColorDrag::decode( e, color ); + i->setValue( QVariant( color ) ); + valueChanged( i ); + e->accept(); + } + else if ( ::qt_cast(i) && QImageDrag::canDecode( e ) ) { + QImage img; + QImageDrag::decode( e, img ); + QPixmap pm; + pm.convertFromImage( img ); + i->setValue( QVariant( pm ) ); + valueChanged( i ); + e->accept(); + } + else + e->ignore(); +} + +QString PropertyList::whatsThisAt( const QPoint &p ) +{ + return whatsThisText( itemAt( p ) ); +} + +void PropertyList::showCurrentWhatsThis() +{ + if ( !currentItem() ) + return; + QPoint p( 0, currentItem()->itemPos() ); + p = viewport()->mapToGlobal( contentsToViewport( p ) ); + QWhatsThis::display( whatsThisText( currentItem() ), p, viewport() ); +} + +QString PropertyList::whatsThisText( QListViewItem *i ) +{ + if ( !i || !editor->widget() ) + return QString::null; + readPropertyDocs(); + if ( ( (PropertyItem*)i )->propertyParent() ) + i = ( (PropertyItem*)i )->propertyParent(); + + const QMetaObject *mo = editor->widget()->metaObject(); + QString prop = ( (PropertyItem*)i )->name(); + while ( mo ) { + QString s; + s = QString( mo->className() ) + "::" + prop; + QMap::Iterator it; + if ( ( it = propertyDocs.find( s ) ) != propertyDocs.end() ) { + return *it; + } + mo = mo->superClass(); + } + + return i18n( "

      QWidget::%1

      There is no documentation available for this property.

      " ).arg( prop ); +} + +void PropertyList::readPropertyDocs() +{ + if ( !propertyDocs.isEmpty() ) + return; + + QString docFile = MainWindow::self->documentationPath() + "/propertydocs"; + QFile f( docFile ); + if ( !f.open( IO_ReadOnly ) ) + return; + QDomDocument doc; + QString errMsg; + int errLine; + if ( !doc.setContent( &f, &errMsg, &errLine ) ) + return; + QDomElement e = doc.firstChild().toElement().firstChild().toElement(); + + for ( ; !e.isNull(); e = e.nextSibling().toElement() ) { + QDomElement n = e.firstChild().toElement(); + QString name; + QString doc; + for ( ; !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "name" ) + name = n.firstChild().toText().data(); + else if ( n.tagName() == "doc" ) + doc = n.firstChild().toText().data(); + } + doc.insert( 0, "

      " + name + "

      " ); + propertyDocs.insert( name, doc ); + } +} + +PropertyList::LastEventType PropertyList::lastEvent() +{ + return theLastEvent; +} +// ------------------------------------------------------------ + +EventList::EventList( QWidget *parent, FormWindow *fw, PropertyEditor *e ) + : HierarchyList( parent, fw, TRUE ), editor( e ) +{ + header()->hide(); + removeColumn( 1 ); + setRootIsDecorated( TRUE ); + connect( this, SIGNAL( itemRenamed( QListViewItem *, int, const QString & ) ), + this, SLOT( renamed( QListViewItem * ) ) ); +} + +QString clean_arguments( const QString &s ) +{ + QString slot = s; + QString arg = slot.mid( slot.find( '(' ) + 1 ); + arg = arg.left( arg.findRev( ')' ) ); + QStringList args = QStringList::split( ',', arg ); + slot = slot.left( slot.find( '(' ) + 1 ); + int num = 0; + for ( QStringList::Iterator it = args.begin(); it != args.end(); ++it, ++num ) { + QString a = *it; + int i; + if ( ( i =a.find( ':' ) ) == -1 ) + slot += a.simplifyWhiteSpace(); + else + slot += a.mid( i + 1 ).simplifyWhiteSpace(); + if ( num < (int)args.count() - 1 ) + slot += ","; + } + + slot += ")"; + + return slot; +} + + +void EventList::setup() +{ + clear(); + + if ( !formWindow ) + return; + LanguageInterface *iface = MetaDataBase::languageInterface( formWindow->project()->language() ); + const QPixmap DesignerEditSlotsPix = SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()); + QStrList sigs; + if ( iface ) + { + sigs = iface->signalNames( editor->widget() ); + } + QStrListIterator it( sigs ); + while ( it.current() ) { + HierarchyItem *eventItem = new HierarchyItem( HierarchyItem::Event, this, (HierarchyItem*)0, + it.current(), QString::null, QString::null ); + eventItem->setOpen( TRUE ); + QValueList conns = + MetaDataBase::connections( formWindow, editor->widget(), formWindow->mainContainer() ); + HierarchyItem *item = 0; + for ( QValueList::Iterator cit = conns.begin(); + cit != conns.end(); ++cit ) { + QString s = it.current(); + if ( MetaDataBase::normalizeFunction( clean_arguments( QString( (*cit).signal ) ) ) != + MetaDataBase::normalizeFunction( clean_arguments( s ) ) ) + continue; + item = new HierarchyItem( HierarchyItem::EventFunction, eventItem, item, + (*cit).slot, QString::null, QString::null ); + item->setPixmap( 0, DesignerEditSlotsPix ); + } + ++it; + } +} + +extern QListViewItem *newItem; + +void EventList::contentsMouseDoubleClickEvent( QMouseEvent *e ) +{ + QListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); + if ( !i || i->parent() ) + return; + QString s; + if ( !formWindow->project()->isCpp() ) { + QString s1 = i->text( 0 ); + int pt = s1.find( "(" ); + if ( pt != -1 ) + s1 = s1.left( pt ); + s = QString( editor->widget()->name() ) + "_" + s1; + } else { + s = QString( editor->widget()->name() ) + "_" + i->text( 0 ); + } + + const QPixmap DesignerEditSlotsPix = SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()); + insertEntry( i, DesignerEditSlotsPix , s ); +} + +void EventList::setCurrent( QWidget * ) +{ +} + +void EventList::objectClicked( QListViewItem *i ) +{ + if ( !i || !i->parent() ) + return; +// formWindow->clearSelection(false); + formWindow->mainWindow()->part()->emitEditFunction(formWindow->fileName(), i->text( 0 )); +// formWindow->mainWindow()->editFunction( i->text( 0 ) ); +} + +void EventList::showRMBMenu( QListViewItem *i, const QPoint &pos ) +{ + if ( !i ) + return; + QPopupMenu menu; + const int NEW_ITEM = 1; + const int DEL_ITEM = 2; + menu.insertItem( SmallIcon( "designer_filenew.png" , KDevDesignerPartFactory::instance()), i18n( "New Signal Handler" ), NEW_ITEM ); + menu.insertItem( SmallIcon( "designer_editcut.png" , KDevDesignerPartFactory::instance()), i18n( "Delete Signal Handler" ), DEL_ITEM ); + int res = menu.exec( pos ); + if ( res == NEW_ITEM ) { + QString s; + if ( !formWindow->project()->isCpp() ) { + QString s1 = ( i->parent() ? i->parent() : i )->text( 0 ); + int pt = s1.find( "(" ); + if ( pt != -1 ) + s1 = s1.left( pt ); + s = QString( editor->widget()->name() ) + "_" + s1; + } else { + s = QString( editor->widget()->name() ) + "_" + ( i->parent() ? i->parent() : i )->text( 0 ); + } + insertEntry( i->parent() ? i->parent() : i, SmallIcon( "designer_editslots.png" , KDevDesignerPartFactory::instance()), s ); + } else if ( res == DEL_ITEM && i->parent() ) { + MetaDataBase::Connection conn; + conn.sender = editor->widget(); + conn.receiver = formWindow->mainContainer(); + conn.signal = i->parent()->text( 0 ); + conn.slot = i->text( 0 ); + delete i; + RemoveConnectionCommand *cmd = new RemoveConnectionCommand( i18n( "Remove Connection" ), + formWindow, + conn ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + editor->formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + } +} + +void EventList::renamed( QListViewItem *i ) +{ + if ( newItem == i ) + newItem = 0; + if ( !i->parent() ) + return; + QListViewItem *itm = i->parent()->firstChild(); + bool del = FALSE; + while ( itm ) { + if ( itm != i && itm->text( 0 ) == i->text( 0 ) ) { + del = TRUE; + break; + } + itm = itm->nextSibling(); + } + i->setRenameEnabled( 0, FALSE ); + if ( del ) { + delete i; + } else { + MetaDataBase::Connection conn; + conn.sender = editor->widget(); + conn.receiver = formWindow->mainContainer(); + conn.signal = i->parent()->text( 0 ); + conn.slot = i->text( 0 ); + AddConnectionCommand *cmd = new AddConnectionCommand( i18n( "Add Connection" ), + formWindow, + conn ); + formWindow->commandHistory()->addCommand( cmd ); + // #### we should look if the specified slot already + // exists and if we can connect to this one + QString funcname = i->text( 0 ).latin1(); + if ( funcname.find( '(' ) == -1 ) { // try to create a signature + QString sig = i->parent()->text( 0 ); + sig = sig.mid( sig.find( '(' ) + 1 ); + sig.remove( (int)sig.length() - 1, 1 ); + LanguageInterface *iface = MetaDataBase::languageInterface( formWindow->project()->language() ); + if ( iface ) + sig = iface->createArguments( sig.simplifyWhiteSpace() ); + funcname += "(" + sig + ")"; + } + + //normally add a function in kdevdesigner + AddFunctionCommand *cmd2 = new AddFunctionCommand( i18n( "Add Function" ), + formWindow, funcname.latin1(), "virtual", + "public", + "slot", formWindow->project()->language(), + "void" ); + +/* MetaDataBase::addFunction( formWindow, funcname.latin1(), "virtual", "public", + "slot", formWindow->project()->language(), "void" ); + editor->formWindow()->mainWindow()-> + editFunction( i->text( 0 ).left( i->text( 0 ).find( "(" ) ), TRUE );*/ + cmd->execute(); + cmd2->execute(); + editor->formWindow()->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + editor->formWindow()->formFile()->setModified( TRUE ); + } +} + +void EventList::save( QListViewItem *p ) +{ + QStringList lst; + QListViewItem *i = p->firstChild(); + while ( i ) { + lst << i->text( 0 ); + i = i->nextSibling(); + } +} + +// -------------------------------------------------------------- + +/*! + \class PropertyEditor propertyeditor.h + \brief PropertyEdior toplevel window + + This is the toplevel window of the property editor which contains a + listview for editing properties. +*/ + +PropertyEditor::PropertyEditor( QWidget *parent ) + : QTabWidget( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | + WStyle_StaysOnTop | WStyle_Tool |WStyle_MinMax | WStyle_SysMenu ) +{ + setCaption( i18n( "Property Editor" ) ); + wid = 0; + formwindow = 0; + listview = new PropertyList( this ); + addTab( listview, i18n( "P&roperties" ) ); + eList = new EventList( this, formWindow(), this ); + addTab( eList, i18n( "Signa&l Handlers" ) ); +} + +QObject *PropertyEditor::widget() const +{ + return wid; +} + +void PropertyEditor::setWidget( QObject *w, FormWindow *fw ) +{ + if ( fw && fw->isFake() ) + w = fw->project()->objectForFakeForm( fw ); + eList->setFormWindow( fw ); + if ( w && w == wid ) { + // if there is no properties displayed then we really should show them. + // to do this check the number of properties in the list. + bool ret = (listview->childCount() > 0) ? TRUE : FALSE; + if ( wid->isWidgetType() && WidgetFactory::layoutType( (QWidget*)wid ) != WidgetFactory::NoLayout ) { + QListViewItemIterator it( listview ); + ret = FALSE; + while ( it.current() ) { + if ( it.current()->text( 0 ) == "layoutSpacing" || it.current()->text( 0 ) == "layoutMargin" ) { + ret = TRUE; + break; + } + ++it; + } + } + if ( ret ) + return; + } + + if ( !w || !fw ) { + setCaption( i18n( "Property Editor" ) ); + clear(); + wid = 0; + formwindow = 0; + return; + } + + wid = w; + formwindow = fw; + setCaption( i18n( "Property Editor (%1)" ).arg( formwindow->name() ) ); + listview->viewport()->setUpdatesEnabled( FALSE ); + listview->setUpdatesEnabled( FALSE ); + clear(); + listview->viewport()->setUpdatesEnabled( TRUE ); + listview->setUpdatesEnabled( TRUE ); + setup(); +} + +void PropertyEditor::clear() +{ + listview->setContentsPos( 0, 0 ); + listview->clear(); + eList->setContentsPos( 0, 0 ); + eList->clear(); +} + +void PropertyEditor::setup() +{ + if ( !formwindow || !wid ) + return; + listview->viewport()->setUpdatesEnabled( FALSE ); + listview->setupProperties(); + listview->viewport()->setUpdatesEnabled( TRUE ); + listview->updateEditorSize(); + + if ( !wid->isA( "PropertyObject" ) ) { + eList->viewport()->setUpdatesEnabled( FALSE ); + eList->setup(); + eList->viewport()->setUpdatesEnabled( TRUE ); + } +} + +void PropertyEditor::refetchData() +{ + listview->refetchData(); +} + +void PropertyEditor::emitWidgetChanged() +{ + if ( formwindow && wid ) + formwindow->widgetChanged( wid ); +} + +void PropertyEditor::closed( FormWindow *w ) +{ + if ( w == formwindow ) { + formwindow = 0; + wid = 0; + clear(); + } +} + +void PropertyEditor::closeEvent( QCloseEvent *e ) +{ + emit hidden(); + e->accept(); +} + +PropertyList *PropertyEditor::propertyList() const +{ + return listview; +} + +FormWindow *PropertyEditor::formWindow() const +{ + return formwindow; +} + +QString PropertyEditor::currentProperty() const +{ + if ( !wid ) + return QString::null; + if ( ( (PropertyItem*)listview->currentItem() )->propertyParent() ) + return ( (PropertyItem*)listview->currentItem() )->propertyParent()->name(); + return ( (PropertyItem*)listview->currentItem() )->name(); +} + +QString PropertyEditor::classOfCurrentProperty() const +{ + if ( !wid ) + return QString::null; + QObject *o = wid; + QString curr = currentProperty(); + QMetaObject *mo = o->metaObject(); + while ( mo ) { + QStrList props = mo->propertyNames( FALSE ); + if ( props.find( curr.latin1() ) != -1 ) + return mo->className(); + mo = mo->superClass(); + } + return QString::null; +} + +QMetaObject* PropertyEditor::metaObjectOfCurrentProperty() const +{ + if ( !wid ) + return 0; + return wid->metaObject(); +} + +void PropertyEditor::resetFocus() +{ + if ( listview->currentItem() ) + ( (PropertyItem*)listview->currentItem() )->showEditor(); +} + +EventList *PropertyEditor::eventList() const +{ + return eList; +} + +void PropertyEditor::setPropertyEditorEnabled( bool b ) +{ + if ( !b ) + removePage( listview ); + else + insertTab( listview, i18n( "Property Editor" ), 0 ); + updateWindow(); +} + +void PropertyEditor::setSignalHandlersEnabled( bool b ) +{ + if ( !b ) + removePage( eList ); + else + insertTab( eList, i18n( "Signal Handlers" ), 0 ); + updateWindow(); +} + +void PropertyEditor::updateWindow() +{ + if ( isHidden() && count() ) { + parentWidget()->show(); + MainWindow::self->setAppropriate( (QDockWindow*)parentWidget(), TRUE ); + } else if ( isShown() && !count() ) { + parentWidget()->hide(); + MainWindow::self->setAppropriate( (QDockWindow*)parentWidget(), FALSE ); + } +} diff --git a/kdevdesigner/designer/propertyeditor.h b/kdevdesigner/designer/propertyeditor.h new file mode 100644 index 00000000..3bdc19e3 --- /dev/null +++ b/kdevdesigner/designer/propertyeditor.h @@ -0,0 +1,867 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PROPERTYEDITOR_H +#define PROPERTYEDITOR_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hierarchyview.h" +#include "metadatabase.h" + +class PropertyList; +class PropertyEditor; +class QPainter; +class QColorGroup; +class QLineEdit; +class QPushButton; +class QHBox; +class QSpinBox; +class QLabel; +class QFrame; +class FormWindow; +class QCloseEvent; +class QResizeEvent; +class PropertyWhatsThis; +class QDateEdit; +class QTimeEdit; +class QDateTimeEdit; + +class PropertyItem : public QListViewItem +{ +public: + PropertyItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ); + ~PropertyItem(); + + void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ); + void paintBranches( QPainter * p, const QColorGroup & cg, + int w, int y, int h ); + void paintFocus( QPainter *p, const QColorGroup &cg, const QRect &r ); + + virtual bool hasSubItems() const; + virtual void createChildren(); + virtual void initChildren(); + + bool isOpen() const; + void setOpen( bool b ); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + QVariant value() const; + QString name() const; + virtual void notifyValueChange(); + + virtual void setChanged( bool b, bool updateDb = TRUE ); + bool isChanged() const; + + virtual void placeEditor( QWidget *w ); + + virtual PropertyItem *propertyParent() const; + virtual void childValueChanged( PropertyItem *child ); + + void addChild( PropertyItem *i ); + int childCount() const; + PropertyItem *child( int i ) const; + + virtual bool hasCustomContents() const; + virtual void drawCustomContents( QPainter *p, const QRect &r ); + + void updateBackColor(); + + void setup() { QListViewItem::setup(); setHeight( QListViewItem::height() + 2 ); } + + virtual QString currentItem() const; + virtual int currentIntItem() const; + virtual void setCurrentItem( const QString &s ); + virtual void setCurrentItem( int i ); + virtual int currentIntItemFromObject() const; + virtual QString currentItemFromObject() const; + + void setFocus( QWidget *w ); + + virtual void toggle(); + void setText( int col, const QString &txt ); + +protected: + PropertyList *listview; + QVariant val; + +private: + QColor backgroundColor(); + void createResetButton(); + void updateResetButtonState(); + +private: + bool open, changed; + PropertyItem *property; + QString propertyName; + QPtrList children; + QColor backColor; + QPushButton *resetButton; + +}; + +class PropertyTextItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyTextItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool comment, bool multiLine, bool ascii = FALSE, bool a = FALSE ); + ~PropertyTextItem(); + + virtual void createChildren(); + virtual void initChildren(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual bool hasSubItems() const; + virtual void childValueChanged( PropertyItem *child ); + + virtual void setChanged( bool b, bool updateDb = TRUE ); + +private slots: + void setValue(); + void getText(); + +private: + QLineEdit *lined(); + QGuardedPtr lin; + QGuardedPtr box; + QPushButton *button; + bool withComment, hasMultiLines, asciiOnly, accel; + +}; + + +class PropertyBoolItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyBoolItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ); + ~PropertyBoolItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual void toggle(); + +private slots: + void setValue(); + +private: + QComboBox *combo(); + QGuardedPtr comb; + +}; + +class PropertyIntItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyIntItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool s ); + ~PropertyIntItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QSpinBox *spinBox(); + QGuardedPtr spinBx; + bool signedValue; + +}; + +class PropertyLayoutItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyLayoutItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertyLayoutItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QSpinBox *spinBox(); + QGuardedPtr spinBx; + +}; + +class PropertyDoubleItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyDoubleItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertyDoubleItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QLineEdit *lined(); + QGuardedPtr lin; +}; + +class PropertyListItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyListItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool editable ); + ~PropertyListItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + + QString currentItem() const; + int currentIntItem() const; + void setCurrentItem( const QString &s ); + void setCurrentItem( int i ); + int currentIntItemFromObject() const; + QString currentItemFromObject() const; + void addItem( const QString &s ); + +private slots: + void setValue(); + +private: + QComboBox *combo(); + QGuardedPtr comb; + int oldInt; + bool editable; + QString oldString; + +}; + +class PropertyFontItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyFontItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ); + ~PropertyFontItem(); + + virtual void createChildren(); + virtual void initChildren(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual bool hasSubItems() const; + virtual void childValueChanged( PropertyItem *child ); + +private slots: + void getFont(); + +private: + QGuardedPtr lined; + QGuardedPtr button; + QGuardedPtr box; + +}; + +class PropertyCoordItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + enum Type { Rect, Size, Point }; + + PropertyCoordItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, Type t ); + ~PropertyCoordItem(); + + virtual void createChildren(); + virtual void initChildren(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual bool hasSubItems() const; + virtual void childValueChanged( PropertyItem *child ); + +private: + QLineEdit *lined(); + QGuardedPtr lin; + Type typ; + +}; + +class PropertyColorItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyColorItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, bool children ); + ~PropertyColorItem(); + + virtual void createChildren(); + virtual void initChildren(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual bool hasSubItems() const; + virtual void childValueChanged( PropertyItem *child ); + + virtual bool hasCustomContents() const; + virtual void drawCustomContents( QPainter *p, const QRect &r ); + +private slots: + void getColor(); + +private: + QGuardedPtr box; + QGuardedPtr colorPrev; + QGuardedPtr button; + bool withChildren; + +}; + +class PropertyPixmapItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + enum Type { Pixmap, IconSet, Image }; + + PropertyPixmapItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName, Type t ); + ~PropertyPixmapItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + + virtual bool hasCustomContents() const; + virtual void drawCustomContents( QPainter *p, const QRect &r ); + +private slots: + void getPixmap(); + +private: + QGuardedPtr box; + QGuardedPtr pixPrev; + QPushButton *button; + Type type; + +}; + + +class PropertySizePolicyItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertySizePolicyItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertySizePolicyItem(); + + virtual void createChildren(); + virtual void initChildren(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual bool hasSubItems() const; + virtual void childValueChanged( PropertyItem *child ); + +private: + QLineEdit *lined(); + QGuardedPtr lin; + +}; + +class PropertyPaletteItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyPaletteItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertyPaletteItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + + virtual bool hasCustomContents() const; + virtual void drawCustomContents( QPainter *p, const QRect &r ); + +private slots: + void getPalette(); + +private: + QGuardedPtr box; + QGuardedPtr palettePrev; + QGuardedPtr button; + +}; + +class PropertyCursorItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyCursorItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertyCursorItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QComboBox *combo(); + QGuardedPtr comb; + +}; + +class PropertyKeysequenceItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyKeysequenceItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertyKeysequenceItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + bool eventFilter( QObject *o, QEvent *e ); + void handleKeyEvent( QKeyEvent *e ); + int translateModifiers( int state ); + + QGuardedPtr sequence; + QGuardedPtr box; + int k1,k2,k3,k4; + int num; + bool mouseEnter; +}; + +class PropertyDatabaseItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyDatabaseItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName, bool wField ); + ~PropertyDatabaseItem(); + + virtual void createChildren(); + virtual void initChildren(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + virtual bool hasSubItems() const; + virtual void childValueChanged( PropertyItem *child ); + +private: + QGuardedPtr lined; + QGuardedPtr button; + QGuardedPtr box; + bool withField; + +}; + +struct EnumItem { + EnumItem( const QString &k, bool s ) + : key( k ), selected( s ) {} + EnumItem() : key( QString::null ), selected( FALSE ) {} + bool operator==( const EnumItem &item ) const { + return key == item.key; + } + QString key; + bool selected; +}; + +class EnumPopup : public QFrame +{ + Q_OBJECT + +public: + EnumPopup( QWidget *parent, const char *name, WFlags f=0 ); + ~EnumPopup(); + void insertEnums( QValueList lst ); + QValueList enumList() const; + void closeWidget(); + +signals: + void closed(); + void hidden(); + +protected: + void keyPressEvent( QKeyEvent *e ); + +private: + QValueList itemList; + QPtrList checkBoxList; + QVBoxLayout *popLayout; +}; + +class EnumBox : public QComboBox +{ + Q_OBJECT + +public: + EnumBox( QWidget *parent, const char *name = 0 ); + ~EnumBox() {} + void setText( const QString &text ); + void insertEnums( QValueList lst ); + QValueList enumList() const; + +signals: + void aboutToShowPopup(); + void valueChanged(); + +protected: + void paintEvent( QPaintEvent * ); + void mousePressEvent( QMouseEvent *e ); + void keyPressEvent( QKeyEvent *e ); + +protected slots: + void restoreArrow(); + void popupHidden(); + void popupClosed(); + +private: + void popup(); + bool arrowDown; + QString str; + bool popupShown; + EnumPopup *pop; + +}; +class PropertyEnumItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyEnumItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, + const QString &propName ); + ~PropertyEnumItem(); + + void showEditor(); + void hideEditor(); + void setValue( const QVariant &v ); + QString currentItem() const; + QString currentItemFromObject() const; + void setCurrentValues( QStrList lst ); + +private slots: + void setValue(); + void insertEnums(); + +private: + QGuardedPtr box; + QValueList enumList; + QString enumString; +}; + +class PropertyList : public QListView +{ + Q_OBJECT + +public: + PropertyList( PropertyEditor *e ); + + virtual void setupProperties(); + + virtual void setCurrentItem( QListViewItem *i ); + virtual void valueChanged( PropertyItem *i ); + virtual void refetchData(); + virtual void setPropertyValue( PropertyItem *i ); + virtual void setCurrentProperty( const QString &n ); + + void layoutInitValue( PropertyItem *i, bool changed = FALSE ); + PropertyEditor *propertyEditor() const; + QString whatsThisAt( const QPoint &p ); + void showCurrentWhatsThis(); + + enum LastEventType { KeyEvent, MouseEvent }; + LastEventType lastEvent(); + +public slots: + void updateEditorSize(); + void resetProperty(); + void toggleSort(); + +private slots: + void itemPressed( QListViewItem *i, const QPoint &p, int c ); + void toggleOpen( QListViewItem *i ); + bool eventFilter( QObject *o, QEvent *e ); + +protected: + void resizeEvent( QResizeEvent *e ); + void paintEmptyArea( QPainter *p, const QRect &r ); + bool addPropertyItem( PropertyItem *&item, const QCString &name, QVariant::Type t ); + + void viewportDragEnterEvent( QDragEnterEvent * ); + void viewportDragMoveEvent ( QDragMoveEvent * ); + void viewportDropEvent ( QDropEvent * ); + +protected: + PropertyEditor *editor; + +private: + void readPropertyDocs(); + void setupCusWidgetProperties( MetaDataBase::CustomWidget *cw, + QMap &unique, + PropertyItem *&item ); + QString whatsThisText( QListViewItem *i ); + +private: + PropertyListItem* pressItem; + QPoint pressPos; + bool mousePressed; + bool showSorted; + QMap propertyDocs; + PropertyWhatsThis *whatsThis; + LastEventType theLastEvent; +}; + +class EventList : public HierarchyList +{ + Q_OBJECT + +public: + EventList( QWidget *parent, FormWindow *fw, PropertyEditor *e ); + + void setup(); + void setCurrent( QWidget *w ); + +protected: + void contentsMouseDoubleClickEvent( QMouseEvent *e ); + +private: + void save( QListViewItem *p ); + +private slots: + void objectClicked( QListViewItem *i ); + void showRMBMenu( QListViewItem *, const QPoint & ); + void renamed( QListViewItem *i ); + +private: + PropertyEditor *editor; + +}; + + +class PropertyEditor : public QTabWidget +{ + Q_OBJECT + +public: + PropertyEditor( QWidget *parent ); + + QObject *widget() const; + + void clear(); + void setup(); + + void emitWidgetChanged(); + void refetchData(); + + void closed( FormWindow *w ); + + PropertyList *propertyList() const; + FormWindow *formWindow() const; + EventList *eventList() const; + + QString currentProperty() const; + QString classOfCurrentProperty() const; + QMetaObject* metaObjectOfCurrentProperty() const; + + void resetFocus(); + + void setPropertyEditorEnabled( bool b ); + void setSignalHandlersEnabled( bool b ); + +signals: + void hidden(); + +public slots: + void setWidget( QObject *w, FormWindow *fw ); + +protected: + void closeEvent( QCloseEvent *e ); + +private: + void updateWindow(); + +private: + QObject *wid; + PropertyList *listview; + EventList *eList; + FormWindow *formwindow; + +}; + +class PropertyDateItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyDateItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ); + ~PropertyDateItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QDateEdit *lined(); + QGuardedPtr lin; + +}; + +class PropertyTimeItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyTimeItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ); + ~PropertyTimeItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QTimeEdit *lined(); + QGuardedPtr lin; + +}; + +class PropertyDateTimeItem : public QObject, + public PropertyItem +{ + Q_OBJECT + +public: + PropertyDateTimeItem( PropertyList *l, PropertyItem *after, PropertyItem *prop, const QString &propName ); + ~PropertyDateTimeItem(); + + virtual void showEditor(); + virtual void hideEditor(); + + virtual void setValue( const QVariant &v ); + +private slots: + void setValue(); + +private: + QDateTimeEdit *lined(); + QGuardedPtr lin; + +}; + +#endif diff --git a/kdevdesigner/designer/propertyobject.cpp b/kdevdesigner/designer/propertyobject.cpp new file mode 100644 index 00000000..8687033e --- /dev/null +++ b/kdevdesigner/designer/propertyobject.cpp @@ -0,0 +1,158 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "propertyobject.h" +#include "metadatabase.h" +#include +#include +#include +#include + +PropertyObject::PropertyObject( const QWidgetList &objs ) + : QObject(), objects( objs ), mobj( 0 ) +{ + QPtrVector > v; + v.resize( objects.count() ); + v.setAutoDelete( TRUE ); + + for ( QObject *o = objects.first(); o; o = objects.next() ) { + const QMetaObject *m = o->metaObject(); + QPtrList *mol = new QPtrList; + while ( m ) { + mol->insert( 0, m ); + m = m->superClass(); + } + v.insert( v.count(), mol ); + } + + int numObjects = objects.count(); + int minDepth = v[0]->count(); + int depth = minDepth; + + for ( int i = 0; i < numObjects; ++i ) { + depth = (int)v[i]->count(); + if ( depth < minDepth ) + minDepth = depth; + } + + const QMetaObject *m = v[0]->at( --minDepth ); + + for ( int j = 0; j < numObjects; ++j ) { + if ( v[j]->at( minDepth ) != m ) { + m = v[0]->at( --minDepth ); + j = 0; + } + } + + mobj = m; + + Q_ASSERT( mobj ); +} + +bool PropertyObject::setProperty( const char *name, const QVariant& value ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) + o->setProperty( name, value ); + + return TRUE; +} + +QVariant PropertyObject::property( const char *name ) const +{ + return ( (PropertyObject*)this )->objects.first()->property( name ); +} + +void PropertyObject::mdPropertyChanged( const QString &property, bool changed ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) + MetaDataBase::setPropertyChanged( o, property, changed ); +} + +bool PropertyObject::mdIsPropertyChanged( const QString &property ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) { + if ( MetaDataBase::isPropertyChanged( o, property ) ) + return TRUE; + } + return FALSE; +} + +void PropertyObject::mdSetPropertyComment( const QString &property, const QString &comment ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) + MetaDataBase::setPropertyComment( o, property, comment ); +} + +QString PropertyObject::mdPropertyComment( const QString &property ) +{ + return MetaDataBase::propertyComment( objects.first(), property ); +} + +void PropertyObject::mdSetFakeProperty( const QString &property, const QVariant &value ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) + MetaDataBase::setFakeProperty( o, property, value ); +} + +QVariant PropertyObject::mdFakeProperty( const QString &property ) +{ + return MetaDataBase::fakeProperty( objects.first(), property ); +} + +void PropertyObject::mdSetCursor( const QCursor &c ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) { + if ( o->isWidgetType() ) + MetaDataBase::setCursor( (QWidget*)o, c ); + } +} + +QCursor PropertyObject::mdCursor() +{ + return MetaDataBase::cursor( objects.first() ); +} + +void PropertyObject::mdSetPixmapKey( int pixmap, const QString &arg ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) + MetaDataBase::setPixmapKey( o, pixmap, arg ); +} + +QString PropertyObject::mdPixmapKey( int pixmap ) +{ + return MetaDataBase::pixmapKey( objects.first(), pixmap ); +} + +void PropertyObject::mdSetExportMacro( const QString ¯o ) +{ + for ( QObject *o = objects.first(); o; o = objects.next() ) + MetaDataBase::setExportMacro( o, macro ); +} + +QString PropertyObject::mdExportMacro() +{ + return MetaDataBase::exportMacro( objects.first() ); +} diff --git a/kdevdesigner/designer/propertyobject.h b/kdevdesigner/designer/propertyobject.h new file mode 100644 index 00000000..c8445239 --- /dev/null +++ b/kdevdesigner/designer/propertyobject.h @@ -0,0 +1,43 @@ +#ifndef PROPERTYOBJECT_H +#define PROPERTYOBJECT_H + +#include +#include +#include + +class PropertyObject : public QObject +{ +public: + QMetaObject *metaObject() const { return (QMetaObject*)mobj; } + const char *className() const { return "PropertyObject"; } + QObject* qObject() { return (QObject*)this; } +private: + static QMetaObject *metaObj; + +public: + PropertyObject( const QWidgetList &objs ); + + bool setProperty( const char *name, const QVariant& value ); + QVariant property( const char *name ) const; + + void mdPropertyChanged( const QString &property, bool changed ); + bool mdIsPropertyChanged( const QString &property ); + void mdSetPropertyComment( const QString &property, const QString &comment ); + QString mdPropertyComment( const QString &property ); + void mdSetFakeProperty( const QString &property, const QVariant &value ); + QVariant mdFakeProperty( const QString &property ); + void mdSetCursor( const QCursor &c ); + QCursor mdCursor(); + void mdSetPixmapKey( int pixmap, const QString &arg ); + QString mdPixmapKey( int pixmap ); + void mdSetExportMacro( const QString ¯o ); + QString mdExportMacro(); + QWidgetList widgetList() const { return objects; } + +private: + QWidgetList objects; + const QMetaObject *mobj; + +}; + +#endif diff --git a/kdevdesigner/designer/qcompletionedit.cpp b/kdevdesigner/designer/qcompletionedit.cpp new file mode 100644 index 00000000..9c735577 --- /dev/null +++ b/kdevdesigner/designer/qcompletionedit.cpp @@ -0,0 +1,210 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "qcompletionedit.h" +#include +#include +#include +#include + +QCompletionEdit::QCompletionEdit( QWidget *parent, const char *name ) + : QLineEdit( parent, name ), aAdd( FALSE ), caseSensitive( FALSE ) +{ + popup = new QVBox( 0, 0, WType_Popup ); + popup->setFrameStyle( QFrame::Box | QFrame::Plain ); + popup->setLineWidth( 1 ); + popup->hide(); + + listbox = new QListBox( popup ); + listbox->setFrameStyle( QFrame::NoFrame ); + listbox->setLineWidth( 1 ); + listbox->installEventFilter( this ); + listbox->setHScrollBarMode( QScrollView::AlwaysOn ); + listbox->setVScrollBarMode( QScrollView::AlwaysOn ); + listbox->setCornerWidget( new QSizeGrip( listbox, "completion sizegrip" ) ); + connect( this, SIGNAL( textChanged( const QString & ) ), + this, SLOT( textDidChange( const QString & ) ) ); + popup->setFocusProxy( listbox ); + installEventFilter( this ); +} + +bool QCompletionEdit::autoAdd() const +{ + return aAdd; +} + +QStringList QCompletionEdit::completionList() const +{ + return compList; +} + +void QCompletionEdit::setCompletionList( const QStringList &l ) +{ + compList = l; +} + +void QCompletionEdit::setAutoAdd( bool add ) +{ + aAdd = add; +} + +void QCompletionEdit::textDidChange( const QString &text ) +{ + if ( text.isEmpty() ) { + popup->close(); + return; + } + updateListBox(); + placeListBox(); +} + +void QCompletionEdit::placeListBox() +{ + if ( listbox->count() == 0 ) { + popup->close(); + return; + } + + popup->resize( QMAX( listbox->sizeHint().width() + listbox->verticalScrollBar()->width() + 4, width() ), + listbox->sizeHint().height() + listbox->horizontalScrollBar()->height() + 4 ); + + QPoint p( mapToGlobal( QPoint( 0, 0 ) ) ); + if ( p.y() + height() + popup->height() <= QApplication::desktop()->height() ) + popup->move( p.x(), p.y() + height() ); + else + popup->move( p.x(), p.y() - listbox->height() ); + popup->show(); + listbox->setCurrentItem( 0 ); + listbox->setSelected( 0, TRUE ); + setFocus(); +} + +void QCompletionEdit::updateListBox() +{ + listbox->clear(); + if ( compList.isEmpty() ) + return; + for ( QStringList::Iterator it = compList.begin(); it != compList.end(); ++it ) { + if ( caseSensitive && (*it).left( text().length() ) == text() || + !caseSensitive && (*it).left( text().length() ).lower() == text().lower() ) + listbox->insertItem( *it ); + } +} + +bool QCompletionEdit::eventFilter( QObject *o, QEvent *e ) +{ + if ( o == popup || o == listbox || o == listbox->viewport() ) { + if ( e->type() == QEvent::KeyPress ) { + QKeyEvent *ke = (QKeyEvent*)e; + if ( ke->key() == Key_Enter || ke->key() == Key_Return || ke->key() == Key_Tab ) { + if ( ke->key() == Key_Tab && listbox->count() > 1 && + listbox->currentItem() < (int)listbox->count() - 1 ) { + listbox->setCurrentItem( listbox->currentItem() + 1 ); + return TRUE; + } + popup->close(); + setFocus(); + blockSignals( TRUE ); + setText( listbox->currentText() ); + blockSignals( FALSE ); + emit chosen( text() ); + return TRUE; + } else if ( ke->key() == Key_Left || ke->key() == Key_Right || + ke->key() == Key_Up || ke->key() == Key_Down || + ke->key() == Key_Home || ke->key() == Key_End || + ke->key() == Key_Prior || ke->key() == Key_Next ) { + return FALSE; + } else if ( ke->key() == Key_Escape ) { + popup->close(); + setFocus(); + } else if ( ke->key() != Key_Shift && ke->key() != Key_Control && + ke->key() != Key_Alt ) { + updateListBox(); + if ( listbox->count() == 0 || text().length() == 0 ) { + popup->close(); + setFocus(); + } + QApplication::sendEvent( this, e ); + return TRUE; + } + } else if ( e->type() == QEvent::MouseButtonDblClick ) { + popup->close(); + setFocus(); + blockSignals( TRUE ); + setText( listbox->currentText() ); + blockSignals( FALSE ); + emit chosen( text() ); + return TRUE; + } + } else if ( o == this ) { + if ( e->type() == QEvent::KeyPress ) { + QKeyEvent *ke = (QKeyEvent*)e; + if ( ke->key() == Key_Up || + ke->key() == Key_Down || + ke->key() == Key_Prior || + ke->key() == Key_Next || + ke->key() == Key_Return || + ke->key() == Key_Enter || + ke->key() == Key_Tab || + ke->key() == Key_Escape ) { + QApplication::sendEvent( listbox, e ); + return TRUE; + } + } + } + return QLineEdit::eventFilter( o, e ); +} + +void QCompletionEdit::addCompletionEntry( const QString &entry ) +{ + if ( compList.find( entry ) == compList.end() ) { + compList << entry; + compList.sort(); + } +} + +void QCompletionEdit::removeCompletionEntry( const QString &entry ) +{ + QStringList::Iterator it = compList.find( entry ); + if ( it != compList.end() ) + compList.remove( it ); +} + +void QCompletionEdit::setCaseSensitive( bool b ) +{ + caseSensitive = b; +} + +bool QCompletionEdit::isCaseSensitive() const +{ + return caseSensitive; +} + +void QCompletionEdit::clear() +{ + QLineEdit::clear(); + compList.clear(); +} diff --git a/kdevdesigner/designer/qcompletionedit.h b/kdevdesigner/designer/qcompletionedit.h new file mode 100644 index 00000000..426e7202 --- /dev/null +++ b/kdevdesigner/designer/qcompletionedit.h @@ -0,0 +1,79 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef QCOMPLETIONEDIT_H +#define QCOMPLETIONEDIT_H + +#include +#include + +class QListBox; +class QVBox; + +class QCompletionEdit : public QLineEdit +{ + Q_OBJECT + Q_PROPERTY( bool autoAdd READ autoAdd WRITE setAutoAdd ) + Q_PROPERTY( bool caseSensitive READ isCaseSensitive WRITE setCaseSensitive ) + +public: + QCompletionEdit( QWidget *parent = 0, const char *name = 0 ); + + bool autoAdd() const; + QStringList completionList() const; + bool eventFilter( QObject *o, QEvent *e ); + bool isCaseSensitive() const; + +public slots: + void setCompletionList( const QStringList &l ); + void setAutoAdd( bool add ); + void clear(); + void addCompletionEntry( const QString &entry ); + void removeCompletionEntry( const QString &entry ); + void setCaseSensitive( bool b ); + +signals: + void chosen( const QString &text ); + +private slots: + void textDidChange( const QString &text ); + +private: + void placeListBox(); + void updateListBox(); + +private: + bool aAdd; + QStringList compList; + QListBox *listbox; + QVBox *popup; + bool caseSensitive; + +}; + + + +#endif diff --git a/kdevdesigner/designer/replacedialog.ui b/kdevdesigner/designer/replacedialog.ui new file mode 100644 index 00000000..41a211ea --- /dev/null +++ b/kdevdesigner/designer/replacedialog.ui @@ -0,0 +1,318 @@ + +ReplaceDialog +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + ReplaceDialog + + + + 0 + 0 + 286 + 217 + + + + Replace Text + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + R&eplace: + + + comboReplace + + + + + TextLabel1 + + + &Find: + + + comboFind + + + + + comboFind + + + + 7 + 0 + 0 + 0 + + + + true + + + + + comboReplace + + + + 7 + 0 + 0 + 0 + + + + true + + + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonReplace + + + &Replace + + + true + + + + + buttonReplaceAll + + + Replace &All + + + + + PushButton2 + + + &Close + + + + + + + ButtonGroup1 + + + Options + + + + unnamed + + + 11 + + + 6 + + + + checkWords + + + &Whole words only + + + + + checkCase + + + Case &sensitive + + + + + checkBegin + + + Start at &beginning + + + + + + + ButtonGroup2 + + + Direction + + + + unnamed + + + 11 + + + 6 + + + + radioForward + + + Forwar&d + + + true + + + + + radioBackward + + + Bac&kward + + + + + + + + + buttonReplace + clicked() + ReplaceDialog + doReplace() + + + buttonReplaceAll + clicked() + ReplaceDialog + doReplaceAll() + + + PushButton2 + clicked() + ReplaceDialog + reject() + + + + comboFind + comboReplace + checkWords + checkCase + checkBegin + radioForward + radioBackward + buttonReplace + buttonReplaceAll + PushButton2 + + + ../interfaces/editorinterface.h + qlineedit.h + replacedialog.ui.h + + + struct EditorInterface; + + + EditorInterface *editor; + QObject *formWindow; + + + init() + destroy() + doReplace() + doReplaceAll() + setEditor( EditorInterface * e, QObject * fw ) + + + diff --git a/kdevdesigner/designer/replacedialog.ui.h b/kdevdesigner/designer/replacedialog.ui.h new file mode 100644 index 00000000..9fa0f546 --- /dev/null +++ b/kdevdesigner/designer/replacedialog.ui.h @@ -0,0 +1,75 @@ +/********************************************************************** +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + + +void ReplaceDialog::init() +{ + editor = 0; + formWindow = 0; +} + +void ReplaceDialog::destroy() +{ + if ( editor ) + editor->release(); + editor = 0; + formWindow = 0; +} + +void ReplaceDialog::doReplace() +{ + if ( !editor ) + return; + + if ( !editor->replace( comboFind->currentText(), comboReplace->currentText(), checkCase->isChecked(), + checkWords->isChecked(), radioForward->isChecked(), !checkBegin->isChecked(), FALSE ) ) + checkBegin->setChecked( TRUE ); + else + checkBegin->setChecked( FALSE ); +} + +void ReplaceDialog::doReplaceAll() +{ + if ( !editor ) + return; + + if ( !editor->replace( comboFind->currentText(), comboReplace->currentText(), checkCase->isChecked(), + checkWords->isChecked(), radioForward->isChecked(), !checkBegin->isChecked(), TRUE ) ) + checkBegin->setChecked( TRUE ); + else + checkBegin->setChecked( FALSE ); +} + +void ReplaceDialog::setEditor( EditorInterface * e, QObject * fw ) +{ + if ( fw != formWindow ) + checkBegin->setChecked( TRUE ); + formWindow = fw; + if ( editor ) + editor->release(); + editor = e; + editor->addRef(); +} diff --git a/kdevdesigner/designer/resource.cpp b/kdevdesigner/designer/resource.cpp new file mode 100644 index 00000000..ca983a42 --- /dev/null +++ b/kdevdesigner/designer/resource.cpp @@ -0,0 +1,3327 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "actiondnd.h" +#include "command.h" +#ifndef QT_NO_SQL +#include "database.h" +#endif +#include "formfile.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "menubareditor.h" +#include "metadatabase.h" +#include "pixmapcollection.h" +#include "popupmenueditor.h" +#include "project.h" +#include "resource.h" +#include "widgetfactory.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_TABLE +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "kdevdesigner_part.h" + +static QString makeIndent( int indent ) +{ + QString s; + s.fill( ' ', indent * 4 ); + return s; +} + +static QString entitize( const QString &s, bool attribute = FALSE ) +{ + QString s2 = s; + s2 = s2.replace( "&", "&" ); + s2 = s2.replace( ">", ">" ); + s2 = s2.replace( "<", "<" ); + if ( attribute ) { + s2 = s2.replace( "\"", """ ); + s2 = s2.replace( "'", "'" ); + } + return s2; +} + +#ifdef Q_WS_MACX +static struct { + int key; + const char* name; +} keyname[] = { + { Qt::Key_Space, QT_TRANSLATE_NOOP( "QAccel", "Space" ) }, + { Qt::Key_Escape, QT_TRANSLATE_NOOP( "QAccel", "Esc" ) }, + { Qt::Key_Tab, QT_TRANSLATE_NOOP( "QAccel", "Tab" ) }, + { Qt::Key_Backtab, QT_TRANSLATE_NOOP( "QAccel", "Backtab" ) }, + { Qt::Key_Backspace, QT_TRANSLATE_NOOP( "QAccel", "Backspace" ) }, + { Qt::Key_Return, QT_TRANSLATE_NOOP( "QAccel", "Return" ) }, + { Qt::Key_Enter, QT_TRANSLATE_NOOP( "QAccel", "Enter" ) }, + { Qt::Key_Insert, QT_TRANSLATE_NOOP( "QAccel", "Ins" ) }, + { Qt::Key_Delete, QT_TRANSLATE_NOOP( "QAccel", "Del" ) }, + { Qt::Key_Pause, QT_TRANSLATE_NOOP( "QAccel", "Pause" ) }, + { Qt::Key_Print, QT_TRANSLATE_NOOP( "QAccel", "Print" ) }, + { Qt::Key_SysReq, QT_TRANSLATE_NOOP( "QAccel", "SysReq" ) }, + { Qt::Key_Home, QT_TRANSLATE_NOOP( "QAccel", "Home" ) }, + { Qt::Key_End, QT_TRANSLATE_NOOP( "QAccel", "End" ) }, + { Qt::Key_Left, QT_TRANSLATE_NOOP( "QAccel", "Left" ) }, + { Qt::Key_Up, QT_TRANSLATE_NOOP( "QAccel", "Up" ) }, + { Qt::Key_Right, QT_TRANSLATE_NOOP( "QAccel", "Right" ) }, + { Qt::Key_Down, QT_TRANSLATE_NOOP( "QAccel", "Down" ) }, + { Qt::Key_Prior, QT_TRANSLATE_NOOP( "QAccel", "PgUp" ) }, + { Qt::Key_Next, QT_TRANSLATE_NOOP( "QAccel", "PgDown" ) }, + { Qt::Key_CapsLock, QT_TRANSLATE_NOOP( "QAccel", "CapsLock" ) }, + { Qt::Key_NumLock, QT_TRANSLATE_NOOP( "QAccel", "NumLock" ) }, + { Qt::Key_ScrollLock, QT_TRANSLATE_NOOP( "QAccel", "ScrollLock" ) }, + { Qt::Key_Menu, QT_TRANSLATE_NOOP( "QAccel", "Menu" ) }, + { Qt::Key_Help, QT_TRANSLATE_NOOP( "QAccel", "Help" ) }, + + // Multimedia keys + { Qt::Key_Back, QT_TRANSLATE_NOOP( "QAccel", "Back" ) }, + { Qt::Key_Forward, QT_TRANSLATE_NOOP( "QAccel", "Forward" ) }, + { Qt::Key_Stop, QT_TRANSLATE_NOOP( "QAccel", "Stop" ) }, + { Qt::Key_Refresh, QT_TRANSLATE_NOOP( "QAccel", "Refresh" ) }, + { Qt::Key_VolumeDown, QT_TRANSLATE_NOOP( "QAccel", "Volume Down" ) }, + { Qt::Key_VolumeMute, QT_TRANSLATE_NOOP( "QAccel", "Volume Mute" ) }, + { Qt::Key_VolumeUp, QT_TRANSLATE_NOOP( "QAccel", "Volume Up" ) }, + { Qt::Key_BassBoost, QT_TRANSLATE_NOOP( "QAccel", "Bass Boost" ) }, + { Qt::Key_BassUp, QT_TRANSLATE_NOOP( "QAccel", "Bass Up" ) }, + { Qt::Key_BassDown, QT_TRANSLATE_NOOP( "QAccel", "Bass Down" ) }, + { Qt::Key_TrebleUp, QT_TRANSLATE_NOOP( "QAccel", "Treble Up" ) }, + { Qt::Key_TrebleDown, QT_TRANSLATE_NOOP( "QAccel", "Treble Down" ) }, + { Qt::Key_MediaPlay, QT_TRANSLATE_NOOP( "QAccel", "Media Play" ) }, + { Qt::Key_MediaStop, QT_TRANSLATE_NOOP( "QAccel", "Media Stop" ) }, + { Qt::Key_MediaPrev, QT_TRANSLATE_NOOP( "QAccel", "Media Previous" ) }, + { Qt::Key_MediaNext, QT_TRANSLATE_NOOP( "QAccel", "Media Next" ) }, + { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP( "QAccel", "Media Record" ) }, + { Qt::Key_HomePage, QT_TRANSLATE_NOOP( "QAccel", "Home" ) }, + { Qt::Key_Favorites, QT_TRANSLATE_NOOP( "QAccel", "Favorites" ) }, + { Qt::Key_Search, QT_TRANSLATE_NOOP( "QAccel", "Search" ) }, + { Qt::Key_Standby, QT_TRANSLATE_NOOP( "QAccel", "Standby" ) }, + { Qt::Key_OpenUrl, QT_TRANSLATE_NOOP( "QAccel", "Open URL" ) }, + { Qt::Key_LaunchMail, QT_TRANSLATE_NOOP( "QAccel", "Launch Mail" ) }, + { Qt::Key_LaunchMedia, QT_TRANSLATE_NOOP( "QAccel", "Launch Media" ) }, + { Qt::Key_Launch0, QT_TRANSLATE_NOOP( "QAccel", "Launch (0)" ) }, + { Qt::Key_Launch1, QT_TRANSLATE_NOOP( "QAccel", "Launch (1)" ) }, + { Qt::Key_Launch2, QT_TRANSLATE_NOOP( "QAccel", "Launch (2)" ) }, + { Qt::Key_Launch3, QT_TRANSLATE_NOOP( "QAccel", "Launch (3)" ) }, + { Qt::Key_Launch4, QT_TRANSLATE_NOOP( "QAccel", "Launch (4)" ) }, + { Qt::Key_Launch5, QT_TRANSLATE_NOOP( "QAccel", "Launch (5)" ) }, + { Qt::Key_Launch6, QT_TRANSLATE_NOOP( "QAccel", "Launch (6)" ) }, + { Qt::Key_Launch7, QT_TRANSLATE_NOOP( "QAccel", "Launch (7)" ) }, + { Qt::Key_Launch8, QT_TRANSLATE_NOOP( "QAccel", "Launch (8)" ) }, + { Qt::Key_Launch9, QT_TRANSLATE_NOOP( "QAccel", "Launch (9)" ) }, + { Qt::Key_LaunchA, QT_TRANSLATE_NOOP( "QAccel", "Launch (A)" ) }, + { Qt::Key_LaunchB, QT_TRANSLATE_NOOP( "QAccel", "Launch (B)" ) }, + { Qt::Key_LaunchC, QT_TRANSLATE_NOOP( "QAccel", "Launch (C)" ) }, + { Qt::Key_LaunchD, QT_TRANSLATE_NOOP( "QAccel", "Launch (D)" ) }, + { Qt::Key_LaunchE, QT_TRANSLATE_NOOP( "QAccel", "Launch (E)" ) }, + { Qt::Key_LaunchF, QT_TRANSLATE_NOOP( "QAccel", "Launch (F)" ) }, + + // -------------------------------------------------------------- + // More consistent namings + { Qt::Key_Print, QT_TRANSLATE_NOOP( "QAccel", "Print Screen" ) }, + { Qt::Key_Prior, QT_TRANSLATE_NOOP( "QAccel", "Page Up" ) }, + { Qt::Key_Next, QT_TRANSLATE_NOOP( "QAccel", "Page Down" ) }, + { Qt::Key_CapsLock, QT_TRANSLATE_NOOP( "QAccel", "Caps Lock" ) }, + { Qt::Key_NumLock, QT_TRANSLATE_NOOP( "QAccel", "Num Lock" ) }, + { Qt::Key_NumLock, QT_TRANSLATE_NOOP( "QAccel", "Number Lock" ) }, + { Qt::Key_ScrollLock, QT_TRANSLATE_NOOP( "QAccel", "Scroll Lock" ) }, + { Qt::Key_Insert, QT_TRANSLATE_NOOP( "QAccel", "Insert" ) }, + { Qt::Key_Delete, QT_TRANSLATE_NOOP( "QAccel", "Delete" ) }, + { Qt::Key_Escape, QT_TRANSLATE_NOOP( "QAccel", "Escape" ) }, + { Qt::Key_SysReq, QT_TRANSLATE_NOOP( "QAccel", "System Request" ) }, + + { 0, 0 } +}; +#endif +static QString platformNeutralKeySequence(const QKeySequence &ks) +{ +#ifndef Q_WS_MACX + return QString(ks); +#else + uint k; + QString str; + QString p; + for (k = 0; k < ks.count(); ++k) { + int keycombo = ks[k]; + int basekey = keycombo & ~(Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META); + if (keycombo & Qt::CTRL) + str += "Ctrl+"; + if (keycombo & Qt::ALT) + str += "Alt+"; + if (keycombo & Qt::META) + str += "Meta+"; + if (keycombo & Qt::SHIFT) + str += "Shift+"; + + // begin copy and paste from QKeySequence :( + if (basekey & Qt::UNICODE_ACCEL) { + // Note: This character should NOT be upper()'ed, since + // the encoded string should indicate EXACTLY what the + // key represents! Hence a 'Ctrl+Shift+c' is posible to + // represent, but is clearly impossible to trigger... + p = QChar(basekey & 0xffff); + } else if ( basekey >= Qt::Key_F1 && basekey <= Qt::Key_F35 ) { + p = QAccel::tr( "F%1" ).arg(basekey - Qt::Key_F1 + 1); + } else if ( basekey > Qt::Key_Space && basekey <= Qt::Key_AsciiTilde ) { + p.sprintf( "%c", basekey ); + } else { + int i = 0; + while (keyname[i].name) { + if (basekey == keyname[i].key) { + p = QAccel::tr(keyname[i].name); + break; + } + ++i; + } + // If we can't find the actual translatable keyname, + // fall back on the unicode representation of it... + // Or else characters like Key_aring may not get displayed + // ( Really depends on you locale ) + if ( !keyname[i].name ) + // Note: This character should NOT be upper()'ed, see above! + p = QChar(basekey & 0xffff); + } + // end copy... + str += p + ", "; + } + str.truncate(str.length() - 2); + return str; +#endif +} + +static QString mkBool( bool b ) +{ + return b? "true" : "false"; +} + +/*! + \class Resource resource.h + \brief Class for saving/loading, etc. forms + + This class is used for saving and loading forms, code generation, + transferring data of widgets over the clipboard, etc.. + +*/ + + +Resource::Resource() +{ + mainwindow = 0; + formwindow = 0; + toplevel = 0; + copying = FALSE; + pasting = FALSE; + hadGeometry = FALSE; + langIface = 0; + hasFunctions = FALSE; +} + +Resource::Resource( MainWindow* mw ) + : mainwindow( mw ) +{ + formwindow = 0; + toplevel = 0; + copying = FALSE; + pasting = FALSE; + hadGeometry = FALSE; + langIface = 0; + hasFunctions = FALSE; +} + +Resource::~Resource() +{ + if ( langIface ) + langIface->release(); +} + +void Resource::setWidget( FormWindow *w ) +{ + formwindow = w; + toplevel = w; +} + +QWidget *Resource::widget() const +{ + return toplevel; +} + +bool Resource::load( FormFile *ff, Project *defProject ) +{ + if ( !ff || ff->absFileName().isEmpty() ) + return FALSE; + currFileName = ff->absFileName(); + mainContainerSet = FALSE; + + QFile f( ff->absFileName() ); + f.open( IO_ReadOnly | IO_Translate ); + + bool b = load( ff, &f, defProject ); + f.close(); + + return b; +} + +#undef signals +#undef slots + +bool Resource::load( FormFile *ff, QIODevice* dev, Project *defProject ) +{ + QDomDocument doc; + QString errMsg; + int errLine; + if ( !doc.setContent( dev, &errMsg, &errLine ) ) { + return FALSE; + } + + DomTool::fixDocument( doc ); + + QWidget *p = mainwindow ? mainwindow->qWorkspace() : 0; + toplevel = formwindow = new FormWindow( ff, p, 0 ); + if ( defProject ) + formwindow->setProject( defProject ); + else if ( MainWindow::self ) + formwindow->setProject( MainWindow::self->currProject() ); + if ( mainwindow ) + formwindow->setMainWindow( mainwindow ); + MetaDataBase::addEntry( formwindow ); + + if ( !langIface ) { + QString lang = "Qt Script"; + if ( mainwindow ) + lang = mainwindow->currProject()->language(); + langIface = MetaDataBase::languageInterface( lang ); + if ( langIface ) + langIface->addRef(); + } + + uiFileVersion = doc.firstChild().toElement().attribute("version"); + QDomElement e = doc.firstChild().toElement().firstChild().toElement(); + + QDomElement forwards = e; + while ( forwards.tagName() != "forwards" && !forwards.isNull() ) + forwards = forwards.nextSibling().toElement(); + + QDomElement includes = e; + while ( includes.tagName() != "includes" && !includes.isNull() ) + includes = includes.nextSibling().toElement(); + + QDomElement variables = e; + while ( variables.tagName() != "variables" && !variables.isNull() ) + variables = variables.nextSibling().toElement(); + + QDomElement signals = e; + while ( signals.tagName() != "signals" && !signals.isNull() ) + signals = signals.nextSibling().toElement(); + + QDomElement slots = e; + while ( slots.tagName() != "slots" && !slots.isNull() ) + slots = slots.nextSibling().toElement(); + + QDomElement functions = e; + while ( functions.tagName() != "functions" && !functions.isNull() ) + functions = functions.nextSibling().toElement(); + + QDomElement connections = e; + while ( connections.tagName() != "connections" && !connections.isNull() ) + connections = connections.nextSibling().toElement(); + + QDomElement imageCollection = e; + images.clear(); + while ( imageCollection.tagName() != "images" && !imageCollection.isNull() ) + imageCollection = imageCollection.nextSibling().toElement(); + + QDomElement customWidgets = e; + while ( customWidgets.tagName() != "customwidgets" && !customWidgets.isNull() ) + customWidgets = customWidgets.nextSibling().toElement(); + + QDomElement tabOrder = e; + while ( tabOrder.tagName() != "tabstops" && !tabOrder.isNull() ) + tabOrder = tabOrder.nextSibling().toElement(); + + QDomElement actions = e; + while ( actions.tagName() != "actions" && !actions.isNull() ) + actions = actions.nextSibling().toElement(); + + QDomElement toolbars = e; + while ( toolbars.tagName() != "toolbars" && !toolbars.isNull() ) + toolbars = toolbars.nextSibling().toElement(); + + QDomElement menubar = e; + while ( menubar.tagName() != "menubar" && !menubar.isNull() ) + menubar = menubar.nextSibling().toElement(); + + QDomElement widget; + while ( !e.isNull() ) { + if ( e.tagName() == "widget" ) { + widgets.clear(); + widget = e; + } else if ( e.tagName() == "include" ) { // compatibility with 2.x + MetaDataBase::Include inc; + inc.location = "global"; + if ( e.attribute( "location" ) == "local" ) + inc.location = "local"; + inc.implDecl = "in declaration"; + if ( e.attribute( "impldecl" ) == "in implementation" ) + inc.implDecl = "in implementation"; + inc.header = e.firstChild().toText().data(); + if ( inc.header.right( 5 ) != ".ui.h" ) { + metaIncludes.append( inc ); + } else { + if ( formwindow->formFile() ) + formwindow->formFile()->setCodeFileState( FormFile::Ok ); + } + } else if ( e.tagName() == "comment" ) { + metaInfo.comment = e.firstChild().toText().data(); + } else if ( e.tagName() == "forward" ) { // compatibility with old betas + metaForwards << e.firstChild().toText().data(); + } else if ( e.tagName() == "variable" ) { // compatibility with old betas + MetaDataBase::Variable v; + v.varName = e.firstChild().toText().data(); + v.varAccess = "protected"; + metaVariables << v; + } else if ( e.tagName() == "author" ) { + metaInfo.author = e.firstChild().toText().data(); + } else if ( e.tagName() == "class" ) { + metaInfo.className = e.firstChild().toText().data(); + } else if ( e.tagName() == "pixmapfunction" ) { + if ( formwindow ) { + formwindow->setSavePixmapInline( FALSE ); + formwindow->setSavePixmapInProject( FALSE ); + formwindow->setPixmapLoaderFunction( e.firstChild().toText().data() ); + } + } else if ( e.tagName() == "pixmapinproject" ) { + if ( formwindow ) { + formwindow->setSavePixmapInline( FALSE ); + formwindow->setSavePixmapInProject( TRUE ); + } + } else if ( e.tagName() == "exportmacro" ) { + exportMacro = e.firstChild().toText().data(); + } else if ( e.tagName() == "layoutdefaults" ) { + formwindow->setLayoutDefaultSpacing( e.attribute( "spacing", QString::number( formwindow->layoutDefaultSpacing() ) ).toInt() ); + formwindow->setLayoutDefaultMargin( e.attribute( "margin", QString::number( formwindow->layoutDefaultMargin() ) ).toInt() ); + } else if ( e.tagName() == "layoutfunctions" ) { + formwindow->setSpacingFunction( e.attribute( "spacing" ) ); + formwindow->setMarginFunction( e.attribute( "margin" ) ); + if ( !formwindow->marginFunction().isEmpty() || !formwindow->spacingFunction().isEmpty() ) + formwindow->hasLayoutFunctions( TRUE ); + } + + e = e.nextSibling().toElement(); + } + + if ( !imageCollection.isNull() ) + loadImageCollection( imageCollection ); + if ( !customWidgets.isNull() ) + loadCustomWidgets( customWidgets, this ); + +#if defined (QT_NON_COMMERCIAL) + bool previewMode = MainWindow::self ? MainWindow::self->isPreviewing() : FALSE; + QWidget *w = (QWidget*)createObject( widget, !previewMode ? (QWidget*)formwindow : MainWindow::self ); + if ( !w ) + return FALSE; + if ( previewMode ) + w->reparent( MainWindow::self, Qt::WType_TopLevel, w->pos(), TRUE ); +#else + if ( !createObject( widget, formwindow) ) + return FALSE; +#endif + + if ( !forwards.isNull() ) { + for ( QDomElement n = forwards.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + if ( n.tagName() == "forward" ) + metaForwards << n.firstChild().toText().data(); + } + + if ( !includes.isNull() ) { + for ( QDomElement n = includes.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + if ( n.tagName() == "include" ) { + if ( n.tagName() == "include" ) { + MetaDataBase::Include inc; + inc.location = "global"; + if ( n.attribute( "location" ) == "local" ) + inc.location = "local"; + inc.implDecl = "in declaration"; + if ( n.attribute( "impldecl" ) == "in implementation" ) + inc.implDecl = "in implementation"; + inc.header = n.firstChild().toText().data(); + if ( inc.header.right( 5 ) != ".ui.h" ) { + metaIncludes.append( inc ); + } else { + if ( formwindow->formFile() ) + formwindow->formFile()->setCodeFileState( FormFile::Ok ); + } + } + } + } + + if ( !variables.isNull() ) { + for ( QDomElement n = variables.firstChild().toElement(); !n.isNull(); + n = n.nextSibling().toElement() ) { + if ( n.tagName() == "variable" ) { + MetaDataBase::Variable v; + v.varName = n.firstChild().toText().data(); + v.varAccess = n.attribute( "access", "protected" ); + if ( v.varAccess.isEmpty() ) + v.varAccess = "protected"; + metaVariables << v; + } + } + } + if ( !signals.isNull() ) { + for ( QDomElement n = signals.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + if ( n.tagName() == "signal" ) + metaSignals << n.firstChild().toText().data(); + } + if ( !slots.isNull() ) { + for ( QDomElement n = slots.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + if ( n.tagName() == "slot" ) { + MetaDataBase::Function function; + function.specifier = n.attribute( "specifier", "virtual" ); + if ( function.specifier.isEmpty() ) + function.specifier = "virtual"; + function.access = n.attribute( "access", "public" ); + if ( function.access.isEmpty() ) + function.access = "public"; + function.language = n.attribute( "language", "C++" ); + function.returnType = n.attribute( "returnType", "void" ); + if ( function.returnType.isEmpty() ) + function.returnType = "void"; + function.type = "slot"; + function.function = n.firstChild().toText().data(); + if ( !MetaDataBase::hasFunction( formwindow, function.function, TRUE ) ) + MetaDataBase::addFunction( formwindow, function.function, function.specifier, + function.access, "slot", function.language, function.returnType ); + else + MetaDataBase::changeFunctionAttributes( formwindow, function.function, function.function, + function.specifier, function.access, + "slot", function.language, + function.returnType ); + } + } + + if ( !functions.isNull() ) { + for ( QDomElement n = functions.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "function" ) { + MetaDataBase::Function function; + function.specifier = n.attribute( "specifier", "virtual" ); + if ( function.specifier.isEmpty() ) + function.specifier = "virtual"; + function.access = n.attribute( "access", "public" ); + if ( function.access.isEmpty() ) + function.access = "public"; + function.type = n.attribute( "type", "function" ); + function.type = "function"; + function.language = n.attribute( "language", "C++" ); + function.returnType = n.attribute( "returnType", "void" ); + if ( function.returnType.isEmpty() ) + function.returnType = "void"; + function.function = n.firstChild().toText().data(); + if ( !MetaDataBase::hasFunction( formwindow, function.function, TRUE ) ) + MetaDataBase::addFunction( formwindow, function.function, function.specifier, + function.access, function.type, function.language, + function.returnType ); + else + MetaDataBase::changeFunctionAttributes( formwindow, function.function, function.function, + function.specifier, function.access, + function.type, function.language, function.returnType ); + } + } + } + + if ( !actions.isNull() ) + loadActions( actions ); + if ( !toolbars.isNull() ) + loadToolBars( toolbars ); + if ( !menubar.isNull() ) + loadMenuBar( menubar ); + + if ( !connections.isNull() ) + loadConnections( connections ); + + if ( !tabOrder.isNull() ) + loadTabOrder( tabOrder ); + + if ( formwindow ) { + MetaDataBase::setIncludes( formwindow, metaIncludes ); + MetaDataBase::setForwards( formwindow, metaForwards ); + MetaDataBase::setVariables( formwindow, metaVariables ); + MetaDataBase::setSignalList( formwindow, metaSignals ); + metaInfo.classNameChanged = metaInfo.className != QString( formwindow->name() ); + MetaDataBase::setMetaInfo( formwindow, metaInfo ); + MetaDataBase::setExportMacro( formwindow->mainContainer(), exportMacro ); + } + + loadExtraSource( formwindow->formFile(), currFileName, langIface, hasFunctions ); + + if ( mainwindow && formwindow ) + mainwindow->insertFormWindow( formwindow ); + + if ( formwindow ) { + formwindow->killAccels( formwindow ); + if ( formwindow->layout() ) + formwindow->layout()->activate(); + if ( hadGeometry ) + formwindow->resize( formwindow->size().expandedTo( formwindow->minimumSize(). + expandedTo( formwindow->minimumSizeHint() ) ) ); + else + formwindow->resize( formwindow->size().expandedTo( formwindow->sizeHint() ) ); + } + + return TRUE; +} + +static bool saveCode( const QString &filename, const QString &code ) +{ + QFile f( filename ); + if ( f.open(IO_WriteOnly | IO_Translate) ) { + QTextStream ts( &f ); + ts << code; + return TRUE; + } + return FALSE; +} + +bool Resource::save( const QString& filename, bool formCodeOnly ) +{ + if ( !formwindow || filename.isEmpty() ) + return FALSE; + if (!langIface) { + QString lang = "Qt Script"; + if ( mainwindow ) + lang = mainwindow->currProject()->language(); + langIface = MetaDataBase::languageInterface( lang ); + if ( langIface ) + langIface->addRef(); + } + if ( formCodeOnly && langIface ) { + if ( saveFormCode(formwindow->formFile(), langIface) ) + return TRUE; + bool breakout = FALSE; + FormFile *ff = formwindow->formFile(); + QString codeFile = ff->project()->makeAbsolute( ff->codeFile() ); + QString filter = langIface->fileFilterList().join("\n"); + while ( !breakout ) { + QString fn = KFileDialog::getSaveFileName( codeFile, filter ); + breakout = fn.isEmpty(); + if ( !breakout ) { + if ( saveCode(fn, ff->code()) ) + return TRUE; + } + } + } + currFileName = filename; + + QFile f( filename ); + if ( !f.open( IO_WriteOnly | IO_Translate ) ) + return FALSE; + bool b = save( &f ); + f.close(); + return b; +} + +bool Resource::save( QIODevice* dev ) +{ + if ( !formwindow ) + return FALSE; + + if ( !langIface ) { + QString lang = "C++"; + if ( mainwindow ) + lang = mainwindow->currProject()->language(); + langIface = MetaDataBase::languageInterface( lang ); + if ( langIface ) + langIface->addRef(); + } + + QTextStream ts( dev ); + ts.setCodec( QTextCodec::codecForName( "UTF-8" ) ); + + ts << "" << endl; + saveMetaInfoBefore( ts, 0 ); + saveObject( formwindow->mainContainer(), 0, ts, 0 ); + if ( ::qt_cast(formwindow->mainContainer()) ) { + saveMenuBar( (QMainWindow*)formwindow->mainContainer(), ts, 0 ); + saveToolBars( (QMainWindow*)formwindow->mainContainer(), ts, 0 ); + } + if ( !MetaDataBase::customWidgets()->isEmpty() && !usedCustomWidgets.isEmpty() ) + saveCustomWidgets( ts, 0 ); + if ( ::qt_cast(formwindow->mainContainer()) ) + saveActions( formwindow->actionList(), ts, 0 ); + if ( !images.isEmpty() ) + saveImageCollection( ts, 0 ); + if ( !MetaDataBase::connections( formwindow ).isEmpty() || + !MetaDataBase::slotList( formwindow ).isEmpty() ) + saveConnections( ts, 0 ); + saveTabOrder( ts, 0 ); + saveMetaInfoAfter( ts, 0 ); + saveIncludeHints( ts, 0 ); + ts << "" << endl; + bool ok = saveFormCode( formwindow->formFile(), langIface ); + images.clear(); + + return ok; +} + +QString Resource::copy() +{ + if ( !formwindow ) + return QString::null; + + copying = TRUE; + QString s; + QTextOStream ts( &s ); + + ts << "" << endl; + QWidgetList widgets = formwindow->selectedWidgets(); + QWidgetList tmp( widgets ); + for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { + QWidget *p = w->parentWidget(); + bool save = TRUE; + while ( p ) { + if ( tmp.findRef( p ) != -1 ) { + save = FALSE; + break; + } + p = p->parentWidget(); + } + if ( save ) + saveObject( w, 0, ts, 0 ); + } + if ( !MetaDataBase::customWidgets()->isEmpty() && !usedCustomWidgets.isEmpty() ) + saveCustomWidgets( ts, 0 ); + if ( !images.isEmpty() ) + saveImageCollection( ts, 0 ); + ts << "" << endl; + + return s; +} + + +void Resource::paste( const QString &cb, QWidget *parent ) +{ + if ( !formwindow ) + return; + mainContainerSet = TRUE; + + pasting = TRUE; + QDomDocument doc; + QString errMsg; + int errLine; + doc.setContent( cb, &errMsg, &errLine ); + + QDomElement firstWidget = doc.firstChild().toElement().firstChild().toElement(); + + QDomElement imageCollection = firstWidget; + images.clear(); + while ( imageCollection.tagName() != "images" && !imageCollection.isNull() ) + imageCollection = imageCollection.nextSibling().toElement(); + + QDomElement customWidgets = firstWidget; + while ( customWidgets.tagName() != "customwidgets" && !customWidgets.isNull() ) + customWidgets = customWidgets.nextSibling().toElement(); + + if ( !imageCollection.isNull() ) + loadImageCollection( imageCollection ); + if ( !customWidgets.isNull() ) + loadCustomWidgets( customWidgets, this ); + + QWidgetList widgets; + formwindow->clearSelection( FALSE ); + formwindow->setPropertyShowingBlocked( TRUE ); + formwindow->clearSelection( FALSE ); + while ( !firstWidget.isNull() ) { + if ( firstWidget.tagName() == "widget" ) { + QWidget *w = (QWidget*)createObject( firstWidget, parent, 0 ); + if ( !w ) + continue; + widgets.append( w ); + int x = w->x() + formwindow->grid().x(); + int y = w->y() + formwindow->grid().y(); + if ( w->x() + w->width() > parent->width() ) + x = QMAX( 0, parent->width() - w->width() ); + if ( w->y() + w->height() > parent->height() ) + y = QMAX( 0, parent->height() - w->height() ); + if ( x != w->x() || y != w->y() ) + w->move( x, y ); + formwindow->selectWidget( w ); + } else if ( firstWidget.tagName() == "spacer" ) { + QWidget *w = createSpacer( firstWidget, parent, 0, firstWidget.tagName() == "vspacer" ? Qt::Vertical : Qt::Horizontal ); + if ( !w ) + continue; + widgets.append( w ); + int x = w->x() + formwindow->grid().x(); + int y = w->y() + formwindow->grid().y(); + if ( w->x() + w->width() > parent->width() ) + x = QMAX( 0, parent->width() - w->width() ); + if ( w->y() + w->height() > parent->height() ) + y = QMAX( 0, parent->height() - w->height() ); + if ( x != w->x() || y != w->y() ) + w->move( x, y ); + formwindow->selectWidget( w ); + } + firstWidget = firstWidget.nextSibling().toElement(); + } + formwindow->setPropertyShowingBlocked( FALSE ); + formwindow->emitShowProperties(); + + PasteCommand *cmd = new PasteCommand( i18n( "Paste" ), formwindow, widgets ); + formwindow->commandHistory()->addCommand( cmd ); +} + +void Resource::saveObject( QObject *obj, QDesignerGridLayout* grid, QTextStream &ts, int indent ) +{ + if ( obj && obj->isWidgetType() && ( (QWidget*)obj )->isHidden() ) + return; + QString closeTag; + const char* className = WidgetFactory::classNameOf( obj ); + int classID = WidgetDatabase::idFromClassName( className ); + bool isPlugin = WidgetDatabase::isCustomPluginWidget( classID ); + if ( obj->isWidgetType() ) { + if ( obj->isA("CustomWidget") || isPlugin ) { + usedCustomWidgets << QString( className ); + includeHints << WidgetDatabase::includeFile( classID ); + } + + if ( obj != formwindow && !formwindow->widgets()->find( (QWidget*)obj ) ) + return; // we don't know anything about this thing + + QString attributes; + if ( grid ) { + QDesignerGridLayout::Item item = grid->items[ (QWidget*)obj ]; + attributes += QString(" row=\"") + QString::number(item.row) + "\""; + attributes += QString(" column=\"") + QString::number(item.column) + "\""; + if ( item.rowspan * item.colspan != 1 ) { + attributes += QString(" rowspan=\"") + QString::number(item.rowspan) + "\""; + attributes += QString(" colspan=\"") + QString::number(item.colspan) + "\""; + } + } + + if ( qstrcmp( className, "Spacer" ) == 0 ) { + closeTag = makeIndent( indent ) + "\n"; + ts << makeIndent( indent ) << "" << endl; + ++indent; + } else { + closeTag = makeIndent( indent ) + "\n"; + ts << makeIndent( indent ) << "" << endl; + ++indent; + } + if ( WidgetFactory::hasItems(classID, obj) ) + saveItems( obj, ts, indent ); + saveObjectProperties( obj, ts, indent ); + } else { + // test for other objects we created. Nothing so far. + return; + } + + QDesignerWidgetStack* ws = 0; + + if ( ::qt_cast(obj) ) { + QTabWidget* tw = (QTabWidget*) obj; + QObjectList* tmpl = tw->queryList( "QWidgetStack" ); + QWidgetStack *ws = (QWidgetStack*)tmpl->first(); + QTabBar *tb = ( (QDesignerTabWidget*)obj )->tabBar(); + for ( int i = 0; i < tb->count(); ++i ) { + QTab *t = tb->tabAt( i ); + if ( !t ) + continue; + QWidget *w = ws->widget( t->identifier() ); + if ( !w ) + continue; + if ( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf(w) ) == -1 ) + continue; // we don't know this widget + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( w->name() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( t->text() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + saveChildrenOf( w, ts, indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + delete tmpl; + } else if ( (ws = ::qt_cast(obj)) != 0 ) { + for ( int i = 0; i < ws->count(); ++i ) { + QWidget *w = ws->page( i ); + if ( !w ) + continue; + if ( WidgetDatabase::idFromClassName(WidgetFactory::classNameOf(w)) == -1 ) + continue; // we don't know this widget + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( w->name() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << QString::number(i) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + saveChildrenOf( w, ts, indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + } else if ( ::qt_cast(obj) ) { + QToolBox* tb = (QToolBox*)obj; + for ( int i = 0; i < tb->count(); ++i ) { + QWidget *w = tb->item( i ); + if ( !w ) + continue; + if ( WidgetDatabase::idFromClassName(WidgetFactory::classNameOf(w)) == -1 ) + continue; // we don't know this widget + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( w->name() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + saveEnumProperty( w, "backgroundMode", QVariant::Invalid, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( tb->itemLabel( tb->indexOf(w) ) ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + saveChildrenOf( w, ts, indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + } else if ( ::qt_cast(obj) ) { + QWizard* wiz = (QWizard*)obj; + for ( int i = 0; i < wiz->pageCount(); ++i ) { + QWidget *w = wiz->page( i ); + if ( !w ) + continue; + if ( WidgetDatabase::idFromClassName(WidgetFactory::classNameOf(w)) == -1 ) + continue; // we don't know this widget + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( w->name() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( wiz->title( w ) ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + saveChildrenOf( w, ts, indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + } else if ( ::qt_cast(obj) ) { + saveChildrenOf( ( (QMainWindow*)obj )->centralWidget(), ts, indent ); + } else { + bool saved = FALSE; +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + if ( isPlugin ) { + WidgetInterface *iface = 0; + widgetManager()->queryInterface( className, &iface ); + if ( iface ) { + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( iface2 ) { + if ( iface2->supportsPages( className ) ) { + QWidgetList containers = iface2->pages( className, (QWidget*)obj ); + if ( !containers.isEmpty() ) { + saved = TRUE; + int i = 0; + for ( QWidget *w = containers.first(); w; w = containers.next(), ++i ) { + if ( WidgetDatabase:: + idFromClassName( WidgetFactory::classNameOf( w ) ) == -1 ) + continue; // we don't know this widget + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( w->name() ) + << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" + << entitize( iface2->pageLabel( className, (QWidget*)obj, i ) ) + << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + saveChildrenOf( w, ts, indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + } + } else { + saved = TRUE; + QWidget *w = iface2->containerOfWidget( className, (QWidget*)obj ); + if ( obj != w ) { + ts << makeIndent( indent ) << "" << endl; + ++indent; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( w->name() ) + << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + saveChildrenOf( w, ts, indent ); + --indent; + ts << makeIndent( indent ) << "" << endl; + } + // Create a custom widget and then store it in the database + // so we can save the custom widgets. + MetaDataBase::CustomWidget *cw = new MetaDataBase::CustomWidget; + cw->className = className; + cw->includeFile = WidgetDatabase::includeFile( classID ); + QStrList lst = w->metaObject()->signalNames( TRUE ); + for ( QPtrListIterator it(lst); it.current(); ++it ) + cw->lstSignals.append(it.current()); + + int i; + int total = w->metaObject()->numProperties( TRUE ); + for ( i = 0; i < total; i++ ) { + const QMetaProperty *p = w->metaObject()->property( i, TRUE ); + if ( p->designable(w) ) { + MetaDataBase::Property prop; + prop.property = p->name(); + QString pType = p->type(); + // *sigh* designer types are not normal types + // Handle most cases, the ones it misses are + // probably too difficult to deal with anyway... + if ( pType.startsWith("Q") ) { + pType = pType.right( pType.length() - 1 ); + } else { + pType[0] = pType[0].upper(); + } + prop.type = pType; + cw->lstProperties.append( prop ); + } + } + + total = w->metaObject()->numSlots( TRUE ); + for ( i = 0; i < total; i++ ) { + const QMetaData *md = w->metaObject()->slot( i, TRUE ); + MetaDataBase::Function funky; + // Find out if we have a return type. + if ( md->method->count > 0 ) { + const QUParameter p = md->method->parameters[0]; + if ( p.inOut == QUParameter::InOut ) + funky.returnType = p.type->desc(); + } + + funky.function = md->name; + funky.language = "C++"; + switch ( md->access ) { + case QMetaData::Public: + funky.access = "public"; + break; + case QMetaData::Protected: + funky.access = "protected"; + break; + case QMetaData::Private: + funky.access = "private"; + break; + } + cw->lstSlots.append( funky ); + } + MetaDataBase::addCustomWidget( cw ); + } + iface2->release(); + } + iface->release(); + } + } +#endif // QT_CONTAINER_CUSTOM_WIDGETS + if ( !saved ) + saveChildrenOf( obj, ts, indent ); + } + + indent--; + ts << closeTag; +} + +void Resource::saveItems( QObject *obj, QTextStream &ts, int indent ) +{ + if ( ::qt_cast(obj) || ::qt_cast(obj) ) { + QListBox *lb = 0; + if ( ::qt_cast(obj) ) + lb = (QListBox*)obj; + else + lb = ( (QComboBox*)obj )->listBox(); + + QListBoxItem *i = lb->firstItem(); + for ( ; i; i = i->next() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QStringList text; + text << i->text(); + QPtrList pixmaps; + if ( i->pixmap() ) + pixmaps.append( i->pixmap() ); + saveItem( text, pixmaps, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } else if ( ::qt_cast(obj) ) { + QIconView *iv = (QIconView*)obj; + + QIconViewItem *i = iv->firstItem(); + for ( ; i; i = i->nextItem() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QStringList text; + text << i->text(); + QPtrList pixmaps; + if ( i->pixmap() ) + pixmaps.append( i->pixmap() ); + saveItem( text, pixmaps, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } else if ( ::qt_cast(obj) ) { + QListView *lv = (QListView*)obj; + int i; + for ( i = 0; i < lv->header()->count(); ++i ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QStringList l; + l << lv->header()->label( i ); + QPtrList pix; + pix.setAutoDelete( TRUE ); + if ( lv->header()->iconSet( i ) ) + pix.append( new QPixmap( lv->header()->iconSet( i )->pixmap() ) ); + saveItem( l, pix, ts, indent ); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << mkBool( lv->header()->isClickEnabled( i ) )<< "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << mkBool( lv->header()->isResizeEnabled( i ) ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + saveItem( lv->firstChild(), ts, indent - 1 ); + } +#if !defined (QT_NO_TABLE) + else if ( ::qt_cast(obj) ) { + QTable *table = (QTable*)obj; + int i; + QMap columnFields = MetaDataBase::columnFields( table ); +# ifndef QT_NO_SQL + bool isDataTable = ::qt_cast(table); +# else + bool isDataTable = false; +# endif + for ( i = 0; i < table->horizontalHeader()->count(); ++i ) { + if ( !table->horizontalHeader()->label( i ).isNull() && + table->horizontalHeader()->label( i ).toInt() != i + 1 || + table->horizontalHeader()->iconSet( i ) || + isDataTable ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QStringList l; + l << table->horizontalHeader()->label( i ); + QPtrList pix; + pix.setAutoDelete( TRUE ); + if ( table->horizontalHeader()->iconSet( i ) ) + pix.append( new QPixmap( table->horizontalHeader()->iconSet( i )->pixmap() ) ); + saveItem( l, pix, ts, indent ); + if ( isDataTable && !columnFields.isEmpty() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( *columnFields.find( l[ 0 ] ) ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } + for ( i = 0; i < table->verticalHeader()->count(); ++i ) { + if ( !table->verticalHeader()->label( i ).isNull() && + table->verticalHeader()->label( i ).toInt() != i + 1 || + table->verticalHeader()->iconSet( i ) ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QStringList l; + l << table->verticalHeader()->label( i ); + QPtrList pix; + pix.setAutoDelete( TRUE ); + if ( table->verticalHeader()->iconSet( i ) ) + pix.append( new QPixmap( table->verticalHeader()->iconSet( i )->pixmap() ) ); + saveItem( l, pix, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } + } +#endif +} + +void Resource::saveItem( QListViewItem *i, QTextStream &ts, int indent ) +{ + QListView *lv = i->listView(); + while ( i ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + + QPtrList pixmaps; + QStringList textes; + for ( int c = 0; c < lv->columns(); ++c ) { + pixmaps.append( i->pixmap( c ) ); + textes << i->text( c ); + } + saveItem( textes, pixmaps, ts, indent ); + + if ( i->firstChild() ) + saveItem( i->firstChild(), ts, indent ); + + indent--; + ts << makeIndent( indent ) << "" << endl; + i = i->nextSibling(); + } +} + +void Resource::savePixmap( const QPixmap &p, QTextStream &ts, int indent, const QString &tagname ) +{ + if ( p.isNull() ) { + ts << makeIndent( indent ) << "<" << tagname << ">" << endl; + return; + } + + if ( formwindow && formwindow->savePixmapInline() ) + ts << makeIndent( indent ) << "<" << tagname << ">" << saveInCollection( p ) << "" << endl; + else if ( formwindow && formwindow->savePixmapInProject() ) + ts << makeIndent( indent ) << "<" << tagname << ">" << MetaDataBase::pixmapKey( formwindow, p.serialNumber() ) + << "" << endl; + else + ts << makeIndent( indent ) << "<" << tagname << ">" << MetaDataBase::pixmapArgument( formwindow, p.serialNumber() ) + << "" << endl; +} + +QPixmap Resource::loadPixmap( const QDomElement &e, const QString &/*tagname*/ ) +{ + QString arg = e.firstChild().toText().data(); + + if ( formwindow && formwindow->savePixmapInline() ) { + QImage img = loadFromCollection( arg ); + QPixmap pix; + pix.convertFromImage( img ); + MetaDataBase::setPixmapArgument( formwindow, pix.serialNumber(), arg ); + return pix; + } else if ( formwindow && formwindow->savePixmapInProject() ) { + QPixmap pix; + if ( mainwindow && mainwindow->currProject() ) { + pix = mainwindow->currProject()->pixmapCollection()->pixmap( arg ); + } else { + pix = BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ); + // we have to force the pixmap to get a new and unique serial number. Unfortunately detatch() doesn't do that + pix.convertFromImage( pix.convertToImage() ); + } + + MetaDataBase::setPixmapKey( formwindow, pix.serialNumber(), arg ); + return pix; + } + QPixmap pix = BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ); + // we have to force the pixmap to get a new and unique serial number. Unfortunately detatch() doesn't do that + pix.convertFromImage( pix.convertToImage() ); + MetaDataBase::setPixmapArgument( formwindow, pix.serialNumber(), arg ); + return pix; +} + +void Resource::saveItem( const QStringList &text, + const QPtrList &pixmaps, QTextStream &ts, + int indent ) +{ + QStringList::ConstIterator it = text.begin(); + for ( ; it != text.end(); ++it ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( *it ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + + for ( int i = 0; i < (int)pixmaps.count(); ++i ) { + QPixmap *p = ( (QPtrList)pixmaps ).at( i ); + ts << makeIndent( indent ) << "" << endl; + indent++; + if ( p ) + savePixmap( *p, ts, indent ); + else + savePixmap( QPixmap(), ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } +} + +void Resource::saveChildrenOf( QObject* obj, QTextStream &ts, int indent ) +{ + const QObjectList *l = obj->children(); + if ( !l ) + return; // no children to save + + QString closeTag; + // if the widget has a layout we pretend that all widget's childs are childs of the layout - makes the structure nicer + QLayout *layout = 0; + QDesignerGridLayout* grid = 0; + if ( !::qt_cast(obj) && + WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( obj ) ) ) && + obj->isWidgetType() && + WidgetFactory::layoutType( (QWidget*)obj, layout ) != WidgetFactory::NoLayout ) { + WidgetFactory::LayoutType lay = WidgetFactory::layoutType( (QWidget*)obj, layout ); + switch ( lay ) { + case WidgetFactory::HBox: + closeTag = makeIndent( indent ) + ""; + ts << makeIndent( indent ) << "" << endl; + ++indent; + break; + case WidgetFactory::VBox: + closeTag = makeIndent( indent ) + ""; + ts << makeIndent( indent ) << "" << endl; + ++indent; + break; + case WidgetFactory::Grid: + closeTag = makeIndent( indent ) + ""; + ts << makeIndent( indent ) << "" << endl; + ++indent; + grid = (QDesignerGridLayout*) layout; + break; + default: + break; + } + + // save properties of layout + if ( lay != WidgetFactory::NoLayout ) + saveObjectProperties( layout, ts, indent ); + + } + + QObject *o = 0; + for ( QPtrListIterator it ( *l ); ( o = it.current() ); ++it ) + if ( !QString( o->name() ).startsWith( "qt_dead_widget_" ) ) + saveObject( o, grid, ts, indent ); + if ( !closeTag.isEmpty() ) { + indent--; + ts << closeTag << endl; + } +} + +void Resource::saveObjectProperties( QObject *w, QTextStream &ts, int indent ) +{ + QStringList saved; + QStringList changed; + changed = MetaDataBase::changedProperties( w ); + if ( w->isWidgetType() ) { + if ( ::qt_cast(w) ) { + if ( !changed.contains( "sizeHint" ) ) + changed << "sizeHint"; + if ( !changed.contains( "geometry" ) ) + changed << "geometry"; + } else { + QToolButton *tb = ::qt_cast(w); + if ( tb && !tb->iconSet().isNull() ) { + changed << "iconSet"; + } + } + } else if ( ::qt_cast(w) ) { + if ( MetaDataBase::spacing( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ) > -1 ) + changed << "spacing"; + if ( MetaDataBase::margin( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ) > -1 ) + changed << "margin"; + if ( MetaDataBase::resizeMode( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ) != "Auto" + && !MetaDataBase::resizeMode( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ).isEmpty() ) + changed << "resizeMode"; + } + + if ( w == formwindow->mainContainer() ) { + if ( changed.findIndex( "geometry" ) == -1 ) + changed << "geometry"; + if ( changed.findIndex( "caption" ) == -1 ) + changed << "caption"; + } + + if ( changed.isEmpty() ) + return; + + bool inLayout = w != formwindow->mainContainer() && !copying && w->isWidgetType() && ( (QWidget*)w )->parentWidget() && + WidgetFactory::layoutType( ( (QWidget*)w )->parentWidget() ) != WidgetFactory::NoLayout; + + QStrList lst = w->metaObject()->propertyNames( !::qt_cast(w) ); + for ( QPtrListIterator it( lst ); it.current(); ++it ) { + if ( changed.find( QString::fromLatin1( it.current() ) ) == changed.end() ) + continue; + if ( saved.find( QString::fromLatin1( it.current() ) ) != saved.end() ) + continue; + saved << QString::fromLatin1( it.current() ); + const QMetaProperty* p = w->metaObject()-> + property( w->metaObject()->findProperty( it.current(), TRUE ), TRUE ); + if ( !p || !p->stored( w ) || ( inLayout && qstrcmp( p->name(), "geometry" ) == 0 ) ) + continue; + if ( ::qt_cast(w) && qstrcmp( p->name(), "pixmap" ) == 0 && + ( !( (QLabel*)w )->pixmap() || ( (QLabel*)w )->pixmap()->isNull() ) ) + continue; + if ( ::qt_cast(w) && + ( qstrcmp( p->name(), "itemName" ) == 0 || qstrcmp( p->name(), "itemNumber" ) == 0 || + qstrcmp( p->name(), "itemText" ) == 0 ) ) + continue; + if ( qstrcmp( p->name(), "name" ) == 0 ) + knownNames << w->property( "name" ).toString(); + if ( !p->isSetType() && !p->isEnumType() && !w->property( p->name() ).isValid() ) + continue; + ts << makeIndent( indent ) << "stdSet() ) + ts << " stdset=\"0\""; + ts << ">" << endl; + indent++; + if ( strcmp( it.current(), "resizeMode" ) == 0 && ::qt_cast(w) ) { + saveProperty( w, it.current(), "", QVariant::String, ts, indent ); + } else if ( p->isSetType() ) { + saveSetProperty( w, it.current(), QVariant::nameToType( p->type() ), ts, indent ); + } else if ( p->isEnumType() ) { + saveEnumProperty( w, it.current(), QVariant::nameToType( p->type() ), ts, indent ); + } else { + saveProperty( w, it.current(), w->property( p->name() ), QVariant::nameToType( p->type() ), ts, indent ); + } + indent--; + ts << makeIndent( indent ) << "
      " << endl; + } + + if ( w->isWidgetType() && MetaDataBase::fakeProperties( w ) ) { + QMap* fakeProperties = MetaDataBase::fakeProperties( w ); + for ( QMap::Iterator fake = fakeProperties->begin(); + fake != fakeProperties->end(); ++fake ) { + if ( MetaDataBase::isPropertyChanged( w, fake.key() ) ) { + if ( w->inherits("CustomWidget") ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)w )->customWidget(); + if ( cw && !cw->hasProperty( fake.key().latin1() ) && fake.key() != "toolTip" && fake.key() != "whatsThis" ) + continue; + } + + ts << makeIndent( indent ) << "" << endl; + indent++; + saveProperty( w, fake.key(), *fake, (*fake).type(), ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } + } +} + +void Resource::saveSetProperty( QObject *w, const QString &name, QVariant::Type, QTextStream &ts, int indent ) +{ + const QMetaProperty *p = w->metaObject()->property( w->metaObject()->findProperty( name, TRUE ), TRUE ); + QStrList l( p->valueToKeys( w->property( name ).toInt() ) ); + QString v; + for ( uint i = 0; i < l.count(); ++i ) { + v += l.at( i ); + if ( i < l.count() - 1 ) + v += "|"; + } + ts << makeIndent( indent ) << "" << v << "" << endl; +} + +void Resource::saveEnumProperty( QObject *w, const QString &name, QVariant::Type, QTextStream &ts, int indent ) +{ + const QMetaProperty *p = w->metaObject()->property( w->metaObject()->findProperty( name, TRUE ), TRUE ); + ts << makeIndent( indent ) << "" << p->valueToKey( w->property( name ).toInt() ) << "" << endl; +} + +void Resource::saveProperty( QObject *w, const QString &name, const QVariant &value, QVariant::Type t, QTextStream &ts, int indent ) +{ + if ( name == "hAlign" || name =="vAlign" || name == "wordwrap" || + name == "layoutMargin" || name =="layoutSpacing" ) + return; + int num; + uint unum; + double dob; + QString comment; + if ( w && formwindow->widgets()->find( (QWidget*)w ) || formwindow->actionList().find( (QAction*)w ) ) + comment = MetaDataBase::propertyComment( w, name ); + switch ( t ) { + case QVariant::String: + if ( name == "resizeMode" ) { + QString resmod = MetaDataBase::resizeMode( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ); + if ( !resmod.isNull() && resmod != "Auto" ) { + ts << makeIndent( indent ) << ""; + ts << resmod; + ts << "" << endl; + } + + } else { + ts << makeIndent( indent ) << "" << entitize( value.toString() ) << "" << endl; + if ( !comment.isEmpty() ) + ts << makeIndent( indent ) << "" << entitize( comment ) << "" << endl; + } + break; + case QVariant::CString: + ts << makeIndent( indent ) << "" << entitize( value.toCString() ).latin1() << "" << endl; + break; + case QVariant::Bool: + ts << makeIndent( indent ) << "" << mkBool( value.toBool() ) << "" << endl; + break; + case QVariant::Int: + if ( ::qt_cast(w) ) { + num = -1; + if ( name == "spacing" ) + num = MetaDataBase::spacing( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ); + else if ( name == "margin" ) + num = MetaDataBase::margin( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)w ) ) ); + if ( num != -1 ) + ts << makeIndent( indent ) << "" << QString::number( num ) << "" << endl; + } else { + num = value.toInt(); + ts << makeIndent( indent ) << "" << QString::number( num ) << "" << endl; + } + break; + case QVariant::Double: + dob = value.toDouble(); + ts << makeIndent( indent ) << "" << QString::number( dob ) << "" << endl; + break; + case QVariant::KeySequence: + ts << makeIndent( indent ) << "" + << entitize(platformNeutralKeySequence(value.toKeySequence())) << "" << endl; + break; + case QVariant::UInt: + unum = value.toUInt(); + ts << makeIndent( indent ) << "" << QString::number( unum ) << "" << endl; + break; + case QVariant::Rect: { + QVariant v( value ); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << QString::number( v.toRect().x() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( v.toRect().y() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( v.toRect().width() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( v.toRect().height() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::Point: { + QVariant v( value ); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << QString::number( v.toPoint().x() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( v.toPoint().y() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::Size: { + QVariant v( value ); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << QString::number( v.toSize().width() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( v.toSize().height() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::Color: { + QVariant v( value ); + ts << makeIndent( indent ) << "" << endl; + indent++; + saveColor( ts, indent, v.toColor() ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::Font: { + QVariant v( value ); + ts << makeIndent( indent ) << "" << endl; + QFont f( qApp->font() ); + if ( w && w->isWidgetType() && ((QWidget*)w)->parentWidget() ) + f = ((QWidget*)w)->parentWidget()->font(); + QFont f2( v.toFont() ); + indent++; + if ( f.family() != f2.family() ) + ts << makeIndent( indent ) << "" << f2.family() << "" << endl; + if ( f.pointSize() != f2.pointSize() ) + ts << makeIndent( indent ) << "" << QString::number( f2.pointSize() ) << "" << endl; + if ( f.bold() != f2.bold() ) + ts << makeIndent( indent ) << "" << QString::number( (int)f2.bold() ) << "" << endl; + if ( f.italic() != f2.italic() ) + ts << makeIndent( indent ) << "" << QString::number( (int)f2.italic() ) << "" << endl; + if ( f.underline() != f2.underline() ) + ts << makeIndent( indent ) << "" << QString::number( (int)f2.underline() ) << "" << endl; + if ( f.strikeOut() != f2.strikeOut() ) + ts << makeIndent( indent ) << "" << QString::number( (int)f2.strikeOut() ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::SizePolicy: { + QSizePolicy sp( value.toSizePolicy() ); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << (int)sp.horData() << "" << endl; + ts << makeIndent( indent ) << "" << (int)sp.verData() << "" << endl; + ts << makeIndent( indent ) << "" << (int)sp.horStretch() << "" << endl; + ts << makeIndent( indent ) << "" << (int)sp.verStretch() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + break; + } + case QVariant::Pixmap: + savePixmap( value.toPixmap(), ts, indent ); + break; + case QVariant::IconSet: + savePixmap( value.toIconSet().pixmap(), ts, indent, "iconset" ); + break; + case QVariant::Image: + ts << makeIndent( indent ) << "" << saveInCollection( value.toImage() ) << "" << endl; + break; + case QVariant::Palette: { + QPalette p( value.toPalette() ); + ts << makeIndent( indent ) << "" << endl; + indent++; + + ts << makeIndent( indent ) << "" << endl; + indent++; + saveColorGroup( ts, indent, p.active() ); + indent--; + ts << makeIndent( indent ) << "" << endl; + + ts << makeIndent( indent ) << "" << endl; + indent++; + saveColorGroup( ts, indent, p.disabled() ); + indent--; + ts << makeIndent( indent ) << "" << endl; + + ts << makeIndent( indent ) << "" << endl; + indent++; + saveColorGroup( ts, indent, p.inactive() ); + indent--; + ts << makeIndent( indent ) << "" << endl; + + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::Cursor: + ts << makeIndent( indent ) << "" << value.toCursor().shape() << "" << endl; + break; + case QVariant::StringList: { + QStringList lst = value.toStringList(); + uint i = 0; + ts << makeIndent( indent ) << "" << endl; + indent++; + if ( !lst.isEmpty() ) { + for ( i = 0; i < lst.count(); ++i ) + ts << makeIndent( indent ) << "" << entitize( lst[ i ] ) << "" << endl; + } + indent--; + ts << makeIndent( indent ) << "" << endl; + } break; + case QVariant::Date: { + QDate d = value.toDate(); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << d.year() << "" << endl; + ts << makeIndent( indent ) << "" << d.month() << "" << endl; + ts << makeIndent( indent ) << "" << d.day() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + break; + } + case QVariant::Time: { + QTime t = value.toTime(); + ts << makeIndent( indent ) << "" << endl; + break; + } + case QVariant::DateTime: { + QDateTime dt = value.toDateTime(); + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << dt.date().year() << "" << endl; + ts << makeIndent( indent ) << "" << dt.date().month() << "" << endl; + ts << makeIndent( indent ) << "" << dt.date().day() << "" << endl; + ts << makeIndent( indent ) << "" << dt.time().hour() << "" << endl; + ts << makeIndent( indent ) << "" << dt.time().minute() << "" << endl; + ts << makeIndent( indent ) << "" << dt.time().second() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + break; + } + default: + qWarning( "saving the property %s of type %d not supported yet", name.latin1(), (int)t ); + } +} + +void Resource::saveColorGroup( QTextStream &ts, int indent, const QColorGroup &cg ) +{ + for( int r = 0 ; r < QColorGroup::NColorRoles ; r++ ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + saveColor( ts, indent, cg.color( (QColorGroup::ColorRole)r ) ); + indent--; + ts << makeIndent( indent ) << "" << endl; + QPixmap* pm = cg.brush( (QColorGroup::ColorRole)r ).pixmap(); + if ( pm && !pm->isNull() ) + savePixmap( *pm, ts, indent ); + } +} + +void Resource::saveColor( QTextStream &ts, int indent, const QColor &c ) +{ + ts << makeIndent( indent ) << "" << QString::number( c.red() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( c.green() ) << "" << endl; + ts << makeIndent( indent ) << "" << QString::number( c.blue() ) << "" << endl; +} + +QObject *Resource::createObject( const QDomElement &e, QWidget *parent, QLayout* layout ) +{ + lastItem = 0; + QDomElement n = e.firstChild().toElement(); + QWidget *w = 0; // the widget that got created + QObject *obj = 0; // gets the properties + + int row = e.attribute( "row" ).toInt(); + int col = e.attribute( "column" ).toInt(); + int rowspan = e.attribute( "rowspan" ).toInt(); + int colspan = e.attribute( "colspan" ).toInt(); + if ( rowspan < 1 ) + rowspan = 1; + if ( colspan < 1 ) + colspan = 1; + + QString className = e.attribute( "class", "QWidget" ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + QString parentClassName = WidgetFactory::classNameOf( parent ); + bool isPlugin = + WidgetDatabase::isCustomPluginWidget( WidgetDatabase::idFromClassName( parentClassName ) ); + if ( isPlugin ) + qWarning( "####### loading custom container widgets without page support not implemented!" ); + // ### TODO loading for custom container widgets without pages +#endif + if ( !className.isNull() ) { + obj = WidgetFactory::create( WidgetDatabase::idFromClassName( className ), parent, 0, FALSE ); + if ( !obj ) { + QMessageBox::critical( MainWindow::self, i18n( "Loading File" ), + i18n( "Error loading %1.\n" + "The widget %2 could not be created." ). + arg( currFileName ).arg( className ) ); + return 0; + } + if ( !mainContainerSet ) { + if ( formwindow ) + formwindow->setMainContainer( (QWidget*)obj ); + mainContainerSet = TRUE; + } + w = (QWidget*)obj; + if ( ::qt_cast(w) ) + w = ( (QMainWindow*)w )->centralWidget(); + if ( layout ) { + switch ( WidgetFactory::layoutType( layout ) ) { + case WidgetFactory::HBox: + ( (QHBoxLayout*)layout )->addWidget( w ); + break; + case WidgetFactory::VBox: + ( (QVBoxLayout*)layout )->addWidget( w ); + break; + case WidgetFactory::Grid: + ( (QDesignerGridLayout*)layout )->addMultiCellWidget( w, row, row + rowspan - 1, + col, col + colspan - 1 ); + break; + default: + break; + } + } + + if ( !toplevel ) + toplevel = w; + layout = 0; + + if ( w && formwindow ) { + if ( !parent || + ( !::qt_cast(parent) && + !::qt_cast(parent) && + !::qt_cast(parent) && + !::qt_cast(parent) +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + && !isPlugin +#endif + ) ) + formwindow->insertWidget( w, pasting ); + else if ( parent && + ( ::qt_cast(parent) || + ::qt_cast(parent) || + ::qt_cast(parent) || + ::qt_cast(parent) +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + || isPlugin +#endif + ) ) + MetaDataBase::addEntry( w ); + } + } + + QDomElement sizePolicyElement; + QObject *sizePolicyObject = 0; + + while ( !n.isNull() ) { + if ( n.tagName() == "spacer" ) { + createSpacer( n, w, layout, Qt::Horizontal ); + } else if ( n.tagName() == "widget" ) { + createObject( n, w, layout ); + } else if ( n.tagName() == "hbox" ) { + layout = WidgetFactory::createLayout( w, layout, WidgetFactory::HBox ); + obj = layout; + n = n.firstChild().toElement(); + continue; + } else if ( n.tagName() == "grid" ) { + layout = WidgetFactory::createLayout( w, layout, WidgetFactory::Grid ); + obj = layout; + n = n.firstChild().toElement(); + continue; + } else if ( n.tagName() == "vbox" ) { + layout = WidgetFactory::createLayout( w, layout, WidgetFactory::VBox ); + obj = layout; + n = n.firstChild().toElement(); + continue; + } else if ( n.tagName() == "property" && obj ) { + if ( n.attribute( "name" ) == "sizePolicy" ) { + // ### Evil hack ### Delay setting sizePolicy so it won't be overridden by other properties. + sizePolicyElement = n; + sizePolicyObject = obj; + } else { + setObjectProperty( obj, n.attribute( "name" ), n.firstChild().toElement() ); + } + } else if ( n.tagName() == "attribute" && w ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( ::qt_cast(parent) ) { + if ( attrib == "title" ) + ( (QTabWidget*)parent )->insertTab( w, v.toString() ); + } else if ( ::qt_cast(parent) ) { + if ( attrib == "id" ) + ( (QDesignerWidgetStack*)parent )->insertPage( w, v.toInt() ); + } else if ( ::qt_cast(parent) ) { + if ( attrib == "label" ) + ( (QToolBox*)parent )->addItem( w, v.toString() ); + } else if ( ::qt_cast(parent) ) { + if ( attrib == "title" ) + ( (QWizard*)parent )->addPage( w, v.toString() ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + } else if ( isPlugin ) { + if ( attrib == "label" ) { + WidgetInterface *iface = 0; + widgetManager()->queryInterface( parentClassName, &iface ); + if ( iface ) { + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( iface2 ) { + iface2->insertPage( parentClassName, + (QWidget*)parent, v.toString(), -1, w ); + iface2->release(); + } + iface->release(); + } + } +#endif // QT_CONTAINER_CUSTOM_WIDGETS + } + } else if ( n.tagName() == "item" ) { + createItem( n, w ); + } else if ( n.tagName() == "column" || n.tagName() =="row" ) { + createColumn( n, w ); + } + + n = n.nextSibling().toElement(); + } + + // ### Evil hack ### See description above. + if ( !sizePolicyElement.isNull() ) { + setObjectProperty( sizePolicyObject, + sizePolicyElement.attribute( "name" ), + sizePolicyElement.firstChild().toElement() ); + } + + if ( w->isWidgetType() ) + widgets.insert( w->name(), w ); + + return w; +} + +void Resource::createColumn( const QDomElement &e, QWidget *widget ) +{ + if ( !widget ) + return; + + if ( ::qt_cast(widget) && e.tagName() == "column" ) { + QListView *lv = (QListView*)widget; + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + bool hasPixmap = FALSE; + QString txt; + bool clickable = TRUE, resizable = TRUE; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + txt = v.toString(); + else if ( attrib == "pixmap" ) { + pix = loadPixmap( n.firstChild().toElement().toElement() ); + hasPixmap = !pix.isNull(); + } else if ( attrib == "clickable" ) + clickable = v.toBool(); + else if ( attrib == "resizable" ) + resizable = v.toBool(); + } + n = n.nextSibling().toElement(); + } + lv->addColumn( txt ); + int i = lv->header()->count() - 1; + if ( hasPixmap ) { + lv->header()->setLabel( i, pix, txt ); + } + if ( !clickable ) + lv->header()->setClickEnabled( clickable, i ); + if ( !resizable ) + lv->header()->setResizeEnabled( resizable, i ); + } +#ifndef QT_NO_TABLE + else if ( ::qt_cast(widget) ) { + QTable *table = (QTable*)widget; + bool isRow; + if ( ( isRow = e.tagName() == "row" ) ) + table->setNumRows( table->numRows() + 1 ); + else + table->setNumCols( table->numCols() + 1 ); + + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + bool hasPixmap = FALSE; + QString txt; + QString field; + QMap fieldMap = MetaDataBase::columnFields( table ); + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + txt = v.toString(); + else if ( attrib == "pixmap" ) { + hasPixmap = !n.firstChild().firstChild().toText().data().isEmpty(); + if ( hasPixmap ) + pix = loadPixmap( n.firstChild().toElement() ); + } else if ( attrib == "field" ) + field = v.toString(); + } + n = n.nextSibling().toElement(); + } + + int i = isRow ? table->numRows() - 1 : table->numCols() - 1; + QHeader *h = !isRow ? table->horizontalHeader() : table->verticalHeader(); + if ( hasPixmap ) + h->setLabel( i, pix, txt ); + else + h->setLabel( i, txt ); + if ( !isRow && !field.isEmpty() ) + fieldMap.insert( txt, field ); + MetaDataBase::setColumnFields( table, fieldMap ); + } +#endif +} + +void Resource::loadItem( const QDomElement &e, QPixmap &pix, QString &txt, bool &hasPixmap ) +{ + QDomElement n = e; + hasPixmap = FALSE; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + txt = v.toString(); + else if ( attrib == "pixmap" ) { + pix = loadPixmap( n.firstChild().toElement() ); + hasPixmap = !pix.isNull(); + } + } + n = n.nextSibling().toElement(); + } +} + +void Resource::createItem( const QDomElement &e, QWidget *widget, QListViewItem *i ) +{ + if ( !widget || !WidgetFactory::hasItems( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( widget ) ), widget ) ) + return; + + if ( ::qt_cast(widget) || ::qt_cast(widget) ) { + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + bool hasPixmap = FALSE; + QString txt; + loadItem( n, pix, txt, hasPixmap ); + QListBox *lb = 0; + if ( ::qt_cast(widget) ) + lb = (QListBox*)widget; + else + lb = ( (QComboBox*)widget)->listBox(); + if ( hasPixmap ) { + new QListBoxPixmap( lb, pix, txt ); + } else { + new QListBoxText( lb, txt ); + } + } else if ( ::qt_cast(widget) ) { + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + bool hasPixmap = FALSE; + QString txt; + loadItem( n, pix, txt, hasPixmap ); + QIconView *iv = (QIconView*)widget; + if ( hasPixmap ) + new QIconViewItem( iv, txt, pix ); + else + new QIconViewItem( iv, txt ); + } else if ( ::qt_cast(widget) ) { + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + QValueList pixmaps; + QStringList textes; + QListViewItem *item = 0; + QListView *lv = (QListView*)widget; + if ( i ) + item = new QListViewItem( i, lastItem ); + else + item = new QListViewItem( lv, lastItem ); + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + textes << v.toString(); + else if ( attrib == "pixmap" ) { + QString s = v.toString(); + if ( s.isEmpty() ) { + pixmaps << QPixmap(); + } else { + pix = loadPixmap( n.firstChild().toElement() ); + pixmaps << pix; + } + } + } else if ( n.tagName() == "item" ) { + item->setOpen( TRUE ); + createItem( n, widget, item ); + } + + n = n.nextSibling().toElement(); + } + + for ( int i = 0; i < lv->columns(); ++i ) { + item->setText( i, textes[ i ] ); + item->setPixmap( i, pixmaps[ i ] ); + } + lastItem = item; + } +} + +QWidget *Resource::createSpacer( const QDomElement &e, QWidget *parent, QLayout *layout, Qt::Orientation o ) +{ + QDomElement n = e.firstChild().toElement(); + int row = e.attribute( "row" ).toInt(); + int col = e.attribute( "column" ).toInt(); + int rowspan = e.attribute( "rowspan" ).toInt(); + int colspan = e.attribute( "colspan" ).toInt(); + if ( rowspan < 1 ) + rowspan = 1; + if ( colspan < 1 ) + colspan = 1; + + Spacer *spacer = (Spacer*) WidgetFactory::create( WidgetDatabase::idFromClassName("Spacer"), + parent, "spacer", FALSE); + spacer->setOrientation( o ); + spacer->setInteraciveMode( FALSE ); + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) + setObjectProperty( spacer, n.attribute( "name" ), n.firstChild().toElement() ); + n = n.nextSibling().toElement(); + } + spacer->setInteraciveMode( TRUE ); + if ( formwindow ) + formwindow->insertWidget( spacer, pasting ); + if ( layout ) { + if ( ::qt_cast(layout) ) + ( (QBoxLayout*)layout )->addWidget( spacer, 0, spacer->alignment() ); + else + ( (QDesignerGridLayout*)layout )->addMultiCellWidget( spacer, row, row + rowspan - 1, col, col + colspan - 1, + spacer->alignment() ); + } + return spacer; +} + +/*! + Attention: this function has to be in sync with Uic::setObjectProperty(). If you change one, change both. +*/ +void Resource::setObjectProperty( QObject* obj, const QString &prop, const QDomElement &e ) +{ + const QMetaProperty *p = obj->metaObject()->property( obj->metaObject()->findProperty( prop, TRUE ), TRUE ); + + if ( !::qt_cast(obj) ) {// no layouts in metadatabase... (RS) + if ( obj->inherits( "CustomWidget" ) ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)obj )->customWidget(); + if ( cw && !cw->hasProperty( prop.latin1() ) && !p && prop != "toolTip" && prop != "whatsThis" ) + return; + } + MetaDataBase::setPropertyChanged( obj, prop, TRUE ); + } + + QVariant defVarient; + if ( e.tagName() == "font" ) { + QFont f( qApp->font() ); + if ( obj->isWidgetType() && ( (QWidget*)obj )->parentWidget() ) + f = ( (QWidget*)obj )->parentWidget()->font(); + defVarient = QVariant( f ); + } + + QString comment; + QVariant v( DomTool::elementToVariant( e, defVarient, comment ) ); + + if ( !comment.isEmpty() ) { + MetaDataBase::addEntry( obj ); + MetaDataBase::setPropertyComment( obj, prop, comment ); + } + + if ( e.tagName() == "pixmap" ) { + QPixmap pix = loadPixmap( e ); + if ( pix.isNull() ) + return; + v = QVariant( pix ); + } else if ( e.tagName() == "iconset" ) { + QPixmap pix = loadPixmap( e, "iconset" ); + if ( pix.isNull() ) + return; + v = QVariant( QIconSet( pix ) ); + } else if ( e.tagName() == "image" ) { + v = QVariant( loadFromCollection( v.toString() ) ); + } + + if ( !p ) { + MetaDataBase::setFakeProperty( obj, prop, v ); + if ( obj->isWidgetType() ) { + if ( prop == "database" && obj != toplevel ) { + QStringList lst = MetaDataBase::fakeProperty( obj, "database" ).toStringList(); + if ( lst.count() > 2 ) + dbControls.insert( obj->name(), lst[ 2 ] ); + else if ( lst.count() == 2 ) + dbTables.insert( obj->name(), lst ); + } + return; + } + } + + if ( e.tagName() == "palette" ) { + QDomElement n = e.firstChild().toElement(); + QPalette p; + while ( !n.isNull() ) { + QColorGroup cg; + if ( n.tagName() == "active" ) { + cg = loadColorGroup( n ); + p.setActive( cg ); + } else if ( n.tagName() == "inactive" ) { + cg = loadColorGroup( n ); + p.setInactive( cg ); + } else if ( n.tagName() == "disabled" ) { + cg = loadColorGroup( n ); + p.setDisabled( cg ); + } + n = n.nextSibling().toElement(); + } + v = QPalette( p ); + } else if ( e.tagName() == "enum" && p && p->isEnumType() && prop != "resizeMode" ) { + QString key( v.toString() ); + int vi = p->keyToValue( key ); + if ( p->valueToKey( vi ) != key ) + return; // ignore invalid properties + v = QVariant( vi ); + } else if ( e.tagName() == "set" && p && p->isSetType() ) { + QString keys( v.toString() ); + QStringList lst = QStringList::split( '|', keys ); + QStrList l; + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + l.append( *it ); + v = QVariant( p->keysToValue( l ) ); + } + + if ( prop == "caption" ) { + QCString s1 = v.toCString(); + QString s2 = v.toString(); + if ( !s2.isEmpty() ) + formwindow->setCaption( s2 ); + else if ( !s1.isEmpty() ) + formwindow->setCaption( s1 ); + } + if ( prop == "icon" ) { + formwindow->setIcon( v.toPixmap() ); + QString pmk = MetaDataBase::pixmapKey( formwindow, v.toPixmap().serialNumber() ); + MetaDataBase::setPixmapKey( formwindow, + formwindow->icon()->serialNumber(), pmk ); + } + + if ( prop == "geometry" ) { + if ( obj == toplevel ) { + hadGeometry = TRUE; + toplevel->resize( v.toRect().size() ); + return; + } else if ( obj == formwindow->mainContainer() ) { + hadGeometry = TRUE; + formwindow->resize( v.toRect().size() ); + return; + } + } + + if ( ::qt_cast(obj) ) { + if ( prop == "spacing" ) { + MetaDataBase::setSpacing( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)obj ) ), v.toInt() ); + return; + } else if ( prop == "margin" ) { + MetaDataBase::setMargin( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)obj ) ), v.toInt() ); + return; + } else if ( e.tagName() == "enum" && prop == "resizeMode" ) { + MetaDataBase::setResizeMode( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (QLayout*)obj ) ), v.toString() ); + return; + } + } + + if ( prop == "name" ) { + if ( pasting ) { + QString s = v.toString(); + formwindow->unify( (QWidget*)obj, s, TRUE ); + obj->setName( s ); + return; + } else if ( formwindow && obj == formwindow->mainContainer() ) { + formwindow->setName( v.toCString() ); + } + } + + if ( prop == "sizePolicy" ) { + QSizePolicy sp = v.toSizePolicy(); + sp.setHeightForWidth( ( (QWidget*)obj )->sizePolicy().hasHeightForWidth() ); + } + + if ( prop == "cursor" ) + MetaDataBase::setCursor( (QWidget*)obj, v.toCursor() ); + + obj->setProperty( prop, v ); +} + + +QString Resource::saveInCollection( const QImage &img ) +{ + QString imgName = "none"; + QValueList::Iterator it = images.begin(); + for ( ; it != images.end(); ++it ) { + if ( img == ( *it ).img ) { + imgName = ( *it ).name; + break; + } + } + + if ( imgName == "none" ) { + Image i; + imgName = "image" + QString::number( images.count() ); + i.name = imgName; + i.img = img; + images.append( i ); + } + return imgName; +} + +void Resource::saveImageData( const QImage &img, QTextStream &ts, int indent ) +{ + QByteArray ba; + QBuffer buf( ba ); + buf.open( IO_WriteOnly | IO_Translate ); + QString format; + bool compress = FALSE; + if (img.hasAlphaBuffer()) { + format = "PNG"; + } else { + format = img.depth() > 1 ? "XPM" : "XBM"; + compress = TRUE; + } + QImageIO iio( &buf, format ); + iio.setImage( img ); + iio.write(); + buf.close(); + QByteArray bazip = ba; + int i = 0; + if (compress) { + bazip = qCompress( ba ); + format += ".GZ"; + // The first 4 bytes in qCompress() are the length of the unzipped + // format. The XPM.GZ format does not use these. + i = 4; + } + ulong len = bazip.size(); + ts << makeIndent( indent ) << ""; + static const char hexchars[] = "0123456789abcdef"; + for (; i < (int)len; ++i ) { + uchar s = (uchar) bazip[i]; + ts << hexchars[s >> 4]; + ts << hexchars[s & 0x0f]; + } + ts << "" << endl; +} + +void Resource::saveImageCollection( QTextStream &ts, int indent ) +{ + ts << makeIndent( indent ) << "" << endl; + indent++; + + QValueList::Iterator it = images.begin(); + for ( ; it != images.end(); ++it ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + saveImageData( (*it).img, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +static QImage loadImageData( QDomElement &n2 ) +{ + QImage img; + QString data = n2.firstChild().toText().data(); + const int lengthOffset = 4; + int baSize = data.length() / 2 + lengthOffset; + uchar *ba = new uchar[ baSize ]; + for ( int i = lengthOffset; i < baSize; ++i ) { + char h = data[ 2 * (i-lengthOffset) ].latin1(); + char l = data[ 2 * (i-lengthOffset) + 1 ].latin1(); + uchar r = 0; + if ( h <= '9' ) + r += h - '0'; + else + r += h - 'a' + 10; + r = r << 4; + if ( l <= '9' ) + r += l - '0'; + else + r += l - 'a' + 10; + ba[ i ] = r; + } + QString format = n2.attribute( "format", "PNG" ); + if ( format == "XPM.GZ" || format == "XBM.GZ" ) { + ulong len = n2.attribute( "length" ).toULong(); + if ( len < data.length() * 5 ) + len = data.length() * 5; + // qUncompress() expects the first 4 bytes to be the expected length of + // the uncompressed data + ba[0] = ( len & 0xff000000 ) >> 24; + ba[1] = ( len & 0x00ff0000 ) >> 16; + ba[2] = ( len & 0x0000ff00 ) >> 8; + ba[3] = ( len & 0x000000ff ); + QByteArray baunzip = qUncompress( ba, baSize ); + img.loadFromData( (const uchar*)baunzip.data(), baunzip.size(), format.left(format.find('.')) ); + } else { + img.loadFromData( (const uchar*)ba+lengthOffset, baSize-lengthOffset, format ); + } + delete [] ba; + return img; +} + +void Resource::loadImageCollection( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "image" ) { + Image img; + img.name = n.attribute( "name" ); + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "data" ) + img.img = loadImageData( n2 ); + n2 = n2.nextSibling().toElement(); + } + images.append( img ); + n = n.nextSibling().toElement(); + } + } +} + +QImage Resource::loadFromCollection( const QString &name ) +{ + QValueList::Iterator it = images.begin(); + for ( ; it != images.end(); ++it ) { + if ( ( *it ).name == name ) + return ( *it ).img; + } + return QImage(); +} + +void Resource::saveConnections( QTextStream &ts, int indent ) +{ + QValueList connections = MetaDataBase::connections( formwindow ); + if ( connections.isEmpty() ) + return; + ts << makeIndent( indent ) << "" << endl; + indent++; + QValueList::Iterator it = connections.begin(); + for ( ; it != connections.end(); ++it ) { + MetaDataBase::Connection conn = *it; + if ( ( knownNames.findIndex( QString( conn.sender->name() ) ) == -1 && + qstrcmp( conn.sender->name(), "this" ) != 0 ) || + ( knownNames.findIndex( QString( conn.receiver->name() ) ) == -1 && + qstrcmp( conn.receiver->name(), "this" ) != 0 ) ) + continue; + if ( formwindow->isMainContainer( (QWidget*)(*it).receiver ) && + !MetaDataBase::hasSlot( formwindow, MetaDataBase::normalizeFunction( (*it).slot ).latin1() ) ) + continue; + + if ( conn.sender->inherits( "CustomWidget" ) ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)conn.sender )->customWidget(); + if ( cw && !cw->hasSignal( conn.signal ) ) + continue; + } + + if ( conn.receiver->inherits( "CustomWidget" ) && !formwindow->isMainContainer( conn.receiver ) ) { + MetaDataBase::CustomWidget *cw = ( (CustomWidget*)conn.receiver )->customWidget(); + if ( cw && !cw->hasSlot( MetaDataBase::normalizeFunction( conn.slot ).latin1() ) ) + continue; + } + + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << entitize( conn.sender->name() ) << "" << endl; + ts << makeIndent( indent ) << "" << entitize( conn.signal ) << "" << endl; + ts << makeIndent( indent ) << "" << entitize( conn.receiver->name() ) << "" << endl; + ts << makeIndent( indent ) << "" << entitize( MetaDataBase::normalizeFunction( conn.slot ) ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + + QString lang = formwindow->project()->language(); + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +void Resource::loadConnections( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "connection" ) { + QString lang = n.attribute( "language", "C++" ); + QDomElement n2 = n.firstChild().toElement(); + MetaDataBase::Connection conn; + while ( !n2.isNull() ) { + if ( n2.tagName() == "sender" ) { + conn.sender = 0; + QString name = n2.firstChild().toText().data(); + if ( name == "this" || qstrcmp( toplevel->name(), name ) == 0 ) { + conn.sender = toplevel; + } else { + if ( name == "this" ) + name = toplevel->name(); + QObjectList *l = toplevel->queryList( 0, name, FALSE ); + if ( l ) { + if ( l->first() ) + conn.sender = l->first(); + delete l; + l = 0; + } + if ( !conn.sender ) + conn.sender = formwindow->findAction( name ); + } + } else if ( n2.tagName() == "signal" ) { + conn.signal = n2.firstChild().toText().data(); + } else if ( n2.tagName() == "receiver" ) { + conn.receiver = 0; + QString name = n2.firstChild().toText().data(); + if ( name == "this" || qstrcmp( toplevel->name(), name ) == 0 ) { + conn.receiver = toplevel; + } else { + QObjectList *l = toplevel->queryList( 0, name, FALSE ); + if ( l ) { + if ( l->first() ) + conn.receiver = l->first(); + delete l; + l = 0; + } + if ( !conn.receiver ) + conn.receiver = formwindow->findAction( name ); + } + } else if ( n2.tagName() == "slot" ) { + conn.slot = n2.firstChild().toText().data(); + } + n2 = n2.nextSibling().toElement(); + } + if ( formwindow ) { + if ( conn.sender == formwindow ) + conn.sender = formwindow->mainContainer(); + if ( conn.receiver == formwindow ) + conn.receiver = formwindow->mainContainer(); + } + if ( conn.sender && conn.receiver ) { + if ( lang == "C++" ) { + MetaDataBase::addConnection( formwindow ? formwindow : toplevel, + conn.sender, conn.signal, conn.receiver, conn.slot ); + } + } + } else if ( n.tagName() == "slot" ) { // compatibility with 2.x + MetaDataBase::Function slot; + slot.specifier = n.attribute( "specifier", "virtual" ); + if ( slot.specifier.isEmpty() ) + slot.specifier = "virtual"; + slot.access = n.attribute( "access", "public" ); + if ( slot.access.isEmpty() ) + slot.access = "public"; + slot.language = n.attribute( "language", "C++" ); + slot.returnType = n.attribute( "returnType", "void" ); + if ( slot.returnType.isEmpty() ) + slot.returnType = "void"; + slot.function = n.firstChild().toText().data(); + if ( !MetaDataBase::hasFunction( formwindow, slot.function, TRUE ) ) + MetaDataBase::addFunction( formwindow, slot.function, slot.specifier, + slot.access, "slot", slot.language, slot.returnType ); + else + MetaDataBase::changeFunctionAttributes( formwindow, slot.function, slot.function, + slot.specifier, slot.access, + "slot", slot.language, slot.returnType ); + } + n = n.nextSibling().toElement(); + } +} + +void Resource::saveCustomWidgets( QTextStream &ts, int indent ) +{ + ts << makeIndent( indent ) << "" << endl; + indent++; + + QPtrList *lst = MetaDataBase::customWidgets(); + for ( MetaDataBase::CustomWidget *w = lst->first(); w; w = lst->next() ) { + if ( usedCustomWidgets.findIndex( w->className ) == -1 ) + continue; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << w->className << "" << endl; + ts << makeIndent( indent ) << "
      includePolicy == MetaDataBase::CustomWidget::Local ? "local" : "global" ) + << "\">" << w->includeFile << "
      " << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << w->sizeHint.width() << "" << endl; + ts << makeIndent( indent ) << "" << w->sizeHint.height() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << (int)w->isContainer << "" << endl; + ts << makeIndent( indent ) << "" << endl; + indent++; + ts << makeIndent( indent ) << "" << (int)w->sizePolicy.horData() << "" << endl; + ts << makeIndent( indent ) << "" << (int)w->sizePolicy.verData() << "" << endl; + ts << makeIndent( indent ) << "" << (int)w->sizePolicy.horStretch() << "" << endl; + ts << makeIndent( indent ) << "" << (int)w->sizePolicy.verStretch() << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + ts << makeIndent( indent ) << "" << saveInCollection( w->pixmap->convertToImage() ) << "" << endl; + if ( !w->lstSignals.isEmpty() ) { + for ( QValueList::Iterator it = w->lstSignals.begin(); it != w->lstSignals.end(); ++it ) + ts << makeIndent( indent ) << "" << entitize( *it ) << "" << endl; + } + if ( !w->lstSlots.isEmpty() ) { + for ( QValueList::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) + ts << makeIndent( indent ) << "" << entitize( (*it).function ) << "" << endl; + } + if ( !w->lstProperties.isEmpty() ) { + for ( QValueList::Iterator it = w->lstProperties.begin(); it != w->lstProperties.end(); ++it ) + ts << makeIndent( indent ) << "" << entitize( (*it).property ) << "" << endl; + } + indent--; + ts << makeIndent( indent ) << "
      " << endl; + } + + + indent--; + ts << makeIndent( indent ) << "
      " << endl; +} + +void Resource::loadCustomWidgets( const QDomElement &e, Resource *r ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "customwidget" ) { + QDomElement n2 = n.firstChild().toElement(); + MetaDataBase::CustomWidget *w = new MetaDataBase::CustomWidget; + while ( !n2.isNull() ) { + if ( n2.tagName() == "class" ) { + w->className = n2.firstChild().toText().data(); + } else if ( n2.tagName() == "header" ) { + w->includeFile = n2.firstChild().toText().data(); + QString s = n2.attribute( "location" ); + if ( s != "local" ) + w->includePolicy = MetaDataBase::CustomWidget::Global; + else + w->includePolicy = MetaDataBase::CustomWidget::Local; + } else if ( n2.tagName() == "sizehint" ) { + QDomElement n3 = n2.firstChild().toElement(); + while ( !n3.isNull() ) { + if ( n3.tagName() == "width" ) + w->sizeHint.setWidth( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "height" ) + w->sizeHint.setHeight( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + } else if ( n2.tagName() == "sizepolicy" ) { + QDomElement n3 = n2.firstChild().toElement(); + while ( !n3.isNull() ) { + if ( n3.tagName() == "hordata" ) + w->sizePolicy.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "verdata" ) + w->sizePolicy.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "horstretch" ) + w->sizePolicy.setHorStretch( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "verstretch" ) + w->sizePolicy.setVerStretch( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + } else if ( n2.tagName() == "pixmap" ) { + QPixmap pix; + if ( r ) { + pix = r->loadPixmap( n2 ); + } else { + QDomElement n3 = n2.firstChild().toElement(); + QImage img; + while ( !n3.isNull() ) { + if ( n3.tagName() == "data" ) { + img = loadImageData( n3 ); + } + n3 = n3.nextSibling().toElement(); + } + pix.convertFromImage( img ); + } + w->pixmap = new QPixmap( pix ); + } else if ( n2.tagName() == "signal" ) { + w->lstSignals.append( n2.firstChild().toText().data().latin1() ); + } else if ( n2.tagName() == "container" ) { + w->isContainer = (bool)n2.firstChild().toText().data().toInt(); + } else if ( n2.tagName() == "slot" ) { + MetaDataBase::Function function; + function.function = n2.firstChild().toText().data().latin1(); + function.access = n2.attribute( "access" ); + function.type = "slot"; + w->lstSlots.append( function ); + } else if ( n2.tagName() == "property" ) { + MetaDataBase::Property property; + property.property = n2.firstChild().toText().data().latin1(); + property.type = n2.attribute( "type" ); + w->lstProperties.append( property ); + } + n2 = n2.nextSibling().toElement(); + } + MetaDataBase::addCustomWidget( w ); + } + n = n.nextSibling().toElement(); + } +} + +void Resource::saveTabOrder( QTextStream &ts, int indent ) +{ + QWidgetList l = MetaDataBase::tabOrder( toplevel ); + if ( l.isEmpty() ) + return; + + ts << makeIndent( indent ) << "" << endl; + indent++; + + for ( QWidget *w = l.first(); w; w = l.next() ) { + if ( w->testWState( Qt::WState_ForceHide ) || knownNames.findIndex( w->name() ) == -1 ) + continue; + ts << makeIndent( indent ) << "" << w->name() << "" << endl; + } + + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +void Resource::loadTabOrder( const QDomElement &e ) +{ + QWidget *last = 0; + QDomElement n = e.firstChild().toElement(); + QWidgetList widgets; + while ( !n.isNull() ) { + if ( n.tagName() == "tabstop" ) { + QString name = n.firstChild().toText().data(); + if ( name.isEmpty() ) + continue; + QObjectList *l = toplevel->queryList( 0, name, FALSE ); + if ( l ) { + if ( l->first() ) { + QWidget *w = (QWidget*)l->first(); + widgets.append( w ); + if ( last ) + toplevel->setTabOrder( last, w ); + last = w; + } + delete l; + } + } + n = n.nextSibling().toElement(); + } + + if ( !widgets.isEmpty() ) + MetaDataBase::setTabOrder( toplevel, widgets ); +} + +void Resource::saveMetaInfoBefore( QTextStream &ts, int indent ) +{ + MetaDataBase::MetaInfo info = MetaDataBase::metaInfo( formwindow ); + QString cn; + if ( info.classNameChanged && !info.className.isEmpty() ) + cn = info.className; + else + cn = formwindow->name(); + ts << makeIndent( indent ) << "" << entitize( cn ) << "" << endl; + if ( !info.comment.isEmpty() ) + ts << makeIndent( indent ) << "" << entitize( info.comment ) << "" << endl; + if ( !info.author.isEmpty() ) + ts << makeIndent( indent ) << "" << entitize( info.author ) << "" << endl; +} + +void Resource::saveMetaInfoAfter( QTextStream &ts, int indent ) +{ + MetaDataBase::MetaInfo info = MetaDataBase::metaInfo( formwindow ); + if ( !langIface || formwindow->project()->isCpp() ) { + QValueList includes = MetaDataBase::includes( formwindow ); + QString extensionInclude; + bool needExtensionInclude = FALSE; + if ( langIface && + formwindow->formFile()->hasFormCode() && + formwindow->formFile()->codeFileState() != FormFile::Deleted ) { + extensionInclude = QFileInfo( currFileName ).fileName() + langIface->formCodeExtension(); + needExtensionInclude = TRUE; + } + if ( !includes.isEmpty() || needExtensionInclude ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + + for ( QValueList::Iterator it = includes.begin(); it != includes.end(); ++it ) { + ts << makeIndent( indent ) << "" << (*it).header << "" << endl; + if ( needExtensionInclude ) + needExtensionInclude = (*it).header != extensionInclude; + } + + if ( needExtensionInclude ) + ts << makeIndent( indent ) << "" + << extensionInclude << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + + QStringList forwards = MetaDataBase::forwards( formwindow ); + if ( !forwards.isEmpty() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + for ( QStringList::Iterator it2 = forwards.begin(); it2 != forwards.end(); ++it2 ) + ts << makeIndent( indent ) << "" << entitize( *it2 ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + QValueList varLst = MetaDataBase::variables( formwindow ); + if ( !varLst.isEmpty() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + + QValueList::Iterator it = varLst.begin(); + for ( ; it != varLst.end(); ++it ) { + ts << makeIndent( indent ) << "" << entitize( (*it).varName ) << "
      " << endl; + } + indent--; + ts << makeIndent( indent ) << "" << endl; + } + QStringList sigs = MetaDataBase::signalList( formwindow ); + if ( !sigs.isEmpty() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + for ( QStringList::Iterator it3 = sigs.begin(); it3 != sigs.end(); ++it3 ) + ts << makeIndent( indent ) << "" << entitize( *it3 ) << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; + } + + QValueList slotList = MetaDataBase::slotList( formwindow ); + if ( !slotList.isEmpty() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QString lang = formwindow->project()->language(); + QValueList::Iterator it = slotList.begin(); + for ( ; it != slotList.end(); ++it ) { + MetaDataBase::Function function = *it; + ts << makeIndent( indent ) << "" << entitize( function.function ) << "" << endl; + } + indent--; + ts << makeIndent( indent ) << "" << endl; + } + + QValueList functionList = MetaDataBase::functionList( formwindow, TRUE ); + if ( !functionList.isEmpty() ) { + ts << makeIndent( indent ) << "" << endl; + indent++; + QString lang = formwindow->project()->language(); + QValueList::Iterator it = functionList.begin(); + for ( ; it != functionList.end(); ++it ) { + MetaDataBase::Function function = *it; + ts << makeIndent( indent ) << "" << entitize( function.function ) << "
      " << endl; + } + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } + + if ( formwindow && formwindow->savePixmapInline() ) + ; + else if ( formwindow && formwindow->savePixmapInProject() ) + ts << makeIndent( indent ) << "" << endl; + else + ts << makeIndent( indent ) << "" << formwindow->pixmapLoaderFunction() << "" << endl; + if ( !( exportMacro = MetaDataBase::exportMacro( formwindow->mainContainer() ) ).isEmpty() ) + ts << makeIndent( indent ) << "" << exportMacro << "" << endl; + if ( formwindow ) { + ts << makeIndent( indent ) << "layoutDefaultSpacing() + << "\" margin=\"" << formwindow->layoutDefaultMargin() << "\"/>" << endl; + if ( formwindow->hasLayoutFunctions() ) { + QString s = ""; + QString m = ""; + if ( !formwindow->spacingFunction().isEmpty() ) + s = QString( " spacing=\"%1\"" ).arg( formwindow->spacingFunction() ); + if ( !formwindow->marginFunction().isEmpty() ) + m = QString( " margin=\"%1\"" ).arg( formwindow->marginFunction() ); + ts << makeIndent( indent ) << "" << endl; + } + } +} + +void Resource::saveIncludeHints( QTextStream &ts, int indent ) +{ + if ( includeHints.isEmpty() ) + return; + ts << makeIndent( indent ) << "" << endl; + indent++; + for ( QStringList::Iterator it = includeHints.begin(); it != includeHints.end(); ++it ) + ts << makeIndent( indent ) << "" << *it << "" << endl; + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +QColorGroup Resource::loadColorGroup( const QDomElement &e ) +{ + QColorGroup cg; + int r = -1; + QDomElement n = e.firstChild().toElement(); + QColor col; + while ( !n.isNull() ) { + if ( n.tagName() == "color" ) { + r++; + cg.setColor( (QColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); + } else if ( n.tagName() == "pixmap" ) { + QPixmap pix = loadPixmap( n ); + cg.setBrush( (QColorGroup::ColorRole)r, QBrush( col, pix ) ); + } + n = n.nextSibling().toElement(); + } + return cg; +} + +void Resource::saveChildActions( QAction *a, QTextStream &ts, int indent ) +{ + if ( !a->children() ) + return; + QObjectListIt it( *a->children() ); + while ( it.current() ) { + QObject *o = it.current(); + ++it; + if ( !::qt_cast(o) ) + continue; + QAction *ac = (QAction*)o; + bool isGroup = ::qt_cast(ac); + if ( isGroup ) + ts << makeIndent( indent ) << "" << endl; + else + ts << makeIndent( indent ) << "" << endl; + indent++; + saveObjectProperties( ac, ts, indent ); + indent--; + if ( isGroup ) { + indent++; + saveChildActions( ac, ts, indent ); + indent--; + } + if ( isGroup ) + ts << makeIndent( indent ) << "" << endl; + else + ts << makeIndent( indent ) << "" << endl; + } +} + +void Resource::saveActions( const QPtrList &actions, QTextStream &ts, int indent ) +{ + if ( actions.isEmpty() ) + return; + ts << makeIndent( indent ) << "" << endl; + indent++; + QPtrListIterator it( actions ); + while ( it.current() ) { + QAction *a = it.current(); + bool isGroup = ::qt_cast(a); + if ( isGroup ) + ts << makeIndent( indent ) << "" << endl; + else + ts << makeIndent( indent ) << "" << endl; + indent++; + saveObjectProperties( a, ts, indent ); + indent--; + if ( isGroup ) { + indent++; + saveChildActions( a, ts, indent ); + indent--; + } + if ( isGroup ) + ts << makeIndent( indent ) << "" << endl; + else + ts << makeIndent( indent ) << "" << endl; + ++it; + } + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +void Resource::loadChildAction( QObject *parent, const QDomElement &e ) +{ + QDomElement n = e; + QAction *a = 0; + if ( n.tagName() == "action" ) { + a = new QDesignerAction( parent ); + MetaDataBase::addEntry( a ); + QDomElement n2 = n.firstChild().toElement(); + bool hasMenuText = FALSE; + while ( !n2.isNull() ) { + if ( n2.tagName() == "property" ) { + QDomElement n3(n2); // don't modify n2 + QString prop = n3.attribute( "name" ); + if (prop == "menuText") + hasMenuText = TRUE; + QDomElement value(n3.firstChild().toElement()); + setObjectProperty( a, prop, value ); + if (!hasMenuText && uiFileVersion < "3.3" && prop == "text") + setObjectProperty( a, "menuText", value ); + } + n2 = n2.nextSibling().toElement(); + } + if ( !::qt_cast(parent) ) + formwindow->actionList().append( a ); + } else if ( n.tagName() == "actiongroup" ) { + a = new QDesignerActionGroup( parent ); + MetaDataBase::addEntry( a ); + QDomElement n2 = n.firstChild().toElement(); + bool hasMenuText = FALSE; + while ( !n2.isNull() ) { + if ( n2.tagName() == "property" ) { + QDomElement n3(n2); // don't modify n2 + QString prop = n3.attribute( "name" ); + if (prop == "menuText") + hasMenuText = TRUE; + QDomElement value = n3.firstChild().toElement(); + setObjectProperty( a, prop, value ); + if (!hasMenuText && uiFileVersion < "3.3" && prop == "text") + setObjectProperty( a, "menuText", value ); + } else if ( n2.tagName() == "action" || + n2.tagName() == "actiongroup" ) { + loadChildAction( a, n2 ); + } + n2 = n2.nextSibling().toElement(); + } + if ( !::qt_cast(parent) ) + formwindow->actionList().append( a ); + } +} + +void Resource::loadActions( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "action" ) { + loadChildAction( formwindow, n ); + } else if ( n.tagName() == "actiongroup" ) { + loadChildAction( formwindow, n ); + } + n = n.nextSibling().toElement(); + } +} + +void Resource::saveToolBars( QMainWindow *mw, QTextStream &ts, int indent ) +{ + ts << makeIndent( indent ) << "" << endl; + indent++; + + QPtrList tbList; + for ( int i = 0; i <= (int)Qt::DockMinimized; ++i ) { + tbList = mw->toolBars( (Qt::Dock)i ); + if ( tbList.isEmpty() ) + continue; + for ( QToolBar *tb = tbList.first(); tb; tb = tbList.next() ) { + if ( tb->isHidden() ) + continue; + ts << makeIndent( indent ) << "" << endl; + indent++; + saveObjectProperties( tb, ts, indent ); + QPtrList actionList = ( (QDesignerToolBar*)tb )->insertedActions(); + for ( QAction *a = actionList.first(); a; a = actionList.next() ) { + if ( ::qt_cast(a) ) { + ts << makeIndent( indent ) << "" << endl; + } else { + if ( ::qt_cast(a) && !( (QDesignerAction*)a )->supportsMenu() ) { + QWidget *w = ( (QDesignerAction*)a )->widget(); + ts << makeIndent( indent ) << "" << endl; + indent++; + const char *className = WidgetFactory::classNameOf( w ); + if ( w->isA( "CustomWidget" ) ) + usedCustomWidgets << QString( className ); + if ( WidgetFactory::hasItems( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ), w ) ) + saveItems( w, ts, indent ); + saveObjectProperties( w, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } else { + ts << makeIndent( indent ) << "name() << "\"/>" << endl; + } + } + } + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +void Resource::saveMenuBar( QMainWindow *mw, QTextStream &ts, int indent ) +{ + MenuBarEditor *mb = (MenuBarEditor *)mw->child( 0, "MenuBarEditor" ); + if ( !mb ) + return; + ts << makeIndent( indent ) << "" << endl; + indent++; + MetaDataBase::setPropertyChanged( mb, "name", TRUE ); // FIXME: remove + saveObjectProperties( mb, ts, indent ); + + for ( int i = 0; i < (int)mb->count(); ++i ) { + MenuBarEditorItem *m = mb->item( i ); + if ( !m ) + continue; + if ( m->isSeparator() ) { + ts << makeIndent( indent ) << "" << endl; + } else { + ts << makeIndent( indent ) << "menuText() ) + << "\" name=\"" << entitize( m->menu()->name() ) << "\">" << endl; + indent++; + savePopupMenu( m->menu(), mw, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } + indent--; + ts << makeIndent( indent ) << "" << endl; +} + +void Resource::savePopupMenu( PopupMenuEditor *pm, QMainWindow *mw, QTextStream &ts, int indent ) +{ + for ( PopupMenuEditorItem *i = pm->items()->first(); i; i = pm->items()->next() ) { + QAction *a = i->action(); + if ( ::qt_cast(a) ) + ts << makeIndent( indent ) << "" << endl; + else if ( ::qt_cast(a) ) + ts << makeIndent( indent ) << "name() << "\"/>" << endl; + else if ( ::qt_cast(a) ) + ts << makeIndent( indent ) << "name() << "\"/>" << endl; + PopupMenuEditor *s = i->subMenu(); + if ( s && s->count() ) { + QString n = s->name(); + ts << makeIndent( indent ) << "menuText() ) + << "\" name=\"" << entitize( n ) + << "\" accel=\"" << entitize( a->accel() ) + << "\">" << endl; + indent++; + savePopupMenu( s, mw, ts, indent ); + indent--; + ts << makeIndent( indent ) << "" << endl; + } + } +} + +void Resource::loadToolBars( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + QMainWindow *mw = ( (QMainWindow*)formwindow->mainContainer() ); + QDesignerToolBar *tb = 0; + while ( !n.isNull() ) { + if ( n.tagName() == "toolbar" ) { + Qt::Dock dock = (Qt::Dock)n.attribute( "dock" ).toInt(); + tb = new QDesignerToolBar( mw, dock ); + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "action" ) { + QAction *a = formwindow->findAction( n2.attribute( "name" ) ); + if ( a ) { + a->addTo( tb ); + tb->addAction( a ); + } + } else if ( n2.tagName() == "separator" ) { + QAction *a = new QSeparatorAction( 0 ); + a->addTo( tb ); + tb->addAction( a ); + } else if ( n2.tagName() == "widget" ) { + QWidget *w = (QWidget*)createObject( n2, tb ); + QDesignerAction *a = new QDesignerAction( w, tb ); + a->addTo( tb ); + tb->addAction( a ); + tb->installEventFilters( w ); + } else if ( n2.tagName() == "property" ) { + setObjectProperty( tb, n2.attribute( "name" ), n2.firstChild().toElement() ); + } + n2 = n2.nextSibling().toElement(); + } + } + n = n.nextSibling().toElement(); + } +} + +void Resource::loadMenuBar( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + QMainWindow *mw = (QMainWindow*)formwindow->mainContainer(); + MenuBarEditor *mb = new MenuBarEditor( formwindow, mw ); + MetaDataBase::addEntry( mb ); + while ( !n.isNull() ) { + if ( n.tagName() == "item" ) { + PopupMenuEditor * popup = new PopupMenuEditor( formwindow, mw ); + loadPopupMenu( popup, n ); + popup->setName( n.attribute( "name" ) ); + mb->insertItem( n.attribute( "text" ), popup ); + MetaDataBase::addEntry( popup ); + } else if ( n.tagName() == "property" ) { + setObjectProperty( mb, n.attribute( "name" ), n.firstChild().toElement() ); + } else if ( n.tagName() == "separator" ) { + mb->insertSeparator(); + } + n = n.nextSibling().toElement(); + } +} + +void Resource::loadPopupMenu( PopupMenuEditor *p, const QDomElement &e ) +{ + MetaDataBase::addEntry( p ); + QDomElement n = e.firstChild().toElement(); + QAction *a = 0; + while ( !n.isNull() ) { + if ( n.tagName() == "action" || n.tagName() == "actiongroup") { + a = formwindow->findAction( n.attribute( "name" ) ); + if ( a ) + p->insert( a ); + } + if ( n.tagName() == "item" ) { + PopupMenuEditorItem *i = p->at( p->find( a ) ); + if ( i ) { + QString name = n.attribute( "name" ); + formwindow->unify( i, name, TRUE ); + i->setName( name ); + MetaDataBase::addEntry( i ); + loadPopupMenu( i->subMenu(), n ); + } + } else if ( n.tagName() == "separator" ) { + a = new QSeparatorAction( 0 ); + p->insert( a ); + } + n = n.nextSibling().toElement(); + } +} + +bool Resource::saveFormCode( FormFile *formfile, LanguageInterface * /*langIface*/ ) +{ + QString lang = formfile->project()->language(); + if ( formfile->hasTempFileName() || + formfile->code().isEmpty() || + !formfile->hasFormCode() || + !formfile->isModified(FormFile::WFormCode) ) + return TRUE; // There is no code to be saved. + return saveCode( formfile->project()->makeAbsolute(formfile->codeFile()), + formfile->code() ); +} + +void Resource::loadExtraSource( FormFile *formfile, const QString &currFileName, + LanguageInterface *langIface, bool hasFunctions ) +{ + QString lang = "Qt Script"; + if ( MainWindow::self ) + lang = MainWindow::self->currProject()->language(); + LanguageInterface *iface = langIface; + if ( hasFunctions || !iface ) + return; + QValueList functions; + QStringList forwards; + QStringList includesImpl; + QStringList includesDecl; + QStringList vars; + QValueList connections; + + iface->loadFormCode( formfile->formName(), + currFileName + iface->formCodeExtension(), + functions, + vars, + connections ); + + QFile f( formfile->project()->makeAbsolute( formfile->codeFile() ) ); + QString code; + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + code = ts.read(); + } + formfile->setCode( code ); + + if ( !MainWindow::self || !MainWindow::self->currProject()->isCpp() ) + MetaDataBase::setupConnections( formfile, connections ); + + for ( QValueList::Iterator fit = functions.begin(); + fit != functions.end(); ++fit ) { + + if ( MetaDataBase::hasFunction( formfile->formWindow() ? + (QObject*)formfile->formWindow() : + (QObject*)formfile, + (*fit).name.latin1() ) ) { + QString access = (*fit).access; + if ( !MainWindow::self || !MainWindow::self->currProject()->isCpp() ) + MetaDataBase::changeFunction( formfile->formWindow() ? + (QObject*)formfile->formWindow() : + (QObject*)formfile, + (*fit).name, + (*fit).name, + QString::null ); + } else { + QString access = (*fit).access; + if ( access.isEmpty() ) + access = "protected"; + QString type = "function"; + if ( (*fit).returnType == "void" ) + type = "slot"; + MetaDataBase::addFunction( formfile->formWindow() ? + (QObject*)formfile->formWindow() : + (QObject*)formfile, + (*fit).name.latin1(), "virtual", (*fit).access, + type, lang, (*fit).returnType ); + } + } +} diff --git a/kdevdesigner/designer/resource.h b/kdevdesigner/designer/resource.h new file mode 100644 index 00000000..abf21cc2 --- /dev/null +++ b/kdevdesigner/designer/resource.h @@ -0,0 +1,165 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef RESOURCE_H +#define RESOURCE_H + +#include +#include +#include +#include +#include +#include "actiondnd.h" + +#include "metadatabase.h" + +class QWidget; +class QObject; +class QLayout; +class QStyle; +class QPalette; +class FormWindow; +class MainWindow; +class QDomElement; +class QDesignerGridLayout; +class QListViewItem; +class QMainWindow; +struct LanguageInterface; +class FormFile; +class Project; +class PopupMenuEditor; + +class Resource +{ +public: + struct Image { + QImage img; + QString name; + bool operator==( const Image &i ) const { + return ( i.name == name && + i.img == img ); + } + }; + + Resource(); + Resource( MainWindow* mw ); + ~Resource(); + + void setWidget( FormWindow *w ); + QWidget *widget() const; + + bool load( FormFile *ff, Project *defProject = 0 ); + bool load( FormFile *ff, QIODevice*, Project *defProject = 0 ); + QString copy(); + + bool save( const QString& filename, bool formCodeOnly = FALSE); + bool save( QIODevice* ); + void paste( const QString &cb, QWidget *parent ); + + static void saveImageData( const QImage &img, QTextStream &ts, int indent ); + static void loadCustomWidgets( const QDomElement &e, Resource *r ); + static void loadExtraSource( FormFile *formfile, const QString &currFileName, + LanguageInterface *langIface, bool hasFunctions ); + static bool saveFormCode( FormFile *formfile, LanguageInterface *langIface ); + +private: + void saveObject( QObject *obj, QDesignerGridLayout* grid, QTextStream &ts, int indent ); + void saveChildrenOf( QObject* obj, QTextStream &ts, int indent ); + void saveObjectProperties( QObject *w, QTextStream &ts, int indent ); + void saveSetProperty( QObject *w, const QString &name, QVariant::Type t, QTextStream &ts, int indent ); + void saveEnumProperty( QObject *w, const QString &name, QVariant::Type t, QTextStream &ts, int indent ); + void saveProperty( QObject *w, const QString &name, const QVariant &value, QVariant::Type t, QTextStream &ts, int indent ); + void saveProperty( const QVariant &value, QTextStream &ts, int indent ); + void saveItems( QObject *obj, QTextStream &ts, int indent ); + void saveItem( const QStringList &text, const QPtrList &pixmaps, QTextStream &ts, int indent ); + void saveItem( QListViewItem *i, QTextStream &ts, int indent ); + void saveConnections( QTextStream &ts, int indent ); + void saveCustomWidgets( QTextStream &ts, int indent ); + void saveTabOrder( QTextStream &ts, int indent ); + void saveColorGroup( QTextStream &ts, int indent, const QColorGroup &cg ); + void saveColor( QTextStream &ts, int indent, const QColor &c ); + void saveMetaInfoBefore( QTextStream &ts, int indent ); + void saveMetaInfoAfter( QTextStream &ts, int indent ); + void saveIncludeHints( QTextStream &ts, int indent ); + void savePixmap( const QPixmap &p, QTextStream &ts, int indent, const QString &tagname = "pixmap" ); + void saveActions( const QPtrList &actions, QTextStream &ts, int indent ); + void saveChildActions( QAction *a, QTextStream &ts, int indent ); + void saveToolBars( QMainWindow *mw, QTextStream &ts, int indent ); + void saveMenuBar( QMainWindow *mw, QTextStream &ts, int indent ); + void savePopupMenu( PopupMenuEditor *pm, QMainWindow *mw, QTextStream &ts, int indent ); + + QObject *createObject( const QDomElement &e, QWidget *parent, QLayout* layout = 0 ); + QWidget *createSpacer( const QDomElement &e, QWidget *parent, QLayout *layout, Qt::Orientation o ); + void createItem( const QDomElement &e, QWidget *widget, QListViewItem *i = 0 ); + void createColumn( const QDomElement &e, QWidget *widget ); + void setObjectProperty( QObject* widget, const QString &prop, const QDomElement &e); + QString saveInCollection( const QImage &img ); + QString saveInCollection( const QPixmap &pix ) { return saveInCollection( pix.convertToImage() ); } + QImage loadFromCollection( const QString &name ); + void saveImageCollection( QTextStream &ts, int indent ); + void loadImageCollection( const QDomElement &e ); + void loadConnections( const QDomElement &e ); + void loadTabOrder( const QDomElement &e ); + void loadItem( const QDomElement &n, QPixmap &pix, QString &txt, bool &hasPixmap ); + void loadActions( const QDomElement &n ); + void loadChildAction( QObject *parent, const QDomElement &e ); + void loadToolBars( const QDomElement &n ); + void loadMenuBar( const QDomElement &n ); + void loadPopupMenu( PopupMenuEditor *pm, const QDomElement &e ); + QColorGroup loadColorGroup( const QDomElement &e ); + QPixmap loadPixmap( const QDomElement &e, const QString &tagname = "pixmap" ); + +private: + MainWindow *mainwindow; + FormWindow *formwindow; + QWidget* toplevel; + QValueList images; + bool copying, pasting; + bool mainContainerSet; + QStringList knownNames; + QStringList usedCustomWidgets; + QListViewItem *lastItem; + + QValueList metaIncludes; + QValueList metaVariables; + QStringList metaForwards; + QStringList metaSignals; + MetaDataBase::MetaInfo metaInfo; + QMap dbControls; + QMap dbTables; + QMap widgets; + QString exportMacro; + bool hadGeometry; + QMap > langConnections; + QString currFileName; + LanguageInterface *langIface; + bool hasFunctions; + QStringList includeHints; + + QString uiFileVersion; +}; + +#endif diff --git a/kdevdesigner/designer/richtextfontdialog.ui b/kdevdesigner/designer/richtextfontdialog.ui new file mode 100644 index 00000000..c55343ad --- /dev/null +++ b/kdevdesigner/designer/richtextfontdialog.ui @@ -0,0 +1,347 @@ + +RichTextFontDialog +********************************************************************* +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + RichTextFontDialog + + + + 0 + 0 + 255 + 158 + + + + Font Properties + + + true + + + + unnamed + + + 11 + + + 6 + + + + Layout6 + + + + unnamed + + + 0 + + + 6 + + + + + default + + + + fontCombo + + + + + TextLabel1_2 + + + &Font: + + + fontCombo + + + + + TextLabel2 + + + Rel. &size: + + + fontSizeCombo + + + + + Spacer13 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1 + + + C&olor: + + + colorButton + + + + + + 0 + + + + + -4 + + + + + -3 + + + + + -2 + + + + + -1 + + + + + +1 + + + + + +2 + + + + + +3 + + + + + +4 + + + + fontSizeCombo + + + true + + + AtTop + + + + + colorButton + + + + 0 + 0 + 0 + 0 + + + + + 40 + 20 + + + + + 0 + 0 + 0 + + + + TabFocus + + + + + + + + + + Spacer14 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + Layout15 + + + + unnamed + + + 0 + + + 6 + + + + Spacer12 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okButton + + + &OK + + + + + cancelButton + + + &Cancel + + + + + + + + + colorButton + clicked() + RichTextFontDialog + selectColor() + + + okButton + clicked() + RichTextFontDialog + accept() + + + cancelButton + clicked() + RichTextFontDialog + reject() + + + + fontCombo + fontSizeCombo + colorButton + okButton + cancelButton + + + richtextfontdialog.ui.h + + + QString font + QColor color + QString size + + + init() + selectColor() + accept() + reject() + getSize() + getColor() + getFont() + + + diff --git a/kdevdesigner/designer/richtextfontdialog.ui.h b/kdevdesigner/designer/richtextfontdialog.ui.h new file mode 100644 index 00000000..8a3dd4c8 --- /dev/null +++ b/kdevdesigner/designer/richtextfontdialog.ui.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ +#include +#include + +void RichTextFontDialog::init() +{ + QFontDatabase *db = new QFontDatabase(); + fontCombo->insertStringList( db->families() ); +} + +void RichTextFontDialog::selectColor() +{ + color = QColorDialog::getColor( "", this ); + if( color.isValid() ) + colorButton->setPaletteBackgroundColor( color ); +} + +void RichTextFontDialog::accept() +{ + size = fontSizeCombo->currentText(); + font = fontCombo->currentText(); + done( Accepted ); +} + +void RichTextFontDialog::reject() +{ + done( Rejected ); +} + +QString RichTextFontDialog::getSize() +{ + return size; +} + +QString RichTextFontDialog::getColor() +{ + return color.name(); +} + +QString RichTextFontDialog::getFont() +{ + return font; +} diff --git a/kdevdesigner/designer/sizehandle.cpp b/kdevdesigner/designer/sizehandle.cpp new file mode 100644 index 00000000..a63a3404 --- /dev/null +++ b/kdevdesigner/designer/sizehandle.cpp @@ -0,0 +1,388 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler needs this here + +#include "sizehandle.h" +#include "formwindow.h" +#include "widgetfactory.h" + +#include +#include +#include +#include + +SizeHandle::SizeHandle( FormWindow *parent, Direction d, WidgetSelection *s ) + : QWidget( parent ) +{ + active = TRUE; + setBackgroundMode( active ? PaletteText : PaletteDark ); + setFixedSize( 6, 6 ); + widget = 0; + dir =d ; + setMouseTracking( FALSE ); + formWindow = parent; + sel = s; + updateCursor(); +} + +void SizeHandle::updateCursor() +{ + if ( !active ) { + setCursor( arrowCursor ); + return; + } + + switch ( dir ) { + case LeftTop: + setCursor( sizeFDiagCursor ); + break; + case Top: + setCursor( sizeVerCursor ); + break; + case RightTop: + setCursor( sizeBDiagCursor ); + break; + case Right: + setCursor( sizeHorCursor ); + break; + case RightBottom: + setCursor( sizeFDiagCursor ); + break; + case Bottom: + setCursor( sizeVerCursor ); + break; + case LeftBottom: + setCursor( sizeBDiagCursor ); + break; + case Left: + setCursor( sizeHorCursor ); + break; + } +} + +void SizeHandle::setActive( bool a ) +{ + active = a; + setBackgroundMode( active ? PaletteText : PaletteDark ); + updateCursor(); +} + +void SizeHandle::setWidget( QWidget *w ) +{ + widget = w; +} + +void SizeHandle::paintEvent( QPaintEvent * ) +{ + if ( ( (FormWindow*)parentWidget() )->currentWidget() != widget ) + return; + QPainter p( this ); + p.setPen( blue ); + p.drawRect( 0, 0, width(), height() ); +} + +void SizeHandle::mousePressEvent( QMouseEvent *e ) +{ + if ( !widget || e->button() != LeftButton || !active ) + return; + oldPressPos = e->pos(); + geom = origGeom = QRect( widget->pos(), widget->size() ); +} + +void SizeHandle::mouseMoveEvent( QMouseEvent *e ) +{ + if ( !widget || ( e->state() & LeftButton ) != LeftButton || !active ) + return; + QPoint rp = mapFromGlobal( e->globalPos() ); + QPoint d = oldPressPos - rp; + oldPressPos = rp; + QPoint checkPos = widget->parentWidget()->mapFromGlobal( e->globalPos() ); + QRect pr = widget->parentWidget()->rect(); + + // ##### move code around a bit to reduce duplicated code here + switch ( dir ) { + case LeftTop: { + if ( checkPos.x() > pr.width() - 2 * width() || checkPos.y() > pr.height() - 2 * height() ) + return; + int w = geom.width() + d.x(); + geom.setWidth( w ); + w = ( w / formWindow->grid().x() ) * formWindow->grid().x(); + int h = geom.height() + d.y(); + geom.setHeight( h ); + h = ( h / formWindow->grid().y() ) * formWindow->grid().y(); + int dx = widget->width() - w; + int dy = widget->height() - h; + trySetGeometry( widget, widget->x() + dx, widget->y() + dy, w, h ); + } break; + case Top: { + if ( checkPos.y() > pr.height() - 2 * height() ) + return; + int h = geom.height() + d.y(); + geom.setHeight( h ); + h = ( h / formWindow->grid().y() ) * formWindow->grid().y(); + int dy = widget->height() - h; + trySetGeometry( widget, widget->x(), widget->y() + dy, widget->width(), h ); + } break; + case RightTop: { + if ( checkPos.x() < 2 * width() || checkPos.y() > pr.height() - 2 * height() ) + return; + int h = geom.height() + d.y(); + geom.setHeight( h ); + h = ( h / formWindow->grid().y() ) * formWindow->grid().y(); + int dy = widget->height() - h; + int w = geom.width() - d.x(); + geom.setWidth( w ); + w = ( w / formWindow->grid().x() ) * formWindow->grid().x(); + trySetGeometry( widget, widget->x(), widget->y() + dy, w, h ); + } break; + case Right: { + if ( checkPos.x() < 2 * width() ) + return; + int w = geom.width() - d.x(); + geom.setWidth( w ); + w = ( w / formWindow->grid().x() ) * formWindow->grid().x(); + tryResize( widget, w, widget->height() ); + } break; + case RightBottom: { + if ( checkPos.x() < 2 * width() || checkPos.y() < 2 * height() ) + return; + int w = geom.width() - d.x(); + geom.setWidth( w ); + w = ( w / formWindow->grid().x() ) * formWindow->grid().x(); + int h = geom.height() - d.y(); + geom.setHeight( h ); + h = ( h / formWindow->grid().y() ) * formWindow->grid().y(); + tryResize( widget, w, h ); + } break; + case Bottom: { + if ( checkPos.y() < 2 * height() ) + return; + int h = geom.height() - d.y(); + geom.setHeight( h ); + h = ( h / formWindow->grid().y() ) * formWindow->grid().y(); + tryResize( widget, widget->width(), h ); + } break; + case LeftBottom: { + if ( checkPos.x() > pr.width() - 2 * width() || checkPos.y() < 2 * height() ) + return; + int w = geom.width() + d.x(); + geom.setWidth( w ); + w = ( w / formWindow->grid().x() ) * formWindow->grid().x(); + int dx = widget->width() - w; + int h = geom.height() - d.y(); + geom.setHeight( h ); + h = ( h / formWindow->grid().y() ) * formWindow->grid().y(); + trySetGeometry( widget, widget->x() + dx, widget->y(), w, h ); + } break; + case Left: { + if ( checkPos.x() > pr.width() - 2 * width() ) + return; + int w = geom.width() + d.x(); + geom.setWidth( w ); + w = ( w / formWindow->grid().x() ) * formWindow->grid().x(); + int dx = widget->width() - w; + trySetGeometry( widget, widget->x() + dx, widget->y(), w, widget->height() ); + } break; + } + + QPoint p = pos(); + sel->updateGeometry(); + oldPressPos += ( p - pos() ); + + formWindow->sizePreview()->setText( i18n( "%1/%2" ).arg( widget->width() ).arg( widget->height() ) ); + formWindow->sizePreview()->adjustSize(); + QRect lg( formWindow->mapFromGlobal( e->globalPos() ) + QPoint( 16, 16 ), + formWindow->sizePreview()->size() ); + formWindow->checkPreviewGeometry( lg ); + formWindow->sizePreview()->setGeometry( lg ); + formWindow->sizePreview()->show(); + formWindow->sizePreview()->raise(); + if ( WidgetFactory::layoutType( widget ) != WidgetFactory::NoLayout ) + formWindow->updateChildSelections( widget ); +} + +void SizeHandle::mouseReleaseEvent( QMouseEvent *e ) +{ + if ( e->button() != LeftButton || !active ) + return; + + formWindow->sizePreview()->hide(); + if ( geom != widget->geometry() ) + formWindow->commandHistory()->addCommand( new ResizeCommand( i18n( "Resize" ), + formWindow, + widget, origGeom, + widget->geometry() ) ); + formWindow->emitUpdateProperties( widget ); +} + +void SizeHandle::trySetGeometry( QWidget *w, int x, int y, int width, int height ) +{ + int minw = QMAX( w->minimumSizeHint().width(), w->minimumSize().width() ); + minw = QMAX( minw, 2 * formWindow->grid().x() ); + int minh = QMAX( w->minimumSizeHint().height(), w->minimumSize().height() ); + minh = QMAX( minh, 2 * formWindow->grid().y() ); + if ( QMAX( minw, width ) > w->maximumWidth() || + QMAX( minh, height ) > w->maximumHeight() ) + return; + if ( width < minw && x != w->x() ) + x -= minw - width; + if ( height < minh && y != w->y() ) + y -= minh - height; + w->setGeometry( x, y, QMAX( minw, width ), QMAX( minh, height ) ); +} + +void SizeHandle::tryResize( QWidget *w, int width, int height ) +{ + int minw = QMAX( w->minimumSizeHint().width(), w->minimumSize().width() ); + minw = QMAX( minw, 16 ); + int minh = QMAX( w->minimumSizeHint().height(), w->minimumSize().height() ); + minh = QMAX( minh, 16 ); + w->resize( QMAX( minw, width ), QMAX( minh, height ) ); +} + +// ------------------------------------------------------------------------ + +WidgetSelection::WidgetSelection( FormWindow *parent, QPtrDict *selDict ) + : selectionDict( selDict ) +{ + formWindow = parent; + for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) { + handles.insert( i, new SizeHandle( formWindow, (SizeHandle::Direction)i, this ) ); + } + hide(); +} + +void WidgetSelection::setWidget( QWidget *w, bool updateDict ) +{ + if ( !w ) { + hide(); + if ( updateDict ) + selectionDict->remove( wid ); + wid = 0; + return; + } + + wid = w; + bool active = !wid->parentWidget() || WidgetFactory::layoutType( wid->parentWidget() ) == WidgetFactory::NoLayout; + for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) { + SizeHandle *h = handles[ i ]; + if ( h ) { + h->setWidget( wid ); + h->setActive( active ); + } + } + updateGeometry(); + show(); + if ( updateDict ) + selectionDict->insert( w, this ); +} + +bool WidgetSelection::isUsed() const +{ + return wid != 0; +} + +void WidgetSelection::updateGeometry() +{ + if ( !wid || !wid->parentWidget() ) + return; + + QPoint p = wid->parentWidget()->mapToGlobal( wid->pos() ); + p = formWindow->mapFromGlobal( p ); + QRect r( p, wid->size() ); + + int w = 6; + int h = 6; + + for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) { + SizeHandle *hndl = handles[ i ]; + if ( !hndl ) + continue; + switch ( i ) { + case SizeHandle::LeftTop: + hndl->move( r.x() - w / 2, r.y() - h / 2 ); + break; + case SizeHandle::Top: + hndl->move( r.x() + r.width() / 2 - w / 2, r.y() - h / 2 ); + break; + case SizeHandle::RightTop: + hndl->move( r.x() + r.width() - w / 2, r.y() - h / 2 ); + break; + case SizeHandle::Right: + hndl->move( r.x() + r.width() - w / 2, r.y() + r.height() / 2 - h / 2 ); + break; + case SizeHandle::RightBottom: + hndl->move( r.x() + r.width() - w / 2, r.y() + r.height() - h / 2 ); + break; + case SizeHandle::Bottom: + hndl->move( r.x() + r.width() / 2 - w / 2, r.y() + r.height() - h / 2 ); + break; + case SizeHandle::LeftBottom: + hndl->move( r.x() - w / 2, r.y() + r.height() - h / 2 ); + break; + case SizeHandle::Left: + hndl->move( r.x() - w / 2, r.y() + r.height() / 2 - h / 2 ); + break; + default: + break; + } + } +} + +void WidgetSelection::hide() +{ + for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) { + SizeHandle *h = handles[ i ]; + if ( h ) + h->hide(); + } +} + +void WidgetSelection::show() +{ + for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) { + SizeHandle *h = handles[ i ]; + if ( h ) { + h->show(); + h->raise(); + } + } +} + +void WidgetSelection::update() +{ + for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) { + SizeHandle *h = handles[ i ]; + if ( h ) + h->update(); + } +} + +QWidget *WidgetSelection::widget() const +{ + return wid; +} diff --git a/kdevdesigner/designer/sizehandle.h b/kdevdesigner/designer/sizehandle.h new file mode 100644 index 00000000..8d53977c --- /dev/null +++ b/kdevdesigner/designer/sizehandle.h @@ -0,0 +1,97 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef SIZEHANDLE_H +#define SIZEHANDLE_H + +#include +#include +#include + +class QMouseEvent; +class FormWindow; +class WidgetSelection; +class QPaintEvent; + +class SizeHandle : public QWidget +{ + Q_OBJECT + +public: + enum Direction { LeftTop, Top, RightTop, Right, RightBottom, Bottom, LeftBottom, Left }; + + SizeHandle( FormWindow *parent, Direction d, WidgetSelection *s ); + void setWidget( QWidget *w ); + void setActive( bool a ); + void updateCursor(); + + void setEnabled( bool ) {} + +protected: + void paintEvent( QPaintEvent *e ); + void mousePressEvent( QMouseEvent *e ); + void mouseMoveEvent( QMouseEvent *e ); + void mouseReleaseEvent( QMouseEvent *e ); + +private: + void trySetGeometry( QWidget *w, int x, int y, int width, int height ); + void tryResize( QWidget *w, int width, int height ); + +private: + QWidget *widget; + Direction dir; + QPoint oldPressPos; + FormWindow *formWindow; + WidgetSelection *sel; + QRect geom, origGeom; + bool active; + +}; + +class WidgetSelection +{ +public: + WidgetSelection( FormWindow *parent, QPtrDict *selDict ); + + void setWidget( QWidget *w, bool updateDict = TRUE ); + bool isUsed() const; + + void updateGeometry(); + void hide(); + void show(); + void update(); + + QWidget *widget() const; + +protected: + QIntDict handles; + QWidget *wid; + FormWindow *formWindow; + QPtrDict *selectionDict; + +}; + +#endif diff --git a/kdevdesigner/designer/sourceeditor.cpp b/kdevdesigner/designer/sourceeditor.cpp new file mode 100644 index 00000000..f3a035b5 --- /dev/null +++ b/kdevdesigner/designer/sourceeditor.cpp @@ -0,0 +1,320 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include + +#include "sourceeditor.h" + +#include "formwindow.h" +#include "metadatabase.h" +#include "project.h" +#include "mainwindow.h" +#include "../interfaces/languageinterface.h" +#include +#include "project.h" +#include "sourcefile.h" +#include "hierarchyview.h" +#include +#include +#include "kdevdesigner_part.h" + +SourceEditor::SourceEditor( QWidget *parent, EditorInterface *iface, LanguageInterface *liface ) + : QVBox( parent, 0, WDestructiveClose ), iFace( iface ), lIface( liface ), obj( 0 ), pro( 0 ) +{ + iFace->addRef(); + lIface->addRef(); + editor = iFace->editor( MainWindow::self->areEditorsReadOnly(), + this, MainWindow::self->designerInterface() ); + iFace->onBreakPointChange( MainWindow::self, SLOT( breakPointsChanged() ) ); + resize( 600, 400 ); + setIcon( SmallIcon( "designer_filenew.png" , KDevDesignerPartFactory::instance()) ); +} + +SourceEditor::~SourceEditor() +{ + saveBreakPoints(); + editor = 0; + if ( formWindow() ) { + formWindow()->formFile()->setCodeEdited( FALSE ); + formWindow()->formFile()->setEditor( 0 ); + } else if ( sourceFile() ) { + sourceFile()->setEditor( 0 ); + if ( MainWindow::self->objectHierarchy()->sourceEditor() == this ) + MainWindow::self->objectHierarchy()->setFormWindow( 0, 0 ); + } + iFace->release(); + lIface->release(); + MainWindow::self->editorClosed( this ); +} + +void SourceEditor::setObject( QObject *o, Project *p ) +{ + if ( sourceFile() ) + sourceFile()->setEditor( 0 ); + if ( formWindow() ) { + formWindow()->formFile()->setCodeEdited( FALSE ); + formWindow()->formFile()->setEditor( 0 ); + } + if ( ::qt_cast(o) ) + ( (FormWindow*)o )->formFile()->setCodeEdited( TRUE ); + save(); + bool changed = FALSE; + if ( &(*obj) != o ) { + saveBreakPoints(); + changed = TRUE; + } + obj = o; + pro = p; + if ( formWindow() ) { + if ( formWindow()->isFake() ) + setCaption( formWindow()->project()->objectForFakeForm( formWindow() )->name() ); + else + setCaption( obj->name() ); + } else { + setCaption( sourceFile()->fileName() ); + } + if ( sourceFile() ) + sourceFile()->setEditor( this ); + else if ( formWindow() ) + formWindow()->formFile()->setEditor( this ); + iFace->setText( sourceOfObject( obj, lang, iFace, lIface ) ); + if ( pro && formWindow() ) { + if ( formWindow()->isFake() ) + iFace->setContext( pro->objectForFakeFormFile( formWindow()->formFile() ) ); + else + iFace->setContext( formWindow()->mainContainer() ); + } else { + iFace->setContext( 0 ); + } + if ( changed || sourceFile() ) + iFace->setBreakPoints( MetaDataBase::breakPoints( o ) ); + MainWindow::self->objectHierarchy()->showClasses( this ); +} + +QString SourceEditor::sourceOfObject( QObject *o, const QString &, + EditorInterface *, LanguageInterface * ) +{ + QString txt; + if ( !o ) + return txt; + if ( ::qt_cast(o) ) + txt = ( (FormWindow*)o )->formFile()->code(); + else if ( ::qt_cast(o) ) + txt = ( (SourceFile*)o )->text(); + return txt; +} + +void SourceEditor::setFunction( const QString &func, const QString &clss ) +{ + iFace->scrollTo( lIface->createFunctionStart( obj->name(), func, "", "" ), clss ); +} + +void SourceEditor::setClass( const QString &clss ) +{ + iFace->scrollTo( clss, QString::null ); +} + +void SourceEditor::closeEvent( QCloseEvent *e ) +{ + e->accept(); + if ( !obj ) + return; + if ( formWindow() ) { + save(); + formWindow()->formFile()->cm = formWindow()->formFile()->isModified(); + } else { + if ( !sourceFile()->closeEvent() ) + e->ignore(); + } +} + +void SourceEditor::save() +{ + if ( !obj ) + return; + if ( formWindow() ) + formWindow()->formFile()->syncCode(); + else if ( sourceFile() && sourceFile()->editor() ) + sourceFile()->setText( iFace->text() ); +} + +QString SourceEditor::language() const +{ + return lang; +} + +void SourceEditor::setLanguage( const QString &l ) +{ + lang = l; +} + +void SourceEditor::editCut() +{ + iFace->cut(); +} + +void SourceEditor::editCopy() +{ + iFace->copy(); +} + +void SourceEditor::editPaste() +{ + iFace->paste(); +} + +bool SourceEditor::editIsUndoAvailable() +{ + return iFace->isUndoAvailable(); +} + +bool SourceEditor::editIsRedoAvailable() +{ + return iFace->isRedoAvailable(); +} + +void SourceEditor::editUndo() +{ + iFace->undo(); +} + +void SourceEditor::editRedo() +{ + iFace->redo(); +} + +void SourceEditor::editSelectAll() +{ + iFace->selectAll(); +} + +void SourceEditor::configChanged() +{ + iFace->readSettings(); +} + +void SourceEditor::setModified( bool b ) +{ + iFace->setModified( b ); +} + +void SourceEditor::refresh( bool allowSave ) +{ + if ( allowSave ) + save(); + bool oldMod = iFace->isModified(); + iFace->setText( sourceOfObject( obj, lang, iFace, lIface ) ); + iFace->setModified( oldMod ); +} + +void SourceEditor::resetContext() +{ + if ( pro && formWindow() ) { + if ( formWindow()->isFake() ) + iFace->setContext( pro->objectForFakeFormFile( formWindow()->formFile() ) ); + else + iFace->setContext( formWindow()->mainContainer() ); + } else { + iFace->setContext( 0 ); + } +} + +void SourceEditor::setFocus() +{ + if ( formWindow() ) + formWindow()->formFile()->setCodeEdited( TRUE ); + if ( editor ) + editor->setFocus(); +} + +int SourceEditor::numLines() const +{ + return iFace->numLines(); +} + +void SourceEditor::saveBreakPoints() +{ + if ( !obj ) + return; + QValueList l; + iFace->breakPoints( l ); + MetaDataBase::setBreakPoints( obj, l ); +} + +void SourceEditor::clearStep() +{ + iFace->clearStep(); +} + +void SourceEditor::clearStackFrame() +{ + iFace->clearStackFrame(); +} + +void SourceEditor::resetBreakPoints() +{ + iFace->setBreakPoints( MetaDataBase::breakPoints( obj ) ); +} + +QString SourceEditor::text() const +{ + return iFace->text(); +} + +bool SourceEditor::isModified() const +{ + return iFace->isModified(); +} + +void SourceEditor::checkTimeStamp() +{ + if ( formWindow() ) + formWindow()->formFile()->checkTimeStamp(); + else if ( sourceFile() ) + sourceFile()->checkTimeStamp(); +} + +bool SourceEditor::saveAs() +{ + if ( formWindow() ) + return formWindow()->formFile()->saveAs(); + else if ( sourceFile() ) + return sourceFile()->saveAs(); + return FALSE; +} + +SourceFile *SourceEditor::sourceFile() const +{ + if ( !::qt_cast((QObject *)obj) ) + return 0; + return (SourceFile*)(QObject*)obj; +} + +FormWindow *SourceEditor::formWindow() const +{ + if ( !::qt_cast((QObject *)obj) ) + return 0; + return (FormWindow*)(QObject*)obj; +} diff --git a/kdevdesigner/designer/sourceeditor.h b/kdevdesigner/designer/sourceeditor.h new file mode 100644 index 00000000..a554b80c --- /dev/null +++ b/kdevdesigner/designer/sourceeditor.h @@ -0,0 +1,106 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef SOURCEEDITOR_H +#define SOURCEEDITOR_H + +#include "../interfaces/editorinterface.h" +#include +#include + +class FormWindow; +class QCloseEvent; +struct LanguageInterface; +class Project; +class SourceFile; + +class SourceEditor : public QVBox +{ + Q_OBJECT + +public: + SourceEditor( QWidget *parent, EditorInterface *iface, LanguageInterface *liface ); + ~SourceEditor(); + + void setObject( QObject *fw, Project *p ); + QObject *object() const { return obj; } + Project *project() const { return pro; } + void setFunction( const QString &func, const QString &clss = QString::null ); + void setClass( const QString &clss ); + void save(); + bool saveAs(); + void setModified( bool b ); + bool isModified() const; + + static QString sourceOfObject( QObject *fw, const QString &lang, EditorInterface *iface, LanguageInterface *lIface ); + + QString language() const; + void setLanguage( const QString &l ); + + void editCut(); + void editCopy(); + void editPaste(); + bool editIsUndoAvailable(); + bool editIsRedoAvailable(); + void editUndo(); + void editRedo(); + void editSelectAll(); + + void configChanged(); + void refresh( bool allowSave ); + void resetContext(); + + EditorInterface *editorInterface() const { return iFace; } + + void setFocus(); + int numLines() const; + void saveBreakPoints(); + void clearStep(); + void clearStackFrame(); + void resetBreakPoints(); + + QString text() const; + + void checkTimeStamp(); + + SourceFile *sourceFile() const; + FormWindow *formWindow() const; + +protected: + void closeEvent( QCloseEvent *e ); + + +private: + EditorInterface *iFace; + LanguageInterface *lIface; + QGuardedPtr obj; + Project *pro; + QString lang; + QGuardedPtr editor; + +}; + +#endif diff --git a/kdevdesigner/designer/sourcefile.cpp b/kdevdesigner/designer/sourcefile.cpp new file mode 100644 index 00000000..327dc58c --- /dev/null +++ b/kdevdesigner/designer/sourcefile.cpp @@ -0,0 +1,298 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "sourcefile.h" +#include +#include +#include "designerappiface.h" +#include "sourceeditor.h" +#include "metadatabase.h" +#include "../interfaces/languageinterface.h" +#include +#include +#include "mainwindow.h" +#include "workspace.h" +#include + +#include +#include + +SourceFile::SourceFile( const QString &fn, bool temp, Project *p ) + : filename( fn ), ed( 0 ), fileNameTemp( temp ), + timeStamp( 0, p->makeAbsolute( fn ) ), pro( p ), pkg( FALSE ) + , accepted( TRUE ) +{ + iface = 0; + + if ( !temp ) + accepted = checkFileName( TRUE ); + + if (accepted) { + load(); + pro->addSourceFile( this ); + MetaDataBase::addEntry( this ); + } + +} + +SourceFile::~SourceFile() +{ + if (iface) + delete iface; +} + +QString SourceFile::text() const +{ + return txt; +} + +void SourceFile::setText( const QString &s ) +{ + txt = s; +} + +bool SourceFile::save( bool ignoreModified ) +{ + if ( fileNameTemp ) + return saveAs(); + if ( !ignoreModified && !isModified() ) + return TRUE; + if ( ed ) + ed->save(); + + if ( QFile::exists( pro->makeAbsolute( filename ) ) ) { + QString fn( pro->makeAbsolute( filename ) ); +#if defined(Q_OS_WIN32) + fn += ".bak"; +#else + fn += "~"; +#endif + QFile f( pro->makeAbsolute( filename ) ); + if ( f.open( IO_ReadOnly ) ) { + QFile f2( fn ); + if ( f2.open( IO_WriteOnly | IO_Translate ) ) { + QCString data( f.size() ); + f.readBlock( data.data(), f.size() ); + f2.writeBlock( data ); + } + } + } + + QFile f( pro->makeAbsolute( filename ) ); + if ( !f.open( IO_WriteOnly | IO_Translate ) ) + return saveAs(); + + QTextStream ts( &f ); + ts << txt; + timeStamp.update(); + setModified( FALSE ); + return TRUE; +} + +bool SourceFile::saveAs( bool ignoreModified ) +{ + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + QString filter; + if ( iface ) + filter = iface->fileFilterList().join("\n"); + + QString old = filename; + QString initFn = pro->makeAbsolute( filename ); + if ( ignoreModified ) { + QString dir = QStringList::split( ':', project()->iFace()->customSetting( "QTSCRIPT_PACKAGES" ) ).first(); + initFn = QFileInfo( initFn ).fileName(); + initFn.prepend( dir + "/" ); + } + QString fn = KFileDialog::getSaveFileName( initFn, filter ); + if ( fn.isEmpty() ) + return FALSE; + fileNameTemp = FALSE; + filename = pro->makeRelative( fn ); + if ( !checkFileName( TRUE ) ) { + filename = old; + return FALSE; + } + pro->setModified( TRUE ); + timeStamp.setFileName( pro->makeAbsolute( filename ) ); + if ( ed ) + ed->setCaption( i18n( "Edit %1" ).arg( filename ) ); + setModified( TRUE ); + if ( pro->isDummy() ) { + QObject *o = ed->parent(); + while ( o && !o->isA( "MainWindow" ) ) + o = o->parent(); + if ( o ) + ((MainWindow *)o)->addRecentlyOpenedFile( fn ); + } + return save( ignoreModified ); +} + +bool SourceFile::load() +{ + QFile f( pro->makeAbsolute( filename ) ); + if ( !f.open( IO_ReadOnly ) ) + return FALSE; + QTextStream ts( &f ); + txt = ts.read(); + timeStamp.update(); + return TRUE; +} + +DesignerSourceFile *SourceFile::iFace() +{ + if ( !iface ) + iface = new DesignerSourceFileImpl( this ); + return iface; +} + +void SourceFile::setEditor( SourceEditor *e ) +{ + ed = e; +} + +bool SourceFile::isModified() const +{ + if ( !ed ) + return FALSE; + return ed->isModified(); +} + +static QMap *extensionCounter; +QString SourceFile::createUnnamedFileName( const QString &extension ) +{ + if ( !extensionCounter ) + extensionCounter = new QMap; + int count = -1; + QMap::Iterator it; + if ( ( it = extensionCounter->find( extension ) ) != extensionCounter->end() ) { + count = *it; + ++count; + extensionCounter->replace( extension, count ); + } else { + count = 1; + extensionCounter->insert( extension, count ); + } + + return "unnamed" + QString::number( count ) + "." + extension; +} + +void SourceFile::setModified( bool m ) +{ + if ( !ed ) + return; + ed->setModified( m ); +} + +bool SourceFile::closeEvent() +{ + if ( !isModified() && fileNameTemp ) { + pro->removeSourceFile( this ); + return TRUE; + } + + if ( !isModified() ) + return TRUE; + + if ( ed ) + ed->save(); + + switch ( QMessageBox::warning( MainWindow::self, i18n( "Save Code" ), + i18n( "Save changes to '%1'?" ).arg( filename ), + i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) { + case 0: // save + if ( !save() ) + return FALSE; + break; + case 1: // don't save + load(); + if ( ed ) + ed->editorInterface()->setText( txt ); + if ( fileNameTemp ) { + pro->removeSourceFile( this ); + return TRUE; + } + if ( MainWindow::self ) + MainWindow::self->workspace()->update(); + break; + case 2: // cancel + return FALSE; + default: + break; + } + setModified( FALSE ); + return TRUE; +} + +bool SourceFile::close() +{ + if ( !ed ) + return TRUE; + return ed->close(); +} + +Project *SourceFile::project() const +{ + return pro; +} + +void SourceFile::checkTimeStamp() +{ + if ( timeStamp.isUpToDate() ) + return; + timeStamp.update(); + if ( QMessageBox::information( MainWindow::self, i18n( "Qt Designer" ), + i18n( "File '%1' has been changed outside Qt Designer.\n" + "Do you want to reload it?" ).arg( filename ), + i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) { + load(); + if ( ed ) + ed->editorInterface()->setText( txt ); + } +} + +bool SourceFile::checkFileName( bool allowBreak ) +{ + SourceFile *sf = pro->findSourceFile( filename, this ); + if ( sf ) + QMessageBox::warning( MainWindow::self, i18n( "Invalid Filename" ), + i18n( "The project already contains a source file with \n" + "filename '%1'. Please choose a new filename." ).arg( filename ) ); + while ( sf ) { + LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() ); + QString filter; + if ( iface ) + filter = iface->fileFilterList().join("\n"); + QString fn; + while ( fn.isEmpty() ) { + fn = KFileDialog::getSaveFileName( pro->makeAbsolute( filename ), filter ); + if ( allowBreak && fn.isEmpty() ) + return FALSE; + } + filename = pro->makeRelative( fn ); + sf = pro->findSourceFile( filename, this ); + } + return TRUE; +} diff --git a/kdevdesigner/designer/sourcefile.h b/kdevdesigner/designer/sourcefile.h new file mode 100644 index 00000000..438d9b4c --- /dev/null +++ b/kdevdesigner/designer/sourcefile.h @@ -0,0 +1,86 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef SOURCEFILE_H +#define SOURCEFILE_H + +#include +#include "timestamp.h" + +struct DesignerSourceFile; +class SourceEditor; +class Project; + +class SourceFile : public QObject +{ + Q_OBJECT + +public: + SourceFile( const QString &fn, bool temp, Project *p ); + ~SourceFile(); + + void setText( const QString &s ); + void setModified( bool m ); + + bool save( bool ignoreModified = FALSE ); + bool saveAs( bool ignoreModified = FALSE ); + bool load(); + bool close(); + bool closeEvent(); + Project *project() const; + + QString text() const; + QString fileName() const { return filename; } + bool isModified() const; + + void checkTimeStamp(); + + DesignerSourceFile *iFace(); + + void setEditor( SourceEditor *e ); + SourceEditor *editor() const { return ed; } + + static QString createUnnamedFileName( const QString &extension ); + + bool isAccepted() const { return accepted; } + +private: + bool checkFileName( bool allowBreak ); + +private: + QString filename; + QString txt; + DesignerSourceFile *iface; + SourceEditor *ed; + bool fileNameTemp; + TimeStamp timeStamp; + Project *pro; + bool pkg; + bool accepted; + +}; + +#endif diff --git a/kdevdesigner/designer/startdialog.ui b/kdevdesigner/designer/startdialog.ui new file mode 100644 index 00000000..1301a20a --- /dev/null +++ b/kdevdesigner/designer/startdialog.ui @@ -0,0 +1,324 @@ + +StartDialogBase +********************************************************************* +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + StartDialogBase + + + + 0 + 0 + 576 + 420 + + + + + 5 + 5 + 0 + 0 + + + + Qt Designer - New/Open + + + true + + + + unnamed + + + 11 + + + 6 + + + + tabWidget + + + + Widget8 + + + &New File/Project + + + + unnamed + + + 11 + + + 6 + + + + templateView + + + 120 + + + Adjust + + + false + + + + + + + tab + + + &Open File/Project + + + + unnamed + + + 11 + + + 6 + + + + + + Widget9 + + + &Recently Opened + + + + unnamed + + + 11 + + + 6 + + + + recentView + + + WheelFocus + + + 120 + + + Adjust + + + false + + + + + fileInfoLabel + + + + 2 + 5 + 0 + 0 + + + + + + + + + + + + checkShowInFuture + + + &Do not show this dialog in the future + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + 4144 + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 0 + 20 + + + + + + buttonOk + + + &OK + + + 0 + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + 0 + + + true + + + + + + + + + buttonOk + clicked() + StartDialogBase + accept() + + + buttonCancel + clicked() + StartDialogBase + reject() + + + templateView + doubleClicked(QIconViewItem*) + StartDialogBase + accept() + + + templateView + returnPressed(QIconViewItem*) + StartDialogBase + accept() + + + recentView + doubleClicked(QIconViewItem*) + StartDialogBase + accept() + + + recentView + onItem(QIconViewItem*) + StartDialogBase + recentItemChanged(QIconViewItem*) + + + recentView + onViewport() + StartDialogBase + clearFileInfo() + + + recentView + returnPressed(QIconViewItem*) + StartDialogBase + accept() + + + recentView + selectionChanged(QIconViewItem*) + StartDialogBase + recentItemChanged(QIconViewItem*) + + + + recentItemChanged( QIconViewItem * ) + clearFileInfo() + accept() + reject() + + + diff --git a/kdevdesigner/designer/startdialogimpl.cpp b/kdevdesigner/designer/startdialogimpl.cpp new file mode 100644 index 00000000..e408e8a5 --- /dev/null +++ b/kdevdesigner/designer/startdialogimpl.cpp @@ -0,0 +1,182 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kdevdesigner_part.h" + +#include "mainwindow.h" +#include "startdialogimpl.h" +#include "designerapp.h" + +#include + +FileDialog::FileDialog( const QString &dir, QWidget *parent ) + : QFileDialog( dir, QString::null, parent ) +{ +} + +void FileDialog::accept() +{ + emit fileSelected(); +} + + +StartDialog::StartDialog( QWidget *parent, const QString &templatePath ) + : StartDialogBase( parent, 0 ) +{ + newForm = new NewForm( templateView, templatePath ); + recentFiles.clear(); + initFileOpen(); + showInFuture = TRUE; + + connect( buttonHelp, SIGNAL( clicked() ), + MainWindow::self, SLOT( showDialogHelp() ) ); + connect( recentView, SIGNAL( doubleClicked(QIconViewItem*) ), + this, SLOT( accept() ) ); + connect( recentView, SIGNAL( returnPressed(QIconViewItem*) ), + this, SLOT( accept() ) ); + connect( fd, SIGNAL( fileSelected() ), this, SLOT( accept() ) ); +} + +void StartDialog::accept() +{ + hide(); + showInFuture = !checkShowInFuture->isChecked(); // means don't show it anymore + + int tabindex = tabWidget->currentPageIndex(); + QString filename; + if( !tabindex ) { + if ( !templateView->currentItem() ) + return; + Project *pro = MainWindow::self->findProject( i18n( "" ) ); + if ( !pro ) + return; + MainWindow::self->setCurrentProject( pro ); + ( (NewItem*)templateView->currentItem() )->insert( pro ); + } else if ( tabindex == 1 ) { + filename = fd->selectedFile(); + } else if ( tabindex == 2 ) { + filename = recentFiles[recentView->currentItem()->index()]; + } + if ( tabindex ) { + if ( !filename.isEmpty() ) { + QFileInfo fi( filename ); + if ( fi.extension() == "pro" ) + MainWindow::self->openProject( filename ); + else + MainWindow::self->fileOpen( "", "", filename ); + } + } + + done( Accepted ); +} + +void StartDialog::reject() +{ + done( Rejected ); +} + +void StartDialog::recentItemChanged( QIconViewItem *item ) +{ + QString msg( recentFiles[item->index()] ); + QFileInfo f( recentFiles[item->index()] ); + uint s = f.size(); + QString unit( "B" ); + if( s > 1024 ) { + s /= 1024; + unit = "KB"; + } + if ( s > 1024 ) { + s /= 1024; + unit = "MB"; + } + QDateTime dt( f.lastModified() ); + QString date( dt.toString( "MMMM dd hh:mm" )); + msg = QString( "%1 (%2 %3) %4" ).arg(msg).arg(s).arg(unit).arg(date); + fileInfoLabel->setText( msg ); +} + +void StartDialog::clearFileInfo() +{ + fileInfoLabel->clear(); +} + +void StartDialog::setRecentlyFiles( QStringList &files ) +{ + insertRecentItems( files, FALSE ); +} + +void StartDialog::setRecentlyProjects( QStringList &projects ) +{ + insertRecentItems( projects, TRUE ); +} + +void StartDialog::insertRecentItems( QStringList &files, bool isProject ) +{ + QString iconName = "designer_newform.png"; + if ( isProject ) + iconName = "designer_project.png"; + QIconViewItem *item; + QStringList::iterator it = files.begin(); + for( ; it != files.end(); ++it ) { + QFileInfo fi( *it ); + item = new QIconViewItem( recentView, fi.fileName() ); + recentFiles[recentView->index( item )] = *it; + item->setPixmap( BarIcon( iconName, KDevDesignerPartFactory::instance() ) ); + item->setDragEnabled( FALSE ); + } +} + +void StartDialog::initFileOpen() +{ + QString encode = QDir::currentDirPath(); + QUrl::encode( encode ); + fd = new FileDialog( encode, this ); + QPoint point( 0, 0 ); + fd->reparent( tab, point ); + + QObjectList *l = fd->queryList( "QPushButton" ); + QObjectListIt it( *l ); + QObject *obj; + while ( (obj = it.current()) != 0 ) { + ++it; + ((QPushButton*)obj)->hide(); + } + delete l; + + fd->setSizeGripEnabled ( FALSE ); + tabLayout->addWidget( fd ); + + QPluginManager manager( IID_ImportFilter, QApplication::libraryPaths(), + MainWindow::self->pluginDirectory() ); + QStringList filterlist; + filterlist << i18n( "Designer Files (*.ui *.pro)" ); + filterlist << i18n( "Qt User-Interface Files (*.ui)" ); + filterlist << i18n( "QMAKE Project Files (*.pro)" ); + + QStringList list = manager.featureList(); + for ( QStringList::Iterator it2 = list.begin(); it2 != list.end(); ++it2 ) + filterlist << *it2; + + filterlist << i18n( "All Files (*)" ); + QString filters = filterlist.join( ";;" ); + fd->setFilters( filters ); + + fd->show(); +} diff --git a/kdevdesigner/designer/startdialogimpl.h b/kdevdesigner/designer/startdialogimpl.h new file mode 100644 index 00000000..b29b5bf1 --- /dev/null +++ b/kdevdesigner/designer/startdialogimpl.h @@ -0,0 +1,80 @@ +/********************************************************************** +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef STARTDIALOGIMPL_H +#define STARTDIALOGIMPL_H + +#include +#include +#include +#include +#include +#include + +#include "newformimpl.h" +#include "startdialog.h" + +class FileDialog : public QFileDialog +{ + Q_OBJECT + +public: + FileDialog( const QString &dir, QWidget *parent ); + +protected slots: + void accept(); + +signals: + void fileSelected(); +}; + + +class StartDialog : public StartDialogBase +{ + Q_OBJECT + +public: + StartDialog( QWidget *parent, const QString &templatePath ); + void setRecentlyFiles( QStringList& ); + void setRecentlyProjects( QStringList& ); + bool showDialogInFuture() const { return showInFuture; } + +protected slots: + void recentItemChanged( QIconViewItem *item ); + void clearFileInfo(); + void accept(); + void reject(); + +private: + void initFileOpen(); + void insertRecentItems( QStringList &files, bool isProject ); + NewForm *newForm; + FileDialog *fd; + QMap recentFiles; + bool showInFuture; +}; + +#endif diff --git a/kdevdesigner/designer/styledbutton.cpp b/kdevdesigner/designer/styledbutton.cpp new file mode 100644 index 00000000..41389684 --- /dev/null +++ b/kdevdesigner/designer/styledbutton.cpp @@ -0,0 +1,295 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler needs this here +#include "styledbutton.h" +#include "formwindow.h" +#include "pixmapchooser.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +StyledButton::StyledButton(QWidget* parent, const char* name) + : QButton( parent, name ), pix( 0 ), spix( 0 ), s( 0 ), formWindow( 0 ), mousePressed( FALSE ) +{ + setMinimumSize( minimumSizeHint() ); + setAcceptDrops( TRUE ); + + connect( this, SIGNAL(clicked()), SLOT(onEditor())); + + setEditor( ColorEditor ); +} + +StyledButton::StyledButton( const QBrush& b, QWidget* parent, const char* name, WFlags f ) + : QButton( parent, name, f ), spix( 0 ), s( 0 ), formWindow( 0 ) +{ + col = b.color(); + pix = b.pixmap(); + setMinimumSize( minimumSizeHint() ); +} + +StyledButton::~StyledButton() +{ +} + +void StyledButton::setEditor( EditorType e ) +{ + if ( edit == e ) + return; + + edit = e; + update(); +} + +StyledButton::EditorType StyledButton::editor() const +{ + return edit; +} + +void StyledButton::setColor( const QColor& c ) +{ + col = c; + update(); +} + +void StyledButton::setPixmap( const QPixmap & pm ) +{ + if ( !pm.isNull() ) { + delete pix; + pix = new QPixmap( pm ); + } else { + delete pix; + pix = 0; + } + scalePixmap(); +} + +QColor StyledButton::color() const +{ + return col; +} + +QPixmap* StyledButton::pixmap() const +{ + return pix; +} + +bool StyledButton::scale() const +{ + return s; +} + +void StyledButton::setScale( bool on ) +{ + if ( s == on ) + return; + + s = on; + scalePixmap(); +} + +QSize StyledButton::sizeHint() const +{ + return QSize( 50, 25 ); +} + +QSize StyledButton::minimumSizeHint() const +{ + return QSize( 50, 25 ); +} + +void StyledButton::scalePixmap() +{ + delete spix; + + if ( pix ) { + spix = new QPixmap( 6*width()/8, 6*height()/8 ); + QImage img = pix->convertToImage(); + + spix->convertFromImage( s? img.smoothScale( 6*width()/8, 6*height()/8 ) : img ); + } else { + spix = 0; + } + + update(); +} + +void StyledButton::resizeEvent( QResizeEvent* e ) +{ + scalePixmap(); + QButton::resizeEvent( e ); +} + +void StyledButton::drawButton( QPainter *paint ) +{ + style().drawPrimitive(QStyle::PE_ButtonBevel, paint, rect(), colorGroup(), + isDown() ? QStyle::Style_Sunken : QStyle::Style_Raised); + drawButtonLabel(paint); + + if (hasFocus()) + style().drawPrimitive(QStyle::PE_FocusRect, paint, + style().subRect(QStyle::SR_PushButtonFocusRect, this), + colorGroup(), QStyle::Style_Default); +} + +void StyledButton::drawButtonLabel( QPainter *paint ) +{ + QColor pen = isEnabled() ? + hasFocus() ? palette().active().buttonText() : palette().inactive().buttonText() + : palette().disabled().buttonText(); + paint->setPen( pen ); + + if(!isEnabled()) { + paint->setBrush( QBrush( colorGroup().button() ) ); + } + else if ( edit == PixmapEditor && spix ) { + paint->setBrush( QBrush( col, *spix ) ); + paint->setBrushOrigin( width()/8, height()/8 ); + } else + paint->setBrush( QBrush( col ) ); + + paint->drawRect( width()/8, height()/8, 6*width()/8, 6*height()/8 ); +} + +void StyledButton::onEditor() +{ + switch (edit) { + case ColorEditor: { + QColor c = QColorDialog::getColor( palette().active().background(), this ); + if ( c.isValid() ) { + setColor( c ); + emit changed(); + } + } break; + case PixmapEditor: { + QPixmap p; + if ( pixmap() ) + p = qChoosePixmap( this, formWindow, *pixmap() ); + else + p = qChoosePixmap( this, formWindow, QPixmap() ); + if ( !p.isNull() ) { + setPixmap( p ); + emit changed(); + } + } break; + default: + break; + } +} + +void StyledButton::mousePressEvent(QMouseEvent* e) +{ + QButton::mousePressEvent(e); + mousePressed = TRUE; + pressPos = e->pos(); +} + +void StyledButton::mouseMoveEvent(QMouseEvent* e) +{ + QButton::mouseMoveEvent( e ); +#ifndef QT_NO_DRAGANDDROP + if ( !mousePressed ) + return; + if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) { + if ( edit == ColorEditor ) { + QColorDrag *drg = new QColorDrag( col, this ); + QPixmap pix( 25, 25 ); + pix.fill( col ); + QPainter p( &pix ); + p.drawRect( 0, 0, pix.width(), pix.height() ); + p.end(); + drg->setPixmap( pix ); + mousePressed = FALSE; + drg->dragCopy(); + } + else if ( edit == PixmapEditor && pix && !pix->isNull() ) { + QImage img = pix->convertToImage(); + QImageDrag *drg = new QImageDrag( img, this ); + if(spix) + drg->setPixmap( *spix ); + mousePressed = FALSE; + drg->dragCopy(); + } + } +#endif +} + +#ifndef QT_NO_DRAGANDDROP +void StyledButton::dragEnterEvent( QDragEnterEvent *e ) +{ + setFocus(); + if ( edit == ColorEditor && QColorDrag::canDecode( e ) ) + e->accept(); + else if ( edit == PixmapEditor && QImageDrag::canDecode( e ) ) + e->accept(); + else + e->ignore(); +} + +void StyledButton::dragLeaveEvent( QDragLeaveEvent * ) +{ + if ( hasFocus() ) + parentWidget()->setFocus(); +} + +void StyledButton::dragMoveEvent( QDragMoveEvent *e ) +{ + if ( edit == ColorEditor && QColorDrag::canDecode( e ) ) + e->accept(); + else if ( edit == PixmapEditor && QImageDrag::canDecode( e ) ) + e->accept(); + else + e->ignore(); +} + +void StyledButton::dropEvent( QDropEvent *e ) +{ + if ( edit == ColorEditor && QColorDrag::canDecode( e ) ) { + QColor color; + QColorDrag::decode( e, color ); + setColor(color); + emit changed(); + e->accept(); + } + else if ( edit == PixmapEditor && QImageDrag::canDecode( e ) ) { + QImage img; + QImageDrag::decode( e, img ); + QPixmap pm; + pm.convertFromImage(img); + setPixmap(pm); + emit changed(); + e->accept(); + } else { + e->ignore(); + } +} +#endif // QT_NO_DRAGANDDROP diff --git a/kdevdesigner/designer/styledbutton.h b/kdevdesigner/designer/styledbutton.h new file mode 100644 index 00000000..882090c7 --- /dev/null +++ b/kdevdesigner/designer/styledbutton.h @@ -0,0 +1,103 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef STYLEDBUTTON_H +#define STYLEDBUTTON_H + +#include +#include + +class QColor; +class QBrush; +class FormWindow; + +class StyledButton : public QButton +{ + Q_OBJECT + + Q_PROPERTY( QColor color READ color WRITE setColor ) + Q_PROPERTY( QPixmap pixmap READ pixmap WRITE setPixmap ) + Q_PROPERTY( EditorType editor READ editor WRITE setEditor ) + Q_PROPERTY( bool scale READ scale WRITE setScale ) + + Q_ENUMS( EditorType ) + +public: + enum EditorType { ColorEditor, PixmapEditor }; + + StyledButton( QWidget* parent = 0, const char* name = 0 ); + StyledButton( const QBrush& b, QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); + ~StyledButton(); + + void setEditor( EditorType ); + EditorType editor() const; + + void setColor( const QColor& ); + void setPixmap( const QPixmap& ); + + QPixmap* pixmap() const; + QColor color() const; + + void setScale( bool ); + bool scale() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setFormWindow( FormWindow *fw ) { formWindow = fw; } + +public slots: + virtual void onEditor(); + +signals: + void changed(); + +protected: + void mousePressEvent(QMouseEvent*); + void mouseMoveEvent(QMouseEvent*); +#ifndef QT_NO_DRAGANDDROP + void dragEnterEvent ( QDragEnterEvent * ); + void dragMoveEvent ( QDragMoveEvent * ); + void dragLeaveEvent ( QDragLeaveEvent * ); + void dropEvent ( QDropEvent * ); +#endif // QT_NO_DRAGANDDROP + void drawButton( QPainter* ); + void drawButtonLabel( QPainter* ); + void resizeEvent( QResizeEvent* ); + void scalePixmap(); + +private: + QPixmap* pix; + QPixmap* spix; // the pixmap scaled down to fit into the button + QColor col; + EditorType edit; + bool s; + FormWindow *formWindow; + QPoint pressPos; + bool mousePressed; +}; + +#endif //STYLEDBUTTON_H diff --git a/kdevdesigner/designer/syntaxhighlighter_html.cpp b/kdevdesigner/designer/syntaxhighlighter_html.cpp new file mode 100644 index 00000000..cd0c2760 --- /dev/null +++ b/kdevdesigner/designer/syntaxhighlighter_html.cpp @@ -0,0 +1,160 @@ +/********************************************************************** +** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "syntaxhighlighter_html.h" +#include "qstring.h" +#include "qmap.h" +#include "qapplication.h" + + +SyntaxHighlighter_HTML::SyntaxHighlighter_HTML() + : QTextPreProcessor(), lastFormat( 0 ), lastFormatId( -1 ) +{ + QFont f( qApp->font() ); + + addFormat(Standard, new QTextFormat(f, qApp->palette().color(QPalette::Active, QColorGroup::Text))); + addFormat(Keyword, new QTextFormat(f, qApp->palette().color(QPalette::Active, QColorGroup::Dark))); + addFormat(Attribute, new QTextFormat(f, qApp->palette().color(QPalette::Active, QColorGroup::Link))); + addFormat(AttribValue, new QTextFormat(f, qApp->palette().color(QPalette::Active, QColorGroup::LinkVisited))); +} + +SyntaxHighlighter_HTML::~SyntaxHighlighter_HTML() +{ +} + +void SyntaxHighlighter_HTML::process( QTextDocument *doc, QTextParagraph *string, int, bool invalidate ) +{ + + QTextFormat *formatStandard = format( Standard ); + QTextFormat *formatKeyword = format( Keyword ); + QTextFormat *formatAttribute = format( Attribute ); + QTextFormat *formatAttribValue = format( AttribValue ); + + const int StateStandard = 0; + const int StateTag = 1; + const int StateAttribute = 2; + const int StateAttribVal = 3; + + QString buffer = ""; + + int state = StateStandard; + + + if ( string->prev() ) { + if ( string->prev()->endState() == -1 ) + process( doc, string->prev(), 0, FALSE ); + state = string->prev()->endState(); + } + + + int i = 0; + for ( ;; ) { + QChar c = string->at( i )->c; + + if ( c == '<' ) { + if ( state != StateStandard ) + string->setFormat( i - buffer.length(), buffer.length(), formatStandard, FALSE ); + buffer = c; + state = StateTag; + string->setFormat( i, 1, formatKeyword, FALSE ); + } + else if ( c == '>' && ( state != StateStandard ) ) { + string->setFormat( i, 1, formatKeyword, FALSE ); + buffer = ""; + state = StateStandard; + } + else if ( c == ' ' && state == StateTag ) { + buffer += c; + string->setFormat( i, 1, formatStandard, FALSE ); + state = StateAttribute; + } + else if ( c == '=' && state == StateAttribute ) { + buffer += c; + string->setFormat( i, 1, formatStandard, FALSE ); + state = StateAttribute; + } + else if ( c == '\"' && state == StateAttribute ) { + buffer += c; + string->setFormat( i, 1, formatStandard, FALSE ); + state = StateAttribVal; + } + else if ( c == '\"' && state == StateAttribVal ) { + buffer += c; + string->setFormat( i, 1, formatStandard, FALSE ); + state = StateAttribute; + } + else if ( state == StateAttribute ) { + buffer += c; + string->setFormat( i, 1, formatAttribute, FALSE ); + } + else if ( state == StateAttribVal ) { + buffer += c; + string->setFormat( i, 1, formatAttribValue, FALSE ); + } + else if ( state == StateTag ) { + string->setFormat( i, 1, formatKeyword, FALSE ); + buffer += c; + } + else if ( state == StateStandard ) { + string->setFormat( i, 1, formatStandard, FALSE ); + } + + i++; + if ( i >= string->length() ) + break; + } + + string->setEndState( state ); + string->setFirstPreProcess( FALSE ); + + if ( invalidate && string->next() && + !string->next()->firstPreProcess() && string->next()->endState() != -1 ) { + QTextParagraph *p = string->next(); + while ( p ) { + if ( p->endState() == -1 ) + return; + p->setEndState( -1 ); + p = p->next(); + } + } +} + +QTextFormat *SyntaxHighlighter_HTML::format( int id ) +{ + if ( lastFormatId == id && lastFormat ) + return lastFormat; + + QTextFormat *f = formats[ id ]; + lastFormat = f ? f : formats[ 0 ]; + lastFormatId = id; + return lastFormat; +} + +void SyntaxHighlighter_HTML::addFormat( int id, QTextFormat *f ) +{ + formats.insert( id, f ); +} diff --git a/kdevdesigner/designer/syntaxhighlighter_html.h b/kdevdesigner/designer/syntaxhighlighter_html.h new file mode 100644 index 00000000..4a135671 --- /dev/null +++ b/kdevdesigner/designer/syntaxhighlighter_html.h @@ -0,0 +1,57 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef SYNTAXHIGHLIGHTER_HTML_H +#define SYNTAXHIGHLIGHTER_HTML_H + +#include <./private/qrichtext_p.h> + +class SyntaxHighlighter_HTML : public QTextPreProcessor +{ +public: + + enum HTML { + Standard = 1, + Keyword, + Attribute, + AttribValue + }; + + SyntaxHighlighter_HTML(); + virtual ~SyntaxHighlighter_HTML(); + void process( QTextDocument *doc, QTextParagraph *string, int start, bool invalidate = TRUE ); + QTextFormat *format( int id ); + +private: + void addFormat( int id, QTextFormat *f ); + + QTextFormat *lastFormat; + int lastFormatId; + QIntDict formats; + +}; + +#endif diff --git a/kdevdesigner/designer/tableeditor.ui b/kdevdesigner/designer/tableeditor.ui new file mode 100644 index 00000000..a6f10312 --- /dev/null +++ b/kdevdesigner/designer/tableeditor.ui @@ -0,0 +1,828 @@ + +TableEditorBase +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + TableEditorBase + + + + 0 + 0 + 484 + 406 + + + + Edit Table + + + true + + + + unnamed + + + 11 + + + 6 + + + + table + + + 1 + + + 1 + + + true + + + + + Layout11 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonApply + + + &Apply + + + true + + + Apply all changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + TabWidget + + + + columns_tab + + + Co&lumns + + + + unnamed + + + 11 + + + 6 + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + listColumns + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + buttonColumnUp + + + + + + "designer_s_up.png" + + + Move up + + + <b>Move the selected item up.</b><p>The top-most column will be the first column of the list.</p> + + + + + buttonColumnDown + + + + + + "designer_s_down.png" + + + Move down + + + <b>Move the selected item down.</b><p>The top-most column will be the first column of the list.</p> + + + + + buttonDeleteColumn + + + &Delete Column + + + + + buttonNewColumn + + + &New Column + + + + + Layout6 + + + + unnamed + + + 0 + + + 6 + + + + labelTable + + + Table: + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + labelColumnPixmap + + + Label4 + + + + + buttonDeleteColPixmap + + + + 30 + 22 + + + + + + + "designer_s_editcut.png" + + + Delete Pixmap + + + <b>Delete the selected item's pixmap.</b><p>The pixmap in the current column of the selected item will be deleted.</p> + + + + + buttonChooseColPixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + <b>Select a pixmap file for the item.</b><p>The pixmap will be changed in the current column of the selected item.</p> + + + + + + + TextLabel2 + + + &Label: + + + editColumnText + + + + + Label2 + + + Pixmap: + + + itemChoosePixmap + + + + + labelFields + + + &Field: + + + comboFields + + + + + editColumnText + + + + + comboFields + + + true + + + + + labelTableValue + + + <no table> + + + + + + + + + rows_tab + + + &Rows + + + + unnamed + + + 11 + + + 6 + + + + Spacer3_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonRowUp + + + + + + "designer_s_up.png" + + + Move up + + + <b>Move the selected item up.</b><p>The top-most column will be the first column of the list.</p> + + + + + listRows + + + + + buttonRowDown + + + + + + "designer_s_down.png" + + + Move down + + + <b>Move the selected item down.</b><p>The top-most column will be the first column of the list.</p> + + + + + Spacer2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + buttonNewRow + + + &New Row + + + + + buttonDeleteRow + + + &Delete Row + + + + + Layout7_2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2_3 + + + &Label: + + + editRowText + + + + + Label2_2 + + + Pixmap: + + + itemChoosePixmap + + + + + Layout2_2 + + + + unnamed + + + 0 + + + 6 + + + + labelRowPixmap + + + Label4 + + + + + buttonDeleteRowPixmap + + + + 30 + 22 + + + + + + + "designer_s_editcut.png" + + + Delete Pixmap + + + <b>Delete the selected item's pixmap.</b><p>The pixmap in the current column of the selected item will be deleted.</p> + + + + + buttonChooseRowPixmap + + + + 30 + 22 + + + + ... + + + Select a Pixmap + + + <b>Select a pixmap file for the item.</b><p>The pixmap will be changed in the current column of the selected item.</p> + + + + + + + editRowText + + + + + + + + + + + + buttonApply + clicked() + TableEditorBase + applyClicked() + + + buttonOk + clicked() + TableEditorBase + okClicked() + + + listColumns + currentChanged(QListBoxItem*) + TableEditorBase + currentColumnChanged(QListBoxItem*) + + + listColumns + selectionChanged(QListBoxItem*) + TableEditorBase + currentColumnChanged(QListBoxItem*) + + + editColumnText + textChanged(const QString&) + TableEditorBase + columnTextChanged(const QString&) + + + buttonNewColumn + clicked() + TableEditorBase + newColumnClicked() + + + buttonDeleteColumn + clicked() + TableEditorBase + deleteColumnClicked() + + + buttonColumnUp + clicked() + TableEditorBase + columnUpClicked() + + + buttonColumnDown + clicked() + TableEditorBase + columnDownClicked() + + + comboFields + activated(const QString&) + TableEditorBase + currentFieldChanged(const QString&) + + + listRows + selectionChanged(QListBoxItem*) + TableEditorBase + currentRowChanged(QListBoxItem*) + + + listRows + currentChanged(QListBoxItem*) + TableEditorBase + currentRowChanged(QListBoxItem*) + + + buttonNewRow + clicked() + TableEditorBase + newRowClicked() + + + buttonDeleteRow + clicked() + TableEditorBase + deleteRowClicked() + + + buttonRowUp + clicked() + TableEditorBase + rowUpClicked() + + + buttonRowDown + clicked() + TableEditorBase + rowDownClicked() + + + buttonChooseRowPixmap + clicked() + TableEditorBase + chooseRowPixmapClicked() + + + buttonDeleteColPixmap + clicked() + TableEditorBase + deleteColPixmapClicked() + + + editRowText + textChanged(const QString&) + TableEditorBase + rowTextChanged(const QString&) + + + buttonCancel + clicked() + TableEditorBase + reject() + + + buttonChooseColPixmap + clicked() + TableEditorBase + chooseColPixmapClicked() + + + buttonDeleteRowPixmap + clicked() + TableEditorBase + deleteRowPixmapClicked() + + + + buttonOk + buttonCancel + table + TabWidget + listColumns + buttonNewColumn + buttonDeleteColumn + comboFields + editColumnText + buttonDeleteColPixmap + buttonChooseColPixmap + buttonColumnUp + buttonColumnDown + buttonApply + listRows + buttonNewRow + buttonDeleteRow + editRowText + buttonDeleteRowPixmap + buttonChooseRowPixmap + buttonRowUp + buttonRowDown + buttonHelp + + + qtable.h + + + init() + destroy() + applyClicked() + chooseRowPixmapClicked() + columnTextChanged( const QString & ) + columnUpClicked() + currentColumnChanged( QListBoxItem * ) + currentFieldChanged( const QString & ) + currentRowChanged( QListBoxItem * ) + deleteColPixmapClicked() + deleteColumnClicked() + deleteRowClicked() + deleteRowPixmapClicked() + newColumnClicked() + newRowClicked() + chooseColPixmapClicked() + okClicked() + rowDownClicked() + rowTextChanged( const QString & ) + rowUpClicked() + columnDownClicked() + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/tableeditorimpl.cpp b/kdevdesigner/designer/tableeditorimpl.cpp new file mode 100644 index 00000000..b2a440de --- /dev/null +++ b/kdevdesigner/designer/tableeditorimpl.cpp @@ -0,0 +1,494 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "tableeditorimpl.h" +#ifndef QT_NO_TABLE +#include +#endif +#include "formwindow.h" +#include +#include +#include +#include +#include +#include +#include "pixmapchooser.h" +#include "command.h" +#include +#include +#include +#include "project.h" +#include "metadatabase.h" +#include "mainwindow.h" + +#include + +TableEditor::TableEditor( QWidget* parent, QWidget *editWidget, FormWindow *fw, const char* name, bool modal, WFlags fl ) + : TableEditorBase( parent, name, modal, fl ), +#ifndef QT_NO_TABLE + editTable( (QTable*)editWidget ), +#endif + formWindow( fw ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); +#ifndef QT_NO_TABLE + labelColumnPixmap->setText( "" ); + labelRowPixmap->setText( "" ); + +#ifndef QT_NO_SQL + if ( !::qt_cast(editTable) ) +#endif + { + labelFields->hide(); + comboFields->hide(); + labelTable->hide(); + labelTableValue->hide(); + } +#ifndef QT_NO_SQL + if ( ::qt_cast(editTable) ) { + // ## why does this behave weird? + // TabWidget->removePage( rows_tab ); + // rows_tab->hide(); + // ## do this in the meantime... + TabWidget->setTabEnabled( rows_tab, FALSE ); + } + + if ( formWindow->project() && ::qt_cast(editTable) ) { + QStringList lst = MetaDataBase::fakeProperty( editTable, "database" ).toStringList(); + if ( lst.count() == 2 && !lst[ 0 ].isEmpty() && !lst[ 1 ].isEmpty() ) { + QStringList fields; + fields << ""; + fields += formWindow->project()->databaseFieldList( lst[ 0 ], lst[ 1 ] ); + comboFields->insertStringList( fields ); + } + if ( !lst[ 1 ].isEmpty() ) + labelTableValue->setText( lst[ 1 ] ); + } +#endif + + readFromTable(); +#endif +} + +TableEditor::~TableEditor() +{ +} + +void TableEditor::columnDownClicked() +{ + if ( listColumns->currentItem() == -1 || + listColumns->currentItem() == (int)listColumns->count() - 1 || + listColumns->count() < 2 ) + return; + saveFieldMap(); + int index = listColumns->currentItem() + 1; + QListBoxItem *i = listColumns->item( listColumns->currentItem() ); + listColumns->takeItem( i ); + listColumns->insertItem( i, index ); + listColumns->setCurrentItem( i ); + readColumns(); + restoreFieldMap(); + currentColumnChanged( i ); +} + +void TableEditor::columnTextChanged( const QString &s ) +{ + if ( listColumns->currentItem() == -1 ) + return; + listColumns->blockSignals( TRUE ); + listColumns->changeItem( s, listColumns->currentItem() ); + listColumns->blockSignals( FALSE ); +#ifndef QT_NO_TABLE + if ( table->horizontalHeader()->iconSet( listColumns->currentItem() ) ) + table->horizontalHeader()->setLabel( listColumns->currentItem(), + *table->horizontalHeader()->iconSet( listColumns->currentItem() ), s ); + else + table->horizontalHeader()->setLabel( listColumns->currentItem(), s ); +#endif +} + +void TableEditor::columnUpClicked() +{ + if ( listColumns->currentItem() <= 0 || + listColumns->count() < 2 ) + return; + saveFieldMap(); + int index = listColumns->currentItem() - 1; + QListBoxItem *i = listColumns->item( listColumns->currentItem() ); + listColumns->takeItem( i ); + listColumns->insertItem( i, index ); + listColumns->setCurrentItem( i ); + readColumns(); + restoreFieldMap(); + currentColumnChanged( i ); +} + +void TableEditor::currentColumnChanged( QListBoxItem *i ) +{ + if ( !i ) + return; + editColumnText->blockSignals( TRUE ); + editColumnText->setText( i->text() ); + if ( i->pixmap() ) + labelColumnPixmap->setPixmap( *i->pixmap() ); + else + labelColumnPixmap->setText( "" ); + editColumnText->blockSignals( FALSE ); + +#ifndef QT_NO_SQL + if ( ::qt_cast(editTable) ) { + QString s = *fieldMap.find( listColumns->index( i ) ); + if ( s.isEmpty() ) + comboFields->setCurrentItem( 0 ); + else if ( comboFields->listBox()->findItem( s ) ) + comboFields->setCurrentItem( comboFields->listBox()->index( comboFields->listBox()->findItem( s ) ) ); + else + comboFields->lineEdit()->setText( s ); + } +#endif +} + +void TableEditor::currentFieldChanged( const QString &s ) +{ + if ( listColumns->currentItem() == -1 ) + return; + fieldMap.remove( listColumns->currentItem() ); + fieldMap.insert( listColumns->currentItem(), s ); + editColumnText->blockSignals( TRUE ); //## necessary + QString newColText = s.mid(0,1).upper() + s.mid(1); + editColumnText->setText( newColText ); + columnTextChanged( newColText ); + editColumnText->blockSignals( FALSE ); +} + +void TableEditor::currentRowChanged( QListBoxItem *i ) +{ + if ( !i ) + return; + editRowText->blockSignals( TRUE ); + editRowText->setText( i->text() ); + if ( i->pixmap() ) + labelRowPixmap->setPixmap( *i->pixmap() ); + else + labelRowPixmap->setText( "" ); + editRowText->blockSignals( FALSE ); +} + +void TableEditor::deleteColumnClicked() +{ + if ( listColumns->currentItem() == -1 ) + return; +#ifndef QT_NO_TABLE + table->setNumCols( table->numCols() - 1 ); + delete listColumns->item( listColumns->currentItem() ); + readColumns(); + if ( listColumns->firstItem() ) { + listColumns->setCurrentItem( listColumns->firstItem() ); + listColumns->setSelected( listColumns->firstItem(), TRUE ); + } +#endif +} + +void TableEditor::deleteRowClicked() +{ + if ( listRows->currentItem() == -1 ) + return; +#ifndef QT_NO_TABLE + table->setNumRows( table->numRows() - 1 ); + delete listRows->item( listRows->currentItem() ); + readRows(); + if ( listRows->firstItem() ) { + listRows->setCurrentItem( listRows->firstItem() ); + listRows->setSelected( listRows->firstItem(), TRUE ); + } +#endif +} + +void TableEditor::newColumnClicked() +{ +#ifndef QT_NO_TABLE + table->setNumCols( table->numCols() + 1 ); + QMap m; + for ( int i = 0; i < table->numCols() - 1; ++i ) + m.insert( table->horizontalHeader()->label( i ), TRUE ); + int n = table->numCols() - 1; + QString t = QString::number( n ); + while ( m.find( t ) != m.end() ) + t = QString::number( ++n ); + table->horizontalHeader()->setLabel( table->numCols() - 1, t ); + listColumns->insertItem( t ); + QListBoxItem *item = listColumns->item( listColumns->count() - 1 ); + listColumns->setCurrentItem( item ); + listColumns->setSelected( item, TRUE ); +#ifndef QT_NO_SQL + if ( ::qt_cast(editTable) ) { + comboFields->setFocus(); + } else +#endif + { + editColumnText->setFocus(); + editColumnText->selectAll(); + } +#endif +} + +void TableEditor::newRowClicked() +{ +#ifndef QT_NO_TABLE + table->setNumRows( table->numRows() + 1 ); + QMap m; + for ( int i = 0; i < table->numRows() - 1; ++i ) + m.insert( table->verticalHeader()->label( i ), TRUE ); + int n = table->numRows() - 1; + QString t = QString::number( n ); + while ( m.find( t ) != m.end() ) + t = QString::number( ++n ); + table->verticalHeader()->setLabel( table->numRows() - 1, t ); + listRows->insertItem( t ); + QListBoxItem *item = listRows->item( listRows->count() - 1 ); + listRows->setCurrentItem( item ); + listRows->setSelected( item, TRUE ); +#endif +} + +void TableEditor::okClicked() +{ + applyClicked(); + accept(); +} + +void TableEditor::rowDownClicked() +{ + if ( listRows->currentItem() == -1 || + listRows->currentItem() == (int)listRows->count() - 1 || + listRows->count() < 2 ) + return; + int index = listRows->currentItem() + 1; + QListBoxItem *i = listRows->item( listRows->currentItem() ); + listRows->takeItem( i ); + listRows->insertItem( i, index ); + listRows->setCurrentItem( i ); + readRows(); +} + +void TableEditor::rowTextChanged( const QString &s ) +{ + if ( listRows->currentItem() == -1 ) + return; +#ifndef QT_NO_TABLE + listRows->changeItem( s, listRows->currentItem() ); + if ( table->verticalHeader()->iconSet( listRows->currentItem() ) ) + table->verticalHeader()->setLabel( listRows->currentItem(), + *table->verticalHeader()->iconSet( listRows->currentItem() ), s ); + else + table->verticalHeader()->setLabel( listRows->currentItem(), s ); +#endif +} + +void TableEditor::rowUpClicked() +{ + if ( listRows->currentItem() <= 0 || + listRows->count() < 2 ) + return; + int index = listRows->currentItem() - 1; + QListBoxItem *i = listRows->item( listRows->currentItem() ); + listRows->takeItem( i ); + listRows->insertItem( i, index ); + listRows->setCurrentItem( i ); + readRows(); +} + +void TableEditor::applyClicked() +{ + QValueList rows; + QValueList cols; + + int i = 0; +#ifndef QT_NO_TABLE + for ( i = 0; i < table->horizontalHeader()->count(); ++i ) { + PopulateTableCommand::Column col; + col.text = table->horizontalHeader()->label( i ); + if ( table->horizontalHeader()->iconSet( i ) ) + col.pix = table->horizontalHeader()->iconSet( i )->pixmap(); + col.field = *fieldMap.find( i ); + cols.append( col ); + } + for ( i = 0; i < table->verticalHeader()->count(); ++i ) { + PopulateTableCommand::Row row; + row.text = table->verticalHeader()->label( i ); + if ( table->verticalHeader()->iconSet( i ) ) + row.pix = table->verticalHeader()->iconSet( i )->pixmap(); + rows.append( row ); + } + PopulateTableCommand *cmd = new PopulateTableCommand( i18n( "Edit the Rows and Columns of '%1' " ).arg( editTable->name() ), + formWindow, editTable, rows, cols ); + cmd->execute(); + formWindow->commandHistory()->addCommand( cmd ); +#endif +} + +void TableEditor::chooseRowPixmapClicked() +{ + if ( listRows->currentItem() == -1 ) + return; + QPixmap pix; + if ( listRows->item( listRows->currentItem() )->pixmap() ) + pix = qChoosePixmap( this, formWindow, *listRows->item( listRows->currentItem() )->pixmap() ); + else + pix = qChoosePixmap( this, formWindow, QPixmap() ); + + if ( pix.isNull() ) + return; + +#ifndef QT_NO_TABLE + table->verticalHeader()->setLabel( listRows->currentItem(), pix, table->verticalHeader()->label( listRows->currentItem() ) ); + listRows->changeItem( pix, listRows->currentText(), listRows->currentItem() ); +#endif +} + +void TableEditor::deleteRowPixmapClicked() +{ + if ( listRows->currentItem() == -1 ) + return; +#ifndef QT_NO_TABLE + table->verticalHeader()->setLabel( listRows->currentItem(), QPixmap(), table->verticalHeader()->label( listRows->currentItem() ) ); + listRows->changeItem( listRows->currentText(), listRows->currentItem() ); +#endif +} + +void TableEditor::chooseColPixmapClicked() +{ + if ( listColumns->currentItem() == -1 ) + return; + QPixmap pix; + if ( listColumns->item( listColumns->currentItem() )->pixmap() ) + pix = qChoosePixmap( this, formWindow, *listColumns->item( listColumns->currentItem() )->pixmap() ); + else + pix = qChoosePixmap( this, formWindow, QPixmap() ); + + if ( pix.isNull() ) + return; +#ifndef QT_NO_TABLE + table->horizontalHeader()->setLabel( listColumns->currentItem(), pix, table->horizontalHeader()->label( listColumns->currentItem() ) ); + listColumns->changeItem( pix, listColumns->currentText(), listColumns->currentItem() ); +#endif +} + +void TableEditor::deleteColPixmapClicked() +{ + if ( listColumns->currentItem() == -1 ) + return; +#ifndef QT_NO_TABLE + table->horizontalHeader()->setLabel( listColumns->currentItem(), QPixmap(), table->horizontalHeader()->label( listColumns->currentItem() ) ); + listColumns->changeItem( listColumns->currentText(), listColumns->currentItem() ); +#endif +} + +void TableEditor::readFromTable() +{ +#ifndef QT_NO_TABLE + QHeader *cols = editTable->horizontalHeader(); + table->setNumCols( cols->count() ); + QMap columnFields = MetaDataBase::columnFields( editTable ); + for ( int i = 0; i < cols->count(); ++i ) { + if ( editTable->horizontalHeader()->iconSet( i ) ) { + table->horizontalHeader()->setLabel( i, *editTable->horizontalHeader()->iconSet( i ), + editTable->horizontalHeader()->label( i ) ); + listColumns->insertItem( editTable->horizontalHeader()->iconSet( i )->pixmap(), + editTable->horizontalHeader()->label( i ) ); + } else { + table->horizontalHeader()->setLabel( i, editTable->horizontalHeader()->label( i ) ); + listColumns->insertItem( editTable->horizontalHeader()->label( i ) ); + } + QString cf = *columnFields.find( editTable->horizontalHeader()->label( i ) ); + fieldMap.insert( i, cf ); + } + + if ( listColumns->firstItem() ) { + listColumns->setCurrentItem( listColumns->firstItem() ); + listColumns->setSelected( listColumns->firstItem(), TRUE ); + } + + QHeader *rows = editTable->verticalHeader(); + table->setNumRows( rows->count() ); + for ( int j = 0; j < rows->count(); ++j ) { + if ( editTable->verticalHeader()->iconSet( j ) ) { + table->verticalHeader()->setLabel( j, *editTable->verticalHeader()->iconSet( j ), + editTable->verticalHeader()->label( j ) ); + listRows->insertItem( editTable->verticalHeader()->iconSet( j )->pixmap(), + editTable->verticalHeader()->label( j ) ); + } else { + table->verticalHeader()->setLabel( j, editTable->verticalHeader()->label( j ) ); + listRows->insertItem( editTable->verticalHeader()->label( j ) ); + } + } + + if ( listRows->firstItem() ) { + listRows->setCurrentItem( listRows->firstItem() ); + listRows->setSelected( listRows->firstItem(), TRUE ); + } +#endif +} + +void TableEditor::readColumns() +{ + int j = 0; +#ifndef QT_NO_TABLE + for ( QListBoxItem *i = listColumns->firstItem(); i; i = i->next(), ++j ) { + if ( i->pixmap() ) + table->horizontalHeader()->setLabel( j, *i->pixmap(), i->text() ); + else + table->horizontalHeader()->setLabel( j, i->text() ); + } +#endif +} + +void TableEditor::readRows() +{ + int j = 0; +#ifndef QT_NO_TABLE + for ( QListBoxItem *i = listRows->firstItem(); i; i = i->next(), ++j ) { + if ( i->pixmap() ) + table->verticalHeader()->setLabel( j, *i->pixmap(), i->text() ); + else + table->verticalHeader()->setLabel( j, i->text() ); + } +#endif +} + +void TableEditor::saveFieldMap() +{ + tmpFieldMap.clear(); + for ( QMap::Iterator it = fieldMap.begin(); it != fieldMap.end(); ++it ) + tmpFieldMap.insert( listColumns->item( it.key() ), *it ); +} + +void TableEditor::restoreFieldMap() +{ + fieldMap.clear(); + for ( QMap::Iterator it = tmpFieldMap.begin(); it != tmpFieldMap.end(); ++it ) + fieldMap.insert( listColumns->index( it.key() ), *it ); +} diff --git a/kdevdesigner/designer/tableeditorimpl.h b/kdevdesigner/designer/tableeditorimpl.h new file mode 100644 index 00000000..8d5ed20d --- /dev/null +++ b/kdevdesigner/designer/tableeditorimpl.h @@ -0,0 +1,82 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef TABLEEDITORIMPL_H +#define TABLEEDITORIMPL_H + +#include "tableeditor.h" +#include + +class QListBoxItem; +class QTable; +class FormWindow; + +class TableEditor : public TableEditorBase +{ + Q_OBJECT + +public: + TableEditor( QWidget* parent = 0, QWidget *editWidget = 0, FormWindow *fw = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~TableEditor(); + +protected slots: + void columnDownClicked(); + void columnTextChanged( const QString & ); + void columnUpClicked(); + void currentColumnChanged( QListBoxItem * ); + void currentFieldChanged( const QString & ); + void currentRowChanged( QListBoxItem * ); + void deleteColumnClicked(); + void deleteRowClicked(); + void newColumnClicked(); + void newRowClicked(); + void okClicked(); + void rowDownClicked(); + void rowTextChanged( const QString & ); + void rowUpClicked(); + void applyClicked(); + void chooseRowPixmapClicked(); + void deleteRowPixmapClicked(); + void chooseColPixmapClicked(); + void deleteColPixmapClicked(); + +private: + void readFromTable(); + void readColumns(); + void readRows(); + void saveFieldMap(); + void restoreFieldMap(); + +private: + QTable *editTable; + FormWindow *formWindow; + QMap fieldMap; + QMap tmpFieldMap; + +}; + +#endif // TABLEEDITOR_H diff --git a/kdevdesigner/designer/timestamp.cpp b/kdevdesigner/designer/timestamp.cpp new file mode 100644 index 00000000..9cda96e6 --- /dev/null +++ b/kdevdesigner/designer/timestamp.cpp @@ -0,0 +1,86 @@ + /********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "timestamp.h" +#include +#include + +class QTimer; + +TimeStamp::TimeStamp( QObject *parent, const QString &f ) + : QObject( parent ), filename( f ), autoCheck( FALSE ) +{ + timer = new QTimer( this ); + connect( timer, SIGNAL( timeout() ), this, SLOT( autoCheckTimeStamp() ) ); + update(); +} + +void TimeStamp::setFileName( const QString &f ) +{ + filename = f; + update(); +} + +QString TimeStamp::fileName() const +{ + return filename; +} + +void TimeStamp::setAutoCheckEnabled( bool a ) +{ + autoCheck = a; + if ( autoCheck ) + timer->start( 5000 ); + else + timer->stop(); +} + +void TimeStamp::update() +{ + QFile f( filename ); + if ( !f.exists() ) + return; + lastTimeStamp = QFileInfo( f ).lastModified(); +} + +bool TimeStamp::isUpToDate() const +{ + QFile f( filename ); + if ( !f.exists() ) + return TRUE; + return lastTimeStamp == QFileInfo( f ).lastModified(); +} + +bool TimeStamp::isAutoCheckEnabled() const +{ + return autoCheck; +} + +void TimeStamp::autoCheckTimeStamp() +{ + if ( !isUpToDate() ) + emit timeStampChanged(); +} diff --git a/kdevdesigner/designer/timestamp.h b/kdevdesigner/designer/timestamp.h new file mode 100644 index 00000000..373fb884 --- /dev/null +++ b/kdevdesigner/designer/timestamp.h @@ -0,0 +1,63 @@ + /********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef TIMESTAMP_H +#define TIMESTAMP_H + +#include +#include +#include + +class TimeStamp : public QObject +{ + Q_OBJECT + +public: + TimeStamp( QObject *parent, const QString &f ); + + void setFileName( const QString &f ); + QString fileName() const; + void setAutoCheckEnabled( bool a ); + void update(); + + bool isUpToDate() const; + bool isAutoCheckEnabled() const; + +signals: + void timeStampChanged(); + +private slots: + void autoCheckTimeStamp(); + +private: + QDateTime lastTimeStamp; + QString filename; + bool autoCheck; + QTimer *timer; + +}; + +#endif diff --git a/kdevdesigner/designer/variabledialog.ui b/kdevdesigner/designer/variabledialog.ui new file mode 100644 index 00000000..a38954af --- /dev/null +++ b/kdevdesigner/designer/variabledialog.ui @@ -0,0 +1,294 @@ + +VariableDialogBase +********************************************************************* +** Copyright (C) 2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + VariableDialogBase + + + + 0 + 0 + 276 + 320 + + + + Edit Variables + + + + unnamed + + + 11 + + + 6 + + + + + Variable + + + true + + + true + + + + + Access + + + true + + + true + + + + varView + + + StyledPanel + + + Sunken + + + true + + + LastColumn + + + + + deleteButton + + + &Delete + + + + + propBox + + + Variable Properties + + + + unnamed + + + 11 + + + 6 + + + + TextLabel2 + + + Acc&ess: + + + accessCombo + + + + + TextLabel1 + + + &Variable: + + + varName + + + + + varName + + + + + + public + + + + + protected + + + + + private + + + + accessCombo + + + + + + + addButton + + + &Add + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 0 + 21 + + + + + + cancelButton + + + &Cancel + + + + + okButton + + + &OK + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 0 + 21 + + + + + + + + cancelButton + clicked() + VariableDialogBase + reject() + + + addButton + clicked() + VariableDialogBase + addVariable() + + + okButton + clicked() + VariableDialogBase + okClicked() + + + varName + textChanged(const QString&) + VariableDialogBase + nameChanged() + + + deleteButton + clicked() + VariableDialogBase + deleteVariable() + + + accessCombo + activated(int) + VariableDialogBase + accessChanged() + + + varView + currentChanged(QListViewItem*) + VariableDialogBase + currentItemChanged(QListViewItem*) + + + varView + selectionChanged(QListViewItem*) + VariableDialogBase + currentItemChanged(QListViewItem*) + + + + varView + addButton + deleteButton + varName + accessCombo + okButton + cancelButton + + + addVariable() + deleteVariable() + accessChanged() + nameChanged() + okClicked() + currentItemChanged( QListViewItem * i ) + + + diff --git a/kdevdesigner/designer/variabledialogimpl.cpp b/kdevdesigner/designer/variabledialogimpl.cpp new file mode 100644 index 00000000..abaa7c68 --- /dev/null +++ b/kdevdesigner/designer/variabledialogimpl.cpp @@ -0,0 +1,180 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include +#include +#include +#include +#include + +#include "metadatabase.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "hierarchyview.h" +#include "command.h" +#include "variabledialogimpl.h" + +#include + + +VariableDialog::VariableDialog( FormWindow *fw, QWidget *parent ) + : VariableDialogBase( parent ), formWindow( fw ) +{ + varView->setSorting( -1 ); + QValueList varLst = MetaDataBase::variables( formWindow ); + QValueList::Iterator it = varLst.begin(); + for ( ; it != varLst.end(); ++it ) { + QListViewItem *i = new QListViewItem( varView ); + i->setText( 0, (*it).varName ); + i->setText( 1, (*it).varAccess ); + } + + if ( varView->firstChild() ) + varView->setCurrentItem( varView->firstChild() ); + else + propBox->setEnabled( FALSE ); +} + +VariableDialog::~VariableDialog() +{ +} + +void VariableDialog::setCurrentItem( QString text ) +{ + QListViewItem *i = varView->findItem( text, 0 ); + if ( i ) + varView->setCurrentItem( i ); +} + +void VariableDialog::okClicked() +{ + QValueList lst; + + QListViewItemIterator it( varView ); + while ( it.current() != 0 ) { + MetaDataBase::Variable v; + v.varName = it.current()->text( 0 ).simplifyWhiteSpace(); + if ( v.varName[ (int)v.varName.length() - 1 ] != ';' ) + v.varName += ";"; + v.varAccess = it.current()->text( 1 ); + lst << v; + ++it; + } + + if ( !lst.isEmpty() ) { + QValueList invalidLst; + QValueList::Iterator it1 = lst.begin(); + QValueList::Iterator it2; + for ( ; it1 != lst.end(); ++it1 ) { + it2 = it1; + ++it2; + for ( ; it2 != lst.end(); ++it2 ) { + if ( MetaDataBase::extractVariableName( (*it1).varName ) == + MetaDataBase::extractVariableName( (*it2).varName ) ) { + invalidLst << (*it1); + break; + } + } + } + if ( !invalidLst.isEmpty() ) { + if ( QMessageBox::information( this, i18n( "Edit Variables" ), + i18n( "One variable has been declared twice.\n" + "Remove this variable?" ), i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) { + for ( it2 = invalidLst.begin(); it2 != invalidLst.end(); ++it2 ) { + it = varView->firstChild(); + while ( it.current() != 0 ) { + if ( MetaDataBase::extractVariableName( (*it)->text( 0 ).simplifyWhiteSpace() ) == + MetaDataBase::extractVariableName( (*it2).varName ) ) { + delete (*it); + break; + } + ++it; + } + } + } + formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView(); + return; + } + } + Command *cmd = new SetVariablesCommand( i18n( "Edit Variables" ), formWindow, lst ); + formWindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + accept(); +} + +void VariableDialog::addVariable() +{ + QListViewItem *i = new QListViewItem( varView, varView->lastItem() ); + i->setText( 0, "int newVariable" ); + i->setText( 1, "protected" ); + varView->setCurrentItem( i ); + varView->setSelected( i, TRUE ); + varName->setFocus(); + varName->selectAll(); +} + +void VariableDialog::deleteVariable() +{ + QListViewItem *i = varView->selectedItem(); + if ( !i ) + return; + delete i; + i = 0; + if ( varView->firstChild() ) + varView->setSelected( varView->firstChild(), TRUE ); +} + +void VariableDialog::currentItemChanged( QListViewItem *i ) +{ + if ( !i ) { + varName->clear(); + accessCombo->setCurrentItem( 1 ); + propBox->setEnabled( FALSE ); + return; + } + varName->setText( i->text( 0 ) ); + if ( i->text( 1 ) == "public" ) + accessCombo->setCurrentItem( 0 ); + else if ( i->text( 1 ) == "protected" ) + accessCombo->setCurrentItem( 1 ); + else + accessCombo->setCurrentItem( 2 ); + propBox->setEnabled( TRUE ); +} + +void VariableDialog::nameChanged() +{ + if ( !varView->currentItem() ) + return; + varView->currentItem()->setText( 0, varName->text() ); +} + +void VariableDialog::accessChanged() +{ + if ( !varView->currentItem() ) + return; + varView->currentItem()->setText( 1, accessCombo->currentText() ); +} diff --git a/kdevdesigner/designer/variabledialogimpl.h b/kdevdesigner/designer/variabledialogimpl.h new file mode 100644 index 00000000..975e18d7 --- /dev/null +++ b/kdevdesigner/designer/variabledialogimpl.h @@ -0,0 +1,56 @@ +/********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef VARIABLEDIALOGIMPL_H +#define VARIABLEDIALOGIMPL_H + +#include "variabledialog.h" + +class FormWindow; +class QListView; + +class VariableDialog : public VariableDialogBase +{ + Q_OBJECT +public: + VariableDialog( FormWindow *fw, QWidget* parent = 0 ); + ~VariableDialog(); + + void setCurrentItem( QString text ); + +protected slots: + void okClicked(); + void addVariable(); + void deleteVariable(); + void nameChanged(); + void accessChanged(); + void currentItemChanged( QListViewItem *i ); + +private: + FormWindow *formWindow; +}; + +#endif diff --git a/kdevdesigner/designer/widgetaction.cpp b/kdevdesigner/designer/widgetaction.cpp new file mode 100644 index 00000000..36a9c14c --- /dev/null +++ b/kdevdesigner/designer/widgetaction.cpp @@ -0,0 +1,58 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "widgetaction.h" +#include +#include +#include "mainwindow.h" +#include +#include + +static QStyle *windowsStyle = 0; + +void WidgetAction::addedTo( QWidget *w, QWidget *container ) +{ + if ( ::qt_cast(w) && ::qt_cast(container->parent()->parent()) ) { + if ( !windowsStyle ) + windowsStyle = QStyleFactory::create( "windows" ); + w->setStyle( windowsStyle ); + ( (QToolButton*)w )->setUsesTextLabel( TRUE ); + ( (QToolButton*)w )->setTextPosition( QToolButton::Right ); + w->setBackgroundMode( container->backgroundMode() ); + } +} + +WidgetAction::~WidgetAction() +{ + if ( MainWindow::self ) + MainWindow::self->toolActions.removeRef( this ); +} + +void WidgetAction::init( const QString &g ) +{ + MainWindow::self->toolActions.append( this ); + grp = g; +} diff --git a/kdevdesigner/designer/widgetaction.h b/kdevdesigner/designer/widgetaction.h new file mode 100644 index 00000000..6215d88d --- /dev/null +++ b/kdevdesigner/designer/widgetaction.h @@ -0,0 +1,65 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIDGETACTION_H +#define WIDGETACTION_H + +#include + +class WidgetAction : public QAction +{ + Q_OBJECT + +public: + WidgetAction( const QString &grp, QObject* parent, + const char* name = 0, bool toggle = FALSE ) + : QAction( parent, name, toggle ) { init( grp ); } + WidgetAction( const QString &grp, const QString& text, + const QIconSet& icon, const QString& menuText, QKeySequence accel, + QObject* parent, const char* name = 0, bool toggle = FALSE ) + : QAction( text, icon, menuText, accel, parent, name, toggle ) { init( grp ); } + WidgetAction( const QString &grp, const QString& text, + const QString& menuText, QKeySequence accel, QObject* parent, + const char* name = 0, bool toggle = FALSE ) + : QAction( text, menuText, accel, parent, name, toggle ) { init( grp ); } + ~WidgetAction(); + +#if !defined(Q_NO_USING_KEYWORD) + using QAction::addedTo; +#endif + void addedTo( QWidget *, QWidget * ); + + QString group() const { return grp; } + +private: + void init( const QString &g ); + +private: + QString grp; + +}; + +#endif diff --git a/kdevdesigner/designer/widgetfactory.cpp b/kdevdesigner/designer/widgetfactory.cpp new file mode 100644 index 00000000..191fbb1f --- /dev/null +++ b/kdevdesigner/designer/widgetfactory.cpp @@ -0,0 +1,1797 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler need this here +#include "widgetfactory.h" +#include +#include "metadatabase.h" +#include "mainwindow.h" +#include "formwindow.h" +#include "propertyeditor.h" +#include "layout.h" +#include "listboxeditorimpl.h" +#include "listvieweditorimpl.h" +#include "iconvieweditorimpl.h" +#include "formwindow.h" +#include "multilineeditorimpl.h" +#include "../interfaces/widgetinterface.h" +#ifndef QT_NO_TABLE +#include "tableeditorimpl.h" +#endif +#include "project.h" +#include "menubareditor.h" +#include "popupmenueditor.h" + +#include "kdevdesigner_part.h" + +#include + +#include + +#include +#include +#include +#ifndef QT_NO_TABLE +#include +#endif +#ifndef QT_NO_SQL +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_SQL +#include "database.h" +#endif + +#define NO_STATIC_COLORS +#include +#include + +#include + +FormWindow *find_formwindow( QWidget *w ) +{ + if ( !w ) + return 0; + for (;;) { + if ( ::qt_cast(w) ) + return (FormWindow*)w; + if ( !w->parentWidget() ) + return 0; + w = w->parentWidget(); + } +} + +void QLayoutWidget::paintEvent( QPaintEvent* ) +{ + QPainter p ( this ); + p.setPen( red ); + p.drawRect( rect() ); +} + + +QDesignerTabWidget::QDesignerTabWidget( QWidget *parent, const char *name ) + : QTabWidget( parent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( FALSE ) +{ + tabBar()->setAcceptDrops( TRUE ); + tabBar()->installEventFilter( this ); +} + +int QDesignerTabWidget::currentPage() const +{ + return tabBar()->currentTab(); +} + +void QDesignerTabWidget::setCurrentPage( int i ) +{ + tabBar()->setCurrentTab( i ); +} + +QString QDesignerTabWidget::pageTitle() const +{ + return ((QTabWidget*)this)->tabLabel( QTabWidget::currentPage() ); +} + +void QDesignerTabWidget::setPageTitle( const QString& title ) +{ + changeTab( QTabWidget::currentPage(), title ); +} + +void QDesignerTabWidget::setPageName( const QCString& name ) +{ + if ( QTabWidget::currentPage() ) + QTabWidget::currentPage()->setName( name ); +} + +QCString QDesignerTabWidget::pageName() const +{ + if ( !QTabWidget::currentPage() ) + return 0; + return QTabWidget::currentPage()->name(); +} + +int QDesignerTabWidget::count() const +{ + return tabBar()->count(); +} + +bool QDesignerTabWidget::eventFilter( QObject *o, QEvent *e ) +{ + if ( o != tabBar() ) return FALSE; + + switch ( e->type() ) { + case QEvent::MouseButtonPress: { + mousePressed = TRUE; + QMouseEvent *me = (QMouseEvent*)e; + pressPoint = me->pos(); + } + break; + case QEvent::MouseMove: { + QMouseEvent *me = (QMouseEvent*)e; + if ( mousePressed && ( pressPoint - me->pos()).manhattanLength() > QApplication::startDragDistance() ) { + QTextDrag *drg = new QTextDrag( QString::number( (long) this ) , this ); + mousePressed = FALSE; + dragPage = QTabWidget::currentPage(); + dragLabel = QTabWidget::tabLabel( dragPage ); + + int index = indexOf( dragPage ); + + removePage( dragPage ); + if ( !drg->dragMove() ) { + insertTab( dragPage, dragLabel, index ); + showPage( dragPage ); + } + if ( dropIndicator ) + dropIndicator->hide(); + } + } + break; + case QEvent::DragLeave: { + if ( dropIndicator ) + dropIndicator->hide(); + } + break; + case QEvent::DragMove: { + QDragEnterEvent *de = (QDragEnterEvent*) e; + if ( QTextDrag::canDecode( de ) ) { + QString text; + QTextDrag::decode( de, text ); + if ( text == QString::number( (long)this ) ) + de->accept(); + else + return FALSE; + } + + int index = 0; + QRect rect; + for ( ; index < tabBar()->count(); index++ ) { + if ( tabBar()->tabAt( index )->rect().contains( de->pos() ) ) { + rect = tabBar()->tabAt( index )->rect(); + break; + } + } + + if ( index == tabBar()->count() -1 ) { + QRect rect2 = rect; + rect2.setLeft( rect2.left() + rect2.width() / 2 ); + if ( rect2.contains( de->pos() ) ) + index++; + } + + if ( ! dropIndicator ) { + dropIndicator = new QWidget( this ); + dropIndicator->setBackgroundColor( red ); + } + + QPoint pos; + if ( index == tabBar()->count() ) + pos = tabBar()->mapToParent( QPoint( rect.x() + rect.width(), rect.y() ) ); + else + pos = tabBar()->mapToParent( QPoint( rect.x(), rect.y() ) ); + + dropIndicator->setGeometry( pos.x(), pos.y() , 3, rect.height() ); + dropIndicator->show(); + } + break; + case QEvent::Drop: { + QDragEnterEvent *de = (QDragEnterEvent*) e; + if ( QTextDrag::canDecode( de ) ) { + QString text; + QTextDrag::decode( de, text ); + if ( text == QString::number( (long)this ) ) { + + int newIndex = 0; + for ( ; newIndex < tabBar()->count(); newIndex++ ) { + if ( tabBar()->tabAt( newIndex )->rect().contains( de->pos() ) ) + break; + } + + if ( newIndex == tabBar()->count() -1 ) { + QRect rect2 = tabBar()->tabAt( newIndex )->rect(); + rect2.setLeft( rect2.left() + rect2.width() / 2 ); + if ( rect2.contains( de->pos() ) ) + newIndex++; + } + + int oldIndex = 0; + for ( ; oldIndex < tabBar()->count(); oldIndex++ ) { + if ( tabBar()->tabAt( oldIndex )->rect().contains( pressPoint ) ) + break; + } + + FormWindow *fw = find_formwindow( this ); + MoveTabPageCommand *cmd = + new MoveTabPageCommand( i18n( "Move Tab Page" ), fw, this, + dragPage, dragLabel, newIndex, oldIndex ); + fw->commandHistory()->addCommand( cmd ); + cmd->execute(); + de->accept(); + } + } + } + break; + default: + break; + } + return FALSE; +} + + +QDesignerWidgetStack::QDesignerWidgetStack( QWidget *parent, const char *name ) + : QWidgetStack( parent, name ) +{ + prev = new QToolButton( Qt::LeftArrow, this, "designer_wizardstack_button" ); + prev->setAutoRaise( TRUE ); + prev->setAutoRepeat( TRUE ); + prev->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ) ); + next = new QToolButton( Qt::RightArrow, this, "designer_wizardstack_button" ); + next->setAutoRaise( TRUE ); + next->setAutoRepeat( TRUE ); + next->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ) ); + connect( prev, SIGNAL( clicked() ), this, SLOT( prevPage() ) ); + connect( next, SIGNAL( clicked() ), this, SLOT( nextPage() ) ); + updateButtons(); +} + +void QDesignerWidgetStack::updateButtons() +{ + prev->setGeometry( width() - 31, 1, 15, 15 ); + next->setGeometry( width() - 16, 1, 15, 15 ); + prev->show(); + next->show(); + prev->raise(); + next->raise(); +} + +void QDesignerWidgetStack::prevPage() +{ + setCurrentPage( currentPage() - 1 ); +} + +void QDesignerWidgetStack::nextPage() +{ + setCurrentPage( currentPage() + 1 ); +} + +int QDesignerWidgetStack::currentPage() const +{ + QDesignerWidgetStack* that = (QDesignerWidgetStack*) this; + return that->pages.find( visibleWidget() ); +} + +void QDesignerWidgetStack::setCurrentPage( int i ) +{ + // help next/prev page commands + if ( i < 0 ) + i += count(); + if ( i >= count() ) + i -= count(); + + if ( i < 0 || i >= count() ) + return; + raiseWidget( pages.at( i ) ); + updateButtons(); +} + +QCString QDesignerWidgetStack::pageName() const +{ + if ( !visibleWidget() ) + return 0; + return visibleWidget()->name(); +} + +void QDesignerWidgetStack::setPageName( const QCString& name ) +{ + if ( visibleWidget() ) + visibleWidget()->setName( name ); +} + +int QDesignerWidgetStack::count() const +{ + return pages.count(); +} + +QWidget* QDesignerWidgetStack::page( int i ) const +{ + if ( i < 0 || i >= count() ) + return 0; + QDesignerWidgetStack* that = (QDesignerWidgetStack*) this; + return that->pages.at( i ); +} + + +int QDesignerWidgetStack::insertPage( QWidget *p, int i ) +{ + if ( i < 0 ) + pages.append( p ); + else + pages.insert( (uint) i, p ); + addWidget( p ); + p->show(); + raiseWidget( p ); + QApplication::sendPostedEvents(); + updateButtons(); + return pages.find( p ); +} + +int QDesignerWidgetStack::removePage( QWidget *p ) +{ + int i = pages.find( p ); + pages.remove( p ); + removeWidget( p ); + setCurrentPage( 0 ); + updateButtons(); + return i; +} + + +int QDesignerWizard::currentPageNum() const +{ + for ( int i = 0; i < pageCount(); ++i ) { + if ( page( i ) == currentPage() ) + return i; + } + return 0; +} + + + + + +void QDesignerWizard::setCurrentPage( int i ) +{ + if ( i < currentPageNum() ) { + while ( i < currentPageNum() ) { + if ( currentPageNum() == 0 ) + break; + back(); + } + + } else { + while ( i > currentPageNum() ) { + if ( currentPageNum() == pageCount() - 1 ) + break; + next(); + } + } +} + +QString QDesignerWizard::pageTitle() const +{ + return title( currentPage() ); +} + +void QDesignerWizard::setPageTitle( const QString& title ) +{ + setTitle( currentPage(), title ); +} + +void QDesignerWizard::setPageName( const QCString& name ) +{ + if ( QWizard::currentPage() ) + QWizard::currentPage()->setName( name ); +} + +QCString QDesignerWizard::pageName() const +{ + if ( !QWizard::currentPage() ) + return 0; + return QWizard::currentPage()->name(); +} + +int QDesignerWizard::pageNum( QWidget *p ) +{ + for ( int i = 0; i < pageCount(); ++i ) { + if ( page( i ) == p ) + return i; + } + return -1; +} + +void QDesignerWizard::addPage( QWidget *p, const QString &t ) +{ + QWizard::addPage( p, t ); + if ( removedPages.find( p ) ) + removedPages.remove( p ); +} + +void QDesignerWizard::removePage( QWidget *p ) +{ + QWizard::removePage( p ); + removedPages.insert( p, p ); +} + +void QDesignerWizard::insertPage( QWidget *p, const QString &t, int index ) +{ + QWizard::insertPage( p, t, index ); + if ( removedPages.find( p ) ) + removedPages.remove( p ); +} + +QMap< int, QMap< QString, QVariant> > *defaultProperties = 0; +QMap< int, QStringList > *changedProperties = 0; + +/*! + \class WidgetFactory widgetfactory.h + \brief Set of static functions for creating widgets, layouts and do other stuff + + The widget factory offers functions to create widgets, create and + delete layouts find out other details - all based on the + WidgetDatabase's data. So the functions that use ids use the same + ids as in the WidgetDatabase. +*/ + + +void WidgetFactory::saveDefaultProperties( QObject *w, int id ) +{ + QMap< QString, QVariant> propMap; + QStrList lst = w->metaObject()->propertyNames( TRUE ); + for ( uint i = 0; i < lst.count(); ++i ) { + QVariant var = w->property( lst.at( i ) ); + if ( !var.isValid() && qstrcmp( "pixmap", lst.at( i ) ) == 0 ) + var = QVariant( QPixmap() ); + else if ( !var.isValid() && qstrcmp( "iconSet", lst.at( i ) ) == 0 ) + var = QVariant( QIconSet() ); + propMap.replace( lst.at( i ), var ); + } + defaultProperties->replace( id, propMap ); +} + +void WidgetFactory::saveChangedProperties( QObject *w, int id ) +{ + QStringList l = MetaDataBase::changedProperties( w ); + changedProperties->insert( id, l ); +} + +/*! Creates a widget of the type which is registered as \a id as + child of \a parent. The \a name is optional. If \a init is TRUE, the + widget is initialized with some defaults, else the plain widget is + created. +*/ + +QWidget *WidgetFactory::create( int id, QWidget *parent, const char *name, bool init, const QRect *r, Qt::Orientation orient ) +{ + QString n = WidgetDatabase::className( id ); + if ( n.isEmpty() ) + return 0; + + if ( !defaultProperties ) { + defaultProperties = new QMap< int, QMap< QString, QVariant> >(); + changedProperties = new QMap< int, QStringList >(); + } + + QWidget *w = 0; + QString str = WidgetDatabase::createWidgetName( id ); + const char *s = str.latin1(); + w = createWidget( n, parent, name ? name : s, init, r, orient ); + if ( ::qt_cast(w) ) + ( (QScrollView*)w )->disableSizeHintCaching(); + if ( !w && WidgetDatabase::isCustomWidget( id ) ) + w = createCustomWidget( parent, name ? name : s, MetaDataBase::customWidget( id ) ); + if ( !w ) + return 0; + MetaDataBase::addEntry( w ); + + if ( !defaultProperties->contains( id ) ) + saveDefaultProperties( w, id ); + if ( !changedProperties->contains( id ) ) + saveChangedProperties( w, id ); + + return w; +} + +/*! Creates a layout on the widget \a widget of the type \a type + which can be \c HBox, \c VBox or \c Grid. +*/ + +QLayout *WidgetFactory::createLayout( QWidget *widget, QLayout *layout, LayoutType type ) +{ + int spacing = MainWindow::self->currentLayoutDefaultSpacing(); + int margin = 0; + + int metaspacing = MetaDataBase::spacing( widget ); + int metamargin = MetaDataBase::margin( widget ); + + if ( ::qt_cast(widget) && + ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( widget ) ) ) || + widget && ::qt_cast(widget->parentWidget()) ) ) + margin = MainWindow::self->currentLayoutDefaultMargin(); + + if ( !layout && ::qt_cast(widget) ) + widget = ((QTabWidget*)widget)->currentPage(); + + if ( !layout && ::qt_cast(widget) ) + widget = ((QWizard*)widget)->currentPage(); + + if ( !layout && ::qt_cast(widget) ) + widget = ((QMainWindow*)widget)->centralWidget(); + + if ( !layout && ::qt_cast(widget) ) + widget = ((QWidgetStack*)widget)->visibleWidget(); + + if ( !layout && ::qt_cast(widget) ) + widget = ((QToolBox*)widget)->currentItem(); + + MetaDataBase::addEntry( widget ); + + QLayout *l = 0; + int align = 0; + if ( !layout && ::qt_cast(widget) ) { + QGroupBox *gb = (QGroupBox*)widget; + gb->setColumnLayout( 0, Qt::Vertical ); + layout = gb->layout(); + layout->setMargin( 0 ); + layout->setSpacing( 0 ); + switch ( type ) { + case HBox: + l = new QHBoxLayout( layout ); + break; + case VBox: + l = new QVBoxLayout( layout ); + break; + case Grid: + l = new QDesignerGridLayout( layout ); + break; + default: + return 0; + } + align = Qt::AlignTop; + MetaDataBase::setMargin( gb, metamargin ); + MetaDataBase::setSpacing( gb, metaspacing ); + } else { + if ( layout ) { + switch ( type ) { + case HBox: + l = new QHBoxLayout( layout ); + break; + case VBox: + l = new QVBoxLayout( layout ); + break; + case Grid: + l = new QDesignerGridLayout( layout ); + break; + default: + return 0; + } + MetaDataBase::addEntry( l ); + l->setSpacing( spacing ); + l->setMargin( margin ); + } else { + switch ( type ) { + case HBox: + l = new QHBoxLayout( widget ); + break; + case VBox: + l = new QVBoxLayout( widget ); + break; + case Grid: + l = new QDesignerGridLayout( widget ); + break; + default: + return 0; + } + MetaDataBase::addEntry( l ); + if ( widget ) { + MetaDataBase::setMargin( widget, metamargin ); + MetaDataBase::setSpacing( widget, metaspacing ); + } else { + l->setMargin( margin ); + l->setSpacing( spacing ); + } + } + } + l->setAlignment( align ); + MetaDataBase::addEntry( l ); + return l; +} + +void WidgetFactory::deleteLayout( QWidget *widget ) +{ + if ( !widget ) + return; + + if ( ::qt_cast(widget) ) + widget = ((QTabWidget*)widget)->currentPage(); + if ( ::qt_cast(widget) ) + widget = ((QWizard*)widget)->currentPage(); + if ( ::qt_cast(widget) ) + widget = ((QMainWindow*)widget)->centralWidget(); + if ( ::qt_cast(widget) ) + widget = ((QWidgetStack*)widget)->visibleWidget(); + if ( ::qt_cast(widget) ) + widget = ((QToolBox*)widget)->currentItem(); + delete widget->layout(); +} + +/*! Factory functions for creating a widget of the type \a className + as child of \a parent with the name \a name. + + If \a init is TRUE, some initial default properties are set. This + has to be in sync with the initChangedProperties() function! +*/ + +QWidget *WidgetFactory::createWidget( const QString &className, QWidget *parent, const char *name, bool init, + const QRect *r, Qt::Orientation orient ) +{ + if ( className == "QPushButton" ) { + QPushButton *b = 0; + if ( init ) { + b = new QDesignerPushButton( parent, name ); + b->setText( QString::fromLatin1( name ) ); + } else { + b = new QDesignerPushButton( parent, name ); + } + QWidget *w = find_formwindow( b ); + b->setAutoDefault( w && ::qt_cast(((FormWindow*)w)->mainContainer()) ); + return b; + } else if ( className == "QToolButton" ) { + if ( init ) { + QDesignerToolButton *tb = new QDesignerToolButton( parent, name ); + if ( ::qt_cast(widgetOfContainer(parent))) { + tb->setUsesTextLabel(TRUE); + tb->setTextLabel("..."); + tb->setAutoRaise(TRUE); + tb->setTextPosition(QToolButton::BesideIcon); + } else { + tb->setText( "..." ); + } + return tb; + } + return new QDesignerToolButton( parent, name ); + } else if ( className == "QCheckBox" ) { + if ( init ) { + QDesignerCheckBox *cb = new QDesignerCheckBox( parent, name ); + cb->setText( QString::fromLatin1( name ) ); + return cb; + } + return new QDesignerCheckBox( parent, name ); + } else if ( className == "QRadioButton" ) { + if ( init ) { + QDesignerRadioButton *rb = new QDesignerRadioButton( parent, name ); + rb->setText( QString::fromLatin1( name ) ); + return rb; + } + return new QDesignerRadioButton( parent, name ); + } else if ( className == "QGroupBox" ) { + if ( init ) + return new QGroupBox( QString::fromLatin1( name ), parent, name ); + return new QGroupBox( parent, name ); + } else if ( className == "QButtonGroup" ) { + if ( init ) + return new QButtonGroup( QString::fromLatin1( name ), parent, name ); + return new QButtonGroup( parent, name ); + } else if ( className == "QIconView" ) { +#if !defined(QT_NO_ICONVIEW) + QIconView* iv = new QIconView( parent, name ); + if ( init ) + (void) new QIconViewItem( iv, i18n( "New Item" ) ); + return iv; +#else + return 0; +#endif + } else if ( className == "QTable" ) { +#if !defined(QT_NO_TABLE) + if ( init ) + return new QTable( 3, 3, parent, name ); + return new QTable( parent, name ); +#else + return 0; +#endif +#ifndef QT_NO_SQL + } else if ( className == "QDataTable" ) { + return new QDataTable( parent, name ); +#endif //QT_NO_SQL + } else if ( className == "QDateEdit" ) { + return new QDateEdit( parent, name ); + } else if ( className == "QTimeEdit" ) { + return new QTimeEdit( parent, name ); + } else if ( className == "QDateTimeEdit" ) { + return new QDateTimeEdit( parent, name ); + } + else if ( className == "QListBox" ) { + QListBox* lb = new QListBox( parent, name ); + if ( init ) { + lb->insertItem( i18n( "New Item" ) ); + lb->setCurrentItem( 0 ); + } + return lb; + } else if ( className == "QListView" ) { + QListView *lv = new QListView( parent, name ); + lv->setSorting( -1 ); + if ( init ) { + lv->addColumn( i18n( "Column 1" ) ); + lv->setCurrentItem( new QListViewItem( lv, i18n( "New Item" ) ) ); + } + return lv; + } else if ( className == "QLineEdit" ) + return new QLineEdit( parent, name ); + else if ( className == "QSpinBox" ) + return new QSpinBox( parent, name ); + else if ( className == "QSplitter" ) + return new QSplitter( parent, name ); + else if ( className == "QMultiLineEdit" ) + return new QMultiLineEdit( parent, name ); + else if ( className == "QTextEdit" ) + return new QTextEdit( parent, name ); + else if ( className == "QLabel" || className == "TextLabel" ) { + QDesignerLabel *l = new QDesignerLabel( parent, name ); + if ( init ) { + l->setText( QString::fromLatin1( name ) ); + MetaDataBase::addEntry( l ); + MetaDataBase::setPropertyChanged( l, "text", TRUE ); + } + return l; + } else if ( className == "PixmapLabel" ) { + QDesignerLabel *l = new QDesignerLabel( parent, name ); + if ( init ) { + l->setPixmap( BarIcon( "designer_qtlogo.png", KDevDesignerPartFactory::instance() ) ); + l->setScaledContents( TRUE ); + MetaDataBase::addEntry( l ); + MetaDataBase::setPropertyChanged( l, "pixmap", TRUE ); + MetaDataBase::setPropertyChanged( l, "scaledContents", TRUE ); + } + return l; + } else if ( className == "QLayoutWidget" ) + return new QLayoutWidget( parent, name ); + else if ( className == "QTabWidget" ) { + QTabWidget *tw = new QDesignerTabWidget( parent, name ); + if ( init ) { + FormWindow *fw = find_formwindow( parent ); + QWidget *w = fw ? new QDesignerWidget( fw, tw, "tab" ) : new QWidget( tw, "tab" ); + tw->addTab( w, i18n("Tab 1") ); + MetaDataBase::addEntry( w ); + w = fw ? new QDesignerWidget( fw, tw, "tab" ) : new QWidget( tw, "tab" ); + tw->addTab( w, i18n("Tab 2") ); + MetaDataBase::addEntry( tw ); + MetaDataBase::addEntry( w ); + } + return tw; + } else if ( className == "QWidgetStack" ) { + QDesignerWidgetStack *ws = new QDesignerWidgetStack( parent, name ); + if ( init ) { + FormWindow *fw = find_formwindow( parent ); + QWidget *w = fw ? new QDesignerWidget( fw, ws, "WStackPage" ) : new QWidget( ws, "WStackPage" ); + ws->insertPage( w ); + MetaDataBase::addEntry( w ); + MetaDataBase::addEntry( ws ); + } + return ws; + } else if ( className == "QComboBox" ) { + return new QComboBox( FALSE, parent, name ); + } else if ( className == "QWidget" ) { + if ( parent && + ( ::qt_cast(parent) || + ::qt_cast(parent) || + ::qt_cast(parent) || + ::qt_cast(parent) || + ::qt_cast(parent) || + ::qt_cast(parent) ) ) { + FormWindow *fw = find_formwindow( parent ); + if ( fw ) { + QDesignerWidget *dw = new QDesignerWidget( fw, parent, name ); + MetaDataBase::addEntry( dw ); + return dw; + } + } + return new QWidget( parent, name ); + } else if ( className == "QDialog" ) { + QDialog *dia = 0; + if ( ::qt_cast(parent) ) + dia = new QDesignerDialog( (FormWindow*)parent, parent, name ); + else + dia = new QDialog( parent, name ); +#if defined(QT_NON_COMMERCIAL) + if ( ::qt_cast(parent) ) +#else + if ( parent ) +#endif + dia->reparent( parent, QPoint( 0, 0 ), TRUE ); + return dia; + } else if ( className == "QWizard" ) { + QWizard *wiz = new QDesignerWizard( parent, name ); +#if defined(QT_NON_COMMERCIAL) + if ( ::qt_cast(parent) ) +#else + if ( parent ) +#endif + wiz->reparent( parent, QPoint( 0, 0 ), TRUE ); + if ( init && ::qt_cast(parent) ) { + QDesignerWidget *dw = new QDesignerWidget( (FormWindow*)parent, wiz, "WizardPage" ); + MetaDataBase::addEntry( dw ); + wiz->addPage( dw, i18n( "Page" ) ); + QTimer::singleShot( 0, wiz, SLOT( next() ) ); + } + return wiz; + } else if ( className == "Spacer" ) { + Spacer *s = new Spacer( parent, name ); + MetaDataBase::addEntry( s ); + MetaDataBase::setPropertyChanged( s, "orientation", TRUE ); + MetaDataBase::setPropertyChanged( s, "sizeType", TRUE ); + if ( !r ) + return s; + if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) + s->setOrientation( orient ); + else if ( r->width() < r->height() ) + s->setOrientation( Qt::Vertical ); + else + s->setOrientation( Qt::Horizontal ); + return s; + } else if ( className == "QLCDNumber" ) + return new QLCDNumber( parent, name ); + else if ( className == "QProgressBar" ) + return new QProgressBar( parent, name ); + else if ( className == "QTextView" ) + return new QTextView( parent, name ); + else if ( className == "QTextBrowser" ) + return new QTextBrowser( parent, name ); + else if ( className == "QDial" ) + return new QDial( parent, name ); + else if ( className == "QSlider" ) { + QSlider *s = new QSlider( parent, name ); + if ( !r ) + return s; + if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) + s->setOrientation( orient ); + else if ( r->width() > r->height() ) + s->setOrientation( Qt::Horizontal ); + MetaDataBase::addEntry( s ); + MetaDataBase::setPropertyChanged( s, "orientation", TRUE ); + return s; + } else if ( className == "QScrollBar" ) { + QScrollBar *s = new QScrollBar( parent, name ); + if ( !r ) + return s; + if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) + s->setOrientation( orient ); + else if ( r->width() > r->height() ) + s->setOrientation( Qt::Horizontal ); + MetaDataBase::addEntry( s ); + MetaDataBase::setPropertyChanged( s, "orientation", TRUE ); + return s; + } else if ( className == "QFrame" ) { + if ( !init ) + return new QFrame( parent, name ); + QFrame *f = new QFrame( parent, name ); + f->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); + return f; + } else if ( className == "Line" ) { + Line *l = new Line( parent, name ); + MetaDataBase::addEntry( l ); + MetaDataBase::setPropertyChanged( l, "orientation", TRUE ); + MetaDataBase::setPropertyChanged( l, "frameShadow", TRUE ); + MetaDataBase::setPropertyChanged( l, "frameShape", TRUE ); + if ( !r ) + return l; + if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) + l->setOrientation( orient ); + else if ( r->width() < r->height() ) + l->setOrientation( Qt::Vertical ); + return l; + } else if ( className == "QMainWindow" ) { + QMainWindow *mw = new QMainWindow( parent, name, 0 ); + mw->setDockEnabled( Qt::DockMinimized, FALSE ); + QDesignerWidget *dw = new QDesignerWidget( (FormWindow*)parent, mw, "central widget" ); + mw->setDockMenuEnabled( FALSE ); + MetaDataBase::addEntry( dw ); + mw->setCentralWidget( dw ); + (void)mw->statusBar(); + dw->show(); + return mw; + } else if ( className == "QToolBox" ) { + if ( !init ) + return new QDesignerToolBox( parent, name ); + QToolBox *tb = new QDesignerToolBox( parent, name ); + FormWindow *fw = find_formwindow( parent ); + QWidget *w = fw ? new QDesignerWidget( fw, tb, "page1" ) : + new QWidget( tb, "page1" ); + tb->addItem( w, i18n("Page 1") ); + MetaDataBase::addEntry( w ); + w = fw ? new QDesignerWidget( fw, tb, "page2" ) : new QWidget( tb, "page2" ); + tb->addItem( w, i18n("Page 2") ); + MetaDataBase::addEntry( tb ); + MetaDataBase::addEntry( w ); + return tb; + } +#ifndef QT_NO_SQL + else if ( className == "QDataBrowser" ) { + QWidget *w = new QDesignerDataBrowser( parent, name ); + if ( parent ) + w->reparent( parent, QPoint( 0, 0 ), TRUE ); + return w; + } else if ( className == "QDataView" ) { + QWidget *w = new QDesignerDataView( parent, name ); + if ( parent ) + w->reparent( parent, QPoint( 0, 0 ), TRUE ); + return w; + } +#endif + + WidgetInterface *iface = 0; + widgetManager()->queryInterface( className, &iface ); + if ( !iface ) + return 0; + + QWidget *w = iface->create( className, parent, name ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + if ( init && WidgetDatabase::isCustomPluginWidget( WidgetDatabase::idFromClassName( className ) ) ) { + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( iface2 ) { + iface2->addPage( className, w, "Page", -1 ); + iface2->release(); + } + } +#endif // QT_CONTAINER_CUSTOM_WIDGETS + iface->release(); + return w; +} + + + +/*! Find out which type the layout of the widget is. Returns \c HBox, + \c VBox, \c Grid or \c NoLayout. \a layout points to this + QWidget::layout() of \a w or to 0 after the function call. +*/ + +WidgetFactory::LayoutType WidgetFactory::layoutType( QWidget *w, QLayout *&layout ) +{ + layout = 0; + + if ( ::qt_cast(w) ) + w = ((QTabWidget*)w)->currentPage(); + if ( ::qt_cast(w) ) + w = ((QWizard*)w)->currentPage(); + if ( ::qt_cast(w) ) + w = ((QMainWindow*)w)->centralWidget(); + if ( ::qt_cast(w) ) + w = ((QWidgetStack*)w)->visibleWidget(); + if ( ::qt_cast(w) ) + w = ((QToolBox*)w)->currentItem(); + + if ( ::qt_cast(w) ) + return ( (QSplitter*)w )->orientation() == Horizontal ? HBox : VBox; + + if ( !w || !w->layout() ) + return NoLayout; + QLayout *lay = w->layout(); + + if ( ::qt_cast(w) ) { + QObjectList *l = lay->queryList( "QLayout" ); + if ( l && l->first() ) + lay = (QLayout*)l->first(); + delete l; + } + layout = lay; + + if ( ::qt_cast(lay) ) + return HBox; + else if ( ::qt_cast(lay) ) + return VBox; + else if ( ::qt_cast(lay) ) + return Grid; + return NoLayout; +} + +/*! + \overload +*/ +WidgetFactory::LayoutType WidgetFactory::layoutType( QLayout *layout ) +{ + if ( ::qt_cast(layout) ) + return HBox; + else if ( ::qt_cast(layout) ) + return VBox; + else if ( ::qt_cast(layout) ) + return Grid; + return NoLayout; +} + +/*! + \overload +*/ +WidgetFactory::LayoutType WidgetFactory::layoutType( QWidget *w ) +{ + QLayout *l = 0; + return layoutType( w, l ); +} + + +QWidget *WidgetFactory::layoutParent( QLayout *layout ) +{ + QObject *o = layout; + while ( o ) { + if ( o->isWidgetType() ) + return (QWidget*)o; + o = o->parent(); + } + return 0; +} + +/*! Returns the widget into which children should be inserted when \a + w is a container known to the designer. + + Usually that is \a w itself, sometimes it is different (e.g. a + tabwidget is known to the designer as a container but the child + widgets should be inserted into the current page of the + tabwidget. So in this case this function returns the current page of + the tabwidget.) + */ +QWidget* WidgetFactory::containerOfWidget( QWidget *w ) +{ + if ( !w ) + return w; + if ( ::qt_cast(w) ) + return ((QTabWidget*)w)->currentPage(); + if ( ::qt_cast(w) ) + return ((QWizard*)w)->currentPage(); + if ( ::qt_cast(w) ) + return ((QWidgetStack*)w)->visibleWidget(); + if ( ::qt_cast(w) ) + return ((QToolBox*)w)->currentItem(); + if ( ::qt_cast(w) ) + return ((QMainWindow*)w)->centralWidget(); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + if ( !WidgetDatabase::isCustomPluginWidget( WidgetDatabase::idFromClassName( classNameOf( w ) ) ) ) + return w; + WidgetInterface *iface = 0; + widgetManager()->queryInterface( classNameOf( w ), &iface ); + if ( !iface ) + return w; + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( !iface2 ) + return w; + QWidget *c = iface2->containerOfWidget( w->className(), w ); + iface2->release(); + iface->release(); + if ( c ) + return c; +#endif // QT_CONTAINER_CUSTOM_WIDGETS + return w; +} + +/*! Returns the actual designer widget of the container \a w. This is + normally \a w itself, but might be a parent or grand parent of \a w + (e.g. when working with a tabwidget and \a w is the container which + contains and layouts childs, but the actual widget known to the + designer is the tabwidget which is the parent of \a w. So this + function returns the tabwidget then.) +*/ + +QWidget* WidgetFactory::widgetOfContainer( QWidget *w ) +{ + if ( w && ::qt_cast(w->parentWidget()) ) + w = w->parentWidget(); + if ( w->parentWidget() && w->parentWidget()->parentWidget() && + w->parentWidget()->parentWidget()->parentWidget() && + ::qt_cast(w->parentWidget()->parentWidget()->parentWidget()) ) + return w->parentWidget()->parentWidget()->parentWidget(); + while ( w ) { + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ); + if ( WidgetDatabase::isContainer( id ) || + w && ::qt_cast(w->parentWidget()) ) + return w; + w = w->parentWidget(); + } + return w; +} + +/*! + Returns whether \a o is a passive interactor or not. + */ + +bool WidgetFactory::lastWasAPassiveInteractor = FALSE; +QGuardedPtr *WidgetFactory::lastPassiveInteractor = new QGuardedPtr(); + +bool WidgetFactory::isPassiveInteractor( QObject* o ) +{ + if ( lastPassiveInteractor && *lastPassiveInteractor && (QObject*)(*lastPassiveInteractor) == o ) + return lastWasAPassiveInteractor; + lastWasAPassiveInteractor = FALSE; + (*lastPassiveInteractor) = o; + if ( QApplication::activePopupWidget() ) // if a popup is open, we have to make sure that this one is closed, else X might do funny things + return ( lastWasAPassiveInteractor = TRUE ); + + if ( ::qt_cast(o) ) + return ( lastWasAPassiveInteractor = TRUE ); + else if ( ::qt_cast(o) ) + return ( lastWasAPassiveInteractor = TRUE ); + else if ( ::qt_cast(o) && + ( ::qt_cast(o->parent()) || ::qt_cast(o->parent()) ) ) + return ( lastWasAPassiveInteractor = TRUE ); + else if ( ::qt_cast(o) && ::qt_cast(o->parent()) ) + return ( lastWasAPassiveInteractor = TRUE ); + else if ( ::qt_cast(o) && ::qt_cast(o->parent()) ) + return ( lastWasAPassiveInteractor = TRUE ); +// else if ( ::qt_cast(o) ) + else if ( o->inherits( "QDockWindowHandle" ) ) + return ( lastWasAPassiveInteractor = TRUE ); +// else if ( ::qt_cast(o) ) + else if ( o->inherits( "QHideDock" ) ) + return ( lastWasAPassiveInteractor = TRUE ); + else if ( qstrcmp( o->name(), "designer_wizardstack_button" ) == 0 ) + return ( lastWasAPassiveInteractor = TRUE ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + if ( !o->isWidgetType() ) + return ( lastWasAPassiveInteractor = FALSE ); + WidgetInterface *iface = 0; + QWidget *w = (QWidget*)o; + while ( !iface && w && !::qt_cast(w) ) { + widgetManager()->queryInterface( classNameOf( w ), &iface ); + w = w->parentWidget(); + } + if ( !iface ) + return ( lastWasAPassiveInteractor = FALSE ); + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 ); + if ( !iface2 ) + return ( lastWasAPassiveInteractor = FALSE ); + QWidget *fw = MainWindow::self->isAFormWindowChild( (QWidget*)o ); + if ( !fw ) + return ( lastWasAPassiveInteractor = FALSE ); + QWidget *dw = ( (FormWindow*)fw )->designerWidget( (QWidget*)o ); + if ( !dw ) + return ( lastWasAPassiveInteractor = FALSE ); + lastWasAPassiveInteractor = iface2->isPassiveInteractor( dw->className(), (QWidget*)o ); + iface2->release(); + iface->release(); +#endif // QT_CONTAINER_CUSTOM_WIDGETS + return lastWasAPassiveInteractor; +} + + +/*! + Returns the class name of object \a o that should be used for externally (i.e. for saving) + */ +const char* WidgetFactory::classNameOf( QObject* o ) +{ + if ( o->isA( "PropertyObject" ) ) + return o->className(); + if (WidgetDatabase::isCustomPluginWidget(WidgetDatabase::idFromClassName(o->className()))) + return o->className(); + else if ( ::qt_cast(o) ) + return "QTabWidget"; + else if ( ::qt_cast(o) ) + return "QWidgetStack"; + else if ( ::qt_cast(o) ) + return "QWeDoNotWantToBreakTabWidget"; + else if ( ::qt_cast(o) ) + return "QDialog"; + else if ( ::qt_cast(o) ) + return "QWidget"; + else if ( o->inherits( "CustomWidget" ) ) + return ( (CustomWidget*)o )->realClassName().latin1(); + else if ( ::qt_cast(o) ) + return "QLabel"; + else if ( ::qt_cast(o) ) + return "QWizard"; + else if ( ::qt_cast(o) ) + return "QPushButton"; + else if ( ::qt_cast(o) ) + return "QToolButton"; + else if ( ::qt_cast(o) ) + return "QRadioButton"; + else if ( ::qt_cast(o) ) + return "QCheckBox"; + else if ( ::qt_cast(o) ) + return "QMenuBar"; + else if ( ::qt_cast(o) ) + return "QToolBar"; + else if ( ::qt_cast(o) ) + return "QAction"; + else if ( ::qt_cast(o) ) + return "QActionGroup"; + else if ( ::qt_cast(o) ) + return "QPopupMenu"; + else if ( ::qt_cast(o) ) + return "QToolBox"; +#ifndef QT_NO_SQL + else if ( ::qt_cast(o) ) + return "QDataBrowser"; + else if ( ::qt_cast(o) ) + return "QDataView"; +#endif + return o->className(); +} + +QString WidgetFactory::defaultSignal( QObject *w ) +{ + if ( ::qt_cast(w) || ::qt_cast(w) ) + return "toggled"; + else if ( ::qt_cast(w) || ::qt_cast(w) ) + return "clicked"; + else if ( ::qt_cast(w) ) + return "linkClicked"; + else if ( ::qt_cast(w) || ::qt_cast(w) ) + return "textChanged"; + else if ( ::qt_cast(w) || ::qt_cast(w) || + ::qt_cast(w) || ::qt_cast(w) ) + return "selectionChanged"; + else if ( ::qt_cast(w) ) + return "selected"; + else if ( ::qt_cast(w) ) + return "currentChanged"; + else if ( ::qt_cast(w) ) + return "aboutToShow"; + else if ( ::qt_cast(w) || ::qt_cast(w) || + ::qt_cast(w) || ::qt_cast(w) || + ::qt_cast(w) || ::qt_cast(w) || + ::qt_cast(w) ) + return "valueChanged"; + else if ( ::qt_cast(w) ) + return "activated"; + return QString::null; +} + +/*! As some properties are set by default when creating a widget this + functions markes this properties as changed. Has to be in sync with + createWidget()! +*/ + +void WidgetFactory::initChangedProperties( QObject *o ) +{ + if ( MainWindow::self && MainWindow::self->currProject() && + MainWindow::self->currProject()->fakeFormFileFor( o ) ) + return; + MetaDataBase::setPropertyChanged( o, "name", TRUE ); + if ( !::qt_cast(o) && !::qt_cast(o) ) + MetaDataBase::setPropertyChanged( o, "geometry", TRUE ); + + if ( ::qt_cast(o) || + ::qt_cast(o) || + ::qt_cast(o) || + ::qt_cast(o) ) { + if (::qt_cast(o) && ::qt_cast(widgetOfContainer((QWidget*)o->parent()))) { + MetaDataBase::setPropertyChanged( o, "usesTextLabel", TRUE ); + MetaDataBase::setPropertyChanged( o, "textLabel", TRUE ); + MetaDataBase::setPropertyChanged( o, "autoRaise", TRUE ); + MetaDataBase::setPropertyChanged( o, "textPosition", TRUE ); + } else { + MetaDataBase::setPropertyChanged( o, "text", TRUE ); + } + } + else if ( ::qt_cast(o) ) + MetaDataBase::setPropertyChanged( o, "title", TRUE ); + else if ( o->isA( "QFrame" ) ) { + MetaDataBase::setPropertyChanged( o, "frameShadow", TRUE ); + MetaDataBase::setPropertyChanged( o, "frameShape", TRUE ); + } else if ( ::qt_cast(o) || ::qt_cast(o) ) { + MetaDataBase::setPropertyChanged( o, "pageTitle", TRUE ); + MetaDataBase::setPropertyChanged( o, "pageName", TRUE ); + MetaDataBase::setPropertyChanged( o, "currentPage", TRUE ); + } else if ( ::qt_cast(o) ) { + MetaDataBase::setPropertyChanged( o, "currentPage", TRUE ); + MetaDataBase::setPropertyChanged( o, "pageName", TRUE ); + } else if ( ::qt_cast(o) ) { + MetaDataBase::setPropertyChanged( o, "currentIndex", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemName", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemLabel", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemIconSet", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemToolTip", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemBackgroundMode", TRUE ); +#ifndef QT_NO_TABLE + } else if ( ::qt_cast(o) ) { +# ifndef QT_NO_SQL + if (!::qt_cast(o) ) +# endif + { + MetaDataBase::setPropertyChanged( o, "numRows", TRUE ); + MetaDataBase::setPropertyChanged( o, "numCols", TRUE ); + QTable *t = (QTable*)o; + for ( int i = 0; i < 3; ++i ) { + t->horizontalHeader()->setLabel( i, QString::number( i + 1 ) ); + t->verticalHeader()->setLabel( i, QString::number( i + 1 ) ); + } + } +#endif + } else if ( ::qt_cast(o) ) { + MetaDataBase::setPropertyChanged( o, "orientation", TRUE ); + } else if ( ::qt_cast(o) ) { + MetaDataBase::setPropertyChanged( o, "label", TRUE ); + } else if ( ::qt_cast(o) ) { + MetaDataBase::setPropertyChanged( o, "itemName", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemNumber", TRUE ); + MetaDataBase::setPropertyChanged( o, "itemText", TRUE ); + } +} + +bool WidgetFactory::hasSpecialEditor( int id, QObject *editorWidget ) +{ + QString className = WidgetDatabase::className( id ); + + if ( className.contains( "ListBox" ) ) + return TRUE; + if ( className.contains( "ComboBox" ) ) + return TRUE; + if ( className.contains( "ListView" ) ) + return TRUE; + if ( className.contains( "IconView" ) ) + return TRUE; + if ( className == "QTextEdit" || className == "QMultiLineEdit" ) + return TRUE; + if ( ::qt_cast(editorWidget) != 0 ) + return TRUE; + + return FALSE; +} + +bool WidgetFactory::hasItems( int id, QObject *editorWidget ) +{ + QString className = WidgetDatabase::className( id ); + + if ( className.contains( "ListBox" ) || className.contains( "ListView" ) || + className.contains( "IconView" ) || className.contains( "ComboBox" ) || + ::qt_cast(editorWidget) != 0 ) + return TRUE; + + return FALSE; +} + +void WidgetFactory::editWidget( int id, QWidget *parent, QWidget *editWidget, FormWindow *fw ) +{ + QString className = WidgetDatabase::className( id ); + + if ( className.contains( "ListBox" ) ) { + if ( !::qt_cast(editWidget) ) + return; + ListBoxEditor *e = new ListBoxEditor( parent, editWidget, fw ); + e->exec(); + delete e; + return; + } + + if ( className.contains( "ComboBox" ) ) { + if ( !::qt_cast(editWidget) ) + return; + QComboBox *cb = (QComboBox*)editWidget; + ListBoxEditor *e = new ListBoxEditor( parent, cb->listBox(), fw ); + e->exec(); + delete e; + cb->update(); + return; + } + + if ( className.contains( "ListView" ) ) { + if ( !::qt_cast(editWidget) ) + return; + QListView *lv = (QListView*)editWidget; + ListViewEditor *e = new ListViewEditor( parent, lv, fw ); + e->exec(); + delete e; + return; + } + + if ( className.contains( "IconView" ) ) { + if ( !::qt_cast(editWidget) ) + return; + IconViewEditor *e = new IconViewEditor( parent, editWidget, fw ); + e->exec(); + delete e; + return; + } + + if ( className == "QMultiLineEdit" || className == "QTextEdit" ) { + MultiLineEditor *e = new MultiLineEditor( FALSE, TRUE, parent, editWidget, fw ); + e->exec(); + delete e; + return; + } +#ifndef QT_NO_TABLE + if (::qt_cast(editWidget) != 0) { + TableEditor *e = new TableEditor( parent, editWidget, fw ); + e->exec(); + delete e; + return; + } +#endif +} + +bool WidgetFactory::canResetProperty( QObject *w, const QString &propName ) +{ + if ( propName == "name" || propName == "geometry" ) + return FALSE; + QStringList l = *changedProperties->find( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ); + return l.findIndex( propName ) == -1; +} + +bool WidgetFactory::resetProperty( QObject *w, const QString &propName ) +{ + const QMetaProperty *p = w->metaObject()->property( w->metaObject()-> + findProperty( propName, TRUE ), TRUE ); + if (!p ) + return FALSE; + return p->reset( w ); +} + +QVariant WidgetFactory::defaultValue( QObject *w, const QString &propName ) +{ + if ( propName == "wordwrap" ) { + int v = defaultValue( w, "alignment" ).toInt(); + return QVariant( ( v & WordBreak ) == WordBreak, 0 ); + } else if ( propName == "toolTip" || propName == "whatsThis" ) { + return QVariant( QString::fromLatin1( "" ) ); + } else if ( w->inherits( "CustomWidget" ) ) { + return QVariant(); + } else if ( propName == "frameworkCode" ) { + return QVariant( TRUE, 0 ); + } else if ( propName == "layoutMargin" || propName == "layoutSpacing" ) { + return QVariant( -1 ); + } + + return *( *defaultProperties->find( WidgetDatabase::idFromClassName( classNameOf( w ) ) ) ).find( propName ); +} + +QString WidgetFactory::defaultCurrentItem( QObject *w, const QString &propName ) +{ + const QMetaProperty *p = w->metaObject()-> + property( w->metaObject()->findProperty( propName, TRUE ), TRUE ); + if ( !p ) { + int v = defaultValue( w, "alignment" ).toInt(); + if ( propName == "hAlign" ) { + if ( ( v & AlignAuto ) == AlignAuto ) + return "AlignAuto"; + if ( ( v & AlignLeft ) == AlignLeft ) + return "AlignLeft"; + if ( ( v & AlignCenter ) == AlignCenter || ( v & AlignHCenter ) == AlignHCenter ) + return "AlignHCenter"; + if ( ( v & AlignRight ) == AlignRight ) + return "AlignRight"; + if ( ( v & AlignJustify ) == AlignJustify ) + return "AlignJustify"; + } else if ( propName == "vAlign" ) { + if ( ( v & AlignTop ) == AlignTop ) + return "AlignTop"; + if ( ( v & AlignCenter ) == AlignCenter || ( v & AlignVCenter ) == AlignVCenter ) + return "AlignVCenter"; + if ( ( v & AlignBottom ) == AlignBottom ) + return "AlignBottom"; + } else if ( propName == "resizeMode" ) { + return "Auto"; + } + return QString::null; + + } + return p->valueToKey( defaultValue( w, propName ).toInt() ); +} + +QWidget *WidgetFactory::createCustomWidget( QWidget *parent, const char *name, MetaDataBase::CustomWidget *w ) +{ + if ( !w ) + return 0; + return new CustomWidget( parent, name, w ); +} + +QVariant WidgetFactory::property( QObject *w, const char *name ) +{ + int id = w->metaObject()->findProperty( name, TRUE ); + const QMetaProperty* p = w->metaObject()->property( id, TRUE ); + if ( !p || !p->isValid() ) + return MetaDataBase::fakeProperty( w, name ); + return w->property( name ); +} + +void QDesignerLabel::updateBuddy() +{ + + if ( myBuddy.isEmpty() ) + return; + + QObjectList *l = topLevelWidget()->queryList( "QWidget", myBuddy, FALSE, TRUE ); + if ( !l || !l->first() ) { + delete l; + return; + } + + QLabel::setBuddy( (QWidget*)l->first() ); + delete l; +} + + +void QDesignerWidget::resizeEvent( QResizeEvent* e) +{ + if ( need_frame ) { + QPainter p(this); + p.setPen( backgroundColor() ); + p.drawRect( QRect( QPoint(0,0), e->oldSize() ) ); + } +} + +void QDesignerWidget::paintEvent( QPaintEvent *e ) +{ + if ( need_frame ) { + QPainter p(this); + p.setPen( backgroundColor().dark() ); + p.drawRect( rect() ); + } + formwindow->paintGrid( this, e ); +} + +void QDesignerDialog::paintEvent( QPaintEvent *e ) +{ + formwindow->paintGrid( this, e ); +} + +QSizePolicy QLayoutWidget::sizePolicy() const +{ + return sp; +} + +bool QLayoutWidget::event( QEvent *e ) +{ + if ( e && ( e->type() == QEvent::ChildInserted || + e->type() == QEvent::ChildRemoved || + e->type() == QEvent::LayoutHint || + e->type() == QEvent::Reparent ) ) + updateSizePolicy(); + return QWidget::event( e ); +} + +/* + This function must be called on QLayoutWidget creation and whenever + the QLayoutWidget's parent layout changes (e.g., from a QHBoxLayout + to a QVBoxLayout), because of the (illogical) way layouting works. +*/ +void QLayoutWidget::updateSizePolicy() +{ + if ( !children() || children()->count() == 0 ) { + sp = QWidget::sizePolicy(); + return; + } + + /* + QSizePolicy::MayShrink & friends are private. Here we assume the + following: + + Fixed = 0 + Maximum = MayShrink + Minimum = MayGrow + Preferred = MayShrink | MayGrow + */ + + int ht = (int) QSizePolicy::Preferred; + int vt = (int) QSizePolicy::Preferred; + + if ( layout() ) { + /* + parentLayout is set to the parent layout if there is one and if it is + top level, in which case layouting is illogical. + */ + QLayout *parentLayout = 0; + if ( parent() && parent()->isWidgetType() ) { + parentLayout = ((QWidget *)parent())->layout(); + if ( parentLayout && + ::qt_cast(parentLayout->mainWidget()) ) + parentLayout = 0; + } + + QObjectListIt it( *children() ); + QObject *o; + + if ( ::qt_cast(layout()) ) { + if ( ::qt_cast(parentLayout) ) + vt = QSizePolicy::Minimum; + else + vt = QSizePolicy::Fixed; + + while ( ( o = it.current() ) ) { + ++it; + if ( !o->isWidgetType() || ( (QWidget*)o )->testWState( WState_ForceHide ) ) + continue; + QWidget *w = (QWidget*)o; + + if ( !w->sizePolicy().mayGrowHorizontally() ) + ht &= ~QSizePolicy::Minimum; + if ( !w->sizePolicy().mayShrinkHorizontally() ) + ht &= ~QSizePolicy::Maximum; + if ( w->sizePolicy().mayGrowVertically() ) + vt |= QSizePolicy::Minimum; + if ( w->sizePolicy().mayShrinkVertically() ) + vt |= QSizePolicy::Maximum; + } + } else if ( ::qt_cast(layout()) ) { + if ( ::qt_cast(parentLayout) ) + ht = QSizePolicy::Minimum; + else + ht = QSizePolicy::Fixed; + + while ( ( o = it.current() ) ) { + ++it; + if ( !o->isWidgetType() || ( (QWidget*)o )->testWState( WState_ForceHide ) ) + continue; + QWidget *w = (QWidget*)o; + + if ( w->sizePolicy().mayGrowHorizontally() ) + ht |= QSizePolicy::Minimum; + if ( w->sizePolicy().mayShrinkHorizontally() ) + ht |= QSizePolicy::Maximum; + if ( !w->sizePolicy().mayGrowVertically() ) + vt &= ~QSizePolicy::Minimum; + if ( !w->sizePolicy().mayShrinkVertically() ) + vt &= ~QSizePolicy::Maximum; + } + } else if ( ::qt_cast(layout()) ) { + ht = QSizePolicy::Fixed; + vt = QSizePolicy::Fixed; + if ( parentLayout ) { + if ( ::qt_cast(parentLayout) ) + ht = QSizePolicy::Minimum; + else if ( ::qt_cast(parentLayout) ) + vt = QSizePolicy::Minimum; + } + + while ( ( o = it.current() ) ) { + ++it; + if ( !o->isWidgetType() || ( (QWidget*)o )->testWState( WState_ForceHide ) ) + continue; + QWidget *w = (QWidget*)o; + + if ( w->sizePolicy().mayGrowHorizontally() ) + ht |= QSizePolicy::Minimum; + if ( w->sizePolicy().mayShrinkHorizontally() ) + ht |= QSizePolicy::Maximum; + if ( w->sizePolicy().mayGrowVertically() ) + vt |= QSizePolicy::Minimum; + if ( w->sizePolicy().mayShrinkVertically() ) + vt |= QSizePolicy::Maximum; + } + } + if ( layout()->expanding() & QSizePolicy::Horizontally ) + ht = QSizePolicy::Expanding; + if ( layout()->expanding() & QSizePolicy::Vertically ) + vt = QSizePolicy::Expanding; + + layout()->invalidate(); + } + + sp = QSizePolicy( (QSizePolicy::SizeType) ht, (QSizePolicy::SizeType) vt ); + updateGeometry(); +} + +void CustomWidget::paintEvent( QPaintEvent *e ) +{ + if ( ::qt_cast(parentWidget()) ) { + ( (FormWindow*)parentWidget() )->paintGrid( this, e ); + } else { + QPainter p( this ); + p.fillRect( rect(), colorGroup().dark() ); + p.setPen( colorGroup().light() ); + p.drawText( 2, 2, width() - 4, height() - 4, Qt::AlignAuto | Qt::AlignTop, cusw->className ); + p.drawPixmap( ( width() - cusw->pixmap->width() ) / 2, + ( height() - cusw->pixmap->height() ) / 2, + *cusw->pixmap ); + } +} + + +CustomWidgetFactory::CustomWidgetFactory() +{ +} + +QWidget *CustomWidgetFactory::createWidget( const QString &className, QWidget *parent, const char *name ) const +{ + MetaDataBase::CustomWidget *w = MetaDataBase::customWidget( WidgetDatabase::idFromClassName( className ) ); + if ( !w ) + return 0; + return WidgetFactory::createCustomWidget( parent, name, w ); +} + + +QDesignerToolBox::QDesignerToolBox( QWidget *parent, const char *name ) + : QToolBox( parent, name ) +{ +} + +QString QDesignerToolBox::itemLabel() const +{ + return QToolBox::itemLabel( currentIndex() ); +} + +void QDesignerToolBox::setItemLabel( const QString &l ) +{ + QToolBox::setItemLabel( currentIndex(), l ); +} + +QCString QDesignerToolBox::itemName() const +{ + return currentItem() ? currentItem()->name() : 0; +} + +void QDesignerToolBox::setItemName( const QCString &n ) +{ + if (currentItem()) + currentItem()->setName( n ); +} + + +Qt::BackgroundMode QDesignerToolBox::itemBackgroundMode() const +{ + return (item(0) ? item(0)->backgroundMode() : PaletteBackground); +} + +void QDesignerToolBox::setItemBackgroundMode( BackgroundMode bmode ) +{ + for (int i = 0; i < count(); ++i) { + QWidget *w = item(i); + w->setBackgroundMode( bmode ); + w->update(); + } +} + +void QDesignerToolBox::itemInserted( int index ) +{ + if (count() > 1) + item(index)->setBackgroundMode(item(index>0?0:1)->backgroundMode()); +} diff --git a/kdevdesigner/designer/widgetfactory.h b/kdevdesigner/designer/widgetfactory.h new file mode 100644 index 00000000..b235b8f4 --- /dev/null +++ b/kdevdesigner/designer/widgetfactory.h @@ -0,0 +1,501 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIDGETFACTORY_H +#define WIDGETFACTORY_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "metadatabase.h" +#include "qwidgetfactory.h" + +class QWidget; +class QLayout; +class FormWindow; + +class CustomWidgetFactory : public QWidgetFactory +{ +public: + CustomWidgetFactory(); + QWidget *createWidget( const QString &className, QWidget *parent, const char *name ) const; + +}; + +class WidgetFactory : public Qt +{ + friend class CustomWidgetFactory; + +public: + enum LayoutType { + HBox, + VBox, + Grid, + NoLayout + }; + + static QWidget *create( int id, QWidget *parent, const char *name = 0, bool init = TRUE, + const QRect *rect = 0, Qt::Orientation orient = Qt::Horizontal ); + static QLayout *createLayout( QWidget *widget, QLayout* layout, LayoutType type ); + static void deleteLayout( QWidget *widget ); + + static LayoutType layoutType( QWidget *w ); + static LayoutType layoutType( QWidget *w, QLayout *&layout ); + static LayoutType layoutType( QLayout *layout ); + static QWidget *layoutParent( QLayout *layout ); + + static QWidget* containerOfWidget( QWidget *w ); + static QWidget* widgetOfContainer( QWidget *w ); + + static bool isPassiveInteractor( QObject* o ); + static const char* classNameOf( QObject* o ); + + static void initChangedProperties( QObject *o ); + + static bool hasSpecialEditor( int id, QObject *editorWidget ); + static bool hasItems( int id, QObject *editorWidget ); + static void editWidget( int id, QWidget *parent, QWidget *editWidget, FormWindow *fw ); + + static bool canResetProperty( QObject *w, const QString &propName ); + static bool resetProperty( QObject *w, const QString &propName ); + static QVariant defaultValue( QObject *w, const QString &propName ); + static QString defaultCurrentItem( QObject *w, const QString &propName ); + + static QVariant property( QObject *w, const char *name ); + static void saveDefaultProperties( QObject *w, int id ); + static void saveChangedProperties( QObject *w, int id ); + + static QString defaultSignal( QObject *w ); + +private: + static QWidget *createWidget( const QString &className, QWidget *parent, const char *name, bool init, + const QRect *r = 0, Qt::Orientation orient = Qt::Horizontal ); + static QWidget *createCustomWidget( QWidget *parent, const char *name, MetaDataBase::CustomWidget *w ); + + static QGuardedPtr *lastPassiveInteractor; + static bool lastWasAPassiveInteractor; +}; + + +class QDesignerTabWidget : public QTabWidget +{ + Q_OBJECT + Q_PROPERTY( int currentPage READ currentPage WRITE setCurrentPage STORED false DESIGNABLE true ) + Q_PROPERTY( QString pageTitle READ pageTitle WRITE setPageTitle STORED false DESIGNABLE true ) + Q_PROPERTY( QCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) +public: + QDesignerTabWidget( QWidget *parent, const char *name ); + + int currentPage() const; + void setCurrentPage( int i ); + QString pageTitle() const; + void setPageTitle( const QString& title ); + QCString pageName() const; + void setPageName( const QCString& name ); + + int count() const; + QTabBar *tabBar() const { return QTabWidget::tabBar(); } + + bool eventFilter( QObject*, QEvent* ); + +private: + QPoint pressPoint; + QWidget *dropIndicator; + QWidget *dragPage; + QString dragLabel; + bool mousePressed; +}; + +class QDesignerWidgetStack : public QWidgetStack +{ + Q_OBJECT + Q_PROPERTY( int currentPage READ currentPage WRITE setCurrentPage STORED false DESIGNABLE true ) + Q_PROPERTY( QCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) +public: + QDesignerWidgetStack( QWidget *parent, const char *name ); + + int currentPage() const; + void setCurrentPage( int i ); + QCString pageName() const; + void setPageName( const QCString& name ); + + int count() const; + QWidget* page( int i ) const; + + int insertPage( QWidget *p, int i = -1 ); + int removePage( QWidget *p ); + +public slots: + void updateButtons(); + +protected: + void resizeEvent( QResizeEvent *e ) { + QWidgetStack::resizeEvent( e ); + updateButtons(); + } + + void showEvent( QShowEvent *e ) { + QWidgetStack::showEvent( e ); + updateButtons(); + } + +private slots: + void prevPage(); + void nextPage(); + +private: + QPtrList pages; + QToolButton *prev, *next; + +}; + +class QDesignerWizard : public QWizard +{ + Q_OBJECT + Q_PROPERTY( int currentPage READ currentPageNum WRITE setCurrentPage STORED false DESIGNABLE true ) + Q_PROPERTY( QString pageTitle READ pageTitle WRITE setPageTitle STORED false DESIGNABLE true ) + Q_PROPERTY( QCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) + Q_OVERRIDE( bool modal READ isModal WRITE setModal ) + +public: + QDesignerWizard( QWidget *parent, const char *name ) + : QWizard( parent, name ), modal(FALSE) {} + + int currentPageNum() const; + void setCurrentPage( int i ); + QString pageTitle() const; + void setPageTitle( const QString& title ); + QCString pageName() const; + void setPageName( const QCString& name ); + int pageNum( QWidget *page ); + void addPage( QWidget *p, const QString & ); + void removePage( QWidget *p ); + void insertPage( QWidget *p, const QString &t, int index ); + bool isPageRemoved( QWidget *p ) { return (removedPages.find( p ) != 0); } + + bool isModal() const { return modal; } + void setModal(bool b) { modal = b; } + + void reject() {} + +private: + struct Page + { + Page( QWidget *a, const QString &b ) : p( a ), t( b ) {} + Page() : p( 0 ), t( QString::null ) {} + QWidget *p; + QString t; + }; + QPtrDict removedPages; + bool modal; + +}; + +class QLayoutWidget : public QWidget +{ + Q_OBJECT + +public: + QLayoutWidget( QWidget *parent, const char *name ) : QWidget( parent, name ), sp( QWidget::sizePolicy() ) {} + + QSizePolicy sizePolicy() const; + void updateSizePolicy(); + +protected: + void paintEvent( QPaintEvent * ); + bool event( QEvent * ); + QSizePolicy sp; + +}; + + +class CustomWidget : public QWidget +{ + Q_OBJECT + +public: + CustomWidget( QWidget *parent, const char *name, MetaDataBase::CustomWidget *cw ) + : QWidget( parent, name ), cusw( cw ) { + alwaysExpand = parentWidget() && parentWidget()->inherits( "FormWindow" ); + setSizePolicy( cw->sizePolicy ); + if ( !alwaysExpand ) + setBackgroundMode( PaletteDark ); + } + + QSize sizeHint() const { + QSize sh = cusw->sizeHint; + if ( sh.isValid() ) + return sh; + return QWidget::sizeHint(); + } + + QString realClassName() { return cusw->className; } + MetaDataBase::CustomWidget *customWidget() const { return cusw; } + +protected: + void paintEvent( QPaintEvent *e ); + + MetaDataBase::CustomWidget *cusw; + bool alwaysExpand; + +}; + + +class Line : public QFrame +{ + Q_OBJECT + + Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) + Q_OVERRIDE( int frameWidth DESIGNABLE false ) + Q_OVERRIDE( Shape frameShape DESIGNABLE false ) + Q_OVERRIDE( QRect frameRect DESIGNABLE false ) + Q_OVERRIDE( QRect contentsRect DESIGNABLE false ) +public: + Line( QWidget *parent, const char *name ) + : QFrame( parent, name, WMouseNoMask ) { + setFrameStyle( HLine | Sunken ); + } + + void setOrientation( Orientation orient ) { + if ( orient == Horizontal ) + setFrameShape( HLine ); + else + setFrameShape( VLine ); + } + Orientation orientation() const { + return frameShape() == HLine ? Horizontal : Vertical; + } +}; + +class QDesignerLabel : public QLabel +{ + Q_OBJECT + + Q_PROPERTY( QCString buddy READ buddyWidget WRITE setBuddyWidget ) + +public: + QDesignerLabel( QWidget *parent = 0, const char *name = 0 ) + : QLabel( parent, name ) { myBuddy = 0; } + + void setBuddyWidget( const QCString &b ) { + myBuddy = b; + updateBuddy(); + } + QCString buddyWidget() const { + return myBuddy; + }; + +protected: + void showEvent( QShowEvent *e ) { + QLabel::showEvent( e ); + updateBuddy(); + } + + +private: + void updateBuddy(); + + QCString myBuddy; + +}; + +class QDesignerWidget : public QWidget +{ + Q_OBJECT + +public: + QDesignerWidget( FormWindow *fw, QWidget *parent, const char *name ) + : QWidget( parent, name, WResizeNoErase ), formwindow( fw ) { + need_frame = parent && parent->inherits("QDesignerWidgetStack" ); + } + +protected: + void resizeEvent( QResizeEvent* e); + void paintEvent( QPaintEvent *e ); + +private: + FormWindow *formwindow; + uint need_frame : 1; + +}; + +class QDesignerDialog : public QDialog +{ + Q_OBJECT + Q_OVERRIDE( bool modal READ isModal WRITE setModal ) + +public: + QDesignerDialog( FormWindow *fw, QWidget *parent, const char *name ) + : QDialog( parent, name, FALSE, WResizeNoErase ), formwindow( fw ), modal(FALSE) {} + + bool isModal() const { return modal; } + void setModal(bool b) { modal = b; } + +protected: + void paintEvent( QPaintEvent *e ); + +private: + FormWindow *formwindow; + bool modal; + +}; + +class QDesignerToolButton : public QToolButton +{ + Q_OBJECT + Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + +public: + QDesignerToolButton( QWidget *parent, const char *name ) + : QToolButton( parent, name ) {} + + bool isInButtonGroup() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ); + } + int buttonGroupId() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ? ( (QButtonGroup*)parentWidget() )->id( (QButton*)this ) : -1; + } + void setButtonGroupId( int id ) { + if ( parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ) { + ( (QButtonGroup*)parentWidget() )->remove( this ); + ( (QButtonGroup*)parentWidget() )->insert( this, id ); + } + } +}; + +class QDesignerRadioButton : public QRadioButton +{ + Q_OBJECT + Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + +public: + QDesignerRadioButton( QWidget *parent, const char *name ) + : QRadioButton( parent, name ) {} + + bool isInButtonGroup() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ); + } + int buttonGroupId() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ? ( (QButtonGroup*)parentWidget() )->id( (QButton*)this ) : -1; + } + void setButtonGroupId( int id ) { + if ( parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ) { + ( (QButtonGroup*)parentWidget() )->remove( this ); + ( (QButtonGroup*)parentWidget() )->insert( this, id ); + } + } + +}; + +class QDesignerPushButton : public QPushButton +{ + Q_OBJECT + Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + +public: + QDesignerPushButton( QWidget *parent, const char *name ) + : QPushButton( parent, name ) {} + + bool isInButtonGroup() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ); + } + int buttonGroupId() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ? ( (QButtonGroup*)parentWidget() )->id( (QButton*)this ) : -1; + } + void setButtonGroupId( int id ) { + if ( parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ) { + ( (QButtonGroup*)parentWidget() )->remove( this ); + ( (QButtonGroup*)parentWidget() )->insert( this, id ); + } + } + +}; + +class QDesignerCheckBox : public QCheckBox +{ + Q_OBJECT + Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + +public: + QDesignerCheckBox( QWidget *parent, const char *name ) + : QCheckBox( parent, name ) {} + + bool isInButtonGroup() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ); + } + int buttonGroupId() const { + return parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ? ( (QButtonGroup*)parentWidget() )->id( (QButton*)this ) : -1; + } + void setButtonGroupId( int id ) { + if ( parentWidget() && parentWidget()->inherits( "QButtonGroup" ) ) { + ( (QButtonGroup*)parentWidget() )->remove( this ); + ( (QButtonGroup*)parentWidget() )->insert( this, id ); + } + } + +}; + +class QDesignerToolBox : public QToolBox +{ + Q_OBJECT + Q_PROPERTY( QString itemLabel READ itemLabel WRITE setItemLabel STORED false DESIGNABLE true ) + Q_PROPERTY( QCString itemName READ itemName WRITE setItemName STORED false DESIGNABLE true ) + Q_PROPERTY( BackgroundMode itemBackgroundMode READ itemBackgroundMode WRITE setItemBackgroundMode STORED false DESIGNABLE true ) + +public: + QDesignerToolBox( QWidget *parent, const char *name ); + + QString itemLabel() const; + void setItemLabel( const QString &l ); + QCString itemName() const; + void setItemName( const QCString &n ); + BackgroundMode itemBackgroundMode() const; + void setItemBackgroundMode( BackgroundMode ); + +protected: + void itemInserted( int index ); +}; + +#endif diff --git a/kdevdesigner/designer/wizardeditor.ui b/kdevdesigner/designer/wizardeditor.ui new file mode 100644 index 00000000..45450be2 --- /dev/null +++ b/kdevdesigner/designer/wizardeditor.ui @@ -0,0 +1,342 @@ + +WizardEditorBase +********************************************************************* +** Copyright (C) 2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +********************************************************************* + + + WizardEditorBase + + + + 0 + 0 + 396 + 233 + + + + Wizard Page Editor + + + + unnamed + + + 11 + + + 6 + + + + Layout19 + + + + unnamed + + + 0 + + + 6 + + + + Layout14 + + + + unnamed + + + 0 + + + 2 + + + + pagesLabel + + + Wizard pages: + + + + + listBox + + + + + + + Layout18 + + + + unnamed + + + 0 + + + 6 + + + + buttonAdd + + + A&dd + + + + + buttonRemove + + + &Remove + + + + + Spacer11 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + buttonUp + + + + + + "designer_s_up.png" + + + + + buttonDown + + + + + + "designer_s_down.png" + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + Close the dialog and apply all the changes. + + + + + buttonApply + + + &Apply + + + true + + + Apply all changes. + + + + + buttonCancel + + + &Cancel + + + true + + + Close the dialog and discard any changes. + + + + + + + + + buttonHelp + clicked() + WizardEditorBase + helpClicked() + + + buttonApply + clicked() + WizardEditorBase + applyClicked() + + + buttonUp + clicked() + WizardEditorBase + upClicked() + + + buttonDown + clicked() + WizardEditorBase + downClicked() + + + buttonAdd + clicked() + WizardEditorBase + addClicked() + + + buttonRemove + clicked() + WizardEditorBase + removeClicked() + + + listBox + selected(int) + WizardEditorBase + itemSelected(int) + + + listBox + highlighted(int) + WizardEditorBase + itemHighlighted(int) + + + buttonOk + clicked() + WizardEditorBase + okClicked() + + + buttonCancel + clicked() + WizardEditorBase + cancelClicked() + + + + init() + destroy() + addClicked() + applyClicked() + cancelClicked() + downClicked() + helpClicked() + itemHighlighted(int) + itemSelected(int) + okClicked() + removeClicked() + upClicked() + + + myiconloader.h + +BarIcon2 + + + diff --git a/kdevdesigner/designer/wizardeditorimpl.cpp b/kdevdesigner/designer/wizardeditorimpl.cpp new file mode 100644 index 00000000..089bf746 --- /dev/null +++ b/kdevdesigner/designer/wizardeditorimpl.cpp @@ -0,0 +1,253 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "wizardeditorimpl.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "command.h" +#include "listboxdnd.h" +#include "listboxrename.h" + +#include +#include +#include +#include + +#include + +WizardEditor::WizardEditor( QWidget *parent, QWizard *w, FormWindow *fw ) + : WizardEditorBase( parent, 0 ), formwindow( fw ), wizard( w ), draggedItem( 0 ) +{ + connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + fillListBox(); + + // Add drag and drop + ListBoxDnd *listBoxDnd = new ListBoxDnd( listBox ); + listBoxDnd->setDragMode( ListBoxDnd::Internal | ListBoxDnd::Move ); + QObject::connect( listBoxDnd, SIGNAL( dropped( QListBoxItem * ) ), + listBoxDnd, SLOT( confirmDrop( QListBoxItem * ) ) ); + + QObject::connect( listBoxDnd, SIGNAL( dragged( QListBoxItem * ) ), + this, SLOT( itemDragged( QListBoxItem * ) ) ); + QObject::connect( listBoxDnd, SIGNAL( dropped( QListBoxItem * ) ), + this, SLOT( itemDropped( QListBoxItem * ) ) ); + + // Add in-place rename + new ListBoxRename( listBox ); +} + +WizardEditor::~WizardEditor() +{ + commands.setAutoDelete( TRUE ); +} + +void WizardEditor::okClicked() +{ + applyClicked(); + accept(); +} + +void WizardEditor::cancelClicked() +{ + reject(); +} + +void WizardEditor::applyClicked() +{ + if ( commands.isEmpty() ) return; + + // schedule macro command + MacroCommand* cmd = new MacroCommand( i18n( "Edit Wizard Pages" ), formwindow, commands ); + formwindow->commandHistory()->addCommand( cmd ); + cmd->execute(); + + // clear command list + commands.clear(); + + // fix wizard buttons + for ( int i = 0; i < wizard->pageCount(); i++ ) { + + QWidget * page = wizard->page( i ); + if ( i == 0 ) { // first page + + wizard->setBackEnabled( page, FALSE ); + wizard->setNextEnabled( page, TRUE ); + } + else if ( i == wizard->pageCount() - 1 ) { // last page + + wizard->setBackEnabled( page, TRUE ); + wizard->setNextEnabled( page, FALSE ); + } + else { + + wizard->setBackEnabled( page, TRUE ); + wizard->setNextEnabled( page, TRUE ); + } + wizard->setFinishEnabled( page, FALSE ); + } + + // update listbox + int index = listBox->currentItem(); + fillListBox(); + listBox->setCurrentItem( index ); + + // show current page + wizard->showPage( wizard->page( 0 ) ); +} + +void WizardEditor::helpClicked() +{ + +} + +void WizardEditor::addClicked() +{ + int index = listBox->currentItem() + 1; + // update listbox + listBox->insertItem( i18n( "Page" ), index ); + + // schedule add command + AddWizardPageCommand *cmd = new AddWizardPageCommand( i18n( "Add Page to %1" ).arg( wizard->name() ), + formwindow, wizard, "Page", index, FALSE); + commands.append( cmd ); + + // update buttons + updateButtons(); +} + +void WizardEditor::removeClicked() +{ + if ( listBox->count() < 2 ) return; + + int index = listBox->currentItem(); + + // update listbox + listBox->removeItem( index ); + + // schedule remove command + DeleteWizardPageCommand *cmd = new DeleteWizardPageCommand( i18n( "Delete Page %1 of %2" ) + .arg( listBox->text( index ) ).arg( wizard->name() ), + formwindow, wizard, index, FALSE ); + commands.append( cmd ); + + // update buttons + updateButtons(); +} + +void WizardEditor::upClicked() +{ + int index1 = listBox->currentItem(); + int index2 = index1 - 1; + + // swap listbox items + QString item1 = listBox->text( index1 ); + listBox->removeItem( index1 ); + listBox->insertItem( item1, index2 ); + listBox->setCurrentItem( index2 ); + + // schedule swap command + SwapWizardPagesCommand *cmd = new SwapWizardPagesCommand( i18n( "Swap Pages %1 and %2 of %3" ).arg( index1 ).arg( index2 ) + .arg( wizard->name() ), formwindow, wizard, index1, index2); + commands.append( cmd ); + + // update buttons + updateButtons(); +} + +void WizardEditor::downClicked() +{ + int index1 = listBox->currentItem(); + int index2 = index1 + 1; + + // swap listbox items + QString item1 = listBox->text( index1 ); + listBox->removeItem( index1 ); + listBox->insertItem( item1, index2 ); + listBox->setCurrentItem( index2 ); + + // schedule swap command + SwapWizardPagesCommand *cmd = new SwapWizardPagesCommand( i18n( "Swap Pages %1 and %2 of %3" ).arg( index1 ).arg( index2 ).arg( wizard->name() ), formwindow, wizard, index2, index1); + commands.append( cmd ); + + // update buttons + updateButtons(); +} + +void WizardEditor::fillListBox() +{ + listBox->clear(); + + if ( !wizard ) return; + for ( int i = 0; i < wizard->pageCount(); i++ ) + listBox->insertItem( wizard->title( wizard->page( i ) ) ); + + updateButtons(); +} + +void WizardEditor::itemHighlighted( int ) +{ + updateButtons(); +} + +void WizardEditor::itemSelected( int index ) +{ + if ( index < 0 ) return; + // Called when Qt::Key_Enter was pressed. + // ListBoxRename has renamed the list item, so we only need to rename the page to the same name. + QString pn( i18n( "Rename page %1 of %2" ).arg( wizard->title( wizard->page( index ) ) ).arg( wizard->name() ) ); + RenameWizardPageCommand *cmd = new RenameWizardPageCommand( pn, formwindow, wizard, index, listBox->text( index ) ); + commands.append( cmd ); +} + +void WizardEditor::updateButtons() +{ + int index = listBox->currentItem(); + + buttonUp->setEnabled( index > 0 ); + buttonDown->setEnabled( index < (int)listBox->count() - 1 ); + buttonRemove->setEnabled( index >= 0 ); + + if ( listBox->count() < 2 ) + buttonRemove->setEnabled( FALSE ); +} + +void WizardEditor::itemDragged( QListBoxItem * i ) +{ + // Store item index + draggedItem = listBox->index( i ); +} + +void WizardEditor::itemDropped( QListBoxItem * i ) +{ + if ( draggedItem < 0 ) return; + // The reorder the pages acording to the listBox list of items + // Assumes that only one item has been moved. + int droppedItem = listBox->index( i ); + + //qDebug( "Moving page %d -> %d", draggedItem, droppedItem ); + MoveWizardPageCommand *cmd = new MoveWizardPageCommand( i18n( "Move Page %1 to %2 in %3" ).arg( draggedItem ).arg( droppedItem ).arg( wizard->name() ), formwindow, wizard, draggedItem, droppedItem ); + commands.append( cmd ); +} diff --git a/kdevdesigner/designer/wizardeditorimpl.h b/kdevdesigner/designer/wizardeditorimpl.h new file mode 100644 index 00000000..0089cb39 --- /dev/null +++ b/kdevdesigner/designer/wizardeditorimpl.h @@ -0,0 +1,74 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIZARDEDITORIMPL_H +#define WIZARDEDITORIMPL_H + +class QWizard; +class FormWindow; + +#include + +#include "wizardeditor.h" +#include "command.h" + +class WizardEditor : public WizardEditorBase +{ + Q_OBJECT + +public: + WizardEditor( QWidget *parent, QWizard *wizard, FormWindow *fw ); + ~WizardEditor(); + +protected slots: + void okClicked(); + void applyClicked(); + void cancelClicked(); + void helpClicked(); + + void addClicked(); + void removeClicked(); + void upClicked(); + void downClicked(); + + void itemHighlighted( int ); + void itemSelected( int ); + + void itemDragged( QListBoxItem * ); + void itemDropped( QListBoxItem * ); + +private: + void updateButtons(); + void fillListBox(); + +private: + FormWindow *formwindow; + QWizard *wizard; + QPtrList commands; + int draggedItem; +}; + +#endif diff --git a/kdevdesigner/designer/workspace.cpp b/kdevdesigner/designer/workspace.cpp new file mode 100644 index 00000000..db9bd7be --- /dev/null +++ b/kdevdesigner/designer/workspace.cpp @@ -0,0 +1,711 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include // HP-UX compiler needs this here +#include "workspace.h" +#include "formwindow.h" +#include "mainwindow.h" +#include "globaldefs.h" +#include "command.h" +#include "project.h" +#include "pixmapcollection.h" +#include "sourcefile.h" +#include "sourceeditor.h" +#include "propertyeditor.h" + +#include +#include "kdevdesigner_part.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qcompletionedit.h" + +#include + +WorkspaceItem::WorkspaceItem( QListView *parent, Project* p ) + : QListViewItem( parent ) +{ + init(); + project = p; + t = ProjectType; + setPixmap( 0, SmallIcon( "designer_folder.png" , KDevDesignerPartFactory::instance()) ); + setExpandable( FALSE ); +} + +WorkspaceItem::WorkspaceItem( QListViewItem *parent, SourceFile* sf ) + : QListViewItem( parent ) +{ + init(); + sourceFile = sf; + t = SourceFileType; + setPixmap( 0, SmallIcon( "designer_filenew.png" , KDevDesignerPartFactory::instance()) ); +} + +WorkspaceItem::WorkspaceItem( QListViewItem *parent, QObject *o, Project *p ) + : QListViewItem( parent ) +{ + init(); + object = o; + project = p; + t = ObjectType; + setPixmap( 0, SmallIcon( "designer_object.png" , KDevDesignerPartFactory::instance()) ); + QObject::connect( p->fakeFormFileFor( o ), SIGNAL( somethingChanged(FormFile*) ), + listView(), SLOT( update() ) ); +} + +WorkspaceItem::WorkspaceItem( QListViewItem *parent, FormFile* ff, Type type ) + : QListViewItem( parent ) +{ + init(); + formFile = ff; + t = type; + if ( type == FormFileType ) { + setPixmap( 0, SmallIcon( "designer_form.png" , KDevDesignerPartFactory::instance()) ); + QObject::connect( ff, SIGNAL( somethingChanged(FormFile*) ), listView(), SLOT( update(FormFile*) ) ); + if ( formFile->supportsCodeFile() ) { + (void) new WorkspaceItem( this, formFile, FormSourceType ); + } + } else if ( type == FormSourceType ) { + setPixmap( 0, SmallIcon( "designer_filenew.png" , KDevDesignerPartFactory::instance()) ); + } +} + + +void WorkspaceItem::init() +{ + autoOpen = FALSE; + useOddColor = FALSE; + project = 0; + sourceFile = 0; + formFile = 0; +} + +void WorkspaceItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) +{ + QColorGroup g( cg ); + g.setColor( QColorGroup::Base, backgroundColor() ); + g.setColor( QColorGroup::Foreground, Qt::black ); + + if ( type() == FormSourceType && + ( !formFile->hasFormCode() || ( formFile->codeFileState() == FormFile::Deleted && formFile->formWindow() ) ) && + parent() && parent()->parent() && ( (WorkspaceItem*)parent()->parent() )->project && + ( (WorkspaceItem*)parent()->parent() )->project->isCpp() ) { + g.setColor( QColorGroup::Text, listView()->palette().disabled().color( QColorGroup::Text) ); + g.setColor( QColorGroup::HighlightedText, listView()->palette().disabled().color( QColorGroup::Text) ); + } else { + g.setColor( QColorGroup::Text, Qt::black ); + } + p->save(); + + if ( isModified() ) { + QFont f = p->font(); + f.setBold( TRUE ); + p->setFont( f ); + } + + QListViewItem::paintCell( p, g, column, width, align ); + p->setPen( QPen( cg.dark(), 1 ) ); + if ( column == 0 ) + p->drawLine( 0, 0, 0, height() - 1 ); + if ( listView()->firstChild() != this ) { + if ( nextSibling() != itemBelow() && itemBelow()->depth() < depth() ) { + int d = depth() - itemBelow()->depth(); + p->drawLine( -listView()->treeStepSize() * d, height() - 1, 0, height() - 1 ); + } + } + p->drawLine( 0, height() - 1, width, height() - 1 ); + p->drawLine( width - 1, 0, width - 1, height() ); + p->restore(); +} + +QString WorkspaceItem::text( int column ) const +{ + if ( column != 0 ) + return QListViewItem::text( column ); + switch( t ) { + case ProjectType: + if ( project->isDummy() ) { + return i18n("" ); + } else if ( MainWindow::self->singleProjectMode() ) { + return QFileInfo( project->fileName() ).baseName(); + } + return project->makeRelative( project->fileName() ); + case FormFileType: + if ( !MainWindow::self->singleProjectMode() ) + return formFile->formName() + ": " + formFile->fileName(); + return formFile->formName(); + case FormSourceType: + if ( !MainWindow::self->singleProjectMode() ) + return formFile->codeFile(); + return formFile->formName() + " [Source]"; + case SourceFileType: + return sourceFile->fileName(); + case ObjectType: + if ( !project->hasParentObject( object ) ) + return object->name(); + return project->qualifiedName( object ); + } + + return QString::null; // shut up compiler +} + +void WorkspaceItem::fillCompletionList( QStringList& completion ) +{ + switch( t ) { + case ProjectType: + break; + case FormFileType: + completion += formFile->formName(); + completion += formFile->fileName(); + break; + case FormSourceType: + completion += formFile->codeFile(); + break; + case SourceFileType: + completion += sourceFile->fileName(); + break; + case ObjectType: + completion += object->name(); + } +} + +bool WorkspaceItem::checkCompletion( const QString& completion ) +{ + switch( t ) { + case ProjectType: + break; + case FormFileType: + return completion == formFile->formName() + || completion == formFile->fileName(); + case FormSourceType: + return completion == formFile->codeFile(); + case SourceFileType: + return completion == sourceFile->fileName(); + case ObjectType: + return completion == object->name(); + } + return FALSE; +} + + +bool WorkspaceItem::isModified() const +{ + switch( t ) { + case ProjectType: + return project->isModified(); + case FormFileType: + return formFile->isModified( FormFile::WFormWindow ); + case FormSourceType: + return formFile->isModified( FormFile::WFormCode ); + case SourceFileType: + return sourceFile->isModified(); + case ObjectType: + return project->fakeFormFileFor( object )->isModified(); + break; + } + return FALSE; // shut up compiler +} + +QString WorkspaceItem::key( int column, bool ) const +{ + QString key = text( column ); + if ( t == FormFileType ) + key.prepend( "0" ); + else if ( t == ObjectType ) + key.prepend( "a" ); + else + key.prepend( "A" ); + return key; +} + +QColor WorkspaceItem::backgroundColor() +{ + bool b = useOddColor; + if ( t == FormSourceType && parent() ) + b = ( ( WorkspaceItem*)parent() )->useOddColor; + return b ? *backColor2 : *backColor1; +} + + +void WorkspaceItem::setOpen( bool b ) +{ + QListViewItem::setOpen( b ); + autoOpen = FALSE; +} + +void WorkspaceItem::setAutoOpen( bool b ) +{ + QListViewItem::setOpen( b ); + autoOpen = b; +} + +Workspace::Workspace( QWidget *parent, MainWindow *mw ) + : QListView( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | + WStyle_Tool | WStyle_MinMax | WStyle_SysMenu ), mainWindow( mw ), + project( 0 ), completionDirty( FALSE ) +{ + init_colors(); + + setDefaultRenameAction( Accept ); + blockNewForms = FALSE; + bufferEdit = 0; + header()->setStretchEnabled( TRUE ); + header()->hide(); + setSorting( 0 ); + setResizePolicy( QScrollView::Manual ); +#ifndef Q_WS_MAC + QPalette p( palette() ); + p.setColor( QColorGroup::Base, QColor( *backColor2 ) ); + (void)*selectedBack; // hack + setPalette( p ); +#endif + addColumn( i18n( "Files" ) ); + setAllColumnsShowFocus( TRUE ); + connect( this, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), + this, SLOT( itemClicked( int, QListViewItem *, const QPoint& ) ) ), + connect( this, SIGNAL( doubleClicked( QListViewItem * ) ), + this, SLOT( itemDoubleClicked( QListViewItem * ) ) ), + connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint &, int ) ), + this, SLOT( rmbClicked( QListViewItem *, const QPoint& ) ) ), + setHScrollBarMode( AlwaysOff ); + setVScrollBarMode( AlwaysOn ); + viewport()->setAcceptDrops( TRUE ); + setAcceptDrops( TRUE ); + setColumnWidthMode( 1, Manual ); +} + + +void Workspace::projectDestroyed( QObject* o ) +{ + if ( o == project ) { + project = 0; + clear(); + } +} + +void Workspace::setCurrentProject( Project *pro ) +{ + if ( project == pro ) + return; + if ( project ) { + disconnect( project, SIGNAL( sourceFileAdded(SourceFile*) ), this, SLOT( sourceFileAdded(SourceFile*) ) ); + disconnect( project, SIGNAL( sourceFileRemoved(SourceFile*) ), this, SLOT( sourceFileRemoved(SourceFile*) ) ); + disconnect( project, SIGNAL( formFileAdded(FormFile*) ), this, SLOT( formFileAdded(FormFile*) ) ); + disconnect( project, SIGNAL( formFileRemoved(FormFile*) ), this, SLOT( formFileRemoved(FormFile*) ) ); + disconnect( project, SIGNAL( objectAdded(QObject*) ), this, SLOT( objectAdded(QObject*) ) ); + disconnect( project, SIGNAL( objectRemoved(QObject*) ), this, SLOT( objectRemoved(QObject*) ) ); + disconnect( project, SIGNAL( projectModified() ), this, SLOT( update() ) ); + } + project = pro; + connect( project, SIGNAL( sourceFileAdded(SourceFile*) ), this, SLOT( sourceFileAdded(SourceFile*) ) ); + connect( project, SIGNAL( sourceFileRemoved(SourceFile*) ), this, SLOT( sourceFileRemoved(SourceFile*) ) ); + connect( project, SIGNAL( formFileAdded(FormFile*) ), this, SLOT( formFileAdded(FormFile*) ) ); + connect( project, SIGNAL( formFileRemoved(FormFile*) ), this, SLOT( formFileRemoved(FormFile*) ) ); + connect( project, SIGNAL( destroyed(QObject*) ), this, SLOT( projectDestroyed(QObject*) ) ); + connect( project, SIGNAL( objectAdded(QObject*) ), this, SLOT( objectAdded(QObject*) ) ); + connect( project, SIGNAL( objectRemoved(QObject*) ), this, SLOT( objectRemoved(QObject*) ) ); + connect( project, SIGNAL( projectModified() ), this, SLOT( update() ) ); + clear(); + + if ( bufferEdit ) + bufferEdit->clear(); + + projectItem = new WorkspaceItem( this, project ); + + projectItem->setOpen( TRUE ); + + for ( QPtrListIterator sources = project->sourceFiles(); + sources.current(); ++sources ) { + SourceFile* f = sources.current(); + (void) new WorkspaceItem( projectItem, f ); + } + + for ( QPtrListIterator forms = project->formFiles(); + forms.current(); ++forms ) { + FormFile* f = forms.current(); + if ( f->isFake() ) + continue; + + (void) new WorkspaceItem( projectItem, f ); + } + + QObjectList l = project->objects(); + QObjectListIt objs( l ); + for ( ;objs.current(); ++objs ) { + QObject* o = objs.current(); + (void) new WorkspaceItem( projectItem, o, project ); + } + + updateColors(); + completionDirty = TRUE; +} + +void Workspace::sourceFileAdded( SourceFile* sf ) +{ + (void) new WorkspaceItem( projectItem, sf ); + updateColors(); +} + +void Workspace::sourceFileRemoved( SourceFile* sf ) +{ + delete findItem( sf ); + updateColors(); +} + +void Workspace::formFileAdded( FormFile* ff ) +{ + if ( ff->isFake() ) + return; + (void) new WorkspaceItem( projectItem, ff ); + updateColors(); +} + +void Workspace::formFileRemoved( FormFile* ff ) +{ + delete findItem( ff ); + updateColors(); +} + +void Workspace::objectAdded( QObject *o ) +{ + (void) new WorkspaceItem( projectItem, o, project ); + updateColors(); +} + +void Workspace::objectRemoved( QObject *o ) +{ + delete findItem( o ); + updateColors(); +} + +void Workspace::update() +{ + completionDirty = TRUE; + triggerUpdate(); +} + +void Workspace::update( FormFile* ff ) +{ + QListViewItem* i = findItem( ff ); + if ( i ) { + i->repaint(); + if ( (i = i->firstChild()) ) + i->repaint(); + } +} + + +void Workspace::activeFormChanged( FormWindow *fw ) +{ + WorkspaceItem *i = findItem( fw->formFile() ); + if ( i ) { + setCurrentItem( i ); + setSelected( i, TRUE ); + if ( !i->isOpen() ) + i->setAutoOpen( TRUE ); + } + + closeAutoOpenItems(); + +} + +void Workspace::activeEditorChanged( SourceEditor *se ) +{ + if ( !se->object() ) + return; + + if ( se->formWindow() ) { + WorkspaceItem *i = findItem( se->formWindow()->formFile() ); + if ( i && i->firstChild() ) { + if ( !i->isOpen() ) + i->setAutoOpen( TRUE ); + setCurrentItem( i->firstChild() ); + setSelected( i->firstChild(), TRUE ); + } + } else { + WorkspaceItem *i = findItem( se->sourceFile() ); + if ( i ) { + setCurrentItem( i ); + setSelected( i, TRUE ); + } + } + + closeAutoOpenItems(); +} + +WorkspaceItem *Workspace::findItem( FormFile* ff) +{ + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) { + if ( ( (WorkspaceItem*)it.current() )->formFile == ff ) + return (WorkspaceItem*)it.current(); + } + return 0; +} + +WorkspaceItem *Workspace::findItem( SourceFile *sf ) +{ + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) { + if ( ( (WorkspaceItem*)it.current() )->sourceFile == sf ) + return (WorkspaceItem*)it.current(); + } + return 0; +} + +WorkspaceItem *Workspace::findItem( QObject *o ) +{ + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) { + if ( ( (WorkspaceItem*)it.current() )->object == o ) + return (WorkspaceItem*)it.current(); + } + return 0; +} + +void Workspace::closeAutoOpenItems() +{ + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) { + WorkspaceItem* i = (WorkspaceItem*) it.current(); + WorkspaceItem* ip = (WorkspaceItem*) i->parent(); + if ( i->type() == WorkspaceItem::FormSourceType ) { + if ( !i->isSelected() && !ip->isSelected() + && ip->isAutoOpen() ) { + ip->setAutoOpen( FALSE ); + } + } + } +} + + +void Workspace::closeEvent( QCloseEvent *e ) +{ + e->accept(); +} + +void Workspace::itemDoubleClicked( QListViewItem *i ) +{ + if ( ( (WorkspaceItem*)i)->type()== WorkspaceItem::ProjectType ) + i->setOpen( TRUE ); +} + +void Workspace::itemClicked( int button, QListViewItem *i, const QPoint& ) +{ + if ( !i || button != LeftButton ) + return; + + closeAutoOpenItems(); + + WorkspaceItem* wi = (WorkspaceItem*)i; + switch( wi->type() ) { + case WorkspaceItem::ProjectType: + break; // ### TODO + case WorkspaceItem::FormFileType: + wi->formFile->showFormWindow(); + break; + case WorkspaceItem::FormSourceType: + wi->formFile->showEditor( FALSE ); + break; + case WorkspaceItem::SourceFileType: + mainWindow->editSource( wi->sourceFile ); + break; + case WorkspaceItem::ObjectType: + project->fakeFormFileFor( wi->object )->formWindow()->setFocus(); + mainWindow->propertyeditor()->setWidget( wi->object, + project->fakeFormFileFor( wi->object )->formWindow() ); + mainWindow->objectHierarchy()-> + setFormWindow( project->fakeFormFileFor( wi->object )->formWindow(), wi->object ); + project->fakeFormFileFor( wi->object )->showEditor(); + break; + } +} + +void Workspace::contentsDropEvent( QDropEvent *e ) +{ + if ( !QUriDrag::canDecode( e ) ) { + e->ignore(); + } else { + QStringList files; + QUriDrag::decodeLocalFiles( e, files ); + if ( !files.isEmpty() ) { + for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it ) { + QString fn = *it; + mainWindow->fileOpen( "", "", fn ); + } + } + } +} + +void Workspace::contentsDragEnterEvent( QDragEnterEvent *e ) +{ + if ( !QUriDrag::canDecode( e ) ) + e->ignore(); + else + e->accept(); +} + +void Workspace::contentsDragMoveEvent( QDragMoveEvent *e ) +{ + if ( !QUriDrag::canDecode( e ) ) + e->ignore(); + else + e->accept(); +} + +void Workspace::rmbClicked( QListViewItem *i, const QPoint& pos ) +{ + if ( !i ) + return; + WorkspaceItem* wi = (WorkspaceItem*)i; + enum { OPEN_SOURCE, REMOVE_SOURCE, OPEN_FORM, REMOVE_FORM, + OPEN_FORM_SOURCE, REMOVE_FORM_SOURCE, OPEN_OBJECT_SOURCE }; + QPopupMenu menu( this ); + menu.setCheckable( TRUE ); + switch ( wi->type() ) { + case WorkspaceItem::SourceFileType: + menu.insertItem( i18n( "&Open Source File" ), OPEN_SOURCE ); + menu.insertSeparator(); + menu.insertItem( SmallIcon( "designer_editcut.png" , KDevDesignerPartFactory::instance()), + i18n( "&Remove Source File From Project" ), REMOVE_SOURCE ); + break; + case WorkspaceItem::FormFileType: + menu.insertItem( i18n( "&Open Form" ), OPEN_FORM ); + menu.insertSeparator(); + menu.insertItem( SmallIcon( "designer_editcut.png" , KDevDesignerPartFactory::instance()), + i18n( "&Remove Form From Project" ), REMOVE_FORM ); + break; + case WorkspaceItem::FormSourceType: + menu.insertItem( i18n( "&Open Form Source" ), OPEN_FORM_SOURCE ); + menu.insertSeparator(); + if ( project->isCpp() ) + menu.insertItem( SmallIcon( "designer_editcut.png" , KDevDesignerPartFactory::instance()), + i18n( "&Remove Source File From Form" ), REMOVE_FORM_SOURCE ); + else + menu.insertItem( SmallIcon( "designer_editcut.png" , KDevDesignerPartFactory::instance()), + i18n( "&Remove Form From Project" ), REMOVE_FORM ); + break; + case WorkspaceItem::ProjectType: + MainWindow::self->popupProjectMenu( pos ); + return; + case WorkspaceItem::ObjectType: + menu.insertItem( i18n( "&Open Source" ), OPEN_OBJECT_SOURCE ); + break; + } + + switch ( menu.exec( pos ) ) { + case REMOVE_SOURCE: + project->removeSourceFile( wi->sourceFile ); + break; + case REMOVE_FORM: + project->removeFormFile( wi->formFile ); + break; + case REMOVE_FORM_SOURCE: + ( (WorkspaceItem*)i )->formFile->setModified( TRUE ); + ( (WorkspaceItem*)i )->formFile->setCodeFileState( FormFile::Deleted ); + delete ( (WorkspaceItem*)i )->formFile->editor(); + break; + case OPEN_OBJECT_SOURCE: + case OPEN_SOURCE: + case OPEN_FORM: + case OPEN_FORM_SOURCE: + itemClicked( LeftButton, i, pos ); + break; + } +} + +bool Workspace::eventFilter( QObject *o, QEvent * e ) +{ + // Reggie, on what type of events do we have to execute updateBufferEdit() + if ( o ==bufferEdit && e->type() != QEvent::ChildRemoved ) + updateBufferEdit(); + return QListView::eventFilter( o, e ); +} + +void Workspace::setBufferEdit( QCompletionEdit *edit ) +{ + bufferEdit = edit; + connect( bufferEdit, SIGNAL( chosen( const QString & ) ), + this, SLOT( bufferChosen( const QString & ) ) ); + bufferEdit->installEventFilter( this ); +} + +void Workspace::updateBufferEdit() +{ + if ( !bufferEdit || !completionDirty || !MainWindow::self) + return; + completionDirty = FALSE; + QStringList completion = MainWindow::self->projectFileNames(); + QListViewItemIterator it( this ); + while ( it.current() ) { + ( (WorkspaceItem*)it.current())->fillCompletionList( completion ); + ++it; + } + completion.sort(); + bufferEdit->setCompletionList( completion ); +} + +void Workspace::bufferChosen( const QString &buffer ) +{ + if ( bufferEdit ) + bufferEdit->setText( "" ); + + if ( MainWindow::self->projectFileNames().contains( buffer ) ) { + MainWindow::self->setCurrentProjectByFilename( buffer ); + return; + } + + QListViewItemIterator it( this ); + while ( it.current() ) { + if ( ( (WorkspaceItem*)it.current())->checkCompletion( buffer ) ) { + itemClicked( LeftButton, it.current(), QPoint() ); + break; + } + ++it; + } +} + +void Workspace::updateColors() +{ + QListViewItem* i = firstChild(); + if ( i ) + i = i->firstChild(); + bool b = TRUE; + while ( i ) { + WorkspaceItem* wi = ( WorkspaceItem*) i; + i = i->nextSibling(); + wi->useOddColor = b; + b = !b; + } +} diff --git a/kdevdesigner/designer/workspace.h b/kdevdesigner/designer/workspace.h new file mode 100644 index 00000000..8e710725 --- /dev/null +++ b/kdevdesigner/designer/workspace.h @@ -0,0 +1,151 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WORKSPACE_H +#define WORKSPACE_H + +#include + +class FormWindow; +class QResizeEvent; +class QCloseEvent; +class QDropEvent; +class QDragMoveEvent; +class QDragEnterEvent; +class MainWindow; +class Project; +class SourceFile; +class FormFile; +class QCompletionEdit; +class SourceEditor; + +class WorkspaceItem : public QListViewItem +{ +public: + enum Type { ProjectType, FormFileType, FormSourceType, SourceFileType, ObjectType }; + + WorkspaceItem( QListView *parent, Project* p ); + WorkspaceItem( QListViewItem *parent, SourceFile* sf ); + WorkspaceItem( QListViewItem *parent, FormFile* ff, Type t = FormFileType ); + WorkspaceItem( QListViewItem *parent, QObject *o, Project *p ); + + void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ); + + Type type() const { return t; } + + bool isModified() const; + + QString text( int ) const; + + void fillCompletionList( QStringList& completion ); + bool checkCompletion( const QString& completion ); + + QString key( int, bool ) const; // column sorting key + + Project* project; + SourceFile* sourceFile; + FormFile* formFile; + QObject *object; + + void setOpen( bool ); + + void setAutoOpen( bool ); + bool isAutoOpen() const { return isOpen() && autoOpen; } + + bool useOddColor; + +private: + void init(); + bool autoOpen; + QColor backgroundColor(); + Type t; +}; + +class Workspace : public QListView +{ + Q_OBJECT + +public: + Workspace( QWidget *parent , MainWindow *mw ); + + void setCurrentProject( Project *pro ); + + void contentsDropEvent( QDropEvent *e ); + void contentsDragEnterEvent( QDragEnterEvent *e ); + void contentsDragMoveEvent( QDragMoveEvent *e ); + + void setBufferEdit( QCompletionEdit *edit ); + +public slots: + + void update(); + void update( FormFile* ); + + void activeFormChanged( FormWindow *fw ); + void activeEditorChanged( SourceEditor *se ); + +protected: + void closeEvent( QCloseEvent *e ); + bool eventFilter( QObject *, QEvent * ); + + +private slots: + void itemClicked( int, QListViewItem *i, const QPoint& pos ); + void itemDoubleClicked( QListViewItem *i ); + void rmbClicked( QListViewItem *i, const QPoint& pos ); + void bufferChosen( const QString &buffer ); + + void projectDestroyed( QObject* ); + + void sourceFileAdded( SourceFile* ); + void sourceFileRemoved( SourceFile* ); + + void formFileAdded( FormFile* ); + void formFileRemoved( FormFile* ); + + void objectAdded( QObject* ); + void objectRemoved( QObject * ); + +private: + WorkspaceItem *findItem( FormFile *ff ); + WorkspaceItem *findItem( SourceFile *sf ); + WorkspaceItem *findItem( QObject *o ); + + void closeAutoOpenItems(); + +private: + MainWindow *mainWindow; + Project *project; + WorkspaceItem *projectItem; + QCompletionEdit *bufferEdit; + bool blockNewForms; + void updateBufferEdit(); + bool completionDirty; + void updateColors(); + +}; + +#endif diff --git a/kdevdesigner/interfaces/actioninterface.h b/kdevdesigner/interfaces/actioninterface.h new file mode 100644 index 00000000..75396f04 --- /dev/null +++ b/kdevdesigner/interfaces/actioninterface.h @@ -0,0 +1,78 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef ACTIONINTERFACE_H +#define ACTIONINTERFACE_H + +#include + +class QAction; +class QObject; + +// {bb206e09-84e5-4777-9fce-706babfab931} +#ifndef IID_Action +#define IID_Action QUuid( 0xbb206e09, 0x84e5, 0x4777, 0x9f, 0xce, 0x70, 0x6b, 0xab, 0xfa, 0xb9, 0x31 ) +#endif + +/*! To add actions to the Qt Designer menubars and toolbars, implement + this interface. You have to implement the create(), group() and + connectTo() functions. + + You also have to implement the function featureList() (\sa + QFeatureListInterface) to return the names of all actions + which this interface provides. +*/ + +class ActionInterface : public QFeatureListInterface +{ +public: + enum Location { + Toolbar, + Menu + }; + + /*! This functions is called to create the action with the name \a + name. \a parent should be used as parent of the action. + + In the implementation return the QAction object for the action + \a name. + */ + virtual QAction* create( const QString &name, QObject* parent = 0 ) = 0; + + /*! In the implementation of the interface return the name of the + group of the action \a name. + */ + virtual QString group( const QString &name ) const = 0; + + /*! In the implementation of the interface return whether the + action \a name should appear in the location \a l */ + virtual bool location( const QString &name, Location l ) const = 0; + + /*! \internal */ + virtual void connectTo( QUnknownInterface *appInterface ) = 0; +}; + +#endif diff --git a/kdevdesigner/interfaces/classbrowserinterface.h b/kdevdesigner/interfaces/classbrowserinterface.h new file mode 100644 index 00000000..2db43afe --- /dev/null +++ b/kdevdesigner/interfaces/classbrowserinterface.h @@ -0,0 +1,63 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef CLASSBROWSERINTERFACE_H +#define CLASSBROWSERINTERFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include +class QListView; + +// {4ede3c32-ae96-4b7a-9e38-9f1d93592391} +#ifndef IID_ClassBrowser +#define IID_ClassBrowser QUuid( 0x4ede3c32, 0xae96, 0x4b7a, 0x9e, 0x38, 0x9f, 0x1d, 0x93, 0x59, 0x23, 0x91 ) +#endif + +struct ClassBrowserInterface : public QUnknownInterface +{ + enum Type { Class, Function }; + + virtual QListView *createClassBrowser( QWidget *parent ) const = 0; + virtual void update( const QString &code ) const = 0; + virtual void clear() const = 0; + + virtual void onClick( QObject *receiver, const char *slot ) = 0; +}; + +#endif diff --git a/kdevdesigner/interfaces/designerinterface.h b/kdevdesigner/interfaces/designerinterface.h new file mode 100644 index 00000000..de7487e2 --- /dev/null +++ b/kdevdesigner/interfaces/designerinterface.h @@ -0,0 +1,261 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DESIGNERINTERFACE_H +#define DESIGNERINTERFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include +#include +#include +#include +#include +#include + +struct DesignerProject; +struct DesignerDatabase; +struct DesignerFormWindow; +struct DesignerDock; +struct DesignerOutputDock; +struct DesignerOutput; +struct DesignerOutputError; +struct DesignerPixmapCollection; +struct DesignerSourceFile; + +class QDockWindow; +class QWidget; +class QObject; +class QAction; +class QIconSet; +class QSqlDatabase; + +// {0e661da-f45c-4830-af47-03ec53eb1633} +#ifndef IID_Designer +#define IID_Designer QUuid( 0xa0e661da, 0xf45c, 0x4830, 0xaf, 0x47, 0x3, 0xec, 0x53, 0xeb, 0x16, 0x33 ) +#endif + +/*! These are the interfaces implemented by the Qt Designer which should + be used by plugins to access and use functionality of the Qt Designer. +*/ + +struct DesignerInterface : public QUnknownInterface +{ + virtual DesignerProject *currentProject() const = 0; + virtual DesignerFormWindow *currentForm() const = 0; + virtual DesignerSourceFile *currentSourceFile() const = 0; + virtual QPtrList projectList() const = 0; + virtual void showStatusMessage( const QString &, int ms = 0 ) const = 0; + virtual DesignerDock *createDock() const = 0; + virtual DesignerOutputDock *outputDock() const = 0; + virtual void setModified( bool b, QWidget *window ) = 0; + virtual void updateFunctionList() = 0; + + virtual void onProjectChange( QObject *receiver, const char *slot ) = 0; + virtual void onFormChange( QObject *receiver, const char *slot ) = 0; + + virtual bool singleProjectMode() const = 0; + virtual void showError( QWidget *widget, int line, const QString &message ) = 0; + virtual void runFinished() = 0; + virtual void showStackFrame( QWidget *w, int line ) = 0; + virtual void showDebugStep( QWidget *w, int line ) = 0; + virtual void runProjectPrecondition() = 0; + virtual void runProjectPostcondition( QObjectList *l ) = 0; + + }; + +struct DesignerProject +{ + virtual QPtrList formList() const = 0; + virtual QStringList formNames() const = 0; + virtual QString formFileName( const QString &form ) const = 0; + virtual void addForm( DesignerFormWindow * ) = 0; + virtual void removeForm( DesignerFormWindow * ) = 0; + virtual QString fileName() const = 0; + virtual void setFileName( const QString & ) = 0; + virtual QString projectName() const = 0; + virtual void setProjectName( const QString & ) = 0; + virtual QString databaseFile() const = 0; + virtual void setDatabaseFile( const QString & ) = 0; + virtual void setupDatabases() const = 0; + virtual QPtrList databaseConnections() const = 0; + virtual void addDatabase( DesignerDatabase * ) = 0; + virtual void removeDatabase( DesignerDatabase * ) = 0; + virtual void save() const = 0; + virtual void setLanguage( const QString & ) = 0; + virtual QString language() const = 0; + virtual void setCustomSetting( const QString &key, const QString &value ) = 0; + virtual QString customSetting( const QString &key ) const = 0; + virtual DesignerPixmapCollection *pixmapCollection() const = 0; + virtual void breakPoints( QMap > &bps ) const = 0; + virtual QString breakPointCondition( QObject *o, int line ) const = 0; + virtual void setBreakPointCondition( QObject *o, int line, const QString &condition ) = 0; + virtual void clearAllBreakpoints() const = 0; + virtual void setIncludePath( const QString &platform, const QString &path ) = 0; + virtual void setLibs( const QString &platform, const QString &path ) = 0; + virtual void setDefines( const QString &platform, const QString &path ) = 0; + virtual void setConfig( const QString &platform, const QString &config ) = 0; + virtual void setTemplate( const QString &t ) = 0; + virtual QString config( const QString &platform ) const = 0; + virtual QString libs( const QString &platform ) const = 0; + virtual QString defines( const QString &platform ) const = 0; + virtual QString includePath( const QString &platform ) const = 0; + virtual QString templte() const = 0; + virtual bool isGenericObject( QObject *o ) const = 0; + +}; + +struct DesignerDatabase +{ + virtual QString name() const = 0; + virtual void setName( const QString & ) = 0; + virtual QString driver() const = 0; + virtual void setDriver( const QString & ) = 0; + virtual QString database() const = 0; + virtual void setDatabase( const QString & ) = 0; + virtual QString userName() const = 0; + virtual void setUserName( const QString & ) = 0; + virtual QString password() const = 0; + virtual void setPassword( const QString & ) = 0; + virtual QString hostName() const = 0; + virtual void setHostName( const QString & ) = 0; + virtual QStringList tables() const = 0; + virtual void setTables( const QStringList & ) = 0; + virtual QMap fields() const = 0; + virtual void setFields( const QMap & ) = 0; + virtual void open( bool suppressDialog = FALSE ) const = 0; + virtual void close() const = 0; + virtual QSqlDatabase* connection() = 0; + +}; + +struct DesignerPixmapCollection +{ + virtual void addPixmap( const QPixmap &p, const QString &name, bool force ) = 0; + virtual QPixmap pixmap( const QString &name ) const = 0; +}; + +struct DesignerFormWindow +{ + virtual QString name() const = 0; + virtual void setName( const QString &n ) = 0; + virtual QString fileName() const = 0; + virtual void setFileName( const QString & ) = 0; + virtual void save() const = 0; + virtual bool isModified() const = 0; + virtual void insertWidget( QWidget * ) = 0; + virtual void removeWidget( QWidget * ) = 0; + virtual QWidget *create( const char *className, QWidget *parent, const char *name ) = 0; + virtual QWidgetList widgets() const = 0; + virtual void undo() = 0; + virtual void redo() = 0; + virtual void cut() = 0; + virtual void copy() = 0; + virtual void paste() = 0; + virtual void adjustSize() = 0; + virtual void editConnections() = 0; + virtual void checkAccels() = 0; + virtual void layoutH() = 0; + virtual void layoutV() = 0; + virtual void layoutHSplit() = 0; + virtual void layoutVSplit() = 0; + virtual void layoutG() = 0; + virtual void layoutHContainer( QWidget* w ) = 0; + virtual void layoutVContainer( QWidget* w ) = 0; + virtual void layoutGContainer( QWidget* w ) = 0; + virtual void breakLayout() = 0; + virtual void selectWidget( QWidget * w ) = 0; + virtual void selectAll() = 0; + virtual void clearSelection() = 0; + virtual bool isWidgetSelected( QWidget * ) const = 0; + virtual QWidgetList selectedWidgets() const = 0; + virtual QWidget *currentWidget() const = 0; + virtual QWidget *form() const = 0; + virtual void setCurrentWidget( QWidget * ) = 0; + virtual QPtrList actionList() const = 0; + virtual QAction *createAction( const QString& text, const QIconSet& icon, const QString& menuText, int accel, + QObject* parent, const char* name = 0, bool toggle = FALSE ) = 0; + virtual void addAction( QAction * ) = 0; + virtual void removeAction( QAction * ) = 0; + virtual void preview() const = 0; + virtual void addFunction( const QCString &slot, const QString &specifier, const QString &access, + const QString &type, const QString &language, const QString &returnType ) = 0; + virtual void addConnection( QObject *sender, const char *signal, QObject *receiver, const char *slot ) = 0; + virtual void setProperty( QObject *o, const char *property, const QVariant &value ) = 0; + virtual QVariant property( QObject *o, const char *property ) const = 0; + virtual void setPropertyChanged( QObject *o, const char *property, bool changed ) = 0; + virtual bool isPropertyChanged( QObject *o, const char *property ) const = 0; + virtual void setColumnFields( QObject *o, const QMap & ) = 0; + virtual QStringList implementationIncludes() const = 0; + virtual QStringList declarationIncludes() const = 0; + virtual void setImplementationIncludes( const QStringList &lst ) = 0; + virtual void setDeclarationIncludes( const QStringList &lst ) = 0; + virtual QStringList forwardDeclarations() const = 0; + virtual void setForwardDeclarations( const QStringList &lst ) = 0; + virtual QStringList signalList() const = 0; + virtual void setSignalList( const QStringList &lst ) = 0; + virtual void addMenu( const QString &text, const QString &name ) = 0; + virtual void addMenuAction( const QString &menu, QAction *a ) = 0; + virtual void addMenuSeparator( const QString &menu ) = 0; + virtual void addToolBar( const QString &text, const QString &name ) = 0; + virtual void addToolBarAction( const QString &tb, QAction *a ) = 0; + virtual void addToolBarSeparator( const QString &tb ) = 0; + + virtual void onModificationChange( QObject *receiver, const char *slot ) = 0; +}; + +struct DesignerSourceFile +{ + virtual QString fileName() const = 0; +}; + +struct DesignerDock +{ + virtual QDockWindow *dockWindow() const = 0; +}; + +struct DesignerOutputDock +{ + virtual QWidget *addView( const QString &pageName ) = 0; + virtual void appendDebug( const QString & ) = 0; + virtual void clearDebug() = 0; + virtual void appendError( const QString &, int ) = 0; + virtual void clearError() = 0; +}; + +#endif diff --git a/kdevdesigner/interfaces/editorinterface.h b/kdevdesigner/interfaces/editorinterface.h new file mode 100644 index 00000000..0aff6c4f --- /dev/null +++ b/kdevdesigner/interfaces/editorinterface.h @@ -0,0 +1,102 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef EDITORINTERFACE_H +#define EDITORINTERFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include +#include + +class QWidget; +class QObjectList; +class QObject; + +// {8668161a-6037-4220-86b6-ccaa20127df8} +#ifndef IID_Editor +#define IID_Editor QUuid( 0x8668161a, 0x6037, 0x4220, 0x86, 0xb6, 0xcc, 0xaa, 0x20, 0x12, 0x7d, 0xf8 ) +#endif + +struct EditorInterface : public QUnknownInterface +{ + enum Mode + { + Editing, + Debugging + }; + + virtual QWidget *editor( bool readOnly, + QWidget *parent, + QUnknownInterface *designerIface ) = 0; + + virtual void setText( const QString &txt ) = 0; + virtual QString text() const = 0; + virtual bool isUndoAvailable() const = 0; + virtual bool isRedoAvailable() const = 0; + virtual void undo() = 0; + virtual void redo() = 0; + virtual void cut() = 0; + virtual void copy() = 0; + virtual void paste() = 0; + virtual void selectAll() = 0; + virtual bool find( const QString &expr, bool cs, bool wo, bool forward, bool startAtCursor ) = 0; + virtual bool replace( const QString &find, const QString &replace, bool cs, bool wo, bool forward, bool startAtCursor, bool replaceAll ) = 0; + virtual void gotoLine( int line ) = 0; + virtual void indent() = 0; + virtual void scrollTo( const QString &txt, const QString &first ) = 0; + virtual void splitView() = 0; + virtual void setContext( QObject *this_ ) = 0; + virtual void setError( int line ) = 0; + virtual void setStep( int line ) = 0; + virtual void setStackFrame( int line ) = 0; + virtual void clearStep() = 0; + virtual void clearStackFrame() = 0; + virtual void readSettings() = 0; + virtual void setModified( bool m ) = 0; + virtual bool isModified() const = 0; + virtual int numLines() const = 0; + virtual void breakPoints( QValueList &l ) const = 0; + virtual void setBreakPoints( const QValueList &l ) = 0; + virtual void setMode( Mode m ) = 0; + + virtual void onBreakPointChange( QObject *receiver, const char *slot ) = 0; + +}; + +#endif diff --git a/kdevdesigner/interfaces/filterinterface.h b/kdevdesigner/interfaces/filterinterface.h new file mode 100644 index 00000000..98abd250 --- /dev/null +++ b/kdevdesigner/interfaces/filterinterface.h @@ -0,0 +1,68 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef FILTERINTERFACE_H +#define FILTERINTERFACE_H + +#include + +// {ea8cb381-59b5-44a8-bae5-9bea8295762a} +#ifndef IID_ImportFilter +#define IID_ImportFilter QUuid( 0xea8cb381, 0x59b5, 0x44a8, 0xba, 0xe5, 0x9b, 0xea, 0x82, 0x95, 0x76, 0x2a ) +#endif + +/*! If you write a filter plugin to import dialogs or other user + interfaces from a different format than .ui into the Qt Designer, + implement this interface in that plugin. + + You also have to implement the function featureList() (\sa + QFeatureListInterface) and return there all filters (names of it) + which this interface provides. +*/ + +struct ImportFilterInterface : public QFeatureListInterface +{ + /*! This function is called by Qt Designer to open the file \a + filename using the filter \a filter. Qt Designer expects to get + back one or more .ui files, which it can open then. In the + implementation of the interface you have to return these + filenames, which the filter created, in this function.*/ + virtual QStringList import( const QString &filter, const QString &filename ) = 0; +}; + +// *************** INTERNAL ************************* + +// {c32a07e0-b006-471e-afca-d227457a1280} +#ifndef IID_ExportFilterInterface +#define IID_ExportFilterInterface QUuid( 0xc32a07e0, 0xb006, 0x471e, 0xaf, 0xca, 0xd2, 0x27, 0x45, 0x7a, 0x12, 0x80 ) +#endif + +struct ExportFilterInterface : public QFeatureListInterface +{ +// virtual QStringList export( const QString& filter, const QString& filename ) = 0; +}; + +#endif diff --git a/kdevdesigner/interfaces/interpreterinterface.h b/kdevdesigner/interfaces/interpreterinterface.h new file mode 100644 index 00000000..8a64e6fc --- /dev/null +++ b/kdevdesigner/interfaces/interpreterinterface.h @@ -0,0 +1,59 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef INTERPRETERINTERFACE_H +#define INTERPRETERINTERFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include + +class QObject; + +// {11cad9ec-4e3c-418b-8e90-e1b8c0c1f48f} +#ifndef IID_Interpreter +#define IID_Interpreter QUuid( 0x11cad9ec, 0x4e3c, 0x418b, 0x8e, 0x90, 0xe1, 0xb8, 0xc0, 0xc1, 0xf4, 0x8f ) +#endif + +struct InterpreterInterface : public QUnknownInterface +{ + virtual void setBreakPoints( QObject *obj, const QValueList &lst ) = 0; +}; + + + +#endif diff --git a/kdevdesigner/interfaces/languageinterface.h b/kdevdesigner/interfaces/languageinterface.h new file mode 100644 index 00000000..6fc0b8f9 --- /dev/null +++ b/kdevdesigner/interfaces/languageinterface.h @@ -0,0 +1,131 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LANGUAGEINTERFACE_H +#define LANGUAGEINTERFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include +#include +#include +#include + +// {f208499a-6f69-4883-9219-6e936e55a330} +#ifndef IID_Language +#define IID_Language QUuid( 0xf208499a, 0x6f69, 0x4883, 0x92, 0x19, 0x6e, 0x93, 0x6e, 0x55, 0xa3, 0x30 ) +#endif + +struct LanguageInterface : public QUnknownInterface +{ + struct Function + { + QString name; + QString body; + QString returnType; + QString comments; + int start; + int end; + QString access; + bool operator==( const Function &f ) const { + return ( name == f.name && + body == f.body && + returnType == f.returnType && + comments == f.comments ); + } + }; + + struct Connection + { + QString sender; + QString signal; + QString slot; + bool operator==( const Connection &c ) const { + return ( sender == c.sender && + signal == c.signal && + slot == c.slot ); + } + }; + + enum Support + { + ReturnType, + ConnectionsToCustomSlots, + CompressProject + }; + + virtual void functions( const QString &code, QValueList *funcs ) const = 0; + virtual void connections( const QString &code, QValueList *connections ) const = 0; + virtual QString createFunctionStart( const QString &className, const QString &func, + const QString &returnType, const QString &access ) = 0; + virtual QString createArguments( const QString &cpp_signature ) = 0; + virtual QString createEmptyFunction() = 0; + virtual QStringList definitions() const = 0; + virtual QStringList definitionEntries( const QString &definition, QUnknownInterface *designerIface ) const = 0; + virtual void setDefinitionEntries( const QString &definition, const QStringList &entries, QUnknownInterface *designerIface ) = 0; + virtual bool supports( Support s ) const = 0; + virtual QStringList fileFilterList() const = 0; + virtual QStringList fileExtensionList() const = 0; + virtual void preferedExtensions( QMap &extensionMap ) const = 0; + virtual QString projectKeyForExtension( const QString &extension ) const = 0; + virtual void sourceProjectKeys( QStringList &keys ) const = 0; + virtual QString cleanSignature( const QString &sig ) = 0; + virtual void loadFormCode( const QString &form, const QString &filename, + QValueList &functions, + QStringList &vars, + QValueList &connections ) = 0; + virtual QString formCodeExtension() const = 0; + + virtual bool canConnect( const QString &signal, const QString &slot ) = 0; + + virtual void compressProject( const QString &projectFile, const QString &compressedFile, + bool withWarning ) = 0; + virtual QString uncompressProject( const QString &projectFile, const QString &destDir ) = 0; + virtual QString aboutText() const = 0; + + virtual void addConnection( const QString &sender, const QString &signal, + const QString &receiver, const QString &slot, + QString *code ) = 0; + virtual void removeConnection( const QString &sender, const QString &signal, + const QString &receiver, const QString &slot, + QString *code ) = 0; + virtual QStrList signalNames( QObject *obj ) const = 0; + +}; + +#endif diff --git a/kdevdesigner/interfaces/preferenceinterface.h b/kdevdesigner/interfaces/preferenceinterface.h new file mode 100644 index 00000000..880fe285 --- /dev/null +++ b/kdevdesigner/interfaces/preferenceinterface.h @@ -0,0 +1,68 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PREFERENCEINTERFACE_H +#define PREFERENCEINTERFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include +#include + +// {5c168ee7-4bee-469f-9995-6afdb04ce5a2} +#ifndef IID_Preference +#define IID_Preference QUuid( 0x5c168ee7, 0x4bee, 0x469f, 0x99, 0x95, 0x6a, 0xfd, 0xb0, 0x4c, 0xe5, 0xa2 ) +#endif + +struct PreferenceInterface : public QUnknownInterface +{ + struct Preference + { + QWidget *tab; + QString title; + QObject *receiver; + const char *init_slot; + const char *accept_slot; + }; + + virtual Preference *preference() = 0; + virtual void connectTo( QUnknownInterface *appInterface ) = 0; + virtual void deletePreferenceObject( Preference * ) = 0; +}; + +#endif diff --git a/kdevdesigner/interfaces/projectsettingsiface.h b/kdevdesigner/interfaces/projectsettingsiface.h new file mode 100644 index 00000000..ee571a7b --- /dev/null +++ b/kdevdesigner/interfaces/projectsettingsiface.h @@ -0,0 +1,69 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PROJECTSETTINGSIFACE_H +#define PROJECTSETTINGSIFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include +#include + +// {d332785d-17fb-4894-84fe-50dbd0ad9512} +#ifndef IID_ProjectSettings +#define IID_ProjectSettings QUuid( 0xd332785d, 0x17fb, 0x4894, 0x84, 0xfe, 0x50, 0xdb, 0xd0, 0xad, 0x95, 0x12 ) +#endif + +struct ProjectSettingsInterface : public QUnknownInterface +{ + struct ProjectSettings + { + QWidget *tab; + QString title; + QObject *receiver; + const char *init_slot; + const char *accept_slot; + }; + + virtual ProjectSettings *projectSetting() = 0; + virtual QStringList projectSettings() const = 0; + virtual void connectTo( QUnknownInterface *appInterface ) = 0; + virtual void deleteProjectSettingsObject( ProjectSettings * ) = 0; +}; + +#endif diff --git a/kdevdesigner/interfaces/sourcetemplateiface.h b/kdevdesigner/interfaces/sourcetemplateiface.h new file mode 100644 index 00000000..c1dc2a74 --- /dev/null +++ b/kdevdesigner/interfaces/sourcetemplateiface.h @@ -0,0 +1,65 @@ + /********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef SOURCETEMPLATEIFACE_H +#define SOURCETEMPLATEIFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include +#include + +// {1b3446a4-1c71-424b-8789-1f34eb5697d8} +#ifndef IID_SourceTemplate +#define IID_SourceTemplate QUuid( 0x1b3446a4, 0x1c71, 0x424b, 0x87, 0x89, 0x1f, 0x34, 0xeb, 0x56, 0x97, 0xd8 ) +#endif + +struct SourceTemplateInterface : public QFeatureListInterface +{ + struct Source + { + QString code; + enum Type { FileName, Unnamed, Invalid } type; + QString filename; + QString extension; + }; + virtual Source create( const QString &templ, QUnknownInterface *appIface ) = 0; + virtual QString language( const QString &templ ) const = 0; + +}; + +#endif diff --git a/kdevdesigner/interfaces/templatewizardiface.h b/kdevdesigner/interfaces/templatewizardiface.h new file mode 100644 index 00000000..82b204da --- /dev/null +++ b/kdevdesigner/interfaces/templatewizardiface.h @@ -0,0 +1,60 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef TEMPLATEWIZARDIFACE_H +#define TEMPLATEWIZARDIFACE_H + +// +// W A R N I N G -- PRIVATE INTERFACES +// -------------------------------------- +// +// This file and the interfaces declared in the file are not +// public. It exists for internal purpose. This header file and +// interfaces may change from version to version (even binary +// incompatible) without notice, or even be removed. +// +// We mean it. +// +// + +#include + +class QWidget; +struct DesignerFormWindow; + +// {983d3eab-fea3-49cc-97ad-d8cc89b7c17b} +#ifndef IID_TemplateWizard +#define IID_TemplateWizard QUuid( 0x983d3eab, 0xfea3, 0x49cc, 0x97, 0xad, 0xd8, 0xcc, 0x89, 0xb7, 0xc1, 0x7b ) +#endif + +class TemplateWizardInterface : public QFeatureListInterface +{ +public: + virtual void setup( const QString &templ, QWidget *widget, DesignerFormWindow *fw, QUnknownInterface *appIface ) = 0; + +}; + +#endif diff --git a/kdevdesigner/interfaces/widgetinterface.h b/kdevdesigner/interfaces/widgetinterface.h new file mode 100644 index 00000000..9b6d8f8e --- /dev/null +++ b/kdevdesigner/interfaces/widgetinterface.h @@ -0,0 +1,35 @@ + /********************************************************************** +** Copyright (C) 2000-2001 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIDGETINTERFACE_H +#define WIDGETINTERFACE_H + +#include + +#define WidgetInterface QWidgetFactoryInterface +#define IID_Widget IID_QWidgetFactory + +#endif diff --git a/kdevdesigner/plugins/Makefile.am b/kdevdesigner/plugins/Makefile.am new file mode 100644 index 00000000..defe80c4 --- /dev/null +++ b/kdevdesigner/plugins/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/interfaces $(all_includes) +METASOURCES = AUTO +kdevdesignerdir = $(kde_moduledir)/plugins/kdevdesigner +kdevdesigner_LTLIBRARIES = libkdevdesigner_lang.la +libkdevdesigner_lang_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +libkdevdesigner_lang_la_SOURCES = languageinterfaceimpl.cpp +libkdevdesigner_lang_la_LIBADD = $(LIB_QT) + diff --git a/kdevdesigner/plugins/languageinterfaceimpl.cpp b/kdevdesigner/plugins/languageinterfaceimpl.cpp new file mode 100644 index 00000000..37077922 --- /dev/null +++ b/kdevdesigner/plugins/languageinterfaceimpl.cpp @@ -0,0 +1,237 @@ +/********************************************************************** +** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "languageinterfaceimpl.h" +#include +#include "../interfaces/designerinterface.h" +#include +//#include "yyreg.h" +#include + +LanguageInterfaceImpl::LanguageInterfaceImpl( QUnknownInterface *outer ) + : parent( outer ), ref( 0 ) +{ +} + +ulong LanguageInterfaceImpl::addRef() +{ + return parent ? parent->addRef() : ref++; +} + +ulong LanguageInterfaceImpl::release() +{ + if ( parent ) + return parent->release(); + if ( !--ref ) { + delete this; + return 0; + } + return ref; +} + +QRESULT LanguageInterfaceImpl::queryInterface( const QUuid &uuid, QUnknownInterface** iface ) +{ + if ( parent ) + return parent->queryInterface( uuid, iface ); + + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = (QUnknownInterface*)this; + else if ( uuid == IID_Language ) + *iface = (LanguageInterface*)this; + else + return QE_NOINTERFACE; + + (*iface)->addRef(); + return QS_OK; +} + + +class NormalizeObject : public QObject +{ +public: + NormalizeObject() : QObject() {} + static QCString normalizeSignalSlot( const char *signalSlot ) { return QObject::normalizeSignalSlot( signalSlot ); } +}; + +void LanguageInterfaceImpl::functions( const QString &code, QValueList *functionMap ) const +{ +/* QValueList l; + extractCppFunctions( code, &l ); + for ( QValueList::Iterator it = l.begin(); it != l.end(); ++it ) { + Function func; + func.name = (*it).prototype(); + func.name.remove( 0, (*it).returnType().length() ); + if ( func.name.find( "::" ) == -1 ) + continue; + func.name.remove( (uint)0, func.name.find( "::" ) + 2 ); + func.body = (*it).body(); + func.returnType = (*it).returnType(); + func.start = (*it).functionStartLineNum(); + func.end = (*it).closingBraceLineNum(); + functionMap->append( func ); + }*/ +} + +QString LanguageInterfaceImpl::createFunctionStart( const QString &className, const QString &func, + const QString &returnType, + const QString & ) +{ + return returnType + " " + className + "::" + func; +} + +QStringList LanguageInterfaceImpl::definitions() const +{ + QStringList lst; + lst << "Includes (in Implementation)" << "Includes (in Declaration)" << "Forward Declarations" << "Signals"; + return lst; +} + +QStringList LanguageInterfaceImpl::definitionEntries( const QString &definition, QUnknownInterface *designerIface ) const +{ + DesignerInterface *iface = 0; + designerIface->queryInterface( IID_Designer, (QUnknownInterface**) &iface ); + if ( !iface ) + return QStringList(); + DesignerFormWindow *fw = iface->currentForm(); + if ( !fw ) + return QStringList(); + QStringList lst; + if ( definition == "Includes (in Implementation)" ) { + lst = fw->implementationIncludes(); + } else if ( definition == "Includes (in Declaration)" ) { + lst = fw->declarationIncludes(); + } else if ( definition == "Forward Declarations" ) { + lst = fw->forwardDeclarations(); + } else if ( definition == "Signals" ) { + lst = fw->signalList(); + } + iface->release(); + return lst; +} + +void LanguageInterfaceImpl::setDefinitionEntries( const QString &definition, const QStringList &entries, QUnknownInterface *designerIface ) +{ + DesignerInterface *iface = 0; + designerIface->queryInterface( IID_Designer, (QUnknownInterface**) &iface ); + if ( !iface ) + return; + DesignerFormWindow *fw = iface->currentForm(); + if ( !fw ) + return; + if ( definition == "Includes (in Implementation)" ) { + fw->setImplementationIncludes( entries ); + } else if ( definition == "Includes (in Declaration)" ) { + fw->setDeclarationIncludes( entries ); + } else if ( definition == "Forward Declarations" ) { + fw->setForwardDeclarations( entries ); + } else if ( definition == "Signals" ) { + fw->setSignalList( entries ); + } + iface->release(); +} + +QString LanguageInterfaceImpl::createEmptyFunction() +{ + return "{\n\n}\n"; +} + +bool LanguageInterfaceImpl::supports( Support s ) const +{ + if ( s == ReturnType ) + return TRUE; + if ( s == ConnectionsToCustomSlots ) + return TRUE; + return FALSE; +} + +QStringList LanguageInterfaceImpl::fileFilterList() const +{ + QStringList f; + f << "C++ Files (*.cpp *.C *.cxx *.c++ *.ocl *.c *.h *.H *.hpp *.hxx)"; + return f; + +} +QStringList LanguageInterfaceImpl::fileExtensionList() const +{ + QStringList f; + f << "cpp" << "ocl" << "C" << "cxx" << "c++" << "c" <<"h" << "H" << "hpp" << "hxx"; + return f; +} + +QString LanguageInterfaceImpl::projectKeyForExtension( const QString &extension ) const +{ + if ( extension[ 0 ] == 'c' || extension[ 0 ] == 'C' ) + return "SOURCES"; + return "HEADERS"; +} + +void LanguageInterfaceImpl::sourceProjectKeys( QStringList &keys ) const +{ + keys << "HEADERS" << "SOURCES"; +} + + class CheckObject : public QObject +{ +public: + CheckObject() {} + bool checkConnectArgs( const char *signal, const char *member ) { return QObject::checkConnectArgs( signal, 0, member ); } + +}; + +bool LanguageInterfaceImpl::canConnect( const QString &signal, const QString &slot ) +{ + CheckObject o; + return o.checkConnectArgs( signal.latin1(), slot.latin1() ); +} + +void LanguageInterfaceImpl::loadFormCode( const QString &, const QString &filename, + QValueList &functions, + QStringList &, + QValueList & ) +{ + QFile f( filename ); + if ( !f.open( IO_ReadOnly ) ) + return; + QTextStream ts( &f ); + QString code( ts.read() ); + this->functions( code, &functions ); +} + +void LanguageInterfaceImpl::preferedExtensions( QMap &extensionMap ) const +{ + extensionMap.insert( "cpp", "C++ Source File" ); + extensionMap.insert( "h", "C++ Header File" ); +} + +QStrList LanguageInterfaceImpl::signalNames( QObject *obj ) const +{ + QStrList sigs; + sigs = obj->metaObject()->signalNames( TRUE ); + sigs.remove( "destroyed()" ); + return sigs; +} diff --git a/kdevdesigner/plugins/languageinterfaceimpl.h b/kdevdesigner/plugins/languageinterfaceimpl.h new file mode 100644 index 00000000..d8cb9cf2 --- /dev/null +++ b/kdevdesigner/plugins/languageinterfaceimpl.h @@ -0,0 +1,83 @@ +/********************************************************************** +** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef LANGUAGEINTERFACEIMPL_H +#define LANGUAGEINTERFACEIMPL_H + +#include "../interfaces/languageinterface.h" + +class LanguageInterfaceImpl : public LanguageInterface +{ +public: + LanguageInterfaceImpl( QUnknownInterface *outer = 0 ); + + ulong addRef(); + ulong release(); + + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + + void functions( const QString &code, QValueList *funcs ) const; + void connections( const QString &, QValueList * ) const {}; + QString createFunctionStart( const QString &className, const QString &func, + const QString &returnType, const QString &access ); + QStringList definitions() const; + QStringList definitionEntries( const QString &definition, QUnknownInterface *designerIface ) const; + void setDefinitionEntries( const QString &definition, const QStringList &entries, QUnknownInterface *designerIface ); + QString createArguments( const QString & ) { return QString::null; } + QString createEmptyFunction(); + bool supports( Support s ) const; + QStringList fileFilterList() const; + QStringList fileExtensionList() const; + void preferedExtensions( QMap &extensionMap ) const; + void sourceProjectKeys( QStringList &keys ) const; + QString projectKeyForExtension( const QString &extension ) const; + QString cleanSignature( const QString &sig ) { return sig; } // #### implement me + void loadFormCode( const QString &, const QString &, + QValueList &, + QStringList &, + QValueList & ); + QString formCodeExtension() const { return ".h"; } + bool canConnect( const QString &signal, const QString &slot ); + void compressProject( const QString &, const QString &, bool ) {} + QString uncompressProject( const QString &, const QString & ) { return QString::null; } + QString aboutText() const { return ""; } + + void addConnection( const QString &, const QString &, + const QString &, const QString &, + QString * ) {} + void removeConnection( const QString &, const QString &, + const QString &, const QString &, + QString * ) {} + QStrList signalNames( QObject *obj ) const; + +private: + QUnknownInterface *parent; + ulong ref; + +}; + +#endif diff --git a/kdevdesigner/shared/Makefile.am b/kdevdesigner/shared/Makefile.am new file mode 100644 index 00000000..ea86ae94 --- /dev/null +++ b/kdevdesigner/shared/Makefile.am @@ -0,0 +1,6 @@ +KDE_CXXFLAGS = -UQT_NO_ASCII_CAST +INCLUDES = -I$(top_srcdir)/lib/interfaces/external $(all_includes) +METASOURCES = AUTO +libshared_la_LDFLAGS = $(all_libraries) +noinst_LTLIBRARIES = libshared.la +libshared_la_SOURCES = domtool.cpp parser.cpp ui2uib.cpp uib.cpp widgetdatabase.cpp diff --git a/kdevdesigner/shared/domtool.cpp b/kdevdesigner/shared/domtool.cpp new file mode 100644 index 00000000..492ce88e --- /dev/null +++ b/kdevdesigner/shared/domtool.cpp @@ -0,0 +1,453 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "domtool.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/*! + \class DomTool domtool.h + \brief Tools for the dom + + A collection of static functions used by Resource (part of the + designer) and Uic. + +*/ + +/*! + Returns the contents of property \a name of object \a e as + variant or the variant passed as \a defValue if the property does + not exist. + + \sa hasProperty() +*/ +QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + if ( n.attribute( "name" ) != name ) + continue; + return elementToVariant( n.firstChild().toElement(), defValue, comment ); + } + } + return defValue; +} + + +/*! + \overload + */ +QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ) +{ + QString comment; + return readProperty( e, name, defValue, comment ); +} + +/*! + Returns wheter object \a e defines property \a name or not. + + \sa readProperty() + */ +bool DomTool::hasProperty( const QDomElement& e, const QString& name ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + if ( n.attribute( "name" ) != name ) + continue; + return TRUE; + } + } + return FALSE; +} + +QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type ) +{ + QStringList result; + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "property" ) { + QDomElement n2 = n.firstChild().toElement(); + if ( n2.tagName() == type ) + result += n.attribute( "name" ); + } + } + return result; +} + + +QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue ) +{ + QString dummy; + return elementToVariant( e, defValue, dummy ); +} + +/*! + Interprets element \a e as variant and returns the result of the interpretation. + */ +QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ) +{ + QVariant v; + if ( e.tagName() == "rect" ) { + QDomElement n3 = e.firstChild().toElement(); + int x = 0, y = 0, w = 0, h = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "x" ) + x = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "y" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "width" ) + w = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "height" ) + h = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QRect( x, y, w, h ) ); + } else if ( e.tagName() == "point" ) { + QDomElement n3 = e.firstChild().toElement(); + int x = 0, y = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "x" ) + x = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "y" ) + y = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QPoint( x, y ) ); + } else if ( e.tagName() == "size" ) { + QDomElement n3 = e.firstChild().toElement(); + int w = 0, h = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "width" ) + w = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "height" ) + h = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QSize( w, h ) ); + } else if ( e.tagName() == "color" ) { + v = QVariant( readColor( e ) ); + } else if ( e.tagName() == "font" ) { + QDomElement n3 = e.firstChild().toElement(); + QFont f( defValue.toFont() ); + while ( !n3.isNull() ) { + if ( n3.tagName() == "family" ) + f.setFamily( n3.firstChild().toText().data() ); + else if ( n3.tagName() == "pointsize" ) + f.setPointSize( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "bold" ) + f.setBold( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "italic" ) + f.setItalic( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "underline" ) + f.setUnderline( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "strikeout" ) + f.setStrikeOut( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( f ); + } else if ( e.tagName() == "string" ) { + v = QVariant( e.firstChild().toText().data() ); + QDomElement n = e; + n = n.nextSibling().toElement(); + if ( n.tagName() == "comment" ) + comment = n.firstChild().toText().data(); + } else if ( e.tagName() == "cstring" ) { + v = QVariant( QCString( e.firstChild().toText().data() ) ); + } else if ( e.tagName() == "number" ) { + bool ok = TRUE; + v = QVariant( e.firstChild().toText().data().toInt( &ok ) ); + if ( !ok ) + v = QVariant( e.firstChild().toText().data().toDouble() ); + } else if ( e.tagName() == "bool" ) { + QString t = e.firstChild().toText().data(); + v = QVariant( t == "true" || t == "1", 0 ); + } else if ( e.tagName() == "pixmap" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "iconset" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "image" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "enum" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "set" ) { + v = QVariant( e.firstChild().toText().data() ); + } else if ( e.tagName() == "sizepolicy" ) { + QDomElement n3 = e.firstChild().toElement(); + QSizePolicy sp; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hsizetype" ) + sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "vsizetype" ) + sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "horstretch" ) + sp.setHorStretch( n3.firstChild().toText().data().toInt() ); + else if ( n3.tagName() == "verstretch" ) + sp.setVerStretch( n3.firstChild().toText().data().toInt() ); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( sp ); + } else if ( e.tagName() == "cursor" ) { + v = QVariant( QCursor( e.firstChild().toText().data().toInt() ) ); + } else if ( e.tagName() == "stringlist" ) { + QStringList lst; + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) + lst << n.firstChild().toText().data(); + v = QVariant( lst ); + } else if ( e.tagName() == "date" ) { + QDomElement n3 = e.firstChild().toElement(); + int y, m, d; + y = m = d = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "year" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "month" ) + m = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "day" ) + d = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QDate( y, m, d ) ); + } else if ( e.tagName() == "time" ) { + QDomElement n3 = e.firstChild().toElement(); + int h, m, s; + h = m = s = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hour" ) + h = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "minute" ) + m = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "second" ) + s = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QTime( h, m, s ) ); + } else if ( e.tagName() == "datetime" ) { + QDomElement n3 = e.firstChild().toElement(); + int h, mi, s, y, mo, d ; + h = mi = s = y = mo = d = 0; + while ( !n3.isNull() ) { + if ( n3.tagName() == "hour" ) + h = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "minute" ) + mi = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "second" ) + s = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "year" ) + y = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "month" ) + mo = n3.firstChild().toText().data().toInt(); + else if ( n3.tagName() == "day" ) + d = n3.firstChild().toText().data().toInt(); + n3 = n3.nextSibling().toElement(); + } + v = QVariant( QDateTime( QDate( y, mo, d ), QTime( h, mi, s ) ) ); + } + return v; +} + + +/*! Returns the color which is returned in the dom element \a e. + */ + +QColor DomTool::readColor( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + int r= 0, g = 0, b = 0; + while ( !n.isNull() ) { + if ( n.tagName() == "red" ) + r = n.firstChild().toText().data().toInt(); + else if ( n.tagName() == "green" ) + g = n.firstChild().toText().data().toInt(); + else if ( n.tagName() == "blue" ) + b = n.firstChild().toText().data().toInt(); + n = n.nextSibling().toElement(); + } + + return QColor( r, g, b ); +} + +/*! + Returns the contents of attribute \a name of object \a e as + variant or the variant passed as \a defValue if the attribute does + not exist. + + \sa hasAttribute() + */ +QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "attribute" ) { + if ( n.attribute( "name" ) != name ) + continue; + return elementToVariant( n.firstChild().toElement(), defValue, comment ); + } + } + return defValue; +} + +/*! + \overload +*/ +QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ) +{ + QString comment; + return readAttribute( e, name, defValue, comment ); +} + +/*! + Returns wheter object \a e defines attribute \a name or not. + + \sa readAttribute() + */ +bool DomTool::hasAttribute( const QDomElement& e, const QString& name ) +{ + QDomElement n; + for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "attribute" ) { + if ( n.attribute( "name" ) != name ) + continue; + return TRUE; + } + } + return FALSE; +} + +static bool toBool( const QString& s ) +{ + return s == "true" || s.toInt() != 0; +} + +/*! + Convert Qt 2.x format to Qt 3.0 format if necessary +*/ +void DomTool::fixDocument( QDomDocument& doc ) +{ + QDomElement e; + QDomNode n; + QDomNodeList nl; + int i = 0; + + e = doc.firstChild().toElement(); + if ( e.tagName() != "UI" ) + return; + + // latest version, don't do anything + if ( e.hasAttribute("version") && e.attribute("version").toDouble() > 3.0 ) + return; + + nl = doc.elementsByTagName( "property" ); + + // in 3.0, we need to fix a spelling error + if ( e.hasAttribute("version") && e.attribute("version").toDouble() == 3.0 ) { + for ( i = 0; i < (int) nl.length(); i++ ) { + QDomElement el = nl.item(i).toElement(); + QString s = el.attribute( "name" ); + if ( s == "resizeable" ) { + el.removeAttribute( "name" ); + el.setAttribute( "name", "resizable" ); + } + } + return; + } + + + // in versions smaller than 3.0 we need to change more + e.setAttribute( "version", 3.0 ); + + e.setAttribute("stdsetdef", 1 ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "name" ) { + name = n2.firstChild().toText().data(); + if ( name == "resizeable" ) + e.setAttribute( "name", "resizable" ); + else + e.setAttribute( "name", name ); + e.removeChild( n2 ); + } + bool stdset = toBool( e.attribute( "stdset" ) ); + if ( stdset || name == "toolTip" || name == "whatsThis" || + name == "buddy" || + e.parentNode().toElement().tagName() == "item" || + e.parentNode().toElement().tagName() == "spacer" || + e.parentNode().toElement().tagName() == "column" + ) + e.removeAttribute( "stdset" ); + else + e.setAttribute( "stdset", 0 ); + } + + nl = doc.elementsByTagName( "attribute" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "name" ) { + name = n2.firstChild().toText().data(); + e.setAttribute( "name", name ); + e.removeChild( n2 ); + } + } + + nl = doc.elementsByTagName( "image" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "name" ) { + name = n2.firstChild().toText().data(); + e.setAttribute( "name", name ); + e.removeChild( n2 ); + } + } + + nl = doc.elementsByTagName( "widget" ); + for ( i = 0; i < (int) nl.length(); i++ ) { + e = nl.item(i).toElement(); + QString name; + QDomElement n2 = e.firstChild().toElement(); + if ( n2.tagName() == "class" ) { + name = n2.firstChild().toText().data(); + e.setAttribute( "class", name ); + e.removeChild( n2 ); + } + } + +} + diff --git a/kdevdesigner/shared/domtool.h b/kdevdesigner/shared/domtool.h new file mode 100644 index 00000000..61b4269a --- /dev/null +++ b/kdevdesigner/shared/domtool.h @@ -0,0 +1,53 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DOMTOOL_H +#define DOMTOOL_H + +#include +#include + +class QDomElement; +class QDomDocument; + +class DomTool : public Qt +{ +public: + static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ); + static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ); + static bool hasProperty( const QDomElement& e, const QString& name ); + static QStringList propertiesOfType( const QDomElement& e, const QString& type ); + static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue ); + static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ); + static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ); + static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ); + static bool hasAttribute( const QDomElement& e, const QString& name ); + static QColor readColor( const QDomElement &e ); + static void fixDocument( QDomDocument& ); +}; + + +#endif // DOMTOOL_H diff --git a/kdevdesigner/shared/globaldefs.h b/kdevdesigner/shared/globaldefs.h new file mode 100644 index 00000000..653c4fa5 --- /dev/null +++ b/kdevdesigner/shared/globaldefs.h @@ -0,0 +1,62 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef GLOBALDEFS_H +#define GLOBALDEFS_H + +#include +#include + +#define BOXLAYOUT_DEFAULT_MARGIN 11 +#define BOXLAYOUT_DEFAULT_SPACING 6 + +#ifndef NO_STATIC_COLORS +static QColor *backColor1 = 0; +static QColor *backColor2 = 0; +static QColor *selectedBack = 0; + +static void init_colors() +{ + if ( backColor1 ) + return; + +#if 0 // a calculated alternative for backColor1 + QColorGroup myCg = qApp->palette().active(); + int h1, s1, v1; + int h2, s2, v2; + myCg.color( QColorGroup::Base ).hsv( &h1, &s1, &v1 ); + myCg.color( QColorGroup::Background ).hsv( &h2, &s2, &v2 ); + QColor c( h1, s1, ( v1 + v2 ) / 2, QColor::Hsv ); +#endif + + backColor1 = new QColor( 250, 248, 235 ); + backColor2 = new QColor( 255, 255, 255 ); + selectedBack = new QColor( 230, 230, 230 ); +} + +#endif + +#endif diff --git a/kdevdesigner/shared/parser.cpp b/kdevdesigner/shared/parser.cpp new file mode 100644 index 00000000..e1b54ca1 --- /dev/null +++ b/kdevdesigner/shared/parser.cpp @@ -0,0 +1,72 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "parser.h" +#include +#include + +class NormalizeObject : public QObject +{ +public: + NormalizeObject() : QObject() {} + static QCString normalizeSignalSlot( const char *signalSlot ) { return QObject::normalizeSignalSlot( signalSlot ); } +}; + +QString Parser::cleanArgs( const QString &func ) +{ + QString slot( func ); + int begin = slot.find( "(" ) + 1; + QString args = slot.mid( begin ); + args = args.left( args.find( ")" ) ); + QStringList lst = QStringList::split( ',', args ); + QString res = slot.left( begin ); + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + if ( it != lst.begin() ) + res += ","; + QString arg = *it; + int pos = 0; + if ( ( pos = arg.find( "&" ) ) != -1 ) { + arg = arg.left( pos + 1 ); + } else if ( ( pos = arg.find( "*" ) ) != -1 ) { + arg = arg.left( pos + 1 ); + } else { + arg = arg.simplifyWhiteSpace(); + if ( ( pos = arg.find( ':' ) ) != -1 ) + arg = arg.left( pos ).simplifyWhiteSpace() + ":" + arg.mid( pos + 1 ).simplifyWhiteSpace(); + QStringList l = QStringList::split( ' ', arg ); + if ( l.count() == 2 ) { + if ( l[ 0 ] != "const" && l[ 0 ] != "unsigned" && l[ 0 ] != "var" ) + arg = l[ 0 ]; + } else if ( l.count() == 3 ) { + arg = l[ 0 ] + " " + l[ 1 ]; + } + } + res += arg; + } + res += ")"; + + return QString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) ); +} diff --git a/kdevdesigner/shared/parser.h b/kdevdesigner/shared/parser.h new file mode 100644 index 00000000..10d83027 --- /dev/null +++ b/kdevdesigner/shared/parser.h @@ -0,0 +1,39 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef PARSER_H +#define PARSER_H + +#include + +class Parser +{ +public: + static QString cleanArgs( const QString &func ); + +}; + +#endif diff --git a/kdevdesigner/shared/ui2uib.cpp b/kdevdesigner/shared/ui2uib.cpp new file mode 100644 index 00000000..72c09320 --- /dev/null +++ b/kdevdesigner/shared/ui2uib.cpp @@ -0,0 +1,893 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "ui2uib.h" +#include "uib.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + The .uib file format is the binary counterpart of the .ui file + format. It is generated by the ui2uib converter and understood by + QWidgetFactory; in a future version, it might also be understood + by a uib2ui converter. Experiments show that .uib files are about + 2.5 times faster to load and 6 times smaller than .ui files. + + The .uib format, unlike the .ui format, is internal to Trolltech + and is not officially documented; it is assumed that anybody who + needs to understand the file format can read the ui2uib and + QWidgetFactory source code, with some guidance. And here's some + guidance. + + A .uib file starts with a 32-bit magic number that allows + QWidgetFactory to determine the file type. The magic number is + followed by '\n' (0x0a) and '\r' (0x0d), which ensure that the + file wasn't corrupted during transfer between different + platforms. For example, transferring a .ui file from Windows to + Unix using FTP with type ASCII will produce a file with '\r\n\r' + in place of '\n\r'. This is followed by the QDataStream format + version number used. + + The rest of the file is made up of blocks, each of which starts + with a block type (Block_XXX) and a block length. Block_Intro and + Block_Widget are mandatory; the others are optional. + QWidgetFactory makes certain assumptions about the order of the + blocks; for example, it expects Block_String before any other + block that refers to a string and Block_Images before + Block_Widget. The order generated by ui2uib is one of the orders + that make sense. Just after the last block, a Block_End marker + indicates the end of the file. + + The division of .uib files into blocks corresponds grossly to the + division of .ui files in top-level XML elements. Thus, + Block_Widget corresponds to and Block_Toolbars to + . The internal organization of each block also mimics + the organization of the corresponding XML elements. + + These are the major differences, all of which contribute to + making .uib files more compact: + + 1. The strings are gathered in Block_Strings, a string-table. + When a string is needed later, it is referenced by a 32-bit + index into that table. The UicStringTable class makes the + whole process of inserting and looking up strings very + simple. The advantage of this scheme is that if a string is + used more than once, it is stored only once. Also, the + string-table is preinitialized with very common strings, so + that these need not be stored along with .uib files. + + 2. QObjects are referred to by index in a table rather than by + name. The table itself is not stored in the .uib file; it is + rather build dynamically by ui2uib and QWidgetFactory as new + objects are specified. In ui2uib, the table is represented by + a UibIndexMap object; in QWidgetFactory, a plain array of + QObject pointers suffices. + + 3. The data is packed to take as little place as possible, + without slowing down QLayoutFactory too much. For example, an + index into the string-table is a 32-bit integer, but in + practice it is rarely above 65534, so only 16 bits are used + for them; when an index above 65534 is met, the index is + saved as 65535 followed by the 32-bit index, for a total of + 48 bits. + + 4. The name of a signal or slot and its signature are saved + separately. That way, if a signal 'foo(const QString&)' is + connected to a slot 'bar(const QString&)', the string-table + will only contain 'foo', 'bar', and '(const QString&)', + instead of the longer 'foo(const QString&)' and 'bar(const + QString&)'. The signatures are normalized beforehand to + ensure that trivial spacing problems don't result in multiple + string-table entries. + + 5. In a signal-to-slot connection, a sender, signal, receiver, + or slot is not repeated if it's the same as for the previous + connection. Bit flags indicate what is repeated and what is + specified. + + 6. Some of the information stored in a .ui file is useful only + by uic, not to QLayoutFactory. That information is, for now, + not taken along in the .uib file. Likewise, needless + QLayoutWidget objects are not taken along. + + The arbitrary constants related to the .uib file formats are + defined in uib.h. Constants such as Block_Actions and + Object_SubWidget are given values such as 'A' and 'W' to make + .uib files easier to read in a hexadecimal editor. + + The file format isn't designed to be extensible. Any extension + that prevents an older version of QLayoutWidget of reading the + file correctly must have a different magic number. The plan is to + use UibMagic + 1 for version 2, UibMagic + 2 for version 3, etc. +*/ + +static QCString layoutForTag( const QString& tag ) +{ + if ( tag == "grid" ) { + return "QGridLayout"; + } else if ( tag == "hbox" ) { + return "QHBoxLayout"; + } else if ( tag == "vbox" ) { + return "QVBoxLayout"; + } else { + return "QLayout"; + } +} + +class UibHack : public QObject +{ +public: + static QString normalize( const QString& member ) { + return QString::fromUtf8( QObject::normalizeSignalSlot(member.utf8()) ); + } +}; + +class UibIndexMap +{ +public: + UibIndexMap() : next( 0 ) { } + + void insert( const QString& name ) { setName( insert(), name ); } + int insert() { return next++; } + void setName( int no, const QString& name ); + + int find( const QString& name, int deflt = -1 ) const; + int count() const { return next; } + +private: + QMap nameMap; + QMap conflicts; + int next; +}; + +void UibIndexMap::setName( int no, const QString& name ) +{ + if ( !name.isEmpty() ) { + if ( *nameMap.insert(name, no, FALSE) != no ) + conflicts.insert( name, 0 ); + } +} + +int UibIndexMap::find( const QString& name, int deflt ) const +{ + QMap::ConstIterator no = nameMap.find( name ); + if ( no == nameMap.end() || conflicts.contains(name) ) { + return deflt; + } else { + return *no; + } +} + +static void packUInt16( QDataStream& out, Q_UINT16 n ) +{ + if ( n < 255 ) { + out << (Q_UINT8) n; + } else { + out << (Q_UINT8) 255; + out << n; + } +} + +static void packUInt32( QDataStream& out, Q_UINT32 n ) +{ + if ( n < 65535 ) { + out << (Q_UINT16) n; + } else { + out << (Q_UINT16) 65535; + out << n; + } +} + +static void packByteArray( QDataStream& out, const QByteArray& array ) +{ + packUInt32( out, array.size() ); + out.writeRawBytes( array.data(), array.size() ); +} + +static void packCString( UibStrTable& strings, QDataStream& out, + const char *cstr ) +{ + packUInt32( out, strings.insertCString(cstr) ); +} + +static void packString( UibStrTable& strings, QDataStream& out, + const QString& str ) +{ + packUInt32( out, strings.insertString(str) ); +} + +static void packStringSplit( UibStrTable& strings, QDataStream& out, + const QString& str, QChar sep ) +{ + int pos = str.find( sep ); + if ( pos == -1 ) + pos = str.length(); + packString( strings, out, str.left(pos) ); + packString( strings, out, str.mid(pos) ); +} + +static void packVariant( UibStrTable& strings, QDataStream& out, + QVariant value, QString tag = "" ) +{ + QStringList::ConstIterator s; + + Q_UINT8 type = value.type(); + if ( tag == "pixmap" ) { + type = QVariant::Pixmap; + } else if ( tag == "image" ) { + type = QVariant::Image; + } else if ( tag == "iconset" ) { + type = QVariant::IconSet; + } + out << type; + + switch ( type ) { + case QVariant::String: + case QVariant::Pixmap: + case QVariant::Image: + case QVariant::IconSet: + packString( strings, out, value.asString() ); + break; + case QVariant::StringList: + packUInt16( out, value.asStringList().count() ); + s = value.asStringList().begin(); + while ( s != value.asStringList().end() ) { + packString( strings, out, *s ); + ++s; + } + break; + case QVariant::Font: + out << value.asFont(); + break; + case QVariant::Rect: + packUInt16( out, value.asRect().x() ); + packUInt16( out, value.asRect().y() ); + packUInt16( out, value.asRect().width() ); + packUInt16( out, value.asRect().height() ); + break; + case QVariant::Size: + packUInt16( out, value.asSize().width() ); + packUInt16( out, value.asSize().height() ); + break; + case QVariant::Color: + out << value.asColor(); + break; + case QVariant::Point: + packUInt16( out, value.asPoint().x() ); + packUInt16( out, value.asPoint().y() ); + break; + case QVariant::Int: + packUInt32( out, value.asInt() ); + break; + case QVariant::Bool: + out << (Q_UINT8) value.asBool(); + break; + case QVariant::Double: + out << value.asDouble(); + break; + case QVariant::CString: + packCString( strings, out, value.asCString() ); + break; + case QVariant::Cursor: + out << value.asCursor(); + break; + case QVariant::Date: + out << value.asDate(); + break; + case QVariant::Time: + out << value.asTime(); + break; + case QVariant::DateTime: + out << value.asDateTime(); + break; + default: + out << value; + } +} + +static void outputProperty( QMap& buddies, int objectNo, + UibStrTable& strings, QDataStream& out, + QDomElement elem ) +{ + QCString name = elem.attribute( "name" ).latin1(); + QDomElement f = elem.firstChild().toElement(); + QString tag = f.tagName(); + QString comment; + QVariant value; + + if ( name == "resizeable" ) + name = "resizable"; + + if ( tag == "font" ) { + QString family; + Q_UINT16 pointSize = 65535; + Q_UINT8 fontFlags = 0; + + QDomElement g = f.firstChild().toElement(); + while ( !g.isNull() ) { + QString text = g.firstChild().toText().data(); + if ( g.tagName() == "family" ) { + fontFlags |= Font_Family; + family = text; + } else if ( g.tagName() == "pointsize" ) { + fontFlags |= Font_PointSize; + pointSize = (Q_UINT16) text.toUInt(); + } else { + if ( g.firstChild().toText().data().toInt() != 0 ) { + if ( g.tagName() == "bold" ) { + fontFlags |= Font_Bold; + } else if ( g.tagName() == "italic" ) { + fontFlags |= Font_Italic; + } else if ( g.tagName() == "underline" ) { + fontFlags |= Font_Underline; + } else if ( g.tagName() == "strikeout" ) { + fontFlags |= Font_StrikeOut; + } + } + } + g = g.nextSibling().toElement(); + } + + out << (Q_UINT8) Object_FontProperty; + packCString( strings, out, name ); + out << fontFlags; + if ( fontFlags & Font_Family ) + packString( strings, out, family ); + if ( fontFlags & Font_PointSize ) + packUInt16( out, pointSize ); + } else if ( tag == "palette" ) { + out << (Q_UINT8) Object_PaletteProperty; + packCString( strings, out, name ); + + QDomElement g = f.firstChild().toElement(); + while ( !g.isNull() ) { + QDomElement h = g.firstChild().toElement(); + while ( !h.isNull() ) { + value = DomTool::elementToVariant( h, Qt::gray ); + if ( h.tagName() == "color" ) { + out << (Q_UINT8) Palette_Color; + out << value.asColor(); + } else if ( h.tagName() == "pixmap" ) { + out << (Q_UINT8) Palette_Pixmap; + packVariant( strings, out, value, "pixmap" ); + } + h = h.nextSibling().toElement(); + } + + if ( g.tagName() == "active" ) { + out << (Q_UINT8) Palette_Active; + } else if ( g.tagName() == "inactive" ) { + out << (Q_UINT8) Palette_Inactive; + } else { + out << (Q_UINT8) Palette_Disabled; + } + g = g.nextSibling().toElement(); + } + out << (Q_UINT8) Palette_End; + } else { + value = DomTool::elementToVariant( f, value, comment ); + if ( value.isValid() ) { + if ( name == "buddy" ) { + buddies[objectNo] += value.asString(); + } else { + if ( tag == "string" ) { + out << (Q_UINT8) Object_TextProperty; + packCString( strings, out, name ); + packCString( strings, out, value.asString().utf8() ); + packCString( strings, out, comment.utf8() ); + } else { + out << (Q_UINT8) Object_VariantProperty; + packCString( strings, out, name ); + packVariant( strings, out, value, tag ); + } + } + } + } +} + +static void outputGridCell( QDataStream& out, QDomElement elem ) +{ + int column = elem.attribute( "column", "0" ).toInt(); + int row = elem.attribute( "row", "0" ).toInt(); + int colspan = elem.attribute( "colspan", "1" ).toInt(); + int rowspan = elem.attribute( "rowspan", "1" ).toInt(); + if ( colspan < 1 ) + colspan = 1; + if ( rowspan < 1 ) + rowspan = 1; + + if ( column != 0 || row != 0 || colspan != 1 || rowspan != 1 ) { + out << (Q_UINT8) Object_GridCell; + packUInt16( out, column ); + packUInt16( out, row ); + packUInt16( out, colspan ); + packUInt16( out, rowspan ); + } +} + +static int outputObject( QMap& buddies, + UibIndexMap& objects, UibStrTable& strings, + QDataStream& out, QDomElement elem, + QCString className = "" ); + +static void outputLayoutWidgetsSubLayout( QMap& buddies, + UibIndexMap& objects, + UibStrTable& strings, + QDataStream& out, QDomElement elem ) +{ + int subLayoutNo = -1; + QCString name; + QDomElement nameElem; + + QDomElement f = elem.firstChild().toElement(); + while ( !f.isNull() ) { + QString tag = f.tagName(); + if ( tag == "grid" || tag == "hbox" || tag == "vbox" ) { + out << (Q_UINT8) Object_SubLayout; + subLayoutNo = outputObject( buddies, objects, strings, out, f, + layoutForTag(tag) ); + } else if ( tag == "property" ) { + if ( f.attribute("name") == "name" ) { + name = DomTool::elementToVariant( f, name ).asCString(); + nameElem = f; + } + } + f = f.nextSibling().toElement(); + } + + if ( subLayoutNo != -1 ) { + /* + Remove the sub-layout's Object_End marker, append the grid + cell and the correct name property, and put the Object_End + marker back. + */ + out.device()->at( out.device()->at() - 1 ); + outputGridCell( out, elem ); + outputProperty( buddies, subLayoutNo, strings, out, nameElem ); + out << (Q_UINT8) Object_End; + + objects.setName( subLayoutNo, name ); + } +} + +static int outputObject( QMap& buddies, + UibIndexMap& objects, UibStrTable& strings, + QDataStream& out, QDomElement elem, + QCString className ) +{ + bool isQObject = !className.isEmpty(); + + if ( className == "QToolBar" ) + out << (Q_UINT8) elem.attribute( "dock", "0" ).toInt(); + if ( className == "QWidget" ) + className = elem.attribute( "class", className ).latin1(); + + int objectNo = -1; + if ( isQObject ) { + packCString( strings, out, className ); + objectNo = objects.insert(); + } + + outputGridCell( out, elem ); + + // optimization: insert '&Foo' into string-table before 'Foo' + if ( className == "QAction" || className == "QActionGroup" ) { + QVariant value = DomTool::readProperty( elem, "menuText", QVariant() ); + if ( value.asString().startsWith("&") ) + strings.insertString( value.asString() ); + } + + QDomElement f = elem.firstChild().toElement(); + while ( !f.isNull() ) { + QString tag = f.tagName(); + if ( tag == "action" ) { + if ( elem.tagName() == "item" || elem.tagName() == "toolbar" ) { + QString actionName = f.attribute( "name" ); + int no = objects.find( actionName ); + if ( no != -1 ) { + out << (Q_UINT8) Object_ActionRef; + packUInt16( out, no ); + } + } else { + out << (Q_UINT8) Object_SubAction; + outputObject( buddies, objects, strings, out, f, "QAction" ); + } + } else if ( tag == "actiongroup" ) { + out << (Q_UINT8) Object_SubAction; + outputObject( buddies, objects, strings, out, f, "QActionGroup" ); + } else if ( tag == "attribute" ) { + out << (Q_UINT8) Object_Attribute; + outputProperty( buddies, objectNo, strings, out, f ); + } else if ( tag == "column" ) { + out << (Q_UINT8) Object_Column; + outputObject( buddies, objects, strings, out, f ); + } else if ( tag == "event" ) { + out << (Q_UINT8) Object_Event; + packCString( strings, out, f.attribute("name").latin1() ); + packVariant( strings, out, + QStringList::split(',', f.attribute("functions")) ); + } else if ( tag == "grid" || tag == "hbox" || tag == "vbox" ) { + out << (Q_UINT8) Object_SubLayout; + outputObject( buddies, objects, strings, out, f, + layoutForTag(tag) ); + } else if ( tag == "item" ) { + if ( elem.tagName() == "menubar" ) { + out << (Q_UINT8) Object_MenuItem; + packCString( strings, out, f.attribute("name").latin1() ); + packCString( strings, out, f.attribute("text").utf8() ); + outputObject( buddies, objects, strings, out, f ); + } else { + out << (Q_UINT8) Object_Item; + outputObject( buddies, objects, strings, out, f ); + } + } else if ( tag == "property" ) { + outputProperty( buddies, objectNo, strings, out, f ); + } else if ( tag == "row" ) { + out << (Q_UINT8) Object_Row; + outputObject( buddies, objects, strings, out, f ); + } else if ( tag == "separator" ) { + out << (Q_UINT8) Object_Separator; + } else if ( tag == "spacer" ) { + out << (Q_UINT8) Object_Spacer; + outputObject( buddies, objects, strings, out, f ); + } else if ( tag == "widget" ) { + if ( f.attribute("class") == "QLayoutWidget" && + elem.tagName() != "widget" ) { + outputLayoutWidgetsSubLayout( buddies, objects, strings, out, + f ); + } else { + out << (Q_UINT8) Object_SubWidget; + outputObject( buddies, objects, strings, out, f, "QWidget" ); + } + } + f = f.nextSibling().toElement(); + } + out << (Q_UINT8) Object_End; + if ( isQObject ) + objects.setName( objectNo, + DomTool::readProperty(elem, "name", "").asString() ); + return objectNo; +} + +static void outputBlock( QDataStream& out, BlockTag tag, + const QByteArray& data ) +{ + if ( !data.isEmpty() ) { + out << (Q_UINT8) tag; + packByteArray( out, data ); + } +} + +void convertUiToUib( QDomDocument& doc, QDataStream& out ) +{ + QByteArray introBlock; + QByteArray actionsBlock; + QByteArray buddiesBlock; + QByteArray connectionsBlock; + QByteArray functionsBlock; + QByteArray imagesBlock; + QByteArray menubarBlock; + QByteArray slotsBlock; + QByteArray tabstopsBlock; + QByteArray toolbarsBlock; + QByteArray variablesBlock; + QByteArray widgetBlock; + + QDomElement actionsElem; + QDomElement connectionsElem; + QDomElement imagesElem; + QDomElement menubarElem; + QDomElement tabstopsElem; + QDomElement toolbarsElem; + QDomElement widgetElem; + + QMap buddies; + UibStrTable strings; + UibIndexMap objects; + int widgetNo = -1; + QCString className; + Q_INT16 defaultMargin = -32768; + Q_INT16 defaultSpacing = -32768; + Q_UINT8 introFlags = 0; + + QDomElement elem = doc.firstChild().toElement().firstChild().toElement(); + while ( !elem.isNull() ) { + QString tag = elem.tagName(); + + switch ( tag[0].latin1() ) { + case 'a': + if ( tag == "actions" ) + actionsElem = elem; + break; + case 'c': + if ( tag == "class" ) { + className = elem.firstChild().toText().data().latin1(); + } else if ( tag == "connections" ) { + connectionsElem = elem; + } + break; + case 'f': + if ( tag == "functions" ) { + QDataStream out2( functionsBlock, IO_WriteOnly ); + QDomElement f = elem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "function" ) { + packStringSplit( strings, out2, + f.attribute("name").latin1(), '(' ); + packString( strings, out2, + f.firstChild().toText().data() ); + } + f = f.nextSibling().toElement(); + } + } + break; + case 'i': + if ( tag == "images" ) { + QDataStream out2( imagesBlock, IO_WriteOnly ); + QDomElement f = elem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "image" ) { + QString name = f.attribute( "name" ); + QDomElement g = f.firstChild().toElement(); + if ( g.tagName() == "data" ) { + QString format = g.attribute( "format", "PNG" ); + QString hex = g.firstChild().toText().data(); + int n = hex.length() / 2; + QByteArray data( n ); + for ( int i = 0; i < n; i++ ) + data[i] = (char) hex.mid( 2 * i, 2 ) + .toUInt( 0, 16 ); + + packString( strings, out2, name ); + packString( strings, out2, format ); + packUInt32( out2, g.attribute("length").toInt() ); + packByteArray( out2, data ); + } + } + f = f.nextSibling().toElement(); + } + } + break; + case 'l': + if ( tag == "layoutdefaults" ) { + QString margin = elem.attribute( "margin" ); + if ( !margin.isEmpty() ) + defaultMargin = margin.toInt(); + QString spacing = elem.attribute( "spacing" ); + if ( !spacing.isEmpty() ) + defaultSpacing = spacing.toInt(); + } + break; + case 'm': + if ( tag == "menubar" ) + menubarElem = elem; + break; + case 'p': + if ( tag == "pixmapinproject" ) + introFlags |= Intro_Pixmapinproject; + break; + case 's': + if ( tag == "slots" ) { + QDataStream out2( slotsBlock, IO_WriteOnly ); + QDomElement f = elem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "slot" ) { + QString language = f.attribute( "language", "C++" ); + QString slot = UibHack::normalize( + f.firstChild().toText().data() ); + packString( strings, out2, language ); + packStringSplit( strings, out2, slot, '(' ); + } + f = f.nextSibling().toElement(); + } + } + break; + case 't': + if ( tag == "tabstops" ) { + tabstopsElem = elem; + } else if ( tag == "toolbars" ) { + toolbarsElem = elem; + } + break; + case 'v': + if ( tag == "variable" ) { + QDataStream out2( variablesBlock, IO_WriteOnly | IO_Append ); + packString( strings, out2, elem.firstChild().toText().data() ); + } else if ( tag == "variables" ) { + QDataStream out2( variablesBlock, IO_WriteOnly ); + QDomElement f = elem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "variable" ) + packString( strings, out2, + f.firstChild().toText().data() ); + f = f.nextSibling().toElement(); + } + } + break; + case 'w': + if ( tag == "widget" ) + widgetElem = elem; + } + elem = elem.nextSibling().toElement(); + } + + { + QDataStream out2( widgetBlock, IO_WriteOnly ); + widgetNo = outputObject( buddies, objects, strings, out2, widgetElem, + "QWidget" ); + } + + if ( !tabstopsElem.isNull() ) { + QDataStream out2( tabstopsBlock, IO_WriteOnly ); + QDomElement f = tabstopsElem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "tabstop" ) { + QString widgetName = f.firstChild().toText().data(); + int no = objects.find( widgetName ); + if ( no != -1 ) + packUInt16( out2, no ); + } + f = f.nextSibling().toElement(); + } + } + + if ( !actionsElem.isNull() ) { + QDataStream out2( actionsBlock, IO_WriteOnly ); + outputObject( buddies, objects, strings, out2, actionsElem ); + } + + if ( !menubarElem.isNull() ) { + QDataStream out2( menubarBlock, IO_WriteOnly ); + outputObject( buddies, objects, strings, out2, menubarElem, + "QMenuBar" ); + } + + if ( !toolbarsElem.isNull() ) { + QDataStream out2( toolbarsBlock, IO_WriteOnly ); + QDomElement f = toolbarsElem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "toolbar" ) + outputObject( buddies, objects, strings, out2, f, "QToolBar" ); + f = f.nextSibling().toElement(); + } + } + + if ( !buddies.isEmpty() ) { + QDataStream out2( buddiesBlock, IO_WriteOnly ); + QMap::ConstIterator a = buddies.begin(); + while ( a != buddies.end() ) { + QStringList::ConstIterator b = (*a).begin(); + while ( b != (*a).end() ) { + int no = objects.find( *b ); + if ( no != -1 ) { + packUInt16( out2, a.key() ); + packUInt16( out2, no ); + } + ++b; + } + ++a; + } + } + + if ( !connectionsElem.isNull() ) { + QString prevLanguage = "C++"; + int prevSenderNo = 0; + QString prevSignal = "clicked()"; + int prevReceiverNo = 0; + QString prevSlot = "accept()"; + + QDataStream out2( connectionsBlock, IO_WriteOnly ); + QDomElement f = connectionsElem.firstChild().toElement(); + while ( !f.isNull() ) { + if ( f.tagName() == "connection" ) { + QMap argMap; + + QDomElement g = f.firstChild().toElement(); + while ( !g.isNull() ) { + argMap[g.tagName()] = g.firstChild().toText().data(); + g = g.nextSibling().toElement(); + } + + QString language = f.attribute( "language", "C++" ); + int senderNo = objects.find( argMap["sender"], widgetNo ); + int receiverNo = objects.find( argMap["receiver"], widgetNo ); + QString signal = UibHack::normalize( argMap["signal"] ); + QString slot = UibHack::normalize( argMap["slot"] ); + + Q_UINT8 connectionFlags = 0; + if ( language != prevLanguage ) + connectionFlags |= Connection_Language; + if ( senderNo != prevSenderNo ) + connectionFlags |= Connection_Sender; + if ( signal != prevSignal ) + connectionFlags |= Connection_Signal; + if ( receiverNo != prevReceiverNo ) + connectionFlags |= Connection_Receiver; + if ( slot != prevSlot ) + connectionFlags |= Connection_Slot; + out2 << connectionFlags; + + if ( connectionFlags & Connection_Language ) + packString( strings, out2, language ); + if ( connectionFlags & Connection_Sender ) + packUInt16( out2, senderNo ); + if ( connectionFlags & Connection_Signal ) + packStringSplit( strings, out2, signal, '(' ); + if ( connectionFlags & Connection_Receiver ) + packUInt16( out2, receiverNo ); + if ( connectionFlags & Connection_Slot ) + packStringSplit( strings, out2, slot, '(' ); + + prevLanguage = language; + prevSenderNo = senderNo; + prevSignal = signal; + prevReceiverNo = receiverNo; + prevSlot = slot; + } else if ( f.tagName() == "slot" ) { + // ### + } + f = f.nextSibling().toElement(); + } + } + + { + QDataStream out2( introBlock, IO_WriteOnly ); + out2 << introFlags; + out2 << defaultMargin; + out2 << defaultSpacing; + packUInt16( out2, objects.count() ); + packCString( strings, out2, className ); + } + + out << UibMagic; + out << (Q_UINT8) '\n'; + out << (Q_UINT8) '\r'; + out << (Q_UINT8) out.version(); + outputBlock( out, Block_Strings, strings.block() ); + outputBlock( out, Block_Intro, introBlock ); + outputBlock( out, Block_Images, imagesBlock ); + outputBlock( out, Block_Widget, widgetBlock ); + outputBlock( out, Block_Slots, slotsBlock ); + outputBlock( out, Block_Tabstops, tabstopsBlock ); + outputBlock( out, Block_Actions, actionsBlock ); + outputBlock( out, Block_Menubar, menubarBlock ); + outputBlock( out, Block_Toolbars, toolbarsBlock ); + outputBlock( out, Block_Variables, variablesBlock ); + outputBlock( out, Block_Functions, functionsBlock ); + outputBlock( out, Block_Buddies, buddiesBlock ); + outputBlock( out, Block_Connections, connectionsBlock ); + out << (Q_UINT8) Block_End; +} diff --git a/kdevdesigner/shared/ui2uib.h b/kdevdesigner/shared/ui2uib.h new file mode 100644 index 00000000..674fd589 --- /dev/null +++ b/kdevdesigner/shared/ui2uib.h @@ -0,0 +1,35 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef UI2UIB_H +#define UI2UIB_H + +class QDataStream; +class QDomDocument; + +void convertUiToUib( QDomDocument& doc, QDataStream& out ); + +#endif diff --git a/kdevdesigner/shared/uib.cpp b/kdevdesigner/shared/uib.cpp new file mode 100644 index 00000000..72d73b45 --- /dev/null +++ b/kdevdesigner/shared/uib.cpp @@ -0,0 +1,42 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "uib.h" + +static const char commonStrings[] = + "\0()\0(bool)\0(const QString&)\0(int)\0C++\0Layout1\0PNG\0QCheckBox\0" + "QComboBox\0QDialog\0QFrame\0QGridLayout\0QGroupBox\0QHBoxLayout\0QLabel\0" + "QLineEdit\0QListView\0QPushButton\0QRadioButton\0QVBoxLayout\0QWidget\0" + "TextLabel1\0XPM.GZ\0accept\0autoDefault\0buddy\0caption\0clicked\0" + "default\0destroy\0frameShadow\0frameShape\0geometry\0init\0margin\0" + "maximumSize\0minimumSize\0name\0reject\0sizePolicy\0spacing\0text\0title\0" + "toolTip\0unnamed\0whatsThis"; + +UibStrTable::UibStrTable() + : out( table, IO_WriteOnly ), start( sizeof(commonStrings) ) +{ + out.writeRawBytes( commonStrings, start ); +} diff --git a/kdevdesigner/shared/uib.h b/kdevdesigner/shared/uib.h new file mode 100644 index 00000000..00adac13 --- /dev/null +++ b/kdevdesigner/shared/uib.h @@ -0,0 +1,152 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef UIB_H +#define UIB_H + +#include + +const Q_UINT32 UibMagic = 0xb77c61d8; + +enum BlockTag { Block_End = '$', Block_Actions = 'A', Block_Buddies = 'B', + Block_Connections = 'C', Block_Functions = 'F', + Block_Images = 'G', Block_Intro = 'I', Block_Menubar = 'M', + Block_Slots = 'S', Block_Strings = 'Z', Block_Tabstops = 'T', + Block_Toolbars = 'O', Block_Variables = 'V', + Block_Widget = 'W' }; + +enum ObjectTag { Object_End = '$', Object_ActionRef = 'X', + Object_Attribute = 'B', Object_Column = 'C', + Object_Event = 'E', Object_FontProperty = 'F', + Object_GridCell = 'G', Object_Item = 'I', + Object_MenuItem = 'M', Object_PaletteProperty = 'P', + Object_Row = 'R', Object_Separator = 'S', Object_Spacer = 'Y', + Object_SubAction = 'A', Object_SubLayout = 'L', + Object_SubWidget = 'W', Object_TextProperty = 'T', + Object_VariantProperty = 'V' }; + +enum PaletteTag { Palette_End = '$', Palette_Active = 'A', + Palette_Inactive = 'I', Palette_Disabled = 'D', + Palette_Color = 'C', Palette_Pixmap = 'P' }; + +enum IntroFlag { Intro_Pixmapinproject = 0x1 }; + +enum FontFlag { Font_Family = 0x1, Font_PointSize = 0x2, Font_Bold = 0x4, + Font_Italic = 0x8, Font_Underline = 0x10, + Font_StrikeOut = 0x20 }; + +enum ConnectionFlag { Connection_Language = 0x1, Connection_Sender = 0x2, + Connection_Signal = 0x4, Connection_Receiver = 0x8, + Connection_Slot = 0x10 }; + +class UibStrTable +{ +public: + UibStrTable(); + + inline int insertCString( const char *cstr ); + inline int insertString( const QString& str ); + inline void readBlock( QDataStream& in, int size ); + + inline const char *asCString( int offset ) const; + inline QString asString( int offset ) const; + inline QByteArray block() const; + +private: + QCString table; + QDataStream out; + int start; +}; + +/* + uic uses insertCString(), insertString(), and block(); + QWidgetFactory uses readBlock(), asCString(), and asString(). By + implementing these functions inline, we ensure that the binaries + don't contain needless code. +*/ + +inline int UibStrTable::insertCString( const char *cstr ) +{ + if ( cstr == 0 || cstr[0] == 0 ) { + return 0; + } else { + int nextPos = table.size(); + int len = strlen( cstr ); + int i; + for ( i = 0; i < nextPos - len; i++ ) { + if ( memcmp(table.data() + i, cstr, len + 1) == 0 ) + return i; + } + for ( i = 0; i < len + 1; i++ ) + out << (Q_UINT8) cstr[i]; + return nextPos; + } +} + +inline int UibStrTable::insertString( const QString& str ) +{ + if ( str.contains('\0') || str[0] == QChar(0x7f) ) { + int nextPos = table.size(); + out << (Q_UINT8) 0x7f; + out << str; + return nextPos; + } else { + return insertCString( str.utf8() ); + } +} + +inline void UibStrTable::readBlock( QDataStream& in, int size ) +{ + table.resize( start + size ); + in.readRawBytes( table.data() + start, size ); +} + +inline QString UibStrTable::asString( int offset ) const +{ + if ( table[offset] == 0x7f ) { + QDataStream in( table, IO_ReadOnly ); + in.device()->at( offset + 1 ); + QString str; + in >> str; + return str; + } else { + return QString::fromUtf8( asCString(offset) ); + } +} + +inline const char *UibStrTable::asCString( int offset ) const +{ + return table.data() + offset; +} + +inline QByteArray UibStrTable::block() const +{ + QByteArray block; + block.duplicate( table.data() + start, table.size() - start ); + return block; +} + +#endif diff --git a/kdevdesigner/shared/widgetdatabase.cpp b/kdevdesigner/shared/widgetdatabase.cpp new file mode 100644 index 00000000..8b80b03f --- /dev/null +++ b/kdevdesigner/shared/widgetdatabase.cpp @@ -0,0 +1,960 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "widgetdatabase.h" +#include "../interfaces/widgetinterface.h" + +#include "../designer/kdevdesigner_part.h" + +#include +#include + +#include +#define NO_STATIC_COLORS +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +const int dbsize = 300; +const int dbcustom = 200; +const int dbdictsize = 211; +static WidgetDatabaseRecord* db[ dbsize ]; +static QDict *className2Id = 0; +static int dbcount = 0; +static int dbcustomcount = 200; +static QStrList *wGroups; +static QStrList *invisibleGroups; +static bool whatsThisLoaded = FALSE; +static QPluginManager *widgetPluginManager = 0; +static bool plugins_set_up = FALSE; +static bool was_in_setup = FALSE; + +QCleanupHandler > cleanup_manager; + +WidgetDatabaseRecord::WidgetDatabaseRecord() +{ + isForm = FALSE; + isContainer = FALSE; + icon = 0; + nameCounter = 0; + isCommon = FALSE; + isPlugin = FALSE; +} + +WidgetDatabaseRecord::~WidgetDatabaseRecord() +{ + delete icon; +} + + +/*! + \class WidgetDatabase widgetdatabase.h + \brief The WidgetDatabase class holds information about widgets + + The WidgetDatabase holds information about widgets like toolTip(), + iconSet(), ... It works Id-based, so all access functions take the + widget id as parameter. To get the id for a widget (classname), use + idFromClassName(). + + All access functions are static. Having multiple widgetdatabases in + one application doesn't make sense anyway and so you don't need more + than an instance of the widgetdatabase. + + For creating widgets, layouts, etc. see WidgetFactory. +*/ + +/*! + Creates widget database. Does nothing. +*/ + +WidgetDatabase::WidgetDatabase() +{ +} + +/*! Sets up the widget database. If the static widgetdatabase already + exists, the functions returns immediately. +*/ + +void WidgetDatabase::setupDataBase( int id ) +{ + was_in_setup = TRUE; +#ifndef UIC + Q_UNUSED( id ) + if ( dbcount ) + return; +#else + if ( dbcount && id != -2 ) + return; + if ( dbcount && !plugins_set_up ) { + setupPlugins(); + return; + } + if ( dbcount && plugins_set_up) + return; +#endif + + wGroups = new QStrList; + invisibleGroups = new QStrList; + invisibleGroups->append( "Forms" ); + invisibleGroups->append( "Temp" ); + className2Id = new QDict( dbdictsize ); + className2Id->setAutoDelete( TRUE ); + + WidgetDatabaseRecord *r = 0; + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_pushbutton.png"; + r->name = "QPushButton"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Push Button"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_toolbutton.png"; + r->name = "QToolButton"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Tool Button"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_radiobutton.png"; + r->name = "QRadioButton"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Radio Button"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_checkbox.png"; + r->name = "QCheckBox"; + r->group = widgetGroup( "Buttons" ); + r->toolTip = "Check Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_groupbox.png"; + r->name = "QGroupBox"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Group Box"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_buttongroup.png"; + r->name = "QButtonGroup"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Button Group"; + r->isContainer = TRUE; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_frame.png"; + r->name = "QFrame"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Frame"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QTabWidget"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Tabwidget"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_widgetstack.png"; + r->name = "QWidgetStack"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Widget Stack"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_toolbox.png"; + r->name = "QToolBox"; + r->group = widgetGroup( "Containers" ); + r->toolTip = "Tool Box"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_listbox.png"; + r->name = "QListBox"; + r->group = widgetGroup( "Views" ); + r->toolTip = "List Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_listview.png"; + r->name = "QListView"; + r->group = widgetGroup( "Views" ); + r->toolTip = "List View"; + + append( r ); + +#if !defined(QT_NO_ICONVIEW) || defined(UIC) + r = new WidgetDatabaseRecord; + r->iconSet = "designer_iconview.png"; + r->name = "QIconView"; + r->group = widgetGroup( "Views" ); + r->toolTip = "Icon View"; + + append( r ); +#endif + +#if !defined(QT_NO_TABLE) + r = new WidgetDatabaseRecord; + r->iconSet = "designer_table.png"; + r->name = "QTable"; + r->group = widgetGroup( "Views" ); + r->toolTip = "Table"; + + append( r ); +#endif + +#if !defined(QT_NO_SQL) + r = new WidgetDatabaseRecord; + r->iconSet = "designer_datatable.png"; + r->includeFile = "qdatatable.h"; + r->name = "QDataTable"; + r->group = widgetGroup( "Database" ); + r->toolTip = "Data Table"; + + append( r ); +#endif + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_lineedit.png"; + r->name = "QLineEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Line Edit"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_spinbox.png"; + r->name = "QSpinBox"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Spin Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_dateedit.png"; + r->name = "QDateEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Date Edit"; + r->includeFile = "qdatetimeedit.h"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_timeedit.png"; + r->name = "QTimeEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Time Edit"; + r->includeFile = "qdatetimeedit.h"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_datetimeedit.png"; + r->name = "QDateTimeEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Date-Time Edit"; + r->includeFile = "qdatetimeedit.h"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_multilineedit.png"; + r->name = "QMultiLineEdit"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Multi Line Edit"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_richtextedit.png"; + r->name = "QTextEdit"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Rich Text Edit"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_combobox.png"; + r->name = "QComboBox"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Combo Box"; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_slider.png"; + r->name = "QSlider"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Slider"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_scrollbar.png"; + r->name = "QScrollBar"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Scrollbar"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_dial.png"; + r->name = "QDial"; + r->group = widgetGroup( "Input" ); + r->toolTip = "Dial"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_label.png"; + r->name = "QLabel"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Label"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_label.png"; + r->name = "TextLabel"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Text Label"; + r->whatsThis = "The Text Label provides a widget to display static text."; + r->isCommon = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_pixlabel.png"; + r->name = "PixmapLabel"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Pixmap Label"; + r->whatsThis = "The Pixmap Label provides a widget to display pixmaps."; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_lcdnumber.png"; + r->name = "QLCDNumber"; + r->group = widgetGroup( "Display" ); + r->toolTip = "LCD Number"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_line.png"; + r->name = "Line"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Line"; + r->includeFile = "qframe.h"; + r->whatsThis = "The Line widget provides horizontal and vertical lines."; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_progress.png"; + r->name = "QProgressBar"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Progress Bar"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_textview.png"; + r->name = "QTextView"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Text View"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_textbrowser.png"; + r->name = "QTextBrowser"; + r->group = widgetGroup( "Display" ); + r->toolTip = "Text Browser"; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_spacer.png"; + r->name = "Spacer"; + r->group = widgetGroup( "Temp" ); + r->toolTip = "Spacer"; + r->whatsThis = "The Spacer provides horizontal and vertical spacing to be able to manipulate the behaviour of layouts."; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QWidget"; + r->isForm = TRUE; + r->group = widgetGroup( "Forms" ); + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QDialog"; + r->group = widgetGroup( "Forms" ); + r->isForm = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QWizard"; + r->group = widgetGroup( "Forms" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QDesignerWizard"; + r->group = widgetGroup( "Forms" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QLayoutWidget"; + r->group = widgetGroup( "Temp" ); + r->includeFile = ""; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->name = "QSplitter"; + r->group = widgetGroup( "Temp" ); + r->includeFile = "qsplitter.h"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QDesignerTabWidget"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QDesignerWidget"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = "designer_tabwidget.png"; + r->name = "QDesignerDialog"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QMainWindow"; + r->includeFile = "qmainwindow.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDesignerAction"; + r->includeFile = "qaction.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = FALSE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDesignerActionGroup"; + r->includeFile = "qaction.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = FALSE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QScrollView"; + r->includeFile = "qscrollview.h"; + r->group = widgetGroup( "Temp" ); + r->isContainer = TRUE; + + append( r ); + +#ifndef QT_NO_SQL + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDataBrowser"; + r->includeFile = "qdatabrowser.h"; + r->group = widgetGroup( "Database" ); + r->toolTip = "Data Browser"; + r->iconSet = "designer_databrowser.png"; + r->isContainer = TRUE; + + append( r ); + + r = new WidgetDatabaseRecord; + r->iconSet = ""; + r->name = "QDataView"; + r->includeFile = "qdataview.h"; + r->group = widgetGroup( "Database" ); + r->toolTip = "Data View"; + r->iconSet = "designer_dataview.png"; + r->isContainer = TRUE; + + append( r ); +#endif + +#ifndef UIC + setupPlugins(); +#endif +} + +void WidgetDatabase::setupPlugins() +{ + if ( plugins_set_up ) + return; + plugins_set_up = TRUE; + QStringList widgets = widgetManager()->featureList(); + for ( QStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { + if ( hasWidget( *it ) ) + continue; + WidgetDatabaseRecord *r = new WidgetDatabaseRecord; + WidgetInterface *iface = 0; + widgetManager()->queryInterface( *it, &iface ); + if ( !iface ) + continue; + +#ifndef UIC + QIconSet icon = iface->iconSet( *it ); + if ( !icon.pixmap().isNull() ) + r->icon = new QIconSet( icon ); +#endif + QString grp = iface->group( *it ); + if ( grp.isEmpty() ) + grp = "3rd party widgets"; + r->group = widgetGroup( grp ); + r->toolTip = iface->toolTip( *it ); + r->whatsThis = iface->whatsThis( *it ); + r->includeFile = iface->includeFile( *it ); + r->isContainer = iface->isContainer( *it ); + r->name = *it; + r->isPlugin = TRUE; + append( r ); + iface->release(); + } +} + +/*! + Returns the number of elements in the widget database. +*/ + +int WidgetDatabase::count() +{ + setupDataBase( -1 ); + return dbcount; +} + +/*! + Returns the id at which the ids of custom widgets start. +*/ + +int WidgetDatabase::startCustom() +{ + setupDataBase( -1 ); + return dbcustom; +} + +/*! + Returns the iconset which represents the class registered as \a id. +*/ + +QIconSet WidgetDatabase::iconSet( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QIconSet(); +#if !defined(UIC) && !defined(RESOURCE) + if ( !r->icon ) { + if ( r->iconSet.isEmpty() ) + return QIconSet(); + QPixmap pix = BarIcon( r->iconSet, KDevDesignerPartFactory::instance() ); + if ( pix.isNull() ) + pix = QPixmap( r->iconSet ); + r->icon = new QIconSet( pix ); + } + return *r->icon; +#else + return QIconSet(); +#endif +} + +/*! + Returns the classname of the widget which is registered as \a id. +*/ + +QString WidgetDatabase::className( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->name; +} + +/*! + Returns the group the widget registered as \a id belongs to. +*/ + +QString WidgetDatabase::group( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->group; +} + +/*! + Returns the tooltip text of the widget which is registered as \a id. +*/ + +QString WidgetDatabase::toolTip( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->toolTip; +} + +/*! + Returns the what's this? text of the widget which is registered as \a id. +*/ + +QString WidgetDatabase::whatsThis( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + return r->whatsThis; +} + +/*! + Returns the include file if the widget which is registered as \a id. +*/ + +QString WidgetDatabase::includeFile( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return QString::null; + if ( r->includeFile.isNull() ) + return r->name.lower() + ".h"; + return r->includeFile; +} + +/*! Returns whether the widget registered as \a id is a form. +*/ +bool WidgetDatabase::isForm( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isForm; +} + +/*! Returns whether the widget registered as \a id can have children. +*/ + +bool WidgetDatabase::isContainer( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isContainer || r->isForm; +} + +bool WidgetDatabase::isCommon( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isCommon; +} + +QString WidgetDatabase::createWidgetName( int id ) +{ + setupDataBase( id ); + QString n = className( id ); + if ( n == "QLayoutWidget" ) + n = "Layout"; + if ( n[ 0 ] == 'Q' && n[ 1 ].lower() != n[ 1 ] ) + n = n.mid( 1 ); + int colonColon = n.findRev( "::" ); + if ( colonColon != -1 ) + n = n.mid( colonColon + 2 ); + + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return n; + n += QString::number( ++r->nameCounter ); + n[0] = n[0].lower(); + return n; +} + +/*! Returns the id for \a name or -1 if \a name is unknown. + */ +int WidgetDatabase::idFromClassName( const QString &name ) +{ + setupDataBase( -1 ); + if ( name.isEmpty() ) + return 0; + int *i = className2Id->find( name ); + if ( i ) + return *i; + if ( name == "FormWindow" ) + return idFromClassName( "QLayoutWidget" ); +#ifdef UIC + setupDataBase( -2 ); + i = className2Id->find( name ); + if ( i ) + return *i; +#endif + return -1; +} + +bool WidgetDatabase::hasWidget( const QString &name ) +{ + return className2Id->find( name ) != 0; +} + +WidgetDatabaseRecord *WidgetDatabase::at( int index ) +{ + if ( index < 0 ) + return 0; + if ( index >= dbcustom && index < dbcustomcount ) + return db[ index ]; + if ( index < dbcount ) + return db[ index ]; + return 0; +} + +void WidgetDatabase::insert( int index, WidgetDatabaseRecord *r ) +{ + if ( index < 0 || index >= dbsize ) + return; + db[ index ] = r; + className2Id->insert( r->name, new int( index ) ); + if ( index < dbcustom ) + dbcount = QMAX( dbcount, index ); +} + +void WidgetDatabase::append( WidgetDatabaseRecord *r ) +{ + if ( !was_in_setup ) + setupDataBase( -1 ); + insert( dbcount++, r ); +} + +QString WidgetDatabase::widgetGroup( const QString &g ) +{ + if ( wGroups->find( g ) == -1 ) + wGroups->append( g ); + return g; +} + +bool WidgetDatabase::isGroupEmpty( const QString &grp ) +{ + WidgetDatabaseRecord *r = 0; + for ( int i = 0; i < dbcount; ++i ) { + if ( !( r = db[ i ] ) ) + continue; + if ( r->group == grp ) + return FALSE; + } + return TRUE; +} + +QString WidgetDatabase::widgetGroup( int i ) +{ + setupDataBase( -1 ); + if ( i >= 0 && i < (int)wGroups->count() ) + return wGroups->at( i ); + return QString::null; +} + +int WidgetDatabase::numWidgetGroups() +{ + setupDataBase( -1 ); + return wGroups->count(); +} + +bool WidgetDatabase::isGroupVisible( const QString &g ) +{ + setupDataBase( -1 ); + return invisibleGroups->find( g ) == -1; +} + +int WidgetDatabase::addCustomWidget( WidgetDatabaseRecord *r ) +{ + insert( dbcustomcount++, r ); + return dbcustomcount - 1; +} + +void WidgetDatabase::customWidgetClassNameChanged( const QString &oldName, + const QString &newName ) +{ + int id = idFromClassName( oldName ); + if ( id == -1 ) + return; + WidgetDatabaseRecord *r = db[ id ]; + r->name = newName; + className2Id->remove( oldName ); + className2Id->insert( newName, new int( id ) ); +} + +bool WidgetDatabase::isCustomWidget( int id ) +{ + if ( id >= dbcustom && id < dbcustomcount ) + return TRUE; + return FALSE; +} + +bool WidgetDatabase::isCustomPluginWidget( int id ) +{ + setupDataBase( id ); + WidgetDatabaseRecord *r = at( id ); + if ( !r ) + return FALSE; + return r->isPlugin; +} + +bool WidgetDatabase::isWhatsThisLoaded() +{ + return whatsThisLoaded; +} + +void WidgetDatabase::loadWhatsThis( const QString &docPath ) +{ + QString whatsthisFile = docPath + "/whatsthis"; + QFile f( whatsthisFile ); + if ( !f.open( IO_ReadOnly ) ) + return; + QTextStream ts( &f ); + while ( !ts.atEnd() ) { + QString s = ts.readLine(); + QStringList l = QStringList::split( " | ", s ); + int id = idFromClassName( l[ 1 ] ); + WidgetDatabaseRecord *r = at( id ); + if ( r ) + r->whatsThis = l[ 0 ]; + } + whatsThisLoaded = TRUE; +} + + +// ### Qt 3.1: make these publically accessible via QWidgetDatabase API +#if defined(UIC) +bool dbnounload = FALSE; +QStringList *dbpaths = 0; +#else +extern QString *qwf_plugin_dir; +#endif + + +QPluginManager *widgetManager() +{ + if ( !widgetPluginManager ) { + QString pluginDir = "/designer"; +#if !defined(UIC) + if ( qwf_plugin_dir ) + pluginDir = *qwf_plugin_dir; +#endif + widgetPluginManager = new QPluginManager( IID_Widget, QApplication::libraryPaths(), pluginDir ); + cleanup_manager.add( &widgetPluginManager ); +#if defined(UIC) + if ( dbnounload ) + widgetPluginManager->setAutoUnload( FALSE ); + if ( dbpaths ) { + QStringList::ConstIterator it = dbpaths->begin(); + for ( ; it != dbpaths->end(); ++it ) + widgetPluginManager->addLibraryPath( *it ); + } +#endif + } + return widgetPluginManager; +} diff --git a/kdevdesigner/shared/widgetdatabase.h b/kdevdesigner/shared/widgetdatabase.h new file mode 100644 index 00000000..03060fa3 --- /dev/null +++ b/kdevdesigner/shared/widgetdatabase.h @@ -0,0 +1,96 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef WIDGETDATABASE_H +#define WIDGETDATABASE_H + +#include +#include +#include "../interfaces/widgetinterface.h" // up here for GCC 2.7.* compatibility +#include + + +extern QPluginManager *widgetManager(); + +struct WidgetDatabaseRecord +{ + WidgetDatabaseRecord(); + ~WidgetDatabaseRecord(); + QString iconSet, name, group, toolTip, whatsThis, includeFile; + uint isContainer : 1; + uint isForm : 1; + uint isCommon : 1; + uint isPlugin : 1; + QIconSet *icon; + int nameCounter; +}; + +class WidgetDatabase : public Qt +{ +public: + WidgetDatabase(); + static void setupDataBase( int id ); + static void setupPlugins(); + + static int count(); + static int startCustom(); + + static QIconSet iconSet( int id ); + static QString className( int id ); + static QString group( int id ); + static QString toolTip( int id ); + static QString whatsThis( int id ); + static QString includeFile( int id ); + static bool isForm( int id ); + static bool isContainer( int id ); + static bool isCommon( int id ); + + static int idFromClassName( const QString &name ); + static QString createWidgetName( int id ); + + static WidgetDatabaseRecord *at( int index ); + static void insert( int index, WidgetDatabaseRecord *r ); + static void append( WidgetDatabaseRecord *r ); + + static QString widgetGroup( const QString &g ); + static QString widgetGroup( int i ); + static int numWidgetGroups(); + static bool isGroupVisible( const QString &g ); + static bool isGroupEmpty( const QString &grp ); + + static int addCustomWidget( WidgetDatabaseRecord *r ); + static bool isCustomWidget( int id ); + static bool isCustomPluginWidget( int id ); + + static bool isWhatsThisLoaded(); + static void loadWhatsThis( const QString &docPath ); + + static bool hasWidget( const QString &name ); + static void customWidgetClassNameChanged( const QString &oldName, const QString &newName ); + +}; + +#endif diff --git a/kdevdesigner/src/Makefile.am b/kdevdesigner/src/Makefile.am new file mode 100644 index 00000000..f6e1b854 --- /dev/null +++ b/kdevdesigner/src/Makefile.am @@ -0,0 +1,47 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = kdevdesigner.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kdevdesigner.pot + + +# this Makefile creates both a KPart application and a KPart +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = kdevdesigner + +# the application source, library search path, and link libraries +kdevdesigner_SOURCES = main.cpp kdevdesigner.cpp +kdevdesigner_LDFLAGS = $(KDE_RPATH) $(all_libraries) +kdevdesigner_LDADD = $(LIB_KPARTS) + +# this is where the desktop file will go +#shelldesktopdir = $(kde_appsdir)/Development +#shelldesktop_DATA = kdevdesigner.desktop +xdg_apps_DATA = kdevdesigner.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/kdevdesigner +shellrc_DATA = kdevdesigner_shell.rc + +######################################################################### +# KPART SECTION +######################################################################### + +# the Part's source, library search path, and link libraries + + +# this is where the desktop file will go +partdesktopdir = $(kde_servicesdir) + +# this is where the part's XML-GUI resource file goes +partrcdir = $(kde_datadir)/kdevdesignerpart diff --git a/kdevdesigner/src/kdevdesigner.cpp b/kdevdesigner/src/kdevdesigner.cpp new file mode 100644 index 00000000..4e2b0d0d --- /dev/null +++ b/kdevdesigner/src/kdevdesigner.cpp @@ -0,0 +1,216 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "kdevdesigner.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +KDevDesigner::KDevDesigner() + : KParts::MainWindow( 0L, "KDevDesigner" ) +{ + // set the shell's ui resource file + setXMLFile("kdevdesigner_shell.rc"); + + // then, setup our actions + setupActions(); + + // and a status bar + statusBar()->show(); + + // this routine will find and load our Part. it finds the Part by + // name which is a bad idea usually.. but it's alright in this + // case since our Part is made for this Shell + KLibFactory *factory = KLibLoader::self()->factory("libkdevdesignerpart"); + if (factory) + { + // now that the Part is loaded, we cast it to a Part to get + // our hands on it + QStringList args; + args.append("in shell"); + m_part = static_cast(factory->create(this, + "kdevdesigner_part", "KParts::ReadWritePart", args)); + + if (m_part) + { + // tell the KParts::MainWindow that this is indeed the main widget + setCentralWidget(m_part->widget()); + + // and integrate the part's GUI with the shell's + createGUI(m_part); + } + } + else + { + // if we couldn't find our Part, we exit since the Shell by + // itself can't do anything useful + KMessageBox::error(this, i18n("Could not find the KDevDesigner part.")); + kapp->quit(); + // we return here, cause kapp->quit() only means "exit the + // next time we enter the event loop... + return; + } + + // apply the saved mainwindow settings, if any, and ask the mainwindow + // to automatically save settings if changed: window size, toolbar + // position, icon size, etc. + setAutoSaveSettings(); +} + +KDevDesigner::~KDevDesigner() +{ +} + +void KDevDesigner::load(const KURL& url) +{ + m_part->openURL( url ); +} + +void KDevDesigner::setupActions() +{ +/* KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStdAction::open(this, SLOT(fileOpen()), actionCollection());*/ + + KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); +} + +void KDevDesigner::saveProperties(KConfig* /*config*/) +{ + // the 'config' object points to the session managed + // config file. anything you write here will be available + // later when this app is restored +} + +void KDevDesigner::readProperties(KConfig* /*config*/) +{ + // the 'config' object points to the session managed + // config file. this function is automatically called whenever + // the app is being restored. read in here whatever you wrote + // in 'saveProperties' +} + +void KDevDesigner::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // About this function, the style guide ( + // http://developer.kde.org/documentation/standards/kde/style/basics/index.html ) + // says that it should open a new window if the document is _not_ + // in its initial state. This is what we do here.. + if ( ! m_part->url().isEmpty() || m_part->isModified() ) + { + (new KDevDesigner)->show(); + }; +} + + +void KDevDesigner::optionsShowToolbar() +{ + // this is all very cut and paste code for showing/hiding the + // toolbar + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void KDevDesigner::optionsShowStatusbar() +{ + // this is all very cut and paste code for showing/hiding the + // statusbar + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void KDevDesigner::optionsConfigureKeys() +{ + KKeyDialog::configureKeys(m_part->actionCollection(), "kdevdesigner_part.rc"); +} + +void KDevDesigner::optionsConfigureToolbars() +{ + saveMainWindowSettings(KGlobal::config(), autoSaveGroup()); + + // use the standard toolbar editor + KEditToolbar dlg(factory()); + connect(&dlg, SIGNAL(newToolbarConfig()), + this, SLOT(applyNewToolbarConfig())); + dlg.exec(); +} + +void KDevDesigner::applyNewToolbarConfig() +{ + applyMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void KDevDesigner::fileOpen() +{ + // this slot is called whenever the File->Open menu is selected, + // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + // button is clicked + KURL url = + KFileDialog::getOpenURL( QString::null, QString::null, this ); + + if (url.isEmpty() == false) + { + // About this function, the style guide ( + // http://developer.kde.org/documentation/standards/kde/style/basics/index.html ) + // says that it should open a new window if the document is _not_ + // in its initial state. This is what we do here.. + if ( m_part->url().isEmpty() && ! m_part->isModified() ) + { + // we open the file in this window... + load( url ); + } + else + { + // we open the file in a new window... + KDevDesigner* newWin = new KDevDesigner; + newWin->load( url ); + newWin->show(); + } + } +} + +#include "kdevdesigner.moc" diff --git a/kdevdesigner/src/kdevdesigner.desktop b/kdevdesigner/src/kdevdesigner.desktop new file mode 100644 index 00000000..7bced6fb --- /dev/null +++ b/kdevdesigner/src/kdevdesigner.desktop @@ -0,0 +1,96 @@ +[Desktop Entry] +Name=KDevelop Designer +Name[el]=Σχεδιαστής KDevelop +Name[es]=Diseñador de KDevelop +Name[et]=KDevelopi Disainer +Name[eu]=KDevelop disenatzailea +Name[fa]=طراح KDevelop +Name[fr]=Concepteur KDevelop +Name[ga]=Dearthóir KDevelop +Name[it]=Designer di KDevelop +Name[ja]=KDevelop デザイナー +Name[ms]=Pereka KDevelop +Name[nds]=KDevelop-Maker +Name[ne]=केडीई विकास डिजाइनर +Name[pl]=Projektant KDevelop +Name[pt]=Desenhador do KDevelop +Name[pt_BR]=Designer do KDevelop +Name[sk]=KDevelop Dizajnér +Name[sl]=Snovalnik KDevelop +Name[sv]=KDevelop designer +Name[ta]=கேமேம்பாட்டு வடிவமைப்பாளர் +Name[tg]=Дизайнгари KDevelop +Name[zh_CN]=KDevelop 设计师 +Name[zh_TW]=KDevelop 設計器 +GenericName=Interface Designer +GenericName[br]=Ergrafer etrefas +GenericName[ca]=Dissenyador de interfícies +GenericName[cy]=Dylunydd Rhyngwyneb +GenericName[de]=Oberflächen-Designer +GenericName[el]=Σχεδιαστής διασυνδέσεων +GenericName[es]=Diseñador de interfaces +GenericName[et]=Liidesedisainer +GenericName[eu]=Interfazeen diseinatzailea +GenericName[fa]=طراح واسط +GenericName[fr]=Concepteur d'interfaces graphiques +GenericName[ga]=Dearthóir Comhéadain +GenericName[gl]=Deseñador de interfaces +GenericName[hu]=Felülettervező +GenericName[it]=Interfaccia del Designer +GenericName[ja]=インターフェースデザイナー +GenericName[lt]=Sąsajos redaktorius +GenericName[ms]=Pereka Antaramuka +GenericName[nds]=Böversietmaker +GenericName[ne]=इन्टरफेस डिजाइनर +GenericName[pl]=Projektowanie interfejsu +GenericName[pt]=Editor de Interfaces +GenericName[pt_BR]=Desenhador de Interface +GenericName[ru]=Дизайнер пользовательского интерфейса +GenericName[rw]=Umuhanzi w'Imigaragarire +GenericName[sk]=Interface Dizajnér +GenericName[sl]=Snovalnik vmesnikov +GenericName[sr]=Дизајнер интерфејса +GenericName[sr@Latn]=Dizajner interfejsa +GenericName[sv]=Gränssnittsdesign +GenericName[tr]=Arayüz Tasarlayıcısı +GenericName[zh_CN]=界面设计师 +GenericName[zh_TW]=介面設計器 +Exec=kdevdesigner %i -caption "%c" +Icon=kdevdesigner +Type=Application +X-DocPath=kdevdesigner/kdevdesigner.html +Comment=GUI Designer for Qt/KDE +Comment[ca]=Dissenyador de IGU per Qt/KDE +Comment[da]=Grafisk brugerfladedesigner til Qt/KDE +Comment[de]=Auf Qt-Designer basierender GUI-Designer +Comment[el]=Σχεδιαστής GUI για Qt/KDE +Comment[es]=Diseñador de interfaces para Qt/KDE +Comment[et]=Qt/KDE graafilise kasutajaliidese disainer +Comment[eu]=GUI diseinatzailea Qt/KDE-rako +Comment[fa]=طراح ونک برای Qt/KDE +Comment[fr]=Concepteur d'interfaces graphiques pour Qt / KDE +Comment[ga]=Dearthóir Comhéadan Grafach le haghaidh Qt/KDE +Comment[gl]=Deseñador GUI para Qt/KDE +Comment[hu]=Qt/KDE felülettervező +Comment[it]=Designer di GUI per Qt/KDE +Comment[ja]=Qt/KDE のための GUI デザイナー +Comment[ms]=Pereka GUI untuk Qt/KDE +Comment[nds]=Böversietmaker för Qt/KDE +Comment[ne]=Qt/KDE का लागि जी यू आई डिजाइनर +Comment[nl]=GUI Designer voor Qt/KDE +Comment[pl]=Projektant graficznego interfejsu użytkownika dla Qt/KDE +Comment[pt]=Editor de Interfaces para Qt/KDE +Comment[pt_BR]=Designer de GUI para o Qt/KDE +Comment[ru]=Среда создания графических форм Qt/KDE +Comment[sk]=GUI Dizajnér pre Qt/KDE +Comment[sl]=Snovalnik grafičnega vmesnika za Qt/KDE +Comment[sr]=Дизајнер GUI-ја за Qt/KDE +Comment[sr@Latn]=Dizajner GUI-ja za Qt/KDE +Comment[sv]=Grafisk gränssnittsdesign för Qt och KDE +Comment[ta]=Qtக்கான GUI வடிவமைப்பாளர் +Comment[tg]=Муҳит барои сохтани Qt/KDE ба шакли графикӣ +Comment[tr]=Qt/KDE için Arayüz Tasarlayıcısı +Comment[zh_CN]=Qt/KDE 的 GUI 设计师 +Comment[zh_TW]=Qt/KDE 的使用者介面設計器 +Terminal=false +Categories=Qt;KDE;Development;GUIDesigner;X-KDE-KDevelopIDE; diff --git a/kdevdesigner/src/kdevdesigner.h b/kdevdesigner/src/kdevdesigner.h new file mode 100644 index 00000000..52a5a259 --- /dev/null +++ b/kdevdesigner/src/kdevdesigner.h @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _KDEVDESIGNER_H_ +#define _KDEVDESIGNER_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +class KToggleAction; + +/** + * This is the application "Shell". It has a menubar, toolbar, and + * statusbar but relies on the "Part" to do all the real work. + * + * @short Application Shell + * @author Alexander Dymo + * @version 0.1 + */ +class KDevDesigner : public KParts::MainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + KDevDesigner(); + + /** + * Default Destructor + */ + virtual ~KDevDesigner(); + + /** + * Use this method to load whatever file/URL you have + */ + void load(const KURL& url); + +protected: + /** + * This method is called when it is time for the app to save its + * properties for session management purposes. + */ + void saveProperties(KConfig *); + + /** + * This method is called when this app is restored. The KConfig + * object points to the session management config file that was saved + * with @ref saveProperties + */ + void readProperties(KConfig *); + +private slots: + void fileNew(); + void fileOpen(); + void optionsShowToolbar(); + void optionsShowStatusbar(); + void optionsConfigureKeys(); + void optionsConfigureToolbars(); + + void applyNewToolbarConfig(); + +private: + void setupAccel(); + void setupActions(); + +private: + KParts::ReadWritePart *m_part; + + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; +}; + +#endif // _KDEVDESIGNER_H_ diff --git a/kdevdesigner/src/kdevdesigner_shell.rc b/kdevdesigner/src/kdevdesigner_shell.rc new file mode 100644 index 00000000..1bb33a25 --- /dev/null +++ b/kdevdesigner/src/kdevdesigner_shell.rc @@ -0,0 +1,37 @@ + + + + &File + + + + + &Edit + + + &Project + + + &Tools + + + &Layout + + + &Window + + + + &Settings + + + + + + + + + + + + diff --git a/kdevdesigner/src/main.cpp b/kdevdesigner/src/main.cpp new file mode 100644 index 00000000..cf432f9d --- /dev/null +++ b/kdevdesigner/src/main.cpp @@ -0,0 +1,94 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include + +#include +#include "kdevdesigner.h" +#include +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("KDE GUI Designer"); + +static const char version[] = "0.2"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("kdevdesigner", I18N_NOOP("KDevDesigner"), version, description, + KAboutData::License_GPL, "KDevDesigner Copyright: (C) 2004-2005 Alexander Dymo\nQt Designer Copyright: (C) 2000-2005 Trolltech AS All Rights Reserved", 0, 0); + about.addAuthor( "Trolltech AS", "Qt Designer code (Free Edition)" ); + about.addAuthor( "Alexander Dymo", "Port to KDE, partification", "adymo@kdevelop.org" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(KDevDesigner); + } + else + { + // no session.. just start up normally + QSplashScreen * splash = 0; + QString splashFile = locate("data", "kdevelop/pics/kdevdesigner-splash.png"); + if (!splashFile.isNull()) + { + QPixmap pm; + pm.load(splashFile); + splash = new QSplashScreen( pm ); + splash->show(); + } + + app.processEvents(); + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + if ( args->count() == 0 ) + { + KDevDesigner *widget = new KDevDesigner; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++ ) + { + KDevDesigner *widget = new KDevDesigner; + widget->show(); + widget->load( args->url( i ) ); + } + } + args->clear(); + if (splash) + delete splash; + } + + return app.exec(); +} diff --git a/kdevdesigner/uilib/Makefile.am b/kdevdesigner/uilib/Makefile.am new file mode 100644 index 00000000..0480cd50 --- /dev/null +++ b/kdevdesigner/uilib/Makefile.am @@ -0,0 +1,9 @@ +KDE_CXXFLAGS=-UQT_NO_ASCII_CAST + +INCLUDES = -I$(top_srcdir)/kdevdesigner/shared $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libkdevqui.la +libkdevqui_la_SOURCES = database.cpp qwidgetfactory.cpp + +libkdevqui_la_LDFLAGS = $(all_libraries) diff --git a/kdevdesigner/uilib/database.cpp b/kdevdesigner/uilib/database.cpp new file mode 100644 index 00000000..a92a04c8 --- /dev/null +++ b/kdevdesigner/uilib/database.cpp @@ -0,0 +1,122 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#if defined(DESIGNER) +#include "database.h" +#else +#include "database2.h" +#endif + +#ifndef QT_NO_SQL + +#if defined(DESIGNER) +#include "formwindow.h" +#include "mainwindow.h" +#endif + +#include +#include +#include +#include + +DatabaseSupport::DatabaseSupport() +{ + con = 0; + frm = 0; + parent = 0; +} + +void DatabaseSupport::initPreview( const QString &connection, const QString &table, QObject *o, + const QMap &databaseControls ) +{ + tbl = table; + dbControls = databaseControls; + parent = o; + + if ( connection != "(default)" ) + con = QSqlDatabase::database( connection ); + else + con = QSqlDatabase::database(); + frm = new QSqlForm( o, table ); + for ( QMap::Iterator it = dbControls.begin(); it != dbControls.end(); ++it ) { + QObject *chld = parent->child( it.key(), "QWidget" ); + if ( !chld ) + continue; + frm->insert( (QWidget*)chld, *it ); + } +} + +QDesignerDataBrowser::QDesignerDataBrowser( QWidget *parent, const char *name ) + : QDataBrowser( parent, name ) +{ +} + +bool QDesignerDataBrowser::event( QEvent* e ) +{ + bool b = QDataBrowser::event( e ); +#if defined(DESIGNER) + if ( MainWindow::self->isPreviewing() ) { +#endif + if ( e->type() == QEvent::Show ) { + if ( con ) { + QSqlCursor* cursor = new QSqlCursor( tbl, TRUE, con ); + setSqlCursor( cursor, TRUE ); + setForm( frm ); + refresh(); + first(); + } + return TRUE; + } +#if defined(DESIGNER) + } +#endif + return b; +} + +QDesignerDataView::QDesignerDataView( QWidget *parent, const char *name ) + : QDataView( parent, name ) +{ +} + +bool QDesignerDataView::event( QEvent* e ) +{ + bool b = QDataView::event( e ); +#if defined(DESIGNER) + if ( MainWindow::self->isPreviewing() ) { +#endif + if ( e->type() == QEvent::Show ) { + setForm( frm ); + readFields(); + return TRUE; + } +#if defined(DESIGNER) + } +#endif + return b; +} + + +#endif diff --git a/kdevdesigner/uilib/database2.h b/kdevdesigner/uilib/database2.h new file mode 100644 index 00000000..05a04712 --- /dev/null +++ b/kdevdesigner/uilib/database2.h @@ -0,0 +1,88 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef DATABASE2_H +#define DATABASE2_H + +#include "qfeatures.h" + +#ifndef QT_NO_SQL +#include +#include +#include +#include + +class QSqlDatabase; +class QSqlForm; + +class DatabaseSupport2 +{ +public: + DatabaseSupport2(); + virtual ~DatabaseSupport2() {} + + void initPreview( const QString &connection, const QString &table, QObject *o, + const QMap &databaseControls ); + +protected: + QSqlDatabase* con; + QSqlForm* frm; + QString tbl; + QMap dbControls; + QObject *parent; + +}; + +class QDesignerDataBrowser2 : public QDataBrowser, public DatabaseSupport2 +{ + Q_OBJECT + +public: + QDesignerDataBrowser2( QWidget *parent, const char *name ); + +protected: + bool event( QEvent* e ); +}; + +class QDesignerDataView2 : public QDataView, public DatabaseSupport2 +{ + Q_OBJECT + +public: + QDesignerDataView2( QWidget *parent, const char *name ); + +protected: + bool event( QEvent* e ); + +}; + +#define DatabaseSupport DatabaseSupport2 +#define QDesignerDataBrowser QDesignerDataBrowser2 +#define QDesignerDataView QDesignerDataView2 + +#endif + +#endif diff --git a/kdevdesigner/uilib/qwidgetfactory.cpp b/kdevdesigner/uilib/qwidgetfactory.cpp new file mode 100644 index 00000000..43c7c11e --- /dev/null +++ b/kdevdesigner/uilib/qwidgetfactory.cpp @@ -0,0 +1,2606 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "qwidgetfactory.h" + +#include "../interfaces/languageinterface.h" +#include "../interfaces/widgetinterface.h" + +#include +#include "database2.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef QT_NO_SQL +#include +#include +#include +#endif + +// include all Qt widgets we support +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_TABLE +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class QWidgetFactoryPrivate +{ +public: + QCString translationContext; + QListViewItem *lastItem; + QDict customWidgets; +}; + +static QPtrList widgetFactories; +static QPluginManager *languageInterfaceManager = 0; +static QPluginManager *widgetInterfaceManager = 0; + +static QMap *availableWidgetMap = 0; +static QStringList *availableWidgetList = 0; + +QMap *qwf_forms = 0; +QString *qwf_language = 0; +bool qwf_execute_code = TRUE; +bool qwf_stays_on_top = FALSE; +QString qwf_currFileName = ""; +QObject *qwf_form_object = 0; +QString *qwf_plugin_dir = 0; + +static void setupPluginDir() +{ + if ( !qwf_plugin_dir ) + qwf_plugin_dir = new QString( "/designer" ); +} + +static void setupWidgetListAndMap() +{ + if ( availableWidgetMap ) + return; + setupPluginDir(); + availableWidgetList = new QStringList; + (*availableWidgetList) << "QPushButton" << "QToolButton" << "QCheckBox" << "QRadioButton" + << "QGroupBox" << "QButtonGroup" << "QIconView" << "QTable" + << "QListBox" << "QListView" << "QLineEdit" << "QSpinBox" + << "QMultiLineEdit" << "QLabel" << "TextLabel" << "PixmapLabel" + << "QLayoutWidget" << "QTabWidget" << "QComboBox" + << "QWidget" << "QDialog" << "QWizard" << "QLCDNumber"; + // put less stress on the compiler by limiting the template nesting depth + (*availableWidgetList) << "QProgressBar" << "QTextView" << "QTextBrowser" + << "QDial" << "QSlider" << "QFrame" << "Line" << "QTextEdit" + << "QDateEdit" << "QTimeEdit" << "QDateTimeEdit" << "QScrollBar" + << "QPopupMenu" << "QWidgetStack" << "QMainWindow" + << "QDataTable" << "QDataBrowser" << "QDataView" + << "QVBox" << "QHBox" << "QGrid" << "QToolBox"; + + if ( !widgetInterfaceManager ) + widgetInterfaceManager = + new QPluginManager( IID_Widget, QApplication::libraryPaths(), *qwf_plugin_dir ); + + QStringList l = widgetInterfaceManager->featureList(); + QStringList::Iterator it; + for ( it = l.begin(); it != l.end(); ++it ) + (*availableWidgetList) << *it; + + availableWidgetMap = new QMap; + for ( it = availableWidgetList->begin(); it != availableWidgetList->end(); ++it ) + availableWidgetMap->insert( *it, TRUE ); +} + +static QImage loadImageData( const QString& format, ulong len, QByteArray data ) +{ + QImage img; + if ( format == "XPM.GZ" || format == "XBM.GZ" ) { + if ( len < data.size() * 10 ) + len = data.size() * 10; + // qUncompress() expects the first 4 bytes to be the expected length of + // the uncompressed data + QByteArray dataTmp( data.size() + 4 ); + memcpy( dataTmp.data()+4, data.data(), data.size() ); + dataTmp[0] = ( len & 0xff000000 ) >> 24; + dataTmp[1] = ( len & 0x00ff0000 ) >> 16; + dataTmp[2] = ( len & 0x0000ff00 ) >> 8; + dataTmp[3] = ( len & 0x000000ff ); + QByteArray baunzip = qUncompress( dataTmp ); + len = baunzip.size(); + img.loadFromData( (const uchar*)baunzip.data(), len, format.left(format.find('.')) ); + } else { + img.loadFromData( (const uchar*)data.data(), data.size(), format ); + } + return img; +} + +static QSizePolicy::SizeType stringToSizeType( const QString& str ) +{ + if ( str == "Fixed" ) { + return QSizePolicy::Fixed; + } else if ( str == "Minimum" ) { + return QSizePolicy::Minimum; + } else if ( str == "Maximum" ) { + return QSizePolicy::Maximum; + } else if ( str == "Preferred" ) { + return QSizePolicy::Preferred; + } else if ( str == "MinimumExpanding" ) { + return QSizePolicy::MinimumExpanding; + } else if ( str == "Expanding" ) { + return QSizePolicy::Expanding; + } else { + return QSizePolicy::Ignored; + } +} + + +/*! + \class QWidgetFactory + + \brief The QWidgetFactory class provides for the dynamic creation of widgets + from Qt Designer .ui files. + + This class basically offers two things: + + \list + + \i Dynamically creating widgets from \link designer-manual.book Qt + Designer\endlink user interface description files. + You can do this using the static function QWidgetFactory::create(). + This function also performs signal and slot connections, tab + ordering, etc., as defined in the .ui file, and returns the + top-level widget in the .ui file. After creating the widget you can + use QObject::child() and QObject::queryList() to access child + widgets of this returned widget. + + \i Adding additional widget factories to be able to create custom + widgets. See createWidget() for details. + + \endlist + + This class is not included in the Qt library itself. To use it you + must link against \c libqui.so (Unix) or \c qui.lib (Windows), which is + built into \c INSTALL/lib if you built \e{Qt Designer} (\c INSTALL is + the directory where Qt is installed ). + + See the "Creating Dynamic Dialogs from .ui Files" section of the \link + designer-manual.book Qt Designer manual\endlink for an example. See + also the \l{QWidgetPlugin} class and the \link plugins-howto.html + Plugins documentation\endlink. +*/ + +/*! Constructs a QWidgetFactory. */ + +QWidgetFactory::QWidgetFactory() + : d( new QWidgetFactoryPrivate() ), dbControls( 0 ), + usePixmapCollection( FALSE ), defMargin( 11 ), defSpacing( 6 ) +{ + widgetFactories.setAutoDelete( TRUE ); + d->customWidgets.setAutoDelete( TRUE ); +} + +/*! \fn QWidgetFactory::~QWidgetFactory() + Destructor. +*/ +QWidgetFactory::~QWidgetFactory() +{ + delete d; +} + +/*! + + Loads the \e{Qt Designer} user interface description file \a uiFile + and returns the top-level widget in that description. \a parent and + \a name are passed to the constructor of the top-level widget. + + This function also performs signal and slot connections, tab + ordering, etc., as described in the .ui file. In \e{Qt Designer} it + is possible to add custom slots to a form and connect to them. If + you want these connections to be made, you must create a class + derived from QObject, which implements all these slots. Then pass an + instance of the object as \a connector to this function. If you do + this, the connections to the custom slots will be done using the \a + connector as slot. + + If something fails, 0 is returned. + + The ownership of the returned widget is passed to the caller. +*/ + +QWidget *QWidgetFactory::create( const QString &uiFile, QObject *connector, + QWidget *parent, const char *name ) +{ + setupPluginDir(); + QFile f( uiFile ); + bool failed = FALSE; + if ( !f.open( IO_ReadOnly ) ) + failed = TRUE; + if ( failed && qApp->type() == QApplication::Tty ) { + // for QSA: If we have no GUI, we have no form definition + // files, but just the code. So try if only the code exists. + f.setName( uiFile + ".qs" ); + failed = !f.open( IO_ReadOnly ); + } + if ( failed ) + return 0; + + qwf_currFileName = uiFile; + QWidget *w = QWidgetFactory::create( &f, connector, parent, name ); + if ( !qwf_forms ) + qwf_forms = new QMap; + qwf_forms->insert( w, uiFile ); + return w; +} + +#undef slots + +/*! \overload + Loads the user interface description from device \a dev. + */ + +QWidget *QWidgetFactory::create( QIODevice *dev, QObject *connector, QWidget *parent, const char *name ) +{ + setupPluginDir(); + QWidget *w = 0; + QDomDocument doc; + QString errMsg; + int errLine; + + QWidgetFactory *widgetFactory = new QWidgetFactory; + widgetFactory->toplevel = 0; + + // If we have no GUI, we only want to load the code + if ( qApp->type() != QApplication::Tty ) { + QIODevice::Offset start = dev->at(); + Q_UINT32 magic; + QDataStream in( dev ); + in >> magic; + if ( magic == UibMagic ) { + w = widgetFactory->createFromUibFile( in, connector, parent, name ); + } else { + in.unsetDevice(); + dev->at( start ); + if ( doc.setContent( dev, &errMsg, &errLine ) ) { + w = widgetFactory->createFromUiFile( doc, connector, parent, name ); + } else { + // qDebug( QString("Parse error: ") + errMsg + QString(" in line %d"), errLine ); + } + } + if ( !w ) { + delete widgetFactory; + return 0; + } + } + + if ( !languageInterfaceManager ) + languageInterfaceManager = + new QPluginManager( IID_Language, QApplication::libraryPaths(), *qwf_plugin_dir ); + widgetFactory->loadExtraSource(); + + if ( widgetFactory->toplevel ) { +#ifndef QT_NO_SQL + QMap::Iterator cit = widgetFactory->sqlWidgetConnections.begin(); + for( ; cit != widgetFactory->sqlWidgetConnections.end(); ++cit ) { + if ( widgetFactory->noDatabaseWidgets.find( cit.key()->name() ) != + widgetFactory->noDatabaseWidgets.end() ) + continue; + if ( cit.key()->inherits( "QDesignerDataBrowser2" ) ) + ( (QDesignerDataBrowser2*)cit.key() )->initPreview( (*cit).conn, (*cit).table, + cit.key(), *(*cit).dbControls ); + else if ( cit.key()->inherits( "QDesignerDataView2" ) ) + ( (QDesignerDataView2*)cit.key() )->initPreview( (*cit).conn, (*cit).table, + cit.key(), *(*cit).dbControls ); + } + + for ( QMap::Iterator it = widgetFactory->dbTables.begin(); + it != widgetFactory->dbTables.end(); ++it ) { + QDataTable *table = (QDataTable*)widgetFactory->toplevel->child( it.key(), "QDataTable" ); + if ( !table ) + continue; + if ( widgetFactory->noDatabaseWidgets.find( table->name() ) != + widgetFactory->noDatabaseWidgets.end() ) + continue; + QValueList fieldMap = *widgetFactory->fieldMaps.find( table ); + QString conn = (*it)[ 0 ]; + QSqlCursor* c = 0; + QSqlDatabase *db = 0; + if ( conn.isEmpty() || conn == "(default)" ) { + db = QSqlDatabase::database(); + c = new QSqlCursor( (*it)[ 1 ] ); + } else { + db = QSqlDatabase::database( conn ); + c = new QSqlCursor( (*it)[ 1 ], TRUE, db ); + } + if ( db ) { + table->setSqlCursor( c, fieldMap.isEmpty(), TRUE ); + table->refresh( QDataTable::RefreshAll ); + } + } +#endif + } + + for ( QMap::Iterator it = widgetFactory->buddies.begin(); + it != widgetFactory->buddies.end(); ++it ) { + QLabel *label = (QLabel*)widgetFactory->toplevel->child( it.key(), "QLabel" ); + QWidget *buddy = (QWidget*)widgetFactory->toplevel->child( *it, "QWidget" ); + if ( label && buddy ) + label->setBuddy( buddy ); + } + + delete widgetFactory; + + QApplication::sendPostedEvents(); + + return w; +} + +QWidget *QWidgetFactory::createFromUiFile( QDomDocument doc, QObject *connector, + QWidget *parent, const char *name ) +{ + DomTool::fixDocument( doc ); + + uiFileVersion = doc.firstChild().toElement().attribute("version"); + QDomElement e = doc.firstChild().toElement().firstChild().toElement(); + + QDomElement variables = e; + while ( variables.tagName() != "variables" && !variables.isNull() ) + variables = variables.nextSibling().toElement(); + + QDomElement slots = e; + while ( slots.tagName() != "slots" && !slots.isNull() ) + slots = slots.nextSibling().toElement(); + + QDomElement connections = e; + while ( connections.tagName() != "connections" && !connections.isNull() ) + connections = connections.nextSibling().toElement(); + + QDomElement imageCollection = e; + while ( imageCollection.tagName() != "images" && !imageCollection.isNull() ) + imageCollection = imageCollection.nextSibling().toElement(); + + QDomElement tabOrder = e; + while ( tabOrder.tagName() != "tabstops" && !tabOrder.isNull() ) + tabOrder = tabOrder.nextSibling().toElement(); + + QDomElement actions = e; + while ( actions.tagName() != "actions" && !actions.isNull() ) + actions = actions.nextSibling().toElement(); + + QDomElement toolbars = e; + while ( toolbars.tagName() != "toolbars" && !toolbars.isNull() ) + toolbars = toolbars.nextSibling().toElement(); + + QDomElement menubar = e; + while ( menubar.tagName() != "menubar" && !menubar.isNull() ) + menubar = menubar.nextSibling().toElement(); + + QDomElement functions = e; + while ( functions.tagName() != "functions" && !functions.isNull() ) + functions = functions.nextSibling().toElement(); + + QDomElement widget; + while ( !e.isNull() ) { + if ( e.tagName() == "class" ) { + d->translationContext = e.firstChild().toText().data(); + } else if ( e.tagName() == "widget" ) { + widget = e; + } else if ( e.tagName() == "pixmapinproject" ) { + usePixmapCollection = TRUE; + } else if ( e.tagName() == "layoutdefaults" ) { + defSpacing = e.attribute( "spacing", QString::number( defSpacing ) ).toInt(); + defMargin = e.attribute( "margin", QString::number( defMargin ) ).toInt(); + } + e = e.nextSibling().toElement(); + } + + if ( !imageCollection.isNull() ) + loadImageCollection( imageCollection ); + + createWidgetInternal( widget, parent, 0, widget.attribute("class", "QWidget") ); + QWidget *w = toplevel; + if ( !w ) + return 0; + + if ( !actions.isNull() ) + loadActions( actions ); + if ( !toolbars.isNull() ) + loadToolBars( toolbars ); + if ( !menubar.isNull() ) + loadMenuBar( menubar ); + + if ( !connections.isNull() ) + loadConnections( connections, connector ); + if ( w && name && qstrlen( name ) > 0 ) + w->setName( name ); + + if ( !tabOrder.isNull() ) + loadTabOrder( tabOrder ); + +#if 0 + if ( !functions.isNull() ) // compatibiliy with early 3.0 betas + loadFunctions( functions ); +#endif + + return w; +} + +void QWidgetFactory::unpackUInt16( QDataStream& in, Q_UINT16& n ) +{ + Q_UINT8 half; + in >> half; + if ( half == 255 ) { + in >> n; + } else { + n = half; + } +} + +void QWidgetFactory::unpackUInt32( QDataStream& in, Q_UINT32& n ) +{ + Q_UINT16 half; + in >> half; + if ( half == 65535 ) { + in >> n; + } else { + n = half; + } +} + +void QWidgetFactory::unpackByteArray( QDataStream& in, QByteArray& array ) +{ + Q_UINT32 size; + unpackUInt32( in, size ); + array.resize( size ); + in.readRawBytes( array.data(), size ); +} + +void QWidgetFactory::unpackCString( const UibStrTable& strings, QDataStream& in, + QCString& cstr ) +{ + Q_UINT32 n; + unpackUInt32( in, n ); + cstr = strings.asCString( n ); +} + +void QWidgetFactory::unpackString( const UibStrTable& strings, QDataStream& in, + QString& str ) +{ + Q_UINT32 n; + unpackUInt32( in, n ); + str = strings.asString( n ); +} + +void QWidgetFactory::unpackStringSplit( const UibStrTable& strings, + QDataStream& in, QString& str ) +{ + QString remainder; + unpackString( strings, in, str ); + unpackString( strings, in, remainder ); + str += remainder; +} + +void QWidgetFactory::unpackVariant( const UibStrTable& strings, QDataStream& in, + QVariant& value ) +{ + QString imageName; + Q_UINT32 number; + Q_UINT16 count; + Q_UINT16 x; + Q_UINT16 y; + Q_UINT16 width; + Q_UINT16 height; + Q_UINT8 bit; + Q_UINT8 type; + + in >> type; + + switch ( type ) { + case QVariant::String: + unpackString( strings, in, value.asString() ); + break; + case QVariant::Pixmap: + unpackString( strings, in, imageName ); + if ( imageName.isEmpty() ) { + value.asPixmap() = QPixmap(); + } else { + value.asPixmap() = loadPixmap( imageName ); + } + break; + case QVariant::Image: + unpackString( strings, in, imageName ); + if ( imageName.isEmpty() ) { + value.asImage() = QImage(); + } else { + value.asImage() = loadFromCollection( imageName ); + } + break; + case QVariant::IconSet: + unpackString( strings, in, imageName ); + if ( imageName.isEmpty() ) { + value.asIconSet() = QIconSet(); + } else { + value.asIconSet() = QIconSet( loadPixmap(imageName) ); + } + break; + case QVariant::StringList: + unpackUInt16( in, count ); + while ( count-- ) { + QString str; + unpackString( strings, in, str ); + value.asStringList().append( str ); + } + break; + case QVariant::Rect: + unpackUInt16( in, x ); + unpackUInt16( in, y ); + unpackUInt16( in, width ); + unpackUInt16( in, height ); + value = QRect( x, y, width, height ); + break; + case QVariant::Size: + unpackUInt16( in, width ); + unpackUInt16( in, height ); + value = QSize( width, height ); + break; + case QVariant::Color: + in >> value.asColor(); + break; + case QVariant::Point: + unpackUInt16( in, x ); + unpackUInt16( in, y ); + value = QPoint( x, y ); + break; + case QVariant::Int: + unpackUInt32( in, number ); + value = (int) number; + break; + case QVariant::Bool: + in >> bit; + value = QVariant( bit != 0, 0 ); + break; + case QVariant::Double: + in >> value.asDouble(); + break; + case QVariant::CString: + unpackCString( strings, in, value.asCString() ); + break; + case QVariant::Cursor: + in >> value.asCursor(); + break; + case QVariant::Date: + in >> value.asDate(); + break; + case QVariant::Time: + in >> value.asTime(); + break; + case QVariant::DateTime: + in >> value.asDateTime(); + break; + default: + in >> value; + } +} + +void QWidgetFactory::inputSpacer( const UibStrTable& strings, QDataStream& in, + QLayout *parent ) +{ + QCString name; + QVariant value; + QCString comment; + QSizePolicy::SizeType sizeType = QSizePolicy::Preferred; + bool vertical = FALSE; + int w = 0; + int h = 0; + Q_UINT16 column = 0; + Q_UINT16 row = 0; + Q_UINT16 colspan = 1; + Q_UINT16 rowspan = 1; + Q_UINT8 objectTag; + + in >> objectTag; + while ( !in.atEnd() && objectTag != Object_End ) { + switch ( objectTag ) { + case Object_GridCell: + unpackUInt16( in, column ); + unpackUInt16( in, row ); + unpackUInt16( in, colspan ); + unpackUInt16( in, rowspan ); + break; + case Object_VariantProperty: + unpackCString( strings, in, name ); + unpackVariant( strings, in, value ); + + if ( name == "orientation" ) { + vertical = ( value == "Vertical" ); + } else if ( name == "sizeHint" ) { + w = value.toSize().width(); + h = value.toSize().height(); + } else if ( name == "sizeType" ) { + sizeType = stringToSizeType( value.toString() ); + } + break; + default: + qFatal( "Corrupt" ); + } + in >> objectTag; + } + + if ( parent != 0 ) { + QSpacerItem *spacer; + if ( vertical ) { + spacer = new QSpacerItem( w, h, QSizePolicy::Minimum, sizeType ); + } else { + spacer = new QSpacerItem( w, h, sizeType, QSizePolicy::Minimum ); + } + + if ( parent->inherits("QGridLayout") ) { + ((QGridLayout *) parent)->addMultiCell( spacer, row, + row + rowspan - 1, column, column + colspan - 1, + vertical ? Qt::AlignHCenter : Qt::AlignVCenter ); + } else { + parent->addItem( spacer ); + } + } +} + +void QWidgetFactory::inputColumnOrRow( const UibStrTable& strings, + QDataStream& in, QObject *parent, + bool isRow ) +{ + QString text; + QPixmap pixmap; + QString field; + bool clickable = TRUE; + bool resizable = TRUE; + + QCString name; + QVariant value; + QCString comment; + QString str; + Q_UINT8 objectTag; + + in >> objectTag; + while ( !in.atEnd() && objectTag != Object_End ) { + switch ( objectTag ) { + case Object_TextProperty: + unpackCString( strings, in, name ); + unpackCString( strings, in, value.asCString() ); + unpackCString( strings, in, comment ); + str = translate( value.asCString().data(), comment.data() ); + + if ( name == "field" ) { + field = str; + } else if ( name == "text" ) { + text = str; + } + break; + case Object_VariantProperty: + unpackCString( strings, in, name ); + unpackVariant( strings, in, value ); + + if ( name == "clickable" ) { + clickable = value.toBool(); + } else if ( name == "pixmap" ) { + pixmap = value.asPixmap(); + } else if ( name == "resizable" ) { + resizable = value.toBool(); + } + break; + default: + qFatal( "Corrupt" ); + } + in >> objectTag; + } + + if ( parent != 0 ) { + if ( parent->inherits("QListView") ) { + createListViewColumn( (QListView *) parent, text, pixmap, clickable, + resizable ); +#ifndef QT_NO_TABLE + } else if ( parent->inherits("QTable") ) { + createTableColumnOrRow( (QTable *) parent, text, pixmap, field, + isRow ); +#endif + } + } +} + +void QWidgetFactory::inputItem( const UibStrTable& strings, QDataStream& in, + QObject *parent, QListViewItem *parentItem ) +{ + QStringList texts; + QValueList pixmaps; + QCString name; + QVariant value; + QCString comment; + Q_UINT8 objectTag; + + QListView *listView = 0; + if ( parent != 0 && parent->inherits("QListView") ) + parent = (QListView *) parent; + QListViewItem *item = 0; + if ( listView != 0 ) { + if ( parentItem == 0 ) { + item = new QListViewItem( listView, d->lastItem ); + } else { + item = new QListViewItem( parentItem, d->lastItem ); + } + d->lastItem = item; + } + + in >> objectTag; + while ( !in.atEnd() && objectTag != Object_End ) { + switch ( objectTag ) { + case Object_Item: + if ( listView != 0 ) + d->lastItem->setOpen( TRUE ); + inputItem( strings, in, parent, item ); + break; + case Object_TextProperty: + unpackCString( strings, in, name ); + unpackCString( strings, in, value.asCString() ); + unpackCString( strings, in, comment ); + + if ( name == "text" ) + texts << translate( value.asCString().data(), comment.data() ); + break; + case Object_VariantProperty: + unpackCString( strings, in, name ); + unpackVariant( strings, in, value ); + + if ( name == "pixmap" ) + pixmaps << value.asPixmap(); + break; + default: + qFatal( "Corrupt" ); + } + in >> objectTag; + } + + if ( listView != 0 ) { + int i = 0; + QStringList::ConstIterator t = texts.begin(); + while ( t != texts.end() ) { + item->setText( i, *t ); + ++i; + ++t; + } + + int j = 0; + QValueList::ConstIterator p = pixmaps.begin(); + while ( p != pixmaps.end() ) { + item->setPixmap( j, *p ); + ++j; + ++p; + } + } else { + QString text = texts.last(); + QPixmap pixmap = pixmaps.last(); + + if ( parent != 0 ) { + if ( parent->inherits("QComboBox") || + parent->inherits("QListBox") ) { + QListBox *listBox = (QListBox *) parent->qt_cast( "QListBox" ); + if ( listBox == 0 ) + listBox = ((QComboBox *) parent)->listBox(); + + if ( pixmap.isNull() ) { + (void) new QListBoxText( listBox, text ); + } else { + (void) new QListBoxPixmap( listBox, pixmap, text ); + } + #ifndef QT_NO_ICONVIEW + } else if ( parent->inherits("QIconView") ) { + (void) new QIconViewItem( (QIconView *) parent, text, pixmap ); + #endif + } + } + } +} + +void QWidgetFactory::inputMenuItem( QObject **objects, + const UibStrTable& strings, QDataStream& in, + QMenuBar *menuBar ) +{ + QCString name; + QCString text; + Q_UINT16 actionNo; + Q_UINT8 objectTag; + + unpackCString( strings, in, name ); + unpackCString( strings, in, text ); + + QPopupMenu *popupMenu = new QPopupMenu( menuBar->parentWidget(), name ); + + in >> objectTag; + while ( !in.atEnd() && objectTag != Object_End ) { + switch ( objectTag ) { + case Object_ActionRef: + unpackUInt16( in, actionNo ); + ((QAction *) objects[actionNo])->addTo( popupMenu ); + break; + case Object_Separator: + popupMenu->insertSeparator(); + break; + default: + qFatal( "Corrupt" ); + } + in >> objectTag; + } + menuBar->insertItem( translate(text.data()), popupMenu ); +} + +QObject *QWidgetFactory::inputObject( QObject **objects, int& numObjects, + const UibStrTable& strings, + QDataStream& in, QWidget *ancestorWidget, + QObject *parent, QCString className ) +{ + QObject *obj = 0; + QWidget *widget = 0; + QLayout *layout = 0; + QWidget *parentWidget = 0; + QLayout *parentLayout = 0; + + bool isQObject = !className.isEmpty(); + if ( isQObject ) { + if ( parent != 0 ) { + if ( parent->isWidgetType() ) { + if ( parent->inherits("QMainWindow") ) { + parentWidget = ((QMainWindow *) parent)->centralWidget(); + } else { + parentWidget = (QWidget *) parent; + } + } else if ( parent->inherits("QLayout") ) { + parentLayout = (QLayout *) parent; + parentWidget = ancestorWidget; + } + } + + if ( className == "QAction" ) { + unpackCString( strings, in, className ); + if ( className == "QActionGroup" ) { + obj = new QActionGroup( parent ); + } else { + obj = new QAction( parent ); + } + } else if ( className == "QLayout" ) { + unpackCString( strings, in, className ); + LayoutType type = Grid; + if ( className == "QHBoxLayout" ) { + type = HBox; + } else if ( className == "QVBoxLayout" ) { + type = VBox; + } + if ( parentLayout != 0 && parentLayout->inherits("QGridLayout") ) { + layout = createLayout( 0, 0, type ); + } else { + layout = createLayout( parentWidget, parentLayout, type ); + } + obj = layout; + } else if ( className == "QMenuBar" ) { + unpackCString( strings, in, className ); + widget = ((QMainWindow *) parent)->menuBar(); + obj = widget; + } else if ( className == "QToolBar" ) { + Q_UINT8 dock; + in >> dock; + unpackCString( strings, in, className ); + widget = new QToolBar( QString::null, (QMainWindow *) parent, + (Qt::Dock) dock ); + obj = widget; + } else if ( className == "QWidget" ) { + unpackCString( strings, in, className ); + widget = createWidget( className, parentWidget, 0 ); + obj = widget; + } + + if ( widget != 0 ) + ancestorWidget = widget; + d->lastItem = 0; + objects[numObjects++] = obj; + } + + QCString name; + QVariant value; + QCString comment; + QString str; + Q_UINT16 actionNo; + int metAttribute = 0; + Q_UINT16 column = 0; + Q_UINT16 row = 0; + Q_UINT16 colspan = 1; + Q_UINT16 rowspan = 1; + Q_UINT8 paletteTag; + Q_UINT8 objectTag; + + in >> objectTag; + while ( !in.atEnd() && objectTag != Object_End ) { + switch ( objectTag ) { + case Object_ActionRef: + unpackUInt16( in, actionNo ); + ((QAction *) objects[actionNo])->addTo( (QToolBar *) widget ); + break; + case Object_Attribute: + metAttribute = 2; + break; + case Object_Column: + inputColumnOrRow( strings, in, obj, FALSE ); + break; + case Object_Event: + unpackCString( strings, in, name ); + unpackVariant( strings, in, value ); + // ### do something with value.asStringList() + break; + case Object_FontProperty: + { + QFont font; + QString family; + Q_UINT16 pointSize; + Q_UINT8 fontFlags; + + unpackCString( strings, in, name ); + in >> fontFlags; + + if ( fontFlags & Font_Family ) { + unpackString( strings, in, family ); + font.setFamily( family ); + } + if ( fontFlags & Font_PointSize ) { + unpackUInt16( in, pointSize ); + font.setPointSize( pointSize ); + } + if ( fontFlags & Font_Bold ) + font.setBold( TRUE ); + if ( fontFlags & Font_Italic ) + font.setItalic( TRUE ); + if ( fontFlags & Font_Underline ) + font.setUnderline( TRUE ); + if ( fontFlags & Font_StrikeOut ) + font.setStrikeOut( TRUE ); + + if ( obj != 0 ) + setProperty( obj, name, font ); + } + break; + case Object_GridCell: + unpackUInt16( in, column ); + unpackUInt16( in, row ); + unpackUInt16( in, colspan ); + unpackUInt16( in, rowspan ); + break; + case Object_Item: + inputItem( strings, in, obj ); + break; + case Object_MenuItem: + inputMenuItem( objects, strings, in, (QMenuBar *) widget ); + break; + case Object_PaletteProperty: + { + QPalette palette; + QColorGroup colorGroup; + QColor color; + int role = -1; + + unpackCString( strings, in, name ); + + in >> paletteTag; + while ( !in.atEnd() && paletteTag != Palette_End ) { + switch ( paletteTag ) { + case Palette_Active: + palette.setActive( colorGroup ); + role = -1; + break; + case Palette_Inactive: + palette.setInactive( colorGroup ); + role = -1; + break; + case Palette_Disabled: + palette.setDisabled( colorGroup ); + role = -1; + break; + case Palette_Color: + role++; + in >> color; + colorGroup.setColor( (QColorGroup::ColorRole) role, + color ); + break; + case Palette_Pixmap: + unpackVariant( strings, in, value ); + colorGroup.setBrush( (QColorGroup::ColorRole) role, + QBrush(color, value.asPixmap()) ); + break; + default: + qFatal( "Corrupt" ); + } + in >> paletteTag; + } + if ( obj != 0 ) + setProperty( obj, name, palette ); + } + break; + case Object_Row: + inputColumnOrRow( strings, in, obj, TRUE ); + break; + case Object_Spacer: + inputSpacer( strings, in, layout ); + break; + case Object_Separator: + ((QToolBar *) widget)->addSeparator(); + break; + case Object_SubAction: + inputObject( objects, numObjects, strings, in, parentWidget, + obj != 0 ? obj : parent, "QAction" ); + break; + case Object_SubLayout: + inputObject( objects, numObjects, strings, in, parentWidget, obj, + "QLayout" ); + break; + case Object_SubWidget: + inputObject( objects, numObjects, strings, in, parentWidget, obj, + "QWidget" ); + break; + case Object_TextProperty: + unpackCString( strings, in, name ); + unpackCString( strings, in, value.asCString() ); + unpackCString( strings, in, comment ); + str = translate( value.asCString().data(), comment.data() ); + + if ( metAttribute > 0 ) { + if ( name == "title" ) { + if ( parent != 0 ) { + if ( parent->inherits("QTabWidget") ) { + ((QTabWidget *) parent)->insertTab( widget, str ); + } else if ( parent->inherits("QWizard") ) { + ((QWizard *) parent)->addPage( widget, str ); + } + } + } + } else { + if ( obj != 0 ) + setProperty( obj, name, str ); + } + break; + case Object_VariantProperty: + unpackCString( strings, in, name ); + unpackVariant( strings, in, value ); + + if ( metAttribute > 0 ) { + if ( name == "id" ) { + if ( parent != 0 && parent->inherits("QWidgetStack") ) + ((QWidgetStack *) parent)->addWidget( widget, value.toInt() ); + } + } else { + if ( obj != 0 ) + setProperty( obj, name, value ); + } + break; + default: + qFatal( "Corrupt" ); + } + in >> objectTag; + metAttribute--; + } + + if ( parentLayout != 0 ) { + if ( widget != 0 ) { + if ( parentLayout->inherits("QGridLayout") ) { + ((QGridLayout *) parentLayout)->addMultiCellWidget( + widget, row, row + rowspan - 1, column, + column + colspan - 1 ); + } else { + ((QBoxLayout *) parentLayout)->addWidget( widget ); + } + } else if ( layout != 0 ) { + if ( parentLayout->inherits("QGridLayout") ) { + ((QGridLayout *) parentLayout)->addMultiCellLayout( + layout, row, row + rowspan - 1, column, + column + colspan - 1 ); + } + } + } + return obj; +} + +QWidget *QWidgetFactory::createFromUibFile( QDataStream& in, + QObject * /* connector */ , QWidget *parent, const char *name ) +{ +#define END_OF_BLOCK() \ + ( in.atEnd() || in.device()->at() >= nextBlock ) + + Q_UINT8 lf; + Q_UINT8 cr; + in >> lf; + in >> cr; + if ( lf != '\n' || cr != '\r' ) { + qWarning( "File corrupted" ); + return 0; + } + + Q_UINT8 qdatastreamVersion; + in >> qdatastreamVersion; + if ( (int) qdatastreamVersion > in.version() ) { + qWarning( "Incompatible version of Qt" ); + return 0; + } + in.setVersion( qdatastreamVersion ); + + UibStrTable strings; + QObject **objects = 0; + int numObjects = 0; + + Q_UINT8 blockType; + Q_UINT32 blockSize; + + in >> blockType; + while ( !in.atEnd() && blockType != Block_End ) { + unpackUInt32( in, blockSize ); + QIODevice::Offset nextBlock = in.device()->at() + blockSize; + + switch ( blockType ) { + case Block_Actions: + inputObject( objects, numObjects, strings, in, toplevel, toplevel ); + break; + case Block_Buddies: + { + Q_UINT16 labelNo; + Q_UINT16 buddyNo; + + do { + unpackUInt16( in, labelNo ); + unpackUInt16( in, buddyNo ); + QLabel *label = + (QLabel *) objects[labelNo]->qt_cast( "QLabel" ); + if ( label != 0 ) + label->setBuddy( (QWidget *) objects[buddyNo] ); + } while ( !END_OF_BLOCK() ); + } + break; + case Block_Connections: + { + QString language = "C++"; + Q_UINT16 senderNo = 0; + QString signal = "clicked()"; + Q_UINT16 receiverNo = 0; + QString slot = "accept()"; + Q_UINT8 connectionFlags; + + do { + in >> connectionFlags; + if ( connectionFlags & Connection_Language ) + unpackString( strings, in, language ); + if ( connectionFlags & Connection_Sender ) + unpackUInt16( in, senderNo ); + if ( connectionFlags & Connection_Signal ) + unpackStringSplit( strings, in, signal ); + if ( connectionFlags & Connection_Receiver ) + unpackUInt16( in, receiverNo ); + if ( connectionFlags & Connection_Slot ) + unpackStringSplit( strings, in, slot ); + // ### +#if 0 + qWarning( "connect( %p, %s, %p, %s )", objects[senderNo], + signal.latin1(), objects[receiverNo], + slot.latin1() ); +#endif + } while ( !END_OF_BLOCK() ); + } + break; + case Block_Functions: + // ### + qWarning( "Block_Functions not supported" ); + in.device()->at( nextBlock ); + break; + case Block_Images: + { + QString format; + Q_UINT32 length; + QByteArray data; + Image image; + + do { + unpackString( strings, in, image.name ); + unpackString( strings, in, format ); + unpackUInt32( in, length ); + unpackByteArray( in, data ); + image.img = loadImageData( format, length, data ); + images += image; + } while ( !END_OF_BLOCK() ); + } + break; + case Block_Intro: + { + Q_INT16 defaultMargin; + Q_INT16 defaultSpacing; + Q_UINT16 maxObjects; + Q_UINT8 introFlags; + + in >> introFlags; + in >> defaultMargin; + in >> defaultSpacing; + unpackUInt16( in, maxObjects ); + unpackCString( strings, in, d->translationContext ); + + if ( introFlags & Intro_Pixmapinproject ) + usePixmapCollection = TRUE; + if ( defaultMargin != -32768 ) + defMargin = defaultMargin; + if ( defaultSpacing != -32768 ) + defSpacing = defaultSpacing; + objects = new QObject *[maxObjects]; + } + break; + case Block_Menubar: + inputObject( objects, numObjects, strings, in, toplevel, toplevel, + "QMenuBar" ); + break; + case Block_Slots: + { + QString language; + QString slot; + + do { + unpackString( strings, in, language ); + unpackStringSplit( strings, in, slot ); + } while ( !END_OF_BLOCK() ); + } + break; + case Block_Strings: + strings.readBlock( in, blockSize ); + break; + case Block_Tabstops: + { + Q_UINT16 beforeNo; + Q_UINT16 afterNo; + + unpackUInt16( in, beforeNo ); + while ( !END_OF_BLOCK() ) { + unpackUInt16( in, afterNo ); + toplevel->setTabOrder( (QWidget *) objects[beforeNo], + (QWidget *) objects[afterNo] ); + beforeNo = afterNo; + } + } + break; + case Block_Toolbars: + do { + inputObject( objects, numObjects, strings, in, toplevel, + toplevel, "QToolBar" ); + } while ( !END_OF_BLOCK() ); + break; + case Block_Variables: + // ### + qWarning( "Block_Variables not supported" ); + in.device()->at( nextBlock ); + break; + case Block_Widget: + toplevel = (QWidget *) + inputObject( objects, numObjects, strings, in, toplevel, parent, + "QWidget" ); + if ( toplevel != 0 ) + toplevel->setName( name ); + break; + default: + qWarning( "Version error" ); + return 0; + } + in >> blockType; + } + delete[] objects; + return toplevel; +} + +/*! Installs a widget factory \a factory, which normally contains + additional widgets that can then be created using a QWidgetFactory. + See createWidget() for further details. +*/ + +void QWidgetFactory::addWidgetFactory( QWidgetFactory *factory ) +{ + widgetFactories.append( factory ); +} + +/*! + Creates a widget of the type \a className passing \a parent and \a + name to its constructor. + + If \a className is a widget in the Qt library, it is directly + created by this function. If the widget isn't in the Qt library, + each of the installed widget plugins is asked, in turn, to create + the widget. As soon as a plugin says it can create the widget it + is asked to do so. It may occur that none of the plugins can + create the widget, in which case each installed widget factory is + asked to create the widget (see addWidgetFactory()). If the widget + cannot be created by any of these means, 0 is returned. + + If you have a custom widget, and want it to be created using the + widget factory, there are two approaches you can use: + + \list 1 + + \i Write a widget plugin. This allows you to use the widget in + \e{Qt Designer} and in this QWidgetFactory. See the widget plugin + documentation for further details. (See the "Creating Custom + Widgets with Plugins" section of the \link designer-manual.book Qt + Designer manual\endlink for an example. + + \i Subclass QWidgetFactory. Then reimplement this function to + create and return an instance of your custom widget if \a + className equals the name of your widget, otherwise return 0. Then + at the beginning of your program where you want to use the widget + factory to create widgets do a: + \code + QWidgetFactory::addWidgetFactory( new MyWidgetFactory ); + \endcode + where MyWidgetFactory is your QWidgetFactory subclass. + + \endlist +*/ + +QWidget *QWidgetFactory::createWidget( const QString &className, QWidget *parent, + const char *name ) const +{ + // create widgets we know + if ( className == "QPushButton" ) { + return new QPushButton( parent, name ); + } else if ( className == "QToolButton" ) { + return new QToolButton( parent, name ); + } else if ( className == "QCheckBox" ) { + return new QCheckBox( parent, name ); + } else if ( className == "QRadioButton" ) { + return new QRadioButton( parent, name ); + } else if ( className == "QGroupBox" ) { + return new QGroupBox( parent, name ); + } else if ( className == "QButtonGroup" ) { + return new QButtonGroup( parent, name ); + } else if ( className == "QIconView" ) { +#if !defined(QT_NO_ICONVIEW) + return new QIconView( parent, name ); +#endif + } else if ( className == "QTable" ) { +#if !defined(QT_NO_TABLE) + return new QTable( parent, name ); +#endif + } else if ( className == "QListBox" ) { + return new QListBox( parent, name ); + } else if ( className == "QListView" ) { + return new QListView( parent, name ); + } else if ( className == "QLineEdit" ) { + return new QLineEdit( parent, name ); + } else if ( className == "QSpinBox" ) { + return new QSpinBox( parent, name ); + } else if ( className == "QMultiLineEdit" ) { + return new QMultiLineEdit( parent, name ); + } else if ( className == "QLabel" || className == "TextLabel" || className == "PixmapLabel" ) { + return new QLabel( parent, name ); + } else if ( className == "QLayoutWidget" ) { + return new QWidget( parent, name ); + } else if ( className == "QTabWidget" ) { + return new QTabWidget( parent, name ); + } else if ( className == "QComboBox" ) { + return new QComboBox( FALSE, parent, name ); + } else if ( className == "QWidget" ) { + if ( !qwf_stays_on_top ) + return new QWidget( parent, name ); + return new QWidget( parent, name, Qt::WStyle_StaysOnTop ); + } else if ( className == "QDialog" ) { + if ( !qwf_stays_on_top ) + return new QDialog( parent, name ); + return new QDialog( parent, name, FALSE, Qt::WStyle_StaysOnTop ); + } else if ( className == "QWizard" ) { + return new QWizard( parent, name ); + } else if ( className == "QLCDNumber" ) { + return new QLCDNumber( parent, name ); + } else if ( className == "QProgressBar" ) { + return new QProgressBar( parent, name ); + } else if ( className == "QTextView" ) { + return new QTextView( parent, name ); + } else if ( className == "QTextBrowser" ) { + return new QTextBrowser( parent, name ); + } else if ( className == "QDial" ) { + return new QDial( parent, name ); + } else if ( className == "QSlider" ) { + return new QSlider( parent, name ); + } else if ( className == "QFrame" ) { + return new QFrame( parent, name ); + } else if ( className == "QSplitter" ) { + return new QSplitter( parent, name ); + } else if ( className == "Line" ) { + QFrame *f = new QFrame( parent, name ); + f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + return f; + } else if ( className == "QTextEdit" ) { + return new QTextEdit( parent, name ); + } else if ( className == "QDateEdit" ) { + return new QDateEdit( parent, name ); + } else if ( className == "QTimeEdit" ) { + return new QTimeEdit( parent, name ); + } else if ( className == "QDateTimeEdit" ) { + return new QDateTimeEdit( parent, name ); + } else if ( className == "QScrollBar" ) { + return new QScrollBar( parent, name ); + } else if ( className == "QPopupMenu" ) { + return new QPopupMenu( parent, name ); + } else if ( className == "QWidgetStack" ) { + return new QWidgetStack( parent, name ); + } else if ( className == "QToolBox" ) { + return new QToolBox( parent, name ); + } else if ( className == "QVBox" ) { + return new QVBox( parent, name ); + } else if ( className == "QHBox" ) { + return new QHBox( parent, name ); + } else if ( className == "QGrid" ) { + return new QGrid( 4, parent, name ); + } else if ( className == "QMainWindow" ) { + QMainWindow *mw = 0; + if ( !qwf_stays_on_top ) + mw = new QMainWindow( parent, name ); + else + mw = new QMainWindow( parent, name, Qt::WType_TopLevel | Qt::WStyle_StaysOnTop ); + mw->setCentralWidget( new QWidget( mw, "qt_central_widget" ) ); + mw->centralWidget()->show(); + (void)mw->statusBar(); + return mw; + + } +#if !defined(QT_NO_SQL) + else if ( className == "QDataTable" ) { + return new QDataTable( parent, name ); + } else if ( className == "QDataBrowser" ) { + return new QDesignerDataBrowser2( parent, name ); + } else if ( className == "QDataView" ) { + return new QDesignerDataView2( parent, name ); + } +#endif + + setupPluginDir(); + // try to create it using the loaded widget plugins + if ( !widgetInterfaceManager ) + widgetInterfaceManager = + new QPluginManager( IID_Widget, QApplication::libraryPaths(), + *qwf_plugin_dir ); + + QInterfacePtr iface = 0; + widgetInterfaceManager->queryInterface( className, &iface ); + if ( iface ) { + QWidget *w = iface->create( className, parent, name ); + if ( w ) { + d->customWidgets.replace( className.latin1(), new bool(TRUE) ); + return w; + } + } + + // hope we have a factory which can do it + for ( QWidgetFactory* f = widgetFactories.first(); f; f = widgetFactories.next() ) { + QWidget *w = f->createWidget( className, parent, name ); + if ( w ) + return w; + } + + // no success + return 0; +} + +/*! Returns the names of the widgets, which this facory can create. */ + +QStringList QWidgetFactory::widgets() +{ + setupWidgetListAndMap(); + return *availableWidgetList; +} + +/*! Returns whether this widget factory can create the widget \a + widget */ + +bool QWidgetFactory::supportsWidget( const QString &widget ) +{ + setupWidgetListAndMap(); + return ( availableWidgetMap->find( widget ) != availableWidgetMap->end() ); +} + +QWidget *QWidgetFactory::createWidgetInternal( const QDomElement &e, QWidget *parent, + QLayout* layout, const QString &classNameArg ) +{ + d->lastItem = 0; + QDomElement n = e.firstChild().toElement(); + QWidget *w = 0; // the widget that got created + QObject *obj = 0; // gets the properties + + QString className = classNameArg; + + int row = e.attribute( "row" ).toInt(); + int col = e.attribute( "column" ).toInt(); + int rowspan = e.attribute( "rowspan" ).toInt(); + int colspan = e.attribute( "colspan" ).toInt(); + if ( rowspan < 1 ) + rowspan = 1; + if ( colspan < 1 ) + colspan = 1; + + bool isQLayoutWidget = FALSE; + + if ( !className.isEmpty() ) { + if ( !layout && className == "QLayoutWidget" ) { + className = "QWidget"; + isQLayoutWidget = TRUE; + } + if ( layout && className == "QLayoutWidget" ) { + // hide layout widgets + w = parent; + } else { + obj = QWidgetFactory::createWidget( className, parent, 0 ); + if ( !obj ) + return 0; + w = (QWidget*)obj; + if ( !toplevel ) + toplevel = w; + if ( w->inherits( "QMainWindow" ) ) + w = ( (QMainWindow*)w )->centralWidget(); + if ( layout ) { + switch( layoutType( layout ) ) { + case HBox: + ( (QHBoxLayout*)layout )->addWidget( w ); + break; + case VBox: + ( (QVBoxLayout*)layout )->addWidget( w ); + break; + case Grid: + ( (QGridLayout*)layout )->addMultiCellWidget( w, row, row + rowspan - 1, + col, col + colspan - 1 ); + break; + default: + break; + } + } + + layout = 0; + } + } +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + QString parentClassName = parent ? parent->className() : 0; + bool isPlugin = parent ? !!d->customWidgets.find( parent->className() ) : FALSE; + if ( isPlugin ) + qWarning( "####### loading custom container widgets without page support not implemented!" ); + // ### TODO loading for custom container widgets without pages +#endif + + int idx = 0; + while ( !n.isNull() ) { + if ( n.tagName() == "spacer" ) { + createSpacer( n, layout ); + } else if ( n.tagName() == "widget" ) { + QMap< QString, QString> *oldDbControls = dbControls; + createWidgetInternal( n, w, layout, n.attribute( "class", "QWidget" ) ); + dbControls = oldDbControls; + } else if ( n.tagName() == "hbox" ) { + QLayout *parentLayout = layout; + if ( layout && layout->inherits( "QGridLayout" ) ) + layout = createLayout( 0, 0, QWidgetFactory::HBox, isQLayoutWidget ); + else + layout = createLayout( w, layout, QWidgetFactory::HBox, isQLayoutWidget ); + obj = layout; + n = n.firstChild().toElement(); + if ( parentLayout && parentLayout->inherits( "QGridLayout" ) ) + ( (QGridLayout*)parentLayout )->addMultiCellLayout( layout, row, + row + rowspan - 1, col, col + colspan - 1 ); + continue; + } else if ( n.tagName() == "grid" ) { + QLayout *parentLayout = layout; + if ( layout && layout->inherits( "QGridLayout" ) ) + layout = createLayout( 0, 0, QWidgetFactory::Grid, isQLayoutWidget ); + else + layout = createLayout( w, layout, QWidgetFactory::Grid, isQLayoutWidget ); + obj = layout; + n = n.firstChild().toElement(); + if ( parentLayout && parentLayout->inherits( "QGridLayout" ) ) + ( (QGridLayout*)parentLayout )->addMultiCellLayout( layout, row, + row + rowspan - 1, col, col + colspan - 1 ); + continue; + } else if ( n.tagName() == "vbox" ) { + QLayout *parentLayout = layout; + if ( layout && layout->inherits( "QGridLayout" ) ) + layout = createLayout( 0, 0, QWidgetFactory::VBox, isQLayoutWidget ); + else + layout = createLayout( w, layout, QWidgetFactory::VBox, isQLayoutWidget ); + obj = layout; + n = n.firstChild().toElement(); + if ( parentLayout && parentLayout->inherits( "QGridLayout" ) ) + ( (QGridLayout*)parentLayout )->addMultiCellLayout( layout, row, + row + rowspan - 1, col, col + colspan - 1 ); + continue; + } else if ( n.tagName() == "property" && obj ) { + setProperty( obj, n.attribute( "name" ), n.firstChild().toElement() ); + } else if ( n.tagName() == "attribute" && w ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( parent ) { + if ( parent->inherits( "QTabWidget" ) ) { + if ( attrib == "title" ) + ( (QTabWidget*)parent )->insertTab( w, translate( v.toString() ) ); + } else if ( parent->inherits( "QWidgetStack" ) ) { + if ( attrib == "id" ) + ( (QWidgetStack*)parent )->addWidget( w, v.toInt() ); + } else if ( parent->inherits( "QToolBox" ) ) { + if ( attrib == "label" ) + ( (QToolBox*)parent )->addItem( w, v.toString() ); + } else if ( parent->inherits( "QWizard" ) ) { + if ( attrib == "title" ) + ( (QWizard*)parent )->addPage( w, translate( v.toString() ) ); +#ifdef QT_CONTAINER_CUSTOM_WIDGETS + } else if ( isPlugin ) { + if ( attrib == "label" ) { + WidgetInterface *iface = 0; + widgetInterfaceManager->queryInterface( parentClassName, &iface ); + if ( iface ) { + QWidgetContainerInterfacePrivate *iface2 = 0; + iface->queryInterface( IID_QWidgetContainer, + (QUnknownInterface**)&iface2 ); + if ( iface2 ) { + iface2->insertPage( parentClassName, + (QWidget*)parent, translate( v.toString() ), -1, w ); + iface2->release(); + } + iface->release(); + } + } +#endif + } + } + } else if ( n.tagName() == "item" ) { + createItem( n, w ); + } else if ( n.tagName() == "column" || n.tagName() == "row" ) { + createColumn( n, w ); + } + + n = n.nextSibling().toElement(); + idx++; + } + + return w; +} + +QLayout *QWidgetFactory::createLayout( QWidget *widget, QLayout* layout, + LayoutType type, bool isQLayoutWidget ) +{ + int spacing = defSpacing; + int margin = defMargin; + + if ( layout || !widget || isQLayoutWidget ) + margin = 0; + + if ( !layout && widget && widget->inherits( "QTabWidget" ) ) + widget = ((QTabWidget*)widget)->currentPage(); + + if ( !layout && widget && widget->inherits( "QWizard" ) ) + widget = ((QWizard*)widget)->currentPage(); + + if ( !layout && widget && widget->inherits( "QWidgetStack" ) ) + widget = ((QWidgetStack*)widget)->visibleWidget(); + + if ( !layout && widget && widget->inherits( "QToolBox" ) ) + widget = ((QToolBox*)widget)->currentItem(); + + QLayout *l = 0; + int align = 0; + if ( !layout && widget && widget->inherits( "QGroupBox" ) ) { + QGroupBox *gb = (QGroupBox*)widget; + gb->setColumnLayout( 0, Qt::Vertical ); + layout = gb->layout(); + layout->setMargin( 0 ); + layout->setSpacing( 0 ); + align = Qt::AlignTop; + } + if ( layout ) { + switch ( type ) { + case HBox: + l = new QHBoxLayout( layout ); + break; + case VBox: + l = new QVBoxLayout( layout ); + break; + case Grid: + l = new QGridLayout( layout ); + break; + default: + return 0; + } + } else { + switch ( type ) { + case HBox: + l = new QHBoxLayout( widget ); + break; + case VBox: + l = new QVBoxLayout( widget ); + break; + case Grid: + l = new QGridLayout( widget ); + break; + default: + return 0; + } + } + l->setAlignment( align ); + l->setMargin( margin ); + l->setSpacing( spacing ); + return l; +} + +QWidgetFactory::LayoutType QWidgetFactory::layoutType( QLayout *layout ) const +{ + if ( layout->inherits( "QHBoxLayout" ) ) + return HBox; + else if ( layout->inherits( "QVBoxLayout" ) ) + return VBox; + else if ( layout->inherits( "QGridLayout" ) ) + return Grid; + return NoLayout; +} + +void QWidgetFactory::setProperty( QObject* obj, const QString &prop, + QVariant value ) +{ + int offset = obj->metaObject()->findProperty( prop, TRUE ); + + if ( offset != -1 ) { + if ( prop == "geometry" && obj == toplevel ) { + toplevel->resize( value.toRect().size() ); + } else if ( prop == "accel" ) { + obj->setProperty( prop, value.toKeySequence() ); + } else { + if ( value.type() == QVariant::String || + value.type() == QVariant::CString ) { + const QMetaProperty *metaProp = + obj->metaObject()->property( offset, TRUE ); + if ( metaProp != 0 && metaProp->isEnumType() ) { + if ( metaProp->isSetType() ) { + QStrList flagsCStr; + QStringList flagsStr = + QStringList::split( '|', value.asString() ); + QStringList::ConstIterator f = flagsStr.begin(); + while ( f != flagsStr.end() ) { + flagsCStr.append( *f ); + ++f; + } + value = QVariant( metaProp->keysToValue(flagsCStr) ); + } else { + QCString key = value.toCString(); + value = QVariant( metaProp->keyToValue(key) ); + } + } + } + obj->setProperty( prop, value ); + } + } else { + if ( obj->isWidgetType() ) { + if ( prop == "toolTip" ) { + if ( !value.toString().isEmpty() ) + QToolTip::add( (QWidget*)obj, translate( value.toString() ) ); + } else if ( prop == "whatsThis" ) { + if ( !value.toString().isEmpty() ) + QWhatsThis::add( (QWidget*)obj, translate( value.toString() ) ); + } else if ( prop == "buddy" ) { + buddies.insert( obj->name(), value.toCString() ); + } else if ( prop == "buttonGroupId" ) { + if ( obj->inherits( "QButton" ) && obj->parent()->inherits( "QButtonGroup" ) ) + ( (QButtonGroup*)obj->parent() )->insert( (QButton*)obj, value.toInt() ); +#ifndef QT_NO_SQL + } else if ( prop == "database" && !obj->inherits( "QDataView" ) + && !obj->inherits( "QDataBrowser" ) ) { + const QStringList& lst = value.asStringList(); + if ( lst.count() > 2 ) { + if ( dbControls ) + dbControls->insert( obj->name(), lst[ 2 ] ); + } else if ( lst.count() == 2 ) { + dbTables.insert( obj->name(), lst ); + } + } else if ( prop == "database" ) { + const QStringList& lst = value.asStringList(); + if ( lst.count() == 2 && obj->inherits( "QWidget" ) ) { + SqlWidgetConnection conn( lst[ 0 ], lst[ 1 ] ); + sqlWidgetConnections.insert( (QWidget*)obj, conn ); + dbControls = conn.dbControls; + } +#endif + } else if ( prop == "frameworkCode" ) { + if ( value.isValid() && !value.toBool() ) + noDatabaseWidgets << obj->name(); + } + } + } +} + +void QWidgetFactory::setProperty( QObject* widget, const QString &prop, const QDomElement &e ) +{ + QString comment; + QVariant value( DomTool::elementToVariant( e, QVariant(), comment ) ); + + if ( e.tagName() == "string" ) { + value = translate( value.asString(), comment ); + } else if ( e.tagName() == "pixmap" ) { + QPixmap pix = loadPixmap( value.toString() ); + if ( !pix.isNull() ) + value = pix; + } else if ( e.tagName() == "iconset" ) { + QPixmap pix = loadPixmap( value.toString() ); + if ( !pix.isNull() ) + value = QIconSet( pix ); + } else if ( e.tagName() == "image" ) { + value = loadFromCollection( value.toString() ); + } else if ( e.tagName() == "palette" ) { + QDomElement n = e.firstChild().toElement(); + QPalette p; + while ( !n.isNull() ) { + QColorGroup cg; + if ( n.tagName() == "active" ) { + cg = loadColorGroup( n ); + p.setActive( cg ); + } else if ( n.tagName() == "inactive" ) { + cg = loadColorGroup( n ); + p.setInactive( cg ); + } else if ( n.tagName() == "disabled" ) { + cg = loadColorGroup( n ); + p.setDisabled( cg ); + } + n = n.nextSibling().toElement(); + } + value = p; + } + setProperty( widget, prop, value ); +} + +void QWidgetFactory::createSpacer( const QDomElement &e, QLayout *layout ) +{ + QDomElement n = e.firstChild().toElement(); + int row = e.attribute( "row" ).toInt(); + int col = e.attribute( "column" ).toInt(); + int rowspan = e.attribute( "rowspan" ).toInt(); + int colspan = e.attribute( "colspan" ).toInt(); + + Qt::Orientation orient = Qt::Horizontal; + int w = 0, h = 0; + QSizePolicy::SizeType sizeType = QSizePolicy::Preferred; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString prop = n.attribute( "name" ); + if ( prop == "orientation" ) { + if ( n.firstChild().firstChild().toText().data() == "Horizontal" ) + orient = Qt::Horizontal; + else + orient = Qt::Vertical; + } else if ( prop == "sizeType" ) { + sizeType = stringToSizeType( n.firstChild().firstChild().toText().data() ); + } else if ( prop == "sizeHint" ) { + w = n.firstChild().firstChild().firstChild().toText().data().toInt(); + h = n.firstChild().firstChild().nextSibling().firstChild().toText().data().toInt(); + } + } + n = n.nextSibling().toElement(); + } + + if ( rowspan < 1 ) + rowspan = 1; + if ( colspan < 1 ) + colspan = 1; + QSpacerItem *item = new QSpacerItem( w, h, orient == Qt::Horizontal ? sizeType : QSizePolicy::Minimum, + orient == Qt::Vertical ? sizeType : QSizePolicy::Minimum ); + if ( layout ) { + if ( layout->inherits( "QBoxLayout" ) ) + ( (QBoxLayout*)layout )->addItem( item ); + else + ( (QGridLayout*)layout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, + orient == Qt::Horizontal ? Qt::AlignVCenter : Qt::AlignHCenter ); + } +} + +static QImage loadImageData( QDomElement &n2 ) +{ + QString format = n2.attribute( "format", "PNG" ); + QString hex = n2.firstChild().toText().data(); + int n = hex.length() / 2; + QByteArray data( n ); + for ( int i = 0; i < n; i++ ) + data[i] = (char) hex.mid( 2 * i, 2 ).toUInt( 0, 16 ); + return loadImageData( format, n2.attribute("length").toULong(), data ); +} + +void QWidgetFactory::loadImageCollection( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "image" ) { + Image img; + img.name = n.attribute( "name" ); + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "data" ) + img.img = loadImageData( n2 ); + n2 = n2.nextSibling().toElement(); + } + images.append( img ); + n = n.nextSibling().toElement(); + } + } +} + +QImage QWidgetFactory::loadFromCollection( const QString &name ) +{ + QValueList::Iterator it = images.begin(); + for ( ; it != images.end(); ++it ) { + if ( ( *it ).name == name ) + return ( *it ).img; + } + return QImage(); +} + +QPixmap QWidgetFactory::loadPixmap( const QString& name ) +{ + QPixmap pix; + if ( usePixmapCollection ) { + const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( name ); + if ( m ) + QImageDrag::decode( m, pix ); + } else { + pix.convertFromImage( loadFromCollection(name) ); + } + return pix; +} + +QPixmap QWidgetFactory::loadPixmap( const QDomElement &e ) +{ + return loadPixmap( e.firstChild().toText().data() ); +} + +QColorGroup QWidgetFactory::loadColorGroup( const QDomElement &e ) +{ + QColorGroup cg; + int r = -1; + QDomElement n = e.firstChild().toElement(); + QColor col; + while ( !n.isNull() ) { + if ( n.tagName() == "color" ) { + r++; + cg.setColor( (QColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); + } else if ( n.tagName() == "pixmap" ) { + QPixmap pix = loadPixmap( n ); + cg.setBrush( (QColorGroup::ColorRole)r, QBrush( col, pix ) ); + } + n = n.nextSibling().toElement(); + } + return cg; +} + +struct Connection +{ + QObject *sender, *receiver; + QCString signal, slot; + bool operator==( const Connection &c ) const { + return sender == c.sender && receiver == c.receiver && + signal == c.signal && slot == c.slot ; + } + + Connection() : sender( 0 ), receiver( 0 ) { } +}; + +class NormalizeObject : public QObject +{ +public: + NormalizeObject() : QObject() {} + static QCString normalizeSignalSlot( const char *signalSlot ) { return QObject::normalizeSignalSlot( signalSlot ); } +}; + +void QWidgetFactory::loadConnections( const QDomElement &e, QObject *connector ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "connection" ) { + QString lang = n.attribute( "language", "C++" ); + QDomElement n2 = n.firstChild().toElement(); + Connection conn; + while ( !n2.isNull() ) { + if ( n2.tagName() == "sender" ) { + QString name = n2.firstChild().toText().data(); + if ( name == "this" || qstrcmp( toplevel->name(), name ) == 0 ) { + conn.sender = toplevel; + } else { + if ( name == "this" ) + name = toplevel->name(); + QObjectList *l = toplevel->queryList( 0, name, FALSE ); + if ( l ) { + if ( l->first() ) + conn.sender = l->first(); + delete l; + } + } + if ( !conn.sender ) + conn.sender = findAction( name ); + } else if ( n2.tagName() == "signal" ) { + conn.signal = n2.firstChild().toText().data(); + } else if ( n2.tagName() == "receiver" ) { + QString name = n2.firstChild().toText().data(); + if ( name == "this" || qstrcmp( toplevel->name(), name ) == 0 ) { + conn.receiver = toplevel; + } else { + QObjectList *l = toplevel->queryList( 0, name, FALSE ); + if ( l ) { + if ( l->first() ) + conn.receiver = l->first(); + delete l; + } + } + } else if ( n2.tagName() == "slot" ) { + conn.slot = n2.firstChild().toText().data(); + } + n2 = n2.nextSibling().toElement(); + } + + conn.signal = NormalizeObject::normalizeSignalSlot( conn.signal ); + conn.slot = NormalizeObject::normalizeSignalSlot( conn.slot ); + + if ( !conn.sender || !conn.receiver ) { + n = n.nextSibling().toElement(); + continue; + } + + QObject *sender = 0, *receiver = 0; + QObjectList *l = toplevel->queryList( 0, conn.sender->name(), FALSE ); + if ( qstrcmp( conn.sender->name(), toplevel->name() ) == 0 ) { + sender = toplevel; + } else { + if ( !l || !l->first() ) { + delete l; + n = n.nextSibling().toElement(); + continue; + } + sender = l->first(); + delete l; + } + if ( !sender ) + sender = findAction( conn.sender->name() ); + + if ( qstrcmp( conn.receiver->name(), toplevel->name() ) == 0 ) { + receiver = toplevel; + } else { + l = toplevel->queryList( 0, conn.receiver->name(), FALSE ); + if ( !l || !l->first() ) { + delete l; + n = n.nextSibling().toElement(); + continue; + } + receiver = l->first(); + delete l; + } + + QString s = "2""%1"; + s = s.arg( conn.signal ); + QString s2 = "1""%1"; + s2 = s2.arg( conn.slot ); + + QStrList signalList = sender->metaObject()->signalNames( TRUE ); + QStrList slotList = receiver->metaObject()->slotNames( TRUE ); + + // if this is a connection to a custom slot and we have a connector, try this as receiver + if ( slotList.find( conn.slot ) == -1 && receiver == toplevel && connector ) { + slotList = connector->metaObject()->slotNames( TRUE ); + receiver = connector; + } + + // avoid warnings + if ( signalList.find( conn.signal ) == -1 || + slotList.find( conn.slot ) == -1 ) { + n = n.nextSibling().toElement(); + continue; + } + QObject::connect( sender, s, receiver, s2 ); + } + n = n.nextSibling().toElement(); + } +} + +void QWidgetFactory::loadTabOrder( const QDomElement &e ) +{ + QWidget *last = 0; + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "tabstop" ) { + QString name = n.firstChild().toText().data(); + QObjectList *l = toplevel->queryList( 0, name, FALSE ); + if ( l ) { + if ( l->first() ) { + QWidget *w = (QWidget*)l->first(); + if ( last ) + toplevel->setTabOrder( last, w ); + last = w; + } + delete l; + } + } + n = n.nextSibling().toElement(); + } +} + +void QWidgetFactory::createListViewColumn( QListView *lv, const QString& txt, + const QPixmap& pix, bool clickable, + bool resizable ) +{ + if ( pix.isNull() ) { + lv->addColumn( txt ); + } else { + lv->addColumn( pix, txt ); + } + + int i = lv->header()->count() - 1; + if ( !pix.isNull() ) + lv->header()->setLabel( i, pix, txt ); + if ( !clickable ) + lv->header()->setClickEnabled( clickable, i ); + if ( !resizable ) + lv->header()->setResizeEnabled( resizable, i ); +} + +#ifndef QT_NO_TABLE +void QWidgetFactory::createTableColumnOrRow( QTable *table, const QString& txt, + const QPixmap& pix, + const QString& field, bool isRow ) +{ +#ifndef QT_NO_SQL + bool isSql = table->inherits( "QDataTable" ); +#endif + if ( isRow ) + table->setNumRows( table->numRows() + 1 ); + else { +#ifndef QT_NO_SQL + if ( !isSql ) +#endif + table->setNumCols( table->numCols() + 1 ); + } + + QValueList fieldMap; + if ( fieldMaps.find( table ) != fieldMaps.end() ) { + fieldMap = *fieldMaps.find( table ); + fieldMaps.remove( table ); + } + + int i = isRow ? table->numRows() - 1 : table->numCols() - 1; + QHeader *h = !isRow ? table->horizontalHeader() : table->verticalHeader(); + if ( !pix.isNull() ) { +#ifndef QT_NO_SQL + if ( isSql ) + ((QDataTable*)table)->addColumn( field, txt, -1, pix ); + else +#endif + h->setLabel( i, pix, txt ); + } else { +#ifndef QT_NO_SQL + if ( isSql ) + ((QDataTable*)table)->addColumn( field, txt ); + else +#endif + h->setLabel( i, txt ); + } + if ( !isRow && !field.isEmpty() ) { + fieldMap.append( Field( txt, pix, field ) ); + fieldMaps.insert( table, fieldMap ); + } + +} +#endif + +void QWidgetFactory::createColumn( const QDomElement &e, QWidget *widget ) +{ + if ( widget->inherits( "QListView" ) && e.tagName() == "column" ) { + QListView *lv = (QListView*)widget; + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + QString txt; + bool clickable = TRUE, resizable = TRUE; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + txt = translate( v.toString() ); + else if ( attrib == "pixmap" ) + pix = loadPixmap( n.firstChild().toElement().toElement() ); + else if ( attrib == "clickable" ) + clickable = v.toBool(); + else if ( attrib == "resizable" || attrib == "resizeable" ) + resizable = v.toBool(); + } + n = n.nextSibling().toElement(); + } + createListViewColumn( lv, txt, pix, clickable, resizable ); + } +#ifndef QT_NO_TABLE + else if ( widget->inherits( "QTable" ) ) { + QTable *table = (QTable*)widget; + + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + QString txt; + QString field; + + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + txt = translate( v.toString() ); + else if ( attrib == "pixmap" ) { + if ( !n.firstChild().firstChild().toText().data().isEmpty() ) + pix = loadPixmap( n.firstChild().toElement().toElement() ); + } else if ( attrib == "field" ) + field = translate( v.toString() ); + } + n = n.nextSibling().toElement(); + } + createTableColumnOrRow( table, txt, pix, field, e.tagName() == "row" ); + } +#endif +} + +void QWidgetFactory::loadItem( const QDomElement &e, QPixmap &pix, QString &txt, bool &hasPixmap ) +{ + QDomElement n = e; + hasPixmap = FALSE; + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + txt = translate( v.toString() ); + else if ( attrib == "pixmap" ) { + pix = loadPixmap( n.firstChild().toElement() ); + hasPixmap = !pix.isNull(); + } + } + n = n.nextSibling().toElement(); + } +} + +void QWidgetFactory::createItem( const QDomElement &e, QWidget *widget, QListViewItem *i ) +{ + if ( widget->inherits( "QListBox" ) || widget->inherits( "QComboBox" ) ) { + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + bool hasPixmap = FALSE; + QString txt; + loadItem( n, pix, txt, hasPixmap ); + QListBox *lb = 0; + if ( widget->inherits( "QListBox" ) ) + lb = (QListBox*)widget; + else + lb = ( (QComboBox*)widget)->listBox(); + if ( hasPixmap ) { + new QListBoxPixmap( lb, pix, txt ); + } else { + new QListBoxText( lb, txt ); + } +#ifndef QT_NO_ICONVIEW + } else if ( widget->inherits( "QIconView" ) ) { + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + bool hasPixmap = FALSE; + QString txt; + loadItem( n, pix, txt, hasPixmap ); + + QIconView *iv = (QIconView*)widget; + new QIconViewItem( iv, txt, pix ); +#endif + } else if ( widget->inherits( "QListView" ) ) { + QDomElement n = e.firstChild().toElement(); + QPixmap pix; + QValueList pixmaps; + QStringList textes; + QListViewItem *item = 0; + QListView *lv = (QListView*)widget; + if ( i ) + item = new QListViewItem( i, d->lastItem ); + else + item = new QListViewItem( lv, d->lastItem ); + while ( !n.isNull() ) { + if ( n.tagName() == "property" ) { + QString attrib = n.attribute( "name" ); + QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + if ( attrib == "text" ) + textes << translate( v.toString() ); + else if ( attrib == "pixmap" ) { + QString s = v.toString(); + if ( s.isEmpty() ) { + pixmaps << QPixmap(); + } else { + pix = loadPixmap( n.firstChild().toElement() ); + pixmaps << pix; + } + } + } else if ( n.tagName() == "item" ) { + item->setOpen( TRUE ); + createItem( n, widget, item ); + } + + n = n.nextSibling().toElement(); + } + + for ( int i = 0; i < lv->columns(); ++i ) { + item->setText( i, textes[ i ] ); + item->setPixmap( i, pixmaps[ i ] ); + } + d->lastItem = item; + } +} + + + +void QWidgetFactory::loadChildAction( QObject *parent, const QDomElement &e ) +{ + QDomElement n = e; + QAction *a = 0; + bool hasMenuText = FALSE; + if ( n.tagName() == "action" ) { + a = new QAction( parent ); + QDomElement n2 = n.firstChild().toElement(); + + while ( !n2.isNull() ) { + if ( n2.tagName() == "property" ) { + QString prop(n2.attribute("name")); + if (prop == "menuText") + hasMenuText = TRUE; + setProperty( a, prop, n2.firstChild().toElement() ); + } + n2 = n2.nextSibling().toElement(); + } + if ( !parent->inherits( "QAction" ) ) + actionList.append( a ); + } else if ( n.tagName() == "actiongroup" ) { + a = new QActionGroup( parent ); + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "property" ) { + QString prop(n2.attribute("name")); + if (prop == "menuText") + hasMenuText = TRUE; + setProperty( a, prop, n2.firstChild().toElement() ); + } else if ( n2.tagName() == "action" || + n2.tagName() == "actiongroup" ) { + loadChildAction( a, n2 ); + + } + n2 = n2.nextSibling().toElement(); + } + if ( !parent->inherits( "QAction" ) ) + actionList.append( a ); + } + + if (a && !hasMenuText && !a->text().isEmpty() && uiFileVersion < "3.3") + a->setMenuText(a->text()); +} + +void QWidgetFactory::loadActions( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "action" ) { + loadChildAction( toplevel, n ); + } else if ( n.tagName() == "actiongroup" ) { + loadChildAction( toplevel, n ); + } + n = n.nextSibling().toElement(); + } +} + +void QWidgetFactory::loadToolBars( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + QMainWindow *mw = ( (QMainWindow*)toplevel ); + QToolBar *tb = 0; + while ( !n.isNull() ) { + if ( n.tagName() == "toolbar" ) { + Qt::Dock dock = (Qt::Dock)n.attribute( "dock" ).toInt(); + tb = new QToolBar( QString::null, mw, dock ); + tb->setLabel( n.attribute( "label" ) ); + tb->setName( n.attribute( "name" ) ); + QDomElement n2 = n.firstChild().toElement(); + while ( !n2.isNull() ) { + if ( n2.tagName() == "action" ) { + QAction *a = findAction( n2.attribute( "name" ) ); + if ( a ) + a->addTo( tb ); + } else if ( n2.tagName() == "separator" ) { + tb->addSeparator(); + } else if ( n2.tagName() == "widget" ) { + (void)createWidgetInternal( n2, tb, 0, n2.attribute( "class", "QWidget" ) ); + } else if ( n2.tagName() == "property" ) { + setProperty( tb, n2.attribute( "name" ), n2.firstChild().toElement() ); + } + n2 = n2.nextSibling().toElement(); + } + } + n = n.nextSibling().toElement(); + } +} + +void QWidgetFactory::loadMenuBar( const QDomElement &e ) +{ + QDomElement n = e.firstChild().toElement(); + QMainWindow *mw = ( (QMainWindow*)toplevel ); + QMenuBar *mb = mw->menuBar(); + while ( !n.isNull() ) { + if ( n.tagName() == "item" ) { + QPopupMenu *popup = new QPopupMenu( mw ); + loadPopupMenu( popup, n ); + popup->setName( n.attribute( "name" ) ); + mb->insertItem( translate( n.attribute( "text" ) ), popup ); + } else if ( n.tagName() == "property" ) { + setProperty( mb, n.attribute( "name" ), n.firstChild().toElement() ); + } else if ( n.tagName() == "separator" ) { + mb->insertSeparator(); + } + n = n.nextSibling().toElement(); + } +} + +void QWidgetFactory::loadPopupMenu( QPopupMenu *p, const QDomElement &e ) +{ + QMainWindow *mw = ( (QMainWindow*)toplevel ); + QDomElement n = e.firstChild().toElement(); + while ( !n.isNull() ) { + if ( n.tagName() == "action" ) { + QAction *a = findAction( n.attribute( "name" ) ); + QDomElement n2 = n.nextSibling().toElement(); + if ( n2.tagName() == "item") { // load submenu + QPopupMenu *popup = new QPopupMenu( mw ); + popup->setName( n2.attribute( "name" ) ); + if ( a ) { + p->setAccel( a->accel(), p->insertItem( a->iconSet(), + translate( n2.attribute( "text" ).utf8().data() ), + popup ) ); + } else { + p->insertItem( translate( n2.attribute( "text" ).utf8().data() ), popup ); + } + loadPopupMenu( popup, n2 ); + n = n2; + } else { + if ( a ) { + a->addTo( p ); + } + } + a = 0; + } else if ( n.tagName() == "separator" ) { + p->insertSeparator(); + } + n = n.nextSibling().toElement(); + } +} + +// compatibility with early 3.0 betas +// ### remove for 4.0 +void QWidgetFactory::loadFunctions( const QDomElement & ) +{ +} + +QAction *QWidgetFactory::findAction( const QString &name ) +{ + for ( QAction *a = actionList.first(); a; a = actionList.next() ) { + if ( QString( a->name() ) == name ) + return a; + QAction *ac = (QAction*)a->child( name.latin1(), "QAction" ); + if ( ac ) + return ac; + } + return 0; +} + +/*! + If you use a pixmap collection (which is the default for new + projects) rather than saving the pixmaps within the .ui XML file, + you must load the pixmap collection. QWidgetFactory looks in the + default QMimeSourceFactory for the pixmaps. Either add it there + manually, or call this function and specify the directory where + the images can be found, as \a dir. This is normally the + directory called \c images in the project's directory. +*/ + +void QWidgetFactory::loadImages( const QString &dir ) +{ + QDir d( dir ); + QStringList l = d.entryList( QDir::Files ); + for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) + QMimeSourceFactory::defaultFactory()->setPixmap( *it, QPixmap( d.path() + "/" + *it, "PNG" ) ); + +} + +void QWidgetFactory::loadExtraSource() +{ + if ( !qwf_language || !languageInterfaceManager ) + return; + QString lang = *qwf_language; + LanguageInterface *iface = 0; + languageInterfaceManager->queryInterface( lang, &iface ); + if ( !iface ) + return; + QFile f( qwf_currFileName + iface->formCodeExtension() ); + if ( f.open( IO_ReadOnly ) ) { + QTextStream ts( &f ); + code = ts.read(); + } +} + +QString QWidgetFactory::translate( const QString& sourceText, const QString& comment ) +{ + return qApp->translate( d->translationContext, sourceText.utf8(), comment.utf8(), + QApplication::UnicodeUTF8 ); +} + +QString QWidgetFactory::translate( const char *sourceText, const char *comment ) +{ + return qApp->translate( d->translationContext, sourceText, comment, + QApplication::UnicodeUTF8 ); +} diff --git a/kdevdesigner/uilib/qwidgetfactory.h b/kdevdesigner/uilib/qwidgetfactory.h new file mode 100644 index 00000000..9146e9a7 --- /dev/null +++ b/kdevdesigner/uilib/qwidgetfactory.h @@ -0,0 +1,180 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#ifndef QWIDGETFACTORY_H +#define QWIDGETFACTORY_H + +#ifndef QT_H +#include +#include +#include +#include +#include +#include +#include +#endif // QT_H + +class QDomDocument; +class QDomElement; +class QLayout; +class QListView; +class QListViewItem; +class QMenuBar; +class QTable; +class QWidget; +class QWidgetFactoryPrivate; +class UibStrTable; + +class QWidgetFactory +{ +public: + QWidgetFactory(); + virtual ~QWidgetFactory(); + + static QWidget *create( const QString &uiFile, QObject *connector = 0, QWidget *parent = 0, const char *name = 0 ); + static QWidget *create( QIODevice *dev, QObject *connector = 0, QWidget *parent = 0, const char *name = 0 ); + static void addWidgetFactory( QWidgetFactory *factory ); + static void loadImages( const QString &dir ); + + virtual QWidget *createWidget( const QString &className, QWidget *parent, const char *name ) const; + static QStringList widgets(); + static bool supportsWidget( const QString &widget ); + +private: + enum LayoutType { HBox, VBox, Grid, NoLayout }; + void loadImageCollection( const QDomElement &e ); + void loadConnections( const QDomElement &e, QObject *connector ); + void loadTabOrder( const QDomElement &e ); + QWidget *createWidgetInternal( const QDomElement &e, QWidget *parent, QLayout* layout, const QString &classNameArg ); + QLayout *createLayout( QWidget *widget, QLayout* layout, LayoutType type, bool isQLayoutWidget = FALSE ); + LayoutType layoutType( QLayout *l ) const; + void setProperty( QObject* widget, const QString &prop, QVariant value ); + void setProperty( QObject* widget, const QString &prop, const QDomElement &e ); + void createSpacer( const QDomElement &e, QLayout *layout ); + QImage loadFromCollection( const QString &name ); + QPixmap loadPixmap( const QString &name ); + QPixmap loadPixmap( const QDomElement &e ); + QColorGroup loadColorGroup( const QDomElement &e ); + void createListViewColumn( QListView *lv, const QString& txt, + const QPixmap& pix, bool clickable, + bool resizable ); +#ifndef QT_NO_TABLE + void createTableColumnOrRow( QTable *table, const QString& txt, + const QPixmap& pix, const QString& field, + bool isRow ); +#endif + void createColumn( const QDomElement &e, QWidget *widget ); + void loadItem( const QDomElement &e, QPixmap &pix, QString &txt, bool &hasPixmap ); + void createItem( const QDomElement &e, QWidget *widget, QListViewItem *i = 0 ); + void loadChildAction( QObject *parent, const QDomElement &e ); + void loadActions( const QDomElement &e ); + void loadToolBars( const QDomElement &e ); + void loadMenuBar( const QDomElement &e ); + void loadPopupMenu( QPopupMenu *p, const QDomElement &e ); + void loadFunctions( const QDomElement &e ); + QAction *findAction( const QString &name ); + void loadExtraSource(); + QString translate( const char *sourceText, const char *comment = "" ); + QString translate( const QString& sourceText, const QString& comment = QString::null ); + + void unpackUInt16( QDataStream& in, Q_UINT16& n ); + void unpackUInt32( QDataStream& in, Q_UINT32& n ); + void unpackByteArray( QDataStream& in, QByteArray& array ); + void unpackCString( const UibStrTable& strings, QDataStream& in, + QCString& cstr ); + void unpackString( const UibStrTable& strings, QDataStream& in, + QString& str ); + void unpackStringSplit( const UibStrTable& strings, QDataStream& in, + QString& str ); + void unpackVariant( const UibStrTable& strings, QDataStream& in, + QVariant& value ); + void inputSpacer( const UibStrTable& strings, QDataStream& in, + QLayout *parent ); + void inputColumnOrRow( const UibStrTable& strings, QDataStream& in, + QObject *parent, bool isRow ); + void inputItem( const UibStrTable& strings, QDataStream& in, + QObject *parent, QListViewItem *parentItem = 0 ); + void inputMenuItem( QObject **objects, const UibStrTable& strings, + QDataStream& in, QMenuBar *menuBar ); + QObject *inputObject( QObject **objects, int& numObjects, + const UibStrTable& strings, QDataStream& in, + QWidget *ancestorWidget, QObject *parent, + QCString className = "" ); + QWidget *createFromUiFile( QDomDocument doc, QObject *connector, + QWidget *parent, const char *name ); + QWidget *createFromUibFile( QDataStream& in, QObject *connector, + QWidget *parent, const char *name ); + +private: + struct Image { + QImage img; + QString name; + bool operator==( const Image &i ) const { + return ( i.name == name && + i.img == img ); + } + }; + + struct Field + { + Field() {} + Field( const QString &s1, const QPixmap &p, const QString &s2 ) : name( s1 ), pix( p ), field( s2 ) {} + QString name; + QPixmap pix; + QString field; + Q_DUMMY_COMPARISON_OPERATOR( Field ) + }; + + struct SqlWidgetConnection + { + SqlWidgetConnection() {} + SqlWidgetConnection( const QString &c, const QString &t ) + : conn( c ), table( t ), dbControls( new QMap() ) {} + QString conn; + QString table; + QMap *dbControls; + Q_DUMMY_COMPARISON_OPERATOR( SqlWidgetConnection ) + }; + + QValueList images; + QWidget *toplevel; + QWidgetFactoryPrivate *d; + QMap *dbControls; + QMap dbTables; + QMap sqlWidgetConnections; + QMap buddies; + QMap > fieldMaps; + QPtrList actionList; + QMap languageSlots; + QStringList noDatabaseWidgets; + bool usePixmapCollection; + int defMargin; + int defSpacing; + QString code; + QString uiFileVersion; +}; + +#endif diff --git a/kdevelop.desktop b/kdevelop.desktop new file mode 100644 index 00000000..8a8435c2 --- /dev/null +++ b/kdevelop.desktop @@ -0,0 +1,52 @@ +[Desktop Entry] +Type=Application +Exec=kdevelop %u +MimeType=application/x-kdevelop; +Icon=kdevelop +X-DocPath=kdevelop/index.html +Terminal=false +Name=KDevelop: Multilanguage +Name[br]=KDevelop : meur a yezh +Name[ca]=KDevelop: Multi llenguatge +Name[da]=KDevelop: Mange sprog +Name[de]=KDevelop: Mehrsprachenunterstützung +Name[el]=KDevelop: πολλές γλώσσες +Name[es]=KDevelop: multilenguaje +Name[et]=KDevelop: mitmekeelne arendus +Name[eu]=KDevelop: Hizkuntza anitz +Name[fa]=KDevelop: چند زبانه +Name[fr]=KDevelop : multi-langage +Name[ga]=KDevelop: Ilteangach +Name[gl]=KDevelop: Multilinguaxe +Name[hu]=KDevelop: nyelvtámogatás +Name[it]=KDevelop: multilinguaggio +Name[ja]=KDevelop: 多言語 +Name[ms]=KDevelop: Pelbagai bahasa +Name[nds]=KDevelop - Verscheden Spraken +Name[ne]=केडीई विकास: बहुभाषा +Name[nl]=KDevelop: meertalig +Name[pl]=KDevelop: wielojęzyczność +Name[pt]=KDevelop: Múltiplas Linguagens +Name[pt_BR]=KDevelop: Multi-Linguagem +Name[ru]=KDevelop: Разработка на нескольких языках +Name[sk]=KDevelop: viac jazykov +Name[sl]=KDevelop: Večjezičnost +Name[sr]=KDevelop: Вишејезички +Name[sr@Latn]=KDevelop: Višejezički +Name[sv]=KDevelop: Flera språk +Name[tr]=KDevelop: Çokludil +Name[zh_CN]=KDevelop:多语言 +Name[zh_TW]=KDevelop:多重語言 +GenericName=IDE +GenericName[da]=Integreret udviklingsmiljø +GenericName[fr]=EDI +GenericName[hu]=Fejlesztőkörnyezet +GenericName[nds]=Programmsmeed +GenericName[ne]=आईडी ई +GenericName[ru]=Интегрированная среда разработки +GenericName[sv]=Utvecklingsmiljö +GenericName[tr]=Bütünleşik Geliştirme Ortamı +GenericName[zh_TW]=整合開發環境 +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Development;IDE;X-KDE-KDevelopIDE; + diff --git a/kdevelop.lsm b/kdevelop.lsm new file mode 100644 index 00000000..fedd4ec5 --- /dev/null +++ b/kdevelop.lsm @@ -0,0 +1,11 @@ +Begin4 +Title: kdevelop +Version: 3.5.4 +Entered-date: 2008-12-18 +Description: Integrated Development Environment for KDE +Keywords: KDE X11 desktop Qt +Author: http://bugs.kde.org/ (KDE Bugtracking System) +Primary-site: http://www.kdevelop.org/index.html?filename=download.html +Platforms: Unix, Qt +Copying-policy: GPL, Artistic +End diff --git a/kdevelop.m4.in b/kdevelop.m4.in new file mode 100644 index 00000000..90e88204 --- /dev/null +++ b/kdevelop.m4.in @@ -0,0 +1,501 @@ +dnl +dnl Check location of Qt documentation +dnl +AC_DEFUN([KDEV_PATH_QTDOC], +[ +AC_MSG_CHECKING([for Qt documentation]) + +ac_qt_docdirs="" +AC_ARG_WITH(qtdoc_dir, +[ --with-qtdoc-dir=DIR where the Qt documentation is installed ], +ac_qt_docdirs="" +qt_docdirs="" +[ + ac_qt_docdirs=$withval +], +) + +dnl +dnl not currently used +dnl +qt_docdirs="/usr/doc/qt-doc/html /usr/local/qt/html /usr/local/lib/qt/html /usr/lib/qt/doc/html /usr/X11/lib/qt/html /usr/X11/lib/qt/doc/html /usr/X11R6/share/doc/qt/html /usr/share/doc/packages/qt/html" +test -n "$QTDIR" && qt_docdirs="$QTDIR/html $QTDIR/doc/html $QTDIR/doc $qt_docdirs" +qt_docdirs="$ac_qt_docdirs $qt_docdirs" +AC_FIND_FILE(classes.html, $qt_docdirs, qt_docdir) +AC_MSG_RESULT($qt_docdir) +if test "$qt_docdir" = NO; then + qt_docdir="" +fi +AC_DEFINE_UNQUOTED(QT_DOCDIR, "$qt_docdir", [Where the Qt documentation is installed]) +]) + + +dnl +dnl Check location of kdelibs documentation generated by Doxygen +dnl +AC_DEFUN([KDEV_PATH_KDELIBSDOXY], +[ +AC_MSG_CHECKING([for kdelibs documentation generated by Doxygen]) + +ac_kdelibs_doxydirs="" +AC_ARG_WITH(kdelibsdoxy_dir, +[ --with-kdelibsdoxy-dir=DIR where the kdelibs documentation is installed ], +ac_kdelibs_doxydirs="" +kdelibs_doxydirs="" +[ + ac_kdelibs_doxydirs=$withval +], +) + +if test "${prefix}" = NONE; then + ac_kde_htmldir="$ac_default_prefix"/share/doc/HTML +else + ac_kde_htmldir="$prefix"/share/doc/HTML +fi + +kdelibs_doxydirs="$ac_kdelibs_doxydirs $ac_kde_htmldir/default/kdelibs-apidocs $ac_kde_htmldir/en/kdelibs-apidocs" +AC_FIND_FILE(kdecore/html/classKApplication.html, $kdelibs_doxydirs, kdelibs_doxydir) +AC_MSG_RESULT($kdelibs_doxydir) +if test "$kdelibs_doxydir" = NO; then + kdelibs_doxydir="" +fi +AC_DEFINE_UNQUOTED(KDELIBS_DOXYDIR, "$kdelibs_doxydir", [where KDE documentation is installed]) +]) +AC_SUBST(kdelibs_doxydir) + + +dnl +dnl Check location of kdelibs documentation +dnl +AC_DEFUN([KDEV_PATH_KDELIBSDOC], +[ +AC_MSG_CHECKING([for kdelibs documentation]) + +ac_kdelibs_docdirs="" +AC_ARG_WITH(kdelibsdoc_dir, +[ --with-kdelibsdoc-dir=DIR where the kdelibs documentation is installed ], +ac_kdelibs_docdirs="" +kdelibs_docdirs="" +[ + ac_kdelibs_docdirs=$withval +], +) + +if test "${prefix}" = NONE; then + ac_kde_htmldir="$ac_default_prefix"/share/doc/HTML +else + ac_kde_htmldir="$prefix"/share/doc/HTML +fi + +kdelibs_docdirs="/usr/doc/kdelibs-doc/html" +if test "$ac_kde_htmldir" != ""; then + kdelibs_docdirs="$kdelibs_docdirs $ac_kde_htmldir/default/kdelibs $ac_kde_htmldir/en/kdelibs" +fi +kdelibs_docdirs="$ac_kdelibs_docdirs $kdelibs_docdirs" +AC_FIND_FILE(kdecore/index.html, $kdelibs_docdirs, kdelibs_docdir) +AC_MSG_RESULT($kdelibs_docdir) +if test "$kdelibs_docdir" = NO; then + kdelibs_docdir="" +fi +AC_DEFINE_UNQUOTED(KDELIBS_DOCDIR, "$kdelibs_docdir", [where KDE documentation is installed]) +]) + + +dnl +dnl Check whether we support Debian docbase +dnl +AC_DEFUN([KDEV_CHECK_DOCBASE], +[ +AC_MSG_CHECKING(for docbase) +AC_ARG_ENABLE(docbase, +[ --enable-docbase enable Debian docbase support], +[if test "$enableval" = yes; then + enable_docbase=yes +fi], +enable_docbase=no) +AC_MSG_RESULT($enable_docbase) + +if test "$enable_docbase" = "yes"; then + AC_DEFINE_UNQUOTED(WITH_DOCBASE, 1, [If Debian docbase should be supported]) +fi +]) + + +dnl +dnl Check whether we support Python scripting +dnl +AC_DEFUN([KDEV_CHECK_SCRIPTING], +[ +AC_MSG_CHECKING(if scripting enabled) +AC_ARG_ENABLE(scripting, +[ --enable-scripting enable python scripting support], +[if test "$enableval" = yes; then + enable_scripting=yes +fi], +enable_scripting=no) +AC_MSG_RESULT($enable_scripting) + +SCRIPTING= +if test "$enable_scripting" = "yes"; then + KDE_CHECK_PYTHON(1.5, [ + AC_MSG_ERROR([You enabled scripting but have no python installed.]) + ]) + SCRIPTING=scripting +fi + AC_SUBST(SCRIPTING) + AM_CONDITIONAL(include_scripting, test -n "$SCRIPTING") +]) + + +dnl +dnl Check for Python documentation dir +dnl +AC_DEFUN([KDEV_PATH_PYTHONDOCDIR], +[ +AC_MSG_CHECKING(for Python documentation directory) +AC_ARG_WITH(pythondocdir, + [ --with-pythondocdir=pythondocdir where the Python documentation is installed ], + kdev_pythondocdir=$withval, + kdev_pythondocdir=/usr/local/python2.0/html +) + +AC_CACHE_VAL(kdev_cv_pythondocdir, +[ + pythondocdirs="/usr/share/doc/packages/python/html /usr/share/doc/python-docs-2.0 /usr/share/doc/python/html $kdev_pythondocdir" + AC_FIND_FILE(ref/comparisons.html, $pythondocdirs, kdev_cv_pythondocdir) +]) + +AC_MSG_RESULT($kdev_cv_pythondocdir) +PYTHONDOCDIR=$kdev_cv_pythondocdir +AC_SUBST(PYTHONDOCDIR) +]) + + +dnl +dnl Check for Python documentation dir +dnl +AC_DEFUN([KDEV_PATH_PHPDOCDIR], +[ +AC_MSG_CHECKING(for PHP documentation directory) +AC_ARG_WITH(phpdocdir, + [ --with-phpdocdir=phpdocdir where the PHP documentation is installed ], + kdev_phpdocdir=$withval, + kdev_phpdocdir=/usr/local/php/doc/manual +) + +AC_CACHE_VAL(kdev_cv_phpdocdir, +[ + phpdocdirs="/usr/share/doc/packages/phpdoc/manual /usr/share/doc/php3-doc/html $kdev_phpdocdir" + AC_FIND_FILE(ref.ftp.html, $phpdocdirs, kdev_cv_phpdocdir) +]) + +AC_MSG_RESULT($kdev_cv_phpdocdir) +PHPDOCDIR=$kdev_cv_phpdocdir +AC_SUBST(PHPDOCDIR) +]) + + +dnl +dnl Check for GNUstep documentation +dnl +AC_DEFUN([KDEV_PATH_GNUSTEPDOCDIR], +[ +AC_MSG_CHECKING([for GNUstep documentation]) +if test -z ${GNUSTEP_SYSTEM_ROOT:-""} ; then +GNUSTEPDOCDIR= +AC_MSG_RESULT(not found) +else +GNUSTEPDOCDIR=$GNUSTEP_SYSTEM_ROOT/Documentation/Developer +AC_MSG_RESULT($GNUSTEPDOCDIR) +fi +AC_SUBST(GNUSTEPDOCDIR) +AM_CONDITIONAL(GNUSTEPDOCS, test x$GNUSTEPDOCDIR != x) +]) + + +dnl +dnl Check for Gtk documentation dirs +dnl +AC_DEFUN([KDEV_PATH_GTKDOCDIR], +[ +AC_ARG_WITH(glibdocdir, + [ --with-glibdocdir=glibdocdir where the glib documentation is installed ], + kdev_glibdocdir=$withval, + kdev_glibdocdir="" +) +AC_ARG_WITH(gdkdocdir, + [ --with-gdkdocdir=gdkdocdir where the gdk documentation is installed ], + kdev_gdkdocdir=$withval, + kdev_gdkdocdir="" +) +AC_ARG_WITH(gdkpbdocdir, + [ --with-gdkpbdocdir=gdkpbdocdir where the gdk-pixbuf documentation is installed ], + kdev_gdkpbdocdir=$withval, + kdev_gdkpbdocdir="" +) +AC_ARG_WITH(gtkdocdir, + [ --with-gtkdocdir=gtkdocdir where the gtk documentation is installed ], + kdev_gtkdocdir=$withval, + kdev_gtkdocdir="" +) +AC_ARG_WITH(gnomedocdir, + [ --with-gnomedocdir=gnomedocdir where the gnome documentation is installed ], + kdev_gnomedocdir=$withval, + kdev_gnomedocdir="" +) +AC_ARG_WITH(gnomeuidocdir, + [ --with-gnomeuidocdir=gnomeuidocdir where the gnomeui documentation is installed ], + kdev_gnomeuidocdir=$withval, + kdev_gnomeuidocdir="" +) + +AC_MSG_CHECKING(for GLib documentation directory) +AC_CACHE_VAL(kdev_cv_glibdocdir, +[ + glibdocdirs="/usr/share/doc/packages/glib $kdev_glibdocdir" + AC_FIND_FILE(glib-arrays.html, $glibdocdirs, kdev_cv_glibdocdir) +]) +AC_MSG_RESULT($kdev_cv_glibdocdir) +AC_MSG_CHECKING(for Gdk documentation directory) +AC_CACHE_VAL(kdev_cv_gdkdocdir, +[ + gdkdocdirs="/usr/share/doc/packages/gdk $kdev_gdkdocdir" + AC_FIND_FILE(gdk-events.html, $gdkdocdirs, kdev_cv_gdkdocdir) +]) +AC_MSG_RESULT($kdev_cv_gdkdocdir) +AC_MSG_CHECKING(for Gdk-Pixbuf documentation directory) +AC_CACHE_VAL(kdev_cv_gdkpbdocdir, +[ + gdkpbdocdirs="/usr/share/doc/packages/gdk-pixbuf/html $kdev_gdkpbdocdir" + AC_FIND_FILE(gdk-pixbuf-rendering.html, $gdkpbdocdirs, kdev_cv_gdkpbdocdir) +]) +AC_MSG_RESULT($kdev_cv_gdkpbdocdir) +AC_MSG_CHECKING(for Gtk documentation directory) +AC_CACHE_VAL(kdev_cv_gtkdocdir, +[ + gtkdocdirs="/usr/share/doc/packages/gtk $kdev_gtkdocdir" + AC_FIND_FILE(gtkcombo.html, $gtkdocdirs, kdev_cv_gtkdocdir) +]) +AC_MSG_RESULT($kdev_cv_gtkdocdir) +AC_MSG_CHECKING(for libgnome documentation directory) +AC_CACHE_VAL(kdev_cv_gnomedocdir, +[ + gnomedocdirs="/usr/share/doc/packages/gnome-libs-devel/devel-docs/gnome/html $kdev_gnomedocdir" + AC_FIND_FILE(libgnome.html, $gnomedocdirs, kdev_cv_gnomedocdir) +]) +AC_MSG_RESULT($kdev_cv_gnomedocdir) +AC_MSG_CHECKING(for libgnomeui documentation directory) +AC_CACHE_VAL(kdev_cv_gnomeuidocdir, +[ + gnomeuidocdirs="/usr/share/doc/packages/gnome-libs-devel/devel-docs/gnomeui/html $kdev_gnomeuidocdir" + AC_FIND_FILE(libgnomeui.html, $gnomeuidocdirs, kdev_cv_gnomeuidocdir) +]) +AC_MSG_RESULT($kdev_cv_gnomeuidocdir) + +dnl We need all directories or none + +if test "$kdev_cv_glibdocdir" = NO; then + kdev_cv_glib_docdir="" +fi +if test "$kdev_cv_gdkdocdir" = NO; then + kdev_cv_glib_docdir="" + kdev_cv_gdk_docdir="" +fi +if test "$kdev_cv_gdkpbdocdir" = NO; then + kdev_cv_glib_docdir="" + kdev_cv_gdkpb_docdir="" +fi +if test "$kdev_cv_gtkdocdir" = NO; then + kdev_cv_glib_docdir="" + kdev_cv_gtk_docdir="" +fi +if test "$kdev_cv_gnomedocdir" = NO; then + kdev_cv_glib_docdir="" + kdev_cv_gnome_docdir="" +fi +if test "$kdev_cv_gnomeuidocdir" = NO; then + kdev_cv_glib_docdir="" + kdev_cv_gnomeui_docdir="" +fi + +GLIBDOCDIR=$kdev_cv_glibdocdir +AC_SUBST(GLIBDOCDIR) +GDKDOCDIR=$kdev_cv_gdkdocdir +AC_SUBST(GDKDOCDIR) +GDKPBDOCDIR=$kdev_cv_gdkpbdocdir +AC_SUBST(GDKPBDOCDIR) +GTKDOCDIR=$kdev_cv_gtkdocdir +AC_SUBST(GTKDOCDIR) +GNOMEDOCDIR=$kdev_cv_gnomedocdir +AC_SUBST(GNOMEDOCDIR) +GNOMEUIDOCDIR=$kdev_cv_gnomeuidocdir +AC_SUBST(GNOMEUIDOCDIR) +AM_CONDITIONAL(GTKDOCS, test x$kdev_cv_glibdocdir != x) +]) + + +dnl +dnl Check whether we support Java +dnl +AC_DEFUN([KDEV_CHECK_JAVA], +[ +AC_MSG_CHECKING(if javasupport enabled) +AC_ARG_ENABLE(javasupport, +[ --enable-javasupport enable java support], +[if test "$enableval" = yes; then + enable_javasupport=yes +fi], +enable_javasupport=no) +AC_MSG_RESULT($enable_javasupport) + +JAVASUPPORT_SUBDIR= +if test "$enable_javasupport" = "yes"; then + KDE_CHECK_JAVA_DIR + if test "x$kde_cv_java_bindir" = xno; then + AC_MSG_RESULT([not found -- parts/javasupport will NOT be built]) + JAVA_SUBDIRS="" + else + JAVA_SUBDIRS="javasupport javadebugger" + fi +fi +AC_SUBST(JAVA_SUBDIRS) +]) + +dnl ********** +dnl Simple Check for Berkeley DB >= 3 +dnl ********** + +AC_DEFUN([KDEV_CHECK_BDB], +[ + ac_db_includedir="" + ac_db_libdir="" + ac_db_lib="db" + AC_ARG_WITH(db_includedir, +[ --with-db-includedir=DIR + where the DB4 headers are installed ], +[ + ac_db_includedir="-I$withval" +], + ac_db_includedir="" +) + AC_ARG_WITH(db_libdir, +[ --with-db-libdir=DIR where the DB4 libraries are installed ], +[ + ac_db_libdir="-L$withval" +], + ac_db_libdir="" +) + AC_ARG_WITH(db_lib, +[ --with-db-lib=LIB library name for the DB4 library ], +[ + ac_db_lib=$withval +], +ac_db_lib=db +) + + AC_MSG_CHECKING(for Berkeley DB >= 4.1) + + AC_CACHE_VAL(ac_cv_bdb, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + save_CXXFLAGS="$CXXFLAGS" + + CXXFLAGS="$CXXFLAGS $ac_db_includedir $ac_db_libdir -l$ac_db_lib" + + AC_TRY_LINK([ + #include + ], + [ + #if DB_VERSION_MAJOR < 4 && DB_VERSION_MINOR < 1 + choke me + #else + DB *db; + db->open( db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644 ); + #endif + ], + ac_cv_bdb=yes, + ac_cv_bdb=no + ) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE + ]) + + if test "$ac_cv_bdb" = "no"; then + AC_MSG_ERROR(no - please install Berkeley DB >= 4.1) + else + AC_MSG_RESULT([yes]) + fi + +DB3LIB="$ac_db_lib" +DB3INCLUDES="$ac_db_includedir" +DB3LDFLAGS="$ac_db_libdir" +AC_SUBST(DB3LIB) +AC_SUBST(DB3INCLUDES) +AC_SUBST(DB3LDFLAGS) +]) + +dnl ********** +dnl check wether KDE is at least version 3.4.0 +dnl ********** +AC_DEFUN([KDEV_CHECK_KDE_VERSION], +[ + AC_MSG_CHECKING(for KDE >= 3.4.0) + + + AC_CACHE_VAL(ac_cv_kde_version_check, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + save_CXXFLAGS="$CXXFLAGS" + + CXXFLAGS="$CXXFLAGS $QT_INCLUDES -I$ac_kde_includes" + + AC_TRY_COMPILE([ + #include + ], + [ + #if KDE_IS_VERSION(3,4,0) + #else + KDE_choke me + #endif + ], + ac_cv_kde_version_check=yes, + ac_cv_kde_version_check=no + ) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE + ]) + + if test "$ac_cv_kde_version_check" = "yes"; then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR(Installed KDE needs to be version 3.4.0 or later) + fi +]) + + +dnl ********** +dnl check for new valgrind version (>= 2.1.0) +dnl ********** + +AC_DEFUN([KDEV_CHECK_VALGRIND], +[ + AC_CHECK_PROG(ac_have_valgrind, [valgrind], [yes]) + if test "yes" == $ac_have_valgrind; then + AC_MSG_CHECKING(valgrind version) + if test "valgrind-20" == `valgrind --version | $AWK -F \. '{print @S|@1@S|@2}'`; then + ac_valgrind_ver=20 + AC_MSG_RESULT(< 2.1.0) + elif test "valgrind-1" == `valgrind --version | $AWK -F \. '{print @S|@1}'`; then + ac_valgrind_ver=20 + AC_MSG_RESULT(< 2.1.0) + else + ac_valgrind_ver=21 + AC_MSG_RESULT(>= 2.1.0) + fi + fi + AC_DEFINE_UNQUOTED(VALGRIND_VERSION, $ac_valgrind_ver, [valgrind version number - 20 for older and 21 for newer]) +]) diff --git a/kdevelop_c_cpp.desktop b/kdevelop_c_cpp.desktop new file mode 100644 index 00000000..a0db141f --- /dev/null +++ b/kdevelop_c_cpp.desktop @@ -0,0 +1,49 @@ +[Desktop Entry] +Type=Application +Exec=kdevelop --profile CandCppIDE %u +MimeType=application/x-kdevelop; +Icon=kdevelop +X-DocPath=kdevelop/index.html +Terminal=false +Name=KDevelop: C/C++ +Name[br]=KDevelop : C/C++ +Name[fr]=KDevelop : C / C++ +Name[nds]=KDevelop - C/C++ +Name[ne]=केडीई विकास: C/C++ +Name[zh_CN]=KDevelop:C/C++ +Name[zh_TW]=KDevelop:C/C++ +GenericName=IDE for C/C++ +GenericName[ca]=IDE per a C/C++ +GenericName[cs]=IDE pro C/C++ +GenericName[da]=Integreret udviklingsmiljø for C/C++ +GenericName[de]=IDE für C/C++ +GenericName[el]=IDE για C/C++ +GenericName[es]=IDE para C/C++ +GenericName[et]=C/C++ IDE +GenericName[eu]=C/C++ IDE-a +GenericName[fa]=IDE برای C/C++ +GenericName[fr]=EDI pour le C / C++ +GenericName[ga]=IDE le haghaidh C/C++ +GenericName[gl]=IDE para C/C++ +GenericName[hu]=C/C++ fejlesztőkörnyezet +GenericName[it]=IDE per C/C++ +GenericName[ja]=C/C++ のための統合開発環境 +GenericName[ms]=IDE untuk C/C++ +GenericName[nds]=C/C++-Programmsmeed +GenericName[ne]=C/C++ का लागि आईडी ई +GenericName[nl]=IDE voor C/C++ +GenericName[pl]=IDE dla C/C++ +GenericName[pt]=IDE para C/C++ +GenericName[pt_BR]=IDE para o C/C++ +GenericName[ru]=Среда разработки на C/C++ +GenericName[sk]=IDE pre C/C++ +GenericName[sl]=IDE za C/C++ +GenericName[sr]=IDE за C +GenericName[sr@Latn]=IDE za C +GenericName[sv]=Utvecklingsmiljö för C/C++ +GenericName[tg]=IDE барои C/C++ +GenericName[tr]=C/C++ için Bütünleşik Geliştirme Ortamı +GenericName[zh_CN]=C/C++ 的 IDE +GenericName[zh_TW]=C/C++ 整合開發環境 +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Development;IDE;X-KDE-KDevelopIDE; diff --git a/kdevelop_kde_cpp.desktop b/kdevelop_kde_cpp.desktop new file mode 100644 index 00000000..2f9657e9 --- /dev/null +++ b/kdevelop_kde_cpp.desktop @@ -0,0 +1,48 @@ +[Desktop Entry] +Type=Application +Exec=kdevelop --profile KDECppIDE %u +MimeType=application/x-kdevelop; +Icon=kdevelop +X-DocPath=kdevelop/index.html +Terminal=false +Name=KDevelop: KDE/C++ +Name[br]=KDevelop : KDE/C++ +Name[fr]=KDevelop : KDE / C++ +Name[nds]=KDevelop - KDE/C++ +Name[ne]=केडीई विकास: KDE/C++ +Name[zh_CN]=KDevelop:KDE/C++ +Name[zh_TW]=KDevelop:KDE/C++ +GenericName=IDE for KDE Development +GenericName[ca]=IDE per al desenvolupament de KDE +GenericName[cs]=IDE pro vývoj KDE +GenericName[da]=Integreret udviklingsmiljø for KDE +GenericName[de]=IDE für KDE-Softwareentwicklung +GenericName[el]=IDE για προγραμματισμό KDE +GenericName[es]=IDE para desarrollo en KDE +GenericName[et]=KDE arendamise IDE +GenericName[eu]=KDE-ren garapenerako IDE-a +GenericName[fa]=IDE برای توسعۀ KDE +GenericName[fr]=EDI pour le développement pour KDE +GenericName[ga]=IDE le haghaidh fhorbairt KDE +GenericName[gl]=IDE para desenvolvemento KDE +GenericName[hu]=Fejlesztőkörnyezet a KDE-hez +GenericName[it]=IDE per lo sviluppo di KDE +GenericName[ja]=KDE のための統合開発環境 +GenericName[nds]=KDE-Programmsmeed +GenericName[ne]=केडीई विकासका लागि आईडी ई +GenericName[nl]=IDE voor KDE Development +GenericName[pl]=IDE do tworzenia programów dla KDE +GenericName[pt]=IDE para Desenvolvimento KDE +GenericName[pt_BR]=IDE para Desenvolvimento no KDE +GenericName[ru]=Среда разработки KDE-приложений +GenericName[sk]=IDE pre vývoj KDE +GenericName[sl]=IDE za razvijanje KDE +GenericName[sr]=IDE за KDE развој +GenericName[sr@Latn]=IDE za KDE razvoj +GenericName[sv]=Utvecklingsmiljö för KDE +GenericName[tr]=KDE Geliştirmek için Bütünleşik Geliştirme Ortamı +GenericName[zh_CN]=KDE 开发的 IDE +GenericName[zh_TW]=KDE 整合開發環境 +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Development;IDE;X-KDE-KDevelopIDE; + diff --git a/kdevelop_ruby.desktop b/kdevelop_ruby.desktop new file mode 100644 index 00000000..b5bc3c3f --- /dev/null +++ b/kdevelop_ruby.desktop @@ -0,0 +1,51 @@ +[Desktop Entry] +Type=Application +Exec=kdevelop --profile RubyIDE %u +MimeType=application/x-kdevelop; +Icon=kdevelop +X-DocPath=kdevelop/index.html +Terminal=false +Name=KDevelop: Ruby +Name[br]=KDevelop : Ruby +Name[fa]=KDevelop: رابی +Name[fr]=KDevelop : Ruby +Name[nds]=KDevelop - Ruby +Name[ne]=केडीई विकास: रूबी +Name[zh_CN]=KDevelop:Ruby +Name[zh_TW]=KDevelop:Ruby +GenericName=IDE for Ruby +GenericName[ca]=IDE per a Ruby +GenericName[cs]=IDE pro Ruby +GenericName[da]=Integreret udviklingsmiljø for Ruby +GenericName[de]=IDE für Ruby +GenericName[el]=IDE για Ruby +GenericName[es]=IDE para Ruby +GenericName[et]=Ruby IDE +GenericName[eu]=Ruby-rako IDE-a +GenericName[fa]=IDE برای رابی +GenericName[fr]=EDI pour Ruby +GenericName[ga]=IDE le haghaidh Ruby +GenericName[gl]=IDE para Ruby +GenericName[hu]=Fejlesztőkörnyezet a Rubyhoz +GenericName[it]=IDE per Ruby +GenericName[ja]=Ruby のための統合開発環境 +GenericName[ms]=IDE untuk Ruby +GenericName[nds]=Ruby-Programmsmeed +GenericName[ne]=रूबीका लागि आईडी ई +GenericName[nl]=IDE voor Ruby +GenericName[pl]=IDE dla języka Ruby +GenericName[pt]=IDE para Ruby +GenericName[pt_BR]=IDE para o Ruby +GenericName[ru]=Среда разработки на Ruby +GenericName[sk]=IDE pre Ruby +GenericName[sl]=IDE za Ruby +GenericName[sr]=IDE за Ruby +GenericName[sr@Latn]=IDE za Ruby +GenericName[sv]=Utvecklingsmiljö för Ruby +GenericName[tg]=IDE барои Ruby +GenericName[tr]=Ruby için Bütünleşik Geliştirme Ortamı +GenericName[zh_CN]=Ruby 的 IDE +GenericName[zh_TW]=Ruby 的整合開發環境 +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Development;IDE;X-KDE-KDevelopIDE; + diff --git a/kdevelop_scripting.desktop b/kdevelop_scripting.desktop new file mode 100644 index 00000000..fde95daf --- /dev/null +++ b/kdevelop_scripting.desktop @@ -0,0 +1,69 @@ +[Desktop Entry] +Type=Application +Exec=kdevelop --profile ScriptingLanguageIDE %u +MimeType=application/x-kdevelop; +Icon=kdevelop +X-DocPath=kdevelop/index.html +Terminal=false +Name=KDevelop: Scripting +Name[ca]=KDevelop: Scripts +Name[cs]=KDevelop: skriptování +Name[da]=KDevelop: Scriptning +Name[de]=KDevelop: Skripten +Name[el]=KDevelop: γραφή σεναρίων +Name[et]=KDevelop: skriptikeeled +Name[eu]=KDevelop: Script-ak +Name[fa]=KDevelop: دست‌نوشته +Name[fr]=KDevelop : scriptage +Name[ga]=KDevelop: Scriptiú +Name[hu]=KDevelop: Szkriptkészítő +Name[it]=KDevelop: scripting +Name[ja]=KDevelop: スクリプティング +Name[ms]=KDevelop: Penskriptan +Name[nds]=KDevelop - Skripten +Name[ne]=केडीई विकास: स्क्रिप्टिङ +Name[pl]=KDevelop: Skrypty +Name[pt]=KDevelop: 'Scripting' +Name[ru]=KDevelop: Сценарии +Name[sk]=KDevelop: Skriptovanie +Name[sl]=KDevelop: Skriptiranje +Name[sr]=KDevelop: Скриптовање +Name[sr@Latn]=KDevelop: Skriptovanje +Name[sv]=KDevelop: skript +Name[tr]=KDevelop: Betik +Name[zh_CN]=KDevelop:脚本 +Name[zh_TW]=KDevelop:文稿 +GenericName=IDE for Scripting Language +GenericName[ca]=IDE per al llenguatge d'scripts +GenericName[cs]=IDE pro skriptovací jazyky +GenericName[da]=Integreret udviklingsmiljø for scriptsprog +GenericName[de]=IDE für Skript-Sprachen +GenericName[el]=IDE για γλώσσα γραφής σεναρίων +GenericName[es]=IDE para lenguaje de guiones +GenericName[et]=Skriptikeelte IDE +GenericName[eu]=Script lengoaientzatko IDE-a +GenericName[fa]=IDE برای زبانهای دست‌نوشته‌ای +GenericName[fr]=EDI pour les langages de scripts +GenericName[ga]=IDE le haghaidh teanga scriptithe +GenericName[gl]=IDE para linguaxes de scripting +GenericName[hu]=Fejlesztőkörnyezet szkriptnyelvekhez +GenericName[it]=IDE per linguaggi di scripting +GenericName[ja]=スクリプト言語のための統合開発環境 +GenericName[nds]=Skriptspraak-Programmsmeed +GenericName[ne]=स्क्रिप्टिङ भाषाका लागि आईडी ई +GenericName[nl]=IDE voor Scripting Language +GenericName[pl]=IDE dla języków skryptowych +GenericName[pt]=IDE para Linguagens de 'Scripting' +GenericName[pt_BR]=IDE para Linguagem de Script +GenericName[ru]=Среда разработки на интерпретируемых языках +GenericName[sk]=IDE pre skriptovací jazyk +GenericName[sl]=IDE za skriptni jezik +GenericName[sr]=IDE за скриптне језике +GenericName[sr@Latn]=IDE za skriptne jezike +GenericName[sv]=Utvecklingsmiljö för skriptspråk +GenericName[tr]=Betik Dili için Bütünleşik Geliştirme Ortamı +GenericName[zh_CN]=脚本语言的 IDE +GenericName[zh_TW]=文稿語言的整合開發環境 +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Development;IDE;X-KDE-KDevelopIDE; + diff --git a/kdevprj2kdevelop b/kdevprj2kdevelop new file mode 100755 index 00000000..124c2d99 --- /dev/null +++ b/kdevprj2kdevelop @@ -0,0 +1,299 @@ +#!/usr/bin/perl + +if ($#ARGV != 0) { + die "Need one argument"; +} + +$filename = $ARGV[0]; +unless ($filename =~ /\.kdevprj/) { + die "Not a .kdevprj file"; +} + + +$ingeneral = 0; +$inlfvgroups = 0; + +open(FILE, "<$filename") || die "File not found"; +while () { + if (/\[General\]/) { + $ingeneral = 1; + $inlfvgroups = 0; + $inbin = 0; + } elsif (/\[LFV Groups\]/) { + $ingeneral = 0; + $inlfvgroups = 1; + $inbin = 0; + } elsif (/\[Config for BinMakefileAm\]/) { + $ingeneral = 0; + $inlfvgroups = 0; + $inbin = 1; + } elsif (/\[(.*)\]/) { + push(@sourcefiles, $1); + $ingeneral = 0; + $inlfvgroups = 0; + $inbin = 0; + } + + if ($ingeneral) { + if (/^author=(.*)/) { + $author = $1; + } elsif (/^configure_args=(.*)/) { + $configure_args = $1; + } elsif (/^email=(.*)/) { + $email = $1; + } elsif (/^make_options=(.*)/) { + $make_options = $1; + if ($makeoptions =~ /-n/) { + $dontact = "true"; + } + if ($makeoptions =~ /-j([0-9]+)/) { + $numberofjobs = $1; + } + if ($makeoptions =~ /-f/) { + $abortonerror = "true"; + } + } elsif (/^project_name=(.*)/) { + $project_name = $1; + } elsif (/^project_type=(.*)/) { + $project_type = $1; + } elsif (/^sub_dir=([^\/]*)/) { + $subdir = $1; + } + } + + if ($inlfvgroups) { + if (/^groups=(.*)/) { + $lfvgroups = $1; + } elsif (/(.*)=(.*)/) { + $group = $1; + $pattern = $2; + $pattern =~ s/^(.*),$/$1/; + $lfvgrouppattern{$group} = $pattern; + } + } + + if ($inbin) { + if (/^bin_program=(.*)/) { + $bin_program = $1; + } elsif (/^path_to_bin_program=(.*)/) { + $path_to_bin_program = $1; + $path_to_bin_program =~ s#^\./(.*)$#$1#; + $path_to_bin_program =~ s#^(.*)/#$1#; + $path_to_bin_program = $path_to_bin_program . "/"; + } elsif (/^cflags=(.*)/) { + $cflags = $1; + } elsif (/^cxxflags=(.*)/) { + $cxxflags = $1; + } + } + +} +close FILE; + +# Choose language support +$primarylanguage = "C++"; +if ($project_type eq "normal_c" + || $project_type eq "normal_gnome") { + $primarylanguage = "C"; +} + +# Choose project management +$projectmanagement = "KDevCustomProject"; +if ($project_type =~ /normal_kde|mini_kde|normalogl_kde|normal_kde2|mini_kde2|mdi_kde2/ + || $project_type =~ /kde2_normal|kicker_app|kio_slave|kc_module|kpart_plugin|ktheme/) { + $projectmanagement = "KDevKDEAutoProject"; +} +if ($project_type =~ /normal_cpp/) { + $projectmanagement = "KDevAutoProject"; +} + +# Keywords +if ($project_type =~ /normal_kde|mini_kde|normalogl_kde|normal_kde2|mini_kde2|mdi_kde2/ + || $project_type =~ /kde2_normal|kicker_app|kio_slave|kc_module|kpart_plugin|ktheme/) { + $keywords = $keywords . ",KDE"; +} +if ($project_type =~ /normal_kde|mini_kde|normalogl_kde|normal_kde2|mini_kde2|mdi_kde2/ + || $project_type =~ /kde2_normal|kicker_app|kio_slave|kc_module|kpart_plugin|ktheme/ + || $project_type =~ /normal_qt|normal_qt2|mdi_qt2|mdi_qextmdi/) { + $keywords = $keywords . ",Qt"; +} + + +## +## Let's go: write project file +## + +$projectfilename = $filename; +$projectfilename =~ s/^(.*)\.kdevprj$/$1.kdevelop/; +open(FILE, ">$projectfilename"); + +print FILE < + + + $author + $email + $projectmanagement + $primarylanguage + +EOF + +foreach $key (split(/,/, $keywords)) { + next if ($key eq ""); + print FILE <$key +EOF +} + +print FILE < + +EOF + +# auto project specific + +if ($projectmanagement eq "KDevAutoProject" || $projectmanagement eq "KDevKDEAutoProject") { + print FILE < + + $path_to_bin_program$bin_program + + + $configure_args + + + $abortonerror + $numberofjobs + $dontact + + + + $cflags + $cxxflags + + +EOF +} + +if ($project_management eq "KDevCustomProject") { + print FILE < + + $path_to_bin_program/$bin_program + + + $abortonerror + $numberofjobs + $dontact + + + +EOF +} + + +# file view +print FILE < + +EOF + +for $group (split /,/, $lfvgroups) { + next if ($group eq ""); + $pattern = $lfvgrouppattern{$group}; + $pattern =~ s/,/;/g; + print FILE < +EOF +} + +print FILE < + + + + gtk + gnustep + python + php + perl + + +EOF + +if ($projectmanagement eq "KDevAutoProject" + || $projectmanagement eq "KDevKDEAutoProject") { + print FILE < + + libtool + + +EOF +} + +print FILE < +EOF +close FILE; + + +## +## Write file list +## + +if ($projectmanagement eq "KDevCustomProject") { + $filelistfilename = $filename; + $filelistfilename =~ s/^(.*).kdevprj$/$1.filelist/; + open(FILE, ">$filelistfilename"); + for $file (@sourcefiles) { + print FILE "$file\n"; + } + close FILE; +} + + +## +## Convert templates +## + +$projectdir = ""; +if ($filename =~ m#(.*/)[^/]*#) { + $projectdir = $1; +} + +$oldtemplatedir = "${projectdir}$subdir/templates"; + +if (open(FILE, "$oldtemplatedir/cpp_template")) { + mkdir "${projectdir}templates"; + if (open(OFILE, ">${projectdir}templates/cpp")) { + while() { + s/\|EMAIL\|/\$EMAIL\$/; + s/\|AUTHOR\|/\$AUTHOR\$/; + s/\|VERSION\|/\$VERSION\$/; + s/\|DATE\|/\$DATE\$/; + s/\|YEAR\|/\$YEAR\$/; + s/\|FILENAME\|/\$FILENAME\$/; + print OFILE $_; + } + close OFILE; + } + close FILE; +} + +if (open(FILE, "$oldtemplatedir/header_template")) { + mkdir "${projectdir}templates"; + if (open(OFILE, ">${projectdir}templates/h")) { + while() { + s/\|EMAIL\|/\$EMAIL\$/; + s/\|AUTHOR\|/\$AUTHOR\$/; + s/\|VERSION\|/\$VERSION\$/; + s/\|DATE\|/\$DATE\$/; + s/\|YEAR\|/\$YEAR\$/; + s/\|FILENAME\|/\$FILENAME\$/; + print OFILE $_; + } + close OFILE; + } + close FILE; +} diff --git a/languages/Makefile.am b/languages/Makefile.am new file mode 100644 index 00000000..1172b71c --- /dev/null +++ b/languages/Makefile.am @@ -0,0 +1,74 @@ +## +## Do NOT remove the comments that start with "kdevelop:" +## They are actually directives to the kdevelop plugin system +## +## The include_xxxx variables are controlled by configure.in.in +## + +if include_ada +ADA_LANGUAGE = ada +endif + +if include_bash +BASH_LANGUAGE = bash +endif + +if include_cpp +CPP_LANGUAGE = cpp +endif + +if include_fortran +FORTRAN_LANGUAGE = fortran +endif + +if include_java +JAVA_LANGUAGE = java +endif + +if include_csharp +CSHARP_LANGUAGE = csharp +endif + +if include_pascal +PASCAL_LANGUAGE = pascal +endif + +if include_perl +PERL_LANGUAGE = perl +endif + +if include_php +PHP_LANGUAGE = php +endif + +if include_python +PYTHON_LANGUAGE = python +endif + +if include_ruby +RUBY_LANGUAGE = ruby +endif + +if include_sql +SQL_LANGUAGE = sql +endif + +#kdevelop: ADA_LANGUAGE = ada +#kdevelop: BASH_LANGUAGE = bash +#kdevelop: CPP_LANGUAGE = cpp +#kdevelop: FORTRAN_LANGUAGE = fortran +#kdevelop: JAVA_LANGUAGE = java +#kdevelop: CSHARP_LANGUAGE = csharp +#kdevelop: PASCAL_LANGUAGE = pascal +#kdevelop: PERL_LANGUAGE = perl +#kdevelop: PHP_LANGUAGE = php +#kdevelop: PYTHON_LANGUAGE = python +#kdevelop: RUBY_LANGUAGE = ruby +#kdevelop: SQL_LANGUAGE = sql + +SUBDIRS = lib $(ADA_LANGUAGE) $(BASH_LANGUAGE) $(CPP_LANGUAGE) $(CSHARP_LANGUAGE) \ + $(FORTRAN_LANGUAGE) $(JAVA_LANGUAGE) $(PASCAL_LANGUAGE) \ + $(PERL_LANGUAGE) $(PHP_LANGUAGE) $(PYTHON_LANGUAGE) $(RUBY_LANGUAGE) $(SQL_LANGUAGE) + +DOXYGEN_EMPTY = YES +include ../Doxyfile.am diff --git a/languages/ada/AdaAST.hpp b/languages/ada/AdaAST.hpp new file mode 100644 index 00000000..1bb2bd07 --- /dev/null +++ b/languages/ada/AdaAST.hpp @@ -0,0 +1,77 @@ +#ifndef ADAAST_HPP +#define ADAAST_HPP + +#include + +class AdaAST; +typedef antlr::ASTRefCount RefAdaAST; + +class AdaAST : public antlr::CommonAST { +public: + AdaAST() : m_line (0), m_column (0) {} + + ~AdaAST() {} + + int getLine () const { return m_line; } + void setLine (int line) { m_line = line; } + + int getColumn () const { return m_column; } + void setColumn (int column) { m_column = column; } + + void initialize (antlr::RefToken t) { + antlr::CommonAST::initialize (t); + m_line = t->getLine () - 1; + m_column = t->getColumn () - 1; + } + + void initialize (int t, const std::string& txt) { + setType (t); + setText (txt); + m_line = 0; + m_column = 0; + } + + RefAdaAST duplicate (void) const { + AdaAST *ast = new AdaAST (*this); + return RefAdaAST (ast); + } + + void set (int t, const std::string& txt) { + setType (t); + setText (txt); + } + + void addChild (RefAdaAST c) { + antlr::RefAST n( c.get() ); + antlr::BaseAST::addChild (n); + } + + RefAdaAST down () const { + return RefAdaAST (antlr::BaseAST::getFirstChild ()); + } + + RefAdaAST right () const { + return RefAdaAST (antlr::BaseAST::getNextSibling ()); + } + + /* bool equals(RefAdaAST t) const { + return ((antlr::BaseAST*)this)->equals (t); + } */ + + static antlr::RefAST factory (void) { + RefAdaAST n( new AdaAST ); + return n.get(); + } + + static const RefAdaAST nullAdaAST; + +private: + int m_line; + int m_column; +}; + +#define Set(n, t) (n)->set(t, #t) +// for Java compatibility: +#define boolean bool + +#endif diff --git a/languages/ada/AdaLexer.cpp b/languages/ada/AdaLexer.cpp new file mode 100644 index 00000000..2ac19416 --- /dev/null +++ b/languages/ada/AdaLexer.cpp @@ -0,0 +1,1507 @@ +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaLexer.cpp"$ */ +#include "AdaLexer.hpp" +#include +#include +#include +#include +#include +#include +#include + +#line 1531 "ada.g" + +#include "preambles.h" + +#line 16 "AdaLexer.cpp" +AdaLexer::AdaLexer(ANTLR_USE_NAMESPACE(std)istream& in) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),false) +{ + initLiterals(); +} + +AdaLexer::AdaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(ib,false) +{ + initLiterals(); +} + +AdaLexer::AdaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(state,false) +{ + initLiterals(); +} + +void AdaLexer::initLiterals() +{ + literals["until"] = 78; + literals["xor"] = 86; + literals["abstract"] = 40; + literals["reverse"] = 71; + literals["use"] = 13; + literals["requeue"] = 84; + literals["with"] = 11; + literals["task"] = 42; + literals["at"] = 49; + literals["for"] = 47; + literals["else"] = 68; + literals["is"] = 23; + literals["of"] = 55; + literals["range"] = 16; + literals["and"] = 85; + literals["begin"] = 62; + literals["procedure"] = 24; + literals["separate"] = 39; + literals["private"] = 20; + literals["pragma"] = 4; + literals["delay"] = 77; + literals["abort"] = 80; + literals["function"] = 25; + literals["digits"] = 17; + literals["declare"] = 72; + literals["raise"] = 83; + literals["not"] = 87; + literals["record"] = 38; + literals["all"] = 30; + literals["in"] = 32; + literals["generic"] = 61; + literals["terminate"] = 82; + literals["subtype"] = 51; + literals["delta"] = 18; + literals["when"] = 58; + literals["null"] = 37; + literals["entry"] = 46; + literals["elsif"] = 67; + literals["case"] = 57; + literals["others"] = 27; + literals["do"] = 76; + literals["abs"] = 100; + literals["constant"] = 53; + literals["renames"] = 34; + literals["then"] = 66; + literals["exception"] = 52; + literals["protected"] = 43; + literals["accept"] = 75; + literals["or"] = 81; + literals["if"] = 65; + literals["aliased"] = 56; + literals["loop"] = 69; + literals["return"] = 41; + literals["limited"] = 60; + literals["new"] = 26; + literals["array"] = 54; + literals["rem"] = 99; + literals["end"] = 48; + literals["body"] = 22; + literals["mod"] = 50; + literals["goto"] = 74; + literals["tagged"] = 59; + literals["select"] = 79; + literals["while"] = 70; + literals["package"] = 21; + literals["type"] = 14; + literals["access"] = 19; + literals["out"] = 33; + literals["exit"] = 73; +} + +ANTLR_USE_NAMESPACE(antlr)RefToken AdaLexer::nextToken() +{ + ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; + for (;;) { + ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; + int _ttype = ANTLR_USE_NAMESPACE(antlr)Token::INVALID_TYPE; + resetText(); + try { // for lexical and char stream error handling + switch ( LA(1)) { + case 0x7c /* '|' */ : + { + mPIPE(true); + theRetToken=_returnToken; + break; + } + case 0x26 /* '&' */ : + { + mCONCAT(true); + theRetToken=_returnToken; + break; + } + case 0x2b /* '+' */ : + { + mPLUS(true); + theRetToken=_returnToken; + break; + } + case 0x28 /* '(' */ : + { + mLPAREN(true); + theRetToken=_returnToken; + break; + } + case 0x29 /* ')' */ : + { + mRPAREN(true); + theRetToken=_returnToken; + break; + } + case 0x2c /* ',' */ : + { + mCOMMA(true); + theRetToken=_returnToken; + break; + } + case 0x3b /* ';' */ : + { + mSEMI(true); + theRetToken=_returnToken; + break; + } + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + mIDENTIFIER(true); + theRetToken=_returnToken; + break; + } + case 0x27 /* '\'' */ : + { + mTIC_OR_CHARACTER_LITERAL(true); + theRetToken=_returnToken; + break; + } + case 0x22 /* '\"' */ : + { + mCHAR_STRING(true); + theRetToken=_returnToken; + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + mNUMERIC_LIT(true); + theRetToken=_returnToken; + break; + } + case 0x9 /* '\t' */ : + case 0xa /* '\n' */ : + case 0xc /* '\14' */ : + case 0xd /* '\r' */ : + case 0x20 /* ' ' */ : + { + mWS_(true); + theRetToken=_returnToken; + break; + } + default: + if ((LA(1) == 0x2d /* '-' */ ) && (LA(2) == 0x2d /* '-' */ ) && ((LA(3) >= 0x3 /* '\3' */ && LA(3) <= 0xff))) { + mCOMMENT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2d /* '-' */ ) && (LA(2) == 0x2d /* '-' */ ) && (true)) { + mCOMMENT_INTRO(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2e /* '.' */ ) && (LA(2) == 0x2e /* '.' */ )) { + mDOT_DOT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3c /* '<' */ )) { + mLT_LT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3e /* '>' */ )) { + mOX(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3e /* '>' */ )) { + mGT_GT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3d /* '=' */ ) && (LA(2) == 0x3e /* '>' */ )) { + mRIGHT_SHAFT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mNE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mLE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mGE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2a /* '*' */ ) && (LA(2) == 0x2a /* '*' */ )) { + mEXPON(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2e /* '.' */ ) && (true)) { + mDOT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3d /* '=' */ ) && (true)) { + mEQ(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (true)) { + mLT_(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (true)) { + mGT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2d /* '-' */ ) && (true)) { + mMINUS(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2a /* '*' */ ) && (true)) { + mSTAR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (true)) { + mDIV(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3a /* ':' */ ) && (true)) { + mCOLON(true); + theRetToken=_returnToken; + } + else { + if (LA(1)==EOF_CHAR) + { + uponEOF(); + _returnToken = makeToken(ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE); + } + else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + } + if ( !_returnToken ) + goto tryAgain; // found SKIP token + + _ttype = _returnToken->getType(); + _returnToken->setType(_ttype); + return _returnToken; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& e) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamRecognitionException(e); + } + catch (ANTLR_USE_NAMESPACE(antlr)CharStreamIOException& csie) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamIOException(csie.io); + } + catch (ANTLR_USE_NAMESPACE(antlr)CharStreamException& cse) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamException(cse.getMessage()); + } +tryAgain:; + } +} + +void AdaLexer::mCOMMENT_INTRO(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMENT_INTRO; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("--"); +#line 1888 "ada.g" + lastTokenWasTicCompatible=false; +#line 345 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mDOT_DOT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DOT_DOT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(".."); +#line 1889 "ada.g" + lastTokenWasTicCompatible=false; +#line 362 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mLT_LT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LT_LT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("<<"); +#line 1890 "ada.g" + lastTokenWasTicCompatible=false; +#line 379 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mOX(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = OX; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("<>"); +#line 1891 "ada.g" + lastTokenWasTicCompatible=false; +#line 396 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mGT_GT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = GT_GT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">>"); +#line 1892 "ada.g" + lastTokenWasTicCompatible=false; +#line 413 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(":="); +#line 1893 "ada.g" + lastTokenWasTicCompatible=false; +#line 430 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mRIGHT_SHAFT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = RIGHT_SHAFT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("=>"); +#line 1894 "ada.g" + lastTokenWasTicCompatible=false; +#line 447 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mNE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("/="); +#line 1895 "ada.g" + lastTokenWasTicCompatible=false; +#line 464 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mLE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("<="); +#line 1896 "ada.g" + lastTokenWasTicCompatible=false; +#line 481 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mGE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = GE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">="); +#line 1897 "ada.g" + lastTokenWasTicCompatible=false; +#line 498 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mEXPON(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EXPON; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("**"); +#line 1898 "ada.g" + lastTokenWasTicCompatible=false; +#line 515 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mPIPE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PIPE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('|' /* charlit */ ); +#line 1899 "ada.g" + lastTokenWasTicCompatible=false; +#line 532 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mCONCAT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CONCAT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('&' /* charlit */ ); +#line 1900 "ada.g" + lastTokenWasTicCompatible=false; +#line 549 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mDOT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DOT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('.' /* charlit */ ); +#line 1901 "ada.g" + lastTokenWasTicCompatible=false; +#line 566 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mEQ(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EQ; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('=' /* charlit */ ); +#line 1902 "ada.g" + lastTokenWasTicCompatible=false; +#line 583 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mLT_(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LT_; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('<' /* charlit */ ); +#line 1903 "ada.g" + lastTokenWasTicCompatible=false; +#line 600 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mGT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = GT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('>' /* charlit */ ); +#line 1904 "ada.g" + lastTokenWasTicCompatible=false; +#line 617 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mPLUS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PLUS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('+' /* charlit */ ); +#line 1905 "ada.g" + lastTokenWasTicCompatible=false; +#line 634 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mMINUS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MINUS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('-' /* charlit */ ); +#line 1906 "ada.g" + lastTokenWasTicCompatible=false; +#line 651 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mSTAR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STAR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('*' /* charlit */ ); +#line 1907 "ada.g" + lastTokenWasTicCompatible=false; +#line 668 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mDIV(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DIV; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('/' /* charlit */ ); +#line 1908 "ada.g" + lastTokenWasTicCompatible=false; +#line 685 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mLPAREN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LPAREN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('(' /* charlit */ ); +#line 1909 "ada.g" + lastTokenWasTicCompatible=false; +#line 702 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mRPAREN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = RPAREN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(')' /* charlit */ ); +#line 1910 "ada.g" + lastTokenWasTicCompatible=true; +#line 719 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mCOLON(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COLON; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(':' /* charlit */ ); +#line 1911 "ada.g" + lastTokenWasTicCompatible=false; +#line 736 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mCOMMA(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMA; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(',' /* charlit */ ); +#line 1912 "ada.g" + lastTokenWasTicCompatible=false; +#line 753 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mSEMI(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SEMI; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(';' /* charlit */ ); +#line 1913 "ada.g" + lastTokenWasTicCompatible=false; +#line 770 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mIDENTIFIER(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = IDENTIFIER; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + matchRange('a','z'); + } + { // ( ... )* + for (;;) { + if ((_tokenSet_0.member(LA(1)))) { + { + switch ( LA(1)) { + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + } + else { + goto _loop512; + } + + } + _loop512:; + } // ( ... )* + _ttype = testLiteralsTable(_ttype); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mTIC_OR_CHARACTER_LITERAL(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = TIC_OR_CHARACTER_LITERAL; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + _saveIndex = text.length(); + match("\'"); + text.erase(_saveIndex); +#line 1927 "ada.g" + _ttype = TIC; +#line 921 "AdaLexer.cpp" + { + if ((((LA(1) >= 0x3 /* '\3' */ && LA(1) <= 0xff)))&&( ! lastTokenWasTicCompatible )) { + matchNot(EOF/*_CHAR*/); + _saveIndex = text.length(); + match("\'"); + text.erase(_saveIndex); +#line 1929 "ada.g" + _ttype = CHARACTER_LITERAL; +#line 930 "AdaLexer.cpp" + } + else { + } + + } +#line 1931 "ada.g" + lastTokenWasTicCompatible=false; +#line 938 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mCHAR_STRING(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CHAR_STRING; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + _saveIndex = text.length(); + match('\"' /* charlit */ ); + text.erase(_saveIndex); + { // ( ... )* + for (;;) { + if ((LA(1) == 0x22 /* '\"' */ ) && (LA(2) == 0x22 /* '\"' */ )) { + match("\"\""); + } + else if ((_tokenSet_1.member(LA(1)))) { + { + match(_tokenSet_1); + } + } + else { + goto _loop518; + } + + } + _loop518:; + } // ( ... )* + _saveIndex = text.length(); + match('\"' /* charlit */ ); + text.erase(_saveIndex); +#line 1934 "ada.g" + lastTokenWasTicCompatible=true; +#line 977 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mNUMERIC_LIT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NUMERIC_LIT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { // ( ... )+ + int _cnt521=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt521>=1 ) { goto _loop521; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt521++; + } + _loop521:; + } // ( ... )+ + { + switch ( LA(1)) { + case 0x23 /* '#' */ : + { + match('#' /* charlit */ ); + mBASED_INTEGER(false); + { + switch ( LA(1)) { + case 0x2e /* '.' */ : + { + match('.' /* charlit */ ); + mBASED_INTEGER(false); + break; + } + case 0x23 /* '#' */ : + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + match('#' /* charlit */ ); + break; + } + case 0x5f /* '_' */ : + { + { // ( ... )+ + int _cnt527=0; + for (;;) { + if ((LA(1) == 0x5f /* '_' */ )) { + match('_' /* charlit */ ); + { // ( ... )+ + int _cnt526=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt526>=1 ) { goto _loop526; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt526++; + } + _loop526:; + } // ( ... )+ + } + else { + if ( _cnt527>=1 ) { goto _loop527; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt527++; + } + _loop527:; + } // ( ... )+ + break; + } + default: + { + } + } + } + { + if (((LA(1) == 0x2e /* '.' */ || LA(1) == 0x65 /* 'e' */ ))&&( LA(2)!='.' )) { + { + switch ( LA(1)) { + case 0x2e /* '.' */ : + { + match('.' /* charlit */ ); + { // ( ... )+ + int _cnt531=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt531>=1 ) { goto _loop531; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt531++; + } + _loop531:; + } // ( ... )+ + { // ( ... )* + for (;;) { + if ((LA(1) == 0x5f /* '_' */ )) { + match('_' /* charlit */ ); + { // ( ... )+ + int _cnt534=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt534>=1 ) { goto _loop534; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt534++; + } + _loop534:; + } // ( ... )+ + } + else { + goto _loop535; + } + + } + _loop535:; + } // ( ... )* + { + if ((LA(1) == 0x65 /* 'e' */ )) { + mEXPONENT(false); + } + else { + } + + } + break; + } + case 0x65 /* 'e' */ : + { + mEXPONENT(false); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + } + else { + } + + } +#line 1945 "ada.g" + lastTokenWasTicCompatible=false; +#line 1144 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mDIGIT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DIGIT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + matchRange('0','9'); + } +#line 1950 "ada.g" + lastTokenWasTicCompatible=false; +#line 1163 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mBASED_INTEGER(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BASED_INTEGER; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + mEXTENDED_DIGIT(false); + } + { // ( ... )* + for (;;) { + if ((_tokenSet_2.member(LA(1)))) { + { + switch ( LA(1)) { + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + mEXTENDED_DIGIT(false); + } + else { + goto _loop550; + } + + } + _loop550:; + } // ( ... )* +#line 1959 "ada.g" + lastTokenWasTicCompatible=false; +#line 1226 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mEXPONENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EXPONENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + match('e' /* charlit */ ); + } + { + switch ( LA(1)) { + case 0x2b /* '+' */ : + { + match('+' /* charlit */ ); + break; + } + case 0x2d /* '-' */ : + { + match('-' /* charlit */ ); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )+ + int _cnt543=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt543>=1 ) { goto _loop543; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt543++; + } + _loop543:; + } // ( ... )+ +#line 1953 "ada.g" + lastTokenWasTicCompatible=false; +#line 1290 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mEXTENDED_DIGIT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EXTENDED_DIGIT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + mDIGIT(false); + break; + } + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + { + matchRange('a','f'); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1956 "ada.g" + lastTokenWasTicCompatible=false; +#line 1338 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mWS_(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = WS_; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x20 /* ' ' */ : + { + match(' ' /* charlit */ ); + break; + } + case 0x9 /* '\t' */ : + { + match('\t' /* charlit */ ); + break; + } + case 0xc /* '\14' */ : + { + match('\14' /* charlit */ ); + break; + } + case 0xa /* '\n' */ : + case 0xd /* '\r' */ : + { + { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ )) { + match("\r\n"); + } + else if ((LA(1) == 0xd /* '\r' */ ) && (true)) { + match('\r' /* charlit */ ); + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } +#line 1971 "ada.g" + newline(); +#line 1389 "AdaLexer.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1973 "ada.g" + _ttype = antlr::Token::SKIP; +#line 1400 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void AdaLexer::mCOMMENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + mCOMMENT_INTRO(false); + { // ( ... )* + for (;;) { + if ((_tokenSet_3.member(LA(1)))) { + { + match(_tokenSet_3); + } + } + else { + goto _loop557; + } + + } + _loop557:; + } // ( ... )* + { + switch ( LA(1)) { + case 0xa /* '\n' */ : + { + match('\n' /* charlit */ ); + break; + } + case 0xd /* '\r' */ : + { + match('\r' /* charlit */ ); + { + if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); + } + else { + } + + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1978 "ada.g" + _ttype = antlr::Token::SKIP; + newline(); + lastTokenWasTicCompatible=false; +#line 1459 "AdaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + + +const unsigned long AdaLexer::_tokenSet_0_data_[] = { 0UL, 67043328UL, 2147483648UL, 134217726UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0 1 2 3 4 5 6 7 8 9 _ a b c d e f g h i j k l m n o p q r s t u v w +// x y z +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaLexer::_tokenSet_0(_tokenSet_0_data_,10); +const unsigned long AdaLexer::_tokenSet_1_data_[] = { 4294967288UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 +// 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! # $ +// % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F +// G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g +// h i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 +// 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 +// 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f +// 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad +// 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb +// 0xbc 0xbd 0xbe 0xbf 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 0xc8 0xc9 +// 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0 0xd1 0xd2 0xd3 0xd4 0xd5 0xd6 0xd7 +// 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf 0xe0 0xe1 0xe2 0xe3 0xe4 0xe5 +// 0xe6 0xe7 0xe8 0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf3 +// 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaLexer::_tokenSet_1(_tokenSet_1_data_,16); +const unsigned long AdaLexer::_tokenSet_2_data_[] = { 0UL, 67043328UL, 2147483648UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0 1 2 3 4 5 6 7 8 9 _ a b c d e f +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaLexer::_tokenSet_2(_tokenSet_2_data_,10); +const unsigned long AdaLexer::_tokenSet_3_data_[] = { 4294958072UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14 +// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # $ % +// & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G +// H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g h +// i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 +// 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 +// 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f +// 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad +// 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb +// 0xbc 0xbd 0xbe 0xbf 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 0xc8 0xc9 +// 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0 0xd1 0xd2 0xd3 0xd4 0xd5 0xd6 0xd7 +// 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf 0xe0 0xe1 0xe2 0xe3 0xe4 0xe5 +// 0xe6 0xe7 0xe8 0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf3 +// 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaLexer::_tokenSet_3(_tokenSet_3_data_,16); + diff --git a/languages/ada/AdaLexer.hpp b/languages/ada/AdaLexer.hpp new file mode 100644 index 00000000..795c7bba --- /dev/null +++ b/languages/ada/AdaLexer.hpp @@ -0,0 +1,86 @@ +#ifndef INC_AdaLexer_hpp_ +#define INC_AdaLexer_hpp_ + +#line 29 "ada.g" + +#include // antlr wants this +#include "AdaAST.hpp" +#include "preambles.h" + +#line 11 "AdaLexer.hpp" +#include +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaLexer.hpp"$ */ +#include +#include +#include +#include "AdaTokenTypes.hpp" +#include +class CUSTOM_API AdaLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public AdaTokenTypes +{ +#line 1879 "ada.g" + + ANTLR_LEXER_PREAMBLE + private: + bool lastTokenWasTicCompatible; +#line 22 "AdaLexer.hpp" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return false; + } +public: + AdaLexer(ANTLR_USE_NAMESPACE(std)istream& in); + AdaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + AdaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mCOMMENT_INTRO(bool _createToken); + public: void mDOT_DOT(bool _createToken); + public: void mLT_LT(bool _createToken); + public: void mOX(bool _createToken); + public: void mGT_GT(bool _createToken); + public: void mASSIGN(bool _createToken); + public: void mRIGHT_SHAFT(bool _createToken); + public: void mNE(bool _createToken); + public: void mLE(bool _createToken); + public: void mGE(bool _createToken); + public: void mEXPON(bool _createToken); + public: void mPIPE(bool _createToken); + public: void mCONCAT(bool _createToken); + public: void mDOT(bool _createToken); + public: void mEQ(bool _createToken); + public: void mLT_(bool _createToken); + public: void mGT(bool _createToken); + public: void mPLUS(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mDIV(bool _createToken); + public: void mLPAREN(bool _createToken); + public: void mRPAREN(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mSEMI(bool _createToken); + public: void mIDENTIFIER(bool _createToken); + public: void mTIC_OR_CHARACTER_LITERAL(bool _createToken); + public: void mCHAR_STRING(bool _createToken); + public: void mNUMERIC_LIT(bool _createToken); + protected: void mDIGIT(bool _createToken); + protected: void mBASED_INTEGER(bool _createToken); + protected: void mEXPONENT(bool _createToken); + protected: void mEXTENDED_DIGIT(bool _createToken); + public: void mWS_(bool _createToken); + public: void mCOMMENT(bool _createToken); +private: + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; +}; + +#endif /*INC_AdaLexer_hpp_*/ diff --git a/languages/ada/AdaParser.cpp b/languages/ada/AdaParser.cpp new file mode 100644 index 00000000..e783595e --- /dev/null +++ b/languages/ada/AdaParser.cpp @@ -0,0 +1,12283 @@ +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaParser.cpp"$ */ +#include "AdaParser.hpp" +#include +#include +#include +#line 1 "ada.g" +#line 8 "AdaParser.cpp" +AdaParser::AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k) +{ +} + +AdaParser::AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,2) +{ +} + +AdaParser::AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,k) +{ +} + +AdaParser::AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,2) +{ +} + +AdaParser::AdaParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(state,2) +{ +} + +void AdaParser::compilation_unit() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST compilation_unit_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + context_items_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case PRIVATE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case GENERIC: + { + library_item(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEPARATE: + { + subunit(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { // ( ... )* + for (;;) { + if ((LA(1) == PRAGMA)) { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop4; + } + + } + _loop4:; + } // ( ... )* + compilation_unit_AST = RefAdaAST(currentAST.root); + returnAST = compilation_unit_AST; +} + +void AdaParser::context_items_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST context_items_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case WITH: + { + with_clause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case USE: + { + use_clause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop14; + } + } + } + _loop14:; + } // ( ... )* + if ( inputState->guessing==0 ) { + context_items_opt_AST = RefAdaAST(currentAST.root); +#line 86 "ada.g" + context_items_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(CONTEXT_CLAUSE,"CONTEXT_CLAUSE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(context_items_opt_AST)))); +#line 135 "AdaParser.cpp" + currentAST.root = context_items_opt_AST; + if ( context_items_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + context_items_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = context_items_opt_AST->getFirstChild(); + else + currentAST.child = context_items_opt_AST; + currentAST.advanceChildToEnd(); + } + context_items_opt_AST = RefAdaAST(currentAST.root); + returnAST = context_items_opt_AST; +} + +void AdaParser::library_item() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST library_item_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + private_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case PACKAGE: + { + lib_pkg_spec_or_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + case FUNCTION: + { + subprog_decl_or_rename_or_inst_or_body(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case GENERIC: + { + generic_decl(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + library_item_AST = RefAdaAST(currentAST.root); +#line 133 "ada.g" + library_item_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(LIBRARY_ITEM,"LIBRARY_ITEM")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(library_item_AST)))); +#line 194 "AdaParser.cpp" + currentAST.root = library_item_AST; + if ( library_item_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + library_item_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = library_item_AST->getFirstChild(); + else + currentAST.child = library_item_AST; + currentAST.advanceChildToEnd(); + } + library_item_AST = RefAdaAST(currentAST.root); + returnAST = library_item_AST; +} + +void AdaParser::subunit() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subunit_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken sep = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST sep_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + sep = LT(1); + if ( inputState->guessing == 0 ) { + sep_AST = astFactory->create(sep); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(sep_AST)); + } + match(SEPARATE); + match(LPAREN); + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 1497 "ada.g" + Set(sep_AST, SUBUNIT); +#line 229 "AdaParser.cpp" + } + { + switch ( LA(1)) { + case PROCEDURE: + case FUNCTION: + { + subprogram_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PACKAGE: + { + package_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case TASK: + { + task_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROTECTED: + { + protected_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + subunit_AST = RefAdaAST(currentAST.root); + returnAST = subunit_AST; +} + +void AdaParser::pragma() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST pragma_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp3_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp3_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp3_AST)); + } + match(PRAGMA); + RefAdaAST tmp4_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp4_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp4_AST)); + } + match(IDENTIFIER); + pragma_args_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + pragma_AST = RefAdaAST(currentAST.root); + returnAST = pragma_AST; +} + +void AdaParser::pragma_args_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST pragma_args_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + pragma_arg(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + pragma_arg(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop9; + } + + } + _loop9:; + } // ( ... )* + match(RPAREN); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + pragma_args_opt_AST = RefAdaAST(currentAST.root); + returnAST = pragma_args_opt_AST; +} + +void AdaParser::pragma_arg() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST pragma_arg_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + if ((LA(1) == IDENTIFIER) && (LA(2) == RIGHT_SHAFT)) { + RefAdaAST tmp9_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp9_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp9_AST)); + } + match(IDENTIFIER); + RefAdaAST tmp10_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp10_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp10_AST)); + } + match(RIGHT_SHAFT); + } + else if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + pragma_arg_AST = RefAdaAST(currentAST.root); + returnAST = pragma_arg_AST; +} + +void AdaParser::expression() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST expression_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST a_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken o = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST o_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + relation(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case AND: + { + a = LT(1); + if ( inputState->guessing == 0 ) { + a_AST = astFactory->create(a); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(a_AST)); + } + match(AND); + { + switch ( LA(1)) { + case THEN: + { + match(THEN); + if ( inputState->guessing==0 ) { +#line 1417 "ada.g" + Set (a_AST, AND_THEN); +#line 416 "AdaParser.cpp" + } + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + relation(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case OR: + { + o = LT(1); + if ( inputState->guessing == 0 ) { + o_AST = astFactory->create(o); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(o_AST)); + } + match(OR); + { + switch ( LA(1)) { + case ELSE: + { + match(ELSE); + if ( inputState->guessing==0 ) { +#line 1418 "ada.g" + Set (o_AST, OR_ELSE); +#line 462 "AdaParser.cpp" + } + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + relation(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case XOR: + { + RefAdaAST tmp13_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp13_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp13_AST)); + } + match(XOR); + relation(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop450; + } + } + } + _loop450:; + } // ( ... )* + expression_AST = RefAdaAST(currentAST.root); + returnAST = expression_AST; +} + +void AdaParser::with_clause() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST with_clause_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken w = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST w_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + w = LT(1); + if ( inputState->guessing == 0 ) { + w_AST = astFactory->create(w); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(w_AST)); + } + match(WITH); + c_name_list(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 94 "ada.g" + Set(w_AST, WITH_CLAUSE); +#line 539 "AdaParser.cpp" + } + with_clause_AST = RefAdaAST(currentAST.root); + returnAST = with_clause_AST; +} + +void AdaParser::use_clause() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST use_clause_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken u = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST u_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + u = LT(1); + if ( inputState->guessing == 0 ) { + u_AST = astFactory->create(u); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(u_AST)); + } + match(USE); + { + switch ( LA(1)) { + case TYPE: + { + match(TYPE); + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop25; + } + + } + _loop25:; + } // ( ... )* + if ( inputState->guessing==0 ) { +#line 108 "ada.g" + Set(u_AST, USE_TYPE_CLAUSE); +#line 586 "AdaParser.cpp" + } + break; + } + case IDENTIFIER: + { + c_name_list(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 109 "ada.g" + Set(u_AST, USE_CLAUSE); +#line 599 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + use_clause_AST = RefAdaAST(currentAST.root); + returnAST = use_clause_AST; +} + +void AdaParser::c_name_list() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST c_name_list_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop18; + } + + } + _loop18:; + } // ( ... )* + c_name_list_AST = RefAdaAST(currentAST.root); + returnAST = c_name_list_AST; +} + +void AdaParser::compound_name() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST compound_name_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp19_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp19_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp19_AST)); + } + match(IDENTIFIER); + { // ( ... )* + for (;;) { + if ((LA(1) == DOT)) { + RefAdaAST tmp20_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp20_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp20_AST)); + } + match(DOT); + RefAdaAST tmp21_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp21_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp21_AST)); + } + match(IDENTIFIER); + } + else { + goto _loop21; + } + + } + _loop21:; + } // ( ... )* + compound_name_AST = RefAdaAST(currentAST.root); + returnAST = compound_name_AST; +} + +void AdaParser::subtype_mark() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subtype_mark_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case TIC: + { + RefAdaAST tmp22_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp22_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp22_AST)); + } + match(TIC); + attribute_id(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case LPAREN: + case COMMA: + case RPAREN: + case RIGHT_SHAFT: + case WITH: + case USE: + case RANGE: + case DIGITS: + case DELTA: + case IS: + case PIPE: + case DOT_DOT: + case RENAMES: + case ASSIGN: + case AT: + case THEN: + case LOOP: + case OR: + case AND: + case XOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + subtype_mark_AST = RefAdaAST(currentAST.root); + returnAST = subtype_mark_AST; +} + +void AdaParser::attribute_id() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST attribute_id_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case RANGE: + { + RefAdaAST tmp23_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp23_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp23_AST)); + } + match(RANGE); + attribute_id_AST = RefAdaAST(currentAST.root); + break; + } + case DIGITS: + { + RefAdaAST tmp24_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp24_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp24_AST)); + } + match(DIGITS); + attribute_id_AST = RefAdaAST(currentAST.root); + break; + } + case DELTA: + { + RefAdaAST tmp25_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp25_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp25_AST)); + } + match(DELTA); + attribute_id_AST = RefAdaAST(currentAST.root); + break; + } + case ACCESS: + { + RefAdaAST tmp26_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp26_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp26_AST)); + } + match(ACCESS); + attribute_id_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp27_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp27_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp27_AST)); + } + match(IDENTIFIER); + attribute_id_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = attribute_id_AST; +} + +void AdaParser::private_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST private_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PRIVATE: + { + RefAdaAST tmp28_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp28_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp28_AST)); + } + match(PRIVATE); + break; + } + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case GENERIC: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + private_opt_AST = RefAdaAST(currentAST.root); +#line 137 "ada.g" + private_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(private_opt_AST)))); +#line 843 "AdaParser.cpp" + currentAST.root = private_opt_AST; + if ( private_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + private_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = private_opt_AST->getFirstChild(); + else + currentAST.child = private_opt_AST; + currentAST.advanceChildToEnd(); + } + private_opt_AST = RefAdaAST(currentAST.root); + returnAST = private_opt_AST; +} + +void AdaParser::lib_pkg_spec_or_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST lib_pkg_spec_or_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken pkg = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST pkg_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + pkg = LT(1); + if ( inputState->guessing == 0 ) { + pkg_AST = astFactory->create(pkg); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(pkg_AST)); + } + match(PACKAGE); + { + switch ( LA(1)) { + case BODY: + { + match(BODY); + def_id(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + pkg_body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 143 "ada.g" + Set(pkg_AST, PACKAGE_BODY); +#line 887 "AdaParser.cpp" + } + break; + } + case IDENTIFIER: + { + def_id(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + spec_decl_part(pkg_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + lib_pkg_spec_or_body_AST = RefAdaAST(currentAST.root); + returnAST = lib_pkg_spec_or_body_AST; +} + +void AdaParser::subprog_decl_or_rename_or_inst_or_body( + boolean lib_level +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subprog_decl_or_rename_or_inst_or_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken f = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST f_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 944 "ada.g" + RefAdaAST t; +#line 925 "AdaParser.cpp" + + switch ( LA(1)) { + case PROCEDURE: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PROCEDURE); + def_id(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + if ((LA(1) == IS) && (LA(2) == NEW)) { + generic_subp_inst(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 948 "ada.g" + Set(p_AST, GENERIC_PROCEDURE_INSTANTIATION); +#line 949 "AdaParser.cpp" + } + } + else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2)))) { + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 950 "ada.g" + Set(p_AST, PROCEDURE_RENAMING_DECLARATION); +#line 968 "AdaParser.cpp" + } + break; + } + case IS: + { + match(IS); + { + switch ( LA(1)) { + case SEPARATE: + case ABSTRACT: + { + separate_or_abstract(p_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + case BEGIN: + { + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 952 "ada.g" + Set(p_AST, PROCEDURE_BODY); +#line 1007 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 954 "ada.g" + pop_def_id(); + Set(p_AST, PROCEDURE_DECLARATION); +#line 1025 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + subprog_decl_or_rename_or_inst_or_body_AST = RefAdaAST(currentAST.root); + break; + } + case FUNCTION: + { + f = LT(1); + if ( inputState->guessing == 0 ) { + f_AST = astFactory->create(f); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)); + } + match(FUNCTION); + def_designator(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IS: + { + generic_subp_inst(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 961 "ada.g" + Set(f_AST, GENERIC_FUNCTION_INSTANTIATION); +#line 1068 "AdaParser.cpp" + } + break; + } + case LPAREN: + case RETURN: + { + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 963 "ada.g" + Set(f_AST, FUNCTION_RENAMING_DECLARATION); +#line 1090 "AdaParser.cpp" + } + break; + } + case IS: + { + match(IS); + { + switch ( LA(1)) { + case SEPARATE: + case ABSTRACT: + { + separate_or_abstract(f_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + case BEGIN: + { + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 965 "ada.g" + Set(f_AST, FUNCTION_BODY); +#line 1129 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 967 "ada.g" + pop_def_id(); + Set(f_AST, FUNCTION_DECLARATION); +#line 1147 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + subprog_decl_or_rename_or_inst_or_body_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = subprog_decl_or_rename_or_inst_or_body_AST; +} + +void AdaParser::generic_decl( + boolean lib_level +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST generic_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken g = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST g_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + g = LT(1); + if ( inputState->guessing == 0 ) { + g_AST = astFactory->create(g); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(g_AST)); + } + match(GENERIC); + generic_formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case PACKAGE: + { + match(PACKAGE); + def_id(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 865 "ada.g" + Set(g_AST, GENERIC_PACKAGE_RENAMING); +#line 1216 "AdaParser.cpp" + } + break; + } + case IS: + { + match(IS); + pkg_spec_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 866 "ada.g" + Set(g_AST, GENERIC_PACKAGE_DECLARATION); +#line 1230 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case PROCEDURE: + { + match(PROCEDURE); + def_id(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 869 "ada.g" + Set(g_AST, GENERIC_PROCEDURE_RENAMING); +#line 1264 "AdaParser.cpp" + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 872 "ada.g" + Set(g_AST, GENERIC_PROCEDURE_DECLARATION); pop_def_id(); +#line 1273 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case FUNCTION: + { + match(FUNCTION); + def_designator(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 875 "ada.g" + Set(g_AST, GENERIC_FUNCTION_RENAMING); +#line 1307 "AdaParser.cpp" + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 878 "ada.g" + Set(g_AST, GENERIC_FUNCTION_DECLARATION); pop_def_id(); +#line 1316 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + generic_decl_AST = RefAdaAST(currentAST.root); + returnAST = generic_decl_AST; +} + +void AdaParser::def_id( + boolean lib_level +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST def_id_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefAdaAST cn_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken n = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + if (((LA(1) == IDENTIFIER) && (_tokenSet_4.member(LA(2))))&&( lib_level )) { + compound_name(); + if (inputState->guessing==0) { + cn_AST = returnAST; + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 171 "ada.g" + push_def_id(cn_AST); +#line 1358 "AdaParser.cpp" + } + def_id_AST = RefAdaAST(currentAST.root); + } + else if (((LA(1) == IDENTIFIER) && (_tokenSet_5.member(LA(2))))&&( !lib_level )) { + n = LT(1); + if ( inputState->guessing == 0 ) { + n_AST = astFactory->create(n); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(n_AST)); + } + match(IDENTIFIER); + if ( inputState->guessing==0 ) { +#line 172 "ada.g" + push_def_id(n_AST); +#line 1372 "AdaParser.cpp" + } + def_id_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = def_id_AST; +} + +void AdaParser::pkg_body_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST pkg_body_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + declarative_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + block_body_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + pkg_body_part_AST = RefAdaAST(currentAST.root); + returnAST = pkg_body_part_AST; +} + +void AdaParser::spec_decl_part( + RefAdaAST pkg +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST spec_decl_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case IS: + { + match(IS); + { + switch ( LA(1)) { + case NEW: + { + generic_inst(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 364 "ada.g" + Set(pkg, GENERIC_PACKAGE_INSTANTIATION); +#line 1427 "AdaParser.cpp" + } + break; + } + case PRAGMA: + case IDENTIFIER: + case USE: + case TYPE: + case PRIVATE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case END: + case SUBTYPE: + case GENERIC: + { + pkg_spec_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 365 "ada.g" + Set(pkg, PACKAGE_SPECIFICATION); +#line 1453 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 367 "ada.g" + Set(pkg, PACKAGE_RENAMING_DECLARATION); +#line 1474 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + spec_decl_part_AST = RefAdaAST(currentAST.root); + returnAST = spec_decl_part_AST; +} + +void AdaParser::subprog_decl( + boolean lib_level +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subprog_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken f = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST f_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 148 "ada.g" + RefAdaAST t; +#line 1501 "AdaParser.cpp" + + switch ( LA(1)) { + case PROCEDURE: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PROCEDURE); + def_id(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + if ((LA(1) == IS) && (LA(2) == NEW)) { + generic_subp_inst(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 152 "ada.g" + Set(p_AST, GENERIC_PROCEDURE_INSTANTIATION); +#line 1525 "AdaParser.cpp" + } + } + else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_6.member(LA(2)))) { + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 154 "ada.g" + Set(p_AST, PROCEDURE_RENAMING_DECLARATION); +#line 1544 "AdaParser.cpp" + } + break; + } + case SEMI: + case IS: + { + is_separate_or_abstract_or_decl(p_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + subprog_decl_AST = RefAdaAST(currentAST.root); + break; + } + case FUNCTION: + { + f = LT(1); + if ( inputState->guessing == 0 ) { + f_AST = astFactory->create(f); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)); + } + match(FUNCTION); + def_designator(lib_level); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IS: + { + generic_subp_inst(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 161 "ada.g" + Set(f_AST, GENERIC_FUNCTION_INSTANTIATION); +#line 1596 "AdaParser.cpp" + } + break; + } + case LPAREN: + case RETURN: + { + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RENAMES: + { + renames(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 163 "ada.g" + Set(f_AST, FUNCTION_RENAMING_DECLARATION); +#line 1618 "AdaParser.cpp" + } + break; + } + case SEMI: + case IS: + { + is_separate_or_abstract_or_decl(f_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + subprog_decl_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = subprog_decl_AST; +} + +void AdaParser::generic_subp_inst() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST generic_subp_inst_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(IS); + generic_inst(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + generic_subp_inst_AST = RefAdaAST(currentAST.root); + returnAST = generic_subp_inst_AST; +} + +void AdaParser::formal_part_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST formal_part_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + parameter_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + parameter_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop70; + } + + } + _loop70:; + } // ( ... )* + match(RPAREN); + break; + } + case SEMI: + case IS: + case RENAMES: + case WHEN: + case DO: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + formal_part_opt_AST = RefAdaAST(currentAST.root); +#line 235 "ada.g" + formal_part_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(FORMAL_PART_OPT,"FORMAL_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(formal_part_opt_AST)))); +#line 1723 "AdaParser.cpp" + currentAST.root = formal_part_opt_AST; + if ( formal_part_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + formal_part_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = formal_part_opt_AST->getFirstChild(); + else + currentAST.child = formal_part_opt_AST; + currentAST.advanceChildToEnd(); + } + formal_part_opt_AST = RefAdaAST(currentAST.root); + returnAST = formal_part_opt_AST; +} + +void AdaParser::renames() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST renames_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 258 "ada.g" + RefAdaAST dummy; +#line 1742 "AdaParser.cpp" + + match(RENAMES); + { + switch ( LA(1)) { + case IDENTIFIER: + { + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case CHAR_STRING: + { + dummy=definable_operator_symbol(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 262 "ada.g" + pop_def_id(); +#line 1772 "AdaParser.cpp" + } + renames_AST = RefAdaAST(currentAST.root); + returnAST = renames_AST; +} + +void AdaParser::is_separate_or_abstract_or_decl( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST is_separate_or_abstract_or_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case IS: + { + match(IS); + separate_or_abstract(t); + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 305 "ada.g" + pop_def_id(); + if (t->getType() == AdaTokenTypes::PROCEDURE) + Set(t, PROCEDURE_DECLARATION); + else + Set(t, FUNCTION_DECLARATION); + +#line 1802 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = is_separate_or_abstract_or_decl_AST; +} + +void AdaParser::def_designator( + boolean lib_level +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST def_designator_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 330 "ada.g" + RefAdaAST d; +#line 1823 "AdaParser.cpp" + + if (((LA(1) == IDENTIFIER) && (_tokenSet_7.member(LA(2))))&&( lib_level )) { + compound_name(); + if (inputState->guessing==0) { + n_AST = returnAST; + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 332 "ada.g" + push_def_id(n_AST); +#line 1834 "AdaParser.cpp" + } + def_designator_AST = RefAdaAST(currentAST.root); + } + else if (((LA(1) == IDENTIFIER || LA(1) == CHAR_STRING) && (LA(2) == LPAREN || LA(2) == IS || LA(2) == RETURN))&&( !lib_level )) { + d=designator(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 333 "ada.g" + push_def_id(d); +#line 1846 "AdaParser.cpp" + } + def_designator_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = def_designator_AST; +} + +void AdaParser::function_tail() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST function_tail_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + func_formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RETURN); + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + function_tail_AST = RefAdaAST(currentAST.root); + returnAST = function_tail_AST; +} + +void AdaParser::generic_inst() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST generic_inst_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(NEW); + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 179 "ada.g" + pop_def_id(); +#line 1910 "AdaParser.cpp" + } + generic_inst_AST = RefAdaAST(currentAST.root); + returnAST = generic_inst_AST; +} + +void AdaParser::value_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST value_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + value(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + value(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop445; + } + + } + _loop445:; + } // ( ... )* + if ( inputState->guessing==0 ) { + value_s_AST = RefAdaAST(currentAST.root); +#line 1405 "ada.g" + value_s_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(VALUES,"VALUES")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(value_s_AST)))); +#line 1945 "AdaParser.cpp" + currentAST.root = value_s_AST; + if ( value_s_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + value_s_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = value_s_AST->getFirstChild(); + else + currentAST.child = value_s_AST; + currentAST.advanceChildToEnd(); + } + value_s_AST = RefAdaAST(currentAST.root); + returnAST = value_s_AST; +} + +void AdaParser::parenth_values() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST parenth_values_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(LPAREN); + value(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + value(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop46; + } + + } + _loop46:; + } // ( ... )* + match(RPAREN); + parenth_values_AST = RefAdaAST(currentAST.root); + returnAST = parenth_values_AST; +} + +void AdaParser::value() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST value_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case OTHERS: + { + RefAdaAST tmp60_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp60_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp60_AST)); + } + match(OTHERS); + match(RIGHT_SHAFT); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + ranged_expr_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RIGHT_SHAFT: + { + RefAdaAST tmp62_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp62_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp62_AST)); + } + match(RIGHT_SHAFT); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case COMMA: + case RPAREN: + case WITH: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + value_AST = RefAdaAST(currentAST.root); + returnAST = value_AST; +} + +void AdaParser::ranged_expr_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST ranged_expr_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + ranged_expr(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == PIPE)) { + RefAdaAST tmp63_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp63_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp63_AST)); + } + match(PIPE); + ranged_expr(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop52; + } + + } + _loop52:; + } // ( ... )* + ranged_expr_s_AST = RefAdaAST(currentAST.root); + returnAST = ranged_expr_s_AST; +} + +void AdaParser::ranged_expr() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST ranged_expr_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case DOT_DOT: + { + RefAdaAST tmp64_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp64_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp64_AST)); + } + match(DOT_DOT); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RANGE: + { + RefAdaAST tmp65_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp65_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp65_AST)); + } + match(RANGE); + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case COMMA: + case RPAREN: + case RIGHT_SHAFT: + case WITH: + case PIPE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + ranged_expr_AST = RefAdaAST(currentAST.root); + returnAST = ranged_expr_AST; +} + +void AdaParser::simple_expression() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST simple_expression_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + signed_term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PLUS: + { + RefAdaAST tmp66_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp66_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp66_AST)); + } + match(PLUS); + signed_term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case MINUS: + { + RefAdaAST tmp67_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp67_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp67_AST)); + } + match(MINUS); + signed_term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case CONCAT: + { + RefAdaAST tmp68_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp68_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp68_AST)); + } + match(CONCAT); + signed_term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop458; + } + } + } + _loop458:; + } // ( ... )* + simple_expression_AST = RefAdaAST(currentAST.root); + returnAST = simple_expression_AST; +} + +void AdaParser::range() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST range_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + bool synPredMatched59 = false; + if (((_tokenSet_0.member(LA(1))) && (_tokenSet_8.member(LA(2))))) { + int _m59 = mark(); + synPredMatched59 = true; + inputState->guessing++; + try { + { + range_dots(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched59 = false; + } + rewind(_m59); + inputState->guessing--; + } + if ( synPredMatched59 ) { + range_dots(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == IDENTIFIER) && (LA(2) == LPAREN || LA(2) == DOT || LA(2) == TIC)) { + range_attrib_ref(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + range_AST = RefAdaAST(currentAST.root); + returnAST = range_AST; +} + +void AdaParser::range_constraint() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST range_constraint_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken r = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST r_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + r = LT(1); + if ( inputState->guessing == 0 ) { + r_AST = astFactory->create(r); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(r_AST)); + } + match(RANGE); + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 203 "ada.g" + Set(r_AST, RANGE_CONSTRAINT); +#line 2287 "AdaParser.cpp" + } + range_constraint_AST = RefAdaAST(currentAST.root); + returnAST = range_constraint_AST; +} + +void AdaParser::range_dots() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST range_dots_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + RefAdaAST tmp69_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp69_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp69_AST)); + } + match(DOT_DOT); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_dots_AST = RefAdaAST(currentAST.root); + returnAST = range_dots_AST; +} + +void AdaParser::range_attrib_ref() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST range_attrib_ref_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken r = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST r_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + prefix(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(TIC); + r = LT(1); + if ( inputState->guessing == 0 ) { + r_AST = astFactory->create(r); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(r_AST)); + } + match(RANGE); + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + break; + } + case SEMI: + case COMMA: + case RPAREN: + case RIGHT_SHAFT: + case WITH: + case RANGE: + case DIGITS: + case IS: + case PIPE: + case DOT_DOT: + case ASSIGN: + case THEN: + case LOOP: + case OR: + case AND: + case XOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 219 "ada.g" + Set(r_AST, RANGE_ATTRIBUTE_REFERENCE); +#line 2374 "AdaParser.cpp" + } + range_attrib_ref_AST = RefAdaAST(currentAST.root); + returnAST = range_attrib_ref_AST; +} + +void AdaParser::prefix() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prefix_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp73_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp73_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp73_AST)); + } + match(IDENTIFIER); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case DOT: + { + RefAdaAST tmp74_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp74_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp74_AST)); + } + match(DOT); + { + switch ( LA(1)) { + case ALL: + { + RefAdaAST tmp75_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp75_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp75_AST)); + } + match(ALL); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp76_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp76_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp76_AST)); + } + match(IDENTIFIER); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case LPAREN: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(LPAREN); + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 228 "ada.g" + Set(p_AST, INDEXED_COMPONENT); +#line 2450 "AdaParser.cpp" + } + break; + } + default: + { + goto _loop66; + } + } + } + _loop66:; + } // ( ... )* + prefix_AST = RefAdaAST(currentAST.root); + returnAST = prefix_AST; +} + +void AdaParser::parameter_specification() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST parameter_specification_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + def_ids_colon(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + mode_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + init_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + parameter_specification_AST = RefAdaAST(currentAST.root); +#line 240 "ada.g" + parameter_specification_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PARAMETER_SPECIFICATION,"PARAMETER_SPECIFICATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(parameter_specification_AST)))); +#line 2492 "AdaParser.cpp" + currentAST.root = parameter_specification_AST; + if ( parameter_specification_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + parameter_specification_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = parameter_specification_AST->getFirstChild(); + else + currentAST.child = parameter_specification_AST; + currentAST.advanceChildToEnd(); + } + parameter_specification_AST = RefAdaAST(currentAST.root); + returnAST = parameter_specification_AST; +} + +void AdaParser::def_ids_colon() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST def_ids_colon_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + defining_identifier_list(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + def_ids_colon_AST = RefAdaAST(currentAST.root); + returnAST = def_ids_colon_AST; +} + +void AdaParser::mode_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST mode_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case IN: + { + RefAdaAST tmp79_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp79_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp79_AST)); + } + match(IN); + { + switch ( LA(1)) { + case OUT: + { + RefAdaAST tmp80_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp80_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp80_AST)); + } + match(OUT); + break; + } + case IDENTIFIER: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case OUT: + { + RefAdaAST tmp81_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp81_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp81_AST)); + } + match(OUT); + break; + } + case ACCESS: + { + RefAdaAST tmp82_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp82_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp82_AST)); + } + match(ACCESS); + break; + } + case IDENTIFIER: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + mode_opt_AST = RefAdaAST(currentAST.root); +#line 255 "ada.g" + mode_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(mode_opt_AST)))); +#line 2592 "AdaParser.cpp" + currentAST.root = mode_opt_AST; + if ( mode_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + mode_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = mode_opt_AST->getFirstChild(); + else + currentAST.child = mode_opt_AST; + currentAST.advanceChildToEnd(); + } + mode_opt_AST = RefAdaAST(currentAST.root); + returnAST = mode_opt_AST; +} + +void AdaParser::init_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST init_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ASSIGN: + { + match(ASSIGN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case RPAREN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + init_opt_AST = RefAdaAST(currentAST.root); +#line 468 "ada.g" + init_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(INIT_OPT,"INIT_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(init_opt_AST)))); +#line 2636 "AdaParser.cpp" + currentAST.root = init_opt_AST; + if ( init_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + init_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = init_opt_AST->getFirstChild(); + else + currentAST.child = init_opt_AST; + currentAST.advanceChildToEnd(); + } + init_opt_AST = RefAdaAST(currentAST.root); + returnAST = init_opt_AST; +} + +void AdaParser::defining_identifier_list() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST defining_identifier_list_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp84_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp84_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp84_AST)); + } + match(IDENTIFIER); + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + RefAdaAST tmp86_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp86_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp86_AST)); + } + match(IDENTIFIER); + } + else { + goto _loop75; + } + + } + _loop75:; + } // ( ... )* + if ( inputState->guessing==0 ) { + defining_identifier_list_AST = RefAdaAST(currentAST.root); +#line 249 "ada.g" + defining_identifier_list_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DEFINING_IDENTIFIER_LIST,"DEFINING_IDENTIFIER_LIST")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(defining_identifier_list_AST)))); +#line 2683 "AdaParser.cpp" + currentAST.root = defining_identifier_list_AST; + if ( defining_identifier_list_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + defining_identifier_list_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = defining_identifier_list_AST->getFirstChild(); + else + currentAST.child = defining_identifier_list_AST; + currentAST.advanceChildToEnd(); + } + defining_identifier_list_AST = RefAdaAST(currentAST.root); + returnAST = defining_identifier_list_AST; +} + +void AdaParser::name() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST name_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 265 "ada.g" + RefAdaAST dummy; +#line 2704 "AdaParser.cpp" + + RefAdaAST tmp87_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp87_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp87_AST)); + } + match(IDENTIFIER); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case DOT: + { + RefAdaAST tmp88_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp88_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp88_AST)); + } + match(DOT); + { + switch ( LA(1)) { + case ALL: + { + RefAdaAST tmp89_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp89_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp89_AST)); + } + match(ALL); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp90_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp90_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp90_AST)); + } + match(IDENTIFIER); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp91_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp91_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp91_AST)); + } + match(CHARACTER_LITERAL); + break; + } + case CHAR_STRING: + { + dummy=is_operator(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case LPAREN: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(LPAREN); + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 273 "ada.g" + Set(p_AST, INDEXED_COMPONENT); +#line 2787 "AdaParser.cpp" + } + break; + } + case TIC: + { + RefAdaAST tmp93_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp93_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp93_AST)); + } + match(TIC); + attribute_id(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop84; + } + } + } + _loop84:; + } // ( ... )* + name_AST = RefAdaAST(currentAST.root); + returnAST = name_AST; +} + +RefAdaAST AdaParser::definable_operator_symbol() { +#line 285 "ada.g" + RefAdaAST d; +#line 2820 "AdaParser.cpp" + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST definable_operator_symbol_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken op = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST op_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + if (!( definable_operator(LT(1)->getText().c_str()) )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" definable_operator(LT(1)->getText().c_str()) "); + op = LT(1); + if ( inputState->guessing == 0 ) { + op_AST = astFactory->create(op); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(op_AST)); + } + match(CHAR_STRING); + if ( inputState->guessing==0 ) { +#line 287 "ada.g" + op_AST->setType(OPERATOR_SYMBOL); d=op_AST; +#line 2838 "AdaParser.cpp" + } + definable_operator_symbol_AST = RefAdaAST(currentAST.root); + returnAST = definable_operator_symbol_AST; + return d; +} + +RefAdaAST AdaParser::is_operator() { +#line 280 "ada.g" + RefAdaAST d; +#line 2848 "AdaParser.cpp" + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST is_operator_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken op = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST op_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + if (!( is_operator_symbol(LT(1)->getText().c_str()) )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" is_operator_symbol(LT(1)->getText().c_str()) "); + op = LT(1); + if ( inputState->guessing == 0 ) { + op_AST = astFactory->create(op); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(op_AST)); + } + match(CHAR_STRING); + if ( inputState->guessing==0 ) { +#line 282 "ada.g" + op_AST->setType(OPERATOR_SYMBOL); d=op_AST; +#line 2866 "AdaParser.cpp" + } + is_operator_AST = RefAdaAST(currentAST.root); + returnAST = is_operator_AST; + return d; +} + +void AdaParser::parenthesized_primary() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST parenthesized_primary_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken pp = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST pp_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + pp = LT(1); + if ( inputState->guessing == 0 ) { + pp_AST = astFactory->create(pp); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(pp_AST)); + } + match(LPAREN); + { + if ((LA(1) == NuLL) && (LA(2) == RECORD)) { + RefAdaAST tmp94_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp94_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp94_AST)); + } + match(NuLL); + match(RECORD); + } + else if ((_tokenSet_9.member(LA(1))) && (_tokenSet_10.member(LA(2)))) { + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + extension_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 295 "ada.g" + Set(pp_AST, PARENTHESIZED_PRIMARY); +#line 2915 "AdaParser.cpp" + } + parenthesized_primary_AST = RefAdaAST(currentAST.root); + returnAST = parenthesized_primary_AST; +} + +void AdaParser::extension_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST extension_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case WITH: + { + match(WITH); + { + if ((LA(1) == NuLL) && (LA(2) == RECORD)) { + RefAdaAST tmp98_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp98_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp98_AST)); + } + match(NuLL); + match(RECORD); + } + else if ((_tokenSet_9.member(LA(1))) && (_tokenSet_11.member(LA(2)))) { + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + break; + } + case RPAREN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + extension_opt_AST = RefAdaAST(currentAST.root); +#line 299 "ada.g" + extension_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(EXTENSION_OPT,"EXTENSION_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(extension_opt_AST)))); +#line 2969 "AdaParser.cpp" + currentAST.root = extension_opt_AST; + if ( extension_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + extension_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = extension_opt_AST->getFirstChild(); + else + currentAST.child = extension_opt_AST; + currentAST.advanceChildToEnd(); + } + extension_opt_AST = RefAdaAST(currentAST.root); + returnAST = extension_opt_AST; +} + +void AdaParser::separate_or_abstract( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST separate_or_abstract_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case SEPARATE: + { + match(SEPARATE); + if ( inputState->guessing==0 ) { +#line 315 "ada.g" + pop_def_id(); + if (t->getType() == AdaTokenTypes::PROCEDURE) + Set(t, PROCEDURE_BODY_STUB); + else + Set(t, FUNCTION_BODY_STUB); + +#line 3001 "AdaParser.cpp" + } + break; + } + case ABSTRACT: + { + match(ABSTRACT); + if ( inputState->guessing==0 ) { +#line 322 "ada.g" + pop_def_id(); + if (t->getType() == AdaTokenTypes::PROCEDURE) + Set(t, ABSTRACT_PROCEDURE_DECLARATION); + else + Set(t, ABSTRACT_FUNCTION_DECLARATION); + +#line 3016 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = separate_or_abstract_AST; +} + +RefAdaAST AdaParser::designator() { +#line 336 "ada.g" + RefAdaAST d; +#line 3031 "AdaParser.cpp" + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST designator_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken n = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 336 "ada.g" + RefAdaAST op; +#line 3039 "AdaParser.cpp" + + switch ( LA(1)) { + case CHAR_STRING: + { + op=definable_operator_symbol(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 338 "ada.g" + d = op; +#line 3051 "AdaParser.cpp" + } + designator_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + { + n = LT(1); + if ( inputState->guessing == 0 ) { + n_AST = astFactory->create(n); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(n_AST)); + } + match(IDENTIFIER); + if ( inputState->guessing==0 ) { +#line 339 "ada.g" + d = n_AST; +#line 3067 "AdaParser.cpp" + } + designator_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = designator_AST; + return d; +} + +void AdaParser::func_formal_part_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST func_formal_part_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + func_param(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + func_param(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop100; + } + + } + _loop100:; + } // ( ... )* + match(RPAREN); + break; + } + case RETURN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + func_formal_part_opt_AST = RefAdaAST(currentAST.root); +#line 348 "ada.g" + func_formal_part_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(FORMAL_PART_OPT,"FORMAL_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(func_formal_part_opt_AST)))); +#line 3129 "AdaParser.cpp" + currentAST.root = func_formal_part_opt_AST; + if ( func_formal_part_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + func_formal_part_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = func_formal_part_opt_AST->getFirstChild(); + else + currentAST.child = func_formal_part_opt_AST; + currentAST.advanceChildToEnd(); + } + func_formal_part_opt_AST = RefAdaAST(currentAST.root); + returnAST = func_formal_part_opt_AST; +} + +void AdaParser::func_param() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST func_param_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + def_ids_colon(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + in_access_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + init_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + func_param_AST = RefAdaAST(currentAST.root); +#line 354 "ada.g" + func_param_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PARAMETER_SPECIFICATION,"PARAMETER_SPECIFICATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(func_param_AST)))); +#line 3168 "AdaParser.cpp" + currentAST.root = func_param_AST; + if ( func_param_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + func_param_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = func_param_AST->getFirstChild(); + else + currentAST.child = func_param_AST; + currentAST.advanceChildToEnd(); + } + func_param_AST = RefAdaAST(currentAST.root); + returnAST = func_param_AST; +} + +void AdaParser::in_access_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST in_access_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case IN: + { + RefAdaAST tmp105_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp105_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp105_AST)); + } + match(IN); + break; + } + case ACCESS: + { + RefAdaAST tmp106_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp106_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp106_AST)); + } + match(ACCESS); + break; + } + case IDENTIFIER: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + in_access_opt_AST = RefAdaAST(currentAST.root); +#line 360 "ada.g" + in_access_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(in_access_opt_AST)))); +#line 3222 "AdaParser.cpp" + currentAST.root = in_access_opt_AST; + if ( in_access_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + in_access_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = in_access_opt_AST->getFirstChild(); + else + currentAST.child = in_access_opt_AST; + currentAST.advanceChildToEnd(); + } + in_access_opt_AST = RefAdaAST(currentAST.root); + returnAST = in_access_opt_AST; +} + +void AdaParser::pkg_spec_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST pkg_spec_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + basic_declarative_items_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + private_declarative_items_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + pkg_spec_part_AST = RefAdaAST(currentAST.root); + returnAST = pkg_spec_part_AST; +} + +void AdaParser::basic_declarative_items_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST basic_declarative_items_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + { + basic_decl_item(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop114; + } + } + } + _loop114:; + } // ( ... )* + if ( inputState->guessing==0 ) { + basic_declarative_items_opt_AST = RefAdaAST(currentAST.root); +#line 385 "ada.g" + basic_declarative_items_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(BASIC_DECLARATIVE_ITEMS_OPT,"BASIC_DECLARATIVE_ITEMS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(basic_declarative_items_opt_AST)))); +#line 3303 "AdaParser.cpp" + currentAST.root = basic_declarative_items_opt_AST; + if ( basic_declarative_items_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + basic_declarative_items_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = basic_declarative_items_opt_AST->getFirstChild(); + else + currentAST.child = basic_declarative_items_opt_AST; + currentAST.advanceChildToEnd(); + } + basic_declarative_items_opt_AST = RefAdaAST(currentAST.root); + returnAST = basic_declarative_items_opt_AST; +} + +void AdaParser::private_declarative_items_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST private_declarative_items_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + { + basic_decl_item(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop111; + } + } + } + _loop111:; + } // ( ... )* + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + private_declarative_items_opt_AST = RefAdaAST(currentAST.root); +#line 378 "ada.g" + private_declarative_items_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PRIVATE_DECLARATIVE_ITEMS_OPT,"PRIVATE_DECLARATIVE_ITEMS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(private_declarative_items_opt_AST)))); +#line 3380 "AdaParser.cpp" + currentAST.root = private_declarative_items_opt_AST; + if ( private_declarative_items_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + private_declarative_items_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = private_declarative_items_opt_AST->getFirstChild(); + else + currentAST.child = private_declarative_items_opt_AST; + currentAST.advanceChildToEnd(); + } + private_declarative_items_opt_AST = RefAdaAST(currentAST.root); + returnAST = private_declarative_items_opt_AST; +} + +void AdaParser::end_id_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST end_id_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken e = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST e_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + e = LT(1); + if ( inputState->guessing == 0 ) { + e_AST = astFactory->create(e); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(e_AST)); + } + match(END); + id_opt_aux(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1176 "ada.g" + Set(e_AST, END_ID_OPT); +#line 3413 "AdaParser.cpp" + } + end_id_opt_AST = RefAdaAST(currentAST.root); + returnAST = end_id_opt_AST; +} + +void AdaParser::basic_decl_item() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST basic_decl_item_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken pkg = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST pkg_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken tsk = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST tsk_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken pro = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST pro_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case PACKAGE: + { + pkg = LT(1); + if ( inputState->guessing == 0 ) { + pkg_AST = astFactory->create(pkg); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(pkg_AST)); + } + match(PACKAGE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + spec_decl_part(pkg_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + basic_decl_item_AST = RefAdaAST(currentAST.root); + break; + } + case TASK: + { + tsk = LT(1); + if ( inputState->guessing == 0 ) { + tsk_AST = astFactory->create(tsk); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tsk_AST)); + } + match(TASK); + task_type_or_single_decl(tsk_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + basic_decl_item_AST = RefAdaAST(currentAST.root); + break; + } + case PROTECTED: + { + pro = LT(1); + if ( inputState->guessing == 0 ) { + pro_AST = astFactory->create(pro); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(pro_AST)); + } + match(PROTECTED); + prot_type_or_single_decl(pro_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + basic_decl_item_AST = RefAdaAST(currentAST.root); + break; + } + case PROCEDURE: + case FUNCTION: + { + subprog_decl(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + basic_decl_item_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + case USE: + case TYPE: + case FOR: + case SUBTYPE: + case GENERIC: + { + decl_common(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + basic_decl_item_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = basic_decl_item_AST; +} + +void AdaParser::basic_declarative_items() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST basic_declarative_items_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )+ + int _cnt117=0; + for (;;) { + switch ( LA(1)) { + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + { + basic_decl_item(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + if ( _cnt117>=1 ) { goto _loop117; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + } + _cnt117++; + } + _loop117:; + } // ( ... )+ + if ( inputState->guessing==0 ) { + basic_declarative_items_AST = RefAdaAST(currentAST.root); +#line 392 "ada.g" + basic_declarative_items_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(BASIC_DECLARATIVE_ITEMS_OPT,"BASIC_DECLARATIVE_ITEMS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(basic_declarative_items_AST)))); +#line 3562 "AdaParser.cpp" + currentAST.root = basic_declarative_items_AST; + if ( basic_declarative_items_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + basic_declarative_items_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = basic_declarative_items_AST->getFirstChild(); + else + currentAST.child = basic_declarative_items_AST; + currentAST.advanceChildToEnd(); + } + basic_declarative_items_AST = RefAdaAST(currentAST.root); + returnAST = basic_declarative_items_AST; +} + +void AdaParser::task_type_or_single_decl( + RefAdaAST tsk +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST task_type_or_single_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case TYPE: + { + match(TYPE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrim_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + task_definition_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 408 "ada.g" + Set(tsk, TASK_TYPE_DECLARATION); +#line 3601 "AdaParser.cpp" + } + task_type_or_single_decl_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + { + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + task_definition_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 410 "ada.g" + Set(tsk, SINGLE_TASK_DECLARATION); +#line 3619 "AdaParser.cpp" + } + task_type_or_single_decl_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = task_type_or_single_decl_AST; +} + +void AdaParser::prot_type_or_single_decl( + RefAdaAST pro +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prot_type_or_single_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case TYPE: + { + match(TYPE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrim_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + protected_definition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 539 "ada.g" + Set(pro, PROTECTED_TYPE_DECLARATION); +#line 3658 "AdaParser.cpp" + } + prot_type_or_single_decl_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + { + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + protected_definition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 541 "ada.g" + Set(pro, SINGLE_PROTECTED_DECLARATION); +#line 3676 "AdaParser.cpp" + } + prot_type_or_single_decl_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = prot_type_or_single_decl_AST; +} + +void AdaParser::decl_common() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST decl_common_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken t = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST t_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken r = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST r_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken erd = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST erd_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken ord = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST ord_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken od = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST od_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case TYPE: + { + t = LT(1); + if ( inputState->guessing == 0 ) { + t_AST = astFactory->create(t); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(t_AST)); + } + match(TYPE); + RefAdaAST tmp111_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp111_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp111_AST)); + } + match(IDENTIFIER); + { + switch ( LA(1)) { + case IS: + { + match(IS); + type_def(t_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case LPAREN: + { + { + switch ( LA(1)) { + case LPAREN: + { + discrim_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IS: + { + match(IS); + derived_or_private_or_record(t_AST, true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 587 "ada.g" + Set(t_AST, INCOMPLETE_TYPE_DECLARATION); +#line 3759 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case SEMI: + { + empty_discrim_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 590 "ada.g" + Set(t_AST, INCOMPLETE_TYPE_DECLARATION); +#line 3780 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + decl_common_AST = RefAdaAST(currentAST.root); + break; + } + case SUBTYPE: + { + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(SUBTYPE); + RefAdaAST tmp115_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp115_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp115_AST)); + } + match(IDENTIFIER); + match(IS); + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 604 "ada.g" + Set(s_AST, SUBTYPE_DECLARATION); +#line 3825 "AdaParser.cpp" + } + decl_common_AST = RefAdaAST(currentAST.root); + break; + } + case GENERIC: + { + generic_decl(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + decl_common_AST = RefAdaAST(currentAST.root); + break; + } + case USE: + { + use_clause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + decl_common_AST = RefAdaAST(currentAST.root); + break; + } + case FOR: + { + r = LT(1); + if ( inputState->guessing == 0 ) { + r_AST = astFactory->create(r); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(r_AST)); + } + match(FOR); + { + bool synPredMatched184 = false; + if (((LA(1) == IDENTIFIER) && (LA(2) == USE))) { + int _m184 = mark(); + synPredMatched184 = true; + inputState->guessing++; + try { + { + local_enum_name(); + match(USE); + match(LPAREN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched184 = false; + } + rewind(_m184); + inputState->guessing--; + } + if ( synPredMatched184 ) { + local_enum_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(USE); + enumeration_aggregate(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 609 "ada.g" + Set(r_AST, ENUMERATION_REPESENTATION_CLAUSE); +#line 3888 "AdaParser.cpp" + } + } + else if ((LA(1) == IDENTIFIER) && (LA(2) == DOT || LA(2) == USE || LA(2) == TIC)) { + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(USE); + rep_spec_part(r_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + match(SEMI); + decl_common_AST = RefAdaAST(currentAST.root); + break; + } + default: + bool synPredMatched186 = false; + if (((LA(1) == IDENTIFIER) && (LA(2) == COLON))) { + int _m186 = mark(); + synPredMatched186 = true; + inputState->guessing++; + try { + { + match(IDENTIFIER); + match(COLON); + match(EXCEPTION); + match(RENAMES); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched186 = false; + } + rewind(_m186); + inputState->guessing--; + } + if ( synPredMatched186 ) { + RefAdaAST tmp121_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp121_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp121_AST)); + } + match(IDENTIFIER); + erd = LT(1); + if ( inputState->guessing == 0 ) { + erd_AST = astFactory->create(erd); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(erd_AST)); + } + match(COLON); + match(EXCEPTION); + match(RENAMES); + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 615 "ada.g" + Set(erd_AST, EXCEPTION_RENAMING_DECLARATION); +#line 3954 "AdaParser.cpp" + } + decl_common_AST = RefAdaAST(currentAST.root); + } + else { + bool synPredMatched188 = false; + if (((LA(1) == IDENTIFIER) && (LA(2) == COLON))) { + int _m188 = mark(); + synPredMatched188 = true; + inputState->guessing++; + try { + { + match(IDENTIFIER); + match(COLON); + subtype_mark(); + match(RENAMES); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched188 = false; + } + rewind(_m188); + inputState->guessing--; + } + if ( synPredMatched188 ) { + RefAdaAST tmp125_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp125_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp125_AST)); + } + match(IDENTIFIER); + ord = LT(1); + if ( inputState->guessing == 0 ) { + ord_AST = astFactory->create(ord); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(ord_AST)); + } + match(COLON); + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RENAMES); + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 618 "ada.g" + Set(ord_AST, OBJECT_RENAMING_DECLARATION); +#line 4004 "AdaParser.cpp" + } + decl_common_AST = RefAdaAST(currentAST.root); + } + else if ((LA(1) == IDENTIFIER) && (LA(2) == COMMA || LA(2) == COLON)) { + defining_identifier_list(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + od = LT(1); + if ( inputState->guessing == 0 ) { + od_AST = astFactory->create(od); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(od_AST)); + } + match(COLON); + { + if ((LA(1) == EXCEPTION)) { + match(EXCEPTION); + if ( inputState->guessing==0 ) { +#line 621 "ada.g" + Set(od_AST, EXCEPTION_DECLARATION); +#line 4025 "AdaParser.cpp" + } + } + else { + bool synPredMatched191 = false; + if (((LA(1) == CONSTANT) && (LA(2) == ASSIGN))) { + int _m191 = mark(); + synPredMatched191 = true; + inputState->guessing++; + try { + { + match(CONSTANT); + match(ASSIGN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched191 = false; + } + rewind(_m191); + inputState->guessing--; + } + if ( synPredMatched191 ) { + match(CONSTANT); + match(ASSIGN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 623 "ada.g" + Set(od_AST, NUMBER_DECLARATION); +#line 4056 "AdaParser.cpp" + } + } + else if ((_tokenSet_12.member(LA(1))) && (_tokenSet_13.member(LA(2)))) { + aliased_constant_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case ARRAY: + { + array_type_definition(od_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + init_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 626 "ada.g" + Set(od_AST, ARRAY_OBJECT_DECLARATION); +#line 4079 "AdaParser.cpp" + } + break; + } + case IDENTIFIER: + { + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + init_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 630 "ada.g" + Set(od_AST, OBJECT_DECLARATION); +#line 4096 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + decl_common_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + }} + returnAST = decl_common_AST; +} + +void AdaParser::discrim_part_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrim_part_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case LPAREN: + { + discrim_part_text(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case IS: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + discrim_part_opt_AST = RefAdaAST(currentAST.root); +#line 420 "ada.g" + discrim_part_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIM_PART_OPT,"DISCRIM_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(discrim_part_opt_AST)))); +#line 4153 "AdaParser.cpp" + currentAST.root = discrim_part_opt_AST; + if ( discrim_part_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + discrim_part_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = discrim_part_opt_AST->getFirstChild(); + else + currentAST.child = discrim_part_opt_AST; + currentAST.advanceChildToEnd(); + } + discrim_part_opt_AST = RefAdaAST(currentAST.root); + returnAST = discrim_part_opt_AST; +} + +void AdaParser::task_definition_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST task_definition_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case IS: + { + match(IS); + task_items_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + private_task_items_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + task_definition_opt_AST = RefAdaAST(currentAST.root); + break; + } + case SEMI: + { + match(SEMI); + if ( inputState->guessing==0 ) { +#line 415 "ada.g" + pop_def_id(); +#line 4197 "AdaParser.cpp" + } + task_definition_opt_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = task_definition_opt_AST; +} + +void AdaParser::task_items_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST task_items_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + if ((LA(1) == PRAGMA)) { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop138; + } + + } + _loop138:; + } // ( ... )* + entrydecls_repspecs_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + task_items_opt_AST = RefAdaAST(currentAST.root); +#line 473 "ada.g" + task_items_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TASK_ITEMS_OPT,"TASK_ITEMS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(task_items_opt_AST)))); +#line 4239 "AdaParser.cpp" + currentAST.root = task_items_opt_AST; + if ( task_items_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + task_items_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = task_items_opt_AST->getFirstChild(); + else + currentAST.child = task_items_opt_AST; + currentAST.advanceChildToEnd(); + } + task_items_opt_AST = RefAdaAST(currentAST.root); + returnAST = task_items_opt_AST; +} + +void AdaParser::private_task_items_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST private_task_items_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + { // ( ... )* + for (;;) { + if ((LA(1) == PRAGMA)) { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop163; + } + + } + _loop163:; + } // ( ... )* + entrydecls_repspecs_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + private_task_items_opt_AST = RefAdaAST(currentAST.root); +#line 530 "ada.g" + private_task_items_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PRIVATE_TASK_ITEMS_OPT,"PRIVATE_TASK_ITEMS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(private_task_items_opt_AST)))); +#line 4298 "AdaParser.cpp" + currentAST.root = private_task_items_opt_AST; + if ( private_task_items_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + private_task_items_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = private_task_items_opt_AST->getFirstChild(); + else + currentAST.child = private_task_items_opt_AST; + currentAST.advanceChildToEnd(); + } + private_task_items_opt_AST = RefAdaAST(currentAST.root); + returnAST = private_task_items_opt_AST; +} + +void AdaParser::discrim_part_text() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrim_part_text_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(LPAREN); + { + switch ( LA(1)) { + case BOX: + { + RefAdaAST tmp137_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp137_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp137_AST)); + } + match(BOX); + break; + } + case IDENTIFIER: + { + discriminant_specifications(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(RPAREN); + discrim_part_text_AST = RefAdaAST(currentAST.root); + returnAST = discrim_part_text_AST; +} + +void AdaParser::discriminant_specifications() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discriminant_specifications_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + discriminant_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + discriminant_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop130; + } + + } + _loop130:; + } // ( ... )* + if ( inputState->guessing==0 ) { + discriminant_specifications_AST = RefAdaAST(currentAST.root); +#line 450 "ada.g" + discriminant_specifications_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIMINANT_SPECIFICATIONS,"DISCRIMINANT_SPECIFICATIONS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(discriminant_specifications_AST)))); +#line 4378 "AdaParser.cpp" + currentAST.root = discriminant_specifications_AST; + if ( discriminant_specifications_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + discriminant_specifications_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = discriminant_specifications_AST->getFirstChild(); + else + currentAST.child = discriminant_specifications_AST; + currentAST.advanceChildToEnd(); + } + discriminant_specifications_AST = RefAdaAST(currentAST.root); + returnAST = discriminant_specifications_AST; +} + +void AdaParser::known_discrim_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST known_discrim_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(LPAREN); + discriminant_specifications(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { + known_discrim_part_AST = RefAdaAST(currentAST.root); +#line 430 "ada.g" + known_discrim_part_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIM_PART_OPT,"DISCRIM_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(known_discrim_part_AST)))); +#line 4407 "AdaParser.cpp" + currentAST.root = known_discrim_part_AST; + if ( known_discrim_part_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + known_discrim_part_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = known_discrim_part_AST->getFirstChild(); + else + currentAST.child = known_discrim_part_AST; + currentAST.advanceChildToEnd(); + } + known_discrim_part_AST = RefAdaAST(currentAST.root); + returnAST = known_discrim_part_AST; +} + +void AdaParser::empty_discrim_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST empty_discrim_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + if ( inputState->guessing==0 ) { + empty_discrim_opt_AST = RefAdaAST(currentAST.root); +#line 436 "ada.g" + empty_discrim_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIM_PART_OPT,"DISCRIM_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(empty_discrim_opt_AST)))); +#line 4430 "AdaParser.cpp" + currentAST.root = empty_discrim_opt_AST; + if ( empty_discrim_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + empty_discrim_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = empty_discrim_opt_AST->getFirstChild(); + else + currentAST.child = empty_discrim_opt_AST; + currentAST.advanceChildToEnd(); + } + empty_discrim_opt_AST = RefAdaAST(currentAST.root); + returnAST = empty_discrim_opt_AST; +} + +void AdaParser::discrim_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrim_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + discrim_part_text(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + discrim_part_AST = RefAdaAST(currentAST.root); +#line 443 "ada.g" + discrim_part_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIM_PART_OPT,"DISCRIM_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(discrim_part_AST)))); +#line 4457 "AdaParser.cpp" + currentAST.root = discrim_part_AST; + if ( discrim_part_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + discrim_part_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = discrim_part_AST->getFirstChild(); + else + currentAST.child = discrim_part_AST; + currentAST.advanceChildToEnd(); + } + discrim_part_AST = RefAdaAST(currentAST.root); + returnAST = discrim_part_AST; +} + +void AdaParser::discriminant_specification() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discriminant_specification_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + def_ids_colon(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + access_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + init_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + discriminant_specification_AST = RefAdaAST(currentAST.root); +#line 457 "ada.g" + discriminant_specification_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIMINANT_SPECIFICATION,"DISCRIMINANT_SPECIFICATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(discriminant_specification_AST)))); +#line 4496 "AdaParser.cpp" + currentAST.root = discriminant_specification_AST; + if ( discriminant_specification_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + discriminant_specification_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = discriminant_specification_AST->getFirstChild(); + else + currentAST.child = discriminant_specification_AST; + currentAST.advanceChildToEnd(); + } + discriminant_specification_AST = RefAdaAST(currentAST.root); + returnAST = discriminant_specification_AST; +} + +void AdaParser::access_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST access_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ACCESS: + { + RefAdaAST tmp142_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp142_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp142_AST)); + } + match(ACCESS); + break; + } + case IDENTIFIER: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + access_opt_AST = RefAdaAST(currentAST.root); +#line 464 "ada.g" + access_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(access_opt_AST)))); +#line 4540 "AdaParser.cpp" + currentAST.root = access_opt_AST; + if ( access_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + access_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = access_opt_AST->getFirstChild(); + else + currentAST.child = access_opt_AST; + currentAST.advanceChildToEnd(); + } + access_opt_AST = RefAdaAST(currentAST.root); + returnAST = access_opt_AST; +} + +void AdaParser::entrydecls_repspecs_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entrydecls_repspecs_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + if ((LA(1) == ENTRY)) { + entry_declaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case FOR: + { + rep_spec(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop142; + } + } + } + _loop142:; + } // ( ... )* + } + else { + goto _loop143; + } + + } + _loop143:; + } // ( ... )* + entrydecls_repspecs_opt_AST = RefAdaAST(currentAST.root); + returnAST = entrydecls_repspecs_opt_AST; +} + +void AdaParser::entry_declaration() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_declaration_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken e = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST e_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + e = LT(1); + if ( inputState->guessing == 0 ) { + e_AST = astFactory->create(e); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(e_AST)); + } + match(ENTRY); + RefAdaAST tmp143_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp143_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp143_AST)); + } + match(IDENTIFIER); + discrete_subtype_def_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 482 "ada.g" + Set (e_AST, ENTRY_DECLARATION); +#line 4635 "AdaParser.cpp" + } + entry_declaration_AST = RefAdaAST(currentAST.root); + returnAST = entry_declaration_AST; +} + +void AdaParser::rep_spec() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST rep_spec_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken r = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST r_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + r = LT(1); + if ( inputState->guessing == 0 ) { + r_AST = astFactory->create(r); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(r_AST)); + } + match(FOR); + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(USE); + rep_spec_part(r_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + rep_spec_AST = RefAdaAST(currentAST.root); + returnAST = rep_spec_AST; +} + +void AdaParser::discrete_subtype_def_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrete_subtype_def_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + bool synPredMatched148 = false; + if (((LA(1) == LPAREN) && (_tokenSet_0.member(LA(2))))) { + int _m148 = mark(); + synPredMatched148 = true; + inputState->guessing++; + try { + { + match(LPAREN); + discrete_subtype_definition(); + match(RPAREN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched148 = false; + } + rewind(_m148); + inputState->guessing--; + } + if ( synPredMatched148 ) { + match(LPAREN); + discrete_subtype_definition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + } + else if ((LA(1) == SEMI || LA(1) == LPAREN) && (_tokenSet_14.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + if ( inputState->guessing==0 ) { + discrete_subtype_def_opt_AST = RefAdaAST(currentAST.root); +#line 489 "ada.g" + discrete_subtype_def_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRETE_SUBTYPE_DEF_OPT,"DISCRETE_SUBTYPE_DEF_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(discrete_subtype_def_opt_AST)))); +#line 4712 "AdaParser.cpp" + currentAST.root = discrete_subtype_def_opt_AST; + if ( discrete_subtype_def_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + discrete_subtype_def_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = discrete_subtype_def_opt_AST->getFirstChild(); + else + currentAST.child = discrete_subtype_def_opt_AST; + currentAST.advanceChildToEnd(); + } + discrete_subtype_def_opt_AST = RefAdaAST(currentAST.root); + returnAST = discrete_subtype_def_opt_AST; +} + +void AdaParser::discrete_subtype_definition() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrete_subtype_definition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + bool synPredMatched152 = false; + if (((_tokenSet_0.member(LA(1))) && (_tokenSet_8.member(LA(2))))) { + int _m152 = mark(); + synPredMatched152 = true; + inputState->guessing++; + try { + { + range(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched152 = false; + } + rewind(_m152); + inputState->guessing--; + } + if ( synPredMatched152 ) { + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == IDENTIFIER) && (_tokenSet_15.member(LA(2)))) { + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + discrete_subtype_definition_AST = RefAdaAST(currentAST.root); + returnAST = discrete_subtype_definition_AST; +} + +void AdaParser::subtype_ind() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subtype_ind_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constraint_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + subtype_ind_AST = RefAdaAST(currentAST.root); +#line 693 "ada.g" + subtype_ind_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(SUBTYPE_INDICATION,"SUBTYPE_INDICATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(subtype_ind_AST)))); +#line 4785 "AdaParser.cpp" + currentAST.root = subtype_ind_AST; + if ( subtype_ind_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + subtype_ind_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = subtype_ind_AST->getFirstChild(); + else + currentAST.child = subtype_ind_AST; + currentAST.advanceChildToEnd(); + } + subtype_ind_AST = RefAdaAST(currentAST.root); + returnAST = subtype_ind_AST; +} + +void AdaParser::rep_spec_part( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST rep_spec_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case RECORD: + { + match(RECORD); + align_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + comp_loc_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(RECORD); + if ( inputState->guessing==0 ) { +#line 512 "ada.g" + Set(t, RECORD_REPRESENTATION_CLAUSE); +#line 4822 "AdaParser.cpp" + } + rep_spec_part_AST = RefAdaAST(currentAST.root); + break; + } + case AT: + { + match(AT); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 514 "ada.g" + Set(t, AT_CLAUSE); +#line 4837 "AdaParser.cpp" + } + rep_spec_part_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 517 "ada.g" + Set(t, ATTRIBUTE_DEFINITION_CLAUSE); +#line 4861 "AdaParser.cpp" + } + rep_spec_part_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = rep_spec_part_AST; +} + +void AdaParser::align_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST align_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case AT: + { + match(AT); + match(MOD); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case PRAGMA: + case IDENTIFIER: + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + align_opt_AST = RefAdaAST(currentAST.root); +#line 521 "ada.g" + align_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MOD_CLAUSE_OPT,"MOD_CLAUSE_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(align_opt_AST)))); +#line 4908 "AdaParser.cpp" + currentAST.root = align_opt_AST; + if ( align_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + align_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = align_opt_AST->getFirstChild(); + else + currentAST.child = align_opt_AST; + currentAST.advanceChildToEnd(); + } + align_opt_AST = RefAdaAST(currentAST.root); + returnAST = align_opt_AST; +} + +void AdaParser::comp_loc_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST comp_loc_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + { + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(AT); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RANGE); + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + default: + { + goto _loop159; + } + } + } + _loop159:; + } // ( ... )* + if ( inputState->guessing==0 ) { + comp_loc_s_AST = RefAdaAST(currentAST.root); +#line 525 "ada.g" + comp_loc_s_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(COMPONENT_CLAUSES_OPT,"COMPONENT_CLAUSES_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(comp_loc_s_AST)))); +#line 4968 "AdaParser.cpp" + currentAST.root = comp_loc_s_AST; + if ( comp_loc_s_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + comp_loc_s_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = comp_loc_s_AST->getFirstChild(); + else + currentAST.child = comp_loc_s_AST; + currentAST.advanceChildToEnd(); + } + comp_loc_s_AST = RefAdaAST(currentAST.root); + returnAST = comp_loc_s_AST; +} + +void AdaParser::protected_definition() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST protected_definition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(IS); + prot_op_decl_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + prot_private_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + protected_definition_AST = RefAdaAST(currentAST.root); + returnAST = protected_definition_AST; +} + +void AdaParser::prot_private_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prot_private_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + case PROCEDURE: + case FUNCTION: + case ENTRY: + case FOR: + { + prot_op_decl(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + { + comp_decl(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop168; + } + } + } + _loop168:; + } // ( ... )* + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + prot_private_opt_AST = RefAdaAST(currentAST.root); +#line 545 "ada.g" + prot_private_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PROT_PRIVATE_OPT,"PROT_PRIVATE_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(prot_private_opt_AST)))); +#line 5061 "AdaParser.cpp" + currentAST.root = prot_private_opt_AST; + if ( prot_private_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + prot_private_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = prot_private_opt_AST->getFirstChild(); + else + currentAST.child = prot_private_opt_AST; + currentAST.advanceChildToEnd(); + } + prot_private_opt_AST = RefAdaAST(currentAST.root); + returnAST = prot_private_opt_AST; +} + +void AdaParser::prot_op_decl() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prot_op_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken f = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST f_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case ENTRY: + { + entry_declaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + prot_op_decl_AST = RefAdaAST(currentAST.root); + break; + } + case PROCEDURE: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PROCEDURE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 561 "ada.g" + pop_def_id(); Set(p_AST, PROCEDURE_DECLARATION); +#line 5113 "AdaParser.cpp" + } + prot_op_decl_AST = RefAdaAST(currentAST.root); + break; + } + case FUNCTION: + { + f = LT(1); + if ( inputState->guessing == 0 ) { + f_AST = astFactory->create(f); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)); + } + match(FUNCTION); + def_designator(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 563 "ada.g" + pop_def_id(); Set(f_AST, FUNCTION_DECLARATION); +#line 5138 "AdaParser.cpp" + } + prot_op_decl_AST = RefAdaAST(currentAST.root); + break; + } + case FOR: + { + rep_spec(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + prot_op_decl_AST = RefAdaAST(currentAST.root); + break; + } + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + prot_op_decl_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = prot_op_decl_AST; +} + +void AdaParser::comp_decl() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST comp_decl_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + def_ids_colon(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + component_subtype_def(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + init_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { + comp_decl_AST = RefAdaAST(currentAST.root); +#line 575 "ada.g" + comp_decl_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(COMPONENT_DECLARATION,"COMPONENT_DECLARATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(comp_decl_AST)))); +#line 5192 "AdaParser.cpp" + currentAST.root = comp_decl_AST; + if ( comp_decl_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + comp_decl_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = comp_decl_AST->getFirstChild(); + else + currentAST.child = comp_decl_AST; + currentAST.advanceChildToEnd(); + } + comp_decl_AST = RefAdaAST(currentAST.root); + returnAST = comp_decl_AST; +} + +void AdaParser::prot_op_decl_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prot_op_decl_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + if ((_tokenSet_16.member(LA(1)))) { + prot_op_decl(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop172; + } + + } + _loop172:; + } // ( ... )* + if ( inputState->guessing==0 ) { + prot_op_decl_s_AST = RefAdaAST(currentAST.root); +#line 555 "ada.g" + prot_op_decl_s_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PROT_OP_DECLARATIONS,"PROT_OP_DECLARATIONS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(prot_op_decl_s_AST)))); +#line 5229 "AdaParser.cpp" + currentAST.root = prot_op_decl_s_AST; + if ( prot_op_decl_s_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + prot_op_decl_s_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = prot_op_decl_s_AST->getFirstChild(); + else + currentAST.child = prot_op_decl_s_AST; + currentAST.advanceChildToEnd(); + } + prot_op_decl_s_AST = RefAdaAST(currentAST.root); + returnAST = prot_op_decl_s_AST; +} + +void AdaParser::prot_member_decl_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prot_member_decl_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + case PROCEDURE: + case FUNCTION: + case ENTRY: + case FOR: + { + prot_op_decl(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + { + comp_decl(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop176; + } + } + } + _loop176:; + } // ( ... )* + if ( inputState->guessing==0 ) { + prot_member_decl_s_AST = RefAdaAST(currentAST.root); +#line 569 "ada.g" + prot_member_decl_s_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PROT_MEMBER_DECLARATIONS,"PROT_MEMBER_DECLARATIONS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(prot_member_decl_s_AST)))); +#line 5283 "AdaParser.cpp" + currentAST.root = prot_member_decl_s_AST; + if ( prot_member_decl_s_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + prot_member_decl_s_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = prot_member_decl_s_AST->getFirstChild(); + else + currentAST.child = prot_member_decl_s_AST; + currentAST.advanceChildToEnd(); + } + prot_member_decl_s_AST = RefAdaAST(currentAST.root); + returnAST = prot_member_decl_s_AST; +} + +void AdaParser::component_subtype_def() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST component_subtype_def_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + aliased_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + component_subtype_def_AST = RefAdaAST(currentAST.root); + returnAST = component_subtype_def_AST; +} + +void AdaParser::type_def( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST type_def_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + enum_id_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 638 "ada.g" + Set(t, ENUMERATION_TYPE_DECLARATION); +#line 5332 "AdaParser.cpp" + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case RANGE: + { + match(RANGE); + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 640 "ada.g" + Set(t, SIGNED_INTEGER_TYPE_DECLARATION); +#line 5347 "AdaParser.cpp" + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case MOD: + { + match(MOD); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 642 "ada.g" + Set(t, MODULAR_TYPE_DECLARATION); +#line 5362 "AdaParser.cpp" + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case DIGITS: + { + match(DIGITS); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_constraint_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 644 "ada.g" + Set(t, FLOATING_POINT_DECLARATION); +#line 5381 "AdaParser.cpp" + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case DELTA: + { + match(DELTA); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case RANGE: + { + match(RANGE); + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 647 "ada.g" + Set(t, ORDINARY_FIXED_POINT_DECLARATION); +#line 5405 "AdaParser.cpp" + } + break; + } + case DIGITS: + { + match(DIGITS); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_constraint_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 649 "ada.g" + Set(t, DECIMAL_FIXED_POINT_DECLARATION); +#line 5423 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case ARRAY: + { + array_type_definition(t); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case ACCESS: + { + access_type_definition(t); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + case PRIVATE: + case NEW: + case NuLL: + case RECORD: + case ABSTRACT: + case TAGGED: + case LIMITED: + { + empty_discrim_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + derived_or_private_or_record(t, false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_def_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = type_def_AST; +} + +void AdaParser::derived_or_private_or_record( + RefAdaAST t, boolean has_discrim +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST derived_or_private_or_record_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + bool synPredMatched246 = false; + if (((LA(1) == NEW || LA(1) == ABSTRACT) && (LA(2) == IDENTIFIER || LA(2) == NEW))) { + int _m246 = mark(); + synPredMatched246 = true; + inputState->guessing++; + try { + { + { + switch ( LA(1)) { + case ABSTRACT: + { + match(ABSTRACT); + break; + } + case NEW: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(NEW); + subtype_ind(); + match(WITH); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched246 = false; + } + rewind(_m246); + inputState->guessing--; + } + if ( synPredMatched246 ) { + abstract_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(NEW); + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(WITH); + { + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + if ( inputState->guessing==0 ) { +#line 772 "ada.g" + Set(t, PRIVATE_EXTENSION_DECLARATION); +#line 5542 "AdaParser.cpp" + } + break; + } + case NuLL: + case RECORD: + { + record_definition(has_discrim); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 774 "ada.g" + Set(t, DERIVED_RECORD_EXTENSION); +#line 5556 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + derived_or_private_or_record_AST = RefAdaAST(currentAST.root); + } + else if ((LA(1) == NEW) && (LA(2) == IDENTIFIER)) { + match(NEW); + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 776 "ada.g" + Set(t, ORDINARY_DERIVED_TYPE_DECLARATION); +#line 5577 "AdaParser.cpp" + } + derived_or_private_or_record_AST = RefAdaAST(currentAST.root); + } + else if ((_tokenSet_17.member(LA(1))) && (_tokenSet_18.member(LA(2)))) { + abstract_tagged_limited_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + if ( inputState->guessing==0 ) { +#line 778 "ada.g" + Set(t, PRIVATE_TYPE_DECLARATION); +#line 5594 "AdaParser.cpp" + } + break; + } + case NuLL: + case RECORD: + { + record_definition(has_discrim); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 780 "ada.g" + Set(t, RECORD_TYPE_DECLARATION); +#line 5608 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + derived_or_private_or_record_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = derived_or_private_or_record_AST; +} + +void AdaParser::local_enum_name() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST local_enum_name_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp177_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp177_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp177_AST)); + } + match(IDENTIFIER); + local_enum_name_AST = RefAdaAST(currentAST.root); + returnAST = local_enum_name_AST; +} + +void AdaParser::enumeration_aggregate() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST enumeration_aggregate_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + parenth_values(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + enumeration_aggregate_AST = RefAdaAST(currentAST.root); + returnAST = enumeration_aggregate_AST; +} + +void AdaParser::aliased_constant_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST aliased_constant_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ALIASED: + { + RefAdaAST tmp178_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp178_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp178_AST)); + } + match(ALIASED); + break; + } + case IDENTIFIER: + case CONSTANT: + case ARRAY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case CONSTANT: + { + RefAdaAST tmp179_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp179_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp179_AST)); + } + match(CONSTANT); + break; + } + case IDENTIFIER: + case ARRAY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + aliased_constant_opt_AST = RefAdaAST(currentAST.root); +#line 858 "ada.g" + aliased_constant_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(aliased_constant_opt_AST)))); +#line 5712 "AdaParser.cpp" + currentAST.root = aliased_constant_opt_AST; + if ( aliased_constant_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + aliased_constant_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = aliased_constant_opt_AST->getFirstChild(); + else + currentAST.child = aliased_constant_opt_AST; + currentAST.advanceChildToEnd(); + } + aliased_constant_opt_AST = RefAdaAST(currentAST.root); + returnAST = aliased_constant_opt_AST; +} + +void AdaParser::array_type_definition( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST array_type_definition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(ARRAY); + match(LPAREN); + index_or_discrete_range_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + match(OF); + component_subtype_def(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 669 "ada.g" + Set(t, ARRAY_TYPE_DECLARATION); +#line 5747 "AdaParser.cpp" + } + array_type_definition_AST = RefAdaAST(currentAST.root); + returnAST = array_type_definition_AST; +} + +void AdaParser::enum_id_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST enum_id_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + enumeration_literal_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + enumeration_literal_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop197; + } + + } + _loop197:; + } // ( ... )* + enum_id_s_AST = RefAdaAST(currentAST.root); + returnAST = enum_id_s_AST; +} + +void AdaParser::range_constraint_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST range_constraint_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case RANGE: + { + range_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case COMMA: + case RPAREN: + case WITH: + case ASSIGN: + case LOOP: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + range_constraint_opt_AST = RefAdaAST(currentAST.root); + returnAST = range_constraint_opt_AST; +} + +void AdaParser::access_type_definition( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST access_type_definition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(ACCESS); + { + switch ( LA(1)) { + case PROCEDURE: + case FUNCTION: + case PROTECTED: + { + protected_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case PROCEDURE: + { + match(PROCEDURE); + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 751 "ada.g" + Set(t, ACCESS_TO_PROCEDURE_DECLARATION); +#line 5846 "AdaParser.cpp" + } + break; + } + case FUNCTION: + { + match(FUNCTION); + func_formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RETURN); + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 753 "ada.g" + Set(t, ACCESS_TO_FUNCTION_DECLARATION); +#line 5865 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case IDENTIFIER: + case ALL: + case CONSTANT: + { + constant_all_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 756 "ada.g" + Set(t, ACCESS_TO_OBJECT_DECLARATION); +#line 5892 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + access_type_definition_AST = RefAdaAST(currentAST.root); + returnAST = access_type_definition_AST; +} + +void AdaParser::enumeration_literal_specification() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST enumeration_literal_specification_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case IDENTIFIER: + { + RefAdaAST tmp189_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp189_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp189_AST)); + } + match(IDENTIFIER); + enumeration_literal_specification_AST = RefAdaAST(currentAST.root); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp190_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp190_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp190_AST)); + } + match(CHARACTER_LITERAL); + enumeration_literal_specification_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = enumeration_literal_specification_AST; +} + +void AdaParser::index_or_discrete_range_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST index_or_discrete_range_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + index_or_discrete_range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + RefAdaAST tmp191_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp191_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp191_AST)); + } + match(COMMA); + index_or_discrete_range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop204; + } + + } + _loop204:; + } // ( ... )* + index_or_discrete_range_s_AST = RefAdaAST(currentAST.root); + returnAST = index_or_discrete_range_s_AST; +} + +void AdaParser::index_or_discrete_range() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST index_or_discrete_range_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case DOT_DOT: + { + RefAdaAST tmp192_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp192_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp192_AST)); + } + match(DOT_DOT); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RANGE: + { + RefAdaAST tmp193_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp193_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp193_AST)); + } + match(RANGE); + { + switch ( LA(1)) { + case BOX: + { + RefAdaAST tmp194_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp194_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp194_AST)); + } + match(BOX); + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case COMMA: + case RPAREN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + index_or_discrete_range_AST = RefAdaAST(currentAST.root); + returnAST = index_or_discrete_range_AST; +} + +void AdaParser::aliased_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST aliased_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ALIASED: + { + RefAdaAST tmp195_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp195_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp195_AST)); + } + match(ALIASED); + break; + } + case IDENTIFIER: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + aliased_opt_AST = RefAdaAST(currentAST.root); +#line 689 "ada.g" + aliased_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(aliased_opt_AST)))); +#line 6093 "AdaParser.cpp" + currentAST.root = aliased_opt_AST; + if ( aliased_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + aliased_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = aliased_opt_AST->getFirstChild(); + else + currentAST.child = aliased_opt_AST; + currentAST.advanceChildToEnd(); + } + aliased_opt_AST = RefAdaAST(currentAST.root); + returnAST = aliased_opt_AST; +} + +void AdaParser::constraint_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST constraint_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case RANGE: + { + range_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DIGITS: + { + digits_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DELTA: + { + delta_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case COMMA: + case RPAREN: + case WITH: + case ASSIGN: + case LOOP: + { + break; + } + default: + bool synPredMatched215 = false; + if (((LA(1) == LPAREN) && (_tokenSet_0.member(LA(2))))) { + int _m215 = mark(); + synPredMatched215 = true; + inputState->guessing++; + try { + { + index_constraint(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched215 = false; + } + rewind(_m215); + inputState->guessing--; + } + if ( synPredMatched215 ) { + index_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == LPAREN) && (_tokenSet_0.member(LA(2)))) { + discriminant_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + constraint_opt_AST = RefAdaAST(currentAST.root); + returnAST = constraint_opt_AST; +} + +void AdaParser::digits_constraint() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST digits_constraint_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken d = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST d_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + d = LT(1); + if ( inputState->guessing == 0 ) { + d_AST = astFactory->create(d); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(d_AST)); + } + match(DIGITS); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_constraint_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 706 "ada.g" + Set(d_AST, DIGITS_CONSTRAINT); +#line 6208 "AdaParser.cpp" + } + digits_constraint_AST = RefAdaAST(currentAST.root); + returnAST = digits_constraint_AST; +} + +void AdaParser::delta_constraint() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST delta_constraint_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken d = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST d_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + d = LT(1); + if ( inputState->guessing == 0 ) { + d_AST = astFactory->create(d); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(d_AST)); + } + match(DELTA); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_constraint_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 710 "ada.g" + Set(d_AST, DELTA_CONSTRAINT); +#line 6238 "AdaParser.cpp" + } + delta_constraint_AST = RefAdaAST(currentAST.root); + returnAST = delta_constraint_AST; +} + +void AdaParser::index_constraint() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST index_constraint_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(LPAREN); + discrete_range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + discrete_range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop220; + } + + } + _loop220:; + } // ( ... )* + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 714 "ada.g" + Set(p_AST, INDEX_CONSTRAINT); +#line 6281 "AdaParser.cpp" + } + index_constraint_AST = RefAdaAST(currentAST.root); + returnAST = index_constraint_AST; +} + +void AdaParser::discriminant_constraint() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discriminant_constraint_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(LPAREN); + discriminant_association(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + discriminant_association(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop226; + } + + } + _loop226:; + } // ( ... )* + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 724 "ada.g" + Set(p_AST, DISCRIMINANT_CONSTRAINT); +#line 6324 "AdaParser.cpp" + } + discriminant_constraint_AST = RefAdaAST(currentAST.root); + returnAST = discriminant_constraint_AST; +} + +void AdaParser::discrete_range() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrete_range_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + bool synPredMatched223 = false; + if (((_tokenSet_0.member(LA(1))) && (_tokenSet_8.member(LA(2))))) { + int _m223 = mark(); + synPredMatched223 = true; + inputState->guessing++; + try { + { + range(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched223 = false; + } + rewind(_m223); + inputState->guessing--; + } + if ( synPredMatched223 ) { + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrete_range_AST = RefAdaAST(currentAST.root); + } + else if ((LA(1) == IDENTIFIER) && (_tokenSet_19.member(LA(2)))) { + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrete_range_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = discrete_range_AST; +} + +void AdaParser::discriminant_association() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discriminant_association_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + selector_names_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + discriminant_association_AST = RefAdaAST(currentAST.root); +#line 728 "ada.g" + discriminant_association_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DISCRIMINANT_ASSOCIATION,"DISCRIMINANT_ASSOCIATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(discriminant_association_AST)))); +#line 6390 "AdaParser.cpp" + currentAST.root = discriminant_association_AST; + if ( discriminant_association_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + discriminant_association_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = discriminant_association_AST->getFirstChild(); + else + currentAST.child = discriminant_association_AST; + currentAST.advanceChildToEnd(); + } + discriminant_association_AST = RefAdaAST(currentAST.root); + returnAST = discriminant_association_AST; +} + +void AdaParser::selector_names_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST selector_names_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + bool synPredMatched231 = false; + if (((LA(1) == IDENTIFIER) && (LA(2) == RIGHT_SHAFT || LA(2) == PIPE))) { + int _m231 = mark(); + synPredMatched231 = true; + inputState->guessing++; + try { + { + association_head(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched231 = false; + } + rewind(_m231); + inputState->guessing--; + } + if ( synPredMatched231 ) { + association_head(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + if ( inputState->guessing==0 ) { + selector_names_opt_AST = RefAdaAST(currentAST.root); +#line 736 "ada.g" + selector_names_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(SELECTOR_NAMES_OPT,"SELECTOR_NAMES_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(selector_names_opt_AST)))); +#line 6443 "AdaParser.cpp" + currentAST.root = selector_names_opt_AST; + if ( selector_names_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + selector_names_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = selector_names_opt_AST->getFirstChild(); + else + currentAST.child = selector_names_opt_AST; + currentAST.advanceChildToEnd(); + } + selector_names_opt_AST = RefAdaAST(currentAST.root); + returnAST = selector_names_opt_AST; +} + +void AdaParser::association_head() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST association_head_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + selector_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == PIPE)) { + match(PIPE); + selector_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop234; + } + + } + _loop234:; + } // ( ... )* + match(RIGHT_SHAFT); + association_head_AST = RefAdaAST(currentAST.root); + returnAST = association_head_AST; +} + +void AdaParser::selector_name() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST selector_name_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp202_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp202_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp202_AST)); + } + match(IDENTIFIER); + selector_name_AST = RefAdaAST(currentAST.root); + returnAST = selector_name_AST; +} + +void AdaParser::protected_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST protected_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PROTECTED: + { + RefAdaAST tmp203_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp203_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp203_AST)); + } + match(PROTECTED); + break; + } + case PROCEDURE: + case FUNCTION: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + protected_opt_AST = RefAdaAST(currentAST.root); +#line 761 "ada.g" + protected_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(protected_opt_AST)))); +#line 6533 "AdaParser.cpp" + currentAST.root = protected_opt_AST; + if ( protected_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + protected_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = protected_opt_AST->getFirstChild(); + else + currentAST.child = protected_opt_AST; + currentAST.advanceChildToEnd(); + } + protected_opt_AST = RefAdaAST(currentAST.root); + returnAST = protected_opt_AST; +} + +void AdaParser::constant_all_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST constant_all_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case CONSTANT: + { + RefAdaAST tmp204_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp204_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp204_AST)); + } + match(CONSTANT); + break; + } + case ALL: + { + RefAdaAST tmp205_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp205_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp205_AST)); + } + match(ALL); + break; + } + case IDENTIFIER: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + constant_all_opt_AST = RefAdaAST(currentAST.root); +#line 765 "ada.g" + constant_all_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(constant_all_opt_AST)))); +#line 6588 "AdaParser.cpp" + currentAST.root = constant_all_opt_AST; + if ( constant_all_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + constant_all_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = constant_all_opt_AST->getFirstChild(); + else + currentAST.child = constant_all_opt_AST; + currentAST.advanceChildToEnd(); + } + constant_all_opt_AST = RefAdaAST(currentAST.root); + returnAST = constant_all_opt_AST; +} + +void AdaParser::abstract_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST abstract_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ABSTRACT: + { + RefAdaAST tmp206_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp206_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp206_AST)); + } + match(ABSTRACT); + break; + } + case NEW: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + abstract_opt_AST = RefAdaAST(currentAST.root); +#line 785 "ada.g" + abstract_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(abstract_opt_AST)))); +#line 6632 "AdaParser.cpp" + currentAST.root = abstract_opt_AST; + if ( abstract_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + abstract_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = abstract_opt_AST->getFirstChild(); + else + currentAST.child = abstract_opt_AST; + currentAST.advanceChildToEnd(); + } + abstract_opt_AST = RefAdaAST(currentAST.root); + returnAST = abstract_opt_AST; +} + +void AdaParser::record_definition( + boolean has_discrim +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST record_definition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case RECORD: + { + match(RECORD); + component_list(has_discrim); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(RECORD); + record_definition_AST = RefAdaAST(currentAST.root); + break; + } + case NuLL: + { + match(NuLL); + match(RECORD); + record_definition_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = record_definition_AST; +} + +void AdaParser::abstract_tagged_limited_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST abstract_tagged_limited_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ABSTRACT: + { + RefAdaAST tmp212_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp212_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp212_AST)); + } + match(ABSTRACT); + match(TAGGED); + break; + } + case TAGGED: + { + RefAdaAST tmp214_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp214_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp214_AST)); + } + match(TAGGED); + break; + } + case PRIVATE: + case NuLL: + case RECORD: + case LIMITED: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LIMITED: + { + RefAdaAST tmp215_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp215_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp215_AST)); + } + match(LIMITED); + break; + } + case PRIVATE: + case NuLL: + case RECORD: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + abstract_tagged_limited_opt_AST = RefAdaAST(currentAST.root); +#line 847 "ada.g" + abstract_tagged_limited_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(abstract_tagged_limited_opt_AST)))); +#line 6750 "AdaParser.cpp" + currentAST.root = abstract_tagged_limited_opt_AST; + if ( abstract_tagged_limited_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + abstract_tagged_limited_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = abstract_tagged_limited_opt_AST->getFirstChild(); + else + currentAST.child = abstract_tagged_limited_opt_AST; + currentAST.advanceChildToEnd(); + } + abstract_tagged_limited_opt_AST = RefAdaAST(currentAST.root); + returnAST = abstract_tagged_limited_opt_AST; +} + +void AdaParser::component_list( + boolean has_discrim +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST component_list_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case NuLL: + { + match(NuLL); + match(SEMI); + component_list_AST = RefAdaAST(currentAST.root); + break; + } + case PRAGMA: + case IDENTIFIER: + { + component_items(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case CASE: + { + variant_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if (!( has_discrim )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" has_discrim "); + break; + } + case END: + case WHEN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + component_list_AST = RefAdaAST(currentAST.root); + break; + } + case CASE: + { + empty_component_items(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + variant_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if (!( has_discrim )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" has_discrim "); + component_list_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = component_list_AST; +} + +void AdaParser::component_items() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST component_items_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )+ + int _cnt256=0; + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + { + comp_decl(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + if ( _cnt256>=1 ) { goto _loop256; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + } + _cnt256++; + } + _loop256:; + } // ( ... )+ + if ( inputState->guessing==0 ) { + component_items_AST = RefAdaAST(currentAST.root); +#line 800 "ada.g" + component_items_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(COMPONENT_ITEMS,"COMPONENT_ITEMS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(component_items_AST)))); +#line 6873 "AdaParser.cpp" + currentAST.root = component_items_AST; + if ( component_items_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + component_items_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = component_items_AST->getFirstChild(); + else + currentAST.child = component_items_AST; + currentAST.advanceChildToEnd(); + } + component_items_AST = RefAdaAST(currentAST.root); + returnAST = component_items_AST; +} + +void AdaParser::variant_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST variant_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken c = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST c_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + c = LT(1); + if ( inputState->guessing == 0 ) { + c_AST = astFactory->create(c); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(c_AST)); + } + match(CASE); + discriminant_direct_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + variant_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(CASE); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 812 "ada.g" + Set (c_AST, VARIANT_PART); +#line 6914 "AdaParser.cpp" + } + variant_part_AST = RefAdaAST(currentAST.root); + returnAST = variant_part_AST; +} + +void AdaParser::empty_component_items() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST empty_component_items_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + if ( inputState->guessing==0 ) { + empty_component_items_AST = RefAdaAST(currentAST.root); +#line 806 "ada.g" + empty_component_items_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(COMPONENT_ITEMS,"COMPONENT_ITEMS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(empty_component_items_AST)))); +#line 6930 "AdaParser.cpp" + currentAST.root = empty_component_items_AST; + if ( empty_component_items_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + empty_component_items_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = empty_component_items_AST->getFirstChild(); + else + currentAST.child = empty_component_items_AST; + currentAST.advanceChildToEnd(); + } + empty_component_items_AST = RefAdaAST(currentAST.root); + returnAST = empty_component_items_AST; +} + +void AdaParser::discriminant_direct_name() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discriminant_direct_name_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp222_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp222_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp222_AST)); + } + match(IDENTIFIER); + discriminant_direct_name_AST = RefAdaAST(currentAST.root); + returnAST = discriminant_direct_name_AST; +} + +void AdaParser::variant_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST variant_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )+ + int _cnt262=0; + for (;;) { + if ((LA(1) == WHEN)) { + variant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt262>=1 ) { goto _loop262; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt262++; + } + _loop262:; + } // ( ... )+ + if ( inputState->guessing==0 ) { + variant_s_AST = RefAdaAST(currentAST.root); +#line 819 "ada.g" + variant_s_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(VARIANTS,"VARIANTS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(variant_s_AST)))); +#line 6984 "AdaParser.cpp" + currentAST.root = variant_s_AST; + if ( variant_s_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + variant_s_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = variant_s_AST->getFirstChild(); + else + currentAST.child = variant_s_AST; + currentAST.advanceChildToEnd(); + } + variant_s_AST = RefAdaAST(currentAST.root); + returnAST = variant_s_AST; +} + +void AdaParser::variant() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST variant_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken w = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST w_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + w = LT(1); + if ( inputState->guessing == 0 ) { + w_AST = astFactory->create(w); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(w_AST)); + } + match(WHEN); + choice_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RIGHT_SHAFT); + component_list(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 823 "ada.g" + Set (w_AST, VARIANT); +#line 7022 "AdaParser.cpp" + } + variant_AST = RefAdaAST(currentAST.root); + returnAST = variant_AST; +} + +void AdaParser::choice_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST choice_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + choice(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == PIPE)) { + RefAdaAST tmp224_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp224_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp224_AST)); + } + match(PIPE); + choice(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop266; + } + + } + _loop266:; + } // ( ... )* + choice_s_AST = RefAdaAST(currentAST.root); + returnAST = choice_s_AST; +} + +void AdaParser::choice() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST choice_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + if ((LA(1) == OTHERS)) { + RefAdaAST tmp225_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp225_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp225_AST)); + } + match(OTHERS); + choice_AST = RefAdaAST(currentAST.root); + } + else { + bool synPredMatched269 = false; + if (((_tokenSet_0.member(LA(1))) && (_tokenSet_20.member(LA(2))))) { + int _m269 = mark(); + synPredMatched269 = true; + inputState->guessing++; + try { + { + discrete_with_range(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched269 = false; + } + rewind(_m269); + inputState->guessing--; + } + if ( synPredMatched269 ) { + discrete_with_range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + choice_AST = RefAdaAST(currentAST.root); + } + else if ((_tokenSet_0.member(LA(1))) && (_tokenSet_21.member(LA(2)))) { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + choice_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = choice_AST; +} + +void AdaParser::discrete_with_range() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discrete_with_range_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + bool synPredMatched272 = false; + if (((LA(1) == IDENTIFIER) && (LA(2) == DOT || LA(2) == TIC || LA(2) == RANGE))) { + int _m272 = mark(); + synPredMatched272 = true; + inputState->guessing++; + try { + { + mark_with_constraint(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched272 = false; + } + rewind(_m272); + inputState->guessing--; + } + if ( synPredMatched272 ) { + mark_with_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrete_with_range_AST = RefAdaAST(currentAST.root); + } + else if ((_tokenSet_0.member(LA(1))) && (_tokenSet_8.member(LA(2)))) { + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrete_with_range_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = discrete_with_range_AST; +} + +void AdaParser::mark_with_constraint() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST mark_with_constraint_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_constraint(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + mark_with_constraint_AST = RefAdaAST(currentAST.root); +#line 839 "ada.g" + mark_with_constraint_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MARK_WITH_CONSTRAINT,"MARK_WITH_CONSTRAINT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(mark_with_constraint_AST)))); +#line 7174 "AdaParser.cpp" + currentAST.root = mark_with_constraint_AST; + if ( mark_with_constraint_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + mark_with_constraint_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = mark_with_constraint_AST->getFirstChild(); + else + currentAST.child = mark_with_constraint_AST; + currentAST.advanceChildToEnd(); + } + mark_with_constraint_AST = RefAdaAST(currentAST.root); + returnAST = mark_with_constraint_AST; +} + +void AdaParser::generic_formal_part_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST generic_formal_part_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case USE: + { + use_clause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case WITH: + case TYPE: + { + generic_formal_parameter(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop289; + } + } + } + _loop289:; + } // ( ... )* + if ( inputState->guessing==0 ) { + generic_formal_part_opt_AST = RefAdaAST(currentAST.root); +#line 885 "ada.g" + generic_formal_part_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(GENERIC_FORMAL_PART,"GENERIC_FORMAL_PART")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(generic_formal_part_opt_AST)))); +#line 7234 "AdaParser.cpp" + currentAST.root = generic_formal_part_opt_AST; + if ( generic_formal_part_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + generic_formal_part_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = generic_formal_part_opt_AST->getFirstChild(); + else + currentAST.child = generic_formal_part_opt_AST; + currentAST.advanceChildToEnd(); + } + generic_formal_part_opt_AST = RefAdaAST(currentAST.root); + returnAST = generic_formal_part_opt_AST; +} + +void AdaParser::generic_formal_parameter() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST generic_formal_parameter_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken t = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST t_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken w = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST w_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case TYPE: + { + t = LT(1); + if ( inputState->guessing == 0 ) { + t_AST = astFactory->create(t); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(t_AST)); + } + match(TYPE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IS: + { + match(IS); + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + match(BOX); + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 895 "ada.g" + Set (t_AST, FORMAL_DISCRETE_TYPE_DECLARATION); +#line 7285 "AdaParser.cpp" + } + break; + } + case RANGE: + { + match(RANGE); + match(BOX); + if ( inputState->guessing==0 ) { +#line 897 "ada.g" + Set (t_AST, FORMAL_SIGNED_INTEGER_TYPE_DECLARATION); +#line 7296 "AdaParser.cpp" + } + break; + } + case MOD: + { + match(MOD); + match(BOX); + if ( inputState->guessing==0 ) { +#line 899 "ada.g" + Set (t_AST, FORMAL_MODULAR_TYPE_DECLARATION); +#line 7307 "AdaParser.cpp" + } + break; + } + case DELTA: + { + match(DELTA); + match(BOX); + { + switch ( LA(1)) { + case DIGITS: + { + match(DIGITS); + match(BOX); + if ( inputState->guessing==0 ) { +#line 902 "ada.g" + Set (t_AST, FORMAL_DECIMAL_FIXED_POINT_DECLARATION); +#line 7324 "AdaParser.cpp" + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 903 "ada.g" + Set (t_AST, FORMAL_ORDINARY_FIXED_POINT_DECLARATION); +#line 7333 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case DIGITS: + { + match(DIGITS); + match(BOX); + if ( inputState->guessing==0 ) { +#line 906 "ada.g" + Set (t_AST, FORMAL_FLOATING_POINT_DECLARATION); +#line 7352 "AdaParser.cpp" + } + break; + } + case ARRAY: + { + array_type_definition(t_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case ACCESS: + { + access_type_definition(t_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRIVATE: + case NEW: + case ABSTRACT: + case TAGGED: + case LIMITED: + { + empty_discrim_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discriminable_type_definition(t_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case LPAREN: + { + discrim_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + discriminable_type_definition(t_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 913 "ada.g" + pop_def_id(); +#line 7418 "AdaParser.cpp" + } + break; + } + case WITH: + { + w = LT(1); + if ( inputState->guessing == 0 ) { + w_AST = astFactory->create(w); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(w_AST)); + } + match(WITH); + { + switch ( LA(1)) { + case PROCEDURE: + { + match(PROCEDURE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subprogram_default_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 915 "ada.g" + Set(w_AST, FORMAL_PROCEDURE_DECLARATION); +#line 7450 "AdaParser.cpp" + } + break; + } + case FUNCTION: + { + match(FUNCTION); + def_designator(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subprogram_default_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 917 "ada.g" + Set(w_AST, FORMAL_FUNCTION_DECLARATION); +#line 7472 "AdaParser.cpp" + } + break; + } + case PACKAGE: + { + match(PACKAGE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + match(NEW); + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_package_actual_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 919 "ada.g" + Set(w_AST, FORMAL_PACKAGE_DECLARATION); +#line 7496 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 921 "ada.g" + pop_def_id(); +#line 7509 "AdaParser.cpp" + } + break; + } + case IDENTIFIER: + { + parameter_specification(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + generic_formal_parameter_AST = RefAdaAST(currentAST.root); + returnAST = generic_formal_parameter_AST; +} + +void AdaParser::discriminable_type_definition( + RefAdaAST t +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST discriminable_type_definition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + bool synPredMatched299 = false; + if (((LA(1) == NEW || LA(1) == ABSTRACT) && (LA(2) == IDENTIFIER || LA(2) == NEW))) { + int _m299 = mark(); + synPredMatched299 = true; + inputState->guessing++; + try { + { + { + switch ( LA(1)) { + case ABSTRACT: + { + match(ABSTRACT); + break; + } + case NEW: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(NEW); + subtype_ind(); + match(WITH); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched299 = false; + } + rewind(_m299); + inputState->guessing--; + } + if ( synPredMatched299 ) { + abstract_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(NEW); + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(WITH); + match(PRIVATE); + if ( inputState->guessing==0 ) { +#line 930 "ada.g" + Set (t, FORMAL_PRIVATE_EXTENSION_DECLARATION); +#line 7589 "AdaParser.cpp" + } + discriminable_type_definition_AST = RefAdaAST(currentAST.root); + } + else if ((LA(1) == NEW) && (LA(2) == IDENTIFIER)) { + match(NEW); + subtype_ind(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 932 "ada.g" + Set (t, FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION); +#line 7602 "AdaParser.cpp" + } + discriminable_type_definition_AST = RefAdaAST(currentAST.root); + } + else if ((_tokenSet_22.member(LA(1))) && (_tokenSet_23.member(LA(2)))) { + abstract_tagged_limited_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(PRIVATE); + if ( inputState->guessing==0 ) { +#line 934 "ada.g" + Set (t, FORMAL_PRIVATE_TYPE_DECLARATION); +#line 7615 "AdaParser.cpp" + } + discriminable_type_definition_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = discriminable_type_definition_AST; +} + +void AdaParser::subprogram_default_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subprogram_default_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case IS: + { + match(IS); + { + switch ( LA(1)) { + case BOX: + { + RefAdaAST tmp253_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp253_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp253_AST)); + } + match(BOX); + break; + } + case IDENTIFIER: + { + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + subprogram_default_opt_AST = RefAdaAST(currentAST.root); + returnAST = subprogram_default_opt_AST; +} + +void AdaParser::formal_package_actual_part_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST formal_package_actual_part_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + { + switch ( LA(1)) { + case BOX: + { + RefAdaAST tmp255_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp255_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp255_AST)); + } + match(BOX); + break; + } + case IDENTIFIER: + { + defining_identifier_list(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(RPAREN); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + formal_package_actual_part_opt_AST = RefAdaAST(currentAST.root); + returnAST = formal_package_actual_part_opt_AST; +} + +void AdaParser::body_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST body_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + declarative_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + block_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + body_part_AST = RefAdaAST(currentAST.root); + returnAST = body_part_AST; +} + +void AdaParser::declarative_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST declarative_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + { + declarative_item(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop316; + } + } + } + _loop316:; + } // ( ... )* + if ( inputState->guessing==0 ) { + declarative_part_AST = RefAdaAST(currentAST.root); +#line 978 "ada.g" + declarative_part_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DECLARATIVE_PART,"DECLARATIVE_PART")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(declarative_part_AST)))); +#line 7799 "AdaParser.cpp" + currentAST.root = declarative_part_AST; + if ( declarative_part_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + declarative_part_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = declarative_part_AST->getFirstChild(); + else + currentAST.child = declarative_part_AST; + currentAST.advanceChildToEnd(); + } + declarative_part_AST = RefAdaAST(currentAST.root); + returnAST = declarative_part_AST; +} + +void AdaParser::block_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST block_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken b = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST b_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + b = LT(1); + if ( inputState->guessing == 0 ) { + b_AST = astFactory->create(b); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(b_AST)); + } + match(BEGIN); + handled_stmt_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1058 "ada.g" + Set(b_AST, BLOCK_BODY); +#line 7832 "AdaParser.cpp" + } + block_body_AST = RefAdaAST(currentAST.root); + returnAST = block_body_AST; +} + +void AdaParser::declarative_item() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST declarative_item_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken pkg = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST pkg_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken tsk = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST tsk_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken pro = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST pro_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PACKAGE: + { + pkg = LT(1); + if ( inputState->guessing == 0 ) { + pkg_AST = astFactory->create(pkg); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(pkg_AST)); + } + match(PACKAGE); + { + switch ( LA(1)) { + case BODY: + { + body_is(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case SEPARATE: + { + separate(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 986 "ada.g" + Set(pkg_AST, PACKAGE_BODY_STUB); +#line 7878 "AdaParser.cpp" + } + break; + } + case PRAGMA: + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case END: + case SUBTYPE: + case GENERIC: + case BEGIN: + { + pkg_body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 988 "ada.g" + Set(pkg_AST, PACKAGE_BODY); +#line 7904 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + break; + } + case IDENTIFIER: + { + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + spec_decl_part(pkg_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case TASK: + { + tsk = LT(1); + if ( inputState->guessing == 0 ) { + tsk_AST = astFactory->create(tsk); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tsk_AST)); + } + match(TASK); + { + switch ( LA(1)) { + case BODY: + { + body_is(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case SEPARATE: + { + separate(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 994 "ada.g" + Set(tsk_AST, TASK_BODY_STUB); +#line 7964 "AdaParser.cpp" + } + break; + } + case PRAGMA: + case IDENTIFIER: + case USE: + case TYPE: + case PACKAGE: + case PROCEDURE: + case FUNCTION: + case TASK: + case PROTECTED: + case FOR: + case SUBTYPE: + case GENERIC: + case BEGIN: + { + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 995 "ada.g" + Set(tsk_AST, TASK_BODY); +#line 7989 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + break; + } + case IDENTIFIER: + case TYPE: + { + task_type_or_single_decl(tsk_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case PROTECTED: + { + pro = LT(1); + if ( inputState->guessing == 0 ) { + pro_AST = astFactory->create(pro); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(pro_AST)); + } + match(PROTECTED); + { + switch ( LA(1)) { + case BODY: + { + body_is(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case SEPARATE: + { + separate(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1002 "ada.g" + Set(pro_AST, PROTECTED_BODY_STUB); +#line 8046 "AdaParser.cpp" + } + break; + } + case PRAGMA: + case PROCEDURE: + case FUNCTION: + case ENTRY: + case END: + { + prot_op_bodies_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1004 "ada.g" + Set(pro_AST, PROTECTED_BODY); +#line 8067 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case IDENTIFIER: + case TYPE: + { + prot_type_or_single_decl(pro_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + break; + } + case PROCEDURE: + case FUNCTION: + { + subprog_decl_or_rename_or_inst_or_body(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case USE: + case TYPE: + case FOR: + case SUBTYPE: + case GENERIC: + { + decl_common(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + declarative_item_AST = RefAdaAST(currentAST.root); + returnAST = declarative_item_AST; +} + +void AdaParser::body_is() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST body_is_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(BODY); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + body_is_AST = RefAdaAST(currentAST.root); + returnAST = body_is_AST; +} + +void AdaParser::separate() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST separate_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(SEPARATE); + if ( inputState->guessing==0 ) { +#line 1023 "ada.g" + pop_def_id(); +#line 8153 "AdaParser.cpp" + } + separate_AST = RefAdaAST(currentAST.root); + returnAST = separate_AST; +} + +void AdaParser::prot_op_bodies_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST prot_op_bodies_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case ENTRY: + { + entry_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + case FUNCTION: + { + subprog_decl_or_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop332; + } + } + } + _loop332:; + } // ( ... )* + if ( inputState->guessing==0 ) { + prot_op_bodies_opt_AST = RefAdaAST(currentAST.root); +#line 1039 "ada.g" + prot_op_bodies_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PROT_OP_BODIES_OPT,"PROT_OP_BODIES_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(prot_op_bodies_opt_AST)))); +#line 8205 "AdaParser.cpp" + currentAST.root = prot_op_bodies_opt_AST; + if ( prot_op_bodies_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + prot_op_bodies_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = prot_op_bodies_opt_AST->getFirstChild(); + else + currentAST.child = prot_op_bodies_opt_AST; + currentAST.advanceChildToEnd(); + } + prot_op_bodies_opt_AST = RefAdaAST(currentAST.root); + returnAST = prot_op_bodies_opt_AST; +} + +void AdaParser::block_body_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST block_body_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case BEGIN: + { + match(BEGIN); + handled_stmt_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + block_body_opt_AST = RefAdaAST(currentAST.root); +#line 1030 "ada.g" + block_body_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(BLOCK_BODY_OPT,"BLOCK_BODY_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(block_body_opt_AST)))); +#line 8249 "AdaParser.cpp" + currentAST.root = block_body_opt_AST; + if ( block_body_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + block_body_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = block_body_opt_AST->getFirstChild(); + else + currentAST.child = block_body_opt_AST; + currentAST.advanceChildToEnd(); + } + block_body_opt_AST = RefAdaAST(currentAST.root); + returnAST = block_body_opt_AST; +} + +void AdaParser::handled_stmt_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST handled_stmt_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + except_handler_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + handled_stmt_s_AST = RefAdaAST(currentAST.root); +#line 1062 "ada.g" + handled_stmt_s_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(HANDLED_SEQUENCE_OF_STATEMENTS,"HANDLED_SEQUENCE_OF_STATEMENTS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(handled_stmt_s_AST)))); +#line 8280 "AdaParser.cpp" + currentAST.root = handled_stmt_s_AST; + if ( handled_stmt_s_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + handled_stmt_s_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = handled_stmt_s_AST->getFirstChild(); + else + currentAST.child = handled_stmt_s_AST; + currentAST.advanceChildToEnd(); + } + handled_stmt_s_AST = RefAdaAST(currentAST.root); + returnAST = handled_stmt_s_AST; +} + +void AdaParser::entry_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken e = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST e_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + e = LT(1); + if ( inputState->guessing == 0 ) { + e_AST = astFactory->create(e); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(e_AST)); + } + match(ENTRY); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + entry_body_formal_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + entry_barrier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1236 "ada.g" + Set (e_AST, ENTRY_BODY); +#line 8327 "AdaParser.cpp" + } + entry_body_AST = RefAdaAST(currentAST.root); + returnAST = entry_body_AST; +} + +void AdaParser::subprog_decl_or_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subprog_decl_or_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken f = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST f_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case PROCEDURE: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PROCEDURE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IS: + { + match(IS); + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1046 "ada.g" + Set(p_AST, PROCEDURE_BODY); +#line 8371 "AdaParser.cpp" + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 1047 "ada.g" + pop_def_id(); Set(p_AST, PROCEDURE_DECLARATION); +#line 8380 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + subprog_decl_or_body_AST = RefAdaAST(currentAST.root); + break; + } + case FUNCTION: + { + f = LT(1); + if ( inputState->guessing == 0 ) { + f_AST = astFactory->create(f); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)); + } + match(FUNCTION); + def_designator(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IS: + { + match(IS); + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1051 "ada.g" + Set(f_AST, FUNCTION_BODY); +#line 8422 "AdaParser.cpp" + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 1052 "ada.g" + pop_def_id(); Set(f_AST, FUNCTION_DECLARATION); +#line 8431 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + subprog_decl_or_body_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = subprog_decl_or_body_AST; +} + +void AdaParser::statements() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST statements_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )+ + int _cnt342=0; + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case NuLL: + case RETURN: + case FOR: + case CASE: + case BEGIN: + case LT_LT: + case IF: + case LOOP: + case WHILE: + case DECLARE: + case EXIT: + case GOTO: + case ACCEPT: + case DELAY: + case SELECT: + case ABORT: + case RAISE: + case REQUEUE: + { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + if ( _cnt342>=1 ) { goto _loop342; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + } + _cnt342++; + } + _loop342:; + } // ( ... )+ + if ( inputState->guessing==0 ) { + statements_AST = RefAdaAST(currentAST.root); +#line 1074 "ada.g" + statements_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(SEQUENCE_OF_STATEMENTS,"SEQUENCE_OF_STATEMENTS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(statements_AST)))); +#line 8509 "AdaParser.cpp" + currentAST.root = statements_AST; + if ( statements_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + statements_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = statements_AST->getFirstChild(); + else + currentAST.child = statements_AST; + currentAST.advanceChildToEnd(); + } + statements_AST = RefAdaAST(currentAST.root); + returnAST = statements_AST; +} + +void AdaParser::except_handler_part_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST except_handler_part_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case EXCEPTION: + { + match(EXCEPTION); + { // ( ... )+ + int _cnt429=0; + for (;;) { + if ((LA(1) == WHEN)) { + exception_handler(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt429>=1 ) { goto _loop429; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt429++; + } + _loop429:; + } // ( ... )+ + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + except_handler_part_opt_AST = RefAdaAST(currentAST.root); +#line 1365 "ada.g" + except_handler_part_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(EXCEPT_HANDLER_PART_OPT,"EXCEPT_HANDLER_PART_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(except_handler_part_opt_AST)))); +#line 8566 "AdaParser.cpp" + currentAST.root = except_handler_part_opt_AST; + if ( except_handler_part_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + except_handler_part_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = except_handler_part_opt_AST->getFirstChild(); + else + currentAST.child = except_handler_part_opt_AST; + currentAST.advanceChildToEnd(); + } + except_handler_part_opt_AST = RefAdaAST(currentAST.root); + returnAST = except_handler_part_opt_AST; +} + +void AdaParser::handled_stmts_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST handled_stmts_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case PRAGMA: + case IDENTIFIER: + case NuLL: + case RETURN: + case FOR: + case CASE: + case BEGIN: + case LT_LT: + case IF: + case LOOP: + case WHILE: + case DECLARE: + case EXIT: + case GOTO: + case ACCEPT: + case DELAY: + case SELECT: + case ABORT: + case RAISE: + case REQUEUE: + { + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + except_handler_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + handled_stmts_opt_AST = RefAdaAST(currentAST.root); +#line 1068 "ada.g" + handled_stmts_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(HANDLED_STMTS_OPT,"HANDLED_STMTS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(handled_stmts_opt_AST)))); +#line 8632 "AdaParser.cpp" + currentAST.root = handled_stmts_opt_AST; + if ( handled_stmts_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + handled_stmts_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = handled_stmts_opt_AST->getFirstChild(); + else + currentAST.child = handled_stmts_opt_AST; + currentAST.advanceChildToEnd(); + } + handled_stmts_opt_AST = RefAdaAST(currentAST.root); + returnAST = handled_stmts_opt_AST; +} + +void AdaParser::statement() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST statement_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + def_label_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case NuLL: + { + null_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case EXIT: + { + exit_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RETURN: + { + return_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case GOTO: + { + goto_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DELAY: + { + delay_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case ABORT: + { + abort_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RAISE: + { + raise_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case REQUEUE: + { + requeue_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case ACCEPT: + { + accept_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SELECT: + { + select_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IF: + { + if_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case CASE: + { + case_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case FOR: + case LOOP: + case WHILE: + { + loop_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case BEGIN: + case DECLARE: + { + block(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(SEMI); + break; + } + default: + if ((LA(1) == IDENTIFIER) && (LA(2) == COLON)) { + statement_identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case FOR: + case LOOP: + case WHILE: + { + loop_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case BEGIN: + case DECLARE: + { + block(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else if ((LA(1) == IDENTIFIER) && (_tokenSet_24.member(LA(2)))) { + call_or_assignment(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + statement_AST = RefAdaAST(currentAST.root); +#line 1100 "ada.g" + statement_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(STATEMENT,"STATEMENT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(statement_AST)))); +#line 8833 "AdaParser.cpp" + currentAST.root = statement_AST; + if ( statement_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + statement_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = statement_AST->getFirstChild(); + else + currentAST.child = statement_AST; + currentAST.advanceChildToEnd(); + } + statement_AST = RefAdaAST(currentAST.root); + returnAST = statement_AST; +} + +void AdaParser::def_label_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST def_label_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case LT_LT: + { + match(LT_LT); + RefAdaAST tmp277_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp277_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp277_AST)); + } + match(IDENTIFIER); + match(GT_GT); + break; + } + case IDENTIFIER: + case NuLL: + case RETURN: + case FOR: + case CASE: + case BEGIN: + case IF: + case LOOP: + case WHILE: + case DECLARE: + case EXIT: + case GOTO: + case ACCEPT: + case DELAY: + case SELECT: + case ABORT: + case RAISE: + case REQUEUE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + def_label_opt_AST = RefAdaAST(currentAST.root); +#line 1104 "ada.g" + def_label_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(LABEL_OPT,"LABEL_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(def_label_opt_AST)))); +#line 8896 "AdaParser.cpp" + currentAST.root = def_label_opt_AST; + if ( def_label_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + def_label_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = def_label_opt_AST->getFirstChild(); + else + currentAST.child = def_label_opt_AST; + currentAST.advanceChildToEnd(); + } + def_label_opt_AST = RefAdaAST(currentAST.root); + returnAST = def_label_opt_AST; +} + +void AdaParser::null_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST null_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(NuLL); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1108 "ada.g" + Set(s_AST, NULL_STATEMENT); +#line 8926 "AdaParser.cpp" + } + null_stmt_AST = RefAdaAST(currentAST.root); + returnAST = null_stmt_AST; +} + +void AdaParser::exit_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST exit_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(EXIT); + { + switch ( LA(1)) { + case IDENTIFIER: + { + label_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case WHEN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case WHEN: + { + RefAdaAST tmp280_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp280_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp280_AST)); + } + match(WHEN); + condition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1206 "ada.g" + Set(s_AST, EXIT_STATEMENT); +#line 8996 "AdaParser.cpp" + } + exit_stmt_AST = RefAdaAST(currentAST.root); + returnAST = exit_stmt_AST; +} + +void AdaParser::return_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST return_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(RETURN); + { + switch ( LA(1)) { + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1213 "ada.g" + Set(s_AST, RETURN_STATEMENT); +#line 9049 "AdaParser.cpp" + } + return_stmt_AST = RefAdaAST(currentAST.root); + returnAST = return_stmt_AST; +} + +void AdaParser::goto_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST goto_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(GOTO); + label_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1217 "ada.g" + Set(s_AST, GOTO_STATEMENT); +#line 9076 "AdaParser.cpp" + } + goto_stmt_AST = RefAdaAST(currentAST.root); + returnAST = goto_stmt_AST; +} + +void AdaParser::delay_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST delay_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken d = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST d_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + d = LT(1); + if ( inputState->guessing == 0 ) { + d_AST = astFactory->create(d); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(d_AST)); + } + match(DELAY); + until_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1282 "ada.g" + Set (d_AST, DELAY_STATEMENT); +#line 9107 "AdaParser.cpp" + } + delay_stmt_AST = RefAdaAST(currentAST.root); + returnAST = delay_stmt_AST; +} + +void AdaParser::abort_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST abort_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST a_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + a = LT(1); + if ( inputState->guessing == 0 ) { + a_AST = astFactory->create(a); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(a_AST)); + } + match(ABORT); + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop425; + } + + } + _loop425:; + } // ( ... )* + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1361 "ada.g" + Set (a_AST, ABORT_STATEMENT); +#line 9150 "AdaParser.cpp" + } + abort_stmt_AST = RefAdaAST(currentAST.root); + returnAST = abort_stmt_AST; +} + +void AdaParser::raise_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST raise_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken r = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST r_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + r = LT(1); + if ( inputState->guessing == 0 ) { + r_AST = astFactory->create(r); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(r_AST)); + } + match(RAISE); + { + switch ( LA(1)) { + case IDENTIFIER: + { + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1389 "ada.g" + Set (r_AST, RAISE_STATEMENT); +#line 9193 "AdaParser.cpp" + } + raise_stmt_AST = RefAdaAST(currentAST.root); + returnAST = raise_stmt_AST; +} + +void AdaParser::requeue_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST requeue_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken r = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST r_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + r = LT(1); + if ( inputState->guessing == 0 ) { + r_AST = astFactory->create(r); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(r_AST)); + } + match(REQUEUE); + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case WITH: + { + match(WITH); + RefAdaAST tmp289_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp289_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp289_AST)); + } + match(ABORT); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1393 "ada.g" + Set (r_AST, REQUEUE_STATEMENT); +#line 9243 "AdaParser.cpp" + } + requeue_stmt_AST = RefAdaAST(currentAST.root); + returnAST = requeue_stmt_AST; +} + +void AdaParser::accept_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST accept_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST a_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + a = LT(1); + if ( inputState->guessing == 0 ) { + a_AST = astFactory->create(a); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(a_AST)); + } + match(ACCEPT); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + entry_index_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case DO: + { + match(DO); + handled_stmts_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case SEMI: + { + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1264 "ada.g" + pop_def_id(); +#line 9296 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 1266 "ada.g" + Set (a_AST, ACCEPT_STATEMENT); +#line 9309 "AdaParser.cpp" + } + accept_stmt_AST = RefAdaAST(currentAST.root); + returnAST = accept_stmt_AST; +} + +void AdaParser::select_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST select_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(SELECT); + { + bool synPredMatched403 = false; + if (((LA(1) == IDENTIFIER || LA(1) == DELAY) && (_tokenSet_25.member(LA(2))))) { + int _m403 = mark(); + synPredMatched403 = true; + inputState->guessing++; + try { + { + triggering_alternative(); + match(THEN); + match(ABORT); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched403 = false; + } + rewind(_m403); + inputState->guessing--; + } + if ( synPredMatched403 ) { + triggering_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(THEN); + match(ABORT); + abortable_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1297 "ada.g" + Set (s_AST, ASYNCHRONOUS_SELECT); +#line 9361 "AdaParser.cpp" + } + } + else if ((_tokenSet_26.member(LA(1))) && (_tokenSet_27.member(LA(2)))) { + selective_accept(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1299 "ada.g" + Set (s_AST, SELECTIVE_ACCEPT); +#line 9372 "AdaParser.cpp" + } + } + else if ((LA(1) == IDENTIFIER) && (_tokenSet_28.member(LA(2)))) { + entry_call_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case OR: + { + match(OR); + delay_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1301 "ada.g" + Set (s_AST, TIMED_ENTRY_CALL); +#line 9392 "AdaParser.cpp" + } + break; + } + case ELSE: + { + match(ELSE); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1302 "ada.g" + Set (s_AST, CONDITIONAL_ENTRY_CALL); +#line 9406 "AdaParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + match(END); + match(SELECT); + match(SEMI); + select_stmt_AST = RefAdaAST(currentAST.root); + returnAST = select_stmt_AST; +} + +void AdaParser::if_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST if_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(IF); + cond_clause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + elsifs_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + else_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(IF); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1114 "ada.g" + Set(s_AST, IF_STATEMENT); +#line 9460 "AdaParser.cpp" + } + if_stmt_AST = RefAdaAST(currentAST.root); + returnAST = if_stmt_AST; +} + +void AdaParser::case_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST case_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(CASE); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + alternative_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(CASE); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1134 "ada.g" + Set(s_AST, CASE_STATEMENT); +#line 9494 "AdaParser.cpp" + } + case_stmt_AST = RefAdaAST(currentAST.root); + returnAST = case_stmt_AST; +} + +void AdaParser::loop_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST loop_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken l = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST l_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + iteration_scheme_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + l = LT(1); + if ( inputState->guessing == 0 ) { + l_AST = astFactory->create(l); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(l_AST)); + } + match(LOOP); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(LOOP); + if ( inputState->guessing==0 ) { +#line 1146 "ada.g" + Set(l_AST, LOOP_STATEMENT); +#line 9526 "AdaParser.cpp" + } + loop_stmt_AST = RefAdaAST(currentAST.root); + returnAST = loop_stmt_AST; +} + +void AdaParser::block() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST block_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + declare_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + block_body(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + block_AST = RefAdaAST(currentAST.root); +#line 1198 "ada.g" + block_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(BLOCK_STATEMENT,"BLOCK_STATEMENT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(block_AST)))); +#line 9549 "AdaParser.cpp" + currentAST.root = block_AST; + if ( block_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + block_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = block_AST->getFirstChild(); + else + currentAST.child = block_AST; + currentAST.advanceChildToEnd(); + } + block_AST = RefAdaAST(currentAST.root); + returnAST = block_AST; +} + +void AdaParser::statement_identifier() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST statement_identifier_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken n = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + n = LT(1); + if ( inputState->guessing == 0 ) { + n_AST = astFactory->create(n); + } + match(IDENTIFIER); + match(COLON); + if ( inputState->guessing==0 ) { +#line 1186 "ada.g" + push_def_id(n_AST); +#line 9578 "AdaParser.cpp" + } + returnAST = statement_identifier_AST; +} + +void AdaParser::id_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST id_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + id_opt_aux(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + id_opt_AST = RefAdaAST(currentAST.root); +#line 1172 "ada.g" + id_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ID_OPT,"ID_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(id_opt_AST)))); +#line 9596 "AdaParser.cpp" + currentAST.root = id_opt_AST; + if ( id_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + id_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = id_opt_AST->getFirstChild(); + else + currentAST.child = id_opt_AST; + currentAST.advanceChildToEnd(); + } + id_opt_AST = RefAdaAST(currentAST.root); + returnAST = id_opt_AST; +} + +void AdaParser::call_or_assignment() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST call_or_assignment_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case ASSIGN: + { + match(ASSIGN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + call_or_assignment_AST = RefAdaAST(currentAST.root); +#line 1222 "ada.g" + call_or_assignment_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ASSIGNMENT_STATEMENT,"ASSIGNMENT_STATEMENT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(call_or_assignment_AST)))); +#line 9632 "AdaParser.cpp" + currentAST.root = call_or_assignment_AST; + if ( call_or_assignment_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + call_or_assignment_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = call_or_assignment_AST->getFirstChild(); + else + currentAST.child = call_or_assignment_AST; + currentAST.advanceChildToEnd(); + } + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { + call_or_assignment_AST = RefAdaAST(currentAST.root); +#line 1225 "ada.g" + call_or_assignment_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(CALL_STATEMENT,"CALL_STATEMENT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(call_or_assignment_AST)))); +#line 9650 "AdaParser.cpp" + currentAST.root = call_or_assignment_AST; + if ( call_or_assignment_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + call_or_assignment_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = call_or_assignment_AST->getFirstChild(); + else + currentAST.child = call_or_assignment_AST; + currentAST.advanceChildToEnd(); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + call_or_assignment_AST = RefAdaAST(currentAST.root); + returnAST = call_or_assignment_AST; +} + +void AdaParser::cond_clause() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST cond_clause_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken c = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST c_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + condition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + c = LT(1); + if ( inputState->guessing == 0 ) { + c_AST = astFactory->create(c); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(c_AST)); + } + match(THEN); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1118 "ada.g" + Set(c_AST, COND_CLAUSE); +#line 9696 "AdaParser.cpp" + } + cond_clause_AST = RefAdaAST(currentAST.root); + returnAST = cond_clause_AST; +} + +void AdaParser::elsifs_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST elsifs_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + if ((LA(1) == ELSIF)) { + match(ELSIF); + cond_clause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop354; + } + + } + _loop354:; + } // ( ... )* + if ( inputState->guessing==0 ) { + elsifs_opt_AST = RefAdaAST(currentAST.root); +#line 1126 "ada.g" + elsifs_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ELSIFS_OPT,"ELSIFS_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(elsifs_opt_AST)))); +#line 9727 "AdaParser.cpp" + currentAST.root = elsifs_opt_AST; + if ( elsifs_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + elsifs_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = elsifs_opt_AST->getFirstChild(); + else + currentAST.child = elsifs_opt_AST; + currentAST.advanceChildToEnd(); + } + elsifs_opt_AST = RefAdaAST(currentAST.root); + returnAST = elsifs_opt_AST; +} + +void AdaParser::else_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST else_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case ELSE: + { + match(ELSE); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + else_opt_AST = RefAdaAST(currentAST.root); +#line 1130 "ada.g" + else_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ELSE_OPT,"ELSE_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(else_opt_AST)))); +#line 9770 "AdaParser.cpp" + currentAST.root = else_opt_AST; + if ( else_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + else_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = else_opt_AST->getFirstChild(); + else + currentAST.child = else_opt_AST; + currentAST.advanceChildToEnd(); + } + else_opt_AST = RefAdaAST(currentAST.root); + returnAST = else_opt_AST; +} + +void AdaParser::condition() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST condition_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + condition_AST = RefAdaAST(currentAST.root); + returnAST = condition_AST; +} + +void AdaParser::alternative_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST alternative_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )+ + int _cnt360=0; + for (;;) { + if ((LA(1) == WHEN)) { + case_statement_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt360>=1 ) { goto _loop360; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt360++; + } + _loop360:; + } // ( ... )+ + alternative_s_AST = RefAdaAST(currentAST.root); + returnAST = alternative_s_AST; +} + +void AdaParser::case_statement_alternative() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST case_statement_alternative_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(WHEN); + choice_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RIGHT_SHAFT); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1141 "ada.g" + Set(s_AST, CASE_STATEMENT_ALTERNATIVE); +#line 9847 "AdaParser.cpp" + } + case_statement_alternative_AST = RefAdaAST(currentAST.root); + returnAST = case_statement_alternative_AST; +} + +void AdaParser::iteration_scheme_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST iteration_scheme_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case WHILE: + { + RefAdaAST tmp316_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp316_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp316_AST)); + } + match(WHILE); + condition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case FOR: + { + RefAdaAST tmp317_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp317_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp317_AST)); + } + match(FOR); + RefAdaAST tmp318_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp318_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp318_AST)); + } + match(IDENTIFIER); + match(IN); + reverse_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + discrete_subtype_definition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LOOP: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + iteration_scheme_opt_AST = RefAdaAST(currentAST.root); +#line 1152 "ada.g" + iteration_scheme_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ITERATION_SCHEME_OPT,"ITERATION_SCHEME_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(iteration_scheme_opt_AST)))); +#line 9914 "AdaParser.cpp" + currentAST.root = iteration_scheme_opt_AST; + if ( iteration_scheme_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + iteration_scheme_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = iteration_scheme_opt_AST->getFirstChild(); + else + currentAST.child = iteration_scheme_opt_AST; + currentAST.advanceChildToEnd(); + } + iteration_scheme_opt_AST = RefAdaAST(currentAST.root); + returnAST = iteration_scheme_opt_AST; +} + +void AdaParser::reverse_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST reverse_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case REVERSE: + { + RefAdaAST tmp320_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp320_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp320_AST)); + } + match(REVERSE); + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + reverse_opt_AST = RefAdaAST(currentAST.root); +#line 1158 "ada.g" + reverse_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(reverse_opt_AST)))); +#line 9968 "AdaParser.cpp" + currentAST.root = reverse_opt_AST; + if ( reverse_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + reverse_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = reverse_opt_AST->getFirstChild(); + else + currentAST.child = reverse_opt_AST; + currentAST.advanceChildToEnd(); + } + reverse_opt_AST = RefAdaAST(currentAST.root); + returnAST = reverse_opt_AST; +} + +void AdaParser::id_opt_aux() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST id_opt_aux_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 1161 "ada.g" + RefAdaAST endid; +#line 9988 "AdaParser.cpp" + + switch ( LA(1)) { + case CHAR_STRING: + { + endid=definable_operator_symbol(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if (!( end_id_matches_def_id (endid) )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" end_id_matches_def_id (endid) "); + id_opt_aux_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + { + compound_name(); + if (inputState->guessing==0) { + n_AST = returnAST; + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if (!( end_id_matches_def_id (n_AST) )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" end_id_matches_def_id (n_AST) "); + id_opt_aux_AST = RefAdaAST(currentAST.root); + break; + } + case SEMI: + { + if ( inputState->guessing==0 ) { +#line 1168 "ada.g" + pop_def_id(); +#line 10019 "AdaParser.cpp" + } + id_opt_aux_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = id_opt_aux_AST; +} + +void AdaParser::declare_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST declare_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case DECLARE: + { + match(DECLARE); + declarative_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case BEGIN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + declare_opt_AST = RefAdaAST(currentAST.root); +#line 1202 "ada.g" + declare_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DECLARE_OPT,"DECLARE_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(declare_opt_AST)))); +#line 10062 "AdaParser.cpp" + currentAST.root = declare_opt_AST; + if ( declare_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + declare_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = declare_opt_AST->getFirstChild(); + else + currentAST.child = declare_opt_AST; + currentAST.advanceChildToEnd(); + } + declare_opt_AST = RefAdaAST(currentAST.root); + returnAST = declare_opt_AST; +} + +void AdaParser::label_name() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST label_name_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + RefAdaAST tmp322_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp322_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp322_AST)); + } + match(IDENTIFIER); + label_name_AST = RefAdaAST(currentAST.root); + returnAST = label_name_AST; +} + +void AdaParser::entry_body_formal_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_body_formal_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + entry_index_spec_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + entry_body_formal_part_AST = RefAdaAST(currentAST.root); + returnAST = entry_body_formal_part_AST; +} + +void AdaParser::entry_barrier() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_barrier_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(WHEN); + condition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + entry_barrier_AST = RefAdaAST(currentAST.root); + returnAST = entry_barrier_AST; +} + +void AdaParser::entry_index_spec_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_index_spec_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + bool synPredMatched388 = false; + if (((LA(1) == LPAREN) && (LA(2) == FOR))) { + int _m388 = mark(); + synPredMatched388 = true; + inputState->guessing++; + try { + { + match(LPAREN); + match(FOR); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched388 = false; + } + rewind(_m388); + inputState->guessing--; + } + if ( synPredMatched388 ) { + match(LPAREN); + match(FOR); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IN); + discrete_subtype_definition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + } + else if ((LA(1) == LPAREN || LA(1) == WHEN) && (_tokenSet_0.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + if ( inputState->guessing==0 ) { + entry_index_spec_opt_AST = RefAdaAST(currentAST.root); +#line 1247 "ada.g" + entry_index_spec_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ENTRY_INDEX_SPECIFICATION,"ENTRY_INDEX_SPECIFICATION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(entry_index_spec_opt_AST)))); +#line 10170 "AdaParser.cpp" + currentAST.root = entry_index_spec_opt_AST; + if ( entry_index_spec_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + entry_index_spec_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = entry_index_spec_opt_AST->getFirstChild(); + else + currentAST.child = entry_index_spec_opt_AST; + currentAST.advanceChildToEnd(); + } + entry_index_spec_opt_AST = RefAdaAST(currentAST.root); + returnAST = entry_index_spec_opt_AST; +} + +void AdaParser::entry_call_stmt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_call_stmt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { + entry_call_stmt_AST = RefAdaAST(currentAST.root); +#line 1257 "ada.g" + entry_call_stmt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ENTRY_CALL_STATEMENT,"ENTRY_CALL_STATEMENT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(entry_call_stmt_AST)))); +#line 10198 "AdaParser.cpp" + currentAST.root = entry_call_stmt_AST; + if ( entry_call_stmt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + entry_call_stmt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = entry_call_stmt_AST->getFirstChild(); + else + currentAST.child = entry_call_stmt_AST; + currentAST.advanceChildToEnd(); + } + entry_call_stmt_AST = RefAdaAST(currentAST.root); + returnAST = entry_call_stmt_AST; +} + +void AdaParser::entry_index_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_index_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + bool synPredMatched396 = false; + if (((LA(1) == LPAREN) && (_tokenSet_0.member(LA(2))))) { + int _m396 = mark(); + synPredMatched396 = true; + inputState->guessing++; + try { + { + match(LPAREN); + expression(); + match(RPAREN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched396 = false; + } + rewind(_m396); + inputState->guessing--; + } + if ( synPredMatched396 ) { + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + } + else if ((LA(1) == SEMI || LA(1) == LPAREN || LA(1) == DO) && (_tokenSet_29.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + if ( inputState->guessing==0 ) { + entry_index_opt_AST = RefAdaAST(currentAST.root); +#line 1276 "ada.g" + entry_index_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ENTRY_INDEX_OPT,"ENTRY_INDEX_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(entry_index_opt_AST)))); +#line 10255 "AdaParser.cpp" + currentAST.root = entry_index_opt_AST; + if ( entry_index_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + entry_index_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = entry_index_opt_AST->getFirstChild(); + else + currentAST.child = entry_index_opt_AST; + currentAST.advanceChildToEnd(); + } + entry_index_opt_AST = RefAdaAST(currentAST.root); + returnAST = entry_index_opt_AST; +} + +void AdaParser::until_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST until_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case UNTIL: + { + RefAdaAST tmp331_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp331_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp331_AST)); + } + match(UNTIL); + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case PLUS: + case MINUS: + case ABS: + case NUMERIC_LIT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + until_opt_AST = RefAdaAST(currentAST.root); +#line 1286 "ada.g" + until_opt_AST = RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(until_opt_AST)))); +#line 10309 "AdaParser.cpp" + currentAST.root = until_opt_AST; + if ( until_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + until_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = until_opt_AST->getFirstChild(); + else + currentAST.child = until_opt_AST; + currentAST.advanceChildToEnd(); + } + until_opt_AST = RefAdaAST(currentAST.root); + returnAST = until_opt_AST; +} + +void AdaParser::triggering_alternative() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST triggering_alternative_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case DELAY: + { + delay_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + { + entry_call_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + stmts_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + triggering_alternative_AST = RefAdaAST(currentAST.root); +#line 1310 "ada.g" + triggering_alternative_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TRIGGERING_ALTERNATIVE,"TRIGGERING_ALTERNATIVE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(triggering_alternative_AST)))); +#line 10360 "AdaParser.cpp" + currentAST.root = triggering_alternative_AST; + if ( triggering_alternative_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + triggering_alternative_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = triggering_alternative_AST->getFirstChild(); + else + currentAST.child = triggering_alternative_AST; + currentAST.advanceChildToEnd(); + } + triggering_alternative_AST = RefAdaAST(currentAST.root); + returnAST = triggering_alternative_AST; +} + +void AdaParser::abortable_part() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST abortable_part_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + stmts_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + abortable_part_AST = RefAdaAST(currentAST.root); +#line 1316 "ada.g" + abortable_part_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ABORTABLE_PART,"ABORTABLE_PART")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(abortable_part_AST)))); +#line 10387 "AdaParser.cpp" + currentAST.root = abortable_part_AST; + if ( abortable_part_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + abortable_part_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = abortable_part_AST->getFirstChild(); + else + currentAST.child = abortable_part_AST; + currentAST.advanceChildToEnd(); + } + abortable_part_AST = RefAdaAST(currentAST.root); + returnAST = abortable_part_AST; +} + +void AdaParser::selective_accept() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST selective_accept_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + guard_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + select_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + or_select_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + else_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + selective_accept_AST = RefAdaAST(currentAST.root); + returnAST = selective_accept_AST; +} + +void AdaParser::entry_call_alternative() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST entry_call_alternative_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + entry_call_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + stmts_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + entry_call_alternative_AST = RefAdaAST(currentAST.root); +#line 1322 "ada.g" + entry_call_alternative_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ENTRY_CALL_ALTERNATIVE,"ENTRY_CALL_ALTERNATIVE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(entry_call_alternative_AST)))); +#line 10443 "AdaParser.cpp" + currentAST.root = entry_call_alternative_AST; + if ( entry_call_alternative_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + entry_call_alternative_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = entry_call_alternative_AST->getFirstChild(); + else + currentAST.child = entry_call_alternative_AST; + currentAST.advanceChildToEnd(); + } + entry_call_alternative_AST = RefAdaAST(currentAST.root); + returnAST = entry_call_alternative_AST; +} + +void AdaParser::delay_alternative() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST delay_alternative_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + delay_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + stmts_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + delay_alternative_AST = RefAdaAST(currentAST.root); +#line 1347 "ada.g" + delay_alternative_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(DELAY_ALTERNATIVE,"DELAY_ALTERNATIVE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(delay_alternative_AST)))); +#line 10474 "AdaParser.cpp" + currentAST.root = delay_alternative_AST; + if ( delay_alternative_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + delay_alternative_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = delay_alternative_AST->getFirstChild(); + else + currentAST.child = delay_alternative_AST; + currentAST.advanceChildToEnd(); + } + delay_alternative_AST = RefAdaAST(currentAST.root); + returnAST = delay_alternative_AST; +} + +void AdaParser::stmts_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST stmts_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case PRAGMA: + { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case NuLL: + case RETURN: + case FOR: + case CASE: + case BEGIN: + case LT_LT: + case IF: + case LOOP: + case WHILE: + case DECLARE: + case EXIT: + case GOTO: + case ACCEPT: + case DELAY: + case SELECT: + case ABORT: + case RAISE: + case REQUEUE: + { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop419; + } + } + } + _loop419:; + } // ( ... )* + stmts_opt_AST = RefAdaAST(currentAST.root); + returnAST = stmts_opt_AST; +} + +void AdaParser::guard_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST guard_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken w = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST w_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case WHEN: + { + w = LT(1); + if ( inputState->guessing == 0 ) { + w_AST = astFactory->create(w); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(w_AST)); + } + match(WHEN); + condition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RIGHT_SHAFT); + { // ( ... )* + for (;;) { + if ((LA(1) == PRAGMA)) { + pragma(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop413; + } + + } + _loop413:; + } // ( ... )* + break; + } + case ACCEPT: + case DELAY: + case TERMINATE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 1331 "ada.g" + Set(w_AST, GUARD_OPT); +#line 10595 "AdaParser.cpp" + } + guard_opt_AST = RefAdaAST(currentAST.root); + returnAST = guard_opt_AST; +} + +void AdaParser::select_alternative() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST select_alternative_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken t = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST t_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case ACCEPT: + { + accept_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + select_alternative_AST = RefAdaAST(currentAST.root); + break; + } + case DELAY: + { + delay_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + select_alternative_AST = RefAdaAST(currentAST.root); + break; + } + case TERMINATE: + { + t = LT(1); + if ( inputState->guessing == 0 ) { + t_AST = astFactory->create(t); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(t_AST)); + } + match(TERMINATE); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1337 "ada.g" + Set(t_AST, TERMINATE_ALTERNATIVE); +#line 10639 "AdaParser.cpp" + } + select_alternative_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = select_alternative_AST; +} + +void AdaParser::or_select_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST or_select_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { // ( ... )* + for (;;) { + if ((LA(1) == OR)) { + match(OR); + guard_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + select_alternative(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop422; + } + + } + _loop422:; + } // ( ... )* + if ( inputState->guessing==0 ) { + or_select_opt_AST = RefAdaAST(currentAST.root); +#line 1356 "ada.g" + or_select_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(OR_SELECT_OPT,"OR_SELECT_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(or_select_opt_AST)))); +#line 10682 "AdaParser.cpp" + currentAST.root = or_select_opt_AST; + if ( or_select_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + or_select_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = or_select_opt_AST->getFirstChild(); + else + currentAST.child = or_select_opt_AST; + currentAST.advanceChildToEnd(); + } + or_select_opt_AST = RefAdaAST(currentAST.root); + returnAST = or_select_opt_AST; +} + +void AdaParser::accept_alternative() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST accept_alternative_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + accept_stmt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + stmts_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + accept_alternative_AST = RefAdaAST(currentAST.root); +#line 1341 "ada.g" + accept_alternative_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ACCEPT_ALTERNATIVE,"ACCEPT_ALTERNATIVE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(accept_alternative_AST)))); +#line 10713 "AdaParser.cpp" + currentAST.root = accept_alternative_AST; + if ( accept_alternative_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + accept_alternative_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = accept_alternative_AST->getFirstChild(); + else + currentAST.child = accept_alternative_AST; + currentAST.advanceChildToEnd(); + } + accept_alternative_AST = RefAdaAST(currentAST.root); + returnAST = accept_alternative_AST; +} + +void AdaParser::exception_handler() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST exception_handler_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken w = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST w_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + w = LT(1); + if ( inputState->guessing == 0 ) { + w_AST = astFactory->create(w); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(w_AST)); + } + match(WHEN); + identifier_colon_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + except_choice_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RIGHT_SHAFT); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1372 "ada.g" + Set (w_AST, EXCEPTION_HANDLER); +#line 10755 "AdaParser.cpp" + } + exception_handler_AST = RefAdaAST(currentAST.root); + returnAST = exception_handler_AST; +} + +void AdaParser::identifier_colon_opt() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST identifier_colon_opt_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + if ((LA(1) == IDENTIFIER) && (LA(2) == COLON)) { + RefAdaAST tmp336_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp336_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp336_AST)); + } + match(IDENTIFIER); + match(COLON); + } + else if ((LA(1) == IDENTIFIER || LA(1) == OTHERS) && (LA(2) == RIGHT_SHAFT || LA(2) == DOT || LA(2) == PIPE)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + if ( inputState->guessing==0 ) { + identifier_colon_opt_AST = RefAdaAST(currentAST.root); +#line 1376 "ada.g" + identifier_colon_opt_AST = + RefAdaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(IDENTIFIER_COLON_OPT,"IDENTIFIER_COLON_OPT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(identifier_colon_opt_AST)))); +#line 10788 "AdaParser.cpp" + currentAST.root = identifier_colon_opt_AST; + if ( identifier_colon_opt_AST!=RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + identifier_colon_opt_AST->getFirstChild() != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = identifier_colon_opt_AST->getFirstChild(); + else + currentAST.child = identifier_colon_opt_AST; + currentAST.advanceChildToEnd(); + } + identifier_colon_opt_AST = RefAdaAST(currentAST.root); + returnAST = identifier_colon_opt_AST; +} + +void AdaParser::except_choice_s() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST except_choice_s_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + exception_choice(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == PIPE)) { + RefAdaAST tmp338_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp338_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp338_AST)); + } + match(PIPE); + exception_choice(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop435; + } + + } + _loop435:; + } // ( ... )* + except_choice_s_AST = RefAdaAST(currentAST.root); + returnAST = except_choice_s_AST; +} + +void AdaParser::exception_choice() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST exception_choice_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case IDENTIFIER: + { + compound_name(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + exception_choice_AST = RefAdaAST(currentAST.root); + break; + } + case OTHERS: + { + RefAdaAST tmp339_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp339_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp339_AST)); + } + match(OTHERS); + exception_choice_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = exception_choice_AST; +} + +void AdaParser::operator_call() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST operator_call_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken cs = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST cs_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + cs = LT(1); + if ( inputState->guessing == 0 ) { + cs_AST = astFactory->create(cs); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(cs_AST)); + } + match(CHAR_STRING); + operator_call_tail(cs_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + operator_call_AST = RefAdaAST(currentAST.root); + returnAST = operator_call_AST; +} + +void AdaParser::operator_call_tail( + RefAdaAST opstr +) { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST operator_call_tail_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + match(LPAREN); + if (!( is_operator_symbol(opstr->getText().c_str()) )) + throw ANTLR_USE_NAMESPACE(antlr)SemanticException(" is_operator_symbol(opstr->getText().c_str()) "); + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 1401 "ada.g" + opstr->setType(OPERATOR_SYMBOL); +#line 10908 "AdaParser.cpp" + } + operator_call_tail_AST = RefAdaAST(currentAST.root); + returnAST = operator_call_tail_AST; +} + +void AdaParser::relation() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST relation_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken n = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case IN: + { + RefAdaAST tmp342_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp342_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp342_AST)); + } + match(IN); + range_or_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case NOT: + { + n = LT(1); + if ( inputState->guessing == 0 ) { + n_AST = astFactory->create(n); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(n_AST)); + } + match(NOT); + match(IN); + range_or_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1425 "ada.g" + Set (n_AST, NOT_IN); +#line 10957 "AdaParser.cpp" + } + break; + } + case EQ: + { + RefAdaAST tmp344_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp344_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp344_AST)); + } + match(EQ); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case NE: + { + RefAdaAST tmp345_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp345_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp345_AST)); + } + match(NE); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LT_: + { + RefAdaAST tmp346_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp346_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp346_AST)); + } + match(LT_); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LE: + { + RefAdaAST tmp347_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp347_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp347_AST)); + } + match(LE); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case GT: + { + RefAdaAST tmp348_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp348_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp348_AST)); + } + match(GT); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case GE: + { + RefAdaAST tmp349_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp349_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp349_AST)); + } + match(GE); + simple_expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case COMMA: + case RPAREN: + case RIGHT_SHAFT: + case WITH: + case RANGE: + case DIGITS: + case IS: + case PIPE: + case DOT_DOT: + case ASSIGN: + case THEN: + case LOOP: + case OR: + case AND: + case XOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + relation_AST = RefAdaAST(currentAST.root); + returnAST = relation_AST; +} + +void AdaParser::range_or_mark() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST range_or_mark_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + bool synPredMatched455 = false; + if (((_tokenSet_0.member(LA(1))) && (_tokenSet_8.member(LA(2))))) { + int _m455 = mark(); + synPredMatched455 = true; + inputState->guessing++; + try { + { + range(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched455 = false; + } + rewind(_m455); + inputState->guessing--; + } + if ( synPredMatched455 ) { + range(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_or_mark_AST = RefAdaAST(currentAST.root); + } + else if ((LA(1) == IDENTIFIER) && (_tokenSet_30.member(LA(2)))) { + subtype_mark(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + range_or_mark_AST = RefAdaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + returnAST = range_or_mark_AST; +} + +void AdaParser::signed_term() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST signed_term_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken m = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST m_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case PLUS: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PLUS); + term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1447 "ada.g" + Set(p_AST, UNARY_PLUS); +#line 11141 "AdaParser.cpp" + } + signed_term_AST = RefAdaAST(currentAST.root); + break; + } + case MINUS: + { + m = LT(1); + if ( inputState->guessing == 0 ) { + m_AST = astFactory->create(m); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(m_AST)); + } + match(MINUS); + term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1448 "ada.g" + Set(m_AST, UNARY_MINUS); +#line 11161 "AdaParser.cpp" + } + signed_term_AST = RefAdaAST(currentAST.root); + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case ABS: + case NUMERIC_LIT: + { + term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + signed_term_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = signed_term_AST; +} + +void AdaParser::term() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST term_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case STAR: + { + RefAdaAST tmp350_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp350_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp350_AST)); + } + match(STAR); + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DIV: + { + RefAdaAST tmp351_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp351_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp351_AST)); + } + match(DIV); + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case MOD: + { + RefAdaAST tmp352_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp352_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp352_AST)); + } + match(MOD); + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case REM: + { + RefAdaAST tmp353_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp353_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp353_AST)); + } + match(REM); + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop462; + } + } + } + _loop462:; + } // ( ... )* + term_AST = RefAdaAST(currentAST.root); + returnAST = term_AST; +} + +void AdaParser::factor() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST factor_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case NOT: + { + RefAdaAST tmp354_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp354_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp354_AST)); + } + match(NOT); + primary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case ABS: + { + RefAdaAST tmp355_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp355_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp355_AST)); + } + match(ABS); + primary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case LPAREN: + case NEW: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NUMERIC_LIT: + { + primary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case EXPON: + { + RefAdaAST tmp356_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp356_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp356_AST)); + } + match(EXPON); + primary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case COMMA: + case RPAREN: + case RIGHT_SHAFT: + case WITH: + case RANGE: + case DIGITS: + case IS: + case PIPE: + case DOT_DOT: + case IN: + case ASSIGN: + case MOD: + case THEN: + case LOOP: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + factor_AST = RefAdaAST(currentAST.root); + returnAST = factor_AST; +} + +void AdaParser::primary() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST primary_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken cs = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST cs_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + { + switch ( LA(1)) { + case IDENTIFIER: + { + name_or_qualified(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LPAREN: + { + parenthesized_primary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case NEW: + { + allocator(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case NuLL: + { + RefAdaAST tmp357_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp357_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp357_AST)); + } + match(NuLL); + break; + } + case NUMERIC_LIT: + { + RefAdaAST tmp358_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp358_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp358_AST)); + } + match(NUMERIC_LIT); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp359_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp359_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp359_AST)); + } + match(CHARACTER_LITERAL); + break; + } + case CHAR_STRING: + { + cs = LT(1); + if ( inputState->guessing == 0 ) { + cs_AST = astFactory->create(cs); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(cs_AST)); + } + match(CHAR_STRING); + { + switch ( LA(1)) { + case LPAREN: + { + operator_call_tail(cs_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case COMMA: + case RPAREN: + case RIGHT_SHAFT: + case WITH: + case RANGE: + case DIGITS: + case IS: + case PIPE: + case DOT_DOT: + case IN: + case ASSIGN: + case MOD: + case THEN: + case LOOP: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case EXPON: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + primary_AST = RefAdaAST(currentAST.root); + returnAST = primary_AST; +} + +void AdaParser::name_or_qualified() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST name_or_qualified_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); +#line 1479 "ada.g" + RefAdaAST dummy; +#line 11528 "AdaParser.cpp" + + RefAdaAST tmp360_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp360_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp360_AST)); + } + match(IDENTIFIER); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case DOT: + { + RefAdaAST tmp361_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp361_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp361_AST)); + } + match(DOT); + { + switch ( LA(1)) { + case ALL: + { + RefAdaAST tmp362_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp362_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp362_AST)); + } + match(ALL); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp363_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp363_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp363_AST)); + } + match(IDENTIFIER); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp364_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp364_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp364_AST)); + } + match(CHARACTER_LITERAL); + break; + } + case CHAR_STRING: + { + dummy=is_operator(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case LPAREN: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(LPAREN); + value_s(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 1487 "ada.g" + Set(p_AST, INDEXED_COMPONENT); +#line 11611 "AdaParser.cpp" + } + break; + } + case TIC: + { + RefAdaAST tmp366_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp366_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp366_AST)); + } + match(TIC); + { + switch ( LA(1)) { + case LPAREN: + { + parenthesized_primary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENTIFIER: + case RANGE: + case DIGITS: + case DELTA: + case ACCESS: + { + attribute_id(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + goto _loop473; + } + } + } + _loop473:; + } // ( ... )* + name_or_qualified_AST = RefAdaAST(currentAST.root); + returnAST = name_or_qualified_AST; +} + +void AdaParser::allocator() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST allocator_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken n = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST n_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + n = LT(1); + if ( inputState->guessing == 0 ) { + n_AST = astFactory->create(n); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(n_AST)); + } + match(NEW); + name_or_qualified(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { +#line 1493 "ada.g" + Set(n_AST, ALLOCATOR); +#line 11685 "AdaParser.cpp" + } + allocator_AST = RefAdaAST(currentAST.root); + returnAST = allocator_AST; +} + +void AdaParser::subprogram_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST subprogram_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken f = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST f_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + switch ( LA(1)) { + case PROCEDURE: + { + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PROCEDURE); + def_id(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formal_part_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1507 "ada.g" + pop_def_id(); Set(p_AST, PROCEDURE_BODY); +#line 11726 "AdaParser.cpp" + } + subprogram_body_AST = RefAdaAST(currentAST.root); + break; + } + case FUNCTION: + { + f = LT(1); + if ( inputState->guessing == 0 ) { + f_AST = astFactory->create(f); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)); + } + match(FUNCTION); + def_designator(false); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + function_tail(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(IS); + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1509 "ada.g" + pop_def_id(); Set(f_AST, FUNCTION_BODY); +#line 11756 "AdaParser.cpp" + } + subprogram_body_AST = RefAdaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + returnAST = subprogram_body_AST; +} + +void AdaParser::package_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST package_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PACKAGE); + body_is(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + pkg_body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1513 "ada.g" + Set(p_AST, PACKAGE_BODY); +#line 11794 "AdaParser.cpp" + } + package_body_AST = RefAdaAST(currentAST.root); + returnAST = package_body_AST; +} + +void AdaParser::task_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST task_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken t = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST t_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + t = LT(1); + if ( inputState->guessing == 0 ) { + t_AST = astFactory->create(t); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(t_AST)); + } + match(TASK); + body_is(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + body_part(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1517 "ada.g" + Set(t_AST, TASK_BODY); +#line 11825 "AdaParser.cpp" + } + task_body_AST = RefAdaAST(currentAST.root); + returnAST = task_body_AST; +} + +void AdaParser::protected_body() { + returnAST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefAdaAST protected_body_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefAdaAST p_AST = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(PROTECTED); + body_is(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + prot_op_bodies_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + end_id_opt(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 1521 "ada.g" + Set(p_AST, PROTECTED_BODY); +#line 11860 "AdaParser.cpp" + } + protected_body_AST = RefAdaAST(currentAST.root); + returnAST = protected_body_AST; +} + +void AdaParser::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ) +{ + factory.setMaxNodeType(289); +} +const char* AdaParser::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "\"pragma\"", + "IDENTIFIER", + "SEMI", + "LPAREN", + "COMMA", + "RPAREN", + "RIGHT_SHAFT", + "\"with\"", + "DOT", + "\"use\"", + "\"type\"", + "TIC", + "\"range\"", + "\"digits\"", + "\"delta\"", + "\"access\"", + "\"private\"", + "\"package\"", + "\"body\"", + "\"is\"", + "\"procedure\"", + "\"function\"", + "\"new\"", + "\"others\"", + "PIPE", + "DOT_DOT", + "\"all\"", + "COLON", + "\"in\"", + "\"out\"", + "\"renames\"", + "CHARACTER_LITERAL", + "CHAR_STRING", + "\"null\"", + "\"record\"", + "\"separate\"", + "\"abstract\"", + "\"return\"", + "\"task\"", + "\"protected\"", + "BOX", + "ASSIGN", + "\"entry\"", + "\"for\"", + "\"end\"", + "\"at\"", + "\"mod\"", + "\"subtype\"", + "\"exception\"", + "\"constant\"", + "\"array\"", + "\"of\"", + "\"aliased\"", + "\"case\"", + "\"when\"", + "\"tagged\"", + "\"limited\"", + "\"generic\"", + "\"begin\"", + "LT_LT", + "GT_GT", + "\"if\"", + "\"then\"", + "\"elsif\"", + "\"else\"", + "\"loop\"", + "\"while\"", + "\"reverse\"", + "\"declare\"", + "\"exit\"", + "\"goto\"", + "\"accept\"", + "\"do\"", + "\"delay\"", + "\"until\"", + "\"select\"", + "\"abort\"", + "\"or\"", + "\"terminate\"", + "\"raise\"", + "\"requeue\"", + "\"and\"", + "\"xor\"", + "\"not\"", + "EQ", + "NE", + "LT_", + "LE", + "GT", + "GE", + "PLUS", + "MINUS", + "CONCAT", + "STAR", + "DIV", + "\"rem\"", + "\"abs\"", + "EXPON", + "NUMERIC_LIT", + "ABORTABLE_PART", + "ABORT_STATEMENT", + "ACCEPT_ALTERNATIVE", + "ACCEPT_STATEMENT", + "ALLOCATOR", + "ASSIGNMENT_STATEMENT", + "ASYNCHRONOUS_SELECT", + "ATTRIBUTE_DEFINITION_CLAUSE", + "AT_CLAUSE", + "BLOCK_STATEMENT", + "CASE_STATEMENT", + "CASE_STATEMENT_ALTERNATIVE", + "CODE_STATEMENT", + "COMPONENT_DECLARATION", + "CONDITIONAL_ENTRY_CALL", + "CONTEXT_CLAUSE", + "DECLARATIVE_PART", + "DEFINING_IDENTIFIER_LIST", + "DELAY_ALTERNATIVE", + "DELAY_STATEMENT", + "DELTA_CONSTRAINT", + "DIGITS_CONSTRAINT", + "DISCRIMINANT_ASSOCIATION", + "DISCRIMINANT_CONSTRAINT", + "DISCRIMINANT_SPECIFICATION", + "ENTRY_BODY", + "ENTRY_CALL_ALTERNATIVE", + "ENTRY_CALL_STATEMENT", + "ENTRY_DECLARATION", + "ENTRY_INDEX_SPECIFICATION", + "ENUMERATION_REPESENTATION_CLAUSE", + "EXCEPTION_DECLARATION", + "EXCEPTION_HANDLER", + "EXCEPTION_RENAMING_DECLARATION", + "EXIT_STATEMENT", + "FORMAL_PACKAGE_DECLARATION", + "GENERIC_FORMAL_PART", + "GENERIC_PACKAGE_DECLARATION", + "GOTO_STATEMENT", + "HANDLED_SEQUENCE_OF_STATEMENTS", + "HANDLED_STMTS_OPT", + "IF_STATEMENT", + "INCOMPLETE_TYPE_DECLARATION", + "INDEXED_COMPONENT", + "INDEX_CONSTRAINT", + "LIBRARY_ITEM", + "LOOP_STATEMENT", + "NAME", + "NULL_STATEMENT", + "NUMBER_DECLARATION", + "OBJECT_DECLARATION", + "OBJECT_RENAMING_DECLARATION", + "OPERATOR_SYMBOL", + "PACKAGE_BODY", + "PACKAGE_BODY_STUB", + "PACKAGE_RENAMING_DECLARATION", + "PACKAGE_SPECIFICATION", + "PARAMETER_SPECIFICATION", + "PRIVATE_EXTENSION_DECLARATION", + "PRIVATE_TYPE_DECLARATION", + "PROTECTED_BODY", + "PROTECTED_BODY_STUB", + "PROTECTED_TYPE_DECLARATION", + "RAISE_STATEMENT", + "RANGE_ATTRIBUTE_REFERENCE", + "RECORD_REPRESENTATION_CLAUSE", + "REQUEUE_STATEMENT", + "RETURN_STATEMENT", + "SELECTIVE_ACCEPT", + "SEQUENCE_OF_STATEMENTS", + "SINGLE_PROTECTED_DECLARATION", + "SINGLE_TASK_DECLARATION", + "STATEMENT", + "SUBTYPE_DECLARATION", + "SUBTYPE_INDICATION", + "SUBTYPE_MARK", + "SUBUNIT", + "TASK_BODY", + "TASK_BODY_STUB", + "TASK_TYPE_DECLARATION", + "TERMINATE_ALTERNATIVE", + "TIMED_ENTRY_CALL", + "TRIGGERING_ALTERNATIVE", + "USE_CLAUSE", + "USE_TYPE_CLAUSE", + "VARIANT", + "VARIANT_PART", + "WITH_CLAUSE", + "ABSTRACT_FUNCTION_DECLARATION", + "ABSTRACT_PROCEDURE_DECLARATION", + "ACCESS_TO_FUNCTION_DECLARATION", + "ACCESS_TO_OBJECT_DECLARATION", + "ACCESS_TO_PROCEDURE_DECLARATION", + "ARRAY_OBJECT_DECLARATION", + "ARRAY_TYPE_DECLARATION", + "AND_THEN", + "BASIC_DECLARATIVE_ITEMS_OPT", + "BLOCK_BODY", + "BLOCK_BODY_OPT", + "CALL_STATEMENT", + "COMPONENT_CLAUSES_OPT", + "COMPONENT_ITEMS", + "COND_CLAUSE", + "DECIMAL_FIXED_POINT_DECLARATION", + "DECLARE_OPT", + "DERIVED_RECORD_EXTENSION", + "DISCRETE_SUBTYPE_DEF_OPT", + "DISCRIMINANT_SPECIFICATIONS", + "DISCRIM_PART_OPT", + "ELSE_OPT", + "ELSIFS_OPT", + "END_ID_OPT", + "ENTRY_INDEX_OPT", + "ENUMERATION_TYPE_DECLARATION", + "EXCEPT_HANDLER_PART_OPT", + "EXTENSION_OPT", + "FLOATING_POINT_DECLARATION", + "FORMAL_DECIMAL_FIXED_POINT_DECLARATION", + "FORMAL_DISCRETE_TYPE_DECLARATION", + "FORMAL_FLOATING_POINT_DECLARATION", + "FORMAL_FUNCTION_DECLARATION", + "FORMAL_MODULAR_TYPE_DECLARATION", + "FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION", + "FORMAL_ORDINARY_FIXED_POINT_DECLARATION", + "FORMAL_PART_OPT", + "FORMAL_PRIVATE_EXTENSION_DECLARATION", + "FORMAL_PRIVATE_TYPE_DECLARATION", + "FORMAL_PROCEDURE_DECLARATION", + "FORMAL_SIGNED_INTEGER_TYPE_DECLARATION", + "FUNCTION_BODY", + "FUNCTION_BODY_STUB", + "FUNCTION_DECLARATION", + "FUNCTION_RENAMING_DECLARATION", + "GENERIC_FUNCTION_DECLARATION", + "GENERIC_FUNCTION_INSTANTIATION", + "GENERIC_FUNCTION_RENAMING", + "GENERIC_PACKAGE_INSTANTIATION", + "GENERIC_PACKAGE_RENAMING", + "GENERIC_PROCEDURE_DECLARATION", + "GENERIC_PROCEDURE_INSTANTIATION", + "GENERIC_PROCEDURE_RENAMING", + "GUARD_OPT", + "IDENTIFIER_COLON_OPT", + "ID_OPT", + "INIT_OPT", + "ITERATION_SCHEME_OPT", + "LABEL_OPT", + "MARK_WITH_CONSTRAINT", + "MODIFIERS", + "MODULAR_TYPE_DECLARATION", + "MOD_CLAUSE_OPT", + "NOT_IN", + "ORDINARY_DERIVED_TYPE_DECLARATION", + "ORDINARY_FIXED_POINT_DECLARATION", + "OR_ELSE", + "OR_SELECT_OPT", + "PARENTHESIZED_PRIMARY", + "PRIVATE_DECLARATIVE_ITEMS_OPT", + "PRIVATE_TASK_ITEMS_OPT", + "PROCEDURE_BODY", + "PROCEDURE_BODY_STUB", + "PROCEDURE_DECLARATION", + "PROCEDURE_RENAMING_DECLARATION", + "PROT_MEMBER_DECLARATIONS", + "PROT_OP_BODIES_OPT", + "PROT_OP_DECLARATIONS", + "PROT_PRIVATE_OPT", + "RANGED_EXPRS", + "RANGE_CONSTRAINT", + "RECORD_TYPE_DECLARATION", + "SELECTOR_NAMES_OPT", + "SIGNED_INTEGER_TYPE_DECLARATION", + "TASK_ITEMS_OPT", + "UNARY_MINUS", + "UNARY_PLUS", + "VALUE", + "VALUES", + "VARIANTS", + "COMMENT_INTRO", + "OX", + "TIC_OR_CHARACTER_LITERAL", + "DIGIT", + "EXPONENT", + "EXTENDED_DIGIT", + "BASED_INTEGER", + "WS_", + "COMMENT", + 0 +}; + +const unsigned long AdaParser::_tokenSet_0_data_[] = { 67109024UL, 56UL, 3229614080UL, 80UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN "new" CHARACTER_LITERAL CHAR_STRING "null" "not" PLUS +// MINUS "abs" NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_0(_tokenSet_0_data_,10); +const unsigned long AdaParser::_tokenSet_1_data_[] = { 201364384UL, 262201UL, 4293001216UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN COMMA RPAREN DOT TIC "new" "others" "in" CHARACTER_LITERAL +// CHAR_STRING "null" "mod" "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS +// MINUS CONCAT STAR DIV "rem" "abs" EXPON NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_1(_tokenSet_1_data_,10); +const unsigned long AdaParser::_tokenSet_2_data_[] = { 8388800UL, 4UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN "is" "renames" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_2(_tokenSet_2_data_,10); +const unsigned long AdaParser::_tokenSet_3_data_[] = { 52453426UL, 1611238800UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "pragma" IDENTIFIER "use" "type" "package" "procedure" "function" +// CHAR_STRING "separate" "abstract" "task" "protected" "for" "end" "subtype" +// "generic" "begin" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_3(_tokenSet_3_data_,10); +const unsigned long AdaParser::_tokenSet_4_data_[] = { 8392896UL, 67108869UL, 4096UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN DOT "is" "in" "renames" "when" "do" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_4(_tokenSet_4_data_,10); +const unsigned long AdaParser::_tokenSet_5_data_[] = { 8388800UL, 67108869UL, 4096UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN "is" "in" "renames" "when" "do" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_5(_tokenSet_5_data_,10); +const unsigned long AdaParser::_tokenSet_6_data_[] = { 53502002UL, 537496976UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "pragma" IDENTIFIER "use" "type" "private" "package" "procedure" +// "function" CHAR_STRING "separate" "abstract" "task" "protected" "for" +// "end" "subtype" "generic" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_6(_tokenSet_6_data_,10); +const unsigned long AdaParser::_tokenSet_7_data_[] = { 8392832UL, 512UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN DOT "is" "return" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_7(_tokenSet_7_data_,10); +const unsigned long AdaParser::_tokenSet_8_data_[] = { 738234528UL, 262200UL, 3229614080UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN DOT TIC "new" "others" DOT_DOT CHARACTER_LITERAL CHAR_STRING +// "null" "mod" "not" PLUS MINUS CONCAT STAR DIV "rem" "abs" EXPON NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_8(_tokenSet_8_data_,10); +const unsigned long AdaParser::_tokenSet_9_data_[] = { 201326752UL, 56UL, 3229614080UL, 80UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN "new" "others" CHARACTER_LITERAL CHAR_STRING "null" +// "not" PLUS MINUS "abs" NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_9(_tokenSet_9_data_,10); +const unsigned long AdaParser::_tokenSet_10_data_[] = { 1006739360UL, 262201UL, 4293001216UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN COMMA RPAREN RIGHT_SHAFT "with" DOT TIC "range" "new" +// "others" PIPE DOT_DOT "in" CHARACTER_LITERAL CHAR_STRING "null" "mod" +// "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS MINUS CONCAT STAR DIV +// "rem" "abs" EXPON NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_10(_tokenSet_10_data_,10); +const unsigned long AdaParser::_tokenSet_11_data_[] = { 1006737312UL, 262201UL, 4293001216UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN COMMA RPAREN RIGHT_SHAFT DOT TIC "range" "new" "others" +// PIPE DOT_DOT "in" CHARACTER_LITERAL CHAR_STRING "null" "mod" "or" "and" +// "xor" "not" EQ NE LT_ LE GT GE PLUS MINUS CONCAT STAR DIV "rem" "abs" +// EXPON NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_11(_tokenSet_11_data_,10); +const unsigned long AdaParser::_tokenSet_12_data_[] = { 32UL, 23068672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER "constant" "array" "aliased" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_12(_tokenSet_12_data_,10); +const unsigned long AdaParser::_tokenSet_13_data_[] = { 495840UL, 6299648UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER SEMI LPAREN DOT TIC "range" "digits" "delta" ASSIGN "constant" +// "array" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_13(_tokenSet_13_data_,10); +const unsigned long AdaParser::_tokenSet_14_data_[] = { 51380274UL, 114688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "pragma" IDENTIFIER "private" "procedure" "function" "entry" "for" +// "end" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_14(_tokenSet_14_data_,10); +const unsigned long AdaParser::_tokenSet_15_data_[] = { 496256UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN RPAREN DOT TIC "range" "digits" "delta" "loop" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_15(_tokenSet_15_data_,10); +const unsigned long AdaParser::_tokenSet_16_data_[] = { 50331664UL, 49152UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "pragma" "procedure" "function" "entry" "for" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_16(_tokenSet_16_data_,10); +const unsigned long AdaParser::_tokenSet_17_data_[] = { 1048576UL, 402653536UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "private" "null" "record" "abstract" "tagged" "limited" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_17(_tokenSet_17_data_,10); +const unsigned long AdaParser::_tokenSet_18_data_[] = { 1048688UL, 436207712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "pragma" IDENTIFIER SEMI "private" "null" "record" "case" "tagged" "limited" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_18(_tokenSet_18_data_,10); +const unsigned long AdaParser::_tokenSet_19_data_[] = { 496512UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN COMMA RPAREN DOT TIC "range" "digits" "delta" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_19(_tokenSet_19_data_,10); +const unsigned long AdaParser::_tokenSet_20_data_[] = { 738300064UL, 262200UL, 3229614080UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN DOT TIC "range" "new" "others" DOT_DOT CHARACTER_LITERAL +// CHAR_STRING "null" "mod" "not" PLUS MINUS CONCAT STAR DIV "rem" "abs" +// EXPON NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_20(_tokenSet_20_data_,10); +const unsigned long AdaParser::_tokenSet_21_data_[] = { 469800096UL, 262201UL, 4293001216UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER LPAREN RIGHT_SHAFT DOT TIC "new" "others" PIPE "in" CHARACTER_LITERAL +// CHAR_STRING "null" "mod" "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS +// MINUS CONCAT STAR DIV "rem" "abs" EXPON NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_21(_tokenSet_21_data_,10); +const unsigned long AdaParser::_tokenSet_22_data_[] = { 1048576UL, 402653440UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "private" "abstract" "tagged" "limited" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_22(_tokenSet_22_data_,10); +const unsigned long AdaParser::_tokenSet_23_data_[] = { 1048640UL, 402653184UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "private" "tagged" "limited" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_23(_tokenSet_23_data_,10); +const unsigned long AdaParser::_tokenSet_24_data_[] = { 37056UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN DOT TIC ASSIGN +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_24(_tokenSet_24_data_,10); +const unsigned long AdaParser::_tokenSet_25_data_[] = { 67145952UL, 56UL, 3229630464UL, 80UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER SEMI LPAREN DOT TIC "new" CHARACTER_LITERAL CHAR_STRING "null" +// "until" "not" PLUS MINUS "abs" NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_25(_tokenSet_25_data_,10); +const unsigned long AdaParser::_tokenSet_26_data_[] = { 0UL, 67108864UL, 272384UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "when" "accept" "delay" "terminate" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_26(_tokenSet_26_data_,10); +const unsigned long AdaParser::_tokenSet_27_data_[] = { 67109088UL, 56UL, 3229630464UL, 80UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER SEMI LPAREN "new" CHARACTER_LITERAL CHAR_STRING "null" "until" +// "not" PLUS MINUS "abs" NUMERIC_LIT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_27(_tokenSet_27_data_,10); +const unsigned long AdaParser::_tokenSet_28_data_[] = { 37056UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN DOT TIC +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_28(_tokenSet_28_data_,10); +const unsigned long AdaParser::_tokenSet_29_data_[] = { 48UL, 3323036192UL, 1814398UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "pragma" IDENTIFIER "null" "return" "for" "end" "exception" "case" "when" +// "begin" LT_LT "if" "then" "elsif" "else" "loop" "while" "declare" "exit" +// "goto" "accept" "delay" "select" "abort" "or" "raise" "requeue" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_29(_tokenSet_29_data_,10); +const unsigned long AdaParser::_tokenSet_30_data_[] = { 813932352UL, 8192UL, 6422564UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI COMMA RPAREN RIGHT_SHAFT "with" DOT TIC "range" "digits" "is" PIPE +// DOT_DOT ASSIGN "then" "loop" "or" "and" "xor" +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaParser::_tokenSet_30(_tokenSet_30_data_,10); + + diff --git a/languages/ada/AdaParser.hpp b/languages/ada/AdaParser.hpp new file mode 100644 index 00000000..0074c820 --- /dev/null +++ b/languages/ada/AdaParser.hpp @@ -0,0 +1,389 @@ +#ifndef INC_AdaParser_hpp_ +#define INC_AdaParser_hpp_ + +#line 29 "ada.g" + +#include // antlr wants this +#include "AdaAST.hpp" +#include "preambles.h" + +#line 11 "AdaParser.hpp" +#include +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaParser.hpp"$ */ +#include +#include +#include "AdaTokenTypes.hpp" +#include + +class CUSTOM_API AdaParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public AdaTokenTypes +{ +#line 53 "ada.g" + + ANTLR_PARSER_PREAMBLE + +public: + // Ada support stuff + void push_def_id (const RefAdaAST& defid); + const RefAdaAST& pop_def_id (); + bool end_id_matches_def_id (const RefAdaAST& endid); + bool definable_operator (const char *string); // operator_symbol sans "/=" + bool is_operator_symbol (const char *string); +#line 22 "AdaParser.hpp" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + AdaParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return AdaParser::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return AdaParser::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return AdaParser::tokenNames; + } + public: void compilation_unit(); + public: void context_items_opt(); + public: void library_item(); + public: void subunit(); + public: void pragma(); + public: void pragma_args_opt(); + public: void pragma_arg(); + public: void expression(); + public: void with_clause(); + public: void use_clause(); + public: void c_name_list(); + public: void compound_name(); + public: void subtype_mark(); + public: void attribute_id(); + public: void private_opt(); + public: void lib_pkg_spec_or_body(); + public: void subprog_decl_or_rename_or_inst_or_body( + boolean lib_level + ); + public: void generic_decl( + boolean lib_level + ); + public: void def_id( + boolean lib_level + ); + public: void pkg_body_part(); + public: void spec_decl_part( + RefAdaAST pkg + ); + public: void subprog_decl( + boolean lib_level + ); + public: void generic_subp_inst(); + public: void formal_part_opt(); + public: void renames(); + public: void is_separate_or_abstract_or_decl( + RefAdaAST t + ); + public: void def_designator( + boolean lib_level + ); + public: void function_tail(); + public: void generic_inst(); + public: void value_s(); + public: void parenth_values(); + public: void value(); + public: void ranged_expr_s(); + public: void ranged_expr(); + public: void simple_expression(); + public: void range(); + public: void range_constraint(); + public: void range_dots(); + public: void range_attrib_ref(); + public: void prefix(); + public: void parameter_specification(); + public: void def_ids_colon(); + public: void mode_opt(); + public: void init_opt(); + public: void defining_identifier_list(); + public: void name(); + public: RefAdaAST definable_operator_symbol(); + public: RefAdaAST is_operator(); + public: void parenthesized_primary(); + public: void extension_opt(); + public: void separate_or_abstract( + RefAdaAST t + ); + public: RefAdaAST designator(); + public: void func_formal_part_opt(); + public: void func_param(); + public: void in_access_opt(); + public: void pkg_spec_part(); + public: void basic_declarative_items_opt(); + public: void private_declarative_items_opt(); + public: void end_id_opt(); + public: void basic_decl_item(); + public: void basic_declarative_items(); + public: void task_type_or_single_decl( + RefAdaAST tsk + ); + public: void prot_type_or_single_decl( + RefAdaAST pro + ); + public: void decl_common(); + public: void discrim_part_opt(); + public: void task_definition_opt(); + public: void task_items_opt(); + public: void private_task_items_opt(); + public: void discrim_part_text(); + public: void discriminant_specifications(); + public: void known_discrim_part(); + public: void empty_discrim_opt(); + public: void discrim_part(); + public: void discriminant_specification(); + public: void access_opt(); + public: void entrydecls_repspecs_opt(); + public: void entry_declaration(); + public: void rep_spec(); + public: void discrete_subtype_def_opt(); + public: void discrete_subtype_definition(); + public: void subtype_ind(); + public: void rep_spec_part( + RefAdaAST t + ); + public: void align_opt(); + public: void comp_loc_s(); + public: void protected_definition(); + public: void prot_private_opt(); + public: void prot_op_decl(); + public: void comp_decl(); + public: void prot_op_decl_s(); + public: void prot_member_decl_s(); + public: void component_subtype_def(); + public: void type_def( + RefAdaAST t + ); + public: void derived_or_private_or_record( + RefAdaAST t, boolean has_discrim + ); + public: void local_enum_name(); + public: void enumeration_aggregate(); + public: void aliased_constant_opt(); + public: void array_type_definition( + RefAdaAST t + ); + public: void enum_id_s(); + public: void range_constraint_opt(); + public: void access_type_definition( + RefAdaAST t + ); + public: void enumeration_literal_specification(); + public: void index_or_discrete_range_s(); + public: void index_or_discrete_range(); + public: void aliased_opt(); + public: void constraint_opt(); + public: void digits_constraint(); + public: void delta_constraint(); + public: void index_constraint(); + public: void discriminant_constraint(); + public: void discrete_range(); + public: void discriminant_association(); + public: void selector_names_opt(); + public: void association_head(); + public: void selector_name(); + public: void protected_opt(); + public: void constant_all_opt(); + public: void abstract_opt(); + public: void record_definition( + boolean has_discrim + ); + public: void abstract_tagged_limited_opt(); + public: void component_list( + boolean has_discrim + ); + public: void component_items(); + public: void variant_part(); + public: void empty_component_items(); + public: void discriminant_direct_name(); + public: void variant_s(); + public: void variant(); + public: void choice_s(); + public: void choice(); + public: void discrete_with_range(); + public: void mark_with_constraint(); + public: void generic_formal_part_opt(); + public: void generic_formal_parameter(); + public: void discriminable_type_definition( + RefAdaAST t + ); + public: void subprogram_default_opt(); + public: void formal_package_actual_part_opt(); + public: void body_part(); + public: void declarative_part(); + public: void block_body(); + public: void declarative_item(); + public: void body_is(); + public: void separate(); + public: void prot_op_bodies_opt(); + public: void block_body_opt(); + public: void handled_stmt_s(); + public: void entry_body(); + public: void subprog_decl_or_body(); + public: void statements(); + public: void except_handler_part_opt(); + public: void handled_stmts_opt(); + public: void statement(); + public: void def_label_opt(); + public: void null_stmt(); + public: void exit_stmt(); + public: void return_stmt(); + public: void goto_stmt(); + public: void delay_stmt(); + public: void abort_stmt(); + public: void raise_stmt(); + public: void requeue_stmt(); + public: void accept_stmt(); + public: void select_stmt(); + public: void if_stmt(); + public: void case_stmt(); + public: void loop_stmt(); + public: void block(); + public: void statement_identifier(); + public: void id_opt(); + public: void call_or_assignment(); + public: void cond_clause(); + public: void elsifs_opt(); + public: void else_opt(); + public: void condition(); + public: void alternative_s(); + public: void case_statement_alternative(); + public: void iteration_scheme_opt(); + public: void reverse_opt(); + public: void id_opt_aux(); + public: void declare_opt(); + public: void label_name(); + public: void entry_body_formal_part(); + public: void entry_barrier(); + public: void entry_index_spec_opt(); + public: void entry_call_stmt(); + public: void entry_index_opt(); + public: void until_opt(); + public: void triggering_alternative(); + public: void abortable_part(); + public: void selective_accept(); + public: void entry_call_alternative(); + public: void delay_alternative(); + public: void stmts_opt(); + public: void guard_opt(); + public: void select_alternative(); + public: void or_select_opt(); + public: void accept_alternative(); + public: void exception_handler(); + public: void identifier_colon_opt(); + public: void except_choice_s(); + public: void exception_choice(); + public: void operator_call(); + public: void operator_call_tail( + RefAdaAST opstr + ); + public: void relation(); + public: void range_or_mark(); + public: void signed_term(); + public: void term(); + public: void factor(); + public: void primary(); + public: void name_or_qualified(); + public: void allocator(); + public: void subprogram_body(); + public: void package_body(); + public: void task_body(); + public: void protected_body(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefAdaAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 290; +#else + enum { + NUM_TOKENS = 290 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; + static const unsigned long _tokenSet_7_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; + static const unsigned long _tokenSet_8_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; + static const unsigned long _tokenSet_9_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; + static const unsigned long _tokenSet_10_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; + static const unsigned long _tokenSet_11_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; + static const unsigned long _tokenSet_12_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; + static const unsigned long _tokenSet_13_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; + static const unsigned long _tokenSet_14_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; + static const unsigned long _tokenSet_15_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; + static const unsigned long _tokenSet_16_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; + static const unsigned long _tokenSet_17_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; + static const unsigned long _tokenSet_18_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; + static const unsigned long _tokenSet_19_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; + static const unsigned long _tokenSet_20_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; + static const unsigned long _tokenSet_21_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; + static const unsigned long _tokenSet_22_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; + static const unsigned long _tokenSet_23_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; + static const unsigned long _tokenSet_24_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; + static const unsigned long _tokenSet_25_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; + static const unsigned long _tokenSet_26_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; + static const unsigned long _tokenSet_27_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; + static const unsigned long _tokenSet_28_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; + static const unsigned long _tokenSet_29_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; + static const unsigned long _tokenSet_30_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; +}; + +#endif /*INC_AdaParser_hpp_*/ diff --git a/languages/ada/AdaStoreWalker.cpp b/languages/ada/AdaStoreWalker.cpp new file mode 100644 index 00000000..167d671c --- /dev/null +++ b/languages/ada/AdaStoreWalker.cpp @@ -0,0 +1,9439 @@ +/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalker.cpp"$ */ +#include "AdaStoreWalker.hpp" +#include +#include +#include +#include +#include +#include +#line 1 "expandedada.store.g" +#line 11 "AdaStoreWalker.cpp" +AdaStoreWalker::AdaStoreWalker() + : ANTLR_USE_NAMESPACE(antlr)TreeParser() { +} + +void AdaStoreWalker::compilation_unit(RefAdaAST _t) { + RefAdaAST compilation_unit_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling +#line 116 "expandedada.store.g" + init(); +#line 22 "AdaStoreWalker.cpp" + context_items_opt(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LIBRARY_ITEM: + { + library_item(_t); + _t = _retTree; + break; + } + case SUBUNIT: + { + subunit(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == PRAGMA)) { + pragma(_t); + _t = _retTree; + } + else { + goto _loop4; + } + + } + _loop4:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::context_items_opt(RefAdaAST _t) { + RefAdaAST context_items_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t70 = _t; + RefAdaAST tmp1_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CONTEXT_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case WITH_CLAUSE: + { + with_clause(_t); + _t = _retTree; + break; + } + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + { + use_clause(_t); + _t = _retTree; + break; + } + default: + { + goto _loop72; + } + } + } + _loop72:; + } // ( ... )* + _t = __t70; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::library_item(RefAdaAST _t) { + RefAdaAST library_item_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST pb = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefAdaAST gpi = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefAdaAST ps = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefAdaAST prd = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefAdaAST __t17 = _t; + RefAdaAST tmp2_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LIBRARY_ITEM); + _t = _t->getFirstChild(); + RefAdaAST __t18 = _t; + RefAdaAST tmp3_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MODIFIERS); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRIVATE: + { + RefAdaAST tmp4_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PRIVATE); + _t = _t->getNextSibling(); +#line 132 "expandedada.store.g" + m_currentAccess = CodeModelItem::Protected; +#line 149 "AdaStoreWalker.cpp" + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t18; + _t = _t->getNextSibling(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + lib_subprog_decl_or_rename_or_inst_or_body(_t); + _t = _retTree; + break; + } + case PACKAGE_BODY: + { + RefAdaAST __t21 = _t; + RefAdaAST tmp5_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_BODY); + _t = _t->getFirstChild(); + pb = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; + pkg_body_part(_t); + _t = _retTree; + _t = __t21; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_INSTANTIATION: + { + RefAdaAST __t22 = _t; + RefAdaAST tmp6_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PACKAGE_INSTANTIATION); + _t = _t->getFirstChild(); + gpi = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; +#line 136 "expandedada.store.g" + + defineScope( gpi ); + +#line 213 "AdaStoreWalker.cpp" + generic_inst(_t); + _t = _retTree; + _t = __t22; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_SPECIFICATION: + { + RefAdaAST __t23 = _t; + RefAdaAST tmp7_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_SPECIFICATION); + _t = _t->getFirstChild(); + ps = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; +#line 142 "expandedada.store.g" + + NamespaceDom psc = defineScope( ps ); + m_currentContainer = psc; + m_scopeStack.append( psc ); + m_addToStore = true; + +#line 236 "AdaStoreWalker.cpp" + pkg_spec_part(_t); + _t = _retTree; +#line 149 "expandedada.store.g" + + m_scopeStack.remove(m_scopeStack.last()); + if (m_scopeStack.count() == 0) { + kdDebug() << "adastore: m_scopeStack is empty!" << endl; + m_scopeStack.append( m_model->globalNamespace() ); + } + m_currentContainer = m_scopeStack.last(); + // m_currentContainer->setEndPosition (endLine, 0); + m_addToStore = false; + +#line 250 "AdaStoreWalker.cpp" + _t = __t23; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_RENAMING_DECLARATION: + { + RefAdaAST __t24 = _t; + RefAdaAST tmp8_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + prd = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; +#line 161 "expandedada.store.g" + + defineScope( prd ); + +#line 268 "AdaStoreWalker.cpp" + renames(_t); + _t = _retTree; + _t = __t24; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + { + generic_decl(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t17; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subunit(RefAdaAST _t) { + RefAdaAST subunit_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t521 = _t; + RefAdaAST tmp9_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SUBUNIT); + _t = _t->getFirstChild(); + compound_name(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case FUNCTION_BODY: + case PROCEDURE_BODY: + { + subprogram_body(_t); + _t = _retTree; + break; + } + case PACKAGE_BODY: + { + package_body(_t); + _t = _retTree; + break; + } + case TASK_BODY: + { + task_body(_t); + _t = _retTree; + break; + } + case PROTECTED_BODY: + { + protected_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t521; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::pragma(RefAdaAST _t) { + RefAdaAST pragma_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t64 = _t; + RefAdaAST tmp10_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PRAGMA); + _t = _t->getFirstChild(); + RefAdaAST tmp11_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_0.member(_t->getType()))) { + pragma_arg(_t); + _t = _retTree; + } + else { + goto _loop66; + } + + } + _loop66:; + } // ( ... )* + _t = __t64; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::with_clause(RefAdaAST _t) { + RefAdaAST with_clause_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t6 = _t; + RefAdaAST tmp12_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),WITH_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt8=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == DOT)) { + compound_name(_t); + _t = _retTree; + } + else { + if ( _cnt8>=1 ) { goto _loop8; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt8++; + } + _loop8:; + } // ( ... )+ + _t = __t6; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::compound_name(RefAdaAST _t) { + RefAdaAST compound_name_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp13_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + RefAdaAST __t74 = _t; + RefAdaAST tmp14_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + compound_name(_t); + _t = _retTree; + RefAdaAST tmp15_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + _t = __t74; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::use_clause(RefAdaAST _t) { + RefAdaAST use_clause_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST c = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case USE_TYPE_CLAUSE: + { + RefAdaAST __t10 = _t; + RefAdaAST tmp16_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),USE_TYPE_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt12=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == DOT || _t->getType() == TIC)) { + subtype_mark(_t); + _t = _retTree; + } + else { + if ( _cnt12>=1 ) { goto _loop12; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt12++; + } + _loop12:; + } // ( ... )+ + _t = __t10; + _t = _t->getNextSibling(); + break; + } + case USE_CLAUSE: + { + RefAdaAST __t13 = _t; + RefAdaAST tmp17_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),USE_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt15=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == DOT)) { + c = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + compound_name(_t); + _t = _retTree; +#line 127 "expandedada.store.g" + m_imports.back ().push_back (qtext (c)); +#line 527 "AdaStoreWalker.cpp" + } + else { + if ( _cnt15>=1 ) { goto _loop15; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt15++; + } + _loop15:; + } // ( ... )+ + _t = __t13; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subtype_mark(RefAdaAST _t) { + RefAdaAST subtype_mark_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case TIC: + { + RefAdaAST __t76 = _t; + RefAdaAST tmp18_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TIC); + _t = _t->getFirstChild(); + compound_name(_t); + _t = _retTree; + attribute_id(_t); + _t = _retTree; + _t = __t76; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::lib_subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t) { + RefAdaAST lib_subprog_decl_or_rename_or_inst_or_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling +#line 310 "expandedada.store.g" + m_addToStore = true; +#line 603 "AdaStoreWalker.cpp" + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl(_t); + _t = _retTree; + break; + } + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } +#line 315 "expandedada.store.g" + m_addToStore = false; +#line 643 "AdaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::def_id(RefAdaAST _t) { + RefAdaAST def_id_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST cn = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + cn = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + compound_name(_t); + _t = _retTree; +#line 189 "expandedada.store.g" + + // kdDebug() << "cn:compound_name started " << endl; + if (m_addToStore) { + // kdDebug() << "cn:compound_name m_addToStore " << endl; + if (m_isSubprogram) { + // kdDebug() << "cn:compound_name m_isSubprogram " << endl; + FunctionDom method = m_model->create(); + method->setName (qtext (cn)); + method->setFileName(m_fileName); + // kdDebug() << "cn:compound_name method->setStartPosition(" << endl; + method->setStartPosition(cn->getLine(), cn->getColumn()); + + if (m_currentContainer == m_model->globalNamespace()) + m_file->addFunction(method); + else + m_currentContainer->addFunction(method); + //FIXME: adymo: is this valid for CodeModel + /* ParsedMethod *old = m_currentContainer->getMethod (method); + if (old) { + delete (method); + method = old; + } else { + m_currentContainer->addMethod (method); + }*/ + } else { + // TBC: what about other declarations? + } + } + +#line 691 "AdaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::pkg_body_part(RefAdaAST _t) { + RefAdaAST pkg_body_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + declarative_part(_t); + _t = _retTree; + block_body_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::generic_inst(RefAdaAST _t) { + RefAdaAST generic_inst_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + compound_name(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case VALUES: + { + value_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::pkg_spec_part(RefAdaAST _t) { + RefAdaAST pkg_spec_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + basic_declarative_items_opt(_t); + _t = _retTree; + private_declarative_items_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::renames(RefAdaAST _t) { + RefAdaAST renames_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case CHARACTER_STRING: + { + RefAdaAST tmp19_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHARACTER_STRING); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + RefAdaAST tmp20_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case INDEXED_COMPONENT: + { + name(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::generic_decl(RefAdaAST _t) { + RefAdaAST generic_decl_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST gpd = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case GENERIC_PACKAGE_RENAMING: + { + RefAdaAST __t49 = _t; + RefAdaAST tmp21_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PACKAGE_RENAMING); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t49; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_DECLARATION: + { + RefAdaAST __t50 = _t; + RefAdaAST tmp22_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PACKAGE_DECLARATION); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + gpd = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; +#line 284 "expandedada.store.g" + + NamespaceDom psc = defineScope( gpd ); + m_currentContainer = psc; + m_scopeStack.append( psc ); + m_addToStore = true; + +#line 860 "AdaStoreWalker.cpp" + pkg_spec_part(_t); + _t = _retTree; +#line 291 "expandedada.store.g" + + m_scopeStack.remove(m_scopeStack.last()); + if (m_scopeStack.count() == 0) + m_scopeStack.append( m_model->globalNamespace() ); + m_currentContainer = m_scopeStack.last(); + // m_currentContainer->setDeclarationEndsOnLine (endLine); + m_addToStore = false; + +#line 872 "AdaStoreWalker.cpp" + _t = __t50; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PROCEDURE_RENAMING: + { + RefAdaAST __t51 = _t; + RefAdaAST tmp23_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PROCEDURE_RENAMING); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t51; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PROCEDURE_DECLARATION: + { + RefAdaAST __t52 = _t; + RefAdaAST tmp24_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + subprog_def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t52; + _t = _t->getNextSibling(); + break; + } + case GENERIC_FUNCTION_RENAMING: + { + RefAdaAST __t53 = _t; + RefAdaAST tmp25_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_FUNCTION_RENAMING); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t53; + _t = _t->getNextSibling(); + break; + } + case GENERIC_FUNCTION_DECLARATION: + { + RefAdaAST __t54 = _t; + RefAdaAST tmp26_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + subprog_def_id(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t54; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subprog_def_id(RefAdaAST _t) { + RefAdaAST subprog_def_id_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling +#line 171 "expandedada.store.g" + m_isSubprogram = true; +#line 965 "AdaStoreWalker.cpp" + def_id(_t); + _t = _retTree; +#line 173 "expandedada.store.g" + m_isSubprogram = false; +#line 970 "AdaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subprog_decl(RefAdaAST _t) { + RefAdaAST subprog_decl_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case GENERIC_PROCEDURE_INSTANTIATION: + { + RefAdaAST __t27 = _t; + RefAdaAST tmp27_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PROCEDURE_INSTANTIATION); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t27; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE_RENAMING_DECLARATION: + { + RefAdaAST __t28 = _t; + RefAdaAST tmp28_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t28; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE_DECLARATION: + { + RefAdaAST __t29 = _t; + RefAdaAST tmp29_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t29; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE_BODY_STUB: + { + RefAdaAST __t30 = _t; + RefAdaAST tmp30_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE_BODY_STUB); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t30; + _t = _t->getNextSibling(); + break; + } + case ABSTRACT_PROCEDURE_DECLARATION: + { + RefAdaAST __t31 = _t; + RefAdaAST tmp31_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABSTRACT_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t31; + _t = _t->getNextSibling(); + break; + } + case GENERIC_FUNCTION_INSTANTIATION: + { + RefAdaAST __t32 = _t; + RefAdaAST tmp32_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_FUNCTION_INSTANTIATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t32; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_RENAMING_DECLARATION: + { + RefAdaAST __t33 = _t; + RefAdaAST tmp33_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t33; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_DECLARATION: + { + RefAdaAST __t34 = _t; + RefAdaAST tmp34_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t34; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_BODY_STUB: + { + RefAdaAST __t35 = _t; + RefAdaAST tmp35_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION_BODY_STUB); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t35; + _t = _t->getNextSibling(); + break; + } + case ABSTRACT_FUNCTION_DECLARATION: + { + RefAdaAST __t36 = _t; + RefAdaAST tmp36_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABSTRACT_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t36; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::formal_part_opt(RefAdaAST _t) { + RefAdaAST formal_part_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t112 = _t; + RefAdaAST tmp37_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_PART_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == PARAMETER_SPECIFICATION)) { + parameter_specification(_t); + _t = _retTree; + } + else { + goto _loop114; + } + + } + _loop114:; + } // ( ... )* + _t = __t112; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::def_designator(RefAdaAST _t) { + RefAdaAST def_designator_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST cn = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + cn = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + compound_name(_t); + _t = _retTree; +#line 221 "expandedada.store.g" + + // kdDebug() << "def_designator cn:compound_name started" << endl; + if (m_addToStore) { + // kdDebug() << "def_designator cn:compound_name m_addToStore" << endl; + FunctionDom method = m_model->create(); + method->setName (qtext (cn)); + method->setFileName(m_fileName); + // kdDebug() << "def_designator cn:compound_name method->setStartPosition(" << endl; + method->setStartPosition(cn->getLine(), cn->getColumn()); + + if (m_currentContainer == m_model->globalNamespace()) + m_file->addFunction(method); + else + m_currentContainer->addFunction(method); + //FIXME: adymo: is this valid for CodeModel + /* ParsedMethod *old = m_currentContainer->getMethod (method); + if (old) { + delete method; + method = old; + } else { + m_currentContainer->addMethod (method); + }*/ + } + +#line 1218 "AdaStoreWalker.cpp" + break; + } + case OPERATOR_SYMBOL: + { + definable_operator_symbol(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::function_tail(RefAdaAST _t) { + RefAdaAST function_tail_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + formal_part_opt(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::definable_operator_symbol(RefAdaAST _t) { + RefAdaAST definable_operator_symbol_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp38_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::spec_decl_part(RefAdaAST _t) { + RefAdaAST spec_decl_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST ps = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case GENERIC_PACKAGE_INSTANTIATION: + { + RefAdaAST __t40 = _t; + RefAdaAST tmp39_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_PACKAGE_INSTANTIATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t40; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_SPECIFICATION: + { + RefAdaAST __t41 = _t; + RefAdaAST tmp40_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_SPECIFICATION); + _t = _t->getFirstChild(); + ps = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; +#line 250 "expandedada.store.g" + + NamespaceDom psc = defineScope( ps ); + m_currentContainer = psc; + m_scopeStack.append( psc ); + m_addToStore = true; + +#line 1312 "AdaStoreWalker.cpp" + pkg_spec_part(_t); + _t = _retTree; +#line 257 "expandedada.store.g" + + m_scopeStack.remove(m_scopeStack.last()); + if (m_scopeStack.count() == 0) { + kdDebug() << "adastore: m_scopeStack is empty!" << endl; + m_scopeStack.append( m_model->globalNamespace() ); + } + m_currentContainer = m_scopeStack.last(); + // m_currentContainer->setDeclarationEndsOnLine (endLine); + m_addToStore = false; + +#line 1326 "AdaStoreWalker.cpp" + _t = __t41; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_RENAMING_DECLARATION: + { + RefAdaAST __t42 = _t; + RefAdaAST tmp41_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t42; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::basic_declarative_items_opt(RefAdaAST _t) { + RefAdaAST basic_declarative_items_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t136 = _t; + RefAdaAST tmp42_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BASIC_DECLARATIVE_ITEMS_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_1.member(_t->getType()))) { + basic_decl_item(_t); + _t = _retTree; + } + else { + goto _loop138; + } + + } + _loop138:; + } // ( ... )* + _t = __t136; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::private_declarative_items_opt(RefAdaAST _t) { + RefAdaAST private_declarative_items_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case PROTECTED_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SINGLE_PROTECTED_DECLARATION: + case SINGLE_TASK_DECLARATION: + case SUBTYPE_DECLARATION: + case TASK_TYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_INSTANTIATION: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { +#line 276 "expandedada.store.g" + m_currentAccess = CodeModelItem::Protected; +#line 1457 "AdaStoreWalker.cpp" + { // ( ... )+ + int _cnt47=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case PROTECTED_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SINGLE_PROTECTED_DECLARATION: + case SINGLE_TASK_DECLARATION: + case SUBTYPE_DECLARATION: + case TASK_TYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_INSTANTIATION: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + basic_decl_item(_t); + _t = _retTree; + break; + } + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + default: + { + if ( _cnt47>=1 ) { goto _loop47; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + } + _cnt47++; + } + _loop47:; + } // ( ... )+ +#line 278 "expandedada.store.g" + m_currentAccess = CodeModelItem::Public; +#line 1538 "AdaStoreWalker.cpp" + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::end_id_opt(RefAdaAST _t) { + RefAdaAST end_id_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t86 = _t; + RefAdaAST tmp43_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),END); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case OPERATOR_SYMBOL: + { + def_designator(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t86; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::basic_decl_item(RefAdaAST _t) { + RefAdaAST basic_decl_item_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case GENERIC_PACKAGE_INSTANTIATION: + { + spec_decl_part(_t); + _t = _retTree; + break; + } + case SINGLE_TASK_DECLARATION: + case TASK_TYPE_DECLARATION: + { + task_type_or_single_decl(_t); + _t = _retTree; + break; + } + case PROTECTED_TYPE_DECLARATION: + case SINGLE_PROTECTED_DECLARATION: + { + prot_type_or_single_decl(_t); + _t = _retTree; + break; + } + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SUBTYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + decl_common(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::generic_formal_part_opt(RefAdaAST _t) { + RefAdaAST generic_formal_part_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t295 = _t; + RefAdaAST tmp44_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GENERIC_FORMAL_PART); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + { + use_clause(_t); + _t = _retTree; + break; + } + case FORMAL_PACKAGE_DECLARATION: + case PARAMETER_SPECIFICATION: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case FORMAL_DECIMAL_FIXED_POINT_DECLARATION: + case FORMAL_DISCRETE_TYPE_DECLARATION: + case FORMAL_FLOATING_POINT_DECLARATION: + case FORMAL_FUNCTION_DECLARATION: + case FORMAL_MODULAR_TYPE_DECLARATION: + case FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION: + case FORMAL_ORDINARY_FIXED_POINT_DECLARATION: + case FORMAL_PRIVATE_EXTENSION_DECLARATION: + case FORMAL_PRIVATE_TYPE_DECLARATION: + case FORMAL_PROCEDURE_DECLARATION: + case FORMAL_SIGNED_INTEGER_TYPE_DECLARATION: + { + generic_formal_parameter(_t); + _t = _retTree; + break; + } + default: + { + goto _loop297; + } + } + } + _loop297:; + } // ( ... )* + _t = __t295; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::procedure_body(RefAdaAST _t) { + RefAdaAST procedure_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t319 = _t; + RefAdaAST tmp45_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t319; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::function_body(RefAdaAST _t) { + RefAdaAST function_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t321 = _t; + RefAdaAST tmp46_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION_BODY); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t321; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t) { + RefAdaAST subprog_decl_or_rename_or_inst_or_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl(_t); + _t = _retTree; + break; + } + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subprog_decl_or_body(RefAdaAST _t) { + RefAdaAST subprog_decl_or_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case PROCEDURE_DECLARATION: + { + RefAdaAST __t59 = _t; + RefAdaAST tmp47_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + subprog_def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t59; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + case FUNCTION_DECLARATION: + { + RefAdaAST __t60 = _t; + RefAdaAST tmp48_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t60; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::package_body(RefAdaAST _t) { + RefAdaAST package_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefAdaAST id = RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefAdaAST __t62 = _t; + RefAdaAST tmp49_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_BODY); + _t = _t->getFirstChild(); + id = (_t == ASTNULL) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + def_id(_t); + _t = _retTree; + pkg_body_part(_t); + _t = _retTree; + _t = __t62; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::pragma_arg(RefAdaAST _t) { + RefAdaAST pragma_arg_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case RIGHT_SHAFT: + { + RefAdaAST __t68 = _t; + RefAdaAST tmp50_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RIGHT_SHAFT); + _t = _t->getFirstChild(); + RefAdaAST tmp51_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + _t = __t68; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::expression(RefAdaAST _t) { + RefAdaAST expression_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case AND: + { + RefAdaAST __t479 = _t; + RefAdaAST tmp52_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),AND); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t479; + _t = _t->getNextSibling(); + break; + } + case AND_THEN: + { + RefAdaAST __t480 = _t; + RefAdaAST tmp53_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),AND_THEN); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t480; + _t = _t->getNextSibling(); + break; + } + case OR: + { + RefAdaAST __t481 = _t; + RefAdaAST tmp54_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OR); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t481; + _t = _t->getNextSibling(); + break; + } + case OR_ELSE: + { + RefAdaAST __t482 = _t; + RefAdaAST tmp55_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OR_ELSE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t482; + _t = _t->getNextSibling(); + break; + } + case XOR: + { + RefAdaAST __t483 = _t; + RefAdaAST tmp56_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),XOR); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t483; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case NOT_IN: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + relation(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::attribute_id(RefAdaAST _t) { + RefAdaAST attribute_id_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case RANGE: + { + RefAdaAST tmp57_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RANGE); + _t = _t->getNextSibling(); + break; + } + case DIGITS: + { + RefAdaAST tmp58_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DIGITS); + _t = _t->getNextSibling(); + break; + } + case DELTA: + { + RefAdaAST tmp59_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DELTA); + _t = _t->getNextSibling(); + break; + } + case ACCESS: + { + RefAdaAST tmp60_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCESS); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp61_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::modifiers(RefAdaAST _t) { + RefAdaAST modifiers_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t79 = _t; + RefAdaAST tmp62_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MODIFIERS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT: + { + RefAdaAST tmp63_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABSTRACT); + _t = _t->getNextSibling(); + break; + } + case ACCESS: + { + RefAdaAST tmp64_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCESS); + _t = _t->getNextSibling(); + break; + } + case ALIASED: + { + RefAdaAST tmp65_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ALIASED); + _t = _t->getNextSibling(); + break; + } + case ALL: + { + RefAdaAST tmp66_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ALL); + _t = _t->getNextSibling(); + break; + } + case CONSTANT: + { + RefAdaAST tmp67_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CONSTANT); + _t = _t->getNextSibling(); + break; + } + case IN: + { + RefAdaAST tmp68_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IN); + _t = _t->getNextSibling(); + break; + } + case LIMITED: + { + RefAdaAST tmp69_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LIMITED); + _t = _t->getNextSibling(); + break; + } + case OUT: + { + RefAdaAST tmp70_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OUT); + _t = _t->getNextSibling(); + break; + } + case PRIVATE: + { + RefAdaAST tmp71_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PRIVATE); + _t = _t->getNextSibling(); + break; + } + case PROTECTED: + { + RefAdaAST tmp72_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROTECTED); + _t = _t->getNextSibling(); + break; + } + case REVERSE: + { + RefAdaAST tmp73_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),REVERSE); + _t = _t->getNextSibling(); + break; + } + case TAGGED: + { + RefAdaAST tmp74_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TAGGED); + _t = _t->getNextSibling(); + break; + } + default: + { + goto _loop81; + } + } + } + _loop81:; + } // ( ... )* + _t = __t79; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::id_opt(RefAdaAST _t) { + RefAdaAST id_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t83 = _t; + RefAdaAST tmp75_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ID_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case OPERATOR_SYMBOL: + { + def_designator(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t83; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::value_s(RefAdaAST _t) { + RefAdaAST value_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t475 = _t; + RefAdaAST tmp76_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VALUES); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt477=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_2.member(_t->getType()))) { + value(_t); + _t = _retTree; + } + else { + if ( _cnt477>=1 ) { goto _loop477; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt477++; + } + _loop477:; + } // ( ... )+ + _t = __t475; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::value(RefAdaAST _t) { + RefAdaAST value_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case OTHERS: + { + RefAdaAST __t91 = _t; + RefAdaAST tmp77_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OTHERS); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + _t = __t91; + _t = _t->getNextSibling(); + break; + } + case RIGHT_SHAFT: + { + RefAdaAST __t92 = _t; + RefAdaAST tmp78_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RIGHT_SHAFT); + _t = _t->getFirstChild(); + ranged_expr_s(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t92; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case RANGE: + case PIPE: + case DOT_DOT: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + ranged_expr_s(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::ranged_expr_s(RefAdaAST _t) { + RefAdaAST ranged_expr_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PIPE: + { + RefAdaAST __t94 = _t; + RefAdaAST tmp79_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PIPE); + _t = _t->getFirstChild(); + ranged_expr_s(_t); + _t = _retTree; + ranged_expr(_t); + _t = _retTree; + _t = __t94; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case RANGE: + case DOT_DOT: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + ranged_expr(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::ranged_expr(RefAdaAST _t) { + RefAdaAST ranged_expr_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + { + RefAdaAST __t96 = _t; + RefAdaAST tmp80_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT_DOT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t96; + _t = _t->getNextSibling(); + break; + } + case RANGE: + { + RefAdaAST __t97 = _t; + RefAdaAST tmp81_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RANGE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + range(_t); + _t = _retTree; + _t = __t97; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::simple_expression(RefAdaAST _t) { + RefAdaAST simple_expression_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PLUS: + { + RefAdaAST __t495 = _t; + RefAdaAST tmp82_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PLUS); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + signed_term(_t); + _t = _retTree; + _t = __t495; + _t = _t->getNextSibling(); + break; + } + case MINUS: + { + RefAdaAST __t496 = _t; + RefAdaAST tmp83_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MINUS); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + signed_term(_t); + _t = _retTree; + _t = __t496; + _t = _t->getNextSibling(); + break; + } + case CONCAT: + { + RefAdaAST __t497 = _t; + RefAdaAST tmp84_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CONCAT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + signed_term(_t); + _t = _retTree; + _t = __t497; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + signed_term(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::range(RefAdaAST _t) { + RefAdaAST range_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + { + range_dots(_t); + _t = _retTree; + break; + } + case RANGE_ATTRIBUTE_REFERENCE: + { + range_attrib_ref(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::range_constraint(RefAdaAST _t) { + RefAdaAST range_constraint_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t99 = _t; + RefAdaAST tmp85_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RANGE_CONSTRAINT); + _t = _t->getFirstChild(); + range(_t); + _t = _retTree; + _t = __t99; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::range_dots(RefAdaAST _t) { + RefAdaAST range_dots_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t103 = _t; + RefAdaAST tmp86_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT_DOT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t103; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::range_attrib_ref(RefAdaAST _t) { + RefAdaAST range_attrib_ref_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t105 = _t; + RefAdaAST tmp87_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RANGE_ATTRIBUTE_REFERENCE); + _t = _t->getFirstChild(); + prefix(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t105; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prefix(RefAdaAST _t) { + RefAdaAST prefix_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp88_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + RefAdaAST __t108 = _t; + RefAdaAST tmp89_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + prefix(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ALL: + { + RefAdaAST tmp90_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ALL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp91_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t108; + _t = _t->getNextSibling(); + break; + } + case INDEXED_COMPONENT: + { + RefAdaAST __t110 = _t; + RefAdaAST tmp92_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INDEXED_COMPONENT); + _t = _t->getFirstChild(); + prefix(_t); + _t = _retTree; + value_s(_t); + _t = _retTree; + _t = __t110; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::parameter_specification(RefAdaAST _t) { + RefAdaAST parameter_specification_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t116 = _t; + RefAdaAST tmp93_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PARAMETER_SPECIFICATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t116; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::defining_identifier_list(RefAdaAST _t) { + RefAdaAST defining_identifier_list_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t118 = _t; + RefAdaAST tmp94_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DEFINING_IDENTIFIER_LIST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt120=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER)) { + RefAdaAST tmp95_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + } + else { + if ( _cnt120>=1 ) { goto _loop120; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt120++; + } + _loop120:; + } // ( ... )+ + _t = __t118; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::init_opt(RefAdaAST _t) { + RefAdaAST init_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t154 = _t; + RefAdaAST tmp96_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INIT_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t154; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::name(RefAdaAST _t) { + RefAdaAST name_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp97_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + RefAdaAST __t123 = _t; + RefAdaAST tmp98_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ALL: + { + RefAdaAST tmp99_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ALL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp100_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp101_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + RefAdaAST tmp102_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t123; + _t = _t->getNextSibling(); + break; + } + case INDEXED_COMPONENT: + { + RefAdaAST __t125 = _t; + RefAdaAST tmp103_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INDEXED_COMPONENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + value_s(_t); + _t = _retTree; + _t = __t125; + _t = _t->getNextSibling(); + break; + } + case TIC: + { + RefAdaAST __t126 = _t; + RefAdaAST tmp104_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TIC); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + attribute_id(_t); + _t = _retTree; + _t = __t126; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::parenthesized_primary(RefAdaAST _t) { + RefAdaAST parenthesized_primary_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t129 = _t; + RefAdaAST tmp105_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PARENTHESIZED_PRIMARY); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NuLL: + { + RefAdaAST tmp106_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NuLL); + _t = _t->getNextSibling(); + break; + } + case VALUES: + { + value_s(_t); + _t = _retTree; + extension_opt(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t129; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::extension_opt(RefAdaAST _t) { + RefAdaAST extension_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t132 = _t; + RefAdaAST tmp107_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXTENSION_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NuLL: + { + RefAdaAST tmp108_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NuLL); + _t = _t->getNextSibling(); + break; + } + case VALUES: + { + value_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t132; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::task_type_or_single_decl(RefAdaAST _t) { + RefAdaAST task_type_or_single_decl_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case TASK_TYPE_DECLARATION: + { + RefAdaAST __t141 = _t; + RefAdaAST tmp109_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TASK_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + discrim_part_opt(_t); + _t = _retTree; + task_definition_opt(_t); + _t = _retTree; + _t = __t141; + _t = _t->getNextSibling(); + break; + } + case SINGLE_TASK_DECLARATION: + { + RefAdaAST __t142 = _t; + RefAdaAST tmp110_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SINGLE_TASK_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + task_definition_opt(_t); + _t = _retTree; + _t = __t142; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prot_type_or_single_decl(RefAdaAST _t) { + RefAdaAST prot_type_or_single_decl_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROTECTED_TYPE_DECLARATION: + { + RefAdaAST __t182 = _t; + RefAdaAST tmp111_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROTECTED_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + discrim_part_opt(_t); + _t = _retTree; + protected_definition(_t); + _t = _retTree; + _t = __t182; + _t = _t->getNextSibling(); + break; + } + case SINGLE_PROTECTED_DECLARATION: + { + RefAdaAST __t183 = _t; + RefAdaAST tmp112_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SINGLE_PROTECTED_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + protected_definition(_t); + _t = _retTree; + _t = __t183; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::decl_common(RefAdaAST _t) { + RefAdaAST decl_common_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ENUMERATION_TYPE_DECLARATION: + { + RefAdaAST __t202 = _t; + RefAdaAST tmp113_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENUMERATION_TYPE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp114_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + enum_id_s(_t); + _t = _retTree; + _t = __t202; + _t = _t->getNextSibling(); + break; + } + case SIGNED_INTEGER_TYPE_DECLARATION: + { + RefAdaAST __t203 = _t; + RefAdaAST tmp115_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SIGNED_INTEGER_TYPE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp116_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + range(_t); + _t = _retTree; + _t = __t203; + _t = _t->getNextSibling(); + break; + } + case MODULAR_TYPE_DECLARATION: + { + RefAdaAST __t204 = _t; + RefAdaAST tmp117_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MODULAR_TYPE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp118_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + _t = __t204; + _t = _t->getNextSibling(); + break; + } + case FLOATING_POINT_DECLARATION: + { + RefAdaAST __t205 = _t; + RefAdaAST tmp119_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FLOATING_POINT_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp120_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t205; + _t = _t->getNextSibling(); + break; + } + case ORDINARY_FIXED_POINT_DECLARATION: + { + RefAdaAST __t206 = _t; + RefAdaAST tmp121_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ORDINARY_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp122_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + range(_t); + _t = _retTree; + _t = __t206; + _t = _t->getNextSibling(); + break; + } + case DECIMAL_FIXED_POINT_DECLARATION: + { + RefAdaAST __t207 = _t; + RefAdaAST tmp123_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DECIMAL_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp124_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t207; + _t = _t->getNextSibling(); + break; + } + case ARRAY_TYPE_DECLARATION: + { + array_type_declaration(_t); + _t = _retTree; + break; + } + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + { + access_type_declaration(_t); + _t = _retTree; + break; + } + case INCOMPLETE_TYPE_DECLARATION: + { + RefAdaAST __t208 = _t; + RefAdaAST tmp125_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INCOMPLETE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp126_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + discrim_part_opt(_t); + _t = _retTree; + _t = __t208; + _t = _t->getNextSibling(); + break; + } + case PRIVATE_EXTENSION_DECLARATION: + { + RefAdaAST __t209 = _t; + RefAdaAST tmp127_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PRIVATE_EXTENSION_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t209; + _t = _t->getNextSibling(); + break; + } + case DERIVED_RECORD_EXTENSION: + { + RefAdaAST __t210 = _t; + RefAdaAST tmp128_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DERIVED_RECORD_EXTENSION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + record_definition(_t); + _t = _retTree; + _t = __t210; + _t = _t->getNextSibling(); + break; + } + case ORDINARY_DERIVED_TYPE_DECLARATION: + { + RefAdaAST __t211 = _t; + RefAdaAST tmp129_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ORDINARY_DERIVED_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t211; + _t = _t->getNextSibling(); + break; + } + case PRIVATE_TYPE_DECLARATION: + { + RefAdaAST __t212 = _t; + RefAdaAST tmp130_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PRIVATE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + _t = __t212; + _t = _t->getNextSibling(); + break; + } + case RECORD_TYPE_DECLARATION: + { + RefAdaAST __t213 = _t; + RefAdaAST tmp131_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RECORD_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + record_definition(_t); + _t = _retTree; + _t = __t213; + _t = _t->getNextSibling(); + break; + } + case SUBTYPE_DECLARATION: + { + RefAdaAST __t214 = _t; + RefAdaAST tmp132_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SUBTYPE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp133_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + subtype_ind(_t); + _t = _retTree; + _t = __t214; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + { + generic_decl(_t); + _t = _retTree; + break; + } + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + { + use_clause(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + { + rep_spec(_t); + _t = _retTree; + break; + } + case EXCEPTION_RENAMING_DECLARATION: + { + RefAdaAST __t215 = _t; + RefAdaAST tmp134_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXCEPTION_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + compound_name(_t); + _t = _retTree; + _t = __t215; + _t = _t->getNextSibling(); + break; + } + case OBJECT_RENAMING_DECLARATION: + { + RefAdaAST __t216 = _t; + RefAdaAST tmp135_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OBJECT_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + name(_t); + _t = _retTree; + _t = __t216; + _t = _t->getNextSibling(); + break; + } + case EXCEPTION_DECLARATION: + { + RefAdaAST __t217 = _t; + RefAdaAST tmp136_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXCEPTION_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + _t = __t217; + _t = _t->getNextSibling(); + break; + } + case NUMBER_DECLARATION: + { + RefAdaAST __t218 = _t; + RefAdaAST tmp137_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUMBER_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t218; + _t = _t->getNextSibling(); + break; + } + case ARRAY_OBJECT_DECLARATION: + { + RefAdaAST __t219 = _t; + RefAdaAST tmp138_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY_OBJECT_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + array_type_definition(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t219; + _t = _t->getNextSibling(); + break; + } + case OBJECT_DECLARATION: + { + RefAdaAST __t220 = _t; + RefAdaAST tmp139_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OBJECT_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t220; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discrim_part_opt(RefAdaAST _t) { + RefAdaAST discrim_part_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t145 = _t; + RefAdaAST tmp140_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DISCRIM_PART_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + RefAdaAST tmp141_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOX); + _t = _t->getNextSibling(); + break; + } + case DISCRIMINANT_SPECIFICATIONS: + { + discriminant_specifications(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t145; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::task_definition_opt(RefAdaAST _t) { + RefAdaAST task_definition_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + task_items_opt(_t); + _t = _retTree; + private_task_items_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::task_items_opt(RefAdaAST _t) { + RefAdaAST task_items_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t157 = _t; + RefAdaAST tmp142_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TASK_ITEMS_OPT); + _t = _t->getFirstChild(); + entrydecls_repspecs_opt(_t); + _t = _retTree; + _t = __t157; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::private_task_items_opt(RefAdaAST _t) { + RefAdaAST private_task_items_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t180 = _t; + RefAdaAST tmp143_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PRIVATE_TASK_ITEMS_OPT); + _t = _t->getFirstChild(); + entrydecls_repspecs_opt(_t); + _t = _retTree; + _t = __t180; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discriminant_specifications(RefAdaAST _t) { + RefAdaAST discriminant_specifications_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t148 = _t; + RefAdaAST tmp144_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DISCRIMINANT_SPECIFICATIONS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == DISCRIMINANT_SPECIFICATION)) { + discriminant_specification(_t); + _t = _retTree; + } + else { + goto _loop150; + } + + } + _loop150:; + } // ( ... )* + _t = __t148; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discriminant_specification(RefAdaAST _t) { + RefAdaAST discriminant_specification_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t152 = _t; + RefAdaAST tmp145_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DISCRIMINANT_SPECIFICATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t152; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entrydecls_repspecs_opt(RefAdaAST _t) { + RefAdaAST entrydecls_repspecs_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ENTRY_DECLARATION: + { + entry_declaration(_t); + _t = _retTree; + break; + } + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + { + rep_spec(_t); + _t = _retTree; + break; + } + default: + { + goto _loop160; + } + } + } + _loop160:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_declaration(RefAdaAST _t) { + RefAdaAST entry_declaration_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t162 = _t; + RefAdaAST tmp146_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENTRY_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp147_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + discrete_subtype_def_opt(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t162; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::rep_spec(RefAdaAST _t) { + RefAdaAST rep_spec_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case RECORD_REPRESENTATION_CLAUSE: + { + RefAdaAST __t168 = _t; + RefAdaAST tmp148_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RECORD_REPRESENTATION_CLAUSE); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + align_opt(_t); + _t = _retTree; + comp_loc_s(_t); + _t = _retTree; + _t = __t168; + _t = _t->getNextSibling(); + break; + } + case AT_CLAUSE: + { + RefAdaAST __t169 = _t; + RefAdaAST tmp149_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),AT_CLAUSE); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t169; + _t = _t->getNextSibling(); + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + { + RefAdaAST __t170 = _t; + RefAdaAST tmp150_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ATTRIBUTE_DEFINITION_CLAUSE); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t170; + _t = _t->getNextSibling(); + break; + } + case ENUMERATION_REPESENTATION_CLAUSE: + { + RefAdaAST __t171 = _t; + RefAdaAST tmp151_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENUMERATION_REPESENTATION_CLAUSE); + _t = _t->getFirstChild(); + local_enum_name(_t); + _t = _retTree; + enumeration_aggregate(_t); + _t = _retTree; + _t = __t171; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discrete_subtype_def_opt(RefAdaAST _t) { + RefAdaAST discrete_subtype_def_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t164 = _t; + RefAdaAST tmp152_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DISCRETE_SUBTYPE_DEF_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + case SUBTYPE_INDICATION: + { + discrete_subtype_definition(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t164; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discrete_subtype_definition(RefAdaAST _t) { + RefAdaAST discrete_subtype_definition_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + case SUBTYPE_INDICATION: + { + subtype_ind(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subtype_ind(RefAdaAST _t) { + RefAdaAST subtype_ind_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t239 = _t; + RefAdaAST tmp153_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SUBTYPE_INDICATION); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + constraint_opt(_t); + _t = _retTree; + _t = __t239; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::align_opt(RefAdaAST _t) { + RefAdaAST align_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t173 = _t; + RefAdaAST tmp154_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MOD_CLAUSE_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t173; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::comp_loc_s(RefAdaAST _t) { + RefAdaAST comp_loc_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t176 = _t; + RefAdaAST tmp155_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COMPONENT_CLAUSES_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case DOT: + case TIC: + { + subtype_mark(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + range(_t); + _t = _retTree; + break; + } + default: + { + goto _loop178; + } + } + } + _loop178:; + } // ( ... )* + _t = __t176; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::local_enum_name(RefAdaAST _t) { + RefAdaAST local_enum_name_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp156_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::enumeration_aggregate(RefAdaAST _t) { + RefAdaAST enumeration_aggregate_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_2.member(_t->getType()))) { + value(_t); + _t = _retTree; + } + else { + goto _loop293; + } + + } + _loop293:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::protected_definition(RefAdaAST _t) { + RefAdaAST protected_definition_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + prot_op_decl_s(_t); + _t = _retTree; + prot_private_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prot_private_opt(RefAdaAST _t) { + RefAdaAST prot_private_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t185 = _t; + RefAdaAST tmp157_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROT_PRIVATE_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROT_MEMBER_DECLARATIONS: + { + prot_member_decl_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t185; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prot_member_decl_s(RefAdaAST _t) { + RefAdaAST prot_member_decl_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t196 = _t; + RefAdaAST tmp158_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROT_MEMBER_DECLARATIONS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENTRY_DECLARATION: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + case FUNCTION_DECLARATION: + case PROCEDURE_DECLARATION: + { + prot_op_decl(_t); + _t = _retTree; + break; + } + case COMPONENT_DECLARATION: + { + comp_decl(_t); + _t = _retTree; + break; + } + default: + { + goto _loop198; + } + } + } + _loop198:; + } // ( ... )* + _t = __t196; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prot_op_decl_s(RefAdaAST _t) { + RefAdaAST prot_op_decl_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t189 = _t; + RefAdaAST tmp159_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROT_OP_DECLARATIONS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_3.member(_t->getType()))) { + prot_op_decl(_t); + _t = _retTree; + } + else { + goto _loop191; + } + + } + _loop191:; + } // ( ... )* + _t = __t189; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prot_op_decl(RefAdaAST _t) { + RefAdaAST prot_op_decl_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ENTRY_DECLARATION: + { + entry_declaration(_t); + _t = _retTree; + break; + } + case PROCEDURE_DECLARATION: + { + RefAdaAST __t193 = _t; + RefAdaAST tmp160_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t193; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_DECLARATION: + { + RefAdaAST __t194 = _t; + RefAdaAST tmp161_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t194; + _t = _t->getNextSibling(); + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + { + rep_spec(_t); + _t = _retTree; + break; + } + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::comp_decl(RefAdaAST _t) { + RefAdaAST comp_decl_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t200 = _t; + RefAdaAST tmp162_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COMPONENT_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + component_subtype_def(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t200; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::component_subtype_def(RefAdaAST _t) { + RefAdaAST component_subtype_def_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::enum_id_s(RefAdaAST _t) { + RefAdaAST enum_id_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )+ + int _cnt224=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == CHARACTER_LITERAL)) { + enumeration_literal_specification(_t); + _t = _retTree; + } + else { + if ( _cnt224>=1 ) { goto _loop224; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt224++; + } + _loop224:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::range_constraint_opt(RefAdaAST _t) { + RefAdaAST range_constraint_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case RANGE_CONSTRAINT: + { + range_constraint(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::array_type_declaration(RefAdaAST _t) { + RefAdaAST array_type_declaration_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t230 = _t; + RefAdaAST tmp163_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY_TYPE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp164_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + array_type_definition(_t); + _t = _retTree; + _t = __t230; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::access_type_declaration(RefAdaAST _t) { + RefAdaAST access_type_declaration_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ACCESS_TO_PROCEDURE_DECLARATION: + { + RefAdaAST __t263 = _t; + RefAdaAST tmp165_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCESS_TO_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp166_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t263; + _t = _t->getNextSibling(); + break; + } + case ACCESS_TO_FUNCTION_DECLARATION: + { + RefAdaAST __t264 = _t; + RefAdaAST tmp167_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCESS_TO_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp168_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t264; + _t = _t->getNextSibling(); + break; + } + case ACCESS_TO_OBJECT_DECLARATION: + { + RefAdaAST __t265 = _t; + RefAdaAST tmp169_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCESS_TO_OBJECT_DECLARATION); + _t = _t->getFirstChild(); + RefAdaAST tmp170_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t265; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::id_and_discrim(RefAdaAST _t) { + RefAdaAST id_and_discrim_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp171_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + discrim_part_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::record_definition(RefAdaAST _t) { + RefAdaAST record_definition_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case COMPONENT_ITEMS: + { + component_list(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::array_type_definition(RefAdaAST _t) { + RefAdaAST array_type_definition_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + index_or_discrete_range_s(_t); + _t = _retTree; + component_subtype_def(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::enumeration_literal_specification(RefAdaAST _t) { + RefAdaAST enumeration_literal_specification_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp172_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp173_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::index_or_discrete_range_s(RefAdaAST _t) { + RefAdaAST index_or_discrete_range_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case RANGE: + case DOT_DOT: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + index_or_discrete_range(_t); + _t = _retTree; + break; + } + case COMMA: + { + RefAdaAST __t232 = _t; + RefAdaAST tmp174_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COMMA); + _t = _t->getFirstChild(); + index_or_discrete_range_s(_t); + _t = _retTree; + index_or_discrete_range(_t); + _t = _retTree; + _t = __t232; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::index_or_discrete_range(RefAdaAST _t) { + RefAdaAST index_or_discrete_range_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + { + RefAdaAST __t234 = _t; + RefAdaAST tmp175_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT_DOT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t234; + _t = _t->getNextSibling(); + break; + } + case RANGE: + { + RefAdaAST __t235 = _t; + RefAdaAST tmp176_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RANGE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + RefAdaAST tmp177_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOX); + _t = _t->getNextSibling(); + break; + } + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t235; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + simple_expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::constraint_opt(RefAdaAST _t) { + RefAdaAST constraint_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case RANGE_CONSTRAINT: + { + range_constraint(_t); + _t = _retTree; + break; + } + case DIGITS_CONSTRAINT: + { + digits_constraint(_t); + _t = _retTree; + break; + } + case DELTA_CONSTRAINT: + { + delta_constraint(_t); + _t = _retTree; + break; + } + case INDEX_CONSTRAINT: + { + index_constraint(_t); + _t = _retTree; + break; + } + case DISCRIMINANT_CONSTRAINT: + { + discriminant_constraint(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::digits_constraint(RefAdaAST _t) { + RefAdaAST digits_constraint_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t243 = _t; + RefAdaAST tmp178_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DIGITS_CONSTRAINT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t243; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::delta_constraint(RefAdaAST _t) { + RefAdaAST delta_constraint_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t245 = _t; + RefAdaAST tmp179_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DELTA_CONSTRAINT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t245; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::index_constraint(RefAdaAST _t) { + RefAdaAST index_constraint_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t247 = _t; + RefAdaAST tmp180_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INDEX_CONSTRAINT); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt249=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == DOT_DOT || _t->getType() == RANGE_ATTRIBUTE_REFERENCE || _t->getType() == SUBTYPE_INDICATION)) { + discrete_range(_t); + _t = _retTree; + } + else { + if ( _cnt249>=1 ) { goto _loop249; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt249++; + } + _loop249:; + } // ( ... )+ + _t = __t247; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discriminant_constraint(RefAdaAST _t) { + RefAdaAST discriminant_constraint_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t252 = _t; + RefAdaAST tmp181_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DISCRIMINANT_CONSTRAINT); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt254=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == DISCRIMINANT_ASSOCIATION)) { + discriminant_association(_t); + _t = _retTree; + } + else { + if ( _cnt254>=1 ) { goto _loop254; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt254++; + } + _loop254:; + } // ( ... )+ + _t = __t252; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discrete_range(RefAdaAST _t) { + RefAdaAST discrete_range_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + case SUBTYPE_INDICATION: + { + subtype_ind(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discriminant_association(RefAdaAST _t) { + RefAdaAST discriminant_association_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t256 = _t; + RefAdaAST tmp182_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DISCRIMINANT_ASSOCIATION); + _t = _t->getFirstChild(); + selector_names_opt(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t256; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::selector_names_opt(RefAdaAST _t) { + RefAdaAST selector_names_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t258 = _t; + RefAdaAST tmp183_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SELECTOR_NAMES_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER)) { + selector_name(_t); + _t = _retTree; + } + else { + goto _loop260; + } + + } + _loop260:; + } // ( ... )* + _t = __t258; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::selector_name(RefAdaAST _t) { + RefAdaAST selector_name_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp184_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::component_list(RefAdaAST _t) { + RefAdaAST component_list_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + component_items(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case VARIANT_PART: + { + variant_part(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::component_items(RefAdaAST _t) { + RefAdaAST component_items_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t271 = _t; + RefAdaAST tmp185_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COMPONENT_ITEMS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case COMPONENT_DECLARATION: + { + comp_decl(_t); + _t = _retTree; + break; + } + default: + { + goto _loop273; + } + } + } + _loop273:; + } // ( ... )* + _t = __t271; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::variant_part(RefAdaAST _t) { + RefAdaAST variant_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t275 = _t; + RefAdaAST tmp186_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIANT_PART); + _t = _t->getFirstChild(); + discriminant_direct_name(_t); + _t = _retTree; + variant_s(_t); + _t = _retTree; + _t = __t275; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discriminant_direct_name(RefAdaAST _t) { + RefAdaAST discriminant_direct_name_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp187_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::variant_s(RefAdaAST _t) { + RefAdaAST variant_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t278 = _t; + RefAdaAST tmp188_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIANTS); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt280=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == VARIANT)) { + variant(_t); + _t = _retTree; + } + else { + if ( _cnt280>=1 ) { goto _loop280; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt280++; + } + _loop280:; + } // ( ... )+ + _t = __t278; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::variant(RefAdaAST _t) { + RefAdaAST variant_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t282 = _t; + RefAdaAST tmp189_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIANT); + _t = _t->getFirstChild(); + choice_s(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case COMPONENT_ITEMS: + { + component_list(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t282; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::choice_s(RefAdaAST _t) { + RefAdaAST choice_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PIPE: + { + RefAdaAST __t285 = _t; + RefAdaAST tmp190_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PIPE); + _t = _t->getFirstChild(); + choice_s(_t); + _t = _retTree; + choice(_t); + _t = _retTree; + _t = __t285; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case OTHERS: + case DOT_DOT: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case RANGE_ATTRIBUTE_REFERENCE: + case AND_THEN: + case MARK_WITH_CONSTRAINT: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + choice(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::choice(RefAdaAST _t) { + RefAdaAST choice_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case OTHERS: + { + RefAdaAST tmp191_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OTHERS); + _t = _t->getNextSibling(); + break; + } + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + case MARK_WITH_CONSTRAINT: + { + discrete_with_range(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::discrete_with_range(RefAdaAST _t) { + RefAdaAST discrete_with_range_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case MARK_WITH_CONSTRAINT: + { + mark_with_constraint(_t); + _t = _retTree; + break; + } + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::mark_with_constraint(RefAdaAST _t) { + RefAdaAST mark_with_constraint_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t289 = _t; + RefAdaAST tmp192_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MARK_WITH_CONSTRAINT); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + range_constraint(_t); + _t = _retTree; + _t = __t289; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::generic_formal_parameter(RefAdaAST _t) { + RefAdaAST generic_formal_parameter_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case FORMAL_DISCRETE_TYPE_DECLARATION: + { + RefAdaAST __t299 = _t; + RefAdaAST tmp193_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_DISCRETE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t299; + _t = _t->getNextSibling(); + break; + } + case FORMAL_SIGNED_INTEGER_TYPE_DECLARATION: + { + RefAdaAST __t300 = _t; + RefAdaAST tmp194_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_SIGNED_INTEGER_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t300; + _t = _t->getNextSibling(); + break; + } + case FORMAL_MODULAR_TYPE_DECLARATION: + { + RefAdaAST __t301 = _t; + RefAdaAST tmp195_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_MODULAR_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t301; + _t = _t->getNextSibling(); + break; + } + case FORMAL_DECIMAL_FIXED_POINT_DECLARATION: + { + RefAdaAST __t302 = _t; + RefAdaAST tmp196_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_DECIMAL_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t302; + _t = _t->getNextSibling(); + break; + } + case FORMAL_ORDINARY_FIXED_POINT_DECLARATION: + { + RefAdaAST __t303 = _t; + RefAdaAST tmp197_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_ORDINARY_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t303; + _t = _t->getNextSibling(); + break; + } + case FORMAL_FLOATING_POINT_DECLARATION: + { + RefAdaAST __t304 = _t; + RefAdaAST tmp198_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_FLOATING_POINT_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t304; + _t = _t->getNextSibling(); + break; + } + case ARRAY_TYPE_DECLARATION: + { + formal_array_type_declaration(_t); + _t = _retTree; + break; + } + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + { + formal_access_type_declaration(_t); + _t = _retTree; + break; + } + case FORMAL_PRIVATE_TYPE_DECLARATION: + { + RefAdaAST __t305 = _t; + RefAdaAST tmp199_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_PRIVATE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_part(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + _t = __t305; + _t = _t->getNextSibling(); + break; + } + case FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION: + { + RefAdaAST __t306 = _t; + RefAdaAST tmp200_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_part(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t306; + _t = _t->getNextSibling(); + break; + } + case FORMAL_PRIVATE_EXTENSION_DECLARATION: + { + RefAdaAST __t307 = _t; + RefAdaAST tmp201_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_PRIVATE_EXTENSION_DECLARATION); + _t = _t->getFirstChild(); + id_part(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t307; + _t = _t->getNextSibling(); + break; + } + case FORMAL_PROCEDURE_DECLARATION: + { + RefAdaAST __t308 = _t; + RefAdaAST tmp202_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + subprogram_default_opt(_t); + _t = _retTree; + _t = __t308; + _t = _t->getNextSibling(); + break; + } + case FORMAL_FUNCTION_DECLARATION: + { + RefAdaAST __t309 = _t; + RefAdaAST tmp203_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + subprogram_default_opt(_t); + _t = _retTree; + _t = __t309; + _t = _t->getNextSibling(); + break; + } + case FORMAL_PACKAGE_DECLARATION: + { + RefAdaAST __t310 = _t; + RefAdaAST tmp204_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FORMAL_PACKAGE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + compound_name(_t); + _t = _retTree; + formal_package_actual_part_opt(_t); + _t = _retTree; + _t = __t310; + _t = _t->getNextSibling(); + break; + } + case PARAMETER_SPECIFICATION: + { + parameter_specification(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::formal_array_type_declaration(RefAdaAST _t) { + RefAdaAST formal_array_type_declaration_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + array_type_declaration(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::formal_access_type_declaration(RefAdaAST _t) { + RefAdaAST formal_access_type_declaration_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + access_type_declaration(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::id_part(RefAdaAST _t) { + RefAdaAST id_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + def_id(_t); + _t = _retTree; + discrim_part_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subprogram_default_opt(RefAdaAST _t) { + RefAdaAST subprogram_default_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + RefAdaAST tmp205_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOX); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case INDEXED_COMPONENT: + { + name(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::formal_package_actual_part_opt(RefAdaAST _t) { + RefAdaAST formal_package_actual_part_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + RefAdaAST tmp206_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOX); + _t = _t->getNextSibling(); + break; + } + case DEFINING_IDENTIFIER_LIST: + { + defining_identifier_list(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::body_part(RefAdaAST _t) { + RefAdaAST body_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + declarative_part(_t); + _t = _retTree; + block_body(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::declarative_part(RefAdaAST _t) { + RefAdaAST declarative_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t324 = _t; + RefAdaAST tmp207_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DECLARATIVE_PART); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PACKAGE_BODY: + case PACKAGE_BODY_STUB: + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case PROTECTED_BODY: + case PROTECTED_BODY_STUB: + case PROTECTED_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SINGLE_PROTECTED_DECLARATION: + case SINGLE_TASK_DECLARATION: + case SUBTYPE_DECLARATION: + case TASK_BODY: + case TASK_BODY_STUB: + case TASK_TYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case FUNCTION_BODY: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_INSTANTIATION: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case PROCEDURE_BODY: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + declarative_item(_t); + _t = _retTree; + break; + } + default: + { + goto _loop326; + } + } + } + _loop326:; + } // ( ... )* + _t = __t324; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::block_body(RefAdaAST _t) { + RefAdaAST block_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t343 = _t; + RefAdaAST tmp208_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BLOCK_BODY); + _t = _t->getFirstChild(); + handled_stmt_s(_t); + _t = _retTree; + _t = __t343; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::declarative_item(RefAdaAST _t) { + RefAdaAST declarative_item_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PACKAGE_BODY_STUB: + { + RefAdaAST __t328 = _t; + RefAdaAST tmp209_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t328; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_BODY: + { + RefAdaAST __t329 = _t; + RefAdaAST tmp210_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + pkg_body_part(_t); + _t = _retTree; + _t = __t329; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case GENERIC_PACKAGE_INSTANTIATION: + { + spec_decl_part(_t); + _t = _retTree; + break; + } + case TASK_BODY_STUB: + { + RefAdaAST __t330 = _t; + RefAdaAST tmp211_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TASK_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t330; + _t = _t->getNextSibling(); + break; + } + case TASK_BODY: + { + RefAdaAST __t331 = _t; + RefAdaAST tmp212_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TASK_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + _t = __t331; + _t = _t->getNextSibling(); + break; + } + case SINGLE_TASK_DECLARATION: + case TASK_TYPE_DECLARATION: + { + task_type_or_single_decl(_t); + _t = _retTree; + break; + } + case PROTECTED_BODY_STUB: + { + RefAdaAST __t332 = _t; + RefAdaAST tmp213_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROTECTED_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t332; + _t = _t->getNextSibling(); + break; + } + case PROTECTED_BODY: + { + RefAdaAST __t333 = _t; + RefAdaAST tmp214_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROTECTED_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + prot_op_bodies_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + _t = __t333; + _t = _t->getNextSibling(); + break; + } + case PROTECTED_TYPE_DECLARATION: + case SINGLE_PROTECTED_DECLARATION: + { + prot_type_or_single_decl(_t); + _t = _retTree; + break; + } + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl_or_rename_or_inst_or_body(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SUBTYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + decl_common(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::prot_op_bodies_opt(RefAdaAST _t) { + RefAdaAST prot_op_bodies_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t339 = _t; + RefAdaAST tmp215_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROT_OP_BODIES_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case ENTRY_BODY: + { + entry_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + case FUNCTION_DECLARATION: + case PROCEDURE_BODY: + case PROCEDURE_DECLARATION: + { + subprog_decl_or_body(_t); + _t = _retTree; + break; + } + default: + { + goto _loop341; + } + } + } + _loop341:; + } // ( ... )* + _t = __t339; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::block_body_opt(RefAdaAST _t) { + RefAdaAST block_body_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t336 = _t; + RefAdaAST tmp216_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BLOCK_BODY_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case HANDLED_SEQUENCE_OF_STATEMENTS: + { + handled_stmt_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t336; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::handled_stmt_s(RefAdaAST _t) { + RefAdaAST handled_stmt_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t345 = _t; + RefAdaAST tmp217_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),HANDLED_SEQUENCE_OF_STATEMENTS); + _t = _t->getFirstChild(); + statements(_t); + _t = _retTree; + except_handler_part_opt(_t); + _t = _retTree; + _t = __t345; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_body(RefAdaAST _t) { + RefAdaAST entry_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t405 = _t; + RefAdaAST tmp218_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENTRY_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + entry_body_formal_part(_t); + _t = _retTree; + entry_barrier(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t405; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::statements(RefAdaAST _t) { + RefAdaAST statements_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t350 = _t; + RefAdaAST tmp219_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SEQUENCE_OF_STATEMENTS); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt352=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case STATEMENT: + { + statement(_t); + _t = _retTree; + break; + } + default: + { + if ( _cnt352>=1 ) { goto _loop352; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + } + _cnt352++; + } + _loop352:; + } // ( ... )+ + _t = __t350; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::except_handler_part_opt(RefAdaAST _t) { + RefAdaAST except_handler_part_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t455 = _t; + RefAdaAST tmp220_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXCEPT_HANDLER_PART_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == EXCEPTION_HANDLER)) { + exception_handler(_t); + _t = _retTree; + } + else { + goto _loop457; + } + + } + _loop457:; + } // ( ... )* + _t = __t455; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::handled_stmts_opt(RefAdaAST _t) { + RefAdaAST handled_stmts_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t347 = _t; + RefAdaAST tmp221_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),HANDLED_STMTS_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SEQUENCE_OF_STATEMENTS: + { + statements(_t); + _t = _retTree; + except_handler_part_opt(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t347; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::statement(RefAdaAST _t) { + RefAdaAST statement_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t354 = _t; + RefAdaAST tmp222_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STATEMENT); + _t = _t->getFirstChild(); + def_label_opt(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NULL_STATEMENT: + { + null_stmt(_t); + _t = _retTree; + break; + } + case EXIT_STATEMENT: + { + exit_stmt(_t); + _t = _retTree; + break; + } + case RETURN_STATEMENT: + { + return_stmt(_t); + _t = _retTree; + break; + } + case GOTO_STATEMENT: + { + goto_stmt(_t); + _t = _retTree; + break; + } + case DELAY_STATEMENT: + { + delay_stmt(_t); + _t = _retTree; + break; + } + case ABORT_STATEMENT: + { + abort_stmt(_t); + _t = _retTree; + break; + } + case RAISE_STATEMENT: + { + raise_stmt(_t); + _t = _retTree; + break; + } + case REQUEUE_STATEMENT: + { + requeue_stmt(_t); + _t = _retTree; + break; + } + case ACCEPT_STATEMENT: + { + accept_stmt(_t); + _t = _retTree; + break; + } + case ASYNCHRONOUS_SELECT: + case CONDITIONAL_ENTRY_CALL: + case SELECTIVE_ACCEPT: + case TIMED_ENTRY_CALL: + { + select_stmt(_t); + _t = _retTree; + break; + } + case IF_STATEMENT: + { + if_stmt(_t); + _t = _retTree; + break; + } + case CASE_STATEMENT: + { + case_stmt(_t); + _t = _retTree; + break; + } + case LOOP_STATEMENT: + { + loop_stmt(_t); + _t = _retTree; + id_opt(_t); + _t = _retTree; + break; + } + case BLOCK_STATEMENT: + { + block(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + break; + } + case ASSIGNMENT_STATEMENT: + case CALL_STATEMENT: + { + call_or_assignment(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t354; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::def_label_opt(RefAdaAST _t) { + RefAdaAST def_label_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t357 = _t; + RefAdaAST tmp223_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LABEL_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp224_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t357; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::null_stmt(RefAdaAST _t) { + RefAdaAST null_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp225_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NULL_STATEMENT); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::exit_stmt(RefAdaAST _t) { + RefAdaAST exit_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t392 = _t; + RefAdaAST tmp226_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXIT_STATEMENT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + label_name(_t); + _t = _retTree; + break; + } + case 3: + case WHEN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case WHEN: + { + RefAdaAST tmp227_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),WHEN); + _t = _t->getNextSibling(); + condition(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t392; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::return_stmt(RefAdaAST _t) { + RefAdaAST return_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t397 = _t; + RefAdaAST tmp228_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RETURN_STATEMENT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t397; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::goto_stmt(RefAdaAST _t) { + RefAdaAST goto_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t400 = _t; + RefAdaAST tmp229_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GOTO_STATEMENT); + _t = _t->getFirstChild(); + label_name(_t); + _t = _retTree; + _t = __t400; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::delay_stmt(RefAdaAST _t) { + RefAdaAST delay_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t419 = _t; + RefAdaAST tmp230_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DELAY_STATEMENT); + _t = _t->getFirstChild(); + modifiers(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t419; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::abort_stmt(RefAdaAST _t) { + RefAdaAST abort_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t451 = _t; + RefAdaAST tmp231_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABORT_STATEMENT); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt453=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_4.member(_t->getType()))) { + name(_t); + _t = _retTree; + } + else { + if ( _cnt453>=1 ) { goto _loop453; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt453++; + } + _loop453:; + } // ( ... )+ + _t = __t451; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::raise_stmt(RefAdaAST _t) { + RefAdaAST raise_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t467 = _t; + RefAdaAST tmp232_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RAISE_STATEMENT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t467; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::requeue_stmt(RefAdaAST _t) { + RefAdaAST requeue_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t470 = _t; + RefAdaAST tmp233_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),REQUEUE_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABORT: + { + RefAdaAST tmp234_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABORT); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t470; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::accept_stmt(RefAdaAST _t) { + RefAdaAST accept_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t414 = _t; + RefAdaAST tmp235_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCEPT_STATEMENT); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + entry_index_opt(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + handled_stmts_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + _t = __t414; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::select_stmt(RefAdaAST _t) { + RefAdaAST select_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ASYNCHRONOUS_SELECT: + { + RefAdaAST __t421 = _t; + RefAdaAST tmp236_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ASYNCHRONOUS_SELECT); + _t = _t->getFirstChild(); + triggering_alternative(_t); + _t = _retTree; + abortable_part(_t); + _t = _retTree; + _t = __t421; + _t = _t->getNextSibling(); + break; + } + case SELECTIVE_ACCEPT: + { + RefAdaAST __t422 = _t; + RefAdaAST tmp237_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SELECTIVE_ACCEPT); + _t = _t->getFirstChild(); + selective_accept(_t); + _t = _retTree; + _t = __t422; + _t = _t->getNextSibling(); + break; + } + case TIMED_ENTRY_CALL: + { + RefAdaAST __t423 = _t; + RefAdaAST tmp238_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TIMED_ENTRY_CALL); + _t = _t->getFirstChild(); + entry_call_alternative(_t); + _t = _retTree; + delay_alternative(_t); + _t = _retTree; + _t = __t423; + _t = _t->getNextSibling(); + break; + } + case CONDITIONAL_ENTRY_CALL: + { + RefAdaAST __t424 = _t; + RefAdaAST tmp239_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CONDITIONAL_ENTRY_CALL); + _t = _t->getFirstChild(); + entry_call_alternative(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t424; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::if_stmt(RefAdaAST _t) { + RefAdaAST if_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t361 = _t; + RefAdaAST tmp240_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IF_STATEMENT); + _t = _t->getFirstChild(); + cond_clause(_t); + _t = _retTree; + elsifs_opt(_t); + _t = _retTree; + else_opt(_t); + _t = _retTree; + _t = __t361; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::case_stmt(RefAdaAST _t) { + RefAdaAST case_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t373 = _t; + RefAdaAST tmp241_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CASE_STATEMENT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + alternative_s(_t); + _t = _retTree; + _t = __t373; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::loop_stmt(RefAdaAST _t) { + RefAdaAST loop_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t380 = _t; + RefAdaAST tmp242_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LOOP_STATEMENT); + _t = _t->getFirstChild(); + iteration_scheme_opt(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t380; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::block(RefAdaAST _t) { + RefAdaAST block_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t387 = _t; + RefAdaAST tmp243_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BLOCK_STATEMENT); + _t = _t->getFirstChild(); + declare_opt(_t); + _t = _retTree; + block_body(_t); + _t = _retTree; + _t = __t387; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::call_or_assignment(RefAdaAST _t) { + RefAdaAST call_or_assignment_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ASSIGNMENT_STATEMENT: + { + RefAdaAST __t402 = _t; + RefAdaAST tmp244_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ASSIGNMENT_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t402; + _t = _t->getNextSibling(); + break; + } + case CALL_STATEMENT: + { + RefAdaAST __t403 = _t; + RefAdaAST tmp245_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CALL_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + _t = __t403; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::cond_clause(RefAdaAST _t) { + RefAdaAST cond_clause_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t363 = _t; + RefAdaAST tmp246_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COND_CLAUSE); + _t = _t->getFirstChild(); + condition(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t363; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::elsifs_opt(RefAdaAST _t) { + RefAdaAST elsifs_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t366 = _t; + RefAdaAST tmp247_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ELSIFS_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == COND_CLAUSE)) { + cond_clause(_t); + _t = _retTree; + } + else { + goto _loop368; + } + + } + _loop368:; + } // ( ... )* + _t = __t366; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::else_opt(RefAdaAST _t) { + RefAdaAST else_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t370 = _t; + RefAdaAST tmp248_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ELSE_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SEQUENCE_OF_STATEMENTS: + { + statements(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t370; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::condition(RefAdaAST _t) { + RefAdaAST condition_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + expression(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::alternative_s(RefAdaAST _t) { + RefAdaAST alternative_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )+ + int _cnt376=0; + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == CASE_STATEMENT_ALTERNATIVE)) { + case_statement_alternative(_t); + _t = _retTree; + } + else { + if ( _cnt376>=1 ) { goto _loop376; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt376++; + } + _loop376:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::case_statement_alternative(RefAdaAST _t) { + RefAdaAST case_statement_alternative_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t378 = _t; + RefAdaAST tmp249_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CASE_STATEMENT_ALTERNATIVE); + _t = _t->getFirstChild(); + choice_s(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t378; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::iteration_scheme_opt(RefAdaAST _t) { + RefAdaAST iteration_scheme_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t382 = _t; + RefAdaAST tmp250_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ITERATION_SCHEME_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case WHILE: + { + RefAdaAST __t384 = _t; + RefAdaAST tmp251_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),WHILE); + _t = _t->getFirstChild(); + condition(_t); + _t = _retTree; + _t = __t384; + _t = _t->getNextSibling(); + break; + } + case FOR: + { + RefAdaAST __t385 = _t; + RefAdaAST tmp252_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FOR); + _t = _t->getFirstChild(); + RefAdaAST tmp253_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + discrete_subtype_definition(_t); + _t = _retTree; + _t = __t385; + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t382; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::declare_opt(RefAdaAST _t) { + RefAdaAST declare_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t389 = _t; + RefAdaAST tmp254_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DECLARE_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DECLARATIVE_PART: + { + declarative_part(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t389; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::label_name(RefAdaAST _t) { + RefAdaAST label_name_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST tmp255_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_body_formal_part(RefAdaAST _t) { + RefAdaAST entry_body_formal_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + entry_index_spec_opt(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_barrier(RefAdaAST _t) { + RefAdaAST entry_barrier_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + condition(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_index_spec_opt(RefAdaAST _t) { + RefAdaAST entry_index_spec_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t408 = _t; + RefAdaAST tmp256_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENTRY_INDEX_SPECIFICATION); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + def_id(_t); + _t = _retTree; + discrete_subtype_definition(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t408; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_call_stmt(RefAdaAST _t) { + RefAdaAST entry_call_stmt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t412 = _t; + RefAdaAST tmp257_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENTRY_CALL_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + _t = __t412; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_index_opt(RefAdaAST _t) { + RefAdaAST entry_index_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t416 = _t; + RefAdaAST tmp258_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENTRY_INDEX_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t416; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::triggering_alternative(RefAdaAST _t) { + RefAdaAST triggering_alternative_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t426 = _t; + RefAdaAST tmp259_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TRIGGERING_ALTERNATIVE); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DELAY_STATEMENT: + { + delay_stmt(_t); + _t = _retTree; + break; + } + case ENTRY_CALL_STATEMENT: + { + entry_call_stmt(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + stmts_opt(_t); + _t = _retTree; + _t = __t426; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::abortable_part(RefAdaAST _t) { + RefAdaAST abortable_part_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t429 = _t; + RefAdaAST tmp260_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABORTABLE_PART); + _t = _t->getFirstChild(); + stmts_opt(_t); + _t = _retTree; + _t = __t429; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::selective_accept(RefAdaAST _t) { + RefAdaAST selective_accept_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + guard_opt(_t); + _t = _retTree; + select_alternative(_t); + _t = _retTree; + or_select_opt(_t); + _t = _retTree; + else_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::entry_call_alternative(RefAdaAST _t) { + RefAdaAST entry_call_alternative_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t431 = _t; + RefAdaAST tmp261_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ENTRY_CALL_ALTERNATIVE); + _t = _t->getFirstChild(); + entry_call_stmt(_t); + _t = _retTree; + stmts_opt(_t); + _t = _retTree; + _t = __t431; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::delay_alternative(RefAdaAST _t) { + RefAdaAST delay_alternative_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t442 = _t; + RefAdaAST tmp262_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DELAY_ALTERNATIVE); + _t = _t->getFirstChild(); + delay_stmt(_t); + _t = _retTree; + stmts_opt(_t); + _t = _retTree; + _t = __t442; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::stmts_opt(RefAdaAST _t) { + RefAdaAST stmts_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case STATEMENT: + { + statement(_t); + _t = _retTree; + break; + } + default: + { + goto _loop445; + } + } + } + _loop445:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::guard_opt(RefAdaAST _t) { + RefAdaAST guard_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t434 = _t; + RefAdaAST tmp263_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GUARD_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + condition(_t); + _t = _retTree; + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == PRAGMA)) { + pragma(_t); + _t = _retTree; + } + else { + goto _loop437; + } + + } + _loop437:; + } // ( ... )* + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t434; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::select_alternative(RefAdaAST _t) { + RefAdaAST select_alternative_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ACCEPT_ALTERNATIVE: + { + accept_alternative(_t); + _t = _retTree; + break; + } + case DELAY_ALTERNATIVE: + { + delay_alternative(_t); + _t = _retTree; + break; + } + case TERMINATE_ALTERNATIVE: + { + RefAdaAST tmp264_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TERMINATE_ALTERNATIVE); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::or_select_opt(RefAdaAST _t) { + RefAdaAST or_select_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t447 = _t; + RefAdaAST tmp265_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OR_SELECT_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == GUARD_OPT)) { + guard_opt(_t); + _t = _retTree; + select_alternative(_t); + _t = _retTree; + } + else { + goto _loop449; + } + + } + _loop449:; + } // ( ... )* + _t = __t447; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::accept_alternative(RefAdaAST _t) { + RefAdaAST accept_alternative_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t440 = _t; + RefAdaAST tmp266_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ACCEPT_ALTERNATIVE); + _t = _t->getFirstChild(); + accept_stmt(_t); + _t = _retTree; + stmts_opt(_t); + _t = _retTree; + _t = __t440; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::exception_handler(RefAdaAST _t) { + RefAdaAST exception_handler_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t459 = _t; + RefAdaAST tmp267_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXCEPTION_HANDLER); + _t = _t->getFirstChild(); + identifier_colon_opt(_t); + _t = _retTree; + except_choice_s(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t459; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::identifier_colon_opt(RefAdaAST _t) { + RefAdaAST identifier_colon_opt_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t461 = _t; + RefAdaAST tmp268_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER_COLON_OPT); + _t = _t->getFirstChild(); + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp269_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t461; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::except_choice_s(RefAdaAST _t) { + RefAdaAST except_choice_s_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PIPE: + { + RefAdaAST __t464 = _t; + RefAdaAST tmp270_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PIPE); + _t = _t->getFirstChild(); + except_choice_s(_t); + _t = _retTree; + exception_choice(_t); + _t = _retTree; + _t = __t464; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case OTHERS: + { + exception_choice(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::exception_choice(RefAdaAST _t) { + RefAdaAST exception_choice_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case OTHERS: + { + RefAdaAST tmp271_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OTHERS); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::operator_call(RefAdaAST _t) { + RefAdaAST operator_call_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t473 = _t; + RefAdaAST tmp272_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OPERATOR_SYMBOL); + _t = _t->getFirstChild(); + value_s(_t); + _t = _retTree; + _t = __t473; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::relation(RefAdaAST _t) { + RefAdaAST relation_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IN: + { + RefAdaAST __t485 = _t; + RefAdaAST tmp273_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IN); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + range_or_mark(_t); + _t = _retTree; + _t = __t485; + _t = _t->getNextSibling(); + break; + } + case NOT_IN: + { + RefAdaAST __t486 = _t; + RefAdaAST tmp274_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NOT_IN); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + range_or_mark(_t); + _t = _retTree; + _t = __t486; + _t = _t->getNextSibling(); + break; + } + case EQ: + { + RefAdaAST __t487 = _t; + RefAdaAST tmp275_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EQ); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t487; + _t = _t->getNextSibling(); + break; + } + case NE: + { + RefAdaAST __t488 = _t; + RefAdaAST tmp276_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t488; + _t = _t->getNextSibling(); + break; + } + case LT_: + { + RefAdaAST __t489 = _t; + RefAdaAST tmp277_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LT_); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t489; + _t = _t->getNextSibling(); + break; + } + case LE: + { + RefAdaAST __t490 = _t; + RefAdaAST tmp278_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t490; + _t = _t->getNextSibling(); + break; + } + case GT: + { + RefAdaAST __t491 = _t; + RefAdaAST tmp279_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t491; + _t = _t->getNextSibling(); + break; + } + case GE: + { + RefAdaAST __t492 = _t; + RefAdaAST tmp280_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t492; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + simple_expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::range_or_mark(RefAdaAST _t) { + RefAdaAST range_or_mark_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case DOT: + case TIC: + { + subtype_mark(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::signed_term(RefAdaAST _t) { + RefAdaAST signed_term_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case UNARY_PLUS: + { + RefAdaAST __t499 = _t; + RefAdaAST tmp281_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),UNARY_PLUS); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + _t = __t499; + _t = _t->getNextSibling(); + break; + } + case UNARY_MINUS: + { + RefAdaAST __t500 = _t; + RefAdaAST tmp282_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),UNARY_MINUS); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + _t = __t500; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + { + term(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::term(RefAdaAST _t) { + RefAdaAST term_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case STAR: + { + RefAdaAST __t502 = _t; + RefAdaAST tmp283_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STAR); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t502; + _t = _t->getNextSibling(); + break; + } + case DIV: + { + RefAdaAST __t503 = _t; + RefAdaAST tmp284_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DIV); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t503; + _t = _t->getNextSibling(); + break; + } + case MOD: + { + RefAdaAST __t504 = _t; + RefAdaAST tmp285_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MOD); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t504; + _t = _t->getNextSibling(); + break; + } + case REM: + { + RefAdaAST __t505 = _t; + RefAdaAST tmp286_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),REM); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t505; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + { + factor(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::factor(RefAdaAST _t) { + RefAdaAST factor_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NOT: + { + RefAdaAST __t507 = _t; + RefAdaAST tmp287_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NOT); + _t = _t->getFirstChild(); + primary(_t); + _t = _retTree; + _t = __t507; + _t = _t->getNextSibling(); + break; + } + case ABS: + { + RefAdaAST __t508 = _t; + RefAdaAST tmp288_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABS); + _t = _t->getFirstChild(); + primary(_t); + _t = _retTree; + _t = __t508; + _t = _t->getNextSibling(); + break; + } + case EXPON: + { + RefAdaAST __t509 = _t; + RefAdaAST tmp289_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXPON); + _t = _t->getFirstChild(); + primary(_t); + _t = _retTree; + primary(_t); + _t = _retTree; + _t = __t509; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + { + primary(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::primary(RefAdaAST _t) { + RefAdaAST primary_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case INDEXED_COMPONENT: + { + name_or_qualified(_t); + _t = _retTree; + break; + } + case PARENTHESIZED_PRIMARY: + { + parenthesized_primary(_t); + _t = _retTree; + break; + } + case ALLOCATOR: + { + allocator(_t); + _t = _retTree; + break; + } + case NuLL: + { + RefAdaAST tmp290_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NuLL); + _t = _t->getNextSibling(); + break; + } + case NUMERIC_LIT: + { + RefAdaAST tmp291_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUMERIC_LIT); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp292_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + case CHAR_STRING: + { + RefAdaAST tmp293_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHAR_STRING); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + operator_call(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::name_or_qualified(RefAdaAST _t) { + RefAdaAST name_or_qualified_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + RefAdaAST tmp294_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + RefAdaAST __t513 = _t; + RefAdaAST tmp295_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ALL: + { + RefAdaAST tmp296_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ALL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + RefAdaAST tmp297_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + RefAdaAST tmp298_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + RefAdaAST tmp299_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t513; + _t = _t->getNextSibling(); + break; + } + case INDEXED_COMPONENT: + { + RefAdaAST __t515 = _t; + RefAdaAST tmp300_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INDEXED_COMPONENT); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + value_s(_t); + _t = _retTree; + _t = __t515; + _t = _t->getNextSibling(); + break; + } + case TIC: + { + RefAdaAST __t516 = _t; + RefAdaAST tmp301_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TIC); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + { + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PARENTHESIZED_PRIMARY: + { + parenthesized_primary(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case RANGE: + case DIGITS: + case DELTA: + case ACCESS: + { + attribute_id(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t516; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::allocator(RefAdaAST _t) { + RefAdaAST allocator_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t519 = _t; + RefAdaAST tmp302_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ALLOCATOR); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + _t = __t519; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::subprogram_body(RefAdaAST _t) { + RefAdaAST subprogram_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::task_body(RefAdaAST _t) { + RefAdaAST task_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t525 = _t; + RefAdaAST tmp303_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TASK_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t525; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::protected_body(RefAdaAST _t) { + RefAdaAST protected_body_AST_in = (_t == RefAdaAST(ASTNULL)) ? RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefAdaAST __t527 = _t; + RefAdaAST tmp304_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROTECTED_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + prot_op_bodies_opt(_t); + _t = _retTree; + _t = __t527; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefAdaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaStoreWalker::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& ) +{ +} +const char* AdaStoreWalker::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "\"pragma\"", + "IDENTIFIER", + "SEMI", + "LPAREN", + "COMMA", + "RPAREN", + "RIGHT_SHAFT", + "\"with\"", + "DOT", + "\"use\"", + "\"type\"", + "TIC", + "\"range\"", + "\"digits\"", + "\"delta\"", + "\"access\"", + "\"private\"", + "\"package\"", + "\"body\"", + "\"is\"", + "\"procedure\"", + "\"function\"", + "\"new\"", + "\"others\"", + "PIPE", + "DOT_DOT", + "\"all\"", + "COLON", + "\"in\"", + "\"out\"", + "\"renames\"", + "CHARACTER_LITERAL", + "CHAR_STRING", + "\"null\"", + "\"record\"", + "\"separate\"", + "\"abstract\"", + "\"return\"", + "\"task\"", + "\"protected\"", + "BOX", + "ASSIGN", + "\"entry\"", + "\"for\"", + "\"end\"", + "\"at\"", + "\"mod\"", + "\"subtype\"", + "\"exception\"", + "\"constant\"", + "\"array\"", + "\"of\"", + "\"aliased\"", + "\"case\"", + "\"when\"", + "\"tagged\"", + "\"limited\"", + "\"generic\"", + "\"begin\"", + "LT_LT", + "GT_GT", + "\"if\"", + "\"then\"", + "\"elsif\"", + "\"else\"", + "\"loop\"", + "\"while\"", + "\"reverse\"", + "\"declare\"", + "\"exit\"", + "\"goto\"", + "\"accept\"", + "\"do\"", + "\"delay\"", + "\"until\"", + "\"select\"", + "\"abort\"", + "\"or\"", + "\"terminate\"", + "\"raise\"", + "\"requeue\"", + "\"and\"", + "\"xor\"", + "\"not\"", + "EQ", + "NE", + "LT_", + "LE", + "GT", + "GE", + "PLUS", + "MINUS", + "CONCAT", + "STAR", + "DIV", + "\"rem\"", + "\"abs\"", + "EXPON", + "NUMERIC_LIT", + "ABORTABLE_PART", + "ABORT_STATEMENT", + "ACCEPT_ALTERNATIVE", + "ACCEPT_STATEMENT", + "ALLOCATOR", + "ASSIGNMENT_STATEMENT", + "ASYNCHRONOUS_SELECT", + "ATTRIBUTE_DEFINITION_CLAUSE", + "AT_CLAUSE", + "BLOCK_STATEMENT", + "CASE_STATEMENT", + "CASE_STATEMENT_ALTERNATIVE", + "CODE_STATEMENT", + "COMPONENT_DECLARATION", + "CONDITIONAL_ENTRY_CALL", + "CONTEXT_CLAUSE", + "DECLARATIVE_PART", + "DEFINING_IDENTIFIER_LIST", + "DELAY_ALTERNATIVE", + "DELAY_STATEMENT", + "DELTA_CONSTRAINT", + "DIGITS_CONSTRAINT", + "DISCRIMINANT_ASSOCIATION", + "DISCRIMINANT_CONSTRAINT", + "DISCRIMINANT_SPECIFICATION", + "ENTRY_BODY", + "ENTRY_CALL_ALTERNATIVE", + "ENTRY_CALL_STATEMENT", + "ENTRY_DECLARATION", + "ENTRY_INDEX_SPECIFICATION", + "ENUMERATION_REPESENTATION_CLAUSE", + "EXCEPTION_DECLARATION", + "EXCEPTION_HANDLER", + "EXCEPTION_RENAMING_DECLARATION", + "EXIT_STATEMENT", + "FORMAL_PACKAGE_DECLARATION", + "GENERIC_FORMAL_PART", + "GENERIC_PACKAGE_DECLARATION", + "GOTO_STATEMENT", + "HANDLED_SEQUENCE_OF_STATEMENTS", + "HANDLED_STMTS_OPT", + "IF_STATEMENT", + "INCOMPLETE_TYPE_DECLARATION", + "INDEXED_COMPONENT", + "INDEX_CONSTRAINT", + "LIBRARY_ITEM", + "LOOP_STATEMENT", + "NAME", + "NULL_STATEMENT", + "NUMBER_DECLARATION", + "OBJECT_DECLARATION", + "OBJECT_RENAMING_DECLARATION", + "OPERATOR_SYMBOL", + "PACKAGE_BODY", + "PACKAGE_BODY_STUB", + "PACKAGE_RENAMING_DECLARATION", + "PACKAGE_SPECIFICATION", + "PARAMETER_SPECIFICATION", + "PRIVATE_EXTENSION_DECLARATION", + "PRIVATE_TYPE_DECLARATION", + "PROTECTED_BODY", + "PROTECTED_BODY_STUB", + "PROTECTED_TYPE_DECLARATION", + "RAISE_STATEMENT", + "RANGE_ATTRIBUTE_REFERENCE", + "RECORD_REPRESENTATION_CLAUSE", + "REQUEUE_STATEMENT", + "RETURN_STATEMENT", + "SELECTIVE_ACCEPT", + "SEQUENCE_OF_STATEMENTS", + "SINGLE_PROTECTED_DECLARATION", + "SINGLE_TASK_DECLARATION", + "STATEMENT", + "SUBTYPE_DECLARATION", + "SUBTYPE_INDICATION", + "SUBTYPE_MARK", + "SUBUNIT", + "TASK_BODY", + "TASK_BODY_STUB", + "TASK_TYPE_DECLARATION", + "TERMINATE_ALTERNATIVE", + "TIMED_ENTRY_CALL", + "TRIGGERING_ALTERNATIVE", + "USE_CLAUSE", + "USE_TYPE_CLAUSE", + "VARIANT", + "VARIANT_PART", + "WITH_CLAUSE", + "ABSTRACT_FUNCTION_DECLARATION", + "ABSTRACT_PROCEDURE_DECLARATION", + "ACCESS_TO_FUNCTION_DECLARATION", + "ACCESS_TO_OBJECT_DECLARATION", + "ACCESS_TO_PROCEDURE_DECLARATION", + "ARRAY_OBJECT_DECLARATION", + "ARRAY_TYPE_DECLARATION", + "AND_THEN", + "BASIC_DECLARATIVE_ITEMS_OPT", + "BLOCK_BODY", + "BLOCK_BODY_OPT", + "CALL_STATEMENT", + "COMPONENT_CLAUSES_OPT", + "COMPONENT_ITEMS", + "COND_CLAUSE", + "DECIMAL_FIXED_POINT_DECLARATION", + "DECLARE_OPT", + "DERIVED_RECORD_EXTENSION", + "DISCRETE_SUBTYPE_DEF_OPT", + "DISCRIMINANT_SPECIFICATIONS", + "DISCRIM_PART_OPT", + "ELSE_OPT", + "ELSIFS_OPT", + "END_ID_OPT", + "ENTRY_INDEX_OPT", + "ENUMERATION_TYPE_DECLARATION", + "EXCEPT_HANDLER_PART_OPT", + "EXTENSION_OPT", + "FLOATING_POINT_DECLARATION", + "FORMAL_DECIMAL_FIXED_POINT_DECLARATION", + "FORMAL_DISCRETE_TYPE_DECLARATION", + "FORMAL_FLOATING_POINT_DECLARATION", + "FORMAL_FUNCTION_DECLARATION", + "FORMAL_MODULAR_TYPE_DECLARATION", + "FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION", + "FORMAL_ORDINARY_FIXED_POINT_DECLARATION", + "FORMAL_PART_OPT", + "FORMAL_PRIVATE_EXTENSION_DECLARATION", + "FORMAL_PRIVATE_TYPE_DECLARATION", + "FORMAL_PROCEDURE_DECLARATION", + "FORMAL_SIGNED_INTEGER_TYPE_DECLARATION", + "FUNCTION_BODY", + "FUNCTION_BODY_STUB", + "FUNCTION_DECLARATION", + "FUNCTION_RENAMING_DECLARATION", + "GENERIC_FUNCTION_DECLARATION", + "GENERIC_FUNCTION_INSTANTIATION", + "GENERIC_FUNCTION_RENAMING", + "GENERIC_PACKAGE_INSTANTIATION", + "GENERIC_PACKAGE_RENAMING", + "GENERIC_PROCEDURE_DECLARATION", + "GENERIC_PROCEDURE_INSTANTIATION", + "GENERIC_PROCEDURE_RENAMING", + "GUARD_OPT", + "IDENTIFIER_COLON_OPT", + "ID_OPT", + "INIT_OPT", + "ITERATION_SCHEME_OPT", + "LABEL_OPT", + "MARK_WITH_CONSTRAINT", + "MODIFIERS", + "MODULAR_TYPE_DECLARATION", + "MOD_CLAUSE_OPT", + "NOT_IN", + "ORDINARY_DERIVED_TYPE_DECLARATION", + "ORDINARY_FIXED_POINT_DECLARATION", + "OR_ELSE", + "OR_SELECT_OPT", + "PARENTHESIZED_PRIMARY", + "PRIVATE_DECLARATIVE_ITEMS_OPT", + "PRIVATE_TASK_ITEMS_OPT", + "PROCEDURE_BODY", + "PROCEDURE_BODY_STUB", + "PROCEDURE_DECLARATION", + "PROCEDURE_RENAMING_DECLARATION", + "PROT_MEMBER_DECLARATIONS", + "PROT_OP_BODIES_OPT", + "PROT_OP_DECLARATIONS", + "PROT_PRIVATE_OPT", + "RANGED_EXPRS", + "RANGE_CONSTRAINT", + "RECORD_TYPE_DECLARATION", + "SELECTOR_NAMES_OPT", + "SIGNED_INTEGER_TYPE_DECLARATION", + "TASK_ITEMS_OPT", + "UNARY_MINUS", + "UNARY_PLUS", + "VALUE", + "VALUES", + "VARIANTS", + "COMMENT_INTRO", + "OX", + "TIC_OR_CHARACTER_LITERAL", + "DIGIT", + "EXPONENT", + "EXTENDED_DIGIT", + "BASED_INTEGER", + "WS_", + "COMMENT", + "CHARACTER_STRING", + 0 +}; + +const unsigned long AdaStoreWalker::_tokenSet_0_data_[] = { 37920UL, 262201UL, 4293001216UL, 2175UL, 134479872UL, 0UL, 64UL, 1073741824UL, 3145738UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER RIGHT_SHAFT DOT TIC "in" CHARACTER_LITERAL CHAR_STRING "null" +// "mod" "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS MINUS CONCAT STAR +// DIV "rem" "abs" EXPON NUMERIC_LIT ALLOCATOR INDEXED_COMPONENT OPERATOR_SYMBOL +// AND_THEN NOT_IN OR_ELSE PARENTHESIZED_PRIMARY UNARY_MINUS UNARY_PLUS +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaStoreWalker::_tokenSet_0(_tokenSet_0_data_,20); +const unsigned long AdaStoreWalker::_tokenSet_1_data_[] = { 0UL, 0UL, 0UL, 49152UL, 3338801504UL, 2353094950UL, 151076927UL, 2416967168UL, 328577UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// ATTRIBUTE_DEFINITION_CLAUSE AT_CLAUSE ENUMERATION_REPESENTATION_CLAUSE +// EXCEPTION_DECLARATION EXCEPTION_RENAMING_DECLARATION GENERIC_PACKAGE_DECLARATION +// INCOMPLETE_TYPE_DECLARATION NUMBER_DECLARATION OBJECT_DECLARATION OBJECT_RENAMING_DECLARATION +// PACKAGE_RENAMING_DECLARATION PACKAGE_SPECIFICATION PRIVATE_EXTENSION_DECLARATION +// PRIVATE_TYPE_DECLARATION PROTECTED_TYPE_DECLARATION RECORD_REPRESENTATION_CLAUSE +// SINGLE_PROTECTED_DECLARATION SINGLE_TASK_DECLARATION SUBTYPE_DECLARATION +// TASK_TYPE_DECLARATION USE_CLAUSE USE_TYPE_CLAUSE ABSTRACT_FUNCTION_DECLARATION +// ABSTRACT_PROCEDURE_DECLARATION ACCESS_TO_FUNCTION_DECLARATION ACCESS_TO_OBJECT_DECLARATION +// ACCESS_TO_PROCEDURE_DECLARATION ARRAY_OBJECT_DECLARATION ARRAY_TYPE_DECLARATION +// DECIMAL_FIXED_POINT_DECLARATION DERIVED_RECORD_EXTENSION ENUMERATION_TYPE_DECLARATION +// FLOATING_POINT_DECLARATION FUNCTION_BODY_STUB FUNCTION_DECLARATION FUNCTION_RENAMING_DECLARATION +// GENERIC_FUNCTION_DECLARATION GENERIC_FUNCTION_INSTANTIATION GENERIC_FUNCTION_RENAMING +// GENERIC_PACKAGE_INSTANTIATION GENERIC_PACKAGE_RENAMING GENERIC_PROCEDURE_DECLARATION +// GENERIC_PROCEDURE_INSTANTIATION GENERIC_PROCEDURE_RENAMING MODULAR_TYPE_DECLARATION +// ORDINARY_DERIVED_TYPE_DECLARATION ORDINARY_FIXED_POINT_DECLARATION PROCEDURE_BODY_STUB +// PROCEDURE_DECLARATION PROCEDURE_RENAMING_DECLARATION RECORD_TYPE_DECLARATION +// SIGNED_INTEGER_TYPE_DECLARATION +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaStoreWalker::_tokenSet_1(_tokenSet_1_data_,20); +const unsigned long AdaStoreWalker::_tokenSet_2_data_[] = { 939627552UL, 262201UL, 4293001216UL, 2175UL, 134479872UL, 0UL, 64UL, 1073741824UL, 3145738UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER RIGHT_SHAFT DOT TIC "range" "others" PIPE DOT_DOT "in" CHARACTER_LITERAL +// CHAR_STRING "null" "mod" "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS +// MINUS CONCAT STAR DIV "rem" "abs" EXPON NUMERIC_LIT ALLOCATOR INDEXED_COMPONENT +// OPERATOR_SYMBOL AND_THEN NOT_IN OR_ELSE PARENTHESIZED_PRIMARY UNARY_MINUS +// UNARY_PLUS +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaStoreWalker::_tokenSet_2(_tokenSet_2_data_,20); +const unsigned long AdaStoreWalker::_tokenSet_3_data_[] = { 16UL, 0UL, 0UL, 49152UL, 40UL, 256UL, 0UL, 1024UL, 256UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "pragma" ATTRIBUTE_DEFINITION_CLAUSE AT_CLAUSE ENTRY_DECLARATION ENUMERATION_REPESENTATION_CLAUSE +// RECORD_REPRESENTATION_CLAUSE FUNCTION_DECLARATION PROCEDURE_DECLARATION +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaStoreWalker::_tokenSet_3(_tokenSet_3_data_,20); +const unsigned long AdaStoreWalker::_tokenSet_4_data_[] = { 36896UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER DOT TIC INDEXED_COMPONENT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaStoreWalker::_tokenSet_4(_tokenSet_4_data_,12); + + diff --git a/languages/ada/AdaStoreWalker.hpp b/languages/ada/AdaStoreWalker.hpp new file mode 100644 index 00000000..6f108ff6 --- /dev/null +++ b/languages/ada/AdaStoreWalker.hpp @@ -0,0 +1,350 @@ +#ifndef INC_AdaStoreWalker_hpp_ +#define INC_AdaStoreWalker_hpp_ + +#line 1 "expandedada.store.g" + +#include +#include +#include + +#include +#include "AdaAST.hpp" +#include "ada_utils.hpp" + +#line 15 "AdaStoreWalker.hpp" +#include +#include "AdaStoreWalkerTokenTypes.hpp" +/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalker.hpp"$ */ +#include + +#line 10 "expandedada.store.g" + +#include +#include + +#line 26 "AdaStoreWalker.hpp" +class CUSTOM_API AdaStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public AdaStoreWalkerTokenTypes +{ +#line 25 "expandedada.store.g" + +private: + QString m_fileName; + QValueList m_scopeStack; + CodeModel* m_model; + QValueList m_imports; + NamespaceDom m_currentContainer; + int m_currentAccess; + bool m_addToStore; /* auxiliary variable: for the moment, this is `true' + only when we are in specs, not bodies. */ + bool m_isSubprogram; // auxiliary to def_id() + FileDom m_file; + +public: + void setCodeModel (CodeModel* model) { m_model = model; } + CodeModel* codeModel () { return m_model; } + const CodeModel* codeModel () const { return m_model; } + + QString fileName () const { return m_fileName; } + void setFileName (const QString& fileName) { m_fileName = fileName; } + + void init () { + m_scopeStack.clear (); + m_imports.clear (); + m_currentContainer = m_model->globalNamespace (); + m_scopeStack.append (m_currentContainer); + m_currentAccess = CodeModelItem::Public; + m_addToStore = false; + m_isSubprogram = false; + if (m_model->hasFile(m_fileName)) + m_model->removeFile (m_model->fileByName(m_fileName)); + m_file = m_model->create(); + m_file->setName(m_fileName); + m_model->addFile(m_file); + } + + void wipeout () { m_model->wipeout (); } +// void out () { m_store->out (); } + void removeWithReferences (const QString& fileName) { + m_model->removeFile (m_model->fileByName(fileName)); + } + NamespaceDom insertScopeContainer + (NamespaceDom scope, const QStringList & scopes ) { + QStringList::ConstIterator it = scopes.begin(); + QString prefix( *it ); + NamespaceDom ns = scope->namespaceByName( prefix ); +// kdDebug() << "insertScopeContainer begin with prefix " << prefix << endl; + if (!ns.data()) { +// kdDebug() << "insertScopeContainer: ns is empty" << endl; + ns = m_model->create(); +// kdDebug() << "insertScopeContainer: ns created" << endl; + ns->setName( prefix ); +// kdDebug() << "insertScopeContainer: ns name set" << endl; + scope->addNamespace( ns ); +// kdDebug() << "insertScopeContainer: ns added to a scope" << endl; + + if (scope == m_model->globalNamespace()) + m_file->addNamespace( ns ); + } +// kdDebug() << "insertScopeContainer: while" << endl; + while ( ++it != scopes.end() ) { + QString nameSegment( *it ); + prefix += "." + nameSegment; +// kdDebug() << "insertScopeContainer: while prefix = " << prefix << endl; + NamespaceDom inner = scope->namespaceByName( prefix ); + if (!inner.data() ) { +// kdDebug() << "insertScopeContainer: inner is empty " << endl; + inner = m_model->create(); +// kdDebug() << "insertScopeContainer: inner created " << endl; + inner->setName( nameSegment ); + ns->addNamespace( inner ); +// kdDebug() << "insertScopeContainer: inner added " << endl; + } + ns = inner; + } + return ns; + } + NamespaceDom defineScope( RefAdaAST namenode ) { + QStringList scopes( qnamelist( namenode ) ); +// kdDebug() << "defineScope: " << scopes.join(" ") << endl; + NamespaceDom psc = insertScopeContainer( m_currentContainer, scopes ); +// kdDebug() << "defineScope psc created" << endl; + psc->setStartPosition(namenode->getLine(), namenode->getColumn()); +// kdDebug() << "defineScope start position set" << endl; + psc->setFileName(m_fileName); +// kdDebug() << "defineScope file name set" << endl; + // psc->setEndPosition (endLine, 0); +// kdDebug() << "defineScope return" << endl; + return psc; + } +#line 30 "AdaStoreWalker.hpp" +public: + AdaStoreWalker(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return AdaStoreWalker::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return AdaStoreWalker::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return AdaStoreWalker::tokenNames; + } + public: void compilation_unit(RefAdaAST _t); + public: void context_items_opt(RefAdaAST _t); + public: void library_item(RefAdaAST _t); + public: void subunit(RefAdaAST _t); + public: void pragma(RefAdaAST _t); + public: void with_clause(RefAdaAST _t); + public: void compound_name(RefAdaAST _t); + public: void use_clause(RefAdaAST _t); + public: void subtype_mark(RefAdaAST _t); + public: void lib_subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t); + public: void def_id(RefAdaAST _t); + public: void pkg_body_part(RefAdaAST _t); + public: void generic_inst(RefAdaAST _t); + public: void pkg_spec_part(RefAdaAST _t); + public: void renames(RefAdaAST _t); + public: void generic_decl(RefAdaAST _t); + public: void subprog_def_id(RefAdaAST _t); + public: void subprog_decl(RefAdaAST _t); + public: void formal_part_opt(RefAdaAST _t); + public: void def_designator(RefAdaAST _t); + public: void function_tail(RefAdaAST _t); + public: void definable_operator_symbol(RefAdaAST _t); + public: void spec_decl_part(RefAdaAST _t); + public: void basic_declarative_items_opt(RefAdaAST _t); + public: void private_declarative_items_opt(RefAdaAST _t); + public: void end_id_opt(RefAdaAST _t); + public: void basic_decl_item(RefAdaAST _t); + public: void generic_formal_part_opt(RefAdaAST _t); + public: void procedure_body(RefAdaAST _t); + public: void function_body(RefAdaAST _t); + public: void subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t); + public: void subprog_decl_or_body(RefAdaAST _t); + public: void package_body(RefAdaAST _t); + public: void pragma_arg(RefAdaAST _t); + public: void expression(RefAdaAST _t); + public: void attribute_id(RefAdaAST _t); + public: void modifiers(RefAdaAST _t); + public: void id_opt(RefAdaAST _t); + public: void value_s(RefAdaAST _t); + public: void value(RefAdaAST _t); + public: void ranged_expr_s(RefAdaAST _t); + public: void ranged_expr(RefAdaAST _t); + public: void simple_expression(RefAdaAST _t); + public: void range(RefAdaAST _t); + public: void range_constraint(RefAdaAST _t); + public: void range_dots(RefAdaAST _t); + public: void range_attrib_ref(RefAdaAST _t); + public: void prefix(RefAdaAST _t); + public: void parameter_specification(RefAdaAST _t); + public: void defining_identifier_list(RefAdaAST _t); + public: void init_opt(RefAdaAST _t); + public: void name(RefAdaAST _t); + public: void parenthesized_primary(RefAdaAST _t); + public: void extension_opt(RefAdaAST _t); + public: void task_type_or_single_decl(RefAdaAST _t); + public: void prot_type_or_single_decl(RefAdaAST _t); + public: void decl_common(RefAdaAST _t); + public: void discrim_part_opt(RefAdaAST _t); + public: void task_definition_opt(RefAdaAST _t); + public: void task_items_opt(RefAdaAST _t); + public: void private_task_items_opt(RefAdaAST _t); + public: void discriminant_specifications(RefAdaAST _t); + public: void discriminant_specification(RefAdaAST _t); + public: void entrydecls_repspecs_opt(RefAdaAST _t); + public: void entry_declaration(RefAdaAST _t); + public: void rep_spec(RefAdaAST _t); + public: void discrete_subtype_def_opt(RefAdaAST _t); + public: void discrete_subtype_definition(RefAdaAST _t); + public: void subtype_ind(RefAdaAST _t); + public: void align_opt(RefAdaAST _t); + public: void comp_loc_s(RefAdaAST _t); + public: void local_enum_name(RefAdaAST _t); + public: void enumeration_aggregate(RefAdaAST _t); + public: void protected_definition(RefAdaAST _t); + public: void prot_private_opt(RefAdaAST _t); + public: void prot_member_decl_s(RefAdaAST _t); + public: void prot_op_decl_s(RefAdaAST _t); + public: void prot_op_decl(RefAdaAST _t); + public: void comp_decl(RefAdaAST _t); + public: void component_subtype_def(RefAdaAST _t); + public: void enum_id_s(RefAdaAST _t); + public: void range_constraint_opt(RefAdaAST _t); + public: void array_type_declaration(RefAdaAST _t); + public: void access_type_declaration(RefAdaAST _t); + public: void id_and_discrim(RefAdaAST _t); + public: void record_definition(RefAdaAST _t); + public: void array_type_definition(RefAdaAST _t); + public: void enumeration_literal_specification(RefAdaAST _t); + public: void index_or_discrete_range_s(RefAdaAST _t); + public: void index_or_discrete_range(RefAdaAST _t); + public: void constraint_opt(RefAdaAST _t); + public: void digits_constraint(RefAdaAST _t); + public: void delta_constraint(RefAdaAST _t); + public: void index_constraint(RefAdaAST _t); + public: void discriminant_constraint(RefAdaAST _t); + public: void discrete_range(RefAdaAST _t); + public: void discriminant_association(RefAdaAST _t); + public: void selector_names_opt(RefAdaAST _t); + public: void selector_name(RefAdaAST _t); + public: void component_list(RefAdaAST _t); + public: void component_items(RefAdaAST _t); + public: void variant_part(RefAdaAST _t); + public: void discriminant_direct_name(RefAdaAST _t); + public: void variant_s(RefAdaAST _t); + public: void variant(RefAdaAST _t); + public: void choice_s(RefAdaAST _t); + public: void choice(RefAdaAST _t); + public: void discrete_with_range(RefAdaAST _t); + public: void mark_with_constraint(RefAdaAST _t); + public: void generic_formal_parameter(RefAdaAST _t); + public: void formal_array_type_declaration(RefAdaAST _t); + public: void formal_access_type_declaration(RefAdaAST _t); + public: void id_part(RefAdaAST _t); + public: void subprogram_default_opt(RefAdaAST _t); + public: void formal_package_actual_part_opt(RefAdaAST _t); + public: void body_part(RefAdaAST _t); + public: void declarative_part(RefAdaAST _t); + public: void block_body(RefAdaAST _t); + public: void declarative_item(RefAdaAST _t); + public: void prot_op_bodies_opt(RefAdaAST _t); + public: void block_body_opt(RefAdaAST _t); + public: void handled_stmt_s(RefAdaAST _t); + public: void entry_body(RefAdaAST _t); + public: void statements(RefAdaAST _t); + public: void except_handler_part_opt(RefAdaAST _t); + public: void handled_stmts_opt(RefAdaAST _t); + public: void statement(RefAdaAST _t); + public: void def_label_opt(RefAdaAST _t); + public: void null_stmt(RefAdaAST _t); + public: void exit_stmt(RefAdaAST _t); + public: void return_stmt(RefAdaAST _t); + public: void goto_stmt(RefAdaAST _t); + public: void delay_stmt(RefAdaAST _t); + public: void abort_stmt(RefAdaAST _t); + public: void raise_stmt(RefAdaAST _t); + public: void requeue_stmt(RefAdaAST _t); + public: void accept_stmt(RefAdaAST _t); + public: void select_stmt(RefAdaAST _t); + public: void if_stmt(RefAdaAST _t); + public: void case_stmt(RefAdaAST _t); + public: void loop_stmt(RefAdaAST _t); + public: void block(RefAdaAST _t); + public: void call_or_assignment(RefAdaAST _t); + public: void cond_clause(RefAdaAST _t); + public: void elsifs_opt(RefAdaAST _t); + public: void else_opt(RefAdaAST _t); + public: void condition(RefAdaAST _t); + public: void alternative_s(RefAdaAST _t); + public: void case_statement_alternative(RefAdaAST _t); + public: void iteration_scheme_opt(RefAdaAST _t); + public: void declare_opt(RefAdaAST _t); + public: void label_name(RefAdaAST _t); + public: void entry_body_formal_part(RefAdaAST _t); + public: void entry_barrier(RefAdaAST _t); + public: void entry_index_spec_opt(RefAdaAST _t); + public: void entry_call_stmt(RefAdaAST _t); + public: void entry_index_opt(RefAdaAST _t); + public: void triggering_alternative(RefAdaAST _t); + public: void abortable_part(RefAdaAST _t); + public: void selective_accept(RefAdaAST _t); + public: void entry_call_alternative(RefAdaAST _t); + public: void delay_alternative(RefAdaAST _t); + public: void stmts_opt(RefAdaAST _t); + public: void guard_opt(RefAdaAST _t); + public: void select_alternative(RefAdaAST _t); + public: void or_select_opt(RefAdaAST _t); + public: void accept_alternative(RefAdaAST _t); + public: void exception_handler(RefAdaAST _t); + public: void identifier_colon_opt(RefAdaAST _t); + public: void except_choice_s(RefAdaAST _t); + public: void exception_choice(RefAdaAST _t); + public: void operator_call(RefAdaAST _t); + public: void relation(RefAdaAST _t); + public: void range_or_mark(RefAdaAST _t); + public: void signed_term(RefAdaAST _t); + public: void term(RefAdaAST _t); + public: void factor(RefAdaAST _t); + public: void primary(RefAdaAST _t); + public: void name_or_qualified(RefAdaAST _t); + public: void allocator(RefAdaAST _t); + public: void subprogram_body(RefAdaAST _t); + public: void task_body(RefAdaAST _t); + public: void protected_body(RefAdaAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefAdaAST returnAST; + RefAdaAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 291; +#else + enum { + NUM_TOKENS = 291 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_AdaStoreWalker_hpp_*/ diff --git a/languages/ada/AdaStoreWalkerTokenTypes.hpp b/languages/ada/AdaStoreWalkerTokenTypes.hpp new file mode 100644 index 00000000..daaa4b21 --- /dev/null +++ b/languages/ada/AdaStoreWalkerTokenTypes.hpp @@ -0,0 +1,307 @@ +#ifndef INC_AdaStoreWalkerTokenTypes_hpp_ +#define INC_AdaStoreWalkerTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalkerTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API AdaStoreWalkerTokenTypes { +#endif + enum { + EOF_ = 1, + PRAGMA = 4, + IDENTIFIER = 5, + SEMI = 6, + LPAREN = 7, + COMMA = 8, + RPAREN = 9, + RIGHT_SHAFT = 10, + WITH = 11, + DOT = 12, + USE = 13, + TYPE = 14, + TIC = 15, + RANGE = 16, + DIGITS = 17, + DELTA = 18, + ACCESS = 19, + PRIVATE = 20, + PACKAGE = 21, + BODY = 22, + IS = 23, + PROCEDURE = 24, + FUNCTION = 25, + NEW = 26, + OTHERS = 27, + PIPE = 28, + DOT_DOT = 29, + ALL = 30, + COLON = 31, + IN = 32, + OUT = 33, + RENAMES = 34, + CHARACTER_LITERAL = 35, + CHAR_STRING = 36, + NuLL = 37, + RECORD = 38, + SEPARATE = 39, + ABSTRACT = 40, + RETURN = 41, + TASK = 42, + PROTECTED = 43, + BOX = 44, + ASSIGN = 45, + ENTRY = 46, + FOR = 47, + END = 48, + AT = 49, + MOD = 50, + SUBTYPE = 51, + EXCEPTION = 52, + CONSTANT = 53, + ARRAY = 54, + OF = 55, + ALIASED = 56, + CASE = 57, + WHEN = 58, + TAGGED = 59, + LIMITED = 60, + GENERIC = 61, + BEGIN = 62, + LT_LT = 63, + GT_GT = 64, + IF = 65, + THEN = 66, + ELSIF = 67, + ELSE = 68, + LOOP = 69, + WHILE = 70, + REVERSE = 71, + DECLARE = 72, + EXIT = 73, + GOTO = 74, + ACCEPT = 75, + DO = 76, + DELAY = 77, + UNTIL = 78, + SELECT = 79, + ABORT = 80, + OR = 81, + TERMINATE = 82, + RAISE = 83, + REQUEUE = 84, + AND = 85, + XOR = 86, + NOT = 87, + EQ = 88, + NE = 89, + LT_ = 90, + LE = 91, + GT = 92, + GE = 93, + PLUS = 94, + MINUS = 95, + CONCAT = 96, + STAR = 97, + DIV = 98, + REM = 99, + ABS = 100, + EXPON = 101, + NUMERIC_LIT = 102, + ABORTABLE_PART = 103, + ABORT_STATEMENT = 104, + ACCEPT_ALTERNATIVE = 105, + ACCEPT_STATEMENT = 106, + ALLOCATOR = 107, + ASSIGNMENT_STATEMENT = 108, + ASYNCHRONOUS_SELECT = 109, + ATTRIBUTE_DEFINITION_CLAUSE = 110, + AT_CLAUSE = 111, + BLOCK_STATEMENT = 112, + CASE_STATEMENT = 113, + CASE_STATEMENT_ALTERNATIVE = 114, + CODE_STATEMENT = 115, + COMPONENT_DECLARATION = 116, + CONDITIONAL_ENTRY_CALL = 117, + CONTEXT_CLAUSE = 118, + DECLARATIVE_PART = 119, + DEFINING_IDENTIFIER_LIST = 120, + DELAY_ALTERNATIVE = 121, + DELAY_STATEMENT = 122, + DELTA_CONSTRAINT = 123, + DIGITS_CONSTRAINT = 124, + DISCRIMINANT_ASSOCIATION = 125, + DISCRIMINANT_CONSTRAINT = 126, + DISCRIMINANT_SPECIFICATION = 127, + ENTRY_BODY = 128, + ENTRY_CALL_ALTERNATIVE = 129, + ENTRY_CALL_STATEMENT = 130, + ENTRY_DECLARATION = 131, + ENTRY_INDEX_SPECIFICATION = 132, + ENUMERATION_REPESENTATION_CLAUSE = 133, + EXCEPTION_DECLARATION = 134, + EXCEPTION_HANDLER = 135, + EXCEPTION_RENAMING_DECLARATION = 136, + EXIT_STATEMENT = 137, + FORMAL_PACKAGE_DECLARATION = 138, + GENERIC_FORMAL_PART = 139, + GENERIC_PACKAGE_DECLARATION = 140, + GOTO_STATEMENT = 141, + HANDLED_SEQUENCE_OF_STATEMENTS = 142, + HANDLED_STMTS_OPT = 143, + IF_STATEMENT = 144, + INCOMPLETE_TYPE_DECLARATION = 145, + INDEXED_COMPONENT = 146, + INDEX_CONSTRAINT = 147, + LIBRARY_ITEM = 148, + LOOP_STATEMENT = 149, + NAME = 150, + NULL_STATEMENT = 151, + NUMBER_DECLARATION = 152, + OBJECT_DECLARATION = 153, + OBJECT_RENAMING_DECLARATION = 154, + OPERATOR_SYMBOL = 155, + PACKAGE_BODY = 156, + PACKAGE_BODY_STUB = 157, + PACKAGE_RENAMING_DECLARATION = 158, + PACKAGE_SPECIFICATION = 159, + PARAMETER_SPECIFICATION = 160, + PRIVATE_EXTENSION_DECLARATION = 161, + PRIVATE_TYPE_DECLARATION = 162, + PROTECTED_BODY = 163, + PROTECTED_BODY_STUB = 164, + PROTECTED_TYPE_DECLARATION = 165, + RAISE_STATEMENT = 166, + RANGE_ATTRIBUTE_REFERENCE = 167, + RECORD_REPRESENTATION_CLAUSE = 168, + REQUEUE_STATEMENT = 169, + RETURN_STATEMENT = 170, + SELECTIVE_ACCEPT = 171, + SEQUENCE_OF_STATEMENTS = 172, + SINGLE_PROTECTED_DECLARATION = 173, + SINGLE_TASK_DECLARATION = 174, + STATEMENT = 175, + SUBTYPE_DECLARATION = 176, + SUBTYPE_INDICATION = 177, + SUBTYPE_MARK = 178, + SUBUNIT = 179, + TASK_BODY = 180, + TASK_BODY_STUB = 181, + TASK_TYPE_DECLARATION = 182, + TERMINATE_ALTERNATIVE = 183, + TIMED_ENTRY_CALL = 184, + TRIGGERING_ALTERNATIVE = 185, + USE_CLAUSE = 186, + USE_TYPE_CLAUSE = 187, + VARIANT = 188, + VARIANT_PART = 189, + WITH_CLAUSE = 190, + ABSTRACT_FUNCTION_DECLARATION = 191, + ABSTRACT_PROCEDURE_DECLARATION = 192, + ACCESS_TO_FUNCTION_DECLARATION = 193, + ACCESS_TO_OBJECT_DECLARATION = 194, + ACCESS_TO_PROCEDURE_DECLARATION = 195, + ARRAY_OBJECT_DECLARATION = 196, + ARRAY_TYPE_DECLARATION = 197, + AND_THEN = 198, + BASIC_DECLARATIVE_ITEMS_OPT = 199, + BLOCK_BODY = 200, + BLOCK_BODY_OPT = 201, + CALL_STATEMENT = 202, + COMPONENT_CLAUSES_OPT = 203, + COMPONENT_ITEMS = 204, + COND_CLAUSE = 205, + DECIMAL_FIXED_POINT_DECLARATION = 206, + DECLARE_OPT = 207, + DERIVED_RECORD_EXTENSION = 208, + DISCRETE_SUBTYPE_DEF_OPT = 209, + DISCRIMINANT_SPECIFICATIONS = 210, + DISCRIM_PART_OPT = 211, + ELSE_OPT = 212, + ELSIFS_OPT = 213, + END_ID_OPT = 214, + ENTRY_INDEX_OPT = 215, + ENUMERATION_TYPE_DECLARATION = 216, + EXCEPT_HANDLER_PART_OPT = 217, + EXTENSION_OPT = 218, + FLOATING_POINT_DECLARATION = 219, + FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, + FORMAL_DISCRETE_TYPE_DECLARATION = 221, + FORMAL_FLOATING_POINT_DECLARATION = 222, + FORMAL_FUNCTION_DECLARATION = 223, + FORMAL_MODULAR_TYPE_DECLARATION = 224, + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, + FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, + FORMAL_PART_OPT = 227, + FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, + FORMAL_PRIVATE_TYPE_DECLARATION = 229, + FORMAL_PROCEDURE_DECLARATION = 230, + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, + FUNCTION_BODY = 232, + FUNCTION_BODY_STUB = 233, + FUNCTION_DECLARATION = 234, + FUNCTION_RENAMING_DECLARATION = 235, + GENERIC_FUNCTION_DECLARATION = 236, + GENERIC_FUNCTION_INSTANTIATION = 237, + GENERIC_FUNCTION_RENAMING = 238, + GENERIC_PACKAGE_INSTANTIATION = 239, + GENERIC_PACKAGE_RENAMING = 240, + GENERIC_PROCEDURE_DECLARATION = 241, + GENERIC_PROCEDURE_INSTANTIATION = 242, + GENERIC_PROCEDURE_RENAMING = 243, + GUARD_OPT = 244, + IDENTIFIER_COLON_OPT = 245, + ID_OPT = 246, + INIT_OPT = 247, + ITERATION_SCHEME_OPT = 248, + LABEL_OPT = 249, + MARK_WITH_CONSTRAINT = 250, + MODIFIERS = 251, + MODULAR_TYPE_DECLARATION = 252, + MOD_CLAUSE_OPT = 253, + NOT_IN = 254, + ORDINARY_DERIVED_TYPE_DECLARATION = 255, + ORDINARY_FIXED_POINT_DECLARATION = 256, + OR_ELSE = 257, + OR_SELECT_OPT = 258, + PARENTHESIZED_PRIMARY = 259, + PRIVATE_DECLARATIVE_ITEMS_OPT = 260, + PRIVATE_TASK_ITEMS_OPT = 261, + PROCEDURE_BODY = 262, + PROCEDURE_BODY_STUB = 263, + PROCEDURE_DECLARATION = 264, + PROCEDURE_RENAMING_DECLARATION = 265, + PROT_MEMBER_DECLARATIONS = 266, + PROT_OP_BODIES_OPT = 267, + PROT_OP_DECLARATIONS = 268, + PROT_PRIVATE_OPT = 269, + RANGED_EXPRS = 270, + RANGE_CONSTRAINT = 271, + RECORD_TYPE_DECLARATION = 272, + SELECTOR_NAMES_OPT = 273, + SIGNED_INTEGER_TYPE_DECLARATION = 274, + TASK_ITEMS_OPT = 275, + UNARY_MINUS = 276, + UNARY_PLUS = 277, + VALUE = 278, + VALUES = 279, + VARIANTS = 280, + COMMENT_INTRO = 281, + OX = 282, + TIC_OR_CHARACTER_LITERAL = 283, + DIGIT = 284, + EXPONENT = 285, + EXTENDED_DIGIT = 286, + BASED_INTEGER = 287, + WS_ = 288, + COMMENT = 289, + CHARACTER_STRING = 290, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_AdaStoreWalkerTokenTypes_hpp_*/ diff --git a/languages/ada/AdaStoreWalkerTokenTypes.txt b/languages/ada/AdaStoreWalkerTokenTypes.txt new file mode 100644 index 00000000..e9ba489c --- /dev/null +++ b/languages/ada/AdaStoreWalkerTokenTypes.txt @@ -0,0 +1,289 @@ +// $ANTLR 2.7.7 (20070609): expandedada.store.g -> AdaStoreWalkerTokenTypes.txt$ +AdaStoreWalker // output token vocab name +PRAGMA="pragma"=4 +IDENTIFIER=5 +SEMI=6 +LPAREN=7 +COMMA=8 +RPAREN=9 +RIGHT_SHAFT=10 +WITH="with"=11 +DOT=12 +USE="use"=13 +TYPE="type"=14 +TIC=15 +RANGE="range"=16 +DIGITS="digits"=17 +DELTA="delta"=18 +ACCESS="access"=19 +PRIVATE="private"=20 +PACKAGE="package"=21 +BODY="body"=22 +IS="is"=23 +PROCEDURE="procedure"=24 +FUNCTION="function"=25 +NEW="new"=26 +OTHERS="others"=27 +PIPE=28 +DOT_DOT=29 +ALL="all"=30 +COLON=31 +IN="in"=32 +OUT="out"=33 +RENAMES="renames"=34 +CHARACTER_LITERAL=35 +CHAR_STRING=36 +NuLL="null"=37 +RECORD="record"=38 +SEPARATE="separate"=39 +ABSTRACT="abstract"=40 +RETURN="return"=41 +TASK="task"=42 +PROTECTED="protected"=43 +BOX=44 +ASSIGN=45 +ENTRY="entry"=46 +FOR="for"=47 +END="end"=48 +AT="at"=49 +MOD="mod"=50 +SUBTYPE="subtype"=51 +EXCEPTION="exception"=52 +CONSTANT="constant"=53 +ARRAY="array"=54 +OF="of"=55 +ALIASED="aliased"=56 +CASE="case"=57 +WHEN="when"=58 +TAGGED="tagged"=59 +LIMITED="limited"=60 +GENERIC="generic"=61 +BEGIN="begin"=62 +LT_LT=63 +GT_GT=64 +IF="if"=65 +THEN="then"=66 +ELSIF="elsif"=67 +ELSE="else"=68 +LOOP="loop"=69 +WHILE="while"=70 +REVERSE="reverse"=71 +DECLARE="declare"=72 +EXIT="exit"=73 +GOTO="goto"=74 +ACCEPT="accept"=75 +DO="do"=76 +DELAY="delay"=77 +UNTIL="until"=78 +SELECT="select"=79 +ABORT="abort"=80 +OR="or"=81 +TERMINATE="terminate"=82 +RAISE="raise"=83 +REQUEUE="requeue"=84 +AND="and"=85 +XOR="xor"=86 +NOT="not"=87 +EQ=88 +NE=89 +LT_=90 +LE=91 +GT=92 +GE=93 +PLUS=94 +MINUS=95 +CONCAT=96 +STAR=97 +DIV=98 +REM="rem"=99 +ABS="abs"=100 +EXPON=101 +NUMERIC_LIT=102 +ABORTABLE_PART=103 +ABORT_STATEMENT=104 +ACCEPT_ALTERNATIVE=105 +ACCEPT_STATEMENT=106 +ALLOCATOR=107 +ASSIGNMENT_STATEMENT=108 +ASYNCHRONOUS_SELECT=109 +ATTRIBUTE_DEFINITION_CLAUSE=110 +AT_CLAUSE=111 +BLOCK_STATEMENT=112 +CASE_STATEMENT=113 +CASE_STATEMENT_ALTERNATIVE=114 +CODE_STATEMENT=115 +COMPONENT_DECLARATION=116 +CONDITIONAL_ENTRY_CALL=117 +CONTEXT_CLAUSE=118 +DECLARATIVE_PART=119 +DEFINING_IDENTIFIER_LIST=120 +DELAY_ALTERNATIVE=121 +DELAY_STATEMENT=122 +DELTA_CONSTRAINT=123 +DIGITS_CONSTRAINT=124 +DISCRIMINANT_ASSOCIATION=125 +DISCRIMINANT_CONSTRAINT=126 +DISCRIMINANT_SPECIFICATION=127 +ENTRY_BODY=128 +ENTRY_CALL_ALTERNATIVE=129 +ENTRY_CALL_STATEMENT=130 +ENTRY_DECLARATION=131 +ENTRY_INDEX_SPECIFICATION=132 +ENUMERATION_REPESENTATION_CLAUSE=133 +EXCEPTION_DECLARATION=134 +EXCEPTION_HANDLER=135 +EXCEPTION_RENAMING_DECLARATION=136 +EXIT_STATEMENT=137 +FORMAL_PACKAGE_DECLARATION=138 +GENERIC_FORMAL_PART=139 +GENERIC_PACKAGE_DECLARATION=140 +GOTO_STATEMENT=141 +HANDLED_SEQUENCE_OF_STATEMENTS=142 +HANDLED_STMTS_OPT=143 +IF_STATEMENT=144 +INCOMPLETE_TYPE_DECLARATION=145 +INDEXED_COMPONENT=146 +INDEX_CONSTRAINT=147 +LIBRARY_ITEM=148 +LOOP_STATEMENT=149 +NAME=150 +NULL_STATEMENT=151 +NUMBER_DECLARATION=152 +OBJECT_DECLARATION=153 +OBJECT_RENAMING_DECLARATION=154 +OPERATOR_SYMBOL=155 +PACKAGE_BODY=156 +PACKAGE_BODY_STUB=157 +PACKAGE_RENAMING_DECLARATION=158 +PACKAGE_SPECIFICATION=159 +PARAMETER_SPECIFICATION=160 +PRIVATE_EXTENSION_DECLARATION=161 +PRIVATE_TYPE_DECLARATION=162 +PROTECTED_BODY=163 +PROTECTED_BODY_STUB=164 +PROTECTED_TYPE_DECLARATION=165 +RAISE_STATEMENT=166 +RANGE_ATTRIBUTE_REFERENCE=167 +RECORD_REPRESENTATION_CLAUSE=168 +REQUEUE_STATEMENT=169 +RETURN_STATEMENT=170 +SELECTIVE_ACCEPT=171 +SEQUENCE_OF_STATEMENTS=172 +SINGLE_PROTECTED_DECLARATION=173 +SINGLE_TASK_DECLARATION=174 +STATEMENT=175 +SUBTYPE_DECLARATION=176 +SUBTYPE_INDICATION=177 +SUBTYPE_MARK=178 +SUBUNIT=179 +TASK_BODY=180 +TASK_BODY_STUB=181 +TASK_TYPE_DECLARATION=182 +TERMINATE_ALTERNATIVE=183 +TIMED_ENTRY_CALL=184 +TRIGGERING_ALTERNATIVE=185 +USE_CLAUSE=186 +USE_TYPE_CLAUSE=187 +VARIANT=188 +VARIANT_PART=189 +WITH_CLAUSE=190 +ABSTRACT_FUNCTION_DECLARATION=191 +ABSTRACT_PROCEDURE_DECLARATION=192 +ACCESS_TO_FUNCTION_DECLARATION=193 +ACCESS_TO_OBJECT_DECLARATION=194 +ACCESS_TO_PROCEDURE_DECLARATION=195 +ARRAY_OBJECT_DECLARATION=196 +ARRAY_TYPE_DECLARATION=197 +AND_THEN=198 +BASIC_DECLARATIVE_ITEMS_OPT=199 +BLOCK_BODY=200 +BLOCK_BODY_OPT=201 +CALL_STATEMENT=202 +COMPONENT_CLAUSES_OPT=203 +COMPONENT_ITEMS=204 +COND_CLAUSE=205 +DECIMAL_FIXED_POINT_DECLARATION=206 +DECLARE_OPT=207 +DERIVED_RECORD_EXTENSION=208 +DISCRETE_SUBTYPE_DEF_OPT=209 +DISCRIMINANT_SPECIFICATIONS=210 +DISCRIM_PART_OPT=211 +ELSE_OPT=212 +ELSIFS_OPT=213 +END_ID_OPT=214 +ENTRY_INDEX_OPT=215 +ENUMERATION_TYPE_DECLARATION=216 +EXCEPT_HANDLER_PART_OPT=217 +EXTENSION_OPT=218 +FLOATING_POINT_DECLARATION=219 +FORMAL_DECIMAL_FIXED_POINT_DECLARATION=220 +FORMAL_DISCRETE_TYPE_DECLARATION=221 +FORMAL_FLOATING_POINT_DECLARATION=222 +FORMAL_FUNCTION_DECLARATION=223 +FORMAL_MODULAR_TYPE_DECLARATION=224 +FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION=225 +FORMAL_ORDINARY_FIXED_POINT_DECLARATION=226 +FORMAL_PART_OPT=227 +FORMAL_PRIVATE_EXTENSION_DECLARATION=228 +FORMAL_PRIVATE_TYPE_DECLARATION=229 +FORMAL_PROCEDURE_DECLARATION=230 +FORMAL_SIGNED_INTEGER_TYPE_DECLARATION=231 +FUNCTION_BODY=232 +FUNCTION_BODY_STUB=233 +FUNCTION_DECLARATION=234 +FUNCTION_RENAMING_DECLARATION=235 +GENERIC_FUNCTION_DECLARATION=236 +GENERIC_FUNCTION_INSTANTIATION=237 +GENERIC_FUNCTION_RENAMING=238 +GENERIC_PACKAGE_INSTANTIATION=239 +GENERIC_PACKAGE_RENAMING=240 +GENERIC_PROCEDURE_DECLARATION=241 +GENERIC_PROCEDURE_INSTANTIATION=242 +GENERIC_PROCEDURE_RENAMING=243 +GUARD_OPT=244 +IDENTIFIER_COLON_OPT=245 +ID_OPT=246 +INIT_OPT=247 +ITERATION_SCHEME_OPT=248 +LABEL_OPT=249 +MARK_WITH_CONSTRAINT=250 +MODIFIERS=251 +MODULAR_TYPE_DECLARATION=252 +MOD_CLAUSE_OPT=253 +NOT_IN=254 +ORDINARY_DERIVED_TYPE_DECLARATION=255 +ORDINARY_FIXED_POINT_DECLARATION=256 +OR_ELSE=257 +OR_SELECT_OPT=258 +PARENTHESIZED_PRIMARY=259 +PRIVATE_DECLARATIVE_ITEMS_OPT=260 +PRIVATE_TASK_ITEMS_OPT=261 +PROCEDURE_BODY=262 +PROCEDURE_BODY_STUB=263 +PROCEDURE_DECLARATION=264 +PROCEDURE_RENAMING_DECLARATION=265 +PROT_MEMBER_DECLARATIONS=266 +PROT_OP_BODIES_OPT=267 +PROT_OP_DECLARATIONS=268 +PROT_PRIVATE_OPT=269 +RANGED_EXPRS=270 +RANGE_CONSTRAINT=271 +RECORD_TYPE_DECLARATION=272 +SELECTOR_NAMES_OPT=273 +SIGNED_INTEGER_TYPE_DECLARATION=274 +TASK_ITEMS_OPT=275 +UNARY_MINUS=276 +UNARY_PLUS=277 +VALUE=278 +VALUES=279 +VARIANTS=280 +COMMENT_INTRO=281 +OX=282 +TIC_OR_CHARACTER_LITERAL=283 +DIGIT=284 +EXPONENT=285 +EXTENDED_DIGIT=286 +BASED_INTEGER=287 +WS_=288 +COMMENT=289 +CHARACTER_STRING=290 diff --git a/languages/ada/AdaTokenTypes.hpp b/languages/ada/AdaTokenTypes.hpp new file mode 100644 index 00000000..918b1cfd --- /dev/null +++ b/languages/ada/AdaTokenTypes.hpp @@ -0,0 +1,306 @@ +#ifndef INC_AdaTokenTypes_hpp_ +#define INC_AdaTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API AdaTokenTypes { +#endif + enum { + EOF_ = 1, + PRAGMA = 4, + IDENTIFIER = 5, + SEMI = 6, + LPAREN = 7, + COMMA = 8, + RPAREN = 9, + RIGHT_SHAFT = 10, + WITH = 11, + DOT = 12, + USE = 13, + TYPE = 14, + TIC = 15, + RANGE = 16, + DIGITS = 17, + DELTA = 18, + ACCESS = 19, + PRIVATE = 20, + PACKAGE = 21, + BODY = 22, + IS = 23, + PROCEDURE = 24, + FUNCTION = 25, + NEW = 26, + OTHERS = 27, + PIPE = 28, + DOT_DOT = 29, + ALL = 30, + COLON = 31, + IN = 32, + OUT = 33, + RENAMES = 34, + CHARACTER_LITERAL = 35, + CHAR_STRING = 36, + NuLL = 37, + RECORD = 38, + SEPARATE = 39, + ABSTRACT = 40, + RETURN = 41, + TASK = 42, + PROTECTED = 43, + BOX = 44, + ASSIGN = 45, + ENTRY = 46, + FOR = 47, + END = 48, + AT = 49, + MOD = 50, + SUBTYPE = 51, + EXCEPTION = 52, + CONSTANT = 53, + ARRAY = 54, + OF = 55, + ALIASED = 56, + CASE = 57, + WHEN = 58, + TAGGED = 59, + LIMITED = 60, + GENERIC = 61, + BEGIN = 62, + LT_LT = 63, + GT_GT = 64, + IF = 65, + THEN = 66, + ELSIF = 67, + ELSE = 68, + LOOP = 69, + WHILE = 70, + REVERSE = 71, + DECLARE = 72, + EXIT = 73, + GOTO = 74, + ACCEPT = 75, + DO = 76, + DELAY = 77, + UNTIL = 78, + SELECT = 79, + ABORT = 80, + OR = 81, + TERMINATE = 82, + RAISE = 83, + REQUEUE = 84, + AND = 85, + XOR = 86, + NOT = 87, + EQ = 88, + NE = 89, + LT_ = 90, + LE = 91, + GT = 92, + GE = 93, + PLUS = 94, + MINUS = 95, + CONCAT = 96, + STAR = 97, + DIV = 98, + REM = 99, + ABS = 100, + EXPON = 101, + NUMERIC_LIT = 102, + ABORTABLE_PART = 103, + ABORT_STATEMENT = 104, + ACCEPT_ALTERNATIVE = 105, + ACCEPT_STATEMENT = 106, + ALLOCATOR = 107, + ASSIGNMENT_STATEMENT = 108, + ASYNCHRONOUS_SELECT = 109, + ATTRIBUTE_DEFINITION_CLAUSE = 110, + AT_CLAUSE = 111, + BLOCK_STATEMENT = 112, + CASE_STATEMENT = 113, + CASE_STATEMENT_ALTERNATIVE = 114, + CODE_STATEMENT = 115, + COMPONENT_DECLARATION = 116, + CONDITIONAL_ENTRY_CALL = 117, + CONTEXT_CLAUSE = 118, + DECLARATIVE_PART = 119, + DEFINING_IDENTIFIER_LIST = 120, + DELAY_ALTERNATIVE = 121, + DELAY_STATEMENT = 122, + DELTA_CONSTRAINT = 123, + DIGITS_CONSTRAINT = 124, + DISCRIMINANT_ASSOCIATION = 125, + DISCRIMINANT_CONSTRAINT = 126, + DISCRIMINANT_SPECIFICATION = 127, + ENTRY_BODY = 128, + ENTRY_CALL_ALTERNATIVE = 129, + ENTRY_CALL_STATEMENT = 130, + ENTRY_DECLARATION = 131, + ENTRY_INDEX_SPECIFICATION = 132, + ENUMERATION_REPESENTATION_CLAUSE = 133, + EXCEPTION_DECLARATION = 134, + EXCEPTION_HANDLER = 135, + EXCEPTION_RENAMING_DECLARATION = 136, + EXIT_STATEMENT = 137, + FORMAL_PACKAGE_DECLARATION = 138, + GENERIC_FORMAL_PART = 139, + GENERIC_PACKAGE_DECLARATION = 140, + GOTO_STATEMENT = 141, + HANDLED_SEQUENCE_OF_STATEMENTS = 142, + HANDLED_STMTS_OPT = 143, + IF_STATEMENT = 144, + INCOMPLETE_TYPE_DECLARATION = 145, + INDEXED_COMPONENT = 146, + INDEX_CONSTRAINT = 147, + LIBRARY_ITEM = 148, + LOOP_STATEMENT = 149, + NAME = 150, + NULL_STATEMENT = 151, + NUMBER_DECLARATION = 152, + OBJECT_DECLARATION = 153, + OBJECT_RENAMING_DECLARATION = 154, + OPERATOR_SYMBOL = 155, + PACKAGE_BODY = 156, + PACKAGE_BODY_STUB = 157, + PACKAGE_RENAMING_DECLARATION = 158, + PACKAGE_SPECIFICATION = 159, + PARAMETER_SPECIFICATION = 160, + PRIVATE_EXTENSION_DECLARATION = 161, + PRIVATE_TYPE_DECLARATION = 162, + PROTECTED_BODY = 163, + PROTECTED_BODY_STUB = 164, + PROTECTED_TYPE_DECLARATION = 165, + RAISE_STATEMENT = 166, + RANGE_ATTRIBUTE_REFERENCE = 167, + RECORD_REPRESENTATION_CLAUSE = 168, + REQUEUE_STATEMENT = 169, + RETURN_STATEMENT = 170, + SELECTIVE_ACCEPT = 171, + SEQUENCE_OF_STATEMENTS = 172, + SINGLE_PROTECTED_DECLARATION = 173, + SINGLE_TASK_DECLARATION = 174, + STATEMENT = 175, + SUBTYPE_DECLARATION = 176, + SUBTYPE_INDICATION = 177, + SUBTYPE_MARK = 178, + SUBUNIT = 179, + TASK_BODY = 180, + TASK_BODY_STUB = 181, + TASK_TYPE_DECLARATION = 182, + TERMINATE_ALTERNATIVE = 183, + TIMED_ENTRY_CALL = 184, + TRIGGERING_ALTERNATIVE = 185, + USE_CLAUSE = 186, + USE_TYPE_CLAUSE = 187, + VARIANT = 188, + VARIANT_PART = 189, + WITH_CLAUSE = 190, + ABSTRACT_FUNCTION_DECLARATION = 191, + ABSTRACT_PROCEDURE_DECLARATION = 192, + ACCESS_TO_FUNCTION_DECLARATION = 193, + ACCESS_TO_OBJECT_DECLARATION = 194, + ACCESS_TO_PROCEDURE_DECLARATION = 195, + ARRAY_OBJECT_DECLARATION = 196, + ARRAY_TYPE_DECLARATION = 197, + AND_THEN = 198, + BASIC_DECLARATIVE_ITEMS_OPT = 199, + BLOCK_BODY = 200, + BLOCK_BODY_OPT = 201, + CALL_STATEMENT = 202, + COMPONENT_CLAUSES_OPT = 203, + COMPONENT_ITEMS = 204, + COND_CLAUSE = 205, + DECIMAL_FIXED_POINT_DECLARATION = 206, + DECLARE_OPT = 207, + DERIVED_RECORD_EXTENSION = 208, + DISCRETE_SUBTYPE_DEF_OPT = 209, + DISCRIMINANT_SPECIFICATIONS = 210, + DISCRIM_PART_OPT = 211, + ELSE_OPT = 212, + ELSIFS_OPT = 213, + END_ID_OPT = 214, + ENTRY_INDEX_OPT = 215, + ENUMERATION_TYPE_DECLARATION = 216, + EXCEPT_HANDLER_PART_OPT = 217, + EXTENSION_OPT = 218, + FLOATING_POINT_DECLARATION = 219, + FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, + FORMAL_DISCRETE_TYPE_DECLARATION = 221, + FORMAL_FLOATING_POINT_DECLARATION = 222, + FORMAL_FUNCTION_DECLARATION = 223, + FORMAL_MODULAR_TYPE_DECLARATION = 224, + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, + FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, + FORMAL_PART_OPT = 227, + FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, + FORMAL_PRIVATE_TYPE_DECLARATION = 229, + FORMAL_PROCEDURE_DECLARATION = 230, + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, + FUNCTION_BODY = 232, + FUNCTION_BODY_STUB = 233, + FUNCTION_DECLARATION = 234, + FUNCTION_RENAMING_DECLARATION = 235, + GENERIC_FUNCTION_DECLARATION = 236, + GENERIC_FUNCTION_INSTANTIATION = 237, + GENERIC_FUNCTION_RENAMING = 238, + GENERIC_PACKAGE_INSTANTIATION = 239, + GENERIC_PACKAGE_RENAMING = 240, + GENERIC_PROCEDURE_DECLARATION = 241, + GENERIC_PROCEDURE_INSTANTIATION = 242, + GENERIC_PROCEDURE_RENAMING = 243, + GUARD_OPT = 244, + IDENTIFIER_COLON_OPT = 245, + ID_OPT = 246, + INIT_OPT = 247, + ITERATION_SCHEME_OPT = 248, + LABEL_OPT = 249, + MARK_WITH_CONSTRAINT = 250, + MODIFIERS = 251, + MODULAR_TYPE_DECLARATION = 252, + MOD_CLAUSE_OPT = 253, + NOT_IN = 254, + ORDINARY_DERIVED_TYPE_DECLARATION = 255, + ORDINARY_FIXED_POINT_DECLARATION = 256, + OR_ELSE = 257, + OR_SELECT_OPT = 258, + PARENTHESIZED_PRIMARY = 259, + PRIVATE_DECLARATIVE_ITEMS_OPT = 260, + PRIVATE_TASK_ITEMS_OPT = 261, + PROCEDURE_BODY = 262, + PROCEDURE_BODY_STUB = 263, + PROCEDURE_DECLARATION = 264, + PROCEDURE_RENAMING_DECLARATION = 265, + PROT_MEMBER_DECLARATIONS = 266, + PROT_OP_BODIES_OPT = 267, + PROT_OP_DECLARATIONS = 268, + PROT_PRIVATE_OPT = 269, + RANGED_EXPRS = 270, + RANGE_CONSTRAINT = 271, + RECORD_TYPE_DECLARATION = 272, + SELECTOR_NAMES_OPT = 273, + SIGNED_INTEGER_TYPE_DECLARATION = 274, + TASK_ITEMS_OPT = 275, + UNARY_MINUS = 276, + UNARY_PLUS = 277, + VALUE = 278, + VALUES = 279, + VARIANTS = 280, + COMMENT_INTRO = 281, + OX = 282, + TIC_OR_CHARACTER_LITERAL = 283, + DIGIT = 284, + EXPONENT = 285, + EXTENDED_DIGIT = 286, + BASED_INTEGER = 287, + WS_ = 288, + COMMENT = 289, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_AdaTokenTypes_hpp_*/ diff --git a/languages/ada/AdaTokenTypes.txt b/languages/ada/AdaTokenTypes.txt new file mode 100644 index 00000000..2415ea0c --- /dev/null +++ b/languages/ada/AdaTokenTypes.txt @@ -0,0 +1,288 @@ +// $ANTLR 2.7.7 (20070609): ada.g -> AdaTokenTypes.txt$ +Ada // output token vocab name +PRAGMA="pragma"=4 +IDENTIFIER=5 +SEMI=6 +LPAREN=7 +COMMA=8 +RPAREN=9 +RIGHT_SHAFT=10 +WITH="with"=11 +DOT=12 +USE="use"=13 +TYPE="type"=14 +TIC=15 +RANGE="range"=16 +DIGITS="digits"=17 +DELTA="delta"=18 +ACCESS="access"=19 +PRIVATE="private"=20 +PACKAGE="package"=21 +BODY="body"=22 +IS="is"=23 +PROCEDURE="procedure"=24 +FUNCTION="function"=25 +NEW="new"=26 +OTHERS="others"=27 +PIPE=28 +DOT_DOT=29 +ALL="all"=30 +COLON=31 +IN="in"=32 +OUT="out"=33 +RENAMES="renames"=34 +CHARACTER_LITERAL=35 +CHAR_STRING=36 +NuLL="null"=37 +RECORD="record"=38 +SEPARATE="separate"=39 +ABSTRACT="abstract"=40 +RETURN="return"=41 +TASK="task"=42 +PROTECTED="protected"=43 +BOX=44 +ASSIGN=45 +ENTRY="entry"=46 +FOR="for"=47 +END="end"=48 +AT="at"=49 +MOD="mod"=50 +SUBTYPE="subtype"=51 +EXCEPTION="exception"=52 +CONSTANT="constant"=53 +ARRAY="array"=54 +OF="of"=55 +ALIASED="aliased"=56 +CASE="case"=57 +WHEN="when"=58 +TAGGED="tagged"=59 +LIMITED="limited"=60 +GENERIC="generic"=61 +BEGIN="begin"=62 +LT_LT=63 +GT_GT=64 +IF="if"=65 +THEN="then"=66 +ELSIF="elsif"=67 +ELSE="else"=68 +LOOP="loop"=69 +WHILE="while"=70 +REVERSE="reverse"=71 +DECLARE="declare"=72 +EXIT="exit"=73 +GOTO="goto"=74 +ACCEPT="accept"=75 +DO="do"=76 +DELAY="delay"=77 +UNTIL="until"=78 +SELECT="select"=79 +ABORT="abort"=80 +OR="or"=81 +TERMINATE="terminate"=82 +RAISE="raise"=83 +REQUEUE="requeue"=84 +AND="and"=85 +XOR="xor"=86 +NOT="not"=87 +EQ=88 +NE=89 +LT_=90 +LE=91 +GT=92 +GE=93 +PLUS=94 +MINUS=95 +CONCAT=96 +STAR=97 +DIV=98 +REM="rem"=99 +ABS="abs"=100 +EXPON=101 +NUMERIC_LIT=102 +ABORTABLE_PART=103 +ABORT_STATEMENT=104 +ACCEPT_ALTERNATIVE=105 +ACCEPT_STATEMENT=106 +ALLOCATOR=107 +ASSIGNMENT_STATEMENT=108 +ASYNCHRONOUS_SELECT=109 +ATTRIBUTE_DEFINITION_CLAUSE=110 +AT_CLAUSE=111 +BLOCK_STATEMENT=112 +CASE_STATEMENT=113 +CASE_STATEMENT_ALTERNATIVE=114 +CODE_STATEMENT=115 +COMPONENT_DECLARATION=116 +CONDITIONAL_ENTRY_CALL=117 +CONTEXT_CLAUSE=118 +DECLARATIVE_PART=119 +DEFINING_IDENTIFIER_LIST=120 +DELAY_ALTERNATIVE=121 +DELAY_STATEMENT=122 +DELTA_CONSTRAINT=123 +DIGITS_CONSTRAINT=124 +DISCRIMINANT_ASSOCIATION=125 +DISCRIMINANT_CONSTRAINT=126 +DISCRIMINANT_SPECIFICATION=127 +ENTRY_BODY=128 +ENTRY_CALL_ALTERNATIVE=129 +ENTRY_CALL_STATEMENT=130 +ENTRY_DECLARATION=131 +ENTRY_INDEX_SPECIFICATION=132 +ENUMERATION_REPESENTATION_CLAUSE=133 +EXCEPTION_DECLARATION=134 +EXCEPTION_HANDLER=135 +EXCEPTION_RENAMING_DECLARATION=136 +EXIT_STATEMENT=137 +FORMAL_PACKAGE_DECLARATION=138 +GENERIC_FORMAL_PART=139 +GENERIC_PACKAGE_DECLARATION=140 +GOTO_STATEMENT=141 +HANDLED_SEQUENCE_OF_STATEMENTS=142 +HANDLED_STMTS_OPT=143 +IF_STATEMENT=144 +INCOMPLETE_TYPE_DECLARATION=145 +INDEXED_COMPONENT=146 +INDEX_CONSTRAINT=147 +LIBRARY_ITEM=148 +LOOP_STATEMENT=149 +NAME=150 +NULL_STATEMENT=151 +NUMBER_DECLARATION=152 +OBJECT_DECLARATION=153 +OBJECT_RENAMING_DECLARATION=154 +OPERATOR_SYMBOL=155 +PACKAGE_BODY=156 +PACKAGE_BODY_STUB=157 +PACKAGE_RENAMING_DECLARATION=158 +PACKAGE_SPECIFICATION=159 +PARAMETER_SPECIFICATION=160 +PRIVATE_EXTENSION_DECLARATION=161 +PRIVATE_TYPE_DECLARATION=162 +PROTECTED_BODY=163 +PROTECTED_BODY_STUB=164 +PROTECTED_TYPE_DECLARATION=165 +RAISE_STATEMENT=166 +RANGE_ATTRIBUTE_REFERENCE=167 +RECORD_REPRESENTATION_CLAUSE=168 +REQUEUE_STATEMENT=169 +RETURN_STATEMENT=170 +SELECTIVE_ACCEPT=171 +SEQUENCE_OF_STATEMENTS=172 +SINGLE_PROTECTED_DECLARATION=173 +SINGLE_TASK_DECLARATION=174 +STATEMENT=175 +SUBTYPE_DECLARATION=176 +SUBTYPE_INDICATION=177 +SUBTYPE_MARK=178 +SUBUNIT=179 +TASK_BODY=180 +TASK_BODY_STUB=181 +TASK_TYPE_DECLARATION=182 +TERMINATE_ALTERNATIVE=183 +TIMED_ENTRY_CALL=184 +TRIGGERING_ALTERNATIVE=185 +USE_CLAUSE=186 +USE_TYPE_CLAUSE=187 +VARIANT=188 +VARIANT_PART=189 +WITH_CLAUSE=190 +ABSTRACT_FUNCTION_DECLARATION=191 +ABSTRACT_PROCEDURE_DECLARATION=192 +ACCESS_TO_FUNCTION_DECLARATION=193 +ACCESS_TO_OBJECT_DECLARATION=194 +ACCESS_TO_PROCEDURE_DECLARATION=195 +ARRAY_OBJECT_DECLARATION=196 +ARRAY_TYPE_DECLARATION=197 +AND_THEN=198 +BASIC_DECLARATIVE_ITEMS_OPT=199 +BLOCK_BODY=200 +BLOCK_BODY_OPT=201 +CALL_STATEMENT=202 +COMPONENT_CLAUSES_OPT=203 +COMPONENT_ITEMS=204 +COND_CLAUSE=205 +DECIMAL_FIXED_POINT_DECLARATION=206 +DECLARE_OPT=207 +DERIVED_RECORD_EXTENSION=208 +DISCRETE_SUBTYPE_DEF_OPT=209 +DISCRIMINANT_SPECIFICATIONS=210 +DISCRIM_PART_OPT=211 +ELSE_OPT=212 +ELSIFS_OPT=213 +END_ID_OPT=214 +ENTRY_INDEX_OPT=215 +ENUMERATION_TYPE_DECLARATION=216 +EXCEPT_HANDLER_PART_OPT=217 +EXTENSION_OPT=218 +FLOATING_POINT_DECLARATION=219 +FORMAL_DECIMAL_FIXED_POINT_DECLARATION=220 +FORMAL_DISCRETE_TYPE_DECLARATION=221 +FORMAL_FLOATING_POINT_DECLARATION=222 +FORMAL_FUNCTION_DECLARATION=223 +FORMAL_MODULAR_TYPE_DECLARATION=224 +FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION=225 +FORMAL_ORDINARY_FIXED_POINT_DECLARATION=226 +FORMAL_PART_OPT=227 +FORMAL_PRIVATE_EXTENSION_DECLARATION=228 +FORMAL_PRIVATE_TYPE_DECLARATION=229 +FORMAL_PROCEDURE_DECLARATION=230 +FORMAL_SIGNED_INTEGER_TYPE_DECLARATION=231 +FUNCTION_BODY=232 +FUNCTION_BODY_STUB=233 +FUNCTION_DECLARATION=234 +FUNCTION_RENAMING_DECLARATION=235 +GENERIC_FUNCTION_DECLARATION=236 +GENERIC_FUNCTION_INSTANTIATION=237 +GENERIC_FUNCTION_RENAMING=238 +GENERIC_PACKAGE_INSTANTIATION=239 +GENERIC_PACKAGE_RENAMING=240 +GENERIC_PROCEDURE_DECLARATION=241 +GENERIC_PROCEDURE_INSTANTIATION=242 +GENERIC_PROCEDURE_RENAMING=243 +GUARD_OPT=244 +IDENTIFIER_COLON_OPT=245 +ID_OPT=246 +INIT_OPT=247 +ITERATION_SCHEME_OPT=248 +LABEL_OPT=249 +MARK_WITH_CONSTRAINT=250 +MODIFIERS=251 +MODULAR_TYPE_DECLARATION=252 +MOD_CLAUSE_OPT=253 +NOT_IN=254 +ORDINARY_DERIVED_TYPE_DECLARATION=255 +ORDINARY_FIXED_POINT_DECLARATION=256 +OR_ELSE=257 +OR_SELECT_OPT=258 +PARENTHESIZED_PRIMARY=259 +PRIVATE_DECLARATIVE_ITEMS_OPT=260 +PRIVATE_TASK_ITEMS_OPT=261 +PROCEDURE_BODY=262 +PROCEDURE_BODY_STUB=263 +PROCEDURE_DECLARATION=264 +PROCEDURE_RENAMING_DECLARATION=265 +PROT_MEMBER_DECLARATIONS=266 +PROT_OP_BODIES_OPT=267 +PROT_OP_DECLARATIONS=268 +PROT_PRIVATE_OPT=269 +RANGED_EXPRS=270 +RANGE_CONSTRAINT=271 +RECORD_TYPE_DECLARATION=272 +SELECTOR_NAMES_OPT=273 +SIGNED_INTEGER_TYPE_DECLARATION=274 +TASK_ITEMS_OPT=275 +UNARY_MINUS=276 +UNARY_PLUS=277 +VALUE=278 +VALUES=279 +VARIANTS=280 +COMMENT_INTRO=281 +OX=282 +TIC_OR_CHARACTER_LITERAL=283 +DIGIT=284 +EXPONENT=285 +EXTENDED_DIGIT=286 +BASED_INTEGER=287 +WS_=288 +COMMENT=289 diff --git a/languages/ada/AdaTreeParserSuper.cpp b/languages/ada/AdaTreeParserSuper.cpp new file mode 100644 index 00000000..be5f0623 --- /dev/null +++ b/languages/ada/AdaTreeParserSuper.cpp @@ -0,0 +1,9050 @@ +/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuper.cpp"$ */ +#include "AdaTreeParserSuper.hpp" +#include +#include +#include +#include +#include +#include +#line 1 "ada.tree.g" +#line 11 "AdaTreeParserSuper.cpp" +AdaTreeParserSuper::AdaTreeParserSuper() + : ANTLR_USE_NAMESPACE(antlr)TreeParser() { +} + +void AdaTreeParserSuper::compilation_unit(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST compilation_unit_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + context_items_opt(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case LIBRARY_ITEM: + { + library_item(_t); + _t = _retTree; + break; + } + case SUBUNIT: + { + subunit(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == PRAGMA)) { + pragma(_t); + _t = _retTree; + } + else { + goto _loop4; + } + + } + _loop4:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::context_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST context_items_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t12 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp1_AST_in = _t; + match(_t,CONTEXT_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case WITH_CLAUSE: + { + with_clause(_t); + _t = _retTree; + break; + } + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + { + use_clause(_t); + _t = _retTree; + break; + } + default: + { + goto _loop14; + } + } + } + _loop14:; + } // ( ... )* + _t = __t12; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::library_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST library_item_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t32 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp2_AST_in = _t; + match(_t,LIBRARY_ITEM); + _t = _t->getFirstChild(); + modifiers(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl_or_rename_or_inst_or_body(_t); + _t = _retTree; + break; + } + case PACKAGE_BODY: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t34 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp3_AST_in = _t; + match(_t,PACKAGE_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + pkg_body_part(_t); + _t = _retTree; + _t = __t34; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_INSTANTIATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t35 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp4_AST_in = _t; + match(_t,GENERIC_PACKAGE_INSTANTIATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t35; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_SPECIFICATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t36 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp5_AST_in = _t; + match(_t,PACKAGE_SPECIFICATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + pkg_spec_part(_t); + _t = _retTree; + _t = __t36; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_RENAMING_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t37 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp6_AST_in = _t; + match(_t,PACKAGE_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t37; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + { + generic_decl(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t32; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subunit(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subunit_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t514 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp7_AST_in = _t; + match(_t,SUBUNIT); + _t = _t->getFirstChild(); + compound_name(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case FUNCTION_BODY: + case PROCEDURE_BODY: + { + subprogram_body(_t); + _t = _retTree; + break; + } + case PACKAGE_BODY: + { + package_body(_t); + _t = _retTree; + break; + } + case TASK_BODY: + { + task_body(_t); + _t = _retTree; + break; + } + case PROTECTED_BODY: + { + protected_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t514; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::pragma(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST pragma_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t6 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp8_AST_in = _t; + match(_t,PRAGMA); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp9_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_0.member(_t->getType()))) { + pragma_arg(_t); + _t = _retTree; + } + else { + goto _loop8; + } + + } + _loop8:; + } // ( ... )* + _t = __t6; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::pragma_arg(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST pragma_arg_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case RIGHT_SHAFT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t10 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp10_AST_in = _t; + match(_t,RIGHT_SHAFT); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp11_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + _t = __t10; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST expression_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case AND: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t472 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp12_AST_in = _t; + match(_t,AND); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t472; + _t = _t->getNextSibling(); + break; + } + case AND_THEN: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t473 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp13_AST_in = _t; + match(_t,AND_THEN); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t473; + _t = _t->getNextSibling(); + break; + } + case OR: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t474 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp14_AST_in = _t; + match(_t,OR); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t474; + _t = _t->getNextSibling(); + break; + } + case OR_ELSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t475 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp15_AST_in = _t; + match(_t,OR_ELSE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t475; + _t = _t->getNextSibling(); + break; + } + case XOR: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t476 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp16_AST_in = _t; + match(_t,XOR); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + relation(_t); + _t = _retTree; + _t = __t476; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case NOT_IN: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + relation(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::with_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST with_clause_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t16 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp17_AST_in = _t; + match(_t,WITH_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt18=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == DOT)) { + compound_name(_t); + _t = _retTree; + } + else { + if ( _cnt18>=1 ) { goto _loop18; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt18++; + } + _loop18:; + } // ( ... )+ + _t = __t16; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::use_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST use_clause_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case USE_TYPE_CLAUSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t22 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp18_AST_in = _t; + match(_t,USE_TYPE_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt24=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == DOT || _t->getType() == TIC)) { + subtype_mark(_t); + _t = _retTree; + } + else { + if ( _cnt24>=1 ) { goto _loop24; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt24++; + } + _loop24:; + } // ( ... )+ + _t = __t22; + _t = _t->getNextSibling(); + break; + } + case USE_CLAUSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t25 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp19_AST_in = _t; + match(_t,USE_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt27=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == DOT)) { + compound_name(_t); + _t = _retTree; + } + else { + if ( _cnt27>=1 ) { goto _loop27; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt27++; + } + _loop27:; + } // ( ... )+ + _t = __t25; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::compound_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST compound_name_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp20_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t20 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp21_AST_in = _t; + match(_t,DOT); + _t = _t->getFirstChild(); + compound_name(_t); + _t = _retTree; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp22_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + _t = __t20; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subtype_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subtype_mark_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case TIC: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t29 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp23_AST_in = _t; + match(_t,TIC); + _t = _t->getFirstChild(); + compound_name(_t); + _t = _retTree; + attribute_id(_t); + _t = _retTree; + _t = __t29; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::attribute_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST attribute_id_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case RANGE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp24_AST_in = _t; + match(_t,RANGE); + _t = _t->getNextSibling(); + break; + } + case DIGITS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp25_AST_in = _t; + match(_t,DIGITS); + _t = _t->getNextSibling(); + break; + } + case DELTA: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp26_AST_in = _t; + match(_t,DELTA); + _t = _t->getNextSibling(); + break; + } + case ACCESS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp27_AST_in = _t; + match(_t,ACCESS); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp28_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::modifiers(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST modifiers_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t39 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp29_AST_in = _t; + match(_t,MODIFIERS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp30_AST_in = _t; + match(_t,ABSTRACT); + _t = _t->getNextSibling(); + break; + } + case ACCESS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp31_AST_in = _t; + match(_t,ACCESS); + _t = _t->getNextSibling(); + break; + } + case ALIASED: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp32_AST_in = _t; + match(_t,ALIASED); + _t = _t->getNextSibling(); + break; + } + case ALL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp33_AST_in = _t; + match(_t,ALL); + _t = _t->getNextSibling(); + break; + } + case CONSTANT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp34_AST_in = _t; + match(_t,CONSTANT); + _t = _t->getNextSibling(); + break; + } + case IN: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp35_AST_in = _t; + match(_t,IN); + _t = _t->getNextSibling(); + break; + } + case LIMITED: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp36_AST_in = _t; + match(_t,LIMITED); + _t = _t->getNextSibling(); + break; + } + case OUT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp37_AST_in = _t; + match(_t,OUT); + _t = _t->getNextSibling(); + break; + } + case PRIVATE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp38_AST_in = _t; + match(_t,PRIVATE); + _t = _t->getNextSibling(); + break; + } + case PROTECTED: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp39_AST_in = _t; + match(_t,PROTECTED); + _t = _t->getNextSibling(); + break; + } + case REVERSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp40_AST_in = _t; + match(_t,REVERSE); + _t = _t->getNextSibling(); + break; + } + case TAGGED: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp41_AST_in = _t; + match(_t,TAGGED); + _t = _t->getNextSibling(); + break; + } + default: + { + goto _loop41; + } + } + } + _loop41:; + } // ( ... )* + _t = __t39; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subprog_decl_or_rename_or_inst_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subprog_decl_or_rename_or_inst_or_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl(_t); + _t = _retTree; + break; + } + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::def_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST def_id_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + compound_name(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::pkg_body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST pkg_body_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + declarative_part(_t); + _t = _retTree; + block_body_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::generic_inst(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST generic_inst_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + compound_name(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case VALUES: + { + value_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::pkg_spec_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST pkg_spec_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + basic_declarative_items_opt(_t); + _t = _retTree; + private_declarative_items_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::renames(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST renames_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case CHARACTER_STRING: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp42_AST_in = _t; + match(_t,CHARACTER_STRING); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp43_AST_in = _t; + match(_t,OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case INDEXED_COMPONENT: + { + name(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::generic_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST generic_decl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case GENERIC_PACKAGE_RENAMING: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t277 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp44_AST_in = _t; + match(_t,GENERIC_PACKAGE_RENAMING); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t277; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t278 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp45_AST_in = _t; + match(_t,GENERIC_PACKAGE_DECLARATION); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + pkg_spec_part(_t); + _t = _retTree; + _t = __t278; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PROCEDURE_RENAMING: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t279 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp46_AST_in = _t; + match(_t,GENERIC_PROCEDURE_RENAMING); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t279; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t280 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp47_AST_in = _t; + match(_t,GENERIC_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t280; + _t = _t->getNextSibling(); + break; + } + case GENERIC_FUNCTION_RENAMING: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t281 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp48_AST_in = _t; + match(_t,GENERIC_FUNCTION_RENAMING); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t281; + _t = _t->getNextSibling(); + break; + } + case GENERIC_FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t282 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp49_AST_in = _t; + match(_t,GENERIC_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + generic_formal_part_opt(_t); + _t = _retTree; + def_id(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t282; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST id_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t43 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp50_AST_in = _t; + match(_t,ID_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case OPERATOR_SYMBOL: + { + def_designator(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t43; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::def_designator(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST def_designator_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case OPERATOR_SYMBOL: + { + definable_operator_symbol(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::end_id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST end_id_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t46 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp51_AST_in = _t; + match(_t,END); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case OPERATOR_SYMBOL: + { + def_designator(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t46; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subprog_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subprog_decl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case GENERIC_PROCEDURE_INSTANTIATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t49 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp52_AST_in = _t; + match(_t,GENERIC_PROCEDURE_INSTANTIATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t49; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE_RENAMING_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t50 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp53_AST_in = _t; + match(_t,PROCEDURE_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t50; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t51 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp54_AST_in = _t; + match(_t,PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t51; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE_BODY_STUB: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t52 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp55_AST_in = _t; + match(_t,PROCEDURE_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t52; + _t = _t->getNextSibling(); + break; + } + case ABSTRACT_PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t53 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp56_AST_in = _t; + match(_t,ABSTRACT_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t53; + _t = _t->getNextSibling(); + break; + } + case GENERIC_FUNCTION_INSTANTIATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t54 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp57_AST_in = _t; + match(_t,GENERIC_FUNCTION_INSTANTIATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t54; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_RENAMING_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t55 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp58_AST_in = _t; + match(_t,FUNCTION_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t55; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t56 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp59_AST_in = _t; + match(_t,FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t56; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_BODY_STUB: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t57 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp60_AST_in = _t; + match(_t,FUNCTION_BODY_STUB); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t57; + _t = _t->getNextSibling(); + break; + } + case ABSTRACT_FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t58 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp61_AST_in = _t; + match(_t,ABSTRACT_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t58; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST formal_part_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t84 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp62_AST_in = _t; + match(_t,FORMAL_PART_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == PARAMETER_SPECIFICATION)) { + parameter_specification(_t); + _t = _retTree; + } + else { + goto _loop86; + } + + } + _loop86:; + } // ( ... )* + _t = __t84; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::function_tail(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST function_tail_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + formal_part_opt(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::value_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST value_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t468 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp63_AST_in = _t; + match(_t,VALUES); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt470=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_1.member(_t->getType()))) { + value(_t); + _t = _retTree; + } + else { + if ( _cnt470>=1 ) { goto _loop470; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt470++; + } + _loop470:; + } // ( ... )+ + _t = __t468; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::value(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST value_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case OTHERS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t63 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp64_AST_in = _t; + match(_t,OTHERS); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + _t = __t63; + _t = _t->getNextSibling(); + break; + } + case RIGHT_SHAFT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t64 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp65_AST_in = _t; + match(_t,RIGHT_SHAFT); + _t = _t->getFirstChild(); + ranged_expr_s(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t64; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case RANGE: + case PIPE: + case DOT_DOT: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + ranged_expr_s(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::ranged_expr_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST ranged_expr_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PIPE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t66 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp66_AST_in = _t; + match(_t,PIPE); + _t = _t->getFirstChild(); + ranged_expr_s(_t); + _t = _retTree; + ranged_expr(_t); + _t = _retTree; + _t = __t66; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case RANGE: + case DOT_DOT: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + ranged_expr(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::ranged_expr(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST ranged_expr_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t68 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp67_AST_in = _t; + match(_t,DOT_DOT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t68; + _t = _t->getNextSibling(); + break; + } + case RANGE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t69 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp68_AST_in = _t; + match(_t,RANGE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + range(_t); + _t = _retTree; + _t = __t69; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::simple_expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST simple_expression_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PLUS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t488 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp69_AST_in = _t; + match(_t,PLUS); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + signed_term(_t); + _t = _retTree; + _t = __t488; + _t = _t->getNextSibling(); + break; + } + case MINUS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t489 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp70_AST_in = _t; + match(_t,MINUS); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + signed_term(_t); + _t = _retTree; + _t = __t489; + _t = _t->getNextSibling(); + break; + } + case CONCAT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t490 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp71_AST_in = _t; + match(_t,CONCAT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + signed_term(_t); + _t = _retTree; + _t = __t490; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + signed_term(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::range(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST range_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + { + range_dots(_t); + _t = _retTree; + break; + } + case RANGE_ATTRIBUTE_REFERENCE: + { + range_attrib_ref(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::range_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST range_constraint_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t71 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp72_AST_in = _t; + match(_t,RANGE_CONSTRAINT); + _t = _t->getFirstChild(); + range(_t); + _t = _retTree; + _t = __t71; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::range_dots(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST range_dots_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t75 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp73_AST_in = _t; + match(_t,DOT_DOT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t75; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::range_attrib_ref(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST range_attrib_ref_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t77 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp74_AST_in = _t; + match(_t,RANGE_ATTRIBUTE_REFERENCE); + _t = _t->getFirstChild(); + prefix(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t77; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prefix(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prefix_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp75_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t80 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp76_AST_in = _t; + match(_t,DOT); + _t = _t->getFirstChild(); + prefix(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ALL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp77_AST_in = _t; + match(_t,ALL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp78_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t80; + _t = _t->getNextSibling(); + break; + } + case INDEXED_COMPONENT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t82 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp79_AST_in = _t; + match(_t,INDEXED_COMPONENT); + _t = _t->getFirstChild(); + prefix(_t); + _t = _retTree; + value_s(_t); + _t = _retTree; + _t = __t82; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::parameter_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST parameter_specification_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t88 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp80_AST_in = _t; + match(_t,PARAMETER_SPECIFICATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t88; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::defining_identifier_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST defining_identifier_list_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t90 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp81_AST_in = _t; + match(_t,DEFINING_IDENTIFIER_LIST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt92=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER)) { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp82_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + } + else { + if ( _cnt92>=1 ) { goto _loop92; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt92++; + } + _loop92:; + } // ( ... )+ + _t = __t90; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::init_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST init_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t136 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp83_AST_in = _t; + match(_t,INIT_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t136; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::name(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST name_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp84_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t95 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp85_AST_in = _t; + match(_t,DOT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ALL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp86_AST_in = _t; + match(_t,ALL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp87_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp88_AST_in = _t; + match(_t,CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp89_AST_in = _t; + match(_t,OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t95; + _t = _t->getNextSibling(); + break; + } + case INDEXED_COMPONENT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t97 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp90_AST_in = _t; + match(_t,INDEXED_COMPONENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + value_s(_t); + _t = _retTree; + _t = __t97; + _t = _t->getNextSibling(); + break; + } + case TIC: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t98 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp91_AST_in = _t; + match(_t,TIC); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + attribute_id(_t); + _t = _retTree; + _t = __t98; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::definable_operator_symbol(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST definable_operator_symbol_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp92_AST_in = _t; + match(_t,OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::parenthesized_primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST parenthesized_primary_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t101 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp93_AST_in = _t; + match(_t,PARENTHESIZED_PRIMARY); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case NuLL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp94_AST_in = _t; + match(_t,NuLL); + _t = _t->getNextSibling(); + break; + } + case VALUES: + { + value_s(_t); + _t = _retTree; + extension_opt(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t101; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::extension_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST extension_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t104 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp95_AST_in = _t; + match(_t,EXTENSION_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case NuLL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp96_AST_in = _t; + match(_t,NuLL); + _t = _t->getNextSibling(); + break; + } + case VALUES: + { + value_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t104; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::spec_decl_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST spec_decl_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case GENERIC_PACKAGE_INSTANTIATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t109 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp97_AST_in = _t; + match(_t,GENERIC_PACKAGE_INSTANTIATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + generic_inst(_t); + _t = _retTree; + _t = __t109; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_SPECIFICATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t110 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp98_AST_in = _t; + match(_t,PACKAGE_SPECIFICATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + pkg_spec_part(_t); + _t = _retTree; + _t = __t110; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_RENAMING_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t111 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp99_AST_in = _t; + match(_t,PACKAGE_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + renames(_t); + _t = _retTree; + _t = __t111; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::basic_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST basic_declarative_items_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t114 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp100_AST_in = _t; + match(_t,BASIC_DECLARATIVE_ITEMS_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_2.member(_t->getType()))) { + basic_decl_item(_t); + _t = _retTree; + } + else { + goto _loop116; + } + + } + _loop116:; + } // ( ... )* + _t = __t114; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::private_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST private_declarative_items_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t118 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp101_AST_in = _t; + match(_t,PRIVATE_DECLARATIVE_ITEMS_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_2.member(_t->getType()))) { + basic_decl_item(_t); + _t = _retTree; + } + else { + goto _loop120; + } + + } + _loop120:; + } // ( ... )* + _t = __t118; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::basic_decl_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST basic_decl_item_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case GENERIC_PACKAGE_INSTANTIATION: + { + spec_decl_part(_t); + _t = _retTree; + break; + } + case SINGLE_TASK_DECLARATION: + case TASK_TYPE_DECLARATION: + { + task_type_or_single_decl(_t); + _t = _retTree; + break; + } + case PROTECTED_TYPE_DECLARATION: + case SINGLE_PROTECTED_DECLARATION: + { + prot_type_or_single_decl(_t); + _t = _retTree; + break; + } + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SUBTYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + decl_common(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::task_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST task_type_or_single_decl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case TASK_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t123 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp102_AST_in = _t; + match(_t,TASK_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + discrim_part_opt(_t); + _t = _retTree; + task_definition_opt(_t); + _t = _retTree; + _t = __t123; + _t = _t->getNextSibling(); + break; + } + case SINGLE_TASK_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t124 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp103_AST_in = _t; + match(_t,SINGLE_TASK_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + task_definition_opt(_t); + _t = _retTree; + _t = __t124; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prot_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prot_type_or_single_decl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROTECTED_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t164 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp104_AST_in = _t; + match(_t,PROTECTED_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + discrim_part_opt(_t); + _t = _retTree; + protected_definition(_t); + _t = _retTree; + _t = __t164; + _t = _t->getNextSibling(); + break; + } + case SINGLE_PROTECTED_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t165 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp105_AST_in = _t; + match(_t,SINGLE_PROTECTED_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + protected_definition(_t); + _t = _retTree; + _t = __t165; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::decl_common(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST decl_common_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ENUMERATION_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t184 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp106_AST_in = _t; + match(_t,ENUMERATION_TYPE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp107_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + enum_id_s(_t); + _t = _retTree; + _t = __t184; + _t = _t->getNextSibling(); + break; + } + case SIGNED_INTEGER_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t185 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp108_AST_in = _t; + match(_t,SIGNED_INTEGER_TYPE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp109_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + range(_t); + _t = _retTree; + _t = __t185; + _t = _t->getNextSibling(); + break; + } + case MODULAR_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t186 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp110_AST_in = _t; + match(_t,MODULAR_TYPE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp111_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + _t = __t186; + _t = _t->getNextSibling(); + break; + } + case FLOATING_POINT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t187 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp112_AST_in = _t; + match(_t,FLOATING_POINT_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp113_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t187; + _t = _t->getNextSibling(); + break; + } + case ORDINARY_FIXED_POINT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t188 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp114_AST_in = _t; + match(_t,ORDINARY_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp115_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + range(_t); + _t = _retTree; + _t = __t188; + _t = _t->getNextSibling(); + break; + } + case DECIMAL_FIXED_POINT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t189 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp116_AST_in = _t; + match(_t,DECIMAL_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp117_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t189; + _t = _t->getNextSibling(); + break; + } + case ARRAY_TYPE_DECLARATION: + { + array_type_declaration(_t); + _t = _retTree; + break; + } + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + { + access_type_declaration(_t); + _t = _retTree; + break; + } + case INCOMPLETE_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t190 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp118_AST_in = _t; + match(_t,INCOMPLETE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp119_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + discrim_part_opt(_t); + _t = _retTree; + _t = __t190; + _t = _t->getNextSibling(); + break; + } + case PRIVATE_EXTENSION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t191 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp120_AST_in = _t; + match(_t,PRIVATE_EXTENSION_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t191; + _t = _t->getNextSibling(); + break; + } + case DERIVED_RECORD_EXTENSION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t192 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp121_AST_in = _t; + match(_t,DERIVED_RECORD_EXTENSION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + record_definition(_t); + _t = _retTree; + _t = __t192; + _t = _t->getNextSibling(); + break; + } + case ORDINARY_DERIVED_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t193 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp122_AST_in = _t; + match(_t,ORDINARY_DERIVED_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t193; + _t = _t->getNextSibling(); + break; + } + case PRIVATE_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t194 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp123_AST_in = _t; + match(_t,PRIVATE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + _t = __t194; + _t = _t->getNextSibling(); + break; + } + case RECORD_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t195 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp124_AST_in = _t; + match(_t,RECORD_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_and_discrim(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + record_definition(_t); + _t = _retTree; + _t = __t195; + _t = _t->getNextSibling(); + break; + } + case SUBTYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t196 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp125_AST_in = _t; + match(_t,SUBTYPE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp126_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + subtype_ind(_t); + _t = _retTree; + _t = __t196; + _t = _t->getNextSibling(); + break; + } + case GENERIC_PACKAGE_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + { + generic_decl(_t); + _t = _retTree; + break; + } + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + { + use_clause(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + { + rep_spec(_t); + _t = _retTree; + break; + } + case EXCEPTION_RENAMING_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t197 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp127_AST_in = _t; + match(_t,EXCEPTION_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + compound_name(_t); + _t = _retTree; + _t = __t197; + _t = _t->getNextSibling(); + break; + } + case OBJECT_RENAMING_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t198 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp128_AST_in = _t; + match(_t,OBJECT_RENAMING_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + name(_t); + _t = _retTree; + _t = __t198; + _t = _t->getNextSibling(); + break; + } + case EXCEPTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t199 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp129_AST_in = _t; + match(_t,EXCEPTION_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + _t = __t199; + _t = _t->getNextSibling(); + break; + } + case NUMBER_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t200 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp130_AST_in = _t; + match(_t,NUMBER_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t200; + _t = _t->getNextSibling(); + break; + } + case ARRAY_OBJECT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t201 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp131_AST_in = _t; + match(_t,ARRAY_OBJECT_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + array_type_definition(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t201; + _t = _t->getNextSibling(); + break; + } + case OBJECT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t202 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp132_AST_in = _t; + match(_t,OBJECT_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t202; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discrim_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discrim_part_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t127 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp133_AST_in = _t; + match(_t,DISCRIM_PART_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp134_AST_in = _t; + match(_t,BOX); + _t = _t->getNextSibling(); + break; + } + case DISCRIMINANT_SPECIFICATIONS: + { + discriminant_specifications(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t127; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::task_definition_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST task_definition_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + task_items_opt(_t); + _t = _retTree; + private_task_items_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST task_items_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t139 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp135_AST_in = _t; + match(_t,TASK_ITEMS_OPT); + _t = _t->getFirstChild(); + entrydecls_repspecs_opt(_t); + _t = _retTree; + _t = __t139; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::private_task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST private_task_items_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t162 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp136_AST_in = _t; + match(_t,PRIVATE_TASK_ITEMS_OPT); + _t = _t->getFirstChild(); + entrydecls_repspecs_opt(_t); + _t = _retTree; + _t = __t162; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discriminant_specifications(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discriminant_specifications_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t130 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp137_AST_in = _t; + match(_t,DISCRIMINANT_SPECIFICATIONS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == DISCRIMINANT_SPECIFICATION)) { + discriminant_specification(_t); + _t = _retTree; + } + else { + goto _loop132; + } + + } + _loop132:; + } // ( ... )* + _t = __t130; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discriminant_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discriminant_specification_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t134 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp138_AST_in = _t; + match(_t,DISCRIMINANT_SPECIFICATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_mark(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t134; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entrydecls_repspecs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entrydecls_repspecs_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ENTRY_DECLARATION: + { + entry_declaration(_t); + _t = _retTree; + break; + } + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + { + rep_spec(_t); + _t = _retTree; + break; + } + default: + { + goto _loop142; + } + } + } + _loop142:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_declaration_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t144 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp139_AST_in = _t; + match(_t,ENTRY_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp140_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + discrete_subtype_def_opt(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t144; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::rep_spec(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST rep_spec_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case RECORD_REPRESENTATION_CLAUSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t150 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp141_AST_in = _t; + match(_t,RECORD_REPRESENTATION_CLAUSE); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + align_opt(_t); + _t = _retTree; + comp_loc_s(_t); + _t = _retTree; + _t = __t150; + _t = _t->getNextSibling(); + break; + } + case AT_CLAUSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t151 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp142_AST_in = _t; + match(_t,AT_CLAUSE); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t151; + _t = _t->getNextSibling(); + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t152 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp143_AST_in = _t; + match(_t,ATTRIBUTE_DEFINITION_CLAUSE); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t152; + _t = _t->getNextSibling(); + break; + } + case ENUMERATION_REPESENTATION_CLAUSE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t153 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp144_AST_in = _t; + match(_t,ENUMERATION_REPESENTATION_CLAUSE); + _t = _t->getFirstChild(); + local_enum_name(_t); + _t = _retTree; + enumeration_aggregate(_t); + _t = _retTree; + _t = __t153; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discrete_subtype_def_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discrete_subtype_def_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t146 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp145_AST_in = _t; + match(_t,DISCRETE_SUBTYPE_DEF_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + case SUBTYPE_INDICATION: + { + discrete_subtype_definition(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t146; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discrete_subtype_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discrete_subtype_definition_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + case SUBTYPE_INDICATION: + { + subtype_ind(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subtype_ind(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subtype_ind_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t221 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp146_AST_in = _t; + match(_t,SUBTYPE_INDICATION); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + constraint_opt(_t); + _t = _retTree; + _t = __t221; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::align_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST align_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t155 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp147_AST_in = _t; + match(_t,MOD_CLAUSE_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t155; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::comp_loc_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST comp_loc_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t158 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp148_AST_in = _t; + match(_t,COMPONENT_CLAUSES_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case DOT: + case TIC: + { + subtype_mark(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + range(_t); + _t = _retTree; + break; + } + default: + { + goto _loop160; + } + } + } + _loop160:; + } // ( ... )* + _t = __t158; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::local_enum_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST local_enum_name_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp149_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::enumeration_aggregate(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST enumeration_aggregate_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_1.member(_t->getType()))) { + value(_t); + _t = _retTree; + } + else { + goto _loop275; + } + + } + _loop275:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::protected_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST protected_definition_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + prot_op_decl_s(_t); + _t = _retTree; + prot_private_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prot_private_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prot_private_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t167 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp150_AST_in = _t; + match(_t,PROT_PRIVATE_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROT_MEMBER_DECLARATIONS: + { + prot_member_decl_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t167; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prot_member_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prot_member_decl_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t178 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp151_AST_in = _t; + match(_t,PROT_MEMBER_DECLARATIONS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENTRY_DECLARATION: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + case FUNCTION_DECLARATION: + case PROCEDURE_DECLARATION: + { + prot_op_decl(_t); + _t = _retTree; + break; + } + case COMPONENT_DECLARATION: + { + comp_decl(_t); + _t = _retTree; + break; + } + default: + { + goto _loop180; + } + } + } + _loop180:; + } // ( ... )* + _t = __t178; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prot_op_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prot_op_decl_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t171 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp152_AST_in = _t; + match(_t,PROT_OP_DECLARATIONS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_3.member(_t->getType()))) { + prot_op_decl(_t); + _t = _retTree; + } + else { + goto _loop173; + } + + } + _loop173:; + } // ( ... )* + _t = __t171; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prot_op_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prot_op_decl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ENTRY_DECLARATION: + { + entry_declaration(_t); + _t = _retTree; + break; + } + case PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t175 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp153_AST_in = _t; + match(_t,PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t175; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t176 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp154_AST_in = _t; + match(_t,FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t176; + _t = _t->getNextSibling(); + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case RECORD_REPRESENTATION_CLAUSE: + { + rep_spec(_t); + _t = _retTree; + break; + } + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::comp_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST comp_decl_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t182 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp155_AST_in = _t; + match(_t,COMPONENT_DECLARATION); + _t = _t->getFirstChild(); + defining_identifier_list(_t); + _t = _retTree; + component_subtype_def(_t); + _t = _retTree; + init_opt(_t); + _t = _retTree; + _t = __t182; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::component_subtype_def(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST component_subtype_def_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::enum_id_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST enum_id_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { // ( ... )+ + int _cnt206=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER || _t->getType() == CHARACTER_LITERAL)) { + enumeration_literal_specification(_t); + _t = _retTree; + } + else { + if ( _cnt206>=1 ) { goto _loop206; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt206++; + } + _loop206:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::range_constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST range_constraint_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case RANGE_CONSTRAINT: + { + range_constraint(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST array_type_declaration_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t212 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp156_AST_in = _t; + match(_t,ARRAY_TYPE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp157_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + array_type_definition(_t); + _t = _retTree; + _t = __t212; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST access_type_declaration_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ACCESS_TO_PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t245 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp158_AST_in = _t; + match(_t,ACCESS_TO_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp159_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t245; + _t = _t->getNextSibling(); + break; + } + case ACCESS_TO_FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t246 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp160_AST_in = _t; + match(_t,ACCESS_TO_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp161_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t246; + _t = _t->getNextSibling(); + break; + } + case ACCESS_TO_OBJECT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t247 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp162_AST_in = _t; + match(_t,ACCESS_TO_OBJECT_DECLARATION); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp163_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t247; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::id_and_discrim(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST id_and_discrim_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp164_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + discrim_part_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::record_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST record_definition_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case COMPONENT_ITEMS: + { + component_list(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::array_type_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST array_type_definition_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + index_or_discrete_range_s(_t); + _t = _retTree; + component_subtype_def(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::enumeration_literal_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST enumeration_literal_specification_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp165_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp166_AST_in = _t; + match(_t,CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::index_or_discrete_range_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST index_or_discrete_range_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case RANGE: + case DOT_DOT: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + index_or_discrete_range(_t); + _t = _retTree; + break; + } + case COMMA: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t214 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp167_AST_in = _t; + match(_t,COMMA); + _t = _t->getFirstChild(); + index_or_discrete_range_s(_t); + _t = _retTree; + index_or_discrete_range(_t); + _t = _retTree; + _t = __t214; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::index_or_discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST index_or_discrete_range_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t216 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp168_AST_in = _t; + match(_t,DOT_DOT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t216; + _t = _t->getNextSibling(); + break; + } + case RANGE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t217 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp169_AST_in = _t; + match(_t,RANGE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp170_AST_in = _t; + match(_t,BOX); + _t = _t->getNextSibling(); + break; + } + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t217; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + simple_expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST constraint_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case RANGE_CONSTRAINT: + { + range_constraint(_t); + _t = _retTree; + break; + } + case DIGITS_CONSTRAINT: + { + digits_constraint(_t); + _t = _retTree; + break; + } + case DELTA_CONSTRAINT: + { + delta_constraint(_t); + _t = _retTree; + break; + } + case INDEX_CONSTRAINT: + { + index_constraint(_t); + _t = _retTree; + break; + } + case DISCRIMINANT_CONSTRAINT: + { + discriminant_constraint(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::digits_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST digits_constraint_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t225 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp171_AST_in = _t; + match(_t,DIGITS_CONSTRAINT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t225; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::delta_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST delta_constraint_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t227 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp172_AST_in = _t; + match(_t,DELTA_CONSTRAINT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + range_constraint_opt(_t); + _t = _retTree; + _t = __t227; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::index_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST index_constraint_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t229 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp173_AST_in = _t; + match(_t,INDEX_CONSTRAINT); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt231=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == DOT_DOT || _t->getType() == RANGE_ATTRIBUTE_REFERENCE || _t->getType() == SUBTYPE_INDICATION)) { + discrete_range(_t); + _t = _retTree; + } + else { + if ( _cnt231>=1 ) { goto _loop231; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt231++; + } + _loop231:; + } // ( ... )+ + _t = __t229; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discriminant_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discriminant_constraint_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t234 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp174_AST_in = _t; + match(_t,DISCRIMINANT_CONSTRAINT); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt236=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == DISCRIMINANT_ASSOCIATION)) { + discriminant_association(_t); + _t = _retTree; + } + else { + if ( _cnt236>=1 ) { goto _loop236; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt236++; + } + _loop236:; + } // ( ... )+ + _t = __t234; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discrete_range_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + case SUBTYPE_INDICATION: + { + subtype_ind(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discriminant_association(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discriminant_association_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t238 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp175_AST_in = _t; + match(_t,DISCRIMINANT_ASSOCIATION); + _t = _t->getFirstChild(); + selector_names_opt(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t238; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::selector_names_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST selector_names_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t240 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp176_AST_in = _t; + match(_t,SELECTOR_NAMES_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == IDENTIFIER)) { + selector_name(_t); + _t = _retTree; + } + else { + goto _loop242; + } + + } + _loop242:; + } // ( ... )* + _t = __t240; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::selector_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST selector_name_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp177_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::component_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST component_list_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + component_items(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case VARIANT_PART: + { + variant_part(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::component_items(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST component_items_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t253 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp178_AST_in = _t; + match(_t,COMPONENT_ITEMS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case COMPONENT_DECLARATION: + { + comp_decl(_t); + _t = _retTree; + break; + } + default: + { + goto _loop255; + } + } + } + _loop255:; + } // ( ... )* + _t = __t253; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::variant_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST variant_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t257 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp179_AST_in = _t; + match(_t,VARIANT_PART); + _t = _t->getFirstChild(); + discriminant_direct_name(_t); + _t = _retTree; + variant_s(_t); + _t = _retTree; + _t = __t257; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discriminant_direct_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discriminant_direct_name_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp180_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::variant_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST variant_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t260 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp181_AST_in = _t; + match(_t,VARIANTS); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt262=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == VARIANT)) { + variant(_t); + _t = _retTree; + } + else { + if ( _cnt262>=1 ) { goto _loop262; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt262++; + } + _loop262:; + } // ( ... )+ + _t = __t260; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::variant(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST variant_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t264 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp182_AST_in = _t; + match(_t,VARIANT); + _t = _t->getFirstChild(); + choice_s(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case COMPONENT_ITEMS: + { + component_list(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t264; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST choice_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PIPE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t267 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp183_AST_in = _t; + match(_t,PIPE); + _t = _t->getFirstChild(); + choice_s(_t); + _t = _retTree; + choice(_t); + _t = _retTree; + _t = __t267; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case OTHERS: + case DOT_DOT: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case RANGE_ATTRIBUTE_REFERENCE: + case AND_THEN: + case MARK_WITH_CONSTRAINT: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + choice(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST choice_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case OTHERS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp184_AST_in = _t; + match(_t,OTHERS); + _t = _t->getNextSibling(); + break; + } + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + case MARK_WITH_CONSTRAINT: + { + discrete_with_range(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::discrete_with_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST discrete_with_range_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case MARK_WITH_CONSTRAINT: + { + mark_with_constraint(_t); + _t = _retTree; + break; + } + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::mark_with_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST mark_with_constraint_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t271 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp185_AST_in = _t; + match(_t,MARK_WITH_CONSTRAINT); + _t = _t->getFirstChild(); + subtype_mark(_t); + _t = _retTree; + range_constraint(_t); + _t = _retTree; + _t = __t271; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::generic_formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST generic_formal_part_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t284 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp186_AST_in = _t; + match(_t,GENERIC_FORMAL_PART); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + { + use_clause(_t); + _t = _retTree; + break; + } + case FORMAL_PACKAGE_DECLARATION: + case PARAMETER_SPECIFICATION: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case FORMAL_DECIMAL_FIXED_POINT_DECLARATION: + case FORMAL_DISCRETE_TYPE_DECLARATION: + case FORMAL_FLOATING_POINT_DECLARATION: + case FORMAL_FUNCTION_DECLARATION: + case FORMAL_MODULAR_TYPE_DECLARATION: + case FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION: + case FORMAL_ORDINARY_FIXED_POINT_DECLARATION: + case FORMAL_PRIVATE_EXTENSION_DECLARATION: + case FORMAL_PRIVATE_TYPE_DECLARATION: + case FORMAL_PROCEDURE_DECLARATION: + case FORMAL_SIGNED_INTEGER_TYPE_DECLARATION: + { + generic_formal_parameter(_t); + _t = _retTree; + break; + } + default: + { + goto _loop286; + } + } + } + _loop286:; + } // ( ... )* + _t = __t284; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::generic_formal_parameter(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST generic_formal_parameter_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case FORMAL_DISCRETE_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t288 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp187_AST_in = _t; + match(_t,FORMAL_DISCRETE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t288; + _t = _t->getNextSibling(); + break; + } + case FORMAL_SIGNED_INTEGER_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t289 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp188_AST_in = _t; + match(_t,FORMAL_SIGNED_INTEGER_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t289; + _t = _t->getNextSibling(); + break; + } + case FORMAL_MODULAR_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t290 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp189_AST_in = _t; + match(_t,FORMAL_MODULAR_TYPE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t290; + _t = _t->getNextSibling(); + break; + } + case FORMAL_DECIMAL_FIXED_POINT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t291 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp190_AST_in = _t; + match(_t,FORMAL_DECIMAL_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t291; + _t = _t->getNextSibling(); + break; + } + case FORMAL_ORDINARY_FIXED_POINT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t292 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp191_AST_in = _t; + match(_t,FORMAL_ORDINARY_FIXED_POINT_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t292; + _t = _t->getNextSibling(); + break; + } + case FORMAL_FLOATING_POINT_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t293 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp192_AST_in = _t; + match(_t,FORMAL_FLOATING_POINT_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t293; + _t = _t->getNextSibling(); + break; + } + case ARRAY_TYPE_DECLARATION: + { + formal_array_type_declaration(_t); + _t = _retTree; + break; + } + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + { + formal_access_type_declaration(_t); + _t = _retTree; + break; + } + case FORMAL_PRIVATE_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t294 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp193_AST_in = _t; + match(_t,FORMAL_PRIVATE_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_part(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + _t = __t294; + _t = _t->getNextSibling(); + break; + } + case FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t295 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp194_AST_in = _t; + match(_t,FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION); + _t = _t->getFirstChild(); + id_part(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t295; + _t = _t->getNextSibling(); + break; + } + case FORMAL_PRIVATE_EXTENSION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t296 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp195_AST_in = _t; + match(_t,FORMAL_PRIVATE_EXTENSION_DECLARATION); + _t = _t->getFirstChild(); + id_part(_t); + _t = _retTree; + modifiers(_t); + _t = _retTree; + subtype_ind(_t); + _t = _retTree; + _t = __t296; + _t = _t->getNextSibling(); + break; + } + case FORMAL_PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t297 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp196_AST_in = _t; + match(_t,FORMAL_PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + subprogram_default_opt(_t); + _t = _retTree; + _t = __t297; + _t = _t->getNextSibling(); + break; + } + case FORMAL_FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t298 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp197_AST_in = _t; + match(_t,FORMAL_FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + subprogram_default_opt(_t); + _t = _retTree; + _t = __t298; + _t = _t->getNextSibling(); + break; + } + case FORMAL_PACKAGE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t299 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp198_AST_in = _t; + match(_t,FORMAL_PACKAGE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + compound_name(_t); + _t = _retTree; + formal_package_actual_part_opt(_t); + _t = _retTree; + _t = __t299; + _t = _t->getNextSibling(); + break; + } + case PARAMETER_SPECIFICATION: + { + parameter_specification(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::formal_array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST formal_array_type_declaration_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + array_type_declaration(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::formal_access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST formal_access_type_declaration_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + access_type_declaration(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::id_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST id_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + def_id(_t); + _t = _retTree; + discrim_part_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subprogram_default_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subprogram_default_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp199_AST_in = _t; + match(_t,BOX); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case INDEXED_COMPONENT: + { + name(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::formal_package_actual_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST formal_package_actual_part_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case BOX: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp200_AST_in = _t; + match(_t,BOX); + _t = _t->getNextSibling(); + break; + } + case DEFINING_IDENTIFIER_LIST: + { + defining_identifier_list(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::procedure_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST procedure_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t309 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp201_AST_in = _t; + match(_t,PROCEDURE_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t309; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::function_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST function_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t311 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp202_AST_in = _t; + match(_t,FUNCTION_BODY); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t311; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST body_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + declarative_part(_t); + _t = _retTree; + block_body(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::declarative_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST declarative_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t314 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp203_AST_in = _t; + match(_t,DECLARATIVE_PART); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PACKAGE_BODY: + case PACKAGE_BODY_STUB: + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case PROTECTED_BODY: + case PROTECTED_BODY_STUB: + case PROTECTED_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SINGLE_PROTECTED_DECLARATION: + case SINGLE_TASK_DECLARATION: + case SUBTYPE_DECLARATION: + case TASK_BODY: + case TASK_BODY_STUB: + case TASK_TYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case FUNCTION_BODY: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_INSTANTIATION: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case PROCEDURE_BODY: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + declarative_item(_t); + _t = _retTree; + break; + } + default: + { + goto _loop316; + } + } + } + _loop316:; + } // ( ... )* + _t = __t314; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::block_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST block_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t336 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp204_AST_in = _t; + match(_t,BLOCK_BODY); + _t = _t->getFirstChild(); + handled_stmt_s(_t); + _t = _retTree; + _t = __t336; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::declarative_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST declarative_item_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PACKAGE_BODY_STUB: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t318 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp205_AST_in = _t; + match(_t,PACKAGE_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t318; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_BODY: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t319 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp206_AST_in = _t; + match(_t,PACKAGE_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + pkg_body_part(_t); + _t = _retTree; + _t = __t319; + _t = _t->getNextSibling(); + break; + } + case PACKAGE_RENAMING_DECLARATION: + case PACKAGE_SPECIFICATION: + case GENERIC_PACKAGE_INSTANTIATION: + { + spec_decl_part(_t); + _t = _retTree; + break; + } + case TASK_BODY_STUB: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t320 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp207_AST_in = _t; + match(_t,TASK_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t320; + _t = _t->getNextSibling(); + break; + } + case TASK_BODY: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t321 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp208_AST_in = _t; + match(_t,TASK_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + _t = __t321; + _t = _t->getNextSibling(); + break; + } + case SINGLE_TASK_DECLARATION: + case TASK_TYPE_DECLARATION: + { + task_type_or_single_decl(_t); + _t = _retTree; + break; + } + case PROTECTED_BODY_STUB: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t322 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp209_AST_in = _t; + match(_t,PROTECTED_BODY_STUB); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + _t = __t322; + _t = _t->getNextSibling(); + break; + } + case PROTECTED_BODY: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t323 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp210_AST_in = _t; + match(_t,PROTECTED_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + prot_op_bodies_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + _t = __t323; + _t = _t->getNextSibling(); + break; + } + case PROTECTED_TYPE_DECLARATION: + case SINGLE_PROTECTED_DECLARATION: + { + prot_type_or_single_decl(_t); + _t = _retTree; + break; + } + case ABSTRACT_FUNCTION_DECLARATION: + case ABSTRACT_PROCEDURE_DECLARATION: + case FUNCTION_BODY: + case FUNCTION_BODY_STUB: + case FUNCTION_DECLARATION: + case FUNCTION_RENAMING_DECLARATION: + case GENERIC_FUNCTION_INSTANTIATION: + case GENERIC_PROCEDURE_INSTANTIATION: + case PROCEDURE_BODY: + case PROCEDURE_BODY_STUB: + case PROCEDURE_DECLARATION: + case PROCEDURE_RENAMING_DECLARATION: + { + subprog_decl_or_rename_or_inst_or_body(_t); + _t = _retTree; + break; + } + case ATTRIBUTE_DEFINITION_CLAUSE: + case AT_CLAUSE: + case ENUMERATION_REPESENTATION_CLAUSE: + case EXCEPTION_DECLARATION: + case EXCEPTION_RENAMING_DECLARATION: + case GENERIC_PACKAGE_DECLARATION: + case INCOMPLETE_TYPE_DECLARATION: + case NUMBER_DECLARATION: + case OBJECT_DECLARATION: + case OBJECT_RENAMING_DECLARATION: + case PRIVATE_EXTENSION_DECLARATION: + case PRIVATE_TYPE_DECLARATION: + case RECORD_REPRESENTATION_CLAUSE: + case SUBTYPE_DECLARATION: + case USE_CLAUSE: + case USE_TYPE_CLAUSE: + case ACCESS_TO_FUNCTION_DECLARATION: + case ACCESS_TO_OBJECT_DECLARATION: + case ACCESS_TO_PROCEDURE_DECLARATION: + case ARRAY_OBJECT_DECLARATION: + case ARRAY_TYPE_DECLARATION: + case DECIMAL_FIXED_POINT_DECLARATION: + case DERIVED_RECORD_EXTENSION: + case ENUMERATION_TYPE_DECLARATION: + case FLOATING_POINT_DECLARATION: + case GENERIC_FUNCTION_DECLARATION: + case GENERIC_FUNCTION_RENAMING: + case GENERIC_PACKAGE_RENAMING: + case GENERIC_PROCEDURE_DECLARATION: + case GENERIC_PROCEDURE_RENAMING: + case MODULAR_TYPE_DECLARATION: + case ORDINARY_DERIVED_TYPE_DECLARATION: + case ORDINARY_FIXED_POINT_DECLARATION: + case RECORD_TYPE_DECLARATION: + case SIGNED_INTEGER_TYPE_DECLARATION: + { + decl_common(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::prot_op_bodies_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST prot_op_bodies_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t329 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp211_AST_in = _t; + match(_t,PROT_OP_BODIES_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case ENTRY_BODY: + { + entry_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + case FUNCTION_DECLARATION: + case PROCEDURE_BODY: + case PROCEDURE_DECLARATION: + { + subprog_decl_or_body(_t); + _t = _retTree; + break; + } + default: + { + goto _loop331; + } + } + } + _loop331:; + } // ( ... )* + _t = __t329; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::block_body_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST block_body_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t326 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp212_AST_in = _t; + match(_t,BLOCK_BODY_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case HANDLED_SEQUENCE_OF_STATEMENTS: + { + handled_stmt_s(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t326; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::handled_stmt_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST handled_stmt_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t338 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp213_AST_in = _t; + match(_t,HANDLED_SEQUENCE_OF_STATEMENTS); + _t = _t->getFirstChild(); + statements(_t); + _t = _retTree; + except_handler_part_opt(_t); + _t = _retTree; + _t = __t338; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t398 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp214_AST_in = _t; + match(_t,ENTRY_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + entry_body_formal_part(_t); + _t = _retTree; + entry_barrier(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t398; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subprog_decl_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subprog_decl_or_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case PROCEDURE_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t333 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp215_AST_in = _t; + match(_t,PROCEDURE_DECLARATION); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + _t = __t333; + _t = _t->getNextSibling(); + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + case FUNCTION_DECLARATION: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t334 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp216_AST_in = _t; + match(_t,FUNCTION_DECLARATION); + _t = _t->getFirstChild(); + def_designator(_t); + _t = _retTree; + function_tail(_t); + _t = _retTree; + _t = __t334; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST statements_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t343 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp217_AST_in = _t; + match(_t,SEQUENCE_OF_STATEMENTS); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt345=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case STATEMENT: + { + statement(_t); + _t = _retTree; + break; + } + default: + { + if ( _cnt345>=1 ) { goto _loop345; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + } + _cnt345++; + } + _loop345:; + } // ( ... )+ + _t = __t343; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::except_handler_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST except_handler_part_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t448 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp218_AST_in = _t; + match(_t,EXCEPT_HANDLER_PART_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == EXCEPTION_HANDLER)) { + exception_handler(_t); + _t = _retTree; + } + else { + goto _loop450; + } + + } + _loop450:; + } // ( ... )* + _t = __t448; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::handled_stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST handled_stmts_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t340 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp219_AST_in = _t; + match(_t,HANDLED_STMTS_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case SEQUENCE_OF_STATEMENTS: + { + statements(_t); + _t = _retTree; + except_handler_part_opt(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t340; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::statement(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST statement_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t347 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp220_AST_in = _t; + match(_t,STATEMENT); + _t = _t->getFirstChild(); + def_label_opt(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case NULL_STATEMENT: + { + null_stmt(_t); + _t = _retTree; + break; + } + case EXIT_STATEMENT: + { + exit_stmt(_t); + _t = _retTree; + break; + } + case RETURN_STATEMENT: + { + return_stmt(_t); + _t = _retTree; + break; + } + case GOTO_STATEMENT: + { + goto_stmt(_t); + _t = _retTree; + break; + } + case DELAY_STATEMENT: + { + delay_stmt(_t); + _t = _retTree; + break; + } + case ABORT_STATEMENT: + { + abort_stmt(_t); + _t = _retTree; + break; + } + case RAISE_STATEMENT: + { + raise_stmt(_t); + _t = _retTree; + break; + } + case REQUEUE_STATEMENT: + { + requeue_stmt(_t); + _t = _retTree; + break; + } + case ACCEPT_STATEMENT: + { + accept_stmt(_t); + _t = _retTree; + break; + } + case ASYNCHRONOUS_SELECT: + case CONDITIONAL_ENTRY_CALL: + case SELECTIVE_ACCEPT: + case TIMED_ENTRY_CALL: + { + select_stmt(_t); + _t = _retTree; + break; + } + case IF_STATEMENT: + { + if_stmt(_t); + _t = _retTree; + break; + } + case CASE_STATEMENT: + { + case_stmt(_t); + _t = _retTree; + break; + } + case LOOP_STATEMENT: + { + loop_stmt(_t); + _t = _retTree; + id_opt(_t); + _t = _retTree; + break; + } + case BLOCK_STATEMENT: + { + block(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + break; + } + case ASSIGNMENT_STATEMENT: + case CALL_STATEMENT: + { + call_or_assignment(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t347; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::def_label_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST def_label_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t350 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp221_AST_in = _t; + match(_t,LABEL_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp222_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t350; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::null_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST null_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp223_AST_in = _t; + match(_t,NULL_STATEMENT); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::exit_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST exit_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t385 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp224_AST_in = _t; + match(_t,EXIT_STATEMENT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + label_name(_t); + _t = _retTree; + break; + } + case 3: + case WHEN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case WHEN: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp225_AST_in = _t; + match(_t,WHEN); + _t = _t->getNextSibling(); + condition(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t385; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::return_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST return_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t390 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp226_AST_in = _t; + match(_t,RETURN_STATEMENT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t390; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::goto_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST goto_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t393 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp227_AST_in = _t; + match(_t,GOTO_STATEMENT); + _t = _t->getFirstChild(); + label_name(_t); + _t = _retTree; + _t = __t393; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::delay_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST delay_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t412 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp228_AST_in = _t; + match(_t,DELAY_STATEMENT); + _t = _t->getFirstChild(); + modifiers(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t412; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::abort_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST abort_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t444 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp229_AST_in = _t; + match(_t,ABORT_STATEMENT); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt446=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_tokenSet_4.member(_t->getType()))) { + name(_t); + _t = _retTree; + } + else { + if ( _cnt446>=1 ) { goto _loop446; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt446++; + } + _loop446:; + } // ( ... )+ + _t = __t444; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::raise_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST raise_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t460 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp230_AST_in = _t; + match(_t,RAISE_STATEMENT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t460; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::requeue_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST requeue_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t463 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp231_AST_in = _t; + match(_t,REQUEUE_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ABORT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp232_AST_in = _t; + match(_t,ABORT); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t463; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::accept_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST accept_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t407 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp233_AST_in = _t; + match(_t,ACCEPT_STATEMENT); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + entry_index_opt(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + handled_stmts_opt(_t); + _t = _retTree; + end_id_opt(_t); + _t = _retTree; + _t = __t407; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::select_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST select_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ASYNCHRONOUS_SELECT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t414 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp234_AST_in = _t; + match(_t,ASYNCHRONOUS_SELECT); + _t = _t->getFirstChild(); + triggering_alternative(_t); + _t = _retTree; + abortable_part(_t); + _t = _retTree; + _t = __t414; + _t = _t->getNextSibling(); + break; + } + case SELECTIVE_ACCEPT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t415 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp235_AST_in = _t; + match(_t,SELECTIVE_ACCEPT); + _t = _t->getFirstChild(); + selective_accept(_t); + _t = _retTree; + _t = __t415; + _t = _t->getNextSibling(); + break; + } + case TIMED_ENTRY_CALL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t416 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp236_AST_in = _t; + match(_t,TIMED_ENTRY_CALL); + _t = _t->getFirstChild(); + entry_call_alternative(_t); + _t = _retTree; + delay_alternative(_t); + _t = _retTree; + _t = __t416; + _t = _t->getNextSibling(); + break; + } + case CONDITIONAL_ENTRY_CALL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t417 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp237_AST_in = _t; + match(_t,CONDITIONAL_ENTRY_CALL); + _t = _t->getFirstChild(); + entry_call_alternative(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t417; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::if_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST if_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t354 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp238_AST_in = _t; + match(_t,IF_STATEMENT); + _t = _t->getFirstChild(); + cond_clause(_t); + _t = _retTree; + elsifs_opt(_t); + _t = _retTree; + else_opt(_t); + _t = _retTree; + _t = __t354; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::case_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST case_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t366 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp239_AST_in = _t; + match(_t,CASE_STATEMENT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + alternative_s(_t); + _t = _retTree; + _t = __t366; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::loop_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST loop_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t373 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp240_AST_in = _t; + match(_t,LOOP_STATEMENT); + _t = _t->getFirstChild(); + iteration_scheme_opt(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t373; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::block(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST block_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t380 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp241_AST_in = _t; + match(_t,BLOCK_STATEMENT); + _t = _t->getFirstChild(); + declare_opt(_t); + _t = _retTree; + block_body(_t); + _t = _retTree; + _t = __t380; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::call_or_assignment(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST call_or_assignment_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ASSIGNMENT_STATEMENT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t395 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp242_AST_in = _t; + match(_t,ASSIGNMENT_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t395; + _t = _t->getNextSibling(); + break; + } + case CALL_STATEMENT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t396 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp243_AST_in = _t; + match(_t,CALL_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + _t = __t396; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::cond_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST cond_clause_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t356 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp244_AST_in = _t; + match(_t,COND_CLAUSE); + _t = _t->getFirstChild(); + condition(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t356; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::elsifs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST elsifs_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t359 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp245_AST_in = _t; + match(_t,ELSIFS_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == COND_CLAUSE)) { + cond_clause(_t); + _t = _retTree; + } + else { + goto _loop361; + } + + } + _loop361:; + } // ( ... )* + _t = __t359; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::else_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST else_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t363 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp246_AST_in = _t; + match(_t,ELSE_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case SEQUENCE_OF_STATEMENTS: + { + statements(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t363; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::condition(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST condition_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + expression(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::alternative_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST alternative_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { // ( ... )+ + int _cnt369=0; + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == CASE_STATEMENT_ALTERNATIVE)) { + case_statement_alternative(_t); + _t = _retTree; + } + else { + if ( _cnt369>=1 ) { goto _loop369; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t);} + } + + _cnt369++; + } + _loop369:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::case_statement_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST case_statement_alternative_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t371 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp247_AST_in = _t; + match(_t,CASE_STATEMENT_ALTERNATIVE); + _t = _t->getFirstChild(); + choice_s(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t371; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::iteration_scheme_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST iteration_scheme_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t375 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp248_AST_in = _t; + match(_t,ITERATION_SCHEME_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case WHILE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t377 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp249_AST_in = _t; + match(_t,WHILE); + _t = _t->getFirstChild(); + condition(_t); + _t = _retTree; + _t = __t377; + _t = _t->getNextSibling(); + break; + } + case FOR: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t378 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp250_AST_in = _t; + match(_t,FOR); + _t = _t->getFirstChild(); + ANTLR_USE_NAMESPACE(antlr)RefAST tmp251_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + modifiers(_t); + _t = _retTree; + discrete_subtype_definition(_t); + _t = _retTree; + _t = __t378; + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t375; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::declare_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST declare_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t382 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp252_AST_in = _t; + match(_t,DECLARE_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DECLARATIVE_PART: + { + declarative_part(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t382; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::label_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST label_name_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST tmp253_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_body_formal_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_body_formal_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + entry_index_spec_opt(_t); + _t = _retTree; + formal_part_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_barrier(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_barrier_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + condition(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_index_spec_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_index_spec_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t401 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp254_AST_in = _t; + match(_t,ENTRY_INDEX_SPECIFICATION); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + def_id(_t); + _t = _retTree; + discrete_subtype_definition(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t401; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_call_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_call_stmt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t405 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp255_AST_in = _t; + match(_t,ENTRY_CALL_STATEMENT); + _t = _t->getFirstChild(); + name(_t); + _t = _retTree; + _t = __t405; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_index_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_index_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t409 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp256_AST_in = _t; + match(_t,ENTRY_INDEX_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t409; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::triggering_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST triggering_alternative_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t419 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp257_AST_in = _t; + match(_t,TRIGGERING_ALTERNATIVE); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DELAY_STATEMENT: + { + delay_stmt(_t); + _t = _retTree; + break; + } + case ENTRY_CALL_STATEMENT: + { + entry_call_stmt(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + stmts_opt(_t); + _t = _retTree; + _t = __t419; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::abortable_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST abortable_part_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t422 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp258_AST_in = _t; + match(_t,ABORTABLE_PART); + _t = _t->getFirstChild(); + stmts_opt(_t); + _t = _retTree; + _t = __t422; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::selective_accept(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST selective_accept_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + guard_opt(_t); + _t = _retTree; + select_alternative(_t); + _t = _retTree; + or_select_opt(_t); + _t = _retTree; + else_opt(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::entry_call_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST entry_call_alternative_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t424 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp259_AST_in = _t; + match(_t,ENTRY_CALL_ALTERNATIVE); + _t = _t->getFirstChild(); + entry_call_stmt(_t); + _t = _retTree; + stmts_opt(_t); + _t = _retTree; + _t = __t424; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::delay_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST delay_alternative_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t435 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp260_AST_in = _t; + match(_t,DELAY_ALTERNATIVE); + _t = _t->getFirstChild(); + delay_stmt(_t); + _t = _retTree; + stmts_opt(_t); + _t = _retTree; + _t = __t435; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST stmts_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PRAGMA: + { + pragma(_t); + _t = _retTree; + break; + } + case STATEMENT: + { + statement(_t); + _t = _retTree; + break; + } + default: + { + goto _loop438; + } + } + } + _loop438:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::guard_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST guard_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t427 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp261_AST_in = _t; + match(_t,GUARD_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case IN: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case OR: + case AND: + case XOR: + case NOT: + case EQ: + case NE: + case LT_: + case LE: + case GT: + case GE: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case AND_THEN: + case NOT_IN: + case OR_ELSE: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + condition(_t); + _t = _retTree; + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == PRAGMA)) { + pragma(_t); + _t = _retTree; + } + else { + goto _loop430; + } + + } + _loop430:; + } // ( ... )* + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t427; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::select_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST select_alternative_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ACCEPT_ALTERNATIVE: + { + accept_alternative(_t); + _t = _retTree; + break; + } + case DELAY_ALTERNATIVE: + { + delay_alternative(_t); + _t = _retTree; + break; + } + case TERMINATE_ALTERNATIVE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp262_AST_in = _t; + match(_t,TERMINATE_ALTERNATIVE); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::or_select_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST or_select_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t440 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp263_AST_in = _t; + match(_t,OR_SELECT_OPT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + if ((_t->getType() == GUARD_OPT)) { + guard_opt(_t); + _t = _retTree; + select_alternative(_t); + _t = _retTree; + } + else { + goto _loop442; + } + + } + _loop442:; + } // ( ... )* + _t = __t440; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::accept_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST accept_alternative_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t433 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp264_AST_in = _t; + match(_t,ACCEPT_ALTERNATIVE); + _t = _t->getFirstChild(); + accept_stmt(_t); + _t = _retTree; + stmts_opt(_t); + _t = _retTree; + _t = __t433; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::exception_handler(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST exception_handler_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t452 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp265_AST_in = _t; + match(_t,EXCEPTION_HANDLER); + _t = _t->getFirstChild(); + identifier_colon_opt(_t); + _t = _retTree; + except_choice_s(_t); + _t = _retTree; + statements(_t); + _t = _retTree; + _t = __t452; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::identifier_colon_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST identifier_colon_opt_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t454 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp266_AST_in = _t; + match(_t,IDENTIFIER_COLON_OPT); + _t = _t->getFirstChild(); + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp267_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t454; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::except_choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST except_choice_s_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PIPE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t457 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp268_AST_in = _t; + match(_t,PIPE); + _t = _t->getFirstChild(); + except_choice_s(_t); + _t = _retTree; + exception_choice(_t); + _t = _retTree; + _t = __t457; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case OTHERS: + { + exception_choice(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::exception_choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST exception_choice_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + { + compound_name(_t); + _t = _retTree; + break; + } + case OTHERS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp269_AST_in = _t; + match(_t,OTHERS); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::operator_call(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST operator_call_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t466 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp270_AST_in = _t; + match(_t,OPERATOR_SYMBOL); + _t = _t->getFirstChild(); + value_s(_t); + _t = _retTree; + _t = __t466; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::relation(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST relation_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IN: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t478 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp271_AST_in = _t; + match(_t,IN); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + range_or_mark(_t); + _t = _retTree; + _t = __t478; + _t = _t->getNextSibling(); + break; + } + case NOT_IN: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t479 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp272_AST_in = _t; + match(_t,NOT_IN); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + range_or_mark(_t); + _t = _retTree; + _t = __t479; + _t = _t->getNextSibling(); + break; + } + case EQ: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t480 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp273_AST_in = _t; + match(_t,EQ); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t480; + _t = _t->getNextSibling(); + break; + } + case NE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t481 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp274_AST_in = _t; + match(_t,NE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t481; + _t = _t->getNextSibling(); + break; + } + case LT_: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t482 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp275_AST_in = _t; + match(_t,LT_); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t482; + _t = _t->getNextSibling(); + break; + } + case LE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t483 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp276_AST_in = _t; + match(_t,LE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t483; + _t = _t->getNextSibling(); + break; + } + case GT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t484 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp277_AST_in = _t; + match(_t,GT); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t484; + _t = _t->getNextSibling(); + break; + } + case GE: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t485 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp278_AST_in = _t; + match(_t,GE); + _t = _t->getFirstChild(); + simple_expression(_t); + _t = _retTree; + simple_expression(_t); + _t = _retTree; + _t = __t485; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case PLUS: + case MINUS: + case CONCAT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + case UNARY_MINUS: + case UNARY_PLUS: + { + simple_expression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::range_or_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST range_or_mark_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOT_DOT: + case RANGE_ATTRIBUTE_REFERENCE: + { + range(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case DOT: + case TIC: + { + subtype_mark(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::signed_term(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST signed_term_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case UNARY_PLUS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t492 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp279_AST_in = _t; + match(_t,UNARY_PLUS); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + _t = __t492; + _t = _t->getNextSibling(); + break; + } + case UNARY_MINUS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t493 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp280_AST_in = _t; + match(_t,UNARY_MINUS); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + _t = __t493; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case MOD: + case NOT: + case STAR: + case DIV: + case REM: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + { + term(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::term(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST term_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case STAR: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t495 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp281_AST_in = _t; + match(_t,STAR); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t495; + _t = _t->getNextSibling(); + break; + } + case DIV: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t496 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp282_AST_in = _t; + match(_t,DIV); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t496; + _t = _t->getNextSibling(); + break; + } + case MOD: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t497 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp283_AST_in = _t; + match(_t,MOD); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t497; + _t = _t->getNextSibling(); + break; + } + case REM: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t498 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp284_AST_in = _t; + match(_t,REM); + _t = _t->getFirstChild(); + term(_t); + _t = _retTree; + factor(_t); + _t = _retTree; + _t = __t498; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NOT: + case ABS: + case EXPON: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + { + factor(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::factor(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST factor_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case NOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t500 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp285_AST_in = _t; + match(_t,NOT); + _t = _t->getFirstChild(); + primary(_t); + _t = _retTree; + _t = __t500; + _t = _t->getNextSibling(); + break; + } + case ABS: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t501 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp286_AST_in = _t; + match(_t,ABS); + _t = _t->getFirstChild(); + primary(_t); + _t = _retTree; + _t = __t501; + _t = _t->getNextSibling(); + break; + } + case EXPON: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t502 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp287_AST_in = _t; + match(_t,EXPON); + _t = _t->getFirstChild(); + primary(_t); + _t = _retTree; + primary(_t); + _t = _retTree; + _t = __t502; + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + case DOT: + case TIC: + case CHARACTER_LITERAL: + case CHAR_STRING: + case NuLL: + case NUMERIC_LIT: + case ALLOCATOR: + case INDEXED_COMPONENT: + case OPERATOR_SYMBOL: + case PARENTHESIZED_PRIMARY: + { + primary(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST primary_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + case DOT: + case TIC: + case INDEXED_COMPONENT: + { + name_or_qualified(_t); + _t = _retTree; + break; + } + case PARENTHESIZED_PRIMARY: + { + parenthesized_primary(_t); + _t = _retTree; + break; + } + case ALLOCATOR: + { + allocator(_t); + _t = _retTree; + break; + } + case NuLL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp288_AST_in = _t; + match(_t,NuLL); + _t = _t->getNextSibling(); + break; + } + case NUMERIC_LIT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp289_AST_in = _t; + match(_t,NUMERIC_LIT); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp290_AST_in = _t; + match(_t,CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + case CHAR_STRING: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp291_AST_in = _t; + match(_t,CHAR_STRING); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + operator_call(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::name_or_qualified(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST name_or_qualified_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp292_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t506 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp293_AST_in = _t; + match(_t,DOT); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case ALL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp294_AST_in = _t; + match(_t,ALL); + _t = _t->getNextSibling(); + break; + } + case IDENTIFIER: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp295_AST_in = _t; + match(_t,IDENTIFIER); + _t = _t->getNextSibling(); + break; + } + case CHARACTER_LITERAL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp296_AST_in = _t; + match(_t,CHARACTER_LITERAL); + _t = _t->getNextSibling(); + break; + } + case OPERATOR_SYMBOL: + { + ANTLR_USE_NAMESPACE(antlr)RefAST tmp297_AST_in = _t; + match(_t,OPERATOR_SYMBOL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t506; + _t = _t->getNextSibling(); + break; + } + case INDEXED_COMPONENT: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t508 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp298_AST_in = _t; + match(_t,INDEXED_COMPONENT); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + value_s(_t); + _t = _retTree; + _t = __t508; + _t = _t->getNextSibling(); + break; + } + case TIC: + { + ANTLR_USE_NAMESPACE(antlr)RefAST __t509 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp299_AST_in = _t; + match(_t,TIC); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + { + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PARENTHESIZED_PRIMARY: + { + parenthesized_primary(_t); + _t = _retTree; + break; + } + case IDENTIFIER: + case RANGE: + case DIGITS: + case DELTA: + case ACCESS: + { + attribute_id(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + _t = __t509; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::allocator(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST allocator_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t512 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp300_AST_in = _t; + match(_t,ALLOCATOR); + _t = _t->getFirstChild(); + name_or_qualified(_t); + _t = _retTree; + _t = __t512; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::subprogram_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST subprogram_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + if (_t == ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROCEDURE_BODY: + { + procedure_body(_t); + _t = _retTree; + break; + } + case FUNCTION_BODY: + { + function_body(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(_t); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::package_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST package_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t518 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp301_AST_in = _t; + match(_t,PACKAGE_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + pkg_body_part(_t); + _t = _retTree; + _t = __t518; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::task_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST task_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t520 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp302_AST_in = _t; + match(_t,TASK_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + body_part(_t); + _t = _retTree; + _t = __t520; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::protected_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t) { + ANTLR_USE_NAMESPACE(antlr)RefAST protected_body_AST_in = (_t == ANTLR_USE_NAMESPACE(antlr)RefAST(ASTNULL)) ? ANTLR_USE_NAMESPACE(antlr)nullAST : _t; + + try { // for error handling + ANTLR_USE_NAMESPACE(antlr)RefAST __t522 = _t; + ANTLR_USE_NAMESPACE(antlr)RefAST tmp303_AST_in = _t; + match(_t,PROTECTED_BODY); + _t = _t->getFirstChild(); + def_id(_t); + _t = _retTree; + prot_op_bodies_opt(_t); + _t = _retTree; + _t = __t522; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != ANTLR_USE_NAMESPACE(antlr)nullAST ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void AdaTreeParserSuper::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& ) +{ +} +const char* AdaTreeParserSuper::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "\"pragma\"", + "IDENTIFIER", + "SEMI", + "LPAREN", + "COMMA", + "RPAREN", + "RIGHT_SHAFT", + "\"with\"", + "DOT", + "\"use\"", + "\"type\"", + "TIC", + "\"range\"", + "\"digits\"", + "\"delta\"", + "\"access\"", + "\"private\"", + "\"package\"", + "\"body\"", + "\"is\"", + "\"procedure\"", + "\"function\"", + "\"new\"", + "\"others\"", + "PIPE", + "DOT_DOT", + "\"all\"", + "COLON", + "\"in\"", + "\"out\"", + "\"renames\"", + "CHARACTER_LITERAL", + "CHAR_STRING", + "\"null\"", + "\"record\"", + "\"separate\"", + "\"abstract\"", + "\"return\"", + "\"task\"", + "\"protected\"", + "BOX", + "ASSIGN", + "\"entry\"", + "\"for\"", + "\"end\"", + "\"at\"", + "\"mod\"", + "\"subtype\"", + "\"exception\"", + "\"constant\"", + "\"array\"", + "\"of\"", + "\"aliased\"", + "\"case\"", + "\"when\"", + "\"tagged\"", + "\"limited\"", + "\"generic\"", + "\"begin\"", + "LT_LT", + "GT_GT", + "\"if\"", + "\"then\"", + "\"elsif\"", + "\"else\"", + "\"loop\"", + "\"while\"", + "\"reverse\"", + "\"declare\"", + "\"exit\"", + "\"goto\"", + "\"accept\"", + "\"do\"", + "\"delay\"", + "\"until\"", + "\"select\"", + "\"abort\"", + "\"or\"", + "\"terminate\"", + "\"raise\"", + "\"requeue\"", + "\"and\"", + "\"xor\"", + "\"not\"", + "EQ", + "NE", + "LT_", + "LE", + "GT", + "GE", + "PLUS", + "MINUS", + "CONCAT", + "STAR", + "DIV", + "\"rem\"", + "\"abs\"", + "EXPON", + "NUMERIC_LIT", + "ABORTABLE_PART", + "ABORT_STATEMENT", + "ACCEPT_ALTERNATIVE", + "ACCEPT_STATEMENT", + "ALLOCATOR", + "ASSIGNMENT_STATEMENT", + "ASYNCHRONOUS_SELECT", + "ATTRIBUTE_DEFINITION_CLAUSE", + "AT_CLAUSE", + "BLOCK_STATEMENT", + "CASE_STATEMENT", + "CASE_STATEMENT_ALTERNATIVE", + "CODE_STATEMENT", + "COMPONENT_DECLARATION", + "CONDITIONAL_ENTRY_CALL", + "CONTEXT_CLAUSE", + "DECLARATIVE_PART", + "DEFINING_IDENTIFIER_LIST", + "DELAY_ALTERNATIVE", + "DELAY_STATEMENT", + "DELTA_CONSTRAINT", + "DIGITS_CONSTRAINT", + "DISCRIMINANT_ASSOCIATION", + "DISCRIMINANT_CONSTRAINT", + "DISCRIMINANT_SPECIFICATION", + "ENTRY_BODY", + "ENTRY_CALL_ALTERNATIVE", + "ENTRY_CALL_STATEMENT", + "ENTRY_DECLARATION", + "ENTRY_INDEX_SPECIFICATION", + "ENUMERATION_REPESENTATION_CLAUSE", + "EXCEPTION_DECLARATION", + "EXCEPTION_HANDLER", + "EXCEPTION_RENAMING_DECLARATION", + "EXIT_STATEMENT", + "FORMAL_PACKAGE_DECLARATION", + "GENERIC_FORMAL_PART", + "GENERIC_PACKAGE_DECLARATION", + "GOTO_STATEMENT", + "HANDLED_SEQUENCE_OF_STATEMENTS", + "HANDLED_STMTS_OPT", + "IF_STATEMENT", + "INCOMPLETE_TYPE_DECLARATION", + "INDEXED_COMPONENT", + "INDEX_CONSTRAINT", + "LIBRARY_ITEM", + "LOOP_STATEMENT", + "NAME", + "NULL_STATEMENT", + "NUMBER_DECLARATION", + "OBJECT_DECLARATION", + "OBJECT_RENAMING_DECLARATION", + "OPERATOR_SYMBOL", + "PACKAGE_BODY", + "PACKAGE_BODY_STUB", + "PACKAGE_RENAMING_DECLARATION", + "PACKAGE_SPECIFICATION", + "PARAMETER_SPECIFICATION", + "PRIVATE_EXTENSION_DECLARATION", + "PRIVATE_TYPE_DECLARATION", + "PROTECTED_BODY", + "PROTECTED_BODY_STUB", + "PROTECTED_TYPE_DECLARATION", + "RAISE_STATEMENT", + "RANGE_ATTRIBUTE_REFERENCE", + "RECORD_REPRESENTATION_CLAUSE", + "REQUEUE_STATEMENT", + "RETURN_STATEMENT", + "SELECTIVE_ACCEPT", + "SEQUENCE_OF_STATEMENTS", + "SINGLE_PROTECTED_DECLARATION", + "SINGLE_TASK_DECLARATION", + "STATEMENT", + "SUBTYPE_DECLARATION", + "SUBTYPE_INDICATION", + "SUBTYPE_MARK", + "SUBUNIT", + "TASK_BODY", + "TASK_BODY_STUB", + "TASK_TYPE_DECLARATION", + "TERMINATE_ALTERNATIVE", + "TIMED_ENTRY_CALL", + "TRIGGERING_ALTERNATIVE", + "USE_CLAUSE", + "USE_TYPE_CLAUSE", + "VARIANT", + "VARIANT_PART", + "WITH_CLAUSE", + "ABSTRACT_FUNCTION_DECLARATION", + "ABSTRACT_PROCEDURE_DECLARATION", + "ACCESS_TO_FUNCTION_DECLARATION", + "ACCESS_TO_OBJECT_DECLARATION", + "ACCESS_TO_PROCEDURE_DECLARATION", + "ARRAY_OBJECT_DECLARATION", + "ARRAY_TYPE_DECLARATION", + "AND_THEN", + "BASIC_DECLARATIVE_ITEMS_OPT", + "BLOCK_BODY", + "BLOCK_BODY_OPT", + "CALL_STATEMENT", + "COMPONENT_CLAUSES_OPT", + "COMPONENT_ITEMS", + "COND_CLAUSE", + "DECIMAL_FIXED_POINT_DECLARATION", + "DECLARE_OPT", + "DERIVED_RECORD_EXTENSION", + "DISCRETE_SUBTYPE_DEF_OPT", + "DISCRIMINANT_SPECIFICATIONS", + "DISCRIM_PART_OPT", + "ELSE_OPT", + "ELSIFS_OPT", + "END_ID_OPT", + "ENTRY_INDEX_OPT", + "ENUMERATION_TYPE_DECLARATION", + "EXCEPT_HANDLER_PART_OPT", + "EXTENSION_OPT", + "FLOATING_POINT_DECLARATION", + "FORMAL_DECIMAL_FIXED_POINT_DECLARATION", + "FORMAL_DISCRETE_TYPE_DECLARATION", + "FORMAL_FLOATING_POINT_DECLARATION", + "FORMAL_FUNCTION_DECLARATION", + "FORMAL_MODULAR_TYPE_DECLARATION", + "FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION", + "FORMAL_ORDINARY_FIXED_POINT_DECLARATION", + "FORMAL_PART_OPT", + "FORMAL_PRIVATE_EXTENSION_DECLARATION", + "FORMAL_PRIVATE_TYPE_DECLARATION", + "FORMAL_PROCEDURE_DECLARATION", + "FORMAL_SIGNED_INTEGER_TYPE_DECLARATION", + "FUNCTION_BODY", + "FUNCTION_BODY_STUB", + "FUNCTION_DECLARATION", + "FUNCTION_RENAMING_DECLARATION", + "GENERIC_FUNCTION_DECLARATION", + "GENERIC_FUNCTION_INSTANTIATION", + "GENERIC_FUNCTION_RENAMING", + "GENERIC_PACKAGE_INSTANTIATION", + "GENERIC_PACKAGE_RENAMING", + "GENERIC_PROCEDURE_DECLARATION", + "GENERIC_PROCEDURE_INSTANTIATION", + "GENERIC_PROCEDURE_RENAMING", + "GUARD_OPT", + "IDENTIFIER_COLON_OPT", + "ID_OPT", + "INIT_OPT", + "ITERATION_SCHEME_OPT", + "LABEL_OPT", + "MARK_WITH_CONSTRAINT", + "MODIFIERS", + "MODULAR_TYPE_DECLARATION", + "MOD_CLAUSE_OPT", + "NOT_IN", + "ORDINARY_DERIVED_TYPE_DECLARATION", + "ORDINARY_FIXED_POINT_DECLARATION", + "OR_ELSE", + "OR_SELECT_OPT", + "PARENTHESIZED_PRIMARY", + "PRIVATE_DECLARATIVE_ITEMS_OPT", + "PRIVATE_TASK_ITEMS_OPT", + "PROCEDURE_BODY", + "PROCEDURE_BODY_STUB", + "PROCEDURE_DECLARATION", + "PROCEDURE_RENAMING_DECLARATION", + "PROT_MEMBER_DECLARATIONS", + "PROT_OP_BODIES_OPT", + "PROT_OP_DECLARATIONS", + "PROT_PRIVATE_OPT", + "RANGED_EXPRS", + "RANGE_CONSTRAINT", + "RECORD_TYPE_DECLARATION", + "SELECTOR_NAMES_OPT", + "SIGNED_INTEGER_TYPE_DECLARATION", + "TASK_ITEMS_OPT", + "UNARY_MINUS", + "UNARY_PLUS", + "VALUE", + "VALUES", + "VARIANTS", + "COMMENT_INTRO", + "OX", + "TIC_OR_CHARACTER_LITERAL", + "DIGIT", + "EXPONENT", + "EXTENDED_DIGIT", + "BASED_INTEGER", + "WS_", + "COMMENT", + "CHARACTER_STRING", + 0 +}; + +const unsigned long AdaTreeParserSuper::_tokenSet_0_data_[] = { 37920UL, 262201UL, 4293001216UL, 2175UL, 134479872UL, 0UL, 64UL, 1073741824UL, 3145738UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER RIGHT_SHAFT DOT TIC "in" CHARACTER_LITERAL CHAR_STRING "null" +// "mod" "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS MINUS CONCAT STAR +// DIV "rem" "abs" EXPON NUMERIC_LIT ALLOCATOR INDEXED_COMPONENT OPERATOR_SYMBOL +// AND_THEN NOT_IN OR_ELSE PARENTHESIZED_PRIMARY UNARY_MINUS UNARY_PLUS +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaTreeParserSuper::_tokenSet_0(_tokenSet_0_data_,20); +const unsigned long AdaTreeParserSuper::_tokenSet_1_data_[] = { 939627552UL, 262201UL, 4293001216UL, 2175UL, 134479872UL, 0UL, 64UL, 1073741824UL, 3145738UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER RIGHT_SHAFT DOT TIC "range" "others" PIPE DOT_DOT "in" CHARACTER_LITERAL +// CHAR_STRING "null" "mod" "or" "and" "xor" "not" EQ NE LT_ LE GT GE PLUS +// MINUS CONCAT STAR DIV "rem" "abs" EXPON NUMERIC_LIT ALLOCATOR INDEXED_COMPONENT +// OPERATOR_SYMBOL AND_THEN NOT_IN OR_ELSE PARENTHESIZED_PRIMARY UNARY_MINUS +// UNARY_PLUS +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaTreeParserSuper::_tokenSet_1(_tokenSet_1_data_,20); +const unsigned long AdaTreeParserSuper::_tokenSet_2_data_[] = { 0UL, 0UL, 0UL, 49152UL, 3338801504UL, 2353094950UL, 151076927UL, 2416967168UL, 328577UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// ATTRIBUTE_DEFINITION_CLAUSE AT_CLAUSE ENUMERATION_REPESENTATION_CLAUSE +// EXCEPTION_DECLARATION EXCEPTION_RENAMING_DECLARATION GENERIC_PACKAGE_DECLARATION +// INCOMPLETE_TYPE_DECLARATION NUMBER_DECLARATION OBJECT_DECLARATION OBJECT_RENAMING_DECLARATION +// PACKAGE_RENAMING_DECLARATION PACKAGE_SPECIFICATION PRIVATE_EXTENSION_DECLARATION +// PRIVATE_TYPE_DECLARATION PROTECTED_TYPE_DECLARATION RECORD_REPRESENTATION_CLAUSE +// SINGLE_PROTECTED_DECLARATION SINGLE_TASK_DECLARATION SUBTYPE_DECLARATION +// TASK_TYPE_DECLARATION USE_CLAUSE USE_TYPE_CLAUSE ABSTRACT_FUNCTION_DECLARATION +// ABSTRACT_PROCEDURE_DECLARATION ACCESS_TO_FUNCTION_DECLARATION ACCESS_TO_OBJECT_DECLARATION +// ACCESS_TO_PROCEDURE_DECLARATION ARRAY_OBJECT_DECLARATION ARRAY_TYPE_DECLARATION +// DECIMAL_FIXED_POINT_DECLARATION DERIVED_RECORD_EXTENSION ENUMERATION_TYPE_DECLARATION +// FLOATING_POINT_DECLARATION FUNCTION_BODY_STUB FUNCTION_DECLARATION FUNCTION_RENAMING_DECLARATION +// GENERIC_FUNCTION_DECLARATION GENERIC_FUNCTION_INSTANTIATION GENERIC_FUNCTION_RENAMING +// GENERIC_PACKAGE_INSTANTIATION GENERIC_PACKAGE_RENAMING GENERIC_PROCEDURE_DECLARATION +// GENERIC_PROCEDURE_INSTANTIATION GENERIC_PROCEDURE_RENAMING MODULAR_TYPE_DECLARATION +// ORDINARY_DERIVED_TYPE_DECLARATION ORDINARY_FIXED_POINT_DECLARATION PROCEDURE_BODY_STUB +// PROCEDURE_DECLARATION PROCEDURE_RENAMING_DECLARATION RECORD_TYPE_DECLARATION +// SIGNED_INTEGER_TYPE_DECLARATION +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaTreeParserSuper::_tokenSet_2(_tokenSet_2_data_,20); +const unsigned long AdaTreeParserSuper::_tokenSet_3_data_[] = { 16UL, 0UL, 0UL, 49152UL, 40UL, 256UL, 0UL, 1024UL, 256UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "pragma" ATTRIBUTE_DEFINITION_CLAUSE AT_CLAUSE ENTRY_DECLARATION ENUMERATION_REPESENTATION_CLAUSE +// RECORD_REPRESENTATION_CLAUSE FUNCTION_DECLARATION PROCEDURE_DECLARATION +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaTreeParserSuper::_tokenSet_3(_tokenSet_3_data_,20); +const unsigned long AdaTreeParserSuper::_tokenSet_4_data_[] = { 36896UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENTIFIER DOT TIC INDEXED_COMPONENT +const ANTLR_USE_NAMESPACE(antlr)BitSet AdaTreeParserSuper::_tokenSet_4(_tokenSet_4_data_,12); + + diff --git a/languages/ada/AdaTreeParserSuper.hpp b/languages/ada/AdaTreeParserSuper.hpp new file mode 100644 index 00000000..a4d164f0 --- /dev/null +++ b/languages/ada/AdaTreeParserSuper.hpp @@ -0,0 +1,241 @@ +#ifndef INC_AdaTreeParserSuper_hpp_ +#define INC_AdaTreeParserSuper_hpp_ + +#include +#include "AdaTreeParserSuperTokenTypes.hpp" +/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuper.hpp"$ */ +#include + +class CUSTOM_API AdaTreeParserSuper : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public AdaTreeParserSuperTokenTypes +{ +#line 1 "ada.tree.g" +#line 13 "AdaTreeParserSuper.hpp" +public: + AdaTreeParserSuper(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return AdaTreeParserSuper::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return AdaTreeParserSuper::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return AdaTreeParserSuper::tokenNames; + } + public: void compilation_unit(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void context_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void library_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subunit(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pragma(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pragma_arg(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void with_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void use_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void compound_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subtype_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void attribute_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void modifiers(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprog_decl_or_rename_or_inst_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void def_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pkg_body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_inst(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pkg_spec_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void renames(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void def_designator(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void end_id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprog_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void function_tail(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void value_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void value(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void ranged_expr_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void ranged_expr(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void simple_expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_dots(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_attrib_ref(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prefix(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void parameter_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void defining_identifier_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void init_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void definable_operator_symbol(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void parenthesized_primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void extension_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void spec_decl_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void basic_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void private_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void basic_decl_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void decl_common(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrim_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_definition_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void private_task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_specifications(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entrydecls_repspecs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void rep_spec(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_subtype_def_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_subtype_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subtype_ind(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void align_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void comp_loc_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void local_enum_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void enumeration_aggregate(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void protected_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_private_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_member_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_op_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_op_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void comp_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void component_subtype_def(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void enum_id_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void id_and_discrim(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void record_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void array_type_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void enumeration_literal_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void index_or_discrete_range_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void index_or_discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void digits_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void delta_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void index_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_association(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void selector_names_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void selector_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void component_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void component_items(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void variant_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_direct_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void variant_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void variant(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_with_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void mark_with_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_formal_parameter(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void id_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprogram_default_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_package_actual_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void procedure_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void function_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void declarative_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void block_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void declarative_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_op_bodies_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void block_body_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void handled_stmt_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprog_decl_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void except_handler_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void handled_stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void statement(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void def_label_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void null_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void exit_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void return_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void goto_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void delay_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void abort_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void raise_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void requeue_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void accept_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void select_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void if_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void case_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void loop_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void block(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void call_or_assignment(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void cond_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void elsifs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void else_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void condition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void alternative_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void case_statement_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void iteration_scheme_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void declare_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void label_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_body_formal_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_barrier(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_index_spec_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_call_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_index_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void triggering_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void abortable_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void selective_accept(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_call_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void delay_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void guard_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void select_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void or_select_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void accept_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void exception_handler(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void identifier_colon_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void except_choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void exception_choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void operator_call(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void relation(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_or_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void signed_term(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void term(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void factor(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void name_or_qualified(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void allocator(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprogram_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void package_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void protected_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return returnAST; + } + +protected: + ANTLR_USE_NAMESPACE(antlr)RefAST returnAST; + ANTLR_USE_NAMESPACE(antlr)RefAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 291; +#else + enum { + NUM_TOKENS = 291 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_AdaTreeParserSuper_hpp_*/ diff --git a/languages/ada/AdaTreeParserSuperTokenTypes.hpp b/languages/ada/AdaTreeParserSuperTokenTypes.hpp new file mode 100644 index 00000000..924b7415 --- /dev/null +++ b/languages/ada/AdaTreeParserSuperTokenTypes.hpp @@ -0,0 +1,307 @@ +#ifndef INC_AdaTreeParserSuperTokenTypes_hpp_ +#define INC_AdaTreeParserSuperTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuperTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API AdaTreeParserSuperTokenTypes { +#endif + enum { + EOF_ = 1, + PRAGMA = 4, + IDENTIFIER = 5, + SEMI = 6, + LPAREN = 7, + COMMA = 8, + RPAREN = 9, + RIGHT_SHAFT = 10, + WITH = 11, + DOT = 12, + USE = 13, + TYPE = 14, + TIC = 15, + RANGE = 16, + DIGITS = 17, + DELTA = 18, + ACCESS = 19, + PRIVATE = 20, + PACKAGE = 21, + BODY = 22, + IS = 23, + PROCEDURE = 24, + FUNCTION = 25, + NEW = 26, + OTHERS = 27, + PIPE = 28, + DOT_DOT = 29, + ALL = 30, + COLON = 31, + IN = 32, + OUT = 33, + RENAMES = 34, + CHARACTER_LITERAL = 35, + CHAR_STRING = 36, + NuLL = 37, + RECORD = 38, + SEPARATE = 39, + ABSTRACT = 40, + RETURN = 41, + TASK = 42, + PROTECTED = 43, + BOX = 44, + ASSIGN = 45, + ENTRY = 46, + FOR = 47, + END = 48, + AT = 49, + MOD = 50, + SUBTYPE = 51, + EXCEPTION = 52, + CONSTANT = 53, + ARRAY = 54, + OF = 55, + ALIASED = 56, + CASE = 57, + WHEN = 58, + TAGGED = 59, + LIMITED = 60, + GENERIC = 61, + BEGIN = 62, + LT_LT = 63, + GT_GT = 64, + IF = 65, + THEN = 66, + ELSIF = 67, + ELSE = 68, + LOOP = 69, + WHILE = 70, + REVERSE = 71, + DECLARE = 72, + EXIT = 73, + GOTO = 74, + ACCEPT = 75, + DO = 76, + DELAY = 77, + UNTIL = 78, + SELECT = 79, + ABORT = 80, + OR = 81, + TERMINATE = 82, + RAISE = 83, + REQUEUE = 84, + AND = 85, + XOR = 86, + NOT = 87, + EQ = 88, + NE = 89, + LT_ = 90, + LE = 91, + GT = 92, + GE = 93, + PLUS = 94, + MINUS = 95, + CONCAT = 96, + STAR = 97, + DIV = 98, + REM = 99, + ABS = 100, + EXPON = 101, + NUMERIC_LIT = 102, + ABORTABLE_PART = 103, + ABORT_STATEMENT = 104, + ACCEPT_ALTERNATIVE = 105, + ACCEPT_STATEMENT = 106, + ALLOCATOR = 107, + ASSIGNMENT_STATEMENT = 108, + ASYNCHRONOUS_SELECT = 109, + ATTRIBUTE_DEFINITION_CLAUSE = 110, + AT_CLAUSE = 111, + BLOCK_STATEMENT = 112, + CASE_STATEMENT = 113, + CASE_STATEMENT_ALTERNATIVE = 114, + CODE_STATEMENT = 115, + COMPONENT_DECLARATION = 116, + CONDITIONAL_ENTRY_CALL = 117, + CONTEXT_CLAUSE = 118, + DECLARATIVE_PART = 119, + DEFINING_IDENTIFIER_LIST = 120, + DELAY_ALTERNATIVE = 121, + DELAY_STATEMENT = 122, + DELTA_CONSTRAINT = 123, + DIGITS_CONSTRAINT = 124, + DISCRIMINANT_ASSOCIATION = 125, + DISCRIMINANT_CONSTRAINT = 126, + DISCRIMINANT_SPECIFICATION = 127, + ENTRY_BODY = 128, + ENTRY_CALL_ALTERNATIVE = 129, + ENTRY_CALL_STATEMENT = 130, + ENTRY_DECLARATION = 131, + ENTRY_INDEX_SPECIFICATION = 132, + ENUMERATION_REPESENTATION_CLAUSE = 133, + EXCEPTION_DECLARATION = 134, + EXCEPTION_HANDLER = 135, + EXCEPTION_RENAMING_DECLARATION = 136, + EXIT_STATEMENT = 137, + FORMAL_PACKAGE_DECLARATION = 138, + GENERIC_FORMAL_PART = 139, + GENERIC_PACKAGE_DECLARATION = 140, + GOTO_STATEMENT = 141, + HANDLED_SEQUENCE_OF_STATEMENTS = 142, + HANDLED_STMTS_OPT = 143, + IF_STATEMENT = 144, + INCOMPLETE_TYPE_DECLARATION = 145, + INDEXED_COMPONENT = 146, + INDEX_CONSTRAINT = 147, + LIBRARY_ITEM = 148, + LOOP_STATEMENT = 149, + NAME = 150, + NULL_STATEMENT = 151, + NUMBER_DECLARATION = 152, + OBJECT_DECLARATION = 153, + OBJECT_RENAMING_DECLARATION = 154, + OPERATOR_SYMBOL = 155, + PACKAGE_BODY = 156, + PACKAGE_BODY_STUB = 157, + PACKAGE_RENAMING_DECLARATION = 158, + PACKAGE_SPECIFICATION = 159, + PARAMETER_SPECIFICATION = 160, + PRIVATE_EXTENSION_DECLARATION = 161, + PRIVATE_TYPE_DECLARATION = 162, + PROTECTED_BODY = 163, + PROTECTED_BODY_STUB = 164, + PROTECTED_TYPE_DECLARATION = 165, + RAISE_STATEMENT = 166, + RANGE_ATTRIBUTE_REFERENCE = 167, + RECORD_REPRESENTATION_CLAUSE = 168, + REQUEUE_STATEMENT = 169, + RETURN_STATEMENT = 170, + SELECTIVE_ACCEPT = 171, + SEQUENCE_OF_STATEMENTS = 172, + SINGLE_PROTECTED_DECLARATION = 173, + SINGLE_TASK_DECLARATION = 174, + STATEMENT = 175, + SUBTYPE_DECLARATION = 176, + SUBTYPE_INDICATION = 177, + SUBTYPE_MARK = 178, + SUBUNIT = 179, + TASK_BODY = 180, + TASK_BODY_STUB = 181, + TASK_TYPE_DECLARATION = 182, + TERMINATE_ALTERNATIVE = 183, + TIMED_ENTRY_CALL = 184, + TRIGGERING_ALTERNATIVE = 185, + USE_CLAUSE = 186, + USE_TYPE_CLAUSE = 187, + VARIANT = 188, + VARIANT_PART = 189, + WITH_CLAUSE = 190, + ABSTRACT_FUNCTION_DECLARATION = 191, + ABSTRACT_PROCEDURE_DECLARATION = 192, + ACCESS_TO_FUNCTION_DECLARATION = 193, + ACCESS_TO_OBJECT_DECLARATION = 194, + ACCESS_TO_PROCEDURE_DECLARATION = 195, + ARRAY_OBJECT_DECLARATION = 196, + ARRAY_TYPE_DECLARATION = 197, + AND_THEN = 198, + BASIC_DECLARATIVE_ITEMS_OPT = 199, + BLOCK_BODY = 200, + BLOCK_BODY_OPT = 201, + CALL_STATEMENT = 202, + COMPONENT_CLAUSES_OPT = 203, + COMPONENT_ITEMS = 204, + COND_CLAUSE = 205, + DECIMAL_FIXED_POINT_DECLARATION = 206, + DECLARE_OPT = 207, + DERIVED_RECORD_EXTENSION = 208, + DISCRETE_SUBTYPE_DEF_OPT = 209, + DISCRIMINANT_SPECIFICATIONS = 210, + DISCRIM_PART_OPT = 211, + ELSE_OPT = 212, + ELSIFS_OPT = 213, + END_ID_OPT = 214, + ENTRY_INDEX_OPT = 215, + ENUMERATION_TYPE_DECLARATION = 216, + EXCEPT_HANDLER_PART_OPT = 217, + EXTENSION_OPT = 218, + FLOATING_POINT_DECLARATION = 219, + FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, + FORMAL_DISCRETE_TYPE_DECLARATION = 221, + FORMAL_FLOATING_POINT_DECLARATION = 222, + FORMAL_FUNCTION_DECLARATION = 223, + FORMAL_MODULAR_TYPE_DECLARATION = 224, + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, + FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, + FORMAL_PART_OPT = 227, + FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, + FORMAL_PRIVATE_TYPE_DECLARATION = 229, + FORMAL_PROCEDURE_DECLARATION = 230, + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, + FUNCTION_BODY = 232, + FUNCTION_BODY_STUB = 233, + FUNCTION_DECLARATION = 234, + FUNCTION_RENAMING_DECLARATION = 235, + GENERIC_FUNCTION_DECLARATION = 236, + GENERIC_FUNCTION_INSTANTIATION = 237, + GENERIC_FUNCTION_RENAMING = 238, + GENERIC_PACKAGE_INSTANTIATION = 239, + GENERIC_PACKAGE_RENAMING = 240, + GENERIC_PROCEDURE_DECLARATION = 241, + GENERIC_PROCEDURE_INSTANTIATION = 242, + GENERIC_PROCEDURE_RENAMING = 243, + GUARD_OPT = 244, + IDENTIFIER_COLON_OPT = 245, + ID_OPT = 246, + INIT_OPT = 247, + ITERATION_SCHEME_OPT = 248, + LABEL_OPT = 249, + MARK_WITH_CONSTRAINT = 250, + MODIFIERS = 251, + MODULAR_TYPE_DECLARATION = 252, + MOD_CLAUSE_OPT = 253, + NOT_IN = 254, + ORDINARY_DERIVED_TYPE_DECLARATION = 255, + ORDINARY_FIXED_POINT_DECLARATION = 256, + OR_ELSE = 257, + OR_SELECT_OPT = 258, + PARENTHESIZED_PRIMARY = 259, + PRIVATE_DECLARATIVE_ITEMS_OPT = 260, + PRIVATE_TASK_ITEMS_OPT = 261, + PROCEDURE_BODY = 262, + PROCEDURE_BODY_STUB = 263, + PROCEDURE_DECLARATION = 264, + PROCEDURE_RENAMING_DECLARATION = 265, + PROT_MEMBER_DECLARATIONS = 266, + PROT_OP_BODIES_OPT = 267, + PROT_OP_DECLARATIONS = 268, + PROT_PRIVATE_OPT = 269, + RANGED_EXPRS = 270, + RANGE_CONSTRAINT = 271, + RECORD_TYPE_DECLARATION = 272, + SELECTOR_NAMES_OPT = 273, + SIGNED_INTEGER_TYPE_DECLARATION = 274, + TASK_ITEMS_OPT = 275, + UNARY_MINUS = 276, + UNARY_PLUS = 277, + VALUE = 278, + VALUES = 279, + VARIANTS = 280, + COMMENT_INTRO = 281, + OX = 282, + TIC_OR_CHARACTER_LITERAL = 283, + DIGIT = 284, + EXPONENT = 285, + EXTENDED_DIGIT = 286, + BASED_INTEGER = 287, + WS_ = 288, + COMMENT = 289, + CHARACTER_STRING = 290, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_AdaTreeParserSuperTokenTypes_hpp_*/ diff --git a/languages/ada/AdaTreeParserSuperTokenTypes.txt b/languages/ada/AdaTreeParserSuperTokenTypes.txt new file mode 100644 index 00000000..dfd0b0df --- /dev/null +++ b/languages/ada/AdaTreeParserSuperTokenTypes.txt @@ -0,0 +1,289 @@ +// $ANTLR 2.7.7 (20070609): ada.tree.g -> AdaTreeParserSuperTokenTypes.txt$ +AdaTreeParserSuper // output token vocab name +PRAGMA="pragma"=4 +IDENTIFIER=5 +SEMI=6 +LPAREN=7 +COMMA=8 +RPAREN=9 +RIGHT_SHAFT=10 +WITH="with"=11 +DOT=12 +USE="use"=13 +TYPE="type"=14 +TIC=15 +RANGE="range"=16 +DIGITS="digits"=17 +DELTA="delta"=18 +ACCESS="access"=19 +PRIVATE="private"=20 +PACKAGE="package"=21 +BODY="body"=22 +IS="is"=23 +PROCEDURE="procedure"=24 +FUNCTION="function"=25 +NEW="new"=26 +OTHERS="others"=27 +PIPE=28 +DOT_DOT=29 +ALL="all"=30 +COLON=31 +IN="in"=32 +OUT="out"=33 +RENAMES="renames"=34 +CHARACTER_LITERAL=35 +CHAR_STRING=36 +NuLL="null"=37 +RECORD="record"=38 +SEPARATE="separate"=39 +ABSTRACT="abstract"=40 +RETURN="return"=41 +TASK="task"=42 +PROTECTED="protected"=43 +BOX=44 +ASSIGN=45 +ENTRY="entry"=46 +FOR="for"=47 +END="end"=48 +AT="at"=49 +MOD="mod"=50 +SUBTYPE="subtype"=51 +EXCEPTION="exception"=52 +CONSTANT="constant"=53 +ARRAY="array"=54 +OF="of"=55 +ALIASED="aliased"=56 +CASE="case"=57 +WHEN="when"=58 +TAGGED="tagged"=59 +LIMITED="limited"=60 +GENERIC="generic"=61 +BEGIN="begin"=62 +LT_LT=63 +GT_GT=64 +IF="if"=65 +THEN="then"=66 +ELSIF="elsif"=67 +ELSE="else"=68 +LOOP="loop"=69 +WHILE="while"=70 +REVERSE="reverse"=71 +DECLARE="declare"=72 +EXIT="exit"=73 +GOTO="goto"=74 +ACCEPT="accept"=75 +DO="do"=76 +DELAY="delay"=77 +UNTIL="until"=78 +SELECT="select"=79 +ABORT="abort"=80 +OR="or"=81 +TERMINATE="terminate"=82 +RAISE="raise"=83 +REQUEUE="requeue"=84 +AND="and"=85 +XOR="xor"=86 +NOT="not"=87 +EQ=88 +NE=89 +LT_=90 +LE=91 +GT=92 +GE=93 +PLUS=94 +MINUS=95 +CONCAT=96 +STAR=97 +DIV=98 +REM="rem"=99 +ABS="abs"=100 +EXPON=101 +NUMERIC_LIT=102 +ABORTABLE_PART=103 +ABORT_STATEMENT=104 +ACCEPT_ALTERNATIVE=105 +ACCEPT_STATEMENT=106 +ALLOCATOR=107 +ASSIGNMENT_STATEMENT=108 +ASYNCHRONOUS_SELECT=109 +ATTRIBUTE_DEFINITION_CLAUSE=110 +AT_CLAUSE=111 +BLOCK_STATEMENT=112 +CASE_STATEMENT=113 +CASE_STATEMENT_ALTERNATIVE=114 +CODE_STATEMENT=115 +COMPONENT_DECLARATION=116 +CONDITIONAL_ENTRY_CALL=117 +CONTEXT_CLAUSE=118 +DECLARATIVE_PART=119 +DEFINING_IDENTIFIER_LIST=120 +DELAY_ALTERNATIVE=121 +DELAY_STATEMENT=122 +DELTA_CONSTRAINT=123 +DIGITS_CONSTRAINT=124 +DISCRIMINANT_ASSOCIATION=125 +DISCRIMINANT_CONSTRAINT=126 +DISCRIMINANT_SPECIFICATION=127 +ENTRY_BODY=128 +ENTRY_CALL_ALTERNATIVE=129 +ENTRY_CALL_STATEMENT=130 +ENTRY_DECLARATION=131 +ENTRY_INDEX_SPECIFICATION=132 +ENUMERATION_REPESENTATION_CLAUSE=133 +EXCEPTION_DECLARATION=134 +EXCEPTION_HANDLER=135 +EXCEPTION_RENAMING_DECLARATION=136 +EXIT_STATEMENT=137 +FORMAL_PACKAGE_DECLARATION=138 +GENERIC_FORMAL_PART=139 +GENERIC_PACKAGE_DECLARATION=140 +GOTO_STATEMENT=141 +HANDLED_SEQUENCE_OF_STATEMENTS=142 +HANDLED_STMTS_OPT=143 +IF_STATEMENT=144 +INCOMPLETE_TYPE_DECLARATION=145 +INDEXED_COMPONENT=146 +INDEX_CONSTRAINT=147 +LIBRARY_ITEM=148 +LOOP_STATEMENT=149 +NAME=150 +NULL_STATEMENT=151 +NUMBER_DECLARATION=152 +OBJECT_DECLARATION=153 +OBJECT_RENAMING_DECLARATION=154 +OPERATOR_SYMBOL=155 +PACKAGE_BODY=156 +PACKAGE_BODY_STUB=157 +PACKAGE_RENAMING_DECLARATION=158 +PACKAGE_SPECIFICATION=159 +PARAMETER_SPECIFICATION=160 +PRIVATE_EXTENSION_DECLARATION=161 +PRIVATE_TYPE_DECLARATION=162 +PROTECTED_BODY=163 +PROTECTED_BODY_STUB=164 +PROTECTED_TYPE_DECLARATION=165 +RAISE_STATEMENT=166 +RANGE_ATTRIBUTE_REFERENCE=167 +RECORD_REPRESENTATION_CLAUSE=168 +REQUEUE_STATEMENT=169 +RETURN_STATEMENT=170 +SELECTIVE_ACCEPT=171 +SEQUENCE_OF_STATEMENTS=172 +SINGLE_PROTECTED_DECLARATION=173 +SINGLE_TASK_DECLARATION=174 +STATEMENT=175 +SUBTYPE_DECLARATION=176 +SUBTYPE_INDICATION=177 +SUBTYPE_MARK=178 +SUBUNIT=179 +TASK_BODY=180 +TASK_BODY_STUB=181 +TASK_TYPE_DECLARATION=182 +TERMINATE_ALTERNATIVE=183 +TIMED_ENTRY_CALL=184 +TRIGGERING_ALTERNATIVE=185 +USE_CLAUSE=186 +USE_TYPE_CLAUSE=187 +VARIANT=188 +VARIANT_PART=189 +WITH_CLAUSE=190 +ABSTRACT_FUNCTION_DECLARATION=191 +ABSTRACT_PROCEDURE_DECLARATION=192 +ACCESS_TO_FUNCTION_DECLARATION=193 +ACCESS_TO_OBJECT_DECLARATION=194 +ACCESS_TO_PROCEDURE_DECLARATION=195 +ARRAY_OBJECT_DECLARATION=196 +ARRAY_TYPE_DECLARATION=197 +AND_THEN=198 +BASIC_DECLARATIVE_ITEMS_OPT=199 +BLOCK_BODY=200 +BLOCK_BODY_OPT=201 +CALL_STATEMENT=202 +COMPONENT_CLAUSES_OPT=203 +COMPONENT_ITEMS=204 +COND_CLAUSE=205 +DECIMAL_FIXED_POINT_DECLARATION=206 +DECLARE_OPT=207 +DERIVED_RECORD_EXTENSION=208 +DISCRETE_SUBTYPE_DEF_OPT=209 +DISCRIMINANT_SPECIFICATIONS=210 +DISCRIM_PART_OPT=211 +ELSE_OPT=212 +ELSIFS_OPT=213 +END_ID_OPT=214 +ENTRY_INDEX_OPT=215 +ENUMERATION_TYPE_DECLARATION=216 +EXCEPT_HANDLER_PART_OPT=217 +EXTENSION_OPT=218 +FLOATING_POINT_DECLARATION=219 +FORMAL_DECIMAL_FIXED_POINT_DECLARATION=220 +FORMAL_DISCRETE_TYPE_DECLARATION=221 +FORMAL_FLOATING_POINT_DECLARATION=222 +FORMAL_FUNCTION_DECLARATION=223 +FORMAL_MODULAR_TYPE_DECLARATION=224 +FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION=225 +FORMAL_ORDINARY_FIXED_POINT_DECLARATION=226 +FORMAL_PART_OPT=227 +FORMAL_PRIVATE_EXTENSION_DECLARATION=228 +FORMAL_PRIVATE_TYPE_DECLARATION=229 +FORMAL_PROCEDURE_DECLARATION=230 +FORMAL_SIGNED_INTEGER_TYPE_DECLARATION=231 +FUNCTION_BODY=232 +FUNCTION_BODY_STUB=233 +FUNCTION_DECLARATION=234 +FUNCTION_RENAMING_DECLARATION=235 +GENERIC_FUNCTION_DECLARATION=236 +GENERIC_FUNCTION_INSTANTIATION=237 +GENERIC_FUNCTION_RENAMING=238 +GENERIC_PACKAGE_INSTANTIATION=239 +GENERIC_PACKAGE_RENAMING=240 +GENERIC_PROCEDURE_DECLARATION=241 +GENERIC_PROCEDURE_INSTANTIATION=242 +GENERIC_PROCEDURE_RENAMING=243 +GUARD_OPT=244 +IDENTIFIER_COLON_OPT=245 +ID_OPT=246 +INIT_OPT=247 +ITERATION_SCHEME_OPT=248 +LABEL_OPT=249 +MARK_WITH_CONSTRAINT=250 +MODIFIERS=251 +MODULAR_TYPE_DECLARATION=252 +MOD_CLAUSE_OPT=253 +NOT_IN=254 +ORDINARY_DERIVED_TYPE_DECLARATION=255 +ORDINARY_FIXED_POINT_DECLARATION=256 +OR_ELSE=257 +OR_SELECT_OPT=258 +PARENTHESIZED_PRIMARY=259 +PRIVATE_DECLARATIVE_ITEMS_OPT=260 +PRIVATE_TASK_ITEMS_OPT=261 +PROCEDURE_BODY=262 +PROCEDURE_BODY_STUB=263 +PROCEDURE_DECLARATION=264 +PROCEDURE_RENAMING_DECLARATION=265 +PROT_MEMBER_DECLARATIONS=266 +PROT_OP_BODIES_OPT=267 +PROT_OP_DECLARATIONS=268 +PROT_PRIVATE_OPT=269 +RANGED_EXPRS=270 +RANGE_CONSTRAINT=271 +RECORD_TYPE_DECLARATION=272 +SELECTOR_NAMES_OPT=273 +SIGNED_INTEGER_TYPE_DECLARATION=274 +TASK_ITEMS_OPT=275 +UNARY_MINUS=276 +UNARY_PLUS=277 +VALUE=278 +VALUES=279 +VARIANTS=280 +COMMENT_INTRO=281 +OX=282 +TIC_OR_CHARACTER_LITERAL=283 +DIGIT=284 +EXPONENT=285 +EXTENDED_DIGIT=286 +BASED_INTEGER=287 +WS_=288 +COMMENT=289 +CHARACTER_STRING=290 diff --git a/languages/ada/Makefile.am b/languages/ada/Makefile.am new file mode 100644 index 00000000..4a7eb0c1 --- /dev/null +++ b/languages/ada/Makefile.am @@ -0,0 +1,41 @@ +# Here resides the Ada support part. +KDE_CXXFLAGS = $(USE_EXCEPTIONS) + +INCLUDES = -I$(top_srcdir)/lib/antlr -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + $(all_includes) +SUBDIRS = app_templates file_templates doc + + +kde_module_LTLIBRARIES = libkdevadasupport.la +libkdevadasupport_la_LDFLAGS = $(LEXLIB) $(all_libraries) $(KDE_PLUGIN) +libkdevadasupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/antlr/src/libantlr.la + +libkdevadasupport_la_SOURCES = adasupportpart.cpp problemreporter.cpp backgroundparser.cpp addclassdlg.ui addclass.cpp configproblemreporter.ui ada_utils.cpp adasupport.cpp AdaLexer.cpp AdaParser.cpp AdaTreeParserSuper.cpp AdaStoreWalker.cpp + +METASOURCES = AUTO + +EXTRA_DIST = ada.g ada.tree.g ada.store.g + +## The following three rules assume that you have Java installed, +## ANTLR installed, and you have the antlr jar in your CLASSPATH. + +#AdaLexer.hpp AdaLexer.cpp AdaParser.hpp AdaParser.cpp: ada.g +# antlr ada.g + +#AdaTreeParserSuper.hpp AdaTreeParserSuper.cpp: ada.tree.g +# antlr ada.tree.g + +#AdaStoreWalker.hpp AdaStoreWalker.cpp: ada.store.g +# antlr -glib ada.tree.g ada.store.g + +genparser: + antlr ada.g && antlr ada.tree.g && antlr -glib ada.tree.g ada.store.g + +servicedir = $(kde_servicesdir) +service_DATA = kdevadasupport.desktop + +rcdir = $(kde_datadir)/kdevadasupport +rc_DATA = kdevadasupport.rc + +KDE_OPTIONS = nofinal diff --git a/languages/ada/README b/languages/ada/README new file mode 100644 index 00000000..0146b60f --- /dev/null +++ b/languages/ada/README @@ -0,0 +1 @@ +Please read the README.dox file. \ No newline at end of file diff --git a/languages/ada/README.dox b/languages/ada/README.dox new file mode 100644 index 00000000..e71e6d45 --- /dev/null +++ b/languages/ada/README.dox @@ -0,0 +1,31 @@ +/** \class AdaSupportPart +Ada Language Support + +The ANTLR Ada core support files are: + - ada.g -- contains AdaLexer and AdaParser, requires AdaAST.hpp and adasupport.cpp + - ada.tree.g -- contains the AdaTreeParserSuper + - AdaAST.hpp -- definition of the AST node used by ada.g + - adasupport.hpp -- general purpose utilities + - adasupport.cpp -- implementation of general purpose utilities and implementation of AdaParser class methods from ada.g + +These are ANTLR master files. +They only depend on the ANTLR C++ runtime support and on the C++ STL. +They should be kept free of all other dependencies. +In particular, they do not depend on Kdevelop, KDE, or Qt. + +In order to generate the parser by hand, antlr v2.7.2 is required. +There are parser compilation errors with some gcc versions. To avoid +them, replace file antlr/CppCodeGenerator.java in the antlr source code tree +with the one from ftp://fara.cs.uni-potsdam.de/incoming/CppCodeGenerator.java.gz. + +\unmaintained This part is currently un-maintained. + +\authors Oliver Kellogg +\authors Roberto Raggi +\authors Alexander Dymo + +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +\requirement Ada compiler + +*/ diff --git a/languages/ada/ada.g b/languages/ada/ada.g new file mode 100644 index 00000000..5f97952b --- /dev/null +++ b/languages/ada/ada.g @@ -0,0 +1,1982 @@ +/* + * Ada95 Grammar for ANTLR, target language C++ + * + * Copyright (C) 2003 Oliver M. Kellogg + * Modifications (C) 2005 Daniel Zuberbuehler + * + * Adapted from lexer9x.l/grammar9x.y, + * + ******* A YACC grammar for Ada 9X ********************************* + * Copyright (C) Intermetrics, Inc. 1994 Cambridge, MA USA * + * Copying permitted if accompanied by this statement. * + * Derivative works are permitted if accompanied by this statement.* + * This grammar is thought to be correct as of May 1, 1994 * + * but as usual there is *no warranty* to that effect. * + ******************************************************************* + * + * $Id$ + * + * Not all rules from the Ada95 Reference Manual (RM) Annex P, + * Syntax Summary, are mirrored as rules here. + * The tree nodes follow the RM grammar as closely as sensible. + * This applies in particular to the terminals. OTOH, trivially + * reconstructable non-terminal rules are not reflected in the tree. + * FIXME: Document the exact rationale of the tree design. + * + */ + + +header "pre_include_hpp" { +#include // antlr wants this +#include "AdaAST.hpp" +#include "preambles.h" +} + +options { + language="Cpp"; +} + +//----------------------------------------------------------------------------- +// Define a Parser, calling it AdaParser +//----------------------------------------------------------------------------- +class AdaParser extends Parser; +options { + k = 2; // token lookahead + exportVocab=Ada; // Call its vocabulary "Ada" + // codeGenMakeSwitchThreshold = 2; // Some optimizations + // codeGenBitsetTestThreshold = 3; + defaultErrorHandler = false; // Generate parser error handlers + buildAST = true; + ASTLabelType = "RefAdaAST"; +} + +{ + ANTLR_PARSER_PREAMBLE + +public: + // Ada support stuff + void push_def_id (const RefAdaAST& defid); + const RefAdaAST& pop_def_id (); + bool end_id_matches_def_id (const RefAdaAST& endid); + bool definable_operator (const char *string); // operator_symbol sans "/=" + bool is_operator_symbol (const char *string); +} + +// Compilation Unit: This is the start rule for this parser. +// The rules in this grammar are listed in the order in which +// compilation_unit introduces them, depth first, with the +// exception of the expression related rules which are listed +// towards the end. +compilation_unit + : context_items_opt ( library_item | subunit ) ( pragma )* + ; + +// The pragma related rules are pulled up here to get them out of the way. + +pragma : PRAGMA^ IDENTIFIER pragma_args_opt SEMI! + ; + +pragma_args_opt : ( LPAREN! pragma_arg ( COMMA! pragma_arg )* RPAREN! )? + ; + +pragma_arg : ( IDENTIFIER RIGHT_SHAFT^ )? expression + ; + +context_items_opt : ( pragma | with_clause | use_clause )* + { #context_items_opt = + #(#[CONTEXT_CLAUSE, "CONTEXT_CLAUSE"], #context_items_opt); } + // RM Annex P neglects pragmas; we include them. + // The node should really be named CONTEXT_ITEMS_OPT but we + // stick with the RM wording. + ; + +with_clause : w:WITH^ c_name_list SEMI! + { Set(#w, WITH_CLAUSE); } + ; + +c_name_list : compound_name ( COMMA! compound_name )* + ; + +compound_name : IDENTIFIER ( DOT^ IDENTIFIER )* + // Strangely, the RM never defines this rule, which however is + // required for tightening up the syntax of certain names + // (library unit names etc.) + ; + +use_clause : u:USE^ + ( TYPE! subtype_mark ( COMMA! subtype_mark )* + { Set(#u, USE_TYPE_CLAUSE); } + | c_name_list { Set(#u, USE_CLAUSE); } + ) + SEMI! + ; + +subtype_mark : compound_name ( TIC^ attribute_id )? + // { #subtype_mark = #(#[SUBTYPE_MARK, "SUBTYPE_MARK"], #subtype_mark); } + ; + +attribute_id : RANGE + | DIGITS + | DELTA + | ACCESS + | IDENTIFIER + ; + +library_item : private_opt + /* Slightly loose; PRIVATE can only precede + {generic|package|subprog}_decl. + Semantic check required to ensure it.*/ + ( lib_pkg_spec_or_body + | subprog_decl_or_rename_or_inst_or_body[true] + | generic_decl[true] + ) + { #library_item = #(#[LIBRARY_ITEM, "LIBRARY_ITEM"], #library_item); } + ; + +private_opt : ( PRIVATE )? + { #private_opt = #(#[MODIFIERS, "MODIFIERS"], #private_opt); } + ; + +lib_pkg_spec_or_body + : pkg:PACKAGE^ + ( BODY! def_id[true] IS! pkg_body_part SEMI! + { Set(#pkg, PACKAGE_BODY); } + | def_id[true] spec_decl_part[#pkg] + ) + ; + +subprog_decl [boolean lib_level] + { RefAdaAST t; } + : p:PROCEDURE^ def_id[lib_level] + ( generic_subp_inst + { Set(#p, GENERIC_PROCEDURE_INSTANTIATION); } + | formal_part_opt + ( renames { Set(#p, PROCEDURE_RENAMING_DECLARATION); } + | is_separate_or_abstract_or_decl[#p] + ) + SEMI! + ) + | f:FUNCTION^ def_designator[lib_level] + ( generic_subp_inst + { Set(#f, GENERIC_FUNCTION_INSTANTIATION); } + | function_tail + ( renames { Set(#f, FUNCTION_RENAMING_DECLARATION); } + | is_separate_or_abstract_or_decl[#f] + ) + SEMI! + ) + ; + +def_id [boolean lib_level] + : { lib_level }? cn:compound_name { push_def_id(#cn); } + | { !lib_level }? n:IDENTIFIER { push_def_id(#n); } + ; + +generic_subp_inst : IS! generic_inst SEMI! + ; + +generic_inst : NEW! compound_name ( LPAREN! value_s RPAREN! )? + { pop_def_id(); } + ; + +parenth_values : LPAREN! value ( COMMA! value )* RPAREN! + ; + +value : ( OTHERS^ RIGHT_SHAFT! expression + | ranged_expr_s ( RIGHT_SHAFT^ expression )? + ) + // { #value = #(#[VALUE, "VALUE"], #value); } + ; + +ranged_expr_s : ranged_expr ( PIPE^ ranged_expr )* + // { #ranged_expr_s = + // #(#[RANGED_EXPRS, "RANGED_EXPRS"], #ranged_expr_s); } + ; + +ranged_expr : expression + ( DOT_DOT^ simple_expression + | RANGE^ range + )? + ; + +range_constraint : r:RANGE^ range + { Set(#r, RANGE_CONSTRAINT); } + ; + +range : ( (range_dots) => range_dots + | range_attrib_ref + ) + // Current assumption is we don't need an extra node for range, + // otherwise uncomment the following line: + // { #range = #(#[RANGE_EXPR, "RANGE_EXPR"], #range); } + ; + +range_dots : simple_expression DOT_DOT^ simple_expression + ; + +range_attrib_ref : // "name TIC RANGE" is ambiguous; instead: + prefix TIC! r:RANGE^ ( LPAREN! expression RPAREN! )? + { Set(#r, RANGE_ATTRIBUTE_REFERENCE); } + ; + +// Here, the definition of `prefix' deviates from the RM. +// This gives us some more strictness than `name' (which the RM uses to +// define `prefix'.) +prefix : IDENTIFIER + ( DOT^ ( ALL | IDENTIFIER ) + | p:LPAREN^ value_s RPAREN! + { Set(#p, INDEXED_COMPONENT); } + )* + ; + +formal_part_opt : ( LPAREN! parameter_specification + ( SEMI! parameter_specification )* + RPAREN! )? + { #formal_part_opt = #([FORMAL_PART_OPT, "FORMAL_PART_OPT"], + #formal_part_opt); } + ; + +parameter_specification : def_ids_colon mode_opt subtype_mark init_opt + { #parameter_specification = + #(#[PARAMETER_SPECIFICATION, + "PARAMETER_SPECIFICATION"], #parameter_specification); } + ; + +def_ids_colon : defining_identifier_list COLON! + ; + +defining_identifier_list : IDENTIFIER ( COMMA! IDENTIFIER )* + { #defining_identifier_list = + #(#[DEFINING_IDENTIFIER_LIST, + "DEFINING_IDENTIFIER_LIST"], #defining_identifier_list); } + ; + +mode_opt : ( IN ( OUT )? | OUT | ACCESS )? + { #mode_opt = #(#[MODIFIERS, "MODIFIERS"], #mode_opt); } + ; + +renames { RefAdaAST dummy; } + : RENAMES! ( name + | dummy=definable_operator_symbol + ) + { pop_def_id(); } + ; + +name { RefAdaAST dummy; } + : IDENTIFIER + ( DOT^ ( ALL + | IDENTIFIER + | CHARACTER_LITERAL + | dummy=is_operator + ) + | p:LPAREN^ value_s RPAREN! + { Set(#p, INDEXED_COMPONENT); } + | TIC^ attribute_id // must be in here because of e.g. + // Character'Pos (x) + )* + // { #name = #(#[NAME, "NAME"], #name); } + ; + +is_operator returns [RefAdaAST d] + : { is_operator_symbol(LT(1)->getText().c_str()) }? + op:CHAR_STRING { #op->setType(OPERATOR_SYMBOL); d=#op; } + ; + +definable_operator_symbol returns [RefAdaAST d] + : { definable_operator(LT(1)->getText().c_str()) }? + op:CHAR_STRING { #op->setType(OPERATOR_SYMBOL); d=#op; } + ; + +parenthesized_primary : pp:LPAREN^ + ( NuLL RECORD! + | value_s extension_opt + ) + RPAREN! + { Set(#pp, PARENTHESIZED_PRIMARY); } + ; + +extension_opt : ( WITH! ( NuLL RECORD! | value_s ) )? + { #extension_opt = + #(#[EXTENSION_OPT, "EXTENSION_OPT"], #extension_opt); } + ; + +is_separate_or_abstract_or_decl! [RefAdaAST t] + : IS! separate_or_abstract[t] + | { pop_def_id(); + if (t->getType() == AdaTokenTypes::PROCEDURE) + Set(t, PROCEDURE_DECLARATION); + else + Set(t, FUNCTION_DECLARATION); + } + ; + +separate_or_abstract! [RefAdaAST t] + : SEPARATE! + { pop_def_id(); + if (t->getType() == AdaTokenTypes::PROCEDURE) + Set(t, PROCEDURE_BODY_STUB); + else + Set(t, FUNCTION_BODY_STUB); + } + | ABSTRACT! + { pop_def_id(); + if (t->getType() == AdaTokenTypes::PROCEDURE) + Set(t, ABSTRACT_PROCEDURE_DECLARATION); + else + Set(t, ABSTRACT_FUNCTION_DECLARATION); + } + ; + +def_designator [boolean lib_level] + { RefAdaAST d; } + : { lib_level }? n:compound_name { push_def_id(#n); } + | { !lib_level }? d=designator { push_def_id(d); } + ; + +designator returns [RefAdaAST d] + { RefAdaAST op; } + : op=definable_operator_symbol { d = op; } + | n:IDENTIFIER { d = #n; } + ; + +function_tail : func_formal_part_opt RETURN! subtype_mark + ; + +// formal_part_opt is not strict enough for functions, i.e. it permits +// "in out" and "out" as modes, thus we make an extra rule: +func_formal_part_opt : ( LPAREN! func_param ( SEMI! func_param )* RPAREN! )? + { #func_formal_part_opt = + #([FORMAL_PART_OPT, + "FORMAL_PART_OPT"], #func_formal_part_opt); } + ; + +func_param : def_ids_colon in_access_opt subtype_mark init_opt + { #func_param = + #(#[PARAMETER_SPECIFICATION, + "PARAMETER_SPECIFICATION"], #func_param); } + ; + +in_access_opt : ( IN | ACCESS )? + { #in_access_opt = #(#[MODIFIERS, "MODIFIERS"], #in_access_opt); } + ; + +spec_decl_part [RefAdaAST pkg] + : ( IS! ( generic_inst { Set(pkg, GENERIC_PACKAGE_INSTANTIATION); } + | pkg_spec_part { Set(pkg, PACKAGE_SPECIFICATION); } + ) + | renames { Set(pkg, PACKAGE_RENAMING_DECLARATION); } + ) + SEMI! + ; + +pkg_spec_part : basic_declarative_items_opt + private_declarative_items_opt + end_id_opt + ; + +private_declarative_items_opt : ( PRIVATE! ( basic_decl_item | pragma )* )? + { #private_declarative_items_opt = + #(#[PRIVATE_DECLARATIVE_ITEMS_OPT, + "PRIVATE_DECLARATIVE_ITEMS_OPT"], + #private_declarative_items_opt); } + ; + +basic_declarative_items_opt : ( basic_decl_item | pragma )* + { #basic_declarative_items_opt = + #(#[BASIC_DECLARATIVE_ITEMS_OPT, + "BASIC_DECLARATIVE_ITEMS_OPT"], + #basic_declarative_items_opt); } + ; + +basic_declarative_items : ( basic_decl_item | pragma )+ + { #basic_declarative_items = + #(#[BASIC_DECLARATIVE_ITEMS_OPT, + "BASIC_DECLARATIVE_ITEMS_OPT"], + #basic_declarative_items); } + ; + +basic_decl_item + : pkg:PACKAGE^ def_id[false] spec_decl_part[#pkg] + | tsk:TASK^ task_type_or_single_decl[#tsk] + | pro:PROTECTED^ prot_type_or_single_decl[#pro] SEMI! + | subprog_decl[false] + | decl_common + ; + +task_type_or_single_decl [RefAdaAST tsk] + : TYPE! def_id[false] discrim_part_opt task_definition_opt + { Set(tsk, TASK_TYPE_DECLARATION); } + | def_id[false] task_definition_opt + { Set(tsk, SINGLE_TASK_DECLARATION); } + ; + +task_definition_opt + : IS! task_items_opt private_task_items_opt end_id_opt SEMI! + | SEMI! { pop_def_id(); } + ; + +discrim_part_opt + : ( discrim_part_text )? + { #discrim_part_opt = + #(#[DISCRIM_PART_OPT, + "DISCRIM_PART_OPT"], #discrim_part_opt); } + ; + +discrim_part_text : LPAREN! (BOX | discriminant_specifications) RPAREN! + ; + +known_discrim_part + : LPAREN! discriminant_specifications RPAREN! + { #known_discrim_part = + #(#[DISCRIM_PART_OPT, + "DISCRIM_PART_OPT"], #known_discrim_part); } + ; + +empty_discrim_opt : /* empty */ + { #empty_discrim_opt = + #(#[DISCRIM_PART_OPT, + "DISCRIM_PART_OPT"], #empty_discrim_opt); } + ; + +discrim_part + : discrim_part_text + { #discrim_part = + #(#[DISCRIM_PART_OPT, + "DISCRIM_PART_OPT"], #discrim_part); } + ; + +discriminant_specifications : discriminant_specification + ( SEMI! discriminant_specification )* + { #discriminant_specifications = + #(#[DISCRIMINANT_SPECIFICATIONS, + "DISCRIMINANT_SPECIFICATIONS"], + #discriminant_specifications); } + ; + +discriminant_specification : def_ids_colon access_opt subtype_mark init_opt + { #discriminant_specification = + #(#[DISCRIMINANT_SPECIFICATION, + "DISCRIMINANT_SPECIFICATION"], + #discriminant_specification); } + ; + +access_opt : ( ACCESS )? + { #access_opt = #(#[MODIFIERS, "MODIFIERS"], #access_opt); } + ; + +init_opt : ( ASSIGN! expression )? + { #init_opt = #(#[INIT_OPT, "INIT_OPT"], #init_opt); } + ; // `expression' is of course much too loose; + // semantic checks are required in the usage contexts. + +task_items_opt : ( pragma )* entrydecls_repspecs_opt + { #task_items_opt = + #(#[TASK_ITEMS_OPT, "TASK_ITEMS_OPT"], #task_items_opt); } + ; + +entrydecls_repspecs_opt : ( entry_declaration ( pragma | rep_spec )* )* + ; + +entry_declaration : e:ENTRY^ IDENTIFIER + discrete_subtype_def_opt formal_part_opt SEMI! + { Set (#e, ENTRY_DECLARATION); } + ; + +discrete_subtype_def_opt : ( (LPAREN discrete_subtype_definition RPAREN) => + LPAREN! discrete_subtype_definition RPAREN! + | /* empty */ + ) + { #discrete_subtype_def_opt = + #(#[DISCRETE_SUBTYPE_DEF_OPT, + "DISCRETE_SUBTYPE_DEF_OPT"], #discrete_subtype_def_opt); } + ; + +discrete_subtype_definition : ( (range) => range + | subtype_ind + ) + // Looks alot like discrete_range, but it's not + // (as soon as we start doing semantics.) + /* TBC: No need for extra node, just use the inner nodes? + { #discrete_subtype_definition = + #(#[DISCRETE_SUBTYPE_DEFINITION, + "DISCRETE_SUBTYPE_DEFINITION"], + #discrete_subtype_definition); } + */ + ; + +rep_spec : r:FOR^ subtype_mark USE! rep_spec_part[#r] SEMI! + ; + +rep_spec_part [RefAdaAST t] + : RECORD! align_opt comp_loc_s END! RECORD! // record_type_spec + { Set(t, RECORD_REPRESENTATION_CLAUSE); } + | AT! expression // address_spec (Ada83) + { Set(t, AT_CLAUSE); } + | expression // attrib_def. Semantic check must ensure that the + // respective subtype_mark contains an attribute reference. + { Set(t, ATTRIBUTE_DEFINITION_CLAUSE); } + ; + +align_opt : ( AT! MOD! expression SEMI! )? + { #align_opt = #(#[MOD_CLAUSE_OPT, "MOD_CLAUSE_OPT"], #align_opt); } + ; + +comp_loc_s : ( pragma | subtype_mark AT! expression RANGE! range SEMI! )* + { #comp_loc_s = #(#[COMPONENT_CLAUSES_OPT, "COMPONENT_CLAUSES_OPT"], + #comp_loc_s); } + ; + +private_task_items_opt : ( PRIVATE! ( pragma )* entrydecls_repspecs_opt )? + { #private_task_items_opt = + #(#[PRIVATE_TASK_ITEMS_OPT, + "PRIVATE_TASK_ITEMS_OPT"], #private_task_items_opt); } + // Maybe we could just reuse TASK_ITEMS_OPT here instead of + // making a separate node type. + ; + +prot_type_or_single_decl [RefAdaAST pro] + : TYPE! def_id[false] discrim_part_opt protected_definition + { Set(pro, PROTECTED_TYPE_DECLARATION); } + | def_id[false] protected_definition + { Set(pro, SINGLE_PROTECTED_DECLARATION); } + ; + +prot_private_opt : ( PRIVATE! ( prot_op_decl | comp_decl )* )? + { #prot_private_opt = + #(#[PROT_PRIVATE_OPT, + "PROT_PRIVATE_OPT"], #prot_private_opt); } + ; + +protected_definition + : IS! prot_op_decl_s prot_private_opt end_id_opt + ; + +prot_op_decl_s : ( prot_op_decl )* + { #prot_op_decl_s = #(#[PROT_OP_DECLARATIONS, + "PROT_OP_DECLARATIONS"], #prot_op_decl_s); } + ; + +prot_op_decl : entry_declaration + | p:PROCEDURE^ def_id[false] formal_part_opt SEMI! + { pop_def_id(); Set(#p, PROCEDURE_DECLARATION); } + | f:FUNCTION^ def_designator[false] function_tail SEMI! + { pop_def_id(); Set(#f, FUNCTION_DECLARATION); } + | rep_spec + | pragma + ; + +prot_member_decl_s : ( prot_op_decl | comp_decl )* + { #prot_member_decl_s = + #(#[PROT_MEMBER_DECLARATIONS, + "PROT_MEMBER_DECLARATIONS"], #prot_member_decl_s); } + ; + +comp_decl : def_ids_colon component_subtype_def init_opt SEMI! + { #comp_decl = + #(#[COMPONENT_DECLARATION, + "COMPONENT_DECLARATION"], #comp_decl); } + ; + +// decl_common is shared between declarative_item and basic_decl_item. +// decl_common only contains specifications. +decl_common + : t:TYPE^ IDENTIFIER + ( IS! type_def[#t] + | ( discrim_part + ( IS! derived_or_private_or_record[#t, true] + | { Set(#t, INCOMPLETE_TYPE_DECLARATION); } + ) + | empty_discrim_opt + { Set(#t, INCOMPLETE_TYPE_DECLARATION); } + // NB: In this case, the discrim_part_opt does not + // appear in the INCOMPLETE_TYPE_DECLARATION node. + ) + /* The artificial derived_or_private_or_record rule + gives us some syntax-level control over where a + discrim_part may appear. + However, a semantic check is still necessary to make + sure the discrim_part is not given for a derived type + of an elementary type, or for the full view of a + private type that turns out to be such. */ + ) + SEMI! + | s:SUBTYPE^ IDENTIFIER IS! subtype_ind SEMI! // subtype_decl + { Set(#s, SUBTYPE_DECLARATION); } + | generic_decl[false] + | use_clause + | r:FOR^ ( (local_enum_name USE LPAREN) => local_enum_name USE! + enumeration_aggregate + { Set(#r, ENUMERATION_REPESENTATION_CLAUSE); } + | subtype_mark USE! rep_spec_part[#r] + ) + SEMI! + | (IDENTIFIER COLON EXCEPTION RENAMES) => + IDENTIFIER erd:COLON^ EXCEPTION! RENAMES! compound_name SEMI! + { Set(#erd, EXCEPTION_RENAMING_DECLARATION); } + | (IDENTIFIER COLON subtype_mark RENAMES) => + IDENTIFIER ord:COLON^ subtype_mark RENAMES! name SEMI! + { Set(#ord, OBJECT_RENAMING_DECLARATION); } + | defining_identifier_list od:COLON^ // object_declaration + ( EXCEPTION! + { Set(#od, EXCEPTION_DECLARATION); } + | (CONSTANT ASSIGN) => CONSTANT! ASSIGN! expression + { Set(#od, NUMBER_DECLARATION); } + | aliased_constant_opt + ( array_type_definition[#od] init_opt + { Set(#od, ARRAY_OBJECT_DECLARATION); } + // Not an RM rule, but simplifies distinction + // from the non-array object_declaration. + | subtype_ind init_opt + { Set(#od, OBJECT_DECLARATION); } + ) + ) + SEMI! + ; + +type_def [RefAdaAST t] + : LPAREN! enum_id_s RPAREN! + { Set(t, ENUMERATION_TYPE_DECLARATION); } + | RANGE! range + { Set(t, SIGNED_INTEGER_TYPE_DECLARATION); } + | MOD! expression + { Set(t, MODULAR_TYPE_DECLARATION); } + | DIGITS! expression range_constraint_opt + { Set(t, FLOATING_POINT_DECLARATION); } + | DELTA! expression + ( RANGE! range + { Set(t, ORDINARY_FIXED_POINT_DECLARATION); } + | DIGITS! expression range_constraint_opt + { Set(t, DECIMAL_FIXED_POINT_DECLARATION); } + ) + | array_type_definition[t] + | access_type_definition[t] + | empty_discrim_opt derived_or_private_or_record[t, false] + ; + +enum_id_s : enumeration_literal_specification + ( COMMA! enumeration_literal_specification )* + ; + +enumeration_literal_specification : IDENTIFIER | CHARACTER_LITERAL + ; + +range_constraint_opt : ( range_constraint )? + ; + +array_type_definition [RefAdaAST t] + : ARRAY! LPAREN! index_or_discrete_range_s RPAREN! + OF! component_subtype_def + { Set(t, ARRAY_TYPE_DECLARATION); } + ; + +index_or_discrete_range_s + : index_or_discrete_range ( COMMA^ index_or_discrete_range )* + ; + +index_or_discrete_range + : simple_expression + ( DOT_DOT^ simple_expression // constrained + | RANGE^ ( BOX // unconstrained + | range // constrained + ) + )? + ; + +component_subtype_def : aliased_opt subtype_ind + ; + +aliased_opt : ( ALIASED )? + { #aliased_opt = #(#[MODIFIERS, "MODIFIERS"], #aliased_opt); } + ; + +subtype_ind : subtype_mark constraint_opt + { #subtype_ind = #(#[SUBTYPE_INDICATION, "SUBTYPE_INDICATION"], + #subtype_ind); } + ; + +constraint_opt : ( range_constraint + | digits_constraint + | delta_constraint + | (index_constraint) => index_constraint + | discriminant_constraint + )? + ; + +digits_constraint : d:DIGITS^ expression range_constraint_opt + { Set(#d, DIGITS_CONSTRAINT); } + ; + +delta_constraint : d:DELTA^ expression range_constraint_opt + { Set(#d, DELTA_CONSTRAINT); } + ; + +index_constraint : p:LPAREN^ discrete_range ( COMMA! discrete_range )* RPAREN! + { Set(#p, INDEX_CONSTRAINT); } + ; + +discrete_range + : (range) => range + | subtype_ind + ; + +discriminant_constraint : p:LPAREN^ discriminant_association + ( COMMA! discriminant_association )* RPAREN! + { Set(#p, DISCRIMINANT_CONSTRAINT); } + ; + +discriminant_association : selector_names_opt expression + { #discriminant_association = + #(#[DISCRIMINANT_ASSOCIATION, + "DISCRIMINANT_ASSOCIATION"], #discriminant_association); } + ; + +selector_names_opt : ( (association_head) => association_head + | /* empty */ + ) + { #selector_names_opt = + #(#[SELECTOR_NAMES_OPT, + "SELECTOR_NAMES_OPT"], #selector_names_opt); } + ; + +association_head : selector_name ( PIPE! selector_name )* RIGHT_SHAFT! + ; + +selector_name : IDENTIFIER // TBD: sem pred + ; + +access_type_definition [RefAdaAST t] + : ACCESS! + ( protected_opt + ( PROCEDURE! formal_part_opt + { Set(t, ACCESS_TO_PROCEDURE_DECLARATION); } + | FUNCTION! func_formal_part_opt RETURN! subtype_mark + { Set(t, ACCESS_TO_FUNCTION_DECLARATION); } + ) + | constant_all_opt subtype_ind + { Set(t, ACCESS_TO_OBJECT_DECLARATION); } + ) + ; + +protected_opt : ( PROTECTED )? + { #protected_opt = #(#[MODIFIERS, "MODIFIERS"], #protected_opt); } + ; + +constant_all_opt : ( CONSTANT | ALL )? + { #constant_all_opt = + #(#[MODIFIERS, "MODIFIERS"], #constant_all_opt); } + ; + +derived_or_private_or_record [RefAdaAST t, boolean has_discrim] + : ( ( ABSTRACT )? NEW subtype_ind WITH ) => + abstract_opt NEW! subtype_ind WITH! + ( PRIVATE! { Set(t, PRIVATE_EXTENSION_DECLARATION); } + | record_definition[has_discrim] + { Set(t, DERIVED_RECORD_EXTENSION); } + ) + | NEW! subtype_ind { Set(t, ORDINARY_DERIVED_TYPE_DECLARATION); } + | abstract_tagged_limited_opt + ( PRIVATE! { Set(t, PRIVATE_TYPE_DECLARATION); } + | record_definition[has_discrim] + { Set(t, RECORD_TYPE_DECLARATION); } + ) + ; + +abstract_opt : ( ABSTRACT )? + { #abstract_opt = #(#[MODIFIERS, "MODIFIERS"], #abstract_opt); } + ; + +record_definition [boolean has_discrim] + : RECORD! component_list[has_discrim] END! RECORD! + | NuLL! RECORD! // Thus the component_list is optional in the tree. + ; + +component_list [boolean has_discrim] + : NuLL! SEMI! // Thus the component_list is optional in the tree. + | component_items ( variant_part { has_discrim }? )? + | empty_component_items variant_part { has_discrim }? + ; + +component_items : ( pragma | comp_decl )+ + { #component_items = + #(#[COMPONENT_ITEMS, + "COMPONENT_ITEMS"], #component_items); } + ; + +empty_component_items : + { #empty_component_items = + #(#[COMPONENT_ITEMS, + "COMPONENT_ITEMS"], #empty_component_items); } + ; + +variant_part : c:CASE^ discriminant_direct_name IS! variant_s END! CASE! SEMI! + { Set (#c, VARIANT_PART); } + ; + +discriminant_direct_name : IDENTIFIER // TBD: symtab lookup. + ; + +variant_s : ( variant )+ + { #variant_s = #(#[VARIANTS, "VARIANTS"], #variant_s); } + ; + +variant : w:WHEN^ choice_s RIGHT_SHAFT! component_list[true] + { Set (#w, VARIANT); } + ; + +choice_s : choice ( PIPE^ choice )* + ; + +choice : OTHERS + | (discrete_with_range) => discrete_with_range + | expression // ( DOT_DOT^ simple_expression )? + ; // No, that's already in discrete_with_range + +discrete_with_range : (mark_with_constraint) => mark_with_constraint + | range + ; + +mark_with_constraint : subtype_mark range_constraint + { #mark_with_constraint = + #(#[MARK_WITH_CONSTRAINT, + "MARK_WITH_CONSTRAINT"], #mark_with_constraint); } + ; + +abstract_tagged_limited_opt + : ( ABSTRACT TAGGED! | TAGGED )? + ( LIMITED )? + { #abstract_tagged_limited_opt = + #(#[MODIFIERS, "MODIFIERS"], #abstract_tagged_limited_opt); } + ; + +local_enum_name : IDENTIFIER // to be refined: do a symbol table lookup + ; + +enumeration_aggregate : parenth_values + ; + +aliased_constant_opt : ( ALIASED )? ( CONSTANT )? + { #aliased_constant_opt = + #(#[MODIFIERS, "MODIFIERS"], #aliased_constant_opt); } + ; + +generic_decl [boolean lib_level] + : g:GENERIC^ generic_formal_part_opt + ( PACKAGE! def_id[lib_level] + ( renames { Set(#g, GENERIC_PACKAGE_RENAMING); } + | IS! pkg_spec_part { Set(#g, GENERIC_PACKAGE_DECLARATION); } + ) + | PROCEDURE! def_id[lib_level] formal_part_opt + ( renames { Set(#g, GENERIC_PROCEDURE_RENAMING); } + // ^^^ Semantic check must ensure that the (generic_formal)* + // after GENERIC is not given here. + | { Set(#g, GENERIC_PROCEDURE_DECLARATION); pop_def_id(); } + ) + | FUNCTION! def_designator[lib_level] function_tail + ( renames { Set(#g, GENERIC_FUNCTION_RENAMING); } + // ^^^ Semantic check must ensure that the (generic_formal)* + // after GENERIC is not given here. + | { Set(#g, GENERIC_FUNCTION_DECLARATION); pop_def_id(); } + ) + ) + SEMI! + ; + +generic_formal_part_opt : ( use_clause | pragma | generic_formal_parameter )* + { #generic_formal_part_opt = + #(#[GENERIC_FORMAL_PART, + "GENERIC_FORMAL_PART"], + #generic_formal_part_opt); } + ; + +generic_formal_parameter : + ( t:TYPE^ def_id[false] + ( IS! + ( LPAREN! BOX! RPAREN! + { Set (#t, FORMAL_DISCRETE_TYPE_DECLARATION); } + | RANGE! BOX! + { Set (#t, FORMAL_SIGNED_INTEGER_TYPE_DECLARATION); } + | MOD! BOX! + { Set (#t, FORMAL_MODULAR_TYPE_DECLARATION); } + | DELTA! BOX! + ( DIGITS! BOX! + { Set (#t, FORMAL_DECIMAL_FIXED_POINT_DECLARATION); } + | { Set (#t, FORMAL_ORDINARY_FIXED_POINT_DECLARATION); } + ) + | DIGITS! BOX! + { Set (#t, FORMAL_FLOATING_POINT_DECLARATION); } + | array_type_definition[#t] + | access_type_definition[#t] + | empty_discrim_opt discriminable_type_definition[#t] + ) + | discrim_part IS! discriminable_type_definition[#t] + ) + { pop_def_id(); } + | w:WITH^ ( PROCEDURE! def_id[false] formal_part_opt subprogram_default_opt + { Set(#w, FORMAL_PROCEDURE_DECLARATION); } + | FUNCTION! def_designator[false] function_tail subprogram_default_opt + { Set(#w, FORMAL_FUNCTION_DECLARATION); } + | PACKAGE! def_id[false] IS! NEW! compound_name formal_package_actual_part_opt + { Set(#w, FORMAL_PACKAGE_DECLARATION); } + ) + { pop_def_id(); } + | parameter_specification + ) + SEMI! + ; + +discriminable_type_definition [RefAdaAST t] + : ( ( ABSTRACT )? NEW subtype_ind WITH ) => + abstract_opt NEW! subtype_ind WITH! PRIVATE! + { Set (t, FORMAL_PRIVATE_EXTENSION_DECLARATION); } + | NEW! subtype_ind + { Set (t, FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION); } + | abstract_tagged_limited_opt PRIVATE! + { Set (t, FORMAL_PRIVATE_TYPE_DECLARATION); } + ; + +subprogram_default_opt : ( IS! ( BOX | name ) )? + ; + +formal_package_actual_part_opt + : ( LPAREN! ( BOX | defining_identifier_list ) RPAREN! )? + ; + +subprog_decl_or_rename_or_inst_or_body [boolean lib_level] + { RefAdaAST t; } + : p:PROCEDURE^ def_id[lib_level] + ( generic_subp_inst + { Set(#p, GENERIC_PROCEDURE_INSTANTIATION); } + | formal_part_opt + ( renames { Set(#p, PROCEDURE_RENAMING_DECLARATION); } + | IS! ( separate_or_abstract[#p] + | body_part { Set(#p, PROCEDURE_BODY); } + ) + | { pop_def_id(); + Set(#p, PROCEDURE_DECLARATION); } + ) + SEMI! + ) + | f:FUNCTION^ def_designator[lib_level] + ( generic_subp_inst + { Set(#f, GENERIC_FUNCTION_INSTANTIATION); } + | function_tail + ( renames { Set(#f, FUNCTION_RENAMING_DECLARATION); } + | IS! ( separate_or_abstract[#f] + | body_part { Set(#f, FUNCTION_BODY); } + ) + | { pop_def_id(); + Set(#f, FUNCTION_DECLARATION); } + ) + SEMI! + ) + ; + +body_part : declarative_part block_body end_id_opt + ; + +declarative_part : ( pragma | declarative_item )* + { #declarative_part = + #(#[DECLARATIVE_PART, "DECLARATIVE_PART"], + #declarative_part); } + ; + +// A declarative_item may appear in the declarative part of any body. +declarative_item : + ( pkg:PACKAGE^ ( body_is + ( separate { Set(#pkg, PACKAGE_BODY_STUB); } + | pkg_body_part + { Set(#pkg, PACKAGE_BODY); } + ) + SEMI! + | def_id[false] spec_decl_part[#pkg] + ) + | tsk:TASK^ ( body_is + ( separate { Set(#tsk, TASK_BODY_STUB); } + | body_part { Set(#tsk, TASK_BODY); } + ) + SEMI! + | task_type_or_single_decl[#tsk] + ) + | pro:PROTECTED^ + ( body_is + ( separate { Set(#pro, PROTECTED_BODY_STUB); } + | prot_op_bodies_opt end_id_opt + { Set(#pro, PROTECTED_BODY); } + ) + | prot_type_or_single_decl[#pro] + ) + SEMI! + | subprog_decl_or_rename_or_inst_or_body[false] + | decl_common + ) + /* DECLARATIVE_ITEM is just a pass-thru node so we omit it. + Objections anybody? + { #declarative_item = + #(#[DECLARATIVE_ITEM, + "DECLARATIVE_ITEM"], #declarative_item); } + */ + ; + +body_is : BODY! def_id[false] IS! + ; + +separate : SEPARATE! { pop_def_id(); } + ; + +pkg_body_part : declarative_part block_body_opt end_id_opt + ; + +block_body_opt : ( BEGIN! handled_stmt_s )? + { #block_body_opt = + #(#[BLOCK_BODY_OPT, + "BLOCK_BODY_OPT"], #block_body_opt); } + ; + +prot_op_bodies_opt : ( entry_body + | subprog_decl_or_body + | pragma + )* + { #prot_op_bodies_opt = + #(#[PROT_OP_BODIES_OPT, + "PROT_OP_BODIES_OPT"], #prot_op_bodies_opt); } + ; + +subprog_decl_or_body + : p:PROCEDURE^ def_id[false] formal_part_opt + ( IS! body_part { Set(#p, PROCEDURE_BODY); } + | { pop_def_id(); Set(#p, PROCEDURE_DECLARATION); } + ) + SEMI! + | f:FUNCTION^ def_designator[false] function_tail + ( IS! body_part { Set(#f, FUNCTION_BODY); } + | { pop_def_id(); Set(#f, FUNCTION_DECLARATION); } + ) + SEMI! + ; + +block_body : b:BEGIN^ handled_stmt_s + { Set(#b, BLOCK_BODY); } + ; + +handled_stmt_s : statements except_handler_part_opt + { #handled_stmt_s = + #(#[HANDLED_SEQUENCE_OF_STATEMENTS, + "HANDLED_SEQUENCE_OF_STATEMENTS"], #handled_stmt_s); } + ; + +handled_stmts_opt : ( statements except_handler_part_opt )? + { #handled_stmts_opt = + #(#[HANDLED_STMTS_OPT, + "HANDLED_STMTS_OPT"], #handled_stmts_opt); } + ; + +statements : ( pragma | statement )+ + { #statements = #(#[SEQUENCE_OF_STATEMENTS, + "SEQUENCE_OF_STATEMENTS"], #statements); } + ; + +statement : def_label_opt + ( null_stmt + | exit_stmt + | return_stmt + | goto_stmt + | delay_stmt + | abort_stmt + | raise_stmt + | requeue_stmt + | accept_stmt + | select_stmt + | if_stmt + | case_stmt + | loop_stmt SEMI! + | block END! SEMI! + | statement_identifier + ( loop_stmt id_opt SEMI! + | block end_id_opt SEMI! + ) + | call_or_assignment + // | code_stmt // TBD: resolve ambiguity + ) + { #statement = #(#[STATEMENT, "STATEMENT"], #statement); } + ; + +def_label_opt : ( LT_LT! IDENTIFIER GT_GT! )? + { #def_label_opt = #(#[LABEL_OPT, "LABEL_OPT"], #def_label_opt); } + ; + +null_stmt : s:NuLL SEMI! + { Set(#s, NULL_STATEMENT); } + ; + +if_stmt : s:IF^ cond_clause elsifs_opt + else_opt + END! IF! SEMI! + { Set(#s, IF_STATEMENT); } + ; + +cond_clause : condition c:THEN^ statements + { Set(#c, COND_CLAUSE); } + ; + +condition : expression + // { #condition = #(#[CONDITION, "CONDITION"], #condition); } + ; + +elsifs_opt : ( ELSIF! cond_clause )* + { #elsifs_opt = #(#[ELSIFS_OPT, "ELSIFS_OPT"], #elsifs_opt); } + ; + +else_opt : ( ELSE! statements )? + { #else_opt = #(#[ELSE_OPT, "ELSE_OPT"], #else_opt); } + ; + +case_stmt : s:CASE^ expression IS! alternative_s END! CASE! SEMI! + { Set(#s, CASE_STATEMENT); } + ; + +alternative_s : ( case_statement_alternative )+ + ; + +case_statement_alternative : s:WHEN^ choice_s RIGHT_SHAFT! statements + { Set(#s, CASE_STATEMENT_ALTERNATIVE); } + ; + +loop_stmt : iteration_scheme_opt + l:LOOP^ statements END! LOOP! // basic_loop + { Set(#l, LOOP_STATEMENT); } + ; + +iteration_scheme_opt : ( WHILE^ condition + | FOR^ IDENTIFIER IN! reverse_opt discrete_subtype_definition + )? + { #iteration_scheme_opt = + #(#[ITERATION_SCHEME_OPT, + "ITERATION_SCHEME_OPT"], #iteration_scheme_opt); } + ; + +reverse_opt : ( REVERSE )? + { #reverse_opt = #(#[MODIFIERS, "MODIFIERS"], #reverse_opt); } + ; + +id_opt_aux { RefAdaAST endid; } : + endid=definable_operator_symbol { end_id_matches_def_id (endid) }? + | n:compound_name { end_id_matches_def_id (#n) }? + /* Ordinarily we would need to be stricter here, i.e. + match compound_name only for the library-level case + (and IDENTIFIER otherwise), but end_id_matches_def_id + does the right thing for us. */ + | { pop_def_id(); } + ; + +id_opt : id_opt_aux + { #id_opt = #(#[ID_OPT, "ID_OPT"], #id_opt); } + ; + +end_id_opt : e:END^ id_opt_aux + { Set(#e, END_ID_OPT); } + ; + +/* Note: This rule should really be `statement_identifier_opt'. + However, manual disambiguation of `loop_stmt' from `block' + in the presence of the statement_identifier in `statement' + results in this rule. The case of loop_stmt/block given + without the statement_identifier is directly coded in + `statement'. */ +statement_identifier! : n:IDENTIFIER COLON! + { push_def_id(#n); } + ; + +/* +statement_identifier_opt : ( n:IDENTIFIER COLON! { push_def_id(#n); } )? + { #statement_identifier_opt = + #(#[STATEMENT_IDENTIFIER_OPT, + "STATEMENT_IDENTIFIER_OPT"], #statement_identifier_opt); } + ; + */ + +block : declare_opt block_body + { #block = #(#[BLOCK_STATEMENT, "BLOCK_STATEMENT"], #block); } + ; + +declare_opt : ( DECLARE! declarative_part )? + { #declare_opt = #(#[DECLARE_OPT, "DECLARE_OPT"], #declare_opt); } + ; + +exit_stmt : s:EXIT^ ( label_name )? ( WHEN condition )? SEMI! + { Set(#s, EXIT_STATEMENT); } + ; + +label_name : IDENTIFIER + ; + +return_stmt : s:RETURN^ ( expression )? SEMI! + { Set(#s, RETURN_STATEMENT); } + ; + +goto_stmt : s:GOTO^ label_name SEMI! + { Set(#s, GOTO_STATEMENT); } + ; + +call_or_assignment : // procedure_call is in here. + name ( ASSIGN! expression + { #call_or_assignment = + #(#[ASSIGNMENT_STATEMENT, + "ASSIGNMENT_STATEMENT"], #call_or_assignment); } + | { #call_or_assignment = + #(#[CALL_STATEMENT, + "CALL_STATEMENT"], #call_or_assignment); } + /* Preliminary. Use semantic analysis to produce + {PROCEDURE|ENTRY}_CALL_STATEMENT. */ + ) + SEMI! + ; + +entry_body : e:ENTRY^ def_id[false] entry_body_formal_part entry_barrier IS! + body_part SEMI! + { Set (#e, ENTRY_BODY); } + ; + +entry_body_formal_part : entry_index_spec_opt formal_part_opt + ; + +entry_index_spec_opt : + ( (LPAREN FOR) => + LPAREN! FOR! def_id[false] IN! discrete_subtype_definition RPAREN! + | /* empty */ + ) + { #entry_index_spec_opt = + #(#[ENTRY_INDEX_SPECIFICATION, + "ENTRY_INDEX_SPECIFICATION"], #entry_index_spec_opt); } + ; + +entry_barrier : WHEN! condition + ; + +entry_call_stmt : name SEMI! // Semantic analysis required, for example + // to ensure `name' is an entry. + { #entry_call_stmt = + #(#[ENTRY_CALL_STATEMENT, + "ENTRY_CALL_STATEMENT"], #entry_call_stmt); } + ; + +accept_stmt : a:ACCEPT^ def_id[false] entry_index_opt formal_part_opt + ( DO! handled_stmts_opt end_id_opt SEMI! + | SEMI! { pop_def_id(); } + ) + { Set (#a, ACCEPT_STATEMENT); } + ; + +entry_index_opt : ( (LPAREN expression RPAREN) => LPAREN! expression RPAREN! + // Looks alot like parenthesized_expr_opt, but it's not. + // We need the syn pred for the usage context in accept_stmt. + // The formal_part_opt that follows the entry_index_opt there + // creates ambiguity (due to the opening LPAREN.) + | /* empty */ + ) + { #entry_index_opt = + #(#[ENTRY_INDEX_OPT, + "ENTRY_INDEX_OPT"], #entry_index_opt); } + ; + +delay_stmt : d:DELAY^ until_opt expression SEMI! + { Set (#d, DELAY_STATEMENT); } + ; + +until_opt : ( UNTIL )? + { #until_opt = #(#[MODIFIERS, "MODIFIERS"], #until_opt); } + ; + +// SELECT_STATEMENT itself is not modeled since it is trivially +// reconstructed: +// select_statement ::= selective_accept | timed_entry_call +// | conditional_entry_call | asynchronous_select +// +select_stmt : s:SELECT^ + ( (triggering_alternative THEN ABORT) => + triggering_alternative THEN! ABORT! abortable_part + { Set (#s, ASYNCHRONOUS_SELECT); } + | selective_accept + { Set (#s, SELECTIVE_ACCEPT); } + | entry_call_alternative + ( OR! delay_alternative { Set (#s, TIMED_ENTRY_CALL); } + | ELSE! statements { Set (#s, CONDITIONAL_ENTRY_CALL); } + ) + ) + END! SELECT! SEMI! + // { Set (#s, SELECT_STATEMENT); } + ; + +triggering_alternative : ( delay_stmt | entry_call_stmt ) stmts_opt + { #triggering_alternative = + #(#[TRIGGERING_ALTERNATIVE, + "TRIGGERING_ALTERNATIVE"], #triggering_alternative); } + ; + +abortable_part : stmts_opt + { #abortable_part = + #(#[ABORTABLE_PART, + "ABORTABLE_PART"], #abortable_part); } + ; + +entry_call_alternative : entry_call_stmt stmts_opt + { #entry_call_alternative = + #(#[ENTRY_CALL_ALTERNATIVE, + "ENTRY_CALL_ALTERNATIVE"], #entry_call_alternative); } + ; + +selective_accept : guard_opt select_alternative or_select_opt else_opt + ; + +guard_opt : ( w:WHEN^ condition RIGHT_SHAFT! ( pragma )* )? + { Set(#w, GUARD_OPT); } + ; + +select_alternative // Not modeled since it's just a pass-through. + : accept_alternative + | delay_alternative + | t:TERMINATE SEMI! { Set(#t, TERMINATE_ALTERNATIVE); } + ; + +accept_alternative : accept_stmt stmts_opt + { #accept_alternative = + #(#[ACCEPT_ALTERNATIVE, + "ACCEPT_ALTERNATIVE"], #accept_alternative); } + ; + +delay_alternative : delay_stmt stmts_opt + { #delay_alternative = + #(#[DELAY_ALTERNATIVE, + "DELAY_ALTERNATIVE"], #delay_alternative); } + ; + +stmts_opt : ( pragma | statement )* + ; + +or_select_opt : ( OR! guard_opt select_alternative )* + { #or_select_opt = + #(#[OR_SELECT_OPT, "OR_SELECT_OPT"], #or_select_opt); } + ; + +abort_stmt : a:ABORT^ name ( COMMA! name )* SEMI! + { Set (#a, ABORT_STATEMENT); } + ; + +except_handler_part_opt : ( EXCEPTION! ( exception_handler )+ )? + { #except_handler_part_opt = + #(#[EXCEPT_HANDLER_PART_OPT, + "EXCEPT_HANDLER_PART_OPT"], #except_handler_part_opt); } + ; + +exception_handler : w:WHEN^ identifier_colon_opt except_choice_s RIGHT_SHAFT! + statements + { Set (#w, EXCEPTION_HANDLER); } + ; + +identifier_colon_opt : ( IDENTIFIER COLON! )? + { #identifier_colon_opt = + #(#[IDENTIFIER_COLON_OPT, + "IDENTIFIER_COLON_OPT"], #identifier_colon_opt); } + ; + +except_choice_s : exception_choice ( PIPE^ exception_choice )* + ; + +exception_choice : compound_name + | OTHERS + ; + +raise_stmt : r:RAISE^ ( compound_name )? SEMI! + { Set (#r, RAISE_STATEMENT); } + ; + +requeue_stmt : r:REQUEUE^ name ( WITH! ABORT )? SEMI! + { Set (#r, REQUEUE_STATEMENT); } + ; + +operator_call : cs:CHAR_STRING^ operator_call_tail[#cs] + ; + +operator_call_tail [RefAdaAST opstr] + : LPAREN! { is_operator_symbol(opstr->getText().c_str()) }? + value_s RPAREN! { opstr->setType(OPERATOR_SYMBOL); } + ; + +value_s : value ( COMMA! value )* + { #value_s = #(#[VALUES, "VALUES"], #value_s); } + ; + +/* +literal : NUMERIC_LIT + | CHARACTER_LITERAL + | CHAR_STRING + | NuLL + ; + */ + +expression : relation + ( a:AND^ ( THEN! { Set (#a, AND_THEN); } )? relation + | o:OR^ ( ELSE! { Set (#o, OR_ELSE); } )? relation + | XOR^ relation + )* + ; + +relation : simple_expression + ( IN^ range_or_mark + | n:NOT^ IN! range_or_mark { Set (#n, NOT_IN); } + | EQ^ simple_expression + | NE^ simple_expression + | LT_^ simple_expression + | LE^ simple_expression + | GT^ simple_expression + | GE^ simple_expression + )? + ; + +range_or_mark : (range) => range + | subtype_mark + ; + +simple_expression : signed_term + ( PLUS^ signed_term + | MINUS^ signed_term + | CONCAT^ signed_term + )* + ; + +signed_term + : p:PLUS^ term { Set(#p, UNARY_PLUS); } + | m:MINUS^ term { Set(#m, UNARY_MINUS); } + | term + ; + +term : factor ( STAR^ factor + | DIV^ factor + | MOD^ factor + | REM^ factor + )* + ; + +factor : ( NOT^ primary + | ABS^ primary + | primary ( EXPON^ primary )? + ) + ; + +primary : ( name_or_qualified + | parenthesized_primary + | allocator + | NuLL + | NUMERIC_LIT + | CHARACTER_LITERAL + | cs:CHAR_STRING^ ( operator_call_tail[#cs] )? + ) + ; + +// Temporary, to be turned into just `qualified'. +// We get away with it because `qualified' is always mentioned +// together with `name'. +// Only exception: `code_stmt', which is not yet implemented. +name_or_qualified { RefAdaAST dummy; } + : IDENTIFIER + ( DOT^ ( ALL + | IDENTIFIER + | CHARACTER_LITERAL + | dummy=is_operator + ) + | p:LPAREN^ value_s RPAREN! + { Set(#p, INDEXED_COMPONENT); } + | TIC^ ( parenthesized_primary | attribute_id ) + )* + ; + +allocator : n:NEW^ name_or_qualified + { Set(#n, ALLOCATOR); } + ; + +subunit : sep:SEPARATE^ LPAREN! compound_name RPAREN! + { Set(#sep, SUBUNIT); } + ( subprogram_body + | package_body + | task_body + | protected_body + ) + ; + +subprogram_body + : p:PROCEDURE^ def_id[false] formal_part_opt IS! body_part SEMI! + { pop_def_id(); Set(#p, PROCEDURE_BODY); } + | f:FUNCTION^ def_designator[false] function_tail IS! body_part SEMI! + { pop_def_id(); Set(#f, FUNCTION_BODY); } + ; + +package_body : p:PACKAGE^ body_is pkg_body_part SEMI! + { Set(#p, PACKAGE_BODY); } + ; + +task_body : t:TASK^ body_is body_part SEMI! + { Set(#t, TASK_BODY); } + ; + +protected_body : p:PROTECTED^ body_is prot_op_bodies_opt end_id_opt SEMI! + { Set(#p, PROTECTED_BODY); } + ; + +// TBD +// code_stmt : qualified SEMI! +// ; + +//---------------------------------------------------------------------------- +// The Ada scanner +//---------------------------------------------------------------------------- +{ +#include "preambles.h" +} +class AdaLexer extends Lexer; + +options { + charVocabulary = '\3'..'\377'; + exportVocab = Ada; // call the vocabulary "Ada" + testLiterals = false; // don't automatically test for literals + k = 4; // number of characters of lookahead + caseSensitive = false; + caseSensitiveLiterals = false; + ///defaultErrorHandler = true; +} + +tokens { + // part 1: keywords + ABORT = "abort" ; + ABS = "abs" ; + ABSTRACT = "abstract" ; + ACCEPT = "accept" ; + ACCESS = "access" ; + ALIASED = "aliased" ; + ALL = "all" ; + AND = "and" ; + ARRAY = "array" ; + AT = "at" ; + BEGIN = "begin" ; + BODY = "body" ; + CASE = "case" ; + CONSTANT = "constant" ; + DECLARE = "declare" ; + DELAY = "delay" ; + DELTA = "delta" ; + DIGITS = "digits" ; + DO = "do" ; + ELSE = "else" ; + ELSIF = "elsif" ; + END = "end" ; + ENTRY = "entry" ; + EXCEPTION = "exception" ; + EXIT = "exit" ; + FOR = "for" ; + FUNCTION = "function" ; + GENERIC = "generic" ; + GOTO = "goto" ; + IF = "if" ; + IN = "in" ; + IS = "is" ; + LIMITED = "limited" ; + LOOP = "loop" ; + MOD = "mod" ; + NEW = "new" ; + NOT = "not" ; + NuLL = "null" ; + OF = "of" ; + OR = "or" ; + OTHERS = "others" ; + OUT = "out" ; + PACKAGE = "package" ; + PRAGMA = "pragma" ; + PRIVATE = "private" ; + PROCEDURE = "procedure" ; + PROTECTED = "protected" ; + RAISE = "raise" ; + RANGE = "range" ; + RECORD = "record" ; + REM = "rem" ; + RENAMES = "renames" ; + REQUEUE = "requeue" ; + RETURN = "return" ; + REVERSE = "reverse" ; + SELECT = "select" ; + SEPARATE = "separate" ; + SUBTYPE = "subtype" ; + TAGGED = "tagged" ; + TASK = "task" ; + TERMINATE = "terminate" ; + THEN = "then" ; + TYPE = "type" ; + UNTIL = "until" ; + USE = "use" ; + WHEN = "when" ; + WHILE = "while" ; + WITH = "with" ; + XOR = "xor" ; + + // part 2: RM tokens (synthetic) + ABORTABLE_PART; + ABORT_STATEMENT; + /*ABSTRACT_SUBPROGRAM_DECLARATION; => + ABSTRACT_{FUNCTION|PROCEDURE}_DECLARATION */ + ACCEPT_ALTERNATIVE; + ACCEPT_STATEMENT; + /* ACCESS_TO_FUNCTION_DEFINITION => ACCESS_TO_FUNCTION_DECLARATION */ + /* ACCESS_TO_OBJECT_DEFINITION => ACCESS_TO_OBJECT_DECLARATION */ + /* ACCESS_TO_PROCEDURE_DEFINITION => ACCESS_TO_PROCEDURE_DECLARATION */ + /* ACCESS_TYPE_DEFINITION => ACCESS_TYPE_DECLARATION */ + ALLOCATOR; + /* ARRAY_TYPE_DEFINITION => ARRAY_TYPE_DECLARATION */ + ASSIGNMENT_STATEMENT; + ASYNCHRONOUS_SELECT; + ATTRIBUTE_DEFINITION_CLAUSE; + AT_CLAUSE; + BLOCK_STATEMENT; + CASE_STATEMENT; + CASE_STATEMENT_ALTERNATIVE; + CODE_STATEMENT; + COMPONENT_DECLARATION; + // COMPONENT_LIST; // not currently used as an explicit node + // CONDITION; // not currently used + CONDITIONAL_ENTRY_CALL; + CONTEXT_CLAUSE; + /* DECIMAL_FIXED_POINT_DEFINITION => DECIMAL_FIXED_POINT_DECLARATION */ + // DECLARATIVE_ITEM; // not currently used + DECLARATIVE_PART; + DEFINING_IDENTIFIER_LIST; + DELAY_ALTERNATIVE; + DELAY_STATEMENT; + DELTA_CONSTRAINT; + /* DERIVED_TYPE_DEFINITION; => + DERIVED_RECORD_EXTENSION, ORDINARY_DERIVED_TYPE_DECLARATION */ + DIGITS_CONSTRAINT; + // DISCRETE_RANGE; // Not used; instead, directly use its RHS alternatives. + DISCRIMINANT_ASSOCIATION; + DISCRIMINANT_CONSTRAINT; + DISCRIMINANT_SPECIFICATION; + ENTRY_BODY; + ENTRY_CALL_ALTERNATIVE; + ENTRY_CALL_STATEMENT; + ENTRY_DECLARATION; + ENTRY_INDEX_SPECIFICATION; + ENUMERATION_REPESENTATION_CLAUSE; + /* ENUMERATION_TYPE_DEFINITION => ENUMERATION_TYPE_DECLARATION */ + EXCEPTION_DECLARATION; + EXCEPTION_HANDLER; + EXCEPTION_RENAMING_DECLARATION; + EXIT_STATEMENT; + /* FLOATING_POINT_DEFINITION => FLOATING_POINT_DECLARATION */ + /* FORMAL_ACCESS_TYPE_DEFINITION => FORMAL_ACCESS_TYPE_DECLARATION */ + /* FORMAL_ARRAY_TYPE_DEFINITION => FORMAL_ARRAY_TYPE_DECLARATION */ + /* FORMAL_DECIMAL_FIXED_POINT_DEFINITION => + FORMAL_DECIMAL_FIXED_POINT_DECLARATION */ + /* FORMAL_DERIVED_TYPE_DEFINITION => + FORMAL_{ORDINARY_DERIVED_TYPE|PRIVATE_EXTENSION}_DECLARATION */ + /* FORMAL_DISCRETE_TYPE_DEFINITION => FORMAL_DISCRETE_TYPE_DECLARATION */ + /* FORMAL_FLOATING_POINT_DEFINITION => + FORMAL_FLOATING_POINT_DECLARATION */ + /* FORMAL_MODULAR_TYPE_DEFINITION => FORMAL_MODULAR_TYPE_DECLARATION */ + /* FORMAL_ORDINARY_FIXED_POINT_DEFINITION => + FORMAL_ORDINARY_FIXED_POINT_DECLARATION */ + FORMAL_PACKAGE_DECLARATION; + /* FORMAL_PRIVATE_TYPE_DEFINITION => FORMAL_PRIVATE_TYPE_DECLARATION */ + /* FORMAL_SIGNED_INTEGER_TYPE_DEFINITION => + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION */ + /* FORMAL_SUBPROGRAM_DECLARATION; => + FORMAL_{FUNCTION|PROCEDURE}_DECLARATION */ + /* FORMAL_TYPE_DECLARATION; not used, replaced by the corresponding + finer grained declarations */ + /* FORMAL_TYPE_DEFINITION; not used at all; we use declarations + not definitions */ + /* FULL_TYPE_DECLARATION; not used, replaced by the corresponding + finer grained declarations */ + GENERIC_FORMAL_PART; + /* GENERIC_INSTANTIATION; => + GENERIC_{FUNCTION|PACKAGE|PROCEDURE}_INSTANTIATION */ + GENERIC_PACKAGE_DECLARATION; + /* GENERIC_RENAMING_DECLARATION; => + GENERIC_{FUNCTION|PACKAGE|PROCEDURE}_RENAMING */ + /* GENERIC_SUBPROGRAM_DECLARATION; => + GENERIC_{FUNCTION|PROCEDURE}_DECLARATION */ + GOTO_STATEMENT; + HANDLED_SEQUENCE_OF_STATEMENTS; + HANDLED_STMTS_OPT; + IF_STATEMENT; + INCOMPLETE_TYPE_DECLARATION; + INDEXED_COMPONENT; + INDEX_CONSTRAINT; + LIBRARY_ITEM; + LOOP_STATEMENT; + /* MODULAR_TYPE_DEFINITION => MODULAR_TYPE_DECLARATION */ + NAME; + NULL_STATEMENT; + NUMBER_DECLARATION; + OBJECT_DECLARATION; + OBJECT_RENAMING_DECLARATION; + OPERATOR_SYMBOL; + /* ORDINARY_FIXED_POINT_DEFINITION => ORDINARY_FIXED_POINT_DECLARATION */ + PACKAGE_BODY; + PACKAGE_BODY_STUB; + PACKAGE_RENAMING_DECLARATION; + PACKAGE_SPECIFICATION; + PARAMETER_SPECIFICATION; + // PREFIX; // not used + // PRIMARY; // not used + PRIVATE_EXTENSION_DECLARATION; + PRIVATE_TYPE_DECLARATION; + // PROCEDURE_CALL_STATEMENT; // NYI, using CALL_STATEMENT for now. + PROTECTED_BODY; + PROTECTED_BODY_STUB; + PROTECTED_TYPE_DECLARATION; + RAISE_STATEMENT; + RANGE_ATTRIBUTE_REFERENCE; + RECORD_REPRESENTATION_CLAUSE; + /* RECORD_TYPE_DEFINITION => RECORD_TYPE_DECLARATION */ + REQUEUE_STATEMENT; + RETURN_STATEMENT; + SELECTIVE_ACCEPT; + /* SELECT_ALTERNATIVE; Not used - instead, we use the finer grained rules + ACCEPT_ALTERNATIVE | DELAY_ALTERNATIVE + | TERMINATE_ALTERNATIVE */ + /* SELECT_STATEMENT; Not used - instead, we use the finer grained rules + SELECTIVE_ACCEPT | TIMED_ENTRY_CALL + | CONDITIONAL_ENTRY_CALL | ASYNCHRONOUS_SELECT */ + SEQUENCE_OF_STATEMENTS; + /* SIGNED_INTEGER_TYPE_DEFINITION => SIGNED_INTEGER_TYPE_DECLARATION */ + SINGLE_PROTECTED_DECLARATION; + SINGLE_TASK_DECLARATION; + STATEMENT; + /* SUBPROGRAM_BODY; => {FUNCTION|PROCEDURE}_BODY */ + /* SUBPROGRAM_BODY_STUB; => {FUNCTION|PROCEDURE}_BODY_STUB */ + /* SUBPROGRAM_DECLARATION; => {FUNCTION|PROCEDURE}_DECLARATION */ + /* SUBPROGRAM_RENAMING_DECLARATION; => + {FUNCTION|PROCEDURE}_RENAMING_DECLARATION */ + SUBTYPE_DECLARATION; + SUBTYPE_INDICATION; + SUBTYPE_MARK; + SUBUNIT; + TASK_BODY; + TASK_BODY_STUB; + TASK_TYPE_DECLARATION; + TERMINATE_ALTERNATIVE; + TIMED_ENTRY_CALL; + TRIGGERING_ALTERNATIVE; + /* TYPE_DECLARATION; not used, replaced by the corresponding + finer grained declarations */ + USE_CLAUSE; + USE_TYPE_CLAUSE; + VARIANT; + VARIANT_PART; + WITH_CLAUSE; + + // part 3: Non-RM synthetic tokens. + // They exist mainly to normalize the node structure with respect to + // optional items. (Without them, the presence or absence of an optional + // item would change the node layout, but we want a fixed layout.) + ABSTRACT_FUNCTION_DECLARATION; + ABSTRACT_PROCEDURE_DECLARATION; + ACCESS_TO_FUNCTION_DECLARATION; + ACCESS_TO_OBJECT_DECLARATION; + ACCESS_TO_PROCEDURE_DECLARATION; + /* ACCESS_TYPE_DECLARATION; not used, replaced by + ACCESS_TO_{FUNCTION|OBJECT|PROCEDURE}_DECLARATION + */ + ARRAY_OBJECT_DECLARATION; + ARRAY_TYPE_DECLARATION; + AND_THEN; + BASIC_DECLARATIVE_ITEMS_OPT; + BLOCK_BODY; + BLOCK_BODY_OPT; + CALL_STATEMENT; // See {PROCEDURE|ENTRY}_CALL_STATEMENT + COMPONENT_CLAUSES_OPT; + COMPONENT_ITEMS; + COND_CLAUSE; + DECIMAL_FIXED_POINT_DECLARATION; + DECLARE_OPT; + DERIVED_RECORD_EXTENSION; + // DERIVED_TYPE_DECLARATION; // not used + DISCRETE_SUBTYPE_DEF_OPT; + DISCRIMINANT_SPECIFICATIONS; + DISCRIM_PART_OPT; + ELSE_OPT; + ELSIFS_OPT; + END_ID_OPT; + ENTRY_INDEX_OPT; + ENUMERATION_TYPE_DECLARATION; + EXCEPT_HANDLER_PART_OPT; + EXTENSION_OPT; + FLOATING_POINT_DECLARATION; + /* FORMAL_ACCESS_TYPE_DECLARATION => ACCESS_TYPE_DECLARATION */ + /* FORMAL_ARRAY_TYPE_DECLARATION => ARRAY_TYPE_DECLARATION */ + FORMAL_DECIMAL_FIXED_POINT_DECLARATION; + FORMAL_DISCRETE_TYPE_DECLARATION; + FORMAL_FLOATING_POINT_DECLARATION; + FORMAL_FUNCTION_DECLARATION; + FORMAL_MODULAR_TYPE_DECLARATION; + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION; + FORMAL_ORDINARY_FIXED_POINT_DECLARATION; + FORMAL_PART_OPT; + FORMAL_PRIVATE_EXTENSION_DECLARATION; + FORMAL_PRIVATE_TYPE_DECLARATION; + FORMAL_PROCEDURE_DECLARATION; + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION; + FUNCTION_BODY; + FUNCTION_BODY_STUB; + FUNCTION_DECLARATION; + FUNCTION_RENAMING_DECLARATION; + GENERIC_FUNCTION_DECLARATION; + GENERIC_FUNCTION_INSTANTIATION; + GENERIC_FUNCTION_RENAMING; + GENERIC_PACKAGE_INSTANTIATION; + GENERIC_PACKAGE_RENAMING; + GENERIC_PROCEDURE_DECLARATION; + GENERIC_PROCEDURE_INSTANTIATION; + GENERIC_PROCEDURE_RENAMING; + GUARD_OPT; + IDENTIFIER_COLON_OPT; + ID_OPT; + INIT_OPT; + ITERATION_SCHEME_OPT; + LABEL_OPT; + MARK_WITH_CONSTRAINT; + MODIFIERS; /* Possible values: abstract access aliased all constant in + limited out private protected reverse tagged */ + MODULAR_TYPE_DECLARATION; + MOD_CLAUSE_OPT; + // NAME_OR_QUALIFIED; + NOT_IN; + ORDINARY_DERIVED_TYPE_DECLARATION; + ORDINARY_FIXED_POINT_DECLARATION; + OR_ELSE; + OR_SELECT_OPT; + PARENTHESIZED_PRIMARY; + // PARENTHESIZED_VALUES; + // PARENTHESIZED_VALUES_OPT; + PRIVATE_DECLARATIVE_ITEMS_OPT; + PRIVATE_TASK_ITEMS_OPT; + PROCEDURE_BODY; + PROCEDURE_BODY_STUB; + PROCEDURE_DECLARATION; + PROCEDURE_RENAMING_DECLARATION; + PROT_MEMBER_DECLARATIONS; + PROT_OP_BODIES_OPT; + PROT_OP_DECLARATIONS; + PROT_PRIVATE_OPT; + RANGED_EXPRS; // ugh, what an ugly name + RANGE_CONSTRAINT; + RECORD_TYPE_DECLARATION; + SELECTOR_NAMES_OPT; + SIGNED_INTEGER_TYPE_DECLARATION; + TASK_ITEMS_OPT; + UNARY_MINUS; + UNARY_PLUS; + VALUE; + VALUES; + VARIANTS; +} + +{ + ANTLR_LEXER_PREAMBLE + private: + bool lastTokenWasTicCompatible; +} + +//---------------------------------------------------------------------------- +// OPERATORS +//---------------------------------------------------------------------------- +COMMENT_INTRO : "--" {lastTokenWasTicCompatible=false;}; +DOT_DOT : ".." {lastTokenWasTicCompatible=false;}; +LT_LT : "<<" {lastTokenWasTicCompatible=false;}; +OX : "<>" {lastTokenWasTicCompatible=false;}; +GT_GT : ">>" {lastTokenWasTicCompatible=false;}; +ASSIGN : ":=" {lastTokenWasTicCompatible=false;}; +RIGHT_SHAFT : "=>" {lastTokenWasTicCompatible=false;}; +NE : "/=" {lastTokenWasTicCompatible=false;}; +LE : "<=" {lastTokenWasTicCompatible=false;}; +GE : ">=" {lastTokenWasTicCompatible=false;}; +EXPON : "**" {lastTokenWasTicCompatible=false;}; +PIPE : '|' {lastTokenWasTicCompatible=false;}; +CONCAT : '&' {lastTokenWasTicCompatible=false;}; +DOT : '.' {lastTokenWasTicCompatible=false;}; +EQ : '=' {lastTokenWasTicCompatible=false;}; +LT_ : '<' {lastTokenWasTicCompatible=false;}; +GT : '>' {lastTokenWasTicCompatible=false;}; +PLUS : '+' {lastTokenWasTicCompatible=false;}; +MINUS : '-' {lastTokenWasTicCompatible=false;}; +STAR : '*' {lastTokenWasTicCompatible=false;}; +DIV : '/' {lastTokenWasTicCompatible=false;}; +LPAREN : '(' {lastTokenWasTicCompatible=false;}; +RPAREN : ')' {lastTokenWasTicCompatible=true;}; +COLON : ':' {lastTokenWasTicCompatible=false;}; +COMMA : ',' {lastTokenWasTicCompatible=false;}; +SEMI : ';' {lastTokenWasTicCompatible=false;}; + + +// Literals. + +// Rule for IDENTIFIER: testLiterals is set to true. This means that +// after we match the rule, we look in the literals table to see if +// it's a keyword or really an identifier. +IDENTIFIER + options {testLiterals=true;} + : ( 'a'..'z' ) ( ('_')? ( 'a'..'z'|'0'..'9' ) )* + ; + +TIC_OR_CHARACTER_LITERAL : + "'"! { $setType(TIC); } ( + { ! lastTokenWasTicCompatible }? . "'"! + { $setType(CHARACTER_LITERAL); } + )? + {lastTokenWasTicCompatible=false;}; + +CHAR_STRING : '"'! ("\"\"" | ~('"'))* '"'! + {lastTokenWasTicCompatible=true;}; + +NUMERIC_LIT : ( DIGIT )+ + ( '#' BASED_INTEGER ( '.' BASED_INTEGER )? '#' + | ( '_' ( DIGIT )+ )+ // INTEGER + )? + ( { LA(2)!='.' }? //&& LA(3)!='.' }? + ( '.' ( DIGIT )+ ( '_' ( DIGIT )+ )* ( EXPONENT )? + | EXPONENT + ) + )? + {lastTokenWasTicCompatible=false;}; + +// a couple protected methods to assist in matching the various numbers + +protected +DIGIT : ( '0'..'9' ) {lastTokenWasTicCompatible=false;}; + +protected +EXPONENT : ('e') ('+'|'-')? ( DIGIT )+ {lastTokenWasTicCompatible=false;}; + +protected +EXTENDED_DIGIT : ( DIGIT | 'a'..'f' ) {lastTokenWasTicCompatible=false;}; + +protected +BASED_INTEGER : ( EXTENDED_DIGIT ) ( ('_')? EXTENDED_DIGIT )* {lastTokenWasTicCompatible=false;}; + + +// Whitespace -- ignored +WS_ : ( ' ' + | '\t' + | '\f' + // handle newlines + | ( "\r\n" // Evil DOS + | '\r' // Macintosh + | '\n' // Unix (the right way) + ) + { newline(); } + ) + { $setType(antlr::Token::SKIP); } + ; + +// Single-line comments +COMMENT : COMMENT_INTRO (~('\n'|'\r'))* ('\n'|'\r'('\n')?) + { $setType(antlr::Token::SKIP); + newline(); + lastTokenWasTicCompatible=false; } + ; + diff --git a/languages/ada/ada.store.g b/languages/ada/ada.store.g new file mode 100644 index 00000000..dbca7312 --- /dev/null +++ b/languages/ada/ada.store.g @@ -0,0 +1,610 @@ +/* $Id$ + * ANTLR Ada tree walker for building the Kdevelop class store + * Copyright (C) 2003 Oliver Kellogg + */ + +header "pre_include_hpp" { +#include +#include +#include + +#include +#include "AdaAST.hpp" +#include "ada_utils.hpp" +} + +header "post_include_hpp" { +#include +#include +} + +options { + language="Cpp"; +} + +class AdaStoreWalker extends AdaTreeParserSuper; +options { + importVocab = Ada; + ASTLabelType = "RefAdaAST"; +} + +{ +private: + QString m_fileName; + QValueList m_scopeStack; + CodeModel* m_model; + QValueList m_imports; + NamespaceDom m_currentContainer; + int m_currentAccess; + bool m_addToStore; /* auxiliary variable: for the moment, this is `true' + only when we are in specs, not bodies. */ + bool m_isSubprogram; // auxiliary to def_id() + FileDom m_file; + +public: + void setCodeModel (CodeModel* model) { m_model = model; } + CodeModel* codeModel () { return m_model; } + const CodeModel* codeModel () const { return m_model; } + + QString fileName () const { return m_fileName; } + void setFileName (const QString& fileName) { m_fileName = fileName; } + + void init () { + m_scopeStack.clear (); + m_imports.clear (); + m_currentContainer = m_model->globalNamespace (); + m_scopeStack.append (m_currentContainer); + m_currentAccess = CodeModelItem::Public; + m_addToStore = false; + m_isSubprogram = false; + if (m_model->hasFile(m_fileName)) + m_model->removeFile (m_model->fileByName(m_fileName)); + m_file = m_model->create(); + m_file->setName(m_fileName); + m_model->addFile(m_file); + } + + void wipeout () { m_model->wipeout (); } +// void out () { m_store->out (); } + void removeWithReferences (const QString& fileName) { + m_model->removeFile (m_model->fileByName(fileName)); + } + NamespaceDom insertScopeContainer + (NamespaceDom scope, const QStringList & scopes ) { + QStringList::ConstIterator it = scopes.begin(); + QString prefix( *it ); + NamespaceDom ns = scope->namespaceByName( prefix ); +// kdDebug() << "insertScopeContainer begin with prefix " << prefix << endl; + if (!ns.data()) { +// kdDebug() << "insertScopeContainer: ns is empty" << endl; + ns = m_model->create(); +// kdDebug() << "insertScopeContainer: ns created" << endl; + ns->setName( prefix ); +// kdDebug() << "insertScopeContainer: ns name set" << endl; + scope->addNamespace( ns ); +// kdDebug() << "insertScopeContainer: ns added to a scope" << endl; + + if (scope == m_model->globalNamespace()) + m_file->addNamespace( ns ); + } +// kdDebug() << "insertScopeContainer: while" << endl; + while ( ++it != scopes.end() ) { + QString nameSegment( *it ); + prefix += "." + nameSegment; +// kdDebug() << "insertScopeContainer: while prefix = " << prefix << endl; + NamespaceDom inner = scope->namespaceByName( prefix ); + if (!inner.data() ) { +// kdDebug() << "insertScopeContainer: inner is empty " << endl; + inner = m_model->create(); +// kdDebug() << "insertScopeContainer: inner created " << endl; + inner->setName( nameSegment ); + ns->addNamespace( inner ); +// kdDebug() << "insertScopeContainer: inner added " << endl; + } + ns = inner; + } + return ns; + } + NamespaceDom defineScope( RefAdaAST namenode ) { + QStringList scopes( qnamelist( namenode ) ); +// kdDebug() << "defineScope: " << scopes.join(" ") << endl; + NamespaceDom psc = insertScopeContainer( m_currentContainer, scopes ); +// kdDebug() << "defineScope psc created" << endl; + psc->setStartPosition(namenode->getLine(), namenode->getColumn()); +// kdDebug() << "defineScope start position set" << endl; + psc->setFileName(m_fileName); +// kdDebug() << "defineScope file name set" << endl; + // psc->setEndPosition (endLine, 0); +// kdDebug() << "defineScope return" << endl; + return psc; + } +} + +/* + * Only those rules that require specific action for the kdevelop + * class store are overloaded here. + */ + +compilation_unit + : { init(); } + context_items_opt ( library_item | subunit ) ( pragma )* + ; + + +with_clause + : #(WITH_CLAUSE ( compound_name + // TBD: slurp in the actual files + )+ ) + ; + +/* +compound_name + : IDENTIFIER + | #(DOT compound_name IDENTIFIER) + ; + */ + +use_clause + : #(USE_TYPE_CLAUSE ( subtype_mark )+ ) + | #(USE_CLAUSE ( c:compound_name + { m_imports.back ().push_back (qtext (#c)); } + )+ ) + ; + + +library_item : + #(LIBRARY_ITEM + #(MODIFIERS ( PRIVATE { m_currentAccess = CodeModelItem::Protected; } )? ) + ( lib_subprog_decl_or_rename_or_inst_or_body + | #(PACKAGE_BODY pb:def_id pkg_body_part) + | #(GENERIC_PACKAGE_INSTANTIATION gpi:def_id + { + defineScope( #gpi ); + } + generic_inst + ) + | #(PACKAGE_SPECIFICATION ps:def_id + { + NamespaceDom psc = defineScope( #ps ); + m_currentContainer = psc; + m_scopeStack.append( psc ); + m_addToStore = true; + } + pkg_spec_part + { + m_scopeStack.remove(m_scopeStack.last()); + if (m_scopeStack.count() == 0) { + kdDebug() << "adastore: m_scopeStack is empty!" << endl; + m_scopeStack.append( m_model->globalNamespace() ); + } + m_currentContainer = m_scopeStack.last(); + // m_currentContainer->setEndPosition (endLine, 0); + m_addToStore = false; + } + ) + | #(PACKAGE_RENAMING_DECLARATION prd:def_id + { + defineScope( #prd ); + } + renames + ) + | generic_decl + ) + ) + ; + + +subprog_def_id + : { m_isSubprogram = true; } + def_id + { m_isSubprogram = false; } + ; + +subprog_decl + : #(GENERIC_PROCEDURE_INSTANTIATION subprog_def_id generic_inst) + | #(PROCEDURE_RENAMING_DECLARATION subprog_def_id formal_part_opt renames) + | #(PROCEDURE_DECLARATION subprog_def_id formal_part_opt) + | #(PROCEDURE_BODY_STUB subprog_def_id formal_part_opt) + | #(ABSTRACT_PROCEDURE_DECLARATION subprog_def_id formal_part_opt) + | #(GENERIC_FUNCTION_INSTANTIATION def_designator generic_inst) + | #(FUNCTION_RENAMING_DECLARATION def_designator function_tail renames) + | #(FUNCTION_DECLARATION def_designator function_tail) + | #(FUNCTION_BODY_STUB def_designator function_tail) + | #(ABSTRACT_FUNCTION_DECLARATION subprog_def_id function_tail) + ; + + +def_id + : cn:compound_name + { +// kdDebug() << "cn:compound_name started " << endl; + if (m_addToStore) { +// kdDebug() << "cn:compound_name m_addToStore " << endl; + if (m_isSubprogram) { +// kdDebug() << "cn:compound_name m_isSubprogram " << endl; + FunctionDom method = m_model->create(); + method->setName (qtext (cn)); + method->setFileName(m_fileName); +// kdDebug() << "cn:compound_name method->setStartPosition(" << endl; + method->setStartPosition(#cn->getLine(), #cn->getColumn()); + + if (m_currentContainer == m_model->globalNamespace()) + m_file->addFunction(method); + else + m_currentContainer->addFunction(method); + //FIXME: adymo: is this valid for CodeModel +/* ParsedMethod *old = m_currentContainer->getMethod (method); + if (old) { + delete (method); + method = old; + } else { + m_currentContainer->addMethod (method); + }*/ + } else { + // TBC: what about other declarations? + } + } + } + ; + +/* +generic_inst : compound_name ( value_s )? + ; + */ + +/* +formal_part_opt : #(FORMAL_PART_OPT ( parameter_specification )* ) + ; + */ + +/* +parameter_specification + : #(PARAMETER_SPECIFICATION defining_identifier_list modifiers + subtype_mark init_opt) + ; + */ + +/* +defining_identifier_list : #(DEFINING_IDENTIFIER_LIST ( IDENTIFIER )+ ) + ; + */ + +/* +renames : CHARACTER_STRING // CHARACTER_STRING should not really be there. + | OPERATOR_SYMBOL // OPERATOR_SYMBOL should be used instead. + | name + ; + */ + +/* +name : IDENTIFIER + | #(DOT name + ( ALL + | IDENTIFIER + | CHARACTER_LITERAL + | OPERATOR_SYMBOL + ) + ) + | #(INDEXED_COMPONENT name value_s) + | #(TIC name attribute_id) + ; + */ + +def_designator + : cn:compound_name + { +// kdDebug() << "def_designator cn:compound_name started" << endl; + if (m_addToStore) { +// kdDebug() << "def_designator cn:compound_name m_addToStore" << endl; + FunctionDom method = m_model->create(); + method->setName (qtext (cn)); + method->setFileName(m_fileName); +// kdDebug() << "def_designator cn:compound_name method->setStartPosition(" << endl; + method->setStartPosition(#cn->getLine(), #cn->getColumn()); + + if (m_currentContainer == m_model->globalNamespace()) + m_file->addFunction(method); + else + m_currentContainer->addFunction(method); + //FIXME: adymo: is this valid for CodeModel +/* ParsedMethod *old = m_currentContainer->getMethod (method); + if (old) { + delete method; + method = old; + } else { + m_currentContainer->addMethod (method); + }*/ + } + } + | definable_operator_symbol + ; + +/* +function_tail : formal_part_opt subtype_mark + ; + */ + +spec_decl_part + : #(GENERIC_PACKAGE_INSTANTIATION def_id generic_inst) + | #(PACKAGE_SPECIFICATION ps:def_id + { + NamespaceDom psc = defineScope( #ps ); + m_currentContainer = psc; + m_scopeStack.append( psc ); + m_addToStore = true; + } + pkg_spec_part + { + m_scopeStack.remove(m_scopeStack.last()); + if (m_scopeStack.count() == 0) { + kdDebug() << "adastore: m_scopeStack is empty!" << endl; + m_scopeStack.append( m_model->globalNamespace() ); + } + m_currentContainer = m_scopeStack.last(); + // m_currentContainer->setDeclarationEndsOnLine (endLine); + m_addToStore = false; + } + ) + | #(PACKAGE_RENAMING_DECLARATION def_id renames) + ; + +pkg_spec_part : + basic_declarative_items_opt + private_declarative_items_opt + end_id_opt + ; + +private_declarative_items_opt + : ( { m_currentAccess = CodeModelItem::Protected; } + ( basic_decl_item | pragma )+ + { m_currentAccess = CodeModelItem::Public; } + )? + ; + +/* +task_type_or_single_decl + : #(TASK_TYPE_DECLARATION def_id discrim_part_opt task_definition_opt) + | #(SINGLE_TASK_DECLARATION def_id task_definition_opt) + ; + */ + +/* +discriminant_specification + : #(DISCRIMINANT_SPECIFICATION defining_identifier_list + modifiers subtype_mark init_opt) + ; + */ + +/* +entry_declaration + : #(ENTRY_DECLARATION IDENTIFIER + discrete_subtype_def_opt formal_part_opt) + ; + */ + +/* +prot_op_decl + : entry_declaration + | #(PROCEDURE_DECLARATION def_id formal_part_opt) + | #(FUNCTION_DECLARATION def_designator function_tail) + | rep_spec + | pragma + ; + */ + +/* +prot_member_decl_s + : #(PROT_MEMBER_DECLARATIONS ( prot_op_decl | comp_decl )* ) + ; + +comp_decl + : #(COMPONENT_DECLARATION defining_identifier_list component_subtype_def init_opt) + ; + */ + +/* +// decl_common is shared between declarative_item and basic_decl_item. +// decl_common only contains specifications. +decl_common + : // type_def: + #(ENUMERATION_TYPE_DECLARATION IDENTIFIER enum_id_s) + | #(SIGNED_INTEGER_TYPE_DECLARATION IDENTIFIER range) + | #(MODULAR_TYPE_DECLARATION IDENTIFIER expression) + | #(FLOATING_POINT_DECLARATION IDENTIFIER expression range_constraint_opt) + | #(ORDINARY_FIXED_POINT_DECLARATION IDENTIFIER expression range) + | #(DECIMAL_FIXED_POINT_DECLARATION IDENTIFIER expression expression range_constraint_opt) + | array_type_declaration + | access_type_declaration + // + | #(INCOMPLETE_TYPE_DECLARATION IDENTIFIER discrim_part_opt) + // derived_or_private_or_record + | #(PRIVATE_EXTENSION_DECLARATION id_and_discrim modifiers subtype_ind) + | #(DERIVED_RECORD_EXTENSION id_and_discrim modifiers subtype_ind record_definition) + | #(ORDINARY_DERIVED_TYPE_DECLARATION id_and_discrim subtype_ind) + | #(PRIVATE_TYPE_DECLARATION id_and_discrim modifiers) + | #(RECORD_TYPE_DECLARATION id_and_discrim modifiers record_definition) + // + | #(SUBTYPE_DECLARATION IDENTIFIER subtype_ind) + | generic_decl + | use_clause + | rep_spec // enumeration_representation_clause only + | #(EXCEPTION_RENAMING_DECLARATION def_id compound_name) + | #(OBJECT_RENAMING_DECLARATION def_id subtype_mark name) + | #(EXCEPTION_DECLARATION defining_identifier_list) + | #(NUMBER_DECLARATION defining_identifier_list expression) + | #(ARRAY_OBJECT_DECLARATION defining_identifier_list modifiers + array_type_definition init_opt) + | #(OBJECT_DECLARATION defining_identifier_list modifiers + subtype_ind init_opt) + ; + */ + +/* +id_and_discrim + : IDENTIFIER discrim_part_opt + ; + */ + +/* +enumeration_literal_specification : IDENTIFIER | CHARACTER_LITERAL + ; + */ + +/* +array_type_declaration + : #(ARRAY_TYPE_DECLARATION IDENTIFIER array_type_definition) + ; + */ + +/* +access_type_declaration + : #(ACCESS_TO_PROCEDURE_DECLARATION IDENTIFIER modifiers formal_part_opt) + | #(ACCESS_TO_FUNCTION_DECLARATION IDENTIFIER modifiers function_tail) + | #(ACCESS_TO_OBJECT_DECLARATION IDENTIFIER modifiers subtype_ind) + ; + */ + + +generic_decl + : #(GENERIC_PACKAGE_RENAMING generic_formal_part_opt def_id renames) + | #(GENERIC_PACKAGE_DECLARATION generic_formal_part_opt gpd:def_id + { + NamespaceDom psc = defineScope( #gpd ); + m_currentContainer = psc; + m_scopeStack.append( psc ); + m_addToStore = true; + } + pkg_spec_part + { + m_scopeStack.remove(m_scopeStack.last()); + if (m_scopeStack.count() == 0) + m_scopeStack.append( m_model->globalNamespace() ); + m_currentContainer = m_scopeStack.last(); + // m_currentContainer->setDeclarationEndsOnLine (endLine); + m_addToStore = false; + } + ) + | #(GENERIC_PROCEDURE_RENAMING generic_formal_part_opt def_id + formal_part_opt renames) + | #(GENERIC_PROCEDURE_DECLARATION generic_formal_part_opt subprog_def_id + formal_part_opt) + | #(GENERIC_FUNCTION_RENAMING generic_formal_part_opt def_designator + function_tail renames) + | #(GENERIC_FUNCTION_DECLARATION generic_formal_part_opt subprog_def_id + function_tail) + ; + +/* +generic_formal_part_opt + : #(GENERIC_FORMAL_PART + ( pragma | use_clause | generic_formal_parameter )* + ) + ; + */ + +/* +generic_formal_parameter + : // FORMAL_TYPE_DECLARATIONs: + #(FORMAL_DISCRETE_TYPE_DECLARATION def_id) + | #(FORMAL_SIGNED_INTEGER_TYPE_DECLARATION def_id) + | #(FORMAL_MODULAR_TYPE_DECLARATION def_id) + | #(FORMAL_DECIMAL_FIXED_POINT_DECLARATION def_id) + | #(FORMAL_ORDINARY_FIXED_POINT_DECLARATION def_id) + | #(FORMAL_FLOATING_POINT_DECLARATION def_id) + | formal_array_type_declaration + | formal_access_type_declaration + | #(FORMAL_PRIVATE_TYPE_DECLARATION id_part modifiers) + | #(FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION id_part subtype_ind) + | #(FORMAL_PRIVATE_EXTENSION_DECLARATION id_part modifiers subtype_ind) + | #(FORMAL_PROCEDURE_DECLARATION def_id formal_part_opt + subprogram_default_opt) + | #(FORMAL_FUNCTION_DECLARATION def_designator function_tail + subprogram_default_opt) + | #(FORMAL_PACKAGE_DECLARATION def_id compound_name formal_package_actual_part_opt) + | parameter_specification + ; + */ + +lib_subprog_decl_or_rename_or_inst_or_body + : { m_addToStore = true; } + ( subprog_decl + | procedure_body + | function_body + ) + { m_addToStore = false; } + ; + +subprog_decl_or_rename_or_inst_or_body + : subprog_decl + | procedure_body + | function_body + ; + + +/* +// A declarative_item may appear in the declarative part of any body. +declarative_item + : #(PACKAGE_BODY_STUB def_id) + | #(PACKAGE_BODY def_id pkg_body_part) + | spec_decl_part + | #(TASK_BODY_STUB def_id) + | #(TASK_BODY def_id body_part) + | task_type_or_single_decl + | #(PROTECTED_BODY_STUB def_id) + | #(PROTECTED_BODY def_id prot_op_bodies_opt) + | prot_type_or_single_decl + | subprog_decl_or_rename_or_inst_or_body + | decl_common + ; + */ + + +subprog_decl_or_body + : procedure_body + | #(PROCEDURE_DECLARATION subprog_def_id formal_part_opt) + | function_body + | #(FUNCTION_DECLARATION def_designator function_tail) + ; + +/* +// Temporary, to be turned into just `qualified'. +// We get away with it because `qualified' is always mentioned +// together with `name'. +// Only exception: `code_stmt', which is not yet implemented. +name_or_qualified + : IDENTIFIER + | #(DOT name_or_qualified + ( ALL + | IDENTIFIER + | CHARACTER_LITERAL + | OPERATOR_SYMBOL + ) + ) + | #(INDEXED_COMPONENT name_or_qualified value_s) + | #(TIC name_or_qualified + ( parenthesized_primary + | attribute_id + ) + ) + ; + */ + +package_body + : #(PACKAGE_BODY id:def_id + /* TBD + { QString name (qtext (id)); + } + */ + pkg_body_part) + ; + +/* +task_body : #(TASK_BODY def_id body_part) + ; + */ + +/* +protected_body : #(PROTECTED_BODY def_id prot_op_bodies_opt) + ; + */ + diff --git a/languages/ada/ada.tree.g b/languages/ada/ada.tree.g new file mode 100644 index 00000000..df167dcd --- /dev/null +++ b/languages/ada/ada.tree.g @@ -0,0 +1,964 @@ +/* + * ANTLR Ada95 tree super grammar (base class) + * + * Oliver M. Kellogg + * + * $Id$ + * + */ + + +options { + language="Cpp"; +} + +class AdaTreeParserSuper extends TreeParser; +options { + importVocab=Ada; +} + +// Compilation Unit: This is the start rule. + +compilation_unit + : context_items_opt ( library_item | subunit ) ( pragma )* + ; + +pragma : #(PRAGMA IDENTIFIER ( pragma_arg )* ) + ; + +pragma_arg + : #(RIGHT_SHAFT IDENTIFIER expression) + | expression + ; + +context_items_opt + : #(CONTEXT_CLAUSE ( pragma | with_clause | use_clause )* ) + ; + +with_clause + : #(WITH_CLAUSE ( compound_name )+ ) + ; + +compound_name + : IDENTIFIER + | #(DOT compound_name IDENTIFIER) + ; + +use_clause + : #(USE_TYPE_CLAUSE ( subtype_mark )+ ) + | #(USE_CLAUSE ( compound_name )+ ) + ; + +subtype_mark + : compound_name + | #(TIC compound_name attribute_id) + ; + +attribute_id : RANGE + | DIGITS + | DELTA + | ACCESS + | IDENTIFIER + ; + +library_item : + #(LIBRARY_ITEM modifiers + ( subprog_decl_or_rename_or_inst_or_body + | #(PACKAGE_BODY def_id pkg_body_part) + | #(GENERIC_PACKAGE_INSTANTIATION def_id generic_inst) + | #(PACKAGE_SPECIFICATION def_id pkg_spec_part) + | #(PACKAGE_RENAMING_DECLARATION def_id renames) + | generic_decl + ) + ) + ; + +modifiers : #(MODIFIERS + ( ABSTRACT + | ACCESS + | ALIASED + | ALL + | CONSTANT + | IN + | LIMITED + | OUT + | PRIVATE + | PROTECTED + | REVERSE + | TAGGED + )* + // We can afford to be this loose because the parser + // has already fended off illegal usages, i.e. we can + // be sure that we are only dealing with permissible + // values for each usage context here. + // Only exception: PRIVATE as the prefix of private + // {generic|package|subprogram} library-level decl. + // The parser has let this in for bodies as well + // (which is not legal), so we need a semantic check. + ) + ; + +id_opt : #(ID_OPT ( def_designator )? ) + ; + +end_id_opt : #(END ( def_designator )? ) + ; + +subprog_decl + : #(GENERIC_PROCEDURE_INSTANTIATION def_id generic_inst) + | #(PROCEDURE_RENAMING_DECLARATION def_id formal_part_opt renames) + | #(PROCEDURE_DECLARATION def_id formal_part_opt) + | #(PROCEDURE_BODY_STUB def_id formal_part_opt) + | #(ABSTRACT_PROCEDURE_DECLARATION def_id formal_part_opt) + | #(GENERIC_FUNCTION_INSTANTIATION def_designator generic_inst) + | #(FUNCTION_RENAMING_DECLARATION def_designator function_tail renames) + | #(FUNCTION_DECLARATION def_designator function_tail) + | #(FUNCTION_BODY_STUB def_designator function_tail) + | #(ABSTRACT_FUNCTION_DECLARATION def_id function_tail) + ; + +def_id : compound_name // Can afford looseness because parser is tight. + ; + +generic_inst : compound_name ( value_s )? + ; + +value : #(OTHERS expression) + | #(RIGHT_SHAFT ranged_expr_s expression) + | ranged_expr_s + ; + +ranged_expr_s + : #(PIPE ranged_expr_s ranged_expr) + | ranged_expr + ; + +ranged_expr + : #(DOT_DOT expression simple_expression) + | #(RANGE expression range) + | expression + ; + +range_constraint : #(RANGE_CONSTRAINT range) + ; + +range : ( range_dots + | range_attrib_ref + ) + ; + +range_dots : #(DOT_DOT simple_expression simple_expression) + ; + +range_attrib_ref : #(RANGE_ATTRIBUTE_REFERENCE prefix ( expression )? ) + ; + +prefix : IDENTIFIER + | #(DOT prefix ( ALL | IDENTIFIER ) ) + | #(INDEXED_COMPONENT prefix value_s ) + ; + +formal_part_opt : #(FORMAL_PART_OPT ( parameter_specification )* ) + ; + +parameter_specification + : #(PARAMETER_SPECIFICATION defining_identifier_list modifiers + subtype_mark init_opt) + ; + +defining_identifier_list : #(DEFINING_IDENTIFIER_LIST ( IDENTIFIER )+ ) + ; + +renames : CHARACTER_STRING // CHARACTER_STRING should not really be there. + | OPERATOR_SYMBOL // OPERATOR_SYMBOL should be used instead. + | name + ; + +name : IDENTIFIER + | #(DOT name + ( ALL + | IDENTIFIER + | CHARACTER_LITERAL + | OPERATOR_SYMBOL + ) + ) + | #(INDEXED_COMPONENT name value_s) + | #(TIC name attribute_id) + ; + +definable_operator_symbol : OPERATOR_SYMBOL + ; + +parenthesized_primary + : #(PARENTHESIZED_PRIMARY ( NuLL | value_s extension_opt ) ) + ; + +extension_opt : #(EXTENSION_OPT ( NuLL | value_s )? ) + ; + +def_designator + : compound_name + | definable_operator_symbol + ; + +function_tail : formal_part_opt subtype_mark + ; + +spec_decl_part + : #(GENERIC_PACKAGE_INSTANTIATION def_id generic_inst) + | #(PACKAGE_SPECIFICATION def_id pkg_spec_part) + | #(PACKAGE_RENAMING_DECLARATION def_id renames) + ; + +pkg_spec_part + : basic_declarative_items_opt + private_declarative_items_opt + end_id_opt + ; + +basic_declarative_items_opt + : #(BASIC_DECLARATIVE_ITEMS_OPT ( basic_decl_item )* ) + ; + +private_declarative_items_opt + : #(PRIVATE_DECLARATIVE_ITEMS_OPT ( basic_decl_item )* ) + ; + +basic_decl_item + : spec_decl_part + | task_type_or_single_decl + | prot_type_or_single_decl + | subprog_decl + | decl_common + ; + +task_type_or_single_decl + : #(TASK_TYPE_DECLARATION def_id discrim_part_opt task_definition_opt) + | #(SINGLE_TASK_DECLARATION def_id task_definition_opt) + ; + +task_definition_opt + : task_items_opt private_task_items_opt + ; + +discrim_part_opt + : #(DISCRIM_PART_OPT ( BOX | discriminant_specifications )? ) + ; + +discriminant_specifications + : #(DISCRIMINANT_SPECIFICATIONS ( discriminant_specification )* ) + ; + +discriminant_specification + : #(DISCRIMINANT_SPECIFICATION defining_identifier_list + modifiers subtype_mark init_opt) + ; + +init_opt : #(INIT_OPT ( expression )? ) + ; // `expression' is of course much too loose; + // semantic checks are required in the usage contexts. + +task_items_opt + : #(TASK_ITEMS_OPT entrydecls_repspecs_opt) + ; + +entrydecls_repspecs_opt + : ( entry_declaration | pragma | rep_spec )* + ; + +entry_declaration + : #(ENTRY_DECLARATION IDENTIFIER + discrete_subtype_def_opt formal_part_opt) + ; + +discrete_subtype_def_opt + : #(DISCRETE_SUBTYPE_DEF_OPT ( discrete_subtype_definition )? ) + ; + +discrete_subtype_definition // TBD + : range + | subtype_ind + ; + +rep_spec : #(RECORD_REPRESENTATION_CLAUSE subtype_mark align_opt comp_loc_s) + | #(AT_CLAUSE subtype_mark expression) + | #(ATTRIBUTE_DEFINITION_CLAUSE subtype_mark expression) + // attrib_def. Semantic check must ensure that the + // subtype_mark contains an attribute reference. + | #(ENUMERATION_REPESENTATION_CLAUSE local_enum_name enumeration_aggregate) + ; + +align_opt : #(MOD_CLAUSE_OPT ( expression )? ) + ; + +comp_loc_s + : #(COMPONENT_CLAUSES_OPT + ( pragma + | subtype_mark expression range + )* + ) + ; + +private_task_items_opt + : #(PRIVATE_TASK_ITEMS_OPT entrydecls_repspecs_opt ) + ; + +prot_type_or_single_decl + : #(PROTECTED_TYPE_DECLARATION def_id discrim_part_opt protected_definition) + | #(SINGLE_PROTECTED_DECLARATION def_id protected_definition) + ; + +prot_private_opt : #(PROT_PRIVATE_OPT ( prot_member_decl_s )? ) + ; + +protected_definition + : prot_op_decl_s prot_private_opt end_id_opt + ; + +prot_op_decl_s + : #(PROT_OP_DECLARATIONS ( prot_op_decl )* ) + ; + +prot_op_decl + : entry_declaration + | #(PROCEDURE_DECLARATION def_id formal_part_opt) + | #(FUNCTION_DECLARATION def_designator function_tail) + | rep_spec + | pragma + ; + +prot_member_decl_s + : #(PROT_MEMBER_DECLARATIONS ( prot_op_decl | comp_decl )* ) + ; + +comp_decl + : #(COMPONENT_DECLARATION defining_identifier_list component_subtype_def init_opt) + ; + +// decl_common is shared between declarative_item and basic_decl_item. +// decl_common only contains specifications. +decl_common + : // type_def: + #(ENUMERATION_TYPE_DECLARATION IDENTIFIER enum_id_s) + | #(SIGNED_INTEGER_TYPE_DECLARATION IDENTIFIER range) + | #(MODULAR_TYPE_DECLARATION IDENTIFIER expression) + | #(FLOATING_POINT_DECLARATION IDENTIFIER expression range_constraint_opt) + | #(ORDINARY_FIXED_POINT_DECLARATION IDENTIFIER expression range) + | #(DECIMAL_FIXED_POINT_DECLARATION IDENTIFIER expression expression range_constraint_opt) + | array_type_declaration + | access_type_declaration + // + | #(INCOMPLETE_TYPE_DECLARATION IDENTIFIER discrim_part_opt) + // derived_or_private_or_record + | #(PRIVATE_EXTENSION_DECLARATION id_and_discrim modifiers subtype_ind) + | #(DERIVED_RECORD_EXTENSION id_and_discrim modifiers subtype_ind record_definition) + | #(ORDINARY_DERIVED_TYPE_DECLARATION id_and_discrim subtype_ind) + | #(PRIVATE_TYPE_DECLARATION id_and_discrim modifiers) + | #(RECORD_TYPE_DECLARATION id_and_discrim modifiers record_definition) + // + | #(SUBTYPE_DECLARATION IDENTIFIER subtype_ind) + | generic_decl + | use_clause + | rep_spec // enumeration_representation_clause only + | #(EXCEPTION_RENAMING_DECLARATION def_id compound_name) + | #(OBJECT_RENAMING_DECLARATION def_id subtype_mark name) + | #(EXCEPTION_DECLARATION defining_identifier_list) + | #(NUMBER_DECLARATION defining_identifier_list expression) + | #(ARRAY_OBJECT_DECLARATION defining_identifier_list modifiers + array_type_definition init_opt) + | #(OBJECT_DECLARATION defining_identifier_list modifiers + subtype_ind init_opt) + ; + +id_and_discrim + : IDENTIFIER discrim_part_opt + ; + +enum_id_s : ( enumeration_literal_specification )+ + ; + +enumeration_literal_specification : IDENTIFIER | CHARACTER_LITERAL + ; + +array_type_definition + : index_or_discrete_range_s component_subtype_def + ; + +range_constraint_opt : ( range_constraint )? + ; + +array_type_declaration + : #(ARRAY_TYPE_DECLARATION IDENTIFIER array_type_definition) + ; + +index_or_discrete_range_s + : index_or_discrete_range + | #(COMMA index_or_discrete_range_s index_or_discrete_range) + ; + +index_or_discrete_range + : #(DOT_DOT simple_expression simple_expression) + | #(RANGE simple_expression ( BOX | range) ) + | simple_expression + ; + +component_subtype_def : modifiers subtype_ind // mod=aliased_opt + ; + +subtype_ind + : #(SUBTYPE_INDICATION subtype_mark constraint_opt) + ; + +constraint_opt + : ( range_constraint + | digits_constraint + | delta_constraint + | index_constraint + | discriminant_constraint + )? + ; + +digits_constraint + : #(DIGITS_CONSTRAINT expression range_constraint_opt) + ; + +delta_constraint + : #(DELTA_CONSTRAINT expression range_constraint_opt) + ; + +index_constraint + : #(INDEX_CONSTRAINT ( discrete_range )+ ) + ; + +discrete_range + : range + | subtype_ind + ; + +discriminant_constraint + : #(DISCRIMINANT_CONSTRAINT ( discriminant_association )+ ) + ; + +discriminant_association + : #(DISCRIMINANT_ASSOCIATION selector_names_opt expression) + ; + +selector_names_opt + : #(SELECTOR_NAMES_OPT ( selector_name )* ) + ; + +selector_name : IDENTIFIER // TBD: sem pred + ; + +access_type_declaration + : #(ACCESS_TO_PROCEDURE_DECLARATION IDENTIFIER modifiers formal_part_opt) + | #(ACCESS_TO_FUNCTION_DECLARATION IDENTIFIER modifiers function_tail) + | #(ACCESS_TO_OBJECT_DECLARATION IDENTIFIER modifiers subtype_ind) + ; + +record_definition : ( component_list )? + ; + +component_list + : component_items ( variant_part )? + ; + +component_items + : #(COMPONENT_ITEMS ( pragma | comp_decl )* ) + ; + +variant_part + : #(VARIANT_PART discriminant_direct_name variant_s) + ; + +discriminant_direct_name : IDENTIFIER // TBD: symtab lookup. + ; + +variant_s : #(VARIANTS ( variant )+ ) + ; + +variant : #(VARIANT choice_s ( component_list )? ) + ; + +choice_s : #(PIPE choice_s choice ) + | choice + ; + +choice : OTHERS + | discrete_with_range + | expression + ; + +discrete_with_range : mark_with_constraint | range + ; + +mark_with_constraint + : #(MARK_WITH_CONSTRAINT subtype_mark range_constraint) + ; + +local_enum_name : IDENTIFIER // to be refined: do a symbol table lookup + ; + +enumeration_aggregate : ( value )* + ; + +generic_decl + : #(GENERIC_PACKAGE_RENAMING generic_formal_part_opt def_id renames) + | #(GENERIC_PACKAGE_DECLARATION generic_formal_part_opt def_id + pkg_spec_part) + | #(GENERIC_PROCEDURE_RENAMING generic_formal_part_opt def_id + formal_part_opt renames) + | #(GENERIC_PROCEDURE_DECLARATION generic_formal_part_opt def_id + formal_part_opt) + | #(GENERIC_FUNCTION_RENAMING generic_formal_part_opt def_designator + function_tail renames) + | #(GENERIC_FUNCTION_DECLARATION generic_formal_part_opt def_id + function_tail) + ; + +generic_formal_part_opt + : #(GENERIC_FORMAL_PART + ( pragma | use_clause | generic_formal_parameter )* + ) + ; + +generic_formal_parameter + : // FORMAL_TYPE_DECLARATIONs: + #(FORMAL_DISCRETE_TYPE_DECLARATION def_id) + | #(FORMAL_SIGNED_INTEGER_TYPE_DECLARATION def_id) + | #(FORMAL_MODULAR_TYPE_DECLARATION def_id) + | #(FORMAL_DECIMAL_FIXED_POINT_DECLARATION def_id) + | #(FORMAL_ORDINARY_FIXED_POINT_DECLARATION def_id) + | #(FORMAL_FLOATING_POINT_DECLARATION def_id) + | formal_array_type_declaration + | formal_access_type_declaration + | #(FORMAL_PRIVATE_TYPE_DECLARATION id_part modifiers) + | #(FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION id_part subtype_ind) + | #(FORMAL_PRIVATE_EXTENSION_DECLARATION id_part modifiers subtype_ind) + | #(FORMAL_PROCEDURE_DECLARATION def_id formal_part_opt + subprogram_default_opt) + | #(FORMAL_FUNCTION_DECLARATION def_designator function_tail + subprogram_default_opt) + | #(FORMAL_PACKAGE_DECLARATION def_id compound_name formal_package_actual_part_opt) + | parameter_specification + ; + + +id_part : def_id discrim_part_opt + ; + +formal_array_type_declaration : array_type_declaration + ; + +formal_access_type_declaration : access_type_declaration + ; + +subprogram_default_opt : ( BOX | name )? + // #(SUBPROGRAM_DEFAULT_OPT ( BOX | name )? ) + ; + +formal_package_actual_part_opt + : ( BOX | defining_identifier_list )? + ; + +subprog_decl_or_rename_or_inst_or_body + : subprog_decl + | procedure_body + | function_body + ; + +procedure_body + : #(PROCEDURE_BODY def_id formal_part_opt body_part) + ; + +function_body + : #(FUNCTION_BODY def_designator function_tail body_part) + ; + +body_part : declarative_part block_body end_id_opt + ; + +declarative_part + : #(DECLARATIVE_PART ( pragma | declarative_item )* ) + ; + +// A declarative_item may appear in the declarative part of any body. +declarative_item + : #(PACKAGE_BODY_STUB def_id) + | #(PACKAGE_BODY def_id pkg_body_part) + | spec_decl_part + | #(TASK_BODY_STUB def_id) + | #(TASK_BODY def_id body_part end_id_opt) + | task_type_or_single_decl + | #(PROTECTED_BODY_STUB def_id) + | #(PROTECTED_BODY def_id prot_op_bodies_opt end_id_opt) + | prot_type_or_single_decl + | subprog_decl_or_rename_or_inst_or_body + | decl_common + ; + +pkg_body_part : declarative_part block_body_opt end_id_opt + ; + +block_body_opt + : #(BLOCK_BODY_OPT ( handled_stmt_s )? ) + ; + +prot_op_bodies_opt + : #(PROT_OP_BODIES_OPT + ( pragma | entry_body | subprog_decl_or_body )* + ) + ; + +subprog_decl_or_body + : procedure_body + | #(PROCEDURE_DECLARATION def_id formal_part_opt) + | function_body + | #(FUNCTION_DECLARATION def_designator function_tail) + ; + +block_body : #(BLOCK_BODY handled_stmt_s) + ; + +handled_stmt_s + : #(HANDLED_SEQUENCE_OF_STATEMENTS statements except_handler_part_opt) + ; + +handled_stmts_opt + : #(HANDLED_STMTS_OPT ( statements except_handler_part_opt )? ) + ; + +statements + : #(SEQUENCE_OF_STATEMENTS ( pragma | statement )+ ) + ; + +statement : #(STATEMENT def_label_opt + ( null_stmt + | exit_stmt + | return_stmt + | goto_stmt + | delay_stmt + | abort_stmt + | raise_stmt + | requeue_stmt + | accept_stmt + | select_stmt + | if_stmt + | case_stmt + | loop_stmt id_opt + | block end_id_opt + | call_or_assignment + // | code_stmt // not yet implemented in parser + ) + ) + ; + +def_label_opt : #(LABEL_OPT ( IDENTIFIER )? ) + ; + +null_stmt : NULL_STATEMENT + ; + +if_stmt : #(IF_STATEMENT cond_clause elsifs_opt else_opt) + ; + +cond_clause : #(COND_CLAUSE condition statements) + ; + +condition : expression + ; + +elsifs_opt : #(ELSIFS_OPT ( cond_clause )* ) + ; + +else_opt : #(ELSE_OPT ( statements )? ) + ; + +case_stmt : #(CASE_STATEMENT expression alternative_s) + ; + +alternative_s : ( case_statement_alternative )+ + ; + +case_statement_alternative + : #(CASE_STATEMENT_ALTERNATIVE choice_s statements) + ; + +loop_stmt + : #(LOOP_STATEMENT iteration_scheme_opt statements) + ; + +iteration_scheme_opt + : #(ITERATION_SCHEME_OPT + ( #(WHILE condition) + | #(FOR IDENTIFIER modifiers discrete_subtype_definition) + )? // mod=reverse_opt + ) + ; + +block : #(BLOCK_STATEMENT declare_opt block_body) + ; + +declare_opt + : #(DECLARE_OPT ( declarative_part )? ) + ; + +exit_stmt + : #(EXIT_STATEMENT ( label_name )? ( WHEN condition )? ) // TBD !!! + ; + +label_name : IDENTIFIER + ; + +return_stmt + : #(RETURN_STATEMENT ( expression )? ) + ; + +goto_stmt : #(GOTO_STATEMENT label_name) + ; + +call_or_assignment + : #(ASSIGNMENT_STATEMENT name expression) + | #(CALL_STATEMENT name) + ; + +entry_body + : #(ENTRY_BODY def_id entry_body_formal_part entry_barrier body_part) + ; + +entry_body_formal_part : entry_index_spec_opt formal_part_opt + ; + +entry_index_spec_opt + : #(ENTRY_INDEX_SPECIFICATION ( def_id discrete_subtype_definition )? ) + ; + +entry_barrier : condition + ; + +entry_call_stmt + : #(ENTRY_CALL_STATEMENT name) + ; + +accept_stmt + : #(ACCEPT_STATEMENT def_id entry_index_opt formal_part_opt + handled_stmts_opt end_id_opt ) + ; + +entry_index_opt + : #(ENTRY_INDEX_OPT ( expression )? ) + ; + +delay_stmt + : #(DELAY_STATEMENT modifiers expression) //mod=until_opt + ; + +// SELECT_STATEMENT itself is not modeled since it is trivially +// reconstructed: +// select_statement ::= selective_accept | timed_entry_call +// | conditional_entry_call | asynchronous_select +// +select_stmt + : #(ASYNCHRONOUS_SELECT triggering_alternative abortable_part) + | #(SELECTIVE_ACCEPT selective_accept) + | #(TIMED_ENTRY_CALL entry_call_alternative delay_alternative) + | #(CONDITIONAL_ENTRY_CALL entry_call_alternative statements) + ; + +triggering_alternative + : #(TRIGGERING_ALTERNATIVE + ( delay_stmt | entry_call_stmt ) stmts_opt + ) + ; + +abortable_part + : #(ABORTABLE_PART stmts_opt) + ; + +entry_call_alternative + : #(ENTRY_CALL_ALTERNATIVE entry_call_stmt stmts_opt) + ; + +selective_accept : guard_opt select_alternative or_select_opt else_opt + ; + +guard_opt : #(GUARD_OPT ( condition ( pragma )* )? ) + ; + +select_alternative + : accept_alternative + | delay_alternative + | TERMINATE_ALTERNATIVE + ; + +accept_alternative + : #(ACCEPT_ALTERNATIVE accept_stmt stmts_opt) + ; + +delay_alternative + : #(DELAY_ALTERNATIVE delay_stmt stmts_opt) + ; + +stmts_opt : ( pragma | statement )* + ; + +or_select_opt + : #(OR_SELECT_OPT ( guard_opt select_alternative )* ) + ; + +abort_stmt + : #(ABORT_STATEMENT ( name )+ ) + ; + +except_handler_part_opt + : #(EXCEPT_HANDLER_PART_OPT ( exception_handler )* ) + ; + +exception_handler + : #(EXCEPTION_HANDLER identifier_colon_opt except_choice_s + statements + ) + ; + +identifier_colon_opt + : #(IDENTIFIER_COLON_OPT ( IDENTIFIER )? ) + ; + +except_choice_s + : #(PIPE except_choice_s exception_choice) + | exception_choice + ; + +exception_choice : compound_name + | OTHERS + ; + +raise_stmt + : #(RAISE_STATEMENT ( compound_name )? ) + ; + +requeue_stmt + : #(REQUEUE_STATEMENT name ( ABORT )? ) + ; + +operator_call : #(OPERATOR_SYMBOL value_s) + ; + +value_s : #(VALUES ( value )+ ) + ; + +expression + : #(AND expression relation) + | #(AND_THEN expression relation) + | #(OR expression relation) + | #(OR_ELSE expression relation) + | #(XOR expression relation) + | relation + ; + +relation + : #(IN simple_expression range_or_mark) + | #(NOT_IN simple_expression range_or_mark) + | #(EQ simple_expression simple_expression) + | #(NE simple_expression simple_expression) + | #(LT_ simple_expression simple_expression) + | #(LE simple_expression simple_expression) + | #(GT simple_expression simple_expression) + | #(GE simple_expression simple_expression) + | simple_expression + ; + +range_or_mark + : range + | subtype_mark + ; + +simple_expression + : #(PLUS simple_expression signed_term) + | #(MINUS simple_expression signed_term) + | #(CONCAT simple_expression signed_term) + | signed_term + ; + +signed_term + : #(UNARY_PLUS term) + | #(UNARY_MINUS term) + | term + ; + +term : #(STAR term factor) + | #(DIV term factor) + | #(MOD term factor) + | #(REM term factor) + | factor + ; + +factor : #(NOT primary) + | #(ABS primary) + | #(EXPON primary primary) + | primary + ; + +primary : + ( name_or_qualified + | parenthesized_primary + | allocator + | NuLL + | NUMERIC_LIT + | CHARACTER_LITERAL + | CHAR_STRING + | operator_call + ) + ; + +// Temporary, to be turned into just `qualified'. +// We get away with it because `qualified' is always mentioned +// together with `name'. +// Only exception: `code_stmt', which is not yet implemented. +name_or_qualified + : IDENTIFIER + | #(DOT name_or_qualified + ( ALL + | IDENTIFIER + | CHARACTER_LITERAL + | OPERATOR_SYMBOL + ) + ) + | #(INDEXED_COMPONENT name_or_qualified value_s) + | #(TIC name_or_qualified + ( parenthesized_primary + | attribute_id + ) + ) + ; + +allocator : #(ALLOCATOR name_or_qualified) + ; + +subunit : #(SUBUNIT compound_name + ( subprogram_body + | package_body + | task_body + | protected_body + ) + ) + ; + +subprogram_body + : procedure_body + | function_body + ; + +package_body : #(PACKAGE_BODY def_id pkg_body_part) + ; + +task_body : #(TASK_BODY def_id body_part) + ; + +protected_body : #(PROTECTED_BODY def_id prot_op_bodies_opt) + ; + +// TBD +// code_stmt : #(CODE_STATEMENT qualified) +// ; + diff --git a/languages/ada/ada_utils.cpp b/languages/ada/ada_utils.cpp new file mode 100644 index 00000000..9630f058 --- /dev/null +++ b/languages/ada/ada_utils.cpp @@ -0,0 +1,69 @@ +/* + */ +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "ada_utils.hpp" +#include "adasupport.hpp" + +QString qtext (const RefAdaAST& n) +{ + return QString::fromLatin1 (text (n).c_str ()); +} + +QStringList qnamelist (const RefAdaAST& n) +{ + QString txt = qtext (n); + // kdDebug() << "qnamelist: input is " << txt << endl; + return QStringList::split ('.', txt); +} + +QString ada_spec_filename (const QString& comp_unit_name) +{ + QString fn (comp_unit_name.lower ()); + + fn.replace (QRegExp("."), "-"); + fn += ".ads"; + return fn; +} + +QString fq_specfilename (const QString& comp_unit_name) +{ + QString fname = ada_spec_filename (comp_unit_name); + + if (QFile::exists (fname)) + return fname; + + QString adaincpath = getenv ("ADA_INCLUDE_PATH"); + if (adaincpath.isNull ()) + return QString::null; + + QStringList dirs = QStringList::split (':', adaincpath); + QString fq_filename; + for (QStringList::Iterator it = dirs.begin (); it != dirs.end (); it++) { + fq_filename = *it; + if (! fq_filename.endsWith ("/")) + fq_filename += "/"; + fq_filename += fname; + if (QFile::exists (fq_filename)) + return fq_filename; + } + if (fname.startsWith ("ada-") || + fname.startsWith ("text_io") || + fname.startsWith ("system") || + fname.startsWith ("unchecked_")) { + kdDebug () << "resolution of Ada predefined library is TBD" << endl; + } else { + kdDebug () << "Cannot find file " << fname << endl; + } + return QString::null; +} + diff --git a/languages/ada/ada_utils.hpp b/languages/ada/ada_utils.hpp new file mode 100644 index 00000000..b1df43dd --- /dev/null +++ b/languages/ada/ada_utils.hpp @@ -0,0 +1,15 @@ +/* + */ +#ifndef ADA_UTILS_H +#define ADA_UTILS_H + +#include +#include "AdaAST.hpp" + +QString qtext (const RefAdaAST& n); +QStringList qnamelist (const RefAdaAST& n); +QString ada_spec_filename (const QString& comp_unit_name); +QString fq_specfilename (const QString& comp_unit_name); + +#endif + diff --git a/languages/ada/adasupport.cpp b/languages/ada/adasupport.cpp new file mode 100644 index 00000000..6b877b7b --- /dev/null +++ b/languages/ada/adasupport.cpp @@ -0,0 +1,168 @@ +#include +#include +#include +#include +#include +#include +#include +#include "AdaParser.hpp" +#include "AdaTokenTypes.hpp" +#include "adasupport.hpp" + +#define eq !strcmp + +using namespace std; + +const RefAdaAST AdaAST::nullAdaAST(antlr::nullAST.get() ); + +using namespace std; + +string text (const RefAdaAST& n) +{ + if (n == 0 || n == AdaAST::nullAdaAST) + return ""; + string retval; + int type = n->getType(); + if (type == AdaTokenTypes::DOT) { + const RefAdaAST& sibs = n->down (); + retval = text (sibs); + retval.append ("."); + retval.append (text (sibs->right())); + } else { + retval = n->getText(); + } + /* + const RefAdaAST& r = n->right(); + if (r != 0 && r->getType () == AdaTokenTypes::DOT) { + retval.append ("."); + retval.append (text (r->right())); + } + */ + return retval; +} + +int txteq (RefAdaAST n1, RefAdaAST n2) +{ + if (!n1 || !n2 || n1 == antlr::nullAST || n2 == antlr::nullAST) + return 0; + const char* s1 = n1->getText().c_str(); + const char* s2 = n2->getText().c_str(); + if (strcasecmp (s1, s2) != 0) + return 0; + n1 = n1->right (); + n2 = n2->right (); + if (!n1 || !n2 || n1 == antlr::nullAST || n2 == antlr::nullAST) + return 1; + if (n1->getType () == AdaTokenTypes::DOT) + if (n2->getType () == AdaTokenTypes::DOT) + return txteq (n1->right (), n2->right ()); + else + return 0; + else if (n2->getType () == AdaTokenTypes::DOT) + return 0; + return 1; +} + +std::stack defid_stack; + +void AdaParser::push_def_id (const RefAdaAST& defid) +{ +#ifdef __DEBUG__ + string txt (text (defid)); + printf ("push_def_id: pushing %s\n", txt.c_str()); +#endif + defid_stack.push (defid); +} + +const RefAdaAST& AdaParser::pop_def_id () +{ + if (defid_stack.size() == 0) { + fprintf (stderr, "pop_def_id() called on empty stack\n"); + // return static_cast(antlr::nullAST); + return AdaAST::nullAdaAST; + } + RefAdaAST& top = defid_stack.top (); +#ifdef __DEBUG__ + string txt (text (top)); + printf ("pop_def_id: popping %s\n", txt.c_str()); +#endif + defid_stack.pop (); + return top; +} + +bool AdaParser::end_id_matches_def_id (const RefAdaAST& endid) +{ + if (defid_stack.size() == 0) + return false; + RefAdaAST& top = defid_stack.top (); + string defid (text (top)); + defid_stack.pop(); + if (endid == 0 || endid == antlr::nullAST) + return false; + string txt (text (endid)); + if (strcasecmp (defid.c_str (), txt.c_str ()) != 0) { + string errtxt ("End id "); + errtxt.append (txt); + errtxt.append (" does not match "); + errtxt.append (defid); + reportError (errtxt); + return false; + } +#ifdef __DEBUG__ + printf ("end_id_matches_def_id: popped %s\n", txt.c_str()); +#endif + return true; +} + +char * strtolower (char *string) +{ + char *p = string; + if (!p) + return NULL; + while (*p) + { + if (isupper (*p)) + *p = tolower (*p); + p++; + } + return string; +} + +char * extracted_operator (const char *string) +{ + int len = strlen (string); + static char op[10]; + + if (len < 4 && len > 5 || *string != '"' || *(string + len - 1) != '"') + return NULL; + + strcpy (op, string + 1); + op[len - 2] = '\0'; /* discard ending quotation mark */ + strtolower (op); + return op; +} + +bool AdaParser::definable_operator (const char *string) +{ // operator_symbol sans "/=" + char *op = extracted_operator (string); + if (op == NULL) + return false; + return + (eq (op, "=") || + eq (op, "<") || eq (op, ">") || + eq (op, "<=") || eq (op, ">=") || + eq (op, "&") || eq (op, "**") || + eq (op, "*") || eq (op, "/") || eq (op, "+") || eq (op, "-") || + eq (op, "abs") || eq (op, "rem") || eq (op, "mod") || + eq (op, "and") || eq (op, "or") || eq (op, "xor") || eq (op, "not")); +} + +bool AdaParser::is_operator_symbol (const char *string) +{ + char *op; + if (definable_operator (string)) + return true; + op = extracted_operator (string); + return (eq (op, "/=")); +} + diff --git a/languages/ada/adasupport.hpp b/languages/ada/adasupport.hpp new file mode 100644 index 00000000..9d65e0e5 --- /dev/null +++ b/languages/ada/adasupport.hpp @@ -0,0 +1,13 @@ +/* + */ +#ifndef ADASUPPORT_H +#define ADASUPPORT_H + +#include +#include "AdaAST.hpp" + +std::string text (const RefAdaAST& n); +int txteq (RefAdaAST n1, RefAdaAST n2); + +#endif + diff --git a/languages/ada/adasupportpart.cpp b/languages/ada/adasupportpart.cpp new file mode 100644 index 00000000..39ead02a --- /dev/null +++ b/languages/ada/adasupportpart.cpp @@ -0,0 +1,376 @@ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "kdevgenericfactory.h" +#include "kdevcore.h" +#include "kdevproject.h" +#include "kdevmainwindow.h" +#include "kdevpartcontroller.h" +#include "codemodel.h" +#include "adasupportpart.h" +#include "problemreporter.h" +#include "backgroundparser.h" + +#include "AdaLexer.hpp" +#include "AdaParser.hpp" +#include "AdaStoreWalker.hpp" +#include "AdaAST.hpp" + +#include + +enum { KDEV_DB_VERSION = 6 }; +enum { KDEV_PCS_VERSION = 6 }; + +typedef KDevGenericFactory AdaSupportPartFactory; + +static const KDevPluginInfo data("kdevadasupport"); +K_EXPORT_COMPONENT_FACTORY (libkdevadasupport, AdaSupportPartFactory (data)) + + +struct AdaSupportPartData { + ProblemReporter* problemReporter; + + AdaSupportPartData () : problemReporter (0) {} +}; + +AdaSupportPart::AdaSupportPart (QObject *parent, const char *name, const QStringList &) + : KDevLanguageSupport (&data, parent, name ? name : "AdaSupportPart"), d (new AdaSupportPartData()) +{ + setInstance (AdaSupportPartFactory::instance ()); + + d->problemReporter = new ProblemReporter (this); +// connect (core (), SIGNAL (configWidget (KDialogBase*)), +// d->problemReporter, SLOT (configWidget (KDialogBase*))); + d->problemReporter->setIcon( SmallIcon("info") ); + mainWindow( )->embedOutputView( d->problemReporter, i18n("Problems"), i18n("Problem reporter")); + QWhatsThis::add(d->problemReporter, i18n("Problem reporter

      This window shows various \"problems\" in your project. " + "It displays errors reported by a language parser.")); + + setXMLFile ("adasupportpart.rc"); + + connect (core (), SIGNAL (projectOpened ()), this, SLOT (projectOpened ())); + connect (core (), SIGNAL (projectClosed ()), this, SLOT (projectClosed ())); + + connect (partController (), SIGNAL (savedFile (const KURL&)), + this, SLOT (savedFile (const KURL&))); + +// connect (core (), SIGNAL (configWidget (KDialogBase*)), this, SLOT (configWidget (KDialogBase*))); + connect( core(), SIGNAL(configWidget(KDialogBase*)), + d->problemReporter, SLOT(configWidget(KDialogBase*)) ); + + // a small hack (robe) + //classStore ()->globalScope ()->setName ("(default packages)"); + //classStore ()->addScope (classStore ()->globalScope ()); + //classStore ()->globalScope ()->setName (QString::null); +} + + +AdaSupportPart::~AdaSupportPart () +{ + mainWindow ()->removeView (d->problemReporter); + delete (d->problemReporter); + d->problemReporter = 0; + + delete (d); + d = 0; +} + + +KDevLanguageSupport::Features AdaSupportPart::features () +{ + return KDevLanguageSupport::Features + ( // TBD: Classes | + Functions | Namespaces); +} + +void AdaSupportPart::projectOpened () +{ + connect (project (), SIGNAL (addedFilesToProject (const QStringList &)), + this, SLOT (addedFilesToProject (const QStringList &))); + connect (project (), SIGNAL (removedFilesFromProject (const QStringList &)), + this, SLOT (removedFilesFromProject (const QStringList &))); + connect( project( ), SIGNAL( changedFilesInProject( const QStringList & ) ), + this, SLOT( changedFilesInProject( const QStringList & ) ) ); + + QTimer::singleShot (0, this, SLOT (initialParse ())); +} + + +void AdaSupportPart::projectClosed () +{ + saveProjectSourceInfo(); +} + + +void AdaSupportPart::initialParse () +{ + kdDebug () << "------------------------------------------> initialParse ()" << endl; + + if (project ()) + { + mainWindow()->statusBar()->message( i18n("Updating...") ); + kapp->processEvents( ); + kapp->setOverrideCursor (waitCursor); + + int n = 0; + QStringList files = project ()->allFiles (); + + QProgressBar* bar = new QProgressBar( files.count( ), mainWindow( )->statusBar( ) ); + bar->setMinimumWidth( 120 ); + bar->setCenterIndicator( true ); + mainWindow( )->statusBar( )->addWidget( bar ); + bar->show( ); + + for (QStringList::Iterator it = files.begin (); it != files.end (); ++it) { + bar->setProgress( n++ ); + + QString fn = project ()->projectDirectory () + "/" + *it; + maybeParse (fn); + kapp->processEvents (500); + } + + emit updatedSourceInfo(); + + mainWindow( )->statusBar( )->removeWidget( bar ); + delete bar; + + kapp->restoreOverrideCursor (); + mainWindow( )->statusBar( )->message( i18n( "Done" ), 2000 ); +/* mainWindow ()->statusBar ()->message + (i18n ("Found 1 problem", "Found %n problems", d->problemReporter->childCount ()));*/ + } +} + +QStringList AdaSupportPart::fileExtensions () +{ + return QStringList () << "ads" << "adb"; +} + +void AdaSupportPart::maybeParse (const QString &fileName) +{ + kdDebug () << "AdaSupportPart::maybeParse: " << fileName << endl; + + if (!fileExtensions ().contains (QFileInfo (fileName).extension ())) + return; + +// mainWindow ()->statusBar ()->message (i18n ("Parsing file: %1").arg (fileName)); + parse (fileName); +} + + +void AdaSupportPart::addedFilesToProject (const QStringList &fileList) +{ + QStringList::ConstIterator it; + + for (it = fileList.begin (); it != fileList.end (); ++it) + { + QString path = project ()->projectDirectory () + "/" + (*it); + maybeParse (path); + emit addedSourceInfo( path ); + } +} + + +void AdaSupportPart::removedFilesFromProject (const QStringList &fileList) +{ + QStringList::ConstIterator it; + + for (it = fileList.begin (); it != fileList.end (); ++it) + { + kdDebug () << "AdaSupportPart::removedFileFromProject () -- " << (*it) << endl; + QString path = project ()->projectDirectory () + "/" + (*it); + + if( codeModel()->hasFile(path) ) + { + emit aboutToRemoveSourceInfo( path ); + codeModel()->removeFile( codeModel()->fileByName(path) ); + } + } + +// emit updatedSourceInfo(); +} + + +void AdaSupportPart::parse (const QString &fileName) +{ + kdDebug () << "AdaSupportPart::parse () -- " << fileName << endl; + + std::ifstream stream (QFile::encodeName( fileName ).data()); + QCString _fn = fileName.utf8 (); + std::string fn (_fn.data ()); + + AdaLexer lexer (stream); + lexer.setFilename (fn); + lexer.setProblemReporter (d->problemReporter); + + AdaParser parser (lexer); + parser.setFilename (fn); + parser.setProblemReporter (d->problemReporter); + + // make an ast factory + antlr::ASTFactory ast_factory; + // initialize and put it in the parser... + parser.initializeASTFactory (ast_factory); + parser.setASTFactory (&ast_factory); + // parser.setASTNodeType ("RefAdaAST"); + + try { + // old: parser.setASTNodeFactory (AdaAST::factory); + lexer.resetErrors (); + parser.resetErrors (); + + parser.compilation_unit (); + int errors = lexer.numberOfErrors () + parser.numberOfErrors (); + + RefAdaAST ast = RefAdaAST (parser.getAST ()); + + if (errors == 0 && ast != antlr::nullAST) { + kdDebug () << "-------------------> start StoreWalker" << endl; + AdaStoreWalker walker; + walker.setFileName (fileName); + walker.setCodeModel (codeModel ()); + walker.compilation_unit (ast); + } + } catch (antlr::ANTLRException& ex) { + kdDebug () << "*exception*: " << ex.toString ().c_str () << endl; + d->problemReporter->reportError (QString::fromLatin1( ex.getMessage ().c_str() ), + fileName, + lexer.getLine (), + lexer.getColumn ()); + } +} + +void AdaSupportPart::parseContents (const QString& contents, const QString& fileName) +{ + kdDebug () << "AdaSupportPart::parseContents () -- " << fileName << endl; + + QCString _fn = QFile::encodeName (fileName); + std::string fn (_fn.data ()); + + QCString text = contents.utf8 (); + std::istringstream stream ((const char *)text); + + AdaLexer lexer (stream); + lexer.setFilename (fn); + lexer.setProblemReporter (d->problemReporter); + + AdaParser parser (lexer); + parser.setFilename (fn); + parser.setProblemReporter (d->problemReporter); + + try { + lexer.resetErrors (); + parser.resetErrors (); + + parser.compilation_unit (); + int errors = lexer.numberOfErrors () + parser.numberOfErrors (); + Q_UNUSED( errors ); + + } catch (antlr::ANTLRException& ex) { + kdDebug () << "*exception*: " << ex.toString ().c_str () << endl; + d->problemReporter->reportError (QString::fromLatin1( ex.getMessage().c_str() ), + fileName, + lexer.getLine (), + lexer.getColumn ()); + } +} + + + +void AdaSupportPart::savedFile (const KURL& fileName) +{ + kdDebug () << "AdaSupportPart::savedFile ()" << endl; + + if (project ()->allFiles ().contains (fileName.path().mid (project ()->projectDirectory ().length () + 1))) { + maybeParse (fileName.path()); + emit updatedSourceInfo(); + } +} + +KMimeType::List AdaSupportPart::mimeTypes( ) +{ + KMimeType::List list; + + list << KMimeType::mimeType( "text/x-adasrc" ); + + return list; +} + +//@todo adymo: implement source info loading and saving +//hint: check javasupport for an example +// and modify initialParse() method +void AdaSupportPart::saveProjectSourceInfo( ) +{ +/* const FileList fileList = codeModel()->fileList(); + + if( !project() || fileList.isEmpty() ) + return; + + QFile f( project()->projectDirectory() + "/" + project()->projectName() + ".pcs" ); + if( !f.open( IO_WriteOnly ) ) + return; + + QDataStream stream( &f ); + QMap offsets; + + QString pcs( "PCS" ); + stream << pcs << KDEV_PCS_VERSION; + + stream << int( fileList.size() ); + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ){ + const FileDom dom = (*it); +#if QT_VERSION >= 0x030100 + stream << dom->name() << m_timestamp[ dom->name() ].toTime_t(); +#else + stream << dom->name() << toTime_t(m_timestamp[ dom->name() ]); +#endif + offsets.insert( dom->name(), stream.device()->at() ); + stream << (Q_ULONG)0; // dummy offset + } + + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ){ + const FileDom dom = (*it); + int offset = stream.device()->at(); + + dom->write( stream ); + + int end = stream.device()->at(); + + stream.device()->at( offsets[dom->name()] ); + stream << offset; + stream.device()->at( end ); + }*/ +} + +void AdaSupportPart::changedFilesInProject( const QStringList & fileList ) +{ + QStringList files = fileList; + + for ( QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) + { + QString path = project ()->projectDirectory () + "/" + *it ; + + maybeParse( path ); + emit addedSourceInfo( path ); + } +} + + +#include "adasupportpart.moc" diff --git a/languages/ada/adasupportpart.h b/languages/ada/adasupportpart.h new file mode 100644 index 00000000..d9f2c45d --- /dev/null +++ b/languages/ada/adasupportpart.h @@ -0,0 +1,50 @@ +// +#ifndef __ADASUPPORTPART_H__ +#define __ADASUPPORTPART_H__ + +#include "kdevlanguagesupport.h" + +#include + +class AdaSupportPartData; +class KDialogBase; +class QStringList; + +class AdaSupportPart : public KDevLanguageSupport +{ + Q_OBJECT +public: + AdaSupportPart (QObject *parent, const char *name, const QStringList &); + ~AdaSupportPart (); + + void parseContents (const QString& contents, const QString& fileName); + +protected: + Features features (); + KMimeType::List mimeTypes (); + QStringList fileExtensions (); + +private slots: + void projectOpened (); + void projectClosed (); + + void addedFilesToProject (const QStringList &fileList); + void removedFilesFromProject (const QStringList &fileList); + void changedFilesInProject( const QStringList &fileList ); + + void initialParse (); + void savedFile (const KURL&); + +private: + void maybeParse (const QString &fileName); + void parse (const QString &fileName); + + void saveProjectSourceInfo( ); +private: + AdaSupportPartData* d; + +friend class ProblemReporter; +}; + + +#endif diff --git a/languages/ada/addclass.cpp b/languages/ada/addclass.cpp new file mode 100644 index 00000000..5a5ccb13 --- /dev/null +++ b/languages/ada/addclass.cpp @@ -0,0 +1,351 @@ +#include +#include + + +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include + + +#include "addclassdlg.h" + + +#include "addclass.h" + + +AddClassInfo::AddClassInfo() + : interfaceOpt(false), abstractOpt(false), finalOpt(false), + createConstructor(true), createMain(false) +{ +} + + +QString AddClassInfo::adaFileName() const +{ + QString dest = className; + dest.replace(QRegExp("\\."), "/"); + return sourceDir + "/" + dest + ".ada"; +} + + +AddClass::AddClass() +{ +} + + +void AddClass::setInfo(const AddClassInfo &info) +{ + m_info = info; +} + + +AddClassInfo &AddClass::info() +{ + return m_info; +} + + +void AddClass::setBaseClasses(const QStringList &classes) +{ + m_baseClasses = classes; +} + + +bool AddClass::showDialog() +{ + AddClassDlg dlg; + + QString dir = m_info.projectDir; + if (m_info.sourceDir.isEmpty()) + m_info.sourceDir = "src"; + if (dir.isEmpty()) + dir = m_info.sourceDir; + else + dir = dir + "/" + m_info.sourceDir; + + dlg.SourcePath->setText(dir); + dlg.ClassName->setText(m_info.className); + dlg.Extends->insertStringList(m_baseClasses); + dlg.Extends->setEditText(m_info.extends); + dlg.Interface->setChecked(m_info.interfaceOpt); + dlg.Abstract->setChecked(m_info.abstractOpt); + dlg.Final->setChecked(m_info.finalOpt); + + switch (m_info.visibility) + { + case AddClassInfo::ProtectedClass: + dlg.Protected->setChecked(true); + break; + case AddClassInfo::PrivateClass: + dlg.Private->setChecked(true); + break; + default: + dlg.Public->setChecked(true); + break; + } + + dlg.Implements->insertStringList(m_info.implements); + dlg.Constructor->setChecked(m_info.createConstructor); + dlg.Main->setChecked(m_info.createMain); + dlg.Documentation->setText(m_info.documentation); + dlg.License->setEditText(m_info.license); + + if (dlg.exec() == QDialog::Accepted) + { + m_info.projectDir = ""; + m_info.sourceDir = dlg.SourcePath->text(); + m_info.className = dlg.ClassName->text(); + m_info.extends = dlg.Extends->currentText(); + m_info.interfaceOpt = dlg.Interface->isChecked(); + m_info.abstractOpt = dlg.Abstract->isChecked(); + m_info.finalOpt = dlg.Final->isChecked(); + + if (dlg.Protected->isChecked()) + m_info.visibility = AddClassInfo::ProtectedClass; + else if (dlg.Private->isChecked()) + m_info.visibility = AddClassInfo::PrivateClass; + else + m_info.visibility = AddClassInfo::PublicClass; + + m_info.implements = dlg.Implements->items(); + m_info.createConstructor = dlg.Constructor->isChecked(); + m_info.createMain = dlg.Main->isChecked(); + m_info.documentation = dlg.Documentation->text(); + m_info.license = dlg.License->currentText(); + + return true; + } + + return false; +} + + +static bool makeDirs(const QString &dest) +{ + QStringList dirs = QStringList::split("/", dest); + + QString d = ""; + + for (QStringList::Iterator it=dirs.begin(); it != dirs.end(); ++it) + { + d = d + "/" + *it; + + QFileInfo fi(d); + + if (fi.exists() && !fi.isDir()) + { + /// @todo message to user! + return false; + } + + if (!fi.exists()) + if (::mkdir(QFile::encodeName(d), 0755) != 0) + return false; + } + + return true; +} + + +bool AddClass::generate() +{ + QString code; + + // license + + if (!m_info.license.isEmpty()) + { + code += "/*\n"; + + if (m_info.license == "GPL") + { + code += + " * This program is free software; you can redistribute it and/or modify\n" + " * it under the terms of the GNU General Public License as published by\n" + " * the Free Software Foundation; either version 2 of the License, or\n" + " * (at your option) any later version.\n"; + } + else if (m_info.license == "LGPL") + { + code += + " * This program is free software; you can redistribute it and/or modify\n" + " * it under the terms of the GNU Library General Public License as\n" + " * published by the Free Software Foundation; either version 2 of the\n" + " * License, or (at your option) any later version.\n"; + } + else if (m_info.license == "QPL") + { + code += + " * This program may be distributed under the terms of the Q Public\n" + " * License as defined by Trolltech AS of Norway and appearing in the\n" + " * file LICENSE.QPL included in the packaging of this file.\n" + " *\n" + " * This program is distributed in the hope that it will be useful,\n" + " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; + } + else + { + code += " * This program is licensed under the " + m_info.license + ".\n"; + code += " * Please see the documentation for details.\n"; + } + + code += " */\n\n\n"; + } + + // find class and package name + QString className, packageName; + + int i = m_info.className.findRev('.'); + if (i == -1) + { + packageName = ""; + className = m_info.className; + } + else + { + packageName = m_info.className.left(i); + className = m_info.className.mid(i+1); + } + + // package + if (!packageName.isEmpty()) + code += "package " + packageName + ";\n\n\n"; + + // documentation + + if (!m_info.documentation.isEmpty()) + { + code += "/**\n"; + + QTextStream ts(&m_info.documentation, IO_ReadOnly); + + while (!ts.eof()) + code += " * " + ts.readLine() + "\n"; + + code += " */\n\n"; + } + + // visibility + + switch (m_info.visibility) + { + case AddClassInfo::PrivateClass: + code += "private"; + break; + case AddClassInfo::ProtectedClass: + code += "protected"; + break; + default: + code += "public"; + break; + } + + // abstract, final + + if (!m_info.interfaceOpt) + { + if (m_info.abstractOpt) + code += " abstract"; + if (m_info.finalOpt) + code += " final"; + } + + // generate class/interface declaration + + if (m_info.interfaceOpt) + code += " interface "; + else + code += " class "; + + // classname + + code += className; + + // extends + + if (!m_info.extends.isEmpty()) + code += " extends " + m_info.extends; + + // implements + + if ((m_info.implements.count() > 0) && !m_info.interfaceOpt) + { + code += " implements "; + unsigned int c=0; + for (QStringList::Iterator it = m_info.implements.begin(); it != m_info.implements.end(); ++it, c++) + { + code += *it; + if (c+1 < m_info.implements.count()) + code += ", "; + } + } + + // body start + + code += "\n{\n\n"; + + // default constructor + + if (m_info.createConstructor && !m_info.interfaceOpt) + { + code += " " + className + "()\n"; + code += " {\n"; + if (!m_info.extends.isEmpty()) + code += " super();\n"; + code += " }\n\n"; + } + + // main method + + if (m_info.createMain && !m_info.interfaceOpt) + { + code += " public static void main(String[] args)\n"; + code += " {\n"; + code += " }\n\n"; + } + + // body end + + code += "};\n"; + + // create directories + + QString dest = packageName; + dest.replace(QRegExp("\\."), "/"); + dest = m_info.sourceDir + "/" + dest; + + if (!makeDirs(dest)) + return false; + + // write out the file + + if (QFile::exists(m_info.adaFileName())) + { + /// @todo ask before overwriting! + } + + QFile of(m_info.adaFileName()); + if (!of.open(IO_WriteOnly)) + { + /// @todo message to user + return false; + } + + QTextStream os(&of); + os << code; + + of.close(); + + return true; +} diff --git a/languages/ada/addclass.h b/languages/ada/addclass.h new file mode 100644 index 00000000..7bcfd370 --- /dev/null +++ b/languages/ada/addclass.h @@ -0,0 +1,55 @@ +#ifndef __ADDCLASS_H__ +#define __ADDCLASS_H__ + + +#include +#include + + +class AddClassInfo +{ +public: + + AddClassInfo(); + + enum Visibility { PublicClass, ProtectedClass, PrivateClass}; + + QString className; + QString extends; + bool interfaceOpt, abstractOpt, finalOpt; + QString projectDir, sourceDir; + Visibility visibility; + QStringList implements; + bool createConstructor, createMain; + QString documentation; + QString license; + + QString adaFileName() const; + +}; + + +class AddClass +{ +public: + + AddClass(); + + void setInfo(const AddClassInfo &info); + AddClassInfo &info(); + + void setBaseClasses(const QStringList &classes); + bool showDialog(); + + bool generate(); + + +private: + + AddClassInfo m_info; + QStringList m_baseClasses; + +}; + + +#endif diff --git a/languages/ada/addclassdlg.ui b/languages/ada/addclassdlg.ui new file mode 100644 index 00000000..49900786 --- /dev/null +++ b/languages/ada/addclassdlg.ui @@ -0,0 +1,434 @@ + +AddClassDlg + + + AddClassDlg + + + + 0 + 0 + 656 + 684 + + + + Add Class + + + + unnamed + + + + Implements + + + 1 + + + &Implements + + + + + GroupBox1 + + + &Class + + + + unnamed + + + + + Extends + + + true + + + false + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + + Abstract + + + &Abstract + + + + + Interface + + + &Interface + + + + + TextLabel1 + + + &Name: + + + ClassName + + + + + ButtonGroup1 + + + 0 + + + + + + + unnamed + + + 0 + + + + + Public + + + &Public + + + true + + + + + Protected + + + P&rotected + + + + + Private + + + Pri&vate + + + + + + + Final + + + &Final + + + + + ClassName + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + + TextLabel2 + + + &Extends: + + + Extends + + + + + BrowseSourcePath + + + + 1 + 1 + 0 + 0 + + + + ... + + + + + SourcePath + + + + + TextLabel1_2 + + + &Source path: + + + SourcePath + + + + + + + GroupBox3 + + + &Options + + + + unnamed + + + + + Constructor + + + &Create default constructor + + + true + + + + + Main + + + Create &main method + + + + + + + GroupBox4 + + + &Documentation + + + + unnamed + + + + + TextLabel5 + + + &License: + + + License + + + + + + LGPL + + + + + GPL + + + + + QPL + + + + License + + + true + + + + + Documentation + + + + + Spacer4 + + + Horizontal + + + Expanding + + + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + PushButton3 + + + &Help + + + + + Spacer5 + + + Horizontal + + + Expanding + + + + + PushButton1 + + + &Add + + + true + + + + + PushButton2 + + + &Cancel + + + + + + + Interface + toggled(bool) + Abstract + setDisabled(bool) + + + Interface + toggled(bool) + Final + setDisabled(bool) + + + PushButton1 + clicked() + AddClassDlg + accept() + + + PushButton2 + clicked() + AddClassDlg + reject() + + + Interface + toggled(bool) + Constructor + setDisabled(bool) + + + Interface + toggled(bool) + Main + setDisabled(bool) + + + Interface + toggled(bool) + Implements + setDisabled(bool) + + + + SourcePath + BrowseSourcePath + ClassName + Extends + Interface + Abstract + Final + Public + Protected + Private + Constructor + Main + License + PushButton1 + PushButton2 + PushButton3 + + + Public_toggled( bool ) + + + keditlistbox.h + kcombobox.h + klineedit.h + kdialog.h + + + + diff --git a/languages/ada/app_templates/Makefile.am b/languages/ada/app_templates/Makefile.am new file mode 100644 index 00000000..3da5006f --- /dev/null +++ b/languages/ada/app_templates/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = adahello + +profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/CompiledLanguageIDE/AdaIDE +profiles_DATA = ada.appwizard + diff --git a/languages/ada/app_templates/ada.appwizard b/languages/ada/app_templates/ada.appwizard new file mode 100644 index 00000000..2c31ec96 --- /dev/null +++ b/languages/ada/app_templates/ada.appwizard @@ -0,0 +1,2 @@ +[General] +List=adahello diff --git a/languages/ada/app_templates/adahello/.kdev_ignore b/languages/ada/app_templates/adahello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/ada/app_templates/adahello/Makefile.am b/languages/ada/app_templates/adahello/Makefile.am new file mode 100644 index 00000000..45e04df7 --- /dev/null +++ b/languages/ada/app_templates/adahello/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.adb app.kdevelop ada-Makefile app.kdevelop.filelist + +### no need to change below: +template_DATA = adahello.kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +adahello.tar.gz: + $(TAR) -cf adahello.tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 adahello.tar + +archivedir = ${appwizarddatadir} +archive_DATA = adahello.tar.gz adahello.png + +CLEANFILES = *.tar.gz + diff --git a/languages/ada/app_templates/adahello/ada-Makefile b/languages/ada/app_templates/adahello/ada-Makefile new file mode 100644 index 00000000..134ffab6 --- /dev/null +++ b/languages/ada/app_templates/adahello/ada-Makefile @@ -0,0 +1,2 @@ +all: + gnatmake src/%{APPNAMELC}.adb -o %{APPNAMELC} diff --git a/languages/ada/app_templates/adahello/ada-Makefile.am b/languages/ada/app_templates/adahello/ada-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/ada/app_templates/adahello/ada-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/ada/app_templates/adahello/ada-Makefile.cvs b/languages/ada/app_templates/adahello/ada-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/ada/app_templates/adahello/ada-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/ada/app_templates/adahello/adahello b/languages/ada/app_templates/adahello/adahello new file mode 100644 index 00000000..73d82f8d --- /dev/null +++ b/languages/ada/app_templates/adahello/adahello @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=Simple Hello world program +Name[fr]=Un simple programme de test Hello world +Icon=adahello.png +Category=Ada +Comment=Generates a simple Hello world program in Ada +Comment[fr]=Gnre un simple programme de test du type Hello world dans le language ADA. +FileTemplates=adb,AdaStyle +ShowFilesAfterGeneration=src/APPNAMELC.adb diff --git a/languages/ada/app_templates/adahello/adahello.kdevtemplate b/languages/ada/app_templates/adahello/adahello.kdevtemplate new file mode 100644 index 00000000..380f739b --- /dev/null +++ b/languages/ada/app_templates/adahello/adahello.kdevtemplate @@ -0,0 +1,132 @@ +# KDE Config File +[General] +Name=Simple Hello world program +Name[ca]=Simple programa Hello world +Name[da]=Simpelt Goddag verden program +Name[de]=Ein einfaches "Hello World"-Programm +Name[el]=Απλό πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» sencillo +Name[et]=Lihtne "Tere, maailm" programm +Name[eu]="Kaixo mundua" programa sinplea +Name[fa]=برنامۀ سادۀ Hello world +Name[fr]=Programme « Bonjour monde » simple +Name[ga]=Ríomhchlár simplí "Hello World" +Name[gl]=Programa sinxelo Ola mundo +Name[hu]=Egyszerű Hello world program +Name[it]=Semplice programma di "Hello world" +Name[ja]=簡単な Hello world プログラム +Name[ms]=Program Hello World mudah +Name[nds]=En eenfach "Moin Welt"-Programm +Name[ne]=साधारण हेल्लो वोल्ड कार्यक्रम +Name[nl]=Eenvoudig 'Hello World' programma +Name[pl]=Prosty program witaj świecie +Name[pt]=Programa simples Olá Mundo +Name[pt_BR]=Programa simples Olá Mundo +Name[ru]=Простая программа Hello world +Name[sk]=Jednoduchý "Ahoj svet" program +Name[sl]=Preprost program Hello world +Name[sr]=Једноставан „Здраво свете“ програм +Name[sr@Latn]=Jednostavan „Zdravo svete“ program +Name[sv]=Enkelt Hello world-program +Name[tr]=Basit Merhaba dünya programı +Name[zh_CN]=简单的 Hello world 程序 +Name[zh_TW]=簡單的 Hello world 程式 +Icon=adahello.png +Category=Ada +Comment=Generates a simple Hello world program in Ada +Comment[ca]=Genera un simple programa de Hello world en Ada +Comment[da]=Genererer et simpelt Goddag verden program i Ada +Comment[de]=Erstellt ein einfaches "Hello World"-Program in Ada +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα Γεια σου Κόσμε σε Ada +Comment[es]=Genera un programa «Hola mundo» sencillo en Ada +Comment[et]=Lihtsa "Tere, maailm" programmi loomine ADA-s +Comment[eu]="Kaixo mundua" programa sinple bat sortzen du Adan +Comment[fa]=یک برنامۀ سادۀ Hello world در آدا تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en Ada +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí "Hello World" in Ada +Comment[gl]=Xera un programa sinxelo Hello world en Ada +Comment[hu]=Létrehoz egy egyszerű Hello world programot ADA nyelven +Comment[it]=Genera un semplice programma di "Hello world" in Ada +Comment[ja]=Ada で簡単な Hello world プログラムを作成します +Comment[ms]=Menjana program Hello World mudah dalam Ada +Comment[nds]=Stellt in Ada en eenfach "Moin Welt"-Programm op +Comment[ne]=एडामा साधारण हेल्लो वोल्ड कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudig Hello World programma in Ada +Comment[pl]=Generuje prosty program Witaj świecie w Adzie +Comment[pt]=Gera um programa simples de Olá Mundo em Ada +Comment[pt_BR]=Gera um programa simples de Olá Mundo em Ada +Comment[ru]=Создание простой программы Hello world на Ada +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v Ada +Comment[sl]=Ustvari preprost program Hello world v Adi +Comment[sr]=Прави једноставан „Здраво свете“ у Ada-и +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ u Ada-i +Comment[sv]=Skapar ett enkelt Hello world-program i Ada +Comment[tr]=Ada dilinde basit bir Merhaba Dünya programı üretir. +Comment[zh_CN]=以 Ada 语言生成简单的 Hello world 程序 +Comment[zh_TW]=產生 Ada 的 Hello world 程式 +FileTemplates=adb,AdaStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.adb +Archive=adahello.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/ada-Makefile +Dest=%{dest}/Makefile + +[FILE3] +Type=install +Source=%{src}/app.kdevelop.filelist +Dest=%{dest}/%{APPNAMELC}.kdevelop.filelist + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE4] +Type=install +Source=%{src}/main.adb +Dest=%{dest}/src/%{APPNAMELC}.adb + +[MSG] +Type=message +Comment=A simple "Hello world" program in ADA was created in %{dest} +Comment[ca]=Un simple programa de "Hello world" en ADA ha estat creat en %{dest} +Comment[da]=Et simpelt "Goddag verden" program i ADA blev oprettet i %{dest} +Comment[de]=Ein einfaches "Hello world" Programm in Ada wurde in %{dest} erstellt +Comment[el]=Ένα απλό πρόγραμμα "Γεια σου Κόσμε" σε ADA δημιουργήθηκε στο %{dest} +Comment[es]=Un programa «Hola mundo» sencillo en ADA ha sido creado en %{dest} +Comment[et]=Lihtne "Tere, maailm" programm ADA-s loodi asukohta %{dest} +Comment[eu]="Kaixo mundua" programa sinple bat sortu da ADAn hemen: %{dest} +Comment[fa]=یک برنامۀ سادۀ «Hello world» در آدا در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » simple en ADA a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár simplí "Hello World" ADA i %{dest} +Comment[gl]=Creouse un programa sinxelo "Ola mundo" en ADA en %{dest} +Comment[hu]=Létrejött egy egyszerű Hello world program ADA nyelven itt: %{dest} +Comment[it]=È stato creato un semplice programma di "Hello world" in ADA in %{dest} +Comment[ja]=Ada で記述された "Hello world" プログラムを %{dest} に作成しました +Comment[ms]=Program "Hello World" mudah dalam ada telah dicipta dalam %{dest} +Comment[nds]=In %{dest} wöör en eenfach "Moin Welt"-Programm in Ada opstellt +Comment[ne]=एउटा साधारण "हेल्लो वोल्ड" कार्यक्रम एडामा %{dest} सिर्जना गरिएको थियो +Comment[nl]=Een eenvoudig "Hello World" programma in Ada is aangemaakt in %{dest} +Comment[pl]=Prosty program "Witaj świecie" w języku ADA został utworzony w %{dest} +Comment[pt]=Foi criado um programa simples "Olá mundo" em ADA em %{dest} +Comment[pt_BR]=Foi criado um programa simples "Olá mundo" em ADA em %{dest} +Comment[ru]=Простая программа "Hello world" на ADA создана в %{dest} +Comment[sk]=Jednoduchý "Ahoj svet" program v Ada bol vytvorený v %{dest} +Comment[sl]=Preprost program »Hello world« v jeziku ADA je bil ustvarjen v %{dest} +Comment[sr]=Једноставан „Здраво свете“ програм у Ada-и је направљен у %{dest} +Comment[sr@Latn]=Jednostavan „Zdravo svete“ program u Ada-i je napravljen u %{dest} +Comment[sv]=Ett enkelt "Hello world"-program in Ada skapades i %{dest} +Comment[tr]=ADA'da basit bir "Merhaba Dünya" programı %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了 Ada 语言的“Hello world”程序 +Comment[zh_TW]=Ada 的 Hello world 程式已產生在 ${dest} diff --git a/languages/ada/app_templates/adahello/adahello.png b/languages/ada/app_templates/adahello/adahello.png new file mode 100644 index 00000000..888d4f13 Binary files /dev/null and b/languages/ada/app_templates/adahello/adahello.png differ diff --git a/languages/ada/app_templates/adahello/app.kdevelop b/languages/ada/app_templates/adahello/app.kdevelop new file mode 100644 index 00000000..b430f6e8 --- /dev/null +++ b/languages/ada/app_templates/adahello/app.kdevelop @@ -0,0 +1,84 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevCustomProject + Ada + + Ada + Code + + + + + build + / + %{APPNAMELC} + + false + false + + + + make + + + + + + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + diff --git a/languages/ada/app_templates/adahello/app.kdevelop.filelist b/languages/ada/app_templates/adahello/app.kdevelop.filelist new file mode 100644 index 00000000..e5b69ca2 --- /dev/null +++ b/languages/ada/app_templates/adahello/app.kdevelop.filelist @@ -0,0 +1 @@ +src/%{APPNAMELC}.adb \ No newline at end of file diff --git a/languages/ada/app_templates/adahello/configure.in b/languages/ada/app_templates/adahello/configure.in new file mode 100644 index 00000000..a8f81958 --- /dev/null +++ b/languages/ada/app_templates/adahello/configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AM_CONFIG_HEADER(config.h) + +AC_LANG_ADA +AC_PROG_ADA +AC_ADA_LIBRARY_LDFLAGS + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/ada/app_templates/adahello/main.adb b/languages/ada/app_templates/adahello/main.adb new file mode 100644 index 00000000..e2c6f5da --- /dev/null +++ b/languages/ada/app_templates/adahello/main.adb @@ -0,0 +1,8 @@ +with Text_IO; + +procedure Main is + +begin + Text_IO.Put_Line ("Hello World"); +end Main; + diff --git a/languages/ada/app_templates/adahello/src-Makefile.am b/languages/ada/app_templates/adahello/src-Makefile.am new file mode 100644 index 00000000..06291dbf --- /dev/null +++ b/languages/ada/app_templates/adahello/src-Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.adb + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) diff --git a/languages/ada/backgroundparser.cpp b/languages/ada/backgroundparser.cpp new file mode 100644 index 00000000..f94f3216 --- /dev/null +++ b/languages/ada/backgroundparser.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2002 by Roberto Raggi * + * roberto@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "backgroundparser.h" +#include "problemreporter.h" +#include "AdaLexer.hpp" +#include "AdaParser.hpp" +#include "AdaAST.hpp" +#include +#include + +#include + +#include + +BackgroundParser::BackgroundParser( ProblemReporter* reporter, + const QString& source, + const QString& filename ) + : m_reporter( reporter ), + m_source( source.unicode(), source.length() ), + m_fileName( filename ) +{ +} + +BackgroundParser::~BackgroundParser() +{ +} + +void BackgroundParser::run() +{ + QCString _fn = QFile::encodeName(m_fileName); + std::string fn( _fn.data() ); + + std::istringstream stream( m_source.utf8().data() ); + + AdaLexer lexer( stream ); + lexer.setFilename( fn ); + lexer.setProblemReporter( m_reporter ); + + AdaParser parser( lexer ); + parser.setFilename( fn ); + parser.setProblemReporter( m_reporter ); + + // make an ast factory + antlr::ASTFactory ast_factory; + // initialize and put it in the parser... + parser.initializeASTFactory (ast_factory); + parser.setASTFactory (&ast_factory); + // parser.setASTNodeType ("RefAdaAST"); + + try{ + lexer.resetErrors(); + parser.resetErrors(); + + parser.compilation_unit(); + + } catch( antlr::ANTLRException& ex ){ + kdDebug() << "*exception*: " << ex.toString().c_str() << endl; + m_reporter->reportError( QString::fromLatin1( ex.getMessage().c_str() ), + m_fileName, + lexer.getLine(), + lexer.getColumn() ); + } + + kdDebug() << "BackgroundParser::run() FINISHED." << endl; +} + + + diff --git a/languages/ada/backgroundparser.h b/languages/ada/backgroundparser.h new file mode 100644 index 00000000..0b4eef16 --- /dev/null +++ b/languages/ada/backgroundparser.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002 by Roberto Raggi + * roberto@kdevelop.org + * Copyright (C) 2003 Oliver Kellogg + * okellogg@users.sourceforge.net + * + * 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; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef BACKGROUNDPARSER_H +#define BACKGROUNDPARSER_H + +#include +#include +#include + +class ProblemReporter; + +class BackgroundParser: public QThread{ +public: + BackgroundParser( ProblemReporter* reporter, + const QString& source, + const QString& filename ); + virtual ~BackgroundParser(); + + virtual void run(); + +private: + ProblemReporter* m_reporter; + QString m_source; + QString m_fileName; +}; + +#endif diff --git a/languages/ada/configproblemreporter.ui b/languages/ada/configproblemreporter.ui new file mode 100644 index 00000000..75f35b1f --- /dev/null +++ b/languages/ada/configproblemreporter.ui @@ -0,0 +1,89 @@ + +ConfigureProblemReporter + + + ConfigureProblemReporter + + + + 0 + 0 + 390 + 304 + + + + + unnamed + + + + bgParserCheckbox + + + &Enable background parsing + + + + + delaySlider + + + 2000 + + + 250 + + + 500 + + + Horizontal + + + Right + + + 250 + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 101 + + + + + + + + bgParserCheckbox + toggled(bool) + ConfigureProblemReporter + bgParserCheckbox_toggled(bool) + + + + kdialog.h + configproblemreporter.ui.h + + + init() + destroy() + accept() + bgParserCheckbox_toggled( bool b ) + + + + diff --git a/languages/ada/configproblemreporter.ui.h b/languages/ada/configproblemreporter.ui.h new file mode 100644 index 00000000..a336965c --- /dev/null +++ b/languages/ada/configproblemreporter.ui.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + +#include +#include + +void ConfigureProblemReporter::init() +{ + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + bgParserCheckbox->setChecked( config->readBoolEntry("EnableAdaBgParser", true) ); + delaySlider->setEnabled( bgParserCheckbox->isChecked() ); + delaySlider->setValue( config->readNumEntry("BgParserDelay", 500) ); +} + +void ConfigureProblemReporter::destroy() +{ +} + +void ConfigureProblemReporter::accept() +{ + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + config->writeEntry( "EnableAdaBgParser", bgParserCheckbox->isChecked() ); + if( bgParserCheckbox->isChecked() ) + config->writeEntry( "BgParserDelay", delaySlider->value() ); + config->sync(); +} + + +void ConfigureProblemReporter::bgParserCheckbox_toggled( bool b ) +{ + delaySlider->setEnabled( b ); +} diff --git a/languages/ada/configure.in.in b/languages/ada/configure.in.in new file mode 100644 index 00000000..be677e4b --- /dev/null +++ b/languages/ada/configure.in.in @@ -0,0 +1,4 @@ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS(sstream) +AC_LANG_RESTORE diff --git a/languages/ada/doc/Makefile.am b/languages/ada/doc/Makefile.am new file mode 100644 index 00000000..ff5f8a32 --- /dev/null +++ b/languages/ada/doc/Makefile.am @@ -0,0 +1,6 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = ada.toc ada_bugs_gcc.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + diff --git a/languages/ada/doc/ada.toc b/languages/ada/doc/ada.toc new file mode 100644 index 00000000..434a5b6a --- /dev/null +++ b/languages/ada/doc/ada.toc @@ -0,0 +1,130 @@ + + +Ada + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/languages/ada/doc/ada_bugs_gcc.toc b/languages/ada/doc/ada_bugs_gcc.toc new file mode 100644 index 00000000..9c543f0c --- /dev/null +++ b/languages/ada/doc/ada_bugs_gcc.toc @@ -0,0 +1,7 @@ + + +Ada bugs (GCC) + + + + diff --git a/languages/ada/file_templates/Makefile.am b/languages/ada/file_templates/Makefile.am new file mode 100644 index 00000000..58bbd907 --- /dev/null +++ b/languages/ada/file_templates/Makefile.am @@ -0,0 +1,3 @@ +templatedir = $(kde_datadir)/kdevfilecreate/file-templates +template_DATA = adb ads + diff --git a/languages/ada/file_templates/adb b/languages/ada/file_templates/adb new file mode 100644 index 00000000..0306105a --- /dev/null +++ b/languages/ada/file_templates/adb @@ -0,0 +1,12 @@ +-- +-- +-- Ada Body: $MODULE$ +-- +-- Description: +-- +-- +-- Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ +-- +-- Copyright: See COPYING file that comes with this distribution +-- +-- diff --git a/languages/ada/file_templates/ads b/languages/ada/file_templates/ads new file mode 100644 index 00000000..46463d47 --- /dev/null +++ b/languages/ada/file_templates/ads @@ -0,0 +1,12 @@ +-- +-- +-- Ada Spec: $MODULE$ +-- +-- Description: +-- +-- +-- Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ +-- +-- Copyright: See COPYING file that comes with this distribution +-- +-- diff --git a/languages/ada/kdevadasupport.desktop b/languages/ada/kdevadasupport.desktop new file mode 100644 index 00000000..4f99e10c --- /dev/null +++ b/languages/ada/kdevadasupport.desktop @@ -0,0 +1,87 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Ada Language Support +Comment[ca]=Suport per al llenguatge Ada +Comment[da]=Ada sprogunderstøttelse +Comment[de]=Sprachunterstützung für Ada +Comment[el]=Υποστήριξη γλώσσας Ada +Comment[es]=Soporte para lenguaje Ada +Comment[et]=ADA keele toetus +Comment[eu]=Ada lenguaiaren euskarria +Comment[fa]=پشتیبانی زبان آدا +Comment[fr]=Prise en charge du langage ADA +Comment[ga]=Tacaíocht Ada +Comment[gl]=Soporte da linguaxe Ada +Comment[hi]=एडीए भाषा समर्थन +Comment[hu]=Ada nyelvi támogatás +Comment[is]=Stuðningur við Ada forritunarmálið +Comment[it]=Supporto al linguaggio Ada +Comment[ja]=Ada 言語サポート +Comment[ms]=Sokongan Bahasa Ada +Comment[nds]=Spraakünnerstütten för Ada +Comment[ne]=एडा भाषा समर्थन +Comment[nl]=Ondersteuning voor Ada +Comment[pl]=Obsługa języka Ada +Comment[pt]=Suporte à Linguagem Ada +Comment[pt_BR]=Suporte à Linguagem Ada +Comment[ru]=Поддержка языка Ada +Comment[sk]=Podpora jazyka Ada +Comment[sl]=Podpora jeziku ada +Comment[sr]=Ada језичка подршка +Comment[sr@Latn]=Ada jezička podrška +Comment[sv]=Stöd för språket Ada +Comment[ta]=அடா மொழி ஆதரவு +Comment[tg]=Ёри намудани забони Ada +Comment[tr]=Ada Dil Desteği +Comment[zh_CN]=Ada 语言支持 +Comment[zh_TW]=Ada 語言支援 +Name=KDevAdaSupport +Name[da]=KDevelop Ada-understøttelse +Name[de]=Unterstützung für Ada (KDevelop) +Name[hi]=के-डेव-एडीए-समर्थन +Name[nds]=Ada-Ünnerstütten för KDevelop +Name[ne]=केडीई विकास एडा समर्थन +Name[pl]=KDevObsługaAdy +Name[sk]=KDevAdaPodpora +Name[sv]=KDevelop Ada-stöd +Name[ta]=கெடெவ் அடா ஆதரவு +Name[zh_TW]=KDevelop Ada 支援 +GenericName=Ada Language Support +GenericName[ca]=Suport per al llenguatge Ada +GenericName[da]=Ada sprogunderstøttelse +GenericName[de]=Sprachunterstützung für Ada +GenericName[el]=Υποστήριξη γλώσσας Ada +GenericName[es]=Soporte para lenguaje Ada +GenericName[et]=ADA keele toetus +GenericName[eu]=Ada lenguaiaren euskarria +GenericName[fa]=پشتیبانی زبان آدا +GenericName[fr]=Prise en charge du langage ADA +GenericName[ga]=Tacaíocht Ada +GenericName[gl]=Soporte da linguaxe Ada +GenericName[hi]=एडीए भाषा समर्थन +GenericName[hu]=Ada-támogatás +GenericName[it]=Supporto al linguaggio Ada +GenericName[ja]=Ada 言語サポート +GenericName[ms]=Sokongan Bahasa Ada +GenericName[nds]=Ünnerstütten för de Spraak Ada +GenericName[ne]=एडा भाषा समर्थन +GenericName[nl]=Ondersteuning voor Ada +GenericName[pl]=Obsługa języka Ada +GenericName[pt]=Suporte à Linguagem Ada +GenericName[pt_BR]=Suporte à Linguagem Ada +GenericName[ru]=Поддержка языка Ada +GenericName[sk]=Podpora jazyka Ada +GenericName[sl]=Podpora jeziku ada +GenericName[sr]=Ada језичка подршка +GenericName[sr@Latn]=Ada jezička podrška +GenericName[sv]=Stöd för språket Ada +GenericName[ta]=அடா மொழி ஆதரவு +GenericName[tg]=Ёри намудани забони Ada +GenericName[tr]=Ada Dil Desteği +GenericName[zh_CN]=Ada 语言支持 +GenericName[zh_TW]=Ada 語言支援 +ServiceTypes=KDevelop/LanguageSupport +X-KDE-Library=libkdevadasupport +X-KDevelop-Version=5 +X-KDevelop-Language=Ada diff --git a/languages/ada/kdevadasupport.rc b/languages/ada/kdevadasupport.rc new file mode 100644 index 00000000..23b705db --- /dev/null +++ b/languages/ada/kdevadasupport.rc @@ -0,0 +1,11 @@ + + + +

      &Tools + + + + + + + diff --git a/languages/ada/preambles.h b/languages/ada/preambles.h new file mode 100644 index 00000000..e9ea460b --- /dev/null +++ b/languages/ada/preambles.h @@ -0,0 +1,89 @@ +/* + * Two macros are defined here: ANTLR_PARSER_PREAMBLE and ANTLR_LEXER_PREAMBLE. + * They encapsulate the application specific extensions for the classes + * AdaParser and AdaLexer which are defined in ada.g. + * This keeps ada.g independent of the application. + * + * Kdevelop version: + * (C) 2003 Oliver M. Kellogg (okellogg@users.sourceforge.net) + */ +#ifndef _PREAMBLES_H_ +#define _PREAMBLES_H_ + +#include +#include "problemreporter.h" + +#define ANTLR_PARSER_PREAMBLE \ + private: \ + unsigned int m_numberOfErrors; \ + ProblemReporter* m_problemReporter; \ + \ + public: \ + void resetErrors () { m_numberOfErrors = 0; } \ + unsigned int numberOfErrors () const { return m_numberOfErrors; } \ + void setProblemReporter (ProblemReporter* r) { m_problemReporter = r; } \ + \ + void reportError (const antlr::RecognitionException& ex) { \ + m_problemReporter->reportError \ + (ex.toString().c_str (), \ + ex.getFilename().c_str (), \ + ex.getLine (), \ + ex.getColumn ()); \ + ++m_numberOfErrors; \ + } \ + \ + void reportError (const std::string& errorMessage) { \ + m_problemReporter->reportError \ + (errorMessage.c_str(), \ + getFilename ().c_str(), \ + LT(1)->getLine (), \ + LT(1)->getColumn ()); \ + ++m_numberOfErrors; \ + } \ + \ + void reportMessage (const std::string& message) { \ + m_problemReporter->reportMessage \ + (message.c_str (), \ + getFilename ().c_str (), \ + LT(1)->getLine (), \ + LT(1)->getColumn ()); \ + } + +#define ANTLR_LEXER_PREAMBLE \ + private: \ + unsigned int m_numberOfErrors; \ + ProblemReporter* m_problemReporter; \ + \ + public: \ + void resetErrors () { m_numberOfErrors = 0; } \ + unsigned int numberOfErrors () const { return m_numberOfErrors; } \ + void setProblemReporter (ProblemReporter* r) { m_problemReporter = r; } \ + \ + void reportError (const antlr::RecognitionException& ex) { \ + m_problemReporter->reportError \ + (ex.toString ().c_str (), \ + ex.getFilename ().c_str (), \ + ex.getLine (), \ + ex.getColumn ()); \ + ++m_numberOfErrors; \ + } \ + \ + void reportError (const std::string& errorMessage) { \ + m_problemReporter->reportError \ + (errorMessage.c_str (), \ + getFilename().c_str (), \ + getLine (), \ + getColumn ()); \ + ++m_numberOfErrors; \ + } \ + \ + void reportWarning (const std::string& warnMessage) { \ + m_problemReporter->reportWarning \ + (warnMessage.c_str (), \ + getFilename ().c_str (), \ + getLine (), \ + getColumn ()); \ + } + +#endif // _PREAMBLES_H_ + diff --git a/languages/ada/problemreporter.cpp b/languages/ada/problemreporter.cpp new file mode 100644 index 00000000..36ac6186 --- /dev/null +++ b/languages/ada/problemreporter.cpp @@ -0,0 +1,282 @@ +/* + Copyright (C) 2002 by Roberto Raggi + Copyright (C) 2003 Oliver Kellogg + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + version 2, License as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "problemreporter.h" +#include "adasupportpart.h" +#include "kdevpartcontroller.h" +#include "kdevmainwindow.h" +#include "configproblemreporter.h" +#include "backgroundparser.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + + +class ProblemItem: public QListViewItem{ +public: + ProblemItem( QListView* parent, const QString& level, const QString& problem, + const QString& file, const QString& line, const QString& column ) + : QListViewItem( parent, level, problem, file, line, column ) {} + + ProblemItem( QListViewItem* parent, const QString& level, const QString& problem, + const QString& file, const QString& line, const QString& column ) + : QListViewItem( parent, level, problem, file, line, column ) {} + + int compare( QListViewItem* item, int column, bool ascending ) const { + if( column == 3 || column == 4 ){ + int a = text( column ).toInt(); + int b = item->text( column ).toInt(); + if( a == b ) + return 0; + return( a > b ? -1 : 1 ); + } + return QListViewItem::compare( item, column, ascending ); + } + +}; + +ProblemReporter::ProblemReporter( AdaSupportPart* part, QWidget* parent, const char* name ) + : QListView( parent, name ), + m_adaSupport( part ), + m_editor( 0 ), + m_document( 0 ), + m_markIface( 0 ), + m_bgParser( 0 ) +{ + QWhatsThis::add(this, i18n("Problem reporter

      This window shows errors reported by a language parser.")); + + addColumn( i18n("Level") ); + addColumn( i18n("Problem") ); + addColumn( i18n("File") ); + addColumn( i18n("Line") ); + //addColumn( i18n("Column") ); + setAllColumnsShowFocus( TRUE ); + + m_timer = new QTimer( this ); + + connect( part->partController(), SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(slotActivePartChanged(KParts::Part*)) ); + connect( part->partController(), SIGNAL(partAdded(KParts::Part*)), + this, SLOT(slotPartAdded(KParts::Part*)) ); + connect( part->partController(), SIGNAL(partRemoved(KParts::Part*)), + this, SLOT(slotPartRemoved(KParts::Part*)) ); + + connect( m_timer, SIGNAL(timeout()), this, SLOT(reparse()) ); + + connect( this, SIGNAL(doubleClicked(QListViewItem*)), + this, SLOT(slotSelected(QListViewItem*)) ); + connect( this, SIGNAL(returnPressed(QListViewItem*)), + this, SLOT(slotSelected(QListViewItem*)) ); + + configure(); +} + +ProblemReporter::~ProblemReporter() +{ + if( m_bgParser ) { + m_bgParser->wait(); + } + + delete( m_bgParser ); + m_bgParser = 0; +} + +void ProblemReporter::slotActivePartChanged( KParts::Part* part ) +{ + if( !part ) + return; + + if( m_editor ) + reparse(); + + m_document = dynamic_cast( part ); + if( m_document ){ + m_filename = m_document->url().path(); + } + + m_editor = dynamic_cast( part ); + if( m_editor ) + connect( m_document, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) ); + + m_markIface = dynamic_cast( part ); + + m_timer->changeInterval( m_delay ); +} + +void ProblemReporter::slotTextChanged() +{ + if( m_active ) + m_timer->changeInterval( m_delay ); +} + +void ProblemReporter::reparse() +{ + kdDebug() << "ProblemReporter::reparse()" << endl; + + if( !m_editor ) + return; + + m_timer->stop(); + + if( m_bgParser ) { + if( m_bgParser->running() ) { + m_timer->changeInterval( m_delay ); + return; + } + + delete( m_bgParser ); + m_bgParser = 0; + } + + QListViewItem* current = firstChild(); + while( current ){ + QListViewItem* i = current; + current = current->nextSibling(); + + if( i->text(2) == m_filename ) + delete( i ); + } + + if( m_markIface ){ + QPtrList marks = m_markIface->marks(); + QPtrListIterator it( marks ); + while( it.current() ){ + m_markIface->removeMark( it.current()->line, KTextEditor::MarkInterface::markType07 ); + ++it; + } + } + +/* Temporarily deactivated (crashes)*/ + if (!m_adaSupport->fileExtensions ().contains (QFileInfo (m_filename).extension ())) + { + m_bgParser = new BackgroundParser( this, m_editor->text(), m_filename ); + m_bgParser->start(); + } + /**/ +} + +void ProblemReporter::slotSelected( QListViewItem* item ) +{ + KURL url( item->text(2) ); + int line = item->text( 3 ).toInt(); + // int column = item->text( 4 ).toInt(); + m_adaSupport->partController()->editDocument( url, line-1 ); +} + +void ProblemReporter::reportError( QString message, + QString filename, + int line, int column ) +{ + if( m_markIface ){ + m_markIface->addMark( line-1, KTextEditor::MarkInterface::markType07 ); + } + + new ProblemItem( this, + "error", + message.replace( QRegExp("\n"), "" ), + filename, + QString::number( line ), + QString::number( column ) ); +} + +void ProblemReporter::reportWarning( QString message, + QString filename, + int line, int column ) +{ + new ProblemItem( this, + "warning", + message.replace( QRegExp("\n"), "" ), + filename, + QString::number( line ), + QString::number( column ) ); +} + +void ProblemReporter::reportMessage( QString message, + QString filename, + int line, int column ) +{ + new QListViewItem( this, + "message", + message.replace( QRegExp("\n"), "" ), + filename, + QString::number( line ), + QString::number( column ) ); +} + +void ProblemReporter::configure() +{ + kdDebug() << "ProblemReporter::configure()" << endl; + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + m_active = config->readBoolEntry( "EnableAdaBgParser", TRUE ); + m_delay = config->readNumEntry( "BgParserDelay", 500 ); +} + +void ProblemReporter::configWidget( KDialogBase* dlg ) +{ + kdDebug() << "ProblemReporter::configWidget()" << endl; + QVBox *vbox = dlg->addVBoxPage(i18n("Ada Parsing"), i18n("Ada Parsing"), BarIcon( "source", KIcon::SizeMedium )); + ConfigureProblemReporter* w = new ConfigureProblemReporter( vbox ); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + connect(dlg, SIGNAL(okClicked()), this, SLOT(configure())); +} + +void ProblemReporter::slotPartAdded( KParts::Part* part ) +{ + KTextEditor::MarkInterfaceExtension* iface = dynamic_cast( part ); + + if( !iface ) + return; + + iface->setPixmap( KTextEditor::MarkInterface::markType07, SmallIcon("stop") ); +} + +void ProblemReporter::slotPartRemoved( KParts::Part* part ) +{ + kdDebug() << "ProblemReporter::slotPartRemoved()" << endl; + if( part == m_document ){ + m_document = 0; + m_editor = 0; + m_timer->stop(); + } +} + +#include "problemreporter.moc" diff --git a/languages/ada/problemreporter.h b/languages/ada/problemreporter.h new file mode 100644 index 00000000..b42a6ad3 --- /dev/null +++ b/languages/ada/problemreporter.h @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002 by Roberto Raggi + Copyright (C) 2003 Oliver Kellogg + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + version 2, License as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef PROBLEMSREPORTER_H +#define PROBLEMSREPORTER_H + +#include + +class AdaSupportPart; +class QTimer; +class KDialogBase; +class BackgroundParser; + +namespace KParts{ + class Part; +} + +namespace KTextEditor{ + class EditInterface; + class MarkInterface; + class Document; +} + +class ProblemReporter: public QListView{ + Q_OBJECT +public: + ProblemReporter( AdaSupportPart* part, QWidget* parent=0, const char* name=0 ); + virtual ~ProblemReporter(); + + virtual void reportError( QString message, QString filename, + int line, int column ); + + virtual void reportWarning( QString message, QString filename, + int line, int column ); + + virtual void reportMessage( QString message, QString filename, + int line, int column ); + +public slots: + void reparse(); + void configure(); + void configWidget( KDialogBase* ); + +private slots: + void slotPartAdded( KParts::Part* ); + void slotPartRemoved( KParts::Part* ); + void slotActivePartChanged( KParts::Part* ); + void slotTextChanged(); + void slotSelected( QListViewItem* ); + +private: + AdaSupportPart* m_adaSupport; + KTextEditor::EditInterface* m_editor; + KTextEditor::Document* m_document; + KTextEditor::MarkInterface* m_markIface; + QTimer* m_timer; + QString m_filename; + int m_active; + int m_delay; + BackgroundParser* m_bgParser; +}; + +#endif diff --git a/languages/bash/Makefile.am b/languages/bash/Makefile.am new file mode 100644 index 00000000..90b94689 --- /dev/null +++ b/languages/bash/Makefile.am @@ -0,0 +1,20 @@ +#Here resides the Bash Shell support part. + +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + $(all_includes) +SUBDIRS = app_templates doc + +kde_module_LTLIBRARIES = libkdevbashsupport.la +libkdevbashsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevbashsupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevbashsupport_la_SOURCES = bashsupport_part.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevbashsupport.desktop + +rcdir = $(kde_datadir)/kdevbashsupport +rc_DATA = kdevbashsupport.rc diff --git a/languages/bash/README.dox b/languages/bash/README.dox new file mode 100644 index 00000000..95765f0a --- /dev/null +++ b/languages/bash/README.dox @@ -0,0 +1,15 @@ +/** \class BashSupportPart + +Supports bash language + +\authors Ian Reinhart Geiser + +\maintainer Ian Reinhart Geiser + +\feature function browser support +\feature runs bash script in external terminal +\feature syntax highlighting and code folding via katepart +\feature Code completion works for variables +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +*/ diff --git a/languages/bash/app_templates/Makefile.am b/languages/bash/app_templates/Makefile.am new file mode 100644 index 00000000..7dbe86af --- /dev/null +++ b/languages/bash/app_templates/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = bashhello +profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/ScriptingLanguageIDE/ShellIDE +profiles_DATA = bash.appwizard diff --git a/languages/bash/app_templates/bash.appwizard b/languages/bash/app_templates/bash.appwizard new file mode 100644 index 00000000..2e4473b0 --- /dev/null +++ b/languages/bash/app_templates/bash.appwizard @@ -0,0 +1,2 @@ +[General] +List=bashhello diff --git a/languages/bash/app_templates/bashhello/.kdev_ignore b/languages/bash/app_templates/bashhello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/bash/app_templates/bashhello/Makefile.am b/languages/bash/app_templates/bashhello/Makefile.am new file mode 100644 index 00000000..45e403b8 --- /dev/null +++ b/languages/bash/app_templates/bashhello/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = app.sh app.kdevelop +templateName = bashhello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/bash/app_templates/bashhello/app.kdevelop b/languages/bash/app_templates/bashhello/app.kdevelop new file mode 100644 index 00000000..40e783a4 --- /dev/null +++ b/languages/bash/app_templates/bashhello/app.kdevelop @@ -0,0 +1,82 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevScriptProject + Bash + + Bash + + + KDevdistpart + KDevDebugger + + + + + src + *.sh + *~ + + + + + + + + + + ada + ada_bugs_gcc + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + diff --git a/languages/bash/app_templates/bashhello/app.sh b/languages/bash/app_templates/bashhello/app.sh new file mode 100644 index 00000000..9e70bd5f --- /dev/null +++ b/languages/bash/app_templates/bashhello/app.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# $Id$ +# %{APPNAME} - Copyright (C) %{YEAR} %{AUTHOR} <%{EMAIL}> + + +hello() +{ + echo "Hello $NAME" +} + +echo "This is a test" + +LST="Ian Ben Rook Kaz" +for NAME in $LST +do + hello +done diff --git a/languages/bash/app_templates/bashhello/bashhello b/languages/bash/app_templates/bashhello/bashhello new file mode 100644 index 00000000..7c9b9222 --- /dev/null +++ b/languages/bash/app_templates/bashhello/bashhello @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=Simple Bash Shell Script +Name[fr]=Un simple script de test Hello world +Category=Shell +Category[fr]=Interprteur BASH +Comment=This generates a simplistic 'Hello world' program in Bash shell +Comment[fr]=Gnre un simple script de test du type Hello world pour l'interprteur BASH. +FileTemplates=sh,ShellStyle +ShowFilesAfterGeneration=APPNAMELC.sh diff --git a/languages/bash/app_templates/bashhello/bashhello.kdevtemplate b/languages/bash/app_templates/bashhello/bashhello.kdevtemplate new file mode 100644 index 00000000..e62b1514 --- /dev/null +++ b/languages/bash/app_templates/bashhello/bashhello.kdevtemplate @@ -0,0 +1,111 @@ +# KDE Config File +[General] +Name=Simple Bash Shell Script +Name[ca]=Simple script de l'intèrpret de comandaments Bash +Name[da]=Simpelt Bash skal-script +Name[de]=Ein einfaches Shell-Skript für Bash +Name[el]=Απλό σενάριο κελύφους Bash +Name[es]=Guión sencillo para el intérprete de órdenes Bash +Name[et]=Lihtne bash'i shelliskript +Name[eu]=Bash shell-aren script sinplea +Name[fa]=دست‌نوشتۀ سادۀ پوستۀ Bash +Name[fr]=Script shell Bash simple +Name[ga]=Script Shimplí Bhlaoisce Bash +Name[gl]=Script sinxelo en Bash Shell +Name[hu]=Egyszerű Bash-szkript +Name[it]=Semplice script shell Bash +Name[ja]=簡単な Bash シェルスクリプト +Name[nds]=En eenfach Konsoolskript för Bash +Name[ne]=साधारण ब्यास शेल स्क्रिप्ट +Name[nl]=Eenvoudig Bash-shellscript +Name[pl]=Prosty skrypt powłoki Bash +Name[pt]=Programa Simples da 'Shell' Bash +Name[pt_BR]=Programa Simples da 'Shell' Bash +Name[ru]=Простой скрипт Bash +Name[sk]=Jednoduchý skript pre Bash Shell +Name[sl]=Preprost skript za lupino Bash +Name[sr]=Једноставна скрипта шкољке Bash +Name[sr@Latn]=Jednostavna skripta školjke Bash +Name[sv]=Enkelt Bash-skalskript +Name[tr]=Basit Bash Kabuk Betiği +Name[zh_CN]=简单的 Bash Shell 脚本 +Name[zh_TW]=簡單的 Bash shell 文稿 +Category=Shell +Category[fr]=Interprteur BASH +Comment=This generates a simplistic 'Hello world' program in Bash shell +Comment[ca]=Genera un simple programa de 'Hello world' en l'intèrpret de comandaments Bash +Comment[da]=Dette genererer et simplistisk 'Goddag verden' program i en Bash skal +Comment[de]=Generiert ein einfaches "Hello world"-Programm für die Bash-Shell +Comment[el]=Αυτό δημιουργεί ένα απλό πρόγραμμα 'Γεια σου κόσμε' στο κέλυφος Bash +Comment[es]=Genera un sencillo programa «Hola mundo» para el intérprete de órdenes Bash +Comment[et]=Lihtsa "Tere, maailm" programmi loomine bash'i shellis +Comment[eu]=Honek "Kaixo mundua" programa sinple bat sortzen du Bash shell-erako +Comment[fa]=یک برنامۀ سادۀ «Hello world» در پوستۀ Bash تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » des plus simples en shell Bash +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" i mblaosc Bash +Comment[gl]=Xera un programa sinxelo 'Ola mundo' en Bash shell +Comment[hu]=Létrehoz egy egyszerű Hello world programot a Bash parancsértelmezőhöz +Comment[it]=Questo genera un semplice programma shell di "Hello world" in Bash +Comment[ja]=簡単な Hello world プログラムを Bash シェルで記述します +Comment[nds]=Dit stellt en eenfach "Moin Welt"-Programm för de Bash-Konsool op +Comment[ne]=यसले ब्यास शेलमा साधारण 'हेल्डो वोल्डकार' कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Dit genereert een eenvoudig "Hello World" programma in Bash-shell +Comment[pl]=Generuje prosty program 'Witaj świecie' jako skrypt powłoki Bash +Comment[pt]=Isto gera um programa simplista 'Olá mundo' para a linha de comandos Bash +Comment[pt_BR]=Isto gera um programa simplista 'Olá mundo' para a linha de comandos Bash +Comment[ru]=Создание простой программы 'Hello world' на Bash +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v Bash Shell +Comment[sl]=Ustvari preprost program 'Dobrodošel svet' v lupini Bash +Comment[sr]=Ово прави једноставан „Здраво свете“ програм за шкољку Bash +Comment[sr@Latn]=Ovo pravi jednostavan „Zdravo svete“ program za školjku Bash +Comment[sv]=Detta skapar ett förenklat 'Hello world'-program för Bash-skalet +Comment[tr]=Bu, Bash kabuğunda basit bir "Merhaba Dünya" programı üretir. +Comment[zh_CN]=这将生成 Bash shell 中可以使用的“Hello world”程序 +Comment[zh_TW]=這會產生一個簡單的 Bash shell 的 hello world 程式 +FileTemplates=sh,ShellStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.sh +Archive=bashhello.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.sh +Dest=%{dest}/%{APPNAMELC}.sh + +[MSG] +Type=message +Comment=A simple bash shell script project was created in %{dest} +Comment[ca]=Un simple script de l'intèrpret de comandaments Bash ha estat creat en %{dest} +Comment[da]=Et simpelt bash skalscript-projekt blev oprettet i %{dest} +Comment[de]=Ein einfaches Shell-Skript-Projekt für Bash wurde in %{dest} erstellt +Comment[el]=Ένα απλό σενάριο κελύφους bash δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo proyecto de guión de intérprete de órdenes ha sido creado en %{dest} +Comment[et]=Lihtne bash'i shelliskript loodi asukohta %{dest} +Comment[eu]=Bash shell-erako proiektu sinple bat sortu da hemen:%{dest} +Comment[fa]=یک پروژۀ دست‌نوشتۀ پوستۀ bash ساده در %{dest} ایجاد شد +Comment[fr]=Un projet de script shell Bash simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh tionscadal simplí bash i %{dest} +Comment[gl]=Creouse un proxecto de script sinxelo en bash shell en %{dest} +Comment[hu]=Létrejött egy egyszerű Bash-szkript (projekt) itt: %{dest} +Comment[it]=È stato creato un semplice progetto di script shell in Bash in %{dest} +Comment[ja]=簡単な bash シェルスクリプトを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach Konsoolskript-Projekt för Bash opstellt +Comment[ne]=एउटा साधारण शेल स्क्रिप्ट परियोजना %{dest} मा सिर्जना गरिएको थियो +Comment[nl]=Een eenvoudig Bash-shellscript is aangemaakt in %{dest} +Comment[pl]=Prosty skrypt powłoki został utworzony w %{dest} +Comment[pt]=Foi criado um programa simples "Olá mundo" em Bash em %{dest} +Comment[pt_BR]=Foi criado um programa simples "Olá mundo" em Bash em %{dest} +Comment[ru]=Простая программа "Hello world" на Bash создана в %{dest} +Comment[sk]=Jednoduchý Bash Shell projekt bol vytvorený v %{dest} +Comment[sl]=Projekt s preprostim skriptom za lupino Bash je bil ustvarjen v %{dest} +Comment[sr]=Пројекат једноставне скрипте за шкољку Bash направљен је у %{dest} +Comment[sr@Latn]=Projekat jednostavne skripte za školjku Bash napravljen je u %{dest} +Comment[sv]=Ett enkelt Bash skalskriptprojekt skapades i %{dest} +Comment[tr]=Basit bir bash betik projesi %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了简单的 Bash Shell 脚本工程 +Comment[zh_TW]=Bash shell 的 Hello world 程式已產生在 ${dest} diff --git a/languages/bash/app_templates/bashhello/bashhello.png b/languages/bash/app_templates/bashhello/bashhello.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/bash/app_templates/bashhello/bashhello.png differ diff --git a/languages/bash/bashsupport_part.cpp b/languages/bash/bashsupport_part.cpp new file mode 100644 index 00000000..389c0a70 --- /dev/null +++ b/languages/bash/bashsupport_part.cpp @@ -0,0 +1,442 @@ +/* +* Copyright (C) 2003 Ian Reinhart Geiser +*/ +#include "bashsupport_part.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef KDevGenericFactory BashSupportFactory; +static const KDevPluginInfo data("kdevbashsupport"); +K_EXPORT_COMPONENT_FACTORY( libkdevbashsupport, BashSupportFactory( data ) ) + +BashSupportPart::BashSupportPart(QObject *parent, const char *name, const QStringList& ) +: KDevLanguageSupport (&data, parent, name ? name : "BashSupportPart" ) +{ + setInstance(BashSupportFactory::instance()); + setXMLFile("kdevbashsupport.rc"); + + KAction *action; + action = new KAction( i18n("&Run"), "exec",Key_F9,this, SLOT(slotRun()),actionCollection(), "build_execute" ); + action->setToolTip(i18n("Run")); + action->setWhatsThis(i18n("Run

      Starts an application.")); + + kdDebug() << "Creating BashSupportPart" << endl; + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); + connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) ); + connect( partController(), SIGNAL(savedFile(const KURL&)), this, SLOT(savedFile(const KURL&)) ); + connect(partController(), SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(slotActivePartChanged(KParts::Part *))); + + m_cc = new BashCodeCompletion(); +} + + +BashSupportPart::~BashSupportPart() +{ + delete( m_cc ); + m_cc = 0; +} + + +void BashSupportPart::projectConfigWidget(KDialogBase *dlg) +{ + Q_UNUSED( dlg ); +// QVBox *vbox = dlg->addVBoxPage(i18n("Bash")); +// RubyConfigWidget *w = new RubyConfigWidget(*projectDom(), (QWidget *)vbox, "Bash config widget"); +// connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + +void BashSupportPart::projectOpened() +{ + kdDebug(9014) << "projectOpened()" << endl; + + connect( project(), SIGNAL(addedFilesToProject(const QStringList &)), + this, SLOT(addedFilesToProject(const QStringList &)) ); + connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)), + this, SLOT(removedFilesFromProject(const QStringList &)) ); + + // We want to parse only after all components have been + // properly initialized + QTimer::singleShot(0, this, SLOT(parse())); +} + + +void BashSupportPart::projectClosed() +{ + +} + +void BashSupportPart::slotRun () +{ + QString file; + KParts::ReadOnlyPart *ro_part = dynamic_cast(partController()->activePart()); + if(ro_part) + file = ro_part->url().path(); + + QString cmd = interpreter() + " " + file; + startApplication(cmd); +} + +QString BashSupportPart::interpreter() +{ + QString prog = DomUtil::readEntry(*projectDom(), "/kdevrbashsupport/run/interpreter"); + if (prog.isEmpty()) + prog = "bash"; + return prog; +} + +void BashSupportPart::parse() +{ + kdDebug(9014) << "initialParse()" << endl; + + if (project()) + { + kapp->setOverrideCursor(waitCursor); + QStringList files = project()->allFiles(); + for (QStringList::Iterator it = files.begin(); it != files.end() ;++it) + { + kdDebug(9014) << "maybe parse " << project()->projectDirectory() + "/" + (*it) << endl; + parse(project()->projectDirectory() + "/" + *it); + } + emit updatedSourceInfo(); + kapp->restoreOverrideCursor(); + } else { + kdDebug(9014) << "No project" << endl; + } +} + +void BashSupportPart::addedFilesToProject(const QStringList &fileList) +{ +kdDebug(9014) << "addedFilesToProject()" << endl; + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + parse(project()->projectDirectory() + "/" + ( *it ) ); + } + + emit updatedSourceInfo(); +} + + +void BashSupportPart::removedFilesFromProject(const QStringList &fileList) +{ + kdDebug(9014) << "removedFilesFromProject()" << endl; + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + QString fileName = project()->projectDirectory() + "/" + ( *it ); + if( codeModel()->hasFile(fileName) ){ + emit aboutToRemoveSourceInfo( fileName ); + codeModel()->removeFile( codeModel()->fileByName(fileName) ); + } + } + + //emit updatedSourceInfo(); +} + +void BashSupportPart::savedFile(const KURL &fileName) +{ + kdDebug(9014) << "savedFile()" << endl; + + if (project()->allFiles().contains(fileName.path().mid ( project()->projectDirectory().length() + 1 ))) + { + parse(fileName.path()); + emit addedSourceInfo( fileName.path() ); + } +} + +void BashSupportPart::startApplication(const QString &program) +{ + kdDebug() << "starting application" << program << endl; + if (KDevAppFrontend *appFrontend = extension("KDevelop/AppFrontend")) + appFrontend->startAppCommand(QString::QString(), program, TRUE); +} + + +KDevLanguageSupport::Features BashSupportPart::features() +{ + return Features(Variables | Functions); +} + +void BashSupportPart::parse(const QString &fileName) +{ + QFileInfo fi(fileName); + m_vars.clear(); + if (fi.extension() == "sh") + { + if( codeModel()->hasFile(fileName) ){ + emit aboutToRemoveSourceInfo( fileName ); + codeModel()->removeFile( codeModel()->fileByName(fileName) ); + } + + FileDom m_file = codeModel()->create(); + m_file->setName( fileName ); + + m_vars.clear(); + QFile f(QFile::encodeName(fileName)); + if (!f.open(IO_ReadOnly)) + return; + QString rawline; + QString line; + uint lineNo = 0; + //KRegExp methodre("\\b([\\d\\w]+[\\s]*)\\([\\s]*\\)"); + QRegExp methodre("^\\s*(\\w+)\\s*\\(\\s*\\)"); + QRegExp varre( "^\\s*(\\w+)[=]" ); + QRegExp expvarre( "^export\\s*(\\w+)[=]" ); + QRegExp forvarre("\\bfor[\\s]+([\\d\\w]+)[\\s]+in[\\s]+"); + + QTextStream stream(&f); + while (!stream.atEnd()) + { + rawline = stream.readLine(); + line = rawline.stripWhiteSpace().local8Bit(); + kdDebug() << "Trying line: " << line << endl; + if (methodre.search(line) != -1) + { + FunctionDom method = codeModel()->create(); + method->setName(methodre.cap(1)); + method->setFileName(fileName); + method->setStartPosition(lineNo, 0); + + if( !m_file->hasFunction(method->name()) ){ + kdDebug() << "Add global method " << method->name() << endl; + m_file->addFunction( method ); + } + } + else if(varre.search(line) != -1) + { + addAttribute(varre.cap(1), m_file, lineNo); + } + else if(expvarre.search(line) != -1) + { + addAttribute(expvarre.cap(1), m_file, lineNo); + } + else if(forvarre.search(line) != -1) + { + addAttribute(forvarre.cap(1), m_file, lineNo); + } + ++lineNo; + } + f.close(); + + kdDebug() << "Trying to add list..." << endl; + codeModel()->addFile( m_file ); + VariableList attrList = codeModel()->globalNamespace()->variableList(); + for (VariableList::Iterator it = attrList.begin(); it != attrList.end(); ++it) + { + kdDebug() << "Adding " << (*it)->name() << endl; + m_vars.append((*it)->name()); + } + m_cc->setVars(m_vars); + + codeModel()->addFile( m_file ); + } + +} + +void BashSupportPart::slotActivePartChanged(KParts::Part *part) +{ + kdDebug() << "Changeing part..." << endl; + m_cc->setActiveEditorPart(part); +} + +void BashSupportPart::addAttribute(const QString &name, FileDom file, uint lineNo) +{ + VariableDom var = codeModel()->create(); + var->setName(name); + var->setFileName(file->name()); + var->setStartPosition( lineNo, 0 ); + var->setType(i18n("Variable")); + + if( !file->hasVariable(var->name()) ){ + kdDebug() << "Add global attribute " << var->name() << endl; + file->addVariable(var); + } +} + +BashCodeCompletion::BashCodeCompletion() +{ + m_argWidgetShow = false; + m_completionBoxShow=false; +} + +BashCodeCompletion::~BashCodeCompletion() +{ + +} + +void BashCodeCompletion::setActiveEditorPart(KParts::Part *part) +{ + if (!part || !part->widget()) + return; + + kdDebug() << "BashCodeCompletion::setActiveEditorPart" << endl; + +// We need to think about this +// if(!(m_config->getCodeCompletion() || m_config->getCodeHinting())){ +// return; // no help +// } + + m_editInterface = dynamic_cast(part); + if (!m_editInterface) + { + kdDebug() << "editor doesn't support the EditDocumentIface" << endl; + return; + } + + m_cursorInterface = dynamic_cast(part->widget()); + if (!m_cursorInterface) + { + kdDebug() << "editor does not support the ViewCursorInterface" << endl; + return; + } + + m_codeInterface = dynamic_cast(part->widget()); + if (!m_codeInterface) { // no CodeCompletionDocument available + kdDebug() << "editor doesn't support the CodeCompletionDocumentIface" << endl; + return; + } + + disconnect(part->widget(), 0, this, 0 ); // to make sure that it is't connected twice + connect(part->widget(), SIGNAL(cursorPositionChanged()), + this, SLOT(cursorPositionChanged())); + connect(part->widget(), SIGNAL(argHintHidden()), this, SLOT(argHintHidden())); + connect(part->widget(), SIGNAL(completionAborted()), this, SLOT(completionBoxAbort())); + connect(part->widget(), SIGNAL(completionDone()), this, SLOT(completionBoxHidden())); + +} + +void BashCodeCompletion::setVars(QStringList lst) +{ + m_vars = lst; +} + +QValueList BashCodeCompletion::getVars(const QString &startText) +{ + kdDebug() << "getVars for " << startText << endl; + QValueList varList; + QValueList::ConstIterator it; + for (it = m_vars.begin(); it != m_vars.end(); ++it) { + QString var = "$" + (*it); + kdDebug() << "Compair " << var << endl; + if( var.startsWith( startText )) + { + KTextEditor::CompletionEntry e; + e.text = var; + //e.postfix =""; + //e.prefix =""; + kdDebug() << "getVar: " << var << endl; + varList.append(e); + } + } + + return varList; +} + +void BashCodeCompletion::cursorPositionChanged() +{ + uint line, col; + m_cursorInterface->cursorPositionReal(&line, &col); + kdDebug() << "BashCodeCompletion::cursorPositionChanged:" << line << ":" << col << endl; + + QString lineStr = m_editInterface->textLine(line); + if(lineStr.isNull() || lineStr.isEmpty()){ + kdDebug() << "No Text..." << endl; + return; // nothing to do + } +// if(m_config->getCodeCompletion()) +// { + QString restLine = lineStr.mid(col); + QString prevText = lineStr.mid(0,col); + + if(restLine.left(1) != " " && restLine.left(1) != "\t" && !restLine.isNull()) + { + kdDebug() << "no codecompletion because no empty character after cursor:" << restLine << ":" << endl; + return; + } + + QRegExp prevReg("[$][\\d\\w]*\\b$"); + + int pos = prevReg.search( prevText ); + if (pos > -1 ) + { + // We are in completion mode + QString startMatch = prevReg.cap(0); + kdDebug() << "Matching: " << startMatch << endl; + m_completionBoxShow=true; + m_codeInterface->showCompletionBox(getVars(startMatch),2); + } + else + { + kdDebug() << "no vars in: " << prevText << endl; + return; + } + +// } + +} + +void BashCodeCompletion::completionBoxHidden() +{ + kdDebug() << "Complete..." << endl; + m_completionBoxShow=false; +/* uint line, col, start; + m_cursorInterface->cursorPositionReal(&line, &col); + QString lineStr = m_editInterface->textLine(line); + + start = lineStr.findRev(QRegExp("[$][\\d\\w]*\\b$")); + m_editInterface->removeText ( start, col, line, col ); +*/ +} + +void BashCodeCompletion::completionBoxAbort() +{ + kdDebug() << "aborted..." << endl; + m_completionBoxShow=false; +} + +KMimeType::List BashSupportPart::mimeTypes( ) +{ + KMimeType::List list; + + KMimeType::Ptr mime = KMimeType::mimeType( "application/x-shellscript" ); + if( mime ) + list << mime; + + return list; +} +#include "bashsupport_part.moc" diff --git a/languages/bash/bashsupport_part.h b/languages/bash/bashsupport_part.h new file mode 100644 index 00000000..20c11c4e --- /dev/null +++ b/languages/bash/bashsupport_part.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2003 Ian Reinhart Geiser + */ + + +#ifndef __KDEVPART_BASHSUPPORT_H__ +#define __KDEVPART_BASHSUPPORT_H__ + + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +//class BashSupportWidget; + +class BashCodeCompletion : QObject +{ + Q_OBJECT + public: + BashCodeCompletion(); + ~BashCodeCompletion(); + void setActiveEditorPart(KParts::Part*); + void setVars(QStringList); + QValueList getVars(const QString& textHint); + + public slots: + void cursorPositionChanged(); + void completionBoxHidden(); + void completionBoxAbort(); + + private: + QStringList m_vars; + bool m_argWidgetShow; + bool m_completionBoxShow; + KTextEditor::EditInterface *m_editInterface; + KTextEditor::CodeCompletionInterface *m_codeInterface; + KTextEditor::ViewCursorInterface *m_cursorInterface; +}; + +class BashSupportPart : public KDevLanguageSupport +{ + Q_OBJECT + public: + BashSupportPart(QObject *parent, const char *name, const QStringList &); + virtual ~BashSupportPart(); + + protected: + virtual Features features(); + virtual KMimeType::List mimeTypes(); + + private slots: + void slotRun(); + void projectConfigWidget(KDialogBase *dlg); + void projectOpened(); + void projectClosed(); + void savedFile(const KURL &fileName); + void addedFilesToProject(const QStringList &fileList); + void removedFilesFromProject(const QStringList &fileList); + void parse(); + void slotActivePartChanged(KParts::Part *part); + + private: + void startApplication(const QString &program); + QString interpreter(); + void parse(const QString &fileName); + void addAttribute(const QString &name, FileDom file, uint line); + BashCodeCompletion *m_cc; + QStringList m_vars; + +}; + +#endif diff --git a/languages/bash/doc/Makefile.am b/languages/bash/doc/Makefile.am new file mode 100644 index 00000000..1474d939 --- /dev/null +++ b/languages/bash/doc/Makefile.am @@ -0,0 +1,6 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = bash.toc bash_bugs.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + diff --git a/languages/bash/doc/bash.toc b/languages/bash/doc/bash.toc new file mode 100644 index 00000000..060c59c7 --- /dev/null +++ b/languages/bash/doc/bash.toc @@ -0,0 +1,80 @@ + + +Bash Reference Manual + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/languages/bash/doc/bash_bugs.toc b/languages/bash/doc/bash_bugs.toc new file mode 100644 index 00000000..aa7b42e3 --- /dev/null +++ b/languages/bash/doc/bash_bugs.toc @@ -0,0 +1,7 @@ + + +Bash bugs + + + + diff --git a/languages/bash/kdevbashsupport.desktop b/languages/bash/kdevbashsupport.desktop new file mode 100644 index 00000000..f46b99eb --- /dev/null +++ b/languages/bash/kdevbashsupport.desktop @@ -0,0 +1,85 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Bash Support +Comment[ca]=Suport per a Bash +Comment[da]=Bash understøttelse +Comment[de]=Unterstützung für Bash +Comment[el]=Υποστήριξη Bash +Comment[es]=Soporte para Bash +Comment[et]=Bash'i toetus +Comment[eu]=Bash-en euskarria +Comment[fa]=پشتیبانی Bash +Comment[fr]=Prise en charge de BASH +Comment[ga]=Tacaíocht Bash +Comment[gl]=Soporte de Bash +Comment[hi]=बैश समर्थन +Comment[hu]=Bash-támogatás +Comment[is]=Bash stuðnigur +Comment[it]=Supporto per Bash +Comment[ja]=Bash サポート +Comment[nds]=Bash-Ünnerstütten +Comment[ne]=ब्यास समर्थन +Comment[nl]=Ondersteuning voor Bash +Comment[pl]=Obsługa bash-a +Comment[pt]=Suporte a Bash +Comment[pt_BR]=Suporte ao Bash +Comment[ru]=Поддержка языка Bash +Comment[sk]=Podpora Bash +Comment[sl]=Podpora bash +Comment[sr]=Bash подршка +Comment[sr@Latn]=Bash podrška +Comment[sv]=Bash-stöd +Comment[ta]=பாஷ் ஆதரவு +Comment[tg]=Ёри намудани забони Bash +Comment[tr]=Bash Desteği +Comment[zh_CN]=Bash 支持 +Comment[zh_TW]=Bash 支援 +Name=KDevBashSupport +Name[da]=KDevelop Bash-understøttelse +Name[de]=Unterstützung für Bash (KDevelop) +Name[hi]=के-डेव-बैश-समर्थन +Name[nds]=Bash-Ünnerstütten för KDevelop +Name[ne]=केडीई विकास ब्यास समर्थन +Name[pl]=KDevObsługaBasha +Name[sk]=KDevBashPodpora +Name[sv]=KDevelop Bash-stöd +Name[ta]=கெடெவ்பாஷ் ஆதரவு +Name[zh_TW]=KDevelop Bash 支援 +GenericName=Bash Support +GenericName[ca]=Suport per a Bash +GenericName[da]=Bash-understøttelse +GenericName[de]=Unterstützung für Bash +GenericName[el]=Υποστήριξη Bash +GenericName[es]=Soporte para Bash +GenericName[et]=Bash'i toetus +GenericName[eu]=Bash-en euskarria +GenericName[fa]=پشتیبانی Bash +GenericName[fr]=Prise en charge de BASH +GenericName[ga]=Tacaíocht Bash +GenericName[gl]=Soporte de Bash +GenericName[hi]=बैश समर्थन +GenericName[hu]=Bash-támogatás +GenericName[it]=Supporto Bash +GenericName[ja]=Bash サポート +GenericName[nds]=Ünnerstütten för Bash +GenericName[ne]=ब्यास समर्थन +GenericName[nl]=Ondersteuning voor Bash +GenericName[pl]=Obsługa bash-a +GenericName[pt]=Suporte de Bash +GenericName[pt_BR]=Suporte ao Bash +GenericName[ru]=Поддержка языка Bash +GenericName[sk]=Podpora Bash +GenericName[sl]=Podpora bash +GenericName[sr]=Bash подршка +GenericName[sr@Latn]=Bash podrška +GenericName[sv]=Bash-stöd +GenericName[ta]=பாஷ் ஆதரவு +GenericName[tg]=Ёри намудани забони Bash +GenericName[tr]=Bash Desteği +GenericName[zh_CN]=Bash 支持 +GenericName[zh_TW]=Bash 支援 +ServiceTypes=KDevelop/LanguageSupport +X-KDE-Library=libkdevbashsupport +X-KDevelop-Version=5 +X-KDevelop-Language=Bash diff --git a/languages/bash/kdevbashsupport.rc b/languages/bash/kdevbashsupport.rc new file mode 100644 index 00000000..d4592d6b --- /dev/null +++ b/languages/bash/kdevbashsupport.rc @@ -0,0 +1,11 @@ + + + +

      + + + + + + + diff --git a/languages/cpp/KDevCppSupportIface.cpp b/languages/cpp/KDevCppSupportIface.cpp new file mode 100644 index 00000000..f5af83c9 --- /dev/null +++ b/languages/cpp/KDevCppSupportIface.cpp @@ -0,0 +1,24 @@ + +#include "KDevCppSupportIface.h" +#include "cppsupportpart.h" + +KDevCppSupportIface::KDevCppSupportIface( CppSupportPart* cppSupport ) + : QObject( cppSupport ), DCOPObject( "KDevCppSupport" ), m_cppSupport( cppSupport ) +{ +} + +KDevCppSupportIface::~KDevCppSupportIface() +{ +} + +void KDevCppSupportIface::addClass() +{ + m_cppSupport->slotNewClass(); +} + +void KDevCppSupportIface::parseProject() +{ + m_cppSupport->parseProject(); +} + +#include "KDevCppSupportIface.moc" diff --git a/languages/cpp/KDevCppSupportIface.h b/languages/cpp/KDevCppSupportIface.h new file mode 100644 index 00000000..34780d8c --- /dev/null +++ b/languages/cpp/KDevCppSupportIface.h @@ -0,0 +1,27 @@ + +#ifndef KDEVCPPSUPPORTIFACE_H +#define KDEVCPPSUPPORTIFACE_H + +#include +#include + +class CppSupportPart; + +class KDevCppSupportIface : public QObject, public DCOPObject +{ + Q_OBJECT + K_DCOP +public: + KDevCppSupportIface( CppSupportPart* cppSupport ); + ~KDevCppSupportIface(); + +k_dcop: + void addClass(); + void parseProject(); + +private: + CppSupportPart* m_cppSupport; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/Makefile.am b/languages/cpp/Makefile.am new file mode 100644 index 00000000..30ba6d44 --- /dev/null +++ b/languages/cpp/Makefile.am @@ -0,0 +1,59 @@ +# Here resides the C/C++ support part. + +SUBDIRS = templates subclassing_template newclass_templates file_templates \ + app_templates compiler pcsimporter debugger doc + +INCLUDES = -I$(top_srcdir)/languages/lib/designer_integration \ + -I$(top_srcdir)/languages/lib/interfaces -I$(top_srcdir)/lib/catalog -I$(top_srcdir)/lib/compat \ + -I$(top_srcdir)/lib/cppparser -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + -I$(top_builddir)/languages/lib/designer_integration -I$(top_builddir)/bdb/build_unix -I$(top_srcdir)/bdb/include \ + $(all_includes) + +kde_module_LTLIBRARIES = libkdevcppsupport.la +libkdevcppsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevcppsupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/catalog/libkdevcatalog.la $(top_builddir)/lib/cppparser/libkdevcppparser.la \ + $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la \ + $(top_builddir)/languages/lib/designer_integration/libdesignerintegration.la $(top_builddir)/lib/interfaces/libkdevinterfaces.la + +libkdevcppsupport_la_SOURCES = KDevCppSupportIface.cpp KDevCppSupportIface.skel \ + addattributedialog.cpp addattributedialogbase.ui addmethoddialog.cpp addmethoddialogbase.ui \ + ast_utils.cpp backgroundparser.cpp ccconfigwidget.cpp ccconfigwidgetbase.ui \ + classgeneratorconfig.cpp classgeneratorconfigbase.ui codeinformationrepository.cpp \ + completiondebug.cpp configproblemreporter.ui cppcodecompletion.cpp \ + cppcodecompletionconfig.cpp cppevaluation.cpp cppimplementationwidget.cpp cppnewclassdlg.cpp \ + cppnewclassdlgbase.ui cppsplitheadersourceconfig.cpp cppsupport_utils.cpp \ + cppsupportfactory.cpp cppsupportpart.cpp creategettersetter.ui \ + creategettersetterconfiguration.cpp creategettersetterconfiguration.h creategettersetterdialog.cpp \ + creategettersetterdialog.h createpcsdialog.cpp createpcsdialogbase.ui doxydoc.cpp includefiles.cpp \ + includepathresolver.cpp kdevdriver.cpp problemreporter.cpp qtbuildconfig.cpp \ + qtdesignercppintegration.cpp setuphelper.cpp simplecontext.cpp simpletype.cpp simpletypecatalog.cpp \ + simpletypefunction.cpp simpletypenamespace.cpp store_walker.cpp storeconverter.cpp \ + stringhelpers.cpp subclassingdlg.cpp subclassingdlgbase.ui tag_creator.cpp typedesc.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevcppsupport.desktop kdevcsupport.desktop + +rcdir = $(kde_datadir)/kdevcppsupport +rc_DATA = kdevcppsupport.rc + +templatedir = ${kde_datadir}/kdevabbrev/templates +template_DATA = cpptemplates + +configurationdir = ${kde_datadir}/kdevcppsupport +configuration_DATA = configuration + +AM_CXXFLAGS = -DAST_DEBUG + +#bin_PROGRAMS = r++ +#r___LDFLAGS = $(all_libraries) +#r___SOURCES = main.cpp +#r___DEPENDENCIES = libkdevcppsupport.la +#r___LDADD = libkdevcppsupport.la $(top_builddir)/lib/catalog/libkdevcatalog.la $(top_builddir)/lib/cppparser/libkdevcppparser.la +noinst_HEADERS = cppevaluation.h cppimplementationwidget.h \ + cppsplitheadersourceconfig.h declarationinfo.h expressioninfo.h includefiles.h includepathresolver.h \ + qtdesignercppintegration.h setuphelper.h simplecontext.h simpletypecatalog.h simpletypefunction.h \ + simpletypenamespace.h storeconverter.h diff --git a/languages/cpp/README.dox b/languages/cpp/README.dox new file mode 100644 index 00000000..ba1fbc05 --- /dev/null +++ b/languages/cpp/README.dox @@ -0,0 +1,34 @@ +/** \class CppSupportPart +Provides C/C++ language support for KDevelop. + +Well the first thing you should read is lib/catalog it contains the source of the persistant class store +after that languages/cpp/tag_creator.* +it is the component that stores the informations collected by the c++ parser into the PCS +then you can play with KDevPCSImporter the code of the dialog is in languages/cpp/createpcsdialog* and languages/cpp/pcsimporter/* +and of course lib/interfaces/kdevpcsimporter.* +and if you want play with the c++ parser go to lib/cppparser/, the best is to start to read driver.* + +\authors Roberto Raggi + +\maintainer Roberto Raggi + +\feature supports C/C++ language +\feature can do code completion +\feature has presistent class store +\feature code highlight +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +\bug bugs in cppsupport component at Bugzilla database + +\faq How can I have documentation on functions when using codecompletion ? + -# Create the xml-output with Doxygen of the files you want to add to the classstore + -# Create the new PCS-database with r++. Now you have to use the -d command line switch of r++ to have it include the documentation. + It is used like -d/path/of/doxygen/xml/output (notice that there is _no_ whitespace between -d and the path!). + You can use it multiple times to have r++ search for the informations in different directories. + r++ -d has to be used (like every other commandline switch) before you write the directories you want r++ to create the PCSdatabase from. + -# Activate your newly created Database in the Project->Project Options...->C++ Specific->Code Completion... + . +\faq How does this work ? I have no clue. Ask roberto! :) +\faq How does r++ work ? I have no clue. Ask roberto! :) + +*/ diff --git a/languages/cpp/addattributedialog.cpp b/languages/cpp/addattributedialog.cpp new file mode 100644 index 00000000..408b2ff8 --- /dev/null +++ b/languages/cpp/addattributedialog.cpp @@ -0,0 +1,265 @@ +/* +* Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.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; either +* version 2 of the License, or (at your option) any later version. +* +* 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; see the file COPYING.LIB. If not, write to +* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +* Boston, MA 02111-1307, USA. +* +*/ + +#include "addattributedialog.h" +#include "cppsupportpart.h" +#include "backgroundparser.h" +#include "cppsupport_utils.h" + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +AddAttributeDialog::AddAttributeDialog( CppSupportPart* cppSupport, ClassDom klass, + QWidget* parent, const char* name, bool modal, WFlags fl ) +: AddAttributeDialogBase( parent, name, modal, fl ), m_cppSupport( cppSupport ), m_klass( klass ), m_count( 0 ) +{ + access->insertStringList( QStringList() << "Public" << "Protected" << "Private" ); + + storage->insertStringList( QStringList() << "Normal" << "Static" ); + + returnType->setAutoCompletion( true ); + returnType->insertStringList( QStringList() + << "void" + << "char" + << "wchar_t" + << "bool" + << "short" + << "int" + << "long" + << "signed" + << "unsigned" + << "float" + << "double" ); + + returnType->insertStringList( typeNameList( m_cppSupport->codeModel() ) ); + + updateGUI(); + addAttribute(); +} + +AddAttributeDialog::~AddAttributeDialog() +{} + +void AddAttributeDialog::reject() +{ + QDialog::reject(); +} + +void AddAttributeDialog::accept() +{ + m_cppSupport->partController()->editDocument( KURL( m_klass->fileName() ) ); + KTextEditor::EditInterface* editIface = dynamic_cast( m_cppSupport->partController() ->activePart() ); + if ( !editIface ) + { + /// @todo show messagebox + QDialog::accept(); + return ; + } + + int line, column; + m_klass->getEndPosition( &line, &column ); + + // compute the insertion point map + QMap > points; + QStringList accessList; + + const VariableList variableList = m_klass->variableList(); + for ( VariableList::ConstIterator it = variableList.begin(); it != variableList.end(); ++it ) + { + int varEndLine, varEndColumn; + ( *it ) ->getEndPosition( &varEndLine, &varEndColumn ); + QString access = accessID( *it ); + QPair varEndPoint = qMakePair( varEndLine, varEndColumn ); + + if ( !points.contains( access ) || points[ access ] < varEndPoint ) + { + accessList.remove( access ); + accessList.push_back( access ); // move 'access' at the end of the list + + points[ access ] = varEndPoint; + } + } + + int insertedLine = 0; + + accessList += newAccessList( accessList ); + + for ( QStringList::iterator it = accessList.begin(); it != accessList.end(); ++it ) + { + QListViewItem* item = attributes->firstChild(); + while ( item ) + { + QListViewItem * currentItem = item; + + item = item->nextSibling(); + + if ( currentItem->text( 0 ) != *it ) + continue; + + QString access = ( *it ).lower(); + + QString str = variableDeclaration( currentItem ); + + QPair pt; + if ( points.contains( *it ) ) + { + pt = points[ *it ]; + } + else + { + str.prepend( access + ":\n" ); + points[ *it ] = qMakePair( line - 1, 0 ); + pt = points[ *it ]; // end of class declaration + } + + editIface->insertText( pt.first + insertedLine + 1, 0 /*pt.second*/, str ); + insertedLine += str.contains( QChar( '\n' ) ); + } + } + + m_cppSupport->backgroundParser() ->addFile( m_klass->fileName() ); + + QDialog::accept(); +} + +QString AddAttributeDialog::variableDeclaration( QListViewItem* item ) const +{ + QString str; + QTextStream stream( &str, IO_WriteOnly ); + QString ind; + ind.fill( QChar( ' ' ), 4 ); + + stream << ind; + if ( item->text( 1 ) == "Static" ) + stream << "static "; + stream << item->text( 2 ) << " " << item->text( 3 ); + stream << ";\n"; + + return str; +} + + +void AddAttributeDialog::updateGUI() +{ + bool enable = attributes->selectedItem() != 0; + + returnType->setEnabled( enable ); + declarator->setEnabled( enable ); + access->setEnabled( enable ); + storage->setEnabled( enable ); + + deleteAttributeButton->setEnabled( enable ); + + if ( enable ) + { + QListViewItem * item = attributes->selectedItem(); + item->setText( 0, access->currentText() ); + item->setText( 1, storage->currentText() ); + item->setText( 2, returnType->currentText() ); + item->setText( 3, declarator->text() ); + } +} + +void AddAttributeDialog::addAttribute() +{ + QListViewItem * item = new QListViewItem( attributes, "Protected", "Normal", + "int", QString( "attribute_%1" ).arg( ++m_count ) ); + attributes->setCurrentItem( item ); + attributes->setSelected( item, true ); + + returnType->setFocus(); +} + +void AddAttributeDialog::deleteCurrentAttribute() +{ + delete( attributes->currentItem() ); +} + +void AddAttributeDialog::currentChanged( QListViewItem* item ) +{ + if ( item ) + { + QString _access = item->text( 0 ); + QString _storage = item->text( 1 ); + QString _returnType = item->text( 2 ); + QString _declarator = item->text( 3 ); + + access->setCurrentText( _access ); + storage->setCurrentText( _storage ); + returnType->setCurrentText( _returnType ); + declarator->setText( _declarator ); + } + + updateGUI(); +} + +QStringList AddAttributeDialog::newAccessList( const QStringList& accessList ) const +{ + QStringList newAccessList; + + QListViewItem* item = attributes->firstChild(); + while ( item ) + { + QListViewItem * currentItem = item; + + item = item->nextSibling(); + + QString access = currentItem->text( 0 ); + if ( !( accessList.contains( access ) || newAccessList.contains( access ) ) ) + newAccessList.push_back( access ); + } + + return newAccessList; +} + +QString AddAttributeDialog::accessID( VariableDom var ) const +{ + switch ( var->access() ) + { + case CodeModelItem::Public: + return QString::fromLatin1( "Public" ); + + case CodeModelItem::Protected: + return QString::fromLatin1( "Protected" ); + + case CodeModelItem::Private: + return QString::fromLatin1( "Private" ); + } + + return QString::null; +} + +#include "addattributedialog.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; + diff --git a/languages/cpp/addattributedialog.h b/languages/cpp/addattributedialog.h new file mode 100644 index 00000000..18818ef7 --- /dev/null +++ b/languages/cpp/addattributedialog.h @@ -0,0 +1,60 @@ +/* +* Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.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; either +* version 2 of the License, or (at your option) any later version. +* +* 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; see the file COPYING.LIB. If not, write to +* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +* Boston, MA 02111-1307, USA. +* +*/ + +#ifndef ADDATTRIBUTEDIALOG_H +#define ADDATTRIBUTEDIALOG_H + +#include "addattributedialogbase.h" +#include + +class CppSupportPart; + +class AddAttributeDialog : public AddAttributeDialogBase +{ + Q_OBJECT +public: + AddAttributeDialog( CppSupportPart* cppSupport, ClassDom klass, + QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~AddAttributeDialog(); + + virtual void addAttribute(); + virtual void deleteCurrentAttribute(); + virtual void currentChanged( QListViewItem* item ); + virtual void updateGUI(); + +protected: + virtual void reject(); + virtual void accept(); + +private: + QString accessID( VariableDom var ) const; + QStringList newAccessList( const QStringList& accessList ) const; + QString variableDeclaration( QListViewItem* item ) const; + +private: + CppSupportPart* m_cppSupport; + ClassDom m_klass; + int m_count; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + + diff --git a/languages/cpp/addattributedialogbase.ui b/languages/cpp/addattributedialogbase.ui new file mode 100644 index 00000000..eabd89fe --- /dev/null +++ b/languages/cpp/addattributedialogbase.ui @@ -0,0 +1,375 @@ + +AddAttributeDialogBase + + + AddAttributeDialogBase + + + + 0 + 0 + 619 + 413 + + + + Add Attribute + + + true + + + + unnamed + + + + + Access + + + true + + + true + + + + + Storage + + + true + + + true + + + + + Type + + + true + + + true + + + + + Declarator + + + true + + + true + + + + attributes + + + true + + + LastColumn + + + + + layout3 + + + + unnamed + + + + spacer3 + + + Horizontal + + + Expanding + + + + 111 + 20 + + + + + + addAttributeButton + + + &Add Attribute + + + + + deleteAttributeButton + + + &Delete Attribute + + + + + + + groupBox1 + + + Attribute Properties + + + + unnamed + + + + layout4 + + + + unnamed + + + + textLabel1 + + + T&ype: + + + returnType + + + + + returnType + + + true + + + + + declarator + + + + + textLabel2 + + + D&eclarator: + + + declarator + + + + + + + layout5 + + + + unnamed + + + + storage + + + + + textLabel5 + + + S&torage: + + + storage + + + + + textLabel3 + + + Acce&ss: + + + access + + + + + access + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + + buttonOk + clicked() + AddAttributeDialogBase + accept() + + + buttonCancel + clicked() + AddAttributeDialogBase + reject() + + + addAttributeButton + clicked() + AddAttributeDialogBase + addAttribute() + + + deleteAttributeButton + clicked() + AddAttributeDialogBase + deleteCurrentAttribute() + + + attributes + selectionChanged(QListViewItem*) + AddAttributeDialogBase + currentChanged(QListViewItem*) + + + returnType + activated(const QString&) + AddAttributeDialogBase + updateGUI() + + + declarator + textChanged(const QString&) + AddAttributeDialogBase + updateGUI() + + + access + activated(const QString&) + AddAttributeDialogBase + updateGUI() + + + storage + activated(const QString&) + AddAttributeDialogBase + updateGUI() + + + returnType + textChanged(const QString&) + AddAttributeDialogBase + updateGUI() + + + + attributes + addAttributeButton + deleteAttributeButton + returnType + declarator + access + storage + buttonOk + buttonCancel + + + kdialog.h + + + init() + destroy() + addAttribute() + deleteCurrentAttribute() + currentChanged(QListViewItem*) + updateGUI() + + + + diff --git a/languages/cpp/addmethoddialog.cpp b/languages/cpp/addmethoddialog.cpp new file mode 100644 index 00000000..943f15d7 --- /dev/null +++ b/languages/cpp/addmethoddialog.cpp @@ -0,0 +1,420 @@ +/* +* Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.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; either +* version 2 of the License, or (at your option) any later version. +* +* 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; see the file COPYING.LIB. If not, write to +* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +* Boston, MA 02111-1307, USA. +* +*/ + +#include "addmethoddialog.h" +#include "cppsupportpart.h" +#include "backgroundparser.h" +#include "cppsupport_utils.h" +#include "domutil.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +AddMethodDialog::AddMethodDialog( CppSupportPart* cppSupport, ClassDom klass, + QWidget* parent, const char* name, bool modal, WFlags fl ) +: AddMethodDialogBase( parent, name, modal, fl ), m_cppSupport( cppSupport ), m_klass( klass ), m_count( 0 ) +{ + QString fileName = m_klass->fileName(); + + access->insertStringList( QStringList() << "Public" << "Protected" << "Private" << "Signals" << + "Public Slots" << "Protected Slots" << "Private Slots" ); + + storage->insertStringList( QStringList() << "Normal" << "Static" << "Virtual" << "Pure Virtual" << "Friend" ); + + // setup sourceFile combo + QMap m; +#if 0 /// \FIXME ROBE + + FunctionList l = m_klass->functionList(); + { + for ( FunctionList::Iterator it = l.begin(); it != l.end(); ++it ) + { + if ( ( *it ) ->hasImplementation() ) + m.insert( ( *it ) ->implementedInFile(), true ); + } + } +#endif + + { + QStringList headers = QStringList::split( ",", "h,H,hh,hxx,hpp,inl,tlh,diff,ui.h" ); + QStringList fileList; + QMap::Iterator it = m.begin(); + while ( it != m.end() ) + { + QString ext = QFileInfo( it.key() ).extension(); + if ( !headers.contains( ext ) ) + sourceFile->insertItem( it.key() ); + ++it; + } + + if ( sourceFile->count() == 0 ) + { + QFileInfo info( fileName ); + QString impl = DomUtil::readEntry( *cppSupport->projectDom(), "/cppsupportpart/filetemplates/implementationsuffix", "cpp" ); + sourceFile->insertItem( info.dirPath( true ) + "/" + info.baseName() + impl ); + } + } + + returnType->setAutoCompletion( true ); + returnType->insertStringList( QStringList() + << "void" + << "char" + << "wchar_t" + << "bool" + << "short" + << "int" + << "long" + << "signed" + << "unsigned" + << "float" + << "double" ); + + returnType->insertStringList( typeNameList( m_cppSupport->codeModel() ) ); + + updateGUI(); + addMethod(); +} + +AddMethodDialog::~AddMethodDialog() +{} + +void AddMethodDialog::reject() +{ + QDialog::reject(); +} + +QString AddMethodDialog::accessID( FunctionDom fun ) const +{ + if ( fun->isSignal() ) + return QString::fromLatin1( "Signals" ); + + switch ( fun->access() ) + { + case CodeModelItem::Public: + if ( fun->isSlot() ) + return QString::fromLatin1( "Public Slots" ); + return QString::fromLatin1( "Public" ); + + case CodeModelItem::Protected: + if ( fun->isSlot() ) + return QString::fromLatin1( "Protected Slots" ); + return QString::fromLatin1( "Protected" ); + + case CodeModelItem::Private: + if ( fun->isSlot() ) + return QString::fromLatin1( "Private Slots" ); + return QString::fromLatin1( "Private" ); + } + + return QString::null; +} + +void AddMethodDialog::accept() +{ + m_cppSupport->partController() ->editDocument( KURL( m_klass->fileName() ) ); + KTextEditor::EditInterface* editIface = dynamic_cast( m_cppSupport->partController() ->activePart() ); + if ( !editIface ) + { + /// @todo show messagebox + QDialog::accept(); + return ; + } + + int line, column; + m_klass->getEndPosition( &line, &column ); + + // compute the insertion point map + QMap > points; + QStringList accessList; + + const FunctionList functionList = m_klass->functionList(); + for ( FunctionList::ConstIterator it = functionList.begin(); it != functionList.end(); ++it ) + { + int funEndLine, funEndColumn; + ( *it ) ->getEndPosition( &funEndLine, &funEndColumn ); + QString access = accessID( *it ); + QPair funEndPoint = qMakePair( funEndLine, funEndColumn ); + + if ( !points.contains( access ) || points[ access ] < funEndPoint ) + { + accessList.remove( access ); + accessList.push_back( access ); // move 'access' at the end of the list + + points[ access ] = funEndPoint; + } + } + + int insertedLine = 0; + + accessList += newAccessList( accessList ); + + for ( QStringList::iterator it = accessList.begin(); it != accessList.end(); ++it ) + { + QListViewItem* item = methods->firstChild(); + while ( item ) + { + QListViewItem * currentItem = item; + + item = item->nextSibling(); + + if ( currentItem->text( 1 ) != *it ) + continue; + + QString access = ( *it ).lower(); + + bool isInline = currentItem->text( 0 ) == "True"; + QString str = isInline ? functionDefinition( currentItem ) : functionDeclaration( currentItem ); + + QPair pt; + if ( points.contains( *it ) ) + { + pt = points[ *it ]; + } + else + { + str.prepend( access + ":\n" ); + points[ *it ] = qMakePair( line - 1, 0 ); + pt = points[ *it ]; // end of class declaration + } + + editIface->insertText( pt.first + insertedLine + 1, 0 /*pt.second*/, str ); + insertedLine += str.contains( QChar( '\n' ) ); + } + } + + m_cppSupport->backgroundParser() ->addFile( m_klass->fileName() ); + + QString str; + QListViewItem* item = methods->firstChild(); + while ( item ) + { + QListViewItem * currentItem = item; + + item = item->nextSibling(); + + QString str = functionDefinition( currentItem ); + if ( str.isEmpty() ) + continue; + + QString implementationFile = currentItem->text( 5 ); + if ( currentItem->text( 0 ) == "True" ) + implementationFile = m_klass->fileName(); + + QFileInfo fileInfo( implementationFile ); + if ( !QFile::exists( fileInfo.absFilePath() ) ) + { + if ( KDevCreateFile * createFileSupp = m_cppSupport->extension( "KDevelop/CreateFile" ) ) + createFileSupp->createNewFile( fileInfo.extension(), fileInfo.dirPath( true ), fileInfo.baseName() ); + } + + m_cppSupport->partController() ->editDocument( KURL( implementationFile ) ); + editIface = dynamic_cast( m_cppSupport->partController() ->activePart() ); + if ( !editIface ) + continue; + + bool isInline = currentItem->text( 0 ) == "True"; + if ( !isInline ) + { + editIface->insertLine( editIface->numLines(), QString::fromLatin1( "" ) ); + editIface->insertText( editIface->numLines() - 1, 0, str ); + m_cppSupport->backgroundParser() ->addFile( implementationFile ); + } + } + + QDialog::accept(); +} + +void AddMethodDialog::updateGUI() +{ + bool enable = methods->selectedItem() != 0; + + returnType->setEnabled( enable ); + declarator->setEnabled( enable ); + access->setEnabled( enable ); + storage->setEnabled( enable ); + isInline->setEnabled( enable ); + + sourceFile->setEnabled( enable ); + browseButton->setEnabled( enable ); + + deleteMethodButton->setEnabled( enable ); + + if ( enable ) + { + QListViewItem * item = methods->selectedItem(); + item->setText( 0, isInline->isChecked() ? "True" : "False" ); + item->setText( 1, access->currentText() ); + item->setText( 2, storage->currentText() ); + item->setText( 3, returnType->currentText() ); + item->setText( 4, declarator->text() ); + item->setText( 5, sourceFile->currentText() ); + + if ( isInline->isChecked() || storage->currentText() == "Friend" || storage->currentText() == "Pure Virtual" ) + { + sourceFile->setEnabled( false ); + browseButton->setEnabled( false ); + } + } +} + +void AddMethodDialog::addMethod() +{ + QListViewItem * item = new QListViewItem( methods, "False", "Public", "Normal", + "void", QString( "method_%1()" ).arg( ++m_count ), + sourceFile->currentText() ); + methods->setCurrentItem( item ); + methods->setSelected( item, true ); + + returnType->setFocus(); +} + +void AddMethodDialog::deleteCurrentMethod() +{ + delete( methods->currentItem() ); + updateGUI(); +} + +void AddMethodDialog::currentChanged( QListViewItem* item ) +{ + if ( item ) + { + QString _isInline = item->text( 0 ); + QString _access = item->text( 1 ); + QString _storage = item->text( 2 ); + QString _returnType = item->text( 3 ); + QString _declarator = item->text( 4 ); + QString _sourceFile = item->text( 5 ); + + isInline->setChecked( _isInline == "True" ? true : false ); + access->setCurrentText( _access ); + storage->setCurrentText( _storage ); + returnType->setCurrentText( _returnType ); + declarator->setText( _declarator ); + sourceFile->setCurrentText( _sourceFile ); + } + + updateGUI(); +} + +void AddMethodDialog::browseImplementationFile() +{ + QString fileName = KFileDialog::getOpenFileName(); + sourceFile->setCurrentText( fileName ); + updateGUI(); +} + +QString AddMethodDialog::functionDeclaration( QListViewItem * item ) const +{ + QString str; + QTextStream stream( &str, IO_WriteOnly ); + + QString access = item->text( 1 ).lower(); + + stream << " "; /// @todo use AStyle + if ( item->text( 2 ) == "Virtual" || item->text( 2 ) == "Pure Virtual" ) + stream << "virtual "; + else if ( item->text( 2 ) == "Friend" ) + stream << "friend "; + else if ( item->text( 2 ) == "Static" ) + stream << "static "; + stream << item->text( 3 ) << " " << item->text( 4 ); + if ( item->text( 2 ) == "Pure Virtual" ) + stream << " = 0"; + stream << ";\n"; + + return str; +} + +QString AddMethodDialog::functionDefinition( QListViewItem* item ) const +{ + if ( item->text( 1 ) == "Signals" || item->text( 2 ) == "Pure Virtual" || + item->text( 2 ) == "Friend" ) + { + return QString::null; + } + + QString className = m_klass->name(); + QString fullName = m_klass->scope().join( "::" ); + if ( !fullName.isEmpty() ) + fullName += "::"; + fullName += className; + + QString str; + QTextStream stream( &str, IO_WriteOnly ); + + bool isInline = item->text( 0 ) == "True"; + + QString ind; + if ( isInline ) + ind.fill( QChar( ' ' ), 4 ); + + stream << "\n" + << ind << "/*!\n" + << ind << " \\fn " << fullName << "::" << item->text( 4 ) << "\n" + << ind << " */\n"; + + stream + << ind << item->text( 3 ) << " " << ( isInline ? QString::fromLatin1( "" ) : fullName + "::" ) + << item->text( 4 ) << "\n" + << ind << "{\n" + << ind << " /// @todo implement me\n" + << ind << "}\n"; + + return str; +} + +QStringList AddMethodDialog::newAccessList( const QStringList& accessList ) const +{ + QStringList newAccessList; + + QListViewItem* item = methods->firstChild(); + while ( item ) + { + QListViewItem * currentItem = item; + + item = item->nextSibling(); + + QString access = currentItem->text( 1 ); + if ( !( accessList.contains( access ) || newAccessList.contains( access ) ) ) + newAccessList.push_back( access ); + } + + return newAccessList; +} + +#include "addmethoddialog.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; + diff --git a/languages/cpp/addmethoddialog.h b/languages/cpp/addmethoddialog.h new file mode 100644 index 00000000..695ddc80 --- /dev/null +++ b/languages/cpp/addmethoddialog.h @@ -0,0 +1,62 @@ +/* +* Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.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; either +* version 2 of the License, or (at your option) any later version. +* +* 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 +* Library General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; see the file COPYING.LIB. If not, write to +* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +* Boston, MA 02111-1307, USA. +* +*/ + +#ifndef ADDMETHODDIALOG_H +#define ADDMETHODDIALOG_H + +#include "addmethoddialogbase.h" +#include + +class CppSupportPart; + +class AddMethodDialog : public AddMethodDialogBase +{ + Q_OBJECT +public: + AddMethodDialog( CppSupportPart* cppSupport, ClassDom klass, + QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~AddMethodDialog(); + + virtual void addMethod(); + virtual void deleteCurrentMethod(); + virtual void currentChanged( QListViewItem* item ); + virtual void updateGUI(); + virtual void browseImplementationFile(); + +protected: + virtual void reject(); + virtual void accept(); + +private: + QString accessID( FunctionDom fun ) const; + QString functionDeclaration( QListViewItem* item ) const; + QString functionDefinition( QListViewItem* item ) const; + QStringList newAccessList( const QStringList& accessList ) const; + +private: + CppSupportPart* m_cppSupport; + ClassDom m_klass; + int m_count; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + + diff --git a/languages/cpp/addmethoddialogbase.ui b/languages/cpp/addmethoddialogbase.ui new file mode 100644 index 00000000..5ab3f769 --- /dev/null +++ b/languages/cpp/addmethoddialogbase.ui @@ -0,0 +1,459 @@ + +AddMethodDialogBase + + + AddMethodDialogBase + + + + 0 + 0 + 613 + 568 + + + + Add Method + + + true + + + + unnamed + + + + + Inline + + + true + + + true + + + + + Access + + + true + + + true + + + + + Storage + + + true + + + true + + + + + Return Type + + + true + + + true + + + + + Declarator + + + true + + + true + + + + methods + + + true + + + LastColumn + + + + + layout3 + + + + unnamed + + + + spacer3 + + + Horizontal + + + Expanding + + + + 111 + 20 + + + + + + addMethodButton + + + &Add Method + + + + + deleteMethodButton + + + &Delete Method + + + + + + + groupBox1 + + + Method Properties + + + + unnamed + + + + layout4 + + + + unnamed + + + + textLabel1 + + + Return t&ype: + + + returnType + + + + + returnType + + + true + + + + + declarator + + + + + textLabel2 + + + D&eclarator: + + + declarator + + + + + + + layout5 + + + + unnamed + + + + storage + + + + + textLabel5 + + + S&torage: + + + storage + + + + + isInline + + + &Inline + + + + + textLabel3 + + + Acce&ss: + + + access + + + + + access + + + + + + + + + groupBox2 + + + I&mplementation File + + + + unnamed + + + + sourceFile + + + + 7 + 0 + 0 + 0 + + + + true + + + + + browseButton + + + TabFocus + + + ... + + + + + + + Layout1 + + + + unnamed + + + 0 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + + buttonOk + clicked() + AddMethodDialogBase + accept() + + + buttonCancel + clicked() + AddMethodDialogBase + reject() + + + addMethodButton + clicked() + AddMethodDialogBase + addMethod() + + + deleteMethodButton + clicked() + AddMethodDialogBase + deleteCurrentMethod() + + + methods + selectionChanged(QListViewItem*) + AddMethodDialogBase + currentChanged(QListViewItem*) + + + returnType + activated(const QString&) + AddMethodDialogBase + updateGUI() + + + declarator + textChanged(const QString&) + AddMethodDialogBase + updateGUI() + + + access + activated(const QString&) + AddMethodDialogBase + updateGUI() + + + isInline + toggled(bool) + AddMethodDialogBase + updateGUI() + + + storage + activated(const QString&) + AddMethodDialogBase + updateGUI() + + + returnType + textChanged(const QString&) + AddMethodDialogBase + updateGUI() + + + sourceFile + textChanged(const QString&) + AddMethodDialogBase + updateGUI() + + + sourceFile + activated(const QString&) + AddMethodDialogBase + updateGUI() + + + browseButton + clicked() + AddMethodDialogBase + browseImplementationFile() + + + + methods + addMethodButton + deleteMethodButton + returnType + declarator + access + storage + isInline + sourceFile + browseButton + buttonOk + buttonCancel + + + kdialog.h + + + init() + destroy() + addMethod() + deleteCurrentMethod() + currentChanged(QListViewItem*) + updateGUI() + browseImplementationFile() + + + + diff --git a/languages/cpp/app_templates/Makefile.am b/languages/cpp/app_templates/Makefile.am new file mode 100644 index 00000000..a075677f --- /dev/null +++ b/languages/cpp/app_templates/Makefile.am @@ -0,0 +1,10 @@ +SUBDIRS = kapp kpartapp kpartplugin kcmodule kicker kioslave kdevpart kdevpart2 chello cpphello kscreensaver kofficepart chello_gba dcopservice konqnavpanel qmakesimple qmakeapp qt4makeapp khello khello2 kateplugin kateplugin2 qtopiaapp kdedcop wxhello cppsdlhello kconfig35 kdevlang noatunvisual noatunui kmod kfileplugin clanlib opieapp opieapplet opieinput opiemenu opienet opietoday kxt gtk2mmapp cppcurseshello win32hello win32gui cmakesimple cmakesimplec cmakelibcpp cmakelibc kscons_kxt kscons_kmdi qt4hello qmakeempty automakeempty makefileempty qtopia4app kde4app + +profilescdir = $(kde_datadir)/kdevelop/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CIDE +profilesc_DATA = c.appwizard + +profilescppdir = $(kde_datadir)/kdevelop/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CppIDE +profilescpp_DATA = cpp.appwizard + +profileskdecppdir = $(kde_datadir)/kdevelop/profiles/IDE/CompiledLanguageIDE/CandCppIDE/CppIDE/KDECppIDE +profileskdecpp_DATA = kdecpp.appwizard diff --git a/languages/cpp/app_templates/automakeempty/Makefile.am b/languages/cpp/app_templates/automakeempty/Makefile.am new file mode 100644 index 00000000..461e4322 --- /dev/null +++ b/languages/cpp/app_templates/automakeempty/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = automakeempty-Makefile.am automakeempty-Makefile.cvs \ + configure.in automakeempty.png app.kdevelop +templateName = automakeempty + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/automakeempty/app.kdevelop b/languages/cpp/app_templates/automakeempty/app.kdevelop new file mode 100644 index 00000000..6cadd049 --- /dev/null +++ b/languages/cpp/app_templates/automakeempty/app.kdevelop @@ -0,0 +1,101 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + + + + + + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/automakeempty/automakeempty-Makefile.am b/languages/cpp/app_templates/automakeempty/automakeempty-Makefile.am new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/languages/cpp/app_templates/automakeempty/automakeempty-Makefile.am @@ -0,0 +1 @@ + diff --git a/languages/cpp/app_templates/automakeempty/automakeempty-Makefile.cvs b/languages/cpp/app_templates/automakeempty/automakeempty-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/automakeempty/automakeempty-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/automakeempty/automakeempty.kdevtemplate b/languages/cpp/app_templates/automakeempty/automakeempty.kdevtemplate new file mode 100644 index 00000000..db3cdd13 --- /dev/null +++ b/languages/cpp/app_templates/automakeempty/automakeempty.kdevtemplate @@ -0,0 +1,99 @@ +# KDE Config File +[General] +Name=Empty Autotools Template +Name[ca]=Plantilla Autotools buida +Name[da]=Tom Autotools-skabelon +Name[de]=Leere Autotools-Vorlage +Name[el]=Κενό πρότυπο των Autotools +Name[es]=Plantilla Autotools vacía +Name[et]=Tühi autotoolsi mall +Name[hu]=Üres Autotools sablon +Name[it]=Modello di autotools vuoto +Name[nds]=Leddig Vörlaag för Automake un sien Kanuten +Name[nl]=Leeg Autotools-sjabloon +Name[pl]=Pusty szablon Autotools +Name[pt]=Modelo de Autotools Vazio +Name[pt_BR]=Modelo de Autotools Vazio +Name[ru]=Пустой шаблон autotools +Name[sk]=Prázdna šablóna Autotools +Name[sr]=Празан шаблон Autotools-а +Name[sr@Latn]=Prazan šablon Autotools-a +Name[sv]=Tom mall för Autotools +Name[zh_TW]=空的 Autotools 樣板 +Icon=automakeempty.png +Category=C++/Automake project +Comment=Generate an empty Automake based application +Comment[ca]=Genera una aplicació buida basada en Automake +Comment[da]=Opretter et tomt Automake-baseret program +Comment[de]=Erstellt eine leere auf Automake basierende Anwendung +Comment[el]=Δημιουργία μίας κενής εφαρμογής βασισμένης στο Automake +Comment[es]=Genera una aplicación vacía basada en Automake +Comment[et]=Tühja rakenduse loomine Automake'i põhjal +Comment[hu]=Létrehoz egy üres Automake-alapú alkalmazást +Comment[it]=Genera un'applicazione basata su un Automake vuoto +Comment[nds]=Stellt en leddig Programm op, dat op Automake opbuut +Comment[nl]=Genereer een leeg op Automake gebaseerd programma +Comment[pl]=Generuje pusty program używający Automake +Comment[pt]=Gera uma aplicação vazia baseada no Automake +Comment[pt_BR]=Gera uma aplicação vazia baseada no Automake +Comment[ru]=Создать пустое приложение, использующее Automake +Comment[sk]=Vygeneruje prázdnu aplikáciu založenú na Automake +Comment[sr]=Прави празан програм на основу Automake-а +Comment[sr@Latn]=Pravi prazan program na osnovu Automake-a +Comment[sv]=Skapar ett tomt Automake-baserat program +Comment[zh_TW]=產生一個空的使用 Automake 的應用程式 +FileTemplates=h,CStyle,cpp,CStyle +Archive=automakeempty.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE2] +Type=install +Source=%{src}/automakeempty-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/automakeempty-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[MSG] +Type=message +Comment=An Automake based application was created in %{dest} +Comment[ca]=S'ha creat una aplicació basada en Automake en %{dest} +Comment[da]=Et Automake-baseret program blev oprettet i %{dest} +Comment[de]=Eine auf Automake basierende Anwendung wurde in %{dest} erstellt. +Comment[el]=Μία εφαρμογή βασισμένη στο Automake δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación basada en Automake ha sido creada en %{dest} +Comment[et]=Rakendus Automake'i põhjal loodi asukohta %{dest} +Comment[hu]=Létrejött egy Automake-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione basata su automake in %{dest} +Comment[nds]=In %{dest} wöör en op Automake opbuut Programm opstellt +Comment[nl]=Een Automake-gebaseerd programma is aangemaakt in %{dest} +Comment[pl]=Program używający Automake został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação baseada no Automake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação baseada no Automake em %{dest} +Comment[ru]=Использующее Automake приложение создано в %{dest} +Comment[sk]=Aplikácia založená na Automake bola vytvorená v %{dest} +Comment[sr]=Програм на основи Automake-а направљен је у %{dest} +Comment[sr@Latn]=Program na osnovi Automake-a napravljen je u %{dest} +Comment[sv]=Ett Automake-baserat program skapades i %{dest} +Comment[zh_TW]=一個以 Automake 為基礎的應用程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/automakeempty/automakeempty.png b/languages/cpp/app_templates/automakeempty/automakeempty.png new file mode 100644 index 00000000..519c007b Binary files /dev/null and b/languages/cpp/app_templates/automakeempty/automakeempty.png differ diff --git a/languages/cpp/app_templates/automakeempty/configure.in b/languages/cpp/app_templates/automakeempty/configure.in new file mode 100644 index 00000000..7464579b --- /dev/null +++ b/languages/cpp/app_templates/automakeempty/configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile) diff --git a/languages/cpp/app_templates/c.appwizard b/languages/cpp/app_templates/c.appwizard new file mode 100644 index 00000000..14009287 --- /dev/null +++ b/languages/cpp/app_templates/c.appwizard @@ -0,0 +1,2 @@ +[General] +List=chello,chellogba,cmakelibc,cmakesimplec,kmod,prc-tool diff --git a/languages/cpp/app_templates/chello/.kdev_ignore b/languages/cpp/app_templates/chello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/chello/Makefile.am b/languages/cpp/app_templates/chello/Makefile.am new file mode 100644 index 00000000..f7c9742a --- /dev/null +++ b/languages/cpp/app_templates/chello/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = main.c src-Makefile.am c-Makefile.am c-Makefile.cvs \ + configure.in chello.png app.kdevelop + +templateName = chello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} ${dataFiles} ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/chello/app.kdevelop b/languages/cpp/app_templates/chello/app.kdevelop new file mode 100644 index 00000000..521c9f89 --- /dev/null +++ b/languages/cpp/app_templates/chello/app.kdevelop @@ -0,0 +1,107 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C + + C + Code + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + true + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 %{CFLAGS} + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 %{CFLAGS} + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/chello/c-Makefile.am b/languages/cpp/app_templates/chello/c-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/chello/c-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/chello/c-Makefile.cvs b/languages/cpp/app_templates/chello/c-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/chello/c-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/chello/chello.kdevtemplate b/languages/cpp/app_templates/chello/chello.kdevtemplate new file mode 100644 index 00000000..8f2ea5dc --- /dev/null +++ b/languages/cpp/app_templates/chello/chello.kdevtemplate @@ -0,0 +1,253 @@ +# KDE Config File +[General] +Name=Simple Hello world program +Name[ca]=Simple programa Hello world +Name[da]=Simpelt Goddag verden program +Name[de]=Ein einfaches "Hello World"-Programm +Name[el]=Απλό πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» sencillo +Name[et]=Lihtne "Tere, maailm" programm +Name[eu]="Kaixo mundua" programa sinplea +Name[fa]=برنامۀ سادۀ Hello world +Name[fr]=Programme « Bonjour monde » simple +Name[ga]=Ríomhchlár simplí "Hello World" +Name[gl]=Programa sinxelo Ola mundo +Name[hu]=Egyszerű Hello world program +Name[it]=Semplice programma di "Hello world" +Name[ja]=簡単な Hello world プログラム +Name[ms]=Program Hello World mudah +Name[nds]=En eenfach "Moin Welt"-Programm +Name[ne]=साधारण हेल्लो वोल्ड कार्यक्रम +Name[nl]=Eenvoudig 'Hello World' programma +Name[pl]=Prosty program witaj świecie +Name[pt]=Programa simples Olá Mundo +Name[pt_BR]=Programa simples Olá Mundo +Name[ru]=Простая программа Hello world +Name[sk]=Jednoduchý "Ahoj svet" program +Name[sl]=Preprost program Hello world +Name[sr]=Једноставан „Здраво свете“ програм +Name[sr@Latn]=Jednostavan „Zdravo svete“ program +Name[sv]=Enkelt Hello world-program +Name[tr]=Basit Merhaba dünya programı +Name[zh_CN]=简单的 Hello world 程序 +Name[zh_TW]=簡單的 Hello world 程式 +Icon=chello.png +Category=C +Comment=Generates a simple Hello world program in C +Comment[ca]=Genera un simple programa de Hello world en C +Comment[da]=Genererer et simpelt Goddag verden program i C +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in C +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα Γεια σου Κόσμε σε C +Comment[es]=Genera un sencillo programa «Hola mundo» en C +Comment[et]=Lihtsa "Tere, maailm" programmi loomine C-s +Comment[eu]="Kaixo mundua" programa sinplea bat sortzen du C lengoaian +Comment[fa]=یک برنامۀ سادۀ Hello world در سی تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en C +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" i C +Comment[gl]=Xera un programa sinxelo Ola mundo en C +Comment[hu]=Létrehoz egy egyszerű Hello world programot C nyelven +Comment[it]=Genera un semplice programma di "Hello world" in C +Comment[ja]=簡単な Hello world プログラムを C で記述します +Comment[nds]=Stellt en eenfach "Moin Welt"-Programm in C op +Comment[ne]=सी मा साधारण हेल्लो वोल्ड कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudig Hello World programma in C +Comment[pl]=Tworzy prosty program 'Witaj świecie' w języku C +Comment[pt]=Gera um programa simples de Olá mundo em C +Comment[pt_BR]=Gera um programa simples de Olá mundo em C +Comment[ru]=Создание простого приложения Hello world на C +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v C +Comment[sl]=Ustvari preprost program Hello world v C-ju +Comment[sr]=Прави једноставан „Здраво свете“ програм у C-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u C-u +Comment[sv]=Skapar ett enkelt Hello world-program i C +Comment[tr]=C'de basit bir Merhaba Dünya programı yaratır. +Comment[zh_CN]=生成 C 语言的 Hello world 程序 +Comment[zh_TW]=產生 C 語言的 Hello world 程式 +FileTemplates=h,CStyle,c,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.c +Archive=chello.tar.gz + +[LIBS] +Type = value +ValueType=QString +Value= OPT_LIBS +Comment= Optional libraries to link to. +Comment[ca]= Biblioteques opcionals per enllaçar. +Comment[da]= Mulige biblioteker at linke til. +Comment[de]= Optionale Bibliotheken, die eingebunden werden sollen. +Comment[el]= Προαιρετικές βιβλιοθήκες για σύνδεση με αυτές. +Comment[es]=Bibliotecas opcionales para enlazar. +Comment[et]=Täiendavad lingitavad teegid. +Comment[eu]= Estekatzeko aukerako liburutegiak. +Comment[fa]= کتابخانه‌های اختیاری برای پیوند کردن. +Comment[fr]=Bibliothèques optionnelles à lier. +Comment[ga]= Comhadlanna roghnacha ar féidir nascadh leo. +Comment[gl]= Librerías opcionais a enlazar. +Comment[hu]=Linkelési programkönyvtárak (opcionális). +Comment[it]= librerie opzionali da collegare. +Comment[ja]=リンクする他のライブラリ +Comment[nds]= Optschonaal Bibliotheken, na de linkt warrn schall +Comment[ne]= लिङ्क सिर्जना गर्न वैकल्पिक लाइब्रेरी +Comment[nl]=Optionele bibliotheken om naar te linken +Comment[pl]= Opcjonalne biblioteki, z którymi ma być łączony. +Comment[pt]= Bibliotecas opcionais com as quais compilar. +Comment[pt_BR]= Bibliotecas opcionais com as quais compilar. +Comment[ru]=Дополнительные библиотеки для сборки. +Comment[sk]=Voliteľné knižnice pre linkovanie. +Comment[sl]=Dodatne knjižnice, do katerih se naj poveže. +Comment[sr]=Опционе библиотеке за повезивање. +Comment[sr@Latn]=Opcione biblioteke za povezivanje. +Comment[sv]= Valfria bibliotek att länka till. +Comment[tr]=Bağlanılacak isteğe bağlı kütüphaneler. +Comment[zh_CN]=可选的链接库。 +Comment[zh_TW]=要連結的函式庫 +Default= -lm + +[INCLUDES] +Type = value +ValueType=QString +Value= OPT_INCS +Comment= Optional include path. +Comment[ca]= Ruta opcional per a incloure. +Comment[da]= Mulig include-sti. +Comment[de]= Optionaler Include-Pfad. +Comment[el]= Προαιρετική διαδρομή ενσωμάτωσης. +Comment[es]=Ruta opcional para incluir. +Comment[et]=Täiendavate päisefailide asukoht. +Comment[eu]= Aukerako goiburuen bide-izena. +Comment[fa]=include path اختیاری. +Comment[fr]=Chemin d'inclusion optionnel. +Comment[ga]= Conair roghnach ceanntásca. +Comment[gl]= Ruta opcional de cabeceiras. +Comment[hu]=Include fájlok könyvtárai (opcionális). +Comment[it]= percorso opzionale di inclusione. +Comment[ja]=ヘッダファイルを読み込む他のパス +Comment[nds]= Optschonaal Koppdatei-Padd +Comment[ne]= मार्ग सहितको विकल्प +Comment[nl]=Optioneel Include-pad +Comment[pl]= Opcjonalna ścieżka do plików dołączanych. +Comment[pt]= Localização opcional dos ficheiros de inclusão. +Comment[pt_BR]= Localização opcional dos ficheiros de inclusão. +Comment[ru]=Дополнительные пути для заголовочных файлов. +Comment[sk]=Voliteľná cesta pre include. +Comment[sl]=Neobvezna pot za vstavke. +Comment[sr]=Опциона путања за укључивања. +Comment[sr@Latn]=Opciona putanja za uključivanja. +Comment[sv]= Valfri sökväg till deklarationsfiler. +Comment[tr]=İsteğe bağlı include yolu. +Comment[zh_CN]=可选的包含路径。 +Comment[zh_TW]=引入檔路徑 +Default= -I/usr/include + +[CFLAGS] +Type = value +ValueType=QString +Value= CFLAGS +Comment= Optional CFLAGS to define in the makefile. +Comment[ca]= CFLAGS opcionals per a definir en el fitxer de make. +Comment[da]= Mulige CFLAGS at definere i makefile. +Comment[de]= Optionale CFLAGS, die im Makefile definiert werden. +Comment[el]= Προαιρετικές CFLAGS για ορισμό μέσα στο makefile. +Comment[es]=CFLAGS opcionales a definir en el makefile. +Comment[et]=Täiendavad Makefile'is defineeritavad CFLAGS'id. +Comment[eu]= Aukerako makefile-ean definitzeko CFLAGS-ak. +Comment[fa]= CFLAGS اختیاری برای تعریف در makefile. +Comment[fr]=CFLAGS optionnels à définir dans le Makefile. +Comment[ga]= CFLAGS roghnacha le socrú sa makefile. +Comment[gl]= CFLAGS opcionais a definir no makefile. +Comment[hu]=A Makefile-hoz definiálható CFLAGS információ (opcionális). +Comment[it]= CFLAGS opzionale da definire nel makefile. +Comment[ja]=Makefile に定義する他の CFLAGS +Comment[nds]= Optschonaal CFLAGS, de in de "Make"-Datei fastleggt warrt. +Comment[ne]= मेकफाइलमा परिभाषित गर्न CFLAGS विकल्प +Comment[nl]=Optionele CFLAGS om te definiëren in het makefile. +Comment[pl]= Opcjonalna wartość zmiennej CFLAGS do zdefiniowania w pliku makefile. +Comment[pt]= CFLAGS opcionais a definir na Makefile. +Comment[pt_BR]= CFLAGS opcionais a definir na Makefile. +Comment[ru]=Дополнительные параметры CFLAGS для Makefile. +Comment[sk]=Voliteľné nastavenie CFLAGS v makefile. +Comment[sl]=Dodaten CFLAGS za definicijo v datoteki makefile. +Comment[sr]=Опциона CFLAGS дефинисана у справифајлу. +Comment[sr@Latn]=Opciona CFLAGS definisana u spravifajlu. +Comment[sv]= Valfria CFLAGS att definiera i byggfilen. +Comment[tr]=Makefile'da tanımlanacak isteğe bağlı CFLAGS değerleri +Comment[zh_CN]=在 Makefile 中定义的可选 CFLAGS。 +Comment[zh_TW]=makefile 中定義的 CFLAGS +Default= + +[MGS] +Type=message +Comment=A simple C project was created in %{dest}. +Comment[ca]=A simple projecte en C ha estat creat en %{dest}. +Comment[da]=Et simpelt C projekt blev oprette i %{dest}. +Comment[de]=Ein einfaches C-Project wurde in %{dest} erstellt. +Comment[el]=Ένα απλό έργο C δημιουργήθηκε στο %{dest}. +Comment[es]=Un sencillo proyecto de C ha sido creado en %{dest}. +Comment[et]=Lihtne C-projekt loodi asukohta %{dest}. +Comment[eu]=C proiektu sinple bat sortu da hemen: %{dest}. +Comment[fa]=یک پروژۀ سادۀ سی در %{dest} ایجاد شد. +Comment[fr]=Un projet en langage C simple a été créé dans %{dest}. +Comment[ga]=Cruthaíodh tionscadal simplí C i %{dest} +Comment[gl]=Creouse un proxecto sinxelo en C en %{dest}. +Comment[hu]=Létrejött egy egyszerű C-projekt itt: %{dest}. +Comment[it]=È stato creato un semplice progetto C in %{dest}. +Comment[ja]=簡単な C プロジェクトを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach C-Projekt opstellt. +Comment[ne]=एउटा साधारण सी परियोजना %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudig C-project is aangemaakt in %{dest}. +Comment[pl]=Prosty projekt w języku C został utworzony w %{dest}. +Comment[pt]=Foi criado um programa simples "Olá mundo" em C em %{dest}. +Comment[pt_BR]=Foi criado um programa simples "Olá mundo" em C em %{dest}. +Comment[ru]=Простое приложение "Hello world" на C создано в %{dest} +Comment[sk]=Jednoduchý C projekt bol vytvorený v %{dest}. +Comment[sl]=Preprost projekt v C-ju je bil ustvarjen v %{dest}. +Comment[sr]=Једноставан пројекат у C-у направљен је у %{dest}. +Comment[sr@Latn]=Jednostavan projekat u C-u napravljen je u %{dest}. +Comment[sv]=Ett enkelt C-projekt skapades i %{dest}. +Comment[tr]=Basit bir C projesi %{dest} içinde oluşturuldu. +Comment[zh_CN]=在 %{dest} 中创建了简单的 C 工程。 +Comment[zh_TW]=一個簡單的 C 專案已建立在 %{dest}。 +Archive=chello.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/c-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/c-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE6] +Type=install +Source=%{src}/main.c +Dest=%{dest}/src/%{APPNAMELC}.c + diff --git a/languages/cpp/app_templates/chello/chello.png b/languages/cpp/app_templates/chello/chello.png new file mode 100644 index 00000000..888d4f13 Binary files /dev/null and b/languages/cpp/app_templates/chello/chello.png differ diff --git a/languages/cpp/app_templates/chello/configure.in b/languages/cpp/app_templates/chello/configure.in new file mode 100644 index 00000000..3715e0c8 --- /dev/null +++ b/languages/cpp/app_templates/chello/configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_C +AC_PROG_CC +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/chello/main.c b/languages/cpp/app_templates/chello/main.c new file mode 100644 index 00000000..3ac8c330 --- /dev/null +++ b/languages/cpp/app_templates/chello/main.c @@ -0,0 +1,15 @@ +%{C_TEMPLATE} + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/chello/src-Makefile.am b/languages/cpp/app_templates/chello/src-Makefile.am new file mode 100644 index 00000000..51e7609f --- /dev/null +++ b/languages/cpp/app_templates/chello/src-Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.c + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) diff --git a/languages/cpp/app_templates/chello_gba/.kdev_ignore b/languages/cpp/app_templates/chello_gba/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/chello_gba/Makefile.am b/languages/cpp/app_templates/chello_gba/Makefile.am new file mode 100644 index 00000000..2a72573e --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = main.c font.raw.c master.pal.c src-Makefile.am c-Makefile.am \ + c-Makefile.cvs configure.in chellogba.png app.kdevelop \ + main.h gba.h font.bmp README.devel +templateName = chellogba + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/chello_gba/README.devel b/languages/cpp/app_templates/chello_gba/README.devel new file mode 100644 index 00000000..a7cdcc75 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/README.devel @@ -0,0 +1,30 @@ +***Description*** + +This is a small demo program for the Gameboy Advance. +It use a custom font to display strings in MODE 0 on Background 2, but contains only capitalized letters at the moment. +The tiles & color palette for the font were generated from the bitmap "font.bmp" +with following commandline. + +"gfx2gba -M -t8 -fsrc font.bmp" + +You can get a compiled version for Linux from http://gbadev.org/files/gfx2gba06.zip, +but you don't need it to run the program. + + +***Compiling and Running*** + +To compile the code please install the DevKitAdvance for Linux/Unix. It contains a gcc 3.x configured as a cross compiler +for the GBA platform. You can download a precompiled version from http://www.doc.ic.ac.uk/~tb100/ + +To build the program KDevelop use +"CC=arm-agb-elf-gcc CXX=arm-agb-elf-g++ ./configure --host=arm-gcc-elf --build=i386" +as default,but you can change that in the project options if you want. + +To start your binary you can use an emulator or buy a flash card (http://www.lik-sang.com). +KDevelop already contains a plugin to run your GBA program with the VisualBoy Advance emulator. +You can download the emulator from: http://vboy.emuhq.com/ + +Have fun! + +Please report bugs,wishes,problems.. to smeier@kdevelop.org (Sandy Meier) + diff --git a/languages/cpp/app_templates/chello_gba/app.kdevelop b/languages/cpp/app_templates/chello_gba/app.kdevelop new file mode 100644 index 00000000..0025fd02 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/app.kdevelop @@ -0,0 +1,100 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C + + C + GBA + + + KDevDebugger + + + + + src/%{APPNAMELC} + + + true + + + + --host=arm-gcc-elf --build=i386 + -T lnkscript crt0.o + kdevgccoptions + kdevgppoptions + kdevg77options + arm-agb-elf-gcc + arm-agb-elf-g++ + -nostartfiles + + + + + src/%{APPNAMELC}.gba + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/chello_gba/c-Makefile.am b/languages/cpp/app_templates/chello_gba/c-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/c-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/chello_gba/c-Makefile.cvs b/languages/cpp/app_templates/chello_gba/c-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/c-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/chello_gba/chellogba.kdevtemplate b/languages/cpp/app_templates/chello_gba/chellogba.kdevtemplate new file mode 100644 index 00000000..7a3ba857 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/chellogba.kdevtemplate @@ -0,0 +1,173 @@ +# KDE Config File +[General] +Name=Hello world program +Name[ca]=Programa Hello world +Name[da]=Goddag verden program +Name[de]="Hello World"-Programm +Name[el]=Πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» +Name[et]="Tere,maailm" programm +Name[eu]="Kaixo mundua" programa +Name[fa]=برنامۀ Hello world +Name[fr]=Programme « Bonjour monde » +Name[ga]=Ríomhchlár "Hello world" +Name[gl]=Programa Ola mundo +Name[it]=Programma di "Hello world" +Name[ja]=Hello world プログラム +Name[nds]="Moin Welt"-Programm +Name[ne]=हेल्डो वोल्ड कार्यक्रम +Name[nl]=Hello World-programma +Name[pl]=Program 'Witaj świecie' +Name[pt]=Programa 'Olá mundo' +Name[pt_BR]=Programa 'Olá mundo' +Name[ru]=Программа Hello world +Name[sk]=Ahoj svet program +Name[sl]=Program Hello world +Name[sr]=Програм „Здраво свете“ +Name[sr@Latn]=Program „Zdravo svete“ +Name[sv]=Hello world-program +Name[tr]=Merhaba Dünya Programı +Name[zh_CN]=Hello world 程序 +Name[zh_TW]=Hello world 程式 +Icon=chellogba.png +Category=C/GBA +Comment=Generates a simple "Hello world" program for the Gameboy Advance. You will need the "devkitadvance" to compile it. See README.devel for more details. +Comment[ca]=Genera un simple programa de "Hello world" per a la Gameboy Advance. Necessitareu "devkitadvance" per a compilar-lo. Consulteu el README.devel per a més detalls. +Comment[da]=Genererer et simpelt "Goddag verden" program for Gameboy Advance. Du vil skulle bruge "devkitadvance" for at kompilere det. Se README.devel for flere detaljer. +Comment[de]=Erstellt ein einfaches "Hello world"-Programm für den Gameboy Advance. Sie benötigen zum Kompilieren das "devkitadvance". Weitere Einzelheiten finden Sie in der Datei README.devel. +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα "Γεια σου κόσμε" για το Gameboy Advance. Θα χρειαστείτε το "devkitadvance" για τη μεταγλώττισή του. Ανατρέξτε στο README.devel για περισσότερες πληροφορίες. +Comment[es]=Genera un sencillo programa «Hola mundo» para Gameboy Advance. Necesitará «devkitadvance» para compilarlo. Vea README.devel para más detalles. +Comment[et]=Lihtsa "Tere, maailm" programmi loomine Gameboy Advance'i jaoks. Kompileerimiseks on vajalik "devkitadvance". Täpsemalt räägib sellest fail README.devel. +Comment[eu]="Kaixo mundua" programa sinple bat sortzen du Gameboy Advance-erako. "devkitadvance" behar duzu konpilatzeko. Ikusi README.devel xehetasun gehiagorako. +Comment[fa]=یک برنامۀ سادۀ «Hello world» برای Gameboy Advance تولید می‌کند. برای ترجمۀ آن به »devkitadvance« نیاز دارید. برای جزئیات بیشتر، README.devel را ببینید. +Comment[fr]=Génère un programme « Bonjour monde » simple pour la Gameboy Advance. Vous aurez besoin de « devkitadvance » pour le compiler. Consultez le fichier README.devel pour plus de détails. +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" le haghaidh an Gameboy Advance. Tá gá le "devkitadvance" chun é a thiomsú. Féach ar README.devel chun tuilleadh sonraí a fháil. +Comment[gl]=Xera un programa sinxelo "Ola mundo" para Gameboy Advance. Necesitará "devkitadvance" para compilalo. Consulte README.devel para máis detalles. +Comment[hu]=Létrehoz egy egyszerű Hello world programot a Gameboy Advance-hoz. Lefordításához szükség van a "devkitadvance" csomag telepítésére. További információ a README.devel fájlban található. +Comment[it]=Genera un semplice programma di "Hello world" per il Gameboy Advance. Serve il "devkitadvance" per compilarlo. Guarda un po' README.devel per ulteriori dettagli. +Comment[ja]=Gameboy Advance のための Hello world プログラムを作成します。コンパイルするには devkitadvance が必要です。詳しくは README.devel をご覧ください。 +Comment[nds]=Stellt en eenfach "Moin Welt"-Programm för "Gameboy Advance" op. För't Kompileren deit "devkitadvance" noot. Mehr Enkelheiten laat sik binnen "README.devel" finnen. +Comment[ne]=गेमब्याए एडभान्सका लागि साधारण "हेल्लो वोल्ड नमस्कार" उत्पन्न गर्दछ । यसलाई कम्पाइल गर्न तपाईँलाई "devkitadvance" आवश्यक पर्दछ । बढी जानकारीका लागि README.devel हेर्नुहोस् । +Comment[nl]=Genereert een eenvoudig "Hello World" programma voor de Gameboy Advance. U hebt "devkitadvance" nodig om het te kunnen compileren. Zie het bestand README.devel voor meer informatie. +Comment[pl]=Generuje prosty program "Witaj świecie" na konsolę Gameboy Advance. Do skompilowania go potrzebny jest "devkitadvance". Więcej informacji można znaleźć w pliku README.devel. +Comment[pt]=Gera um programa simples "Olá mundo" para o Gameboy Advance. Irá necessitar do "devkitadvance" para o compilar. Veja o README.devel para mais detalhes. +Comment[pt_BR]=Gera um programa simples "Olá mundo" para o Gameboy Advance. Irá necessitar do "devkitadvance" para o compilar. Veja o README.devel para mais detalhes. +Comment[ru]=Создание простой программы "Hello world" на Gameboy Advance. Вам необходима программа "devkitadvance" для её сборки. Прочтите файл README.devel. +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program pre Gameboy Advance.Budete potrebovať "devkitadvance" na to, aby ste ho skompilovali.Pozrite súbor README.devel pre viac detailov. +Comment[sl]=Ustvari preprost program »Pozdravljen svet« za Gameboy Advance. Za prevajanje boste potrebovali »devkitadvance«. Podrobnosti si lahko ogledate v README.devel. +Comment[sr]=Прави једноставан „Здраво свете“ програм за Gameboy Advance. Требаће вам „devkitadvance“ да бисте га превели. Погледајте README.devel за више детаља. +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program za Gameboy Advance. Trebaće vam „devkitadvance“ da biste ga preveli. Pogledajte README.devel za više detalja. +Comment[sv]=Skapar ett enkelt "Hello world"-program för Gameboy Advance. Du behöver "devkitadvance" för att kompilera det. Se filen README.devel för mer information. +Comment[tr]=Gameboy Advance için basit bir "Merhaba Dünya" programı üretir. Derlemek için "devkitadvance" paketine ihtiyacınız olacak. Daha fazla bilgi için README.devel dosyasına bakın. +Comment[zh_CN]=生成 Gameboy Advance 下的“Hello world”程序。您需要“devkitadvane”才能编译。请查看 README.devel 中的细节。 +Comment[zh_TW]=產生一個簡單的 Gameboy Advance 的 Hello world 程式。您需要 "devkitadvance" 來編譯。詳情請參考 README.devel。 +ShowFileAfterGeneration=README.devel +FileTemplates=h,CStyle,c,CStyle +ShowFilesAfterGeneration=%{dest}/src/main.c +Archive=chellogba.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/README.devel +Dest=%{dest}/README.devel + +[FILE3] +Type=install +Source=%{src}/c-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE4] +Type=install +Source=%{src}/c-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE5] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE7] +Type=install +Source=%{src}/main.c +Dest=%{dest}/src/main.c + +[FILE8] +Type=install +Source=%{src}/main.h +Dest=%{dest}/src/main.h + +[FILE9] +Type=install +Source=%{src}/gba.h +Dest=%{dest}/src/gba.h + +[FILE10] +Type=install +Source=%{src}/font.bmp +Dest=%{dest}/src/font.bmp + +[FILE11] +Type=install +Source=%{src}/font.raw.c +Dest=%{dest}/src/font.raw.c + +[FILE12] +Type=install +Source=%{src}/master.pal.c +Dest=%{dest}/src/master.pal.c + +[MSG] +Type=message +Comment=A Hello World program was created in %{dest} +Comment[ca]=A programa de Hello World ha estat creat en %{dest} +Comment[da]=Et Goddag verden program blev oprettet i %{dest} +Comment[de]=Ein "Hello World"-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα πρόγραμμα Γεια σου Κόσμε δημιουργήθηκε στο %{dest} +Comment[es]=Un programa «Hola mundo» ha sido creado en %{dest} +Comment[et]="Tere, maailm" programm loodi asukohta %{dest} +Comment[eu]="Kaixo mundua" programa bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ Hello World در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár "Hello World" i %{dest} +Comment[gl]=Creouse un programa Ola mundo en %{dest} +Comment[hu]=Létrejött egy Hello World program itt: %{dest} +Comment[it]=È stato creato un programma di "Hello World" in %{dest} +Comment[ja]=Hello World プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en "Moin Welt"-Programm opstellt +Comment[ne]=एउटा हेल्लो वोल्ड कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een Hello World-programma is aangemaakt in %{dest} +Comment[pl]=Program 'Witaj świecie' utworzony w %{dest}. +Comment[pt]=Foi criado um programa Olá Mundo em %{dest} +Comment[pt_BR]=Foi criado um programa Olá Mundo em %{dest} +Comment[ru]=Простое приложение Hello World создано в %{dest} +Comment[sk]=Ahoj svet program bol vytvorený v %{dest} +Comment[sl]=Program »Pozdravljen svet« je bil ustvarjen v %{dest} +Comment[sr]=„Здраво свете“ је направљен у %{dest} +Comment[sr@Latn]=„Zdravo svete“ je napravljen u %{dest} +Comment[sv]=Ett Hello World-program skapades i %{dest} +Comment[tr]=Bir Merhaba Dünya programı %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 Hello world 程序 +Comment[zh_TW]=一個 Hello World 程式已經建立在 %{dest} diff --git a/languages/cpp/app_templates/chello_gba/chellogba.png b/languages/cpp/app_templates/chello_gba/chellogba.png new file mode 100644 index 00000000..81bba90a Binary files /dev/null and b/languages/cpp/app_templates/chello_gba/chellogba.png differ diff --git a/languages/cpp/app_templates/chello_gba/configure.in b/languages/cpp/app_templates/chello_gba/configure.in new file mode 100644 index 00000000..3715e0c8 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_C +AC_PROG_CC +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/chello_gba/font.bmp b/languages/cpp/app_templates/chello_gba/font.bmp new file mode 100644 index 00000000..28b8c669 Binary files /dev/null and b/languages/cpp/app_templates/chello_gba/font.bmp differ diff --git a/languages/cpp/app_templates/chello_gba/font.raw.c b/languages/cpp/app_templates/chello_gba/font.raw.c new file mode 100644 index 00000000..8efbf1dd --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/font.raw.c @@ -0,0 +1,123 @@ +const unsigned char font_Tiles[1920]={ +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, +0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, +0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, +0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, +0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/languages/cpp/app_templates/chello_gba/gba.h b/languages/cpp/app_templates/chello_gba/gba.h new file mode 100644 index 00000000..9e57c8f8 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/gba.h @@ -0,0 +1,204 @@ +%{H_TEMPLATE} +// gba.h by eloist + +#ifndef GBA_HEADER +#define GBA_HEADER + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; + +typedef signed char s8; +typedef signed short s16; +typedef signed long s32; + +typedef unsigned char byte; +typedef unsigned short hword; +typedef unsigned long word; + +#define OAMmem (u32*)0x7000000 +#define VideoBuffer (u16*)0x6000000 +#define OAMdata (u16*)0x6100000 +#define BGPaletteMem (u16*)0x5000000 +#define OBJPaletteMem (u16*)0x5000200 + +#define REG_INTERUPT *(u32*)0x3007FFC +#define REG_DISPCNT *(u32*)0x4000000 +#define REG_DISPCNT_L *(u16*)0x4000000 +#define REG_DISPCNT_H *(u16*)0x4000002 +#define REG_DISPSTAT *(u16*)0x4000004 +#define REG_VCOUNT *(u16*)0x4000006 +#define REG_BG0CNT *(u16*)0x4000008 +#define REG_BG1CNT *(u16*)0x400000A +#define REG_BG2CNT *(u16*)0x400000C +#define REG_BG3CNT *(u16*)0x400000E +#define REG_BG0HOFS *(u16*)0x4000010 +#define REG_BG0VOFS *(u16*)0x4000012 +#define REG_BG1HOFS *(u16*)0x4000014 +#define REG_BG1VOFS *(u16*)0x4000016 +#define REG_BG2HOFS *(u16*)0x4000018 +#define REG_BG2VOFS *(u16*)0x400001A +#define REG_BG3HOFS *(u16*)0x400001C +#define REG_BG3VOFS *(u16*)0x400001E +#define REG_BG2PA *(u16*)0x4000020 +#define REG_BG2PB *(u16*)0x4000022 +#define REG_BG2PC *(u16*)0x4000024 +#define REG_BG2PD *(u16*)0x4000026 +#define REG_BG2X *(u32*)0x4000028 +#define REG_BG2X_L *(u16*)0x4000028 +#define REG_BG2X_H *(u16*)0x400002A +#define REG_BG2Y *(u32*)0x400002C +#define REG_BG2Y_L *(u16*)0x400002C +#define REG_BG2Y_H *(u16*)0x400002E +#define REG_BG3PA *(u16*)0x4000030 +#define REG_BG3PB *(u16*)0x4000032 +#define REG_BG3PC *(u16*)0x4000034 +#define REG_BG3PD *(u16*)0x4000036 +#define REG_BG3X *(u32*)0x4000038 +#define REG_BG3X_L *(u16*)0x4000038 +#define REG_BG3X_H *(u16*)0x400003A +#define REG_BG3Y *(u32*)0x400003C +#define REG_BG3Y_L *(u16*)0x400003C +#define REG_BG3Y_H *(u16*)0x400003E +#define REG_WIN0H *(u16*)0x4000040 +#define REG_WIN1H *(u16*)0x4000042 +#define REG_WIN0V *(u16*)0x4000044 +#define REG_WIN1V *(u16*)0x4000046 +#define REG_WININ *(u16*)0x4000048 +#define REG_WINOUT *(u16*)0x400004A +#define REG_MOSAIC *(u32*)0x400004C +#define REG_MOSAIC_L *(u32*)0x400004C +#define REG_MOSAIC_H *(u32*)0x400004E +#define REG_BLDMOD *(u16*)0x4000050 +#define REG_COLEV *(u16*)0x4000052 +#define REG_COLEY *(u16*)0x4000054 +#define REG_SG10 *(u32*)0x4000060 +#define REG_SG10_L *(u16*)0x4000060 +#define REG_SG10_H *(u16*)0x4000062 +#define REG_SG11 *(u16*)0x4000064 +#define REG_SG20 *(u16*)0x4000068 +#define REG_SG21 *(u16*)0x400006C +#define REG_SG30 *(u32*)0x4000070 +#define REG_SG30_L *(u16*)0x4000070 +#define REG_SG30_H *(u16*)0x4000072 +#define REG_SG31 *(u16*)0x4000074 +#define REG_SG40 *(u16*)0x4000078 +#define REG_SG41 *(u16*)0x400007C +#define REG_SGCNT0 *(u32*)0x4000080 +#define REG_SGCNT0_L *(u16*)0x4000080 +#define REG_SGCNT0_H *(u16*)0x4000082 +#define REG_SGCNT1 *(u16*)0x4000084 +#define REG_SGBIAS *(u16*)0x4000088 +#define REG_SGWR0 *(u32*)0x4000090 +#define REG_SGWR0_L *(u16*)0x4000090 +#define REG_SGWR0_H *(u16*)0x4000092 +#define REG_SGWR1 *(u32*)0x4000094 +#define REG_SGWR1_L *(u16*)0x4000094 +#define REG_SGWR1_H *(u16*)0x4000096 +#define REG_SGWR2 *(u32*)0x4000098 +#define REG_SGWR2_L *(u16*)0x4000098 +#define REG_SGWR2_H *(u16*)0x400009A +#define REG_SGWR3 *(u32*)0x400009C +#define REG_SGWR3_L *(u16*)0x400009C +#define REG_SGWR3_H *(u16*)0x400009E +#define REG_SGFIF0A *(u32*)0x40000A0 +#define REG_SGFIFOA_L *(u16*)0x40000A0 +#define REG_SGFIFOA_H *(u16*)0x40000A2 +#define REG_SGFIFOB *(u32*)0x40000A4 +#define REG_SGFIFOB_L *(u16*)0x40000A4 +#define REG_SGFIFOB_H *(u16*)0x40000A6 +#define REG_DM0SAD *(u32*)0x40000B0 +#define REG_DM0SAD_L *(u16*)0x40000B0 +#define REG_DM0SAD_H *(u16*)0x40000B2 +#define REG_DM0DAD *(u32*)0x40000B4 +#define REG_DM0DAD_L *(u16*)0x40000B4 +#define REG_DM0DAD_H *(u16*)0x40000B6 +#define REG_DM0CNT *(u32*)0x40000B8 +#define REG_DM0CNT_L *(u16*)0x40000B8 +#define REG_DM0CNT_H *(u16*)0x40000BA +#define REG_DM1SAD *(u32*)0x40000BC +#define REG_DM1SAD_L *(u16*)0x40000BC +#define REG_DM1SAD_H *(u16*)0x40000BE +#define REG_DM1DAD *(u32*)0x40000C0 +#define REG_DM1DAD_L *(u16*)0x40000C0 +#define REG_DM1DAD_H *(u16*)0x40000C2 +#define REG_DM1CNT *(u32*)0x40000C4 +#define REG_DM1CNT_L *(u16*)0x40000C4 +#define REG_DM1CNT_H *(u16*)0x40000C6 +#define REG_DM2SAD *(u32*)0x40000C8 +#define REG_DM2SAD_L *(u16*)0x40000C8 +#define REG_DM2SAD_H *(u16*)0x40000CA +#define REG_DM2DAD *(u32*)0x40000CC +#define REG_DM2DAD_L *(u16*)0x40000CC +#define REG_DM2DAD_H *(u16*)0x40000CE +#define REG_DM2CNT *(u32*)0x40000D0 +#define REG_DM2CNT_L *(u16*)0x40000D0 +#define REG_DM2CNT_H *(u16*)0x40000D2 +#define REG_DM3SAD *(u32*)0x40000D4 +#define REG_DM3SAD_L *(u16*)0x40000D4 +#define REG_DM3SAD_H *(u16*)0x40000D6 +#define REG_DM3DAD *(u32*)0x40000D8 +#define REG_DM3DAD_L *(u16*)0x40000D8 +#define REG_DM3DAD_H *(u16*)0x40000DA +#define REG_DM3CNT *(u32*)0x40000DC +#define REG_DM3CNT_L *(u16*)0x40000DC +#define REG_DM3CNT_H *(u16*)0x40000DE +#define REG_TM0D *(u16*)0x4000100 +#define REG_TM0CNT *(u16*)0x4000102 +#define REG_TM1D *(u16*)0x4000104 +#define REG_TM1CNT *(u16*)0x4000106 +#define REG_TM2D *(u16*)0x4000108 +#define REG_TM2CNT *(u16*)0x400010A +#define REG_TM3D *(u16*)0x400010C +#define REG_TM3CNT *(u16*)0x400010E +#define REG_SCD0 *(u16*)0x4000120 +#define REG_SCD1 *(u16*)0x4000122 +#define REG_SCD2 *(u16*)0x4000124 +#define REG_SCD3 *(u16*)0x4000126 +#define REG_SCCNT *(u32*)0x4000128 +#define REG_SCCNT_L *(u16*)0x4000128 +#define REG_SCCNT_H *(u16*)0x400012A +#define REG_P1 *(u16*)0x4000130 +#define REG_P1CNT *(u16*)0x4000132 +#define REG_R *(u16*)0x4000134 +#define REG_HS_CTRL *(u16*)0x4000140 +#define REG_JOYRE *(u32*)0x4000150 +#define REG_JOYRE_L *(u16*)0x4000150 +#define REG_JOYRE_H *(u16*)0x4000152 +#define REG_JOYTR *(u32*)0x4000154 +#define REG_JOYTR_L *(u16*)0x4000154 +#define REG_JOYTR_H *(u16*)0x4000156 +#define REG_JSTAT *(u32*)0x4000158 +#define REG_JSTAT_L *(u16*)0x4000158 +#define REG_JSTAT_H *(u16*)0x400015A +#define REG_IE *(u16*)0x4000200 +#define REG_IF *(u16*)0x4000202 +#define REG_WSCNT *(u16*)0x4000204 +#define REG_IME *(u16*)0x4000208 +#define REG_PAUSE *(u16*)0x4000300 + +///REG_DISPCNT Defines//// +#define BG0_ENABLE 0x100 //these are just the flags for enabling backgrounds and sprites +#define BG1_ENABLE 0x200 +#define BG2_ENABLE 0x400 +#define BG3_ENABLE 0x800 +#define OBJ_ENABLE 0x1000 +#define WIN0_ENABLE 0x2000 +#define WIN1_ENABLE 0x4000 +#define WINOBJ_ENABLE 0x8000 + + +#define OBJ_MAP_LINEAR 0x40 //I'll talk about this when i talk about hardware sprites +#define OBJ_MAP_2D 0x0 +#define BACK_BUFFER 0x10 //this is the flag that controlls wich buffer is being rendered + + +#define MODE0 0x0 //these are the modes +#define MODE1 0x1 +#define MODE2 0x2 +#define MODE3 0x3 +#define MODE4 0x4 +#define MODE5 0x5 + +#endif + diff --git a/languages/cpp/app_templates/chello_gba/main.c b/languages/cpp/app_templates/chello_gba/main.c new file mode 100644 index 00000000..354b4fd8 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/main.c @@ -0,0 +1,50 @@ +%{CPP_TEMPLATE} + +#include "main.h" + +int main(){ + initTextMode(); + print("HELLO WORLD",9,9); + while(1){} //loop forever + +} + + +void print(char* text,u16 x,u16 y){ + u16 i=0; + u16* ScreenBase = (u16*)0x6004000; + ScreenBase = ScreenBase + x + y*32; + while ( *text != '\0' ){ + + *ScreenBase++ = (u16)*text-'A'+1; + i++; + text++; + } +} + +void initTextMode(){ + REG_DISPCNT = (MODE0 | BG2_ENABLE); //this sets the screen mode to mode 0 and enables background 2 + + // 256 colors and charscreenbase 0, screenbase 8 + // default size is 256x256 pixel + REG_BG2CNT = (1 << 7 | 0 << 2 | 8 << 8); + + + u16* palDest=(u16*)BGPaletteMem; //0x5000000 + u16* palSource = (u16*)Master_Palette; + // copy the palette info (256 colors a 15/16 Bit) into the desired address + u16 i=0; + for (;i<256;i++) { + *palDest++ = *palSource++; + } + + // copy the tiles to charbase 0, (0x6000000 start of the videobuffer) + u16* fontDest = (u16*)VideoBuffer; //this is the start of video memory + u16* fontSource = (u16*)font_Tiles; + i=0; + for(;i<1920;i=i+2){ + *fontDest++ = *fontSource++; + } +} + + diff --git a/languages/cpp/app_templates/chello_gba/main.h b/languages/cpp/app_templates/chello_gba/main.h new file mode 100644 index 00000000..c84f48bb --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/main.h @@ -0,0 +1,12 @@ +%{H_TEMPLATE} + +// gba.h has all the register definitions +#include "gba.h" + +extern u16 font_Tiles[]; // the letters as 8x8 tiles +extern u16 Master_Palette[]; // the color palette + +void print(char* text,u16 x,u16 y); +void initTextMode(); + + diff --git a/languages/cpp/app_templates/chello_gba/master.pal.c b/languages/cpp/app_templates/chello_gba/master.pal.c new file mode 100644 index 00000000..a24fde37 --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/master.pal.c @@ -0,0 +1,35 @@ +const unsigned short Master_Palette[256]={ +0x0000, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/languages/cpp/app_templates/chello_gba/src-Makefile.am b/languages/cpp/app_templates/chello_gba/src-Makefile.am new file mode 100644 index 00000000..a41e883a --- /dev/null +++ b/languages/cpp/app_templates/chello_gba/src-Makefile.am @@ -0,0 +1,13 @@ +all: %{APPNAMELC}.gba + +%{APPNAMELC}.gba: %{APPNAMELC} + arm-agb-elf-objcopy -O binary %{APPNAMELC} %{APPNAMELC}.gba + +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = main.h main.c font.raw.c master.pal.c + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) diff --git a/languages/cpp/app_templates/clanlib/.kdev_ignore b/languages/cpp/app_templates/clanlib/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/clanlib/Makefile.am b/languages/cpp/app_templates/clanlib/Makefile.am new file mode 100644 index 00000000..f4a650af --- /dev/null +++ b/languages/cpp/app_templates/clanlib/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = src-Makefile.am app-Makefile.am main.cpp app.kdevelop \ + app-configure.in app-autogen.sh +templateName = clanlib + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz $(templateName).png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/clanlib/app-Makefile.am b/languages/cpp/app_templates/clanlib/app-Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/app-Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/languages/cpp/app_templates/clanlib/app-autogen.sh b/languages/cpp/app_templates/clanlib/app-autogen.sh new file mode 100644 index 00000000..2b285d79 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/app-autogen.sh @@ -0,0 +1,2 @@ +#!/bin/bash +aclocal && autoconf && automake --add-missing --copy diff --git a/languages/cpp/app_templates/clanlib/app-configure.in b/languages/cpp/app_templates/clanlib/app-configure.in new file mode 100644 index 00000000..c1518570 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/app-configure.in @@ -0,0 +1,22 @@ +AC_INIT() +AM_INIT_AUTOMAKE(%{APPNAMELC},%{VERSION}) + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MAKE_SET + + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +AC_CHECK_HEADER([ClanLib/application.h], [], + AC_MSG_ERROR([Couldn't find Clanlib headers.])) + +AC_CHECK_LIB(clanApp, main, , AC_ERROR([Couldn't find Clanlib libraries]), -lclanCore -lclanSignals -ldl) + +AC_LANG_RESTORE + + +AC_OUTPUT(Makefile src/Makefile) + diff --git a/languages/cpp/app_templates/clanlib/app.kdevelop b/languages/cpp/app_templates/clanlib/app.kdevelop new file mode 100644 index 00000000..c0d5c286 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/app.kdevelop @@ -0,0 +1,106 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + ClanLib + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + true + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/clanlib/clanlib.kdevtemplate b/languages/cpp/app_templates/clanlib/clanlib.kdevtemplate new file mode 100644 index 00000000..1e7b2677 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/clanlib.kdevtemplate @@ -0,0 +1,138 @@ +# KDE Config File +[General] +Name=Simple ClanLib application +Name[ca]=Una simple aplicació de ClanLib +Name[da]=Simpelt ClanLib program +Name[de]=Eine einfache ClanLib-Anwendung +Name[el]=Μια απλή εφαρμογή ClanLib +Name[es]=Una sencilla aplicación de ClanLib +Name[et]=Lihtne ClanLib rakendus +Name[eu]=ClanLib aplikazio simple bat +Name[fa]=کاربرد سادۀ ClanLib +Name[fr]=Application ClanLib simple +Name[ga]=Feidhmchlár simplí ClanLib +Name[gl]=Aplicación sinxela ClanLib +Name[hu]=Egyszerű Clanlib-alkalmazás +Name[it]=semplice applicazione ClanLib +Name[ja]=簡単な ClanLib アプリケーション +Name[nds]=En eenfach ClanLib-Programm +Name[ne]=साधारण ClanLib अनुप्रयोग +Name[nl]=Eenvoudige ClanLib-toepassing +Name[pl]=Prosty program używający ClanLib +Name[pt]=Aplicação simples da ClanLib +Name[pt_BR]=Aplicação simples da ClanLib +Name[ru]=Простое приложение ClanLib +Name[sk]=Jednoduchá ClanLib aplikácia +Name[sl]=Preprost program ClanLib +Name[sr]=Једноставан ClanLib програм +Name[sr@Latn]=Jednostavan ClanLib program +Name[sv]=Enkelt ClanLib-program +Name[tr]=Basit ClanLib uygulaması +Name[zh_CN]=简单的 ClanLib 应用程序 +Name[zh_TW]=簡單的 ClanLib 應用程式 +Category=C++ +Icon=clanlib.png +Comment=Generates a simple ClanLib application. +Comment[ca]=Genera una simple aplicació de ClanLib. +Comment[da]=Genererer et simpelt ClanLib program +Comment[de]=Erstellt eine einfache ClanLib-Anwendung. +Comment[el]=Δημιουργεί μια απλή εφαρμογή ClanLib. +Comment[es]=Genera una sencilla aplicación de ClanLib. +Comment[et]=Lihtsa ClanLib'i rakenduse loomine. +Comment[eu]=ClanLib aplikazio simple bat sortzen du. +Comment[fa]=یک کاربرد سادۀ ClanLib تولید می‌کند. +Comment[fr]=Génère une application ClanLib simple. +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí ClanLib. +Comment[gl]=Xera una aplicación sinxela ClanLib. +Comment[hu]=Létrehoz egy egyszerű Clanlib-alkalmazást. +Comment[it]=Genera una semplice applicazione ClanLib. +Comment[ja]=簡単な ClanLib アプリケーションを作成します +Comment[nds]=Stellt en eenfach ClanLib-Programm op. +Comment[ne]=साधारण ClanLib अनुप्रयोग सिर्जना गर्दछ । +Comment[nl]=Genereert een eenvoudige ClanLib-toepassing +Comment[pl]=Generuje prosty program używający ClanLib. +Comment[pt]=Gera uma aplicação simples com o ClanLib. +Comment[pt_BR]=Gera uma aplicação simples com o ClanLib. +Comment[ru]=Создание простого приложения ClanLib. +Comment[sk]=Vygeneruje jednoduchú ClanLib aplikáciu. +Comment[sl]=Ustvari preprost program ClanLib. +Comment[sr]=Прави једноставан ClanLib програм. +Comment[sr@Latn]=Pravi jednostavan ClanLib program. +Comment[sv]=Skapar ett enkelt ClanLib-program. +Comment[tr]=Basit bir ClanLib uygulaması yaratır. +Comment[zh_CN]=生成简单的 ClanLib 应用程序。 +Comment[zh_TW]=產生簡單的 ClanLib 應用程式。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/main.cpp +Archive=clanlib.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/app-configure.in +Dest=%{dest}/configure.in + +[FILE4] +Type=install +Source=%{src}/app-autogen.sh +Dest=%{dest}/autogen.sh + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE6] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[MSG] +Type=message +Comment=A simple clanlib application was created in %{dest} +Comment[ca]=Una simple aplicació de clanlib ha estat creada en %{dest} +Comment[da]=Et simpelt clanlib program blev oprettet i %{dest} +Comment[de]=Eine einfache ClanLib-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια απλή εφαρμογή clanlib δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación de ClanLib sencilla ha sido creada en %{dest} +Comment[et]=Lihtne ClanLib'i rakendus loodi asukohta %{dest} +Comment[eu]=clanlib aplikazio simple bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد سادۀ clanlib در %{dest} ایجاد شد +Comment[fr]=Une application Clanlib simple a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár simplí clanlib i %{dest} +Comment[gl]=Creouse una apliación sinxela clanlib en %{dest} +Comment[hu]=Létrejött egy egyszerű Clanlib-alkalmazás itt: %{dest} +Comment[it]=È stata creata una semplice applicazione clanlib in %{dest} +Comment[ja]=簡単な clanlib アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach ClanLib-Programm opstellt +Comment[ne]=साधारण clanlib अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een voorbeeld ClanLib-toepassing is aangemaakt in %{dest} +Comment[pl]=Prosty program używający ClanLib został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação simples da ClanLib em %{dest} +Comment[pt_BR]=Foi criada uma aplicação simples da ClanLib em %{dest} +Comment[ru]=Простое приложение ClanLib создано в %{dest} +Comment[sk]=Jednoduchá ClanLib aplikácia bola vytvorená v %{dest} +Comment[sl]=Preprost program clanlib je bil ustvarjen v %{dest} +Comment[sr]=Једноставан clanlib програм је направљен у %{dest} +Comment[sr@Latn]=Jednostavan clanlib program je napravljen u %{dest} +Comment[sv]=Ett enkelt ClanLib-program skapades i %{dest} +Comment[zh_CN]=在 %{dest} 中创建了一个简单的 clanlib 程序 +Comment[zh_TW]=一個簡單的 clanlib 應用程式已經建立在 %{dest} diff --git a/languages/cpp/app_templates/clanlib/clanlib.png b/languages/cpp/app_templates/clanlib/clanlib.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/clanlib/clanlib.png differ diff --git a/languages/cpp/app_templates/clanlib/main.cpp b/languages/cpp/app_templates/clanlib/main.cpp new file mode 100644 index 00000000..962e1452 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/main.cpp @@ -0,0 +1,29 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include +#include + +class %{APPNAME}Application : public CL_ClanApplication +{ +public: + virtual int main(int argc, char** argv) + { + CL_SetupCore::init(); + CL_SetupDisplay::init(); + CL_SetupGL::init(); + CL_SetupSound::init(); + + // Code here + + CL_SetupSound::deinit(); + CL_SetupGL::deinit(); + CL_SetupDisplay::deinit(); + CL_SetupCore::deinit(); + + return 0; + } +} app; + diff --git a/languages/cpp/app_templates/clanlib/src-Makefile.am b/languages/cpp/app_templates/clanlib/src-Makefile.am new file mode 100644 index 00000000..085f4f76 --- /dev/null +++ b/languages/cpp/app_templates/clanlib/src-Makefile.am @@ -0,0 +1,4 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = main.cpp +%{APPNAMELC}_LDADD = -lclanCore -lclanApp -lclanDisplay -lclanGL -lclanSound -lclanSignals + diff --git a/languages/cpp/app_templates/cmakelibc/CMakeLists.txt b/languages/cpp/app_templates/cmakelibc/CMakeLists.txt new file mode 100644 index 00000000..fad51df5 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/CMakeLists.txt @@ -0,0 +1,7 @@ +PROJECT(%{APPNAMELC}) + +#if you don't want the full compiler output, remove the following line +SET(CMAKE_VERBOSE_MAKEFILE ON) + +SUBDIRS(src) + diff --git a/languages/cpp/app_templates/cmakelibc/CMakeLists.txt.src b/languages/cpp/app_templates/cmakelibc/CMakeLists.txt.src new file mode 100644 index 00000000..d2fabc7a --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/CMakeLists.txt.src @@ -0,0 +1,19 @@ +#this is just a basic CMakeLists.txt, for more information see the cmake manpage + +#add definitions, compiler switches, etc. +ADD_DEFINITIONS(-Wall -O2) + +#build a shared library +ADD_LIBRARY(%{APPNAMELC} SHARED %{APPNAMELC}.c) + +#for testing the shared library you probably need some test app too +ADD_EXECUTABLE(%{APPNAMELC}test %{APPNAMELC}test.c) + +#need to link to some other libraries ? just add them here +TARGET_LINK_LIBRARIES(%{APPNAMELC}test %{APPNAMELC}) + +#add an install target here +#INSTALL_FILES(...) +#INSTALL_PROGRAMS(...) +#INSTALL_TARGET(...) + diff --git a/languages/cpp/app_templates/cmakelibc/Makefile.am b/languages/cpp/app_templates/cmakelibc/Makefile.am new file mode 100644 index 00000000..c10e704a --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = test.c lib.h lib.c cmakelibc.png CMakeLists.txt CMakeLists.txt.src +templateName = cmakelibc + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/cmakelibc/cmakelibc b/languages/cpp/app_templates/cmakelibc/cmakelibc new file mode 100644 index 00000000..ae927b61 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/cmakelibc @@ -0,0 +1,7 @@ +# KDE Config File +[General] +Name=A shared library template +Icon=cmakelibc.png +Category=C/CMake based projects +Comment=Generates a shared library template including a test application in C. It compiles using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +ShowFilesAfterGeneration=src/%{APPNAMELC}.c diff --git a/languages/cpp/app_templates/cmakelibc/cmakelibc.kdevtemplate b/languages/cpp/app_templates/cmakelibc/cmakelibc.kdevtemplate new file mode 100644 index 00000000..cd3783f7 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/cmakelibc.kdevtemplate @@ -0,0 +1,139 @@ +# KDE Config File +[General] +Name=A shared library template +Name[ca]=Una plantilla de biblioteca compartida +Name[da]=En delt biblitekskabelon +Name[de]=Vorlage für eine Shared Library +Name[el]=Ένα πρότυπο κοινόχρηστης βιβλιοθήκης +Name[es]=Una plantilla de biblioteca compartida +Name[et]=Jagatud teegi mall +Name[eu]=Liburutegi partekatu baten txantiloia +Name[fa]=قالب کتابخانۀ مشترک +Name[fr]=Un modèle de bibliothèque partagée +Name[ga]=Teimpléad comhleabharlainne +Name[gl]=Plantilla de biblioteca compartida +Name[hu]=Osztott programkönyvtár-sablon +Name[it]=Un modello di libreria condivisa +Name[ja]=共有ライブラリのテンプレート +Name[nds]=Vörlaag för deelt Bibliotheek +Name[ne]=साझेदारी गरिएको लाइब्रेरी टेम्प्लेट +Name[nl]=Een gedeelde-bibliotheek-sjabloon +Name[pl]=Szablon współdzielonej biblioteki +Name[pt]=Um modelo de uma biblioteca dinâmica +Name[pt_BR]=Um modelo de uma biblioteca dinâmica +Name[ru]=Шаблон разделяемой библиотеки +Name[sk]=Šablóna pre zdieľanú knižnicu +Name[sl]=Predloga deljene knjižnice +Name[sr]=Шаблон дељене библиотеке +Name[sr@Latn]=Šablon deljene biblioteke +Name[sv]=En mall för ett delat bibliotek +Name[tr]=Bir paylaşılan kütüphane şablonu +Name[zh_CN]=共享库模板 +Name[zh_TW]=共享函式庫樣本 +Icon=cmakelibc.png +Category=C/CMake based projects +FileTemplates=h,CStyle,c,CStyle +Comment=Generates a shared library template including a test application in C. It compiles using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +Comment[ca]=Genera una plantilla de biblioteca compartida incloguen una aplicació de prova en C. Es compila usant l'eina de construcció CMake en comptes de la combinació automake/autoconf/libtool. Requereix cmake 2.1 (disponible en el cvs de cmake) o la propera versió 2.2. +Comment[da]=Genererer en delt skabelon for et bibliotek inklusive et testprogram i C. Det kompilerer ved brug af CMake's byggeværktøj i stedet for automake/autoconf/libtool kombinationen. Det kræver cmake 2.1 (tilgængelig fra cmake cvs) eller den fremtidige cmake 2.2 udgivelse. +Comment[de]=Erstellt eine Vorlage für eine Shared Library inklusive einer Testanwendung in C. Der Kompiliervorgang wird mit CMake anstelle der Kombination automake/autoconf/libtool durchgeführt und erfordert CMake 2.1 (das über das CVS-Archiv von CMake verfügbar ist) oder die kommende Version 2.2 von CMake. +Comment[el]=Δημιουργεί ένα πρότυπο κοινόχρηστης βιβλιοθήκης που περιλαμβάνει και μια εφαρμογή δοκιμής σε C. Μεταγλωττίζεται χρησιμοποιώντας το εργαλείο κατασκευής CMake στη θέση του συνδυασμού automake/autoconf/libtool. Χρειάζεται το cmake 2.1 (διαθέσιμο από το cmake cvs) ή την επερχόμενη έκδοση cmake 2.2. +Comment[es]=Genera una plantilla de biblioteca compartida incluyendo una aplicación de prueba en C. Se compila usando la herramienta CMake en lugar de la combinación automake/autoconf/libtool. Requiere cmake 2.1 (disponible en el cvs de cmake) o la próxima cmake 2.2. +Comment[et]=Jagatud teegi malli loomine, kaasa arvatud testrakendus C-s. See kompileeritakse CMake'i ehitamistööriistaga, mitte automake/autoconf/libtool'i kombinatsiooniga. Selleks on vajalik CMake 2.1 (saadaval CMake'i CVSis) või peatne CMake'i versioon 2.2. +Comment[eu]=Liburutegi partekatu baten txantiloia sortzen du C lengoaian idatzitako probarako aplikazio batekin. CMake tresna erabiliz konpilatzen du automake/autoconf/libtool taldea erabili ordez. cmake 2.1 behar du (cmake cvs-an eskuragarri) edo hurrengo cmake 2.2. +Comment[fa]=یک قالب کتابخانۀ مشترک شامل کاربرد آزمایشی در سی تولید می‌کند. با استفاده از ابزار ساختن CMake به جای ترکیب automake/autoconf/libtool، ترجمه می‌کند. به cmake 2.1 )از cmake cvs قابل دسترس است( یا نشر cmake 2.2 در آیندۀ نزدیک، نیاز دارد. +Comment[fr]=Génère un modèle de bibliothèque partagée comprenant une application de test en C. La compilation s'effectue à l'aide de l'outil de construction CMake au lieu de la combinaison automake / autoconf / libtool. Nécessite CMake 2.1 (disponible sur le CVS de CMake) ou la version 2.2 de CMake à venir. +Comment[ga]=Cruthaigh teimpléad comhleabharlainne le feidhmchlár tástála i C. Tiomsaítear é le huirlis tógála CMake in ionad automake/autoconf/libtool. Tá cmake 2.1 de dhíth (ar fáil ó cmake cvs) nó leagan 2.2 cmake atá le teacht. +Comment[gl]=Xera unha plantilla de biblioteca compartida e máis unha aplicación de proba en C. Compílase usando a ferramenta CMake no lugar da combinación automake/autoconf/libtool. Require cmake 2.1 (dispoñíbel no cvs de cmake) ou a próxima versión cmake 2.2. +Comment[hu]=Létrehoz egy alap osztott programkönyvtárat és egy hozzá tartozó tesztprogramot C nyelven. A fordítási környezet a CMake-re fog alapulni (az automake/autoconf/libtool kombináció helyett). A CMake 2.1 (elérhető a CMake CVS-ben) vagy a rövidesen megjelenő CMake 2.2 szükséges hozzá. +Comment[it]=Genera un modello di libreria condivisa includente un'applicazione test in C. Compila usando CMake invece della combinazione automake/autoconf/libtool. Richiede cmake 2.1 (disponibile dal CVS di cmake) o la versione a venire di cmake 2.2. +Comment[ja]=共有ライブラリのテンプレートを作成します。同時に C でテストアプリケーションも作成します。コンパイルには、automake/autoconf/libtool ではなく CMake (2.1 または 2.2) が必要です。 +Comment[nds]=Stellt en Vörlaag för en deelt Bibliotheek mit en Testprogramm in C op. Dat Kompileren bruukt ansteed vun de "automake/autoconf/libtool"-Kombinatschoon "CMake" in de Verschoon 2.1 (ut dat cmake-CVS) oder 2.2 (de tokamen Utgaav). +Comment[ne]=C मा परीक्षण अनुप्रयोग सहितको साझेदारी टेम्प्लेट उत्पन्न गर्दछ । यसले automake/autoconf/libtool संयोजनको सट्टामा CMake निर्माण उपकरण प्रयोग गरेर कम्पाइल गर्दछ । यसका लागि cmake 2.1 (cmake cvs बाट उपलब्ध हुन्छ) वा अब आउने cmake 2.2 उत्पादन आवश्यक पर्दछ । +Comment[nl]=Genereert een gedeelde-bibliotheek-sjabloon inclusief een testtoepassing in C. Het compileert met behulp van de CMake build tool in plaats van de combinatie automake/autoconf/libtool. Het vereist cmake 2.1 (beschikbaar in het cvs van cmake) of de aankomende cmake 2.2-uitgave. +Comment[pl]=Generuje szablon współdzielonej biblioteki zawierający także program testowy w języku C. Kompilacja odbywa sie za pomocą narzędzia CMake zamiast kombinacji automake/autoconf/libtool. Wymaga cmake 2.1 (dostępnego z cvs-u cmake) lub nadchodzącej wersji 2.2. +Comment[pt]=Gera um modelo de uma biblioteca dinâmica, que inclui uma aplicação de testes em C. Ele é compilado com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 (disponível no CVS do 'cmake') ou da próxima versão cmake 2.2. +Comment[pt_BR]=Gera um modelo de uma biblioteca dinâmica, que inclui uma aplicação de testes em C. Ele é compilado com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 (disponível no CVS do 'cmake') ou da próxima versão cmake 2.2. +Comment[ru]=Создание шаблона разделяемой библиотеки, включая тестовую программу на C. Для сборки потребуется CMake вместо комбинации automake/autoconf/libtool. Потребуется cmake 2.1 (из CVS cmake) или релиз cmake 2.2. +Comment[sk]=Vygeneruje šablónu pre zdieľanú knižnicu vrátane testovacej aplikácie v C.Kompiluje sa pomocou nástroja CMake namiesto kombinácie automake/autoconf/libtool.Vyžaduje cmake 2.1 (dostupné v cmake cvs) alebo nadchádzajúci cmake 2.2 release. +Comment[sl]=Ustvari predlogo za deljeno knjižnico in testni program v C. Za prevajanje se namesto kombinacije automake/autoconf/libtool uporabi orodje za gradnjo CMake. Potreben je CMake 2.1 ali CMake 2.2. +Comment[sr]=Прави шаблон дељене библиотеке, укључујући и пробни програм у C-у. Преводи се помоћу алата CMake уместо комбинације Automake/Autoconf/Libtool. Захтева CMake 2.1 (доступан у CVS-у CMake-а) или надолазеће издање CMake 2.2. +Comment[sr@Latn]=Pravi šablon deljene biblioteke, uključujući i probni program u C-u. Prevodi se pomoću alata CMake umesto kombinacije Automake/Autoconf/Libtool. Zahteva CMake 2.1 (dostupan u CVS-u CMake-a) ili nadolazeće izdanje CMake 2.2. +Comment[sv]=Skapar en mall för ett delat bibliotek inklusive ett testprogram i C. Det kompileras med byggverktyget CMake istället för kombinationen automake/autoconf/libtool. Det kräver cmake 2.1 (tillgängligt från cmake CVS-arkiv) eller den förestående utgåvan av cmake 2.2. +Comment[tr]=C'de bir test uygulaması içeren bir paylaşılan kütüphane uygulaması yaratır. automake/autoconf/libtool birleşimini değil, CMake aracını kullanarak derlenir. cmake 2.1( cmake cvs'inden edinilebilir) veya yakında gelecek olan 2.2 sürümüne ihtiyaç duyar. +Comment[zh_CN]=生成一个共享库模板,其中包含一个 C 的测试应用程序。该模板使用 CMake 编译工具编译,而不是使用 automake/autoconf/libtool 的组合。该模板需要 cmake 2.1 (可从 cmake cvs 中获得)或即将发布的 cmake 2.2 版本。 +Comment[zh_TW]=產生一個共享函式庫樣本,包括一個 C 的測試程式。它要用 CMake 建立工具來編譯,而不是用 automake/autoconf/libtool 等。它需要 cmake 2.1(可以從 cmake cvs 中取得),或是以後的版本。 +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.c +Archive=cmakelibc.tar.gz + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/CMakeLists.txt +Dest=%{dest}/CMakeLists.txt + +[FILE2] +Type=install +EscapeXML=true +Source=%{src}/CMakeLists.txt.src +Dest=%{dest}/src/CMakeLists.txt + +[FILE3] +Type=install +EscapeXML=true +Source=%{src}/test.c +Dest=%{dest}/src/%{APPNAMELC}test.c + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/lib.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE5] +Type=install +EscapeXML=true +Source=%{src}/lib.c +Dest=%{dest}/src/%{APPNAMELC}.c + +[CMAKE] +Type=finishcmd +Command=cmake ./ -GKDevelop3 +Directory=%{dest} + +[MSG] +Type=message +Comment=A CMake based shared library template was created in %{dest} +Comment[ca]=Una plantilla de biblioteca compartida basada en CMake ha estat creada en %{dest} +Comment[da]=En CMake baseret skabelon for et delt bibliotek blev oprettet i %{dest} +Comment[de]=Eine auf CMake basierende Vorlage für eine Shared Library wurde in %{dest} erstellt. +Comment[el]=Ένα πρότυπο κοινόχρηστης βιβλιοθήκης βασισμένο στο CMake δημιουργήθηκε στο %{dest} +Comment[es]=Una plantilla de biblioteca compartida basada en CMake ha sido creada en %{dest} +Comment[et]=Jagatud teegi mall CMake'i põhjal loodi asukohta %{dest} +Comment[eu]=CMake-en oinarritutako liburutegi partekatu baten txantiloia sortu da hemen: %{dest} +Comment[fa]=یک قالب کتابخانۀ مشترک بر مبنای CMake در %{dest} ایجاد شد +Comment[fr]=Un modèle de bibliothèque partagée basée sur CMake a été créé dans %{dest} +Comment[ga]=Cruthaíodh teimpléad comhleabharlainne bunaithe ar CMake i %{dest} +Comment[gl]=Creouse una plantilla de biblioteca compartida baseada en CMake en %{dest} +Comment[hu]=Létrejött egy CMake-alapú osztott programkönyvtár-sablon itt: %{dest} +Comment[it]=È stato creato un modello di librerie condivise basate su CMake in %{dest} +Comment[ja]=CMake ベースの共有ライブラリテンプレートを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op CMake opbuut Vörlaag för en deelt Bibliotheek opstellt +Comment[ne]=एउटा CMake आधारित साझेदारी लाइब्रेरी टेम्प्लेट %{dest} मा सिर्जना गरियो +Comment[nl]=Een op Cmake gebaseerde bibliotheeksjabloon is aangemaakt in %{dest} +Comment[pl]=Używający CMake szablon biblioteki współdzielonej został utworzony w %{dest} +Comment[pt]=Foi criado um modelo de uma biblioteca dinâmica do CMake em %{dest} +Comment[pt_BR]=Foi criado um modelo de uma biblioteca dinâmica do CMake em %{dest} +Comment[ru]=Основанный на CMake шаблон разделяемой библиотеки создан в %{dest} +Comment[sk]=Šablóna zdieľanej knižnice založenej na CMake bola vytvorená v %{dest} +Comment[sl]=Predloga deljene knjižnice, ki uporablja CMake, je bila ustvarjena v %{dest} +Comment[sr]=Шаблон дељене библиотеке на основу CMake-а направљен је у %{dest} +Comment[sr@Latn]=Šablon deljene biblioteke na osnovu CMake-a napravljen je u %{dest} +Comment[sv]=En CMake-baserad mall för ett delat bibliotek skapades i %{dest} +Comment[tr]=CMake tabanlı paylaşılan kütüphane şablonu %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了基于 CMake 的共享库 +Comment[zh_TW]=以 CMake 為基礎的共享函式庫樣本已建立在 %{dest} diff --git a/languages/cpp/app_templates/cmakelibc/cmakelibc.png b/languages/cpp/app_templates/cmakelibc/cmakelibc.png new file mode 100644 index 00000000..158d3ce7 Binary files /dev/null and b/languages/cpp/app_templates/cmakelibc/cmakelibc.png differ diff --git a/languages/cpp/app_templates/cmakelibc/lib.c b/languages/cpp/app_templates/cmakelibc/lib.c new file mode 100644 index 00000000..4d285882 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/lib.c @@ -0,0 +1,13 @@ + +#include +#include + +#include "%{APPNAMELC}.h" + + +void do_something() +{ + printf("Hello world !\n"); +} + + diff --git a/languages/cpp/app_templates/cmakelibc/lib.h b/languages/cpp/app_templates/cmakelibc/lib.h new file mode 100644 index 00000000..1b326544 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/lib.h @@ -0,0 +1,7 @@ +#ifndef %{APPNAMELC}_H +#define %{APPNAMELC}_H + +void do_something(); + + +#endif diff --git a/languages/cpp/app_templates/cmakelibc/test.c b/languages/cpp/app_templates/cmakelibc/test.c new file mode 100644 index 00000000..fb13e866 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibc/test.c @@ -0,0 +1,8 @@ + +#include "%{APPNAMELC}.h" + +int main(int argc, char** argv) +{ + do_something(); + return 0; +} diff --git a/languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt b/languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt new file mode 100644 index 00000000..8f172103 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt @@ -0,0 +1,8 @@ + +PROJECT(%{APPNAMELC}) + +#if you don't want the full compiler output, remove the following line + +SET(CMAKE_VERBOSE_MAKEFILE ON) + +SUBDIRS(src) diff --git a/languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt.src b/languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt.src new file mode 100644 index 00000000..ee2bb832 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/CMakeLists.txt.src @@ -0,0 +1,19 @@ +#this is just a basic CMakeLists.txt, for more information see the cmake manpage + +#add definitions, compiler switches, etc. +ADD_DEFINITIONS(-Wall -O2) + +#build a shared library +ADD_LIBRARY(%{APPNAMELC} SHARED %{APPNAMELC}.cpp) + +#for testing the shared library you probably need some test app too +ADD_EXECUTABLE(%{APPNAMELC}test %{APPNAMELC}test.cpp) + +#need to link to some other libraries ? just add them here +TARGET_LINK_LIBRARIES(%{APPNAMELC}test %{APPNAMELC}) + +#add an install target here +#INSTALL_FILES(...) +#INSTALL_PROGRAMS(...) +#INSTALL_TARGET(...) + diff --git a/languages/cpp/app_templates/cmakelibcpp/Makefile.am b/languages/cpp/app_templates/cmakelibcpp/Makefile.am new file mode 100644 index 00000000..395bb107 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = test.cpp lib.h lib.cpp cmakelibcpp.png CMakeLists.txt CMakeLists.txt.src +templateName = cmakelibcpp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp b/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp new file mode 100644 index 00000000..c68119c5 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp @@ -0,0 +1,7 @@ +# KDE Config File +[General] +Name=A shared library template +Icon=cmakelibcpp.png +Category=C++/CMake based projects +Comment=Generates a shared library template including a test application in C++. It compiles using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +ShowFilesAfterGeneration=src/%{APPNAMELC}.cpp diff --git a/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.kdevtemplate b/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.kdevtemplate new file mode 100644 index 00000000..e6e6ac44 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.kdevtemplate @@ -0,0 +1,139 @@ +# KDE Config File +[General] +Name=A shared library template +Name[ca]=Una plantilla de biblioteca compartida +Name[da]=En delt biblitekskabelon +Name[de]=Vorlage für eine Shared Library +Name[el]=Ένα πρότυπο κοινόχρηστης βιβλιοθήκης +Name[es]=Una plantilla de biblioteca compartida +Name[et]=Jagatud teegi mall +Name[eu]=Liburutegi partekatu baten txantiloia +Name[fa]=قالب کتابخانۀ مشترک +Name[fr]=Un modèle de bibliothèque partagée +Name[ga]=Teimpléad comhleabharlainne +Name[gl]=Plantilla de biblioteca compartida +Name[hu]=Osztott programkönyvtár-sablon +Name[it]=Un modello di libreria condivisa +Name[ja]=共有ライブラリのテンプレート +Name[nds]=Vörlaag för deelt Bibliotheek +Name[ne]=साझेदारी गरिएको लाइब्रेरी टेम्प्लेट +Name[nl]=Een gedeelde-bibliotheek-sjabloon +Name[pl]=Szablon współdzielonej biblioteki +Name[pt]=Um modelo de uma biblioteca dinâmica +Name[pt_BR]=Um modelo de uma biblioteca dinâmica +Name[ru]=Шаблон разделяемой библиотеки +Name[sk]=Šablóna pre zdieľanú knižnicu +Name[sl]=Predloga deljene knjižnice +Name[sr]=Шаблон дељене библиотеке +Name[sr@Latn]=Šablon deljene biblioteke +Name[sv]=En mall för ett delat bibliotek +Name[tr]=Bir paylaşılan kütüphane şablonu +Name[zh_CN]=共享库模板 +Name[zh_TW]=共享函式庫樣本 +Icon=cmakelibcpp.png +Category=C++/CMake based projects +FileTemplates=h,CStyle,cpp,CStyle +Comment=Generates a shared library template including a test application in C++. It compiles using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +Comment[ca]=Genera una plantilla de biblioteca compartida incloguen una aplicació de prova en C++. Es compila usant l'eina de construcció CMake en comptes de la combinació automake/autoconf/libtool. Requereix cmake 2.1 (disponible en el cvs de cmake) o la propera versió 2.2. +Comment[da]=Genererer skabelon for delt bibliotek inklusive et testprogram i C++. Det kompileres ved brug af CMake byggeværktøjet i stedet for automake/autoconf/libtool kombinationen. Det kræver cmake 2.1 (tilgængelig fra cmake cvs) eller den fremtidige cmake 2.2 udgivelse. +Comment[de]=Erstellt eine Vorlage für eine Shared Library inklusive einer Testanwendung in C++. Der Kompiliervorgang wird mit CMake anstelle der Kombination automake/autoconf/libtool durchgeführt und erfordert CMake 2.1 (das über das CVS-Archiv von CMake verfügbar ist) oder die kommende Version 2.2 von CMake. +Comment[el]=Δημιουργεί ένα πρότυπο κοινόχρηστης βιβλιοθήκης που περιλαμβάνει και μια εφαρμογή δοκιμής σε C++. Μεταγλωττίζεται χρησιμοποιώντας το εργαλείο κατασκευής CMake στη θέση του συνδυασμού automake/autoconf/libtool. Χρειάζεται το cmake 2.1 (διαθέσιμο από το cmake cvs) ή την επερχόμενη έκδοση cmake 2.2. +Comment[es]=Genera una plantilla de biblioteca compartida incluyendo una aplicación de prueba en C++. Se compila usando la herramienta CMake en lugar de la combinación automake/autoconf/libtool. Requiere cmake 2.1 (disponible en el cvs de cmake) o la próxima cmake 2.2. +Comment[et]=Jagatud teegi malli loomine, kaasa arvatud testrakendus C++-s. See kompileeritakse CMake'i ehitamistööriistaga, mitte automake/autoconf/libtool'i kombinatsiooniga. Selleks on vajalik CMake 2.1 (saadaval CMake'i CVSis) või peatne CMake'i versioon 2.2. +Comment[eu]=Liburutegi partekatu baten txantiloia sortzen du C++ lengoaian idatzitako probarako aplikazio batekin. CMake tresna erabiliz konpilatzen du automake/autoconf/libtool taldea erabili ordez. cmake 2.1 behar du (cmake cvs-an eskuragarri) edo hurrengo cmake 2.2. +Comment[fa]=یک قالب کتابخانۀ مشترک شامل کاربرد آزمایشی در C++ تولید می‌کند. با استفاده از ابزار ساختن CMake به جای ترکیب automake/autoconf/libtool، ترجمه می‌کند. به cmake 2.1 )از cmake cvs قابل دسترس است( یا نشر cmake 2.2 در آیندۀ نزدیک، نیاز دارد. +Comment[fr]=Génère un modèle de bibliothèque partagée incluant une application de test en C++. La compilation s'effectue à l'aide de l'outil de construction CMake au lieu de la combinaison automake / autoconf / libtool. Nécessite CMake 2.1 (disponible sur le CVS de CMake) ou la version 2.2 de CMake à venir. +Comment[ga]=Cruthaigh teimpléad comhleabharlainne le feidhmchlár tástála i C++. Tiomsaítear é le huirlis tógála CMake in ionad automake/autoconf/libtool. Tá cmake 2.1 de dhíth (ar fáil ó cmake cvs) nó leagan 2.2 cmake atá le teacht. +Comment[gl]=Xera unha plantilla de biblioteca compartida e máis unha aplicación de proba en C++. Compílase usando a ferramenta CMake no lugar da combinación automake/autoconf/libtool. Require cmake 2.1 (dispoñíbel no cvs de cmake) ou a próxima versión cmake 2.2. +Comment[hu]=Létrehoz egy alap osztott programkönyvtárat és egy hozzá tartozó tesztprogramot C++ nyelven. A fordítási környezet a CMake-re fog alapulni (az automake/autoconf/libtool kombináció helyett). A CMake 2.1 (elérhető a CMake CVS-ben) vagy a rövidesen megjelenő CMake 2.2 szükséges hozzá. +Comment[it]=Genera un modello di libreria condivisa che include una applicazione test in C++. Compila usando CMake invece della combinazione automake/autoconf/libtool. Richiede cmake 2.1 (disponibile dal CVS di cmake) o la versione a venire cmake 2.2. +Comment[ja]=共有ライブラリのテンプレートを作成します。同時に C++ でテストアプリケーションも作成します。コンパイルには、automake/autoconf/libtool ではなく CMake (2.1 または 2.2) が必要です。 +Comment[nds]=Stellt en Vörlaag för en deelt Bibliotheek mit en Testprogramm in C++ op. Dat Kompileren bruukt ansteed vun de "automake/autoconf/libtool"-Kombinatschoon "CMake" in de Verschoon 2.1 (ut dat cmake-CVS) oder 2.2 (de tokamen Utgaav). +Comment[ne]=C++ मा परीक्षण अनुप्रयोग सहितको साझेदारी टेम्प्लेट उत्पन्न गर्दछ । यसले automake/autoconf/libtool संयोजनको सट्टामा CMake निर्माण उपकरण प्रयोग गरेर कम्पाइल गर्दछ । यसका लागि cmake 2.1 (cmake cvs बाट उपलब्ध हुन्छ) वा अब आउने cmake 2.2 उत्पादन आवश्यक पर्दछ । +Comment[nl]=Genereert een gedeelde-bibliotheek-sjabloon inclusief een testtoepassing in C++. Het compileert met behulp van de CMake build tool in plaats van de combinatie automake/autoconf/libtool. Het vereist cmake 2.1 (uit het cvs van cmake) of de aankomende cmake 2.2-uitgave. +Comment[pl]=Generuje szablon współdzielonej biblioteki zawierający także program testowy w języku C++. Kompilacja odbywa sie za pomocą narzędzia CMake zamiast kombinacji automake/autoconf/libtool. Wymaga cmake 2.1 (dostępnego z cvs-u cmake) lub nadchodzącej wersji 2.2. +Comment[pt]=Gera um modelo de uma biblioteca dinâmica, que inclui uma aplicação de testes em C++. Ele é compilado com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 (disponível no CVS do 'cmake') ou da próxima versão cmake 2.2. +Comment[pt_BR]=Gera um modelo de uma biblioteca dinâmica, que inclui uma aplicação de testes em C++. Ele é compilado com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 (disponível no CVS do 'cmake') ou da próxima versão cmake 2.2. +Comment[ru]=Создание шаблона разделяемой библиотеки, включая тестовую программу на C++. Для сборки потребуется CMake вместо комбинации automake/autoconf/libtool. Потребуется cmake 2.1 (из CVS cmake) или релиз cmake 2.2. +Comment[sk]=Vygeneruje šablónu zdieľanej knižnice vrátane testovacej aplikácie v C++.Kompiluje sa pomocou nástroja CMake namiesto kombinácie automake/autoconf/libtool.Vyžaduje cmake 2.1 (dostupné v cmake cvs) alebo nadchádzajúci cmake 2.2 release. +Comment[sl]=Ustvari predlogo za deljeno knjižnico in testni program v C++. Za prevajanje se namesto kombinacije automake/autoconf/libtool uporabi orodje za gradnjo CMake. Potreben je CMake 2.1 ali CMake 2.2. +Comment[sr]=Прави шаблон дељене библиотеке укључујући и пробни програм у C++-у. Преводи се помоћу алата CMake уместо комбинације Automake/Autoconf/Libtool. Захтева CMake 2.1 (доступан у CVS-у CMake-а) или надолазеће издање CMake 2.2. +Comment[sr@Latn]=Pravi šablon deljene biblioteke uključujući i probni program u C++-u. Prevodi se pomoću alata CMake umesto kombinacije Automake/Autoconf/Libtool. Zahteva CMake 2.1 (dostupan u CVS-u CMake-a) ili nadolazeće izdanje CMake 2.2. +Comment[sv]=Skapar en mall för ett delat bibliotek inklusive ett testprogram i C++. Det kompileras med byggverktyget CMake istället för kombinationen automake/autoconf/libtool. Det kräver cmake 2.1 (tillgängligt från cmake CVS-arkiv) eller den förestående utgåvan av cmake 2.2. +Comment[tr]=C++'da bir test uygulaması içeren bir paylaşılan kütüphane uygulaması yaratır. automake/autoconf/libtool birleşimini değil, CMake aracını kullanarak derlenir. cmake 2.1( cmake cvs'inden edinilebilir) veya yakında gelecek olan 2.2 sürümüne ihtiyaç duyar. +Comment[zh_CN]=生成一个共享库模板,其中包含一个 C++ 的测试应用程序。该模板使用 CMake 编译工具编译,而不是使用 automake/autoconf/libtool 的组合。该模板需要 cmake 2.1 (可从 cmake cvs 中获得)或即将发布的 cmake 2.2 版本。 +Comment[zh_TW]=產生一個包括 C++ 測試程式的共享函式庫樣本。它要用 CMake 建立工具來編譯,而不是用 automake/autoconf/libtool 等。它需要 cmake 2.1(可以從 cmake cvs 中取得),或是以後的版本。 +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=cmakelibcpp.tar.gz + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/CMakeLists.txt +Dest=%{dest}/CMakeLists.txt + +[FILE2] +Type=install +EscapeXML=true +Source=%{src}/CMakeLists.txt.src +Dest=%{dest}/src/CMakeLists.txt + +[FILE3] +Type=install +EscapeXML=true +Source=%{src}/test.cpp +Dest=%{dest}/src/%{APPNAMELC}test.cpp + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/lib.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE5] +Type=install +EscapeXML=true +Source=%{src}/lib.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[CMAKE] +Type=finishcmd +Command=cmake ./ -GKDevelop3 +Directory=%{dest} + +[MSG] +Type=message +Comment=A CMake based shared library template was created in %{dest} +Comment[ca]=Una plantilla de biblioteca compartida basada en CMake ha estat creada en %{dest} +Comment[da]=En CMake baseret skabelon for et delt bibliotek blev oprettet i %{dest} +Comment[de]=Eine auf CMake basierende Vorlage für eine Shared Library wurde in %{dest} erstellt. +Comment[el]=Ένα πρότυπο κοινόχρηστης βιβλιοθήκης βασισμένο στο CMake δημιουργήθηκε στο %{dest} +Comment[es]=Una plantilla de biblioteca compartida basada en CMake ha sido creada en %{dest} +Comment[et]=Jagatud teegi mall CMake'i põhjal loodi asukohta %{dest} +Comment[eu]=CMake-en oinarritutako liburutegi partekatu baten txantiloia sortu da hemen: %{dest} +Comment[fa]=یک قالب کتابخانۀ مشترک بر مبنای CMake در %{dest} ایجاد شد +Comment[fr]=Un modèle de bibliothèque partagée basée sur CMake a été créé dans %{dest} +Comment[ga]=Cruthaíodh teimpléad comhleabharlainne bunaithe ar CMake i %{dest} +Comment[gl]=Creouse una plantilla de biblioteca compartida baseada en CMake en %{dest} +Comment[hu]=Létrejött egy CMake-alapú osztott programkönyvtár-sablon itt: %{dest} +Comment[it]=È stato creato un modello di librerie condivise basate su CMake in %{dest} +Comment[ja]=CMake ベースの共有ライブラリテンプレートを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op CMake opbuut Vörlaag för en deelt Bibliotheek opstellt +Comment[ne]=एउटा CMake आधारित साझेदारी लाइब्रेरी टेम्प्लेट %{dest} मा सिर्जना गरियो +Comment[nl]=Een op Cmake gebaseerde bibliotheeksjabloon is aangemaakt in %{dest} +Comment[pl]=Używający CMake szablon biblioteki współdzielonej został utworzony w %{dest} +Comment[pt]=Foi criado um modelo de uma biblioteca dinâmica do CMake em %{dest} +Comment[pt_BR]=Foi criado um modelo de uma biblioteca dinâmica do CMake em %{dest} +Comment[ru]=Основанный на CMake шаблон разделяемой библиотеки создан в %{dest} +Comment[sk]=Šablóna zdieľanej knižnice založenej na CMake bola vytvorená v %{dest} +Comment[sl]=Predloga deljene knjižnice, ki uporablja CMake, je bila ustvarjena v %{dest} +Comment[sr]=Шаблон дељене библиотеке на основу CMake-а направљен је у %{dest} +Comment[sr@Latn]=Šablon deljene biblioteke na osnovu CMake-a napravljen je u %{dest} +Comment[sv]=En CMake-baserad mall för ett delat bibliotek skapades i %{dest} +Comment[tr]=CMake tabanlı paylaşılan kütüphane şablonu %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了基于 CMake 的共享库 +Comment[zh_TW]=以 CMake 為基礎的共享函式庫樣本已建立在 %{dest} diff --git a/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.png b/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.png new file mode 100644 index 00000000..158d3ce7 Binary files /dev/null and b/languages/cpp/app_templates/cmakelibcpp/cmakelibcpp.png differ diff --git a/languages/cpp/app_templates/cmakelibcpp/lib.cpp b/languages/cpp/app_templates/cmakelibcpp/lib.cpp new file mode 100644 index 00000000..7dc4b57d --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/lib.cpp @@ -0,0 +1,17 @@ + +#include +#include + +#include "%{APPNAMELC}.h" + + +Foo::Foo() +{ +} + +void Foo::doSomething() +{ + printf("Hello world !\n"); +} + + diff --git a/languages/cpp/app_templates/cmakelibcpp/lib.h b/languages/cpp/app_templates/cmakelibcpp/lib.h new file mode 100644 index 00000000..5a434cdb --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/lib.h @@ -0,0 +1,12 @@ +#ifndef %{APPNAMELC}_H +#define %{APPNAMELC}_H + +class Foo +{ + public: + Foo(); + void doSomething(); +}; + + +#endif diff --git a/languages/cpp/app_templates/cmakelibcpp/test.cpp b/languages/cpp/app_templates/cmakelibcpp/test.cpp new file mode 100644 index 00000000..b2464709 --- /dev/null +++ b/languages/cpp/app_templates/cmakelibcpp/test.cpp @@ -0,0 +1,9 @@ + +#include "%{APPNAMELC}.h" + +int main(int argc, char** argv) +{ + Foo foo; + foo.doSomething(); + return 0; +} diff --git a/languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt b/languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt new file mode 100644 index 00000000..819d0a7e --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt @@ -0,0 +1,14 @@ + +PROJECT(%{APPNAMELC}) + +# at least cmake version 2.4.0 is required +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) + +# uncomment the following line if you require a special version of Qt +# and adjust it accordingly +# SET(QT_MIN_VERSION "3.0.0") + +# try to find Qt 3 +FIND_PACKAGE(Qt3 REQUIRED) + +ADD_SUBDIRECTORY(src) diff --git a/languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt.src b/languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt.src new file mode 100644 index 00000000..c4ce3e70 --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/CMakeLists.txt.src @@ -0,0 +1,28 @@ +# this is just a basic CMakeLists.txt +# for more information see the cmake man page + +# add definitions, compiler switches, etc. +ADD_DEFINITIONS(${QT_DEFINITIONS} -Wall -O2 -g) + +# add the Qt include dir to the include path +INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}) + +# list all source files in a variable +SET(%{APPNAMELC}_SRCS main.cpp %{APPNAMELC}.cpp) + +# specify the headers which have to be processed by moc +# and collect the results in the variable given above +QT_WRAP_CPP (%{APPNAMELC} %{APPNAMELC}_SRCS %{APPNAMELC}.h) + +# create tan executable from the list of source files +ADD_EXECUTABLE(%{APPNAMELC} ${%{APPNAMELC}_SRCS}) + +# link the application to the Qt libs +TARGET_LINK_LIBRARIES(%{APPNAMELC} ${QT_LIBRARIES} ) + +# create an install rule for the executable +INSTALL(TARGETS %{APPNAMELC} DESTINATION bin ) + +# if you need to install more things, take a look at the install() command +# in the cmake man page + diff --git a/languages/cpp/app_templates/cmakeqt3app/Makefile.am b/languages/cpp/app_templates/cmakeqt3app/Makefile.am new file mode 100644 index 00000000..c5fca50a --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = main.cpp cmakeqt3app.cpp cmakeqt3app.h cmakeqt3app.png \ + filesave.xpm fileopen.xpm fileprint.xpm CMakeLists.txt CMakeLists.txt.src + +templateName = cmakeqt3app + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app new file mode 100644 index 00000000..6ef2974f --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app @@ -0,0 +1,8 @@ +# QMake application +[General] +Name=Qt3 Application +Icon=cmakeqt3app.png +Category=C++/CMake based projects +Comment=Generate a CMake based Qt3 application +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp new file mode 100644 index 00000000..841f88d4 --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp @@ -0,0 +1,283 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "filesave.xpm" +#include "fileopen.xpm" +#include "fileprint.xpm" + +%{APPNAME}::%{APPNAME}() + : QMainWindow( 0, "%{APPNAME}", WDestructiveClose ) +{ + printer = new QPrinter; + QPixmap openIcon, saveIcon, printIcon; + + QToolBar * fileTools = new QToolBar( this, "file operations" ); + fileTools->setLabel( tr("File Operations") ); + + openIcon = QPixmap( fileopen ); + QToolButton * fileOpen + = new QToolButton( openIcon, tr("Open File"), QString::null, + this, SLOT(choose()), fileTools, "open file" ); + + saveIcon = QPixmap( filesave ); + QToolButton * fileSave + = new QToolButton( saveIcon, tr("Save File"), QString::null, + this, SLOT(save()), fileTools, "save file" ); + + printIcon = QPixmap( fileprint ); + QToolButton * filePrint + = new QToolButton( printIcon, tr("Print File"), QString::null, + this, SLOT(print()), fileTools, "print file" ); + + + (void)QWhatsThis::whatsThisButton( fileTools ); + + QString fileOpenText = tr("

      " + "Click this button to open a new file.
      " + "You can also select the Open command " + "from the File menu.

      "); + + QWhatsThis::add( fileOpen, fileOpenText ); + + QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon ); + + QString fileSaveText = tr("

      Click this button to save the file you " + "are editing. You will be prompted for a file name.\n" + "You can also select the Save command " + "from the File menu.

      "); + + QWhatsThis::add( fileSave, fileSaveText ); + + QString filePrintText = tr("Click this button to print the file you " + "are editing.\n You can also select the Print " + "command from the File menu."); + + QWhatsThis::add( filePrint, filePrintText ); + + + QPopupMenu * file = new QPopupMenu( this ); + menuBar()->insertItem( tr("&File"), file ); + + + file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N ); + + int id; + id = file->insertItem( openIcon, tr("&Open..."), + this, SLOT(choose()), CTRL+Key_O ); + file->setWhatsThis( id, fileOpenText ); + + id = file->insertItem( saveIcon, tr("&Save"), + this, SLOT(save()), CTRL+Key_S ); + file->setWhatsThis( id, fileSaveText ); + + id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) ); + file->setWhatsThis( id, fileSaveText ); + + file->insertSeparator(); + + id = file->insertItem( printIcon, tr("&Print..."), + this, SLOT(print()), CTRL+Key_P ); + file->setWhatsThis( id, filePrintText ); + + file->insertSeparator(); + + file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W ); + + file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); + + menuBar()->insertSeparator(); + + QPopupMenu * help = new QPopupMenu( this ); + menuBar()->insertItem( tr("&Help"), help ); + + help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 ); + help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) ); + help->insertSeparator(); + help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 ); + + e = new QTextEdit( this, "editor" ); + e->setFocus(); + setCentralWidget( e ); + statusBar()->message( tr("Ready"), 2000 ); + + resize( 450, 600 ); +} + + +%{APPNAME}::~%{APPNAME}() +{ + delete printer; +} + + + +void %{APPNAME}::newDoc() +{ + %{APPNAME} *ed = new %{APPNAME}; + ed->setCaption(tr("Qt Example - Application")); + ed->show(); +} + +void %{APPNAME}::choose() +{ + QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, + this); + if ( !fn.isEmpty() ) + load( fn ); + else + statusBar()->message( tr("Loading aborted"), 2000 ); +} + + +void %{APPNAME}::load( const QString &fileName ) +{ + QFile f( fileName ); + if ( !f.open( IO_ReadOnly ) ) + return; + + QTextStream ts( &f ); + e->setText( ts.read() ); + e->setModified( FALSE ); + setCaption( fileName ); + statusBar()->message( tr("Loaded document %1").arg(fileName), 2000 ); +} + + +void %{APPNAME}::save() +{ + if ( filename.isEmpty() ) { + saveAs(); + return; + } + + QString text = e->text(); + QFile f( filename ); + if ( !f.open( IO_WriteOnly ) ) { + statusBar()->message( tr("Could not write to %1").arg(filename), + 2000 ); + return; + } + + QTextStream t( &f ); + t << text; + f.close(); + + e->setModified( FALSE ); + + setCaption( filename ); + + statusBar()->message( tr( "File %1 saved" ).arg( filename ), 2000 ); +} + + +void %{APPNAME}::saveAs() +{ + QString fn = QFileDialog::getSaveFileName( QString::null, QString::null, + this ); + if ( !fn.isEmpty() ) { + filename = fn; + save(); + } else { + statusBar()->message( tr("Saving aborted"), 2000 ); + } +} + + +void %{APPNAME}::print() +{ + // ###### Rewrite to use QSimpleRichText to print here as well + const int Margin = 10; + int pageNo = 1; + + if ( printer->setup(this) ) { // printer dialog + statusBar()->message( tr("Printing...") ); + QPainter p; + if( !p.begin( printer ) ) // paint on printer + return; + + p.setFont( e->font() ); + int yPos = 0; // y-position for each line + QFontMetrics fm = p.fontMetrics(); + QPaintDeviceMetrics metrics( printer ); // need width/height + // of printer surface + for( int i = 0 ; i < e->lines() ; i++ ) { + if ( Margin + yPos > metrics.height() - Margin ) { + QString msg( "Printing (page " ); + msg += QString::number( ++pageNo ); + msg += ")..."; + statusBar()->message( msg ); + printer->newPage(); // no more room on this page + yPos = 0; // back to top of page + } + p.drawText( Margin, Margin + yPos, + metrics.width(), fm.lineSpacing(), + ExpandTabs | DontClip, + e->text( i ) ); + yPos = yPos + fm.lineSpacing(); + } + p.end(); // send job to printer + statusBar()->message( tr("Printing completed"), 2000 ); + } else { + statusBar()->message( tr("Printing aborted"), 2000 ); + } +} + +void %{APPNAME}::closeEvent( QCloseEvent* ce ) +{ + if ( !e->isModified() ) { + ce->accept(); + return; + } + + switch( QMessageBox::information( this, tr("Qt Application Example"), + tr("Do you want to save the changes" + " to the document?"), + tr("Yes"), tr("No"), tr("Cancel"), + 0, 1 ) ) { + case 0: + save(); + ce->accept(); + break; + case 1: + ce->accept(); + break; + case 2: + default: // just for sanity + ce->ignore(); + break; + } +} + + +void %{APPNAME}::about() +{ + QMessageBox::about( this, tr("Qt Application Example"), + tr("This example demonstrates simple use of " + "QMainWindow,\nQMenuBar and QToolBar.")); +} + + +void %{APPNAME}::aboutQt() +{ + QMessageBox::aboutQt( this, tr("Qt Application Example") ); +} diff --git a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.h b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.h new file mode 100644 index 00000000..2d372da9 --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.h @@ -0,0 +1,39 @@ +%{H_TEMPLATE} + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + +#include + +class QTextEdit; + +class %{APPNAME}: public QMainWindow +{ + Q_OBJECT + +public: + %{APPNAME}(); + ~%{APPNAME}(); + +protected: + void closeEvent( QCloseEvent* ); + +private slots: + void newDoc(); + void choose(); + void load( const QString &fileName ); + void save(); + void saveAs(); + void print(); + + void about(); + void aboutQt(); + +private: + QPrinter *printer; + QTextEdit *e; + QString filename; +}; + + +#endif diff --git a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.kdevtemplate b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.kdevtemplate new file mode 100644 index 00000000..ff69203c --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.kdevtemplate @@ -0,0 +1,126 @@ +# KDE Config File +[General] +Name=Qt3 Application +Name[br]=Meziant Qt3 +Name[ca]=Aplicació Qt3 +Name[da]=Qt3-Program +Name[de]=Qt3-Anwendung +Name[el]=Εφαρμογή Qt3 +Name[es]=Aplicación Qt3 +Name[et]=Qt3 rakendus +Name[fr]=Application Qt3 +Name[hu]=Qt3-alapú alkalmazások +Name[it]=Applicazione Qt3 +Name[ja]=Qt3 アプリケーション +Name[nds]=Qt3-Programm +Name[nl]=Qt3-toepassing +Name[pl]=Program Qt3 +Name[pt]=Aplicação do Qt3 +Name[pt_BR]=Aplicação do Qt3 +Name[ru]=Приложение Qt 3 +Name[sk]=Qt3 aplikácia +Name[sr]=Qt3 програм +Name[sr@Latn]=Qt3 program +Name[sv]=Qt3-program +Name[zh_TW]=Qt3 應用程式 +Icon=cmakeqt3app.png +Category=C++/CMake based projects +Comment=Generate a CMake based Qt3 application +Comment[ca]=Genera una aplicació Qt3 basada en CMake +Comment[da]=Opretter et CMake-baseret Qt3-program +Comment[de]=Erstellt eine auf CMake basierende Qt3-Anwendung +Comment[el]=Δημιουργία μιας εφαρμογής Qt3 με βάση το CMake +Comment[es]=Genera una aplicación Qt3 basada en CMake +Comment[et]=Qt3 rakenduse loomine CMake'i põhjal +Comment[fr]=Génère une application Qt3 basée sur CMake +Comment[hu]=Létrehoz egy CMake-alapú Qt3-alkalmazást +Comment[it]=Genera un'applicazione Qt3 basata su CMake +Comment[ja]=CMake ベースの Qt3 アプリケーションを作成 +Comment[nds]=Stellt en op CMake opbuut Qt3-Programm op +Comment[nl]=Genereer een CMake-gebaseerde Qt3-toepassing +Comment[pl]=Generuje program Qt3 używający CMake +Comment[pt]=Gera uma aplicação em Qt3 baseada no CMake +Comment[pt_BR]=Gera uma aplicação em Qt3 baseada no CMake +Comment[ru]=Создание основанного на CMake приложения Qt 3 +Comment[sk]=Vygeneruje Qt3 aplikáciu založenú na CMake +Comment[sr]=Прави Qt3 програм на основу CMake-а +Comment[sr@Latn]=Pravi Qt3 program na osnovu CMake-a +Comment[sv]=Skapar ett CMake-baserat Qt3-program +Comment[zh_TW]=產生使用 CMake 的 Qt3 應用程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=cmakeqt3app.tar.gz + +[FILE1] +Type=install +Source=%{src}/CMakeLists.txt +Dest=%{dest}/CMakeLists.txt + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE2] +Type=install +Source=%{src}/CMakeLists.txt.src +Dest=%{dest}/src/CMakeLists.txt + +[FILE3] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE4] +Type=install +Source=%{src}/cmakeqt3app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/cmakeqt3app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE6] +Type=install +Source=%{src}/fileopen.xpm +Dest=%{dest}/src/fileopen.xpm + +[FILE7] +Type=install +Source=%{src}/filesave.xpm +Dest=%{dest}/src/filesave.xpm + +[FILE8] +Type=install +Source=%{src}/fileprint.xpm +Dest=%{dest}/src/fileprint.xpm + +[CMAKE] +Type=finishcmd +Command=cmake ./ -GKDevelop3 +Directory=%{dest} + +[MSG] +Type=message +Comment=A CMake based Qt3 application was created in %{dest} +Comment[ca]=Una aplicació Qt3 basada en CMake ha estat creada en %{dest} +Comment[da]=Et CMake-baseret Qt3-program blev oprettet i %{dest} +Comment[de]=Eine auf CMake basierende Qt3-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή Qt3 βασισμένη στο Qmake δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación Qt3 basada en CMake ha sido creada en %{dest} +Comment[et]=Qt3 rakendus CMake'i põhjal loodi asukohta %{dest} +Comment[fr]=Une application Qt3 basée sur CMake a été créée dans %{dest} +Comment[hu]=Létrejött egy CMake-alapú Qt3-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Qt3 basata su CMake in %{dest} +Comment[ja]=CMake ベースの Qt3 アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op CMake opbuut Qt3-Programm opstellt +Comment[nl]=Een Cmake-gebaseerde Qt3-toepassing is aangemaakt in %{dest} +Comment[pl]=Program Qt3 oparty na CMake został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do Qt3 baseada no CMake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do Qt3 baseada no CMake em %{dest} +Comment[ru]=Использующее CMake приложение Qt 3 создано в %{dest} +Comment[sk]=Qt3 aplikácia založená na CMake bola vytvorená v %{dest} +Comment[sr]=Qt3 програм на основу CMake-а направљен је у %{dest} +Comment[sr@Latn]=Qt3 program na osnovu CMake-a napravljen je u %{dest} +Comment[sv]=Ett CMake-baserat Qt3-program skapades i %{dest} +Comment[zh_TW]=一個以 Cmake 為基礎的 Qt3 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.png b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.png new file mode 100644 index 00000000..dda0a10b Binary files /dev/null and b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.png differ diff --git a/languages/cpp/app_templates/cmakeqt3app/fileopen.xpm b/languages/cpp/app_templates/cmakeqt3app/fileopen.xpm new file mode 100644 index 00000000..880417ee --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/fileopen.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *fileopen[] = { +" 16 13 5 1", +". c #040404", +"# c #808304", +"a c None", +"b c #f3f704", +"c c #f3f7f3", +"aaaaaaaaa...aaaa", +"aaaaaaaa.aaa.a.a", +"aaaaaaaaaaaaa..a", +"a...aaaaaaaa...a", +".bcb.......aaaaa", +".cbcbcbcbc.aaaaa", +".bcbcbcbcb.aaaaa", +".cbcb...........", +".bcb.#########.a", +".cb.#########.aa", +".b.#########.aaa", +"..#########.aaaa", +"...........aaaaa" +}; diff --git a/languages/cpp/app_templates/cmakeqt3app/fileprint.xpm b/languages/cpp/app_templates/cmakeqt3app/fileprint.xpm new file mode 100644 index 00000000..6ada912f --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/fileprint.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static const char *fileprint[] = { +" 16 14 6 1", +". c #000000", +"# c #848284", +"a c #c6c3c6", +"b c #ffff00", +"c c #ffffff", +"d c None", +"ddddd.........dd", +"dddd.cccccccc.dd", +"dddd.c.....c.ddd", +"ddd.cccccccc.ddd", +"ddd.c.....c....d", +"dd.cccccccc.a.a.", +"d..........a.a..", +".aaaaaaaaaa.a.a.", +".............aa.", +".aaaaaa###aa.a.d", +".aaaaaabbbaa...d", +".............a.d", +"d.aaaaaaaaa.a.dd", +"dd...........ddd" +}; diff --git a/languages/cpp/app_templates/cmakeqt3app/filesave.xpm b/languages/cpp/app_templates/cmakeqt3app/filesave.xpm new file mode 100644 index 00000000..bd6870f4 --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/filesave.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *filesave[] = { +" 14 14 4 1", +". c #040404", +"# c #808304", +"a c #bfc2bf", +"b c None", +"..............", +".#.aaaaaaaa.a.", +".#.aaaaaaaa...", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".##........##.", +".############.", +".##.........#.", +".##......aa.#.", +".##......aa.#.", +".##......aa.#.", +"b............." +}; diff --git a/languages/cpp/app_templates/cmakeqt3app/main.cpp b/languages/cpp/app_templates/cmakeqt3app/main.cpp new file mode 100644 index 00000000..bd26f19a --- /dev/null +++ b/languages/cpp/app_templates/cmakeqt3app/main.cpp @@ -0,0 +1,13 @@ +%{CPP_TEMPLATE} + +#include +#include "%{APPNAMELC}.h" + +int main( int argc, char ** argv ) { + QApplication a( argc, argv ); + %{APPNAME} * mw = new %{APPNAME}(); + mw->setCaption( "%{APPNAME}" ); + mw->show(); + a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); + return a.exec(); +} diff --git a/languages/cpp/app_templates/cmakesimple/CMakeLists.txt b/languages/cpp/app_templates/cmakesimple/CMakeLists.txt new file mode 100644 index 00000000..c8087165 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimple/CMakeLists.txt @@ -0,0 +1,15 @@ + +PROJECT(%{APPNAMELC}) + +#if you don't want the full compiler output, remove the following line +SET(CMAKE_VERBOSE_MAKEFILE ON) + +#add definitions, compiler switches, etc. +ADD_DEFINITIONS(-Wall -O2) + +#list all source files here +ADD_EXECUTABLE(%{APPNAMELC} main.cpp) + +#need to link to some other libraries ? just add them here +#TARGET_LINK_LIBRARIES(%{APPNAMELC} png jpeg) + diff --git a/languages/cpp/app_templates/cmakesimple/Makefile.am b/languages/cpp/app_templates/cmakesimple/Makefile.am new file mode 100644 index 00000000..243ed01d --- /dev/null +++ b/languages/cpp/app_templates/cmakesimple/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.cpp cmakesimple.png CMakeLists.txt README +templateName = cmakesimple + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/cmakesimple/README b/languages/cpp/app_templates/cmakesimple/README new file mode 100644 index 00000000..1a96a1e8 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimple/README @@ -0,0 +1,30 @@ +----------------------------------------------- +Simple C++ Hello World template based on cmake +QStart +Author: Anne-Marie Mahfouf +Date: 2006-12-06 +----------------------------------------------- + +This README file explains you basic things for starting with +this application template. + +----------------------------------------------- +* REQUIREMENTS * +- Qt version might be 3.3.4 or 3.3.5 +- kdelibs 3.5 and kdelibs headers 3.5 (devel package) in order to build this template. +- cmake (http://www.cmake.org/) version 2.1 or 2.2 in your PATH +----------------------------------------------- + +----------------------------------------------- +* Building and running * +- cmake will run after the template is loaded provided cmake is in your PATH. If not, you will see an error message in the terminal +and you will need to install cmake in your PATH. +- In the Build menu in KDevelop, click on Build Project (or use the F8 shortcut) in order to build your project. +- Run your project using the Build menu -> Execute Program. Note that default makes your program run in KDevelop integrated terminal. You can run your program in an external terminal by changing the project options (Project -> Project Options -> Run options and check at the bottom "Start in external terminal") +----------------------------------------------- + +----------------------------------------------- +* Useful link * + +CMake Documentation: http://www.cmake.org/HTML/Documentation.html + diff --git a/languages/cpp/app_templates/cmakesimple/cmakesimple b/languages/cpp/app_templates/cmakesimple/cmakesimple new file mode 100644 index 00000000..a0793d8f --- /dev/null +++ b/languages/cpp/app_templates/cmakesimple/cmakesimple @@ -0,0 +1,7 @@ +# KDE Config File +[General] +Name=Hello world program +Icon=cmakesimple.png +Category=C++/CMake based projects +Comment=Generates a simple Hello world program in C++ using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +ShowFilesAfterGeneration=main.cpp diff --git a/languages/cpp/app_templates/cmakesimple/cmakesimple.kdevtemplate b/languages/cpp/app_templates/cmakesimple/cmakesimple.kdevtemplate new file mode 100644 index 00000000..2e6032e8 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimple/cmakesimple.kdevtemplate @@ -0,0 +1,112 @@ +# KDE Config File +[General] +Name=Hello world program +Name[ca]=Programa Hello world +Name[da]=Goddag verden program +Name[de]="Hello World"-Programm +Name[el]=Πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» +Name[et]="Tere,maailm" programm +Name[eu]="Kaixo mundua" programa +Name[fa]=برنامۀ Hello world +Name[fr]=Programme « Bonjour monde » +Name[ga]=Ríomhchlár "Hello world" +Name[gl]=Programa Ola mundo +Name[it]=Programma di "Hello world" +Name[ja]=Hello world プログラム +Name[nds]="Moin Welt"-Programm +Name[ne]=हेल्डो वोल्ड कार्यक्रम +Name[nl]=Hello World-programma +Name[pl]=Program 'Witaj świecie' +Name[pt]=Programa 'Olá mundo' +Name[pt_BR]=Programa 'Olá mundo' +Name[ru]=Программа Hello world +Name[sk]=Ahoj svet program +Name[sl]=Program Hello world +Name[sr]=Програм „Здраво свете“ +Name[sr@Latn]=Program „Zdravo svete“ +Name[sv]=Hello world-program +Name[tr]=Merhaba Dünya Programı +Name[zh_CN]=Hello world 程序 +Name[zh_TW]=Hello world 程式 +Icon=cmakesimple.png +Category=C++/CMake based projects +Comment=Generates a simple Hello world program in C++ using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 or cmake 2.2. +Comment[ca]=Genera un simple programa de Hello world en C++ usant l'eina de construcció CMake en comptes de la combinació automake/autoconf/libtool. Requereix cmake 2.1 o cmake 2.2. +Comment[da]=Genererer et simpelt Goddag verden program i C++ ved brug af CMake byggeværktøjet i stedet for automake/autoconf/libtool kombinationen. Det kræver cmake 2.1eller cmake 2.2. +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in C++. Der Kompiliervorgang wird mit CMake anstelle der Kombination automake/autoconf/libtool durchgeführt und erfordert CMake 2.1 (das über das CVS-Archiv von CMake verfügbar ist) oder die kommende Version 2.2 von CMake. +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα 'Γεια σου Κόσμε' σε C++, χρησιμοποιώντας το εργαλείο κατασκευής CMake αντί του συνδυασμού automake/autoconf/libtool. Χρειάζεται το cmake 2.1 ή το cmake 2.2. +Comment[es]=Genera un sencillo programa «Hola mundo» en C++ usando la herramienta CMake en lugar de la combinación automake/autoconf/libtool. Requiere cmake 2.1 o cmake 2.2. +Comment[et]=Lihtsa "Tere, maailm" programmi loomine C++-s. See kompileeritakse CMake'i ehitamistööriistaga, mitte automake/autoconf/libtool'i kombinatsiooniga. Selleks on vajalik CMake 2.1 või 2.2. +Comment[fr]=Génère un programme « Bonjour monde » simple en C++ à l'aide de l'outil de construction CMake au lieu de la combinaison automake / autoconf / libtool. Nécessite cmake 2.1 (disponible sur le CVS de CMake) ou cmake 2.2. +Comment[hu]=Létrehoz egy egyszerű 'Hello world' programot C++ nyelven a CMake segítségével (az automake/autoconf/libtool kombináció helyett). CMake 2.1 vagy 2.2 szükséges hozzá. +Comment[it]=Genera un semplice programma di "Hello world" in C++ che usa CMake invece della combinazione automake/autoconf/libtool. Si richiede cmake 2.1 o la versione 2.2. +Comment[ja]=ビルドに automake/autoconf/libtool ではなく CMake を使った簡単な Hello World プログラムを C++ で作成します。CMake 2.1 または 2.2 が必要です。 +Comment[nds]=Stellt en eenfach "Moin Welt"-Programm in C++ op, mit "CMake" ansteed vun de "automake/autoconf/libtool"-Reeg. Nödig is Verschoon 2.1 oder 2.2 vun CMake. +Comment[nl]=Genereert een eenvoudig Hello World-programma in C++ met behulp van de CMake build tool in plaats van de combinatie automake/autoconf/libtool. Het vereist cmake 2.1 of cmake 2.2. +Comment[pl]=Generuje prosty program 'Witaj świecie' w języku C++. Kompilacja odbywa sie za pomocą narzędzia CMake zamiast kombinacji automake/autoconf/libtool. Wymaga cmake w wersji 2.1 lub 2.2. +Comment[pt]=Gera um programa simples Olá Mundo em C++, com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 ou do cmake 2.2. +Comment[pt_BR]=Gera um programa simples Olá Mundo em C++, com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 ou do cmake 2.2. +Comment[ru]=Создание простого приложения Hello world на C++. Для сборки потребуется CMake вместо комбинации automake/autoconf/libtool. Потребуется cmake версии 2.1 или 2.2. +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v C++ s využitím nástroja CMake namiesto kombinácie automake/autoconf/libtool. Vyžaduje cmake 2.1 alebo cmake 2.2. +Comment[sr]=Прави једноставан „Здраво свете“ програм у C++-у користећи алат CMake уместо комбинације Automake/Autoconf/Libtool. Захтева CMake 2.1 или 2.2. +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u C++-u koristeći alat CMake umesto kombinacije Automake/Autoconf/Libtool. Zahteva CMake 2.1 ili 2.2. +Comment[sv]=Skapar ett enkelt Hello world-program i C++ med användning av byggverktyget CMake istället för kombinationen automake/autoconf/libtool. Det kräver cmake 2.1 eller cmake 2.2. +Comment[zh_TW]=它產生一個簡單的 C++ Hello world 程式。它要用 CMake 建立工具來編譯,而不是用 automake/autoconf/libtool 等。它需要 cmake 2.1 或是 2.2 版以上。 +#FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/main.cpp,%{dest}/README +Archive=cmakesimple.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/CMakeLists.txt +Dest=%{dest}/CMakeLists.txt + +[FILE2] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/main.cpp + +[FILE3] +Type=install +Source=%{src}/README +Dest=%{dest}/README + +[CMAKE] +Type=finishcmd +Command=cmake ./ -GKDevelop3 +Directory=%{dest} + +[MSG] +Type=message +Comment=A CMake based hello world program was created in %{dest} +Comment[ca]=Un programa de hello world basat en CMake ha estat creat en %{dest} +Comment[da]=Et CMake-baseret Goddag verden program blev oprettet i %{dest} +Comment[de]=Ein auf CMake basierendes "Hello World"-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα πρόγραμμα Γεια σου Κόσμε βασισμένο στο CMake δημιουργήθηκε στο %{dest} +Comment[es]=Un programa «Hola mundo» basado en CMake ha sido creado en %{dest} +Comment[et]="Tere, maailm" programm CMake'i põhjal loodi asukohta %{dest} +Comment[eu]=CMake-en oinarritutako "kaixo mundua" programa bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ Hello World بر مبنای CMake در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » basé sur CMake a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár "Hello World" bunaithe ar CMake i %{dest} +Comment[gl]=Creouse un programa Ola mundo baseado en CMake en %{dest} +Comment[hu]=Létrejött egy CMake-alapú Hello world program itt: %{dest} +Comment[it]=È stato creato un programma di "hello world" basato su CMake in %{dest} +Comment[ja]=CMake ベースの hello world プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op CMake opbuut "Moin Welt"-Programm opstellt +Comment[ne]=CMake आधारित हेल्लो वोल्ड कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een CMake-gebaseerd Hello World-programma is aangemaakt in %{dest} +Comment[pl]=Używający CMake program 'Witaj świecie' został utworzony w %{dest} +Comment[pt]=Foi criado um programa Olá Mundo baseado no CMake em %{dest} +Comment[pt_BR]=Foi criado um programa Olá Mundo baseado no CMake em %{dest} +Comment[ru]=Основанное на CMake приложение создано в %{dest} +Comment[sk]=Ahoj svet program založený na nástroji CMake bol vytvorený v %{dest} +Comment[sl]=Program hello world na osnovi CMake je bil ustvarjen v %{dest} +Comment[sr]=„Здраво свете“ на основу CMake-а направљен је у %{dest} +Comment[sr@Latn]=„Zdravo svete“ na osnovu CMake-a napravljen je u %{dest} +Comment[sv]=Ett CMake-baserat Hello world-program skapades i %{dest} +Comment[tr]=Bir CMake tabanlı Merhaba Dünya programı %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个基于 CMake 的 hello world 程序 +Comment[zh_TW]=以 CMake 為基礎的 hello world 程式已建立在 %{dest} diff --git a/languages/cpp/app_templates/cmakesimple/cmakesimple.png b/languages/cpp/app_templates/cmakesimple/cmakesimple.png new file mode 100644 index 00000000..d1a90c3a Binary files /dev/null and b/languages/cpp/app_templates/cmakesimple/cmakesimple.png differ diff --git a/languages/cpp/app_templates/cmakesimple/main.cpp b/languages/cpp/app_templates/cmakesimple/main.cpp new file mode 100644 index 00000000..296f9324 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimple/main.cpp @@ -0,0 +1,14 @@ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/cmakesimplec/CMakeLists.txt b/languages/cpp/app_templates/cmakesimplec/CMakeLists.txt new file mode 100644 index 00000000..812fc007 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimplec/CMakeLists.txt @@ -0,0 +1,14 @@ +PROJECT(%{APPNAMELC}) + +#if you don't want the full compiler output, remove the following line +SET(CMAKE_VERBOSE_MAKEFILE ON) + +#add definitions, compiler switches, etc. +ADD_DEFINITIONS(-Wall -O2) + +#list all source files here +ADD_EXECUTABLE(%{APPNAMELC} main.c) + +#need to link to some other libraries ? just add them here +#TARGET_LINK_LIBRARIES(%{APPNAMELC} png jpeg) + diff --git a/languages/cpp/app_templates/cmakesimplec/Makefile.am b/languages/cpp/app_templates/cmakesimplec/Makefile.am new file mode 100644 index 00000000..f5a1c3e7 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimplec/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.c cmakesimplec.png CMakeLists.txt +templateName = cmakesimplec + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/cmakesimplec/cmakesimplec b/languages/cpp/app_templates/cmakesimplec/cmakesimplec new file mode 100644 index 00000000..c0bc6fe2 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimplec/cmakesimplec @@ -0,0 +1,7 @@ +# KDE Config File +[General] +Name=Hello world program +Icon=cmakesimple.png +Category=C/CMake based projects +Comment=Generates a simple Hello world program in C using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +ShowFilesAfterGeneration=main.c diff --git a/languages/cpp/app_templates/cmakesimplec/cmakesimplec.kdevtemplate b/languages/cpp/app_templates/cmakesimplec/cmakesimplec.kdevtemplate new file mode 100644 index 00000000..3fc09047 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimplec/cmakesimplec.kdevtemplate @@ -0,0 +1,115 @@ +# KDE Config File +[General] +Name=Hello world program +Name[ca]=Programa Hello world +Name[da]=Goddag verden program +Name[de]="Hello World"-Programm +Name[el]=Πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» +Name[et]="Tere,maailm" programm +Name[eu]="Kaixo mundua" programa +Name[fa]=برنامۀ Hello world +Name[fr]=Programme « Bonjour monde » +Name[ga]=Ríomhchlár "Hello world" +Name[gl]=Programa Ola mundo +Name[it]=Programma di "Hello world" +Name[ja]=Hello world プログラム +Name[nds]="Moin Welt"-Programm +Name[ne]=हेल्डो वोल्ड कार्यक्रम +Name[nl]=Hello World-programma +Name[pl]=Program 'Witaj świecie' +Name[pt]=Programa 'Olá mundo' +Name[pt_BR]=Programa 'Olá mundo' +Name[ru]=Программа Hello world +Name[sk]=Ahoj svet program +Name[sl]=Program Hello world +Name[sr]=Програм „Здраво свете“ +Name[sr@Latn]=Program „Zdravo svete“ +Name[sv]=Hello world-program +Name[tr]=Merhaba Dünya Programı +Name[zh_CN]=Hello world 程序 +Name[zh_TW]=Hello world 程式 +Icon=cmakesimplec.png +Category=C/CMake based projects +Comment=Generates a simple Hello world program in C using the CMake build tool instead of the automake/autoconf/libtool combination. It requires cmake 2.1 (available from cmake cvs) or the upcoming cmake 2.2 release. +Comment[ca]=Genera un simple programa de Hello world en C usant l'eina de construcció CMake en comptes de la combinació automake/autoconf/libtool. Requereix cmake 2.1 (disponible en el cvs de cmake) o la propera versió 2.2. +Comment[da]=Genererer et simpelt Goddag verden program i C ved brug af CMake byggeværktøjet i stedet for automake/autoconf/libtool kombinationen. Det kræver cmake 2.1 (tilgængelig fra cmake cvs) eller den fremtidige cmake 2.2 udgivelse. +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in C. Der Kompiliervorgang wird mit CMake anstelle der Kombination automake/autoconf/libtool durchgeführt und erfordert CMake 2.1 (das über das CVS-Archiv von CMake verfügbar ist) oder die kommende Version 2.2 von CMake. +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα Γεια σου Κόσμε σε C, χρησιμοποιώντας το εργαλείο κατασκευής CMake στη θέση του συνδυασμού automake/autoconf/libtool. Χρειάζεται το cmake 2.1 (διαθέσιμο από το cmake cvs) ή την επερχόμενη έκδοση cmake 2.2. +Comment[es]=Genera un sencillo programa «Hola mundo» en C usando la herramienta CMake en lugar de la combinación automake/autoconf/libtool. Requiere cmake 2.1 (disponible en el cvs de cmake) o la próxima cmake 2.2. +Comment[et]=Lihtsa "Tere, maailm" programmi loomine C-s. See kompileeritakse CMake'i ehitamistööriistaga, mitte automake/autoconf/libtool'i kombinatsiooniga. Selleks on vajalik CMake 2.1 (saadaval CMake'i CVSis) või peatne CMake'i versioon 2.2. +Comment[eu]="Kaixo mundua" programa sinple bat sortzen du C lengoaian. CMake tresna erabiliz konpilatzen du automake/autoconf/libtool taldea erabili ordez. cmake 2.1 behar du (cmake cvs-an eskuragarri) edo hurrengo cmake 2.2. +Comment[fa]=یک برنامۀ سادۀ Hello world در سی تولید می‌کند. با استفاده از ابزار ساختن CMake به جای ترکیب automake/autoconf/libtool، ترجمه می‌کند.به cmake 2.1 دارد )از cmake cvs قابل دسترس است( یا نشر cmake 2.2 در آیندۀ نزدیک، نیاز دارد. +Comment[fr]=Génère un programme « Bonjour monde » simple en C à l'aide de l'outil de construction CMake au lieu de la combinaison automake / autoconf / libtool. Nécessite cmake 2.1 (disponible sur le CVS de CMake) ou la version 2.2 de CMake à venir. +Comment[ga]=Cruthaigh ríomhchlár simplí "Hello World" i C a thiomsaítear le huirlis tógála CMake in ionad automake/autoconf/libtool. Tá cmake 2.1 de dhíth (ar fáil ó cmake cvs) nó leagan 2.2 cmake atá le teacht. +Comment[gl]=Xera un program sinxelo Ola mundo en C usando a ferramenta de compilación CMake no lugar da combinación automake/autoconf/libtool. Require cmake 2.1 (dispoñíbel no cvs de cmake) ou a próxima versión cmake 2.2. +Comment[hu]=Létrehoz egy egyszerű Hello world programot C nyelven a CMake fordítóeszköz segítségével (az automake/autoconf/libtool kombináció helyett). CMake 2.1 (a CMake CVS-ben elérhető) vagy a rövidesen megjelenő CMake 2.2 szükséges hozzá. +Comment[it]=Genera un semplice programma di "Hello world" in C che usa CMake invece della combinazione automake/autoconf/libtool. Si richiede cmake 2.1 (disponibile dal CVS di cmake) o la versione a venire cmake 2.2. +Comment[ja]=ビルドに automake/autoconf/libtool ではなく CMake を使った簡単な Hello World プログラムを C で作成します。CMake 2.1 または 2.2 が必要です。 +Comment[nds]=Stellt en eenfach "Moin Welt"-Programm in C op mit "CMake" in de Verschoon 2.1 (ut dat cmake-CVS) oder 2.2 (de tokamen Utgaav) ansteed vun de "automake/autoconf/libtool"-Kombinatschoon. +Comment[ne]= automake/autoconf/libtool संयोजनको सट्टामा CMake निर्माण उपकरण प्रयोग गरेर C मा साधारण हेल्लो वोल्ड कार्यक्रम उत्पन्न गर्दछ । यसलाई cmake 2.1 (cmake cvs बाट उपलब्ध हुन्छ) वा आउदै गरेको cmake 2.2 उत्पादन आवश्यक हुन्छ । +Comment[nl]=Genereert een eenvoudig Hello World-programma in C met behulp van de CMake build tool in plaats van de combinatie automake/autoconf/libtool. Het vereist cmake 2.1 (uit het cvs van cmake) of de aankomende cmake 2.2-uitgave. +Comment[pl]=Generuje prosty program 'Witaj świecie' w języku C. Kompilacja odbywa sie za pomocą narzędzia CMake zamiast kombinacji automake/autoconf/libtool. Wymaga cmake 2.1 (dostępnego z cvs-u cmake) lub nadchodzącej wersji 2.2. +Comment[pt]=Gera um programa simples Olá Mundo em C, com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 (disponível no CVS do 'cmake') ou da próxima versão cmake 2.2. +Comment[pt_BR]=Gera um programa simples Olá Mundo em C, com a ferramenta CMake em vez da combinação automake/autoconf/libtool. Necessita do cmake 2.1 (disponível no CVS do 'cmake') ou da próxima versão cmake 2.2. +Comment[ru]=Создание простого приложения Hello world на C. Для сборки потребуется CMake вместо комбинации automake/autoconf/libtool. Потребуется cmake 2.1 (из CVS cmake) или релиз cmake 2.2. +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v C s využitím nástrojaCMake namiesto kombinácie automake/autoconf/libtool.Vyžaduje cmake 2.1 (dostupné v cmake cvs) alebo nadchádzajúci cmake 2.2 release. +Comment[sl]=Ustvari preprost program »Pozdravljen svet« v C. Za prevajanje se namesto kombinacije automake/autoconf/libtool uporabi orodje za gradnjo CMake. Potreben je CMake 2.1 ali CMake 2.2. +Comment[sr]=Прави једноставан „Здраво свете“ програм у C-у користећи алат CMake уместо комбинације Automake/Autoconf/Libtool. Захтева CMake 2.1 (доступан у CVS-у CMake-а) или надолазеће издање CMake 2.2. +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u C-u koristeći alat CMake umesto kombinacije Automake/Autoconf/Libtool. Zahteva CMake 2.1 (dostupan u CVS-u CMake-a) ili nadolazeće izdanje CMake 2.2. +Comment[sv]=Skapar ett enkelt Hello world-program i C med användning av byggverktyget CMake istället för kombinationen automake/autoconf/libtool. Det kräver cmake 2.1 (tillgängligt från cmake CVS-arkiv) eller den förestående utgåvan av cmake 2.2. +Comment[tr]=automake/autoconf/libtool birleşimi yerine CMake aracını kullanarak C'de basit bir Merhaba Dünya programı yaratır. cmake 2.1( cmake cvs'inden edinilebilir) veya yakında gelecek olan 2.2 sürümüne ihtiyaç duyar. +Comment[zh_CN]=生成一个 C 的 Hello world 程序。该程序使用 CMake 编译工具编译,而不是使用 automake/autoconf/libtool 的组合。该程序需要 cmake 2.1 (可从 cmake cvs 中获得)或即将发布的 cmake 2.2 版本。 +Comment[zh_TW]=它產生一個簡單的 C 的 Hello world 程式。它要用 CMake 建立工具來編譯,而不是用 automake/autoconf/libtool 等。它需要 cmake 2.1(可以從 cmake cvs 中取得),或是以後的版本。 +#FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/main.c +Archive=cmakesimplec.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/CMakeLists.txt +Dest=%{dest}/CMakeLists.txt + +[FILE2] +Type=install +Source=%{src}/main.c +Dest=%{dest}/main.c + +[CMAKE] +Type=finishcmd +Command=cmake ./ -GKDevelop3 +Directory=%{dest} + +[MSG] +Type=message +Comment=A CMake based hello world program was created in %{dest} +Comment[ca]=Un programa de hello world basat en CMake ha estat creat en %{dest} +Comment[da]=Et CMake-baseret Goddag verden program blev oprettet i %{dest} +Comment[de]=Ein auf CMake basierendes "Hello World"-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα πρόγραμμα Γεια σου Κόσμε βασισμένο στο CMake δημιουργήθηκε στο %{dest} +Comment[es]=Un programa «Hola mundo» basado en CMake ha sido creado en %{dest} +Comment[et]="Tere, maailm" programm CMake'i põhjal loodi asukohta %{dest} +Comment[eu]=CMake-en oinarritutako "kaixo mundua" programa bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ Hello World بر مبنای CMake در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » basé sur CMake a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár "Hello World" bunaithe ar CMake i %{dest} +Comment[gl]=Creouse un programa Ola mundo baseado en CMake en %{dest} +Comment[hu]=Létrejött egy CMake-alapú Hello world program itt: %{dest} +Comment[it]=È stato creato un programma di "hello world" basato su CMake in %{dest} +Comment[ja]=CMake ベースの hello world プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op CMake opbuut "Moin Welt"-Programm opstellt +Comment[ne]=CMake आधारित हेल्लो वोल्ड कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een CMake-gebaseerd Hello World-programma is aangemaakt in %{dest} +Comment[pl]=Używający CMake program 'Witaj świecie' został utworzony w %{dest} +Comment[pt]=Foi criado um programa Olá Mundo baseado no CMake em %{dest} +Comment[pt_BR]=Foi criado um programa Olá Mundo baseado no CMake em %{dest} +Comment[ru]=Основанное на CMake приложение создано в %{dest} +Comment[sk]=Ahoj svet program založený na nástroji CMake bol vytvorený v %{dest} +Comment[sl]=Program hello world na osnovi CMake je bil ustvarjen v %{dest} +Comment[sr]=„Здраво свете“ на основу CMake-а направљен је у %{dest} +Comment[sr@Latn]=„Zdravo svete“ na osnovu CMake-a napravljen je u %{dest} +Comment[sv]=Ett CMake-baserat Hello world-program skapades i %{dest} +Comment[tr]=Bir CMake tabanlı Merhaba Dünya programı %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个基于 CMake 的 hello world 程序 +Comment[zh_TW]=以 CMake 為基礎的 hello world 程式已建立在 %{dest} diff --git a/languages/cpp/app_templates/cmakesimplec/cmakesimplec.png b/languages/cpp/app_templates/cmakesimplec/cmakesimplec.png new file mode 100644 index 00000000..158d3ce7 Binary files /dev/null and b/languages/cpp/app_templates/cmakesimplec/cmakesimplec.png differ diff --git a/languages/cpp/app_templates/cmakesimplec/main.c b/languages/cpp/app_templates/cmakesimplec/main.c new file mode 100644 index 00000000..296f9324 --- /dev/null +++ b/languages/cpp/app_templates/cmakesimplec/main.c @@ -0,0 +1,14 @@ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/cpp.appwizard b/languages/cpp/app_templates/cpp.appwizard new file mode 100644 index 00000000..dc233269 --- /dev/null +++ b/languages/cpp/app_templates/cpp.appwizard @@ -0,0 +1,2 @@ +[General] +List=opiemenu,win32hello,cppcurseshello,gtk2mmapp,opienet,wxhello,cpphello,opietoday,clanlib,cppsdlhello,qmakeapp,qt4hello,qt4makeapp,cmakelibcpp,opieapp,qmakesimple,cmakesimple,generichello,opieapplet,qtopiaapp,gnome2mmapp,opieinput,win32gui,cmakeqt3app,qmakeempty,automakeempty,makefileempty,qtopia4app diff --git a/languages/cpp/app_templates/cppcurseshello/.kdev_ignore b/languages/cpp/app_templates/cppcurseshello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/cppcurseshello/Makefile.am b/languages/cpp/app_templates/cppcurseshello/Makefile.am new file mode 100644 index 00000000..3f6f64af --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = main.cpp src-Makefile.am cpp-Makefile.am cpp-Makefile.cvs\ + app-configure.in app.kdevelop +templateName = cppcurseshello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/cppcurseshello/app-configure.in b/languages/cpp/app_templates/cppcurseshello/app-configure.in new file mode 100644 index 00000000..b7c83189 --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/app-configure.in @@ -0,0 +1,21 @@ +AC_INIT() +AM_INIT_AUTOMAKE(%{APPNAMELC},%{VERSION}) + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MAKE_SET + + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +AC_CHECK_HEADER([ncurses.h], [], + AC_MSG_ERROR([Couldn't find ncurses headers.])) + +AC_CHECK_LIB(ncurses, refresh, , AC_ERROR([Couldn't find ncurses library]), -lncurses, -ldl) + +AC_LANG_RESTORE + + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/cppcurseshello/app.kdevelop b/languages/cpp/app_templates/cppcurseshello/app.kdevelop new file mode 100644 index 00000000..c7498e39 --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/app.kdevelop @@ -0,0 +1,105 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + true + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/cppcurseshello/cpp-Makefile.am b/languages/cpp/app_templates/cppcurseshello/cpp-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/cpp-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/cppcurseshello/cpp-Makefile.cvs b/languages/cpp/app_templates/cppcurseshello/cpp-Makefile.cvs new file mode 100644 index 00000000..935cee02 --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/cpp-Makefile.cvs @@ -0,0 +1,7 @@ +default: all + +all: + aclocal + automake + autoconf + diff --git a/languages/cpp/app_templates/cppcurseshello/cppcurseshello b/languages/cpp/app_templates/cppcurseshello/cppcurseshello new file mode 100644 index 00000000..40fa8bce --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/cppcurseshello @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=Simple ncurses Hello world program +Name[de]=Einfaches ncurses Hallo-Welt Programm +Icon= +Category=C++ +Comment=Generates a simple ncurses based Hello world program in C++ +Comment[de]=Erstellt ein einfaches Hallo Welt programm fr C++ basierend auf der ncurses Bibliothek +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/cppcurseshello/cppcurseshello.kdevtemplate b/languages/cpp/app_templates/cppcurseshello/cppcurseshello.kdevtemplate new file mode 100644 index 00000000..451999a3 --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/cppcurseshello.kdevtemplate @@ -0,0 +1,143 @@ +# KDE Config File +[General] +Name=Simple ncurses Hello world program +Name[ca]=Simple programa de Hello world per a ncurses +Name[da]=Simpelt ncurses Goddag verden program +Name[de]=Einfaches auf NCurses basierendes "Hello World"-Programm +Name[el]=Απλό ncurses πρόγραμμα Γεια σου κόσμε +Name[es]=Programa «Hola mundo» sencillo en ncurses +Name[et]=Lihtne "Tere, maailm" programm ncurses'i põhjal +Name[eu]=ncurses-en oinarritako "Kaixo mundua" programa sinple bat +Name[fa]=برنامۀ سادۀ ncurses Hello world +Name[fr]=Programme « Bonjour monde » simple en ncurses +Name[ga]=Ríomhchlár simplí "Hello World" le ncurses +Name[gl]=Programa sinxelo ncurses Ola mundo +Name[hu]=Egyszerű, Ncurses-alapú Hello world program +Name[it]=Semplice programma "Hello world" realizzato con ncurses +Name[ja]=ncurses を使った簡単な Hello World プログラム +Name[nds]=Eenfach ncurses-"Moin Welt"-Programm +Name[ne]=साधारण ncurses हेल्लो वोल्ड कार्यक्रम +Name[nl]=Een eenvoudig ncurses Hello World-programma +Name[pl]=Prosty program 'Witaj świecie' używający ncurses +Name[pt]=Programa simples Olá Mundo em ncurses +Name[pt_BR]=Programa simples Olá Mundo em ncurses +Name[ru]=Простое приложение Hello world на ncurses +Name[sk]=Jednoduchý "Ahoj svet" ncurses program +Name[sl]=Preprost program Hello world na osnovi ncurses +Name[sr]=Једноставан „Здраво свете“ програм за ncurses +Name[sr@Latn]=Jednostavan „Zdravo svete“ program za ncurses +Name[sv]=Enkelt ncurses Hello world-program +Name[tr]=Basit ncurses Merhaba Dünya programı +Name[zh_CN]=简单的 ncurses Hello world 程序 +Name[zh_TW]=簡單的 ncurses Hello world 程式 +Icon= +Category=C++ +Comment=Generates a simple ncurses based Hello world program in C++ +Comment[ca]=Genera un simple programa de Hello world en C++ i basat en ncurses +Comment[da]=Genererer et simpelt ncurses baseret Goddag verden program in C++ +Comment[de]=Erstellt ein einfaches, auf NCurses basierendes "Hello World"-Programm in C++ +Comment[el]=Δημιουργεί ένα απλό βασισμένο σε ncurses πρόγραμμα Γεια σου κόσμε σε C++ +Comment[es]=Genera un sencillo programa «Hola mundo» en C++ basado en ncurses +Comment[et]=Lihtsa "Tere, maailm" programmi loomine ncurses'i põhjal C++-s +Comment[eu]=ncurses-en oinarritako "Kaixo mundua" programa sinple bat C++ lengoaian +Comment[fa]=یک برنامۀ سادۀ Hello world در C++ بر مبنای ncurses تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple basé sur ncurses en C++ +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" bunaithe ar ncurses, i C++ +Comment[gl]=Xera un programa sinxelo Ola mundo baseado en ncurses en C++ +Comment[hu]=Létrehoz egy egyszerű, Ncurses-alapú Hello world programot C++-ban +Comment[it]=Genera un semplice programma di "Hello world" in C++ realizzato con ncurses +Comment[ja]=ncurses を使った簡単な Hello World プログラムを C++ で作成します +Comment[nds]=Stellt en eenfach op "ncurses" opbuut "Moin Welt"-Programm in C++ op +Comment[ne]=C++ मा हेल्लो वोल्ड कार्यक्रम आधारित साधारण ncurses उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudig ncurses-gebaseerd Hello World-programma in C++ +Comment[pl]=Generuje prosty program 'Witaj świecie' używający ncurses i języka C++. +Comment[pt]=Gera um programa simples Olá Mundo em C++, baseado no 'ncurses' +Comment[pt_BR]=Gera um programa simples Olá Mundo em C++, baseado no 'ncurses' +Comment[ru]=Создание простого приложения Hello world на ncurses и C++ +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" ncurses program v C++ +Comment[sl]=Ustvari preprost program Hello world na osnovi ncurses v C++ +Comment[sr]=Прави једноставан „Здраво свете“ програм на основу ncurses, у C++-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program na osnovu ncurses, u C++-u +Comment[sv]=Skapar ett enkelt ncurses-baserat Hello world-program i C++ +Comment[tr]=C++'da ncurses tabanlı basit bir Merhaba Dünya programı yaratır. +Comment[zh_CN]=生成一个基于 ncurses 的 C++ Hello world 程序 +Comment[zh_TW]=產生一個簡單的用 C++ 語言與 ncurses 函式庫的 Hello world 程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=cppcurseshello.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/cpp-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/cpp-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/app-configure.in +Dest=%{dest}/configure.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE6] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=A simple hello world program using ncurses was created in %{dest} +Comment[ca]=Un simple programa de hello world usant ncurses ha estat creat en %{dest} +Comment[da]=Et simpelt Goddag verden program ved brug af ncurses blev oprettet i %{dest} +Comment[de]=Ein einfaches "Hello World"-Programm unter Verwendung von NCurses wurde in %{dest} erstellt. +Comment[el]=Ένα απλό πρόγραμμα Γεια σου Κόσμε χρησιμοποιώντας το ncurses δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo programa «Hola mundo» que usa ncurses ha sido creado en %{dest} +Comment[et]=Lihtne "Tere, maailm" programm ncurses'i põhjas loodi asukohta %{dest} +Comment[eu]=ncurses-en oinarritako "Kaixo mundua" programa sinple bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ سادۀ hello world با استفاده از ncurses در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » simple utilisant ncurses a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár simplí "Hello World" le ncurses i %{dest} +Comment[gl]=Creouse un programa sinxelo ola mundo usando ncurses en in %{dest} +Comment[hu]=Létrejött egy egyszerű, Ncurses-alapú Hello world program itt: %{dest} +Comment[it]=È stato creato un programma di "hello world" che usa ncurses in %{dest} +Comment[ja]=ncurses を使った簡単な Hello World プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach "Moin Welt"-Programm opstellt, dat "ncurses" bruukt +Comment[ne]=ncurses प्रयोग गरेर एउटा हेल्लो वोल्ड कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudig Hallo Wereld-programma gebruikmakend van ncurses is aangemaakt in %{dest} +Comment[pl]=Prosty program 'Witaj świecie' używający ncurses został utworzony w %{dest} +Comment[pt]=Foi criado um programa simples Olá Mundo que usa o ncurses em %{dest} +Comment[pt_BR]=Foi criado um programa simples Olá Mundo que usa o ncurses em %{dest} +Comment[ru]=Простое приложение Hello world на ncurses создано в %{dest} +Comment[sk]=Jednoduchý "Ahoj svet" ncurses program bol vytvorený v %{dest} +Comment[sl]=Preprost program Hello world na osnovi ncurses je bil ustvarjen v %{dest} +Comment[sr]=Једноставан „Здраво свете“ на основу ncurses направљен је у %{dest} +Comment[sr@Latn]=Jednostavan „Zdravo svete“ na osnovu ncurses napravljen je u %{dest} +Comment[sv]=Ett enkelt Hello world-program som använder ncurses skapades i %{dest} +Comment[tr]=ncurses kullanan basit bir merhaba dünya programı %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了一个使用 ncurses 的 hello world 程序 +Comment[zh_TW]=一個簡單的使用 ncurses 函式庫的 hello world 程式已建立在 %{dest} diff --git a/languages/cpp/app_templates/cppcurseshello/cppcurseshello.png b/languages/cpp/app_templates/cppcurseshello/cppcurseshello.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/cppcurseshello/cppcurseshello.png differ diff --git a/languages/cpp/app_templates/cppcurseshello/main.cpp b/languages/cpp/app_templates/cppcurseshello/main.cpp new file mode 100644 index 00000000..3e23a5df --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/main.cpp @@ -0,0 +1,49 @@ +%{CPP_TEMPLATE} + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +void create_box(int y, int x, int w, int h) +{ + mvaddch(y, x, '+'); + mvaddch(y, x + w, '+'); + mvaddch(y + h, x, '+'); + mvaddch(y + h, x + w, '+'); + mvhline(y, x + 1, '-', w - 1); + mvhline(y + h, x + 1, '-', w - 1); + mvvline(y + 1, x, '|', h - 1); + mvvline(y + 1, x + w, '|', h - 1); +} + +int main() +{ + int startx, starty, height, width; + + initscr(); + start_color(); + cbreak(); + keypad(stdscr, TRUE); + noecho(); + + init_pair(1, COLOR_BLACK, COLOR_CYAN); + + height = 2; + width = 30; + starty = (LINES - height)/2; + startx = (COLS - width)/2; + + attron(COLOR_PAIR(1)); + + create_box(starty, startx, width, height); + mvprintw(starty, startx + 3, " Hello World! " ); + mvprintw(starty+1,startx+1," Type any char to exit "); + mvprintw(0,0,""); + refresh(); + getch(); + + endwin(); + return 0; +} diff --git a/languages/cpp/app_templates/cppcurseshello/src-Makefile.am b/languages/cpp/app_templates/cppcurseshello/src-Makefile.am new file mode 100644 index 00000000..23de27fb --- /dev/null +++ b/languages/cpp/app_templates/cppcurseshello/src-Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) diff --git a/languages/cpp/app_templates/cpphello/.kdev_ignore b/languages/cpp/app_templates/cpphello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/cpphello/Makefile.am b/languages/cpp/app_templates/cpphello/Makefile.am new file mode 100644 index 00000000..49bd1b67 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = main.cpp src-Makefile.am cpp-Makefile.am cpp-Makefile.cvs \ + configure.in cpphello.png app.kdevelop +templateName = cpphello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/cpphello/app.kdevelop b/languages/cpp/app_templates/cpphello/app.kdevelop new file mode 100644 index 00000000..c7498e39 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/app.kdevelop @@ -0,0 +1,105 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + true + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/cpphello/configure.in b/languages/cpp/app_templates/cpphello/configure.in new file mode 100644 index 00000000..612ce0d5 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/cpphello/cpp-Makefile.am b/languages/cpp/app_templates/cpphello/cpp-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/cpp-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/cpphello/cpp-Makefile.cvs b/languages/cpp/app_templates/cpphello/cpp-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/cpp-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/cpphello/cpphello.kdevtemplate b/languages/cpp/app_templates/cpphello/cpphello.kdevtemplate new file mode 100644 index 00000000..0b5b9367 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/cpphello.kdevtemplate @@ -0,0 +1,145 @@ +# KDE Config File +[General] +Name=Simple Hello world program +Name[ca]=Simple programa Hello world +Name[da]=Simpelt Goddag verden program +Name[de]=Ein einfaches "Hello World"-Programm +Name[el]=Απλό πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» sencillo +Name[et]=Lihtne "Tere, maailm" programm +Name[eu]="Kaixo mundua" programa sinplea +Name[fa]=برنامۀ سادۀ Hello world +Name[fr]=Programme « Bonjour monde » simple +Name[ga]=Ríomhchlár simplí "Hello World" +Name[gl]=Programa sinxelo Ola mundo +Name[hu]=Egyszerű Hello world program +Name[it]=Semplice programma di "Hello world" +Name[ja]=簡単な Hello world プログラム +Name[ms]=Program Hello World mudah +Name[nds]=En eenfach "Moin Welt"-Programm +Name[ne]=साधारण हेल्लो वोल्ड कार्यक्रम +Name[nl]=Eenvoudig 'Hello World' programma +Name[pl]=Prosty program witaj świecie +Name[pt]=Programa simples Olá Mundo +Name[pt_BR]=Programa simples Olá Mundo +Name[ru]=Простая программа Hello world +Name[sk]=Jednoduchý "Ahoj svet" program +Name[sl]=Preprost program Hello world +Name[sr]=Једноставан „Здраво свете“ програм +Name[sr@Latn]=Jednostavan „Zdravo svete“ program +Name[sv]=Enkelt Hello world-program +Name[tr]=Basit Merhaba dünya programı +Name[zh_CN]=简单的 Hello world 程序 +Name[zh_TW]=簡單的 Hello world 程式 +Icon=cpphello.png +Category=C++ +Comment=Generates a simple Hello world program in C++ +Comment[ca]=Genera un simple programa de Hello world en C++ +Comment[da]=Genererer et simpelt Goddag verden program in C++ +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in C++ +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα Γεια σου Κόσμε σε C++ +Comment[es]=Genera un sencillo programa «Hola mundo» en C++ +Comment[et]=Lihtsa "Tere, maailm" programmi loomine C++-s +Comment[eu]="Kaixo mundua" programa sinple bat sortzen du C++ lengoaian +Comment[fa]=یک برنامۀ سادۀ Hello world در C++ تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en C++ +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" i C++ +Comment[gl]=Xera un programa sinxelo Ola mundo en C++ +Comment[hu]=Létrehoz egy egyszerű Hello world programot C++-ban +Comment[it]=Genera un semplice programma di "Hello world" in C++ +Comment[ja]=簡単な Hello World プログラムを C++ で作成します +Comment[nds]=Stellt en eenfach "Moin Welt"-Programm in C++ op +Comment[ne]=C++ मा एउटा साधारण हेल्लो वोल्ड कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudig Hello World-programma in C++ +Comment[pl]=Generuje prosty program 'Witaj świecie' w języku C++ +Comment[pt]=Gera um programa simples Olá Mundo em C++ +Comment[pt_BR]=Gera um programa simples Olá Mundo em C++ +Comment[ru]=Создание простого приложения Hello world на C++ +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v C++ +Comment[sl]=Ustvari preprost program Hello world v C++ +Comment[sr]=Прави једноставан „Здраво свете“ програм у C++-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u C++-u +Comment[sv]=Skapar ett enkelt Hello world-program i C++ +Comment[tr]=C++'da basit bir Merhaba Dünya programı yaratır. +Comment[zh_CN]=生成 C++ 的 Hello world 程序 +Comment[zh_TW]=產生一個簡單的 C++ 的 Hello world 程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=cpphello.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/cpp-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/cpp-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE6] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=A Simple Hello World program was created in %{dest} +Comment[ca]=Un simple programa de Hello World ha estat creat en %{dest} +Comment[da]=Et simpelt Goddag verden program blev oprettet i %{dest} +Comment[de]=Ein einfaches "Hello World"-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα απλό πρόγραμμα Γεια σου Κόσμε δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo programa «Hola mundo» ha sido creado en %{dest} +Comment[et]=Lihtne "Tere, maailm" programm loodi asukohta %{dest} +Comment[eu]="Kaixo mundua" programa sinple bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ سادۀ Hello World در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár simplí "Hello World" i %{dest} +Comment[gl]=Creouse un programa sinxelo Ola mundo en %{dest} +Comment[hu]=Létrejött egy egyszerű Hello world program itt: %{dest} +Comment[it]=È stato creato un semplice programma di "Hello World" in %{dest} +Comment[ja]=簡単な Hello World プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach "Moin Welt"-Programm opstellt +Comment[ne]=एउटा साधारण हेल्लो वोल्ड कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudig Hello World-programma is aangemaakt in %{dest} +Comment[pl]=Prosty program 'Witaj świecie' został utworzony w %{dest} +Comment[pt]=Foi criado um programa simples Olá Mundo em %{dest} +Comment[pt_BR]=Foi criado um programa simples Olá Mundo em %{dest} +Comment[ru]=Простое приложение Hello world на C++ создано в %{dest} +Comment[sk]=Jednoduchý "Ahoj svet" program bol vytvorený v %{dest} +Comment[sl]=Preprost program Hello World je bil ustvarjen v %{dest} +Comment[sr]=Једноставан „Здраво свете“ програм направљен је у %{dest} +Comment[sr@Latn]=Jednostavan „Zdravo svete“ program napravljen je u %{dest} +Comment[sv]=Ett enkelt Hello world-program skapades i %{dest} +Comment[tr]=Basit bir Merhaba Dünya programı %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了 Hello world 程序 +Comment[zh_TW]=一個簡單的 Hello World 程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/cpphello/cpphello.png b/languages/cpp/app_templates/cpphello/cpphello.png new file mode 100644 index 00000000..519c007b Binary files /dev/null and b/languages/cpp/app_templates/cpphello/cpphello.png differ diff --git a/languages/cpp/app_templates/cpphello/main.cpp b/languages/cpp/app_templates/cpphello/main.cpp new file mode 100644 index 00000000..f97c8417 --- /dev/null +++ b/languages/cpp/app_templates/cpphello/main.cpp @@ -0,0 +1,17 @@ +%{CPP_TEMPLATE} + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +using namespace std; + +int main(int argc, char *argv[]) +{ + cout << "Hello, world!" << endl; + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/cpphello/src-Makefile.am b/languages/cpp/app_templates/cpphello/src-Makefile.am new file mode 100644 index 00000000..23de27fb --- /dev/null +++ b/languages/cpp/app_templates/cpphello/src-Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) diff --git a/languages/cpp/app_templates/cppsdlhello/.kdev_ignore b/languages/cpp/app_templates/cppsdlhello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/cppsdlhello/Makefile.am b/languages/cpp/app_templates/cppsdlhello/Makefile.am new file mode 100644 index 00000000..e17785a4 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.cpp src-Makefile.am cpp-Makefile.am cpp-Makefile.cvs configure.in cppsdlhello.png app.kdevelop acinclude.m4 +templateName = cppsdlhello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/cppsdlhello/README b/languages/cpp/app_templates/cppsdlhello/README new file mode 100644 index 00000000..bc4e1d15 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/README @@ -0,0 +1,11 @@ +This template configures KDevelop to be used with libSDL + +Got it working using this tutorial: +http://www.geekcomix.com/snh/files/docs/sdl-kdev/sdl-kdev-mini-how2.html +and not to forget -lSDL has to get passed to ld :) + +This was submitted via a whishlist: +http://bugs.kde.org/show_bug.cgi?id=53702 + +Thanks to: Mrten Woxberg < marwo264 (at) student.liu.se > +For supplying this template. diff --git a/languages/cpp/app_templates/cppsdlhello/acinclude.m4 b/languages/cpp/app_templates/cppsdlhello/acinclude.m4 new file mode 100644 index 00000000..9681a33a --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/acinclude.m4 @@ -0,0 +1,167 @@ +# Configure paths for SDLmm +# David Hedbor, 2000-07-22 +# stolen from SDL +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDLMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDLmm, and define SDLMM_CXXFLAGS and SDLMM_LIBS +dnl +AC_DEFUN(AM_PATH_SDLMM, +[dnl +dnl Get the cflags and libraries from the ismap-config script +dnl +AC_ARG_WITH(sdlmm-prefix,[ --with-sdlmm-prefix=PFX Prefix where SDLmm is installed (optional)], + sdlmm_prefix="$withval", sdlmm_prefix="") +AC_ARG_WITH(sdlmm-exec-prefix,[ --with-sdlmm-exec-prefix=PFX Exec prefix where SDLmm is installed (optional)], + sdlmm_exec_prefix="$withval", sdlmm_exec_prefix="") +AC_ARG_ENABLE(sdlmmtest, [ --disable-sdlmmtest Do not try to compile and run a test SDLmm program], + , enable_sdlmmtest=yes) + + if test x$sdlmm_exec_prefix != x ; then + sdlmm_args="$sdlmm_args --exec-prefix=$sdlmm_exec_prefix" + if test x${SDLMM_CONFIG+set} != xset ; then + SDLMM_CONFIG=$sdlmm_exec_prefix/bin/sdlmm-config + fi + fi + if test x$sdlmm_prefix != x ; then + sdlmm_args="$sdlmm_args --prefix=$sdlmm_prefix" + if test x${SDLMM_CONFIG+set} != xset ; then + SDLMM_CONFIG=$sdlmm_prefix/bin/sdlmm-config + fi + fi + + AC_PATH_PROG(SDLMM_CONFIG, sdlmm-config, no) + min_sdlmm_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDLmm version >= $min_sdlmm_version) + no_sdlmm="" + if test "$SDLMM_CONFIG" = "no" ; then + no_sdlmm=yes + else + SDLMM_CXXFLAGS=`$SDLMM_CONFIG $sdlmmconf_args --cflags` + SDLMM_LIBS=`$SDLMM_CONFIG $sdlmmconf_args --libs` + + sdlmm_major_version=`$SDLMM_CONFIG $sdlmm_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdlmm_minor_version=`$SDLMM_CONFIG $sdlmm_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdlmm_micro_version=`$SDLMM_CONFIG $sdlmm_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdlmmtest" = "xyes" ; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CXXFLAGS="$CXXFLAGS $SDLMM_CXXFLAGS" + LIBS="$LIBS $SDLMM_LIBS" +dnl +dnl Now check if the installed SDLmm is sufficiently new. (Also sanity +dnl checks the results of sdlmm-config to some extent +dnl + rm -f conf.sdlmmtest + AC_TRY_RUN([ +#include +#include +#include "SDLmm/sdlmm.h" +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((std::strlen (str) + 1) * sizeof(char)); + std::strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdlmmtest"); + */ + { FILE *fp = fopen("conf.sdlmmtest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdlmm_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdlmm_version"); + return 1; + } + + if (($sdlmm_major_version > major) || + (($sdlmm_major_version == major) && ($sdlmm_minor_version > minor)) || + (($sdlmm_major_version == major) && ($sdlmm_minor_version == minor) && ($sdlmm_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdlmm-config --version' returned %d.%d.%d, but the minimum version\n", $sdlmm_major_version, $sdlmm_minor_version, $sdlmm_micro_version); + printf("*** of SDLmm required is %d.%d.%d. If sdlmm-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdlmm-config was wrong, set the environment variable SDLMM_CONFIG\n"); + printf("*** to point to the correct copy of sdlmm-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdlmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdlmm" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDLMM_CONFIG" = "no" ; then + echo "*** The sdlmm-config script installed by SDLmm could not be found" + echo "*** If SDLmm was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDLMM_CONFIG environment variable to the" + echo "*** full path to sdlmm-config." + else + if test -f conf.sdlmmtest ; then + : + else + echo "*** Could not run SDLmm test program, checking why..." + CXXFLAGS="$CXXFLAGS $SDLMM_CXXFLAGS" + LIBS="$LIBS $SDLMM_LIBS" + AC_TRY_LINK([ +#include +#include "sdlmm.h" +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDLmm or finding the wrong" + echo "*** version of SDLmm. If it is not finding SDLmm, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDLmm was incorrectly installed" + echo "*** or that you have moved SDLmm since it was installed. In the latter case, you" + echo "*** may want to edit the sdlmm-config script: $SDLMM_CONFIG" ]) + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDLMM_CXXFLAGS="" + SDLMM_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDLMM_CXXFLAGS) + AC_SUBST(SDLMM_LIBS) + rm -f conf.sdlmmtest +]) diff --git a/languages/cpp/app_templates/cppsdlhello/app.kdevelop b/languages/cpp/app_templates/cppsdlhello/app.kdevelop new file mode 100644 index 00000000..fadfbadc --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/app.kdevelop @@ -0,0 +1,103 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + SDL + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + true + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + -lSDL + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/cppsdlhello/configure.in b/languages/cpp/app_templates/cppsdlhello/configure.in new file mode 100644 index 00000000..440c2e44 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/configure.in @@ -0,0 +1,90 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + +dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, +dnl if-not-found, test-parameter) +AC_DEFUN(KDE_FIND_PATH, +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + dirs="$3" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +KDE_FIND_PATH(sdl-config, LIBSDL_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find libsdl anywhere, check http://www.sdl.org]) +]) + +if test -n "$LIBSDL_CONFIG"; then + LIBSDL_LIBS="`$LIBSDL_CONFIG --libs`" + LIBSDL_RPATH= + for args in $LIBSDL_LIBS; do + case $args in + -L*) + LIBSDL_RPATH="$LIBSDL_RPATH $args" + ;; + esac + done + LIBSDL_RPATH=`echo $LIBSDL_RPATH | sed -e "s/-L/-R/g"` + LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`" + + AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 1, [Defines if your system has the LIBSDL library]) +fi + + +AC_SUBST(LIBSDL_LIBS) +AC_SUBST(LIBSDL_CFLAGS) +AC_SUBST(LIBSDL_RPATH) + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/cppsdlhello/cpp-Makefile.am b/languages/cpp/app_templates/cppsdlhello/cpp-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/cpp-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/cppsdlhello/cpp-Makefile.cvs b/languages/cpp/app_templates/cppsdlhello/cpp-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/cpp-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/cppsdlhello/cppsdlhello b/languages/cpp/app_templates/cppsdlhello/cppsdlhello new file mode 100644 index 00000000..fd64358b --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/cppsdlhello @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=Simple SDL program +Name[fr]=Un simple programme avec SDL +Icon=cppsdl.png +Category=C++ +Comment=Generates a simple SDL program in C++ +Comment[fr]=Gnre un simple programme de test avec la bibliothque SDL dans le language C++. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/cppsdlhello/cppsdlhello.kdevtemplate b/languages/cpp/app_templates/cppsdlhello/cppsdlhello.kdevtemplate new file mode 100644 index 00000000..ec4e94b3 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/cppsdlhello.kdevtemplate @@ -0,0 +1,150 @@ +# KDE Config File +[General] +Name=Simple SDL program +Name[ca]=Simple programa per a SDL +Name[da]=Simpelt SDL-program +Name[de]=Einfaches SDL-Programm +Name[el]=Απλό πρόγραμμα SDL +Name[es]=Programa SDL sencillo +Name[et]=Lihtne SDL programm +Name[eu]=SDL programa sinplea +Name[fa]=برنامۀ سادۀ SDL +Name[fr]=Programme SDL simple +Name[ga]=Ríomhchlár simplí SDL +Name[gl]=Programa sinxelo SDL +Name[hu]=Egyszerű SDL-alkalmazás +Name[it]=Semplice programma SDL +Name[ja]=簡単な SDL プログラム +Name[nds]=Eenfach SDL-Programm +Name[ne]=साधारण SDL कार्यक्रम +Name[nl]=Eenvoudig SDL-programma +Name[pl]=Prosty program używający SDL +Name[pt]=Programa simples do SDL +Name[pt_BR]=Programa simples do SDL +Name[ru]=Простое приложение SDL +Name[sk]=Jednoduchý SDL program +Name[sl]=Preprost program SDL +Name[sr]=Једноставан SDL програм +Name[sr@Latn]=Jednostavan SDL program +Name[sv]=Enkelt SDL-program +Name[tg]=Барноманависии SDL +Name[tr]=Basit bir SDL Programı +Name[zh_CN]=简单的 SDL 程序 +Name[zh_TW]=簡單的 SDL 程式 +Icon=cppsdl.png +Category=C++ +Comment=Generates a simple SDL program in C++ +Comment[ca]=Genera un simple programa en SDL en C++ +Comment[da]=Genererer et simpelt SDL program i C++ +Comment[de]=Erstellt ein einfaches SDL-Programm in C++ +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα SDL σε C++ +Comment[es]=Genera un sencillo programa SDL en C++ +Comment[et]=Lihtsa SDL programmi loomise C++-s +Comment[eu]=SDL programa sinple bat sortzen du C++ lengoaian +Comment[fa]=یک برنامۀ سادۀ SDL در C++ تولید می‌کند +Comment[fr]=Génère un programme SDL simple en C++ +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí SDL i C++ +Comment[gl]=Xera un programa sinxelo SDL en C++ +Comment[hu]=Létrehoz egy egyszerű SDL-alkalmazást C++-ban +Comment[it]=Genera un semplice programma SDL in C++ +Comment[ja]=簡単な SDL プログラムを C++ で作成します +Comment[nds]=Stellt en eenfach SDL-Programm in C++ op +Comment[ne]= C++ मा साधारण SDL कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudig SDL-programma in C++ +Comment[pl]=Generuje prosty program używający SDL w C++ +Comment[pt]=Gera um programa simples de SDL em C++ +Comment[pt_BR]=Gera um programa simples de SDL em C++ +Comment[ru]=Создание простого приложения SDL на C++ +Comment[sk]=Vygeneruje jednoduchý SDL program v C++ +Comment[sl]=Ustvari preprost program SDL v C++ +Comment[sr]=Прави једноставан SDL програм у C++-у +Comment[sr@Latn]=Pravi jednostavan SDL program u C++-u +Comment[sv]=Skapar ett enkelt SDL-program i C++ +Comment[tr]=C++'da basit bir SDL programı yaratır +Comment[zh_CN]=生成 C++ 的简单 SDL 程序 +Comment[zh_TW]=產生一個簡單的 C++ SDL 程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=cppsdlhello.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/cpp-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/cpp-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[FILE5] +Type=install +Source=%{src}/acinclude.m4 +Dest=%{dest}/acinclude.m4 + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE7] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + + +[MSG] +Type=message +Comment=A simple SDL program was created in %{dest} +Comment[ca]=Un simple programa en SDL ha estat creat en %{dest} +Comment[da]=Et simpelt SDL-program blev oprettet i %{dest} +Comment[de]=Ein einfaches SDL-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα απλό πρόγραμμα SDL δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo programa SDL ha sido creado en %{dest} +Comment[et]=Lihtne SDL programm loodi asukohta %{dest} +Comment[eu]=SDL programa sinple bat soru da hemen: %{dest} +Comment[fa]=یک برنامۀ سادۀ SDL در %{dest} ایجاد شد +Comment[fr]=Un programme SDL simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár simplí SDL i %{dest} +Comment[gl]=Creouse un programa sinxelo SDL en %{dest} +Comment[hu]=Létrejött egy egyszerű SDL-alkalmazás itt: %{dest} +Comment[it]=È stato creato un semplice programma SDL in %{dest} +Comment[ja]=簡単な SDL プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach SDL-Programm opstellt +Comment[ne]=एउटा साधारण SDL कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudig SDL-programma is aangemaakt in %{dest} +Comment[pl]=Prosty program używający SDL został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação simples em SDL em %{dest} +Comment[pt_BR]=Foi criada uma aplicação simples em SDL em %{dest} +Comment[ru]=Простое приложение SDL создано в %{dest} +Comment[sk]=Jednoduchý SDL program bol vytvorený v %{dest} +Comment[sl]=Preprost program SDL je bil ustvarjen v %{dest} +Comment[sr]=Једноставан SDL програм направљен је у %{dest} +Comment[sr@Latn]=Jednostavan SDL program napravljen je u %{dest} +Comment[sv]=Ett enkelt SDL-program skapades i %{dest} +Comment[tr]=Basit bir SDL programı %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了简单的 SDL 程序 +Comment[zh_TW]=一個簡單的 SDL 程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/cppsdlhello/cppsdlhello.png b/languages/cpp/app_templates/cppsdlhello/cppsdlhello.png new file mode 100644 index 00000000..888d4f13 Binary files /dev/null and b/languages/cpp/app_templates/cppsdlhello/cppsdlhello.png differ diff --git a/languages/cpp/app_templates/cppsdlhello/main.cpp b/languages/cpp/app_templates/cppsdlhello/main.cpp new file mode 100644 index 00000000..89e3ba30 --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/main.cpp @@ -0,0 +1,29 @@ +%{CPP_TEMPLATE} + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "SDL.h" + +using namespace std; + +int main(int argc, char *argv[]) +{ + cout <<"Initializing SDL." << endl; + /* Initializes Audio and the CDROM, add SDL_INIT_VIDEO for Video */ + if(SDL_Init(SDL_INIT_AUDIO | SDL_INIT_CDROM)< 0) { + cout <<"Could not initialize SDL:" << SDL_GetError() << endl; + SDL_Quit(); + } else { + cout << "Audio & CDROM initialized correctly" << endl;; + /* Trying to read number of CD devices on system */ + cout << "Drives available :" << SDL_CDNumDrives() << endl; + for(int i=0; i < SDL_CDNumDrives(); ++i) { + cout << "Drive " << i << "\"" << SDL_CDName(i) << "\""; + } + } + SDL_Quit(); +} diff --git a/languages/cpp/app_templates/cppsdlhello/src-Makefile.am b/languages/cpp/app_templates/cppsdlhello/src-Makefile.am new file mode 100644 index 00000000..3f9fd8bf --- /dev/null +++ b/languages/cpp/app_templates/cppsdlhello/src-Makefile.am @@ -0,0 +1,9 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp + +# set the include path found by configure +AM_CPPFLAGS = $(LIBSDL_CFLAGS) $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) +%{APPNAMELC}_LDADD = $(LIBSDL_LIBS) diff --git a/languages/cpp/app_templates/dcopservice/.kdev_ignore b/languages/cpp/app_templates/dcopservice/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/dcopservice/Makefile.am b/languages/cpp/app_templates/dcopservice/Makefile.am new file mode 100644 index 00000000..00875115 --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = dcopservice.desktop dcopservice.png dcopservice.h \ + src-Makefile.am main.cpp dcopservice.cpp dcopservice.kdevelop \ + subdirs +templateName = dcopservice + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/dcopservice/dcopservice b/languages/cpp/app_templates/dcopservice/dcopservice new file mode 100644 index 00000000..ff62f5ab --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/dcopservice @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=KDE DCOP Service +Name[fr]=Un service DCOP pour KDE +Icon=kdcop.png +Category=C++/KDE +Comment=Generates a framework for a KDE dcop service and client access library. +Comment[fr]=Gnre un squelette de programme pour la gestion d'un service DCOP pour KDE et un programme d'accs au bibliothque. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/dcopservice/dcopservice.cpp b/languages/cpp/app_templates/dcopservice/dcopservice.cpp new file mode 100644 index 00000000..a23da01b --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/dcopservice.cpp @@ -0,0 +1,49 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include + +%{APPNAME}::%{APPNAME}() : DCOPObject("serviceInterface") +{ + kdDebug() << "Starting new service... " << endl; + m_List = QStringList(); +} + +%{APPNAME}::~%{APPNAME}() +{ + kdDebug() << "Going away... " << endl; +} + +QString %{APPNAME}::string(int idx) +{ + return *m_List.at(idx); +} + +QStringList %{APPNAME}::list() +{ + return m_List; +} + +void %{APPNAME}::add(QString arg) +{ + kdDebug() << "Adding " << arg << " to the list" << endl; + m_List << arg; +} + +bool %{APPNAME}::remove(QString arg) +{ + QStringList::Iterator it = m_List.find(arg); + if (it != m_List.end()) + { + m_List.remove(it); + } + else + return false; + return true; +} + +bool %{APPNAME}::exit() +{ + kapp->quit(); +} diff --git a/languages/cpp/app_templates/dcopservice/dcopservice.desktop b/languages/cpp/app_templates/dcopservice/dcopservice.desktop new file mode 100644 index 00000000..2ee5220f --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/dcopservice.desktop @@ -0,0 +1,43 @@ +[Desktop Entry] +Type=Service +Name=%{APPNAME} +Exec=%{APPNAMELC} +X-DCOP-ServiceType=Unique +X-KDE-StartupNotify=false +Comment=Template for dcop services +Comment[br]=Patrom evit servijoù dcop +Comment[ca]=Plantilla per als serveis dcop +Comment[cy]=Patrymlun ar gyfer gwasanaethau dcop +Comment[da]=Skabelon for DCOP-tjenester +Comment[de]=Vorlage für DCOP-Dienste +Comment[el]=Πρότυπο για υπηρεσίες dcop +Comment[es]=Plantilla para servicios DCOP +Comment[et]=DCOP-teenuste mall +Comment[eu]=DCOP zerbitzuentzako plantilla +Comment[fa]=قالب برای خدمات dcop +Comment[fr]=Modèle pour les services DCOP +Comment[ga]=Teimpléad i gcomhair seirbhísí DCOP +Comment[gl]=Modelo para servizos dcop +Comment[hi]=डीसीओपी सेवाओं के लिए टेम्प्लेट +Comment[hu]=Sablon DCOP-szolgáltatásokhoz +Comment[is]=Snið fyrir dcop þjónustur +Comment[it]=Modello per servizi dcop +Comment[ja]=dcop サービスのためのテンプレート +Comment[nds]=Vörlaag för DCOP-Deensten +Comment[ne]=dcop सेवाका लागि टेम्प्लेट +Comment[nl]=Sjabloon voor DCOP-services +Comment[pl]=Szablon dla usług dcop +Comment[pt]=Modelo para serviços dcop +Comment[pt_BR]=Modelo para serviços dcop +Comment[ru]=Шаблон для сервисов DCOP +Comment[sk]=Šablóna pre DCOP služby +Comment[sl]=Predloga za storitve DCOP +Comment[sr]=Шаблон за dcop сервисе +Comment[sr@Latn]=Šablon za dcop servise +Comment[sv]=Mall för DCOP-tjänster +Comment[ta]=டிகாப்சேவைக்கான மாதரி உரு +Comment[tg]=Қолиб барои хидмадгори DCOP +Comment[tr]=dcop hizmetleri için şablon +Comment[zh_CN]=dcop 服务模板 +Comment[zh_TW]=DCOP 服務樣本 + diff --git a/languages/cpp/app_templates/dcopservice/dcopservice.h b/languages/cpp/app_templates/dcopservice/dcopservice.h new file mode 100644 index 00000000..4e9eda87 --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/dcopservice.h @@ -0,0 +1,35 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAME}_H +#define _%{APPNAME}_H + +#include +#include +#include + +class %{APPNAME} : public DCOPObject +{ + K_DCOP + + private: + QStringList m_List; + + public: + %{APPNAME}(); + + ~%{APPNAME}(); + + k_dcop: + QString string(int); + + QStringList list(); + + void add(QString); + + bool remove(QString); + + bool exit(); + + +}; +#endif diff --git a/languages/cpp/app_templates/dcopservice/dcopservice.kdevelop b/languages/cpp/app_templates/dcopservice/dcopservice.kdevelop new file mode 100644 index 00000000..22681e00 --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/dcopservice.kdevelop @@ -0,0 +1,109 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + kioslave + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/dcopservice/dcopservice.kdevtemplate b/languages/cpp/app_templates/dcopservice/dcopservice.kdevtemplate new file mode 100644 index 00000000..dd950d6d --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/dcopservice.kdevtemplate @@ -0,0 +1,202 @@ +# KDE Config File +[General] +Name=KDE DCOP Service +Name[br]=Servij DCOP KDE +Name[ca]=Servei DCOP per al KDE +Name[da]=KDE DCOP-service +Name[de]=KDE-DCOP-Dienst +Name[el]=Υπηρεσία KDE DCOP +Name[es]=Servicio DCOP de KDE +Name[et]=KDE DCOP-teenus +Name[eu]=KDE-ren DCOP zerbitzua +Name[fa]=خدمت KDE DCOP +Name[fr]=Service DCOP KDE +Name[ga]=Seirbhís DCOP KDE +Name[gl]=Servicio DCOP de KDE +Name[hu]=KDE DCOP-szolgáltatás +Name[it]=Servizio DCOP di KDE +Name[ja]=KDE DCOP サービス +Name[nds]=KDE-DCOP-Deenst +Name[ne]=KDE DCOP सेवा +Name[nl]=KDE DCOP-service +Name[pl]=Usługa KDE DCOP +Name[pt]=Serviço de DCOP do KDE +Name[pt_BR]=Serviço de DCOP do KDE +Name[ru]=Сервис DCOP +Name[sk]=KDE DCOP služba +Name[sl]=Storitev DCOP za KDE +Name[sr]=KDE DCOP сервис +Name[sr@Latn]=KDE DCOP servis +Name[sv]=KDE:s DCOP-tjänst +Name[tg]=Хизмати KDE DCOP +Name[tr]=KDE DCOP Hizmeti +Name[zh_CN]=KDE DCOP 服务 +Name[zh_TW]=KDE DCOP 服務 +Icon=kdcop.png +Category=C++/KDE +Comment=Generates a framework for a KDE DCOP service and client access library. +Comment[ca]=Genera una infraestructura per a un servei DCOP de KDE i la biblioteca d'accés del client. +Comment[da]=Genererer et skelet for en KDE dcop-tjeneste og klientadgangsbibliotek. +Comment[de]=Erstellt das Grundgerüst für einen KDE-DCOP-Dienst und eine Bibliothek für den Client-Zugriff. +Comment[el]=Δημιουργεί ένα πλαίσιο για μια υπηρεσία KDE DCOP και μια βιβλιοθήκη πρόσβασης πελάτη. +Comment[es]=Genera una infraestructura para un servicio DCOP de KDE y una biblioteca de acceso cliente. +Comment[et]=KDE DCOP-teenuse raamistiku ja kliendi ligipääsu teegi loomine. +Comment[eu]=KDE-ren DCOP zerbitzu baterako lan-marko bat eta bezero liburutegi bat sortzen ditu. +Comment[fa]=چارچوبی برای خدمت KDE DCOP و کتابخانۀ دستیابی کارخواه تولید می‌کند. +Comment[fr]=Génère une infrastructure pour un service DCOP KDE et une bibliothèque d'accès client. +Comment[ga]=Cruthaigh creatlach do sheirbhís DCOP KDE agus leabharlann rochtana cliaint. +Comment[gl]=Xera un contorno de traballo para un servizo DCOP de KDE e unha biblioteca de acceso para clientes. +Comment[hu]=Létrehoz egy alap KDE DCOP-szolgáltatást és klienselérési programkönyvtárat. +Comment[it]=Genera l'infrastruttura per un servizio DCOP di KDE e una libreria per l'accesso da client. +Comment[ja]=KDE DCOP サービスとクライアントアクセスライブラリのためのフレームワークを作成します +Comment[nds]=Stellt en Rahmenwark för en KDE-DCOP-Deenst un en Clienttogriep-Bibliotheek op. +Comment[ne]=KDE DCOP सेवा र ग्राहक पहुँच लाइब्रेरीका लागि फ्रेमवर्क उत्पन्न गर्दछ । +Comment[nl]=Genereert een framework voor een KDE DCOP-service- en client-bibliotheek. +Comment[pl]=Generuje schemat dla usługi KDE DCOP i biblioteki dostępu użytkownika. +Comment[pt]=Gera a plataforma para um serviço de DCOP do KDE e a biblioteca de acesso dos clientes. +Comment[pt_BR]=Gera a plataforma para um serviço de DCOP do KDE e a biblioteca de acesso dos clientes. +Comment[ru]=Создание сервиса DCOP и библиотеки клиента. +Comment[sk]=Vygeneruje framework pre KDE DCOP službu a klientskú prístupovú knižnicu. +Comment[sr]=Прави једноставан радни оквир за KDE DCOP сервис и приступну библиотеку клијента. +Comment[sr@Latn]=Pravi jednostavan radni okvir za KDE DCOP servis i pristupnu biblioteku klijenta. +Comment[sv]=Skapar ett ramverk för en KDE DCOP-tjänst och klientåtkomstbibliotek. +Comment[tr]=Bir KDE DCOP hizmeti ve istemci erişim kütüphanesi için bir çatı yaratır. +Comment[zh_CN]=生成一个 KDE DCOP 服务和客户访问库的框架。 +Comment[zh_TW]=產生一個 KDE DCOP 服務的架構,以及客戶端存取的函式庫。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=dcopservice.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/dcopservice.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/dcopservice.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/dcopservice.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/dcopservice.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE15] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[MSG] +Type=message +Comment=A KDE DCOP Service was created in %{dest} +Comment[ca]=Un servei DCOP de KDE ha estat creada en %{dest} +Comment[da]=En KDE DCOP tjeneste blev oprettet i %{dest} +Comment[de]=Ein KDE-DCOP-Dienst wurde in %{dest} erstellt. +Comment[el]=Μια υπηρεσία KDE DCOP δημιουργήθηκε στο %{dest} +Comment[es]=Un servicio DCOP de KDE ha sido creado en %{dest} +Comment[et]=KDE DCOP-teenus loodi asukohta %{dest} +Comment[eu]=KDE-ren DCOP zerbitzu bat sortu da hemen: %{dest} +Comment[fa]=یک خدمت KDE DCOP در %{dest} ایجاد شد +Comment[fr]=Un service DCOP KDE a été créé dans %{dest} +Comment[ga]=Cruthaíodh Seirbhís DCOP KDE i %{dest} +Comment[gl]=Creouse un servizo DCOP de KDE en %{dest} +Comment[hu]=Létrejött egy KDE DCOP-szolgáltatás itt: %{dest} +Comment[it]=È stato creato un servizio DCOP di KDE in %{dest} +Comment[ja]=KDE DCOP サービスを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KDE-DCOP-Deenst opstellt +Comment[ne]=KDE DCOP सेवा %{dest} मा सिर्जना गरियो +Comment[nl]=Een DCOP-service is aangemaakt in %{dest} +Comment[pl]=Usługa KDE DCOP została utworzona w %{dest} +Comment[pt]=Foi criado um serviço de DCOP do KDE em %{dest} +Comment[pt_BR]=Foi criado um serviço de DCOP do KDE em %{dest} +Comment[ru]=Сервис DCOP создан в %{dest} +Comment[sk]=KDE DCOP služba bola vytvorená v %{dest} +Comment[sl]=Storitev DCOP za KDE je bila ustvarjena v %{dest} +Comment[sr]=KDE DCOP сервис направљен је у %{dest} +Comment[sr@Latn]=KDE DCOP servis napravljen je u %{dest} +Comment[sv]=En KDE DCOP-tjänst skapades i %{dest} +Comment[tr]=Bir KDE DCOP Hizmeti %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了一个 KDE DCOP 服务 +Comment[zh_TW]=KDE DCOP 服務已建立於 %{dest} diff --git a/languages/cpp/app_templates/dcopservice/dcopservice.png b/languages/cpp/app_templates/dcopservice/dcopservice.png new file mode 100644 index 00000000..2cb4f1f3 Binary files /dev/null and b/languages/cpp/app_templates/dcopservice/dcopservice.png differ diff --git a/languages/cpp/app_templates/dcopservice/main.cpp b/languages/cpp/app_templates/dcopservice/main.cpp new file mode 100644 index 00000000..55509560 --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/main.cpp @@ -0,0 +1,47 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include +#include +#include +#include "%{APPNAMELC}.h" + +static const char description[] = + I18N_NOOP("A KDE KPart Application"); + +static const char version[] = "0.1"; + +static KCmdLineOptions options[] = +{ + KCmdLineLastOption +}; + +int main (int argc, char *argv[]) +{ + KLocale::setMainCatalogue("kdelibs"); + KAboutData aboutdata("%{APPNAMELC}", I18N_NOOP("KDE"), + version, description, + KAboutData::License_GPL, "(C) %{YEAR}, %{AUTHOR}"); + aboutdata.addAuthor("%{AUTHOR}",I18N_NOOP("Developer"),"%{EMAIL}"); + + KCmdLineArgs::init( argc, argv, &aboutdata ); + KCmdLineArgs::addCmdLineOptions( options ); + KUniqueApplication::addCmdLineOptions(); + + if (!KUniqueApplication::start()) + { + kdDebug() << "%{APPNAMELC} is already running!" << endl; + return (0); + } + + KUniqueApplication app; + kdDebug() << "starting %{APPNAMELC} " << endl; + // This app is started automatically, no need for session management + app.disableSessionManagement(); + %{APPNAME} *service = new %{APPNAME}; + kdDebug() << "starting %{APPNAMELC} " << endl; + return app.exec(); + +} diff --git a/languages/cpp/app_templates/dcopservice/src-Makefile.am b/languages/cpp/app_templates/dcopservice/src-Makefile.am new file mode 100644 index 00000000..63b5b8ed --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/src-Makefile.am @@ -0,0 +1,17 @@ +bin_PROGRAMS = %{APPNAMELC} +INCLUDES = $(all_includes) +%{APPNAMELC}_LDFLAGS = $(all_libraries) $(KDE_RPATH) +%{APPNAMELC}_LDADD = $(LIB_KIO) +%{APPNAMELC}_SOURCES = main.cpp %{APPNAMELC}.cpp %{APPNAMELC}.skel + + +noinst_HEADERS = %{APPNAMELC}.h + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + + +service_DATA = %{APPNAMELC}.desktop +servicedir = $(kde_servicesdir) diff --git a/languages/cpp/app_templates/dcopservice/subdirs b/languages/cpp/app_templates/dcopservice/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/dcopservice/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/generichello/.kdev_ignore b/languages/cpp/app_templates/generichello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/generichello/Makefile.am b/languages/cpp/app_templates/generichello/Makefile.am new file mode 100644 index 00000000..b558eecd --- /dev/null +++ b/languages/cpp/app_templates/generichello/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = main.cpp cpphello.png app.kdevelop app.prj +templateName = cppgenerichello + +# BELOW is not the GENERIC Template-Template; +# png-filename differs from archive file name + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz cpphello.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/generichello/app.kdevelop b/languages/cpp/app_templates/generichello/app.kdevelop new file mode 100644 index 00000000..c0b6cc1e --- /dev/null +++ b/languages/cpp/app_templates/generichello/app.kdevelop @@ -0,0 +1,61 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevGenericProject + C++ + + C++ + Code + + + + ShellScript + %{APPNAMELC}.prj + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + true + + + + optimized + GccOptions + GppOptions + G77Options + -O2 -g0 + + + --enable-debug=full + debug + GccOptions + GppOptions + G77Options + -O0 -g3 + + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/generichello/app.prj b/languages/cpp/app_templates/generichello/app.prj new file mode 100644 index 00000000..a1eeca82 --- /dev/null +++ b/languages/cpp/app_templates/generichello/app.prj @@ -0,0 +1,8 @@ + + + + + gcc -o %{APPNAMELC} %{APPNAMELC}.cpp + + + diff --git a/languages/cpp/app_templates/generichello/cpphello.png b/languages/cpp/app_templates/generichello/cpphello.png new file mode 100644 index 00000000..888d4f13 Binary files /dev/null and b/languages/cpp/app_templates/generichello/cpphello.png differ diff --git a/languages/cpp/app_templates/generichello/generichello.kdevtemplate b/languages/cpp/app_templates/generichello/generichello.kdevtemplate new file mode 100644 index 00000000..787140ff --- /dev/null +++ b/languages/cpp/app_templates/generichello/generichello.kdevtemplate @@ -0,0 +1,92 @@ +# KDE Config File +[General] +Name=C++ program (shell script build system) +Name[ca]=Programa C++ (sistema de construcció basat en scripts de shell) +Name[da]=C++ program (skalscript byggesystem) +Name[de]=C++-Programm (Shell-Skript basiertes Erstellungssystem) +Name[el]=Πρόγραμμα C++ (σύστημα κατασκευής σενάριο κελύφους) +Name[es]=Programa en C++ (con sistema de construcción basado en guión de órdenes) +Name[et]=C++ programm (shelliskripti ehitussüsteem) +Name[eu]=C++ programa (shell script-en bidez eraikia) +Name[fa]=برنامۀ ++C )سیستم ساخت دست‌نوشتۀ پوسته( +Name[fr]=Programme C++ (système de construction en script shell) +Name[ga]=Ríomhchlár C++ (córas tógála bunaithe ar scripteanna blaoisce +Name[gl]=Programa C++ (sistema de compilación shell script) +Name[hu]=C++-program (parancssoros fordítási szkripttel) +Name[it]=Programma C++ (sistema di compilazione con script di shell) +Name[ja]=C++ プログラム (シェルスクリプトベースのビルドシステム) +Name[nds]=C++-Programm (Konsoolskript-Opstellsystem) +Name[ne]=C++ कार्यक्रम (शेल स्क्रिप्ट निर्माण प्रणाली) +Name[nl]=C++-programma (shellscript build system) +Name[pl]=Program w C++ (system budowania za pomocą skryptów powłoki) +Name[pt]=Programa em C++ (sistema de compilação em 'shell script') +Name[pt_BR]=Programa em C++ (sistema de compilação em 'shell script') +Name[ru]=Приложение C++ (сборка на скриптах командной оболочки) +Name[sk]=C++ program (shell skript build system) +Name[sl]=Program v C++ (sistem grajenja lupinskega skripta) +Name[sr]=C++ програм (скрипта шкољке као систем за градњу) +Name[sr@Latn]=C++ program (skripta školjke kao sistem za gradnju) +Name[sv]=C++ program (skalskript byggsystem) +Name[tr]=C++ programı (kabuk betiği kurulum sistemi) +Name[zh_CN]=C++ 程序(Shell 脚本创建系统) +Name[zh_TW]=C++ 程式(shell 文稿建立系統) +Icon=cpphello.png +Category=C++/Generic +Comment=Generates a simple Hello world program in C++ +Comment[ca]=Genera un simple programa de Hello world en C++ +Comment[da]=Genererer et simpelt Goddag verden program in C++ +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in C++ +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα Γεια σου Κόσμε σε C++ +Comment[es]=Genera un sencillo programa «Hola mundo» en C++ +Comment[et]=Lihtsa "Tere, maailm" programmi loomine C++-s +Comment[eu]="Kaixo mundua" programa sinple bat sortzen du C++ lengoaian +Comment[fa]=یک برنامۀ سادۀ Hello world در C++ تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en C++ +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" i C++ +Comment[gl]=Xera un programa sinxelo Ola mundo en C++ +Comment[hu]=Létrehoz egy egyszerű Hello world programot C++-ban +Comment[it]=Genera un semplice programma di "Hello world" in C++ +Comment[ja]=簡単な Hello World プログラムを C++ で作成します +Comment[nds]=Stellt en eenfach "Moin Welt"-Programm in C++ op +Comment[ne]=C++ मा एउटा साधारण हेल्लो वोल्ड कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudig Hello World-programma in C++ +Comment[pl]=Generuje prosty program 'Witaj świecie' w języku C++ +Comment[pt]=Gera um programa simples Olá Mundo em C++ +Comment[pt_BR]=Gera um programa simples Olá Mundo em C++ +Comment[ru]=Создание простого приложения Hello world на C++ +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v C++ +Comment[sl]=Ustvari preprost program Hello world v C++ +Comment[sr]=Прави једноставан „Здраво свете“ програм у C++-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u C++-u +Comment[sv]=Skapar ett enkelt Hello world-program i C++ +Comment[tr]=C++'da basit bir Merhaba Dünya programı yaratır. +Comment[zh_CN]=生成 C++ 的 Hello world 程序 +Comment[zh_TW]=產生一個簡單的 C++ 的 Hello world 程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=generichello.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.prj +Dest=%{dest}/%{APPNAMELC}.prj + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE3] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + diff --git a/languages/cpp/app_templates/generichello/main.cpp b/languages/cpp/app_templates/generichello/main.cpp new file mode 100644 index 00000000..f97c8417 --- /dev/null +++ b/languages/cpp/app_templates/generichello/main.cpp @@ -0,0 +1,17 @@ +%{CPP_TEMPLATE} + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +using namespace std; + +int main(int argc, char *argv[]) +{ + cout << "Hello, world!" << endl; + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/gnome2mmapp/.kdev_ignore b/languages/cpp/app_templates/gnome2mmapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/gnome2mmapp/Makefile.am b/languages/cpp/app_templates/gnome2mmapp/Makefile.am new file mode 100644 index 00000000..f86ae76c --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = acconfig.h autogen.sh gnome2mm.glade main_window.cc \ + main_window_glade.hh Makefile.am app-Makefile.am \ + configure.in gnome2mm.gladep main_window.hh \ + app.kdevelop gnome2mm.cc gnome2mmapp main_window_glade.cc\ + src-Makefile.am config.h gnome2mmapp.png + +templateName = gnome2mmapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/gnome2mmapp/acconfig.h b/languages/cpp/app_templates/gnome2mmapp/acconfig.h new file mode 100644 index 00000000..c7231ddc --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/acconfig.h @@ -0,0 +1,23 @@ +// generated 2004/4/12 12:12:12 EDT by amp8165@localhost.(none) +// using glademm V2.0.0 + +/* acconfig.h + * This file is in the public domain. + * + * Descriptive text for the C preprocessor macros that + * the distributed Autoconf macros can define. + * These entries are sometimes used by macros + * which glade-- uses. + */ +#undef PACKAGE +#undef VERSION +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef GETTEXT_PACKAGE +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR diff --git a/languages/cpp/app_templates/gnome2mmapp/app-Makefile.am b/languages/cpp/app_templates/gnome2mmapp/app-Makefile.am new file mode 100644 index 00000000..1d95370d --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/app-Makefile.am @@ -0,0 +1,4 @@ + +SUBDIRS = src + +EXTRA_DIST = AUTHORS TODO README configure diff --git a/languages/cpp/app_templates/gnome2mmapp/app.kdevelop b/languages/cpp/app_templates/gnome2mmapp/app.kdevelop new file mode 100644 index 00000000..8ccf488a --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/app.kdevelop @@ -0,0 +1,69 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + GNOME + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + -O0 -g3 + + + + + + + + + + + + + + + libtool + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/gnome2mmapp/autogen.sh b/languages/cpp/app_templates/gnome2mmapp/autogen.sh new file mode 100755 index 00000000..30e9875b --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/autogen.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. +# generated 2004/4/12 12:12:12 EDT by amp8165@localhost.(none) +# using glademm V2.0.0 +# I didn't want to put a copy of 'macros' in every generated package +# so I try to find them at autogen.sh time and copy them here. +# (Normally if you have access to a cvs repository a copy of macros is +# put into your directory at checkout time. E.g. cvs.gnome.org/gnome-common) +if [ ! -e macros ] +then + GLADE_MACROS=`which glade | sed -e 's-bin/glade-share/glade-'` + if [ -r $GLADE_MACROS/gnome/gnome.m4 ] + then + if cp --dereference /dev/null /dev/zero + then + cp -r --dereference $GLADE_MACROS/gnome macros + else + cp -r $GLADE_MACROS/gnome macros + fi + else + echo "I can't find glade's gnome m4 macros. Please copy them to ./macros and retry." + exit 2 + fi +fi + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="%{APPNAMELC}" + +(test -f $srcdir/configure.in \ +## put other tests here +) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level $PKG_NAME directory" + exit 1 +} + +export ACLOCAL_FLAGS="-I `pwd`/macros $ACLOCAL_FLAGS" +. $srcdir/macros/autogen.sh diff --git a/languages/cpp/app_templates/gnome2mmapp/config.h b/languages/cpp/app_templates/gnome2mmapp/config.h new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/gnome2mmapp/configure.in b/languages/cpp/app_templates/gnome2mmapp/configure.in new file mode 100644 index 00000000..d25f4fbd --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/configure.in @@ -0,0 +1,57 @@ +# generated 2004/4/12 12:12:12 EDT by amp8165@localhost.(none) +# using glademm V2.0.0 + +AC_INIT(configure.in) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AM_CONFIG_HEADER(config.h) + +dnl Pick up the Gnome macros. +AM_ACLOCAL_INCLUDE(macros) +AM_MAINTAINER_MODE + +AC_ISC_POSIX +AC_PROG_CC +AM_PROG_CC_STDC +AC_HEADER_STDC +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_CXXCPP +AM_PROG_LIBTOOL + +# GNOME--: +# (These macros are in the 'macros' directory) +# GNOME_INIT sets the GNOME_CONFIG variable, among other things: +GNOME_INIT +GNOME_COMMON_INIT +GNOME_COMPILE_WARNINGS +dnl ************************************************* +dnl gettext support +dnl ************************************************* + +GETTEXT_PACKAGE=gnome2mm +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE") + +dnl Add the languages which your application supports here. +ALL_LINGUAS="" +AM_GLIB_GNU_GETTEXT + +dnl Set PACKAGE_LOCALE_DIR in config.h. +if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale") +else + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale") +fi + +AC_LANG_CPLUSPLUS + +AM_PATH_GNOMEMM(1.2.2,, AC_MSG_ERROR(Cannot find a matching GNOME-- library: Please install version 1.2.2 or newer)) + +# GNOME-CONFIG script knows about gnomemm: +# ('gnome-config' is installed by GNOME) +#GNOMEMM_CFLAGS="`$GNOME_CONFIG --cflags gnomemm gnomeui`" +#GNOMEMM_LIBS="`$GNOME_CONFIG --libs gnomemm gnomeui`" +#AC_SUBST(GNOMEMM_CFLAGS) +#AC_SUBST(GNOMEMM_LIBS) + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc new file mode 100644 index 00000000..8a33b9ff --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc @@ -0,0 +1,22 @@ +%{CC_TEMPLATE} + +#include +#include +#include + +#include "main_window.hh" + +int main(int argc, char **argv) +{ +#if defined(ENABLE_NLS) + bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + textdomain (GETTEXT_PACKAGE); +#endif //ENABLE_NLS + + Gnome::Main m(PACKAGE, VERSION, argc, argv); + + main_window *main_window = new class main_window(); + m.run(); + delete main_window; + return 0; +} diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mm.glade b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.glade new file mode 100644 index 00000000..4c0370aa --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.glade @@ -0,0 +1,24 @@ + + + + + + + + True + public + True + %{APPNAME} Project + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + True + False + + + + + + + + diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mm.gladep b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.gladep new file mode 100644 index 00000000..b7da0659 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.gladep @@ -0,0 +1,8 @@ + + + + + Gnome2mm + gnome2mm + C++ + diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp new file mode 100644 index 00000000..8593bc68 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp @@ -0,0 +1,8 @@ +# KDE Config File +[General] +Name=GNOME-- Application framework +Category=C++/GTK+ +Icon=gnome2mmapp.png +Comment=Generates a simple GNOME-- application. Gnomemm, Gtkmm >= 1.2.8 and < 1.3.0 should be installed. To edit glade file glade-- (http://home.wtal.de/petig/Gtk/) is required. +FileTemplates=hh,CStyle,cc,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate new file mode 100644 index 00000000..ec101c69 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate @@ -0,0 +1,186 @@ +# KDE Config File +[General] +Name=GNOME-- Application framework +Name[ca]=Infraestructura d'aplicació per a GNOME +Name[da]=GNOME-- Programskelet +Name[de]="GNOME--"-Anwendungsgrundgerüst +Name[el]=GNOME-- Πλαίσιο εφαρμογής +Name[es]=Infraestructura para aplicación GNOME-- +Name[et]=GNOME-- rakenduse raamistik +Name[eu]=GNOME-- Aplikazioen lan-markoa +Name[fa]=چارچوب کاربرد GNOME-- +Name[fr]=Infrastructure d'application GNOME-- +Name[ga]=Creatlach feidhmchláir GNOME-- +Name[gl]=Entorno de traballo para aplicación GNOME +Name[hu]=GNOME - Alkalmazás-keretrendszer +Name[it]=Infrastruttura per applicazioni GNOME-- +Name[ja]=GNOME-- アプリケーションフレームワーク +Name[nds]=Programmrahmenwark för "GNOME--" +Name[ne]=GNOME-- अनुप्रयोग फ्रेमवर्क +Name[nl]=GNOME-- Applicationframework +Name[pl]=GNOME-- Szablon programu +Name[pt]=Plataforma de aplicações GNOME-- +Name[pt_BR]=Plataforma de aplicações GNOME-- +Name[ru]=Приложение GNOME-- +Name[sk]=GNOME-- aplikačný framework +Name[sl]=Ogrodje programa za GNOME-- +Name[sr]=Радни оквир GNOME-- програма +Name[sr@Latn]=Radni okvir GNOME-- programa +Name[sv]=GNOME-- programramverk +Name[tr]=GNOME-- Uygulama Çatısı +Name[zh_CN]=GNOME-- 应用程序框架 +Name[zh_TW]=GNOME-- 應用程式框架 +Category=C++/GTK+ +Icon=gnome2mmapp.png +Comment=Generates a simple GNOME-- application. Gnomemm, Gtkmm >= 1.2.8 and < 1.3.0 should be installed. To edit glade file glade-- (http://home.wtal.de/petig/Gtk/) is required. +Comment[ca]=Genera una simple aplicació GNOME. Gnomemm, Gtkmm >= 1.2.8 i < 1.3.0 haurien d'estar instal·lats. Per editar el fitxer glade es requereix (http://home.wtal.de/petig/Gtk/). +Comment[da]=Genererer et simpelt GNOME-- program. Gnomemm, Gtkmm >= 1.2.8 og < 1.3.0 skal være installeret. For at redigere glade file glade-- kræves (http://home.wtal.de/petig/Gtk/). +Comment[de]=Erstellt eine einfache GNOME-Anwendung. Gnomemm, Gtkmm >= 1.2.8 und < 1.3.0 sollten installiert sein. Zum Bearbeiten der glade-Datei ist glade-- (http://home.wtal.de/petig/Gtk/) erforderlich. +Comment[el]=Δημιουργεί μια απλή εφαρμογή GNOME. Τα Gnomemm, Gtkmm >= 1.2.8 και < 1.3.0 πρέπει να είναι εγκατεστημένα. Για την επεξεργασία του αρχείου glade απαιτείται το glade (http://home.wtal.de/petig/Gtk/). +Comment[es]=Genera una sencilla aplicación GNOME--. Debe tener instalados Gnomemm, Gtkmm >= 1.2.8 y < 1.3.0. Para editar archivos glade se necesita glade-- (http://home.wtal.de/petig/Gtk/). +Comment[et]=Lihtsa GNOME-- rakenduse loomine. Paigaldatud peavad olema Gnomemm, Gtkmm >= 1.2.8 ja < 1.3.0. Glade-faili redigeerimiseks on vajalik glade-- (http://home.wtal.de/petig/Gtk/). +Comment[eu]=GNOME-- applicazio sinple bat sortzen du. Gnomemm, Gtkmm >= 1.2.8 and < 1.3.0 instalatu behar dira. Glade fitxategia editatzeko glade-- (http://home.wtal.de/petig/Gtk/) behar da. +Comment[fa]=یک کاربرد سادۀ GNOME-- تولید می‌کند. Gnomemm، Gtkmm >= ۱.۲.۸ و < ۱.۳.۰ باید نصب شده باشد. برای ویرایش پروندۀ glade، glade-- (http://home.wtal.de/petig/Gtk/) نیاز است. +Comment[fr]=Génère une application GNOME-- simple. Gnomemm et Gtkmm >= 1.2.8 et < 1.3.0 devront être installés. Pour modifier le fichier glade, glade-- (http://home.wtal.de/petig/Gtk/) est requis. +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí GNOME--. Ba chóir Gnomemm, Gtkmm >= 1.2.8 agus < 1.3.0 a bheith suiteáilte. Chun comhad glade a chur in eagar, tá glade-- (http://home.wtal.de/petig/Gtk/) de dhíth ort. +Comment[gl]=Xera una aplicación sinxela GNOME. Gnomemm, Gtkmm >= 1.2.8 e < 1.3.0 deben estar instalados. Para editar un arquivo glade é necesario glade-- (http://home.wtal.de/petig/Gtk/). +Comment[hu]=Létrehoz egy egyszerű GNOME--os -alkalmazást. A Gnomemm, a Gtkmm (>= 1.2.8 és < 1.3.0) szükséges hozzá. Glade-fájl szerkesztéséhez a glade-- (http://home.wtal.de/petig/Gtk/) is szükséges. +Comment[it]=Genera una semplice applicazione GNOME--. Gnomemm, Gtkmm >= 1.2.8 e < 1.3.0 dovrebbero essere installati. Si richiede glade per modificare i file di glade -- (http://home.wtal.de/petig/Gtk/). +Comment[ja]=簡単な GNOME-- アプリケーションを作成します。Gnomemm, Gtkmm >= 1.2.8 かつ < 1.3.0 が必要です。glade ファイルを編集するには glade-- (http://home.wtal.de/petig/Gtk/) が必要です。 +Comment[nds]=Stellt en eenfach "GNOME--"-Programm op. "Gnomemm", "Gtkmm" >= 1.2.8 un < 1.3.0 schöölt installeert wesen. För't Bewerken vun de glade-Datei deit "glade--" (http://home.wtal.de/petig/Gtk/) noot. +Comment[ne]=साधारण जिनोम-- अनुप्रयोग उत्पन्न गर्दछ । Gnomemm, Gtkmm >= 1.2.8 र < 1.3.0 स्थापना गर्नु पर्दछ । ग्लेड फाइल सम्पादन गर्नका लागि ग्लेड-- (http://home.wtal.de/petig/Gtk/) आवश्यक पर्दछ । +Comment[nl]=Genereert een eenvoudige GNOME-- toepassing. Gnomemm, Gtkmm >= 1.2.8 en < 1.3.0 dienen te zijn geïnstalleerd. Voor het bewerken van glade file is glade-- (http://home.wtal.de/petig/Gtk/) nodig. +Comment[pl]=Generuje prosty program dla środowiska GNOME--. Gnomemm i Gtkmm w wersji >= 1.2.8 i < 1.3.0 powinny być zainstalowane. Do edycji pliku glade konieczny jest program glade-- (http://home.wtal.de/petig/Gtk/). +Comment[pt]=Gera uma aplicação simples em GNOME--. Deverão estar instalados o Gnomemm, Gtkmm >= 1.2.8 e < 1.3.0. Para editar o ficheiro do Glade,, é necessário o glade-- (http://home.wtal.de/petig/Gtk/). +Comment[pt_BR]=Gera uma aplicação simples em GNOME--. Deverão estar instalados o Gnomemm, Gtkmm >= 1.2.8 e < 1.3.0. Para editar o ficheiro do Glade,, é necessário o glade-- (http://home.wtal.de/petig/Gtk/). +Comment[ru]=Создание простого приложения GNOME--. Требуются Gnomemm, Gtkmm >= 1.2.8 и < 1.3.0. Для редактирования файла glade нужна соответствующая программа (http://home.wtal.de/petig/Gtk/). +Comment[sk]=Vygeneruje jednoduchú GNOME-- aplikáciu. Vyžaduje nainštalovanéGnomemm, Gtkmm >= 1.2.8 a < 1.3.0. Na editovanie glade súboru he potrebnýglade-- (http://home.wtal.de/petig/Gtk/). +Comment[sr]=Прави једноставан GNOME-- програм. Gnomemm, Gtkmm >= 1.2.8 и < 1.3.0 требало би да су инсталирани. Да бисте уређивали glade фајл, неопходан је glade-- (http://home.wtal.de/petig/Gtk/). +Comment[sr@Latn]=Pravi jednostavan GNOME-- program. Gnomemm, Gtkmm >= 1.2.8 i < 1.3.0 trebalo bi da su instalirani. Da biste uređivali glade fajl, neophodan je glade-- (http://home.wtal.de/petig/Gtk/). +Comment[sv]=Skapar ett enkelt GNOME-- program. Gnomemm, Gtkmm >= 1.2.8 och < 1.3.0 måste vara installerat. För att redigera glade-filer krävs glade-- (http://home.wtal.de/petig/Gtk/). +Comment[tr]=Basit bir GNOME-- uygulaması yaratır. Gnomemm, Gtkmm>=1.28 ve <1.3.0 yüklü olmalıdır. Glade dosyasını düzenlemek için glade-- (http://home.wtal.de/petig/Gtk/) gereklidir. +Comment[zh_CN]=生成简单的 GNOME-- 应用程序。必须安装 Gnomemm、1.2.8 到 1.3.0 之间的 Gtkmm。要编辑 glade 文件,需要使用 glade-- (http://home.wtal.de/petig/Gtk/)。 +Comment[zh_TW]=產生一個簡單的 GNOME-- 應用程式。要先安裝 Gnomemm,Gtkmm 版本 >= 1.2.8 且 < 1.3.0。要編輯 glade 檔則要先安裝 glade-- (http://home.wtal.de/petig/Gtk/)。 +FileTemplates=hh,CStyle,cc,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=gnome2mmapp.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNOME2] +Type=include +File=%{kdevelop}/template-common/gnome2.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[FILE4] +Type=install +Source=%{src}/acconfig.h +Dest=%{dest}/acconfig.h + +[FILE5] +Type=install +Source=%{src}/config.h +Dest=%{dest}/config.h + +[FILE6] +Type=install +Source=%{src}/autogen.sh +Dest=%{dest}/autogen.sh + +[FILE7] +Type=install +Source=%{src}/gnome2mm.glade +Dest=%{dest}/%{APPNAMELC}.glade + +[FILE8] +Type=install +Source=%{src}/gnome2mm.gladep +Dest=%{dest}/%{APPNAMELC}.gladep + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE9] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE10] +Type=install +Source=%{src}/gnome2mm.cc +Dest=%{dest}/src/%{APPNAMELC}.cc + +[FILE11] +Type=install +Source=%{src}/main_window.hh +Dest=%{dest}/src/main_window.hh + +[FILE12] +Type=install +Source=%{src}/main_window.cc +Dest=%{dest}/src/main_window.cc + +[FILE13] +Type=install +Source=%{src}/main_window_glade.hh +Dest=%{dest}/src/main_window_glade.hh + +[FILE14] +Type=install +Source=%{src}/main_window_glade.cc +Dest=%{dest}/src/main_window_glade.cc + +[MSG] +Type=message +Comment=A GNOME-- application framework was created in %{dest} +Comment[ca]=Una infraestructura d'aplicació per a GNOME ha estat creada en %{dest} +Comment[da]=Et GNOME-- programskelet blev oprettet i %{dest} +Comment[de]=Ein GNOME-Anwendungsgerüst wurde in %{dest} erstellt. +Comment[el]=Ένα πλαίσιο εφαρμογής GNOME δημιουργήθηκε στο %{dest} +Comment[es]=Una infraestructura de aplicación GNOME-- ha sido creada en %{dest} +Comment[et]=GNOME-- rakenduse raamistik loodi asukohta %{dest} +Comment[eu]=GNOME-- applicazioen lan-marko bat sortu da hemen: %{dest} +Comment[fa]=یک چارچوب کاربرد GNOME-- در %{dest} ایجاد شد +Comment[fr]=Une infrastructure d'application GNOME-- a été créée dans %{dest} +Comment[ga]=Cruthaíodh creatlach feidhmchláir GNOME-- i %{dest} +Comment[gl]=Creouse un contorno de traballo para aplicación GNOME en %{dest} +Comment[hu]=Létrejött egy GNOME-s alkalmazás-keretrendszer itt: %{dest} +Comment[it]=È stato creata l'infrastruttura per un'applicazione GNOME in %{dest} +Comment[ja]=GNOME-- アプリケーションフレームワークを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Programmrahmenwark för "GNOME--" opstellt +Comment[ne]= जिनोम-- अनुप्रयोग फ्रेमवर्क %{dest} मा सिर्जना गरियो +Comment[nl]=Een GNOME-- applicationframework is aangemaakt in %{dest} +Comment[pl]=Szablon programu dla GNOME-- został utworzony w %{dest} +Comment[pt]=Foi criada a plataforma de uma aplicação GNOME-- em %{dest} +Comment[pt_BR]=Foi criada a plataforma de uma aplicação GNOME-- em %{dest} +Comment[ru]=Простое приложение GNOME-- создано в %{dest} +Comment[sk]=GNOME-- aplikačný framework bol vytvorený v %{dest} +Comment[sl]=Ogrodje programa za GNOME-- je bilo ustvarjeno v %{dest} +Comment[sr]=Радни оквир GNOME-- програма направљен је у %{dest} +Comment[sr@Latn]=Radni okvir GNOME-- programa napravljen je u %{dest} +Comment[sv]=Ett GNOME-- programramverk skapades i %{dest} +Comment[tr]=Bir GNOME-- uygulama çatısı %{dest} içinde yaratılmıştır. +Comment[zh_CN]=在 %{dest} 中创建了 GNOME-- 应用程序框架 +Comment[zh_TW]=GNOME-- 應用程式框架已建立於 %{dest} diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.png b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.png new file mode 100644 index 00000000..253a6229 Binary files /dev/null and b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.png differ diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window.cc b/languages/cpp/app_templates/gnome2mmapp/main_window.cc new file mode 100644 index 00000000..4c73911b --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window.cc @@ -0,0 +1,16 @@ +%{CC_TEMPLATE} + +// newer (non customized) versions of this file go to main_window.cc_new + +// This file is for your program, I won't touch it again! + +#include "config.h" +#include "main_window.hh" + +#include + +gint main_window::quit(GdkEventAny *ev) +{ + Gtk::Main::quit(); +} + diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window.hh b/languages/cpp/app_templates/gnome2mmapp/main_window.hh new file mode 100644 index 00000000..ae93336b --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window.hh @@ -0,0 +1,19 @@ +%{HH_TEMPLATE} + +// newer (non customized) versions of this file go to main_window.hh_new + +// you might replace +// class foo : public foo_glade { ... }; +// by +// typedef foo_glade foo; +// if you didn't make any modifications to the widget + +#ifndef _MAIN_WINDOW_HH +# include "main_window_glade.hh" +# define _MAIN_WINDOW_HH +class main_window : public main_window_glade +{ +protected: + virtual gint quit(GdkEventAny *ev); +}; +#endif diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc new file mode 100644 index 00000000..bea6c857 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc @@ -0,0 +1,30 @@ +%{CC_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using +// glade-- /home/amp8165/Projects/gnome2mm/gnome2mm.glade +// for gtk 2.2.4 and gtkmm 1.2.10 +// +// Please modify the corresponding derived classes in ./src/main_window.cc + +#include "config.h" +#include +#include "main_window_glade.hh" +#include +#include + +main_window_glade::main_window_glade( +) : Gtk::Window(GTK_WINDOW_TOPLEVEL) +{ main_window = this; + + Gtk::AccelGroup *main_window_accgrp = Gtk::AccelGroup::create(); + gmm_data = new GlademmData(main_window_accgrp); + main_window->set_title(_("%{APPNAME} Project")); + main_window->set_modal(false); + main_window->add_accel_group(*(gmm_data->getAccelGroup())); + main_window->show(); + main_window->delete_event.connect(SigC::slot(this, &main_window_glade::quit)); +} + +main_window_glade::~main_window_glade() +{ delete gmm_data; +} diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh new file mode 100644 index 00000000..97a9302f --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh @@ -0,0 +1,49 @@ +%{HH_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using +// glade-- /home/amp8165/Projects/gnome2mm/gnome2mm.glade +// for gtk 2.2.4 and gtkmm 1.2.10 +// +// Please modify the corresponding derived classes in ./src/main_window.hh and./src/main_window.cc + +#ifndef _MAIN_WINDOW_GLADE_HH +# define _MAIN_WINDOW_GLADE_HH + + +#if !defined(GLADEMM_DATA) +#define GLADEMM_DATA +#include + +class GlademmData +{ + + Gtk::AccelGroup *accgrp; +public: + + GlademmData(Gtk::AccelGroup *ag) : accgrp(ag) + { + } + + Gtk::AccelGroup * getAccelGroup() + { return accgrp; + } +}; +#endif //GLADEMM_DATA + +#include + +class main_window_glade : public Gtk::Window +{ + + GlademmData *gmm_data; +public: + class Gtk::Window *main_window; +protected: + + main_window_glade(); + + ~main_window_glade(); + + virtual gint quit(GdkEventAny *ev) = 0; +}; +#endif diff --git a/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am b/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am new file mode 100644 index 00000000..fe5ec32c --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am @@ -0,0 +1,14 @@ +bin_PROGRAMS = %{APPNAMELC} + +%{APPNAMELC}_SOURCES = \ + %{APPNAMELC}.cc\ + main_window_glade.cc \ + main_window.cc + +noinst_HEADERS = \ + main_window_glade.hh \ + main_window.hh + +AM_CXXFLAGS = @CXXFLAGS@ @GNOMEMM_CFLAGS@ + +%{APPNAMELC}_LDADD = @LIBS@ @GNOMEMM_LIBS@ diff --git a/languages/cpp/app_templates/gtk2mmapp/.kdev_ignore b/languages/cpp/app_templates/gtk2mmapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/gtk2mmapp/Makefile.am b/languages/cpp/app_templates/gtk2mmapp/Makefile.am new file mode 100644 index 00000000..2069ade7 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = acconfig.h autogen.sh gtk2mm.glade main_window.cc \ + main_window_glade.hh Makefile.am app-Makefile.am \ + configure.in gtk2mm.gladep main_window.hh \ + app.kdevelop gtk2mm.cc main_window_glade.cc\ + src-Makefile.am config.h gtk2mmapp.png + +templateName = gtk2mmapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/gtk2mmapp/acconfig.h b/languages/cpp/app_templates/gtk2mmapp/acconfig.h new file mode 100644 index 00000000..a3f4402e --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/acconfig.h @@ -0,0 +1,10 @@ +/* acconfig.h + * This file is in the public domain. + * + * Descriptive text for the C preprocessor macros that + * the distributed Autoconf macros can define. + * These entries are sometimes used by macros + * which glade-- uses. + */ +#undef PACKAGE +#undef VERSION diff --git a/languages/cpp/app_templates/gtk2mmapp/app-Makefile.am b/languages/cpp/app_templates/gtk2mmapp/app-Makefile.am new file mode 100644 index 00000000..1d95370d --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/app-Makefile.am @@ -0,0 +1,4 @@ + +SUBDIRS = src + +EXTRA_DIST = AUTHORS TODO README configure diff --git a/languages/cpp/app_templates/gtk2mmapp/app.kdevelop b/languages/cpp/app_templates/gtk2mmapp/app.kdevelop new file mode 100644 index 00000000..47330ca2 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/app.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + GTK + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnustep + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + libtool + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/gtk2mmapp/autogen.sh b/languages/cpp/app_templates/gtk2mmapp/autogen.sh new file mode 100755 index 00000000..231521ba --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/autogen.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# generated 2004/4/12 11:58:47 EDT by amp8165@localhost.(none) +# using glademm V2.0.0 + +if test ! -f install-sh ; then touch install-sh ; fi + +MAKE=`which gnumake` +if test ! -x "$MAKE" ; then MAKE=`which gmake` ; fi +if test ! -x "$MAKE" ; then MAKE=`which make` ; fi +HAVE_GNU_MAKE=`$MAKE --version|grep -c "Free Software Foundation"` + +if test "$HAVE_GNU_MAKE" != "1"; then +echo Using non GNU Make at $MAKE +else +echo Found GNU Make at $MAKE ... good. +fi + +echo This script runs configure and make... +echo You did remember necessary arguments for configure, right? + +if test ! -x `which aclocal` +then echo you need autoconfig and automake to generate the Makefile +fi +if test ! -x `which automake` +then echo you need automake to generate the Makefile +fi + +libtoolize --force --copy +autoheader +aclocal +automake --add-missing --copy --gnu +autoconf +#./configure $* && $MAKE diff --git a/languages/cpp/app_templates/gtk2mmapp/config.h b/languages/cpp/app_templates/gtk2mmapp/config.h new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/gtk2mmapp/configure.in b/languages/cpp/app_templates/gtk2mmapp/configure.in new file mode 100644 index 00000000..cec72218 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/configure.in @@ -0,0 +1,19 @@ + +AC_INIT(configure.in) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_CONFIG_HEADER(config.h) + +AC_ISC_POSIX +AC_PROG_CC +AM_PROG_CC_STDC +AC_HEADER_STDC +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_CXXCPP +AM_PROG_LIBTOOL + +AC_LANG_CPLUSPLUS + +PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.8.0]) + +AC_OUTPUT(Makefile src/Makefile ) diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc new file mode 100644 index 00000000..9845fede --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc @@ -0,0 +1,15 @@ +%{CC_TEMPLATE} + +#include + +#include "main_window.hh" + +int main(int argc, char **argv) +{ + + Gtk::Main m(&argc, &argv); + + main_window main_window; + Gtk::Main::run(main_window); + return 0; +} diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mm.glade b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.glade new file mode 100644 index 00000000..ef4f1b18 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.glade @@ -0,0 +1,30 @@ + + + + + + + True + True + public + True + %{APPNAME} Project + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + + + + + + + + diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mm.gladep b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.gladep new file mode 100644 index 00000000..f09912ac --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.gladep @@ -0,0 +1,10 @@ + + + + + %{APPNAME} + %{APPNAMELC} + C++ + FALSE + FALSE + diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate b/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate new file mode 100644 index 00000000..6d52c9bd --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate @@ -0,0 +1,174 @@ +# KDE Config File +[General] +Name=Gtk-- Application framework +Name[ca]=Infraestructura d'aplicació per a Gtk-- +Name[da]=Gtk-- programskelet +Name[de]="Gtk--"-Anwendungsgrundgerüst +Name[el]=Gtk-- πλαίσιο εφαρμογής +Name[es]=Infraestructura de aplicación Gtk-- +Name[et]=Gtk-- rakenduse raamistik +Name[eu]=Gtk-- Applicazioen lan-markoa +Name[fa]=چارچوب کاربرد Gtk-- +Name[fr]=Infrastructure d'application Gtk-- +Name[ga]=Creatlach feidhmchláir Gtk-- +Name[hu]=Gtk-- - alkalmazás-keretrendszer +Name[it]=Infrastruttura per un'applicazione Gtk-- +Name[ja]=Gtk-- アプリケーションフレームワーク +Name[nds]="Gtk--"-Programmrahmenwark +Name[ne]=Gtk-- अनुप्रयोग फ्रेमवर्क +Name[nl]=Gtk-- Applicationframework +Name[pl]=Szablon programu Gtk-- +Name[pt]=Plataforma de aplicações em Gtk-- +Name[pt_BR]=Plataforma de aplicações em Gtk-- +Name[ru]=Приложение Gtk-- +Name[sk]=Gtk-- aplikačný framework +Name[sl]=Ogrodje programa za Gtk-- +Name[sr]=Радни оквир Gtk-- програма +Name[sr@Latn]=Radni okvir Gtk-- programa +Name[sv]=Gtk-- programramverk +Name[tr]=Gtk-- Uygulama Çatısı +Name[zh_CN]=Gtk-- 应用程序框架 +Name[zh_TW]=Gtk-- 應用程式框架 +Category=C++/GTK+ +Icon=gtk2mmapp.png +Comment=Generates a simple Gtk-- application. Gtkmm >= 2.8.0 should be installed. To edit glade file glade-- (http://home.wtal.de/petig/Gtk/) is required. +Comment[ca]=Genera una simple aplicació Gtk. Gtkmm >= 2.8.0 hauria d'estar instal·lat. Per editar el fitxer glade es requereix glade-- (http://home.wtal.de/petig/Gtk/). +Comment[da]=Genererer et simpelt Gtk-- program. Gtkmm >= 2.8.0 skal være installeret. For at redigere glade file glade-- kræves (http://home.wtal.de/petig/Gtk/). +Comment[de]=Erstellt eine einfache Gtk-Anwendung. Gtkmm >= 1.2.8 und < 1.3.0 sollte installiert sein. Zum Bearbeiten der glade-Datei ist glade-- (http://home.wtal.de/petig/Gtk/) erforderlich. +Comment[el]=Δημιουργεί μια απλή εφαρμογή Gtk. Το Gtkmm >= 2.8.0 πρέπει να είναι εγκατεστημένο. Για την επεξεργασία του αρχείου glade απαιτείται το glade (http://home.wtal.de/petig/Gtk/). +Comment[es]=Genera una sencilla aplicación Gtk--. Debe tener instalado Gtkmm >= 2.8.0. Para editar archivos glade se necesita glade-- (http://home.wtal.de/petig/Gtk/). +Comment[et]=Lihtsa Gtk-- rakenduse loomine. Paigaldatud peab olema Gtkmm >= 2.8.0. Glade-faili redigeerimiseks on vajalik glade-- (http://home.wtal.de/petig/Gtk/). +Comment[fr]=Génère une application Gtk-- simple. Gtkmm >= 2.8.0 devra être installé. Pour modifier le fichier glade, glade-- (http://home.wtal.de/petig/Gtk/) est requis. +Comment[hu]=Létrehoz egy egyszerű Gtk---alapú alkalmazást. Gtkmm >= 2.8.0 szükséges hozzá. Glade-fájl szerkesztéséhez glade-- (http://home.wtal.de/petig/Gtk/) szükséges. +Comment[it]=Genera una semplice applicazione Gtk--. Dovrebbe essere installato Gtkmm >= 2.8.0. Per modificare il file di glade bisogna avere glade-- installato (http://home.wtal.de/petig/Gtk/). +Comment[ja]=簡単な Gtk-- アプリケーションを作成します。Gtkmm >= 2.8.0 が必要です。Glade ファイルを編集するには glade (http://home.wtal.de/petig/Gtk/) が必要です。 +Comment[nds]=Stellt en eenfach "Gtk--"-Programm op. Gtkmm >= 2.8.0 schull installeert wesen. För't Bewerken vun de glade-Datei deit "glade--" (http://home.wtal.de/petig/Gtk/) noot. +Comment[nl]=Genereert een eenvoudige Gtk-- toepassing. Gtkmm >= 2.8.0 dient te zijn geïnstalleerd. Om het glade-bestand te kunnen bewerken hebt u glade-- (http://home.wtal.de/petig/Gtk/) nodig. +Comment[pl]=Generuje prosty program Gtk--. Powinno być zainstalowane Gtkmm w wersji >= 2.8.0. Do modyfikacji plików glade konieczne jest glade-- (http://home.wtal.de/petig/Gtk/). +Comment[pt]=Gera uma aplicação simples em Gtk--. Deverá estar instalado o Gtkmm >= 2.8.0. Para editar o ficheiro do Glade,, é necessário o glade-- (http://home.wtal.de/petig/Gtk/). +Comment[pt_BR]=Gera uma aplicação simples em Gtk--. Deverá estar instalado o Gtkmm >= 2.8.0. Para editar o ficheiro do Glade,, é necessário o glade-- (http://home.wtal.de/petig/Gtk/). +Comment[ru]=Создание простого приложения Gtk--. Требуется Gtkmm >= 1.2.8 и < 1.3.0. Для редактирования файла glade нужна соответствующая программа (http://home.wtal.de/petig/Gtk/). +Comment[sk]=Vygeneruje jednoduchú Gtk-- aplikáciu. Vyžaduje nainštalované Gtkmm >= 2.8.0. Na editovanie glade súboru he potrebný glade-- (http://home.wtal.de/petig/Gtk/). +Comment[sr]=Прави једноставан Gtk-- програм. Gtkmm >= 2.8.0 требало би да је инсталиран. Да бисте уређивали glade фајл, неопходан је glade-- (http://home.wtal.de/petig/Gtk/). +Comment[sr@Latn]=Pravi jednostavan Gtk-- program. Gtkmm >= 2.8.0 trebalo bi da je instaliran. Da biste uređivali glade fajl, neophodan je glade-- (http://home.wtal.de/petig/Gtk/). +Comment[sv]=Skapar ett enkelt Gtk-- program. Gtkmm >= 2.8.0 måste vara installerat. För att redigera glade-filer krävs glade-- (http://home.wtal.de/petig/Gtk/). +Comment[zh_TW]=產生一個簡單的 Gtk-- 應用程式。要先安裝 Gtkmm 版本 >= 2.8.0。要編輯 glade 檔則要先安裝 glade-- (http://home.wtal.de/petig/Gtk/)。 +FileTemplates=hh,CStyle,cc,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=gtk2mmapp.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/configure.in +Dest=%{dest}/configure.in + +[FILE4] +Type=install +Source=%{src}/acconfig.h +Dest=%{dest}/acconfig.h + +[FILE5] +Type=install +Source=%{src}/config.h +Dest=%{dest}/config.h + +[FILE6] +Type=install +Source=%{src}/autogen.sh +Dest=%{dest}/autogen.sh + +[FILE7] +Type=install +Source=%{src}/gtk2mm.glade +Dest=%{dest}/%{APPNAMELC}.glade + +[FILE8] +Type=install +Source=%{src}/gtk2mm.gladep +Dest=%{dest}/%{APPNAMELC}.gladep + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE9] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE10] +Type=install +Source=%{src}/gtk2mm.cc +Dest=%{dest}/src/%{APPNAMELC}.cc + +[FILE11] +Type=install +Source=%{src}/main_window.hh +Dest=%{dest}/src/main_window.hh + +[FILE12] +Type=install +Source=%{src}/main_window.cc +Dest=%{dest}/src/main_window.cc + +[FILE13] +Type=install +Source=%{src}/main_window_glade.hh +Dest=%{dest}/src/main_window_glade.hh + +[FILE14] +Type=install +Source=%{src}/main_window_glade.cc +Dest=%{dest}/src/main_window_glade.cc + +[MSG] +Type=message +Comment=A Gtk-- application framework was created in %{dest} +Comment[ca]=Una infraestructura d'aplicació Gtk-- ha estat creada en %{dest} +Comment[da]=Et Gtk-- programskelet blev oprettet i %{dest} +Comment[de]=Ein Gtk-Anwendungsgerüst wurde in %{dest} erstellt. +Comment[el]=Ένα πλαίσιο εφαρμογής Gtk δημιουργήθηκε στο %{dest} +Comment[es]=Una infraestructura de aplicación Gtk-- ha sido creada en %{dest} +Comment[et]=Gtk-- rakenduse raamistik loodi asukohta %{dest} +Comment[eu]=Gtk-- aplikazioen lan-marko bat sortu da hemen: %{dest} +Comment[fa]=یک چارچوب کاربرد Gtk-- در %{dest} ایجاد شد +Comment[fr]=Une infrastructure d'application Gtk-- a été créée dans %{dest} +Comment[ga]=Cruthaíodh creatlach feidhmchláir Gtk-- i %{dest} +Comment[gl]=Creouse un contorno de traballo para aplicación Gtk en %{dest} +Comment[hu]=Létrejött egy Gtk-s alkalmazás-keretrendszer itt: %{dest} +Comment[it]=È stata creata l'infrastruttura per un'applicazione Gtk-- in %{dest} +Comment[ja]=Gtk-- アプリケーションフレームワークを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en "Gtk-- "-Programmrahmenwark opstellt +Comment[ne]=Gtk-- अनुप्रयोग फ्रेमवर्क %{dest} मा सिर्जना गरियो +Comment[nl]=Een Gtk-- toepassing is aangemaakt in %{dest} +Comment[pl]=Szablon programu Gtk-- został utworzony w %{dest} +Comment[pt]=Foi criada a plataforma de uma aplicação Gtk-- em %{dest} +Comment[pt_BR]=Foi criada a plataforma de uma aplicação Gtk-- em %{dest} +Comment[ru]=Приложение Gtk-- создано в %{dest} +Comment[sk]=Gtk-- aplikačný framework bol vytvorený v %{dest} +Comment[sl]=Ogrodje za program v Gtk-- je bil ustvarjen v %{dest} +Comment[sr]=Радни оквир Gtk-- програма направљен је у %{dest} +Comment[sr@Latn]=Radni okvir Gtk-- programa napravljen je u %{dest} +Comment[sv]=Ett Gtk-- programramverk skapades i %{dest} +Comment[tr]=Bir Gtk-- uygulama çatısı %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个 Gtk-- 应用程序框架 +Comment[zh_TW]=一個 Gtk-- 應用程式框架已建立於 %{dest} diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.png b/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.png new file mode 100644 index 00000000..253a6229 Binary files /dev/null and b/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.png differ diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window.cc b/languages/cpp/app_templates/gtk2mmapp/main_window.cc new file mode 100644 index 00000000..ad36b327 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window.cc @@ -0,0 +1,12 @@ +%{CC_TEMPLATE} + +// newer (non customized) versions of this file go to main_window.cc_new + +// This file is for your program, I won't touch it again! + +#include "config.h" +#include "main_window.hh" + +bool main_window::quit(GdkEventAny *ev) +{ return 0; +} diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window.hh b/languages/cpp/app_templates/gtk2mmapp/main_window.hh new file mode 100644 index 00000000..640e1461 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window.hh @@ -0,0 +1,19 @@ +%{HH_TEMPLATE} + +// newer (non customized) versions of this file go to main_window.hh_new + +// you might replace +// class foo : public foo_glade { ... }; +// by +// typedef foo_glade foo; +// if you didn't make any modifications to the widget + +#ifndef _MAIN_WINDOW_HH +# include "main_window_glade.hh" +# define _MAIN_WINDOW_HH +class main_window : public main_window_glade +{ + + bool quit(GdkEventAny *ev); +}; +#endif diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc new file mode 100644 index 00000000..829855a8 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc @@ -0,0 +1,40 @@ +%{CC_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using glade-- +// for gtk 2.8.3 and gtkmm 2.8.0 +// +// Please modify the corresponding derived classes in ./src/main_window.cc + + +#if defined __GNUC__ && __GNUC__ < 3 +#error This program will crash if compiled with g++ 2.x +// see the dynamic_cast bug in the gtkmm FAQ +#endif // +#include "config.h" +#include +#if GTKMM_MAJOR_VERSION==2 && GTKMM_MINOR_VERSION>2 +#include +#define GMM_GTKMM_22_24(a,b) b +#else //gtkmm 2.2 +#define GMM_GTKMM_22_24(a,b) a +#endif // +#include "main_window_glade.hh" +#include +#include + +main_window_glade::main_window_glade( +) : Gtk::Window(Gtk::WINDOW_TOPLEVEL) +{ main_window = this; + gmm_data = new GlademmData(get_accel_group()); + main_window->set_title("%{APPNAME} Project"); + main_window->set_modal(false); + main_window->property_window_position().set_value(Gtk::WIN_POS_CENTER); + main_window->set_resizable(true); + main_window->property_destroy_with_parent().set_value(false); + main_window->show(); + main_window->signal_delete_event().connect(SigC::slot(*this, &main_window_glade::quit), false); +} + +main_window_glade::~main_window_glade() +{ delete gmm_data; +} diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh new file mode 100644 index 00000000..3c0cc27a --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh @@ -0,0 +1,48 @@ +%{HH_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using glade-- +// for gtk 2.8.3 and gtkmm 2.8.0 +// +// Please modify the corresponding derived classes in ./src/main_window.hh and./src/main_window.cc + +#ifndef _MAIN_WINDOW_GLADE_HH +# define _MAIN_WINDOW_GLADE_HH + + +#if !defined(GLADEMM_DATA) +#define GLADEMM_DATA +#include + +class GlademmData +{ + + Glib::RefPtr accgrp; +public: + + GlademmData(Glib::RefPtr ag) : accgrp(ag) + { + } + + Glib::RefPtr getAccelGroup() + { return accgrp; + } +}; +#endif //GLADEMM_DATA + +#include + +class main_window_glade : public Gtk::Window +{ + + GlademmData *gmm_data; +public: + class Gtk::Window * main_window; +protected: + + main_window_glade(); + + ~main_window_glade(); +private: + virtual bool quit(GdkEventAny *ev) = 0; +}; +#endif diff --git a/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am b/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am new file mode 100644 index 00000000..a8c856e9 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am @@ -0,0 +1,14 @@ +bin_PROGRAMS = %{APPNAMELC} + +%{APPNAMELC}_SOURCES = \ + %{APPNAMELC}.cc\ + main_window_glade.cc \ + main_window.cc + +noinst_HEADERS = \ + main_window_glade.hh \ + main_window.hh + +AM_CXXFLAGS = @CXXFLAGS@ @GTKMM_CFLAGS@ + +%{APPNAMELC}_LDADD = @LIBS@ @GTKMM_LIBS@ diff --git a/languages/cpp/app_templates/kapp/.kdev_ignore b/languages/cpp/app_templates/kapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kapp/Makefile.am b/languages/cpp/app_templates/kapp/Makefile.am new file mode 100644 index 00000000..efe532d3 --- /dev/null +++ b/languages/cpp/app_templates/kapp/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = app.cpp app.h pref.cpp pref.h appview.cpp appview.h \ + appiface.h app_client.cpp main.cpp appui.rc src-Makefile.am \ + kapp.png app.kdevelop subdirs README + +templateName = kapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kapp/README b/languages/cpp/app_templates/kapp/README new file mode 100644 index 00000000..f04a5635 --- /dev/null +++ b/languages/cpp/app_templates/kapp/README @@ -0,0 +1,81 @@ +----------------------------------------------- +Kde application framework template quickstart +Author: Thomas Nagy +Date: 2004-03-22 +----------------------------------------------- + +This README file explains you basic things for starting with +this application template. + + +** Building and installing ** + +* Build the configure script by "make -f Makefile.cvs" + +* To clean, use "make clean", and to clean everything +(remove the makefiles, etc), use "make distclean" + +* To distribute your program, try "make dist". +This will make a compact tarball archive of your release with the +necessary scripts inside. + +* Modifying the auto-tools scripts +for automake scripts there is an excellent tutorial there : +http://developer.kde.org/documentation/other/makefile_am_howto.html + +* Simplify your life : install the project in your home directory for +testing purposes. +./configure --prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use KConfig XT to create your configuration dialogs and make +them more maintainable. + +For more details, consult : +http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-kparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +KDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + + + diff --git a/languages/cpp/app_templates/kapp/app.cpp b/languages/cpp/app_templates/kapp/app.cpp new file mode 100644 index 00000000..5460bba9 --- /dev/null +++ b/languages/cpp/app_templates/kapp/app.cpp @@ -0,0 +1,247 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include "pref.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +%{APPNAME}::%{APPNAME}() + : KMainWindow( 0, "%{APPNAME}" ), + m_view(new %{APPNAME}View(this)), + m_printer(0) +{ + // accept dnd + setAcceptDrops(true); + + // tell the KMainWindow that this is indeed the main widget + setCentralWidget(m_view); + + // then, setup our actions + setupActions(); + + // and a status bar + statusBar()->show(); + + // Apply the create the main window and ask the mainwindow to + // automatically save settings if changed: window size, toolbar + // position, icon size, etc. Also to add actions for the statusbar + // toolbar, and keybindings if necessary. + setupGUI(); + + // allow the view to change the statusbar and caption + connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)), + this, SLOT(changeStatusbar(const QString&))); + connect(m_view, SIGNAL(signalChangeCaption(const QString&)), + this, SLOT(changeCaption(const QString&))); + +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +void %{APPNAME}::load(const KURL& url) +{ + QString target; + // the below code is what you should normally do. in this + // example case, we want the url to our own. you probably + // want to use this code instead for your app + + #if 0 + // download the contents + if (KIO::NetAccess::download(url, target)) + { + // set our caption + setCaption(url); + + // load in the file (target is always local) + loadFile(target); + + // and remove the temp file + KIO::NetAccess::removeTempFile(target); + } + #endif + + setCaption(url.prettyURL()); + m_view->openURL(url); +} + +void %{APPNAME}::setupActions() +{ + KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStdAction::open(this, SLOT(fileOpen()), actionCollection()); + KStdAction::save(this, SLOT(fileSave()), actionCollection()); + KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); + KStdAction::print(this, SLOT(filePrint()), actionCollection()); + KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + + KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + // this doesn't do anything useful. it's just here to illustrate + // how to insert a custom menu and menu item + KAction *custom = new KAction(i18n("Cus&tom Menuitem"), 0, + this, SLOT(optionsPreferences()), + actionCollection(), "custom_action"); +} + +void %{APPNAME}::saveProperties(KConfig *config) +{ + // the 'config' object points to the session managed + // config file. anything you write here will be available + // later when this app is restored + + if (!m_view->currentURL().isEmpty()) { +#if KDE_IS_VERSION(3,1,3) + config->writePathEntry("lastURL", m_view->currentURL()); +#else + config->writeEntry("lastURL", m_view->currentURL()); +#endif + } +} + +void %{APPNAME}::readProperties(KConfig *config) +{ + // the 'config' object points to the session managed + // config file. this function is automatically called whenever + // the app is being restored. read in here whatever you wrote + // in 'saveProperties' + + QString url = config->readPathEntry("lastURL"); + + if (!url.isEmpty()) + m_view->openURL(KURL(url)); +} + +void %{APPNAME}::dragEnterEvent(QDragEnterEvent *event) +{ + // accept uri drops only + event->accept(KURLDrag::canDecode(event)); +} + +void %{APPNAME}::dropEvent(QDropEvent *event) +{ + // this is a very simplistic implementation of a drop event. we + // will only accept a dropped URL. the Qt dnd code can do *much* + // much more, so please read the docs there + KURL::List urls; + + // see if we can decode a URI.. if not, just ignore it + if (KURLDrag::decode(event, urls) && !urls.isEmpty()) + { + // okay, we have a URI.. process it + const KURL &url = urls.first(); + + // load in the file + load(url); + } +} + +void %{APPNAME}::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // create a new window + (new %{APPNAME})->show(); +} + +void %{APPNAME}::fileOpen() +{ + // this slot is called whenever the File->Open menu is selected, + // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + // button is clicked +/* + // this brings up the generic open dialog + KURL url = KURLRequesterDlg::getURL(QString::null, this, i18n("Open Location") ); +*/ + // standard filedialog + KURL url = KFileDialog::getOpenURL(QString::null, QString::null, this, i18n("Open Location")); + if (!url.isEmpty()) + m_view->openURL(url); +} + +void %{APPNAME}::fileSave() +{ + // this slot is called whenever the File->Save menu is selected, + // the Save shortcut is pressed (usually CTRL+S) or the Save toolbar + // button is clicked + + // save the current file +} + +void %{APPNAME}::fileSaveAs() +{ + // this slot is called whenever the File->Save As menu is selected, + KURL file_url = KFileDialog::getSaveURL(); + if (!file_url.isEmpty() && file_url.isValid()) + { + // save your info, here + } +} + +void %{APPNAME}::filePrint() +{ + // this slot is called whenever the File->Print menu is selected, + // the Print shortcut is pressed (usually CTRL+P) or the Print toolbar + // button is clicked + if (!m_printer) m_printer = new KPrinter; + if (m_printer->setup(this)) + { + // setup the printer. with Qt, you always "print" to a + // QPainter.. whether the output medium is a pixmap, a screen, + // or paper + QPainter p; + p.begin(m_printer); + + // we let our view do the actual printing + QPaintDeviceMetrics metrics(m_printer); + m_view->print(&p, metrics.height(), metrics.width()); + + // and send the result to the printer + p.end(); + } +} + +void %{APPNAME}::optionsPreferences() +{ + // popup some sort of preference dialog, here + %{APPNAME}Preferences dlg; + if (dlg.exec()) + { + // redo your settings + } +} + +void %{APPNAME}::changeStatusbar(const QString& text) +{ + // display the text on the statusbar + statusBar()->message(text); +} + +void %{APPNAME}::changeCaption(const QString& text) +{ + // display the text on the caption + setCaption(text); +} +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/kapp/app.desktop b/languages/cpp/app_templates/kapp/app.desktop new file mode 100644 index 00000000..7389904a --- /dev/null +++ b/languages/cpp/app_templates/kapp/app.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} %i -caption "%c" +Icon=%{APPNAMELC} +Type=Application +X-DocPath=%{APPNAMELC}/%{APPNAMELC}.html +Comment=A KDE KPart Application +Comment[br]=Ur meziant Kpart evit KDE +Comment[ca]=Una aplicació KPart per al KDE +Comment[cy]=Cymhwysiad KPart KDE +Comment[da]=Et KDE KPart-program +Comment[de]=Eine auf der Komponententechnik KPart basierende KDE-Anwendung +Comment[el]=Μια εφαρμογή KPart του KDE +Comment[es]=Una aplicación KPart de KDE +Comment[et]=KDE KPart rakendus +Comment[eu]=KDE KPart aplikazio bat +Comment[fa]=یک کاربرد KDE KPart +Comment[fr]=Une application KPart pour KDE +Comment[ga]=Feidhmchlár KPart KDE +Comment[gl]=Unha aplicación KPart de KDE +Comment[hi]=एक केडीई के-पार्ट अनुप्रयोग +Comment[hu]=KPart-alapú KDE-alkalmazás +Comment[is]=KDE KPart forrit +Comment[it]=Applicazione KPart di KDE +Comment[ja]=KDE KPart アプリケーション +Comment[lt]=KDE KPart programa +Comment[nds]=En KPart-Deelprogramm för KDE +Comment[ne]=एउटा केडीई KPart अनुप्रयोग +Comment[nl]=Een KDE KPart-toepassing +Comment[pl]=Osadzalny element KPart KDE +Comment[pt]=Uma Aplicação KPart do KDE +Comment[pt_BR]=Um Aplicativo KPart do KDE +Comment[ru]=Приложение KPart для KDE +Comment[sk]=KDE KPart aplikácia +Comment[sl]=Program KPart za KDE +Comment[sr]=KDE KPart програм +Comment[sr@Latn]=KDE KPart program +Comment[sv]=Ett KDE Kpart-program +Comment[ta]=கெடி கெபார்ட் பயன்பாடு +Comment[tg]=Ба кор андохтани KPart барои KDE +Comment[tr]=Bir KDE KPart Uygulaması +Comment[zh_CN]=一个 KDE KPart 应用程序 +Comment[zh_TW]=KDE KPart 應用程式 +Terminal=false diff --git a/languages/cpp/app_templates/kapp/app.h b/languages/cpp/app_templates/kapp/app.h new file mode 100644 index 00000000..45c65f4b --- /dev/null +++ b/languages/cpp/app_templates/kapp/app.h @@ -0,0 +1,89 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "%{APPNAMELC}view.h" + +class KPrinter; +class KURL; + +/** + * This class serves as the main window for %{APPNAME}. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME} : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); + + /** + * Use this method to load whatever file/URL you have + */ + void load(const KURL& url); + +protected: + /** + * Overridden virtuals for Qt drag 'n drop (XDND) + */ + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dropEvent(QDropEvent *event); + +protected: + /** + * This function is called when it is time for the app to save its + * properties for session management purposes. + */ + void saveProperties(KConfig *); + + /** + * This function is called when this app is restored. The KConfig + * object points to the session management config file that was saved + * with @ref saveProperties + */ + void readProperties(KConfig *); + + +private slots: + void fileNew(); + void fileOpen(); + void fileSave(); + void fileSaveAs(); + void filePrint(); + void optionsPreferences(); + + void changeStatusbar(const QString& text); + void changeCaption(const QString& text); + +private: + void setupAccel(); + void setupActions(); + +private: + %{APPNAME}View *m_view; + + KPrinter *m_printer; +}; + +#endif // _%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/kapp/app.kdevelop b/languages/cpp/app_templates/kapp/app.kdevelop new file mode 100644 index 00000000..07cf3f0f --- /dev/null +++ b/languages/cpp/app_templates/kapp/app.kdevelop @@ -0,0 +1,168 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + . + false + + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + false + + + + + + + false + 1 + false + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + true + false + false + true + + + false + true + + + + + + + + + + + + -f + + -dP + + -f + -u3 -p + + + + + + + false + + + .h + .cpp + true + + + + true + 2 + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kapp/app.kdevses b/languages/cpp/app_templates/kapp/app.kdevses new file mode 100644 index 00000000..dcd1c8c1 --- /dev/null +++ b/languages/cpp/app_templates/kapp/app.kdevses @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/languages/cpp/app_templates/kapp/app_client.cpp b/languages/cpp/app_templates/kapp/app_client.cpp new file mode 100644 index 00000000..5c062077 --- /dev/null +++ b/languages/cpp/app_templates/kapp/app_client.cpp @@ -0,0 +1,26 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + KApplication app(argc, argv, "%{APPNAMELC}_client", false); + + // get our DCOP client and attach so that we may use it + DCOPClient *client = app.dcopClient(); + client->attach(); + + // do a 'send' for now + QByteArray data; + QDataStream ds(data, IO_WriteOnly); + if (argc > 1) + ds << QString(argv[1]); + else + ds << QString("http://www.kde.org"); + client->send("%{APPNAMELC}", "%{APPNAME}Iface", "openURL(QString)", data); + + return app.exec(); +} diff --git a/languages/cpp/app_templates/kapp/appiface.h b/languages/cpp/app_templates/kapp/appiface.h new file mode 100644 index 00000000..4a24ae7f --- /dev/null +++ b/languages/cpp/app_templates/kapp/appiface.h @@ -0,0 +1,17 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}IFACE_H_ +#define _%{APPNAMEUC}IFACE_H_ + +#include + +class %{APPNAME}Iface : virtual public DCOPObject +{ + K_DCOP +public: + +k_dcop: + virtual void openURL(QString url) = 0; +}; + +#endif // _%{APPNAMEUC}IFACE_H_ diff --git a/languages/cpp/app_templates/kapp/appui.rc b/languages/cpp/app_templates/kapp/appui.rc new file mode 100644 index 00000000..ceb4f14e --- /dev/null +++ b/languages/cpp/app_templates/kapp/appui.rc @@ -0,0 +1,8 @@ + + + + C&ustom + + + + diff --git a/languages/cpp/app_templates/kapp/appview.cpp b/languages/cpp/app_templates/kapp/appview.cpp new file mode 100644 index 00000000..a57adbf3 --- /dev/null +++ b/languages/cpp/app_templates/kapp/appview.cpp @@ -0,0 +1,107 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}view.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include + +%{APPNAME}View::%{APPNAME}View(QWidget *parent) + : QWidget(parent), + DCOPObject("%{APPNAME}Iface") +{ + // setup our layout manager to automatically add our widgets + QHBoxLayout *top_layout = new QHBoxLayout(this); + top_layout->setAutoAdd(true); + + // we want to look for all components that satisfy our needs. the + // trader will actually search through *all* registered KDE + // applications and components -- not just KParts. So we have to + // specify two things: a service type and a constraint + // + // the service type is like a mime type. we say that we want all + // applications and components that can handle HTML -- 'text/html' + // + // however, by itself, this will return such things as Netscape.. + // not what we wanted. so we constrain it by saying that the + // string 'KParts/ReadOnlyPart' must be found in the ServiceTypes + // field. with this, only components of the type we want will be + // returned. + KTrader::OfferList offers = KTrader::self()->query("text/html", "'KParts/ReadOnlyPart' in ServiceTypes"); + + KLibFactory *factory = 0; + // in theory, we only care about the first one.. but let's try all + // offers just in case the first can't be loaded for some reason + KTrader::OfferList::Iterator it(offers.begin()); + for( ; it != offers.end(); ++it) + { + KService::Ptr ptr = (*it); + + // we now know that our offer can handle HTML and is a part. + // since it is a part, it must also have a library... let's try to + // load that now + factory = KLibLoader::self()->factory( ptr->library() ); + if (factory) + { + m_html = static_cast(factory->create(this, ptr->name(), "KParts::ReadOnlyPart")); + break; + } + } + + // if our factory is invalid, then we never found our component + // and we might as well just exit now + if (!factory) + { + KMessageBox::error(this, i18n("Could not find a suitable HTML component")); + return; + } + + connect(m_html, SIGNAL(setWindowCaption(const QString&)), + this, SLOT(slotSetTitle(const QString&))); + connect(m_html, SIGNAL(setStatusBarText(const QString&)), + this, SLOT(slotOnURL(const QString&))); + +} + +%{APPNAME}View::~%{APPNAME}View() +{ +} + +void %{APPNAME}View::print(QPainter *p, int height, int width) +{ + // do the actual printing, here + // p->drawText(etc..) +} + +QString %{APPNAME}View::currentURL() +{ + return m_html->url().url(); +} + +void %{APPNAME}View::openURL(QString url) +{ + openURL(KURL(url)); +} + +void %{APPNAME}View::openURL(const KURL& url) +{ + m_html->openURL(url); +} + +void %{APPNAME}View::slotOnURL(const QString& url) +{ + emit signalChangeStatusbar(url); +} + +void %{APPNAME}View::slotSetTitle(const QString& title) +{ + emit signalChangeCaption(title); +} +#include "%{APPNAMELC}view.moc" diff --git a/languages/cpp/app_templates/kapp/appview.h b/languages/cpp/app_templates/kapp/appview.h new file mode 100644 index 00000000..ae0c6b6d --- /dev/null +++ b/languages/cpp/app_templates/kapp/appview.h @@ -0,0 +1,77 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}VIEW_H_ +#define _%{APPNAMEUC}VIEW_H_ + +#include +#include +#include <%{APPNAMELC}iface.h> + +class QPainter; +class KURL; + +/** + * This is the main view class for %{APPNAME}. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * + * This %{APPNAMELC} uses an HTML component as an example. + * + * @short Main view + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME}View : public QWidget, public %{APPNAME}Iface +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAME}View(QWidget *parent); + + /** + * Destructor + */ + virtual ~%{APPNAME}View(); + + /** + * Random 'get' function + */ + QString currentURL(); + + /** + * Random 'set' function accessed by DCOP + */ + virtual void openURL(QString url); + + /** + * Random 'set' function + */ + virtual void openURL(const KURL& url); + + /** + * Print this view to any medium -- paper or not + */ + void print(QPainter *, int height, int width); + +signals: + /** + * Use this signal to change the content of the statusbar + */ + void signalChangeStatusbar(const QString& text); + + /** + * Use this signal to change the content of the caption + */ + void signalChangeCaption(const QString& text); + +private slots: + void slotOnURL(const QString& url); + void slotSetTitle(const QString& title); + +private: + KParts::ReadOnlyPart *m_html; +}; + +#endif // _%{APPNAMEUC}VIEW_H_ diff --git a/languages/cpp/app_templates/kapp/kapp.kdevtemplate b/languages/cpp/app_templates/kapp/kapp.kdevtemplate new file mode 100644 index 00000000..7865c973 --- /dev/null +++ b/languages/cpp/app_templates/kapp/kapp.kdevtemplate @@ -0,0 +1,253 @@ +# KDE Config File +[General] +Name=Application framework +Name[ca]=Infraestructura d'aplicacions +Name[da]=Programskelet +Name[de]=Anwendungsgrundgerüst +Name[el]=Πλαίσιο εφαρμογής +Name[es]=Infraestructura de aplicación +Name[et]=Rakenduse raamistik +Name[eu]=Aplikazioen lan-markoa +Name[fa]=چارچوب کاربرد +Name[fr]=Infrastructure d'application +Name[ga]=Creatlach feidhmchláir +Name[gl]=Entorno de traballo para aplicación +Name[hu]=Alkalmazás-keretrendszer +Name[it]=Infrastruttura applicativa +Name[ja]=アプリケーションフレームワーク +Name[nds]=Programmrahmenwark +Name[ne]=अनुप्रयोग फ्रेमवर्क +Name[nl]=Applicationframework +Name[pl]=Szablon programu +Name[pt]=Plataforma de aplicações +Name[pt_BR]=Plataforma de aplicações +Name[ru]=Приложение KDE +Name[sk]=Aplikačný framework +Name[sl]=Ogrodje programa +Name[sr]=Радни оквир програма +Name[sr@Latn]=Radni okvir programa +Name[sv]=Programramverk +Name[tr]=Uygulama Çatısı +Name[zh_CN]=应用程序框架 +Name[zh_TW]=應用程式框架 +Icon=kapp.png +Category=C++/KDE +Comment=Generates a simple KDE application with one toplevel window, menus and toolbars. A DCOP interface is also provided, so that your application can provide a scripting interface +Comment[ca]=Genera una simple aplicació per al KDE amb una finestra principal, menús i barres d'eines. També es proveeix la interfície DCOP, de manera que la vostra aplicació podrà proveir d'una interfície per a scripts +Comment[da]=Genererer et simpelt KDE program med et vindue på topniveau, menuer og værktøjslinjer. Der sørges også for en DCOP-grænseflade, så dit program kan sørge for en script-grænseflade +Comment[de]=Erstellt eine einfache KDE-Anwendung mit einem Toplevel-Fenster, Menüs und Werkzeugleisten. Dazu kommt eine DCOP-Schnittstelle, so dass Ihre Anwendung eine Schnittstelle für Skripte anbieten kann. +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE με ένα ανώτερο παράθυρο, μενού και γραμμές εργαλείων. Μια διασύνδεση DCOP προσφέρεται επίσης, έτσι ώστε η εφαρμογή σας να προσφέρει ένα περιβάλλον γραφής σεναρίων +Comment[es]=Genera una sencilla aplicación de KDE con una ventana de nivel superior, menús y barras de herramientas. También se proporciona una interfaz DCOP para que su aplicación pueda proporcionar una interfaz para guiones de órdenes. +Comment[et]=Lihtsa KDE rakenduse loomine ühe tipptaseme akna, menüüde ja tööriistaribadega. Lisatakse ka DCOP-liides, mis võimaldab pakkuda rakenduses ka skriptikeelte tuge. +Comment[eu]=KDE aplikazio sinple bat sortzen du menu eta tresna-barradun goi-mailako lehio batekin. DCOP interfaze bat ere eskeintzen zaio aplikazioari, zure aplikazioak script interfaze bat izan dezan +Comment[fa]=یک کاربرد سادۀ KDE با یک پنجرۀ سطح بالا، گزینگان و میله ابزارها تولید می‌کند. همچنین یک واسط DCOP فراهم است. بنابراین، کاربرد شما یک واسط دست‌نوشته‌ای را می‌تواند فراهم کند +Comment[fr]=Génère une application KDE simple comprenant une fenêtre de premier niveau, des menus et des barres d'outils. Une interface DCOP est également prévue, afin que votre application puisse offrir une interface de scriptage +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí KDE le príomhfhuinneog amháin, roghchláir agus barraí uirlisí. Soláthraítear comhéadan DCOP freisin, d'fhonn is féidir comhéadan scriptithe a chur ar fáil +Comment[gl]=Xera unha aplicación KDE sinxela cunha xanela principal, menús e barras de ferramentas. Tamén se proporciona unha interface DCOP de modo que a súa aplicación poida proveer unha interface de scripting. +Comment[hu]=Létrehoz egy egyszerű KDE-alkalmazást egy főablakkal, menükkel és eszköztárakkal. DCOP-felület is létre lesz hozva, ezért az alkalmazás szkriptelési felületet is biztosíthat. +Comment[it]=Genera una semplice applicazione KDE con una finestra toplevel, menu e barre degli strumenti. È anche fornita un'interfaccia DCOP così l'applicazione avrà un'interfaccia per lo scripting +Comment[ja]=簡単な KDE アプリケーションを作成します。アプリケーションには、トップレベルのウィンドウ、メニュー、ツールバーがあります。スクリプト化をサポートするために DCOP のインターフェースも用意してあります。 +Comment[nds]=Stellt en eenfach KDE-Programm mit een böverst Finster, Menüs un Warktüüchbalkens op. Ok warrt noch en DCOP-Koppelsteed praatstellt, so dat Dien Programm en Skriptkoppelsteed anbeden kann +Comment[ne]=एउटा उच्चतह सञ्झ्याल, मेनु र उपकरणपट्टीसँग साधारण केडीई अनुप्रयोग उत्पन्न गर्दछ । DCOP पनि प्रदान गरिन्छ, जसले गर्दा तपाईँको अनुप्रयोगले स्क्रिप्टिङ इन्टरफेस प्रदान गर्न सक्दछ +Comment[nl]=Genereert een eenvoudige KDE-toepassing met één toplevel window, menu's en toolbars. Er wordt ook een DCOP-interface aangeleverd, zodat uw toepassing een scripting interface kan aanleveren. +Comment[pl]=Generuje prosty program dla KDE z oknem, menu i paskami narzędzi. Dostępny jest także interfejs DCOP, więc Twoje programy mogą zawierać interfejs do skryptów +Comment[pt]=Gera uma aplicação simples do KDE com uma janela de topo, menus e barras de ferramentas. Também é oferecida uma interface de DCOP, para que a sua aplicação possa fornecer uma interface de programação +Comment[pt_BR]=Gera uma aplicação simples do KDE com uma janela de topo, menus e barras de ferramentas. Também é oferecida uma interface de DCOP, para que a sua aplicação possa fornecer uma interface de programação +Comment[ru]=Создание простого приложения KDE с окном, меню и панелями инструментов. Кроме того, в нём содержится интерфейс DCOP для автоматизации работы с помощью пользовательских скриптов +Comment[sk]=Vygenruje jednoduchú KDE aplikáciu s jedným oknom, menu apanelom nástrojov. Taktiež bude poskytnuté DCOP rozhranie, takže aj aplikáciamôže poskytnúť skriptovacie rozhranie +Comment[sr]=Прави једноставан KDE програм, са једним прозором највишег нивоа, менијима и тракама са алатом. Дат је и DCOP интерфејс, тако да ваш програм може да омогући скриптовање +Comment[sr@Latn]=Pravi jednostavan KDE program, sa jednim prozorom najvišeg nivoa, menijima i trakama sa alatom. Dat je i DCOP interfejs, tako da vaš program može da omogući skriptovanje +Comment[sv]=Skapar ett enkelt KDE-program med ett toppnivåfönster, menyer och verktygsrader. Ett DCOP-gränssnitt tillhandahålls också, så att programmet kan tillhandahålla ett skriptgränssnitt. +Comment[tr]=Bir üst seviye penceresi, menüleri ve araç çubukları olan basit bir KDE uygulaması yaratır. Bir DCOP arayüzü sağlanır, böylece uygulama bir betik arayüzü sağlayabilir. +Comment[zh_CN]=生成一个带一个顶层窗口、菜单和工具栏的简单 KDE 应用程序。另外还提供了 DCOP 接口,这样您的应用也可同时提供脚本接口。 +Comment[zh_TW]=產生一個簡單的 KDE 應用程式,內含頂層視窗、選單與工具列。另外提供一個 DCOP 介面,讓您的應用程式可以提供文稿介面。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}view.cpp,%{dest}/src/README +Archive=kapp.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE13] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE14] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE15] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE16] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE17] +Type=install +Source=%{src}/appview.cpp +Dest=%{dest}/src/%{APPNAMELC}view.cpp + +[FILE18] +Type=install +Source=%{src}/appview.h +Dest=%{dest}/src/%{APPNAMELC}view.h + +[FILE19] +Type=install +Source=%{src}/appiface.h +Dest=%{dest}/src/%{APPNAMELC}iface.h + +[FILE20] +Type=install +Source=%{src}/app_client.cpp +Dest=%{dest}/src/%{APPNAMELC}_client.cpp + +[FILE21] +Type=install +Source=%{src}/pref.cpp +Dest=%{dest}/src/pref.cpp + +[FILE22] +Type=install +Source=%{src}/pref.h +Dest=%{dest}/src/pref.h + +[FILE23] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE24] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE25] +Type=install +Source=%{src}/README +Dest=%{dest}/src/README + +[MSG] +Type=message +Comment=A KDE Application was created at %{dest} +Comment[ca]=Una aplicació per al KDE ha estat creada a %{dest} +Comment[da]=Et KDE program blev oprettet i %{dest} +Comment[de]=Eine KDE-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή KDE δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación de KDE ha sido creada en %{dest} +Comment[et]=KDE rakendus loodi asukohta %{dest} +Comment[eu]=A KDE aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد KDE در %{dest} فراهم شد +Comment[fr]=Une application KDE a été créée dans %{dest} +Comment[ga]=Cruthaíodh Feidhmchlár KDE ag %{dest} +Comment[gl]=Creouse unha aplicación KDE en %{dest} +Comment[hu]=Létrejött egy KDE-s alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KDE in %{dest} +Comment[ja]=KDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KDE-Programm opstellt +Comment[ne]=KDE अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een KDE-toepassing is aangemaakt in %{dest} +Comment[pl]=Program dla KDE został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KDE em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KDE em %{dest} +Comment[ru]=Приложение KDE создано в %{dest} +Comment[sk]=KDE aplikácia bola vytvorená v %{dest} +Comment[sl]=Program za KDE je bil ustvarjen v %{dest} +Comment[sr]=KDE програм је направљен у %{dest} +Comment[sr@Latn]=KDE program je napravljen u %{dest} +Comment[sv]=Ett KDE-program skapades i %{dest} +Comment[tr]=Bir KDE Uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 KDE 应用程序 +Comment[zh_TW]=一個 KDE 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kapp/kapp.png b/languages/cpp/app_templates/kapp/kapp.png new file mode 100644 index 00000000..a421a664 Binary files /dev/null and b/languages/cpp/app_templates/kapp/kapp.png differ diff --git a/languages/cpp/app_templates/kapp/main.cpp b/languages/cpp/app_templates/kapp/main.cpp new file mode 100644 index 00000000..60c161e8 --- /dev/null +++ b/languages/cpp/app_templates/kapp/main.cpp @@ -0,0 +1,61 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + KApplication app; + + // register ourselves as a dcop client + app.dcopClient()->registerAs(app.name(), false); + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->count() == 0) + { + %{APPNAME} *widget = new %{APPNAME}; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++) + { + %{APPNAME} *widget = new %{APPNAME}; + widget->show(); + widget->load(args->url(i)); + } + } + args->clear(); + } + + return app.exec(); +} diff --git a/languages/cpp/app_templates/kapp/pref.cpp b/languages/cpp/app_templates/kapp/pref.cpp new file mode 100644 index 00000000..ee647b1c --- /dev/null +++ b/languages/cpp/app_templates/kapp/pref.cpp @@ -0,0 +1,42 @@ +%{CPP_TEMPLATE} + +#include "pref.h" + +#include + +#include +#include + +%{APPNAME}Preferences::%{APPNAME}Preferences() + : KDialogBase(TreeList, i18n("%{APPNAME} Preferences"), + Help|Default|Ok|Apply|Cancel, Ok) +{ + // this is the base class for your preferences dialog. it is now + // a Treelist dialog.. but there are a number of other + // possibilities (including Tab, Swallow, and just Plain) + QFrame *frame; + frame = addPage(i18n("First Page"), i18n("Page One Options")); + m_pageOne = new %{APPNAME}PrefPageOne(frame); + + frame = addPage(i18n("Second Page"), i18n("Page Two Options")); + m_pageTwo = new %{APPNAME}PrefPageTwo(frame); +} + +%{APPNAME}PrefPageOne::%{APPNAME}PrefPageOne(QWidget *parent) + : QFrame(parent) +{ + QHBoxLayout *layout = new QHBoxLayout(this); + layout->setAutoAdd(true); + + new QLabel(i18n("Add something here"), this); +} + +%{APPNAME}PrefPageTwo::%{APPNAME}PrefPageTwo(QWidget *parent) + : QFrame(parent) +{ + QHBoxLayout *layout = new QHBoxLayout(this); + layout->setAutoAdd(true); + + new QLabel(i18n("Add something here"), this); +} +#include "pref.moc" diff --git a/languages/cpp/app_templates/kapp/pref.h b/languages/cpp/app_templates/kapp/pref.h new file mode 100644 index 00000000..11aec821 --- /dev/null +++ b/languages/cpp/app_templates/kapp/pref.h @@ -0,0 +1,37 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}PREF_H_ +#define _%{APPNAMEUC}PREF_H_ + +#include +#include + +class %{APPNAME}PrefPageOne; +class %{APPNAME}PrefPageTwo; + +class %{APPNAME}Preferences : public KDialogBase +{ + Q_OBJECT +public: + %{APPNAME}Preferences(); + +private: + %{APPNAME}PrefPageOne *m_pageOne; + %{APPNAME}PrefPageTwo *m_pageTwo; +}; + +class %{APPNAME}PrefPageOne : public QFrame +{ + Q_OBJECT +public: + %{APPNAME}PrefPageOne(QWidget *parent = 0); +}; + +class %{APPNAME}PrefPageTwo : public QFrame +{ + Q_OBJECT +public: + %{APPNAME}PrefPageTwo(QWidget *parent = 0); +}; + +#endif // _%{APPNAMEUC}PREF_H_ diff --git a/languages/cpp/app_templates/kapp/src-Makefile.am b/languages/cpp/app_templates/kapp/src-Makefile.am new file mode 100644 index 00000000..51cb1973 --- /dev/null +++ b/languages/cpp/app_templates/kapp/src-Makefile.am @@ -0,0 +1,43 @@ +## Makefile.am for %{APPNAMELC} + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} %{APPNAMELC}_client + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = $(KDE_RPATH) $(all_libraries) + +# the libraries to link against. +%{APPNAMELC}_LDADD = $(LIB_KFILE) $(LIB_KDEPRINT) + +# which sources should be compiled for %{APPNAMELC} +%{APPNAMELC}_SOURCES = main.cpp %{APPNAMELC}.cpp %{APPNAMELC}view.cpp \ + pref.cpp %{APPNAMELC}iface.skel + +# these are the headers for your project +noinst_HEADERS = %{APPNAMELC}.h %{APPNAMELC}view.h pref.h + +# client stuff +%{APPNAMELC}_client_LDFLAGS = $(KDE_RPATH) $(all_libraries) +%{APPNAMELC}_client_LDADD = $(LIB_KDECORE) +%{APPNAMELC}_client_SOURCES = %{APPNAMELC}_client.cpp + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +KDE_ICON = AUTO + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = %{APPNAMELC}.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/%{APPNAMELC} +rc_DATA = %{APPNAMELC}ui.rc diff --git a/languages/cpp/app_templates/kapp/subdirs b/languages/cpp/app_templates/kapp/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kapp/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kateplugin/.kdev_ignore b/languages/cpp/app_templates/kateplugin/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kateplugin/Makefile.am b/languages/cpp/app_templates/kateplugin/Makefile.am new file mode 100644 index 00000000..62da4d60 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/Makefile.am @@ -0,0 +1,19 @@ +templateName = kateplugin +dataFiles = src-Makefile.am plugin_app.cpp plugin_app.h\ + plugin_app.rc hi16-action-plugin.png \ + hi22-action-plugin.png kateplugin.png \ + plugin.kdevelop subdirs plugin.desktop + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kateplugin/hi16-action-plugin.png b/languages/cpp/app_templates/kateplugin/hi16-action-plugin.png new file mode 100644 index 00000000..e2d7bab8 Binary files /dev/null and b/languages/cpp/app_templates/kateplugin/hi16-action-plugin.png differ diff --git a/languages/cpp/app_templates/kateplugin/hi22-action-plugin.png b/languages/cpp/app_templates/kateplugin/hi22-action-plugin.png new file mode 100644 index 00000000..4082bf10 Binary files /dev/null and b/languages/cpp/app_templates/kateplugin/hi22-action-plugin.png differ diff --git a/languages/cpp/app_templates/kateplugin/kateplugin.kdevtemplate b/languages/cpp/app_templates/kateplugin/kateplugin.kdevtemplate new file mode 100644 index 00000000..767a0a57 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/kateplugin.kdevtemplate @@ -0,0 +1,213 @@ +# KDE Config File +[General] +Name=Kate plugin +Name[br]=Lugent Kate +Name[ca]=Connector per a Kate +Name[de]=Kate-Modul +Name[el]=Πρόσθετο Kate +Name[es]=Complemento para Kate +Name[eu]=Kate plugina +Name[fa]=وصلۀ Kate +Name[fr]=Module externe pour Kate +Name[ga]=Breiseán Kate +Name[gl]=Extensión para Kate +Name[hu]=Kate-bővítőmodul +Name[it]=Plugin per Kate +Name[ja]=Kate プラグイン +Name[nds]=Kate-Moduul +Name[ne]=केट प्लगइन +Name[nl]=Kate-plugin +Name[pl]=Wtyczka do Kate +Name[pt]='Plugin' do Kate +Name[pt_BR]='Plugin' do Kate +Name[ru]=Модуль Kate +Name[sk]=Kate modul +Name[sl]=Vstavek za Kate +Name[sr]=Прикључак за Kate +Name[sr@Latn]=Priključak za Kate +Name[sv]=Kate-insticksprogram +Name[tr]=Kate eklentisi +Name[zh_CN]=Kate 插件 +Name[zh_TW]=Kate 外掛程式 +Icon=kateplugin.png +Category=C++/KDE +Comment=Generates a plugin for Kate the text editor. +Comment[ca]=Genera un connector per a l'editor de text Kate. +Comment[da]=Genererer et plugin for teksteditoren kate +Comment[de]=Erstellt ein Modul für den Texteditor Kate +Comment[el]=Δημιουργεί ένα πρόσθετο για το Kate τον επεξεργαστή κειμένου. +Comment[es]=Genera un complemento para el editor de texto Kate. +Comment[et]=Plugina loomine tekstiredaktorile Kate. +Comment[eu]=Plugin bat sortzen du Kate testu-editorearentzat. +Comment[fa]=وصله‌ای برای ویرایشگر متن Kate تولید می‌کند. +Comment[fr]=Génère un module externe pour l'éditeur de texte Kate. +Comment[ga]=Cruthaíonn sé seo breiseán le haghaidh eagarthóir téacs Kate. +Comment[gl]=Xera unha extensión para o editor de textos Kate. +Comment[hu]=Létrehoz egy bővítőmodult a Kate szövegszerkesztőhöz. +Comment[it]=Genera un plugin per l'editor di testo Kate. +Comment[ja]=Kate テキストエディタのためのプラグインを作成します +Comment[nds]=Stellt en Moduul för den Texteditor "Kate" op. +Comment[ne]=केट पाठ सम्पादकका लागि प्लगइन उत्पन्न गर्दछ । +Comment[nl]=Genereert een plugin voor de Kate-teksteditor +Comment[pl]=Generuje wtyczkę do edytora tekstu Kate +Comment[pt]=Gera um 'plugin' para o Kate, o editor de texto. +Comment[pt_BR]=Gera um 'plugin' para o Kate, o editor de texto. +Comment[ru]=Создание модуля для текстового редактора Kate. +Comment[sk]=Vygeneruje modul pre textový editor Kate. +Comment[sl]=Ustvari vstavek za urejevalnik besedil Kate. +Comment[sr]=Прави прикључак за уређивач текста Kate. +Comment[sr@Latn]=Pravi priključak za uređivač teksta Kate. +Comment[sv]=Skapar ett insticksprogram för texteditorn Kate. +Comment[tr]=Kate metin düzenleyicisi için bir eklenti yaratır. +Comment[zh_CN]=生成 Kate 文本编辑器的插件。 +Comment[zh_TW]=產生一個 Kate 文字編輯器的外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/plugin_%{APPNAMELC}.cpp +Archive=kateplugin.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/plugin.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE13] +Type=install +Source=%{src}/plugin_app.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}.cpp + +[FILE14] +Type=install +Source=%{src}/plugin_app.h +Dest=%{dest}/src/plugin_%{APPNAMELC}.h + +[FILE15] +Type=install +EscapeXML=true +Source=%{src}/plugin_app.rc +Dest=%{dest}/src/plugin_%{APPNAMELC}.rc + +[FILE16] +Type=install +Source=%{src}/hi16-action-plugin.png +Dest=%{dest}/src/hi16-action-plugin.png +Process=false + +[FILE17] +Type=install +Source=%{src}/hi22-action-plugin.png +Dest=%{dest}/src/hi32-action-plugin.png +Process=false + +[MSG] +Type=message +Comment=A plugin for Kate was created at %{dest} +Comment[ca]=Un connector per a Kate ha estat creat a %{dest} +Comment[da]=Et plugin for Kate blev oprettet på %{dest} +Comment[de]=Ein Modul für Kate wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο για το Kate δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento para Kate ha sido creado en %{dest} +Comment[et]=Kate plugin loodi asukohta %{dest} +Comment[eu]=Kate plugin bat sortu da hemen: %{dest} +Comment[fa]=وصله‌ای برای Kate در %{dest} ایجاد شد +Comment[fr]=Un module externe pour Kate a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán Kate ag %{dest} +Comment[gl]=Creouse unha extensión para Kate en %{dest} +Comment[hu]=Létrejött egy Kate-bővítőmodul itt: %{dest} +Comment[it]=È stato creato un plugin per Kate in %{dest} +Comment[ja]=Kate のプラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Moduul för "Kate" opstellt +Comment[ne]=केटका लागि प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een plugin voor Kate is aangemaakt in %{dest} +Comment[pl]=Wtyczka dla Kate została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' para o Kate em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' para o Kate em %{dest} +Comment[ru]=Модуль Kate создан в %{dest} +Comment[sk]=Modul pre Kate bol vytvorený v %{dest} +Comment[sl]=Vstavek za Kate je bil ustvarjen v %{dest} +Comment[sr]=Прикључак за Kate направљен је у %{dest} +Comment[sr@Latn]=Priključak za Kate napravljen je u %{dest} +Comment[sv]=Ett insticksprogram för Kate skapades i %{dest} +Comment[tr]=Kate için bir eklenti %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 Kate 的插件 +Comment[zh_TW]=一個 Kate 外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kateplugin/kateplugin.png b/languages/cpp/app_templates/kateplugin/kateplugin.png new file mode 100644 index 00000000..b442a706 Binary files /dev/null and b/languages/cpp/app_templates/kateplugin/kateplugin.png differ diff --git a/languages/cpp/app_templates/kateplugin/plugin.desktop b/languages/cpp/app_templates/kateplugin/plugin.desktop new file mode 100644 index 00000000..761ac763 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/plugin.desktop @@ -0,0 +1,76 @@ +[Desktop Entry] +Type=Service +ServiceTypes=Kate/Plugin +X-KDE-Library=lib%{APPNAMELC}plugin +X-Kate-Version=2.2 +Name=My First Kate Plugin +Name[br]=Ma lugent Kate kentañ +Name[ca]=El meu primer connector per a Kate +Name[cy]=F'ategyn cyntaf Kate +Name[da]=Mit første Kate plugin +Name[de]=Mein erstes Kate-Modul +Name[el]=Το πρώτο μου πρόσθετο για το Kate +Name[es]=Mi primer complemento para Kate +Name[et]=Minu esimene Kate plugin +Name[eu]=Nire lehenengo Kate plugina +Name[fa]=اولین وصلۀ Kate من +Name[fr]=Mon premier module externe pour Kate +Name[ga]=Mo Chéad Bhreiseán Kate +Name[gl]=A miña primeira extensión para Kate +Name[hu]=Mintapélda Kate-bővítőmodulra +Name[it]=Il mio primo plugin di Kate +Name[ja]=はじめての Kate プラグイン +Name[ms]=Plugin Kate Pertama Saya +Name[nds]=Mien eerst Kate-Moduul +Name[ne]=मेरो पहिलो केट प्लगइन +Name[nl]=Mijn eerste Kate-plugin +Name[pl]=Moja pierwsza wtyczka do Kate +Name[pt]=O Meu Primeiro 'Plugin' para o Kate +Name[pt_BR]=Meu Primeiro Plug-in do Kate +Name[ru]=Мой первый модуль к Kate +Name[sk]=Môj prvý Kate modul +Name[sl]=Moj prvi vstavek za Kate +Name[sr]=Мој први прикључак за Kate +Name[sr@Latn]=Moj prvi priključak za Kate +Name[sv]=Mitt första insticksprogram för Kate +Name[tr]=İlk Kate Eklentim +Name[zh_CN]=我的第一个 Kate 插件 +Name[zh_TW]=我的第一個 Kate 外掛程式 +Comment=Your short description about the plugin goes here +Comment[ca]=Aquí va la descripció curta referent al connector +Comment[cy]=Mae eich disgrifiad byr am yr ategyn yn mynd yma +Comment[da]=Din korte beskrivelse af plugin skal være her +Comment[de]=Hierhin gehört eine kurze Beschreibung des Moduls +Comment[el]=Η σύντομη περιγραφή σας σχετικά με το πρόσθετο πηγαίνει εδώ +Comment[es]=Aquí va la descripción corta sobre el complemento +Comment[et]=Sinu plugina lühikirjeldus +Comment[eu]=Hemen dihoa plugin-aren buruzko zure deskribapen motza +Comment[fa]=توصیف کوتاه شما در مورد وصله در اینجا می‌آید +Comment[fr]=Une courte description de votre module externe s'insère ici +Comment[ga]=Cuir do chur síos gearr ar an mbreiseán anseo +Comment[gl]=A súa descrición breve sobre a extensión vai aquí. +Comment[hi]=प्लगइन के बारे में आपका छोटा सा वर्णन यहाँ जाएगा +Comment[hu]=Itt lehet egy rövid leírást adni a bővítőmodulról +Comment[is]=Hér ætti að vera smá lýsing á viðbótinni +Comment[it]=La tua breve descrizione sui plugin va qui +Comment[ja]=プラグインに関する短い説明をここに記述します。 +Comment[lt]=Čia turėtų būti trumpas priedo aprašymas +Comment[ms]=Huraian ringkas anda tentang plugin anda di sini +Comment[nds]=Hier kannst Du en kort Moduulbeschrieven ingeven +Comment[ne]=प्लगइनका बारेमा तपाईँको छोटो भनाइ यस्तो छ +Comment[nl]=Hier kunt u een korte omschrijving opgeven +Comment[pl]=Tu powinien się pojawić krótki opis wtyczki +Comment[pt]=Aqui deverá colocar uma descrição do 'plugin' +Comment[pt_BR]=Sua descrição sumária sobre o plug-in vai aqui +Comment[ru]=Здесь располагается краткое описание модуля +Comment[sk]=Sem vložte krátky popis modulu +Comment[sl]=Tukaj je kratek opis o vstavku +Comment[sr]=Овде иде ваш кратак опис прикључка +Comment[sr@Latn]=Ovde ide vaš kratak opis priključka +Comment[sv]=En kort beskrivningen av vad insticksprogrammet gör +Comment[ta]=உங்கள் சொருகின் சிறு விவரம் இங்கிருக்கும் +Comment[tg]=Дар инҷо тасвири кӯтоҳи модул ҷойгир аст +Comment[tr]=Eklenti hakkında kısa bir tanımı buraya yazın. +Comment[zh_CN]=关于这个插件的简短描述 +Comment[zh_TW]=您對此外掛程式的描述寫在這裡 +author=%{AUTHOR}, %{EMAIL} diff --git a/languages/cpp/app_templates/kateplugin/plugin.kdevelop b/languages/cpp/app_templates/kateplugin/plugin.kdevelop new file mode 100644 index 00000000..9f0b4ede --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/plugin.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + src/lib%{APPNAMELC}plugin.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kateplugin/plugin_app.cpp b/languages/cpp/app_templates/kateplugin/plugin_app.cpp new file mode 100644 index 00000000..9fd4a694 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/plugin_app.cpp @@ -0,0 +1,89 @@ +%{CPP_TEMPLATE} + +#include "plugin_%{APPNAMELC}.h" + +#include +#include +#include + +class PluginView : public KXMLGUIClient +{ + friend class KatePlugin%{APPNAME}; + + public: + Kate::MainWindow *win; +}; + +extern "C" +{ + void* init_lib%{APPNAMELC}plugin() + { + KGlobal::locale()->insertCatalogue("kate%{APPNAMELC}"); + return new KatePluginFactory; + } +} + +KatePluginFactory::KatePluginFactory() +{ + s_instance = new KInstance( "kate" ); +} + +KatePluginFactory::~KatePluginFactory() +{ + delete s_instance; +} + +QObject* KatePluginFactory::createObject( QObject* parent, const char* name, const char*, const QStringList & ) +{ + return new KatePlugin%{APPNAME}( parent, name ); +} + +KInstance* KatePluginFactory::s_instance = 0L; + +KatePlugin%{APPNAME}::KatePlugin%{APPNAME}( QObject* parent, const char* name ) + : Kate::Plugin ( (Kate::Application*)parent, name ) +{ +} + +KatePlugin%{APPNAME}::~KatePlugin%{APPNAME}() +{ +} + +void KatePlugin%{APPNAME}::addView(Kate::MainWindow *win) +{ + /// @todo doesn't this have to be deleted? + PluginView *view = new PluginView (); + + (void) new KAction ( i18n("Insert Hello World"), 0, this, + SLOT( slotInsertHello() ), view->actionCollection(), + "edit_insert_%{APPNAMELC}" ); + + view->setInstance (new KInstance("kate")); + view->setXMLFile("plugins/%{APPNAMELC}/plugin_%{APPNAMELC}.rc"); + win->guiFactory()->addClient (view); + view->win = win; + + m_views.append (view); +} +void KatePlugin%{APPNAME}::removeView(Kate::MainWindow *win) +{ + for (uint z=0; z < m_views.count(); z++) + if (m_views.at(z)->win == win) + { + PluginView *view = m_views.at(z); + m_views.remove (view); + win->guiFactory()->removeClient (view); + delete view; + } +} + +void KatePlugin%{APPNAME}::slotInsertHello() +{ + Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView(); + + if (kv) + kv->insertText ("Hello World"); +} + +#include "plugin_%{APPNAMELC}.moc" + diff --git a/languages/cpp/app_templates/kateplugin/plugin_app.h b/languages/cpp/app_templates/kateplugin/plugin_app.h new file mode 100644 index 00000000..8cc5b237 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/plugin_app.h @@ -0,0 +1,49 @@ +%{H_TEMPLATE} + +#ifndef _PLUGIN_%{APPNAMEUC}_H_ +#define _PLUGIN_%{APPNAMEUC}_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +class KatePluginFactory : public KLibFactory +{ + Q_OBJECT + + public: + KatePluginFactory(); + virtual ~KatePluginFactory(); + + virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, const char* name = "QObject", const QStringList &args = QStringList() ); + + private: + static KInstance* s_instance; +}; + +class KatePlugin%{APPNAME} : public Kate::Plugin, Kate::PluginViewInterface +{ + Q_OBJECT + + public: + KatePlugin%{APPNAME}( QObject* parent = 0, const char* name = 0 ); + virtual ~KatePlugin%{APPNAME}(); + + void addView (Kate::MainWindow *win); + void removeView (Kate::MainWindow *win); + + public slots: + void slotInsertHello(); + + private: + QPtrList m_views; +}; + +#endif // _PLUGIN_%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/kateplugin/plugin_app.rc b/languages/cpp/app_templates/kateplugin/plugin_app.rc new file mode 100644 index 00000000..fe98416f --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/plugin_app.rc @@ -0,0 +1,11 @@ + + + + &Tools + + + + + + + diff --git a/languages/cpp/app_templates/kateplugin/src-Makefile.am b/languages/cpp/app_templates/kateplugin/src-Makefile.am new file mode 100644 index 00000000..88ba33a8 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/src-Makefile.am @@ -0,0 +1,20 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +KDE_ICON = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = lib%{APPNAMELC}plugin.la + +lib%{APPNAMELC}plugin_la_SOURCES = plugin_%{APPNAMELC}.cpp +lib%{APPNAMELC}plugin_la_LIBADD = -lkateinterfaces +lib%{APPNAMELC}plugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_datadir)/kate/plugins/%{APPNAMELC} +plugins_DATA = plugin_%{APPNAMELC}.rc + +kde_services_DATA = %{APPNAMELC}.desktop + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kateplugin/subdirs b/languages/cpp/app_templates/kateplugin/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kateplugin2/.kdev_ignore b/languages/cpp/app_templates/kateplugin2/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kateplugin2/Makefile.am b/languages/cpp/app_templates/kateplugin2/Makefile.am new file mode 100644 index 00000000..29aea978 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = src-Makefile.am plugin_app.cpp plugin_app.h \ + plugin_app.rc hi16-action-plugin.png hi22-action-plugin.png \ + kateplugin2.png plugin.kdevelop subdirs plugin.desktop + +templateName = kateplugin2 + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kateplugin2/hi16-action-plugin.png b/languages/cpp/app_templates/kateplugin2/hi16-action-plugin.png new file mode 100644 index 00000000..e2d7bab8 Binary files /dev/null and b/languages/cpp/app_templates/kateplugin2/hi16-action-plugin.png differ diff --git a/languages/cpp/app_templates/kateplugin2/hi22-action-plugin.png b/languages/cpp/app_templates/kateplugin2/hi22-action-plugin.png new file mode 100644 index 00000000..4082bf10 Binary files /dev/null and b/languages/cpp/app_templates/kateplugin2/hi22-action-plugin.png differ diff --git a/languages/cpp/app_templates/kateplugin2/kateplugin2.kdevtemplate b/languages/cpp/app_templates/kateplugin2/kateplugin2.kdevtemplate new file mode 100644 index 00000000..b98ab94f --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/kateplugin2.kdevtemplate @@ -0,0 +1,214 @@ +# KDE Config File +[General] +Name=Kate plugin with config page +Name[ca]=Connector per a Kate amb pàgina de configuració +Name[da]=Kate plugin med indstillingsside +Name[de]=Kate-Modul mit Einstellungsseite +Name[el]=Πρόσθετο Kate με σελίδα ρύθμισης +Name[es]=Complemento para Kate con página de configuración +Name[et]=Kate plugin seadistustedialoogiga +Name[eu]=Konfigurazio orridun Kate plugina +Name[fa]=وصلۀ Kate با صفحۀ پیکربندی +Name[fr]=Module externe pour Kate comprenant une page de configuration +Name[ga]=Breiseán Kate le leathanach cumraíochta +Name[gl]=Extensión para Kate con páxina de configuración +Name[hu]=Kate-bővítőmodul beállítólappal +Name[it]=Plugin per Kate con pagina di configurazione +Name[ja]=設定ページのある Kate プラグイン +Name[nds]=Kate-Moduul mit Instellensiet +Name[ne]=कन्फिग पृष्ठसँग केट प्लगइन +Name[nl]=Kate-plugin met config page +Name[pl]=Wtyczka do Kate ze stroną konfiguracyjną +Name[pt]='Plugin' do Kate com página de configuração +Name[pt_BR]='Plugin' do Kate com página de configuração +Name[ru]=Модуль Kate с диалогом настройки +Name[sk]=Kate modul s konfiguračnou stránkou +Name[sl]=Vstavek z nastavitveno stranjo za Kate +Name[sr]=Прикључак за Kate са страном за подешавања +Name[sr@Latn]=Priključak za Kate sa stranom za podešavanja +Name[sv]=Kate-insticksprogram med inställningssida +Name[tr]=Ayar sayfası olan bir Kate eklentisi +Name[zh_CN]=带配置页的 Kate 插件 +Name[zh_TW]=Kate 外掛程式,內含設定頁面 +Icon=kateplugin2.png +Category=C++/KDE +Comment=Generates a plugin with config page for Kate the text editor. +Comment[ca]=Genera un connector amb pàgina de configuració per a l'editor de text Kate. +Comment[da]=Generere et plugin med indstillingsside for teksteditoren Kate. +Comment[de]=Erstellt ein Modul mit Konfigurationsseite für den Texteditor Kate. +Comment[el]=Δημιουργεί ένα πρόσθετο με σελίδα ρύθμισης για το Kate τον επεξεργαστή κειμένου. +Comment[es]=Genera un complemento con página de configuración para el editor de texto Kate. +Comment[et]=Seadistustedialoogiga plugina loomine tekstiredaktorile Kate. +Comment[eu]=Konfigurazio orridun Kate plugin bat sortzen du. +Comment[fa]=وصله‌ای با صفحۀ پیکربندی ویرایشگر متن Kate تولید می‌کند. +Comment[fr]=Génère un module externe comprenant une page de configuration pour l'éditeur de texte Kate. +Comment[ga]=Cruthaíodh breiseán le leathanach cumraíochta le haghaidh eagarthóra téacs Kate. +Comment[gl]=Xera unha extensión con páxina de configuración para o editor de textos Kate. +Comment[hu]=Létrehoz egy bővítőmodult beállítólappal a Kate szövegszerkesztőhöz. +Comment[it]=Genera un plugin con pagina di configurazione per l'editor di testo Kate. +Comment[ja]=テキストエディタ Kate のための設定ページのあるプラグインを作成します。 +Comment[nds]=Stellt en Moduul mit Instellensiet för den Texteditor "Kate" op. +Comment[ne]=केट पाठ सम्पादकका लागि कन्फिग पृष्ठसँग प्लगइन उत्पन्न गर्दछ । +Comment[nl]=Genereert een plugin met een config page voor de Kate-teksteditor +Comment[pl]=Generuje wtyczke wraz ze stroną konfiguracyjną do edytora tekstu Kate. +Comment[pt]=Gera um 'plugin' com uma página de configuração para o Kate, o editor de texto. +Comment[pt_BR]=Gera um 'plugin' com uma página de configuração para o Kate, o editor de texto. +Comment[ru]=Создание модуля для текстового редактора Kate с диалогом настройки. +Comment[sk]=Vygeneruje modul s konfiguračnou stránkou pre textový editor Kate. +Comment[sl]=Ustvari vstavek z nastavitveno stranjo za urejevalnik besedil Kate. +Comment[sr]=Прави прикључак са страном за подешавање за уређивач текста Kate. +Comment[sr@Latn]=Pravi priključak sa stranom za podešavanje za uređivač teksta Kate. +Comment[sv]=Skapar ett insticksprogram för texteditorn Kate med en inställningssida. +Comment[tr]=Kate metin düzenleyicisi için ayar sayfası olan bir eklenti yaratır. +Comment[zh_CN]=生成带配置页的 Kate 文本编辑器插件。 +Comment[zh_TW]=產生一個 Kate 文字編輯器的外掛程式,內含設定頁面。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/plugin_%{APPNAMELC}.cpp +Archive=kateplugin2.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/plugin.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE13] +Type=install +Source=%{src}/plugin_app.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}.cpp + +[FILE14] +Type=install +Source=%{src}/plugin_app.h +Dest=%{dest}/src/plugin_%{APPNAMELC}.h + +[FILE15] +Type=install +EscapeXML=true +Source=%{src}/plugin_app.rc +Dest=%{dest}/src/plugin_%{APPNAMELC}.rc + +[FILE16] +Type=install +Source=%{src}/hi16-action-plugin.png +Dest=%{dest}/src/hi16-action-plugin.png +Process=false + +[FILE17] +Type=install +Source=%{src}/hi22-action-plugin.png +Dest=%{dest}/src/hi32-action-plugin.png +Process=false + +[MSG] +Type=message +Comment=A plugin for Kate with a config page was created in %{dest} +Comment[ca]=Un connector per a Kate amb pàgina de configuració ha estat creat en %{dest} +Comment[da]=Et plugin for Kate med en indstillingsside blev oprettet i %{dest} +Comment[de]=Ein Modul für Kate mit Konfigurationsseite wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο για το Kate με μια σελίδα ρύθμισης δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento para Kate con una página de configuración ha sido creado en %{dest} +Comment[et]=Seadistustedialoogiga Kate plugin loodi asukohta %{dest} +Comment[eu]=Konfigurazio orridun Kate plugin bat sortu da hemen:%{dest} +Comment[fa]=وصله‌ای برای Kate با یک صفحۀ پیکربندی در %{dest} ایجاد شد +Comment[fr]=Un module externe pour Kate comprenant une page de configuration a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán Kate le leathanach cumraíochta i %{dest} +Comment[gl]=Creouse unha extensión para Kate con páxina de configuración en %{dest} +Comment[hu]=Létrejött egy Kate-bővítőmodul (beállítólappal) itt: %{dest} +Comment[it]=È stato creato un plugin per Kate con pagina di configurazione in %{dest} +Comment[ja]=設定ページのある Kate プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Moduul för Kate mit Instellensiet opstellt +Comment[ne]=कन्फिग पृष्ठसँग केटका लागि प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een plugin voor Kate met een config page is aangemaakt in %{dest} +Comment[pl]=Wtyczka do Kate wraz ze stroną konfiguracyjną została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' para o Kate, com uma página de configuração, em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' para o Kate, com uma página de configuração, em %{dest} +Comment[ru]=Модуль Kate с диалогом настройки создан в %{dest} +Comment[sk]=Modul pre Kate s konfiguračnou stránkou bol vytvorený v %{dest} +Comment[sl]=Vstavek z nastavitveno stranjo za Kate je bil ustvarjen v %{dest} +Comment[sr]=Прикључак за Kate са страном за подешавања направљен је у %{dest} +Comment[sr@Latn]=Priključak za Kate sa stranom za podešavanja napravljen je u %{dest} +Comment[sv]=Ett insticksprogram för Kate med en inställningssida skapades i %{dest} +Comment[tr]=Kate için ayar sayfası olan bir eklenti %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个带配置页的 Kate 插件 +Comment[zh_TW]=一個內含設定頁面的 Kate 外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kateplugin2/kateplugin2.png b/languages/cpp/app_templates/kateplugin2/kateplugin2.png new file mode 100644 index 00000000..b442a706 Binary files /dev/null and b/languages/cpp/app_templates/kateplugin2/kateplugin2.png differ diff --git a/languages/cpp/app_templates/kateplugin2/plugin.desktop b/languages/cpp/app_templates/kateplugin2/plugin.desktop new file mode 100644 index 00000000..761ac763 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/plugin.desktop @@ -0,0 +1,76 @@ +[Desktop Entry] +Type=Service +ServiceTypes=Kate/Plugin +X-KDE-Library=lib%{APPNAMELC}plugin +X-Kate-Version=2.2 +Name=My First Kate Plugin +Name[br]=Ma lugent Kate kentañ +Name[ca]=El meu primer connector per a Kate +Name[cy]=F'ategyn cyntaf Kate +Name[da]=Mit første Kate plugin +Name[de]=Mein erstes Kate-Modul +Name[el]=Το πρώτο μου πρόσθετο για το Kate +Name[es]=Mi primer complemento para Kate +Name[et]=Minu esimene Kate plugin +Name[eu]=Nire lehenengo Kate plugina +Name[fa]=اولین وصلۀ Kate من +Name[fr]=Mon premier module externe pour Kate +Name[ga]=Mo Chéad Bhreiseán Kate +Name[gl]=A miña primeira extensión para Kate +Name[hu]=Mintapélda Kate-bővítőmodulra +Name[it]=Il mio primo plugin di Kate +Name[ja]=はじめての Kate プラグイン +Name[ms]=Plugin Kate Pertama Saya +Name[nds]=Mien eerst Kate-Moduul +Name[ne]=मेरो पहिलो केट प्लगइन +Name[nl]=Mijn eerste Kate-plugin +Name[pl]=Moja pierwsza wtyczka do Kate +Name[pt]=O Meu Primeiro 'Plugin' para o Kate +Name[pt_BR]=Meu Primeiro Plug-in do Kate +Name[ru]=Мой первый модуль к Kate +Name[sk]=Môj prvý Kate modul +Name[sl]=Moj prvi vstavek za Kate +Name[sr]=Мој први прикључак за Kate +Name[sr@Latn]=Moj prvi priključak za Kate +Name[sv]=Mitt första insticksprogram för Kate +Name[tr]=İlk Kate Eklentim +Name[zh_CN]=我的第一个 Kate 插件 +Name[zh_TW]=我的第一個 Kate 外掛程式 +Comment=Your short description about the plugin goes here +Comment[ca]=Aquí va la descripció curta referent al connector +Comment[cy]=Mae eich disgrifiad byr am yr ategyn yn mynd yma +Comment[da]=Din korte beskrivelse af plugin skal være her +Comment[de]=Hierhin gehört eine kurze Beschreibung des Moduls +Comment[el]=Η σύντομη περιγραφή σας σχετικά με το πρόσθετο πηγαίνει εδώ +Comment[es]=Aquí va la descripción corta sobre el complemento +Comment[et]=Sinu plugina lühikirjeldus +Comment[eu]=Hemen dihoa plugin-aren buruzko zure deskribapen motza +Comment[fa]=توصیف کوتاه شما در مورد وصله در اینجا می‌آید +Comment[fr]=Une courte description de votre module externe s'insère ici +Comment[ga]=Cuir do chur síos gearr ar an mbreiseán anseo +Comment[gl]=A súa descrición breve sobre a extensión vai aquí. +Comment[hi]=प्लगइन के बारे में आपका छोटा सा वर्णन यहाँ जाएगा +Comment[hu]=Itt lehet egy rövid leírást adni a bővítőmodulról +Comment[is]=Hér ætti að vera smá lýsing á viðbótinni +Comment[it]=La tua breve descrizione sui plugin va qui +Comment[ja]=プラグインに関する短い説明をここに記述します。 +Comment[lt]=Čia turėtų būti trumpas priedo aprašymas +Comment[ms]=Huraian ringkas anda tentang plugin anda di sini +Comment[nds]=Hier kannst Du en kort Moduulbeschrieven ingeven +Comment[ne]=प्लगइनका बारेमा तपाईँको छोटो भनाइ यस्तो छ +Comment[nl]=Hier kunt u een korte omschrijving opgeven +Comment[pl]=Tu powinien się pojawić krótki opis wtyczki +Comment[pt]=Aqui deverá colocar uma descrição do 'plugin' +Comment[pt_BR]=Sua descrição sumária sobre o plug-in vai aqui +Comment[ru]=Здесь располагается краткое описание модуля +Comment[sk]=Sem vložte krátky popis modulu +Comment[sl]=Tukaj je kratek opis o vstavku +Comment[sr]=Овде иде ваш кратак опис прикључка +Comment[sr@Latn]=Ovde ide vaš kratak opis priključka +Comment[sv]=En kort beskrivningen av vad insticksprogrammet gör +Comment[ta]=உங்கள் சொருகின் சிறு விவரம் இங்கிருக்கும் +Comment[tg]=Дар инҷо тасвири кӯтоҳи модул ҷойгир аст +Comment[tr]=Eklenti hakkında kısa bir tanımı buraya yazın. +Comment[zh_CN]=关于这个插件的简短描述 +Comment[zh_TW]=您對此外掛程式的描述寫在這裡 +author=%{AUTHOR}, %{EMAIL} diff --git a/languages/cpp/app_templates/kateplugin2/plugin.kdevelop b/languages/cpp/app_templates/kateplugin2/plugin.kdevelop new file mode 100644 index 00000000..cbed4cac --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/plugin.kdevelop @@ -0,0 +1,114 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + src/lib%{APPNAMELC}plugin.la + + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kateplugin2/plugin_app.cpp b/languages/cpp/app_templates/kateplugin2/plugin_app.cpp new file mode 100644 index 00000000..99d78eff --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/plugin_app.cpp @@ -0,0 +1,140 @@ +%{CPP_TEMPLATE} + +#include "plugin_%{APPNAMELC}.h" + +#include +#include +#include +#include + +#include +#include + +class PluginView : public KXMLGUIClient +{ + friend class KatePlugin%{APPNAME}; + +public: + Kate::MainWindow *win; +}; + +extern "C" +{ + void* init_lib%{APPNAMELC}plugin() + { + KGlobal::locale()->insertCatalogue("kate%{APPNAMELC}"); + return new KatePluginFactory; + } +} + +KatePluginFactory::KatePluginFactory() +{ + s_instance = new KInstance( "kate" ); +} + +KatePluginFactory::~KatePluginFactory() +{ + delete s_instance; +} + +QObject* KatePluginFactory::createObject( QObject* parent, const char* name, const char*, const QStringList & ) +{ + return new KatePlugin%{APPNAME}( parent, name ); +} + +KInstance* KatePluginFactory::s_instance = 0L; + +KatePlugin%{APPNAME}::KatePlugin%{APPNAME}( QObject* parent, const char* name ) + : Kate::Plugin ( (Kate::Application*)parent, name ) +{ +} + +KatePlugin%{APPNAME}::~KatePlugin%{APPNAME}() +{ +} + +void KatePlugin%{APPNAME}::addView(Kate::MainWindow *win) +{ + /// @todo doesn't this have to be deleted? + PluginView *view = new PluginView (); + + (void) new KAction ( i18n("Insert Hello World"), 0, this, + SLOT( slotInsertHello() ), view->actionCollection(), + "edit_insert_%{APPNAMELC}" ); + + view->setInstance (new KInstance("kate")); + view->setXMLFile("plugins/%{APPNAMELC}/plugin_%{APPNAMELC}.rc"); + win->guiFactory()->addClient (view); + view->win = win; + + m_views.append (view); +} + +void KatePlugin%{APPNAME}::removeView(Kate::MainWindow *win) +{ + for (uint z=0; z < m_views.count(); z++) + if (m_views.at(z)->win == win) + { + PluginView *view = m_views.at(z); + m_views.remove (view); + win->guiFactory()->removeClient (view); + delete view; + } +} + +void KatePlugin%{APPNAME}::slotInsertHello() +{ + Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView(); + + if (kv) + kv->insertText ("Hello World"); +} + +Kate::PluginConfigPage* KatePlugin%{APPNAME}::configPage (uint, QWidget *w, const char* name) +{ + %{APPNAME}ConfigPage* p = new %{APPNAME}ConfigPage(this, w); + initConfigPage( p ); + connect( p, SIGNAL(configPageApplyRequest(%{APPNAME}ConfigPage*)), this, SLOT(slotApplyConfig(%{APPNAME}ConfigPage*)) ); + return (Kate::PluginConfigPage*)p; +} + +void KatePlugin%{APPNAME}::initConfigPage( %{APPNAME}ConfigPage* p ) +{ + // TODO: initialize %{APPNAME}ConfigPage here + // NOTE: KatePlugin%{APPNAME} is friend of %{APPNAME}ConfigPage +} + +void KatePlugin%{APPNAME}::slotApplyConfig( %{APPNAME}ConfigPage* p ) +{ + // TODO: save %{APPNAME}ConfigPage here + // NOTE: KatePlugin%{APPNAME} is friend of %{APPNAME}ConfigPage +} + + +/** + * %{APPNAME}ConfigPage + */ +%{APPNAME}ConfigPage::%{APPNAME}ConfigPage (QObject* parent /*= 0L*/, QWidget *parentWidget /*= 0L*/) + : Kate::PluginConfigPage( parentWidget ) +{ + QVBoxLayout* lo = new QVBoxLayout( this, 0, 0, "config_page_layout" ); + lo->setSpacing(KDialogBase::spacingHint()); + + QLabel* lab = new QLabel("KatePlugin%{APPNAME}'s config page", this); + + lo->addWidget(lab); + + // TODO: add connection to emit SLOT( changed() ) +} + +%{APPNAME}ConfigPage::~%{APPNAME}ConfigPage() +{ +} + +void %{APPNAME}ConfigPage::apply() +{ + emit configPageApplyRequest( this ); +} + +#include "plugin_%{APPNAMELC}.moc" + diff --git a/languages/cpp/app_templates/kateplugin2/plugin_app.h b/languages/cpp/app_templates/kateplugin2/plugin_app.h new file mode 100644 index 00000000..e4f97d00 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/plugin_app.h @@ -0,0 +1,91 @@ +%{H_TEMPLATE} + +#ifndef _PLUGIN_%{APPNAMEUC}_H_ +#define _PLUGIN_%{APPNAMEUC}_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +class %{APPNAME}ConfigPage; + +class KatePluginFactory : public KLibFactory +{ + Q_OBJECT + +public: + KatePluginFactory(); + virtual ~KatePluginFactory(); + + virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, const char* name = "QObject", const QStringList &args = QStringList() ); + +private: + static KInstance* s_instance; +}; + +class KatePlugin%{APPNAME} : public Kate::Plugin, Kate::PluginViewInterface, Kate::PluginConfigInterfaceExtension +{ + Q_OBJECT + +public: + KatePlugin%{APPNAME}( QObject* parent = 0, const char* name = 0 ); + virtual ~KatePlugin%{APPNAME}(); + + void addView (Kate::MainWindow *win); + void removeView (Kate::MainWindow *win); + + /** overwrite some functions */ + uint configPages () const { return 1; } + Kate::PluginConfigPage *configPage (uint , QWidget *w, const char *name=0); + QString configPageName(uint) const { return i18n("%{APPNAME}"); }; + QString configPageFullName(uint) const { return i18n("Configure KatePlugin%{APPNAME}"); }; + QPixmap configPagePixmap (uint number = 0, int size = KIcon::SizeSmall) const { return 0L; }; + +public slots: + void slotInsertHello(); + void slotApplyConfig(%{APPNAME}ConfigPage*); + +private: + void initConfigPage( %{APPNAME}ConfigPage* ); + +private: + QPtrList m_views; +}; + + +class %{APPNAME}ConfigPage : public Kate::PluginConfigPage +{ + Q_OBJECT + friend class KatePlugin%{APPNAME}; + +public: + %{APPNAME}ConfigPage (QObject* parent = 0L, QWidget *parentWidget = 0L); + ~%{APPNAME}ConfigPage (); + + /** Reimplemented from Kate::PluginConfigPage; just emits configPageApplyRequest( this ). */ + virtual void apply(); + + virtual void reset () { ; }; + virtual void defaults () { ; }; + +signals: + /** Ask the plugin to set initial values */ + void configPageApplyRequest( %{APPNAME}ConfigPage* ); + /** Ask the plugin to apply changes */ + void configPageInitRequest( %{APPNAME}ConfigPage* ); + +private: // variables + +}; + +#endif // _PLUGIN_%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/kateplugin2/plugin_app.rc b/languages/cpp/app_templates/kateplugin2/plugin_app.rc new file mode 100644 index 00000000..fe98416f --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/plugin_app.rc @@ -0,0 +1,11 @@ + + + + &Tools + + + + + + + diff --git a/languages/cpp/app_templates/kateplugin2/src-Makefile.am b/languages/cpp/app_templates/kateplugin2/src-Makefile.am new file mode 100644 index 00000000..2dbd9367 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/src-Makefile.am @@ -0,0 +1,21 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +KDE_ICON = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = lib%{APPNAMELC}plugin.la + +lib%{APPNAMELC}plugin_la_SOURCES = plugin_%{APPNAMELC}.cpp +lib%{APPNAMELC}plugin_la_LIBADD = -lkateinterfaces +lib%{APPNAMELC}plugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_datadir)/kate/plugins/%{APPNAMELC} +plugins_DATA = plugin_%{APPNAMELC}.rc + +kde_services_DATA = %{APPNAMELC}.desktop + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + diff --git a/languages/cpp/app_templates/kateplugin2/subdirs b/languages/cpp/app_templates/kateplugin2/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kateplugin2/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kcmodule/.kdev_ignore b/languages/cpp/app_templates/kcmodule/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kcmodule/Makefile.am b/languages/cpp/app_templates/kcmodule/Makefile.am new file mode 100644 index 00000000..66173b12 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = module.cpp module.h module.desktop module.kdevelop \ + src-Makefile.am kcmodule.png subdirs +templateName = kcmodule + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kcmodule/kcmodule.kdevtemplate b/languages/cpp/app_templates/kcmodule/kcmodule.kdevtemplate new file mode 100644 index 00000000..c551eeb5 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/kcmodule.kdevtemplate @@ -0,0 +1,197 @@ +# KDE Config File +[General] +Name=Control Center module +Name[ca]=Mòdul per al Centre de control +Name[da]=Kontrolcenter-modul +Name[de]=Kontrollzentrum-Modul +Name[el]=Άρθρωμα κέντρου ελέγχου +Name[en_GB]=Control Centre module +Name[es]=Módulo para el Centro de control +Name[et]=Juhtimiskeskuse moodul +Name[eu]=Kontrol-gunearen modulua +Name[fa]=پیمانۀ مرکز کنترل +Name[fr]=Module du centre de configuration +Name[ga]=Modúl Lárionad Rialaithe +Name[gl]=Módulo para Centro de control +Name[hu]=KControl-beállítómodul +Name[it]=Modulo del Centro di controllo +Name[ja]=コントロールセンターモジュール +Name[nds]=Kuntrullzentrum-Moduul +Name[ne]=नियन्त्रण केन्द्र मोड्युल +Name[nl]=Configuratiemodule +Name[pl]=Moduł Centrum Sterowania +Name[pt]=Módulo do Centro de Controlo +Name[pt_BR]=Módulo do Centro de Controlo +Name[ru]=Модуль Центра управления +Name[sk]=Control Center modul +Name[sl]=Modul nadzornega središča +Name[sr]=Модул Контролног центра +Name[sr@Latn]=Modul Kontrolnog centra +Name[sv]=Modul i inställningscentralen +Name[tr]=Kontrol Merkezi Birimi +Name[zh_CN]=控制中心模块 +Name[zh_TW]=控制中心模組 +Icon=kcmodule.png +Category=C++/KDE +Comment=Generates a framework for a module which can be embedded into the KDE Control Center. +Comment[ca]=Genera una infraestructura per a un mòdul que es pugui encastar al Centre de control de KDE. +Comment[da]=Genererer et skelet for et modul som kan indlejres i KDE's kontrolcenter. +Comment[de]=Erstellt das Gerüst für ein Modul, das in das KDE-Kontrollzentrum integriert werden kann. +Comment[el]=Δημιουργεί ένα πλαίσιο για ένα άρθρωμα το οποίο μπορεί να ενσωματωθεί το κέντρο ελέγχου του KDE. +Comment[en_GB]=Generates a framework for a module which can be embedded into the KDE Control Centre. +Comment[es]=Genera una infraestructura para un módulo que se puede empotrar en el Centro de control de KDE. +Comment[et]=Mooduli raamistiku loomine, mida saab põimida KDE juhtimiskeskusse. +Comment[eu]=KDE-ren kontrol-gunean kapsula daitekeen modulu baten lan-marko bat sortzen du. +Comment[fa]=چارچوبی برای پیمانه‌ای که در مرکز کنترل KDE می‌تواند نهفته شود، تولید می‌کند. +Comment[fr]=Génère une infrastructure pour un module qui peut être intégré dans le centre de configuration de KDE. +Comment[ga]=Cruthaigh creatlach de mhodúl is féidir leabú i Lárionad Rialaithe KDE. +Comment[gl]=Xera un contorno de traballo para un módulo que pode incrustarse no Centro de control de KDE. +Comment[hu]=Létrehoz egy kiindulási KDE vezérlőpult-beállítómodult +Comment[it]=Genera l'infrastruttura per un modulo che può essere integrato nel Centro di controllo di KDE. +Comment[ja]=KDE のコントロールセンターに取り込めるモジュールのフレームワークを作成します。 +Comment[nds]=Stellt en Rahmenwark för en Moduul op, dat sik na dat KDE-Kuntrullzentrum inbetten lett. +Comment[ne]=केडीई नियन्त्रण केन्द्रमा सम्मिलित गर्न सकिने मोड्युलका लागि फ्रेमवर्क उत्पन्न गर्दछ । +Comment[nl]=Genereert een framework voor een module die kan worden ingebed in het configuratiecentrum van KDE. +Comment[pl]=Generuje szablon modułu, który może zostać włączony w Centrum Sterowania KDE. +Comment[pt]=Gera a plataforma para um módulo que possa ser incorporado no Centro de Controlo do KDE. +Comment[pt_BR]=Gera a plataforma para um módulo que possa ser incorporado no Centro de Controlo do KDE. +Comment[ru]=Создание модуля для Центра управления KDE. +Comment[sk]=Vygeneruje framework pre modul, ktorý môže byť vložený do KDE Control Center. +Comment[sr]=Прави радни оквир за модул који се може уградити у Контролни центар KDE-а. +Comment[sr@Latn]=Pravi radni okvir za modul koji se može ugraditi u Kontrolni centar KDE-a. +Comment[sv]=Skapar ett ramverk för en modul som kan inbäddas i KDE:s inställningscentral. +Comment[tr]=KDE Kontrol Merkezine gömülebilen bir birim için bir çatı yaratır. +Comment[zh_CN]=生成一个可嵌入 KDE 控制中心的模块框架。 +Comment[zh_TW]=產生一個可以嵌入 KDE 控制中心的模組框架。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=kcmodule.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/module.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/po + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir4] +Type=mkdir +Dir=%{dest}/src + +[FILE9] +Type=install +Source=%{src}/module.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/module.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/module.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/module.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=A control center module was created in %{dest} +Comment[ca]=A mòdul per al centre de control ha estat creat en %{dest} +Comment[da]=Et kontrolcenter-modul blev oprettet i %{dest} +Comment[de]=Ein Kontrollzentrum-Modul wurde in %{dest} erstellt. +Comment[el]=Ένα άρθρωμα κέντρου ελέγχου δημιουργήθηκε στο %{dest} +Comment[en_GB]=A control centre module was created in %{dest} +Comment[es]=Un módulo para el Centro de control ha sido creado en %{dest} +Comment[et]=Juhtimiskeskuse moodul loodi asukohta %{dest} +Comment[eu]=Kontrol-gunearen modulu bat sortu da hemen: {dest} +Comment[fa]=یک پیمانۀ مرکز کنترل در %{dest} ایجاد شد +Comment[fr]=Un module du centre de configuration a été créé dans %{dest} +Comment[ga]=Cruthaíodh modúl lárionad rialaithe i %{dest} +Comment[gl]=Creouse un módulo para o centro de control en %{dest} +Comment[hu]=Létrejött egy KControl-beállítómodul itt: %{dest} +Comment[it]=È stato creato un modulo del Centro di controllo in %{dest} +Comment[ja]=コントロールセンターのモジュールを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Kuntrullzentrum-Moduul opstellt +Comment[ne]=नियन्त्रण केन्द्र मोड्युल %{dest} मा सिर्जना गरियो +Comment[nl]=Een configuratiemodule is aangemaakt in %{dest} +Comment[pl]=Moduł Centrum Sterowania został utworzony w %{dest} +Comment[pt]=Foi criado um módulo do Centro de Controlo em %{dest} +Comment[pt_BR]=Foi criado um módulo do Centro de Controlo em %{dest} +Comment[ru]=Модуль Центра управления KDE создан в %{dest} +Comment[sk]=Control center modul bol vytvorený v %{dest} +Comment[sl]=Modul nadzornega središča je bil ustvarjen v %{dest} +Comment[sr]=Модул Контролног центра направљен је у %{dest} +Comment[sr@Latn]=Modul Kontrolnog centra napravljen je u %{dest} +Comment[sv]=En modul i inställningscentralen skapades i %{dest} +Comment[zh_CN]=在 %{dest} 中创建了一个控制中心模块 +Comment[zh_TW]=一個控制中心模組已建立於 %{dest} diff --git a/languages/cpp/app_templates/kcmodule/kcmodule.png b/languages/cpp/app_templates/kcmodule/kcmodule.png new file mode 100644 index 00000000..dbab73a3 Binary files /dev/null and b/languages/cpp/app_templates/kcmodule/kcmodule.png differ diff --git a/languages/cpp/app_templates/kcmodule/module.cpp b/languages/cpp/app_templates/kcmodule/module.cpp new file mode 100644 index 00000000..69e87692 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/module.cpp @@ -0,0 +1,66 @@ +%{CPP_TEMPLATE} + +#include + +#include +#include +#include + +#include "%{APPNAMELC}.h" + +typedef KGenericFactory<%{APPNAME}, QWidget> %{APPNAME}Factory; +K_EXPORT_COMPONENT_FACTORY( kcm_%{APPNAME}, %{APPNAME}Factory("kcm%{APPNAMELC}")) + +%{APPNAME}::%{APPNAME}(QWidget *parent, const char *name, const QStringList&) + : KCModule(parent, name), myAboutData(0) +{ + // place widgets here + load(); +}; + + +%{APPNAME}::~%{APPNAME}() +{ +} + + +void %{APPNAME}::load() +{ + // insert your loading code here... +} + + +void %{APPNAME}::defaults() +{ + // insert your default settings code here... + emit changed(true); +} + + +void %{APPNAME}::save() +{ + // insert your saving code here... + emit changed(true); +} + + +int %{APPNAME}::buttons() +{ + return KCModule::Default|KCModule::Apply|KCModule::Help; +} + + +void %{APPNAME}::configChanged() +{ + // insert your saving code here... + emit changed(true); +} + + +QString %{APPNAME}::quickHelp() const +{ + return i18n("Helpful information about the %{APPNAMELC} module."); +} + + +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/kcmodule/module.desktop b/languages/cpp/app_templates/kcmodule/module.desktop new file mode 100644 index 00000000..662b3b2f --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/module.desktop @@ -0,0 +1,81 @@ +[Desktop Entry] +Exec=kcmshell %{APPNAMELC} +Icon=misc +Type=Application + +X-KDE-ModuleType=Library +X-KDE-Library=%{APPNAMELC} +X-KDE-HasReadOnlyMode=false +X-KDE-ParentApp=kcontrol + + + +[Desktop Entry] +Comment=%{APPNAME} - a kcontrol module +Comment[br]=%{APPNAME} - ur mollad kcontrol +Comment[ca]=%{APPNAME} - un mòdul per a kcontrol +Comment[da]=%{APPNAME} - et kcontrol-modul +Comment[de]=%{APPNAME} - ein KControl-Modul +Comment[el]=%{APPNAME} - ένα άρθρωμα kcontrol +Comment[es]=%{APPNAME} - un módulo de kcontrol +Comment[et]=%{APPNAME} - KDE juhtimiskeskuse moodul +Comment[eu]=%{APPNAME} - kcontrol modulu bat +Comment[fa]=%{APPNAME} - یک پیمانۀ kcontrol +Comment[fr]=%{APPNAME} - un module kcontrol +Comment[ga]=%{APPNAME} - modúl kcontrol +Comment[gl]=%{APPNAME} - un módulo de kcontrol +Comment[hu]=%{APPNAME} - beállítómodul +Comment[it]=%{APPNAME} - un modulo per kcontrol +Comment[ja]=%{APPNAME} kcontrol モジュール +Comment[nds]=%{APPNAME} - en KControl-Moduul +Comment[ne]=%{APPNAME} - एउटा केडीई नियन्त्रण मोड्युल +Comment[nl]=%{APPNAME} - een kcontrol module +Comment[pl]=Moduł Centrum Sterowania dla %{APPNAME} +Comment[pt]=%{APPNAME} - um módulo do kcontrol +Comment[pt_BR]=%{APPNAME} - um módulo do kcontrol +Comment[ru]=%{APPNAME} - модуль kcontrol +Comment[sk]=%{APPNAME} - a kcontrol modul +Comment[sl]=%{APPNAME} - modul za kcontrol +Comment[sr]=%{APPNAME} — модул за kcontrol +Comment[sr@Latn]=%{APPNAME} — modul za kcontrol +Comment[sv]=%{APPNAME} - en modul i Inställningscentralen +Comment[ta]=%{APPNAME} - ஒரு கேகன்ட்ரோல் கூறு +Comment[tg]=%{APPNAME} - модули kcontrol +Comment[tr]=%{APPNAME} - bir kcontrol birimi +Comment[zh_CN]=%{APPNAME} - 一个 KDE 控制中心模块 +Comment[zh_TW]=%{APPNAME} - KDE 控制中心模組 +Keywords=%{APPNAME},%{APPNAMELC} +Name=The %{APPNAME} Applet +Name[br]=An arloadig %{APPNAME} +Name[ca]=La miniaplicació %{APPNAME} +Name[da]=%{APPNAME}-appletten +Name[de]=Das Miniprogramm %{APPNAME} +Name[el]=Η μικροεφαρμογή %{APPNAME} +Name[es]=Applet %{APPNAME} +Name[et]=%{APPNAME} aplett +Name[eu]=%{APPNAME} applet-a +Name[fa]=برنامک %{APPNAME} +Name[fr]=L'applet %{APPNAME} +Name[ga]=An Feidhmchláirín %{APPNAME} +Name[gl]=Applet %{APPNAME} +Name[hu]=%{APPNAME} kisalkalmazás +Name[it]=L'applet %{APPNAME} +Name[ja]=%{APPNAME} アプレット +Name[nds]=Dat Lüttprogramm %{APPNAME} +Name[ne]= %{APPNAME} एप्लेट +Name[nl]=De %{APPNAME}-applet +Name[pl]=Aplet %{APPNAME} +Name[pt]='Applet' %{APPNAME} +Name[pt_BR]=O Mini-Aplicativo %{APPNAME} +Name[ru]=Аплет %{APPNAME} +Name[sk]=%{APPNAME} applet +Name[sl]=Vstavek za %{APPNAME} +Name[sr]=%{APPNAME} аплет +Name[sr@Latn]=%{APPNAME} aplet +Name[sv]=Miniprogram %{APPNAME} +Name[tr]=%{APPNAME} Küçük Uygulaması +Name[zh_CN]=%{APPNAME} 小程序 +Name[zh_TW]=%{APPNAME} 小程式 + + +Categories=Qt;KDE;X-KDE-settings-components; diff --git a/languages/cpp/app_templates/kcmodule/module.h b/languages/cpp/app_templates/kcmodule/module.h new file mode 100644 index 00000000..cebf0f48 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/module.h @@ -0,0 +1,32 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#include +#include + +class %{APPNAME}: public KCModule +{ + Q_OBJECT + +public: + %{APPNAME}( QWidget *parent=0, const char *name=0, const QStringList& = QStringList() ); + ~%{APPNAME}(); + + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual int buttons(); + virtual QString quickHelp() const; + virtual const KAboutData *aboutData()const + { return myAboutData; }; + +public slots: + void configChanged(); + +private: + KAboutData *myAboutData; +}; + +#endif diff --git a/languages/cpp/app_templates/kcmodule/module.kdevelop b/languages/cpp/app_templates/kcmodule/module.kdevelop new file mode 100644 index 00000000..76412de2 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/module.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + src/%{APPNAMELC} + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kcmodule/src-Makefile.am b/languages/cpp/app_templates/kcmodule/src-Makefile.am new file mode 100644 index 00000000..e5d30776 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/src-Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kcm_%{APPNAMELC}.la + +kcm_%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp +kcm_%{APPNAMELC}_la_LIBADD = $(LIB_KDEUI) +kcm_%{APPNAMELC}_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined + + +xdg_apps_DATA = %{APPNAMELC}.desktop + + +messages: rc.cpp + $(EXTRACTRC) `find -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcm%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kcmodule/subdirs b/languages/cpp/app_templates/kcmodule/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kcmodule/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kconfig35/Makefile.am b/languages/cpp/app_templates/kconfig35/Makefile.am new file mode 100644 index 00000000..f5f8132d --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = src-Makefile.am app.cpp app.h main.cpp appui.rc app.kdevelop \ + subdirs app.desktop kxt35.png appview.h appview.cpp appview_base.ui \ + prefs-base.ui prefs.cpp prefs.h app.kcfg settings.kcfgc README \ + src-configure.in.in +templateName= kconfig35 + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kconfig35/README b/languages/cpp/app_templates/kconfig35/README new file mode 100644 index 00000000..527ce518 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/README @@ -0,0 +1,90 @@ +----------------------------------------------- +Kde templates quickstart +Author: Thomas Nagy +Date: 2004-03-22 +----------------------------------------------- + +This README file explains you basic things for starting with +this application template. + +----------------------------------------------- +--NOTE--: you need kdelibs 3.5 and kdelibs headers 3.5 (devel package) in order to build this template. +Qt version might be 3.3.4 or 3.3.5 +----------------------------------------------- + +** Building and installing ** + +* Build the configure script by "make -f Makefile.cvs" + +* To clean, use "make clean", and to clean everything +(remove the makefiles, etc), use "make distclean" + +* To distribute your program, try "make dist". +This will make a compact tarball archive of your release with the +necessary scripts inside. + +* Modifying the auto-tools scripts +for automake scripts there is an excellent tutorial there : +http://developer.kde.org/documentation/other/makefile_am_howto.html + +* Simplify your life : install the project in your home directory for +testing purposes. +./configure --prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use KConfig XT to create your configuration dialogs and make +them more maintainable. + +For that, you will need to write two simple configuration files +in the src directory : .kcfg and a .kcfgc +The configure.in.in will need to be modified : change the line #MIN_CONFIG(3.0.0) +into #MIN_CONFIG(3.2.0) + +Take an example on the many apps found in the kdegames source package and consult : +http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-kparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +KDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + + + diff --git a/languages/cpp/app_templates/kconfig35/app.cpp b/languages/cpp/app_templates/kconfig35/app.cpp new file mode 100644 index 00000000..e32e28b5 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/app.cpp @@ -0,0 +1,105 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include "settings.h" +#include "prefs.h" + +#include + +#include +#include +#include +#include +#include +#include + +%{APPNAMELC}::%{APPNAMELC}() + : KMainWindow( 0, "%{APPNAMELC}" ), + m_view(new %{APPNAMELC}View(this)), + m_printer(0) +{ + // accept dnd + setAcceptDrops(true); + + // tell the KMainWindow that this is indeed the main widget + setCentralWidget(m_view); + // and a status bar + statusBar()->show(); + // then, setup our actions + setupActions(); + + // apply the saved mainwindow settings, if any, and ask the mainwindow + // to automatically save settings if changed: window size, toolbar + // position, icon size, etc. + setAutoSaveSettings(); + + // allow the view to change the statusbar and caption + connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)), + this, SLOT(changeStatusbar(const QString&))); + connect(m_view, SIGNAL(signalChangeCaption(const QString&)), + this, SLOT(changeCaption(const QString&))); + +} + +%{APPNAMELC}::~%{APPNAMELC}() +{ +} + +void %{APPNAMELC}::setupActions() +{ + KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + + KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + // custom menu and menu item + KAction *custom = new KAction(i18n("Swi&tch Colors"), 0, + m_view, SLOT(switchColors()), + actionCollection(), "switch_action"); + + setupGUI(); +} + +void %{APPNAMELC}::newToolbarConfig() +{ + // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor. + // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.) + setupGUI(); +} + +void %{APPNAMELC}::optionsPreferences() +{ + // The preference dialog is derived from prefs-base.ui which is subclassed into Prefs + // + // compare the names of the widgets in the .ui file + // to the names of the variables in the .kcfg file + KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self(), KDialogBase::Swallow); + dialog->addPage(new Prefs(), i18n("General"), "package_settings"); + connect(dialog, SIGNAL(settingsChanged()), m_view, SLOT(settingsChanged())); + dialog->show(); +} + +void %{APPNAMELC}::changeCaption(const QString& text) +{ + // display the text on the caption + setCaption(text); +} + +void %{APPNAMELC}::changeStatusbar(const QString& text) +{ + // display the text on the statusbar + statusBar()->message(text); +} + +void %{APPNAMELC}::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // create a new window + (new %{APPNAMELC})->show(); +} + +#include "%{APPNAMELC}.moc" + diff --git a/languages/cpp/app_templates/kconfig35/app.desktop b/languages/cpp/app_templates/kconfig35/app.desktop new file mode 100644 index 00000000..8b36e6e0 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/app.desktop @@ -0,0 +1,40 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +Icon=%{APPNAMELC} +Type=Application +Comment=A simple KDE Application +Comment[br]=Ur meziant eeun evit KDE +Comment[ca]=Una simple aplicació per al KDE +Comment[da]=Et simpelt KDE program +Comment[de]=Eine einfache KDE-Anwendung +Comment[el]=Μια απλή εφαρμογή του KDE +Comment[es]=Una aplicación de KDE sencilla +Comment[et]=Lihtne KDE rakendus +Comment[eu]=KDE aplikazio simple bat +Comment[fa]=یک کاربرد سادۀ KDE +Comment[fr]=Une application simple pour KDE +Comment[ga]=Feidhmchlár Simplí KDE +Comment[gl]=Unha aplicación KDE sinxela +Comment[hi]=एक सादा केडीई अनुप्रयोग +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[is]=Einfalt KDE forrit +Comment[it]=Una semplice applicazione KDE +Comment[ja]=簡単な KDE アプリケーション +Comment[nds]=En eenfach KDE-Programm +Comment[ne]=एउटा साधारण केडीई अनुप्रयोग +Comment[nl]=Een eenvoudige KDE-toepassing +Comment[pl]=Prosty program KDE +Comment[pt]=Uma aplicação simples do KDE +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[ru]=Простое приложение KDE +Comment[sk]=Jednoduchá KDE aplikácia +Comment[sl]=Preprost program za KDE +Comment[sr]=Једноставан KDE програм +Comment[sr@Latn]=Jednostavan KDE program +Comment[sv]=Ett enkelt KDE-program +Comment[ta]=ஒரு சாதாரண கெடிஇ பயன்பாடு +Comment[tg]=Гузориши оддиKDE +Comment[tr]=Basit bir KDE Uygulaması +Comment[zh_CN]=一个简单的 KDE 应用程序 +Comment[zh_TW]=簡單的 KDE 應用程式 diff --git a/languages/cpp/app_templates/kconfig35/app.h b/languages/cpp/app_templates/kconfig35/app.h new file mode 100644 index 00000000..abfd6c09 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/app.h @@ -0,0 +1,60 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "%{APPNAMELC}view.h" + +class KPrinter; +class KURL; + +/** + * This class serves as the main window for %{APPNAME}. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAMELC} : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAMELC}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAMELC}(); + +private slots: + + void fileNew(); + void optionsPreferences(); + void newToolbarConfig(); + + void changeStatusbar(const QString& text); + void changeCaption(const QString& text); + +private: + + void setupActions(); + +private: + %{APPNAMELC}View *m_view; + + KPrinter *m_printer; +}; + +#endif // _%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/kconfig35/app.kcfg b/languages/cpp/app_templates/kconfig35/app.kcfg new file mode 100644 index 00000000..686f25f2 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/app.kcfg @@ -0,0 +1,21 @@ + + + + + + + black + + + + yellow + + + + 2 + + + diff --git a/languages/cpp/app_templates/kconfig35/app.kdevelop b/languages/cpp/app_templates/kconfig35/app.kdevelop new file mode 100644 index 00000000..07cf3f0f --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/app.kdevelop @@ -0,0 +1,168 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + . + false + + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + false + + + + + + + false + 1 + false + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + true + false + false + true + + + false + true + + + + + + + + + + + + -f + + -dP + + -f + -u3 -p + + + + + + + false + + + .h + .cpp + true + + + + true + 2 + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kconfig35/appui.rc b/languages/cpp/app_templates/kconfig35/appui.rc new file mode 100644 index 00000000..06549878 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/appui.rc @@ -0,0 +1,8 @@ + + + + &Move + + + + diff --git a/languages/cpp/app_templates/kconfig35/appview.cpp b/languages/cpp/app_templates/kconfig35/appview.cpp new file mode 100644 index 00000000..35e23682 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/appview.cpp @@ -0,0 +1,41 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}view.h" +#include "settings.h" + +#include +#include + +%{APPNAMELC}View::%{APPNAMELC}View(QWidget *parent) + : %{APPNAMELC}view_base(parent) +{ + settingsChanged(); +} + +%{APPNAMELC}View::~%{APPNAMELC}View() +{ + +} + +void %{APPNAMELC}View::switchColors() +{ + // switch the foreground/background colors of the label + QColor color = Settings::col_background(); + Settings::setCol_background( Settings::col_foreground() ); + Settings::setCol_foreground( color ); + + settingsChanged(); +} + +void %{APPNAMELC}View::settingsChanged() +{ + sillyLabel->setPaletteBackgroundColor( Settings::col_background() ); + sillyLabel->setPaletteForegroundColor( Settings::col_foreground() ); + + // i18n : internationalization + sillyLabel->setText( i18n("This project is %1 days old").arg(Settings::val_time()) ); + emit signalChangeStatusbar( i18n("Settings changed") ); +} + +#include "%{APPNAMELC}view.moc" + diff --git a/languages/cpp/app_templates/kconfig35/appview.h b/languages/cpp/app_templates/kconfig35/appview.h new file mode 100644 index 00000000..45a10de7 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/appview.h @@ -0,0 +1,52 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}VIEW_H_ +#define _%{APPNAMEUC}VIEW_H_ + +#include + +#include "%{APPNAMELC}view_base.h" + +class QPainter; +class KURL; + +/** + * This is the main view class for %{APPNAME}. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * + * @short Main view + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAMELC}View : public %{APPNAMELC}view_base +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAMELC}View(QWidget *parent); + + /** + * Destructor + */ + virtual ~%{APPNAMELC}View(); + +signals: + /** + * Use this signal to change the content of the statusbar + */ + void signalChangeStatusbar(const QString& text); + + /** + * Use this signal to change the content of the caption + */ + void signalChangeCaption(const QString& text); + +private slots: + void switchColors(); + void settingsChanged(); +}; + +#endif // _%{APPNAMEUC}VIEW_H_ diff --git a/languages/cpp/app_templates/kconfig35/appview_base.ui b/languages/cpp/app_templates/kconfig35/appview_base.ui new file mode 100644 index 00000000..626d95df --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/appview_base.ui @@ -0,0 +1,33 @@ + +%{APPNAMELC}view_base + + +%{APPNAMELC}view_base + + + +0 +0 +268 +164 + + + +%{APPNAMELC}_base + + + +unnamed + + + +sillyLabel + + +hello, world + + + + + + diff --git a/languages/cpp/app_templates/kconfig35/kconfig35.kdevtemplate b/languages/cpp/app_templates/kconfig35/kconfig35.kdevtemplate new file mode 100644 index 00000000..0aa709f4 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/kconfig35.kdevtemplate @@ -0,0 +1,245 @@ +# KDE Config File +[General] +Name=KConfig XT for KDE 3.5 +Name[ca]=KConfig XT per a KDE 3.5 +Name[de]=KConfigXT-Anwendung für KDE 3.5 +Name[el]=Εφαρμογή KConfig XT για το KDE 3.5 +Name[es]=KConfig XT para KDE 3.5 +Name[et]=KConfig XT KDE 3.5 jaoks +Name[fr]=Application KConfig XT pour KDE 3.5 +Name[hu]=KConfig XT a KDE 3.5-höz +Name[it]=KConfig XT per KDE 3.5 +Name[ja]=KDE 3.5 用 KConfig XT +Name[nds]=KConfig-XT-Programm för KDE 3.5 +Name[nl]=KConfig XT voor KDE 3.5 +Name[pl]=Program KConfig XT dla KDE 3.5 +Name[pt]=Aplicação do KConfig XT para o KDE 3.5 +Name[pt_BR]=Aplicação do KConfig XT para o KDE 3.5 +Name[ru]=Приложение KDE 3.5 с KConfig XT +Name[sk]=KConfig XT pre KDE 3.5 +Name[sr]=KConfig XT програм за KDE 3.5 +Name[sr@Latn]=KConfig XT program za KDE 3.5 +Name[sv]=KConfig XT för KDE 3.5 +Name[zh_TW]=KDE 3.5 的 KConfig XT 應用程式 +Category=C++/KDE +Icon=kxt.png +Comment=Generates a simple KDE application with one widget and a configuration dialog compatible with KDE 3.5 only +Comment[ca]=Genera una simple aplicació per al KDE amb un estri i un diàleg de configuració compatible només amb KDE 3.5. +Comment[da]=Genererer et simpelt KDE-program med en kontrol og en indstillingsdialog der kun er kompatibelt med KDE 3.5 +Comment[de]=Erstellt eine einfache KDE-Anwendung für KDE 3.5 mit einem Widget und einem Einstellungsdialog. +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE με ένα γραφικό συστατικό, ένα διάλογο ρύθμισης συμβατό μόνο με το KDE 3.5 +Comment[en_GB]=Generates a simple KDE application with one widget and a configuration dialogue compatible with KDE 3.5 only +Comment[es]=Genera una sencilla aplicación para KDE con un widget y un diálogo de configuración compatible solo con KDE 3.5 +Comment[et]=Lihtsa KDE rakenduse loomine ühe vidina ja vaid KDE 3.5-ga ühilduva seadistustedialoogiga. +Comment[fr]=Génère une application KDE simple comprenant un seul élément graphique et une boîte de dialogue de configuration compatible avec KDE 3.5 uniquement +Comment[hu]=Létrehoz egy egyszerű KDE-alkalmazást egy grafikus elemmel és egy beállítóablakkal, csak a KDE 3.5-tel kompatibilis +Comment[it]=Genera una semplice applicazione KDE con un elemento grafico e una finestra di configurazione compatibile solo con KDE 3.5 +Comment[ja]=一つのウィジェットと設定ダイアログを含む簡単な KDE アプリケーションを作成します (KDE 3.5 用) +Comment[nds]=Stellt en eenfach KDE-Programm mit een Element un en Instelldialoog op, de bloots mit KDE 3.5 kompatibel is. +Comment[nl]=Genereert een eenvoudige KDE-toepassing met één widget en een configuratiedialoog die alleen met KDE 3.5 compatible is +Comment[pl]=Generuje prosty program KDE z jednym widżetem i oknem konfiguracyjnym zgodnym z KDE 3.5 +Comment[pt]=Gera uma aplicação simples do KDE com uma janela principal e outra para configuração, apenas para o KDE 3.5 +Comment[pt_BR]=Gera uma aplicação simples do KDE com uma janela principal e outra para configuração, apenas para o KDE 3.5 +Comment[ru]=Создание простого приложения KDE с одним виджетом и диалогом конфигурации, совместимое только с KDE 3.5. +Comment[sk]=Vygeneruje jednoduchú KDE aplikáciu s jedným oknom a konfiguračným dialógom kompatibilnú len s KDE 3.5 +Comment[sr]=Прави једноставан KDE програм са једном контролом и дијалогом за подешавање, компатибилан само са KDE-ом 3.5 +Comment[sr@Latn]=Pravi jednostavan KDE program sa jednom kontrolom i dijalogom za podešavanje, kompatibilan samo sa KDE-om 3.5 +Comment[sv]=Skapar ett enkelt KDE-program med en grafisk komponent och en inställningsdialogruta, som bara fungerar med KDE 3.5 +Comment[zh_TW]=產生一個簡單的 KDE 3.5 上的應用程式,內含一個元件與一個設定對話框。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp,%{dest}/README +Archive=kconfig35.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE13] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE14] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE15] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE16] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE17] +Type=install +EscapeXML=true +Source=%{src}/appview_base.ui +Dest=%{dest}/src/%{APPNAMELC}view_base.ui + +[FILE18] +Type=install +Source=%{src}/appview.cpp +Dest=%{dest}/src/%{APPNAMELC}view.cpp + +[FILE19] +Type=install +Source=%{src}/appview.h +Dest=%{dest}/src/%{APPNAMELC}view.h + +[FILE20] +Type=install +EscapeXML=true +Source=%{src}/prefs-base.ui +Dest=%{dest}/src/prefs-base.ui + +[FILE21] +Type=install +Source=%{src}/prefs.cpp +Dest=%{dest}/src/prefs.cpp + +[FILE22] +Type=install +Source=%{src}/prefs.h +Dest=%{dest}/src/prefs.h + +[FILE23] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE24] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE25] +Type=install +Source=%{src}/README +Dest=%{dest}/README + +[FILE26] +Type=install +Source=%{src}/app.kcfg +Dest=%{dest}/src/%{APPNAMELC}.kcfg + +[FILE27] +Type=install +Source=%{src}/settings.kcfgc +Dest=%{dest}/src/settings.kcfgc + +[FILE28] +Type=install +Source=%{src}/src-configure.in.in +Dest=%{dest}/configure.in.in + +[MSG] +Type=message +Comment=A KDE 3.5 KConfig XT application was created in %{dest} +Comment[ca]=Una aplicació KConfig XT per al KDE ha estat creada en %{dest} +Comment[da]=Et KDE 3.5 KConfig XT-program blev oprettet i %{dest} +Comment[de]=Eine KConfig-XT-Anwendung für KDE 3.5 wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή KConfig XT του KDE 3.5 δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación KConfig XT para KDE 3.5 ha sido creada en %{dest} +Comment[et]=KDE 3.5 KConfig XT rakendus loodi asukohta %{dest} +Comment[fr]=Une application KConfig XT pour KDE 3.5 a été créée dans %{dest} +Comment[hu]=Létrejött egy KConfig XT-alapú KDE 3.5-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KConfig XT per KDE 3.5 in %{dest} +Comment[ja]=KDE 3.5 用 KConfig XT アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KConfig-XT-Programm för KDE 3.5 opstellt +Comment[nl]=Een KDE 3.5 KConfig XT-toepassing is aangemaakt in %{dest} +Comment[pl]=Program KConfig XT dla KDE 3.5 został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KConfig XT para o KDE 3.5 em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KConfig XT para o KDE 3.5 em %{dest} +Comment[ru]=Приложение KDE с KConfig XT создано в %{dest} +Comment[sk]=KConfig XT pre KDE 3.5 bola vytvorená v %{dest} +Comment[sr]=KConfig XT програм за KDE 3.5 направљен је у %{dest} +Comment[sr@Latn]=KConfig XT program za KDE 3.5 napravljen je u %{dest} +Comment[sv]=Ett KDE 3.5 KConfig XT-program skapades i %{dest} +Comment[zh_TW]=一個 KDE 3.5 上的 KConfig XT 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kconfig35/kconfig35.png b/languages/cpp/app_templates/kconfig35/kconfig35.png new file mode 100644 index 00000000..a3866883 Binary files /dev/null and b/languages/cpp/app_templates/kconfig35/kconfig35.png differ diff --git a/languages/cpp/app_templates/kconfig35/kxt35.png b/languages/cpp/app_templates/kconfig35/kxt35.png new file mode 100644 index 00000000..a3866883 Binary files /dev/null and b/languages/cpp/app_templates/kconfig35/kxt35.png differ diff --git a/languages/cpp/app_templates/kconfig35/main.cpp b/languages/cpp/app_templates/kconfig35/main.cpp new file mode 100644 index 00000000..66f038c9 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/main.cpp @@ -0,0 +1,57 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + KApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(%{APPNAMELC}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->count() == 0) + { + %{APPNAMELC} *widget = new %{APPNAMELC}; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++) + { + %{APPNAMELC} *widget = new %{APPNAMELC}; + widget->show(); + } + } + args->clear(); + } + + return app.exec(); +} + diff --git a/languages/cpp/app_templates/kconfig35/prefs-base.ui b/languages/cpp/app_templates/kconfig35/prefs-base.ui new file mode 100644 index 00000000..5c0fc860 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/prefs-base.ui @@ -0,0 +1,127 @@ + +Prefs_base + + + Prefs_base + + + + 0 + 0 + 282 + 156 + + + + + unnamed + + + + textLabel2_2 + + + Background color: + + + + + kcfg_col_background + + + + + + + + textLabel1 + + + Project age: + + + + + textLabel2 + + + Foreground color: + + + + + kcfg_col_foreground + + + + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + kcfg_val_time + + + 1 + + + 2 + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + + + kcolorbutton.h + + diff --git a/languages/cpp/app_templates/kconfig35/prefs.cpp b/languages/cpp/app_templates/kconfig35/prefs.cpp new file mode 100644 index 00000000..e7a46ddf --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/prefs.cpp @@ -0,0 +1,12 @@ +%{CPP_TEMPLATE} + +#include "prefs.h" +#include + +Prefs::Prefs() + : Prefs_base() +{ +// debugging : +// kdWarning()<<"creating a pref dialog"< rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +KDE_ICON = AUTO + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = %{APPNAMELC}.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/%{APPNAMELC} +rc_DATA = %{APPNAMELC}ui.rc diff --git a/languages/cpp/app_templates/kconfig35/src-configure.in.in b/languages/cpp/app_templates/kconfig35/src-configure.in.in new file mode 100644 index 00000000..61d4a7fd --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/src-configure.in.in @@ -0,0 +1,7 @@ + +#MIN_CONFIG(3.2.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + diff --git a/languages/cpp/app_templates/kconfig35/subdirs b/languages/cpp/app_templates/kconfig35/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kconfig35/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kde4app/CMakeLists.txt b/languages/cpp/app_templates/kde4app/CMakeLists.txt new file mode 100644 index 00000000..2544a271 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/CMakeLists.txt @@ -0,0 +1,31 @@ +project(%{APPNAME}) +find_package(KDE4 REQUIRED) +include (KDE4Defaults) +include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) + +set(%{APPNAMELC}_SRCS + %{APPNAMELC}.cpp + main.cpp + %{APPNAMELC}view.cpp + ) + +#kde4_automoc(${%{APPNAMELC}_SRCS}) + +kde4_add_ui_files(%{APPNAMELC}_SRCS %{APPNAMELC}view_base.ui prefs_base.ui) + +kde4_add_kcfg_files(%{APPNAMELC}_SRCS settings.kcfgc ) + +kde4_add_executable(%{APPNAMELC} ${%{APPNAMELC}_SRCS}) + +target_link_libraries(%{APPNAMELC} ${KDE4_KDEUI_LIBS} ) + +install(TARGETS %{APPNAMELC} DESTINATION ${BIN_INSTALL_DIR} ) + + +########### install files ############### + +install( FILES %{APPNAMELC}.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES %{APPNAMELC}.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) +install( FILES %{APPNAMELC}ui.rc DESTINATION ${DATA_INSTALL_DIR}/%{APPNAMELC} ) + + diff --git a/languages/cpp/app_templates/kde4app/Makefile.am b/languages/cpp/app_templates/kde4app/Makefile.am new file mode 100644 index 00000000..2b39fcb4 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = kapp4.cpp kapp4.h prefs_base.ui kapp4view.cpp kapp4view.h kapp4view_base.ui \ + main.cpp kde4appui.rc CMakeLists.txt kapp4.desktop kapp4.kcfg settings.kcfgc \ + kde4app.png README kde4app.kdevelop kde4app.kdevelop.filelist + +templateName = kde4app + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kde4app/README b/languages/cpp/app_templates/kde4app/README new file mode 100644 index 00000000..a5f3a307 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/README @@ -0,0 +1,15 @@ +!!!!!ATTENTION!!!!! + +Before starting the build you may need to setup the KDE4 environment variables. +To do this open Project->Project Options and then look at the "Run" and the "Make" +pages. Each of these two has an environment variables widget in which you have +to fill in the right values for the variables already listed. + +After setting up the variables you'll also need to run cmake inside the build +directory. This can not be done by kdevelop as a KDE4 environment is needed +when running cmake to find KDE4. Open the integrated konsole and change to the build +subdirectory. Then setup a KDE4 environment and run "cmake ../". + +More information how to setup a KDE4 development environment can be found on +http://techbase.kde.org/Getting_Started/Increased_Productivity_in_KDE4_with_Scripts + diff --git a/languages/cpp/app_templates/kde4app/kapp4.cpp b/languages/cpp/app_templates/kde4app/kapp4.cpp new file mode 100644 index 00000000..c11a58d1 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4.cpp @@ -0,0 +1,90 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include "%{APPNAMELC}view.h" +#include "settings.h" + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +%{APPNAME}::%{APPNAME}() + : KXmlGuiWindow(), + m_view(new %{APPNAME}View(this)), + m_printer(0) +{ + // accept dnd + setAcceptDrops(true); + + // tell the KXmlGuiWindow that this is indeed the main widget + setCentralWidget(m_view); + + // then, setup our actions + setupActions(); + + // add a status bar + statusBar()->show(); + + // a call to KXmlGuiWindow::setupGUI() populates the GUI + // with actions, using KXMLGUI. + // It also applies the saved mainwindow settings, if any, and ask the + // mainwindow to automatically save settings if changed: window size, + // toolbar position, icon size, etc. + setupGUI(); +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +void %{APPNAME}::setupActions() +{ + KStandardAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); + + KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + // custom menu and menu item - the slot is in the class %{APPNAME}View + KAction *custom = new KAction(KIcon("colorize"), i18n("Swi&tch Colors"), this); + actionCollection()->addAction( QLatin1String("switch_action"), custom ); + connect(custom, SIGNAL(triggered(bool)), m_view, SLOT(switchColors())); +} + +void %{APPNAME}::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // create a new window + (new %{APPNAME})->show(); +} + +void %{APPNAME}::optionsPreferences() +{ + // The preference dialog is derived from prefs_base.ui + // + // compare the names of the widgets in the .ui file + // to the names of the variables in the .kcfg file + //avoid to have 2 dialogs shown + if ( KConfigDialog::showDialog( "settings" ) ) { + return; + } + KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self()); + QWidget *generalSettingsDlg = new QWidget; + ui_prefs_base.setupUi(generalSettingsDlg); + dialog->addPage(generalSettingsDlg, i18n("General"), "package_setting"); + connect(dialog, SIGNAL(settingsChanged(QString)), m_view, SLOT(settingsChanged())); + dialog->setAttribute( Qt::WA_DeleteOnClose ); + dialog->show(); +} + +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/kde4app/kapp4.desktop b/languages/cpp/app_templates/kde4app/kapp4.desktop new file mode 100644 index 00000000..008fad44 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4.desktop @@ -0,0 +1,30 @@ +[Desktop Entry] +Name=KApp4 +Name[nds]=KProg4 +Name[sv]=KDE 4-program +Name[zh_TW]=KApp4 程式 +Exec=kapp4 %i -caption "%c" +Icon=kapp4 +Type=Application +X-DocPath=kapp4/kapp4.html +GenericName=A KDE4 Application +GenericName[ca]=Una aplicació del KDE4 +GenericName[da]=Et KDE4-program +GenericName[de]=Eine KDE 4-Anwendung +GenericName[el]=Μία εφαρμογή του KDE4 +GenericName[es]=Una aplicación para KDE4 +GenericName[et]=KDE4 rakendus +GenericName[hu]=KDE4-alapú alkalmazás +GenericName[it]=Applicazione KDE4 +GenericName[nds]=En KDE4-Programm +GenericName[nl]=Een KDE4-programma +GenericName[pl]=Program dla KDE4 +GenericName[pt]=Uma Aplicação do KDE4 +GenericName[pt_BR]=Uma Aplicação do KDE4 +GenericName[ru]=Приложение KDE 4 +GenericName[sk]=KDE4 aplikácia +GenericName[sr]=KDE4 програм +GenericName[sr@Latn]=KDE4 program +GenericName[sv]=Ett KDE 4-program +GenericName[zh_TW]=KDE4 應用程式 +Terminal=false diff --git a/languages/cpp/app_templates/kde4app/kapp4.h b/languages/cpp/app_templates/kde4app/kapp4.h new file mode 100644 index 00000000..fb059fde --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4.h @@ -0,0 +1,53 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + + +#include + +#include "ui_prefs_base.h" + +class %{APPNAME}View; +class KPrinter; +class KToggleAction; +class KUrl; + +/** + * This class serves as the main window for %{APPNAME}. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + * @author Andreas Pakulat + * @version 0.1 + */ +class %{APPNAME} : public KXmlGuiWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); + +private slots: + void fileNew(); + void optionsPreferences(); + +private: + void setupActions(); + +private: + Ui::prefs_base ui_prefs_base ; + %{APPNAME}View *m_view; + + KPrinter *m_printer; + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; +}; + +#endif // _%{APPNAMELC}_H_ diff --git a/languages/cpp/app_templates/kde4app/kapp4.kcfg b/languages/cpp/app_templates/kde4app/kapp4.kcfg new file mode 100644 index 00000000..6040f769 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4.kcfg @@ -0,0 +1,21 @@ + + + + + + + black + + + + yellow + + + + 2 + + + diff --git a/languages/cpp/app_templates/kde4app/kapp4view.cpp b/languages/cpp/app_templates/kde4app/kapp4view.cpp new file mode 100644 index 00000000..256f6bcb --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4view.cpp @@ -0,0 +1,42 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}view.h" +#include "settings.h" + +#include +#include + +%{APPNAME}View::%{APPNAME}View(QWidget *) +{ + ui_%{APPNAMELC}view_base.setupUi(this); + settingsChanged(); + setAutoFillBackground(true); +} + +%{APPNAME}View::~%{APPNAME}View() +{ + +} + +void %{APPNAME}View::switchColors() +{ + // switch the foreground/background colors of the label + QColor color = Settings::col_background(); + Settings::setCol_background( Settings::col_foreground() ); + Settings::setCol_foreground( color ); + + settingsChanged(); +} + +void %{APPNAME}View::settingsChanged() +{ + QPalette pal; + pal.setColor( QPalette::Window, Settings::col_background()); + pal.setColor( QPalette::WindowText, Settings::col_foreground()); + ui_%{APPNAMELC}view_base.kcfg_sillyLabel->setPalette( pal ); + + // i18n : internationalization + ui_%{APPNAMELC}view_base.kcfg_sillyLabel->setText( i18n("This project is %1 days old",Settings::val_time()) ); + emit signalChangeStatusbar( i18n("Settings changed") ); +} + +#include "%{APPNAMELC}view.moc" diff --git a/languages/cpp/app_templates/kde4app/kapp4view.h b/languages/cpp/app_templates/kde4app/kapp4view.h new file mode 100644 index 00000000..ab08445f --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4view.h @@ -0,0 +1,55 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMELC}VIEW_H +#define %{APPNAMELC}VIEW_H + +#include + +#include "ui_%{APPNAMELC}view_base.h" + +class QPainter; +class KUrl; + +/** + * This is the main view class for %{APPNAME}. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * + * @short Main view + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ + +class %{APPNAME}View : public QWidget, public Ui::%{APPNAMELC}view_base +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAME}View(QWidget *parent); + + /** + * Destructor + */ + virtual ~%{APPNAME}View(); + +private: + Ui::%{APPNAMELC}view_base ui_%{APPNAMELC}view_base; + +signals: + /** + * Use this signal to change the content of the statusbar + */ + void signalChangeStatusbar(const QString& text); + + /** + * Use this signal to change the content of the caption + */ + void signalChangeCaption(const QString& text); + +private slots: + void switchColors(); + void settingsChanged(); +}; + +#endif // %{APPNAME}VIEW_H diff --git a/languages/cpp/app_templates/kde4app/kapp4view_base.ui b/languages/cpp/app_templates/kde4app/kapp4view_base.ui new file mode 100644 index 00000000..eb6a254a --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kapp4view_base.ui @@ -0,0 +1,213 @@ + +%{APPNAMELC}view_base + + + + 0 + 0 + 315 + 233 + + + + %{APPNAMELC}_base + + + true + + + + 11 + + + 11 + + + 11 + + + 11 + + + 6 + + + 6 + + + + + + + + + + 255 + 255 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + Sans Serif + 12 + + + + true + + + hello, world + + + true + + + Qt::AlignCenter + + + false + + + + + + + qPixmapFromMimeSource + + + diff --git a/languages/cpp/app_templates/kde4app/kde4app.kdevelop b/languages/cpp/app_templates/kde4app/kde4app.kdevelop new file mode 100644 index 00000000..d36a9536 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kde4app.kdevelop @@ -0,0 +1,205 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevCustomProject + C++ + + C++ + Code + Qt + KDE + + %{APPNAMELC} + . + false + + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + true + false + false + true + + + false + true + + + + + + + + + + + + -f + + -dP + + -f + -u3 -p + + + + + + + false + + + .h + .cpp + true + + + + + %{dest}/build/%{APPNAMELC} + + false + false + + + + + + + + + false + false + + true + %{dest} + executable + + + make + %{dest}/build + + + false + 1 + 0 + false + make + + + default + + + + + + + + + + + + + *.h + *.cpp + CMakeLists.txt + *.desktop + *.kcfg* + *.ui + Doxyfile + *.dox + *.rc + *.cmake + + + 0 + + + + default + + + + + + build + + + + + true + 4 + 4 + ExternalDesigner + /usr/bin/designer-qt4 + /usr/lib/qt4 + + + + true + 2 + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kde4app/kde4app.kdevelop.filelist b/languages/cpp/app_templates/kde4app/kde4app.kdevelop.filelist new file mode 100644 index 00000000..5235563f --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kde4app.kdevelop.filelist @@ -0,0 +1,13 @@ +# KDevelop Custom Project File List +CMakeLists.txt +main.cpp +prefs_base.ui +settings.kcfgc +%{APPNAMELC}.cpp +%{APPNAMELC}.desktop +%{APPNAMELC}.h +%{APPNAMELC}.kcfg +%{APPNAMELC}ui.rc +%{APPNAMELC}view.cpp +%{APPNAMELC}view.h +%{APPNAMELC}view_base.ui diff --git a/languages/cpp/app_templates/kde4app/kde4app.kdevtemplate b/languages/cpp/app_templates/kde4app/kde4app.kdevtemplate new file mode 100644 index 00000000..2a7269fd --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kde4app.kdevtemplate @@ -0,0 +1,155 @@ +# KDE Config File +[General] +Name=KDE4 Application framework +Name[ca]=Entorn de treball d'aplicacions pel KDE4 +Name[da]=KDE4 program-framework +Name[de]=KDE 4-Anwendungsgrundgerüst +Name[el]=Πλαίσιο εφαρμογής του KDE4 +Name[es]=Infraestructura de aplicación para KDE4 +Name[et]=KDE4 rakenduse raamistik +Name[hu]=Keretrendszer KDE4-alapú alkalmazáshoz +Name[it]=Infrastruttura per applicazioni KDE4 +Name[nds]=KDE4-Programmrahmenwark +Name[nl]=KDE4-programmaframewerk +Name[pl]=Szablon programu dla KDE4 +Name[pt]=Plataforma de aplicações do KDE4 +Name[pt_BR]=Plataforma de aplicações do KDE4 +Name[ru]=Инструментарий для создания приложений KDE 4 +Name[sk]=KDE4 aplikačný framework +Name[sr]=Радни оквир KDE4 програма +Name[sr@Latn]=Radni okvir KDE4 programa +Name[sv]=KDE 4-programramverk +Name[zh_TW]=KDE4 應用程式框架 +Icon=kde4app.png +Category=C++/KDE4 +Comment=Generates a simple KDE4 application with one toplevel window, menus and toolbars. +Comment[ca]=Genera una aplicació senzilla per al KDE4 amb una finestra principal, menús i barres d'eines. +Comment[da]=Genererer et simpelt KDE4-program med et vindue på topniveau, menuer og værktøjslinjer. +Comment[de]=Erstellt eine einfache KDE 4-Anwendung mit einem Toplevel-Fenster, Menüs und Werkzeugleisten. +Comment[el]=Δημιουργεί μια απλή εφαρμογή του KDE4 με ένα ανώτερο παράθυρο, μενού, και γραμμές εργαλείων. +Comment[es]=Genera una sencilla aplicación para KDE4 con una ventana principal, menús y barras de herramientas. +Comment[et]=Lihtsa KDE4 rakenduse loomine ühe tipptaseme akna, menüüde ja tööriistaribadega. +Comment[hu]=Létrehoz egy egyszerű KDE4-alkalmazást egy főablakkal, menükkel és eszköztárakkal. +Comment[it]=Genera una semplice applicazione KDE4 con una finestra toplevel, menu e barre degli strumenti. +Comment[nds]=Stellt en eenfach KDE4-Programm mit een böverst Finster, Menüs un Warktüüchbalkens op. +Comment[nl]=Genereert een eenvoudig KDE4-programma met een topniveauvenster, menu's en werkbalken. +Comment[pl]=Generuje prosty program dla KDE4 posiadający okno, menu i paski narzędzi. +Comment[pt]=Gera uma aplicação para KDE4 simples, com uma janela de topo, menus e barras de ferramentas. +Comment[pt_BR]=Gera uma aplicação para KDE4 simples, com uma janela de topo, menus e barras de ferramentas. +Comment[ru]=Создание простого приложения KDE 4 с одним окном верхнего уровня, меню и панелями инструментов. +Comment[sk]=Vygeneruje jednoduchú KDE4 aplikáciu s jedným oknom, menu a panelom nástrojov. +Comment[sr]=Прави једноставан KDE4 програм са једним прозором највишег нивоа, менијима и тракама са алатом. +Comment[sr@Latn]=Pravi jednostavan KDE4 program sa jednim prozorom najvišeg nivoa, menijima i trakama sa alatom. +Comment[sv]=Skapar ett enkelt KDE 4-program med ett toppnivåfönster, menyer och verktygsrader. +Comment[zh_TW]=產生一個簡單的 KDE4 應用程式,內含頂層視窗、選單與工具列。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/README +Archive=kde4app.tar.gz + +[FILE1] +Type=install +Source=%{src}/CMakeLists.txt +Dest=%{dest}/CMakeLists.txt + +[FILE2] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/main.cpp + +[FILE3] +Type=install +Source=%{src}/kapp4.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE4] +Type=install +Source=%{src}/kapp4.h +Dest=%{dest}/%{APPNAMELC}.h + +[FILE5] +Type=install +Source=%{src}/kapp4view.cpp +Dest=%{dest}/%{APPNAMELC}view.cpp + + +[FILE6] +Type=install +Source=%{src}/kapp4view.h +Dest=%{dest}/%{APPNAMELC}view.h + + +[FILE7] +Type=install +Source=%{src}/kde4appui.rc +Dest=%{dest}/%{APPNAMELC}ui.rc + + +[FILE8] +Type=install +Source=%{src}/kapp4view_base.ui +Dest=%{dest}/%{APPNAMELC}view_base.ui + + +[FILE9] +Type=install +Source=%{src}/kapp4.desktop +Dest=%{dest}/%{APPNAMELC}.desktop + +[FILE10] +Type=install +Source=%{src}/kapp4.kcfg +Dest=%{dest}/%{APPNAMELC}.kcfg + + +[FILE11] +Type=install +Source=%{src}/prefs_base.ui +Dest=%{dest}/prefs_base.ui + + +[FILE12] +Type=install +Source=%{src}/settings.kcfgc +Dest=%{dest}/settings.kcfgc + +[FILE13] +Type=install +Source=%{src}/README +Dest=%{dest}/README + +[FILE14] +Type=install +Source=%{src}/kde4app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE15] +Type=install +Source=%{src}/kde4app.kdevelop.filelist +Dest=%{dest}/%{APPNAMELC}.kdevelop.filelist + +[MKDIR1] +Type=mkdir +Dir=%{dest}/build + +[MSG] +Type=message +Comment=A KDE4 Application was created at %{dest} +Comment[ca]=S'ha creat una aplicació per al KDE4 a %{dest} +Comment[da]=Et KDE4-program blev oprettet i %{dest} +Comment[de]=Eine KDE 4-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή KDE4 δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para KDE4 ha sido creada en %{dest} +Comment[et]=KDE4 rakendus loodi asukohta %{dest} +Comment[hu]=Létrejött egy KDE4-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KDE4 in %{dest} +Comment[nds]=In %{dest} wöör en KDE4-Programm opstellt +Comment[nl]=Een KDE4-toepassing is aangemaakt in %{dest} +Comment[pl]=Program dla KDE4 został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KDE4 em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KDE4 em %{dest} +Comment[ru]=Приложение KDE 4 создано в %{dest} +Comment[sk]=KDE4 aplikácia bola vytvorená v %{dest} +Comment[sr]=KDE4 програм је направљен у %{dest} +Comment[sr@Latn]=KDE4 program je napravljen u %{dest} +Comment[sv]=Ett KDE 4-program skapades i %{dest} +Comment[zh_TW]=一個 KDE4 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kde4app/kde4app.png b/languages/cpp/app_templates/kde4app/kde4app.png new file mode 100644 index 00000000..a421a664 Binary files /dev/null and b/languages/cpp/app_templates/kde4app/kde4app.png differ diff --git a/languages/cpp/app_templates/kde4app/kde4appui.rc b/languages/cpp/app_templates/kde4app/kde4appui.rc new file mode 100644 index 00000000..406bccc6 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/kde4appui.rc @@ -0,0 +1,8 @@ + + + + &Move + + + + diff --git a/languages/cpp/app_templates/kde4app/main.cpp b/languages/cpp/app_templates/kde4app/main.cpp new file mode 100644 index 00000000..2bb5b6bf --- /dev/null +++ b/languages/cpp/app_templates/kde4app/main.cpp @@ -0,0 +1,55 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE 4 Application"); + +static const char version[] = "%{VERSION}"; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", 0, ki18n("%{APPNAME}"), version, ki18n(description), + KAboutData::License_%{LICENSE}, ki18n("(C) %{YEAR} %{AUTHOR}"), KLocalizedString(), 0, "%{EMAIL}"); + about.addAuthor( ki18n("%{AUTHOR}"), KLocalizedString(), "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + + KCmdLineOptions options; + options.add("+[URL]", ki18n( "Document to open" )); + KCmdLineArgs::addCmdLineOptions(options); + KApplication app; + + %{APPNAME} *widget = new %{APPNAME}; + + // see if we are starting with session management + if (app.isSessionRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->count() == 0) + { + //%{APPNAMELC} *widget = new %{APPNAMELC}; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++) + { + //%{APPNAMELC} *widget = new %{APPNAMELC}; + widget->show(); + } + } + args->clear(); + } + + return app.exec(); +} diff --git a/languages/cpp/app_templates/kde4app/prefs_base.ui b/languages/cpp/app_templates/kde4app/prefs_base.ui new file mode 100644 index 00000000..ea400f02 --- /dev/null +++ b/languages/cpp/app_templates/kde4app/prefs_base.ui @@ -0,0 +1,155 @@ + + prefs_base + + + + 0 + 0 + 282 + 156 + + + + + + + Background color: + + + false + + + + + + + Choose a new background color + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Change the <span style=" font-weight:600;">background</span> color by clicking here and choose the new <span style=" color:#ff0000;">color</span> in the <span style=" font-style:italic;">color dialog</span>.</p></body></html> + + + + + + + + + + Project age: + + + false + + + + + + + Foreground color: + + + false + + + + + + + Choose a new foreground color + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Change the <span style=" font-weight:600;">foreground</span> color by clicking here and choose the new <span style=" color:#ff0000;">color</span> in the <span style=" font-style:italic;">color dialog</span>.</p></body></html> + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 41 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 41 + 20 + + + + + + + + Set the project age (in days) + + + Change the project age (in days) by choosing a new number of days. + + + 1 + + + 2 + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 41 + 20 + + + + + + + + qPixmapFromMimeSource + + + KColorButton + QPushButton +
      kcolorbutton.h
      +
      +
      + + kcolorbutton.h + + + +
      diff --git a/languages/cpp/app_templates/kde4app/settings.kcfgc b/languages/cpp/app_templates/kde4app/settings.kcfgc new file mode 100644 index 00000000..384510cd --- /dev/null +++ b/languages/cpp/app_templates/kde4app/settings.kcfgc @@ -0,0 +1,6 @@ +# Code generation options for kconfig_compiler +File=%{APPNAMELC}.kcfg +ClassName=Settings +Singleton=true +Mutators=col_background,col_foreground +# will create the necessary code for setting those variables diff --git a/languages/cpp/app_templates/kdecpp.appwizard b/languages/cpp/app_templates/kdecpp.appwizard new file mode 100644 index 00000000..aa36123a --- /dev/null +++ b/languages/cpp/app_templates/kdecpp.appwizard @@ -0,0 +1,2 @@ +[General] +List=kdedcop,kioslave,kxt,kdevlang,kmake,kapp,kconfig35,kdevlang,kdevpart,kateplugin,kdevpart2,kopart,noatunui,kateplugin2,kfileplugin,konqnavpanel,noatunvisual,dcopservice,khello,kpartapp,khello2,kpartplugin,kcmodule,kicker,kscreensaver,kscons_kxt,kscons_kmdi diff --git a/languages/cpp/app_templates/kdedcop/.kdev_ignore b/languages/cpp/app_templates/kdedcop/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kdedcop/Makefile.am b/languages/cpp/app_templates/kdedcop/Makefile.am new file mode 100644 index 00000000..87697fcd --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = app.cpp app.h app_iface.h app.kdevelop main.cpp mainclass.cpp \ + mainclass.h kdedcop.png src-Makefile.am subdirs + +templateName = kdedcop + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kdedcop/app.cpp b/languages/cpp/app_templates/kdedcop/app.cpp new file mode 100644 index 00000000..e295253a --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/app.cpp @@ -0,0 +1,21 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" + +#include + +#include +#include + +%{APPNAME}::%{APPNAME}() + : KMainWindow( 0, "%{APPNAME}" ) +{ + m_mainClass = new MainClass(); +} + +%{APPNAME}::~%{APPNAME}() +{ + if (m_mainClass) delete m_mainClass; +} + +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/kdedcop/app.h b/languages/cpp/app_templates/kdedcop/app.h new file mode 100644 index 00000000..b908b62c --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/app.h @@ -0,0 +1,36 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "mainclass.h" + +/** + * @short Application Main Window + * @author %{AUTHOR} <%{EMAIL}> + * @version 0.1 + */ +class %{APPNAME} : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); +private: + MainClass *m_mainClass; +}; + +#endif // _%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/kdedcop/app.kdevelop b/languages/cpp/app_templates/kdedcop/app.kdevelop new file mode 100644 index 00000000..496a3838 --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/app.kdevelop @@ -0,0 +1,116 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + DCOP + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kdedcop/app_iface.h b/languages/cpp/app_templates/kdedcop/app_iface.h new file mode 100644 index 00000000..57bfb059 --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/app_iface.h @@ -0,0 +1,19 @@ +%{H_TEMPLATE} + +#include + +class DCOPDemoIface : virtual public DCOPObject +{ + K_DCOP + k_dcop: + + + // Here you should place your DCOP interface. + // Below are four example methods. + virtual QString strVal() const = 0; + virtual int intVal() const = 0; + + virtual void setIntVal( int num ) = 0; + virtual void setStrVal( const QString &str ) = 0; + +}; diff --git a/languages/cpp/app_templates/kdedcop/kdedcop.kdevtemplate b/languages/cpp/app_templates/kdedcop/kdedcop.kdevtemplate new file mode 100644 index 00000000..99f6e28d --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/kdedcop.kdevtemplate @@ -0,0 +1,227 @@ +# KDE Config File +[General] +Name=Simple DCOP server +Name[ca]=Simple servidor DCOP +Name[da]=Simpel DCOP-server +Name[de]=Einfacher DCOP-Server +Name[el]=Απλός εξυπηρετητής DCOP +Name[es]=Sencillo servidor DCOP +Name[et]=Lihtne DCOP-server +Name[eu]=DCOP zerbitzari sinple bat +Name[fa]=کارساز سادۀ DCOP +Name[fr]=Serveur DCOP simple +Name[ga]=Freastalaí simplí DCOP +Name[gl]=Servidor sinxelo DCOP +Name[hu]=Egyszerű DCOP-kiszolgáló +Name[it]=Semplice server DCOP +Name[ja]=簡単な DCOP サーバ +Name[nds]=Eenfach DCOP-Server +Name[ne]=साधारण DCOP सर्भर +Name[nl]=Eenvoudige DCOP-server +Name[pl]=Prosty serwer DCOP +Name[pt]=Servidor de DCOP simples +Name[pt_BR]=Servidor de DCOP simples +Name[ru]=Сервер DCOP +Name[sk]=Jednoduchý DCOP server +Name[sl]=Preprost strežnik DCOP +Name[sr]=Једноставан DCOP сервер +Name[sr@Latn]=Jednostavan DCOP server +Name[sv]=Enkel DCOP-server +Name[tr]=Basit DCOP Sunucusu +Name[zh_CN]=简单的 DCOP 服务器 +Name[zh_TW]=簡單的 DCOP 伺服器 +Icon=kdedcop.png +Category=C++/KDE +Comment=Generates a basic KDE DCOP server. This is an ideal starting point for a DCOP server that does not require a GUI interface. +Comment[ca]=Genera un servidor bàsic DCOP per al KDE. Aquest és un idoni punt de partida per a un servidor DCOP que no requereixi d'una IGU. +Comment[da]=Genererer en basal KDE DCOP-server. Dette er et ideelt startpunkt for en DCOP-server der ikke kræver en GUI-grænseflade. +Comment[de]=Erstellt einen einfachen KDE-DCOP-Server. Dies ist ein idealer Ausgangspunkt für einen DCOP-Server, der keine Benutzeroberfläche erfordert. +Comment[el]=Δημιουργεί ένα βασικό εξυπηρετητή KDE DCOP. Αυτό είναι ένα ιδανικό σημείο αρχής για έναν εξυπηρετητή DCOP ο οποίος δε χρειάζεται ένα γραφικό περιβάλλον. +Comment[es]=Genera un servidor básico DCOP para KDE. Es un punto de comienzo ideal para un servidor DCOP que no requiera una interfaz gráfica. +Comment[et]=Lihtsa KDE DCOP-serveri loomine. See on ideaalne algus DCOP-serverile, mis ei eelda graafilist kasutajaliidest. +Comment[eu]=DCOP zerbitzari sinple bat sortzen du. Hau GUI interfazerik behar ez duen DCOP zerbitzari baterako hasierako puntu aparta da. +Comment[fa]=یک کارساز پایۀ KDE DCOP تولید می‌کند. این یک نقطۀ شروع دلخواه برای یک کارساز DCOP است، که نیازی به یک واسط ونک ندارد. +Comment[fr]=Génère un serveur DCOP KDE de base. C'est un bon point de départ pour un serveur DCOP qui ne requiert pas d'interface graphique. +Comment[gl]=Xera un servidor básico DCOP para KDE. Este é un punto de comezo ideal para un servidor DCOP que non require unha interface GUI. +Comment[hu]=Létrehoz egy egyszerű KDE DCOP-os kiszolgálót. Jó kiindulópont grafikus felület nélküli DCOP-kiszolgáló készítéséhez. +Comment[it]=Genera un semplice server DCOP per KDE. È un punto di partenza ideale per un server DCOP che non richiede un'interfaccia GUI. +Comment[ja]=基本的な KDE DCOP サーバを作成します。GUI を必要としない DCOP サーバの理想的な開始点です。 +Comment[nds]=Stellt en eenfach DCOP-Server op. Dat is en goot Anfang för en DCOP-Server ahn Böversiet. +Comment[ne]=आधारभूत KDE DCOP सर्भर उत्पन्न गर्दछ । यो DCOP सर्भरका लागि उपयुक्त सुरुआत बिन्दु हो जसलाई जी यू आई इन्टरफेस आवश्यक पर्दैन । +Comment[nl]=Genereert een basis KDE DCOP-server. Dit is een ideaal startpunt voor een DCOP-server die geen GUI-interface vereist. +Comment[pl]=Generuje prosty serwer KDE DCOP. Dobry punkt startu dla serwera DCOP, który nie potrzebuje interfejsu graficznego. +Comment[pt]=Gera um servidor básico de DCOP para o KDE. Este é um ponto de partida ideal para um servidor de DCOP que não necessite de uma interface gráfica. +Comment[pt_BR]=Gera um servidor básico de DCOP para o KDE. Este é um ponto de partida ideal para um servidor de DCOP que não necessite de uma interface gráfica. +Comment[ru]=Создание простого сервера DCOP. Идеальная стартовая точка для разработки сервера DCOP без графического интерфейса. +Comment[sk]=Vygeneruje základný KDE DCOP server. Toto je ideálny štartovací bod pre DCOP server, ktorý nepotrebuje GUI rozhranie. +Comment[sl]=Ustvari osnovni strežnik DCOP za KDE. To je idealno začetno mesto za strežnik DCOP, ki ne potrebuje grafičnega vmesnika. +Comment[sr]=Прави основан KDE DCOP сервер. Ово је идеална почетна тачка за DCOP сервер који не захтева GUI. +Comment[sr@Latn]=Pravi osnovan KDE DCOP server. Ovo je idealna početna tačka za DCOP server koji ne zahteva GUI. +Comment[sv]=Skapar en grundläggande KDE DCOP-server. Detta är en idealisk utgångspunkt för en DCOP-server som inte kräver ett grafiskt användargränssnitt. +Comment[tr]=Basit bir KDE DCOP sunucusu yaratır. Bu grafik arayüz gerektirmeyen bir DCOP sunucusuna başlamak için uygun bir noktadır. +Comment[zh_CN]=生成简单的 KDE DCOP 服务器。这是不需要图形界面的 DCOP 服务器的良好开端。 +Comment[zh_TW]=產生一個基本的 KDE DCOP 伺服器。這個是開發一個不需使用者介面的 DCOP 伺服器的一個好起點。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/main.cpp +Archive=kdedcop.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE13] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE14] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE15] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE16] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE17] +Type=install +Source=%{src}/mainclass.cpp +Dest=%{dest}/src/mainclass.cpp + +[FILE18] +Type=install +Source=%{src}/mainclass.h +Dest=%{dest}/src/mainclass.h + +[FILE19] +Type=install +Source=%{src}/app_iface.h +Dest=%{dest}/src/%{APPNAMELC}_iface.h + +[FILE20] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[MSG] +Type=message +Comment=A simple DCOP server was created in %{dest} +Comment[ca]=Un simple servidor DCOP ha estat creat en %{dest} +Comment[da]=En simpel DCOP-server blev oprettet i %{dest} +Comment[de]=Ein einfacher DCOP-Server wurde in %{dest} erstellt. +Comment[el]=Ένας απλός εξυπηρετητής DCOP δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo servidor DCOP ha sido creado en %{dest} +Comment[et]=Lihtne DCOP-server loodi asukohta %{dest} +Comment[eu]=DCOP zerbitzari sinple bat sortu da hemen: %{dest} +Comment[fa]=یک کارساز سادۀ DCOP در %{dest} ایجاد شد +Comment[fr]=Un serveur DCOP simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh freastalaí simplí DCOP i %{dest} +Comment[gl]=Creouse un servidor DCOP sinxelo en %{dest} +Comment[hu]=Létrejött egy egyszerű DCOP-kiszolgáló itt: %{dest} +Comment[it]=È stato creato un semplice server DCOP in %{dest} +Comment[ja]=簡単な DCOP サーバを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach DCOP-Server opstellt +Comment[ne]=साधारण DCOP सर्भर %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudige DCOP-server is aangemaakt in %{dest} +Comment[pl]=Prosty serwer DCOP został utworzony w %{dest} +Comment[pt]=Foi criado um servidor de DCOP simples em %{dest} +Comment[pt_BR]=Foi criado um servidor de DCOP simples em %{dest} +Comment[ru]=Простой сервер DCOP создан в %{dest} +Comment[sk]=Jednoduchý DCOP server bol vytvorený v %{dest} +Comment[sl]=Preprost strežnik DCOP je bil ustvarjen v %{dest} +Comment[sr]=Једноставан DCOP сервер направљен је у %{dest} +Comment[sr@Latn]=Jednostavan DCOP server napravljen je u %{dest} +Comment[sv]=En enkel DCOP-server skapades i %{dest} +Comment[tr]=Basit bir DCOP sunucusu %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了简单的 DCOP 服务器 +Comment[zh_TW]=一個簡單的 DCOP 伺服器已建立於 %{dest} diff --git a/languages/cpp/app_templates/kdedcop/kdedcop.png b/languages/cpp/app_templates/kdedcop/kdedcop.png new file mode 100644 index 00000000..1d25362b Binary files /dev/null and b/languages/cpp/app_templates/kdedcop/kdedcop.png differ diff --git a/languages/cpp/app_templates/kdedcop/main.cpp b/languages/cpp/app_templates/kdedcop/main.cpp new file mode 100644 index 00000000..5bfcf8ae --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/main.cpp @@ -0,0 +1,52 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE KPart Application"); + +static const char version[] = "0.1"; + +static KCmdLineOptions options[] = +{ +// { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + %{APPNAME} *mainWin = 0; + + if (app.isRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + /// @todo do something with the command line args here + + mainWin = new %{APPNAME}(); + app.setMainWidget( mainWin ); + mainWin->show(); + + args->clear(); + } + + int ret = app.exec(); + + delete mainWin; + return ret; +} diff --git a/languages/cpp/app_templates/kdedcop/mainclass.cpp b/languages/cpp/app_templates/kdedcop/mainclass.cpp new file mode 100644 index 00000000..8f334114 --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/mainclass.cpp @@ -0,0 +1,31 @@ +%{CPP_TEMPLATE} + +#include "mainclass.h" + + +MainClass::MainClass() + : DCOPDemoIface(), + DCOPObject("mainclass"), /* this is the object name DCOP will expose */ + m_intValue(0) +{ +} + +MainClass::~MainClass() +{ +} + +void MainClass::setStrVal(const QString & str) { + m_strValue = str; +} + +void MainClass::setIntVal(int val) { + m_intValue = val; +} + +QString MainClass::strVal() const { + return m_strValue; +} + +int MainClass::intVal() const { + return m_intValue; +} diff --git a/languages/cpp/app_templates/kdedcop/mainclass.h b/languages/cpp/app_templates/kdedcop/mainclass.h new file mode 100644 index 00000000..ca37f2ad --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/mainclass.h @@ -0,0 +1,32 @@ +%{H_TEMPLATE} + +#ifndef MAINCLASS_H +#define MAINCLASS_H + +#include "%{APPNAMELC}_iface.h" + +/** + * + * @author %{AUTHOR} + **/ +class MainClass : virtual public DCOPDemoIface +{ +public: + MainClass(); + + ~MainClass(); + + + // Here is the implementation of the example DCOP interface methods. + virtual void setStrVal(const QString &); + virtual void setIntVal(int); + virtual QString strVal() const; + virtual int intVal() const; + +private: + QString m_strValue; + int m_intValue; + +}; + +#endif diff --git a/languages/cpp/app_templates/kdedcop/src-Makefile.am b/languages/cpp/app_templates/kdedcop/src-Makefile.am new file mode 100644 index 00000000..dc26ec93 --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/src-Makefile.am @@ -0,0 +1,23 @@ +## Makefile.am for %{APPNAMELC} + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = %{APPNAMELC}.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} + +# the application source, library search path, and link libraries +%{APPNAMELC}_SOURCES = main.cpp %{APPNAMELC}.cpp %{APPNAMELC}_iface.skel mainclass.cpp +%{APPNAMELC}_LDFLAGS = $(KDE_RPATH) $(all_libraries) +%{APPNAMELC}_LDADD = $(LIB_KDEUI) diff --git a/languages/cpp/app_templates/kdedcop/subdirs b/languages/cpp/app_templates/kdedcop/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kdedcop/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kdevlang/.kdev_ignore b/languages/cpp/app_templates/kdevlang/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kdevlang/Makefile.am b/languages/cpp/app_templates/kdevlang/Makefile.am new file mode 100644 index 00000000..972dd511 --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = src-Makefile.am kdevlang_part.cpp kdevlang_part.h kdevlang.rc \ + kdevlang.desktop app.kdevelop kdevlang-configure.in.in README.dox +templateName = kdevlang + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kdevlang/README.dox b/languages/cpp/app_templates/kdevlang/README.dox new file mode 100644 index 00000000..86968add --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/README.dox @@ -0,0 +1,55 @@ +/** \class %{APPNAME} +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +\authors %{AUTHOR} +\authors 2nd author full name +... +\authors nth author full name + +\maintainer %{AUTHOR} +\maintainer 2nd maintainer full name +... +\maintainer nth maintainer full name + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in +YOUR_COMPONENT_NAME at Bugzilla database +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/languages/cpp/app_templates/kdevlang/app.kdevelop b/languages/cpp/app_templates/kdevlang/app.kdevelop new file mode 100644 index 00000000..7a0e573b --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/app.kdevelop @@ -0,0 +1,115 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + KDevelop + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kdevlang/kdevlang-configure.in.in b/languages/cpp/app_templates/kdevlang/kdevlang-configure.in.in new file mode 100644 index 00000000..78ed2275 --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/kdevlang-configure.in.in @@ -0,0 +1,10 @@ +#MIN_CONFIG(3.0.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +KDE_CHECK_HEADERS([kdevelop/kdevcore.h]) +KDE_CHECK_LIB([kdevelop],main, + [LIBKDEVELOP="-lkdevelop"]) +AC_SUBST(LIBKDEVELOP) diff --git a/languages/cpp/app_templates/kdevlang/kdevlang.desktop b/languages/cpp/app_templates/kdevlang/kdevlang.desktop new file mode 100644 index 00000000..d8f320a3 --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/kdevlang.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=%{APPNAME} +Comment[pt]=%{APPNAME$} +Name=KDev%{APPNAME} +Name[nds]=KDev%{ProgNaam} +Name[sv]=KDevelop %{APPNAME} +Name[ta]=கெடெவ்%{APPNAME} +Icon=kdevelop +ServiceTypes=KDevelop/LanguageSupport +X-KDevelop-Language=ChangeMe +X-KDE-Library=libkdev%{APPNAMELC} +X-KDevelop-Version=3 diff --git a/languages/cpp/app_templates/kdevlang/kdevlang.kdevtemplate b/languages/cpp/app_templates/kdevlang/kdevlang.kdevtemplate new file mode 100644 index 00000000..c3ad93bf --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/kdevlang.kdevtemplate @@ -0,0 +1,157 @@ +# KDE Config File +[General] +Name=KDevelop Language Support Plugin (Standalone build) +Name[ca]=Connector per al suport de llenguatge a KDevelop (de construcció aïllada) +Name[da]=KDevelop plugin for sprogstøttet (alenestående bygning) +Name[de]=KDevelop-Modul für Sprachunterstützung (Unabhängige Erstellung) +Name[el]=Πρόσθετο υποστήριξης γλώσσας του KDevelop (αυτόνομη κατασκευή) +Name[es]=Complemento de implementación de lenguaje para KDevelop (construcción independiente) +Name[et]=KDevelopi keeletoetuse plugin (autonoomne) +Name[eu]=KDevelop-en lengoaien euskarrien interfazea (eraikuntza autonomoak) +Name[fa]=وصلۀ پشتیبانی زبان KDevelop )ساخت خوداتکا( +Name[fr]=Module externe de prise en charge de langage de KDevelop (construction autonome) +Name[ga]=Breiseán Tacaíochta Teanga le haghaidh KDevelop (Tógáil Shaorsheasaimh) +Name[gl]=Extensión de soporte de linguaxes para KDevelop (compilación independente) +Name[hu]=KDevelop nyelvtámogató modul (önálló) +Name[it]=Plugin di supporto per linguaggio di KDevelop (compilazione indipendente) +Name[ja]=KDevelop 言語サポートプラグイン (スタンダローンビルド) +Name[nds]=KDevelop-Moduul för Spraakünnerstütten (Enkelprogramm) +Name[ne]=केडीई विकास भाषा समर्थन प्लगइन (स्ट्यान्डअलोन निर्माण) +Name[nl]=KDEvelop Taalondersteuning Plugin (Standalone build) +Name[pl]=Wtyczka KDevelopa do obsługi języka (budowana oddzielnie) +Name[pt]='Plugin' de Suporte a Linguagens do KDevelop (compilação autónoma) +Name[pt_BR]='Plugin' de Suporte a Linguagens do KDevelop (compilação autónoma) +Name[ru]=Интерфейс языковой поддержки для KDevelop (внешний) +Name[sk]=KDevelop modul pre jazykovú podporu (samostatný build) +Name[sl]=Vstavek jezikovne podpore za KDevelop (samostojna izgradnja) +Name[sr]=KDevelop-ов интерфејс за језичку подршку (самостална градња) +Name[sr@Latn]=KDevelop-ov interfejs za jezičku podršku (samostalna gradnja) +Name[sv]=KDevelop-insticksprogram för språkstöd (att bygga fristående) +Name[tr]=KDevelop Dil Desteği Eklentisi (Kendi başına çalışabilen kurulum) +Name[zh_CN]=KDevelop 语言支持插件(独立编译) +Name[zh_TW]=KDevelop 語言支援外掛程式(單獨建立) +Category=C++/KDevelop/ +Comment=This generates a language support plugin for KDevelop, to be built outside of the KDevelop source tree. +Comment[ca]=Genera un connector per al suport de llenguatge a KDevelop, per a que es construeixi fora de l'arbre de fonts de KDevelop. +Comment[da]=Dette genererer en sprogstøtte-plugin for KDevelop, der skal bygges udenfor KDevelop's kildetræ. +Comment[de]=Hiermit wird ein Sprachunterstützungsmodul für KDevelop generiert, das außerhalb des Quelltextbaumes von KDevelop erstellt wird. +Comment[el]=Αυτό δημιουργεί ένα πρόσθετο υποστήριξης γλώσσας για το KDevelop, για την κατασκευή του έξω από το δέντρο πηγαίου κώδικα του KDevelop. +Comment[es]=Genera un complemento de implementación de lenguaje para KDevelop, para ser construido fuera del árbol de código fuente de KDevelop. +Comment[et]=KDevelopi keeletoetuse plugina loomine, mida saab ehitada väljaspool KDevelopi lähtekoodipuud. +Comment[eu]=Honek KDevelop-en lengoai-euskarrirako plugin bat sortzen du, KDevelop-en iturburu zuhaitzetik at eraikitzeko. +Comment[fa]=یک وصلۀ پشتیبان برای KDevelop تولید می‌کند، تا در بیرون درخت منبع KDevelop ساخته شود. +Comment[fr]=Génère un module externe de prise en charge de langage pour KDevelop, à construire en dehors de l'arborescence des sources de KDevelop. +Comment[gl]=Isto xera unha extensión de soporte de linguaxes para KDevelop que se compilará fóra da árbore de código de KDevelop. +Comment[hu]=Létrehoz egy nyelvtámogató modult a KDevelophoz, mely a KDevelopos forráskönyvtáron kívül fordítható le. +Comment[it]=Genera un plugin di supporto per linguaggio per KDevelop, deve essere compilato fuori dell'albero sorgente di KDevelop. +Comment[nds]=Dit stellt en Spraakünnerstütten-Moduul för KDevelop op, dat buten den KDevelop-Bornboom kompileert warrt. +Comment[ne]=यसले केडीई विकासका लागि केडीई विकास स्रोत ट्रीको बाहिर निर्माण गर्न, भाषा समर्थन प्लगइन उत्पन्न गर्दछ । +Comment[nl]=Dit genereert een taalondersteuningsplugin voor KDEvelop, welke buiten de KDevelop sourcetree wordt gebouwd. +Comment[pl]=Generuje wtyczkę do obsługi języka w KDevelopie. Wtyczka jest budowana poza drzewem źródłowym KDevelopa. +Comment[pt]=Isto gera um 'plugin' de suporte de linguagens para o KDevelop, que possa ser compilado fora da árvore de código do KDevelop. +Comment[pt_BR]=Isto gera um 'plugin' de suporte de linguagens para o KDevelop, que possa ser compilado fora da árvore de código do KDevelop. +Comment[ru]=Создание интерфейса языковой поддержки для KDevelop со сборкой вне исходного кода KDevelop. +Comment[sk]=Vygeneruje modul pre jazykovú podporu pre KDevelop, tak aby ho bolo možné kompilovať mimo zdrojového stromu KDevelop. +Comment[sr]=Ово прави прикључак за језичку подршку за KDevelop, који се гради ван KDevelop-овог изворног стабла. +Comment[sr@Latn]=Ovo pravi priključak za jezičku podršku za KDevelop, koji se gradi van KDevelop-ovog izvornog stabla. +Comment[sv]=Detta skapar ett KDevelop-insticksprogram för språkstöd, att bygga utanför KDevelops källkodsträd. +Comment[tr]=Bu KDevelop için, KDevelop kaynak ağacının dışında olacak, bir dil desteği eklentisi yaratır. +Comment[zh_CN]=这将生成 KDevelop 的语言支持插件,可以在 KDevelop 源代码树之外编译。 +Comment[zh_TW]=產生一個 KDevelop 語言支援外掛程式,建立在 KDevelop 程式源碼樹之外。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}_part.cpp +Archive=kdevlang.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE5] +Type=install +Source=%{src}/kdevlang-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE7] +Type=install +Source=%{src}/kdevlang_part.cpp +Dest=%{dest}/src/%{APPNAMELC}_part.cpp + +[FILE8] +Type=install +Source=%{src}/kdevlang_part.h +Dest=%{dest}/src/%{APPNAMELC}_part.h + +[FILE9] +Type=install +EscapeXML=true +Source=%{src}/kdevlang.rc +Dest=%{dest}/src/kdev%{APPNAMELC}.rc + +[FILE10] +Type=install +Source=%{src}/kdevlang.desktop +Dest=%{dest}/src/kdev%{APPNAMELC}.desktop + +[FILE11] +Type=install +Source=%{src}/README.dox +Dest=%{dest}/src/README.dox + +[MSG] +Type=message +Comment=A language plugin for KDevelop for standalone build was created in %{dest} +Comment[ca]=Un connector per a llenguatge a KDevelop i de construcció aïllada ha estat creat en %{dest} +Comment[da]=Et sprog-plugin for KDevelop for alenestående bygning blev oprettet i %{dest} +Comment[de]=Ein Sprachunterstützungsmodul für KDevelop (unabhängige Erstellung) wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο γλώσσας για το KDevelop για αυτόνομη κατασκευή δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento de lenguaje para KDevelop de construcción independiente ha sido creado en %{dest} +Comment[et]=KDevelopi autonoomne keeleplugin loodi asukohta %{dest} +Comment[eu]=KDevelop-en hizkuntza plugin autonomo bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ زبان برای KDevelop جهت ساخت خوداتکا در %{dest} ایجاد شد +Comment[fr]=Un module externe de langage pour KDevelop à construire de façon autonome a été créé dans %{dest} +Comment[gl]=Creouse unha extensión de linguaxe para KDevelop a compilar de forma independente en %{dest} +Comment[hu]=Létrejött egy KDevelopos nyelvtámogató modul (önálló lefordításra) itt: %{dest} +Comment[it]=È stato creato un plugin di linguaggio per KDevelop per compilazione indipendente %{dest} +Comment[nds]=In %{dest} wöör en Spraakünnerstütten-Moduul för KDevelop (Enkelprogramm) opstellt +Comment[ne]=स्ट्यान्डअलोन निर्माण गर्न केडीई विकासका लागि भाषा प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een taalplugin voor KDevelop voor standalone build is aangemaakt in %{dest} +Comment[pl]=Wtyczka języka dla KDevelopa do budowy oddzielnie została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' de linguagens de compilação autónoma para o KDevelop em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' de linguagens de compilação autónoma para o KDevelop em %{dest} +Comment[ru]=Внешний интерфейс языковой поддержки для KDevelop создан в %{dest} +Comment[sk]=Modul pre jazykovú podporu pre KDevelop bol vutvorený v %{dest} +Comment[sr]=Језички прикључак за KDevelop за самосталну градњу направљен је у %{dest} +Comment[sr@Latn]=Jezički priključak za KDevelop za samostalnu gradnju napravljen je u %{dest} +Comment[sv]=Ett KDevelop-insticksprogram för språkstöd att bygga fristående skapades i %{dest} +Comment[tr]=Kendi başına çalışabilen bir KDevelop dil eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个独立编译的 KDevelop 语言插件 +Comment[zh_TW]=一個單獨建立的 KDevelop 語言外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kdevlang/kdevlang.png b/languages/cpp/app_templates/kdevlang/kdevlang.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/kdevlang/kdevlang.png differ diff --git a/languages/cpp/app_templates/kdevlang/kdevlang.rc b/languages/cpp/app_templates/kdevlang/kdevlang.rc new file mode 100644 index 00000000..b4e153fa --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/kdevlang.rc @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/languages/cpp/app_templates/kdevlang/kdevlang_part.cpp b/languages/cpp/app_templates/kdevlang/kdevlang_part.cpp new file mode 100644 index 00000000..9d5cadcf --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/kdevlang_part.cpp @@ -0,0 +1,154 @@ +%{CPP_TEMPLATE} + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include "%{APPNAMELC}_widget.h" +#include "%{APPNAMELC}_part.h" + +typedef KGenericFactory<%{APPNAME}Part> %{APPNAME}Factory; +K_EXPORT_COMPONENT_FACTORY( libkdev%{APPNAMELC}, %{APPNAME}Factory( "kdev%{APPNAMELC}" ) ); +static const KDevPluginInfo data("kdev%{APPNAMELC}"); + +%{APPNAME}Part::%{APPNAME}Part(QObject *parent, const char *name, const QStringList& ) +: KDevLanguageSupport(&data, parent, name ? name : "%{APPNAME}Part" ) +{ + setInstance(%{APPNAME}Factory::instance()); + setXMLFile("kdevlang_%{APPNAMELC}.rc"); + + + m_build = new KAction( i18n("&Run"), "exec",Key_F9,this, SLOT(slotRun()),actionCollection(), "build_execute" ); + + kdDebug() << "Creating %{APPNAMELC} Part" << endl; + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); + connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) ); + connect( partController(), SIGNAL(savedFile(const KURL&)), this, SLOT(savedFile(const KURL&)) ); + connect(partController(), SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(slotActivePartChanged(KParts::Part *))); +} + + +%{APPNAME}Part::~%{APPNAME}Part() +{ + delete m_build; +} + +KDevLanguageSupport::Features %{APPNAME}Part::features() +{ + return Features(Variables | Functions); +} +KMimeType::List %{APPNAME}Part::mimeTypes() +{ + KMimeType::List list; + + KMimeType::Ptr mime = KMimeType::mimeType( "application/x-shellscript" ); + if( mime ) + list << mime; + + return list; +} +void %{APPNAME}Part::slotRun() +{ + // Execute the application here. +} +void %{APPNAME}Part::projectConfigWidget(KDialogBase *dlg) +{ + Q_UNUSED( dlg ); + // Create your config dialog here. +} +void %{APPNAME}Part::projectOpened() +{ + kdDebug(9014) << "projectOpened()" << endl; + + connect( project(), SIGNAL(addedFilesToProject(const QStringList &)), + this, SLOT(addedFilesToProject(const QStringList &)) ); + connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)), + this, SLOT(removedFilesFromProject(const QStringList &)) ); + + // We want to parse only after all components have been + // properly initialized + QTimer::singleShot(0, this, SLOT(parse())); +} +void %{APPNAME}Part::projectClosed() +{ + +} +void %{APPNAME}Part::savedFile(const KURL &fileName) +{ + + + if (project()->allFiles().contains(fileName.path().mid ( project()->projectDirectory().length() + 1 ))) + { + kdDebug(9014) << "parse file " << fileName.path() << endl; + emit addedSourceInfo( fileName.path() ); + } +} +void %{APPNAME}Part::addedFilesToProject(const QStringList &fileList) +{ + kdDebug(9014) << "addedFilesToProject()" << endl; + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + kdDebug(9014) << "maybe parse " << project()->projectDirectory() + "/" + ( *it ) << endl; + } + + emit updatedSourceInfo(); +} +void %{APPNAME}Part::removedFilesFromProject(const QStringList &fileList) +{ + + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + QString fileName = project()->projectDirectory() + "/" + ( *it ); + if( codeModel()->hasFile(fileName) ) + { + kdDebug(9014) << "removed " << fileName << endl; + emit aboutToRemoveSourceInfo( fileName ); + codeModel()->removeFile( codeModel()->fileByName(fileName) ); + } + } + +} +void %{APPNAME}Part::parse() +{ + kdDebug(9014) << "initialParse()" << endl; + + if (project()) + { + kapp->setOverrideCursor(waitCursor); + QStringList files = project()->allFiles(); + for (QStringList::Iterator it = files.begin(); it != files.end() ;++it) + { + kdDebug(9014) << "maybe parse " << project()->projectDirectory() + "/" + (*it) << endl; + } + emit updatedSourceInfo(); + kapp->restoreOverrideCursor(); + } else { + kdDebug(9014) << "No project" << endl; + } +} +void %{APPNAME}Part::slotActivePartChanged(KParts::Part *part) +{ + kdDebug() << "Changeing active part..." << endl; +} + +#include "%{APPNAMELC}_part.moc" diff --git a/languages/cpp/app_templates/kdevlang/kdevlang_part.h b/languages/cpp/app_templates/kdevlang/kdevlang_part.h new file mode 100644 index 00000000..25721d64 --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/kdevlang_part.h @@ -0,0 +1,43 @@ +%{H_TEMPLATE} + +#ifndef __KDEVPART_%{APPNAMEUC}_H__ +#define __KDEVPART_%{APPNAMEUC}_H__ + + +#include +#include +#include +#include +#include + +class KAction; + +/* + Please read the README.dox file for more info about this part + */ +class %{APPNAME}Part : public KDevLanguageSupport +{ + Q_OBJECT + public: + %{APPNAME}Part(QObject *parent, const char *name, const QStringList &); + ~%{APPNAME}Part(); + protected: + virtual Features features(); + virtual KMimeType::List mimeTypes(); + + private slots: + void slotRun(); + void projectConfigWidget(KDialogBase *dlg); + void projectOpened(); + void projectClosed(); + void savedFile(const KURL &fileName); + void addedFilesToProject(const QStringList &fileList); + void removedFilesFromProject(const QStringList &fileList); + void parse(); + void slotActivePartChanged(KParts::Part *part); + private: + KAction *m_build; +}; + + +#endif diff --git a/languages/cpp/app_templates/kdevlang/src-Makefile.am b/languages/cpp/app_templates/kdevlang/src-Makefile.am new file mode 100644 index 00000000..325352ad --- /dev/null +++ b/languages/cpp/app_templates/kdevlang/src-Makefile.am @@ -0,0 +1,14 @@ +AM_CPPFLAGS = -I$(kde_includes)/kdevelop/interfaces -I$(kde_includes)/kdevelop/util -I$(kde_includes)/kinterfacedesigner $(all_includes) + +kde_module_LTLIBRARIES = libkdev%{APPNAMELC}.la +libkdev%{APPNAMELC}_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdev%{APPNAMELC}_la_LIBADD = -lkdevelop +libkdev%{APPNAMELC}_la_SOURCES = %{APPNAMELC}_part.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdev%{APPNAMELC}.desktop + +rcdir = $(kde_datadir)/kdev%{APPNAMELC} +rc_DATA = kdev%{APPNAMELC}.rc diff --git a/languages/cpp/app_templates/kdevpart/.kdev_ignore b/languages/cpp/app_templates/kdevpart/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kdevpart/Makefile.am b/languages/cpp/app_templates/kdevpart/Makefile.am new file mode 100644 index 00000000..d1541685 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = src-Makefile.am kdevpart_part.cpp kdevpart_part.h \ + kdevpart_widget.h kdevpart_widget.cpp kdevpart_part.rc \ + kdevpart.desktop app.kdevelop README.dox globalconfigbase.ui globalconfig.h \ + globalconfig.cpp projectconfigbase.ui projectconfig.h projectconfig.cpp +templateName = kdevpart + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kdevpart/README.dox b/languages/cpp/app_templates/kdevpart/README.dox new file mode 100644 index 00000000..86968add --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/README.dox @@ -0,0 +1,55 @@ +/** \class %{APPNAME} +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +\authors %{AUTHOR} +\authors 2nd author full name +... +\authors nth author full name + +\maintainer %{AUTHOR} +\maintainer 2nd maintainer full name +... +\maintainer nth maintainer full name + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in +YOUR_COMPONENT_NAME at Bugzilla database +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/languages/cpp/app_templates/kdevpart/app.kdevelop b/languages/cpp/app_templates/kdevpart/app.kdevelop new file mode 100644 index 00000000..29beaf21 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/app.kdevelop @@ -0,0 +1,116 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + KDevelop + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kdevpart/globalconfig.cpp b/languages/cpp/app_templates/kdevpart/globalconfig.cpp new file mode 100644 index 00000000..12396fec --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/globalconfig.cpp @@ -0,0 +1,15 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}globalconfig.h" + +#include "%{APPNAMELC}part.h" + +%{APPNAME}GlobalConfig::%{APPNAME}GlobalConfig(%{APPNAME}Part *part, QWidget *parent, const char *name) + : %{APPNAME}GlobalConfigBase(parent, name), m_part(part) +{ +} + +void %{APPNAME}GlobalConfig::accept() +{ +} + +#include "%{APPNAMELC}globalconfig.moc" diff --git a/languages/cpp/app_templates/kdevpart/globalconfig.h b/languages/cpp/app_templates/kdevpart/globalconfig.h new file mode 100644 index 00000000..1b321cd2 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/globalconfig.h @@ -0,0 +1,22 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_GLOBAL_CONFIG_H +#define %{APPNAMEUC}_GLOBAL_CONFIG_H + +#include "%{APPNAMELC}globalconfigbase.h" + +class %{APPNAME}Part; + +class %{APPNAME}GlobalConfig: public %{APPNAME}GlobalConfigBase +{ + Q_OBJECT +public: + %{APPNAME}GlobalConfig(%{APPNAME}Part *part, QWidget *parent = 0, const char *name = 0); + +public slots: + void accept(); + +private: + %{APPNAME}Part *m_part; +}; + +#endif diff --git a/languages/cpp/app_templates/kdevpart/globalconfigbase.ui b/languages/cpp/app_templates/kdevpart/globalconfigbase.ui new file mode 100644 index 00000000..c16bd90d --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/globalconfigbase.ui @@ -0,0 +1,20 @@ + +%{APPNAME}GlobalConfigBase + + + %{APPNAME}GlobalConfigBase + + + + 0 + 0 + 600 + 480 + + + + %{APPNAME} + + + + diff --git a/languages/cpp/app_templates/kdevpart/kdevpart.desktop b/languages/cpp/app_templates/kdevpart/kdevpart.desktop new file mode 100644 index 00000000..eb61eef9 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart.desktop @@ -0,0 +1,83 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Name=KDev%{APPNAME} +Name[nds]=KDev%{ProgNaam} +Name[sv]=KDevelop %{APPNAME} +Name[ta]=கெடெவ்%{APPNAME} +GenericName=%{APPNAME} Plugin +GenericName[br]=Lugent %{APPNAME} +GenericName[ca]=Connector per a %{APPNAME} +GenericName[da]=%{APPNAME} plugin +GenericName[de]=%{APPNAME}-Modul +GenericName[el]=Πρόσθετο %{APPNAME} +GenericName[es]=Complemento %{APPNAME} +GenericName[et]=%{APPNAME} plugin +GenericName[eu]=%{APPNAME} plugina +GenericName[fa]=وصلۀ %{APPNAME} +GenericName[fr]=Module externe pour %{APPNAME} +GenericName[ga]=Breiseán %{APPNAME} +GenericName[gl]=Extensión %{APPNAME} +GenericName[hu]=%{APPNAME}-bővítőmodul +GenericName[it]=Plugin %{APPNAME} +GenericName[ja]=%{APPNAME} プラグイン +GenericName[nds]=%{APPNAME}-Moduul +GenericName[ne]=%{APPNAME} प्लगइन +GenericName[nl]=%{APPNAME}-plugin +GenericName[pl]=Wtyczka %{APPNAME} +GenericName[pt]='Plugin' %{APPNAME} +GenericName[pt_BR]=Plug-in do %{APPNAME} +GenericName[ru]=Модуль %{APPNAME} +GenericName[sk]=%{APPNAME} modul +GenericName[sl]=Vstavek za %{APPNAME} +GenericName[sr]=%{APPNAME} прикључак +GenericName[sr@Latn]=%{APPNAME} priključak +GenericName[sv]=%{APPNAME} insticksprogram +GenericName[tr]=%{APPNAME} Eklentisi +GenericName[zh_CN]=%{APPNAME} 插件 +GenericName[zh_TW]=%{APPNAME} 外掛程式 +Comment=%{APPNAME} Description +Comment[br]=Deskrivadur %{APPNAME} +Comment[ca]=Descripció per a %{APPNAME} +Comment[da]=%{APPNAME} beskrivelse +Comment[de]=%{APPNAME} Beschreibung +Comment[el]=Περιγραφή %{APPNAME} +Comment[es]=Descripción de %{APPNAME} +Comment[et]=%{APPNAME} kirjeldus +Comment[eu]=%{APPNAME} deskribapena +Comment[fa]=توصیف %{APPNAME} +Comment[fr]=Description pour %{APPNAME} +Comment[ga]=Cur Síos %{APPNAME} +Comment[gl]=Descripción de %{APPNAME} +Comment[hu]=%{APPNAME} leírása +Comment[it]=Descrizione %{APPNAME} +Comment[ja]=%{APPNAME} 概説 +Comment[nds]=%{APPNAME}-Beschrieven +Comment[ne]=%{APPNAME} वर्णन +Comment[nl]=%{APPNAME} omschrijving +Comment[pl]=Opis %{APPNAME} +Comment[pt]=Descrição de %{APPNAME$} +Comment[pt_BR]=Descrição do %{APPNAME} +Comment[ru]=Описание %{APPNAME} +Comment[sk]=%{APPNAME} popis +Comment[sl]=Opis za %{APPNAME} +Comment[sr]=Опис за %{APPNAME} +Comment[sr@Latn]=Opis za %{APPNAME} +Comment[sv]=%{APPNAME} beskrivning +Comment[tr]=%{APPNAME} Tanımı +Comment[zh_CN]=%{APPNAME} 描述 +Comment[zh_TW]=%{APPNAME} 描述 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin + +X-KDevelop-Plugin-Version=1 +X-KDevelop-Plugin-Homepage= +X-KDevelop-Plugin-BugsEmailAddress=%{EMAIL} +X-KDevelop-Plugin-Copyright=(C) by %{AUTHOR} + +X-KDevelop-Args= + +X-KDevelop-Scope=%{SCOPE} +X-KDE-Library=libkdev%{APPNAMELC} +X-KDevelop-Version=3 +X-KDevelop-Properties=%{PROPS} diff --git a/languages/cpp/app_templates/kdevpart/kdevpart.kdevtemplate b/languages/cpp/app_templates/kdevpart/kdevpart.kdevtemplate new file mode 100644 index 00000000..bc7becbf --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart.kdevtemplate @@ -0,0 +1,242 @@ +# KDE Config File +[General] +Name=KDevelop Plugin (KDevelop source tree build) +Name[ca]=Connector per a KDevelop (de construcció a l'arbre de fonts de KDevelop) +Name[da]=KDevelop Plugin (KDevelop kildetræ bygning) +Name[de]=KDevelop-Modul (Erstellung im KDevelop-Quelltextbaum) +Name[el]=Πρόσθετο KDevelop (κατασκευή με το δέντρο πηγαίου κώδικα του KDevelop) +Name[es]=Complemento para KDevelop (construcción en árbol de código fuente de KDevelop) +Name[et]=KDevelopi plugin (Kdevelopi lähtekoodipuus) +Name[eu]=KDevelop plugina (KDevelop-en iturburu zuhaitzean erakitzeko) +Name[fa]=وصلۀ KDevelop )ساخت درخت منبع KDevelop( +Name[fr]=Module externe de KDevelop (construction dans l'arborescence des sources de KDevelop) +Name[gl]=Extensión para KDevelop (compilación na árbore de código de KDevelop) +Name[hu]=KDevelop-bővítőmodul (KDevelopos forráskönyvtáron belül) +Name[it]=Plugin di KDevelop (compila l'albero sorgente di KDevelop) +Name[ja]=KDevelop プラグイン (KDevelop ソースツリービルド) +Name[nds]=KDevelop-Moduul (KDevelop-Bornboomprogramm) +Name[ne]=केडीई विकास प्लगइन (केडीई विकास स्रोत ट्री निर्माण) +Name[nl]=KDevelop-plugin (KDevelop source tree build) +Name[pl]=Wtyczka KDevelopa (budowa w drzewie źródłowym KDevelopa) +Name[pt]='Plugin' do KDevelop (compilação na árvore de código do KDevelop) +Name[pt_BR]='Plugin' do KDevelop (compilação na árvore de código do KDevelop) +Name[ru]=Модуль KDevelop (в исходном коде KDevelop) +Name[sk]=KDevelop modul (KDevelop zdrojový strom build) +Name[sr]=Прикључак за KDevelop (градња у изворном стаблу KDevelop-а) +Name[sr@Latn]=Priključak za KDevelop (gradnja u izvornom stablu KDevelop-a) +Name[sv]=KDevelop-insticksprogram (att bygga i KDevelops källkodsträd) +Name[tr]=KDevelop Eklentisi (KDevelop kaynak ağacı kurulumu) +Name[zh_CN]=KDevelop 插件(KDevelop 源代码树编译) +Name[zh_TW]=KDevelop 外掛程式(KDevelop 程式源碼樹內建立) +Category=C++/KDevelop/ +Comment=This generates a plugin for KDevelop, for building within the KDevelop source tree +Comment[ca]=Genera un connector per a KDevelop, per a que es construeixi en l'arbre de fonts de KDevelop +Comment[da]=Dette genererer et plugin for KDevelop, til at bygges indenfor KDevelop's kildetræ +Comment[de]=Hiermit wird ein Modul für KDevelop erstellt, dessen Erstellung innerhalb des Quelltextbaumes von KDevelop erfolgt. +Comment[el]=Αυτό δημιουργεί ένα πρόσθετο για το KDevelop, για κατασκευή του μέσα στο δέντρο πηγαίου κώδικα του KDevelop +Comment[es]=Genera un complemento para KDevelop, para ser construido en el árbol de código fuente de KDevelop +Comment[et]=KDevelopi plugina loomine, mis ehitatakse KDevelopi lähtekoodipuus. +Comment[eu]=Honek KDevelop-erako plugin bat sortzen du, KDevelop-en iturburu-zuhaitzean eraikitzeko +Comment[fa]=وصله‌ای برای KDevelop، برای ساختن در درخت منبع KDevelop تولید می‌کند +Comment[fr]=Génère un module externe pour KDevelop, à construire dans l'arborescence des sources de KDevelop +Comment[gl]=Isto xera unha extensión para KDevelop que se compilará dentro da árbore de código de KDevelop +Comment[hu]=Létrehoz egy KDevelop-bővítőmodult, mely a KDevelopos forráskönyvtáron belül fordítható le +Comment[it]=Genera un plugin per KDevelop, per compilarlo assieme all'albero sorgente di KDevelop +Comment[nds]=Dit stellt en KDevelop-Moduul för't Kompileren binnen den KDevelop-Bornboom op +Comment[ne]=यसले केडीई विकास स्रोत ट्री भित्र निर्माण गर्न, केडीई विकासका लागि प्लगइन उत्पन्न गर्दछ +Comment[nl]=Dit genereert een plugin voor KDevelop, om te bouwen binnen de KDevelop sourcetree +Comment[pl]=Generuje wtyczkę do KDevelopa, która jest budowana w jego drzewie źródłowym +Comment[pt]=Isto gera um 'plugin' para o KDevelop, para uma compilação dentro da árvore de código do KDevelop +Comment[pt_BR]=Isto gera um 'plugin' para o KDevelop, para uma compilação dentro da árvore de código do KDevelop +Comment[ru]=Создание модуля KDevelop в исходном коде KDevelop +Comment[sk]=Vygeneruje modul pre KDevelop, ktorý sa bude kompilovať v rámci KDevelop zdrojového stromu +Comment[sr]=Ово прави прикључак за KDevelop, за градњу у оквиру KDevelop-овог изворног стабла +Comment[sr@Latn]=Ovo pravi priključak za KDevelop, za gradnju u okviru KDevelop-ovog izvornog stabla +Comment[sv]=Det här skapar ett insticksprogram för KDevelop, att byggas inne i KDevelops källkodsträd. +Comment[tr]=Bu KDevelop için, KDevelop kaynak ağacınında olacak, bir eklenti yaratır. +Comment[zh_CN]=这将生成 KDevelop 的插件,该插件需要与 KDevelop 源代码树一起编译 +Comment[zh_TW]=產生一個 KDevelop 外掛程式,建立於 KDevelop 程式源碼樹內。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}part.cpp +Archive=kdevpart.tar.gz + +[SCOPE] +Type = value +ValueType=QString +Value= SCOPE +Comment= The scope of a plugin (Global, Project, Core) +Comment[ca]= L'àmbit d'un connector (Global, Project, Core) +Comment[da]= Et plugins omfang (Globalt, Projekt, Kerne) +Comment[de]= Gültigkeitsbereich eines Moduls (Global, Projekt, Kern) +Comment[el]= Η εμβέλεια ενός πρόσθετου (Καθολική, Έργο, Πυρήνας) +Comment[es]=El alcance de un complemento (global, proyecto, núcleo) +Comment[et]=Plugina skoop (globaalne, projekt, tuum) +Comment[eu]= Pluginaren barrutia (Globala, Projektua, Nukleoa) +Comment[fa]=دامنۀ یک وصله )سراسری، پروژه، هسته( +Comment[fr]= La portée d'un module externe (globale, projet, core) +Comment[ga]= Scóip an bhreiseáin (Comhchoiteann, Tionscadal, Ceartlár) +Comment[gl]=Ámbito da extensión (Global, Proxecto, Núcleo) +Comment[hu]=A modul hatóköre (globális, projektszintű, alap) +Comment[it]=Il contesto di un plugin (Globale, Progetto, Core) +Comment[nds]= Dat Rebeet vun en Moduul (Globaal, Projekt, Karn) +Comment[ne]= प्लगइनको क्षेत्र (विश्वव्यापी, परियोजना, कोर) +Comment[nl]=Het bereik van een plugin (globaal, project, core) +Comment[pl]=Przynależność wtyczki (globalna, projekt, część główna) +Comment[pt]=O âmbito de um 'plugin' (Global, Projecto, Núcleo) +Comment[pt_BR]=O âmbito de um 'plugin' (Global, Projecto, Núcleo) +Comment[ru]=Тип модуля (Global, Project, Core) +Comment[sk]=Rozsah module (globálny, projektový, jadrový) +Comment[sr]=Опсег прикључка (глобални, пројекат, језгро) +Comment[sr@Latn]=Opseg priključka (globalni, projekat, jezgro) +Comment[sv]=Insticksprogrammets omfattning (Global, Projekt, Kärna) +Comment[tr]=Bir eklentinin alanı (Genel, Proje, İç) +Comment[zh_CN]=插件的范围(全局、工程、核心) +Comment[zh_TW]=外掛程式的範圍(全域、專案、核心) +Default= Global + +[PROPS] +Type = value +ValueType=QString +Value= PROPS +Comment= The list of supported KDevelop properties +Comment[ca]= La llista de propietats suportades del KDevelop +Comment[da]= Listen af understøttede KDevelop-egenskaber +Comment[de]= Die Liste der unterstützten KDevelop-Eigenschaften +Comment[el]= Η λίστα των υποστηριζόμενων ιδιοτήτων του KDevelop +Comment[es]=La lista de propiedades de KDevelop soportadas +Comment[et]= KDevelopi toetatud omaduste nimekiri +Comment[eu]= Onartzen diren KDevelop-en propietateen zerrenda +Comment[fa]=فهرست ویژگیهای پشتیبانی‌شدۀ KDevelop +Comment[fr]= La liste des propriétés de KDevelop prises en charge +Comment[ga]= Liosta d'airíonna KDevelop a dtacaítear leo +Comment[gl]=Lista das propiedades de KDevelop soportadas +Comment[hu]=A támogatott KDevelop-tulajdonságok +Comment[it]=Lista delle proprietà supportate da KDevelop +Comment[nds]= De List mit ünnerstütt KDevelop-Egenschappen +Comment[ne]= केडीई विकास समर्थन गर्ने गुणको सूची +Comment[nl]=De lijst met ondersteunde KDevelop-properties +Comment[pl]= Lista obsługiwanych właściwości KDevelopa +Comment[pt]= A lista de propriedades do KDevelop suportadas +Comment[pt_BR]= A lista de propriedades do KDevelop suportadas +Comment[ru]=Список поддерживаемых типов модулей для KDevelop +Comment[sk]=Zoznam podporovaných vlastností KDevelop +Comment[sl]=Seznam podprtih lastnosti KDevelop +Comment[sr]=Листа подржаних KDevelop-ових својстава +Comment[sr@Latn]=Lista podržanih KDevelop-ovih svojstava +Comment[sv]=Listan med egenskaper i KDevelop som stöds +Comment[tr]=Desteklenen KDevelop özellikleri +Comment[zh_CN]=列出支持的 KDevelop 属性 +Comment[zh_TW]=支援的 KDevelop 屬性列表 +Default= + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/kdevpart_part.cpp +Dest=%{dest}/%{APPNAMELC}part.cpp + +[FILE4] +Type=install +Source=%{src}/kdevpart_part.h +Dest=%{dest}/%{APPNAMELC}part.h + +[FILE5] +Type=install +Source=%{src}/kdevpart_widget.cpp +Dest=%{dest}/%{APPNAMELC}widget.cpp + +[FILE6] +Type=install +Source=%{src}/kdevpart_widget.h +Dest=%{dest}/%{APPNAMELC}widget.h + +[FILE7] +Type=install +EscapeXML=true +Source=%{src}/kdevpart_part.rc +Dest=%{dest}/kdev%{APPNAMELC}.rc + +[FILE71] +Type=install +EscapeXML=true +Source=%{src}/globalconfigbase.ui +Dest=%{dest}/%{APPNAMELC}globalconfigbase.ui + +[FILE711] +Type=install +Source=%{src}/globalconfig.h +Dest=%{dest}/%{APPNAMELC}globalconfig.h + +[FILE712] +Type=install +Source=%{src}/globalconfig.cpp +Dest=%{dest}/%{APPNAMELC}globalconfig.cpp + +[FILE72] +Type=install +EscapeXML=true +Source=%{src}/projectconfigbase.ui +Dest=%{dest}/%{APPNAMELC}projectconfigbase.ui + +[FILE721] +Type=install +Source=%{src}/projectconfig.h +Dest=%{dest}/%{APPNAMELC}projectconfig.h + +[FILE722] +Type=install +Source=%{src}/projectconfig.cpp +Dest=%{dest}/%{APPNAMELC}projectconfig.cpp + +[FILE8] +Type=install +Source=%{src}/kdevpart.desktop +Dest=%{dest}/kdev%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{src}/README.dox +Dest=%{dest}/README.dox + +[MSG] +Type=message +Comment=A KDevelop plugin was created in %{dest} +Comment[ca]=Un connector per a KDevelop ha estat creat en %{dest} +Comment[da]=Et KDevelop plugin blev oprettet i %{dest} +Comment[de]=Ein KDevelop-Modul wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο του KDevelop δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento para KDevelop ha sido creado en %{dest} +Comment[et]=KDevelopi plugin loodi asukohta %{dest} +Comment[eu]=KDevelop plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ KDevelop در %{dest} ایجاد شد +Comment[fr]=Un module externe pour KDevelop a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán KDevelop i %{dest} +Comment[gl]=Creouse unha extensión para KDevelop en %{dest} +Comment[hu]=Létrejött egy KDevelop-bővítőmodul itt: %{dest} +Comment[it]=È stato creato un plugin per KDevelop in %{dest} +Comment[ja]=KDevelop プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KDevelop-Moduul opstellt +Comment[ne]=केडीई विकास प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Er is een KDevelop-plugin aangemaakt in %{dest} +Comment[pl]=Wtyczka do KDevelopa została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' do KDevelop em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' do KDevelop em %{dest} +Comment[ru]=Модуль KDevelop создан в %{dest} +Comment[sk]=KDevelop modul bol vytvorený v %{dest} +Comment[sl]=Vstavek za KDevelop je bil ustvarjen v %{dest} +Comment[sr]=Прикључак за KDevelop направљен је у %{dest} +Comment[sr@Latn]=Priključak za KDevelop napravljen je u %{dest} +Comment[sv]=Ett insticksprogram för KDevelop skapades i %{dest} +Comment[tr]=Bir KDevelop eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了 KDevelop 插件 +Comment[zh_TW]=一個 KDevelop 外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kdevpart/kdevpart.png b/languages/cpp/app_templates/kdevpart/kdevpart.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/kdevpart/kdevpart.png differ diff --git a/languages/cpp/app_templates/kdevpart/kdevpart_part.cpp b/languages/cpp/app_templates/kdevpart/kdevpart_part.cpp new file mode 100644 index 00000000..dd86843d --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart_part.cpp @@ -0,0 +1,183 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}part.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "%{APPNAMELC}widget.h" +#include "%{APPNAMELC}globalconfig.h" +#include "%{APPNAMELC}projectconfig.h" + +typedef KDevGenericFactory<%{APPNAME}Part> %{APPNAME}Factory; +KDevPluginInfo data("kdev%{APPNAMELC}"); +K_EXPORT_COMPONENT_FACTORY( libkdev%{APPNAMELC}, %{APPNAME}Factory( data ) ); + +#define GLOBALDOC_OPTIONS 1 +#define PROJECTDOC_OPTIONS 2 + +%{APPNAME}Part::%{APPNAME}Part(QObject *parent, const char *name, const QStringList &/*args*/) + : KDevPlugin(&data, parent, name ? name : "%{APPNAME}Part") +{ + setInstance(%{APPNAME}Factory::instance()); + setXMLFile("kdev%{APPNAMELC}.rc"); + + m_widget = new %{APPNAME}Widget(this); + m_widget->setCaption("widget caption"); + m_widget->setIcon(SmallIcon(info()->icon())); + + QWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?")); + + // now you decide what should happen to the widget. Take a look at kdevcore.h + // or at other plugins how to embed it. + + // if you want to embed your widget as an outputview, simply uncomment + // the following line. + // mainWindow()->embedOutputView( m_widget, "name that should appear", "enter a tooltip" ); + + // if you want to embed your widget as a selectview (at the left), simply uncomment + // the following line. + // mainWindow()->embedSelectView( m_widget, "name that should appear", "enter a tooltip" ); + + // if you want to embed your widget as a selectview (at the right), simply uncomment + // the following line. + // mainWindow()->embedSelectViewRight( m_widget, "name that should appear", "enter a tooltip" ); + + setupActions(); + + m_configProxy = new ConfigWidgetProxy(core()); + m_configProxy->createGlobalConfigPage(i18n("%{APPNAME}"), GLOBALDOC_OPTIONS, info()->icon()); + m_configProxy->createProjectConfigPage(i18n("%{APPNAME}"), PROJECTDOC_OPTIONS, info()->icon()); + connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), + this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int))); + + connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), + this, SLOT(contextMenu(QPopupMenu *, const Context *))); + connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened())); + connect(core(), SIGNAL(projectClosed()), this, SLOT(projectClosed())); + + + QTimer::singleShot(0, this, SLOT(init())); +} + +%{APPNAME}Part::~%{APPNAME}Part() +{ +// if you embed a widget, you need to tell the mainwindow when you remove it +// if ( m_widget ) +// { +// mainWindow()->removeView( m_widget ); +// } + delete m_widget; + delete m_configProxy; +} + +void %{APPNAME}Part::init() +{ +// delayed initialization stuff goes here +} + +void %{APPNAME}Part::setupActions() +{ +// create XMLGUI actions here + action = new KAction(i18n("&Do Something..."), 0, + this, SLOT(doSomething()), actionCollection(), "plugin_action" ); + action->setToolTip(i18n("Do something")); + action->setWhatsThis(i18n("Do something

      Describe here what does this action do.")); +} + +void %{APPNAME}Part::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo) +{ +// create configuraton dialogs here + switch (pageNo) + { + case GLOBALDOC_OPTIONS: + { + %{APPNAME}GlobalConfig *w = new %{APPNAME}GlobalConfig(this, page, "global config"); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + break; + } + case PROJECTDOC_OPTIONS: + { + %{APPNAME}ProjectConfig *w = new %{APPNAME}ProjectConfig(this, page, "project config"); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + break; + } + } +} + +void %{APPNAME}Part::contextMenu(QPopupMenu *popup, const Context *context) +{ +// put actions into the context menu here + if (context->hasType(Context::EditorContext)) + { + // editor context menu + const EditorContext *econtext = static_cast(context); + + // use context and plug actions here + action->plug(popup); + + // or create menu items on the fly + // int id = -1; + // id = popup->insertItem(i18n("Do Something Here"), + // this, SLOT(doSomething()) ); + // popup->setWhatsThis(id, i18n("Do something here

      Describe here what does this action do." + } + else if (context->hasType(Context::FileContext)) + { + // file context menu + const FileContext *fcontext = static_cast(context); + + //use context and plug actions here + } + else if (context->hasType(Context::ProjectModelItemContext)) + { + // project tree context menu + const ProjectModelItemContext *pcontext = static_cast(context); + + // use context and plug actions here + } + else if (context->hasType(Context::CodeModelItemContext)) + { + // class tree context menu + const CodeModelItemContext *mcontext = static_cast(context); + + // use context and plug actions here + } + else if (context->hasType(Context::DocumentationContext)) + { + // documentation viewer context menu + const DocumentationContext *dcontext = static_cast(context); + + // use context and plug actions here + } +} + +void %{APPNAME}Part::projectOpened() +{ +// do something when the project is opened +} + +void %{APPNAME}Part::projectClosed() +{ +// do something when the project is closed +} + +void %{APPNAME}Part::doSomething() +{ +// do something useful here instead of showing the message box + KMessageBox::information(m_widget, i18n("This action does nothing."), i18n("%{APPNAME} Plugin")); +} + +#include "%{APPNAMELC}part.moc" diff --git a/languages/cpp/app_templates/kdevpart/kdevpart_part.h b/languages/cpp/app_templates/kdevpart/kdevpart_part.h new file mode 100644 index 00000000..168b8a40 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart_part.h @@ -0,0 +1,45 @@ +%{H_TEMPLATE} +#ifndef KDEV%{APPNAMEUC}_H +#define KDEV%{APPNAMEUC}_H + +#include + +#include + +class QPopupMenu; +class KAction; +class KDialogBase; +class Context; +class ConfigWidgetProxy; +class %{APPNAME}Widget; + +/** +Please read the README.dox file for more info about this part +*/ +class %{APPNAME}Part: public KDevPlugin +{ + Q_OBJECT +public: + %{APPNAME}Part(QObject *parent, const char *name, const QStringList &args); + ~%{APPNAME}Part(); + +private slots: + void init(); + + void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo); + void contextMenu(QPopupMenu *popup, const Context *context); + void projectOpened(); + void projectClosed(); + + void doSomething(); + +private: + void setupActions(); + + KAction *action; + + QGuardedPtr<%{APPNAME}Widget> m_widget; + ConfigWidgetProxy *m_configProxy; +}; + +#endif diff --git a/languages/cpp/app_templates/kdevpart/kdevpart_part.rc b/languages/cpp/app_templates/kdevpart/kdevpart_part.rc new file mode 100644 index 00000000..a38ee14e --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart_part.rc @@ -0,0 +1,11 @@ + + + +

      &Tools + + + + + + + diff --git a/languages/cpp/app_templates/kdevpart/kdevpart_widget.cpp b/languages/cpp/app_templates/kdevpart/kdevpart_widget.cpp new file mode 100644 index 00000000..0c05b976 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart_widget.cpp @@ -0,0 +1,21 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}widget.h" + +#include +#include +#include + +#include + +#include "%{APPNAMELC}part.h" + +%{APPNAME}Widget::%{APPNAME}Widget(%{APPNAME}Part *part) + : QWidget(0, "%{APPNAMELC} widget"), m_part(part) +{ +} + +%{APPNAME}Widget::~%{APPNAME}Widget() +{ +} + +#include "%{APPNAMELC}widget.moc" diff --git a/languages/cpp/app_templates/kdevpart/kdevpart_widget.h b/languages/cpp/app_templates/kdevpart/kdevpart_widget.h new file mode 100644 index 00000000..e29e29d2 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/kdevpart_widget.h @@ -0,0 +1,23 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_WIDGET_H +#define %{APPNAMEUC}_WIDGET_H + +#include +#include + +class KDevProject; +class %{APPNAME}Part; + +class %{APPNAME}Widget: public QWidget +{ + Q_OBJECT +public: + %{APPNAME}Widget(%{APPNAME}Part *part); + ~%{APPNAME}Widget(); + +private: + %{APPNAME}Part *m_part; +}; + + +#endif diff --git a/languages/cpp/app_templates/kdevpart/projectconfig.cpp b/languages/cpp/app_templates/kdevpart/projectconfig.cpp new file mode 100644 index 00000000..5f07993b --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/projectconfig.cpp @@ -0,0 +1,15 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}projectconfig.h" + +#include "%{APPNAMELC}part.h" + +%{APPNAME}ProjectConfig::%{APPNAME}ProjectConfig(%{APPNAME}Part *part, QWidget *parent, const char *name) + : %{APPNAME}ProjectConfigBase(parent, name), m_part(part) +{ +} + +void %{APPNAME}ProjectConfig::accept() +{ +} + +#include "%{APPNAMELC}projectconfig.moc" diff --git a/languages/cpp/app_templates/kdevpart/projectconfig.h b/languages/cpp/app_templates/kdevpart/projectconfig.h new file mode 100644 index 00000000..ec3ff4df --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/projectconfig.h @@ -0,0 +1,22 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_PROJECT_CONFIG_H +#define %{APPNAMEUC}_PROJECT_CONFIG_H + +#include "%{APPNAMELC}projectconfigbase.h" + +class %{APPNAME}Part; + +class %{APPNAME}ProjectConfig: public %{APPNAME}ProjectConfigBase +{ + Q_OBJECT +public: + %{APPNAME}ProjectConfig(%{APPNAME}Part *part, QWidget *parent = 0, const char *name = 0); + +public slots: + void accept(); + +private: + %{APPNAME}Part *m_part; +}; + +#endif diff --git a/languages/cpp/app_templates/kdevpart/projectconfigbase.ui b/languages/cpp/app_templates/kdevpart/projectconfigbase.ui new file mode 100644 index 00000000..c733a774 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/projectconfigbase.ui @@ -0,0 +1,20 @@ + +%{APPNAME}ProjectConfigBase + + + %{APPNAME}ProjectConfigBase + + + + 0 + 0 + 600 + 480 + + + + %{APPNAME} + + + + diff --git a/languages/cpp/app_templates/kdevpart/src-Makefile.am b/languages/cpp/app_templates/kdevpart/src-Makefile.am new file mode 100644 index 00000000..5cd25f36 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart/src-Makefile.am @@ -0,0 +1,20 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdev%{APPNAMELC}.la +libkdev%{APPNAMELC}_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) $(KDE_PLUGIN) +libkdev%{APPNAMELC}_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdev%{APPNAMELC}_la_SOURCES = %{APPNAMELC}part.cpp %{APPNAMELC}widget.cpp \ + %{APPNAMELC}globalconfigbase.ui %{APPNAMELC}globalconfig.cpp \ + %{APPNAMELC}projectconfigbase.ui %{APPNAMELC}projectconfig.cpp + +METASOURCES = AUTO + +appsharedir = $(kde_datadir)/kdev%{APPNAMELC} +appshare_DATA = + +servicedir = $(kde_servicesdir) +service_DATA = kdev%{APPNAMELC}.desktop + +rcdir = $(kde_datadir)/kdev%{APPNAMELC} +rc_DATA = kdev%{APPNAMELC}.rc diff --git a/languages/cpp/app_templates/kdevpart2/.kdev_ignore b/languages/cpp/app_templates/kdevpart2/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kdevpart2/Makefile.am b/languages/cpp/app_templates/kdevpart2/Makefile.am new file mode 100644 index 00000000..6e58fa02 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = src-Makefile.am kdevpart_part.cpp kdevpart_part.h\ + kdevpart_widget.h kdevpart_widget.cpp \ + kdevpart_part.rc kdevpart.desktop app.kdevelop \ + kdevpart-configure.in.in README.dox subdirs globalconfigbase.ui globalconfig.h \ + globalconfig.cpp projectconfigbase.ui projectconfig.h projectconfig.cpp + +templateName = kdevpart2 + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kdevpart2/README.dox b/languages/cpp/app_templates/kdevpart2/README.dox new file mode 100644 index 00000000..86968add --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/README.dox @@ -0,0 +1,55 @@ +/** \class %{APPNAME} +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +\authors %{AUTHOR} +\authors 2nd author full name +... +\authors nth author full name + +\maintainer %{AUTHOR} +\maintainer 2nd maintainer full name +... +\maintainer nth maintainer full name + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in +YOUR_COMPONENT_NAME at Bugzilla database +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/languages/cpp/app_templates/kdevpart2/app.kdevelop b/languages/cpp/app_templates/kdevpart2/app.kdevelop new file mode 100644 index 00000000..644adcdf --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/app.kdevelop @@ -0,0 +1,148 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + KDevelop + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + executable + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + + + + + + false + true + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + -f + + + + -dP + -f + -C -d -P + -u3 -p + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + true + true + true + false + true + true + 250 + 400 + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kdevpart2/globalconfig.cpp b/languages/cpp/app_templates/kdevpart2/globalconfig.cpp new file mode 100644 index 00000000..12396fec --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/globalconfig.cpp @@ -0,0 +1,15 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}globalconfig.h" + +#include "%{APPNAMELC}part.h" + +%{APPNAME}GlobalConfig::%{APPNAME}GlobalConfig(%{APPNAME}Part *part, QWidget *parent, const char *name) + : %{APPNAME}GlobalConfigBase(parent, name), m_part(part) +{ +} + +void %{APPNAME}GlobalConfig::accept() +{ +} + +#include "%{APPNAMELC}globalconfig.moc" diff --git a/languages/cpp/app_templates/kdevpart2/globalconfig.h b/languages/cpp/app_templates/kdevpart2/globalconfig.h new file mode 100644 index 00000000..1b321cd2 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/globalconfig.h @@ -0,0 +1,22 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_GLOBAL_CONFIG_H +#define %{APPNAMEUC}_GLOBAL_CONFIG_H + +#include "%{APPNAMELC}globalconfigbase.h" + +class %{APPNAME}Part; + +class %{APPNAME}GlobalConfig: public %{APPNAME}GlobalConfigBase +{ + Q_OBJECT +public: + %{APPNAME}GlobalConfig(%{APPNAME}Part *part, QWidget *parent = 0, const char *name = 0); + +public slots: + void accept(); + +private: + %{APPNAME}Part *m_part; +}; + +#endif diff --git a/languages/cpp/app_templates/kdevpart2/globalconfigbase.ui b/languages/cpp/app_templates/kdevpart2/globalconfigbase.ui new file mode 100644 index 00000000..c16bd90d --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/globalconfigbase.ui @@ -0,0 +1,20 @@ + +%{APPNAME}GlobalConfigBase + + + %{APPNAME}GlobalConfigBase + + + + 0 + 0 + 600 + 480 + + + + %{APPNAME} + + + + diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart-configure.in.in b/languages/cpp/app_templates/kdevpart2/kdevpart-configure.in.in new file mode 100644 index 00000000..06ee70b8 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart-configure.in.in @@ -0,0 +1,10 @@ +#MIN_CONFIG(3.0.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +KDE_CHECK_HEADERS([kdevelop/interfaces/kdevcore.h]) +KDE_CHECK_LIB([kdevelop],main, + [LIBKDEVELOP="-lkdevelop"]) +AC_SUBST(LIBKDEVELOP) diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart.desktop b/languages/cpp/app_templates/kdevpart2/kdevpart.desktop new file mode 100644 index 00000000..eb61eef9 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart.desktop @@ -0,0 +1,83 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Name=KDev%{APPNAME} +Name[nds]=KDev%{ProgNaam} +Name[sv]=KDevelop %{APPNAME} +Name[ta]=கெடெவ்%{APPNAME} +GenericName=%{APPNAME} Plugin +GenericName[br]=Lugent %{APPNAME} +GenericName[ca]=Connector per a %{APPNAME} +GenericName[da]=%{APPNAME} plugin +GenericName[de]=%{APPNAME}-Modul +GenericName[el]=Πρόσθετο %{APPNAME} +GenericName[es]=Complemento %{APPNAME} +GenericName[et]=%{APPNAME} plugin +GenericName[eu]=%{APPNAME} plugina +GenericName[fa]=وصلۀ %{APPNAME} +GenericName[fr]=Module externe pour %{APPNAME} +GenericName[ga]=Breiseán %{APPNAME} +GenericName[gl]=Extensión %{APPNAME} +GenericName[hu]=%{APPNAME}-bővítőmodul +GenericName[it]=Plugin %{APPNAME} +GenericName[ja]=%{APPNAME} プラグイン +GenericName[nds]=%{APPNAME}-Moduul +GenericName[ne]=%{APPNAME} प्लगइन +GenericName[nl]=%{APPNAME}-plugin +GenericName[pl]=Wtyczka %{APPNAME} +GenericName[pt]='Plugin' %{APPNAME} +GenericName[pt_BR]=Plug-in do %{APPNAME} +GenericName[ru]=Модуль %{APPNAME} +GenericName[sk]=%{APPNAME} modul +GenericName[sl]=Vstavek za %{APPNAME} +GenericName[sr]=%{APPNAME} прикључак +GenericName[sr@Latn]=%{APPNAME} priključak +GenericName[sv]=%{APPNAME} insticksprogram +GenericName[tr]=%{APPNAME} Eklentisi +GenericName[zh_CN]=%{APPNAME} 插件 +GenericName[zh_TW]=%{APPNAME} 外掛程式 +Comment=%{APPNAME} Description +Comment[br]=Deskrivadur %{APPNAME} +Comment[ca]=Descripció per a %{APPNAME} +Comment[da]=%{APPNAME} beskrivelse +Comment[de]=%{APPNAME} Beschreibung +Comment[el]=Περιγραφή %{APPNAME} +Comment[es]=Descripción de %{APPNAME} +Comment[et]=%{APPNAME} kirjeldus +Comment[eu]=%{APPNAME} deskribapena +Comment[fa]=توصیف %{APPNAME} +Comment[fr]=Description pour %{APPNAME} +Comment[ga]=Cur Síos %{APPNAME} +Comment[gl]=Descripción de %{APPNAME} +Comment[hu]=%{APPNAME} leírása +Comment[it]=Descrizione %{APPNAME} +Comment[ja]=%{APPNAME} 概説 +Comment[nds]=%{APPNAME}-Beschrieven +Comment[ne]=%{APPNAME} वर्णन +Comment[nl]=%{APPNAME} omschrijving +Comment[pl]=Opis %{APPNAME} +Comment[pt]=Descrição de %{APPNAME$} +Comment[pt_BR]=Descrição do %{APPNAME} +Comment[ru]=Описание %{APPNAME} +Comment[sk]=%{APPNAME} popis +Comment[sl]=Opis za %{APPNAME} +Comment[sr]=Опис за %{APPNAME} +Comment[sr@Latn]=Opis za %{APPNAME} +Comment[sv]=%{APPNAME} beskrivning +Comment[tr]=%{APPNAME} Tanımı +Comment[zh_CN]=%{APPNAME} 描述 +Comment[zh_TW]=%{APPNAME} 描述 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin + +X-KDevelop-Plugin-Version=1 +X-KDevelop-Plugin-Homepage= +X-KDevelop-Plugin-BugsEmailAddress=%{EMAIL} +X-KDevelop-Plugin-Copyright=(C) by %{AUTHOR} + +X-KDevelop-Args= + +X-KDevelop-Scope=%{SCOPE} +X-KDE-Library=libkdev%{APPNAMELC} +X-KDevelop-Version=3 +X-KDevelop-Properties=%{PROPS} diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart2.kdevtemplate b/languages/cpp/app_templates/kdevpart2/kdevpart2.kdevtemplate new file mode 100644 index 00000000..6b701188 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart2.kdevtemplate @@ -0,0 +1,276 @@ +# KDE Config File +[General] +Name=KDevelop Plugin (Standalone build) +Name[ca]=Connector per a KDevelop (de construcció aïllada) +Name[da]=KDevelop plugin (Alenestående) +Name[de]=KDevelop-Modul (Unabhängige Erstellung) +Name[el]=Πρόσθετο KDevelop (Αυτόνομη κατασκευή) +Name[es]=Complemento para KDevelop (construcción independiente) +Name[et]=KDevelopi plugin (autonoomne) +Name[eu]=KDevelop plugin-a (eraikuntza autonomoak) +Name[fa]=وصلۀ KDevelop )ساخت خوداتکا( +Name[fr]=Module externe pour KDevelop (construction autonome) +Name[ga]=Breiseán KDevelop (Tógáil Shaorsheasaimh) +Name[gl]=Extensión para KDevelop (compilación independente) +Name[hu]=KDevelop-bővítőmodul (önálló) +Name[it]=Plugin di KDevelop (compilazione indipendente) +Name[ja]=KDevelop プラグイン (スタンダローンビルド) +Name[nds]=KDevelop-Moduul (Enkelprogramm) +Name[ne]=केडीई विकास प्लगइन (स्ट्यान्डअलोन निर्माण) +Name[nl]=KDevelop-plugin (standalone build) +Name[pl]=Wtyczka do KDevelopa (budowana oddzielnie) +Name[pt]='Plugin' do KDevelop (compilação autónoma) +Name[pt_BR]='Plugin' do KDevelop (compilação autónoma) +Name[ru]=Модуль KDevelop (внешний) +Name[sk]=KDevelop modul (samostatný build) +Name[sl]=Vstavek za KDevelop (samostojna izgradnja) +Name[sr]=Прикључак за KDevelop +Name[sr@Latn]=Priključak za KDevelop +Name[sv]=KDevelop-insticksprogram (att bygga fristående) +Name[tr]=KDevelop Eklentisi (Kendi başına çalışabilen) +Name[zh_CN]=KDevelop 插件(独立编译) +Name[zh_TW]=KDevelop 外掛程式(單獨建立) +Category=C++/KDevelop/ +Comment=This generates a KPart for KDevelop, to be built outside of the KDevelop source tree. +Comment[ca]=Genera una KPart per a KDevelop, per a que es construeixi fora de l'arbre de fonts de KDevelop. +Comment[da]=Dette genererer en KPart for KDevelop, til at bygges udenfor KDevelop's kildetræ. +Comment[de]=Hiermit wird eine Komponente (KPart) für KDevelop generiert, die außerhalb des Quelltextbaumes von KDevelop erstellt wird. +Comment[el]=Αυτό δημιουργεί ένα KPart για το KDevelop, για κατασκευή του έξω από το δέντρο πηγαίου κώδικα του KDevelop. +Comment[es]=Genera un KPart para KDevelop, para ser construido fuera del árbol de código fuente de KDevelop. +Comment[et]=KDevelopi KPart'i loomine, mida saab ehitada väljaspool KDevelopi lähtekoodipuud. +Comment[eu]=Honek KDevelop-en KPart bat sortzen du, KDevelop-en iturburu-zuhaitzetik at eraikitzeko. +Comment[fa]=یک KPart برای KDevelop، برای ساخته شدن در بیرون درخت منبع پروژه تولید می‌کند. +Comment[fr]=Génère un KPart pour KDevelop, à construire en dehors de l'arborescence des sources de KDevelop. +Comment[gl]=Isto xera un KPart para KDevelop que se compilará fóra da árbore de código de KDevelop. +Comment[hu]=Létrehoz egy KDevelop-bővítőmodult, mely a KDevelopos forráskönyvtáron kívül fordítható le. +Comment[it]=Genera un KPart per KDevelop, da compilare al di fuori dell'albero sorgente di KDevelop. +Comment[nds]=Dit stellt en KPart-Komponent för KDevelop op, dat buten den KDevelop-Bornboom kompileert warrt. +Comment[ne]=यसले केडीई विकास स्रोत ट्री बाहिर निर्माण हुने, केडीई विकासका लागि केडीई भाग उत्पन्न गर्दछ । +Comment[nl]=Dit genereert een KPart voor KDevelop, welke buiten de KDevelop sourcetree wordt gebouwd. +Comment[pl]=Generuje KPart dla KDevelopa budowane poza jego drzewem źródłowym. +Comment[pt]=Isto gera uma KPart para o KDevelop, de modo a ser compilada fora da árvore de código do KDevelop. +Comment[pt_BR]=Isto gera uma KPart para o KDevelop, de modo a ser compilada fora da árvore de código do KDevelop. +Comment[ru]=Создание компонента KPart для KDevelop со сборкой вне исходного кода KDevelop. +Comment[sk]=Vygenruje KPart pre KDevelop, tak aby ho bolo možné kompilovať mimo zdrojový strom KDevelop. +Comment[sr]=Ово прави KPart за KDevelop, за градњу изван KDevelop-овог изворног стабла. +Comment[sr@Latn]=Ovo pravi KPart za KDevelop, za gradnju izvan KDevelop-ovog izvornog stabla. +Comment[sv]=Detta skapar ett KDevelop-delprogram, att bygga utanför KDevelops källkodsträd. +Comment[tr]=Bu, KDevelop için, KDevelop kaynak ağacının dışında yapılacak, bir KPart yaratır. +Comment[zh_CN]=这将生成一个 KDevelop 的 KPart,可以在 KDevelop 源代码树之外编译。 +Comment[zh_TW]=產生一個 KDevelop 的 KPart 元件,建立在 KDevelop 程式源碼樹之外。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}_part.cpp +Archive=kdevpart2.tar.gz + +[SCOPE] +Type = value +ValueType=QString +Value= SCOPE +Comment= The scope of a plugin (Global, Project, Core) +Comment[ca]= L'àmbit d'un connector (Global, Project, Core) +Comment[da]= Et plugins omfang (Globalt, Projekt, Kerne) +Comment[de]= Gültigkeitsbereich eines Moduls (Global, Projekt, Kern) +Comment[el]= Η εμβέλεια ενός πρόσθετου (Καθολική, Έργο, Πυρήνας) +Comment[es]=El alcance de un complemento (global, proyecto, núcleo) +Comment[et]=Plugina skoop (globaalne, projekt, tuum) +Comment[eu]= Pluginaren barrutia (Globala, Projektua, Nukleoa) +Comment[fa]=دامنۀ یک وصله )سراسری، پروژه، هسته( +Comment[fr]= La portée d'un module externe (globale, projet, core) +Comment[ga]= Scóip an bhreiseáin (Comhchoiteann, Tionscadal, Ceartlár) +Comment[gl]=Ámbito da extensión (Global, Proxecto, Núcleo) +Comment[hu]=A modul hatóköre (globális, projektszintű, alap) +Comment[it]=Il contesto di un plugin (Globale, Progetto, Core) +Comment[nds]= Dat Rebeet vun en Moduul (Globaal, Projekt, Karn) +Comment[ne]= प्लगइनको क्षेत्र (विश्वव्यापी, परियोजना, कोर) +Comment[nl]=Het bereik van een plugin (globaal, project, core) +Comment[pl]=Przynależność wtyczki (globalna, projekt, część główna) +Comment[pt]=O âmbito de um 'plugin' (Global, Projecto, Núcleo) +Comment[pt_BR]=O âmbito de um 'plugin' (Global, Projecto, Núcleo) +Comment[ru]=Тип модуля (Global, Project, Core) +Comment[sk]=Rozsah module (globálny, projektový, jadrový) +Comment[sr]=Опсег прикључка (глобални, пројекат, језгро) +Comment[sr@Latn]=Opseg priključka (globalni, projekat, jezgro) +Comment[sv]=Insticksprogrammets omfattning (Global, Projekt, Kärna) +Comment[tr]=Bir eklentinin alanı (Genel, Proje, İç) +Comment[zh_CN]=插件的范围(全局、工程、核心) +Comment[zh_TW]=外掛程式的範圍(全域、專案、核心) +Default= Global + +[PROPS] +Type = value +ValueType=QString +Value= PROPS +Comment= The list of supported KDevelop properties +Comment[ca]= La llista de propietats suportades del KDevelop +Comment[da]= Listen af understøttede KDevelop-egenskaber +Comment[de]= Die Liste der unterstützten KDevelop-Eigenschaften +Comment[el]= Η λίστα των υποστηριζόμενων ιδιοτήτων του KDevelop +Comment[es]=La lista de propiedades de KDevelop soportadas +Comment[et]= KDevelopi toetatud omaduste nimekiri +Comment[eu]= Onartzen diren KDevelop-en propietateen zerrenda +Comment[fa]=فهرست ویژگیهای پشتیبانی‌شدۀ KDevelop +Comment[fr]= La liste des propriétés de KDevelop prises en charge +Comment[ga]= Liosta d'airíonna KDevelop a dtacaítear leo +Comment[gl]=Lista das propiedades de KDevelop soportadas +Comment[hu]=A támogatott KDevelop-tulajdonságok +Comment[it]=Lista delle proprietà supportate da KDevelop +Comment[nds]= De List mit ünnerstütt KDevelop-Egenschappen +Comment[ne]= केडीई विकास समर्थन गर्ने गुणको सूची +Comment[nl]=De lijst met ondersteunde KDevelop-properties +Comment[pl]= Lista obsługiwanych właściwości KDevelopa +Comment[pt]= A lista de propriedades do KDevelop suportadas +Comment[pt_BR]= A lista de propriedades do KDevelop suportadas +Comment[ru]=Список поддерживаемых типов модулей для KDevelop +Comment[sk]=Zoznam podporovaných vlastností KDevelop +Comment[sl]=Seznam podprtih lastnosti KDevelop +Comment[sr]=Листа подржаних KDevelop-ових својстава +Comment[sr@Latn]=Lista podržanih KDevelop-ovih svojstava +Comment[sv]=Listan med egenskaper i KDevelop som stöds +Comment[tr]=Desteklenen KDevelop özellikleri +Comment[zh_CN]=列出支持的 KDevelop 属性 +Comment[zh_TW]=支援的 KDevelop 屬性列表 +Default= + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE5] +Type=install +Source=%{src}/kdevpart-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE7] +Type=install +Source=%{src}/kdevpart_part.cpp +Dest=%{dest}/src/%{APPNAMELC}part.cpp + +[FILE71] +Type=install +EscapeXML=true +Source=%{src}/globalconfigbase.ui +Dest=%{dest}/src/%{APPNAMELC}globalconfigbase.ui + +[FILE711] +Type=install +Source=%{src}/globalconfig.h +Dest=%{dest}/src/%{APPNAMELC}globalconfig.h + +[FILE712] +Type=install +Source=%{src}/globalconfig.cpp +Dest=%{dest}/src/%{APPNAMELC}globalconfig.cpp + +[FILE72] +Type=install +EscapeXML=true +Source=%{src}/projectconfigbase.ui +Dest=%{dest}/src/%{APPNAMELC}projectconfigbase.ui + +[FILE721] +Type=install +Source=%{src}/projectconfig.h +Dest=%{dest}/src/%{APPNAMELC}projectconfig.h + +[FILE722] +Type=install +Source=%{src}/projectconfig.cpp +Dest=%{dest}/src/%{APPNAMELC}projectconfig.cpp + +[FILE8] +Type=install +Source=%{src}/kdevpart_part.h +Dest=%{dest}/src/%{APPNAMELC}part.h + +[FILE9] +Type=install +Source=%{src}/kdevpart_widget.cpp +Dest=%{dest}/src/%{APPNAMELC}widget.cpp + +[FILE10] +Type=install +Source=%{src}/kdevpart_widget.h +Dest=%{dest}/src/%{APPNAMELC}widget.h + +[FILE11] +Type=install +EscapeXML=true +Source=%{src}/kdevpart_part.rc +Dest=%{dest}/src/kdev%{APPNAMELC}.rc + +[FILE12] +Type=install +Source=%{src}/kdevpart.desktop +Dest=%{dest}/src/kdev%{APPNAMELC}.desktop + +[FILE13] +Type=install +Source=%{src}/README.dox +Dest=%{dest}/src/README.dox + +[MSG] +Type=message +Comment=A KDevelop plugin was created in %{dest} +Comment[ca]=Un connector per a KDevelop ha estat creat en %{dest} +Comment[da]=Et KDevelop plugin blev oprettet i %{dest} +Comment[de]=Ein KDevelop-Modul wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο του KDevelop δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento para KDevelop ha sido creado en %{dest} +Comment[et]=KDevelopi plugin loodi asukohta %{dest} +Comment[eu]=KDevelop plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ KDevelop در %{dest} ایجاد شد +Comment[fr]=Un module externe pour KDevelop a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán KDevelop i %{dest} +Comment[gl]=Creouse unha extensión para KDevelop en %{dest} +Comment[hu]=Létrejött egy KDevelop-bővítőmodul itt: %{dest} +Comment[it]=È stato creato un plugin per KDevelop in %{dest} +Comment[ja]=KDevelop プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KDevelop-Moduul opstellt +Comment[ne]=केडीई विकास प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Er is een KDevelop-plugin aangemaakt in %{dest} +Comment[pl]=Wtyczka do KDevelopa została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' do KDevelop em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' do KDevelop em %{dest} +Comment[ru]=Модуль KDevelop создан в %{dest} +Comment[sk]=KDevelop modul bol vytvorený v %{dest} +Comment[sl]=Vstavek za KDevelop je bil ustvarjen v %{dest} +Comment[sr]=Прикључак за KDevelop направљен је у %{dest} +Comment[sr@Latn]=Priključak za KDevelop napravljen je u %{dest} +Comment[sv]=Ett insticksprogram för KDevelop skapades i %{dest} +Comment[tr]=Bir KDevelop eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了 KDevelop 插件 +Comment[zh_TW]=一個 KDevelop 外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart2.png b/languages/cpp/app_templates/kdevpart2/kdevpart2.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/kdevpart2/kdevpart2.png differ diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart_part.cpp b/languages/cpp/app_templates/kdevpart2/kdevpart_part.cpp new file mode 100644 index 00000000..dd86843d --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart_part.cpp @@ -0,0 +1,183 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}part.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "%{APPNAMELC}widget.h" +#include "%{APPNAMELC}globalconfig.h" +#include "%{APPNAMELC}projectconfig.h" + +typedef KDevGenericFactory<%{APPNAME}Part> %{APPNAME}Factory; +KDevPluginInfo data("kdev%{APPNAMELC}"); +K_EXPORT_COMPONENT_FACTORY( libkdev%{APPNAMELC}, %{APPNAME}Factory( data ) ); + +#define GLOBALDOC_OPTIONS 1 +#define PROJECTDOC_OPTIONS 2 + +%{APPNAME}Part::%{APPNAME}Part(QObject *parent, const char *name, const QStringList &/*args*/) + : KDevPlugin(&data, parent, name ? name : "%{APPNAME}Part") +{ + setInstance(%{APPNAME}Factory::instance()); + setXMLFile("kdev%{APPNAMELC}.rc"); + + m_widget = new %{APPNAME}Widget(this); + m_widget->setCaption("widget caption"); + m_widget->setIcon(SmallIcon(info()->icon())); + + QWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?")); + + // now you decide what should happen to the widget. Take a look at kdevcore.h + // or at other plugins how to embed it. + + // if you want to embed your widget as an outputview, simply uncomment + // the following line. + // mainWindow()->embedOutputView( m_widget, "name that should appear", "enter a tooltip" ); + + // if you want to embed your widget as a selectview (at the left), simply uncomment + // the following line. + // mainWindow()->embedSelectView( m_widget, "name that should appear", "enter a tooltip" ); + + // if you want to embed your widget as a selectview (at the right), simply uncomment + // the following line. + // mainWindow()->embedSelectViewRight( m_widget, "name that should appear", "enter a tooltip" ); + + setupActions(); + + m_configProxy = new ConfigWidgetProxy(core()); + m_configProxy->createGlobalConfigPage(i18n("%{APPNAME}"), GLOBALDOC_OPTIONS, info()->icon()); + m_configProxy->createProjectConfigPage(i18n("%{APPNAME}"), PROJECTDOC_OPTIONS, info()->icon()); + connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), + this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int))); + + connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), + this, SLOT(contextMenu(QPopupMenu *, const Context *))); + connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened())); + connect(core(), SIGNAL(projectClosed()), this, SLOT(projectClosed())); + + + QTimer::singleShot(0, this, SLOT(init())); +} + +%{APPNAME}Part::~%{APPNAME}Part() +{ +// if you embed a widget, you need to tell the mainwindow when you remove it +// if ( m_widget ) +// { +// mainWindow()->removeView( m_widget ); +// } + delete m_widget; + delete m_configProxy; +} + +void %{APPNAME}Part::init() +{ +// delayed initialization stuff goes here +} + +void %{APPNAME}Part::setupActions() +{ +// create XMLGUI actions here + action = new KAction(i18n("&Do Something..."), 0, + this, SLOT(doSomething()), actionCollection(), "plugin_action" ); + action->setToolTip(i18n("Do something")); + action->setWhatsThis(i18n("Do something

      Describe here what does this action do.")); +} + +void %{APPNAME}Part::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo) +{ +// create configuraton dialogs here + switch (pageNo) + { + case GLOBALDOC_OPTIONS: + { + %{APPNAME}GlobalConfig *w = new %{APPNAME}GlobalConfig(this, page, "global config"); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + break; + } + case PROJECTDOC_OPTIONS: + { + %{APPNAME}ProjectConfig *w = new %{APPNAME}ProjectConfig(this, page, "project config"); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + break; + } + } +} + +void %{APPNAME}Part::contextMenu(QPopupMenu *popup, const Context *context) +{ +// put actions into the context menu here + if (context->hasType(Context::EditorContext)) + { + // editor context menu + const EditorContext *econtext = static_cast(context); + + // use context and plug actions here + action->plug(popup); + + // or create menu items on the fly + // int id = -1; + // id = popup->insertItem(i18n("Do Something Here"), + // this, SLOT(doSomething()) ); + // popup->setWhatsThis(id, i18n("Do something here

      Describe here what does this action do." + } + else if (context->hasType(Context::FileContext)) + { + // file context menu + const FileContext *fcontext = static_cast(context); + + //use context and plug actions here + } + else if (context->hasType(Context::ProjectModelItemContext)) + { + // project tree context menu + const ProjectModelItemContext *pcontext = static_cast(context); + + // use context and plug actions here + } + else if (context->hasType(Context::CodeModelItemContext)) + { + // class tree context menu + const CodeModelItemContext *mcontext = static_cast(context); + + // use context and plug actions here + } + else if (context->hasType(Context::DocumentationContext)) + { + // documentation viewer context menu + const DocumentationContext *dcontext = static_cast(context); + + // use context and plug actions here + } +} + +void %{APPNAME}Part::projectOpened() +{ +// do something when the project is opened +} + +void %{APPNAME}Part::projectClosed() +{ +// do something when the project is closed +} + +void %{APPNAME}Part::doSomething() +{ +// do something useful here instead of showing the message box + KMessageBox::information(m_widget, i18n("This action does nothing."), i18n("%{APPNAME} Plugin")); +} + +#include "%{APPNAMELC}part.moc" diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart_part.h b/languages/cpp/app_templates/kdevpart2/kdevpart_part.h new file mode 100644 index 00000000..168b8a40 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart_part.h @@ -0,0 +1,45 @@ +%{H_TEMPLATE} +#ifndef KDEV%{APPNAMEUC}_H +#define KDEV%{APPNAMEUC}_H + +#include + +#include + +class QPopupMenu; +class KAction; +class KDialogBase; +class Context; +class ConfigWidgetProxy; +class %{APPNAME}Widget; + +/** +Please read the README.dox file for more info about this part +*/ +class %{APPNAME}Part: public KDevPlugin +{ + Q_OBJECT +public: + %{APPNAME}Part(QObject *parent, const char *name, const QStringList &args); + ~%{APPNAME}Part(); + +private slots: + void init(); + + void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo); + void contextMenu(QPopupMenu *popup, const Context *context); + void projectOpened(); + void projectClosed(); + + void doSomething(); + +private: + void setupActions(); + + KAction *action; + + QGuardedPtr<%{APPNAME}Widget> m_widget; + ConfigWidgetProxy *m_configProxy; +}; + +#endif diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart_part.rc b/languages/cpp/app_templates/kdevpart2/kdevpart_part.rc new file mode 100644 index 00000000..a38ee14e --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart_part.rc @@ -0,0 +1,11 @@ + + + +

      &Tools + + + + + + + diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart_widget.cpp b/languages/cpp/app_templates/kdevpart2/kdevpart_widget.cpp new file mode 100644 index 00000000..0c05b976 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart_widget.cpp @@ -0,0 +1,21 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}widget.h" + +#include +#include +#include + +#include + +#include "%{APPNAMELC}part.h" + +%{APPNAME}Widget::%{APPNAME}Widget(%{APPNAME}Part *part) + : QWidget(0, "%{APPNAMELC} widget"), m_part(part) +{ +} + +%{APPNAME}Widget::~%{APPNAME}Widget() +{ +} + +#include "%{APPNAMELC}widget.moc" diff --git a/languages/cpp/app_templates/kdevpart2/kdevpart_widget.h b/languages/cpp/app_templates/kdevpart2/kdevpart_widget.h new file mode 100644 index 00000000..e29e29d2 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/kdevpart_widget.h @@ -0,0 +1,23 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_WIDGET_H +#define %{APPNAMEUC}_WIDGET_H + +#include +#include + +class KDevProject; +class %{APPNAME}Part; + +class %{APPNAME}Widget: public QWidget +{ + Q_OBJECT +public: + %{APPNAME}Widget(%{APPNAME}Part *part); + ~%{APPNAME}Widget(); + +private: + %{APPNAME}Part *m_part; +}; + + +#endif diff --git a/languages/cpp/app_templates/kdevpart2/projectconfig.cpp b/languages/cpp/app_templates/kdevpart2/projectconfig.cpp new file mode 100644 index 00000000..5f07993b --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/projectconfig.cpp @@ -0,0 +1,15 @@ +%{CPP_TEMPLATE} +#include "%{APPNAMELC}projectconfig.h" + +#include "%{APPNAMELC}part.h" + +%{APPNAME}ProjectConfig::%{APPNAME}ProjectConfig(%{APPNAME}Part *part, QWidget *parent, const char *name) + : %{APPNAME}ProjectConfigBase(parent, name), m_part(part) +{ +} + +void %{APPNAME}ProjectConfig::accept() +{ +} + +#include "%{APPNAMELC}projectconfig.moc" diff --git a/languages/cpp/app_templates/kdevpart2/projectconfig.h b/languages/cpp/app_templates/kdevpart2/projectconfig.h new file mode 100644 index 00000000..ec3ff4df --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/projectconfig.h @@ -0,0 +1,22 @@ +%{H_TEMPLATE} +#ifndef %{APPNAMEUC}_PROJECT_CONFIG_H +#define %{APPNAMEUC}_PROJECT_CONFIG_H + +#include "%{APPNAMELC}projectconfigbase.h" + +class %{APPNAME}Part; + +class %{APPNAME}ProjectConfig: public %{APPNAME}ProjectConfigBase +{ + Q_OBJECT +public: + %{APPNAME}ProjectConfig(%{APPNAME}Part *part, QWidget *parent = 0, const char *name = 0); + +public slots: + void accept(); + +private: + %{APPNAME}Part *m_part; +}; + +#endif diff --git a/languages/cpp/app_templates/kdevpart2/projectconfigbase.ui b/languages/cpp/app_templates/kdevpart2/projectconfigbase.ui new file mode 100644 index 00000000..c733a774 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/projectconfigbase.ui @@ -0,0 +1,20 @@ + +%{APPNAME}ProjectConfigBase + + + %{APPNAME}ProjectConfigBase + + + + 0 + 0 + 600 + 480 + + + + %{APPNAME} + + + + diff --git a/languages/cpp/app_templates/kdevpart2/src-Makefile.am b/languages/cpp/app_templates/kdevpart2/src-Makefile.am new file mode 100644 index 00000000..dded12c0 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/src-Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(kde_includes)/kdevelop/interfaces -I$(kde_includes)/kdevelop/util $(all_includes) + +kde_module_LTLIBRARIES = libkdev%{APPNAMELC}.la +libkdev%{APPNAMELC}_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) $(KDE_PLUGIN) +libkdev%{APPNAMELC}_la_LIBADD = -lkdevelop +libkdev%{APPNAMELC}_la_SOURCES = %{APPNAMELC}part.cpp %{APPNAMELC}widget.cpp %{APPNAMELC}globalconfigbase.ui %{APPNAMELC}globalconfig.cpp %{APPNAMELC}projectconfigbase.ui %{APPNAMELC}projectconfig.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdev%{APPNAMELC}.desktop + +rcdir = $(kde_datadir)/kdev%{APPNAMELC} +rc_DATA = kdev%{APPNAMELC}.rc + +appsharedir = $(kde_datadir)/kdev%{APPNAMELC} +appshare_DATA = diff --git a/languages/cpp/app_templates/kdevpart2/subdirs b/languages/cpp/app_templates/kdevpart2/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kdevpart2/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kfileplugin/.kdev_ignore b/languages/cpp/app_templates/kfileplugin/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kfileplugin/Makefile.am b/languages/cpp/app_templates/kfileplugin/Makefile.am new file mode 100644 index 00000000..9ac8003d --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = README.devel kfile_plugin.cpp kfile_plugin.desktop \ + kfile_plugin.h plugin.kdevelop kfileplugin kfileplugin.png \ + src-Makefile.am subdirs +templateName = kfileplugin + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kfileplugin/README.devel b/languages/cpp/app_templates/kfileplugin/README.devel new file mode 100644 index 00000000..21ee67c7 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/README.devel @@ -0,0 +1,9 @@ +@todo: + +1. add information to src/kfile_%{APPNAMELC}.desktop +MimeType= +PreferredGroups= +PreferredItems= + +2. plugin +Note: Please change to "Optimized" compilation if you want to make a release. diff --git a/languages/cpp/app_templates/kfileplugin/kfile_plugin.cpp b/languages/cpp/app_templates/kfileplugin/kfile_plugin.cpp new file mode 100644 index 00000000..3e6b849a --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/kfile_plugin.cpp @@ -0,0 +1,55 @@ +%{CPP_TEMPLATE} + +#include +#include "kfile_%{APPNAMELC}.h" + +#include +//#include + +//#include +//#include + +typedef KGenericFactory<%{APPNAME}Plugin> %{APPNAME}Factory; + +K_EXPORT_COMPONENT_FACTORY(kfile_%{APPNAME}, %{APPNAME}Factory( "kfile_%{APPNAMELC}" )) + +%{APPNAME}Plugin::%{APPNAME}Plugin(QObject *parent, const char *name, + const QStringList &args) + : KFilePlugin(parent, name, args) +{ + //add the mimetype here - example: + //KFileMimeTypeInfo* info = addMimeTypeInfo( "text/html" ); + KFileMimeTypeInfo* info = addMimeTypeInfo( "text/html" ); + + // our new group + KFileMimeTypeInfo::GroupInfo* group = 0L; + group = addGroupInfo(info, "%{APPNAME}Info", i18n("%{APPNAME} Information")); + + KFileMimeTypeInfo::ItemInfo* item; + + // our new items in the group + item = addItemInfo(group, "Items", i18n("Items"), QVariant::Int); + item = addItemInfo(group, "Size", i18n("Size"), QVariant::Int); + setUnit(item, KFileMimeTypeInfo::KiloBytes); + + // strings are possible, too: + //addItemInfo(group, "Text", i18n("Document Type"), QVariant::String); +} + +bool %{APPNAME}Plugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + KFileMetaInfoGroup group = appendGroup(info, "%{APPNAME}Info"); + + // add your "calculations" here + // if something goes wrong, "return false;" + + + // and finally display it! + appendItem(group, "Items", 100); + appendItem(group, "Size", int(5000/1024)); + + return true; +} + +#include "kfile_%{APPNAMELC}.moc" + diff --git a/languages/cpp/app_templates/kfileplugin/kfile_plugin.desktop b/languages/cpp/app_templates/kfileplugin/kfile_plugin.desktop new file mode 100644 index 00000000..9af8b5e9 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/kfile_plugin.desktop @@ -0,0 +1,39 @@ +[Desktop Entry] +Type=Service +Name=%{APPNAME} Info +Name[br]=Titouriñ diwar-benn %{APPNAME} +Name[ca]=Informació per a %{APPNAME} +Name[da]=%{APPNAME} info +Name[el]=Πληροφορίες %{APPNAME} +Name[es]=Información de %{APPNAME} +Name[et]=%{APPNAME} info +Name[eu]=%{APPNAME} informazioa +Name[fa]=اطلاعات %{APPNAME} +Name[fr]=Informations sur %{APPNAME} +Name[ga]=Eolas faoi %{APPNAME} +Name[gl]=Información de %{APPNAME} +Name[hu]=%{APPNAME} jellemzői +Name[it]=Informazioni su %{APPNAME} +Name[nds]=%{APPNAME}-Info +Name[ne]=%{APPNAME} सूचना +Name[pl]=Informacje dla %{APPNAME} +Name[pt]=Informação do %{APPNAME} +Name[pt_BR]=Informações de %{APPNAME} +Name[ru]=Информация о %{APPNAME} +Name[sk]=%{APPNAME} info +Name[sl]=Informacije o %{APPNAME} +Name[sr]=Информације за %{APPNAME} +Name[sr@Latn]=Informacije za %{APPNAME} +Name[sv]=%{APPNAME} information +Name[ta]=%{APPNAME} தகவல் +Name[tg]=Маълумот дар бораи %{APPNAME} +Name[zh_CN]=%{APPNAME}的信息 +Name[zh_TW]=%{APPNAME} 資訊 +ServiceTypes=KFilePlugin +X-KDE-Library=kfile_%{APPNAMELC} +# change MimeType here! (example: inode/directory) +MimeType= +# change PreferredGroups here! (example: FolderInfo) +PreferredGroups= +# change PreferredItems here! (example: Items;Size) +PreferredItems= diff --git a/languages/cpp/app_templates/kfileplugin/kfile_plugin.h b/languages/cpp/app_templates/kfileplugin/kfile_plugin.h new file mode 100644 index 00000000..358b4dcb --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/kfile_plugin.h @@ -0,0 +1,24 @@ +%{H_TEMPLATE} + +#ifndef __KFILE_%{APPNAMEUC}_H__ +#define __KFILE_%{APPNAMEUC}_H__ + +/** + * Note: For further information look into <$KDEDIR/include/kfilemetainfo.h> + */ +#include + +class QStringList; + +class %{APPNAME}Plugin: public KFilePlugin +{ + Q_OBJECT + +public: + %{APPNAME}Plugin( QObject *parent, const char *name, const QStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif // __KFILE_%{APPNAMEUC}_H__ + diff --git a/languages/cpp/app_templates/kfileplugin/kfileplugin b/languages/cpp/app_templates/kfileplugin/kfileplugin new file mode 100644 index 00000000..6717cdc2 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/kfileplugin @@ -0,0 +1,8 @@ +# KDE Config File +[General] +Name=KFile plugin +Icon=kfileplugin.png +Category=C++/KDE +Comment=Generates a KFile plugin for konqueror to display meta information. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=README.devel,src/kfile_APPNAMELC.cpp diff --git a/languages/cpp/app_templates/kfileplugin/kfileplugin.kdevtemplate b/languages/cpp/app_templates/kfileplugin/kfileplugin.kdevtemplate new file mode 100644 index 00000000..edff2fd4 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/kfileplugin.kdevtemplate @@ -0,0 +1,166 @@ +# KDE Config File +[General] +Name=KFile plugin +Name[br]=Lugent KFile +Name[ca]=Connector KFile +Name[de]=KFile-Modul +Name[el]=Πρόσθετο KFile +Name[es]=Complemento para KFile +Name[et]=KFile'i plugin +Name[eu]=KFile plugin-a +Name[fa]=وصلۀ KFile +Name[fr]=Module externe KFile +Name[ga]=Breiseán KFile +Name[gl]=Extensión para KFile +Name[hu]=KFile-bővítőmodul +Name[it]=Plugin KFile +Name[ja]=KFile プラグイン +Name[nds]=KFile-Moduul +Name[ne]=केडीई फाइल प्लगइन +Name[nl]=KFile-plugin +Name[pl]=Wtyczka do KFile +Name[pt]='Plugin' do KFile +Name[pt_BR]='Plugin' do KFile +Name[ru]=Модуль KFile +Name[sk]=KFile modul +Name[sl]=Vstavek za KFile +Name[sr]=Прикључак за KFile +Name[sr@Latn]=Priključak za KFile +Name[sv]=KFile-insticksprogram +Name[tr]=KFile Eklentisi +Name[zh_CN]=KFile 插件 +Name[zh_TW]=KFile 外掛程式 +Icon=kfileplugin.png +Category=C++/KDE +Comment=Generates a KFile plugin for konqueror to display meta information. +Comment[ca]=Genera un connector KFile per al konqueror per a mostrar meta informació. +Comment[da]=Genererer et KFile-plugin for konqueror til at vise meta-information. +Comment[de]=Erstellt ein KFile-Modul für Konqueror zur Anzeige von Meta-Daten. +Comment[el]=Δημιουργεί ένα πρόσθετο KFile για την εμφάνιση μεταπληροφοριών στον konqueror. +Comment[es]=Genera un complemento de KFile para Konqueror que muestra metainformación. +Comment[et]=Konquerori KFile'i plugina loomine, mis näitab metainfot. +Comment[eu]=Meta-informazioa bistaratzeko Konqueror-en KFile plugin bat sortzen du. +Comment[fa]=یک وصلۀ KFile برای konqueror جهت نمایش فرااطلاعات تولید می‌کند. +Comment[fr]=Génère un module externe KFile pour que Konqueror affiche des méta-informations. +Comment[gl]=Xera unha extensión para KFile para permitir a konqueror mostrar metainformación. +Comment[hu]=Létrehoz egy KFile-bővítőmodult, mellyel a Konquerorban dokumentumjellemzőket lehet megjeleníteni. +Comment[it]=Genera un plugin KFile per Konqueror per mostrare meta informazioni. +Comment[nds]=Stellt en KFile-Moduul för Konqueror op, dat Metadaten wiest. +Comment[ne]=मेटा सूचना देखाउन कन्क्वेररका लागि केडीई फाइल प्लगइन उत्पन्न गर्दछ । +Comment[nl]=Genereert een KFile-plugin voor konqueror voor het weergeven van meta-informatie. +Comment[pl]=Generuje wtyczkę KFile dla Konquerora do wyświetlania informacji meta. +Comment[pt]=Gera um 'plugin' do KFile para o Konqueror poder mostrar meta-informações. +Comment[pt_BR]=Gera um 'plugin' do KFile para o Konqueror poder mostrar meta-informações. +Comment[ru]=Создание модуля KFile для показа метаданных в Konqueror. +Comment[sk]=Vygeneruje KFile modul pre konqueror na zobrazenie meta informácií. +Comment[sr]=Прави прикључак за KFile за приказ метаинформација у Konqueror-у. +Comment[sr@Latn]=Pravi priključak za KFile za prikaz metainformacija u Konqueror-u. +Comment[sv]=Skapar ett KFile-insticksprogram till Konqueror för att visa metainformation. +Comment[tr]=Meta bilgisini göstermesi için Konqueror'a bir KFile eklentisi yaratır. +Comment[zh_CN]=生成一个可显示元信息的 Konqueror KFile 插件。 +Comment[zh_TW]=產生一個 Konqueror 的 KFile 外掛程式,顯示中繼資訊 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=${dest}/README.devel,%{dest}/src/kfile_%{APPNAMELC}.cpp +Archive=kfileplugin.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/kfile_plugin.desktop +Dest=%{dest}/src/kfile_%{APPNAMELC}.desktop + +[FILE13] +Type=install +Source=%{src}/kfile_plugin.cpp +Dest=%{dest}/src/kfile_%{APPNAMELC}.cpp + +[FILE14] +Type=install +Source=%{src}/kfile_plugin.h +Dest=%{dest}/src/kfile_%{APPNAMELC}.h + +[FILE15] +Type=install +Source=%{src}/README.devel +Dest=%{dest}/README.devel + diff --git a/languages/cpp/app_templates/kfileplugin/kfileplugin.png b/languages/cpp/app_templates/kfileplugin/kfileplugin.png new file mode 100644 index 00000000..d2a56245 Binary files /dev/null and b/languages/cpp/app_templates/kfileplugin/kfileplugin.png differ diff --git a/languages/cpp/app_templates/kfileplugin/plugin.kdevelop b/languages/cpp/app_templates/kfileplugin/plugin.kdevelop new file mode 100644 index 00000000..a95b52f9 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/plugin.kdevelop @@ -0,0 +1,114 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/kfile_%{APPNAMELC}.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kfileplugin/src-Makefile.am b/languages/cpp/app_templates/kfileplugin/src-Makefile.am new file mode 100644 index 00000000..48ac1c66 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/src-Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for folder file meta info plugin + +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = kfile_%{APPNAMELC}.h + +kde_module_LTLIBRARIES = kfile_%{APPNAMELC}.la + +kfile_%{APPNAMELC}_la_SOURCES = kfile_%{APPNAMELC}.cpp +kfile_%{APPNAMELC}_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kfile_%{APPNAMELC}_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +services_DATA = kfile_%{APPNAMELC}.desktop +servicesdir = $(kde_servicesdir) + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kfile_%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kfileplugin/subdirs b/languages/cpp/app_templates/kfileplugin/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kfileplugin/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/khello/.kdev_ignore b/languages/cpp/app_templates/khello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/khello/Makefile.am b/languages/cpp/app_templates/khello/Makefile.am new file mode 100644 index 00000000..6f788f99 --- /dev/null +++ b/languages/cpp/app_templates/khello/Makefile.am @@ -0,0 +1,18 @@ +# all khello data files +dataFiles = src-Makefile.am app.cpp app.h main.cpp appui.rc app.kdevelop \ + subdirs app.desktop khello.png +templateName = khello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/khello/app.cpp b/languages/cpp/app_templates/khello/app.cpp new file mode 100644 index 00000000..44332685 --- /dev/null +++ b/languages/cpp/app_templates/khello/app.cpp @@ -0,0 +1,23 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" + +#include + +#include +#include + +%{APPNAME}::%{APPNAME}() + : KMainWindow( 0, "%{APPNAME}" ) +{ + // set the shell's ui resource file + setXMLFile("%{APPNAMELC}ui.rc"); + + new QLabel( "Hello World", this, "hello label" ); +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/khello/app.desktop b/languages/cpp/app_templates/khello/app.desktop new file mode 100644 index 00000000..8b36e6e0 --- /dev/null +++ b/languages/cpp/app_templates/khello/app.desktop @@ -0,0 +1,40 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +Icon=%{APPNAMELC} +Type=Application +Comment=A simple KDE Application +Comment[br]=Ur meziant eeun evit KDE +Comment[ca]=Una simple aplicació per al KDE +Comment[da]=Et simpelt KDE program +Comment[de]=Eine einfache KDE-Anwendung +Comment[el]=Μια απλή εφαρμογή του KDE +Comment[es]=Una aplicación de KDE sencilla +Comment[et]=Lihtne KDE rakendus +Comment[eu]=KDE aplikazio simple bat +Comment[fa]=یک کاربرد سادۀ KDE +Comment[fr]=Une application simple pour KDE +Comment[ga]=Feidhmchlár Simplí KDE +Comment[gl]=Unha aplicación KDE sinxela +Comment[hi]=एक सादा केडीई अनुप्रयोग +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[is]=Einfalt KDE forrit +Comment[it]=Una semplice applicazione KDE +Comment[ja]=簡単な KDE アプリケーション +Comment[nds]=En eenfach KDE-Programm +Comment[ne]=एउटा साधारण केडीई अनुप्रयोग +Comment[nl]=Een eenvoudige KDE-toepassing +Comment[pl]=Prosty program KDE +Comment[pt]=Uma aplicação simples do KDE +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[ru]=Простое приложение KDE +Comment[sk]=Jednoduchá KDE aplikácia +Comment[sl]=Preprost program za KDE +Comment[sr]=Једноставан KDE програм +Comment[sr@Latn]=Jednostavan KDE program +Comment[sv]=Ett enkelt KDE-program +Comment[ta]=ஒரு சாதாரண கெடிஇ பயன்பாடு +Comment[tg]=Гузориши оддиKDE +Comment[tr]=Basit bir KDE Uygulaması +Comment[zh_CN]=一个简单的 KDE 应用程序 +Comment[zh_TW]=簡單的 KDE 應用程式 diff --git a/languages/cpp/app_templates/khello/app.h b/languages/cpp/app_templates/khello/app.h new file mode 100644 index 00000000..678df7a3 --- /dev/null +++ b/languages/cpp/app_templates/khello/app.h @@ -0,0 +1,32 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +/** + * @short Application Main Window + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME} : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); +}; + +#endif // _%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/khello/app.kdevelop b/languages/cpp/app_templates/khello/app.kdevelop new file mode 100644 index 00000000..7e6cf8da --- /dev/null +++ b/languages/cpp/app_templates/khello/app.kdevelop @@ -0,0 +1,115 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/khello/appui.rc b/languages/cpp/app_templates/khello/appui.rc new file mode 100644 index 00000000..ceb4f14e --- /dev/null +++ b/languages/cpp/app_templates/khello/appui.rc @@ -0,0 +1,8 @@ + + + + C&ustom + + + + diff --git a/languages/cpp/app_templates/khello/khello.kdevtemplate b/languages/cpp/app_templates/khello/khello.kdevtemplate new file mode 100644 index 00000000..e401fa5d --- /dev/null +++ b/languages/cpp/app_templates/khello/khello.kdevtemplate @@ -0,0 +1,220 @@ +# KDE Config File +[General] +Name=Simple KDE Application +Name[ca]=Una simple aplicació per al KDE +Name[da]=Et simpelt KDE program +Name[de]=Einfache KDE-Anwendung +Name[el]=Απλή εφαρμογή του KDE +Name[es]=Aplicación de KDE sencilla +Name[et]=Lihtne KDE rakendus +Name[eu]=KDE aplikazio simple bat +Name[fa]=کاربرد سادۀ KDE +Name[fr]=Application KDE simple +Name[ga]=Feidhmchlár Simplí KDE +Name[gl]=Aplicación KDE sinxela +Name[hu]=Egyszerű KDE-s alkalmazás +Name[it]=Una semplice applicazione KDE +Name[ja]=簡単な KDE アプリケーション +Name[nds]=Eenfach KDE-Programm +Name[ne]=साधारण केडीई अनुप्रयोग +Name[nl]=Eenvoudige KDE-toepassing +Name[pl]=Prosty program dla KDE +Name[pt]=Aplicação Simples do KDE +Name[pt_BR]=Aplicação Simples do KDE +Name[ru]=Простое приложение KDE +Name[sk]=Jednoduchá KDE aplikácia +Name[sl]=Preprost program za KDE +Name[sr]=Једноставан KDE програм +Name[sr@Latn]=Jednostavan KDE program +Name[sv]=Enkelt KDE-program +Name[tr]=Basit KDE Uygulaması +Name[zh_CN]=简单的 KDE 应用程序 +Name[zh_TW]=簡單的 KDE 應用程式 +Category=C++/KDE +Icon=khello.png +Comment=Generates a simple KDE application with one widget. +Comment[ca]=Genera una simple aplicació per al KDE amb un estri. +Comment[da]=Genererer et simpelt KDE program men en kontrol +Comment[de]=Erstellt eine einfache KDE-Anwendung mit einem Oberflächenelement +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE με ένα γραφικό συστατικό. +Comment[es]=Genera una sencilla aplicación para KDE con una ventana. +Comment[et]=Lihtsa KDE rakenduse loomine ühe vidinaga. +Comment[eu]=Trepeta bakarra duen KDE aplikazio simple bat sortzen du. +Comment[fa]=یک کاربرد سادۀ KDE با یک عنصر تولید می‌کند. +Comment[fr]=Génère une application KDE simple comprenant un seul élément graphique (widget). +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí KDE le giuirléid amháin. +Comment[gl]=Xera unha aplicación KDE sinxela con un compoñente. +Comment[hu]=Létrehoz egy egyszerű KDE-s alkalmazást, egy grafikus elemmel. +Comment[it]=Genera una semplice applicazione KDE senza elementi grafici. +Comment[ja]=ウィジェットを一つ含んだ簡単な KDE アプリケーションを作成します。 +Comment[nds]=Stellt en eenfach KDE-Programm mit een Element op. +Comment[ne]=एउटा विगेटसँग साधारण केडीई अनुप्रयोग उत्पन्न गर्दछ । +Comment[nl]=Genereert een eenvoudige KDE-toepassing met één widget. +Comment[pl]=Generuje prosty program dla KDE z jednym widgetem. +Comment[pt]=Gera uma aplicação simples para o KDE com uma janela. +Comment[pt_BR]=Gera uma aplicação simples para o KDE com uma janela. +Comment[ru]=Создание простого приложения KDE с одним окном. +Comment[sk]=Vygeneruje jednoduchú KDE aplikáciu s jedným oknom. +Comment[sl]=Ustvari preprost program za KDE z enim gradnikom. +Comment[sr]=Прави једноставан KDE програм са једном контролом. +Comment[sr@Latn]=Pravi jednostavan KDE program sa jednom kontrolom. +Comment[sv]=Skapar ett enkelt KDE-program med en grafisk komponent. +Comment[tr]=Tek parçacıklı basit bir KDE uygulaması yaratır. +Comment[zh_CN]=生成只有一个部件的 KDE 应用程序。 +Comment[zh_TW]=產生一個簡單的 KDE 應用程式,內含一個元件 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=khello.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/po + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE9] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[MkDir4] +Type=mkdir +Dir=%{dest}/src + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[FILE13] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE14] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE15] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE16] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE17] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE18] +Type=install +Source=%{src}/app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=A KDE Hello world program was created in %{dest} +Comment[ca]=Un programa de Hello world per al KDE ha estat creat en %{dest} +Comment[da]=Et KDE Goddag verden program blev oprettet i %{dest} +Comment[de]=Ein KDE-"Hello World"-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα πρόγραμμα Γεια σου Κόσμε του KDE δημιουργήθηκε στο %{dest} +Comment[es]=Un programa «Hola mundo» para KDE ha sido creado en %{dest} +Comment[et]=KDE "Tere, maailm" programm loodi asukohta %{dest} +Comment[eu]=KDE-ren "Kaixo mundua" programa bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ KDE Hello world در %{dest} ایجاد شد +Comment[fr]=Un programme KDE « Bonjour monde » a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár "Hello World" KDE i %{dest} +Comment[gl]=Creouse un programa KDE Ola mundo en %{dest} +Comment[hu]=Létrejött egy KDE Hello world program itt: %{dest} +Comment[it]=È stato creato un semplice programma KDE di "Hello world" in %{dest} +Comment[ja]=KDE Hello world プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en "Moin Welt"-Programm för KDE opstellt +Comment[ne]=केडीई हेल्लो वोल्ड कार्यक्रम %{dest} मा सिर्जना गरियो +Comment[nl]=Een KDE Hello World-programma is aangemaakt in %{dest} +Comment[pl]=Program 'Witaj świecie' dla KDE został utworzony w %{dest} +Comment[pt]=Foi criado um programa Olá Mundo do KDE em %{dest} +Comment[pt_BR]=Foi criado um programa Olá Mundo do KDE em %{dest} +Comment[ru]=Приложение KDE Hello world создано в %{dest} +Comment[sk]=KDE Ahoj svet program bol vytvorený v %{dest} +Comment[sl]=Program Hello World za KDE je bil ustvarjen v %{dest} +Comment[sr]=KDE „Здраво свете“ програм направљен је у %{dest} +Comment[sr@Latn]=KDE „Zdravo svete“ program napravljen je u %{dest} +Comment[sv]=Ett KDE Hello world-program skapades i %{dest} +Comment[tr]=Bir KDE Merhaba Dünya programı %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了 KDE Hello world 程序 +Comment[zh_TW]=一個 KDE Hello World 程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/khello/khello.png b/languages/cpp/app_templates/khello/khello.png new file mode 100644 index 00000000..9fe493f5 Binary files /dev/null and b/languages/cpp/app_templates/khello/khello.png differ diff --git a/languages/cpp/app_templates/khello/main.cpp b/languages/cpp/app_templates/khello/main.cpp new file mode 100644 index 00000000..da7c5335 --- /dev/null +++ b/languages/cpp/app_templates/khello/main.cpp @@ -0,0 +1,51 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE KPart Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ +// { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + %{APPNAME} *mainWin = 0; + + if (app.isRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + /// @todo do something with the command line args here + + mainWin = new %{APPNAME}(); + app.setMainWidget( mainWin ); + mainWin->show(); + + args->clear(); + } + + // mainWin has WDestructiveClose flag by default, so it will delete itself. + return app.exec(); +} + diff --git a/languages/cpp/app_templates/khello/src-Makefile.am b/languages/cpp/app_templates/khello/src-Makefile.am new file mode 100644 index 00000000..d9ac7c7a --- /dev/null +++ b/languages/cpp/app_templates/khello/src-Makefile.am @@ -0,0 +1,35 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = %{APPNAMELC}.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +KDE_ICON = AUTO + +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} + +# the application source, library search path, and link libraries +%{APPNAMELC}_SOURCES = main.cpp %{APPNAMELC}.cpp +%{APPNAMELC}_LDFLAGS = $(KDE_RPATH) $(all_libraries) +%{APPNAMELC}_LDADD = $(LIB_KDEUI) + +# this is where the desktop file will go +shelldesktopdir = $(kde_appsdir)/Utilities +shelldesktop_DATA = %{APPNAMELC}.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/%{APPNAMELC} +shellrc_DATA = %{APPNAMELC}ui.rc + diff --git a/languages/cpp/app_templates/khello/subdirs b/languages/cpp/app_templates/khello/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/khello/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/khello2/.kdev_ignore b/languages/cpp/app_templates/khello2/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/khello2/Makefile.am b/languages/cpp/app_templates/khello2/Makefile.am new file mode 100644 index 00000000..8ac1b18d --- /dev/null +++ b/languages/cpp/app_templates/khello2/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = src-Makefile.am app.cpp app.h main.cpp appui.rc app.kdevelop \ + subdirs app.desktop khello2.png widget.cpp widget.h widgetbase.ui + +templateName = khello2 + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/khello2/app.cpp b/languages/cpp/app_templates/khello2/app.cpp new file mode 100644 index 00000000..948a98fc --- /dev/null +++ b/languages/cpp/app_templates/khello2/app.cpp @@ -0,0 +1,19 @@ +%{CPP_TEMPLATE} + +#include +#include + +#include "%{APPNAMELC}.h" +#include "%{APPNAMELC}widget.h" + +%{APPNAME}::%{APPNAME}() + : KMainWindow( 0, "%{APPNAME}" ) +{ + setCentralWidget( new %{APPNAME}Widget( this ) ); +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/khello2/app.desktop b/languages/cpp/app_templates/khello2/app.desktop new file mode 100644 index 00000000..8b36e6e0 --- /dev/null +++ b/languages/cpp/app_templates/khello2/app.desktop @@ -0,0 +1,40 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +Icon=%{APPNAMELC} +Type=Application +Comment=A simple KDE Application +Comment[br]=Ur meziant eeun evit KDE +Comment[ca]=Una simple aplicació per al KDE +Comment[da]=Et simpelt KDE program +Comment[de]=Eine einfache KDE-Anwendung +Comment[el]=Μια απλή εφαρμογή του KDE +Comment[es]=Una aplicación de KDE sencilla +Comment[et]=Lihtne KDE rakendus +Comment[eu]=KDE aplikazio simple bat +Comment[fa]=یک کاربرد سادۀ KDE +Comment[fr]=Une application simple pour KDE +Comment[ga]=Feidhmchlár Simplí KDE +Comment[gl]=Unha aplicación KDE sinxela +Comment[hi]=एक सादा केडीई अनुप्रयोग +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[is]=Einfalt KDE forrit +Comment[it]=Una semplice applicazione KDE +Comment[ja]=簡単な KDE アプリケーション +Comment[nds]=En eenfach KDE-Programm +Comment[ne]=एउटा साधारण केडीई अनुप्रयोग +Comment[nl]=Een eenvoudige KDE-toepassing +Comment[pl]=Prosty program KDE +Comment[pt]=Uma aplicação simples do KDE +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[ru]=Простое приложение KDE +Comment[sk]=Jednoduchá KDE aplikácia +Comment[sl]=Preprost program za KDE +Comment[sr]=Једноставан KDE програм +Comment[sr@Latn]=Jednostavan KDE program +Comment[sv]=Ett enkelt KDE-program +Comment[ta]=ஒரு சாதாரண கெடிஇ பயன்பாடு +Comment[tg]=Гузориши оддиKDE +Comment[tr]=Basit bir KDE Uygulaması +Comment[zh_CN]=一个简单的 KDE 应用程序 +Comment[zh_TW]=簡單的 KDE 應用程式 diff --git a/languages/cpp/app_templates/khello2/app.h b/languages/cpp/app_templates/khello2/app.h new file mode 100644 index 00000000..678df7a3 --- /dev/null +++ b/languages/cpp/app_templates/khello2/app.h @@ -0,0 +1,32 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +/** + * @short Application Main Window + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME} : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); +}; + +#endif // _%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/khello2/app.kdevelop b/languages/cpp/app_templates/khello2/app.kdevelop new file mode 100644 index 00000000..43425791 --- /dev/null +++ b/languages/cpp/app_templates/khello2/app.kdevelop @@ -0,0 +1,115 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + GccOptions + GppOptions + G77Options + -O2 -g0 + + + --enable-debug=full + debug + GccOptions + GppOptions + G77Options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/khello2/appui.rc b/languages/cpp/app_templates/khello2/appui.rc new file mode 100644 index 00000000..ceb4f14e --- /dev/null +++ b/languages/cpp/app_templates/khello2/appui.rc @@ -0,0 +1,8 @@ + + + + C&ustom + + + + diff --git a/languages/cpp/app_templates/khello2/khello2.kdevtemplate b/languages/cpp/app_templates/khello2/khello2.kdevtemplate new file mode 100644 index 00000000..479d7496 --- /dev/null +++ b/languages/cpp/app_templates/khello2/khello2.kdevtemplate @@ -0,0 +1,230 @@ +# KDE Config File +[General] +Name=Simple Designer based KDE Application +Name[ca]=Simple aplicació per al KDE basada en el dissenyador +Name[da]=Simpelt Designer-baseret KDE program +Name[de]=Einfache, auf Designer basierende KDE-Anwendung +Name[el]=Απλή εφαρμογή KDE βασισμένη στο σχεδιαστή +Name[es]=Aplicación para KDE sencilla basada en el diseñador +Name[et]=Lihtne KDE rakendus Disaineri põhjal +Name[eu]=Designer-en oinarritutako KDE aplikazio simple bat +Name[fa]=کاربرد KDE بر مبنای طراح ساده +Name[fr]=Application KDE simple basée sur Designer +Name[gl]=Aplicación KDE sinxela baseada no deseñador +Name[hu]=Egyszerű Qt Designer-alapú KDE-s alkalmazás +Name[it]=Una semplice applicazione KDE basata su designer +Name[ja]=Designer ベースの簡単な KDE アプリケーション +Name[nds]=Eenfach, op "Designer" opbuut KDE-Programm +Name[ne]=साधारण डिजाइनरमा आधारित केडीई अनुप्रयोग +Name[nl]=Eenvoudige Designer-gebaseerde KDE-toepassing +Name[pl]=Prosty program dla KDE wykonany w Designerze +Name[pt]=Aplicação Simples do KDE baseada no Qt Designer +Name[pt_BR]=Aplicação Simples do KDE baseada no Qt Designer +Name[ru]=Простое приложение KDE с формой +Name[sk]=Jednoduchý dizajnér založený na KDE aplikácii +Name[sr]=Једноставан KDE програм на основу Designer-а +Name[sr@Latn]=Jednostavan KDE program na osnovu Designer-a +Name[sv]=Enkelt KDE-program baserat på Designer +Name[tr]=Basit Designer tabanlı KDE Uygulaması +Name[zh_CN]=基于设计师的简单 KDE 应用程序 +Name[zh_TW]=簡單的設計器 KDE 應用程式 +Category=C++/KDE +Icon=khello2.png +Comment=Generates a simple KDE application with one Qt-designer based widget. +Comment[ca]=Genera una simple aplicació per al KDE basada en el dissenyador de Qt. +Comment[da]=Genererer et simpelt KDE program med en Qt-designer baseret kontrol. +Comment[de]=Erstellt eine einfache KDE-Anwendung mit einem auf Qt-Designer basierenden Widget. +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE με ένα γραφικό συστατικό βασισμένο στο σχεδιαστή Qt. +Comment[es]=Genera una sencilla aplicación para KDE con una ventana basada en Qt-designer. +Comment[et]=Lihtsa KDE rakenduse loomine ühe vidinaga Qt Disaineri põhjal. +Comment[eu]=Qt Designer-en oinarritutako trepeta bat duen KDE aplikazio sinple bat sortzen du. +Comment[fa]=یک کاربرد سادۀ KDE با یک عنصر مبنای طراح Qt تولید می‌کند. +Comment[fr]=Génère une application KDE simple comprenant un seul élément graphique (widget) basé sur Qt-designer. +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí KDE le giuirléid amháin bunaithe ar Qt-Designer +Comment[gl]=Xera unha aplicación KDE sinxela cunha compoñente baseada en Qt-designer. +Comment[hu]=Létrehoz egy egyszerű KDE-s alkalmazást, mely egy Qt Designerrel készített grafikus elemre épül. +Comment[it]=Genera una semplice applicazione KDE con un elemento grafico basato su Qt-designer. +Comment[nds]=Stellt en eenfach KDE-Programm mit een op Qt-Designer opbuut Element op. +Comment[ne]=क्यू टी डिजाइनरमा आधारित विगेटसँग साधारण केडीई अनुप्रयोग उत्पन्न गर्दछ । +Comment[nl]=Genereert een eenvoudige KDE-toepassing met één Qt-Designer-gebaseerde widget. +Comment[pl]=Generuje prosty program dla KDE z jednym widgetem pochodzącym z Qt Designera. +Comment[pt]=Gera uma aplicação simples do KDE com uma interface baseada no Qt-designer. +Comment[pt_BR]=Gera uma aplicação simples do KDE com uma interface baseada no Qt-designer. +Comment[ru]=Создание простого приложения KDE с формой, созданной в Qt Designer. +Comment[sk]=Vygeneruje jednoduchú KDE aplikáciu s jedným oknom Qt dizajnéra. +Comment[sr]=Прави једноставан KDE програма са једном контролом на основу Qt-Designer-а. +Comment[sr@Latn]=Pravi jednostavan KDE programa sa jednom kontrolom na osnovu Qt-Designer-a. +Comment[sv]=Skapar ett enkelt KDE-program med en grafisk komponent baserad på Qt-Designer. +Comment[tr]=Qt-designer tabanlı bir parçacığı olan basit bir KDE uygulaması yaratır. +Comment[zh_CN]=生成一个带一个基于 Qt 设计师部件的简单 KDE 应用程序。 +Comment[zh_TW]=產生一個簡單的 KDE 應用程式,內含 Qt 設計器的元件 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=khello2.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/po + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE9] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[MkDir4] +Type=mkdir +Dir=%{dest}/src + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[FILE13] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE14] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE15] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE16] +Type=install +Source=%{src}/widget.cpp +Dest=%{dest}/src/%{APPNAMELC}widget.cpp + +[FILE17] +Type=install +Source=%{src}/widget.h +Dest=%{dest}/src/%{APPNAMELC}widget.h + +[FILE18] +Type=install +EscapeXML=true +Source=%{src}/widgetbase.ui +Dest=%{dest}/src/%{APPNAMELC}widgetbase.ui + +[FILE19] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE20] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE21] +Type=install +Source=%{src}/app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=A simple designer based KDE application was created in %{dest} +Comment[ca]=A simple aplicació per al KDE basada en el dissenyador ha estat creada en %{dest} +Comment[da]=Et simpelt designer-baseret KDE program blev oprettet i %{dest} +Comment[de]=Eine einfache, auf Designer basierende KDE-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια απλή εφαρμογή KDE βασισμένη στο σχεδιαστή δημιουργήθηκε στο %{dest} +Comment[es]=Una sencilla aplicación para KDE basada en el diseñador ha sido creada en %{dest} +Comment[et]=Lihtne KDE rakendus Disaineri põhjal loodi asukohta %{dest} +Comment[eu]=Designer-en oinarritutako KDE aplikazio simple bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد ساده‌ای بر مبنای طراح در %{dest} ایجاد شد +Comment[fr]=Une application KDE simple basée sur Designer a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár simplí KDE bunaithe ar Qt-Designer i %{dest} +Comment[gl]=Creouse unha aplicación KDE baseada no deseñador en %{dest} +Comment[hu]=Létrejött egy egyszerű, Qt Designer-alapú KDE-s alkalmazás itt: %{dest} +Comment[it]=È stata creata una semplice applicazione KDE basata su designer +Comment[ja]=Designer ベースの簡単な KDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach op "Designer" opbuut KDE-Programm opstellt +Comment[ne]=साधारण डिजाइनरमा आधारित केडीई अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudige Designer-gebaseerde KDE-toepassing is aangemaakt in %{dest} +Comment[pl]=Prosty program wykorzystujący Qt Designera został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação simples do KDE em %{dest} +Comment[pt_BR]=Foi criada uma aplicação simples do KDE em %{dest} +Comment[ru]=Простое приложение KDE с формой создано в %{dest} +Comment[sk]=Jednoduchý dizajnér založený na KDE aplikácii bol vytvorený v %{dest} +Comment[sr]=Једноставан KDE програм на основу Designer-а направљен је у %{dest} +Comment[sr@Latn]=Jednostavan KDE program na osnovu Designer-a napravljen je u %{dest} +Comment[sv]=Ett enkelt KDE-program baserat på Designer skapades i %{dest} +Comment[tr]=Designer tabanlı basit bir KDE uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个基于设计师的简单 KDE 应用程序 +Comment[zh_TW]=一個簡單的設計器 KDE 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/khello2/khello2.png b/languages/cpp/app_templates/khello2/khello2.png new file mode 100644 index 00000000..97422793 Binary files /dev/null and b/languages/cpp/app_templates/khello2/khello2.png differ diff --git a/languages/cpp/app_templates/khello2/main.cpp b/languages/cpp/app_templates/khello2/main.cpp new file mode 100644 index 00000000..278eef46 --- /dev/null +++ b/languages/cpp/app_templates/khello2/main.cpp @@ -0,0 +1,51 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE KPart Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ +// { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + %{APPNAME} *mainWin = 0; + + if (app.isRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + /// @todo do something with the command line args here + + mainWin = new %{APPNAME}(); + app.setMainWidget( mainWin ); + mainWin->show(); + + args->clear(); + } + + // mainWin has WDestructiveClose flag by default, so it will delete itself. + return app.exec(); +} + diff --git a/languages/cpp/app_templates/khello2/src-Makefile.am b/languages/cpp/app_templates/khello2/src-Makefile.am new file mode 100644 index 00000000..4664fe84 --- /dev/null +++ b/languages/cpp/app_templates/khello2/src-Makefile.am @@ -0,0 +1,35 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = %{APPNAMELC}.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +KDE_ICON = AUTO + +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} + +# the application source, library search path, and link libraries +%{APPNAMELC}_SOURCES = main.cpp %{APPNAMELC}.cpp %{APPNAMELC}widget.cpp %{APPNAMELC}widgetbase.ui +%{APPNAMELC}_LDFLAGS = $(KDE_RPATH) $(all_libraries) +%{APPNAMELC}_LDADD = $(LIB_KDEUI) + +# this is where the desktop file will go +shelldesktopdir = $(kde_appsdir)/Utilities +shelldesktop_DATA = %{APPNAMELC}.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/%{APPNAMELC} +shellrc_DATA = %{APPNAMELC}ui.rc + diff --git a/languages/cpp/app_templates/khello2/subdirs b/languages/cpp/app_templates/khello2/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/khello2/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/khello2/widget.cpp b/languages/cpp/app_templates/khello2/widget.cpp new file mode 100644 index 00000000..6775ac39 --- /dev/null +++ b/languages/cpp/app_templates/khello2/widget.cpp @@ -0,0 +1,30 @@ +%{CPP_TEMPLATE} + +#include + +#include "%{APPNAMELC}widget.h" + +%{APPNAME}Widget::%{APPNAME}Widget(QWidget* parent, const char* name, WFlags fl) + : %{APPNAME}WidgetBase(parent,name,fl) +{} + +%{APPNAME}Widget::~%{APPNAME}Widget() +{} + +/*$SPECIALIZATION$*/ +void %{APPNAME}Widget::button_clicked() +{ + if ( label->text().isEmpty() ) + { + label->setText( "Hello World!" ); + } + else + { + label->clear(); + } +} + + + +#include "%{APPNAMELC}widget.moc" + diff --git a/languages/cpp/app_templates/khello2/widget.h b/languages/cpp/app_templates/khello2/widget.h new file mode 100644 index 00000000..275e13c7 --- /dev/null +++ b/languages/cpp/app_templates/khello2/widget.h @@ -0,0 +1,30 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}WIDGET_H_ +#define _%{APPNAMEUC}WIDGET_H_ + +#include "%{APPNAMELC}widgetbase.h" + +class %{APPNAME}Widget : public %{APPNAME}WidgetBase +{ + Q_OBJECT + +public: + %{APPNAME}Widget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~%{APPNAME}Widget(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + virtual void button_clicked(); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + +}; + +#endif + diff --git a/languages/cpp/app_templates/khello2/widgetbase.ui b/languages/cpp/app_templates/khello2/widgetbase.ui new file mode 100644 index 00000000..e6f5be3d --- /dev/null +++ b/languages/cpp/app_templates/khello2/widgetbase.ui @@ -0,0 +1,52 @@ + +%{APPNAME}WidgetBase + + + %{APPNAMELC}widgetbase + + + + 0 + 0 + 220 + 133 + + + + + + + + unnamed + + + + button + + + Click Me! + + + + + label + + + + + + + + + + button + clicked() + %{APPNAMELC}widgetbase + button_clicked() + + + + button_clicked() + + + diff --git a/languages/cpp/app_templates/kicker/.kdev_ignore b/languages/cpp/app_templates/kicker/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kicker/Makefile.am b/languages/cpp/app_templates/kicker/Makefile.am new file mode 100644 index 00000000..168a93c9 --- /dev/null +++ b/languages/cpp/app_templates/kicker/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = applet.cpp applet.h applet.desktop applet.kdevelop \ + src-Makefile.am kicker.png subdirs +templateName = kicker + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kicker/applet.cpp b/languages/cpp/app_templates/kicker/applet.cpp new file mode 100644 index 00000000..5345ac0c --- /dev/null +++ b/languages/cpp/app_templates/kicker/applet.cpp @@ -0,0 +1,72 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include +#include +#include + +#include "%{APPNAMELC}.h" + + +%{APPNAME}::%{APPNAME}(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) + : KPanelApplet(configFile, type, actions, parent, name) +{ + // Get the current application configuration handle + ksConfig = config(); + QLCDNumber *w = new QLCDNumber(this); + w->display(42); + + mainView = w; + mainView->show(); +} + + +%{APPNAME}::~%{APPNAME}() +{ +} + + +void %{APPNAME}::about() +{ + KMessageBox::information(0, i18n("This is an about box")); +} + + +void %{APPNAME}::help() +{ + KMessageBox::information(0, i18n("This is a help box")); +} + + +void %{APPNAME}::preferences() +{ + KMessageBox::information(0, i18n("This is a preferences box")); +} + +int %{APPNAME}::widthForHeight(int height) const +{ + return width(); +} + +int %{APPNAME}::heightForWidth(int width) const +{ + return height(); +} + +void %{APPNAME}::resizeEvent(QResizeEvent *e) +{ +} + + +extern "C" +{ + KPanelApplet* init( QWidget *parent, const QString& configFile) + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}(configFile, KPanelApplet::Normal, + KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences, + parent, "%{APPNAMELC}"); + } +} diff --git a/languages/cpp/app_templates/kicker/applet.desktop b/languages/cpp/app_templates/kicker/applet.desktop new file mode 100644 index 00000000..24e47c40 --- /dev/null +++ b/languages/cpp/app_templates/kicker/applet.desktop @@ -0,0 +1,40 @@ +[Desktop Entry] +Comment=A panel applet called $NAME$ +Comment[br]=Un arloadig panell a vez graet $NAME$ +Comment[ca]=Una miniaplicació del plafó anomenat $NAME$ +Comment[cy]=Rhaglennig panel o'r enw $NAME$ +Comment[da]=En panel-applet der hedder $NAME$ +Comment[de]=Ein Miniprogramm mit dem Namen $NAME$ +Comment[el]=Μία μικροεφαρμογή πίνακα με όνομα $NAME$ +Comment[es]=Un applet del panel llamado $NAME$ +Comment[et]=Paneeliaplett nimega $NAME$ +Comment[eu]=$NAME$ izeneko panel applet bat +Comment[fa]=برنامک تابلو، $NAME$ نامیده شد +Comment[fr]=Un applet pour le tableau de bord nommé $NAME$ +Comment[ga]=Feidhmchláirín painéil darbh ainm $NAME$ +Comment[gl]=Un applet para o panel chamado $NAME$ +Comment[hi]=एक फलक ऐपलेट जो कहलाता है- $NAME$ +Comment[hu]=$NAME$ nevű panel-kisalkalmazás +Comment[is]=Spjaldforritlingur nefndur $NAME$ +Comment[it]=Un applet per il pannello chiamata $NAME$ +Comment[ja]=$NAME$ と呼ばれるパネルアプレット +Comment[nds]=En Paneel-Lüttprogramm nöömt $NAME$ +Comment[ne]= $NAME$ भनिने प्यानल एप्लेट +Comment[nl]=Een paneel-applet met naam $NAME$ +Comment[pl]=Aplet panelu o nazwie $NAME$ +Comment[pt]=Um 'applet' para o painel chamado $NAME$ +Comment[pt_BR]=Uma applet de painel chamada $NAME$ +Comment[ru]=Аплет панели $NAME$ +Comment[sk]=Applet panel s menom $NAME$ +Comment[sl]=Pultni vstavek z imenom $NAME$ +Comment[sr]=Панелни аплет по имену $NAME$ +Comment[sr@Latn]=Panelni aplet po imenu $NAME$ +Comment[sv]=Ett panelminiprogram som kallas $NAME$ +Comment[ta]=ஒரு பானல் ஆப்லெட் $NAME$ என்ற்உ அழைக்கப்படுகிறது +Comment[tg]=Пайраҳаи апплети $NAME$ +Comment[tr]=$NAME$ adında bir panel küçük uygulaması +Comment[zh_CN]=一个称作 $NAME$ 的面板小程序 +Comment[zh_TW]=一個名稱為 $NAME$ 的面板小程式 +Name=%{APPNAMELC} +X-KDE-Library=%{APPNAMELC}_panelapplet +X-KDE-UniqueApplet = false diff --git a/languages/cpp/app_templates/kicker/applet.h b/languages/cpp/app_templates/kicker/applet.h new file mode 100644 index 00000000..b078b2a4 --- /dev/null +++ b/languages/cpp/app_templates/kicker/applet.h @@ -0,0 +1,107 @@ +%{H_TEMPLATE} + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + + +class %{APPNAME} : public KPanelApplet +{ + Q_OBJECT + +public: + /** + * Construct a @ref KPanelApplet just like any other widget. + * + * @param configFile The configFile handed over in the factory function. + * @param Type The applet @ref type(). + * @param actions Standard RMB menu actions supported by the applet (see @ref action() ). + * @param parent The pointer to the parent widget handed over in the factory function. + * @param name A Qt object name for your applet. + **/ + %{APPNAME}(const QString& configFile, Type t = Normal, int actions = 0, + QWidget *parent = 0, const char *name = 0); + /** destructor */ + ~%{APPNAME}(); + + /** + * Retrieve a suggested width for a given height. + * + * Every applet should reimplement this function. + * + * Depending on the panel orientation the height (horizontal panel) or the + * width (vertical panel) of the applets is fixed. + * The exact values of the fixed size component depend on the panel size. + * + * On a horizontal panel the applet height is fixed, the panel will + * call @ref widthForHeight(int height) with @p height + * equal to 'the fixed applet height' + * when laying out the applets. + * + * The applet can now choose the other size component (width) + * based on the given height. + * + * The width you return is granted. + **/ + virtual int widthForHeight(int height) const; + /** + * @return A suggested height for a given width. + * + * Every applet should reimplement this function. + * + * Depending on the panel orientation the height (horizontal panel) or the + * width (vertical panel) of the applets is fixed. + * The exact values of the fixed size component depend on the panel size. + * + * On a vertical panel the applet width is fixed, the panel will + * call @ref heightForWidth(int width) with @p width + * equal to 'the fixed applet width' + * when laying out the applets. + * + * The applet can now choose the other size component (height) + * based on the given width. + * + * The height you return is granted. + **/ + virtual int heightForWidth(int width) const; + /** + * Is called when the user selects "About" from the applets RMB menu. + * Reimplement this function to launch a about dialog. + * + * Note that this is called only when your applet supports the About action. + * See @ref Action and @ref KPanelApplet(). + **/ + virtual void about(); + /** + * Is called when the user selects "Help" from the applets RMB menu. + * Reimplement this function to launch a manual or help page. + * + * Note that this is called only when your applet supports the Help action. + * See @ref Action and @ref KPanelApplet(). + **/ + virtual void help(); + /** + * Is called when the user selects "Preferences" from the applets RMB menu. + * Reimplement this function to launch a preferences dialog or kcontrol module. + * + * Note that this is called only when your applet supports the preferences action. + * See @ref Action and @ref KPanelApplet(). + **/ + virtual void preferences(); + +protected: + void resizeEvent(QResizeEvent *); + +private: + KConfig *ksConfig; + QWidget *mainView; +}; + +#endif diff --git a/languages/cpp/app_templates/kicker/applet.kdevelop b/languages/cpp/app_templates/kicker/applet.kdevelop new file mode 100644 index 00000000..8bb35326 --- /dev/null +++ b/languages/cpp/app_templates/kicker/applet.kdevelop @@ -0,0 +1,115 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + Kicker + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kicker/kicker.kdevtemplate b/languages/cpp/app_templates/kicker/kicker.kdevtemplate new file mode 100644 index 00000000..f6f87256 --- /dev/null +++ b/languages/cpp/app_templates/kicker/kicker.kdevtemplate @@ -0,0 +1,194 @@ +# KDE Config File +[General] +Name=Kicker Applet +Name[br]=Arloadig Kicker +Name[ca]=Una miniaplicació per a Kicker +Name[da]=Kicker-applet +Name[de]=Kicker-Miniprogramm +Name[el]=Μικροεφαρμογή Kicker +Name[es]=Applet para Kicker +Name[et]=Kickeri aplett +Name[eu]=Kicker applet-a +Name[fa]=برنامک Kicker +Name[fr]=Applet Kicker +Name[ga]=Feidhmchláirín Kicker +Name[gl]=Applet para Kicker +Name[hu]=Panel-kisalkalmazás +Name[it]=Applet di kicker +Name[ja]=Kicker アプレット +Name[nds]=Kicker-Lüttprogramm +Name[ne]=किकर एप्लेट +Name[nl]=Kicker-applet +Name[pl]=Aplet panelu +Name[pt]='Applet' do Kicker +Name[pt_BR]='Applet' do Kicker +Name[ru]=Аплет панели KDE +Name[sk]=Kicker applet +Name[sl]=Vstavek za Kicker +Name[sr]=Аплет за Kicker +Name[sr@Latn]=Aplet za Kicker +Name[sv]=Miniprogram för Kicker +Name[tr]=Kicker Küçük Uygulaması +Name[zh_CN]=Kicker 小程序 +Name[zh_TW]=Kicker 小程式 +Icon=kicker.png +Category=C++/KDE +Comment=Generates a framework for an applet that embeds into the KDE panel +Comment[ca]=Genera una infraestructura per a una miniaplicació encastada en el plafó de KDE +Comment[da]=Genererer et skelet for en applet der indlejres i KDE's panel +Comment[de]=Erstellt das Grundgerüst für ein Miniprogramm, das in die KDE-Kontrollleiste eingebettet wird. +Comment[el]=Δημιουργεί ένα πλαίσιο για μία μικροεφαρμογή που ενσωματώνεται στον πίνακα του KDE +Comment[es]=Genera una infraestructura para un applet empotrado en el panel de KDE +Comment[et]=Apleti raamistiku loomine, mida saab põimida KDE paneelile +Comment[eu]=KDE-ren panelean kapsulatzen den applet baten lan-marko bat sortzen du +Comment[fa]=چارچوبی برای برنامک نهفته‌شده در تابلوی KDEتولید می‌کند +Comment[fr]=Génère une infrastructure pour un applet qui s'intègre dans le tableau de bord de KDE +Comment[gl]=Xera un contorno de traballo para un applet que se incrusta no panel de KDE. +Comment[hu]=Létrehoz egy keretprogramot KDE-s panel-kisalkalmazás készítéséhez +Comment[it]=Genera l'infrastruttura per un'applet che si integra nel pannello di KDE +Comment[nds]=Stellt dat Rahmenwark för en Lüttprogramm op, dat sik na dat KDE-Paneel inbett +Comment[ne]=केडीई प्यानलमा सम्मिलित एप्लेटका लागि फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Genereert een framework voor een applet die kan worden ingebed in het KDE-paneel +Comment[pl]=Generuje szablon apletu, który można wstawić do panelu KDE +Comment[pt]=Gera a plataforma para uma 'applet' que se incorpore no painel do KDE +Comment[pt_BR]=Gera a plataforma para uma 'applet' que se incorpore no painel do KDE +Comment[ru]=Создание аплета панели KDE +Comment[sk]=Vygeneruje framework pre applet, ktorý sa bude dať vložiť do KDE panelu +Comment[sr]=Прави радни оквир за аплет који се уграђује у KDE-ов панел +Comment[sr@Latn]=Pravi radni okvir za aplet koji se ugrađuje u KDE-ov panel +Comment[sv]=Skapar ett ramverk för ett miniprogram som inbäddas i KDE:s panel +Comment[tr]=KDE paneline gömülen bir küçük uygulama için bir çatı oluşturur. +Comment[zh_CN]=生成一个可嵌入 KDE 面板的小程序框架 +Comment[zh_TW]=產生一個嵌入 KDE 面板的小程式框架 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=kicker.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/applet.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/applet.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/applet.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/applet.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=A Kicker Applet was created in %{dest} +Comment[ca]=Una miniaplicació per a Kicker ha estat creat en %{dest} +Comment[da]=En Kicker applet blev oprettet i %{dest} +Comment[de]=Ein Miniprogramm für Kicker wurde in %{dest} erstellt. +Comment[el]=Μία μικροεφαρμογή Kicker δημιουργήθηκε στο %{dest} +Comment[es]=Un applet para Kicker ha sido creado en %{dest} +Comment[et]=Kickeri aplett loodi asukohta %{dest} +Comment[eu]=Kicker Applet bat sortu da hemen: %{dest} +Comment[fa]=یک برنامک Kicker در %{dest} ایجاد شد +Comment[fr]=Un applet Kicker a été créé dans %{dest} +Comment[ga]=Cruthaíodh feidhmchláirín Kicker i %{dest} +Comment[gl]=Creouse un applet para Kicker en %{dest} +Comment[hu]=Létrejött egy panel-kisalkalmazás itt: %{dest} +Comment[it]=È stata creata un'applet per kicker in %{dest} +Comment[ja]=Kicker アプレットを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Kicker-Lüttprogramm opstellt +Comment[ne]=किकर एप्लेट %{dest} मा सिर्जना गरियो +Comment[nl]=Een Kicker-applet is aangemaakt in %{dest} +Comment[pl]=Aplet panelu został utworzony w %{dest} +Comment[pt]=Foi criada uma 'applet' do Kicker em %{dest} +Comment[pt_BR]=Foi criada uma 'applet' do Kicker em %{dest} +Comment[ru]=Аплет панели KDE создан в %{dest} +Comment[sk]=Kicker applet bol vytvorený v %{dest} +Comment[sl]=Vstavek za Kicker je bil ustvarjen v %{dest} +Comment[sr]=Аплет за Kicker направљен је у %{dest} +Comment[sr@Latn]=Aplet za Kicker napravljen je u %{dest} +Comment[sv]=Ett miniprogram för Kicker skapades i %{dest} +Comment[tr]=Bir Kicker küçük uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 Kicker 小程序 +Comment[zh_TW]=一個 Kicker 小程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kicker/kicker.png b/languages/cpp/app_templates/kicker/kicker.png new file mode 100644 index 00000000..5e4f746f Binary files /dev/null and b/languages/cpp/app_templates/kicker/kicker.png differ diff --git a/languages/cpp/app_templates/kicker/src-Makefile.am b/languages/cpp/app_templates/kicker/src-Makefile.am new file mode 100644 index 00000000..424062d1 --- /dev/null +++ b/languages/cpp/app_templates/kicker/src-Makefile.am @@ -0,0 +1,15 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES = %{APPNAMELC}_panelapplet.la + +%{APPNAMELC}_panelapplet_la_SOURCES = %{APPNAMELC}.cpp +%{APPNAMELC}_panelapplet_la_LDFLAGS = -module -avoid-version $(all_libraries) +%{APPNAMELC}_panelapplet_la_LIBADD = $(LIB_KDEUI) + +%{APPNAMELC}_DATA = %{APPNAMELC}.desktop +%{APPNAMELC}dir = $(kde_datadir)/kicker/applets + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kicker/subdirs b/languages/cpp/app_templates/kicker/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kicker/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kioslave/.kdev_ignore b/languages/cpp/app_templates/kioslave/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kioslave/Makefile.am b/languages/cpp/app_templates/kioslave/Makefile.am new file mode 100644 index 00000000..5aa5b88e --- /dev/null +++ b/languages/cpp/app_templates/kioslave/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = slave.cpp slave.h slave.protocol slave.kdevelop \ + src-Makefile.am kioslave.png subdirs +templateName = kioslave + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kioslave/kioslave.kdevtemplate b/languages/cpp/app_templates/kioslave/kioslave.kdevtemplate new file mode 100644 index 00000000..0af80e7b --- /dev/null +++ b/languages/cpp/app_templates/kioslave/kioslave.kdevtemplate @@ -0,0 +1,183 @@ +# KDE Config File +[General] +Name=KIO slave +Name[br]=Sklav KIO +Name[ca]=Esclau KIO +Name[da]=KIO-slave +Name[de]=Ein-/Ausgabemodul +Name[el]=Υπηρέτης KIO +Name[es]=Esclavo KIO +Name[et]=KIO-moodul +Name[eu]=KIO morroia +Name[fr]=Esclave KIO +Name[ga]=Sclábhaí KIO +Name[gl]=Escravo KIO +Name[hu]=KDE-protokoll (KIOslave) +Name[it]=Slave KIO +Name[nds]=In-/Utgaavmoduul +Name[ne]=KIO स्लेभ +Name[nl]=KIO-slave +Name[pt]=KIO Slave +Name[sk]=KIO otrok +Name[sv]=I/O-slav +Icon=kioslave.png +Category=C++/KDE +Comment=Generates a framework for an IO slave +Comment[ca]=Genera una infraestructura per a un esclau IO +Comment[da]=Genererer et skelet for en IO-slave +Comment[de]=Erstellt das Grundgerüst für ein Ein-/Ausgabemodul. +Comment[el]=Δημιουργεί ένα πλαίσιο για έναν υπηρέτη IO +Comment[es]=Genera una infraestructura para un esclavo de E/S +Comment[et]=IO-mooduli raamistiku loomine +Comment[eu]=IO morroi baterako lan-marko bat sortzen du +Comment[fa]=چارچوبی برای یک IO slave تولید می‌کند +Comment[fr]=Génère une infrastructure pour un esclave d'entrée / sortie +Comment[ga]=Cruthaíonn sé seo creatlach le haghaidh sclábhaí IO +Comment[gl]=Xera un contorno de traballo para un escravo IO +Comment[hu]=Létrehoz egy kiindulási keretprogramot KIOslave készítéséhez +Comment[it]=Genera l'infrastruttura per uno slave di I/O +Comment[ja]=IO slave のフレームワークを作成します +Comment[nds]=Stellt dat Rahmenwark för en In-/Utgaavmoduul op +Comment[ne]=IO स्लेभका लागि फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Genereert een framework voor een IO-slave +Comment[pl]=Generuje szablon dla IO slave +Comment[pt]=Gera a plataforma para um 'IO slave' +Comment[pt_BR]=Gera a plataforma para um 'IO slave' +Comment[ru]=Создание канала IO slave для KDE +Comment[sk]=Vygeneruje framework pre IO otroka +Comment[sr]=Прави радни оквир за IO slave +Comment[sr@Latn]=Pravi radni okvir za IO slave +Comment[sv]=Skapar ett ramverk för en I/O-slav +Comment[zh_CN]=生成一个 IO slave 的框架 +Comment[zh_TW]=產生一個 IO slave 的框架 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=kioslave.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/slave.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/slave.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/slave.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/slave.protocol +Dest=%{dest}/src/%{APPNAMELC}.protocol + +[MSG] +Type=message +Comment=A KIO slave was created in %{dest} +Comment[ca]=Un esclau KIO ha estat creat en %{dest} +Comment[da]=En KIO-slave blev oprettet i %{dest} +Comment[de]=Ein Ein-/Ausgabemodul wurde in %{dest} erstellt. +Comment[el]=Ένας υπηρέτης KIO δημιουργήθηκε στο %{dest} +Comment[es]=Un esclavo KIO ha sido creado en %{dest} +Comment[et]=KIO-moodul loodi asukohta %{dest} +Comment[eu]=KIO morroi bat sortu da hemen: %{dest} +Comment[fa]=یک KIO slave در %{dest} ایجاد شد +Comment[fr]=Un esclave d'entrée / sortie a été créé dans %{dest} +Comment[ga]=Cruthaíodh sclábhaí KIO i %{dest} +Comment[gl]=Creouse un escravo KIO en %{dest} +Comment[hu]=Létrejött egy KIOslave itt: %{dest} +Comment[it]=È stato generato un slave KIO in %{dest} +Comment[ja]=KIO slave を %{dest} に作成しました。 +Comment[nds]=In %{dest} wöör en In-/Utgaavmoduul opstellt +Comment[ne]=KIO स्लेभ %{dest} मा सिर्जना गरियो +Comment[nl]=Een KIO-slave is aangemaakt in %{dest} +Comment[pl]=KIO slave został utworzony w %{dest} +Comment[pt]=Foi criado um 'KIO slave' em %{dest} +Comment[pt_BR]=Foi criado um 'KIO slave' em %{dest} +Comment[ru]=Канал KIO slave создан в %{dest} +Comment[sk]=KIO otrok bol vytvorený v %{dest} +Comment[sr]=KIO slave је направљен у %{dest} +Comment[sr@Latn]=KIO slave je napravljen u %{dest} +Comment[sv]=En I/O-slav skapades i %{dest} +Comment[tr]=Bir KIO slave'i %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 KIO slave +Comment[zh_TW]=一個 KIO slave 已建立於 %{dest} diff --git a/languages/cpp/app_templates/kioslave/kioslave.png b/languages/cpp/app_templates/kioslave/kioslave.png new file mode 100644 index 00000000..f0cd89a8 Binary files /dev/null and b/languages/cpp/app_templates/kioslave/kioslave.png differ diff --git a/languages/cpp/app_templates/kioslave/slave.cpp b/languages/cpp/app_templates/kioslave/slave.cpp new file mode 100644 index 00000000..df32aebf --- /dev/null +++ b/languages/cpp/app_templates/kioslave/slave.cpp @@ -0,0 +1,88 @@ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "%{APPNAMELC}.h" + +using namespace KIO; + + +kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol(const QCString &pool_socket, const QCString &app_socket) + : SlaveBase("kio_%{APPNAMELC}", pool_socket, app_socket) +{ + kdDebug() << "kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol()" << endl; +} + + +kio_%{APPNAMELC}Protocol::~kio_%{APPNAMELC}Protocol() +{ + kdDebug() << "kio_%{APPNAMELC}Protocol::~kio_%{APPNAMELC}Protocol()" << endl; +} + + +void kio_%{APPNAMELC}Protocol::get(const KURL& url ) +{ + kdDebug() << "kio_%{APPNAMELC}::get(const KURL& url)" << endl ; + + kdDebug() << "Seconds: " << url.query() << endl; + QString remoteServer = url.host(); + int remotePort = url.port(); + kdDebug() << "myURL: " << url.prettyURL() << endl; + + infoMessage(i18n("Looking for %1...").arg( remoteServer ) ); + // Send the mimeType as soon as it is known + mimeType("text/plain"); + // Send the data + QString theData = "This is a test of kio_%{APPNAMELC}"; + data(QCString(theData.local8Bit())); + data(QByteArray()); // empty array means we're done sending the data + finished(); +} + + +void kio_%{APPNAMELC}Protocol::mimetype(const KURL & /*url*/) +{ + mimeType("text/plain"); + finished(); +} + + +extern "C" +{ + int kdemain(int argc, char **argv) + { + KInstance instance( "kio_%{APPNAMELC}" ); + + kdDebug(7101) << "*** Starting kio_%{APPNAMELC} " << endl; + + if (argc != 4) { + kdDebug(7101) << "Usage: kio_%{APPNAMELC} protocol domain-socket1 domain-socket2" << endl; + exit(-1); + } + + kio_%{APPNAMELC}Protocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + kdDebug(7101) << "*** kio_%{APPNAMELC} Done" << endl; + return 0; + } +} diff --git a/languages/cpp/app_templates/kioslave/slave.h b/languages/cpp/app_templates/kioslave/slave.h new file mode 100644 index 00000000..649ead8c --- /dev/null +++ b/languages/cpp/app_templates/kioslave/slave.h @@ -0,0 +1,23 @@ + +#ifndef _%{APPNAMELC}_H_ +#define _%{APPNAMELC}_H_ + +#include +#include + +#include +#include +#include + +class QCString; + +class kio_%{APPNAMELC}Protocol : public KIO::SlaveBase +{ +public: + kio_%{APPNAMELC}Protocol(const QCString &pool_socket, const QCString &app_socket); + virtual ~kio_%{APPNAMELC}Protocol(); + virtual void mimetype(const KURL& url); + virtual void get(const KURL& url); +}; + +#endif diff --git a/languages/cpp/app_templates/kioslave/slave.kdevelop b/languages/cpp/app_templates/kioslave/slave.kdevelop new file mode 100644 index 00000000..a2ca970a --- /dev/null +++ b/languages/cpp/app_templates/kioslave/slave.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + kioslave + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + + + + + libtool + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kioslave/slave.protocol b/languages/cpp/app_templates/kioslave/slave.protocol new file mode 100644 index 00000000..2e2cc076 --- /dev/null +++ b/languages/cpp/app_templates/kioslave/slave.protocol @@ -0,0 +1,39 @@ +[Protocol] +exec=kio_%{APPNAMELC} +protocol=%{APPNAMELC} +input=none +output=stream +reading=true +defaultMimetype=text/plain +Icon=remote +Description=A kioslave for %{APPNAMELC} +Description[br]=Ur c'hioslave evit %{APPNAMELC} +Description[ca]=Un kioslave per a %{APPNAMELC} +Description[da]=En kioslave til %{APPNAMELC} +Description[de]=Ein Ein-/Ausgabemodul für %{APPNAMELC} +Description[el]=Ένα υπηρέτης kio για %{APPNAMELC} +Description[es]=Un kioslave para %{APPNAMELC} +Description[et]=%{APPNAMELC} IO-moodul +Description[eu]=kioslave bat honentzat: %{APPNAMELC} +Description[fa]=یک kioslave برای %{APPNAMELC} +Description[fr]=Un esclave d'E/S (kioslave) pour %{APPNAMELC} +Description[ga]=kioslave le haghaidh %{APPNAMELC} +Description[gl]=Un kioslave para %{APPNAMELC} +Description[hu]=%{APPNAMELC}-támogató KIOslave +Description[it]=Un kioslave per %{APPNAMELC} +Description[ja]=%{APPNAMELC} のための kioslave +Description[nds]=En In-/Utgaavmoduul för %{APPNAMELC} +Description[ne]= %{APPNAMELC} का लागि किवस्लेभ +Description[nl]=Kioslave voor %{APPNAMELC} +Description[pl]=kioslave dla %{APPNAMELC} +Description[pt]=Um 'kioslave' para %{APPNAMELC} +Description[pt_BR]=Um kioslave para %{APPNAMELC} +Description[ru]=Канал kioslave для %{APPNAMELC} +Description[sk]=kioslave pre %{APPNAMELC} +Description[sl]=kioslave za %{APPNAMELC} +Description[sr]=KIOSlave за %{APPNAMELC} +Description[sr@Latn]=KIOSlave za %{APPNAMELC} +Description[sv]=En I/O-slav för %{APPNAMELC} +Description[tr]=%{APPNAMELC} için bir kioslave +Description[zh_CN]=%{APPNAMELC} 的 kioslave +Description[zh_TW]=%{APPNAMELC} 的 kioslave diff --git a/languages/cpp/app_templates/kioslave/src-Makefile.am b/languages/cpp/app_templates/kioslave/src-Makefile.am new file mode 100644 index 00000000..957ec330 --- /dev/null +++ b/languages/cpp/app_templates/kioslave/src-Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kio_%{APPNAMELC}.la + +kio_%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp +kio_%{APPNAMELC}_la_LIBADD = -lkio +kio_%{APPNAMELC}_la_LDFLAGS = -module -avoid-version $(all_libraries) $(KDE_PLUGIN) + +protocol_DATA = %{APPNAMELC}.protocol +protocoldir = $(kde_servicesdir) + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kio_%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kioslave/subdirs b/languages/cpp/app_templates/kioslave/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kioslave/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kmake/Makefile.am b/languages/cpp/app_templates/kmake/Makefile.am new file mode 100644 index 00000000..87d660e0 --- /dev/null +++ b/languages/cpp/app_templates/kmake/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = appui.rc app.desktop app.cpp mainviewimp.cpp mainviewimp.h mainview.ui app.kdevelop app.pro src.pro +templateName = kmake + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kmake/app.cpp b/languages/cpp/app_templates/kmake/app.cpp new file mode 100644 index 00000000..8920b2f0 --- /dev/null +++ b/languages/cpp/app_templates/kmake/app.cpp @@ -0,0 +1,33 @@ + +#include +#include +#include +#include +#include "mainviewimp.h" + +static const char description[] = I18N_NOOP("A KDE Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = + { + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption + }; + + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAME}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) 2004 %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + KApplication app; + MainViewImp *widget = new MainViewImp; + app.setMainWidget(widget); + widget->show(); + return app.exec(); +} + diff --git a/languages/cpp/app_templates/kmake/app.desktop b/languages/cpp/app_templates/kmake/app.desktop new file mode 100644 index 00000000..7389904a --- /dev/null +++ b/languages/cpp/app_templates/kmake/app.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} %i -caption "%c" +Icon=%{APPNAMELC} +Type=Application +X-DocPath=%{APPNAMELC}/%{APPNAMELC}.html +Comment=A KDE KPart Application +Comment[br]=Ur meziant Kpart evit KDE +Comment[ca]=Una aplicació KPart per al KDE +Comment[cy]=Cymhwysiad KPart KDE +Comment[da]=Et KDE KPart-program +Comment[de]=Eine auf der Komponententechnik KPart basierende KDE-Anwendung +Comment[el]=Μια εφαρμογή KPart του KDE +Comment[es]=Una aplicación KPart de KDE +Comment[et]=KDE KPart rakendus +Comment[eu]=KDE KPart aplikazio bat +Comment[fa]=یک کاربرد KDE KPart +Comment[fr]=Une application KPart pour KDE +Comment[ga]=Feidhmchlár KPart KDE +Comment[gl]=Unha aplicación KPart de KDE +Comment[hi]=एक केडीई के-पार्ट अनुप्रयोग +Comment[hu]=KPart-alapú KDE-alkalmazás +Comment[is]=KDE KPart forrit +Comment[it]=Applicazione KPart di KDE +Comment[ja]=KDE KPart アプリケーション +Comment[lt]=KDE KPart programa +Comment[nds]=En KPart-Deelprogramm för KDE +Comment[ne]=एउटा केडीई KPart अनुप्रयोग +Comment[nl]=Een KDE KPart-toepassing +Comment[pl]=Osadzalny element KPart KDE +Comment[pt]=Uma Aplicação KPart do KDE +Comment[pt_BR]=Um Aplicativo KPart do KDE +Comment[ru]=Приложение KPart для KDE +Comment[sk]=KDE KPart aplikácia +Comment[sl]=Program KPart za KDE +Comment[sr]=KDE KPart програм +Comment[sr@Latn]=KDE KPart program +Comment[sv]=Ett KDE Kpart-program +Comment[ta]=கெடி கெபார்ட் பயன்பாடு +Comment[tg]=Ба кор андохтани KPart барои KDE +Comment[tr]=Bir KDE KPart Uygulaması +Comment[zh_CN]=一个 KDE KPart 应用程序 +Comment[zh_TW]=KDE KPart 應用程式 +Terminal=false diff --git a/languages/cpp/app_templates/kmake/app.kdevelop b/languages/cpp/app_templates/kmake/app.kdevelop new file mode 100644 index 00000000..aa290baa --- /dev/null +++ b/languages/cpp/app_templates/kmake/app.kdevelop @@ -0,0 +1,111 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + + + + /usr/bin/ + true + false + false + + + false + true + + + + + + ./bin/%{APPNAMELC} + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kmake/app.pro b/languages/cpp/app_templates/kmake/app.pro new file mode 100644 index 00000000..7dc1cc78 --- /dev/null +++ b/languages/cpp/app_templates/kmake/app.pro @@ -0,0 +1,7 @@ +# File generated by kdevelop's qmake manager. +# ------------------------------------------- +# Subdir relative project main directory: . +# Target is a subdirs project + +SUBDIRS += src +TEMPLATE=subdirs diff --git a/languages/cpp/app_templates/kmake/appui.rc b/languages/cpp/app_templates/kmake/appui.rc new file mode 100644 index 00000000..25884e61 --- /dev/null +++ b/languages/cpp/app_templates/kmake/appui.rc @@ -0,0 +1,3 @@ + + + diff --git a/languages/cpp/app_templates/kmake/kmake.kdevtemplate b/languages/cpp/app_templates/kmake/kmake.kdevtemplate new file mode 100644 index 00000000..3797d8e9 --- /dev/null +++ b/languages/cpp/app_templates/kmake/kmake.kdevtemplate @@ -0,0 +1,148 @@ +# KDE Config File +[General] +Name=QMake based KDE template +Name[ca]=Plantilla per al KDE basada en QMake +Name[da]=QMake baseret KDE-skabelon +Name[de]=Auf QMake basierende KDE-Vorlage +Name[el]=Πρότυπο KDE βασισμένο στο QMake +Name[es]=Plantilla para KDE basada en QMake +Name[et]=KDE mall QMake'i põhjal +Name[eu]=QMake-en oinarritutatko KDE txantiloia +Name[fa]=قالب KDE بر مبنای QMake +Name[fr]=Modèle KDE basé sur QMake +Name[ga]=Teimpléad KDE bunaithe ar QMake +Name[gl]=Modelo de KDE baseado en QMake +Name[hu]=QMake-alapú KDE-s sablon +Name[it]=Modello KDE basato su QMake +Name[ja]=QMake ベースの KDE テンプレート +Name[nds]=Op QMake opbuut KDE-Vörlaag +Name[ne]=QMake मा आधारित केडीई टेम्प्लेट +Name[nl]=Qmake-gebaseerde KDE-jabloon +Name[pl]=Oparty na QMake szablon dla KDE +Name[pt]=Modelo do KDE baseado no QMake +Name[pt_BR]=Modelo do KDE baseado no QMake +Name[ru]=Приложение KDE как проект QMake +Name[sk]=Šablóna KDE založená na QMake +Name[sr]=KDE шаблон на основи QMake-а +Name[sr@Latn]=KDE šablon na osnovi QMake-a +Name[sv]=QMake-baserad KDE-mall +Name[tr]=QMake tabanlı KDE şablonu +Name[zh_CN]=基于 QMake 的 KDE 模板 +Name[zh_TW]=QMake 為基礎的 KDE 樣本 +Icon=kmake.png +Category=C++/QMake project +Comment=Generates a simple KDE application using QMake based project manager +Comment[ca]=Genera una simple aplicació per al KDE usant un gestor de projectes basat en QMake +Comment[da]=Genererer et simpelt KDE program ved brug af QMake baseret projekthåndtering +Comment[de]=Erstellt eine einfache KDE-Anwendung unter Verwendung der QMake-Projektverwaltung +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE χρησιμοποιώντας το διαχειριστή έργου βασισμένο στο QMake +Comment[es]=Genera una sencilla aplicación para KDE que usa un gestor de proyecto basado en QMake +Comment[et]=Lihtsa KDE rakenduse loomine projektihalduriga QMake'i põhjal +Comment[eu]=KDE aplikazio sinple bat sortzen du QMake-en oinarritutako proiektu-kudeatzailea erabiliz +Comment[fa]=یک کاربرد سادۀ KDE، با استفاده از مدیر پروژۀ بر مبنای QMake تولید می‌کند +Comment[fr]=Génère une application KDE simple utilisant un gestionnaire de projet basé sur QMake +Comment[gl]=Xera unha aplicación KDE sinxela usando un xestor de proxectos baseado en QMake +Comment[hu]=Létrehoz egy egyszerű KDE-s alkalmazást Qmake-alapú projektkezelővel +Comment[it]=Genera una semplice applicazione KDE che usa QMake basata sul gestore di progetto +Comment[ja]=QMake ベースのプロジェクトマネージャを使って 簡単な KDE アプリケーションを作成します +Comment[nds]=Stellt mit den op QMake opbuut Projektpleger en eenfach KDE-Programm op +Comment[ne]=QMake आधारित परियोजना प्रबन्धक प्रयोग गरेर एउटा साधारण केडीई अनुप्रयोग उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudige KDE-toepassing met behulp van Qmake-gebaseerde projectmanager +Comment[pl]=Generuje prosty program KDE używający menedżera projektów QMake +Comment[pt]=Gera uma aplicação simples do KDE, usando o QMake como gestor de projectos +Comment[pt_BR]=Gera uma aplicação simples do KDE, usando o QMake como gestor de projectos +Comment[ru]=Создание простого приложения KDE как проекта QMake +Comment[sk]=Vygeneruje jednoduchú KDE aplikáciu založenú na QMake projektovom manažéri +Comment[sr]=Прави једноставан KDE програм помоћу менаџера пројекта на основи QMake-а +Comment[sr@Latn]=Pravi jednostavan KDE program pomoću menadžera projekta na osnovi QMake-a +Comment[sv]=Skapar ett enkelt KDE-program baserat på QMake projekthantering +Comment[tr]=QMake tabanlı proje yöneticisini kullanarak basit bir KDE uygulaması yaratır. +Comment[zh_CN]=使用基于 QMake的工程管理器生成一个简单的 KDE 应用程序 +Comment[zh_TW]=產生一個使用 QMake 專案管理員的簡單 KDE 應用程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=kmake.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE3] +Type=install +Source=%{src}/src.pro +Dest=%{dest}/src/src.pro + +[FILE4] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/mainviewimp.cpp +Dest=%{dest}/src/mainviewimp.cpp + +[FILE7] +Type=install +Source=%{src}/mainviewimp.h +Dest=%{dest}/src/mainviewimp.h + +[FILE8] +Type=install +EscapeXML=true +Source=%{src}/mainview.ui +Dest=%{dest}/src/mainview.ui + +[FILE9] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}.rc + +[FILE10] +Type=install +Source=%{src}/app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=A Qmake based KDE application was created in %{dest} +Comment[ca]=Una aplicació per al KDE basada en QMake ha estat creada en %{dest} +Comment[da]=Et Qmake baseret KDE program blev oprettet i %{dest} +Comment[de]=Eine auf Qmake basierende KDE-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή KDE βασισμένη στο Qmake δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para KDE basada en QMake ha sido creada en %{dest} +Comment[et]=KDE rakendus QMake'i põhjal loodi asukohta %{dest} +Comment[eu]=Qmake-en oinarritutako KDE aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد KDE بر مبنای Qmake در %{dest} ایجاد شد +Comment[fr]=Une application KDE basée sur QMake a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár KDE bunaithe ar Qmake i %{dest} +Comment[gl]=Creouse unha aplicación KDE baseada en QMake en %{dest} +Comment[hu]=Létrejött egy Qmake-alapú KDE-s alkalmazás itt: %{dest} +Comment[it]=È stata creata una semplice applicazione KDE basata su Qmake in %{dest} +Comment[ja]=QMake ベースの KDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op QMake opbuut KDE-Programm opstellt +Comment[ne]=Qmake आधारित केडीई अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Qmake-gebaseerde KDE-toepassing is aangemaakt in %{dest} +Comment[pl]=Program KDE oparty na QMake został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KDE baseada no Qmake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KDE baseada no Qmake em %{dest} +Comment[ru]=Приложение KDE как проект QMake создано в %{dest} +Comment[sk]=KDE aplikácia založená na QMake bola vytvorená v %{dest} +Comment[sr]=KDE програм на основу QMake-а направљен је у %{dest} +Comment[sr@Latn]=KDE program na osnovu QMake-a napravljen je u %{dest} +Comment[sv]=Ett Qmake-baserat KDE-program skapades i %{dest} +Comment[tr]=Bir QMake tabanlı KDE uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了基于 QMake 的 KDE 应用程序 +Comment[zh_TW]=一個以 Qmake 為基礎的 KDE 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kmake/kmake.png b/languages/cpp/app_templates/kmake/kmake.png new file mode 100644 index 00000000..913ebb87 Binary files /dev/null and b/languages/cpp/app_templates/kmake/kmake.png differ diff --git a/languages/cpp/app_templates/kmake/mainview.ui b/languages/cpp/app_templates/kmake/mainview.ui new file mode 100644 index 00000000..fea02def --- /dev/null +++ b/languages/cpp/app_templates/kmake/mainview.ui @@ -0,0 +1,76 @@ + +MainView + + + Form1 + + + + 0 + 0 + 124 + 90 + + + + + unnamed + + + + groupBox1 + + + + 5 + 5 + 0 + 1 + + + + Output + + + + unnamed + + + + helloLabel + + + + + + true + + + AlignCenter + + + + + + + helloButton + + + Hello + + + + + + + helloButton + clicked() + Form1 + slotHelloButtonClicked() + + + + slotHelloButtonClicked() + + + diff --git a/languages/cpp/app_templates/kmake/mainviewimp.cpp b/languages/cpp/app_templates/kmake/mainviewimp.cpp new file mode 100644 index 00000000..68cb262a --- /dev/null +++ b/languages/cpp/app_templates/kmake/mainviewimp.cpp @@ -0,0 +1,23 @@ + +#include "mainviewimp.h" +#include +#include + +MainViewImp::MainViewImp(QWidget* parent, const char* name, WFlags fl) +: MainView(parent,name,fl) +{ +} + +MainViewImp::~MainViewImp() +{ +} + +void MainViewImp::slotHelloButtonClicked() +{ + helloLabel->setText(i18n("Hello there.")); +} + + + + + diff --git a/languages/cpp/app_templates/kmake/mainviewimp.h b/languages/cpp/app_templates/kmake/mainviewimp.h new file mode 100644 index 00000000..51af1957 --- /dev/null +++ b/languages/cpp/app_templates/kmake/mainviewimp.h @@ -0,0 +1,19 @@ +#ifndef MAINVIEWIMP_H +#define MAINVIEWIMP_H + +#include "mainview.h" + +class MainViewImp : public MainView +{ + Q_OBJECT + +public: + MainViewImp(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MainViewImp(); + +public slots: + virtual void slotHelloButtonClicked(); +}; + +#endif + diff --git a/languages/cpp/app_templates/kmake/src.pro b/languages/cpp/app_templates/kmake/src.pro new file mode 100644 index 00000000..a27a6b13 --- /dev/null +++ b/languages/cpp/app_templates/kmake/src.pro @@ -0,0 +1,29 @@ +# File generated by kdevelop's qmake manager. +# ------------------------------------------- +# Subdir relative project main directory: ./src +# Target is an application: ../bin/%{APPNAMELC} +KDELIB=$$system(kde-config --expandvars --install lib) +KDEBIN=$$system(kde-config --expandvars --install exe) +KDEAPPS=$$system(kde-config --expandvars --install apps) +KDEPREFIX=$$system(kde-config --prefix) +KDEINCLUDE=$$KDEPREFIX/include/kde $$KDEPREFIX/include + +TEMPLATE = app + +INSTALLS += %{APPNAMELC}_rc \ + %{APPNAMELC}_desktop \ + target +target.path = $$KDEBIN +%{APPNAMELC}_desktop.files += *.desktop +%{APPNAMELC}_desktop.path = $$KDEAPPS/Utils +%{APPNAMELC}_rc.files += *.rc +%{APPNAMELC}_rc.path = $$KDEAPPDATA/%{APPNAMELC} +FORMS += mainview.ui +HEADERS += mainviewimp.h +SOURCES += %{APPNAMELC}.cpp mainviewimp.cpp +LIBS += -lkdeui -lkdecore +INCLUDEPATH = $$KDEINCLUDE +QMAKE_LIBDIR = $$KDELIB +TARGET = %{APPNAMELC} +DESTDIR = ../bin +CONFIG += release warn_on diff --git a/languages/cpp/app_templates/kmod/.kdev_ignore b/languages/cpp/app_templates/kmod/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kmod/Makefile.am b/languages/cpp/app_templates/kmod/Makefile.am new file mode 100644 index 00000000..76afcd5a --- /dev/null +++ b/languages/cpp/app_templates/kmod/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = src-Makefile kmod.kdevelop kmod-driver.c + +templateName = kmod + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kmod/kmod-driver.c b/languages/cpp/app_templates/kmod/kmod-driver.c new file mode 100644 index 00000000..5ddc7ce6 --- /dev/null +++ b/languages/cpp/app_templates/kmod/kmod-driver.c @@ -0,0 +1,22 @@ + +#include +#include +#include + +MODULE_DESCRIPTION("My kernel module"); +MODULE_AUTHOR("%{AUTHOR} (%{EMAIL})"); +MODULE_LICENSE("$LICENSE$"); + +static int %{APPNAMELC}_init_module(void) +{ + printk( KERN_DEBUG "Module %{APPNAME} init\n" ); + return 0; +} + +static void %{APPNAMELC}_exit_module(void) +{ + printk( KERN_DEBUG "Module %{APPNAME} exit\n" ); +} + +module_init(%{APPNAMELC}_init_module); +module_exit(%{APPNAMELC}_exit_module); diff --git a/languages/cpp/app_templates/kmod/kmod.kdevelop b/languages/cpp/app_templates/kmod/kmod.kdevelop new file mode 100644 index 00000000..93c6c0f4 --- /dev/null +++ b/languages/cpp/app_templates/kmod/kmod.kdevelop @@ -0,0 +1,93 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevCustomProject + C + + KDevDebugger + + + C + Linux + Kernel + + + + + + + + + + + + make + + + + true + 1 + false + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kmod/kmod.kdevtemplate b/languages/cpp/app_templates/kmod/kmod.kdevtemplate new file mode 100644 index 00000000..03a335cd --- /dev/null +++ b/languages/cpp/app_templates/kmod/kmod.kdevtemplate @@ -0,0 +1,89 @@ +# KDE Config File +[General] +Name=Linux Kernel module +Name[br]=Mollad ar galon Linux +Name[ca]=Mòdul del nucli Linux +Name[da]=Linux kernemodul +Name[de]=Linux-Kernelmodul +Name[el]=Άρθρωμα πυρήνα Linux +Name[es]=Módulo para el núcleo de Linux +Name[et]=Linuxi kerneli moodul +Name[eu]=Linux Kernel modulua +Name[fa]=پیمانۀ هستۀ لینوکس +Name[fr]=Module de noyau Linux +Name[ga]=Modúl Eithne Linux +Name[gl]=Módulo para o kernel Linux +Name[hu]=Linuxos kernelmodul +Name[it]=Modulo del kernel Linux +Name[ja]=Linux カーネルモジュール +Name[nds]=Linux-Kernelmoduul +Name[ne]=लिनक्स कर्नेल मोड्युल +Name[nl]=Linux kernelmodule +Name[pl]=Moduł jądra Linuksa +Name[pt]=Módulo do 'kernel' do Linux +Name[pt_BR]=Módulo do 'kernel' do Linux +Name[ru]=Драйвер ядра Linux +Name[sk]=Linux kernel modul +Name[sr]=Модул језгра Linux-а +Name[sr@Latn]=Modul jezgra Linux-a +Name[sv]=Modul för Linux kärna +Name[tr]=Linux Çekirdek Birimi +Name[zh_CN]=Linux 内核模块 +Name[zh_TW]=Linux 核心模組 +Icon= +Category=C +Comment=Generates a template for a Linux kernel module. +Comment[ca]=Genera una plantilla per a un mòdul del nucli Linux. +Comment[da]=Genererer en skabelon for en Linux kernemodul. +Comment[de]=Erstellt eine Vorlage für ein Linux-Kernelmodul. +Comment[el]=Δημιουργεί ένα πρότυπο για ένα άρθρωμα του πυρήνα του Linux. +Comment[es]=Genera una plantilla para un módulo del núcleo de Linux. +Comment[et]=Linuxi kerneli mooduli malli loomine. +Comment[eu]=Linux kernel modulu batentzat txantiloi bat sortzen du. +Comment[fa]=قالبی برای پیمانۀ هستۀ لینوکس تولید می‌کند +Comment[fr]=Génère un modèle pour un module de noyau Linux. +Comment[gl]=Xera unha modelo dun módulo para o kernel Linux. +Comment[hu]=Létrehoz egy sablont linuxos kernelmodul készítéséhez. +Comment[it]=Genera un modello per un modulo del kernel Linux kernel. +Comment[ja]=Linux カーネルモジュール用のテンプレートを作成します +Comment[nds]=Stellt en Vörlaag för en Linux-Kernelmoduul op. +Comment[ne]=लिनक्स कर्नेल मोड्युलका लागि टेम्प्लेट उत्पन्न गर्दछ +Comment[nl]=Genereert een sjabloon voor een Linux kernelmodule +Comment[pl]=Generuje szablon dla modułu jądra Linuksa. +Comment[pt]=Gera um modelo para um módulo do 'kernel' do Linux. +Comment[pt_BR]=Gera um modelo para um módulo do 'kernel' do Linux. +Comment[ru]=Создание драйвера ядра Linux. +Comment[sk]=Vygeneruje šablónu pre Linux kernel modul +Comment[sr]=Прави шаблон за модул језгра Linux-а. +Comment[sr@Latn]=Pravi šablon za modul jezgra Linux-a. +Comment[sv]=Skapar en mall för en modul i Linux kärna. +Comment[tr]=Bir Linux çekirdek birimi için bir şablon yaratır. +Comment[zh_CN]=生成一个 Linux 内核模块的模板。 +Comment[zh_TW]=產生一個 Linux 核心模組的樣本 +FileTemplates=h,CStyle,c,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}-driver.c +Archive=kmod.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/kmod.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/src-Makefile +Dest=%{dest}/Makefile + +[FILE3] +Type=install +Source=%{src}/kmod-driver.c +Dest=%{dest}/%{APPNAMELC}-driver.c + +[MSG] +Type=message +Command=A linux kernel module was created in %{dest} diff --git a/languages/cpp/app_templates/kmod/kmod.png b/languages/cpp/app_templates/kmod/kmod.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/kmod/kmod.png differ diff --git a/languages/cpp/app_templates/kmod/src-Makefile b/languages/cpp/app_templates/kmod/src-Makefile new file mode 100644 index 00000000..92a2b461 --- /dev/null +++ b/languages/cpp/app_templates/kmod/src-Makefile @@ -0,0 +1,30 @@ +TARGET = %{APPNAMELC}-driver +OBJS = %{APPNAMELC}-driver.o +MDIR = drivers/misc + +EXTRA_CFLAGS = -DEXPORT_SYMTAB +CURRENT = $(shell uname -r) +KDIR = /lib/modules/$(CURRENT)/build +PWD = $(shell pwd) +DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR) + +obj-m := $(TARGET).o + +default: + make -C $(KDIR) SUBDIRS=$(PWD) modules + +$(TARGET).o: $(OBJS) + $(LD) $(LD_RFLAG) -r -o $@ $(OBJS) + +ifneq (,$(findstring 2.4.,$(CURRENT))) +install: + su -c "cp -v $(TARGET).o $(DEST) && /sbin/depmod -a" +else +install: + su -c "cp -v $(TARGET).ko $(DEST) && /sbin/depmod -a" +endif + +clean: + -rm -f *.o *.ko .*.cmd .*.flags *.mod.c + +-include $(KDIR)/Rules.make diff --git a/languages/cpp/app_templates/kofficepart/.kdev_ignore b/languages/cpp/app_templates/kofficepart/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kofficepart/Makefile.am b/languages/cpp/app_templates/kofficepart/Makefile.am new file mode 100644 index 00000000..96280d88 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = kopart.kdevelop kopart_aboutdata.h kopart_part.cpp kopart_view.h \ + src-Makefile.am kopart.png kopart_factory.cpp kopart_part.h \ + subdirs kopart.desktop kopart.rc kopart_factory.h \ + kopart_view.cpp x-kopart.desktop kde-configure.in.in \ + main.cpp + +templateName = kopart + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kofficepart/kde-configure.in.in b/languages/cpp/app_templates/kofficepart/kde-configure.in.in new file mode 100644 index 00000000..ec8e8bea --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kde-configure.in.in @@ -0,0 +1,42 @@ +#MIN_CONFIG + +AM_INIT_AUTOMAKE(kotest, 0.1) + +AC_CHECK_HEADERS(unistd.h sys/param.h floatingpoint.h paths.h) +KDE_CHECK_KIMGIO +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +dnl AC_DEFINE(USE_QFD, 1, [Define if you prefer the Qt provided file dialog]) +KWMF_INCLUDES='-I$(KDEDIR)/lib/kwmf -I$(KDEDIR)/lib/kwmf' +AC_SUBST(KWMF_INCLUDES) + +KSTORE_INCLUDES='-I$(KDEDIR)/include' +AC_SUBST(KSTORE_INCLUDES) + +KOFFICECORE_INCLUDES='-I$(KDEDIR)/include' +AC_SUBST(KOFFICECORE_INCLUDES) + +KOFFICEUI_INCLUDES='-I$(KDEDIR)/include' +AC_SUBST(KOFFICEUI_INCLUDES) + +LIB_KOFFICEUI='$(KDEDIR)/lib/libkofficeui.la' +LIB_KOFFICECORE='$(KDEDIR)/lib/libkofficecore.la' +LIB_KSTORE='$(KDEDIR)/lib/libkstore.la' +LIB_KWMF='$(KDEDIR)/lib/libkwmf.la' +AC_SUBST(LIB_KOFFICEUI) +AC_SUBST(LIB_KOFFICECORE) +AC_SUBST(LIB_KSTORE) +AC_SUBST(LIB_KWMF) + +KOFFICE_LIBS='$(LIB_KOFFICEUI) $(LIB_KOFFICECORE) $(LIB_KSTORE)' +AC_SUBST(KOFFICE_LIBS) + +KOFFICE_INCLUDES='$(KOFFICEUI_INCLUDES) $(KOFFICECORE_INCLUDES) $(KSTORE_INCLUDES) $(KWMF_INCLUDES)' +AC_SUBST(KOFFICE_INCLUDES) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS(streambuf streambuf.h) +AC_LANG_RESTORE + diff --git a/languages/cpp/app_templates/kofficepart/kopart.desktop b/languages/cpp/app_templates/kofficepart/kopart.desktop new file mode 100644 index 00000000..8b2be99e --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +X-KDE-Library=lib%{APPNAMELC}part +MimeType=application/x-%{APPNAMELC}; +Type=Application +Icon=%{APPNAMELC} +ServiceTypes=KOfficePart,KParts/ReadOnlyPart,KParts/ReadWritePart +X-KDE-NativeMimeType=application/x-%{APPNAMELC} diff --git a/languages/cpp/app_templates/kofficepart/kopart.kdevelop b/languages/cpp/app_templates/kofficepart/kopart.kdevelop new file mode 100644 index 00000000..bf70fc63 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + kioslave + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}part.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kofficepart/kopart.kdevtemplate b/languages/cpp/app_templates/kofficepart/kopart.kdevtemplate new file mode 100644 index 00000000..9d5ecba4 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.kdevtemplate @@ -0,0 +1,231 @@ +# KDE Config File +[General] +Name=KOffice Part +Name[br]=Perzh KOffice +Name[ca]=Part per a KOffice +Name[da]=KOffice part +Name[de]=KOffice-Komponente +Name[el]=Τμήμα KOffice +Name[es]=Part de KOffice +Name[et]=KOffice'i komponent +Name[eu]=KOffice zatia +Name[fa]=جزء KOffice +Name[fr]=Composant KOffice +Name[ga]=Páirt KOffice +Name[gl]='Part' para KOffice +Name[hu]=KOffice-objektum +Name[it]=Part di KOffice +Name[nds]=KOffice-Komponent +Name[ne]=केडीई अफिस भाग +Name[nl]=Koffice-part +Name[pt]=Componente do KOffice +Name[pt_BR]=Componente do KOffice +Name[ru]=Приложение KOffice +Name[sr]=KOffice део +Name[sr@Latn]=KOffice deo +Name[sv]=Koffice-delprogram +Name[tr]=KOffice Bileşeni +Name[zh_CN]=KOffice 部件 +Name[zh_TW]=KOffice 元件 +Icon=kopart.png +Category=C++/KDE +Comment=Generates a framework for a full KOffice Application. +Comment[ca]=Genera una infraestructura per a una completa aplicació de KOffice. +Comment[da]=Genererer et skelet for et fuldstændigt KOffice-program. +Comment[de]=Erstellt ein Grundgerüst für eine vollwertige KOffice-Anwendung +Comment[el]=Δημιουργεί ένα πλαίσιο για μια πλήρης εφαρμογή του KOffice. +Comment[es]=Genera una infraestructura para una aplicación completa de KOffice. +Comment[et]=KOffice'i rakenduse raamistiku loomine. +Comment[eu]=KOffice-en aplikazio batentzat lan-marko oso bat sortzen du. +Comment[fa]=چارچوبی را برای کاربرد کامل KOffice تولید می‌کند. +Comment[fr]=Génère une infrastructure pour une application KOffice complète. +Comment[gl]=Xera un contorno de traballo para unha aplicación KOffice completa. +Comment[hu]=Létrehoz egy kiindulási keretprogramot teljes KOffice-alkalmazás készítéséhez. +Comment[it]=Genera l'infrastruttura per un'applicazione completa di KOffice. +Comment[nds]=Stellt dat Rahmenwark för en heel KOffice-Programm op. +Comment[ne]=पूर्ण केडीई अफिस अनुप्रयोगका लागि फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Genereert een framework voor een volledige KOffice-toepassing +Comment[pl]=Generuje szablon pełnego programu KOffice. +Comment[pt]=Gera a plataforma para uma aplicação completa do KOffice. +Comment[pt_BR]=Gera a plataforma para uma aplicação completa do KOffice. +Comment[ru]=Создание приложения KOffice. +Comment[sk]=Vygeneruje framework pre kompletnú aplikáciu KOffice. +Comment[sl]=Ustvari ogrodje za poln program KOffice +Comment[sr]=Прави радни оквир за пуни KOffice програм. +Comment[sr@Latn]=Pravi radni okvir za puni KOffice program. +Comment[sv]=Skapar ett ramverk för ett fullständigt Koffice-program. +Comment[tr]=Tam bir KOffice Uygulaması için bir çatı yaratır. +Comment[zh_CN]=生成一个全功能的 KOffice 应用程序框架。 +Comment[zh_TW]=產生一個完整的 KOffice 應用程式的框架 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}_part.cpp +Archive=kopart.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/kopart.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{src}/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/kopart_view.cpp +Dest=%{dest}/src/%{APPNAMELC}_view.cpp + +[FILE13] +Type=install +Source=%{src}/kopart_view.h +Dest=%{dest}/src/%{APPNAMELC}_view.h + +[FILE14] +Type=install +Source=%{src}/kopart_part.cpp +Dest=%{dest}/src/%{APPNAMELC}_part.cpp + +[FILE15] +Type=install +Source=%{src}/kopart_part.h +Dest=%{dest}/src/%{APPNAMELC}_part.h + +[FILE16] +Type=install +Source=%{src}/kopart_factory.cpp +Dest=%{dest}/src/%{APPNAMELC}_factory.cpp + +[FILE17] +Type=install +Source=%{src}/kopart_factory.h +Dest=%{dest}/src/%{APPNAMELC}_factory.h + +[FILE18] +Type=install +Source=%{src}/kopart_aboutdata.h +Dest=%{dest}/src/%{APPNAMELC}_aboutdata.h + +[FILE19] +Type=install +EscapeXML=true +Source=%{src}/kopart.rc +Dest=%{dest}/src/%{APPNAMELC}.rc + +[FILE20] +Type=install +Source=%{src}/kopart.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE21] +Type=install +Source=%{src}/x-kopart.desktop +Dest=%{dest}/src/x-%{APPNAMELC}.desktop + +[FILE22] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=A KOffice part was created in %{dest} +Comment[ca]=Una part per a KOffice ha estat creada en %{dest} +Comment[da]=En KOffice part blev oprettet i %{dest} +Comment[de]=Eine KOffice-Komponente wurde in %{dest} erstellt. +Comment[el]=Ένα τμήμα του KOffice δημιουργήθηκε στο %{dest} +Comment[es]=Un Part de KOffice ha sido creado en %{dest} +Comment[et]=KOffice'i komponent loodi asukohta %{dest} +Comment[eu]=KOffice zati bat sortu da hemen: %{dest} +Comment[fa]=یک جزء KOffice در %{dest} ایجاد شد +Comment[fr]=Un composant KOffice a été créé dans %{dest} +Comment[ga]=Cruthaíodh páirt KDE i %{dest} +Comment[gl]=Creouse unha 'part' para KOffice en %{dest} +Comment[hu]=Létrejött egy KOffice-objektum itt: %{dest} +Comment[it]=È stata creata una part di KOffice in %{dest} +Comment[ja]=KOffice パートを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KOffice-Komponent opstellt +Comment[ne]=केडीई अफिस भाग %{dest} मा सिर्जना गरियो +Comment[nl]=Een KOffice-part is aangemaakt in %{dest} +Comment[pl]=KOffice part została utworzona w %{dest} +Comment[pt]=Foi criado um componente do KOffice em %{dest} +Comment[pt_BR]=Foi criado um componente do KOffice em %{dest} +Comment[ru]=Приложение KOffice создано в %{dest} +Comment[sk]=KOffice Part bol vytvorený v %{dest} +Comment[sr]=KOffice део је направљен у %{dest} +Comment[sr@Latn]=KOffice deo je napravljen u %{dest} +Comment[sv]=Ett Koffice-delprogram skapades i %{dest} +Comment[tr]=Bir KOffice bileşeni %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 KOffice 部件 +Comment[zh_TW]=一個 KOffice 元件已建立於 %{dest} diff --git a/languages/cpp/app_templates/kofficepart/kopart.png b/languages/cpp/app_templates/kofficepart/kopart.png new file mode 100644 index 00000000..fa45e5c3 Binary files /dev/null and b/languages/cpp/app_templates/kofficepart/kopart.png differ diff --git a/languages/cpp/app_templates/kofficepart/kopart.rc b/languages/cpp/app_templates/kofficepart/kopart.rc new file mode 100644 index 00000000..d03230ec --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart.rc @@ -0,0 +1,10 @@ + + + Edit + + + +Edit + + + diff --git a/languages/cpp/app_templates/kofficepart/kopart_aboutdata.h b/languages/cpp/app_templates/kofficepart/kopart_aboutdata.h new file mode 100644 index 00000000..ab66d088 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_aboutdata.h @@ -0,0 +1,24 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_ABOUTDATA +#define %{APPNAME}_ABOUTDATA + +#include +#include + +static const char description[] = I18N_NOOP("%{APPNAME} KOffice Program"); +static const char version[] = "%{VERSION}"; + +KAboutData * new%{APPNAME}AboutData() +{ + KAboutData * aboutData=new KAboutData( "%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), + version, description, KAboutData::License_%{LICENSE}, + "(c) %{YEAR}, %{AUTHOR}"); + aboutData->addAuthor("%{AUTHOR}",0, "%{EMAIL}"); + return aboutData; +} + +#endif diff --git a/languages/cpp/app_templates/kofficepart/kopart_factory.cpp b/languages/cpp/app_templates/kofficepart/kopart_factory.cpp new file mode 100644 index 00000000..bd79c317 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_factory.cpp @@ -0,0 +1,76 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ +#include <%{APPNAMELC}_factory.h> +#include <%{APPNAMELC}_part.h> +#include <%{APPNAMELC}_aboutdata.h> +#include +#include +#include +#include +#include + +extern "C" +{ + void* init_lib%{APPNAMELC}part() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}Factory; + } +}; + +KInstance* %{APPNAME}Factory::s_global = 0L; +KAboutData* %{APPNAME}Factory::s_aboutData = 0L; + +%{APPNAME}Factory::%{APPNAME}Factory( QObject* parent, const char* name ) + : KoFactory( parent, name ) +{ + global(); +} + +%{APPNAME}Factory::~%{APPNAME}Factory() +{ + delete s_aboutData; + s_aboutData = 0L; + delete s_global; + s_global = 0L; +} + +KParts::Part* %{APPNAME}Factory::createPartObject( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, const char* classname, const QStringList & ) +{ + // If classname is "KoDocument", our host is a koffice application + // otherwise, the host wants us as a simple part, so switch to readonly and single view. + bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 ); + + // parentWidget and widgetName are used by KoDocument for the "readonly+singleView" case. + %{APPNAME}Part *part = new %{APPNAME}Part( parentWidget, widgetName, parent, name, !bWantKoDocument ); + + if ( !bWantKoDocument ) + part->setReadWrite( false ); + + return part; +} + +KAboutData* %{APPNAME}Factory::aboutData() +{ + if ( !s_aboutData ) + // Change this, of course + s_aboutData = new%{APPNAME}AboutData(); + return s_aboutData; +} + +KInstance* %{APPNAME}Factory::global() +{ + if ( !s_global ) + { + s_global = new KInstance( aboutData() ); + // Add any application-specific resource directories here + + // Tell the iconloader about share/apps/koffice/icons + s_global->iconLoader()->addAppDir("koffice"); + } + return s_global; +} + +#include <%{APPNAMELC}_factory.moc> diff --git a/languages/cpp/app_templates/kofficepart/kopart_factory.h b/languages/cpp/app_templates/kofficepart/kopart_factory.h new file mode 100644 index 00000000..45f1f649 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_factory.h @@ -0,0 +1,33 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_FACTORY_H +#define %{APPNAME}_FACTORY_H + +#include + +class KInstance; +class KAboutData; + +class %{APPNAME}Factory : public KoFactory +{ + Q_OBJECT +public: + %{APPNAME}Factory( QObject* parent = 0, const char* name = 0 ); + ~%{APPNAME}Factory(); + + virtual KParts::Part *createPartObject( QWidget *parentWidget = 0, const char *widgetName = 0, QObject *parent = 0, const char *name = 0, const char *classname = "KoDocument", const QStringList &args = QStringList() ); + + static KInstance* global(); + + // _Creates_ a KAboutData but doesn't keep ownership + static KAboutData* aboutData(); + +private: + static KInstance* s_global; + static KAboutData* s_aboutData; +}; + +#endif diff --git a/languages/cpp/app_templates/kofficepart/kopart_part.cpp b/languages/cpp/app_templates/kofficepart/kopart_part.cpp new file mode 100644 index 00000000..500179f3 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_part.cpp @@ -0,0 +1,69 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#include "%{APPNAMELC}_part.h" +#include "%{APPNAMELC}_view.h" + +#include + +%{APPNAME}Part::%{APPNAME}Part( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, bool singleViewMode ) + : KoDocument( parentWidget, widgetName, parent, name, singleViewMode ) +{ +} + +bool %{APPNAME}Part::initDoc( InitDocFlags flags, QWidget* parentWidget ) +{ + // If nothing is loaded, do initialize here + return TRUE; +} + +KoView* %{APPNAME}Part::createViewInstance( QWidget* parent, const char* name ) +{ + return new %{APPNAME}View( this, parent, name ); +} + +bool %{APPNAME}Part::loadOasis( const QDomDocument & doc, KoOasisStyles& oasisStyles, const QDomDocument & settings, KoStore* store ) +{ + /// @todo load the document using the OASIS format + return true; +} + +bool %{APPNAME}Part::loadXML( QIODevice *, const QDomDocument & ) +{ + /// @todo load the document from the QDomDocument + return true; +} + +QDomDocument %{APPNAME}Part::saveXML() +{ + /// @todo save the document into a QDomDocument + return QDomDocument(); +} + +bool %{APPNAME}Part::saveOasis( KoStore* store, KoXmlWriter* manifestWriter ) +{ + /// @todo save the document using the OASIS format + return true; +} + + +void %{APPNAME}Part::paintContent( QPainter& painter, const QRect& rect, bool /*transparent*/, + double /*zoomX*/, double /*zoomY*/ ) +{ + // ####### handle transparency + + // Need to draw only the document rectangle described in the parameter rect. + int left = rect.left() / 20; + int right = rect.right() / 20 + 1; + int top = rect.top() / 20; + int bottom = rect.bottom() / 20 + 1; + + for( int x = left; x < right; ++x ) + painter.drawLine( x * 20, top * 20, x * 20, bottom * 20 ); + for( int y = left; y < right; ++y ) + painter.drawLine( left * 20, y * 20, right * 20, y * 20 ); +} + +#include "%{APPNAMELC}_part.moc" diff --git a/languages/cpp/app_templates/kofficepart/kopart_part.h b/languages/cpp/app_templates/kofficepart/kopart_part.h new file mode 100644 index 00000000..03361ca7 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_part.h @@ -0,0 +1,30 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_PART_H +#define %{APPNAME}_PART_H + +#include + +class %{APPNAME}Part : public KoDocument +{ + Q_OBJECT +public: + %{APPNAME}Part( QWidget *parentWidget = 0, const char *widgetName = 0, QObject* parent = 0, const char* name = 0, bool singleViewMode = false ); + + virtual void paintContent( QPainter& painter, const QRect& rect, bool transparent = FALSE, double zoomX = 1.0, double zoomY = 1.0 ); + + virtual bool initDoc( InitDocFlags flags, QWidget* parentWidget = 0 ); + + virtual bool loadOasis( const QDomDocument & doc, KoOasisStyles& oasisStyles, const QDomDocument & settings, KoStore* store ); + virtual bool loadXML( QIODevice *, const QDomDocument & ); + virtual QDomDocument saveXML(); + virtual bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter ); + +protected: + virtual KoView* createViewInstance( QWidget* parent, const char* name ); +}; + +#endif diff --git a/languages/cpp/app_templates/kofficepart/kopart_view.cpp b/languages/cpp/app_templates/kofficepart/kopart_view.cpp new file mode 100644 index 00000000..28c0b42f --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_view.cpp @@ -0,0 +1,52 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ +#include "%{APPNAMELC}_view.h" +#include "%{APPNAMELC}_factory.h" +#include "%{APPNAMELC}_part.h" + +#include +#include +#include +#include +#include +#include + +%{APPNAME}View::%{APPNAME}View( %{APPNAME}Part* part, QWidget* parent, const char* name ) + : KoView( part, parent, name ) +{ + setInstance( %{APPNAME}Factory::global() ); + setXMLFile( "%{APPNAMELC}.rc" ); + KStdAction::cut(this, SLOT( cut() ), actionCollection(), "cut" ); + // Note: Prefer KStdAction::* to any custom action if possible. + //m_cut = new KAction( i18n("&Cut"), "editcut", 0, this, SLOT( cut() ), + // actionCollection(), "cut"); +} + +void %{APPNAME}View::paintEvent( QPaintEvent* ev ) +{ + QPainter painter; + painter.begin( this ); + + /// @todo Scaling + + // Let the document do the drawing + koDocument()->paintEverything( painter, ev->rect(), FALSE, this ); + + painter.end(); +} + +void %{APPNAME}View::updateReadWrite( bool /*readwrite*/ ) +{ +#ifdef __GNUC__ +#warning TODO +#endif +} + +void %{APPNAME}View::cut() +{ + kdDebug(31000) << "%{APPNAME}View::cut(): CUT called" << endl; +} + +#include "%{APPNAMELC}_view.moc" diff --git a/languages/cpp/app_templates/kofficepart/kopart_view.h b/languages/cpp/app_templates/kofficepart/kopart_view.h new file mode 100644 index 00000000..eb14763f --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/kopart_view.h @@ -0,0 +1,34 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#ifndef %{APPNAME}_VIEW +#define %{APPNAME}_VIEW + +#include + +class KAction; +class QPaintEvent; + +class %{APPNAME}Part; + +class %{APPNAME}View : public KoView +{ + Q_OBJECT +public: + %{APPNAME}View( %{APPNAME}Part* part, QWidget* parent = 0, const char* name = 0 ); + +protected slots: + void cut(); + +protected: + void paintEvent( QPaintEvent* ); + + virtual void updateReadWrite( bool readwrite ); + +private: + //KAction* m_cut; +}; + +#endif diff --git a/languages/cpp/app_templates/kofficepart/main.cpp b/languages/cpp/app_templates/kofficepart/main.cpp new file mode 100644 index 00000000..1561922a --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/main.cpp @@ -0,0 +1,33 @@ + +/* This template is based off of the KOffice example written by Torben Weis +*/ + +#include +#include +#include +#include +#include +#include +#include "%{APPNAMELC}_aboutdata.h" + + +static const KCmdLineOptions options[]= +{ + {"+[file]", I18N_NOOP("File to open"),0}, + KCmdLineLastOption +}; + +int main( int argc, char **argv ) +{ + KCmdLineArgs::init( argc, argv, new%{APPNAME}AboutData() ); + KCmdLineArgs::addCmdLineOptions( options ); + KoApplication app; + + app.dcopClient()->attach(); + app.dcopClient()->registerAs( "%{APPNAMELC}" ); + + if (!app.start()) // parses command line args, create initial docs and shells + return 1; + return app.exec(); +} diff --git a/languages/cpp/app_templates/kofficepart/src-Makefile.am b/languages/cpp/app_templates/kofficepart/src-Makefile.am new file mode 100644 index 00000000..19d38267 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/src-Makefile.am @@ -0,0 +1,41 @@ + +INCLUDES = $(KOFFICE_INCLUDES) $(all_includes) + +## The part +kde_module_LTLIBRARIES = lib%{APPNAMELC}part.la +lib%{APPNAMELC}part_la_SOURCES = %{APPNAMELC}_part.cpp \ + %{APPNAMELC}_view.cpp %{APPNAMELC}_factory.cpp +lib%{APPNAMELC}part_la_LDFLAGS = $(KDE_PLUGIN) +lib%{APPNAMELC}part_la_LIBADD = -lkofficeui + +## The kdeinit loadable module +lib_LTLIBRARIES = %{APPNAMELC}.la +%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp +%{APPNAMELC}_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +%{APPNAMELC}_la_LIBADD = -lkofficecore + +## The executable +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = dummy.cpp +%{APPNAMELC}_LDFLAGS = $(all_libraries) $(KDE_RPATH) +%{APPNAMELC}_LDADD = %{APPNAMELC}.la + +dummy.cpp: + echo > dummy.cpp + +METASOURCES = AUTO +noinst_HEADERS = %{APPNAMELC}_part.h \ + %{APPNAMELC}_view.h %{APPNAMELC}_factory.h %{APPNAMELC}_aboutdata.h + +kdelnk_DATA = %{APPNAMELC}.desktop +kdelnkdir = $(kde_appsdir)/Office + +kdemime_DATA = x-%{APPNAMELC}.desktop +kdemimedir = $(kde_mimedir)/application + +rc_DATA = %{APPNAMELC}.rc +rcdir = $(kde_datadir)/%{APPNAMELC} + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp %{APPNAMELC}_aboutdata.h -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kofficepart/subdirs b/languages/cpp/app_templates/kofficepart/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kofficepart/x-kopart.desktop b/languages/cpp/app_templates/kofficepart/x-kopart.desktop new file mode 100644 index 00000000..f4e15e79 --- /dev/null +++ b/languages/cpp/app_templates/kofficepart/x-kopart.desktop @@ -0,0 +1,40 @@ +# KDE Config File +[Desktop Entry] +MimeType=application/x-%{APPNAMELC} +Comment= A really awesome KOffice application +Comment[ca]=Una aplicació de KOffice realment interessant +Comment[da]=Et helt fantastisk KOffice program +Comment[de]=Eine wirklich großartige KOffice-Anwendung +Comment[el]= Μια πραγματικά όμορφη εφαρμογή KOffice +Comment[es]=Una aplicación de KOffice realmente intesesante +Comment[et]=Tõesti imeline KOffice'i rakendus +Comment[eu]=KOffice aplikazio harrigarri bat +Comment[fa]=کاربرد واقعاً بیمناک KOffice +Comment[fr]=Une application pour KOffice vraiment superbe +Comment[ga]= Feidhmchlár sármhaith KOffice +Comment[gl]=Unha aplicación de KOffice realmente impresionante +Comment[hu]=Egy bámulatos KOffice-alkalmazás +Comment[it]=Un'applicazione di KOffice veramente bella +Comment[nds]=En redig deegt KOffice-Programm +Comment[ne]= वास्तवमै प्रभावकारी केडीई अफिस अनुप्रयोग +Comment[nl]=Een fantastische KOffice-toepassing +Comment[pl]=Wspaniały program KOffice +Comment[pt]=Uma aplicação fantástica para o KOffice +Comment[pt_BR]=Um aplicativo realmente do tipo do KOffice +Comment[ru]=Приложение KOffice +Comment[sk]=Naozaj hrozná KOffice aplikácia +Comment[sl]=Sijajen program za KOffice +Comment[sr]=Стварно сјајан KOffice програм +Comment[sr@Latn]=Stvarno sjajan KOffice program +Comment[sv]=Ett riktigt suveränt Koffice-program +Comment[tr]=Gerçekten harika bir KOffice uygulaması +Comment[zh_CN]=一个非常杰出的 KOffice 应用程序 +Comment[zh_TW]=一個十分完美的 KOffice 應用程式 +Type=MimeType +#You need to change the mime type below to match what your application will handle... +Patterns=*.xmpl; +X-KDE-AutoEmbed=false +[Property::X-KDE-NativeExtension] +Type=QString +#You need to change the mime type below to match what your application will handle... +Value=.xmpl diff --git a/languages/cpp/app_templates/konqnavpanel/.kdev_ignore b/languages/cpp/app_templates/konqnavpanel/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/konqnavpanel/Makefile.am b/languages/cpp/app_templates/konqnavpanel/Makefile.am new file mode 100644 index 00000000..7a3ae56b --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = konqnavpanel.cpp konqnavpanel.h konqnavpanel.desktop \ + konqnavpanel.kdevelop src-Makefile.am \ + konqnavpanel.png subdirs +templateName = konqnavpanel + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/konqnavpanel/konqnavpanel.cpp b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.cpp new file mode 100644 index 00000000..34515ce2 --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.cpp @@ -0,0 +1,34 @@ + +#include +#include +#include +#include + +#include "%{APPNAMELC}.h" +#include "%{APPNAMELC}.moc" + +%{APPNAME}::%{APPNAME}(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName, const char* name): + KonqSidebarPlugin(inst,parent,widgetParent,desktopName,name) +{ + widget=new QLabel("Init Value",widgetParent); +} + + +%{APPNAME}::~%{APPNAME}() +{ +} + +void %{APPNAME}::handleURL(const KURL &url) +{ + widget->setText(QString("%{APPNAME}")+"::"+url.url()); +} + + + +extern "C" +{ + void* create_konqsidebar_%{APPNAME}(KInstance *instance,QObject *par,QWidget *widp,QString &desktopname,const char *name) + { + return new %{APPNAME}(instance,par,widp,desktopname,name); + } +}; diff --git a/languages/cpp/app_templates/konqnavpanel/konqnavpanel.desktop b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.desktop new file mode 100644 index 00000000..31e23a1a --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.desktop @@ -0,0 +1,39 @@ +[Desktop Entry] +Type=Link +URL= +Icon=wizard +Comment=A konqueror navigation panel plugin called $NAME$ +Comment[ca]=Un connector per al plafó de navegació de Konqueror anomenat $NAME$ +Comment[da]=Et Konqueror navigationspanel plugin der hedder $NAME$ +Comment[de]=Ein Modul für den Navigationsbereich von Konqueror mit Namen $NAME$ +Comment[el]=Ένα πρόσθετο του πίνακα πλοήγησης του konqueror με το όνομα $NAME$ +Comment[es]=Un complemento del panel de navegación de Konqueror llamado $NAME$ +Comment[et]=Konquerori liikumispaneeli plugin nimega $NAME$ +Comment[eu]=$NAME$ izeneko konqueror arakatze-paneleko plugin bat +Comment[fa]=وصلۀ تابلوی ناوش konqueror، $NAME$ نامیده شد +Comment[fr]=Un module externe pour le panneau de navigation de Konqueror appelé $NAME$ +Comment[ga]=Breiseán painéil nascleanúna konqueror darb ainm $NAME$ +Comment[gl]=Unha extensión para o panel de navegación de konqueror chamado $NAME$ +Comment[hu]=Bővítőmodul a Konqueror navigációs paneljéhez ($NAMES$) +Comment[it]=Un plugin per il pannello di navigazione di Konqueror chiamato $NAME$ +Comment[ja]=$NAME$ と呼ばれる konqueror ナビゲーションプラグイン +Comment[nds]=En Sietpaneelmoduul för Konqueror, nöömt $NAME$ +Comment[ne]= $NAME$ भनिने कन्क्वेरर नेभिगेसन प्यानल प्लगइन +Comment[nl]=Een konqueror navigatiepaneel-plugin met de naam $NAME$ +Comment[pl]=Wtyczka do panelu nawigacyjnego Konquerora o nazwie $NAME$ +Comment[pt]=Um 'plugin' do painel de navegação do konqueror chamado $NAME$ +Comment[pt_BR]=Um plug-in de painel de navegação do konqueror chamado $NAME$ +Comment[ru]=Модуль панели навигации Konqueror $NAME$ +Comment[sk]=Modul pre konqueror navigačný panel s menom $NAME$ +Comment[sl]=Konquerorjev vstavek pulta za navigacijo z imenom $NAME$ +Comment[sr]=Кonqueror-ов прикључак за навигациони панел по имену $NAME$ +Comment[sr@Latn]=Konqueror-ov priključak za navigacioni panel po imenu $NAME$ +Comment[sv]=Ett insticksprogram i Konquerors navigeringspanel som heter $NAME$ +Comment[tr]=$NAME$ adında bir konqueror gezinme paneli eklentisi +Comment[zh_CN]=一个称作 $NAME$ 的 konqueror 导航面板插件 +Comment[zh_TW]=名稱為 $NAME$ 的 Konqueror 導覽面板外掛程式 +Name=%{APPNAMELC} + +Open=false +X-KDE-KonqSidebarModule=konqsidebar_%{APPNAMELC} + diff --git a/languages/cpp/app_templates/konqnavpanel/konqnavpanel.h b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.h new file mode 100644 index 00000000..949c68d3 --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.h @@ -0,0 +1,43 @@ + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + + +class %{APPNAME} : public KonqSidebarPlugin +{ + Q_OBJECT + +public: + /** + * Construct a @ref KonqSidebarPlugin. + * + * @param inst The sidebar's kinstance class. + * @param parent The sidebar internal button info class responsible for this plugin. + * @param widgetParent The container which will contain the plugins widget. + * @param desktopName The filename of the configuration file. + * @param name A Qt object name for your plugin. + **/ + %{APPNAME}(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName, const char* name=0); + + /** destructor */ + ~%{APPNAME}(); + + virtual QWidget *getWidget(){return widget;} + virtual void *provides(const QString &) {return 0;} + +protected: + /*Example widget only. You use whichever widget you want. You onl have to care that getWidget returns some kind of widget */ + QLabel *widget; + virtual void handleURL(const KURL &url); + +}; + +#endif diff --git a/languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevelop b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevelop new file mode 100644 index 00000000..8bb35326 --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevelop @@ -0,0 +1,115 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + Kicker + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevtemplate b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevtemplate new file mode 100644 index 00000000..4cbc7d5d --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.kdevtemplate @@ -0,0 +1,192 @@ +# KDE Config File +[General] +Name=Konqueror Navigation Panel Plugin +Name[br]=Lugent panell furchal Konqueror +Name[ca]=Un connector per al plafó de navegació de Konqueror +Name[da]=Konqueror navigationspanel plugin +Name[de]=Modul für den Navigationsbereich von Konqueror +Name[el]=Πρόσθετο πίνακα πλοήγησης του Konqueror +Name[es]=Un complemento para el panel de navegación de Konqueror +Name[et]=Konquerori liikumispaneeli plugin +Name[eu]=Konqueror arakatze-panel plugina +Name[fa]=وصلۀ تابلوی ناوش Konqueror +Name[fr]=Module externe pour le panneau de navigation de Konqueror +Name[ga]=Breiseán Painéil Nascleanúna Konqueror +Name[gl]=Extensión para o panel de navegación de Konqueror +Name[hu]=Konqueroros navigációs bővítőmodul +Name[it]=Plugin per il pannello di navigazione di Konqueror +Name[ja]=Konqueror ナビゲーションプラグイン +Name[nds]=En Sietpaneelmoduul för Konqueror +Name[ne]=कन्क्वेरर नेभिगेसन प्यानल प्लगइन +Name[nl]=Konqueror Navigatiepaneel-plugin +Name[pl]=Wtyczka panelu nawigacji Konquerora +Name[pt]='Plugin' do Painel de Navegação do Konqueror +Name[pt_BR]='Plugin' do Painel de Navegação do Konqueror +Name[ru]=Модуль панели навигации Konqueror +Name[sk]=Modul pre konqueror navigačný panel +Name[sr]=Кonqueror-ов прикључак за навигациони панел +Name[sr@Latn]=Konqueror-ov priključak za navigacioni panel +Name[sv]=Konqueror-insticksprogram för navigeringspanelen +Name[tr]=Konqueror Gezinme Paneli Eklentisi +Name[zh_CN]=Konqueror 导航面板插件 +Name[zh_TW]=Konqueror 導覽面板外掛程式 +Icon=konqnavpanel.png +Category=C++/KDE +Comment=Generates a framework for a plugin that embeds into Konqueror's navigation panel +Comment[ca]=Genera una infraestructura per a un connector que s'encasti al plafó de navegació de Konqueror +Comment[da]=Genererer et skelet for et plugin der indlejres i Konqueror's navigationspanel +Comment[de]=Erstellt das Gerüst für ein Modul, das in den Navigationsbereich von Konqueror eingebunden werden kann. +Comment[el]=Δημιουργεί ένα πλαίσιο για ένα πρόσθετο που ενσωματώνεται στον πίνακα πλοήγησης του Konqueror +Comment[es]=Genera una infraestructura para un complemento empotrado en el panel de navegación de Konqueror +Comment[et]=Plugina raamistiku loomine, mida saab põimida Konquerori liikumispaneelile. +Comment[eu]=Konqueror-en arakatze-panelean kapsulatzen den plugin batentzat lan-marko oso bat sortzen du +Comment[fa]=چارچوبی را برای یک وصله که در تابلوی ناوش Konqueror نهفته بود، تولید می‌کند +Comment[fr]=Génère une infrastructure pour un module externe qui s'intègre dans le panneau de navigation de Konqueror +Comment[gl]=Xera un contorno de traballo para unha extensión que se incrusta no panel de navegación de Konqueror +Comment[hu]=Létrehoz egy alapprogramot konqueroros navigációs panelmodul készítéséhez +Comment[it]=Genera l'infrastruttura per un plugin che si integra nel pannello di navigazione di Konqueror +Comment[nds]=Stellt dat Rahmenwark för en Moduul op, dat sik in't Sietpaneel vun Konqueror inbett +Comment[ne]=कन्क्वेररको नेभिगेसन प्यानलमा सम्मिलित हुने प्लगइनका लागि फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Genereert een framework voor een plugin die kan worden ingebed in Konqueror's navigatiepaneel. +Comment[pl]=Generuje wtyczkę, którą można osadzić w panelu nawigacyjnym Konquerora +Comment[pt]=Gera a plataforma para um 'plugin' que se incorpore no painel de navegação do Konqueror +Comment[pt_BR]=Gera a plataforma para um 'plugin' que se incorpore no painel de navegação do Konqueror +Comment[ru]=Создание модуля панели навигации Konqueror +Comment[sk]=Vygeneruje framework pre modul, ktorý sa bude dať vložiť do konqueror navigačného panelu +Comment[sr]=Прави радни оквир за прикључак који се уграђује у Konqueror-ов навигациони панел +Comment[sr@Latn]=Pravi radni okvir za priključak koji se ugrađuje u Konqueror-ov navigacioni panel +Comment[sv]=Skapar ett ramverk för ett insticksprogram som inbäddas i Konquerors navigeringspanel +Comment[tr]=Konqueror'un gezinme paneline gömülen bir eklenti için bir çatı oluşturur. +Comment[zh_CN]=生成可嵌入到 Konqueror 导航面板的插件框架 +Comment[zh_TW]=產生一個嵌入 Konqueror 導覽面板的外掛程式的框架 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=konqnavpanel.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/konqnavpanel.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/konqnavpanel.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/konqnavpanel.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/konqnavpanel.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=A konqueror navigation panel plugin was created in %{dest} +Comment[ca]=Un connector per al plafó de navegació de Konqueror ha estat creada en %{dest} +Comment[da]=Et Konqueror navigationspanel plugin blev oprettet i %{dest} +Comment[de]=Ein Modul für den Navigationsbereich von Konqueror wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο του πίνακα πλοήγησης του konqueror δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento para el panel de navegación de Konqueror ha sido creado en %{dest} +Comment[et]=Konquerori liikumispaneeli plugin loodi asukohta %{dest} +Comment[eu]=Konqueror-en arakatze-paneleko plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ تابلوی ناوش konqueror در %{dest} ایجاد شد +Comment[fr]=Un module externe pour le panneau de navigation de Konqueror a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán painéil nascleanúna konqueror i %{dest} +Comment[gl]=Creouse unha extensión para o panel de navegación en %{dest} +Comment[hu]=Létrejött egy konqueroros navigációs modul itt: %{dest} +Comment[it]=È stato creato un plugin per il pannello di navigazione di Konqueror in %{dest} +Comment[ja]=Konqueror ナビゲーションプラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Sietpaneelmoduul för Konqueror opstellt +Comment[ne]=कन्क्वेरर नेभिगेसन प्यानल प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Konqueror-navigatiepaneel-plugin is aangemaakt in %{dest} +Comment[pl]=Wtyczka do panelu nawigacyjnego Konquerora została utworzona w %{dest} +Comment[pt]=Um 'plugin' do painel de navegação do Konqueror foi criado em %{dest} +Comment[pt_BR]=Um 'plugin' do painel de navegação do Konqueror foi criado em %{dest} +Comment[ru]=Модуль панели навигации Konqueror создан в %{dest} +Comment[sk]=Modul pre konqueror navigačný panel bol vytvorený v %{dest} +Comment[sr]=Кonqueror-ов прикључак за навигациони панел направљен је у %{dest} +Comment[sr@Latn]=Konqueror-ov priključak za navigacioni panel napravljen je u %{dest} +Comment[sv]=Ett Konqueror-insticksprogram för navigeringspanelen skapades i %{dest} +Comment[tr]=Bir konqueror gezinme paneli eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 konqueror 导航器面板插件 +Comment[zh_TW]=一個 Konqueror 導覽面板外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/konqnavpanel/konqnavpanel.png b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.png new file mode 100644 index 00000000..dd0d89f3 Binary files /dev/null and b/languages/cpp/app_templates/konqnavpanel/konqnavpanel.png differ diff --git a/languages/cpp/app_templates/konqnavpanel/src-Makefile.am b/languages/cpp/app_templates/konqnavpanel/src-Makefile.am new file mode 100644 index 00000000..5a9113c5 --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/src-Makefile.am @@ -0,0 +1,11 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES=konqsidebar_%{APPNAMELC}.la + +konqsidebar_%{APPNAMELC}_la_SOURCES = %{APPNAMELC}.cpp +konqsidebar_%{APPNAMELC}_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -lkonqsidebarplugin +konqsidebar_%{APPNAMELC}_la_LIBADD = $(LIB_KPARTS) $(LIB_KFILE) + +%{APPNAMELC}_entry_DATA = %{APPNAMELC}.desktop +%{APPNAMELC}_entrydir = $(kde_datadir)/konqsidebartng/entries diff --git a/languages/cpp/app_templates/konqnavpanel/subdirs b/languages/cpp/app_templates/konqnavpanel/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/konqnavpanel/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kpartapp/.kdev_ignore b/languages/cpp/app_templates/kpartapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kpartapp/Makefile.am b/languages/cpp/app_templates/kpartapp/Makefile.am new file mode 100644 index 00000000..9b69f17d --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = src-Makefile.am app.cpp app.h app_part.cpp\ + app_part.h main.cpp app_part.rc app_shell.rc \ + kpartapp.png app.kdevelop subdirs +templateName = kpartapp +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kpartapp/app.cpp b/languages/cpp/app_templates/kpartapp/app.cpp new file mode 100644 index 00000000..68c34ab3 --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app.cpp @@ -0,0 +1,209 @@ + +#include "%{APPNAMELC}.h" + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +%{APPNAME}::%{APPNAME}() + : KParts::MainWindow( 0L, "%{APPNAME}" ) +{ + // set the shell's ui resource file + setXMLFile("%{APPNAMELC}_shell.rc"); + + // then, setup our actions + setupActions(); + + // and a status bar + statusBar()->show(); + + // this routine will find and load our Part. it finds the Part by + // name which is a bad idea usually.. but it's alright in this + // case since our Part is made for this Shell + KLibFactory *factory = KLibLoader::self()->factory("lib%{APPNAMELC}part"); + if (factory) + { + // now that the Part is loaded, we cast it to a Part to get + // our hands on it + m_part = static_cast(factory->create(this, + "%{APPNAMELC}_part", "KParts::ReadWritePart" )); + + if (m_part) + { + // tell the KParts::MainWindow that this is indeed the main widget + setCentralWidget(m_part->widget()); + + // and integrate the part's GUI with the shell's + createGUI(m_part); + } + } + else + { + // if we couldn't find our Part, we exit since the Shell by + // itself can't do anything useful + KMessageBox::error(this, i18n("Could not find our part.")); + kapp->quit(); + // we return here, cause kapp->quit() only means "exit the + // next time we enter the event loop... + return; + } + + // apply the saved mainwindow settings, if any, and ask the mainwindow + // to automatically save settings if changed: window size, toolbar + // position, icon size, etc. + setAutoSaveSettings(); +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +void %{APPNAME}::load(const KURL& url) +{ + m_part->openURL( url ); +} + +void %{APPNAME}::setupActions() +{ + KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStdAction::open(this, SLOT(fileOpen()), actionCollection()); + + KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); +} + +void %{APPNAME}::saveProperties(KConfig* /*config*/) +{ + // the 'config' object points to the session managed + // config file. anything you write here will be available + // later when this app is restored +} + +void %{APPNAME}::readProperties(KConfig* /*config*/) +{ + // the 'config' object points to the session managed + // config file. this function is automatically called whenever + // the app is being restored. read in here whatever you wrote + // in 'saveProperties' +} + +void %{APPNAME}::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // About this function, the style guide ( + // http://developer.kde.org/documentation/standards/kde/style/basics/index.html ) + // says that it should open a new window if the document is _not_ + // in its initial state. This is what we do here.. + if ( ! m_part->url().isEmpty() || m_part->isModified() ) + { + (new %{APPNAME})->show(); + }; +} + + +void %{APPNAME}::optionsShowToolbar() +{ + // this is all very cut and paste code for showing/hiding the + // toolbar + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void %{APPNAME}::optionsShowStatusbar() +{ + // this is all very cut and paste code for showing/hiding the + // statusbar + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void %{APPNAME}::optionsConfigureKeys() +{ + KKeyDialog::configure(actionCollection()); +} + +void %{APPNAME}::optionsConfigureToolbars() +{ +#if defined(KDE_MAKE_VERSION) +# if KDE_VERSION >= KDE_MAKE_VERSION(3,1,0) + saveMainWindowSettings(KGlobal::config(), autoSaveGroup()); +# else + saveMainWindowSettings(KGlobal::config() ); +# endif +#else + saveMainWindowSettings(KGlobal::config() ); +#endif + + // use the standard toolbar editor + KEditToolbar dlg(factory()); + connect(&dlg, SIGNAL(newToolbarConfig()), + this, SLOT(applyNewToolbarConfig())); + dlg.exec(); +} + +void %{APPNAME}::applyNewToolbarConfig() +{ +#if defined(KDE_MAKE_VERSION) +# if KDE_VERSION >= KDE_MAKE_VERSION(3,1,0) + applyMainWindowSettings(KGlobal::config(), autoSaveGroup()); +# else + applyMainWindowSettings(KGlobal::config()); +# endif +#else + applyMainWindowSettings(KGlobal::config()); +#endif +} + +void %{APPNAME}::fileOpen() +{ + // this slot is called whenever the File->Open menu is selected, + // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + // button is clicked + KURL url = + KFileDialog::getOpenURL( QString::null, QString::null, this ); + + if (url.isEmpty() == false) + { + // About this function, the style guide ( + // http://developer.kde.org/documentation/standards/kde/style/basics/index.html ) + // says that it should open a new window if the document is _not_ + // in its initial state. This is what we do here.. + if ( m_part->url().isEmpty() && ! m_part->isModified() ) + { + // we open the file in this window... + load( url ); + } + else + { + // we open the file in a new window... + %{APPNAME}* newWin = new %{APPNAME}; + newWin->load( url ); + newWin->show(); + } + } +} + +#include "%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/kpartapp/app.desktop b/languages/cpp/app_templates/kpartapp/app.desktop new file mode 100644 index 00000000..01cc9d37 --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Name=%{APPNAME}Part +Name[br]=Perzh%{APPNAME} +Name[ca]=Part per a %{APPNAME} +Name[el]=Τμήμα%{APPNAME} +Name[et]=%{APPNAME} komponent +Name[fa]=جزء %{APPNAME} +Name[gl]=%{APPNAME} Part +Name[ja]=%{APPNAME} パート +Name[ne]=%{APPNAME}भाग +Name[pt_BR]=Parte %{APPNAME} +Name[sv]=%{APPNAME}-del +Name[ta]=%{APPNAME}பாகம் +Name[tr]=%{APPNAME} Bileşeni +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; +ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart +X-KDE-Library=lib%{APPNAMELC}part +Type=Service diff --git a/languages/cpp/app_templates/kpartapp/app.h b/languages/cpp/app_templates/kpartapp/app.h new file mode 100644 index 00000000..25cd63bf --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app.h @@ -0,0 +1,76 @@ + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +class KToggleAction; + +/** + * This is the application "Shell". It has a menubar, toolbar, and + * statusbar but relies on the "Part" to do all the real work. + * + * @short Application Shell + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME} : public KParts::MainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); + + /** + * Use this method to load whatever file/URL you have + */ + void load(const KURL& url); + +protected: + /** + * This method is called when it is time for the app to save its + * properties for session management purposes. + */ + void saveProperties(KConfig *); + + /** + * This method is called when this app is restored. The KConfig + * object points to the session management config file that was saved + * with @ref saveProperties + */ + void readProperties(KConfig *); + +private slots: + void fileNew(); + void fileOpen(); + void optionsShowToolbar(); + void optionsShowStatusbar(); + void optionsConfigureKeys(); + void optionsConfigureToolbars(); + + void applyNewToolbarConfig(); + +private: + void setupAccel(); + void setupActions(); + +private: + KParts::ReadWritePart *m_part; + + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; +}; + +#endif // _%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/kpartapp/app.kdevelop b/languages/cpp/app_templates/kpartapp/app.kdevelop new file mode 100644 index 00000000..3adbae9e --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app.kdevelop @@ -0,0 +1,115 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kpartapp/app_part.cpp b/languages/cpp/app_templates/kpartapp/app_part.cpp new file mode 100644 index 00000000..bf63557f --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app_part.cpp @@ -0,0 +1,201 @@ + +#include "%{APPNAMELC}_part.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +%{APPNAME}Part::%{APPNAME}Part( QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name ) + : KParts::ReadWritePart(parent, name) +{ + // we need an instance + setInstance( %{APPNAME}PartFactory::instance() ); + + // this should be your custom internal widget + m_widget = new QMultiLineEdit( parentWidget, widgetName ); + + // notify the part that this is our internal widget + setWidget(m_widget); + + // create our actions + KStdAction::open(this, SLOT(fileOpen()), actionCollection()); + KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); + KStdAction::save(this, SLOT(save()), actionCollection()); + + // set our XML-UI resource file + setXMLFile("%{APPNAMELC}_part.rc"); + + // we are read-write by default + setReadWrite(true); + + // we are not modified since we haven't done anything yet + setModified(false); +} + +%{APPNAME}Part::~%{APPNAME}Part() +{ +} + +void %{APPNAME}Part::setReadWrite(bool rw) +{ + // notify your internal widget of the read-write state + m_widget->setReadOnly(!rw); + if (rw) + connect(m_widget, SIGNAL(textChanged()), + this, SLOT(setModified())); + else + { + disconnect(m_widget, SIGNAL(textChanged()), + this, SLOT(setModified())); + } + + ReadWritePart::setReadWrite(rw); +} + +void %{APPNAME}Part::setModified(bool modified) +{ + // get a handle on our Save action and make sure it is valid + KAction *save = actionCollection()->action(KStdAction::stdName(KStdAction::Save)); + if (!save) + return; + + // if so, we either enable or disable it based on the current + // state + if (modified) + save->setEnabled(true); + else + save->setEnabled(false); + + // in any event, we want our parent to do it's thing + ReadWritePart::setModified(modified); +} + +bool %{APPNAME}Part::openFile() +{ + // m_file is always local so we can use QFile on it + QFile file(m_file); + if (file.open(IO_ReadOnly) == false) + return false; + + // our example widget is text-based, so we use QTextStream instead + // of a raw QDataStream + QTextStream stream(&file); + QString str; + while (!stream.eof()) + str += stream.readLine() + "\n"; + + file.close(); + + // now that we have the entire file, display it + m_widget->setText(str); + + // just for fun, set the status bar + emit setStatusBarText( m_url.prettyURL() ); + + return true; +} + +bool %{APPNAME}Part::saveFile() +{ + // if we aren't read-write, return immediately + if (isReadWrite() == false) + return false; + + // m_file is always local, so we use QFile + QFile file(m_file); + if (file.open(IO_WriteOnly) == false) + return false; + + // use QTextStream to dump the text to the file + QTextStream stream(&file); + stream << m_widget->text(); + + file.close(); + + return true; +} + +void %{APPNAME}Part::fileOpen() +{ + // this slot is called whenever the File->Open menu is selected, + // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + // button is clicked + QString file_name = KFileDialog::getOpenFileName(); + + if (file_name.isEmpty() == false) + openURL(file_name); +} + +void %{APPNAME}Part::fileSaveAs() +{ + // this slot is called whenever the File->Save As menu is selected, + QString file_name = KFileDialog::getSaveFileName(); + if (file_name.isEmpty() == false) + saveAs(file_name); +} + + +// It's usually safe to leave the factory code alone.. with the +// notable exception of the KAboutData data +#include +#include + +KInstance* %{APPNAME}PartFactory::s_instance = 0L; +KAboutData* %{APPNAME}PartFactory::s_about = 0L; + +%{APPNAME}PartFactory::%{APPNAME}PartFactory() + : KParts::Factory() +{ +} + +%{APPNAME}PartFactory::~%{APPNAME}PartFactory() +{ + delete s_instance; + delete s_about; + + s_instance = 0L; +} + +KParts::Part* %{APPNAME}PartFactory::createPartObject( QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, + const char *classname, const QStringList &args ) +{ + // Create an instance of our Part + %{APPNAME}Part* obj = new %{APPNAME}Part( parentWidget, widgetName, parent, name ); + + // See if we are to be read-write or not + if (QCString(classname) == "KParts::ReadOnlyPart") + obj->setReadWrite(false); + + return obj; +} + +KInstance* %{APPNAME}PartFactory::instance() +{ + if( !s_instance ) + { + s_about = new KAboutData("%{APPNAMELC}part", I18N_NOOP("%{APPNAME}Part"), "%{VERSION}"); + s_about->addAuthor("%{AUTHOR}", 0, "%{EMAIL}"); + s_instance = new KInstance(s_about); + } + return s_instance; +} + +extern "C" +{ + void* init_lib%{APPNAMELC}part() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}PartFactory; + } +}; + +#include "%{APPNAMELC}_part.moc" diff --git a/languages/cpp/app_templates/kpartapp/app_part.h b/languages/cpp/app_templates/kpartapp/app_part.h new file mode 100644 index 00000000..37c30189 --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app_part.h @@ -0,0 +1,86 @@ + +#ifndef _%{APPNAMEUC}PART_H_ +#define _%{APPNAMEUC}PART_H_ + +#include +#include + +class QWidget; +class QPainter; +class KURL; +class QMultiLineEdit; + +/** + * This is a "Part". It that does all the real work in a KPart + * application. + * + * @short Main Part + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME}Part : public KParts::ReadWritePart +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAME}Part(QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name); + + /** + * Destructor + */ + virtual ~%{APPNAME}Part(); + + /** + * This is a virtual function inherited from KParts::ReadWritePart. + * A shell will use this to inform this Part if it should act + * read-only + */ + virtual void setReadWrite(bool rw); + + /** + * Reimplemented to disable and enable Save action + */ + virtual void setModified(bool modified); + +protected: + /** + * This must be implemented by each part + */ + virtual bool openFile(); + + /** + * This must be implemented by each read-write part + */ + virtual bool saveFile(); + +protected slots: + void fileOpen(); + void fileSaveAs(); + +private: + QMultiLineEdit *m_widget; +}; + +class KInstance; +class KAboutData; + +class %{APPNAME}PartFactory : public KParts::Factory +{ + Q_OBJECT +public: + %{APPNAME}PartFactory(); + virtual ~%{APPNAME}PartFactory(); + virtual KParts::Part* createPartObject( QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, + const char *classname, const QStringList &args ); + static KInstance* instance(); + +private: + static KInstance* s_instance; + static KAboutData* s_about; +}; + +#endif // _%{APPNAMEUC}PART_H_ diff --git a/languages/cpp/app_templates/kpartapp/app_part.rc b/languages/cpp/app_templates/kpartapp/app_part.rc new file mode 100644 index 00000000..cec8ec5c --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app_part.rc @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/languages/cpp/app_templates/kpartapp/app_shell.rc b/languages/cpp/app_templates/kpartapp/app_shell.rc new file mode 100644 index 00000000..e0600cda --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/app_shell.rc @@ -0,0 +1,28 @@ + + + + &File + + + + + + &Settings + + + + + + + + + + + + +Main Toolbar + + + + + diff --git a/languages/cpp/app_templates/kpartapp/kpartapp.kdevtemplate b/languages/cpp/app_templates/kpartapp/kpartapp.kdevtemplate new file mode 100644 index 00000000..03583faa --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/kpartapp.kdevtemplate @@ -0,0 +1,237 @@ +# KDE Config File +[General] +Name=Application framework (KParts) +Name[ca]=Infraestructura d'aplicació (KParts) +Name[da]=Programskelet (KParts) +Name[de]=Anwendungsgerüst (KParts) +Name[el]=Πλαίσιο εφαρμογής (KParts) +Name[es]=Infraestructura de aplicación (KParts) +Name[et]=Rakenduse raamistik (KParts) +Name[eu]=Aplikazioen lan-markoa (KParts) +Name[fa]=(KParts)چارچوب کاربرد +Name[fr]=Infrastructure d'application (KParts) +Name[ga]=Creatlach feidhmchláir (KParts) +Name[gl]=Entorno de traballo de aplicación (KParts) +Name[hu]=Alkalmazás-keretrendszer (objektumokkal) +Name[it]=Infrastruttura applicativa (KParts) +Name[ja]=アプリケーションフレームワーク (KParts) +Name[nds]=Programmrahmenwark (KParts) +Name[ne]=अनुप्रयोग फ्रेमवर्क (केडीई भाग) +Name[nl]=Toepassingframework (KParts) +Name[pl]=Szablon progamu (KParts) +Name[pt]=Plataforma de aplicações (KParts) +Name[pt_BR]=Plataforma de aplicações (KParts) +Name[ru]=Приложение KPart +Name[sk]=Aplikačný framework (KParts) +Name[sr]=Радни оквир програма (KParts) +Name[sr@Latn]=Radni okvir programa (KParts) +Name[sv]=Programramverk (KParts) +Name[tr]=Uygulama Çatısı (KParts) +Name[zh_CN]=应用程序框架(KParts) +Name[zh_TW]=應用程式框架(KParts) +Icon=kpartapp.png +Category=C++/KDE +Comment=Generates a complex KDE application with a KParts shell and a KPart component. +Comment[ca]=Genera una complexa aplicació per al KDE amb un intèrpret de comandaments KParts i un component KPart. +Comment[da]=Genererer et komplekst KDE-program med en KParts-skal og en KPart-komponent. +Comment[de]=Erstellt eine aufwändige KDE-Anwendung mit einer Shell für KParts und einer KPart-Komponente. +Comment[el]=Δημιουργεί μια πολύπλοκη εφαρμογή KDE με ένα κέλυφος KParts και ένα συστατικό KPart. +Comment[es]=Genera una aplicación KDE compleja con un contenedor KParts y un componente KPart. +Comment[et]=Keerulise KDE rakenduse loomine KParts-shelliga ja KPart-komponendiga. +Comment[eu]=KDE aplikazio konplexu bat sortzen du KParts shellbat eta KPart osagai batekin. +Comment[fa]=یک کاربرد پیچیدۀ KDE با یک پوستۀ KParts و یک مؤلفۀ KPart تولید می‌کند. +Comment[fr]=Génère une application KDE évoluée comprenant un shell KParts et un composant KPart. +Comment[ga]=Cruthaíonn sé seo feidhmchlár casta KDE le blaosc KParts agus comhpháirt KPart. +Comment[gl]=Xera unha aplicación KDE complexa cun terminal KPart e unha compoñente KPart. +Comment[hu]=Létrehoz egy komplex, objektumok használatát támogató KDE-s alkalmazást és egy KPart objektumot. +Comment[it]=Genera un'applicazione complessa di KDE con una shell di KParts e un componente KPart. +Comment[nds]=Stellt en vigeliensch KDE-Programm mit en Konsool för KPart un en KPart-Komponent op. +Comment[ne]=केडीई भाग शेल र केडीई भाग अवयवसँग जटिल केडीई अनुप्रयोग उत्पन्न गर्दछ । +Comment[nl]=Genereert een complexe KDE-toepassing met een KParts-shell en een KPart-component. +Comment[pl]=Generuje złożony program z powłoką KParts i komponentem KPart. +Comment[pt]=Gera uma aplicação complexa do KDE com uma infra-estrutura de KParts, bem como um componente KPart. +Comment[pt_BR]=Gera uma aplicação complexa do KDE com uma infra-estrutura de KParts, bem como um componente KPart. +Comment[ru]=Создание полноценного приложения KDE на базе компонента KPart. +Comment[sk]=Vygeneruje komplexnú KDE aplikáciu s KParts shell a s KPart komponentom. +Comment[sr]=Прави сложени KDE програм са KParts шкољком и KPart компонентом. +Comment[sr@Latn]=Pravi složeni KDE program sa KParts školjkom i KPart komponentom. +Comment[sv]=Skapar ett komplext KDE-program med ett KPart-skal och en KPart-komponent. +Comment[tr]=Bir KParts kabuğu ve KParts bileşeni olan karmaşık bir KDE uygulaması yaratır. +Comment[zh_CN]=生成一个带 KParts 外壳和 KPart 组件的复杂 KDE 应用程序。 +Comment[zh_TW]=產生一個複雜的 KDE 應用程式,內含 KParts shell 與 KPart 元件。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}_part.cpp +Archive=kpartapp.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-part.desktop +Dest=%{dest}/src/%{APPNAMELC}_part.desktop + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE13] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE14] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE15] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE16] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE17] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE18] +Type=install +Source=%{src}/app_part.cpp +Dest=%{dest}/src/%{APPNAMELC}_part.cpp + +[FILE19] +Type=install +Source=%{src}/app_part.h +Dest=%{dest}/src/%{APPNAMELC}_part.h + +[FILE20] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE21] +Type=install +EscapeXML=true +Source=%{src}/app_part.rc +Dest=%{dest}/src/%{APPNAMELC}_part.rc + +[FILE22] +Type=install +EscapeXML=true +Source=%{src}/app_shell.rc +Dest=%{dest}/src/%{APPNAMELC}_shell.rc + +[MSG] +Type=message +Comment=A complex KDE application using KParts was created in %{dest} +Comment[ca]=Una complexa aplicació per al KDE usant KParts ha estat creada en %{dest} +Comment[da]=Et komplekst KDE-program ved brug af KParts blev oprettet i %{dest} +Comment[de]=Eine aufwändige KDE-Anwendung, die KParts verwendet, wurde in %{dest} erstellt. +Comment[el]=Μια πολύπλοκη εφαρμογή KDE που χρησιμοποιεί το KParts δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación compleja para KDE que usa KParts ha sido creada en %{dest} +Comment[et]=KParts'i kasutav keeruline KDE rakendus loodi asukohta %{dest} +Comment[eu]=KDE aplikazio konplexu bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد پیچیدۀ KDE با استفاده از KParts در %{dest} ایجاد شد +Comment[fr]=Une application KDE évoluée utilisant KParts a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár casta KDE a úsáideann KParts i %{dest} +Comment[gl]=Creouse unha aplicación KDE complexa usando KParts en %{dest} +Comment[hu]=Létrejött egy komplex, objektumok használatát támogató KDE-s alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KDE complessa usando KParts in %{dest} +Comment[ja]=KParts を使った複雑な KDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en vigeliensch KDE-Programm opstellt, dat "KParts" bruukt. +Comment[ne]=केडीई भाग प्रयोग गरेर जटिल केडीई अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een complexe KDE-toepassing gebruik makend van KParts is aangemaakt in %{dest} +Comment[pl]=Złożony program KDE używający KParts został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação complexa do KDE, que usa o KParts, em %{dest} +Comment[pt_BR]=Foi criada uma aplicação complexa do KDE, que usa o KParts, em %{dest} +Comment[ru]=Приложение KDE на базе компонента KPart создано в %{dest} +Comment[sk]=Komplexná KDE aplikácia používajúca KParts bola vytvorená v %{dest} +Comment[sr]=Сложени KDE програм на основу KParts направљен је у %{dest} +Comment[sr@Latn]=Složeni KDE program na osnovu KParts napravljen je u %{dest} +Comment[sv]=Ett komplext KDE-program som använder KParts skapades i %{dest} +Comment[tr]=KParts kullanan karmaşık bir KDE uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个使用 KParts 的复杂 KDE 应用程序 +Comment[zh_TW]=一個使用 KParts 的複雜 KDE 應用程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/kpartapp/kpartapp.png b/languages/cpp/app_templates/kpartapp/kpartapp.png new file mode 100644 index 00000000..5834ac9f Binary files /dev/null and b/languages/cpp/app_templates/kpartapp/kpartapp.png differ diff --git a/languages/cpp/app_templates/kpartapp/main.cpp b/languages/cpp/app_templates/kpartapp/main.cpp new file mode 100644 index 00000000..a7c0d2c4 --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/main.cpp @@ -0,0 +1,57 @@ + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE KPart Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + if ( args->count() == 0 ) + { + %{APPNAME} *widget = new %{APPNAME}; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++ ) + { + %{APPNAME} *widget = new %{APPNAME}; + widget->show(); + widget->load( args->url( i ) ); + } + } + args->clear(); + } + + return app.exec(); +} diff --git a/languages/cpp/app_templates/kpartapp/src-Makefile.am b/languages/cpp/app_templates/kpartapp/src-Makefile.am new file mode 100644 index 00000000..357e2d0b --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/src-Makefile.am @@ -0,0 +1,53 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = %{APPNAMELC}.h %{APPNAMELC}_part.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +KDE_ICON = AUTO + +# this Makefile creates both a KPart application and a KPart +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} + +# the application source, library search path, and link libraries +%{APPNAMELC}_SOURCES = main.cpp %{APPNAMELC}.cpp +%{APPNAMELC}_LDFLAGS = $(KDE_RPATH) $(all_libraries) +%{APPNAMELC}_LDADD = $(LIB_KPARTS) + +# this is where the desktop file will go +shelldesktopdir = $(kde_appsdir)/Utilities +shelldesktop_DATA = %{APPNAMELC}.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/%{APPNAMELC} +shellrc_DATA = %{APPNAMELC}_shell.rc + +######################################################################### +# KPART SECTION +######################################################################### +kde_module_LTLIBRARIES = lib%{APPNAMELC}part.la + +# the Part's source, library search path, and link libraries +lib%{APPNAMELC}part_la_SOURCES = %{APPNAMELC}_part.cpp +lib%{APPNAMELC}part_la_LDFLAGS = -module -avoid-version -no-undefined $(KDE_PLUGIN) $(all_libraries) +lib%{APPNAMELC}part_la_LIBADD = $(LIB_KPARTS) $(LIB_KFILE) + +# this is where the desktop file will go +partdesktopdir = $(kde_servicesdir) +partdesktop_DATA = %{APPNAMELC}_part.desktop + +# this is where the part's XML-GUI resource file goes +partrcdir = $(kde_datadir)/%{APPNAMELC}part +partrc_DATA = %{APPNAMELC}_part.rc diff --git a/languages/cpp/app_templates/kpartapp/subdirs b/languages/cpp/app_templates/kpartapp/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kpartapp/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kpartplugin/.kdev_ignore b/languages/cpp/app_templates/kpartplugin/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kpartplugin/Makefile.am b/languages/cpp/app_templates/kpartplugin/Makefile.am new file mode 100644 index 00000000..170bdd6d --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = src-Makefile.am plugin_app.cpp plugin_app.h \ + plugin_app.rc hi16-action-plugin.png hi22-action-plugin.png \ + kpartplugin.png plugin.kdevelop subdirs + +templateName = kpartplugin + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kpartplugin/hi16-action-plugin.png b/languages/cpp/app_templates/kpartplugin/hi16-action-plugin.png new file mode 100644 index 00000000..e2d7bab8 Binary files /dev/null and b/languages/cpp/app_templates/kpartplugin/hi16-action-plugin.png differ diff --git a/languages/cpp/app_templates/kpartplugin/hi22-action-plugin.png b/languages/cpp/app_templates/kpartplugin/hi22-action-plugin.png new file mode 100644 index 00000000..4082bf10 Binary files /dev/null and b/languages/cpp/app_templates/kpartplugin/hi22-action-plugin.png differ diff --git a/languages/cpp/app_templates/kpartplugin/kpartplugin.kdevtemplate b/languages/cpp/app_templates/kpartplugin/kpartplugin.kdevtemplate new file mode 100644 index 00000000..f331c6cf --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/kpartplugin.kdevtemplate @@ -0,0 +1,204 @@ +# KDE Config File +[General] +Name=KHTMLPart plugin +Name[br]=Lugent KHTMLPart +Name[ca]=Connector per a KHTMLPart +Name[de]=KHTMLPart-Modul +Name[el]=Πρόσθετο KHTMLPart +Name[es]=Complemento para KHTMLPart +Name[eu]=KHTMLPart plugina +Name[fa]=وصلۀ KHTMLPart +Name[fr]=Module externe pour le composant KHTML +Name[ga]=Breiseán KHTMLPart +Name[gl]=Extensión para KHTMLPart +Name[hu]=KHTML-bővítőmodul +Name[it]=Plugin KHTMLPart +Name[ja]=KHTMLPart プラグイン +Name[nds]=KHTMLPart-Moduul +Name[ne]=KHTMLPart प्लगइन +Name[nl]=KHTMLPart-plugin +Name[pl]=Wtyczka do KHTMLPart +Name[pt]='Plugin' do KHTMLPart +Name[pt_BR]='Plugin' do KHTMLPart +Name[ru]=Модуль KHTMLPart +Name[sk]=KHTMLPart modul +Name[sl]=Vstavek za KHTMLPart +Name[sr]=Прикључак за део KHTML +Name[sr@Latn]=Priključak za deo KHTML +Name[sv]=Insticksprogram för KHTML-delprogram +Name[tr]=KHTMLPart Eklentisi +Name[zh_CN]=KHTMLPart 插件 +Name[zh_TW]=KHTMLPart 外掛程式 +Icon=kpartplugin.png +Category=C++/KDE +Comment=Generates a plugin for the KHTML part. +Comment[ca]=Genera un connector per a la part KHTML. +Comment[da]=Genererer et plugin for KHTML parten. +Comment[de]=Erstellt ein Modul für die Komponente KHTML +Comment[el]=Δημιουργεί ένα πρόσθετο για το τμήμα KHTML. +Comment[es]=Genera un complemento para KHTMLPart. +Comment[et]=KHTML-komponendi plugina loomine. +Comment[eu]=KHTML zatirako plugin bat sortzen du. +Comment[fa]=یک وصله برای جزء KHTML تولید می‌کند +Comment[fr]=Génère un module externe pour le composant KHTML. +Comment[gl]=Xera unha extensión para o 'part' KHTML. +Comment[hu]=Létrehoz egy KHTML-bővítőmodult. +Comment[it]=Genera un plugin per la part KHTML. +Comment[ja]=KHTML パートのためのプラグインを作成します +Comment[nds]=Stellt en Moduul för de Komponent KHTML op. +Comment[ne]=KHTML भागका लागि प्लगइन उत्पन्न गर्दछ । +Comment[nl]=Genereert een plugin voor de KHTML-part. +Comment[pl]=Generuje wtyczkę do KHTML part. +Comment[pt]=Gera um 'plugin' para a componente KHTML. +Comment[pt_BR]=Gera um 'plugin' para a componente KHTML. +Comment[ru]=Создание модуля для компонента KHTML. +Comment[sk]=Vygeneruje modul pre KHTML part. +Comment[sr]=Прави прикључак за део KHTML. +Comment[sr@Latn]=Pravi priključak za deo KHTML. +Comment[sv]=Skapar ett insticksprogram för KHTML-delprogrammet +Comment[zh_CN]=生成 KHTML 部件的插件。 +Comment[zh_TW]=產生一個 KHTML part 的外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/plugin_%{APPNAMELC}.cpp +Archive=kpartplugin.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/plugin_app.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/plugin_app.h +Dest=%{dest}/src/plugin_%{APPNAMELC}.h + +[FILE14] +Type=install +EscapeXML=true +Source=%{src}/plugin_app.rc +Dest=%{dest}/src/plugin_%{APPNAMELC}.rc + +[FILE15] +Type=install +Source=%{src}/hi16-action-plugin.png +Dest=%{dest}/src/hi16-action-plugin.png +Process=false + +[FILE16] +Type=install +Source=%{src}/hi22-action-plugin.png +Dest=%{dest}/src/hi32-action-plugin.png +Process=false + +[MSG] +Type=message +Comment=A KHTMLPart plugin was created in %{dest} +Comment[ca]=Un connector per a KHTMLPart ha estat creat en %{dest} +Comment[da]=Et KHTMLPart plugin blev oprettet i %{dest} +Comment[de]=Ein Modul für die Komponente KHTML wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο τμήμα KHTML δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento para KHTMLPart ha sido creado en %{dest} +Comment[et]=KHTMLPart plugin loodi asukohta %{dest} +Comment[eu]=KHTMLPart plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ جزء KHTML در %{dest} ایجاد شد +Comment[fr]=Un module externe pour KHTMLPart a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán KHTMLPart i %{dest} +Comment[gl]=Creouse unha extensión para KHTMLPart en %{dest} +Comment[hu]=Létrejött egy KHTML-bővítőmodul itt: %{dest} +Comment[it]=È stato creato un plugin KHTMLPart in %{dest} +Comment[ja]=KHTMLPart プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KHTMLPart-Moduul opstellt +Comment[ne]=KHTMLPart प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een KHTMLPart-plugin is aangemaakt in %{dest} +Comment[pl]=Wtyczka do KHTMLPart została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' KHTMLPart em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' KHTMLPart em %{dest} +Comment[ru]=Модуль для компонента KHTML создан в %{dest} +Comment[sk]=KHTML modul bol vytvorený v %{dest} +Comment[sr]=Прикључак за део KHTML направљен је у %{dest} +Comment[sr@Latn]=Priključak za deo KHTML napravljen je u %{dest} +Comment[sv]=Ett insticksprogram för KHTML-delprogrammet skapades i %{dest} +Comment[tr]=Bir KHTMLPart eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 KHTMLPart 插件 +Comment[zh_TW]=一個 KHTML 外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kpartplugin/kpartplugin.png b/languages/cpp/app_templates/kpartplugin/kpartplugin.png new file mode 100644 index 00000000..7d90241a Binary files /dev/null and b/languages/cpp/app_templates/kpartplugin/kpartplugin.png differ diff --git a/languages/cpp/app_templates/kpartplugin/plugin.kdevelop b/languages/cpp/app_templates/kpartplugin/plugin.kdevelop new file mode 100644 index 00000000..dc1b3e25 --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/plugin.kdevelop @@ -0,0 +1,114 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kpartplugin/plugin_app.cpp b/languages/cpp/app_templates/kpartplugin/plugin_app.cpp new file mode 100644 index 00000000..a9ee55a3 --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/plugin_app.cpp @@ -0,0 +1,109 @@ + +#include "plugin_%{APPNAMELC}.h" + +#include +#include +#include +#include +#include +#include + +Plugin%{APPNAME}::Plugin%{APPNAME}( QObject* parent, const char* name ) + : Plugin( parent, name ) +{ + // Instantiate all of your actions here. These will appear in + // Konqueror's menu and toolbars. + (void) new KAction( i18n("&Plugin Action"), "%{APPNAMELC}", 0, + this, SLOT(slotAction()), + actionCollection(), "plugin_action" ); +} + +Plugin%{APPNAME}::~Plugin%{APPNAME}() +{ +} + +void Plugin%{APPNAME}::slotAction() +{ + // This plugin assumes KHTMLPart. If your plugin can handle more + // than this or a different Part than this, simply delete or + // change the following block. + if ( !parent()->inherits("KHTMLPart") ) + { + QString title( i18n( "Cannot Translate Source" ) ); + QString text( i18n( "You cannot translate anything except web pages " + "with this plugin." ) ); + + KMessageBox::sorry( 0, text, title ); + return; + } + + // Get a handle on our parent so we may get the necessary data for + // processing + KHTMLPart *part = dynamic_cast(parent()); + + // This plugin only uses the URL. You may use whatever data you + // need. + KURL url( part->url() ); + + // This is a standard check to make sure we are dealing with a + // valid URL + if ( !url.isValid() ) + { + QString title( i18n( "Malformed URL" ) ); + QString text( i18n( "The URL you entered is not valid, please " + "correct it and try again" ) ); + + KMessageBox::sorry( 0, text, title ); + return; + } + +// The following block is very plugin specific. In this example, we +// translate the current page with AltaVista's BabelFish. You will +// definitely want to change this. +// BEGIN + KURL work( "http://babel.altavista.com/translate.dyn" ); + + QString query( "urltext=" ); + query += KURL::encode_string( url.url() ); + work.setQuery( query ); +// END + + // Finally, execute the request + part->openURL( work ); +} + +%{APPNAME}Factory::%{APPNAME}Factory() + : KLibFactory() +{ +} + +%{APPNAME}Factory::~%{APPNAME}Factory() +{ + delete s_instance; + s_instance = 0; +} + +QObject* %{APPNAME}Factory::createObject( QObject* parent, const char* name, const char*, const QStringList & ) +{ + return new Plugin%{APPNAME}( parent, name ); +} + +KInstance *%{APPNAME}Factory::instance() +{ + if ( !s_instance ) + s_instance = new KInstance( "%{APPNAMELC}" ); + return s_instance; +} + +extern "C" +{ + void* init_lib%{APPNAMELC}plugin() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}Factory; + } +} + +KInstance* %{APPNAME}Factory::s_instance = 0L; + +#include "plugin_%{APPNAMELC}.moc" diff --git a/languages/cpp/app_templates/kpartplugin/plugin_app.h b/languages/cpp/app_templates/kpartplugin/plugin_app.h new file mode 100644 index 00000000..e70ad1c1 --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/plugin_app.h @@ -0,0 +1,34 @@ + +#ifndef _PLUGIN_%{APPNAMEUC}_H_ +#define _PLUGIN_%{APPNAMEUC}_H_ + +#include +#include + +class Plugin%{APPNAME} : public KParts::Plugin +{ + Q_OBJECT +public: + Plugin%{APPNAME}( QObject* parent = 0, const char* name = 0 ); + virtual ~Plugin%{APPNAME}(); + +public slots: + void slotAction(); +}; + +class %{APPNAME}Factory : public KLibFactory +{ + Q_OBJECT +public: + %{APPNAME}Factory(); + virtual ~%{APPNAME}Factory(); + + virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, const char* name = "QObject", const QStringList &args = QStringList() ); + + static KInstance* instance(); + +private: + static KInstance* s_instance; +}; + +#endif // _PLUGIN_%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/kpartplugin/plugin_app.rc b/languages/cpp/app_templates/kpartplugin/plugin_app.rc new file mode 100644 index 00000000..a38ee14e --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/plugin_app.rc @@ -0,0 +1,11 @@ + + + + &Tools + + + + + + + diff --git a/languages/cpp/app_templates/kpartplugin/src-Makefile.am b/languages/cpp/app_templates/kpartplugin/src-Makefile.am new file mode 100644 index 00000000..52e29c09 --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/src-Makefile.am @@ -0,0 +1,22 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +KDE_ICON = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = lib%{APPNAMELC}plugin.la + +# This is all standard. Remove the LIB_KHTML reference if you are not +# using the KHTML Part +lib%{APPNAMELC}plugin_la_SOURCES = plugin_%{APPNAMELC}.cpp +lib%{APPNAMELC}plugin_la_LIBADD = $(LIB_KPARTS) $(LIB_KHTML) +lib%{APPNAMELC}plugin_la_LDFLAGS = -module -avoid-version -no-undefined $(KDE_PLUGIN) $(all_libraries) + +# Install the .rc file in the Part's directory (in this case, the part +# is KHTMLPart) +pluginsdir = $(kde_datadir)/khtml/kpartplugins +plugins_DATA = plugin_%{APPNAMELC}.rc + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kpartplugin/subdirs b/languages/cpp/app_templates/kpartplugin/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kpartplugin/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kscons_kmdi/INSTALL b/languages/cpp/app_templates/kscons_kmdi/INSTALL new file mode 100644 index 00000000..edeed594 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/INSTALL @@ -0,0 +1,83 @@ +REQUIREMENTS +------------ + +* KDE headers & libraries for kdelibs +* A Python interpreter for the compilation + +scons v0.96.1 or newer is recommended, but it's not required since a +minimum scons distribution is included in the package. + +BUILDING AND INSTALLING +----------------------- + +For configuring, compiling and installing the application and +if you do have Scons 0.96.1 or newer installed, just run: + +$ scons +$ scons install (as root user) + +In case you don't have Scons installed, you can use +the accompanying minimum scons by running: + +$ tar xjvf admin/scons-mini.tar.bz2 +$ ./scons +$ ./scons install + +ADVANCED BUILD FEATURES & DEINSTALLING +-------------------------------------- + +In case you want to execute many compilation jobs in parallel (because you +want to make use of a SMP system or a compile cluster, for instance), +you can use ('N' is the number of jobs which should be run in parallel): + +$ scons -jN + +A debug build of the program can be created by running: + +$ scons configure debug=1 +$ scons + +Finally, the software can be removed from your system by running + +$ scons -c install + +CONFIGURATION NOTES +------------------- + +The installation scripts are relying on the kde-config program. +The programs kde-config, qmake, uic and moc must be accesssible +through your PATH. + +Qt and kde may not be installed as expected (in QTDIR and KDEDIR) +So until kde-config is able to give that information, you may +have to give those paths. You may also want to tune the build. + +In these cases, you must first run "scons configure" with some options +before running "scons" and "scons install" + +Here are some examples : +On Fedora/Redhat +$ scons configure kdeincludes=/usr/include/kde/ +On Debian +$ scons configure qtincludes=/usr/include/qt/ kdeinclude=/usr/include/kde/ +To install in some particular location with additional include paths +$ scons configure prefix=~/tmp extraincludes=/tmp/include:/usr/local/include +For AMD64 and platforms where folders are like /usr/lib64 +$ scons configure libsuffix=64 + +For more options, run +scons --help + +The build system is based on bksys, a build system that replaces +autoconf, automake and make in a row. Feel free to report your opinion +about it to the bksys authors. + +PACKAGE CREATION +---------------- + +RPM packagers can use the DESTDIR environment variable +$ DESTDIR=/tmp/build-rpm/ scons install + +To use checkinstall, pass the following option +$ checkinstall --fstrans=no --nodoc scons install + diff --git a/languages/cpp/app_templates/kscons_kmdi/Makefile.am b/languages/cpp/app_templates/kscons_kmdi/Makefile.am new file mode 100644 index 00000000..aa6d9b53 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = app.kcfg app.kdevelop appkmdi.cpp appkmdi.h appkmdiView.cpp \ +appkmdiView.h INSTALL kmdikonsole.cpp kmdikonsole.h main.cpp \ +messages.sh prefs.ui QUICKSTART README SConscript-doc SConscript-src \ +SConstruct settings.kcfgc tips VERSION \ +app_part.cpp app_part.h app_part.rc app_shell.rc + +templateName= kscons_kmdi + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kscons_kmdi/QUICKSTART b/languages/cpp/app_templates/kscons_kmdi/QUICKSTART new file mode 100644 index 00000000..ceaf1bda --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/QUICKSTART @@ -0,0 +1,164 @@ +------------------------------------------ +SUMMARY : + +scons +scons install + + +The online documentation of bksys can be found at: +http://freehackers.org/~tnagy/bksys_manual.html + + ... and now for the quickstart: + +CONFIGURING AND COMPILING THE PROJECT(S) +SCONS TIPS +MOC PROCESSING +SCONS MINIMUM DISTRIBUTION +MORE TIPS + +------------------------------------------ +CONFIGURING AND COMPILING THE PROJECT(S) + +The program scons is usually launched as "scons" +When it is not intalled globally, one can run +"./scons" instead of "scons" (ie : to use the local scons +that comes with bksys - see below SCONS MINIMUM DISTRIBUTION +if you do not have scons already) + +To compile the project, you will then only need to launch +scons on the top-level directory, the scripts find and +cache the environment detected *automatically* : +-> scons + +To clean the project -> scons -c + +To install the project -> scons install +To install as root user -> su -c 'scons install' +To uninstall the project -> scons -c install +To uninstall (as root) -> su -c 'scons -c install' +To consult the help -> scons -h + +To (re)configure the project and give particular arguments, use : + -> scons configure debug=1 + +The variables are saved automatically after the first run +in files named *.cache.py (look at kde.cache.py, ..) + +------------------------------------------ +SCONS TIPS + +In a subdirectory, it is necessary to launch scons with the -u flag : +scons -u + +This is annoying and you probably want to add this to your .bashrc +export SCONSFLAGS=-u +and forget about it :) + +To make .deb or .rpm packages of your program, use : +checkinstall --fstrans=no --nodoc scons install +(if you have checkinstall on your system of course) + +To make scons run (much) faster, consult ./addons/README in bksys + +------------------------------------------ +MOC PROCESSING + +In qt programs, when a header 'foo.h' contains a class that has +signals and slots, then 'foo.h' must contain the macro Q_OBJECT +in order to compile. foo_moc.cpp is usually generated, and is +used to produce foo_moc.o which is linked with the +program or the library. + +In kde programs, 'foo.moc' is generated instead of foo_moc.cpp, +and it must be included at the very end of foo.cpp +(add #include "foo.moc" : this increases the speed of +compilation a *lot* and makes less object files. + +Both modes are provided though, see test6-mocfiesta/ + +------------------------------------------ +MINIMUM SCONS DISTRIBUTION + +A minimum scons distribution is included in the archive +for convenience to those who do not have scons packages +for their operating system or their linux +distribution. For a full and more recent version of scons, +please consult http://www.scons.org + +Including this scons distribution to your archive will add +about 63kb (compressed) , while including the necessary +kdescripts (admin/ directory, configure, autom4 cache stuff, +Makefile.in) can add easily 500kb (compressed). + +To compile with the scons distribution : +* unpack it with : + tar xjvf admin/scons-mini.tar.bz2 +* compile the program with : + ./scons (instead of just 'scons') +* install the program with : + ./scons install (instead of just 'scons install') + +More options : +* clean the object files with : + ./scons -c +* uninstall the program with with : + ./scons -c install +* create a package : + ./scons dist + +------------------------------------------ +MORE TIPS + +** static libraries ** +With Makefile.am, one had to make static libraries all the time +because it did not allow having source code in other directories. +This is not the case anymore with scons, so you can specify +sources in other directories relative to the sconscript file, ie: + test1_sources = ['mainfiles/main.cpp', 'otherfile/program.cpp'] + myenv.Program( target = "test1", source = test1_sources ) +To encourage you to switch to the new scheme, the static library +helper has been omitted (look at the end of kde.py if you need one) + +** libtool ** +The LaFile build tool is a cheat that allows klibloader to load +.so files without complaints. If you need real libtool support +you can have a look to the libtool directory : it can work but +remember that libtool is broken on many systems (invalid flags +among others), so when you can work without libtool +(small projects especially), just do it. + +** moc processing ** +As stated above, you should always add #include "foo.moc" +for your qt classes (Q_OBJECT) to save precious compilation time. + +** using a cache ** +It is a good idea to enable the cache feature in SConstruct, +especially if you are doing experiments (it saves your computer +from recompiling the same files over and over again ..). + +** threading ** +myenv.AppendUnique( CPPFLAGS = ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] ) + +** final notes *** +A medium-sized project containing several targets, libraries and data +files can be converted very quickly. +Also, remember that SConscript files are actually python scripts .. +you can use whatever python feature you want in them, ie: "for" loops, +this is how the kde helpers work (KDEprogram, KDEshlib ..). + +If you are stuck, you can also have a look at more complicated +bksys-based projects like kdissert or kshaderdesigner + +The scons man page and the wiki can be very useful, do not forget to +consult them when you encounter an issue + +------------------------------------------ + +I hope you will enjoy this alternative to the autotools +scripts for kde programming, at least as much as I do : +http://freehackers.org/~tnagy/kdissert/index.html + +Happy kde hacking, + +Thomas Nagy, 2004, 2005 + diff --git a/languages/cpp/app_templates/kscons_kmdi/README b/languages/cpp/app_templates/kscons_kmdi/README new file mode 100644 index 00000000..8085c7e7 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/README @@ -0,0 +1,111 @@ +----------------------------------------------- +Kde scons template quickstart +Author: Thomas Nagy +Date: 2005-04-04 +----------------------------------------------- + +This README file explains basic concepts necessary +for starting with this application template. + + +** Building and installing ** + +* To configure the application run "scons configure" + In some rare cases you may need to add flags: + scons configure qtincludes=/usr/include/qt3/include kdeincludes=/usr/lib/kde3/include + +* After building, launch the application and test the dcop + interface by using the command (search a bit) : + dcop + dcop appname-... + dcop appname-... instancenumber + dcop appname-... instancenumber switch_colors + dcop appname switch_colors + Or launch kdcop and search in the menus for your program + name and double-click on 'switch_colors()' + +* The usual targets call the following scons commands : + make -> scons + make clean -> scons -c + make install -> scons install + make uninstall -> scons -c install + make dist -> scons dist + +* To build apps, use KDEprogram, KDEshlib, etc. + these functions are documented at the bottom of kde.py + More information can be found in the QUICKSTART + +* The scons scripts for building kde applications originate + from the 'bksys' distribution. It contains several other examples + that detail the kpart building and the dcop interface + processing : + http://www.kde-apps.org/content/show.php?content=19243 + +* Extending the scons scripts for building the application : + The scons scripts are actually python scripts, so all the + usual tricks apply : 'for' and 'while' loops, 'if', 'else' .. + consult : + http://www.python.org for more information about python + http://www.scons.org for more informationabout scons + +* Simplify your life : install the project in your home directory for +testing purposes. +scons configure prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use KConfig XT to create your configuration dialogs and make +them more maintainable. + +For that, you will need to write two simple configuration files +in the src directory : .kcfg and a .kcfgc +The configure.in.in will need to be modified : change the line #MIN_CONFIG(3.0.0) +into #MIN_CONFIG(3.2.0) + +Take an example on the many apps found in the kdegames source package and consult : +http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-kparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +refer to the file po/SConscript and po/messages.sh + +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +KDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + diff --git a/languages/cpp/app_templates/kscons_kmdi/SConscript-doc b/languages/cpp/app_templates/kscons_kmdi/SConscript-doc new file mode 100644 index 00000000..6769a359 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/SConscript-doc @@ -0,0 +1,92 @@ +#! /usr/bin/env python +## This script demonstrates to build and install +## the documentation of a kde program with scons +## +## Thomas Nagy, 2005 + +## This file can be reused freely for any project (see COPYING) + +## First load the environment set in the top-level SConstruct file +Import( 'env' ) +myenv=env.Copy() + +## The following looks complicated but it is not +## We first define a function to install all files as documentation +## The documentation is of course lying in subfolders from here +## * normal files are installed under KDEDOC/destination +## * meinproc files are not installed, but processed into a single +## index.cache.bz2 which is installed afterwards + +## This is far more maintainable to have *one* file than +## having lots of almost empty SConscript in several folders + +################################################################### +# COMMON PART FOR PROCESSING DOCUMENTATION FOLDERS +################################################################### + +import os +import sys +import glob +import SCons.Util + +## Define this to 1 if you are writing documentation else to 0 :) +i_am_a_documentation_writer = 0 + +## This function uses env imported above +def processfolder(folder, lang, destination=""): + # folder is the folder to process + # lang is the language + # destination is the subdirectory in KDEDOC + + docfiles = glob.glob(folder+"/???*.*") # file files that are at least 4 chars wide :) + + # warn about errors + #if len(lang) != 2: + # print "error, lang must be a two-letter string, like 'en'" + + # when the destination is not given, use the folder + if len(destination) == 0: + destination=folder + + docbook_list = [] + for file in docfiles: + + # do not process folders + if not os.path.isfile(file): + continue + # do not process the cache file + if file == 'index.cache.bz2': + continue + # ignore invalid files (TODO??) + if len( SCons.Util.splitext( file ) ) <= 1 : + continue + + ext = SCons.Util.splitext( file )[1] + + # docbook files are processed by meinproc + if ext == '.docbook': + docbook_list.append( file ) + continue + + myenv.KDEinstall('KDEDOC', lang+'/'+destination, file) + + # Now process the index.docbook files .. + if len(docbook_list) == 0: + return + if not os.path.isfile( folder+'/index.docbook' ): + print "Error, index.docbook was not found in "+folder+'/index.docbook' + return + if i_am_a_documentation_writer: + for file in docbook_list: + myenv.Depends( folder+'index.cache.bz2', file ) + myenv.Meinproc( folder+'/index.cache.bz2', folder+'/index.docbook' ) + myenv.KDEinstall( 'KDEDOC', lang+'/'+destination, folder+'/index.cache.bz2' ) + +################################################################### +# TELL WHICH FOLDERS TO PROCESS +################################################################### + +## Use processfolder for each documentation directory +processfolder('en/', 'en', '%{APPNAMELC}') +processfolder('fr/', 'fr', '%{APPNAMELC}') + diff --git a/languages/cpp/app_templates/kscons_kmdi/SConscript-src b/languages/cpp/app_templates/kscons_kmdi/SConscript-src new file mode 100644 index 00000000..746cdf98 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/SConscript-src @@ -0,0 +1,60 @@ +#! /usr/bin/env python +## This script is a quick test to demonstrate (and test) +## the bksys moc handling '#include "file.moc"' can be added .. or not +## +## Thomas Nagy, 2005 +## This file can be reused freely for any project (see COPYING) + +Import('env') +myenv=env.Copy() + +## First build : the shell +## Each tab in it will hold an instance of the part .. + +%{APPNAMELC}_sources=""" +main.cpp +%{APPNAMELC}kmdi.cpp +%{APPNAMELC}kmdiView.cpp +kmdikonsole.cpp +settings.kcfgc +prefs.ui +""" +# Now that we have our list of sources we can build the program +myenv.KDEprogram( '%{APPNAMELC}', %{APPNAMELC}_sources ) # main program +myenv.KDEaddpaths_includes( './ ../' ) # additional paths +myenv.KDEaddlibs( 'qt-mt kdecore kio kparts kmdi' ) # additional libraries + +## Next, the kpart library +## using KDEshlib, the .so and .la are installed automatically when needed + +myenv2=env.Copy() +%{APPNAMELC}part_sources = '%{APPNAMELC}_part.cpp' +myenv2.KDEshlib( 'lib%{APPNAMELC}part', %{APPNAMELC}part_sources) +myenv2.KDEaddpaths_includes( './ #/' ) # the '#' means the top-level directory +myenv2.KDEaddlibs( 'qt-mt kio kdecore kdeprint kparts' ) +# myenv2.KDEaddflags_link( '-DQT_THREAD_SUPPORT' ) + +############################# +## Data files to install + +## NOTE: KDEinstall( resource_type, subdir, list of files ) + +## the .kcfg file +myenv.KDEinstall( 'KDEKCFG', '', '%{APPNAMELC}.kcfg' ) + +## the program .desktop file +myenv.KDEinstall( 'KDEMENU', '/Utilities', '%{APPNAMELC}.desktop' ) + +## the rc file - named *_shell.rc instead of *ui.rc for kpart apps +myenv.KDEinstall( 'KDEDATA', '/%{APPNAMELC}', '%{APPNAMELC}_shell.rc' ) + +## this servicetype desktop file goes in KDEXDG whether the other one goes in KDEMENU +myenv.KDEinstall( 'KDEXDG', '', '%{APPNAMELC}_part.desktop' ) + +## the kpart resource file +myenv.KDEinstall( 'KDEDATA', '/%{APPNAMELC}part', '%{APPNAMELC}_part.rc' ) + +## Installing icons is easy (hi-16-app-%{APPNAMELC}.png, hi-22-app-%{APPNAMELC}.png) +#myenv.KDEicon() + +## do not forget that this is a python script so even loops are allowed... :) diff --git a/languages/cpp/app_templates/kscons_kmdi/SConstruct b/languages/cpp/app_templates/kscons_kmdi/SConstruct new file mode 100644 index 00000000..b82de4e1 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/SConstruct @@ -0,0 +1,112 @@ +#! /usr/bin/env python + +""" +help -> scons -h +compile -> scons +clean -> scons -c +install -> scons install +uninstall -> scons -c install +configure -> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local + +Run from a subdirectory -> scons -u +The variables are saved automatically after the first run (look at cache/kde.cache.py, ..) +""" + +################################################################### +# LOAD THE ENVIRONMENT AND SET UP THE TOOLS +################################################################### + +## Load the builders in config +env = Environment( tools=['default', 'generic', 'kde'], toolpath=['./', './admin']) +#env = Environment( tools=['default', 'generic', 'kde', 'othertool'], toolpath=['./', './admin']) + +env.KDEuse("environ rpath") +#env.KDEuse("environ rpath lang_qt thread nohelp") + +################################################################### +# SCRIPTS FOR BUILDING THE TARGETS +################################################################### + +dirs=""" +src +doc +""" +env.subdirs(dirs) + +## Process the translations in the po/ directory +env.KDElang('po/', '%{APPNAMELC}') + +################################################################### +# CONVENIENCE FUNCTIONS TO EMULATE 'make dist' and 'make distclean' +################################################################### + +### To make a tarball of your masterpiece, use 'scons dist' +if 'dist' in COMMAND_LINE_TARGETS: + + ## The target scons dist requires the python module shutil which is in 2.3 + env.EnsurePythonVersion(2, 3) + + import os + APPNAME = 'bksys' + VERSION = os.popen("cat VERSION").read().rstrip() + FOLDER = APPNAME+'-'+VERSION + ARCHIVE = FOLDER+'.tar.bz2' + + ## If your app name and version number are defined in 'version.h', use this instead: + ## (contributed by Dennis Schridde devurandom@gmx@net) + #import re + #INFO = dict( re.findall( '(?m)^#define\s+(\w+)\s+(.*)(?<=\S)', open(r"version.h","rb").read() ) ) + #APPNAME = INFO['APPNAME'] + #VERSION = INFO['VERSION'] + + import shutil + import glob + + ## check if the temporary directory already exists + if os.path.isdir(FOLDER): + shutil.rmtree(FOLDER) + if os.path.isfile(ARCHIVE): + os.remove(ARCHIVE) + + ## create a temporary directory + startdir = os.getcwd() + shutil.copytree(startdir, FOLDER) + + ## remove our object files first + os.popen("find "+FOLDER+" -name \"*cache*\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f") + #os.popen("pushd %s && scons -c " % FOLDER) # TODO + + ## CVS cleanup + os.popen("find "+FOLDER+" -name \"CVS\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \".cvsignore\" | xargs rm -rf") + + ## Subversion cleanup + os.popen("find %s -name .svn -type d | xargs rm -rf" % FOLDER) + + ## GNU Arch cleanup + os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \".arch-i*\" | xargs rm -rf") + + ## Create the tarball (coloured output) + print "\033[92m"+"Writing archive "+ARCHIVE+"\033[0m" + os.popen("tar cjf "+ARCHIVE+" "+FOLDER) + + ## Remove the temporary directory + if os.path.isdir(FOLDER): + shutil.rmtree(FOLDER) + + env.Default(None) + env.Exit(0) + +### Emulate "make distclean" +if 'distclean' in COMMAND_LINE_TARGETS: + ## Remove the cache directory + import os, shutil + if os.path.isdir(env['CACHEDIR']): + shutil.rmtree(env['CACHEDIR']) + os.popen("find . -name \"*.pyc\" | xargs rm -rf") + + env.Default(None) + env.Exit(0) + diff --git a/languages/cpp/app_templates/kscons_kmdi/VERSION b/languages/cpp/app_templates/kscons_kmdi/VERSION new file mode 100644 index 00000000..2e293c30 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/VERSION @@ -0,0 +1 @@ +%{VERSION} diff --git a/languages/cpp/app_templates/kscons_kmdi/app.kcfg b/languages/cpp/app_templates/kscons_kmdi/app.kcfg new file mode 100644 index 00000000..f2c46b64 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/app.kcfg @@ -0,0 +1,12 @@ + + + + + + true + + + diff --git a/languages/cpp/app_templates/kscons_kmdi/app.kdevelop b/languages/cpp/app_templates/kscons_kmdi/app.kdevelop new file mode 100644 index 00000000..e6a14fff --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/app.kdevelop @@ -0,0 +1,169 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + . + false + + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + false + + + + + + + false + 1 + false + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + true + false + false + true + + + false + true + + + + + + + + + + + + -f + + -dP + + -f + -u3 -p + + + + + + + false + + + .h + .cpp + true + + + + true + 2 + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kscons_kmdi/app_part.cpp b/languages/cpp/app_templates/kscons_kmdi/app_part.cpp new file mode 100644 index 00000000..71155138 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/app_part.cpp @@ -0,0 +1,159 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}_part.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +typedef KParts::GenericFactory<%{APPNAMELC}Part> %{APPNAMELC}PartFactory; +K_EXPORT_COMPONENT_FACTORY( lib%{APPNAMELC}part, %{APPNAMELC}PartFactory ); + +%{APPNAMELC}Part::%{APPNAMELC}Part( QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, const QStringList & /*args*/) + : KParts::ReadWritePart(parent) +{ + // we need an instance + setInstance( %{APPNAMELC}PartFactory::instance() ); + + // this should be your custom internal widget + m_widget = new QMultiLineEdit( parentWidget, widgetName ); + + // notify the part that this is our internal widget + setWidget(m_widget); + + // create our actions + KStdAction::open(this, SLOT(fileOpen()), actionCollection()); + KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); + KStdAction::save(this, SLOT(save()), actionCollection()); + + // set our XML-UI resource file + setXMLFile("%{APPNAMELC}_part.rc"); + + // we are read-write by default + setReadWrite(true); + + // we are not modified since we haven't done anything yet + setModified(false); +} + +%{APPNAMELC}Part::~%{APPNAMELC}Part() +{ +} + +KAboutData *%{APPNAMELC}Part::createAboutData() +{ + // The non-i18n name here must be the same as the directory in + // which the part's rc file is installed + KAboutData *aboutData = new KAboutData("%{APPNAMELC}part", I18N_NOOP("%{APPNAMELC}Part"), "0.0.1"); + aboutData->addAuthor("%{AUTHOR}", 0, "%{EMAIL}"); + return aboutData; +} + +void %{APPNAMELC}Part::setReadWrite(bool rw) +{ + // notify your internal widget of the read-write state + m_widget->setReadOnly(!rw); + if (rw) + connect(m_widget, SIGNAL(textChanged()), + this, SLOT(setModified())); + else + { + disconnect(m_widget, SIGNAL(textChanged()), + this, SLOT(setModified())); + } + + ReadWritePart::setReadWrite(rw); +} + +void %{APPNAMELC}Part::setModified(bool modified) +{ + // get a handle on our Save action and make sure it is valid + KAction *save = actionCollection()->action(KStdAction::stdName(KStdAction::Save)); + if (!save) + return; + + // if so, we either enable or disable it based on the current + // state + if (modified) + save->setEnabled(true); + else + save->setEnabled(false); + + // in any event, we want our parent to do it's thing + ReadWritePart::setModified(modified); +} + +bool %{APPNAMELC}Part::openFile() +{ + // m_file is always local so we can use QFile on it + QFile file(m_file); + if (file.open(IO_ReadOnly) == false) + return false; + + // our example widget is text-based, so we use QTextStream instead + // of a raw QDataStream + QTextStream stream(&file); + QString str; + while (!stream.eof()) + str += stream.readLine() + "\n"; + + file.close(); + + // now that we have the entire file, display it + m_widget->setText(str); + + // just for fun, set the status bar + emit setStatusBarText( m_url.prettyURL() ); + + return true; +} + +bool %{APPNAMELC}Part::saveFile() +{ + // if we aren't read-write, return immediately + if (isReadWrite() == false) + return false; + + // m_file is always local, so we use QFile + QFile file(m_file); + if (file.open(IO_WriteOnly) == false) + return false; + + // use QTextStream to dump the text to the file + QTextStream stream(&file); + stream << m_widget->text(); + + file.close(); + + return true; +} + +void %{APPNAMELC}Part::fileOpen() +{ + // this slot is called whenever the File->Open menu is selected, + // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + // button is clicked + QString file_name = KFileDialog::getOpenFileName(); + + if (file_name.isEmpty() == false) + openURL(file_name); +} + +void %{APPNAMELC}Part::fileSaveAs() +{ + // this slot is called whenever the File->Save As menu is selected, + QString file_name = KFileDialog::getSaveFileName(); + if (file_name.isEmpty() == false) + saveAs(file_name); +} + +#include "%{APPNAMELC}_part.moc" diff --git a/languages/cpp/app_templates/kscons_kmdi/app_part.h b/languages/cpp/app_templates/kscons_kmdi/app_part.h new file mode 100644 index 00000000..e1dd002b --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/app_part.h @@ -0,0 +1,74 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}PART_H_ +#define _%{APPNAMEUC}PART_H_ + +#include +#include + +class QMultiLineEdit; +class QWidget; +class QPainter; +class KURL; +class KAboutData; + +/** + * This is a "Part". It that does all the real work in a KPart + * application. + * + * @short Main Part + * @author %{AUTHOR} + * @version %{VERSION} + */ +class %{APPNAMELC}Part : public KParts::ReadWritePart +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAMELC}Part(QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, const QStringList & /*args*/); + + /** + * Destructor + */ + virtual ~%{APPNAMELC}Part(); + + /** + * This is a virtual function inherited from KParts::ReadWritePart. + * A shell will use this to inform this Part if it should act + * read-only + */ + virtual void setReadWrite(bool rw); + + /** + * Reimplemented to disable and enable Save action + */ + virtual void setModified(bool modified); + + /** + * About data for the part + */ + static KAboutData *createAboutData(); + +protected: + /** + * This must be implemented by each part + */ + virtual bool openFile(); + + /** + * This must be implemented by each read-write part + */ + virtual bool saveFile(); + +protected slots: + void fileOpen(); + void fileSaveAs(); + +private: + QMultiLineEdit *m_widget; +}; + +#endif // _%{APPNAMEUC}PART_H_ diff --git a/languages/cpp/app_templates/kscons_kmdi/app_part.rc b/languages/cpp/app_templates/kscons_kmdi/app_part.rc new file mode 100644 index 00000000..cec8ec5c --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/app_part.rc @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/languages/cpp/app_templates/kscons_kmdi/app_shell.rc b/languages/cpp/app_templates/kscons_kmdi/app_shell.rc new file mode 100644 index 00000000..c8b2bb98 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/app_shell.rc @@ -0,0 +1,33 @@ + + + + &File + + + + + + + + &View + + &Settings + + + + + + + + + + + + +Main Toolbar + + + + + + diff --git a/languages/cpp/app_templates/kscons_kmdi/appkmdi.cpp b/languages/cpp/app_templates/kscons_kmdi/appkmdi.cpp new file mode 100644 index 00000000..be5d8862 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/appkmdi.cpp @@ -0,0 +1,394 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "settings.h" +#include "prefs.h" +#include "%{APPNAMELC}kmdiView.h" +#include "kmdikonsole.h" +#include "%{APPNAMELC}kmdi.h" + +%{APPNAMELC}kmdi::%{APPNAMELC}kmdi(KMdi::MdiMode mode) + : KMdiMainFrm( 0, "%{APPNAMELC}", mode ) +{ + resize( 800, 600 ); // start at 800x600 the first time + + setManagedDockPositionModeEnabled(true); + setStandardMDIMenuEnabled(false); + + m_manager = new KParts::PartManager(this); + connect(m_manager, SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(createGUI(KParts::Part*)) ); + +#if KDE_IS_VERSION(3, 3, 0) + setToolviewStyle( KMdi::TextAndIcon ); + tabWidget()->setHoverCloseButton( false ); +#endif + + setMenuForSDIModeSysButtons( menuBar() ); + setManagedDockPositionModeEnabled(true); + + m_console = NULL; + + // accept dnd + setAcceptDrops(true); + + // then, setup our actions + setupActions(); + + //createShellGUI( true ); + + // and a status bar + statusBar()->show(); + + connect( this, SIGNAL( viewActivated( KMdiChildView * ) ), this, SLOT( currentChanged( KMdiChildView * ) ) ); + + m_console = new kmdikonsole(this, "konsole"); + m_console->setIcon( SmallIcon("konsole") ); + m_console->setCaption( i18n("Terminal") ); + addToolWindow( m_console, KDockWidget::DockBottom, getMainDockWidget(), 20 ); + + +#if KDE_IS_VERSION(3, 3, 0) + if (Settings::showCloseTabsButton()) + { + QToolButton *but = new QToolButton(tabWidget()); + but->setIconSet(SmallIcon("tab_remove")); + but->adjustSize(); + but->hide(); + connect(but, SIGNAL(clicked()), actionCollection()->action( "file_close" ), SIGNAL(activated())); + tabWidget()->setCornerWidget(but, TopRight); + } +#endif + + // apply the saved mainwindow settings, if any, and ask the mainwindow + // to automatically save settings if changed: window size, toolbar + // position, icon size, etc. + setAutoSaveSettings(); + + // Read the dock config only if the app was started at least only once - kmdi is tricky + KConfig *cfg = new KConfig("%{APPNAMELC}_dockposrc"); + if (cfg->readNumEntry("%{APPNAMELC}_main_dock_settings", 0) == 1) manager()->readConfig(cfg); + cfg->writeEntry("%{APPNAMELC}_main_dock_settings", 1); + delete cfg; + + showTipOnStart(); +} + +%{APPNAMELC}kmdi::~%{APPNAMELC}kmdi() +{ + // Write the dock config on exit + KConfig *cfg = new KConfig("%{APPNAMELC}_dockposrc"); + manager()->writeConfig(cfg); + delete cfg; + delete m_console; +} + +void %{APPNAMELC}kmdi::setupActions() +{ + setXMLFile("%{APPNAMELC}_shell.rc"); + + KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection()); + + KStdAction::tipOfDay( this, SLOT( showTip() ), actionCollection() + )->setWhatsThis(i18n("This shows useful tips on the use of this application.")); + + KStdAction::close(this, SLOT(slotFileClose()), actionCollection()); + KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + KAction* action = KStdAction::configureToolbars(this, + SLOT(optionsConfigureToolbars()), actionCollection()); + + createGUI( NULL ); +} + +void %{APPNAMELC}kmdi::showTip() +{ + KTipDialog::showTip(this,QString::null,true); +} + +void %{APPNAMELC}kmdi::showTipOnStart() +{ + KTipDialog::showTip(this); +} + +void %{APPNAMELC}kmdi::slotFileNew() +{ + %{APPNAMELC}kmdiView *view = new %{APPNAMELC}kmdiView(this); + m_manager->addPart( view->part() ); + + addWindow( view ); + + // add the tree view to the widget stack + m_views += view; + + currentChanged( view ); +} + +void %{APPNAMELC}kmdi::openURL(const KURL & url) +{ + // check if the url is not already opened first + QValueList<%{APPNAMELC}kmdiView*>::iterator it = m_views.begin(); + QValueList<%{APPNAMELC}kmdiView*>::iterator end = m_views.end(); + for (; it != end; ++it) + { + %{APPNAMELC}kmdiView *view = *it; + if (view->part()->url() == url) + { + activateView(view); + return; + } + } + + %{APPNAMELC}kmdiView *view = new %{APPNAMELC}kmdiView(this); + m_manager->addPart( view->part() ); + + addWindow( view ); + + m_views += view; + + view->part()->openURL(url); + currentChanged( view ); +} + +void %{APPNAMELC}kmdi::currentChanged( KMdiChildView *current ) +{ + //kdWarning()<<"current view changed"<setActivePart(NULL); + //setCaption("()"); + return; + } + + // switch to the corresponding document + if ( m_views.contains( (%{APPNAMELC}kmdiView*) current ) ) + { + %{APPNAMELC}kmdiView *view = (%{APPNAMELC}kmdiView*) current; + //view->updateCaption(); + m_manager->setActivePart( view->part() ); + } +} + +void %{APPNAMELC}kmdi::slotFileClose() +{ + requestClose( activeWindow() ); +} + +bool %{APPNAMELC}kmdi::requestClose(KMdiChildView* v) +{ + // kdWarning()<<"closing view"<part()->queryClose()) + { + m_manager->removePart( view->part() ); + + closeWindow( view ); + m_views.clear(); + setCaption("kdissert"); + return true; + } + return false; + } + return true; + } + + %{APPNAMELC}kmdiView *view = (%{APPNAMELC}kmdiView*) v; + if ( m_views.contains( view ) ) + { + m_views.remove( view ); + if ( view->part()->queryClose() ) + { + m_manager->removePart( view->part() ); + + closeWindow( view ); + return true; + } + return false; + } + return true; +} + +void %{APPNAMELC}kmdi::slotFileQuit() +{ + close(); +} + +void %{APPNAMELC}kmdi::optionsShowToolbar() +{ + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void %{APPNAMELC}kmdi::optionsShowStatusbar() +{ + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void %{APPNAMELC}kmdi::optionsConfigureKeys() +{ + //KKeyDialog::configure(actionCollection()); + KKeyDialog dlg( false, this ); + QPtrList clients = guiFactory()->clients(); + + for( QPtrListIterator it( clients ); it.current(); ++it ) + dlg.insert ( (*it)->actionCollection(), (*it)->instance()->aboutData()->programName() ); + + dlg.configure(); + + for (int i=0; ipart()->reloadXML(); + } +} + +void %{APPNAMELC}kmdi::optionsConfigureToolbars() +{ + //saveMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void %{APPNAMELC}kmdi::newToolbarConfig() +{ + // This slot is called when user clicks "Ok" or "Apply" in the toolbar editor. + // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.) + //createGUI(); + //applyMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void %{APPNAMELC}kmdi::optionsPreferences() +{ + // The preference dialog is derived from prefs-base.ui which is subclassed into Prefs + // + // compare the names of the widgets in the .ui file + // to the names of the variables in the .kcfg file + if (KConfigDialog::showDialog("settings")) + return; + + KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self(), KDialogBase::Swallow); + dialog->addPage(new prefs(), i18n("General"), "package_settings"); + connect(dialog, SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); + dialog->show(); +} + +void %{APPNAMELC}kmdi::settingsChanged() +{ + // propagate the changes to our views + /*QValueList<%{APPNAMELC}kmdiView*>::iterator it = m_views.begin(); + QValueList<%{APPNAMELC}kmdiView*>::iterator end = m_views.end(); + for (; it != end; ++it) + { + %{APPNAMELC}kmdiView *view = *it; + view->settingsChanged(); + }*/ +} + +void %{APPNAMELC}kmdi::changeStatusbar(const QString& text) +{ + // display the text on the statusbar + statusBar()->message(text, 2000); +} + +void %{APPNAMELC}kmdi::dragEnterEvent(QDragEnterEvent *event) +{ + // accept uri drops only + event->accept(KURLDrag::canDecode(event)); +} + +void %{APPNAMELC}kmdi::dropEvent(QDropEvent *event) +{ + KURL::List urls; + + // see if we can decode a URI.. if not, just ignore it + if (KURLDrag::decode(event, urls) && !urls.isEmpty()) + { + // okay, we have a URI.. process it + const KURL &url = urls.first(); + + // load in the file + openURL(url); + } +} + +bool %{APPNAMELC}kmdi::queryClose() +{ + QValueList<%{APPNAMELC}kmdiView*>::iterator it; + + // check if we can close all documents + for (it = m_views.begin(); it != m_views.end(); ++it) + { + // kdWarning()<<"searching for the part"<part()->queryClose()) + { + return false; + } + } + + // and now close the documents + for (it = m_views.begin(); it != m_views.end(); ++it) + { + // now close all views + %{APPNAMELC}kmdiView *view = *it; + + m_manager->removePart( view->part() ); + closeWindow( view ); + } + + return true; +} + +#include "%{APPNAMELC}kmdi.moc" diff --git a/languages/cpp/app_templates/kscons_kmdi/appkmdi.h b/languages/cpp/app_templates/kscons_kmdi/appkmdi.h new file mode 100644 index 00000000..370a3034 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/appkmdi.h @@ -0,0 +1,82 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}KMDI_H +#define _%{APPNAMEUC}KMDI_H + +#include + +#include +#include +#include + +class KToggleAction; +class KRecentFilesAction; + +class kmdikonsole; +class KMdiChildView; +class QWidgetStack; +class %{APPNAMELC}kmdiView; +class TextProperties; +class MiscProperties; + +/** + * This class serves as the main window for %{APPNAMELC}kmdi. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + */ +class %{APPNAMELC}kmdi : public KMdiMainFrm +{ + Q_OBJECT + public: + %{APPNAMELC}kmdi( KMdi::MdiMode mode ); + virtual ~%{APPNAMELC}kmdi(); + void showTipOnStart(); + + public slots: + void openURL( const KURL& ); + + protected: + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dropEvent(QDropEvent *event); + virtual bool queryClose(); + + private slots: + void slotFileNew(); + void slotFileClose(); + void slotFileQuit(); + + /// this is called when a new file is saved + void showTip(); + + void optionsShowToolbar(); + void optionsShowStatusbar(); + void optionsConfigureKeys(); + void optionsConfigureToolbars(); + void optionsPreferences(); + void newToolbarConfig(); + + + void changeStatusbar(const QString& text); + + void currentChanged( KMdiChildView *current ); + bool requestClose(KMdiChildView* view); + + void settingsChanged(); + + private: + void setupAccel(); + void setupActions(); + + QValueList<%{APPNAMELC}kmdiView*> m_views; + + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; + + KParts::PartManager *m_manager; + + kmdikonsole *m_console; +}; + +#endif // _%{APPNAMEUC}KMDI_H + diff --git a/languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp b/languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp new file mode 100644 index 00000000..c4cfbf65 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp @@ -0,0 +1,63 @@ +%{CPP_TEMPLATE} + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "%{APPNAMELC}kmdiView.h" + + + %{APPNAMELC}kmdiView::%{APPNAMELC}kmdiView( QWidget *parentWidget, const char *name ) +: KMdiChildView( parentWidget, name ) +{ + m_part = NULL; + + // this routine will find and load our Part. it finds the Part by + // name which is a bad idea usually.. but it's alright in this + // case since our Part is made for this Shell + KLibFactory *factory = KLibLoader::self()->factory("lib%{APPNAMELC}part"); + //KLibFactory *factory = KLibLoader::self()->factory("libkatepart"); + if (factory) + { + // now that the Part is loaded, we cast it to a Part to get + // our hands on it + m_part = static_cast(factory->create( + this, "katepart", "KParts::ReadWritePart" )); + + if (m_part) + { + part()->widget()->setFocus(); + setFocusProxy(part()->widget()); + + QBoxLayout* layout = new QHBoxLayout(this, 0, -1, "kdissertviewlayout" ); + part()->widget()->reparent( this, QPoint(0, 0) ); + layout->addWidget( part()->widget() ); + + // connect( m_part, SIGNAL(stateChanged()), this, SLOT(updateCaption()) ); + } + else + { + KMessageBox::error(this, i18n("Could not find our part.")); + } + } + else + { + // if we couldn't find our Part, we exit since the Shell by + // itself can't do anything useful + KMessageBox::error(this, i18n("Could not find our part.")); + return; + } +} + +%{APPNAMELC}kmdiView::~%{APPNAMELC}kmdiView() +{ + delete m_part->widget(); +} + +#include "%{APPNAMELC}kmdiView.moc" diff --git a/languages/cpp/app_templates/kscons_kmdi/appkmdiView.h b/languages/cpp/app_templates/kscons_kmdi/appkmdiView.h new file mode 100644 index 00000000..66e5203b --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/appkmdiView.h @@ -0,0 +1,29 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}KMDIVIEW_H +#define _%{APPNAMEUC}KMDIVIEW_H + +#include +#include +#include + +/** + * This class serves as the %{APPNAMELC}kmdi view. + * + * @short main view class + */ +class %{APPNAMELC}kmdiView : public KMdiChildView +{ + Q_OBJECT + public: + %{APPNAMELC}kmdiView( QWidget *parentWidget=0L, const char *name=0L ); + virtual ~%{APPNAMELC}kmdiView(); + + KParts::ReadWritePart *part() { return m_part; } + + private: + KParts::ReadWritePart *m_part; +}; + +#endif // _%{APPNAMEUC}KMDIVIEW_H + diff --git a/languages/cpp/app_templates/kscons_kmdi/kmdikonsole.cpp b/languages/cpp/app_templates/kscons_kmdi/kmdikonsole.cpp new file mode 100644 index 00000000..da41685f --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/kmdikonsole.cpp @@ -0,0 +1,76 @@ +%{CPP_TEMPLATE} + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "kmdikonsole.h" + +kmdikonsole::kmdikonsole(QWidget *parent, const char *name) : QVBox(parent, name) +{ + m_haskonsole = false; + respawn(); +} + +kmdikonsole::~kmdikonsole() +{ +} + +void kmdikonsole::respawn() +{ + KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart"); + + if (!factory) return; + m_part = (KParts::ReadOnlyPart *) factory->create(this); + + if (!m_part) return; + + if (m_part->widget()->inherits("QFrame")) + ((QFrame*)m_part->widget())->setFrameStyle(QFrame::Panel|QFrame::Sunken); + + m_haskonsole=true; + connect( m_part, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); + + m_part->widget()->show(); + show(); +} + +void kmdikonsole::setDirectory(const QString &dirname) +{ + if (m_haskonsole) + { + KURL url(dirname); + if (m_part->url() != url) + m_part->openURL(url); + } +} + +void kmdikonsole::showEvent(QShowEvent *ev) +{ + QWidget::showEvent(ev); + activate(); +} + +void kmdikonsole::activate() +{ + if (m_haskonsole) + { + m_part->widget()->show(); + setFocusProxy(m_part->widget()); + m_part->widget()->setFocus(); + } +} + +void kmdikonsole::slotDestroyed() +{ + m_haskonsole=false; + respawn(); +} + +#include "kmdikonsole.moc" diff --git a/languages/cpp/app_templates/kscons_kmdi/kmdikonsole.h b/languages/cpp/app_templates/kscons_kmdi/kmdikonsole.h new file mode 100644 index 00000000..83adb417 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/kmdikonsole.h @@ -0,0 +1,32 @@ +%{H_TEMPLATE} + +#ifndef KMDIKONSOLE_H +#define KMDIKONSOLE_H + +#include + +class kmdikonsole : public QVBox +{ + Q_OBJECT + + public: + kmdikonsole( QWidget* parent, const char* name=0); + ~kmdikonsole(); + + public slots: + void setDirectory(const QString & dir); + void activate(); + + private slots: + void slotDestroyed(); + void respawn(); + + protected: + void showEvent(QShowEvent *ev); + + private: + KParts::ReadOnlyPart *m_part; + bool m_haskonsole; +}; + +#endif // KMDIKONSOLE_H diff --git a/languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.kdevtemplate b/languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.kdevtemplate new file mode 100644 index 00000000..4f0f8856 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.kdevtemplate @@ -0,0 +1,271 @@ +# KDE Config File +[General] +Name=Scons-based KMDI application +Name[ca]=Aplicació per a KMDI basada en Scons +Name[da]=Scons-baseret KMDI-program +Name[de]=Auf Scons basierende KMDI-Anwendung +Name[el]=Μια εφαρμογή KMDI βασισμένης στο Scons +Name[es]=Aplicación KMDI basada en Scons +Name[et]=KMDI rakendus Sconsi põhjal +Name[eu]=Scons-en oinarritutako KMDI aplikazioa +Name[fa]=کاربرد KMDI بر مبنای Scons +Name[fr]=Application KMDI basée sur Scons +Name[ga]=Feidhmchlár KMDI bunaithe ar Scons +Name[gl]=Aplicación KMDI baseada en Scons +Name[hu]=Scons-alapú KMDI-alkalmazás +Name[it]=Applicazione KMDI basata su scons +Name[ja]=Scons ベースの KMDI アプリケーション +Name[nds]=Op "scons" opbuut KMDI-Programm +Name[ne]=स्कोन-आधारित KMDI अनुप्रयोग +Name[nl]=Scons gebaseerde KMDI-toepassing +Name[pl]=Program KMDI wykorzystujący Scons +Name[pt]=Aplicação KMDI usando Scons +Name[pt_BR]=Aplicação KMDI usando Scons +Name[ru]=Многооконное приложение KDE на базе Scons +Name[sk]=KMDI aplikácia založená na Scons +Name[sr]=KMDI програм на основу Scons-а +Name[sr@Latn]=KMDI program na osnovu Scons-a +Name[sv]=Scons-baserat KMDI-program +Name[tr]=Scons tabanlı KMDI uygulaması +Name[zh_CN]=基于 Scons 的 KMDI 应用程序 +Name[zh_TW]=Scons 為基礎的 KMDI 應用程式 +Category=C++/KDE +Icon=kscons_kmdi.png +Comment=Generates a complex KMDI application. Scons scripts are provided for compiling and installing the application. +Comment[ca]=Genera una complexa aplicació per a KMDI. Els scripts en Scons són proveïts per a compilar i instal·lar l'aplicació. +Comment[da]=Genererer et komplekst KDE-program. Der sørges for scons-scripter til at kompilere og installere programmet. +Comment[de]=Erstellt eine aufwändige KMDI-Anwendung. Scons-Skripte zum Kompilieren und Installieren der Anwendung werden zur Verfügung gestellt. +Comment[el]=Δημιουργεί μια πολύπλοκη εφαρμογή KMDI. Προσφέρονται σενάρια Scons για τη μεταγλώττιση και εγκατάσταση της εφαρμογής. +Comment[es]=Genera una aplicación KMDI compleja. Se proporcionan guiones en Scons para compilar e instalar la aplicación. +Comment[et]=Keerulise KMDI rakenduse loomine. Luuakse ka Sconsi skriptid rakenduse kompileerimiseks ja paigaldamiseks. +Comment[eu]=KMDI aplikazio konplexu bat sortzen du. Aplikazioak konpilatu eta aplikazioa instalatzeko Scons script-ak sortzen ditu. +Comment[fa]=یک کاربرد پیچیدۀ KMDI تولید می‌کند. دست‌نوشته‌های Scons برای ترجمه و نصب کاربرد فراهم می‌شوند. +Comment[fr]=Génère une application KMDI évoluée. Des scripts Scons sont fournis pour compiler et installer l'application. +Comment[gl]=Xera unha aplicación complexa KMDI. Os scripts Scons proporciónanse para compilar e instalar a aplicación. +Comment[hu]=Létrehoz egy komplex KMDI alkalmazást. Az alkalmazás lefordításához és telepítéséhez Scons-szkriptek állnak rendelkezésre. +Comment[it]=Genera una applicazione KMDI complessa. Gli script scons sono forniti per compilare e istallare l'applicazione. +Comment[nds]=Stellt en vigeliensch KMDI-Programm op. Stellt Scons-Skripten för't Kompileren un Installeren vun't Programm praat. +Comment[ne]=जटिल KMDI अनुप्रयोग उत्पन्न गर्दछ । स्कोन स्क्रिप्टहरू अनुप्रयोग स्थापना र कम्पाइल गर्नका लागि प्रदान गरिन्छ । +Comment[nl]=Genereert een complexe KMDI-applicatie. Scons-scripts worden gebruikt voor compilatie en installatie. +Comment[pl]=Generuje złożony program z powłoką KMDI. Do kompilacji i instalacji wykorzystywany jest skrypt Scons. +Comment[pt]=Gera uma aplicação complexa com KMDI. Os ficheiros do Scons são fornecidos para compilar e instalar a aplicação. +Comment[pt_BR]=Gera uma aplicação complexa com KMDI. Os ficheiros do Scons são fornecidos para compilar e instalar a aplicação. +Comment[ru]=Создание полноценного многооконного приложения KDE. Для сборки и установки этого приложения будут использованы скрипты Scons. +Comment[sk]=Vygeneruje komplexnú KMDI aplikáciu. K dispozícii je Scons skriptna kompiláciu a inštaláciu aplikácie. +Comment[sr]=Прави сложени KMDI програм. Дате су Scons скрипте за превођење и инсталирање програма. +Comment[sr@Latn]=Pravi složeni KMDI program. Date su Scons skripte za prevođenje i instaliranje programa. +Comment[sv]=Skapar ett komplext KMDI-program. Scons-skript tillhandahålls för att kompilera och installera programmet. +Comment[tr]=Karmaşık bir KMDI uygulaması yaratır. Uygulamayı derlemek ve kurmak için scons betikleri sağlanmıştır. +Comment[zh_CN]=生成一个复杂的 KMDI 应用程序。此时会提供 Scons 脚本以供编译并安装应用程序。 +Comment[zh_TW]=產生一個複雜的 KMDI 應用程式。Scons 文稿是用於編譯與安裝應用程式。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/QUICKSTART +Archive=kscons_kmdi.tar.gz + +[SCONS] +Type=include +File=%{kdevelop}/template-common/scons.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{src}/SConscript-doc +Dest=%{dest}/doc/SConscript + +[FILE2] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE3] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE4] +Type=install +Source=%{src}/SConstruct +Dest=%{dest}/SConstruct + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE10] +Type=install +Source=%{src}/SConscript-src +Dest=%{dest}/src/SConscript + +[FILE11] +Type=install +Source=%{src}/appkmdi.cpp +Dest=%{dest}/src/%{APPNAMELC}kmdi.cpp + +[FILE12] +Type=install +Source=%{src}/appkmdi.h +Dest=%{dest}/src/%{APPNAMELC}kmdi.h + +[FILE13] +Type=install +EscapeXML=true +Source=%{src}/prefs.ui +Dest=%{dest}/src/prefs.ui + +[FILE14] +Type=install +Source=%{src}/appkmdiView.cpp +Dest=%{dest}/src/%{APPNAMELC}kmdiView.cpp + +[FILE15] +Type=install +Source=%{src}/appkmdiView.h +Dest=%{dest}/src/%{APPNAMELC}kmdiView.h + +[FILE19] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE20] +Type=install +EscapeXML=true +Source=%{src}/app_shell.rc +Dest=%{dest}/src/%{APPNAMELC}_shell.rc + +[FILE21] +Type=install +Source=%{src}/README +Dest=%{dest}/src/README + +[FILE22] +Type=install +Source=%{src}/app.kcfg +Dest=%{dest}/src/%{APPNAMELC}.kcfg + +[FILE23] +Type=install +Source=%{src}/settings.kcfgc +Dest=%{dest}/src/settings.kcfgc + +[FILE25] +Type=install +Source=%{src}/tips +Dest=%{dest}/src/tips + +[FILE27] +Type=install +Source=%{src}/VERSION +Dest=%{dest}/VERSION + +[FILE28] +Type=install +Source=%{src}/INSTALL +Dest=%{dest}/INSTALL + +[FILE29] +Type=install +Source=%{src}/QUICKSTART +Dest=%{dest}/QUICKSTART + +[FILE30] +Type=install +Source=%{src}/messages.sh +Dest=%{dest}/po/messages.sh + +[FILE31] +Type=install +Source=%{src}/kmdikonsole.cpp +Dest=%{dest}/src/kmdikonsole.cpp + +[FILE32] +Type=install +Source=%{src}/kmdikonsole.h +Dest=%{dest}/src/kmdikonsole.h + +[FILE34] +Type=install +Source=%{src}/app_part.cpp +Dest=%{dest}/src/%{APPNAMELC}_part.cpp + +[FILE35] +Type=install +Source=%{src}/app_part.h +Dest=%{dest}/src/%{APPNAMELC}_part.h + +[FILE36] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE37] +Type=install +Source=%{kdevelop}/template-common/kde-part.desktop +Dest=%{dest}/src/%{APPNAMELC}_part.desktop + +[FILE38] +Type=install +Source=%{src}/app_part.rc +Dest=%{dest}/src/%{APPNAMELC}_part.rc + +[MSG] +Type=message +Comment=A KDE application with scons scripts was created in %{dest} +Comment[ca]=Una aplicació per al KDE amb scripts en Scons ha estat creada e n %{dest} +Comment[da]=Et KDE program med scons-scripter blev oprette i %{dest} +Comment[de]=Eine KDE-Anwendung mit Scons-Skripten wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή KDE με σενάρια scons δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para KDE con guiones de Scons ha sido creada en %{dest} +Comment[et]=KDE rakendus Sconsi skriptidega loodi asukohta %{dest} +Comment[eu]=Scons script-dun KDE aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد KDE با دست‌نوشته‌های scons در %{dest} ایجاد شد +Comment[fr]=Une application KDE comprenant des scripts Scons a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár KDE le scripteanna scons i %{dest} +Comment[gl]=Creouse unha aplicación KDE con scripts scons en %{dest} +Comment[hu]=Létrejött egy Scons-szkripteket használó KDE-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KDE con gli script scons in %{dest} +Comment[ja]=Scons スクリプトを使った KDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KDE-Programm mit scons-Skripten opstellt +Comment[ne]=स्कोन स्क्रिप्टसँग केडीई अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een KDE applicatie inclusief Scons-scripts is aangemaakt in %{dest} +Comment[pl]=Program KDE ze skryptami scons utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KDE com ficheiros do 'scons' em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KDE com ficheiros do 'scons' em %{dest} +Comment[ru]=Приложение KDE со скриптами Scons создано в %{dest} +Comment[sk]=KDE aplikácia so scons skriptom bola vytvorená v %{dest} +Comment[sr]=KDE програм са scons скриптама направљен је у %{dest} +Comment[sr@Latn]=KDE program sa scons skriptama napravljen je u %{dest} +Comment[sv]=Ett KDE-program med Scons-skript skapades i %{dest} +Comment[tr]=Scons betikleri olan bir KDE uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了带 scons 脚本的 KDE 应用程序 +Comment[zh_TW]=一個內含 scons 文稿的 KDE 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.png b/languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.png new file mode 100644 index 00000000..72a347ee Binary files /dev/null and b/languages/cpp/app_templates/kscons_kmdi/kscons_kmdi.png differ diff --git a/languages/cpp/app_templates/kscons_kmdi/main.cpp b/languages/cpp/app_templates/kscons_kmdi/main.cpp new file mode 100644 index 00000000..7e43b0e7 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/main.cpp @@ -0,0 +1,60 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include +#include + +#include "%{APPNAMELC}kmdi.h" + +static const char description[] = +I18N_NOOP("A simple kmdi app"); + +static const char version[] = "0.0.1"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}" ); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + + // warning, utf-8 char + //about.addCredit( "bksys authors", "Thomas Nagy, Julien Antille" ); + + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + + KApplication app; + + // see if we are starting with session management + /*if (app.isRestored()) + { + RESTORE((%{APPNAME}); + } else */ + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + %{APPNAMELC}kmdi *widget = new %{APPNAMELC}kmdi( KMdi::IDEAlMode ); + + if (args->count() != 0) + { + for (int i=0; i < args->count(); i++) + { + widget->openURL( args->url( i ) ); + } + } + widget->show(); + args->clear(); + } + + return app.exec(); +} + diff --git a/languages/cpp/app_templates/kscons_kmdi/messages.sh b/languages/cpp/app_templates/kscons_kmdi/messages.sh new file mode 100755 index 00000000..a36f5c93 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/messages.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# Inspired by Makefile.common from coolo +# this script is used to update the .po files + +# To update the translations, you will need a specific gettext +# patched for kde and a lot of patience, tenacity, luck, time .. + + +# I guess one should only update the .po files when all .cpp files +# are generated (after a make or scons) + +# If you have a better way to do this, do not keep that info +# for yourself and help me to improve this script, thanks +# (tnagyemail-mail tat yahoo d0tt fr) + +SRCDIR=../test1-kconfigxt # srcdir is the directory containing the source code +TIPSDIR=$SRCDIR # tipsdir is the directory containing the tips + +KDEDIR=`kde-config --prefix` +EXTRACTRC=extractrc +KDEPOT=`kde-config --prefix`/include/kde.pot +XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x $KDEPOT " + +## check that kde.pot is available +if ! test -e $KDEPOT; then + echo "$KDEPOT does not exist, there is something wrong with your installation!" + XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale " +fi + +> rc.cpp + +## extract the strings +echo "extracting the strings" + +# process the .ui and .rc files +$EXTRACTRC `find $SRCDIR -iname *.rc` >> rc.cpp +$EXTRACTRC `find $SRCDIR -iname *.ui` >> rc.cpp +echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > $SRCDIR/_translatorinfo.cpp + +# process the tips - $SRCDIR is supposed to be where the tips are living +pushd $TIPSDIR; preparetips >tips.cpp; popd + +$XGETTEXT `find $SRCDIR -name "*.cpp"` -o kdissert.pot + +# remove the intermediate files +rm -f $TIPSDIR/tips.cpp +rm -f rc.cpp +rm -f $SRCDIR/_translatorinfo.cpp + +## now merge the .po files .. +echo "merging the .po files" + +for i in `ls *.po`; do + msgmerge $i kdissert.pot -o $i || exit 1 +done + +## finished +echo "Done" + diff --git a/languages/cpp/app_templates/kscons_kmdi/prefs.ui b/languages/cpp/app_templates/kscons_kmdi/prefs.ui new file mode 100644 index 00000000..5de638ef --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/prefs.ui @@ -0,0 +1,30 @@ + +prefs + + +prefs + + + +0 +0 +241 +47 + + + + +unnamed + + + +kcfg_showCloseTabsButton + + +Show close buttons on the right of tabs + + + + + + diff --git a/languages/cpp/app_templates/kscons_kmdi/settings.kcfgc b/languages/cpp/app_templates/kscons_kmdi/settings.kcfgc new file mode 100644 index 00000000..384510cd --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/settings.kcfgc @@ -0,0 +1,6 @@ +# Code generation options for kconfig_compiler +File=%{APPNAMELC}.kcfg +ClassName=Settings +Singleton=true +Mutators=col_background,col_foreground +# will create the necessary code for setting those variables diff --git a/languages/cpp/app_templates/kscons_kmdi/tips b/languages/cpp/app_templates/kscons_kmdi/tips new file mode 100644 index 00000000..56f29469 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/tips @@ -0,0 +1,6 @@ + + +

      ... that automake was not involved in building this kde application ?

      +

      The kdevelop template "kscons_kxt" was used instead.

      + +
      diff --git a/languages/cpp/app_templates/kscons_kxt/INSTALL b/languages/cpp/app_templates/kscons_kxt/INSTALL new file mode 100644 index 00000000..edeed594 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/INSTALL @@ -0,0 +1,83 @@ +REQUIREMENTS +------------ + +* KDE headers & libraries for kdelibs +* A Python interpreter for the compilation + +scons v0.96.1 or newer is recommended, but it's not required since a +minimum scons distribution is included in the package. + +BUILDING AND INSTALLING +----------------------- + +For configuring, compiling and installing the application and +if you do have Scons 0.96.1 or newer installed, just run: + +$ scons +$ scons install (as root user) + +In case you don't have Scons installed, you can use +the accompanying minimum scons by running: + +$ tar xjvf admin/scons-mini.tar.bz2 +$ ./scons +$ ./scons install + +ADVANCED BUILD FEATURES & DEINSTALLING +-------------------------------------- + +In case you want to execute many compilation jobs in parallel (because you +want to make use of a SMP system or a compile cluster, for instance), +you can use ('N' is the number of jobs which should be run in parallel): + +$ scons -jN + +A debug build of the program can be created by running: + +$ scons configure debug=1 +$ scons + +Finally, the software can be removed from your system by running + +$ scons -c install + +CONFIGURATION NOTES +------------------- + +The installation scripts are relying on the kde-config program. +The programs kde-config, qmake, uic and moc must be accesssible +through your PATH. + +Qt and kde may not be installed as expected (in QTDIR and KDEDIR) +So until kde-config is able to give that information, you may +have to give those paths. You may also want to tune the build. + +In these cases, you must first run "scons configure" with some options +before running "scons" and "scons install" + +Here are some examples : +On Fedora/Redhat +$ scons configure kdeincludes=/usr/include/kde/ +On Debian +$ scons configure qtincludes=/usr/include/qt/ kdeinclude=/usr/include/kde/ +To install in some particular location with additional include paths +$ scons configure prefix=~/tmp extraincludes=/tmp/include:/usr/local/include +For AMD64 and platforms where folders are like /usr/lib64 +$ scons configure libsuffix=64 + +For more options, run +scons --help + +The build system is based on bksys, a build system that replaces +autoconf, automake and make in a row. Feel free to report your opinion +about it to the bksys authors. + +PACKAGE CREATION +---------------- + +RPM packagers can use the DESTDIR environment variable +$ DESTDIR=/tmp/build-rpm/ scons install + +To use checkinstall, pass the following option +$ checkinstall --fstrans=no --nodoc scons install + diff --git a/languages/cpp/app_templates/kscons_kxt/Makefile.am b/languages/cpp/app_templates/kscons_kxt/Makefile.am new file mode 100644 index 00000000..8cce001c --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = app.cpp app.h main.cpp appui.rc app.kdevelop \ +appview.h appview.cpp appview_base.ui prefs-base.ui \ +prefs.cpp prefs.h app.kcfg settings.kcfgc messages.sh \ +SConstruct SConscript-doc SConscript-src tips VERSION \ +QUICKSTART INSTALL README + +templateName= kscons_kxt + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kscons_kxt/QUICKSTART b/languages/cpp/app_templates/kscons_kxt/QUICKSTART new file mode 100644 index 00000000..ceaf1bda --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/QUICKSTART @@ -0,0 +1,164 @@ +------------------------------------------ +SUMMARY : + +scons +scons install + + +The online documentation of bksys can be found at: +http://freehackers.org/~tnagy/bksys_manual.html + + ... and now for the quickstart: + +CONFIGURING AND COMPILING THE PROJECT(S) +SCONS TIPS +MOC PROCESSING +SCONS MINIMUM DISTRIBUTION +MORE TIPS + +------------------------------------------ +CONFIGURING AND COMPILING THE PROJECT(S) + +The program scons is usually launched as "scons" +When it is not intalled globally, one can run +"./scons" instead of "scons" (ie : to use the local scons +that comes with bksys - see below SCONS MINIMUM DISTRIBUTION +if you do not have scons already) + +To compile the project, you will then only need to launch +scons on the top-level directory, the scripts find and +cache the environment detected *automatically* : +-> scons + +To clean the project -> scons -c + +To install the project -> scons install +To install as root user -> su -c 'scons install' +To uninstall the project -> scons -c install +To uninstall (as root) -> su -c 'scons -c install' +To consult the help -> scons -h + +To (re)configure the project and give particular arguments, use : + -> scons configure debug=1 + +The variables are saved automatically after the first run +in files named *.cache.py (look at kde.cache.py, ..) + +------------------------------------------ +SCONS TIPS + +In a subdirectory, it is necessary to launch scons with the -u flag : +scons -u + +This is annoying and you probably want to add this to your .bashrc +export SCONSFLAGS=-u +and forget about it :) + +To make .deb or .rpm packages of your program, use : +checkinstall --fstrans=no --nodoc scons install +(if you have checkinstall on your system of course) + +To make scons run (much) faster, consult ./addons/README in bksys + +------------------------------------------ +MOC PROCESSING + +In qt programs, when a header 'foo.h' contains a class that has +signals and slots, then 'foo.h' must contain the macro Q_OBJECT +in order to compile. foo_moc.cpp is usually generated, and is +used to produce foo_moc.o which is linked with the +program or the library. + +In kde programs, 'foo.moc' is generated instead of foo_moc.cpp, +and it must be included at the very end of foo.cpp +(add #include "foo.moc" : this increases the speed of +compilation a *lot* and makes less object files. + +Both modes are provided though, see test6-mocfiesta/ + +------------------------------------------ +MINIMUM SCONS DISTRIBUTION + +A minimum scons distribution is included in the archive +for convenience to those who do not have scons packages +for their operating system or their linux +distribution. For a full and more recent version of scons, +please consult http://www.scons.org + +Including this scons distribution to your archive will add +about 63kb (compressed) , while including the necessary +kdescripts (admin/ directory, configure, autom4 cache stuff, +Makefile.in) can add easily 500kb (compressed). + +To compile with the scons distribution : +* unpack it with : + tar xjvf admin/scons-mini.tar.bz2 +* compile the program with : + ./scons (instead of just 'scons') +* install the program with : + ./scons install (instead of just 'scons install') + +More options : +* clean the object files with : + ./scons -c +* uninstall the program with with : + ./scons -c install +* create a package : + ./scons dist + +------------------------------------------ +MORE TIPS + +** static libraries ** +With Makefile.am, one had to make static libraries all the time +because it did not allow having source code in other directories. +This is not the case anymore with scons, so you can specify +sources in other directories relative to the sconscript file, ie: + test1_sources = ['mainfiles/main.cpp', 'otherfile/program.cpp'] + myenv.Program( target = "test1", source = test1_sources ) +To encourage you to switch to the new scheme, the static library +helper has been omitted (look at the end of kde.py if you need one) + +** libtool ** +The LaFile build tool is a cheat that allows klibloader to load +.so files without complaints. If you need real libtool support +you can have a look to the libtool directory : it can work but +remember that libtool is broken on many systems (invalid flags +among others), so when you can work without libtool +(small projects especially), just do it. + +** moc processing ** +As stated above, you should always add #include "foo.moc" +for your qt classes (Q_OBJECT) to save precious compilation time. + +** using a cache ** +It is a good idea to enable the cache feature in SConstruct, +especially if you are doing experiments (it saves your computer +from recompiling the same files over and over again ..). + +** threading ** +myenv.AppendUnique( CPPFLAGS = ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] ) + +** final notes *** +A medium-sized project containing several targets, libraries and data +files can be converted very quickly. +Also, remember that SConscript files are actually python scripts .. +you can use whatever python feature you want in them, ie: "for" loops, +this is how the kde helpers work (KDEprogram, KDEshlib ..). + +If you are stuck, you can also have a look at more complicated +bksys-based projects like kdissert or kshaderdesigner + +The scons man page and the wiki can be very useful, do not forget to +consult them when you encounter an issue + +------------------------------------------ + +I hope you will enjoy this alternative to the autotools +scripts for kde programming, at least as much as I do : +http://freehackers.org/~tnagy/kdissert/index.html + +Happy kde hacking, + +Thomas Nagy, 2004, 2005 + diff --git a/languages/cpp/app_templates/kscons_kxt/README b/languages/cpp/app_templates/kscons_kxt/README new file mode 100644 index 00000000..8085c7e7 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/README @@ -0,0 +1,111 @@ +----------------------------------------------- +Kde scons template quickstart +Author: Thomas Nagy +Date: 2005-04-04 +----------------------------------------------- + +This README file explains basic concepts necessary +for starting with this application template. + + +** Building and installing ** + +* To configure the application run "scons configure" + In some rare cases you may need to add flags: + scons configure qtincludes=/usr/include/qt3/include kdeincludes=/usr/lib/kde3/include + +* After building, launch the application and test the dcop + interface by using the command (search a bit) : + dcop + dcop appname-... + dcop appname-... instancenumber + dcop appname-... instancenumber switch_colors + dcop appname switch_colors + Or launch kdcop and search in the menus for your program + name and double-click on 'switch_colors()' + +* The usual targets call the following scons commands : + make -> scons + make clean -> scons -c + make install -> scons install + make uninstall -> scons -c install + make dist -> scons dist + +* To build apps, use KDEprogram, KDEshlib, etc. + these functions are documented at the bottom of kde.py + More information can be found in the QUICKSTART + +* The scons scripts for building kde applications originate + from the 'bksys' distribution. It contains several other examples + that detail the kpart building and the dcop interface + processing : + http://www.kde-apps.org/content/show.php?content=19243 + +* Extending the scons scripts for building the application : + The scons scripts are actually python scripts, so all the + usual tricks apply : 'for' and 'while' loops, 'if', 'else' .. + consult : + http://www.python.org for more information about python + http://www.scons.org for more informationabout scons + +* Simplify your life : install the project in your home directory for +testing purposes. +scons configure prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use KConfig XT to create your configuration dialogs and make +them more maintainable. + +For that, you will need to write two simple configuration files +in the src directory : .kcfg and a .kcfgc +The configure.in.in will need to be modified : change the line #MIN_CONFIG(3.0.0) +into #MIN_CONFIG(3.2.0) + +Take an example on the many apps found in the kdegames source package and consult : +http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-kparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +refer to the file po/SConscript and po/messages.sh + +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +KDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + diff --git a/languages/cpp/app_templates/kscons_kxt/SConscript-doc b/languages/cpp/app_templates/kscons_kxt/SConscript-doc new file mode 100644 index 00000000..6769a359 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/SConscript-doc @@ -0,0 +1,92 @@ +#! /usr/bin/env python +## This script demonstrates to build and install +## the documentation of a kde program with scons +## +## Thomas Nagy, 2005 + +## This file can be reused freely for any project (see COPYING) + +## First load the environment set in the top-level SConstruct file +Import( 'env' ) +myenv=env.Copy() + +## The following looks complicated but it is not +## We first define a function to install all files as documentation +## The documentation is of course lying in subfolders from here +## * normal files are installed under KDEDOC/destination +## * meinproc files are not installed, but processed into a single +## index.cache.bz2 which is installed afterwards + +## This is far more maintainable to have *one* file than +## having lots of almost empty SConscript in several folders + +################################################################### +# COMMON PART FOR PROCESSING DOCUMENTATION FOLDERS +################################################################### + +import os +import sys +import glob +import SCons.Util + +## Define this to 1 if you are writing documentation else to 0 :) +i_am_a_documentation_writer = 0 + +## This function uses env imported above +def processfolder(folder, lang, destination=""): + # folder is the folder to process + # lang is the language + # destination is the subdirectory in KDEDOC + + docfiles = glob.glob(folder+"/???*.*") # file files that are at least 4 chars wide :) + + # warn about errors + #if len(lang) != 2: + # print "error, lang must be a two-letter string, like 'en'" + + # when the destination is not given, use the folder + if len(destination) == 0: + destination=folder + + docbook_list = [] + for file in docfiles: + + # do not process folders + if not os.path.isfile(file): + continue + # do not process the cache file + if file == 'index.cache.bz2': + continue + # ignore invalid files (TODO??) + if len( SCons.Util.splitext( file ) ) <= 1 : + continue + + ext = SCons.Util.splitext( file )[1] + + # docbook files are processed by meinproc + if ext == '.docbook': + docbook_list.append( file ) + continue + + myenv.KDEinstall('KDEDOC', lang+'/'+destination, file) + + # Now process the index.docbook files .. + if len(docbook_list) == 0: + return + if not os.path.isfile( folder+'/index.docbook' ): + print "Error, index.docbook was not found in "+folder+'/index.docbook' + return + if i_am_a_documentation_writer: + for file in docbook_list: + myenv.Depends( folder+'index.cache.bz2', file ) + myenv.Meinproc( folder+'/index.cache.bz2', folder+'/index.docbook' ) + myenv.KDEinstall( 'KDEDOC', lang+'/'+destination, folder+'/index.cache.bz2' ) + +################################################################### +# TELL WHICH FOLDERS TO PROCESS +################################################################### + +## Use processfolder for each documentation directory +processfolder('en/', 'en', '%{APPNAMELC}') +processfolder('fr/', 'fr', '%{APPNAMELC}') + diff --git a/languages/cpp/app_templates/kscons_kxt/SConscript-src b/languages/cpp/app_templates/kscons_kxt/SConscript-src new file mode 100644 index 00000000..02432be5 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/SConscript-src @@ -0,0 +1,72 @@ +#! /usr/bin/env python +# SConscript for %{APPNAMELC} compilation and installation + +############################ +## Configuration + +## use the environment set in the top-level +## SConstruct file + +Import('env') +myenv=env.Copy() + +############################# +## Programs to build + +%{APPNAMELC}_sources=""" +settings.kcfgc +main.cpp +prefs.cpp +%{APPNAMELC}.skel +%{APPNAMELC}.cpp +%{APPNAMELC}view.cpp +prefs-base.ui +%{APPNAMELC}view_base.ui +""" + +# Our main program +# KDEprogram add the file to the install targets automatically, +# so you do not need to write myenv.KDEinstall( env['KDEBIN'], %{APPNAMELC}) +myenv.KDEprogram( "%{APPNAMELC}", %{APPNAMELC}_sources ) + +############################ +## Customization + +## Additional include paths for compiling the source files +## Always add '../' (top-level directory) because moc makes code that needs it +myenv.KDEaddpaths_includes( "./ ../" ) + +## Necessary libraries to link against +myenv.KDEaddlibs( "qt-mt kio kdecore kdeprint" ) + +## This shows how to add other link flags to the program +# myenv.KDEaddflags_link('-export-dynamic') + +## If you are using QThread, add this line +# myenv.KDEaddflags_link( '-DQT_THREAD_SUPPORT' ) + +############################# +## Installation + +## NOTE 1: The program is installed automatically +## NOTE 2: KDEinstall( resource_type, subdirectory, list_of_files ) + +## The ui.rc file and the tips go into datadir/appname/ +myenv.KDEinstall( 'KDEDATA', '/%{APPNAMELC}', '%{APPNAMELC}ui.rc' ) +myenv.KDEinstall( 'KDEDATA', '/%{APPNAMELC}', 'tips' ) + +## The kcfg file is installed in a global kcfg directory +myenv.KDEinstall( 'KDEKCFG', '', '%{APPNAMELC}.kcfg' ) + +## Warning : there is a difference between the normal destop file used for the menu +## and the servicetype desktop file, so they go in different directories +myenv.KDEinstall( 'KDEMENU', 'Utilities/', '%{APPNAMELC}.desktop' ) + +## Use this when you need to install a mimetype file +#myenv.KDEinstall( 'KDEMIME', 'application', 'x-%{APPNAMELC}.desktop' ) + +## Installing icons is easy (hi-16-app-%{APPNAMELC}.png, hi-22-app-%{APPNAMELC}.png) +#myenv.KDEicon() + +## do not forget that this is a python script so even loops are allowed... :) + diff --git a/languages/cpp/app_templates/kscons_kxt/SConstruct b/languages/cpp/app_templates/kscons_kxt/SConstruct new file mode 100644 index 00000000..b82de4e1 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/SConstruct @@ -0,0 +1,112 @@ +#! /usr/bin/env python + +""" +help -> scons -h +compile -> scons +clean -> scons -c +install -> scons install +uninstall -> scons -c install +configure -> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local + +Run from a subdirectory -> scons -u +The variables are saved automatically after the first run (look at cache/kde.cache.py, ..) +""" + +################################################################### +# LOAD THE ENVIRONMENT AND SET UP THE TOOLS +################################################################### + +## Load the builders in config +env = Environment( tools=['default', 'generic', 'kde'], toolpath=['./', './admin']) +#env = Environment( tools=['default', 'generic', 'kde', 'othertool'], toolpath=['./', './admin']) + +env.KDEuse("environ rpath") +#env.KDEuse("environ rpath lang_qt thread nohelp") + +################################################################### +# SCRIPTS FOR BUILDING THE TARGETS +################################################################### + +dirs=""" +src +doc +""" +env.subdirs(dirs) + +## Process the translations in the po/ directory +env.KDElang('po/', '%{APPNAMELC}') + +################################################################### +# CONVENIENCE FUNCTIONS TO EMULATE 'make dist' and 'make distclean' +################################################################### + +### To make a tarball of your masterpiece, use 'scons dist' +if 'dist' in COMMAND_LINE_TARGETS: + + ## The target scons dist requires the python module shutil which is in 2.3 + env.EnsurePythonVersion(2, 3) + + import os + APPNAME = 'bksys' + VERSION = os.popen("cat VERSION").read().rstrip() + FOLDER = APPNAME+'-'+VERSION + ARCHIVE = FOLDER+'.tar.bz2' + + ## If your app name and version number are defined in 'version.h', use this instead: + ## (contributed by Dennis Schridde devurandom@gmx@net) + #import re + #INFO = dict( re.findall( '(?m)^#define\s+(\w+)\s+(.*)(?<=\S)', open(r"version.h","rb").read() ) ) + #APPNAME = INFO['APPNAME'] + #VERSION = INFO['VERSION'] + + import shutil + import glob + + ## check if the temporary directory already exists + if os.path.isdir(FOLDER): + shutil.rmtree(FOLDER) + if os.path.isfile(ARCHIVE): + os.remove(ARCHIVE) + + ## create a temporary directory + startdir = os.getcwd() + shutil.copytree(startdir, FOLDER) + + ## remove our object files first + os.popen("find "+FOLDER+" -name \"*cache*\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f") + #os.popen("pushd %s && scons -c " % FOLDER) # TODO + + ## CVS cleanup + os.popen("find "+FOLDER+" -name \"CVS\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \".cvsignore\" | xargs rm -rf") + + ## Subversion cleanup + os.popen("find %s -name .svn -type d | xargs rm -rf" % FOLDER) + + ## GNU Arch cleanup + os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \".arch-i*\" | xargs rm -rf") + + ## Create the tarball (coloured output) + print "\033[92m"+"Writing archive "+ARCHIVE+"\033[0m" + os.popen("tar cjf "+ARCHIVE+" "+FOLDER) + + ## Remove the temporary directory + if os.path.isdir(FOLDER): + shutil.rmtree(FOLDER) + + env.Default(None) + env.Exit(0) + +### Emulate "make distclean" +if 'distclean' in COMMAND_LINE_TARGETS: + ## Remove the cache directory + import os, shutil + if os.path.isdir(env['CACHEDIR']): + shutil.rmtree(env['CACHEDIR']) + os.popen("find . -name \"*.pyc\" | xargs rm -rf") + + env.Default(None) + env.Exit(0) + diff --git a/languages/cpp/app_templates/kscons_kxt/VERSION b/languages/cpp/app_templates/kscons_kxt/VERSION new file mode 100644 index 00000000..2e293c30 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/VERSION @@ -0,0 +1 @@ +%{VERSION} diff --git a/languages/cpp/app_templates/kscons_kxt/app.cpp b/languages/cpp/app_templates/kscons_kxt/app.cpp new file mode 100644 index 00000000..bc343554 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/app.cpp @@ -0,0 +1,177 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include "settings.h" +#include "prefs.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +%{APPNAME}::%{APPNAME}() + : KMainWindow( 0, "%{APPNAME}" ), + m_view(new %{APPNAME}View(this)), + m_printer(0) +{ + // accept dnd + setAcceptDrops(true); + + // tell the KMainWindow that this is indeed the main widget + setCentralWidget(m_view); + + // then, setup our actions + setupActions(); + + // and a status bar + statusBar()->show(); + + // apply the saved mainwindow settings, if any, and ask the mainwindow + // to automatically save settings if changed: window size, toolbar + // position, icon size, etc. + setAutoSaveSettings(); + + // allow the view to change the statusbar and caption + connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)), + this, SLOT(changeStatusbar(const QString&))); + connect(m_view, SIGNAL(signalChangeCaption(const QString&)), + this, SLOT(changeCaption(const QString&))); + + showTipOnStart(); +} + +%{APPNAME}::~%{APPNAME}() +{ +} + +void %{APPNAME}::setupActions() +{ + KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::tipOfDay( this, SLOT( showTip() ), actionCollection() + )->setWhatsThis(i18n("This shows useful tips on the use of this application.")); + + KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); + KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + // custom menu and menu item - the slot is in the class %{APPNAME}View + KAction *custom = new KAction(i18n("Swi&tch Colors"), 0, + m_view, SLOT(switchColors()), + actionCollection(), "switch_action"); + + createGUI(); +} + +void %{APPNAME}::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // create a new window + (new %{APPNAME})->show(); +} + +void %{APPNAME}::optionsShowToolbar() +{ + // this is all very cut and paste code for showing/hiding the + // toolbar + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void %{APPNAME}::optionsShowStatusbar() +{ + // show/hide the statusbar + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void %{APPNAME}::optionsConfigureKeys() +{ + KKeyDialog::configure(actionCollection()); +} + +void %{APPNAME}::optionsConfigureToolbars() +{ + // use the standard toolbar editor + saveMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void %{APPNAME}::newToolbarConfig() +{ + // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor. + // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.) + createGUI(); + + applyMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void %{APPNAME}::optionsPreferences() +{ + // The preference dialog is derived from prefs-base.ui which is subclassed into Prefs + // + // compare the names of the widgets in the .ui file + // to the names of the variables in the .kcfg file + KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self(), KDialogBase::Swallow); + dialog->addPage(new Prefs(), i18n("General"), "package_settings"); + connect(dialog, SIGNAL(settingsChanged()), m_view, SLOT(settingsChanged())); + dialog->show(); +} + +void %{APPNAME}::changeStatusbar(const QString& text) +{ + // display the text on the statusbar + statusBar()->message(text, 2000); +} + +void %{APPNAME}::changeCaption(const QString& text) +{ + // display the text on the caption + setCaption(text); +} + +void %{APPNAME}::showTip() +{ + KTipDialog::showTip(this,QString::null,true); +} + +void %{APPNAME}::showTipOnStart() +{ + KTipDialog::showTip(this); +} + +void %{APPNAME}::switch_colors() +{ + if (!m_view) + return; + m_view->switchColors(); +} + +#include "%{APPNAMELC}.moc" + diff --git a/languages/cpp/app_templates/kscons_kxt/app.h b/languages/cpp/app_templates/kscons_kxt/app.h new file mode 100644 index 00000000..4f855793 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/app.h @@ -0,0 +1,73 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include "%{APPNAMELC}view.h" + +class KPrinter; +class KToggleAction; +class KURL; + +/** + * This class serves as the main window for %{APPNAME}. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME} : public KMainWindow, public DCOPObject +{ + K_DCOP + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAME}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAME}(); + +k_dcop: + virtual void switch_colors(); + +private slots: + void fileNew(); + void optionsShowToolbar(); + void optionsShowStatusbar(); + void optionsConfigureKeys(); + void optionsConfigureToolbars(); + void optionsPreferences(); + void newToolbarConfig(); + void showTip(); + + void changeStatusbar(const QString& text); + void changeCaption(const QString& text); + +private: + void setupAccel(); + void setupActions(); + void showTipOnStart(); + +private: + %{APPNAME}View *m_view; + + KPrinter *m_printer; + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; +}; + +#endif // _%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/kscons_kxt/app.kcfg b/languages/cpp/app_templates/kscons_kxt/app.kcfg new file mode 100644 index 00000000..d5325b92 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/app.kcfg @@ -0,0 +1,21 @@ + + + + + + + black + + + + yellow + + + + 2 + + + diff --git a/languages/cpp/app_templates/kscons_kxt/app.kdevelop b/languages/cpp/app_templates/kscons_kxt/app.kdevelop new file mode 100644 index 00000000..e6a14fff --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/app.kdevelop @@ -0,0 +1,169 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + . + false + + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + false + + + + + + + false + 1 + false + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + true + false + false + true + + + false + true + + + + + + + + + + + + -f + + -dP + + -f + -u3 -p + + + + + + + false + + + .h + .cpp + true + + + + true + 2 + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kscons_kxt/appui.rc b/languages/cpp/app_templates/kscons_kxt/appui.rc new file mode 100644 index 00000000..06549878 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/appui.rc @@ -0,0 +1,8 @@ + + + + &Move + + + + diff --git a/languages/cpp/app_templates/kscons_kxt/appview.cpp b/languages/cpp/app_templates/kscons_kxt/appview.cpp new file mode 100644 index 00000000..7dc99f61 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/appview.cpp @@ -0,0 +1,41 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}view.h" +#include "settings.h" + +#include +#include + +%{APPNAME}View::%{APPNAME}View(QWidget *parent) + : %{APPNAME}view_base(parent) +{ + settingsChanged(); +} + +%{APPNAME}View::~%{APPNAME}View() +{ + +} + +void %{APPNAME}View::switchColors() +{ + // switch the foreground/background colors of the label + QColor color = Settings::col_background(); + Settings::setCol_background( Settings::col_foreground() ); + Settings::setCol_foreground( color ); + + settingsChanged(); +} + +void %{APPNAME}View::settingsChanged() +{ + sillyLabel->setPaletteBackgroundColor( Settings::col_background() ); + sillyLabel->setPaletteForegroundColor( Settings::col_foreground() ); + + // i18n : internationalization + sillyLabel->setText( i18n("This project is %1 days old").arg(Settings::val_time()) ); + emit signalChangeStatusbar( i18n("Settings changed") ); +} + +#include "%{APPNAMELC}view.moc" + diff --git a/languages/cpp/app_templates/kscons_kxt/appview.h b/languages/cpp/app_templates/kscons_kxt/appview.h new file mode 100644 index 00000000..86d097a4 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/appview.h @@ -0,0 +1,52 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}VIEW_H_ +#define _%{APPNAMEUC}VIEW_H_ + +#include + +#include "%{APPNAMELC}view_base.h" + +class QPainter; +class KURL; + +/** + * This is the main view class for %{APPNAME}. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * + * @short Main view + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAME}View : public %{APPNAME}view_base +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAME}View(QWidget *parent); + + /** + * Destructor + */ + virtual ~%{APPNAME}View(); + +signals: + /** + * Use this signal to change the content of the statusbar + */ + void signalChangeStatusbar(const QString& text); + + /** + * Use this signal to change the content of the caption + */ + void signalChangeCaption(const QString& text); + +public slots: + void switchColors(); + void settingsChanged(); +}; + +#endif // _%{APPNAMEUC}VIEW_H_ diff --git a/languages/cpp/app_templates/kscons_kxt/appview_base.ui b/languages/cpp/app_templates/kscons_kxt/appview_base.ui new file mode 100644 index 00000000..6cd36d2c --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/appview_base.ui @@ -0,0 +1,35 @@ + +%{APPNAME}view_base +%{CPP_TEMPLATE} +%{AUTHOR} <%{EMAIL}> + + + %{APPNAME}view_base + + + + 0 + 0 + 268 + 164 + + + + %{APPNAME}_base + + + + unnamed + + + + sillyLabel + + + hello, world + + + + + + diff --git a/languages/cpp/app_templates/kscons_kxt/kscons_kxt.kdevtemplate b/languages/cpp/app_templates/kscons_kxt/kscons_kxt.kdevtemplate new file mode 100644 index 00000000..6236f905 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/kscons_kxt.kdevtemplate @@ -0,0 +1,253 @@ +# KDE Config File +[General] +Name=Scons-based KDE application +Name[ca]=Una aplicació per al KDE basada en Scons +Name[da]=Scons-baseret KDE program +Name[de]=Auf Scons basierende KDE-Anwendung +Name[el]=Μια εφαρμογή KMDI βασισμένης στο Scons +Name[es]=Aplicación para KDE basada en Scons +Name[et]=KDE rakendus Sconsi põhjal +Name[eu]=Scons-en oinarritutako KDE aplikazioa +Name[fa]=کاربرد KDE بر مبنای Scons +Name[fr]=Application KDE basée sur Scons +Name[ga]=Feidhmchlár KDE bunaithe ar Scons +Name[gl]=Aplicación KDE baseada en Scons +Name[hu]=Scons-alapú KDE-s alkalmazás +Name[it]=Un'applicazione KDE basata su scons +Name[ja]=Scons を使った KDE アプリケーション +Name[nds]=Op "Scons" opbuut KDE-Programm +Name[ne]=स्कोन-आधारित केडीई अनुप्रयोग +Name[nl]=Scons gebaseerde KDE-toepassing +Name[pl]=Program KDE wykorzystujący Scons +Name[pt]=Aplicação KDE usando Scons +Name[pt_BR]=Aplicação KDE usando Scons +Name[ru]=Приложение KDE на базе Scons +Name[sk]=KDE aplikácia založená na Scons +Name[sr]=KDE програм на основу Scons-а +Name[sr@Latn]=KDE program na osnovu Scons-a +Name[sv]=Scons-baserat KDE-program +Name[tr]=Scons-tabanlı KDE Uygulaması +Name[zh_CN]=基于 Scons 的 KDE 应用程序 +Name[zh_TW]=Scons 為基礎的 KDE 應用程式 +Category=C++/KDE +Icon=kscons_kxt.png +Comment=Generates a simple KDE application with one widget, a configuration dialog and a dcop interface. Scons scripts are provided for compiling and installing the application. +Comment[ca]=Genera una simple aplicació per al KDE amb un estri, un diàleg de configuració i una interfície dcop. Els scripts en Scons són proveïts per a compilar i instal·lar l'aplicació. +Comment[da]=Genererer et simpelt KDE program med en kontrol, en indstillingsdialog og en dcop-grænseflade. Der sørges for scons-scripter til at kompilere og installere programmet. +Comment[de]=Erstellt eine einfache KDE-Anwendung mit einem Widget, einem Einstellungsdialog und einer DCOP-Schnittstelle. Scons-Skripte zum Kompileren und Installieren der Anwendung werden zur Verfügung gestellt. +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE με ένα γραφικό συστατικό, ένα διάλογο ρύθμισης και μια διασύνδεση dcop. Προσφέρονται σενάρια Scons για τη μεταγλώττιση και εγκατάσταση της εφαρμογής. +Comment[en_GB]=Generates a simple KDE application with one widget, a configuration dialogue and a dcop interface. Scons scripts are provided for compiling and installing the application. +Comment[es]=Genera una sencilla aplicación para KDE con una ventana principal, un diálogo de configuración y una interfaz DCOP. Se proporcionan guiones en Scons para compilar e instalar la aplicación. +Comment[et]=Lihtsa KDE rakenduse loomine ühe vidina, seadistusdialoogi ja DCOP-liidesega. Luuakse ka Sconsi skriptid rakenduse kompileerimiseks ja paigaldamiseks. +Comment[eu]=KDE aplikazio sinple bat sortzen du trepeta bat, konfigurazio-elkarrizketa eta dcop interfaze batekin. Aplikazioa konpilatu eta instalatzeko Scons script-ak sortzen ditu. +Comment[fa]=یک کاربرد سادۀ KDE با یک عنصر، یک محاورۀ پیکربندی و یک واسط dcop تولید می‌کند. دست‌نوشته‌های Scons برای ترجمه و نصب کاربرد فراهم شده‌اند. +Comment[fr]=Génère une application KDE simple comprenant un seul élément graphique (widget), une boîte de dialogue de configuration et une interface DCOP. Des scripts Scons sont fournis pour compiler et installer l'application. +Comment[gl]=Xera unha aplicación sinxela KDE cunha compoñente, un diálogo de configuración e unha interface dcop. Os scripts scons proporciónanse para compilar e intalar a aplicación. +Comment[hu]=Létrehoz egy egyszerű KDE-alkalmazást egy főablakkal, beállítóablakkal és DCOP-felülettel. Az alkalmazás lefordításához és telepítéséhez Scons-szkriptek állnak rendelkezésre. +Comment[it]=Genera una semplice applicazione KDE con un elemento grafico, una finestra di configurazione e un'interfaccia DCOP. Gli script scons sono forniti per compilare e installare l'applicazione. +Comment[nds]=Stellt en eenfach KDE-Programm mit een Element, en Instelldialoog un en DCOP-Koppelsteed op. Stellt Scons-Skripten för't Kompileren un Installeren vun't Programm praat. +Comment[ne]=एउटा विगेट, कन्फिगरेसन संवाद र dcop इन्टरफेससँग एउटा साधारण केडीई अनुप्रयोग उत्पन्न गर्दछ । स्कोन स्क्रिप्टहरू अनुप्रयोग स्थापना र कम्पाइल गर्नका लागि प्रदान गरिन्छ । +Comment[nl]=Genereert een eenvoudige KDE-toepassing met één toplevel widget, een configuratievenster en een DCOP-interface. Scons-scripts worden aangemaakt voor compilatie en installatie. +Comment[pl]=Generuje prosty program dla KDE widgetem, oknem konfiguracyjnym i interfejsem dcop. Do kompilacji i instalacji programu wykorzystywane są skrypty Scons. +Comment[pt]=Gera uma aplicação simples do KDE com uma janela principal, uma de configuração e uma interface de DCOP. Os ficheiros do 'scons' são oferecidos para compilar e instalar a aplicação. +Comment[pt_BR]=Gera uma aplicação simples do KDE com uma janela principal, uma de configuração e uma interface de DCOP. Os ficheiros do 'scons' são oferecidos para compilar e instalar a aplicação. +Comment[ru]=Создание простого приложения KDE с одним виджетом, окном настройки и интерфейсом DCOP. Сборка и установка осуществляется с помощью скриптов Scons. +Comment[sk]=Vygeneruje jednoduchú KDE aplikáciu s jedným oknom, konfiguračným dial=ogom a DCOP rozhraním. K dispozícii je Scons skriptna kompiláciu a inštaláciu aplikácie. +Comment[sr]=Прави једноставан KDE програм са једном контролом, дијалогом за подешавање и DCOP интерфејсом. Дате су Scons скрипте за превођење и инсталирање програма. +Comment[sr@Latn]=Pravi jednostavan KDE program sa jednom kontrolom, dijalogom za podešavanje i DCOP interfejsom. Date su Scons skripte za prevođenje i instaliranje programa. +Comment[sv]=Skapar ett enkelt KDE-program med en grafisk komponent, en inställningsdialogruta och ett DCOP-gränssnitt. Scons-script tillhandahålls för att kompilera och installera programmet. +Comment[tr]=Bir parçacıklı, ayar pencereli ve bir dcop arayüzü olan basit bir KDE uygulaması yaratır. Uygulamayı derlemek ve kurmak için scons betikleri sağlanmıştır. +Comment[zh_CN]=生成一个带一个部件、一个配置对话框和一个 DCOP 接口的简单 KDE 应用程序。此时会提供 Scons 脚本以供编译并安装应用程序。 +Comment[zh_TW]=產生一個簡單的 KDE 應用程式,內含一個元件,一個設定對話框與一個 DCOP 介面。Scons 文稿可用於編譯與安裝應用程式。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/QUICKSTART +Archive=kscons_kxt.tar.gz + +[SCONS] +Type=include +File=%{kdevelop}/template-common/scons.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{src}/SConscript-doc +Dest=%{dest}/doc/SConscript + +[FILE2] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE3] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE4] +Type=install +Source=%{src}/SConstruct +Dest=%{dest}/SConstruct + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE10] +Type=install +Source=%{src}/SConscript-src +Dest=%{dest}/src/SConscript + +[FILE11] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE12] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE13] +Type=install +EscapeXML=true +Source=%{src}/appview_base.ui +Dest=%{dest}/src/%{APPNAMELC}view_base.ui + +[FILE14] +Type=install +Source=%{src}/appview.cpp +Dest=%{dest}/src/%{APPNAMELC}view.cpp + +[FILE15] +Type=install +Source=%{src}/appview.h +Dest=%{dest}/src/%{APPNAMELC}view.h + +[FILE16] +Type=install +EscapeXML=true +Source=%{src}/prefs-base.ui +Dest=%{dest}/src/prefs-base.ui + +[FILE17] +Type=install +Source=%{src}/prefs.cpp +Dest=%{dest}/src/prefs.cpp + +[FILE18] +Type=install +Source=%{src}/prefs.h +Dest=%{dest}/src/prefs.h + +[FILE19] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE20] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE21] +Type=install +Source=%{src}/README +Dest=%{dest}/src/README + +[FILE22] +Type=install +Source=%{src}/app.kcfg +Dest=%{dest}/src/%{APPNAMELC}.kcfg + +[FILE23] +Type=install +Source=%{src}/settings.kcfgc +Dest=%{dest}/src/settings.kcfgc + +[FILE24] +Type=install +Source=%{src}/tips +Dest=%{dest}/src/tips + +[FILE26] +Type=install +Source=%{src}/VERSION +Dest=%{dest}/VERSION + +[FILE29] +Type=install +Source=%{src}/INSTALL +Dest=%{dest}/INSTALL + +[FILE30] +Type=install +Source=%{src}/QUICKSTART +Dest=%{dest}/QUICKSTART + +[FILE31] +Type=install +Source=%{src}/messages.sh +Dest=%{dest}/po/messages.sh + +[MSG] +Type=message +Comment=A KDE application with scons scripts was created in %{dest} +Comment[ca]=Una aplicació per al KDE amb scripts en Scons ha estat creada e n %{dest} +Comment[da]=Et KDE program med scons-scripter blev oprette i %{dest} +Comment[de]=Eine KDE-Anwendung mit Scons-Skripten wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή KDE με σενάρια scons δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para KDE con guiones de Scons ha sido creada en %{dest} +Comment[et]=KDE rakendus Sconsi skriptidega loodi asukohta %{dest} +Comment[eu]=Scons script-dun KDE aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد KDE با دست‌نوشته‌های scons در %{dest} ایجاد شد +Comment[fr]=Une application KDE comprenant des scripts Scons a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár KDE le scripteanna scons i %{dest} +Comment[gl]=Creouse unha aplicación KDE con scripts scons en %{dest} +Comment[hu]=Létrejött egy Scons-szkripteket használó KDE-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KDE con gli script scons in %{dest} +Comment[ja]=Scons スクリプトを使った KDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KDE-Programm mit scons-Skripten opstellt +Comment[ne]=स्कोन स्क्रिप्टसँग केडीई अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een KDE applicatie inclusief Scons-scripts is aangemaakt in %{dest} +Comment[pl]=Program KDE ze skryptami scons utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KDE com ficheiros do 'scons' em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KDE com ficheiros do 'scons' em %{dest} +Comment[ru]=Приложение KDE со скриптами Scons создано в %{dest} +Comment[sk]=KDE aplikácia so scons skriptom bola vytvorená v %{dest} +Comment[sr]=KDE програм са scons скриптама направљен је у %{dest} +Comment[sr@Latn]=KDE program sa scons skriptama napravljen je u %{dest} +Comment[sv]=Ett KDE-program med Scons-skript skapades i %{dest} +Comment[tr]=Scons betikleri olan bir KDE uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了带 scons 脚本的 KDE 应用程序 +Comment[zh_TW]=一個內含 scons 文稿的 KDE 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kscons_kxt/kscons_kxt.png b/languages/cpp/app_templates/kscons_kxt/kscons_kxt.png new file mode 100644 index 00000000..13e8eeff Binary files /dev/null and b/languages/cpp/app_templates/kscons_kxt/kscons_kxt.png differ diff --git a/languages/cpp/app_templates/kscons_kxt/main.cpp b/languages/cpp/app_templates/kscons_kxt/main.cpp new file mode 100644 index 00000000..95e54c47 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/main.cpp @@ -0,0 +1,57 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + KApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(%{APPNAME}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->count() == 0) + { + %{APPNAME} *widget = new %{APPNAME}; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++) + { + %{APPNAME} *widget = new %{APPNAME}; + widget->show(); + } + } + args->clear(); + } + + return app.exec(); +} + diff --git a/languages/cpp/app_templates/kscons_kxt/messages.sh b/languages/cpp/app_templates/kscons_kxt/messages.sh new file mode 100755 index 00000000..a36f5c93 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/messages.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# Inspired by Makefile.common from coolo +# this script is used to update the .po files + +# To update the translations, you will need a specific gettext +# patched for kde and a lot of patience, tenacity, luck, time .. + + +# I guess one should only update the .po files when all .cpp files +# are generated (after a make or scons) + +# If you have a better way to do this, do not keep that info +# for yourself and help me to improve this script, thanks +# (tnagyemail-mail tat yahoo d0tt fr) + +SRCDIR=../test1-kconfigxt # srcdir is the directory containing the source code +TIPSDIR=$SRCDIR # tipsdir is the directory containing the tips + +KDEDIR=`kde-config --prefix` +EXTRACTRC=extractrc +KDEPOT=`kde-config --prefix`/include/kde.pot +XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x $KDEPOT " + +## check that kde.pot is available +if ! test -e $KDEPOT; then + echo "$KDEPOT does not exist, there is something wrong with your installation!" + XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale " +fi + +> rc.cpp + +## extract the strings +echo "extracting the strings" + +# process the .ui and .rc files +$EXTRACTRC `find $SRCDIR -iname *.rc` >> rc.cpp +$EXTRACTRC `find $SRCDIR -iname *.ui` >> rc.cpp +echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > $SRCDIR/_translatorinfo.cpp + +# process the tips - $SRCDIR is supposed to be where the tips are living +pushd $TIPSDIR; preparetips >tips.cpp; popd + +$XGETTEXT `find $SRCDIR -name "*.cpp"` -o kdissert.pot + +# remove the intermediate files +rm -f $TIPSDIR/tips.cpp +rm -f rc.cpp +rm -f $SRCDIR/_translatorinfo.cpp + +## now merge the .po files .. +echo "merging the .po files" + +for i in `ls *.po`; do + msgmerge $i kdissert.pot -o $i || exit 1 +done + +## finished +echo "Done" + diff --git a/languages/cpp/app_templates/kscons_kxt/prefs-base.ui b/languages/cpp/app_templates/kscons_kxt/prefs-base.ui new file mode 100644 index 00000000..43ef8a5f --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/prefs-base.ui @@ -0,0 +1,129 @@ + +Prefs_base +%{CPP_TEMPLATE} +%{AUTHOR} <%{EMAIL}> + + + Prefs_base + + + + 0 + 0 + 282 + 156 + + + + + unnamed + + + + textLabel2_2 + + + Background color: + + + + + kcfg_col_background + + + + + + + + textLabel1 + + + Project age: + + + + + textLabel2 + + + Foreground color: + + + + + kcfg_col_foreground + + + + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + kcfg_val_time + + + 1 + + + 2 + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + + + kcolorbutton.h + + diff --git a/languages/cpp/app_templates/kscons_kxt/prefs.cpp b/languages/cpp/app_templates/kscons_kxt/prefs.cpp new file mode 100644 index 00000000..e7a46ddf --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/prefs.cpp @@ -0,0 +1,12 @@ +%{CPP_TEMPLATE} + +#include "prefs.h" +#include + +Prefs::Prefs() + : Prefs_base() +{ +// debugging : +// kdWarning()<<"creating a pref dialog"< + +

      ... that automake was not involved in building this kde application ?

      +

      The kdevelop template "kscons_kxt" was used instead.

      + + diff --git a/languages/cpp/app_templates/kscreensaver/.kdev_ignore b/languages/cpp/app_templates/kscreensaver/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kscreensaver/Makefile.am b/languages/cpp/app_templates/kscreensaver/Makefile.am new file mode 100644 index 00000000..28747ace --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = kscreensaver.desktop kscreensaver.png kscreensaver.h \ + kscreensaverui.ui src-Makefile.am kscreensaver.cpp \ + kscreensaver.kdevelop subdirs + +templateName= kscreensaver + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz $(templateName).png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaver.cpp b/languages/cpp/app_templates/kscreensaver/kscreensaver.cpp new file mode 100644 index 00000000..f4418571 --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/kscreensaver.cpp @@ -0,0 +1,107 @@ +%{CPP_TEMPLATE} + +#include +#include +#include +#include +#include +#include +#include +#include +#include "%{APPNAMELC}.h" +#include "%{APPNAMELC}ui.h" + +//! libkscreensaver interface +extern "C" +{ + const char *kss_applicationName = "%{APPNAMELC}.kss"; + const char *kss_description = I18N_NOOP( "%{APPNAME}" ); + const char *kss_version = "2.2.0"; + + %{APPNAME} *kss_create( WId id ) + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}( id ); + } + + QDialog *kss_setup() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}Setup(); + } +} + +//----------------------------------------------------------------------------- +//! dialog to setup screen saver parameters +%{APPNAME}Setup::%{APPNAME}Setup( QWidget *parent, const char *name ) + : %{APPNAME}UI( parent, name, TRUE ) +{ + /// @todo + //Connect your signals and slots here to configure the screen saver. + connect( OkayPushButton, SIGNAL( released() ), + SLOT( slotOkPressed() ) ); + connect( CancelPushButton, SIGNAL( released() ), + SLOT( slotCancelPressed() ) ); +} + + +//! read settings from config file +void %{APPNAME}Setup::readSettings() +{ + KConfig *config = KGlobal::config(); + config->setGroup( "Settings" ); + /// @todo + // Add your config options here... + CheckBox1->setChecked(config->readBoolEntry( "somesetting", false )); +} + + +//! Ok pressed - save settings and exit +void %{APPNAME}Setup::slotOkPressed() +{ + KConfig *config = KGlobal::config(); + config->setGroup( "Settings" ); + /// @todo + // Add your config options here. + config->writeEntry( "somesetting", CheckBox1->isChecked() ); + config->sync(); + + accept(); +} + +void %{APPNAME}Setup::slotCancelPressed() +{ + reject(); +} +//----------------------------------------------------------------------------- + + +%{APPNAME}::%{APPNAME}( WId id ) : KScreenSaver( id ) +{ + readSettings(); + blank(); +} + +%{APPNAME}::~%{APPNAME}() +{} + + +//! read configuration settings from config file +void %{APPNAME}::readSettings() +{ + KConfig *config = KGlobal::config(); + config->setGroup( "Settings" ); + /// @todo + // Add your config options here... + bool somesetting = config->readBoolEntry( "somesetting", false ); +} + + +void %{APPNAME}::blank() +{ + /// @todo + //Add your code to render the screen. + setBackgroundColor( QColor(black) ); + // + erase(); +} diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaver.desktop b/languages/cpp/app_templates/kscreensaver/kscreensaver.desktop new file mode 100644 index 00000000..0743cc69 --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/kscreensaver.desktop @@ -0,0 +1,124 @@ +[Desktop Entry] +Exec=%{APPNAMELC}.kss +Icon=kscreensaver +Type=Application +Actions=Setup;InWindow;Root; +X-KDE-Category=Miscellaneous +Name=%{APPNAME} + +[Desktop Action Setup] +Exec=%{APPNAMELC}.kss -setup +Name=Setup... +Name[br]=Kefluniadur ... +Name[ca]=Configuració... +Name[cy]=Gosod ... +Name[da]=Opsætning... +Name[de]=Einrichtung ... +Name[el]=Ρύθμιση... +Name[es]=Configuración... +Name[et]=Häälestus... +Name[eu]=Konfiguratu... +Name[fa]=برپایی... +Name[fr]=Configuration... +Name[ga]=Cumraigh... +Name[gl]=Configuración... +Name[hu]=Beállítások... +Name[it]=Imposta... +Name[ja]=設定... +Name[lt]=Nustatymas... +Name[ms]=Tetapan... +Name[nds]=Instellen... +Name[ne]=सेटअप... +Name[nl]=Instellen... +Name[pl]=Ustawienia... +Name[pt]=Configurar... +Name[pt_BR]=Configurar... +Name[ru]=Настроить... +Name[rw]=Iboneza... +Name[sk]=Nastavenie... +Name[sl]=Nastavi ... +Name[sr]=Постављање... +Name[sr@Latn]=Postavljanje... +Name[sv]=Inställning... +Name[tr]=Kurulum... +Name[zh_CN]=设置... +Name[zh_TW]=設定... +Icon=kscreensaver + +[Desktop Action InWindow] +Exec=%{APPNAMELC}.kss -window-id %w +Name=Display in Specified Window +Name[br]=Diskwel er prenestr spisaet +Name[ca]=Mostra a la finestra especificada +Name[cy]=Dangos mewn Ffenestr Benodol +Name[da]=Vis i specificeret vindue +Name[de]=Im angegebenen Fenster anzeigen +Name[el]=Προβολή στο ορισμένο παράθυρο +Name[es]=Mostrar en la ventana especificada +Name[et]=Kuva määratud aknas +Name[eu]=Bistaratu zehaztutako lehioan +Name[fa]=نمایش در پنجرۀ مشخص‌شده +Name[fr]=Afficher dans la fenêtre spécifiée +Name[ga]=Taispeáin san Fhuinneog Sonraithe +Name[gl]=Mostrar na xanela especificada +Name[hu]=Megjelenítés egy adott ablakban +Name[it]=Mostra in una finestra specificata +Name[ja]=指定したウィンドウに表示 +Name[lt]=Rodyti nurodytame lange +Name[ms]=Papar dalam Tetingkap Yang Dinyatakan +Name[nds]=Binnen angeven Finster wiesen +Name[ne]=निर्दिष्ट सञ्झ्यालमा प्रर्दशन +Name[nl]=Weergave in aangegeven venster +Name[pl]=Pokazywanie w podanym oknie +Name[pt]=Mostrar na Janela Indicada +Name[pt_BR]=Exibir na Janela Especificada +Name[ru]=Показать в указанном окне +Name[rw]=Kwerekana mu Idirishya Ryihariye +Name[sk]=Zobraziť v špecifickom okne +Name[sl]=Prikaži v določenem oknu +Name[sr]=Прикажи у наведеном прозору +Name[sr@Latn]=Prikaži u navedenom prozoru +Name[sv]=Visa i angivet fönster +Name[tr]=Belirtilen Pencerede Göster +Name[zh_CN]=在指定窗口中显示 +Name[zh_TW]=顯示在指定視窗 +NoDisplay=true + +[Desktop Action Root] +Exec=%{APPNAMELC}.kss -root +Name=Display in Root Window +Name[br]=Diskwel er prenestr gwrizienn +Name[ca]=Mostra a la finestra arrel +Name[cy]=Dangos mewn Ffenestr Wraidd +Name[da]=Vis i rod-vindue +Name[de]=Im Root-Fenster anzeigen +Name[el]=Προβολή στο βασικό παράθυρο +Name[es]=Mostrar en la ventana raíz +Name[et]=Kuva juuraknas +Name[eu]=Bistaratu erro-lehioan +Name[fa]=نمایش در پنجرۀ ریشه +Name[fr]=Afficher dans la fenêtre racine +Name[ga]=Taispeáin sa bhFréamhfhuinneog +Name[gl]=Mostrar na xanela raíz +Name[hu]=Megjelenítés a gyökérablakban +Name[it]=Mostra nella finestra radice +Name[ja]=ルートウィンドウに表示 +Name[lt]=Rodyti root lange +Name[ms]=Papar dalam Tetingkap Root +Name[nds]=Binnen Wörtelfinster wiesen +Name[ne]=रूट सञ्झ्यालमा प्रर्दशन +Name[nl]=Weergave in hoofdvenster +Name[pl]=Pokazywanie w głównym oknie +Name[pt]=Mostrar na Janela de Fundo +Name[pt_BR]=Exibir na Janela Raiz +Name[ru]=Показать в главном окне +Name[rw]=Kwerekana mu Idirishya Umuzi +Name[sk]=Zobraziť v koreňovom okne +Name[sl]=Prikaži v korenskem oknu +Name[sr]=Прикажи у кореном прозору +Name[sr@Latn]=Prikaži u korenom prozoru +Name[sv]=Visa i rotfönster +Name[tr]=Kök Pencerede Göster +Name[zh_CN]=在根窗口中显示 +Name[zh_TW]=顯示在根視窗 +NoDisplay=true diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaver.h b/languages/cpp/app_templates/kscreensaver/kscreensaver.h new file mode 100644 index 00000000..1301083d --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/kscreensaver.h @@ -0,0 +1,35 @@ +%{CPP_TEMPLATE} + +#ifndef %{APPNAME}_H__ +#define %{APPNAME}_H__ + +#include "kscreensaver.h" +#include "%{APPNAMELC}ui.h" + +class %{APPNAME} : public KScreenSaver +{ + Q_OBJECT +public: + %{APPNAME}( WId drawable ); + virtual ~%{APPNAME}(); +private: + void readSettings(); + void blank(); +}; + +class %{APPNAME}Setup : public %{APPNAME}UI +{ + Q_OBJECT +public: + %{APPNAME}Setup( QWidget *parent = NULL, const char *name = NULL ); + +private slots: + void slotOkPressed(); + void slotCancelPressed(); + +private: + void readSettings(); + %{APPNAME} *saver; +}; + +#endif diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaver.kdevelop b/languages/cpp/app_templates/kscreensaver/kscreensaver.kdevelop new file mode 100644 index 00000000..e912518f --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/kscreensaver.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + kioslave + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/lib%{APPNAMELC}.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaver.kdevtemplate b/languages/cpp/app_templates/kscreensaver/kscreensaver.kdevtemplate new file mode 100644 index 00000000..027ba4ea --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/kscreensaver.kdevtemplate @@ -0,0 +1,203 @@ +# KDE Config File +[General] +Name=KDE Screen Saver +Name[br]=Damanter skramm KDE +Name[ca]=Salvapantalles per al KDE +Name[da]=KDE pauseskærm +Name[de]=KDE-Bildschirmschoner +Name[el]=Προφύλαξη οθόνης του KDE +Name[es]=Salvapantallas para KDE +Name[et]=KDE ekraanisäästja +Name[eu]=KDE pantaila-babeslea +Name[fa]=محافظ صفحۀ KDE +Name[fr]=Écran de veille KDE +Name[ga]=Spárálaí Scáileáin KDE +Name[gl]=Salvapantallas KDE +Name[hu]=KDE-s képernyővédő +Name[it]=Salva schermo di KDE +Name[ja]=KDE スクリーンセーバー +Name[nds]=KDE-Pausschirm +Name[ne]=केडीई स्क्रिन सर्भर +Name[nl]=KDE-schermbeveiliging +Name[pl]=Wygaszacz ekranu KDE +Name[pt]=Protector de Ecrã do KDE +Name[pt_BR]=Protetor de tela do KDE +Name[ru]=Хранитель экрана для KDE +Name[sk]=KDE šetrič obrazovky +Name[sl]=Ohranjevalnik zaslona za KDE +Name[sr]=KDE чувар екрана +Name[sr@Latn]=KDE čuvar ekrana +Name[sv]=KDE-skärmsläckare +Name[tr]=KDE Ekran Koruyucusu +Name[zh_CN]= KDE 屏幕保护程序 +Name[zh_TW]=KDE 螢幕保護程式 +Icon=kscreensaver.png +Category=C++/KDE +Comment=Generates a framework for a KDE screensaver. +Comment[ca]=Genera una infraestructura per a un salvapantalles de KDE. +Comment[da]=Genererer et skelet for en KDE-pauseskærm. +Comment[de]=Erstellt das Gerüst für einen KDE-Bildschirmschoner. +Comment[el]=Δημιουργεί ένα πλαίσιο για μια προφύλαξη οθόνης του KDE. +Comment[es]=Genera una infraestructura para un salvapantallas de KDE +Comment[et]=KDE ekraanisäästja raamistiku loomine. +Comment[eu]=KDE-ren pantaila-babesle baten lan-marko bat sortzen du. +Comment[fa]=چارچوبی برای محافظ صفحۀ KDE تولید می‌کند. +Comment[fr]=Génère une infrastructure pour un écran de veille KDE. +Comment[gl]=Xera un contorno de traballo para un salvapantallas KDE. +Comment[hu]=Létrehoz egy alap KDE-s képernyővédőt. +Comment[it]=Genera l'infrastruttura per un salvaschermo di KDE. +Comment[ja]=KDE スクリーンセーバーのフレームワークを作成します +Comment[nds]=Stellt dat Rahmenwark för en KDE-Pausschirm op. +Comment[ne]=केडीई स्क्रिनसेभरका लागि फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Genereert een framework voor een KDE-schermbeveiliging. +Comment[pl]=Generuje szablon wygaszacza ekranu dla KDE. +Comment[pt]=Gera a plataforma para um protector de ecrã do KDE. +Comment[pt_BR]=Gera a plataforma para um protector de ecrã do KDE. +Comment[ru]=Создание инфраструктуры хранителя экрана для KDE. +Comment[sk]=Vygeneruje framework pre KDE šetrič obrazovky. +Comment[sl]=Ustvari ogrodje ohranjevalnika zaslona za KDE. +Comment[sr]=Прави радни оквир за KDE чувар екрана. +Comment[sr@Latn]=Pravi radni okvir za KDE čuvar ekrana. +Comment[sv]=Skapar ett ramverk för en KDE-skärmsläckare +Comment[tr]=Bir KDE ekran koruyucusu için bir çatı oluşturulur. +Comment[zh_CN]=生成 KDE 屏幕保护程序框架。 +Comment[zh_TW]=產生一個 KDE 螢幕保護程式的框架 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=kscreensaver.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/kscreensaver.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/kscreensaver.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/kscreensaver.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/kscreensaver.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE15] +Type=install +EscapeXML=true +Source=%{src}/kscreensaverui.ui +Dest=%{dest}/src/%{APPNAMELC}ui.ui + +[MSG] +Type=message +Comment=A screensaver application was created in %{dest} +Comment[ca]=Una aplicació de salvapantalles ha estat creada en %{dest} +Comment[da]=Et pauseskærmsprogram blev oprettet i %{dest} +Comment[de]=Ein Bildschirmschoner wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή προφύλαξης οθόνης δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación salvapantallas ha sido creada en %{dest} +Comment[et]=Ekraanisäästja rakendus loodi asukohta %{dest} +Comment[eu]=Pantaila-babesle baten aplikazioa sortu da hemen: %{dest} +Comment[fa]=یک کاربرد محافظ صفحه در %{dest} ایجاد شد +Comment[fr]=Une application écran de veille a été créé dans %{dest} +Comment[ga]=Cruthaíodh spárálaí scáileáin i %{dest} +Comment[gl]=Creouse unha aplicación salvapantallas en %{dest} +Comment[hu]=Létrejött egy alap képernyővédő program itt: %{dest} +Comment[it]=È stata creata un'applicazione salvaschermo in %{dest} +Comment[ja]=スクリーンセーバーアプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Pausschirm opstellt +Comment[ne]=स्क्रिनसेभर अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een schermbeveiligingstoepassing is aangemaakt in %{dest} +Comment[pl]=Program wygaszacza ekranu został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação protectora do ecrã em %{dest} +Comment[pt_BR]=Foi criada uma aplicação protectora do ecrã em %{dest} +Comment[ru]=Приложение хранителя экрана создано в %{dest} +Comment[sk]=Aplikácia šetriča obrazovky bola vytvorená v %{dest} +Comment[sl]=Program ohranjevalnika zaslona je bil ustvarjen v %{dest} +Comment[sr]=Програм чувара екрана направљен је у %{dest} +Comment[sr@Latn]=Program čuvara ekrana napravljen je u %{dest} +Comment[sv]=Ett skärmsläckarprogram skapades i %{dest} +Comment[tr]=Bir ekran koruyucusu uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了屏幕保护应用程序 +Comment[zh_TW]=一個螢幕保護程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaver.png b/languages/cpp/app_templates/kscreensaver/kscreensaver.png new file mode 100644 index 00000000..e91ec2e2 Binary files /dev/null and b/languages/cpp/app_templates/kscreensaver/kscreensaver.png differ diff --git a/languages/cpp/app_templates/kscreensaver/kscreensaverui.ui b/languages/cpp/app_templates/kscreensaver/kscreensaverui.ui new file mode 100644 index 00000000..c4a843d0 --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/kscreensaverui.ui @@ -0,0 +1,79 @@ + +%{APPNAME}UI +This is the main UI for setting up your screen saver. +Ian Reinhart Geiser + + + %{APPNAMELC}cfg + + + + 0 + 0 + 257 + 58 + + + + Screen Saver Config + + + + Layout2 + + + + 5 + 0 + 255 + 57 + + + + + unnamed + + + + CheckBox1 + + + Set some setting + + + + + Layout1 + + + + unnamed + + + + + OkayPushButton + + + &OK + + + + + CancelPushButton + + + &Cancel + + + + + + + + + kdialog.h + + + + diff --git a/languages/cpp/app_templates/kscreensaver/src-Makefile.am b/languages/cpp/app_templates/kscreensaver/src-Makefile.am new file mode 100644 index 00000000..e19ffb77 --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/src-Makefile.am @@ -0,0 +1,24 @@ +# Makefile.am for %{APPNAMELC}. +# + +AM_CPPFLAGS = -UQT_NO_ASCII_CAST +METASOURCES = AUTO + +INCLUDES = $(all_includes) +LDFLAGS = $(all_libraries) $(KDE_RPATH) +LDADD = $(LIB_KDEUI) -lkscreensaver -lm +bin_PROGRAMS = %{APPNAMELC}.kss + +%{APPNAMELC}_kss_SOURCES = %{APPNAMELC}ui.ui %{APPNAMELC}.cpp +%{APPNAMELC}_kss_LDADD = $(LIB_QT) $(LIB_KDECORE) $(LDADD) $(LIB_KSYCOCA) + +#datadir = $(kde_datadir)/%{APPNAMELC} + +desktop_DATA = %{APPNAMELC}.desktop +desktopdir = $(kde_appsdir)/System/ScreenSavers + +EXTRA_DIST = $(desktop_DATA) + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/kscreensaver/subdirs b/languages/cpp/app_templates/kscreensaver/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kscreensaver/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/kxt/.kdev_ignore b/languages/cpp/app_templates/kxt/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/kxt/Makefile.am b/languages/cpp/app_templates/kxt/Makefile.am new file mode 100644 index 00000000..07767961 --- /dev/null +++ b/languages/cpp/app_templates/kxt/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = src-Makefile.am app.cpp app.h main.cpp appui.rc app.kdevelop \ + subdirs app.desktop preview.png appview.h appview.cpp appview_base.ui \ + prefs-base.ui prefs.cpp prefs.h app.kcfg settings.kcfgc README \ + src-configure.in.in +templateName= kxt + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/kxt/README b/languages/cpp/app_templates/kxt/README new file mode 100644 index 00000000..74e23296 --- /dev/null +++ b/languages/cpp/app_templates/kxt/README @@ -0,0 +1,86 @@ +----------------------------------------------- +Kde templates quickstart +Author: Thomas Nagy +Date: 2004-03-22 +----------------------------------------------- + +This README file explains you basic things for starting with +this application template. + + +** Building and installing ** + +* Build the configure script by "make -f Makefile.cvs" + +* To clean, use "make clean", and to clean everything +(remove the makefiles, etc), use "make distclean" + +* To distribute your program, try "make dist". +This will make a compact tarball archive of your release with the +necessary scripts inside. + +* Modifying the auto-tools scripts +for automake scripts there is an excellent tutorial there : +http://developer.kde.org/documentation/other/makefile_am_howto.html + +* Simplify your life : install the project in your home directory for +testing purposes. +./configure --prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use KConfig XT to create your configuration dialogs and make +them more maintainable. + +For that, you will need to write two simple configuration files +in the src directory : .kcfg and a .kcfgc +The configure.in.in will need to be modified : change the line #MIN_CONFIG(3.0.0) +into #MIN_CONFIG(3.2.0) + +Take an example on the many apps found in the kdegames source package and consult : +http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-kparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +KDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + + + diff --git a/languages/cpp/app_templates/kxt/app.cpp b/languages/cpp/app_templates/kxt/app.cpp new file mode 100644 index 00000000..6e2ce524 --- /dev/null +++ b/languages/cpp/app_templates/kxt/app.cpp @@ -0,0 +1,154 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include "settings.h" +#include "prefs.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +%{APPNAMELC}::%{APPNAMELC}() + : KMainWindow( 0, "%{APPNAMELC}" ), + m_view(new %{APPNAMELC}View(this)), + m_printer(0) +{ + // accept dnd + setAcceptDrops(true); + + // tell the KMainWindow that this is indeed the main widget + setCentralWidget(m_view); + + // then, setup our actions + setupActions(); + + // and a status bar + statusBar()->show(); + + // apply the saved mainwindow settings, if any, and ask the mainwindow + // to automatically save settings if changed: window size, toolbar + // position, icon size, etc. + setAutoSaveSettings(); + + // allow the view to change the statusbar and caption + connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)), + this, SLOT(changeStatusbar(const QString&))); + connect(m_view, SIGNAL(signalChangeCaption(const QString&)), + this, SLOT(changeCaption(const QString&))); + +} + +%{APPNAMELC}::~%{APPNAMELC}() +{ +} + +void %{APPNAMELC}::setupActions() +{ + KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); + KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); + KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + // custom menu and menu item - the slot is in the class %{APPNAMELC}View + KAction *custom = new KAction(i18n("Swi&tch Colors"), 0, + m_view, SLOT(switchColors()), + actionCollection(), "switch_action"); + + createGUI(); +} + +void %{APPNAMELC}::fileNew() +{ + // this slot is called whenever the File->New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // create a new window + (new %{APPNAMELC})->show(); +} + +void %{APPNAMELC}::optionsShowToolbar() +{ + // this is all very cut and paste code for showing/hiding the + // toolbar + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void %{APPNAMELC}::optionsShowStatusbar() +{ + // show/hide the statusbar + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void %{APPNAMELC}::optionsConfigureKeys() +{ + KKeyDialog::configure(actionCollection()); +} + +void %{APPNAMELC}::optionsConfigureToolbars() +{ + // use the standard toolbar editor + saveMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void %{APPNAMELC}::newToolbarConfig() +{ + // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor. + // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.) + createGUI(); + + applyMainWindowSettings(KGlobal::config(), autoSaveGroup()); +} + +void %{APPNAMELC}::optionsPreferences() +{ + // The preference dialog is derived from prefs-base.ui which is subclassed into Prefs + // + // compare the names of the widgets in the .ui file + // to the names of the variables in the .kcfg file + KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self(), KDialogBase::Swallow); + dialog->addPage(new Prefs(), i18n("General"), "package_settings"); + connect(dialog, SIGNAL(settingsChanged()), m_view, SLOT(settingsChanged())); + dialog->show(); +} + +void %{APPNAMELC}::changeStatusbar(const QString& text) +{ + // display the text on the statusbar + statusBar()->message(text, 2000); +} + +void %{APPNAMELC}::changeCaption(const QString& text) +{ + // display the text on the caption + setCaption(text); +} +#include "%{APPNAMELC}.moc" + diff --git a/languages/cpp/app_templates/kxt/app.desktop b/languages/cpp/app_templates/kxt/app.desktop new file mode 100644 index 00000000..8b36e6e0 --- /dev/null +++ b/languages/cpp/app_templates/kxt/app.desktop @@ -0,0 +1,40 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +Icon=%{APPNAMELC} +Type=Application +Comment=A simple KDE Application +Comment[br]=Ur meziant eeun evit KDE +Comment[ca]=Una simple aplicació per al KDE +Comment[da]=Et simpelt KDE program +Comment[de]=Eine einfache KDE-Anwendung +Comment[el]=Μια απλή εφαρμογή του KDE +Comment[es]=Una aplicación de KDE sencilla +Comment[et]=Lihtne KDE rakendus +Comment[eu]=KDE aplikazio simple bat +Comment[fa]=یک کاربرد سادۀ KDE +Comment[fr]=Une application simple pour KDE +Comment[ga]=Feidhmchlár Simplí KDE +Comment[gl]=Unha aplicación KDE sinxela +Comment[hi]=एक सादा केडीई अनुप्रयोग +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[is]=Einfalt KDE forrit +Comment[it]=Una semplice applicazione KDE +Comment[ja]=簡単な KDE アプリケーション +Comment[nds]=En eenfach KDE-Programm +Comment[ne]=एउटा साधारण केडीई अनुप्रयोग +Comment[nl]=Een eenvoudige KDE-toepassing +Comment[pl]=Prosty program KDE +Comment[pt]=Uma aplicação simples do KDE +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[ru]=Простое приложение KDE +Comment[sk]=Jednoduchá KDE aplikácia +Comment[sl]=Preprost program za KDE +Comment[sr]=Једноставан KDE програм +Comment[sr@Latn]=Jednostavan KDE program +Comment[sv]=Ett enkelt KDE-program +Comment[ta]=ஒரு சாதாரண கெடிஇ பயன்பாடு +Comment[tg]=Гузориши оддиKDE +Comment[tr]=Basit bir KDE Uygulaması +Comment[zh_CN]=一个简单的 KDE 应用程序 +Comment[zh_TW]=簡單的 KDE 應用程式 diff --git a/languages/cpp/app_templates/kxt/app.h b/languages/cpp/app_templates/kxt/app.h new file mode 100644 index 00000000..22037de2 --- /dev/null +++ b/languages/cpp/app_templates/kxt/app.h @@ -0,0 +1,66 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "%{APPNAMELC}view.h" + +class KPrinter; +class KToggleAction; +class KURL; + +/** + * This class serves as the main window for %{APPNAME}. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAMELC} : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + %{APPNAMELC}(); + + /** + * Default Destructor + */ + virtual ~%{APPNAMELC}(); + +private slots: + void fileNew(); + void optionsShowToolbar(); + void optionsShowStatusbar(); + void optionsConfigureKeys(); + void optionsConfigureToolbars(); + void optionsPreferences(); + void newToolbarConfig(); + + void changeStatusbar(const QString& text); + void changeCaption(const QString& text); + +private: + void setupAccel(); + void setupActions(); + +private: + %{APPNAMELC}View *m_view; + + KPrinter *m_printer; + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; +}; + +#endif // _%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/kxt/app.kcfg b/languages/cpp/app_templates/kxt/app.kcfg new file mode 100644 index 00000000..686f25f2 --- /dev/null +++ b/languages/cpp/app_templates/kxt/app.kcfg @@ -0,0 +1,21 @@ + + + + + + + black + + + + yellow + + + + 2 + + + diff --git a/languages/cpp/app_templates/kxt/app.kdevelop b/languages/cpp/app_templates/kxt/app.kdevelop new file mode 100644 index 00000000..e6a14fff --- /dev/null +++ b/languages/cpp/app_templates/kxt/app.kdevelop @@ -0,0 +1,169 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + . + false + + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + false + + + + + + + false + 1 + false + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + true + false + false + true + + + false + true + + + + + + + + + + + + -f + + -dP + + -f + -u3 -p + + + + + + + false + + + .h + .cpp + true + + + + true + 2 + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/kxt/appui.rc b/languages/cpp/app_templates/kxt/appui.rc new file mode 100644 index 00000000..06549878 --- /dev/null +++ b/languages/cpp/app_templates/kxt/appui.rc @@ -0,0 +1,8 @@ + + + + &Move + + + + diff --git a/languages/cpp/app_templates/kxt/appview.cpp b/languages/cpp/app_templates/kxt/appview.cpp new file mode 100644 index 00000000..35e23682 --- /dev/null +++ b/languages/cpp/app_templates/kxt/appview.cpp @@ -0,0 +1,41 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}view.h" +#include "settings.h" + +#include +#include + +%{APPNAMELC}View::%{APPNAMELC}View(QWidget *parent) + : %{APPNAMELC}view_base(parent) +{ + settingsChanged(); +} + +%{APPNAMELC}View::~%{APPNAMELC}View() +{ + +} + +void %{APPNAMELC}View::switchColors() +{ + // switch the foreground/background colors of the label + QColor color = Settings::col_background(); + Settings::setCol_background( Settings::col_foreground() ); + Settings::setCol_foreground( color ); + + settingsChanged(); +} + +void %{APPNAMELC}View::settingsChanged() +{ + sillyLabel->setPaletteBackgroundColor( Settings::col_background() ); + sillyLabel->setPaletteForegroundColor( Settings::col_foreground() ); + + // i18n : internationalization + sillyLabel->setText( i18n("This project is %1 days old").arg(Settings::val_time()) ); + emit signalChangeStatusbar( i18n("Settings changed") ); +} + +#include "%{APPNAMELC}view.moc" + diff --git a/languages/cpp/app_templates/kxt/appview.h b/languages/cpp/app_templates/kxt/appview.h new file mode 100644 index 00000000..45a10de7 --- /dev/null +++ b/languages/cpp/app_templates/kxt/appview.h @@ -0,0 +1,52 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}VIEW_H_ +#define _%{APPNAMEUC}VIEW_H_ + +#include + +#include "%{APPNAMELC}view_base.h" + +class QPainter; +class KURL; + +/** + * This is the main view class for %{APPNAME}. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * + * @short Main view + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class %{APPNAMELC}View : public %{APPNAMELC}view_base +{ + Q_OBJECT +public: + /** + * Default constructor + */ + %{APPNAMELC}View(QWidget *parent); + + /** + * Destructor + */ + virtual ~%{APPNAMELC}View(); + +signals: + /** + * Use this signal to change the content of the statusbar + */ + void signalChangeStatusbar(const QString& text); + + /** + * Use this signal to change the content of the caption + */ + void signalChangeCaption(const QString& text); + +private slots: + void switchColors(); + void settingsChanged(); +}; + +#endif // _%{APPNAMEUC}VIEW_H_ diff --git a/languages/cpp/app_templates/kxt/appview_base.ui b/languages/cpp/app_templates/kxt/appview_base.ui new file mode 100644 index 00000000..626d95df --- /dev/null +++ b/languages/cpp/app_templates/kxt/appview_base.ui @@ -0,0 +1,33 @@ + +%{APPNAMELC}view_base + + +%{APPNAMELC}view_base + + + +0 +0 +268 +164 + + + +%{APPNAMELC}_base + + + +unnamed + + + +sillyLabel + + +hello, world + + + + + + diff --git a/languages/cpp/app_templates/kxt/kxt.kdevtemplate b/languages/cpp/app_templates/kxt/kxt.kdevtemplate new file mode 100644 index 00000000..a7a23298 --- /dev/null +++ b/languages/cpp/app_templates/kxt/kxt.kdevtemplate @@ -0,0 +1,269 @@ +# KDE Config File +[General] +Name=KConfig XT application +Name[ca]=Aplicació KConfig XT +Name[da]=KConfig XT program +Name[de]=KConfigXT-Anwendung +Name[el]=Εφαρμογή KConfig XT +Name[es]=Aplicación KConfig XT +Name[et]=KConfig XT rakendus +Name[eu]=KConfig XT aplikazioa +Name[fa]=کاربرد KConfig XT +Name[fr]=Application KConfig XT +Name[ga]=Feidhmchlár XT KConfig +Name[gl]=Aplicación KConfig XT +Name[hu]=KConfig XT-alapú alkalmazás +Name[it]=Applicazione KConfig XT +Name[ja]=KConfig XT アプリケーション +Name[nds]=KConfig-XT-Programm +Name[ne]=KConfig XT अनुप्रयोग +Name[nl]=KConfig XT-toepassing +Name[pl]=Program KConfig XT +Name[pt]=Aplicação do KConfig XT +Name[pt_BR]=Aplicação do KConfig XT +Name[ru]=Приложение KDE с KConfig XT +Name[sk]=KConfig XT aplikácia +Name[sr]=KConfig XT програм +Name[sr@Latn]=KConfig XT program +Name[sv]=KConfig XT-program +Name[tr]=KConfig XT uygulaması +Name[zh_CN]=KConfig XT 应用程序 +Name[zh_TW]=KConfig XT 應用程式 +Category=C++/KDE +Icon=kxt.png +Comment=Generates a simple KDE application with one widget and a configuration dialog +Comment[ca]=Genera una simple aplicació per al KDE amb un estri i un diàleg de configuració +Comment[da]=Genererer et simpelt KDE-program med en kontrol og en indstillingsdialog +Comment[de]=Erstellt eine einfache KDE-Anwendung mit einem Widget und einem Einstellungsdialog. +Comment[el]=Δημιουργεί μια απλή εφαρμογή KDE με ένα γραφικό συστατικό, ένα διάλογο ρύθμισης +Comment[en_GB]=Generates a simple KDE application with one widget and a configuration dialogue +Comment[es]=Genera una sencilla aplicación para KDE con una ventana y un diálogo de configuración +Comment[et]=Lihtsa KDE rakenduse loomine ühe vidina ja seadistustedialoogiga. +Comment[eu]=Trepeta bat eta konfigurazio elkarrizketa-koadro bat duen KDE aplikazio sinple bat sortzen du +Comment[fa]=یک کاربرد سادۀ KDE، با یک عنصر و یک محاورۀ پیکربندی تولید می‌کند +Comment[fr]=Génère une application KDE simple comprenant un seul élément graphique (widget) et une boîte de dialogue de configuration +Comment[ga]=Cruthaíonn sé seo feidhmchlár simplí KDE le giuirléid amháin agus dialóg chumraíochta +Comment[gl]=Xera unha aplicación KDE sinxela cunha compoñente e un diálogo de configuración +Comment[hu]=Létrehoz egy egyszerű KDE-alkalmazást egy grafikus elemmel és egy beállítóablakkal +Comment[it]=Genera una semplice applicazione KDE con un elemento grafico e una finestra di configurazione +Comment[ja]=一つのウィジェットと設定ダイアログを含む簡単な KDE アプリケーションを作成します +Comment[nds]=Stellt en eenfach KDE-Programm mit een Element un en Instelldialoog op +Comment[ne]=एउटा विगेट र कन्फिगरेसन संवादसँग साधारण केडीई अनुप्रयोग उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudige KDE-toepassing met één widget en een configuratiedialoog +Comment[pl]=Generuje prosty program KDE z jednym widgetem i oknem konfiguracyjnym +Comment[pt]=Gera uma aplicação simples do KDE com uma janela principal e outra para configuração +Comment[pt_BR]=Gera uma aplicação simples do KDE com uma janela principal e outra para configuração +Comment[ru]=Создание приложения KDE с окном конфигурации +Comment[sk]=Vygeneruje jednoduchú KDE aplikáciu s jedným oknom a konfiguračným dialógom +Comment[sr]=Прави једноставан KDE програм са једном контролом и дијалогом за подешавање +Comment[sr@Latn]=Pravi jednostavan KDE program sa jednom kontrolom i dijalogom za podešavanje +Comment[sv]=Skapar ett enkelt KDE-program med en grafisk komponent och en inställningsdialogruta +Comment[tr]=Bir parçacığı ve ayar penceresi olan basit bir KDE uygulaması yaratır. +Comment[zh_CN]=生成带一个部件和一个配置对话框的简单 KDE 应用程序 +Comment[zh_TW]=產生一個簡單的 KDE 應用程式,內含一個元件與一個設定對話框。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=kxt.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE13] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE14] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE15] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE16] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE17] +Type=install +EscapeXML=true +Source=%{src}/appview_base.ui +Dest=%{dest}/src/%{APPNAMELC}view_base.ui + +[FILE18] +Type=install +Source=%{src}/appview.cpp +Dest=%{dest}/src/%{APPNAMELC}view.cpp + +[FILE19] +Type=install +Source=%{src}/appview.h +Dest=%{dest}/src/%{APPNAMELC}view.h + +[FILE20] +Type=install +EscapeXML=true +Source=%{src}/prefs-base.ui +Dest=%{dest}/src/prefs-base.ui + +[FILE21] +Type=install +Source=%{src}/prefs.cpp +Dest=%{dest}/src/prefs.cpp + +[FILE22] +Type=install +Source=%{src}/prefs.h +Dest=%{dest}/src/prefs.h + +[FILE23] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE24] +Type=install +EscapeXML=true +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + +[FILE25] +Type=install +Source=%{src}/README +Dest=%{dest}/src/README + +[FILE26] +Type=install +Source=%{src}/app.kcfg +Dest=%{dest}/src/%{APPNAMELC}.kcfg + +[FILE27] +Type=install +Source=%{src}/settings.kcfgc +Dest=%{dest}/src/settings.kcfgc + +[FILE28] +Type=install +Source=%{src}/src-configure.in.in +Dest=%{dest}/configure.in.in + +[MSG] +Type=message +Comment=A KConfig XT application was created in %{dest} +Comment[ca]=Una aplicació KConfig XT ha estat creada en %{dest} +Comment[da]=Et KConfig XT-program blev oprettet i %{dest} +Comment[de]=Eine KConfig-XT-Anwendung wurde in %{dest} erstellt +Comment[el]=Μια εφαρμογή KConfig XT δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación KConfig XT ha sido creada en %{dest} +Comment[et]=A KConfig XT rakendus loodi asukohta %{dest} +Comment[eu]=KConfig XT aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد KConfig XT در %{dest} ایجاد شد +Comment[fr]=Une application KConfig XT a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár XT KConfig i %{dest} +Comment[gl]=Creouse unha aplicación KConfig XT en %{dest} +Comment[hu]=Létrejött egy KConfig XT-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione KConfig XT in %{dest} +Comment[ja]=KConfig XT アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en KConfig-XT-Programm opstellt +Comment[ne]=KConfig XT अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een KConfig XT-toepassing is aangemaakt in %{dest} +Comment[pl]=Program KConfig XT został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do KConfig XT em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do KConfig XT em %{dest} +Comment[ru]=Приложение KDE с KConfig XT создано в %{dest} +Comment[sk]=KConfig XT aplikácia bola vytvorená v %{dest} +Comment[sr]=KConfig XT програм је направљен у %{dest} +Comment[sr@Latn]=KConfig XT program je napravljen u %{dest} +Comment[sv]=Ett KConfig XT-program skapades i %{dest} +Comment[tr]=Bir KConfig XT uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了 KConfig XT 应用程序 +Comment[zh_TW]=一個 KConfig XT 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kxt/kxt.png b/languages/cpp/app_templates/kxt/kxt.png new file mode 100644 index 00000000..5a4b6359 Binary files /dev/null and b/languages/cpp/app_templates/kxt/kxt.png differ diff --git a/languages/cpp/app_templates/kxt/main.cpp b/languages/cpp/app_templates/kxt/main.cpp new file mode 100644 index 00000000..66f038c9 --- /dev/null +++ b/languages/cpp/app_templates/kxt/main.cpp @@ -0,0 +1,57 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A KDE Application"); + +static const char version[] = "%{VERSION}"; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + KApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(%{APPNAMELC}); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->count() == 0) + { + %{APPNAMELC} *widget = new %{APPNAMELC}; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++) + { + %{APPNAMELC} *widget = new %{APPNAMELC}; + widget->show(); + } + } + args->clear(); + } + + return app.exec(); +} + diff --git a/languages/cpp/app_templates/kxt/prefs-base.ui b/languages/cpp/app_templates/kxt/prefs-base.ui new file mode 100644 index 00000000..5c0fc860 --- /dev/null +++ b/languages/cpp/app_templates/kxt/prefs-base.ui @@ -0,0 +1,127 @@ + +Prefs_base + + + Prefs_base + + + + 0 + 0 + 282 + 156 + + + + + unnamed + + + + textLabel2_2 + + + Background color: + + + + + kcfg_col_background + + + + + + + + textLabel1 + + + Project age: + + + + + textLabel2 + + + Foreground color: + + + + + kcfg_col_foreground + + + + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + kcfg_val_time + + + 1 + + + 2 + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + + + kcolorbutton.h + + diff --git a/languages/cpp/app_templates/kxt/prefs.cpp b/languages/cpp/app_templates/kxt/prefs.cpp new file mode 100644 index 00000000..e7a46ddf --- /dev/null +++ b/languages/cpp/app_templates/kxt/prefs.cpp @@ -0,0 +1,12 @@ +%{CPP_TEMPLATE} + +#include "prefs.h" +#include + +Prefs::Prefs() + : Prefs_base() +{ +// debugging : +// kdWarning()<<"creating a pref dialog"< rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/%{APPNAMELC}.pot + +KDE_ICON = AUTO + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = %{APPNAMELC}.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/%{APPNAMELC} +rc_DATA = %{APPNAMELC}ui.rc diff --git a/languages/cpp/app_templates/kxt/src-configure.in.in b/languages/cpp/app_templates/kxt/src-configure.in.in new file mode 100644 index 00000000..61d4a7fd --- /dev/null +++ b/languages/cpp/app_templates/kxt/src-configure.in.in @@ -0,0 +1,7 @@ + +#MIN_CONFIG(3.2.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + diff --git a/languages/cpp/app_templates/kxt/subdirs b/languages/cpp/app_templates/kxt/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/kxt/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/makefileempty/Makefile.am b/languages/cpp/app_templates/makefileempty/Makefile.am new file mode 100644 index 00000000..87f1db69 --- /dev/null +++ b/languages/cpp/app_templates/makefileempty/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = makefileempty-Makefile \ + makefileempty.png app.kdevelop +templateName = makefileempty + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/makefileempty/app.kdevelop b/languages/cpp/app_templates/makefileempty/app.kdevelop new file mode 100644 index 00000000..a0b41f59 --- /dev/null +++ b/languages/cpp/app_templates/makefileempty/app.kdevelop @@ -0,0 +1,101 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevCustomProject + C++ + + C++ + Code + + + + + + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/makefileempty/makefileempty-Makefile b/languages/cpp/app_templates/makefileempty/makefileempty-Makefile new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/makefileempty/makefileempty.kdevtemplate b/languages/cpp/app_templates/makefileempty/makefileempty.kdevtemplate new file mode 100644 index 00000000..bacfcae0 --- /dev/null +++ b/languages/cpp/app_templates/makefileempty/makefileempty.kdevtemplate @@ -0,0 +1,85 @@ +# KDE Config File +[General] +Name=Empty Custom Makefile Template +Name[ca]=Plantilla Makefile personalitzada buida +Name[da]=Tom brugertilpasset Makefile-skabelon +Name[de]=Leere Vorlage für benutzerdefiniertes Makefile +Name[el]=Κενό προσαρμοσμένο πρότυπο Makefile +Name[es]=Plantilla vacía para Makefile personalizado +Name[et]=Tühi kohandatud makefile'i mall +Name[hu]=Üres egyedi Makefile-ra épülő sablon +Name[it]=Modello di makefile personalizzato vuoto +Name[nds]=Egen leddig Makefile-Vörlaag +Name[nl]=Leeg aangepast Makefile-sjabloon +Name[pl]=Pusty własny szablon pliku Makefile +Name[pt]=Modelo de Makefile Personalizada Vazio +Name[pt_BR]=Modelo de Makefile Personalizada Vazio +Name[ru]=Пустой шаблон с пользовательским Makefile +Name[sk]=Prázdna šablóna pre vlastný Makefile +Name[sr]=Празан шаблон посебног справифајла +Name[sr@Latn]=Prazan šablon posebnog spravifajla +Name[sv]=Tom mall för egen byggfil +Name[zh_TW]=空的自訂 Makefile 樣板 +Icon=makefileempty.png +Category=C++ +Comment=Generate an empty Custom Makefile based application +Comment[ca]=Genera una aplicació personalitzada buida basada en Makefile +Comment[da]=Opretter et tomt brugertilpasset Makefile-baseret program +Comment[de]=Erstellt eine auf einem benutzerdefinierten Makefile basierende Anwendung +Comment[el]=Δημιουργία μίας κενής εφαρμογής βασισμένης σε προσαρμοσμένο Makefile +Comment[es]=Genera una aplicación vacía basada en un Makefile personalizado +Comment[et]=Tühja rakenduse loomine kohandatud makefile'i põhjal +Comment[hu]=Létrehoz egy egyedi Makefile-ra épülő alkalmazást +Comment[it]=Genera un'applicazione basata su makefile personalizzato +Comment[nds]=Stellt en leddig Programm op, dat op en egen Makefile opbuut +Comment[nl]=Genereer een leeg op een aangepast Makefile gebaseerd programma +Comment[pl]=Generuje pusty program z własnym plikiem Makefile +Comment[pt]=Gera uma aplicação baseada em Makefile's personalizadas +Comment[pt_BR]=Gera uma aplicação baseada em Makefile's personalizadas +Comment[ru]=Создание каркаса приложения, использующего пользовательский Makefile +Comment[sk]=Vygeneruje prázdnu aplikáciu založenú na vlastnom Makefile +Comment[sr]=Прави програм на основу посебног справифајла +Comment[sr@Latn]=Pravi program na osnovu posebnog spravifajla +Comment[sv]=Skapar ett tomt program baserat på en egen byggfil +Comment[zh_TW]=產生一個空的使用自訂 Makefile 的應用程式 +FileTemplates=h,CStyle,cpp,CStyle +Archive=makefileempty.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE2] +Type=install +Source=%{src}/makefileempty-Makefile +Dest=%{dest}/Makefile + +[MSG] +Type=message +Comment=A Custom Makefile based application was created in %{dest} +Comment[ca]=S'ha creat una aplicació basada en Makefile en %{dest} +Comment[da]=Et brugertilpasset Makefile-baseret program blev oprettet i %{dest} +Comment[de]=Eine auf einem benutzerdefinierten Makefile basierende Anwendung wurde in %{dest} erstellt. +Comment[el]=Δημιουργήθηκε μία εφαρμογή βασισμένη σε προσαρμοσμένο Makefile στο %{dest} +Comment[es]=Una aplicación basada en un Makefile personalizado ha sido creada en %{dest} +Comment[et]=Rakendus kohandatud makefile'i põhjal loodi asukohta %{dest} +Comment[hu]=Létrejött egy egyedi Makefile-ra épülő alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione basata su un makefile personalizzato in %{dest} +Comment[nds]=In %{dest} wöör en Programm opstellt, dat op en egen Makefile opbuut +Comment[nl]=Een op een aangepast Makefile gebaseerd programma is aangemaakt in %{dest} +Comment[pl]=Program używający własnego Makefile został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação baseada em Makefile's personalizadas em %{dest} +Comment[pt_BR]=Foi criada uma aplicação baseada em Makefile's personalizadas em %{dest} +Comment[ru]=Приложение с пользовательским Makefile создано в %{dest} +Comment[sk]=Aplikácia založená na vlastnom Makefile bola vytvorená v %{dest} +Comment[sr]=Програм на основу посебног справифајла направљен је у %{dest} +Comment[sr@Latn]=Program na osnovu posebnog spravifajla napravljen je u %{dest} +Comment[sv]=Ett program baserat på en egen byggfil skapades i %{dest} +Comment[zh_TW]=一個以自訂 Makefile 為基礎的應用程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/makefileempty/makefileempty.png b/languages/cpp/app_templates/makefileempty/makefileempty.png new file mode 100644 index 00000000..519c007b Binary files /dev/null and b/languages/cpp/app_templates/makefileempty/makefileempty.png differ diff --git a/languages/cpp/app_templates/noatunui/.kdev_ignore b/languages/cpp/app_templates/noatunui/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/noatunui/Makefile.am b/languages/cpp/app_templates/noatunui/Makefile.am new file mode 100644 index 00000000..29358f2f --- /dev/null +++ b/languages/cpp/app_templates/noatunui/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = src-Makefile.am plugin_app.cpp plugin_impl.cpp plugin_impl.h \ + noatunui.png plugin.plugin plugin.kdevelop subdirs +templateName = noatunui + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/noatunui/noatunui b/languages/cpp/app_templates/noatunui/noatunui new file mode 100644 index 00000000..631c4798 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/noatunui @@ -0,0 +1,8 @@ +# KDE Config File +[General] +Name=Noatun UI plugin +Icon=noatunui.png +Category=C++/KDE +Comment=Generates a simple user interface plugin for noatun. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/plugin_APPNAMELC_impl.cpp diff --git a/languages/cpp/app_templates/noatunui/noatunui.kdevtemplate b/languages/cpp/app_templates/noatunui/noatunui.kdevtemplate new file mode 100644 index 00000000..394e71ed --- /dev/null +++ b/languages/cpp/app_templates/noatunui/noatunui.kdevtemplate @@ -0,0 +1,195 @@ +# KDE Config File +[General] +Name=Noatun UI plugin +Name[ca]=Connector d'interfície d'usuari per a Noatun +Name[de]=Noatun-UI-Modul +Name[el]=Πρόσθετο Noatun UI +Name[es]=Complemento de interfaz de usuario para Noatun +Name[et]=Noatuni kasutajaliidese plugin +Name[eu]=Noatun UI plugina +Name[fa]=وصلۀ Noatun UI +Name[fr]=Module externe d'interface utilisateur pour Noatun +Name[ga]=Breiseán Chomhéadan Noatun +Name[gl]=Extensión para a IU de Noatun +Name[hu]=Noatun UI-modul +Name[it]=Plugin UI di noatun +Name[ja]=Noatun UI プラグイン +Name[nds]=Böversiet-Moduul för Noatun +Name[ne]=नोअटन UI plugin +Name[nl]=Noatun UI-plugin +Name[pl]=Wtyczka do interfejsu użytkownika Noatun +Name[pt]='Plugin' de UI do Noatun +Name[pt_BR]='Plugin' de UI do Noatun +Name[ru]=Модуль интерфейса Noatun +Name[sk]=Noatun UI modul +Name[sr]=UI прикључак за Noatun +Name[sr@Latn]=UI priključak za Noatun +Name[sv]=Noatun-insticksprogram för användargränssnitt +Name[tr]=Noatun Arayüz eklentisi +Name[zh_CN]=Noatun 界面插件 +Name[zh_TW]=Noatun 使用者介面外掛程式 +Icon=noatunui.png +Category=C++/KDE +Comment=Generates a simple user interface plugin for noatun. +Comment[ca]=Genera un simple connector d'interfície d'usuari per a Noatun. +Comment[da]=Genererer en simpel brugergrænseflade-plugin for noatun. +Comment[de]=Erstellt ein einfaches Oberflächen-Modul für Noatun +Comment[el]=Δημιουργεί ένα απλό πρόσθετο γραφικού περιβάλλοντος για το noatun. +Comment[es]=Genera un complemento de interfaz de usuario para Noatun. +Comment[et]=Noatuni lihtsa kasutajaliidese plugina loomine. +Comment[eu]=Noatun-entzat erabiltzaile-interfazerako plugin sinple bat sortzen du. +Comment[fa]=یک وصلۀ واسط کاربر ساده برای noatun تولید می‌کند. +Comment[fr]=Génère un module externe d'interface utilisateur simple pour Noatun. +Comment[gl]=Xera unha extensión sinxela para a interface de usuario de noatun. +Comment[hu]=Létrehoz egy egyszerű felületbővítő modult a Noatun programhoz. +Comment[it]=Genera un semplice plugin di interfaccia per noatun. +Comment[nds]=Stellt en eenfach Böversietmoduul för Noatun op. +Comment[ne]=नोअटनका लागि साधारण इन्टरफेस प्लगइन उत्पन्न गर्दछ । +Comment[nl]=Genereert een eenvoudige gebruikersinterfaceplugin voor Noatun. +Comment[pl]=Generuje prostą wtyczkę do interfejsu użytkownika programu Noatun. +Comment[pt]=Gera um 'plugin' simples para a interface de utilizador do Noatun. +Comment[pt_BR]=Gera um 'plugin' simples para a interface de utilizador do Noatun. +Comment[ru]=Создание простого интерфейса для Noatun. +Comment[sk]=Vygeneruje jednoduchý modul užívateľského rozhrania pre Noatun +Comment[sr]=Прави једноставан прикључак корисничког интерфејса за Noatun. +Comment[sr@Latn]=Pravi jednostavan priključak korisničkog interfejsa za Noatun. +Comment[sv]=Skapar ett enkelt insticksprogram för användargränssnitt till Noatun. +Comment[tr]=Noatun için basit bir kullanıcı arayüzü eklentisi yaratır. +Comment[zh_CN]=生成 noatun 的简单用户界面插件。 +Comment[zh_TW]=產生一個簡單的 noatun 的使用者介面外掛程式。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/plugin_%{APPNAMELC}_impl.cpp +Archive=noatunui.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/plugin_app.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/plugin_impl.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}_impl.cpp + +[FILE14] +Type=install +Source=%{src}/plugin_impl.h +Dest=%{dest}/src/plugin_%{APPNAMELC}_impl.h + +[FILE15] +Type=install +Source=%{src}/plugin.plugin +Dest=%{dest}/src/%{APPNAMELC}.plugin + +[MSG] +Type=message +Comment=A Noatun UI plugin was created in %{dest} +Comment[ca]=Un connector d'interfície d'usuari per a Noatun ha estat creat en %{dest} +Comment[da]=Et Noatun UI-plugin blev oprettet i %{dest} +Comment[de]=Ein Oberflächen-Modul für Noatun wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο Noatun UI δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento de interfaz de usuario para Noatun ha sido creado en %{dest} +Comment[et]=Noatuni kasutajaliidese plugin loodi asukohta %{dest} +Comment[eu]=Noatun UI plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ Noatun UI در %{dest} ایجاد شد +Comment[fr]=Un module externe d'interface utilisateur pour Noatun a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán chomhéadan Noatun i %{dest} +Comment[gl]=Creouse unha extensión para a IU de Noatun en %{dest} +Comment[hu]=Létrejött egy Noatun UI-modul itt: %{dest} +Comment[it]=È stato creato un plugin UI per noatun in %{dest} +Comment[ja]=Noatun UI プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Noatun-Böversietmoduul opstellt +Comment[ne]=नोअटन UI प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Noatun UI-plugin is aangemaakt in %{dest} +Comment[pl]=Wtyczka do interfejsu Noatun została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' da UI do Noatun em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' da UI do Noatun em %{dest} +Comment[ru]=Модуль интерфейса для Noatun создан в %{dest} +Comment[sk]=Noatun UI modul bol vytvorený v %{dest} +Comment[sr]=UI прикључак за Noatun направљен је у %{dest} +Comment[sr@Latn]=UI priključak za Noatun napravljen je u %{dest} +Comment[sv]=Ett Noatun-insticksprogram för användargränssnitt skapades i %{dest} +Comment[tr]=Bir Noatun Arayüz eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 Noatun 界面插件 +Comment[zh_TW]=一個 Noatun 使用者介面外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/noatunui/noatunui.png b/languages/cpp/app_templates/noatunui/noatunui.png new file mode 100644 index 00000000..0d2c3e30 Binary files /dev/null and b/languages/cpp/app_templates/noatunui/noatunui.png differ diff --git a/languages/cpp/app_templates/noatunui/plugin.kdevelop b/languages/cpp/app_templates/noatunui/plugin.kdevelop new file mode 100644 index 00000000..f0cda142 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/plugin.kdevelop @@ -0,0 +1,111 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/noatun_%{APPNAMELC}plugin.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/noatunui/plugin.plugin b/languages/cpp/app_templates/noatunui/plugin.plugin new file mode 100644 index 00000000..a7bb9170 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/plugin.plugin @@ -0,0 +1,8 @@ +Filename=noatun_%{APPNAMELC}plugin.la +Author=%{AUTHOR} +Site=http://noatun.kde.org/ +Email=%{EMAIL} +Type=userinterface +License=$LICENSE$ +Name=%{APPNAME} +Comment=A UI for Noatun diff --git a/languages/cpp/app_templates/noatunui/plugin_app.cpp b/languages/cpp/app_templates/noatunui/plugin_app.cpp new file mode 100644 index 00000000..23067139 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/plugin_app.cpp @@ -0,0 +1,15 @@ + +#include "plugin_%{APPNAMELC}_impl.h" + +#include +#include + +extern "C" +{ + Plugin *create_plugin() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}UI; + } +} + diff --git a/languages/cpp/app_templates/noatunui/plugin_impl.cpp b/languages/cpp/app_templates/noatunui/plugin_impl.cpp new file mode 100644 index 00000000..1b5eea45 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/plugin_impl.cpp @@ -0,0 +1,301 @@ + +#include "plugin_%{APPNAMELC}_impl.h" +#include "plugin_%{APPNAMELC}_impl.moc" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +//#include +//#include + +%{APPNAME}UI::%{APPNAME}UI() : QWidget(0,"%{APPNAME}UI"), UserInterface() +{ + setAcceptDrops(true); + static const int buttonSize=32; + + mBack=new QPushButton(this); + mBack->setFixedSize(buttonSize,buttonSize); + mBack->setPixmap(BarIcon("noatunback")); + connect(mBack, SIGNAL(clicked()), napp->player(), SLOT(back())); + QToolTip::add(mBack,i18n("Back")); + + mStop=new QPushButton(this); + mStop->setFixedSize(buttonSize,buttonSize); + mStop->setPixmap(BarIcon("noatunstop")); + connect(mStop, SIGNAL(clicked()), napp->player(), SLOT(stop())); + QToolTip::add(mStop, i18n("Stop")); + + mPlay=new QPushButton(this); + mPlay->setToggleButton(true); + mPlay->setFixedSize(buttonSize,buttonSize); + mPlay->setPixmap(BarIcon("noatunplay")); + connect(mPlay, SIGNAL(clicked()), napp->player(), SLOT(playpause())); + QToolTip::add(mPlay, i18n("Play")); + + mForward=new QPushButton(this); + mForward->setFixedSize(buttonSize,buttonSize); + mForward->setPixmap(BarIcon("noatunforward")); + connect(mForward, SIGNAL(clicked()), napp->player(), SLOT(forward())); + QToolTip::add(mForward, i18n("Forward")); + + mPlaylist=new QPushButton(this); + mPlaylist->setToggleButton(true); + mPlaylist->setFixedSize(buttonSize,buttonSize); + mPlaylist->setPixmap(BarIcon("noatunplaylist")); + connect(mPlaylist, SIGNAL(clicked()), napp->player(), SLOT(toggleListView())); + QToolTip::add(mPlaylist, i18n("Playlist")); + + mLoop=new QPushButton(this); + mLoop->setFixedSize(buttonSize,buttonSize); + mLoop->setPixmap(BarIcon("noatunloopnone")); + connect(mLoop, SIGNAL(clicked()), napp->player(), SLOT(loop())); + QToolTip::add(mLoop, i18n("Change loop style")); + + mPopup=new QPushButton(this); + mPopup->setFixedSize(buttonSize,buttonSize); + mPopup->setPixmap(BarIcon("noatun")); + connect(mPopup, SIGNAL(clicked()), SLOT(popup())); + + + mVolume=new L33tSlider(0,100,10,0, Horizontal, this); + mVolume->setValue(napp->player()->volume()); + mSeeker=new L33tSlider(0,1000,10,0, Horizontal, this); + + mStatusBar=new KStatusBar(this); + + + QGridLayout *l=new QGridLayout(this); + l->addWidget(mBack,0,0); + l->addWidget(mStop,0,1); + l->addWidget(mPlay,0,2); + l->addWidget(mForward,0,3); + l->addWidget(mPlaylist,0,4, Qt::AlignLeft); + l->addWidget(mLoop,0,5); + l->addWidget(mPopup,0,6); + l->addColSpacing(4, buttonSize+8); + + l->addMultiCellWidget(mVolume,1,1,0,6); + l->addMultiCellWidget(mSeeker,2,2,0,6); + l->addMultiCellWidget(mStatusBar,3,3,0,6); + + statusBar()->message(i18n("No File Loaded")); + statusBar()->insertItem("--:--/--:--", 1, 0, true); + + connect(napp, SIGNAL(hideYourself()), this, SLOT(hide()) ); + connect(napp, SIGNAL(showYourself()), this, SLOT(show()) ); + + connect(napp->player(), SIGNAL(playing()), this, SLOT(slotPlaying())); + connect(napp->player(), SIGNAL(stopped()), this, SLOT(slotStopped())); + connect(napp->player(), SIGNAL(paused()), this, SLOT(slotPaused())); + napp->player()->handleButtons(); + + connect(napp->player(), SIGNAL(timeout()), this, SLOT(slotTimeout())); + connect(napp->player(), SIGNAL(loopTypeChange(int)), this, SLOT(changeLoopType(int))); + + /* This skipToWrapper is needed to pass milliseconds to Player() as everybody + * below the GUI is based on milliseconds instead of some unprecise thingy + * like seconds or mille */ + connect(seeker(), SIGNAL(userChanged(int)), this, SLOT(skipToWrapper(int))); + connect(this, SIGNAL(skipTo(int)), napp->player(), SLOT(skipTo(int))); + connect(seeker(), SIGNAL(sliderMoved(int)), SLOT(sliderMoved(int))); + + connect(mVolume, SIGNAL(sliderMoved(int)), napp->player(), SLOT(setVolume(int))); + connect(mVolume, SIGNAL(userChanged(int)), napp->player(), SLOT(setVolume(int))); + + + connect(napp->player(), SIGNAL(playlistShown()), SLOT(playlistShown())); + connect(napp->player(), SIGNAL(playlistHidden()), SLOT(playlistHidden())); + + // Event Filter for the RMB + for (QPtrListIterator i(*children()); i.current(); ++i) + (*i)->installEventFilter(this); + + setCaption("Noatun"); + setIcon(BarIcon("noatun")); + show(); + + // What it is now, stay. + setFixedSize(minimumSize()); +} + +%{APPNAME}UI::~%{APPNAME}UI() +{ + /** save settings here */ +} + +void %{APPNAME}UI::closeEvent(QCloseEvent*) +{ + unload(); +} + +void %{APPNAME}UI::showEvent(QShowEvent*e) +{ + QWidget::showEvent(e); +} + +void %{APPNAME}UI::dragEnterEvent(QDragEnterEvent *event) +{ + // accept uri drops only + event->accept(KURLDrag::canDecode(event)); +} + +void %{APPNAME}UI::dropEvent(QDropEvent *event) +{ + KURL::List uri; + if (KURLDrag::decode(event, uri)) + { + for (KURL::List::Iterator i = uri.begin(); i != uri.end(); ++i) + napp->player()->openFile(*i, false); + } +} + +void %{APPNAME}UI::mouseReleaseEvent(QMouseEvent *e) +{ + QWidget::mouseReleaseEvent(e); + if (e->button()!=RightButton) return; + NoatunStdAction::ContextMenu::showContextMenu(); +} + +void %{APPNAME}UI::changeStatusbar(const QString& text, const QString &text2) +{ + if (!text2.isNull()) + statusBar()->changeItem(text2, 1); + + statusBar()->message(!text.isNull() ? text : napp->player()->current().title()); +} + +void %{APPNAME}UI::changeCaption(const QString& text) +{ + setCaption(text); +} + +void %{APPNAME}UI::popup() +{ + NoatunStdAction::ContextMenu::showContextMenu( + mapToGlobal(mPopup->geometry().bottomLeft()) ); +} + +void %{APPNAME}UI::slotPlaying() +{ + changeStatusbar(napp->player()->current().title(), napp->player()->lengthString()); + mPlay->setOn(true); + mStop->setEnabled(true); + mPlay->setPixmap(BarIcon("noatunpause")); +} + +void %{APPNAME}UI::slotStopped() +{ + if (!napp->player()->current()) return; + changeStatusbar(i18n("No File Loaded"), napp->player()->lengthString()); + mStop->setEnabled(false); + mPlay->setOn(false); + seeker()->setValue(0); + mPlay->setPixmap(BarIcon("noatunplay")); +} + +void %{APPNAME}UI::slotPaused() +{ + mStop->setEnabled(true); + mPlay->setOn(false); + mPlay->setPixmap(BarIcon("noatunplay")); +} + +void %{APPNAME}UI::slotTimeout() +{ + mVolume->setValue(napp->player()->volume()); + + if (!napp->player()->current()) return; + if (static_cast(seeker())->currentlyPressed()) return; + if (seeker()) + { + seeker()->setRange ( 0, (int)napp->player()->getLength()/1000 ); + seeker()->setValue ( (int)napp->player()->getTime()/1000 ); + } + changeStatusbar(0, napp->player()->lengthString()); +} + +void %{APPNAME}UI::sliderMoved(int seconds) +{ + if (napp->player()->current()) + changeStatusbar(0, napp->player()->lengthString(seconds*1000)); +} + +void %{APPNAME}UI::skipToWrapper(int second) +{ + emit skipTo((long)(second*1000)); +} + +void %{APPNAME}UI::changeLoopType(int t) +{ + static const int time=2000; + switch (t) + { + case(Player::None): + statusBar()->message(i18n("No looping"), time); + mLoop->setPixmap(BarIcon("noatunloopnone")); + break; + case(Player::Song): + statusBar()->message(i18n("Song looping"), time); + mLoop->setPixmap(BarIcon("noatunloopsong")); + break; + case(Player::Playlist): + statusBar()->message(i18n("Playlist looping"), time); + mLoop->setPixmap(BarIcon("noatunloopplaylist")); + break; + case(Player::Random): + statusBar()->message(i18n("Random play"), time); + mLoop->setPixmap(BarIcon("noatunlooprandom")); + } +} + +bool %{APPNAME}UI::eventFilter(QObject *o, QEvent *e) +{ + if ((e->type() == QEvent::MouseButtonRelease) + && ((static_cast(e))->button()==RightButton)) + { + mouseReleaseEvent(static_cast(e)); + return true; + } + + if (e->type() == QEvent::Wheel) + { + wheelEvent(static_cast(e)); + return true; + } + return QWidget::eventFilter(o, e); +} + +void %{APPNAME}UI::playlistShown() +{ + mPlaylist->setOn(true); +} + +void %{APPNAME}UI::playlistHidden() +{ + mPlaylist->setOn(false); +} + +void %{APPNAME}UI::wheelEvent(QWheelEvent *e) +{ + int delta=e->delta(); + mVolume->setValue(mVolume->value()+(delta/120)); + napp->player()->setVolume(mVolume->value()+(delta/120)); +} + diff --git a/languages/cpp/app_templates/noatunui/plugin_impl.h b/languages/cpp/app_templates/noatunui/plugin_impl.h new file mode 100644 index 00000000..970246d4 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/plugin_impl.h @@ -0,0 +1,78 @@ + +#ifndef %{APPNAMEUC}_IMPL_H +#define %{APPNAMEUC}_IMPL_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +// Pref dialog pointer global now for position saving +#include + +class Player; +class QSlider; +class QPushButton; +class KStatusBar; + +/** + * @short Main window class + * @author %{AUTHOR} <%{EMAIL}> + * @version 0.1 + * Note: You can user _every_ widget for implementing your userinterface. + */ +class %{APPNAME}UI : public QWidget, public UserInterface +{ +Q_OBJECT +public: + %{APPNAME}UI(); + virtual ~%{APPNAME}UI(); + void load(const QString& url); + +protected: + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dropEvent(QDropEvent *event); + virtual void closeEvent(QCloseEvent*); + virtual void showEvent(QShowEvent*e); + /** RMB -> context menu */ + virtual void mouseReleaseEvent(QMouseEvent *); + virtual bool eventFilter(QObject*, QEvent*); + /** volume control */ + virtual void wheelEvent(QWheelEvent *e); + +protected: + QSlider *seeker() const { return mSeeker; } + KStatusBar *statusBar() const { return mStatusBar; } + +public slots: + void slotPlaying(); + void slotStopped(); + void slotPaused(); + + /** "show/hide playlist" button */ + void playlistShown(); + void playlistHidden(); + + void slotTimeout(); + void sliderMoved(int seconds); + void changeLoopType(int t); + void skipToWrapper(int second); + +signals: + void skipTo( int ); // emitted by skipToWrapper() + +private slots: + void changeStatusbar(const QString& text, const QString &text2=0); + void changeCaption(const QString& text); + void popup(); + +private: + QPushButton *mBack, *mStop, *mPlay, *mForward, *mPlaylist, *mPopup, *mLoop; + QSlider *mSeeker, *mVolume; + KStatusBar *mStatusBar; +}; + +#endif // %{APPNAMEUC}_IMPL_H + diff --git a/languages/cpp/app_templates/noatunui/src-Makefile.am b/languages/cpp/app_templates/noatunui/src-Makefile.am new file mode 100644 index 00000000..95506569 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/src-Makefile.am @@ -0,0 +1,24 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = noatun_%{APPNAMELC}plugin.la + +noatun_%{APPNAMELC}plugin_la_SOURCES = plugin_%{APPNAMELC}.cpp plugin_%{APPNAMELC}_impl.cpp +noatun_%{APPNAMELC}plugin_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +noatun_%{APPNAMELC}plugin_la_LIBADD = $(LIB_KFILE) -lnoatun -lnoatuncontrols \ + -lqtmcop -lkmedia2_idl -lsoundserver_idl + +noinst_HEADERS = plugin_%{APPNAMELC}_impl.h + +# noatun_modules_uidir = $(kde_datadir)/noatun +# noatun_modules_ui_DATA = %{APPNAMELC}.plugin + +pluginsdir = $(kde_datadir)/noatun +plugins_DATA = %{APPNAMELC}.plugin + +# kde_services_DATA = %{APPNAMELC}.desktop + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/noatunui/subdirs b/languages/cpp/app_templates/noatunui/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/noatunui/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/noatunvisual/.kdev_ignore b/languages/cpp/app_templates/noatunvisual/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/noatunvisual/Makefile.am b/languages/cpp/app_templates/noatunvisual/Makefile.am new file mode 100644 index 00000000..0d6a43eb --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = src-Makefile.am plugin_app.cpp plugin_app.h plugin_impl.cpp \ + plugin_impl.h noatunvisual.png plugin.plugin plugin.kdevelop \ + subdirs noatunvisual-configure.in.in +templateName = noatunvisual + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual b/languages/cpp/app_templates/noatunvisual/noatunvisual new file mode 100644 index 00000000..e0d0f7e0 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual @@ -0,0 +1,8 @@ +# KDE Config File +[General] +Name=Noatun visualization plugin +Icon=noatunvisual.png +Category=C++/KDE +Comment=Generates a visualization plugin for noatun using SDL +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/plugin_APPNAMELC_impl.cpp diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in b/languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in new file mode 100644 index 00000000..b973abe8 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in @@ -0,0 +1,36 @@ +#MIN_CONFIG(3.0.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +KDE_CHECK_HEADERS([noatun/plugin.h]) +KDE_CHECK_LIB([noatun],main, + [LIB_NOAUTUN="-lnoautun"]) +AC_SUBST(LIB_NOAUTUN) + +KDE_FIND_PATH(sdl-config, LIBSDL_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find libsdl anywhere, check http://www.sdl.org]) +]) + +if test -n "$LIBSDL_CONFIG"; then + LIBSDL_LIBS="`$LIBSDL_CONFIG --libs`" + LIBSDL_RPATH= + for args in $LIBSDL_LIBS; do + case $args in + -L*) + LIBSDL_RPATH="$LIBSDL_RPATH $args" + ;; + esac + done + LIBSDL_RPATH=`echo $LIBSDL_RPATH | sed -e "s/-L/-R/g"` + LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`" + + AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 1, [Defines if your system has the LIBSDL library]) +fi + + +AC_SUBST(LIBSDL_LIBS) +AC_SUBST(LIBSDL_CFLAGS) +AC_SUBST(LIBSDL_RPATH) + diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate b/languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate new file mode 100644 index 00000000..4c726194 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate @@ -0,0 +1,205 @@ +# KDE Config File +[General] +Name=Noatun visualization plugin +Name[ca]=Connector de visualització per a Noatun +Name[da]=Noatun visualiserings-plugin +Name[de]=Noatun-Visualisierungs-Modul +Name[el]=Οπτικό πρόσθετο Noatun +Name[en_GB]=Noatun visualisation plugin +Name[es]=Complemento de visualización para Noatun +Name[et]=Noatuni visualiseerimisplugin +Name[eu]=Noatun bistaratze-plugina +Name[fa]=وصلۀ تجسم Noatun +Name[fr]=Module externe de visualisation pour Noatun +Name[ga]=Breiseán amharcléirithe Noatun +Name[gl]=Extensión de visualización para Noatun +Name[hu]=Noatun vizualizációs modul +Name[it]=Plugin di visualizzazione per noatun +Name[ja]=Noatun ビジュアライゼーションプラグイン +Name[nds]=Noatun-Filmmakermoduul +Name[ne]=नोअटन भिजुलाइजेसन प्लगइन +Name[nl]=Noatun visualisatieplugin +Name[pl]=Wtyczka wizualizacji do Noatun +Name[pt]='Plugin' de visualização do Noatun +Name[pt_BR]='Plugin' de visualização do Noatun +Name[ru]=Модуль визуализации Noatun +Name[sk]=Noatun vizualizačný modul +Name[sr]=Визуелизациони прикључак за Noatun +Name[sr@Latn]=Vizuelizacioni priključak za Noatun +Name[sv]=Noatun-insticksprogram för visningar +Name[tr]=Noatun görsellik eklentisi +Name[zh_CN]=Noatun 可视化插件 +Name[zh_TW]=Noatun 視覺化外掛程式 +Icon=noatunvisual.png +Category=C++/KDE +Comment=Generates a visualization plugin for noatun using SDL +Comment[ca]=Genera un connector de visualització per a Noatun usant SDL +Comment[da]=Generere et visualiserings-plugin for noatun ved brug af SDL +Comment[de]=Erstellt ein Visualisierungs-Modul für Noatun unter Verwendung der SDL. +Comment[el]=Δημιουργεί ένα οπτικό πρόσθετο για το noatun χρησιμοποιώντας το SDL +Comment[en_GB]=Generates a visualisation plugin for noatun using SDL +Comment[es]=Genera un complemento de visualización para Noatun que usa SDL +Comment[et]=Noatuni visualiseerimisplugina loomine SDL-i abil +Comment[eu]=SDL erabiliz, bistaratze-plugin bat sortzen du noatun-entzat +Comment[fa]=یک وصلۀ تجسم برای noatun با استفاده از SDL تولید می‌کند +Comment[fr]=Génère un module externe de visualisation pour Noatun utilisant SDL +Comment[ga]=Cruthaíonn sé seo breiseán amharcléirithe noatun le SDL +Comment[gl]=Xera unha extensión de visualización para noatun usando SDL +Comment[hu]=Létrehoz egy vizualizációs modult a Noatunhoz, SDL-ben +Comment[it]=Genera un plugin di visualizzazione per noatun usando SDL +Comment[nds]=Stellt mit SDL en Filmmakermoduul för Noatun op +Comment[ne]=SDL प्रयोग गरेर नोअटनका लागि भिजुलाइजेसन प्लगइन उत्पन्न गर्दछ +Comment[nl]=Genereert een visualisatieplugin voor Noatun met behulp van SDL +Comment[pl]=Generuje wtyczkę wizualizacji do Noatun. Używany jest SDL. +Comment[pt]=Gera um 'plugin' de visualização para o Noatun, que usa o SDL +Comment[pt_BR]=Gera um 'plugin' de visualização para o Noatun, que usa o SDL +Comment[ru]=Создание модуля визуализации для Noatun на основе SDL +Comment[sk]=Vygeneruje vizualizačný modul pre Noatun s použitím SDL +Comment[sr]=Прави визуелизациони прикључак за Noatun користећи SDL +Comment[sr@Latn]=Pravi vizuelizacioni priključak za Noatun koristeći SDL +Comment[sv]=Skapar ett Noatun-insticksprogram för visningar som använder SDL +Comment[tr]=SDL kullanarak noatun için bir görsellik eklentisi yaratır. +Comment[zh_CN]=使用 SDL 生成 noatun 的可视化插件 +Comment[zh_TW]=產生一個使用 SDL 的 Noatun 視覺化外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/plugin_%{APPNAMELC}_impl.cpp +Archive=noatunvisual.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{src}/noatunvisual-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/plugin_app.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/plugin_app.h +Dest=%{dest}/src/plugin_%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/plugin_impl.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}_impl.cpp + +[FILE15] +Type=install +Source=%{src}/plugin_impl.h +Dest=%{dest}/src/plugin_%{APPNAMELC}_impl.h + +[FILE16] +Type=install +Source=%{src}/plugin.plugin +Dest=%{dest}/src/%{APPNAMELC}.plugin + +[MSG] +Type=message +Comment=A Noatun visualization plugin was created in %{dest} +Comment[ca]=Un connector de visualització per a Noatun ha estat creat en %{dest} +Comment[da]=Et Noatun visualiserings-plugin blev oprettet i %{dest} +Comment[de]=Ein Visualisierungs-Modul für Noatun wurde in %{dest} erstellt. +Comment[el]=Ένα οπτικό πρόσθετο Noatun δημιουργήθηκε στο %{dest} +Comment[en_GB]=A Noatun visualisation plugin was created in %{dest} +Comment[es]=Un complemento de visualización para Noatun ha sido creado en %{dest} +Comment[et]=Noatuni visualiseerimisplugin loodi asukohta %{dest} +Comment[eu]=Noatun-en bistaratze-plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ تجسم Noatun در %{dest} ایجاد شد +Comment[fr]=Un module externe de visualisation pour Noatun a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán amharcléirithe Noatun i %{dest} +Comment[gl]=Creouse unha extensión de visualización para Noatun en %{dest} +Comment[hu]=Létrejött egy Noatun vizualizációs modul itt: %{dest} +Comment[it]=È stato creato un plugin di visualizzazione per noatun in %{dest} +Comment[ja]=Noatun ビジュアライゼーションプラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Noatun-Filmmakermoduul opstellt +Comment[ne]=नोअटन भिजुलाइजेसन प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Noatun-visualisatieplugin is aangemaakt in %{dest} +Comment[pl]=Wtyczka wizualizacji została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' de visualização do Noatun em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' de visualização do Noatun em %{dest} +Comment[ru]=Модуль визуализации Noatun создан в %{dest} +Comment[sk]=Noatun vizualizačný modul bol vytvorený v %{dest} +Comment[sr]=Визуелизациони прикључак за Noatun направљен је у %{dest} +Comment[sr@Latn]=Vizuelizacioni priključak za Noatun napravljen je u %{dest} +Comment[sv]=Ett Noatun-insticksprogram för visningar skapades i %{dest} +Comment[tr]=Bir Noatun görsellik eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了 Noatun 可视化插件 +Comment[zh_TW]=一個 Noatun 視覺化外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual.png b/languages/cpp/app_templates/noatunvisual/noatunvisual.png new file mode 100644 index 00000000..4dcfce3d Binary files /dev/null and b/languages/cpp/app_templates/noatunvisual/noatunvisual.png differ diff --git a/languages/cpp/app_templates/noatunvisual/plugin.kdevelop b/languages/cpp/app_templates/noatunvisual/plugin.kdevelop new file mode 100644 index 00000000..281d095e --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin.kdevelop @@ -0,0 +1,118 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + + + + 3 + true + 3 + EmbeddedKDevDesigner + + + + + + src/noatun_%{APPNAMELC}plugin.la + debug + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + -lSDL + + + + + + + + + + + + + + + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/noatunvisual/plugin.plugin b/languages/cpp/app_templates/noatunvisual/plugin.plugin new file mode 100644 index 00000000..9dc32648 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin.plugin @@ -0,0 +1,8 @@ +Filename=noatun_%{APPNAMELC}plugin.la +Author=%{AUTHOR} +Site=http://noatun.kde.org/ +Email=%{EMAIL} +Type=visualization +License=$LICENSE$ +Name=%{APPNAME} +Comment=My scope visualization plugin diff --git a/languages/cpp/app_templates/noatunvisual/plugin_app.cpp b/languages/cpp/app_templates/noatunvisual/plugin_app.cpp new file mode 100644 index 00000000..442bdefd --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_app.cpp @@ -0,0 +1,58 @@ + +#include +#include + +#include "plugin_%{APPNAMELC}.h" +#include "plugin_%{APPNAMELC}_impl.h" + +#include +#include + +extern "C" +{ + Plugin *create_plugin() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}Scope(); + } +} + +%{APPNAME}Scope::%{APPNAME}Scope() + : MonoScope(50), Plugin() +{ + setSamples(320); +} + +%{APPNAME}Scope::~%{APPNAME}Scope() +{ + ::close(mOutFd); + wait(0); +} + +void %{APPNAME}Scope::init() +{ + int pipes[2]; + ::pipe(pipes); + mOutFd=pipes[1]; + if (!fork()) + { + ::close(pipes[1]); + new %{APPNAME}View(pipes[0]); + exit(0); + } + else + { + fcntl(mOutFd, F_SETFL, fcntl(mOutFd, F_GETFL) & ~O_NONBLOCK); + ::close(pipes[0]); + MonoScope::start(); + } +} + +void %{APPNAME}Scope::scopeEvent(float *d, int size) +{ + if (::write(mOutFd, (char *)d, size * sizeof(float))==-1) + { + MonoScope::stop(); + unload(); + } +} diff --git a/languages/cpp/app_templates/noatunvisual/plugin_app.h b/languages/cpp/app_templates/noatunvisual/plugin_app.h new file mode 100644 index 00000000..a3cf91ea --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_app.h @@ -0,0 +1,36 @@ + +/** Note: You only have to change plugin_%{APPNAMELC}_impl.[h,cpp] */ + +#ifndef _PLUGIN_%{APPNAMEUC}_H_ +#define _PLUGIN_%{APPNAMEUC}_H_ + +#include +#include + +extern "C" +{ + #include + #include + #include +} + +class %{APPNAME}Scope : public MonoScope, public Plugin +{ +NOATUNPLUGIND + +public: + %{APPNAME}Scope(); + virtual ~%{APPNAME}Scope(); + + /** @short create a new child process (using fork) with %{APPNAME}View */ + void init(); + +protected: + virtual void scopeEvent(float *data, int bands); + +private: + int mOutFd; +}; + +#endif // _PLUGIN_%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/noatunvisual/plugin_impl.cpp b/languages/cpp/app_templates/noatunvisual/plugin_impl.cpp new file mode 100644 index 00000000..a25f1fd2 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_impl.cpp @@ -0,0 +1,276 @@ + +#include "plugin_%{APPNAMELC}_impl.h" + +#include +#include + +extern "C" +{ + #include + #include + #include +} + +#if 0 +#define TEST() cout << "At line " << __LINE__ << endl +#else +#define TEST() if(0) +#endif + +#define output ((unsigned char*)data) +template +inline void Bitmap::addPixel(int x, int y, int br1, int br2) +{ + if (x < 0 || x >= width || y < 0 || y >= height) return; + + register unsigned char *p = output+x*2+y*width*2; + if (p[0] < 255-br1) p[0] += br1; else p[0] = 255; + if (p[1] < 255-br2) p[1] += br2; else p[1] = 255; +} + +template +void Bitmap::addVertLine(int x, int y1, int y2, int br1, int br2) +{ + if(y1 < y2) + { + for(int y = y1; y <= y2; y++) + addPixel(x,y, br1, br2); + } + else if(y2 < y1) + { + for(int y = y2; y <= y1; y++) + addPixel(x, y, br1, br2); + } + else + { + addPixel(x, y1, br1, br2); + } +} + +template +void Bitmap::fadeStar() +{ + register unsigned long *ptr = (unsigned long*)output; + int i = width*height*2/4; + do + { + if (*ptr) + *(ptr++) -= ((*ptr & 0xf0f0f0f0ul) >> 4) + ((*ptr & 0xe0e0e0e0ul) >> 5); + else + ptr++; + } while(--i > 0); +} + +%{APPNAME}View::%{APPNAME}View(int in) : mFd(in), outputBmp(0), fullscreen(false) +{ + surface = 0; + width = 320; + height = width*6/8; + outputBmp.size(width, height); + TEST(); + + TEST(); + fcntl(mFd, F_SETFL, fcntl(mFd, F_GETFL) & ~O_NONBLOCK); + TEST(); + + + float *data = new float[width]; + TEST(); + + startVideo(); + setupPalette(); + TEST(); + + while(true) + { + checkInput(); + + if(!surface) exit(0); + + int bytestoread = width * sizeof(float); + int pos = 0; + while(pos < bytestoread) + { + char *d = (char *)data; + int r = read(mFd, d + pos, bytestoread - pos); + if(r > 0) pos += r; + else if (r==0) exit(0); + } + + outputBmp.fadeStar(); + outputBmp.fadeStar(); + + float *d = data; + float *end = data + width; + float heightHalf = height / 4.0; + int y = height / 2; + int x=0; + int oldy=(int)(*d * heightHalf); + while(d <= end) + { + int amp = (int)(*d * heightHalf); + amp+=y; + + outputBmp.addVertLine(x, oldy, amp, 255, 255); + oldy=amp; + + d++; + x++; + } + repaint(); + } +} + +static SDL_Surface *CreateScreen(Uint16 w, Uint16 h, Uint8 bpp, Uint32 flags) +{ + SDL_Surface *screen; + + // Set the video mode + screen = SDL_SetVideoMode(w, h, bpp, flags); + return screen; +} + +void %{APPNAME}View::startVideo() +{ + if(surface) + { + SDL_FreeSurface(surface); + surface = 0; + } + + Uint32 videoflags; + + /* Initialize SDL */ + if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) + exit(0); + + SDL_WM_SetCaption("%{APPNAME}","%{APPNAMELC}"); + + /* See if we try to get a hardware colormap */ + videoflags = SDL_SWSURFACE | (fullscreen?SDL_FULLSCREEN:0); + + surface = CreateScreen(width, height, 8, videoflags); + if (!surface) + exit(0); + + SDL_ShowCursor(0); + + if(!surface) + SDL_Quit(); + + SDL_WM_SetCaption("%{APPNAME}", 0); + SDL_ShowCursor(0); + +} + +void %{APPNAME}View::setupPalette(double) +{ +#define BOUND(x) ((x) > 255 ? 255 : (x)) +#define PEAKIFY(x) int(BOUND((x) - (x)*(255-(x))/255/2)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) + + int redMax=136; + int greenMax=136; + int blueMax=255; + + SDL_Color sdlPalette[256]; + + for(int i=0;i<256;i++) + { + // i + // 255 136 + sdlPalette[i].r = i*redMax/255; + sdlPalette[i].g = i*greenMax/255; + sdlPalette[i].b = i*blueMax/255; + } + + SDL_SetColors(surface, sdlPalette, 0, 256); + +#undef BOUND +#undef PEAKIFY +#undef MAX +} + +void %{APPNAME}View::checkInput() +{ + SDL_Event myEvent; + + while(SDL_PollEvent(&myEvent)) + { + switch(myEvent.type) + { + case SDL_KEYDOWN: + switch(myEvent.key.keysym.sym) + { + case SDLK_SPACE: +// fullscreen ^= true; +// startVideo(); + break; + default: + break; + } + break; + + case SDL_QUIT: + exit(0); + break; + } + } +} + +#define output2 ((unsigned char*)outputBmp.data) + +void %{APPNAME}View::repaint() +{ + SDL_LockSurface(surface); + TEST(); + + register unsigned long *ptr2 = (unsigned long*)output2; + unsigned long *ptr1 = (unsigned long*)( surface->pixels ); + int i = width*height/4; + TEST(); + + do { + // Asger Alstrup Nielsen's (alstrup@diku.dk) + // optimized 32 bit screen loop + register unsigned int const r1 = *(ptr2++); + register unsigned int const r2 = *(ptr2++); + + //if (r1 || r2) { +#ifdef LITTLEENDIAN + register unsigned int const v = + ((r1 & 0x000000f0ul) >> 4) + | ((r1 & 0x0000f000ul) >> 8) + | ((r1 & 0x00f00000ul) >> 12) + | ((r1 & 0xf0000000ul) >> 16); + *(ptr1++) = v | + ( ((r2 & 0x000000f0ul) << 12) + | ((r2 & 0x0000f000ul) << 8) + | ((r2 & 0x00f00000ul) << 4) + | ((r2 & 0xf0000000ul))); +#else + register unsigned int const v = + ((r2 & 0x000000f0ul) >> 4) + | ((r2 & 0x0000f000ul) >> 8) + | ((r2 & 0x00f00000ul) >> 12) + | ((r2 & 0xf0000000ul) >> 16); + *(ptr1++) = v | + ( ((r1 & 0x000000f0ul) << 12) + | ((r1 & 0x0000f000ul) << 8) + | ((r1 & 0x00f00000ul) << 4) + | ((r1 & 0xf0000000ul))); +#endif + //} else ptr1++; + } while (--i); + TEST(); + + SDL_UnlockSurface(surface); + SDL_UpdateRect(surface, 0, 0, 0, 0); + TEST(); + +} + +%{APPNAME}View::~%{APPNAME}View() +{ + ::close(mFd); +} diff --git a/languages/cpp/app_templates/noatunvisual/plugin_impl.h b/languages/cpp/app_templates/noatunvisual/plugin_impl.h new file mode 100644 index 00000000..2a7de7b1 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_impl.h @@ -0,0 +1,77 @@ + +#ifndef %{APPNAMEUC}_IMPL_H +#define %{APPNAMEUC}_IMPL_H + +struct SDL_Surface; + +/** + * @short This class is used for painting and supports some effects. + * Note: This is used in Blurscope. Feel free to remove this and + * implement your own drawing routines! + */ +template class Bitmap +{ +public: + int width, height, extra; + Pixel *data; + + Bitmap(int e=0) : extra(e), data(0) { } + ~Bitmap() { delete[] data; } + + inline void addPixel(int x, int y, int bright1, int bright2); + void addVertLine(int x, int y, int y2, int br1, int br2); + + void fadeStar(); + + void size(int w,int h) + { + delete[] data; + width = w; + height = h; + data = new Pixel[w*h+extra]; + clear(); + } + + void clear() + { + memset(data,0,sizeof(Pixel)*(width*height+extra)); + } +}; + +/** + * @short This class does: + * o set up view + * o drawing routines. + */ +class %{APPNAME}View +{ +public: + %{APPNAME}View(int in); + ~%{APPNAME}View(); + +protected: + /** Screen initialization with SDL. Note, that you can initialize OpenGL with SDL! */ + void startVideo(); + /** SDL event queue */ + void checkInput(); + /** Used in Blurscope. Feel free to implement your own drawing routines! */ + void setupPalette(double dummy=0.0); + + /** Draw everything. */ + void repaint(); + +private: + /** used for pipelining */ + int mFd; + + /** SDL screen surface */ + SDL_Surface *surface; + Bitmap outputBmp; + + bool fullscreen; + int width; + int height; +}; + +#endif // %{APPNAMEUC}_IMPL_H + diff --git a/languages/cpp/app_templates/noatunvisual/src-Makefile.am b/languages/cpp/app_templates/noatunvisual/src-Makefile.am new file mode 100644 index 00000000..207fd8a8 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/src-Makefile.am @@ -0,0 +1,19 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = noatun_%{APPNAMELC}plugin.la + +noatun_%{APPNAMELC}plugin_la_SOURCES = plugin_%{APPNAMELC}.cpp plugin_%{APPNAMELC}_impl.cpp +noatun_%{APPNAMELC}plugin_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined $(LIBSDL_RPATH) +noatun_%{APPNAMELC}plugin_la_CXXFLAGS = $(LIBSDL_CFLAGS) +noatun_%{APPNAMELC}plugin_la_LIBADD = $(LIB_KFILE) $(LIBSDL_LIBS) -lnoatun -lm + +pluginsdir = $(kde_datadir)/noatun +plugins_DATA = %{APPNAMELC}.plugin + +# kde_services_DATA = %{APPNAMELC}.desktop + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/noatunvisual/subdirs b/languages/cpp/app_templates/noatunvisual/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/cpp/app_templates/opieapp/.kdev_ignore b/languages/cpp/app_templates/opieapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opieapp/Example.png b/languages/cpp/app_templates/opieapp/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opieapp/Example.png differ diff --git a/languages/cpp/app_templates/opieapp/Makefile.am b/languages/cpp/app_templates/opieapp/Makefile.am new file mode 100644 index 00000000..643a1c29 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = Example.png app.kdevelop example.desktop Makefile.am \ + app.pro example.cpp example.h examplebase.ui + +templateName = opieapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opieapp/app.kdevelop b/languages/cpp/app_templates/opieapp/app.kdevelop new file mode 100644 index 00000000..69b6f2bc --- /dev/null +++ b/languages/cpp/app_templates/opieapp/app.kdevelop @@ -0,0 +1,143 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + true + + + + Applications + + %{APPNAMELC} + 0 +
      opie/application
      + %{AUTHOR} %{EMAIL} + arm + task-opie-minimal + %{VERSION} + Empty +
      +
      + + + + + ./%{APPNAMELC} + -qws + + +
      + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
      diff --git a/languages/cpp/app_templates/opieapp/app.pro b/languages/cpp/app_templates/opieapp/app.pro new file mode 100644 index 00000000..f4111696 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/app.pro @@ -0,0 +1,38 @@ +TEMPLATE = quick-template +CONFIG = qt qtopia warn_on release zecke-libqpe zecke-libopie +HEADERS = %{APPNAMELC}.h +SOURCES = %{APPNAMELC}.cpp +INTERFACES = %{APPNAMELC}base.ui +TARGET = %{APPNAMELC} + +QMAKE_LIBDIR = $(OPIEDIR)/lib +OPIE-SPEC=6 + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +zecke-libqpe { + INCLUDEPATH += $(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $(OPIEDIR)/include + DEPENDPATH += $(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opieapp/example.cpp b/languages/cpp/app_templates/opieapp/example.cpp new file mode 100644 index 00000000..84f3f9d5 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/example.cpp @@ -0,0 +1,32 @@ +#include "%{APPNAMELC}.h" +#include +#include + +typedef OApplicationFactory<%{APPNAME}> %{APPNAME}Factory; +OPIE_EXPORT_APP( %{APPNAME}Factory ) + +/* + * Constructs a %{APPNAME} which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +%{APPNAME}::%{APPNAME}( QWidget* parent, const char* name, WFlags fl ) + : %{APPNAME}Base( parent, name, fl ) +{ + connect(quit, SIGNAL(clicked()), this, SLOT(goodBye())); +} + +/* + * Destroys the object and frees any allocated resources + */ +%{APPNAME}::~%{APPNAME}() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * A simple slot... not very interesting. + */ +void %{APPNAME}::goodBye() +{ + close(); +} diff --git a/languages/cpp/app_templates/opieapp/example.desktop b/languages/cpp/app_templates/opieapp/example.desktop new file mode 100644 index 00000000..f6f04194 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/example.desktop @@ -0,0 +1,37 @@ +[Desktop Entry] +Comment=An %{APPNAME} Program +Comment[ca]=Un programa per a %{APPNAME} +Comment[da]=Et %{APPNAME} program +Comment[de]=Ein %{APPNAME}-Program +Comment[el]=Ένα πρόγραμμα %{APPNAME} +Comment[es]=Un programa %{APPNAME} +Comment[et]=%{APPNAME} programm +Comment[eu]=%{APPNAME} programa bat +Comment[fa]=برنامۀ %{APPNAME} +Comment[fr]=Un programme %{APPNAME} +Comment[ga]=Clár %{APPNAME} +Comment[gl]=Un programa %{APPNAME} +Comment[hu]=%{APPNAME} program +Comment[it]=Un programma per %{APPNAME} +Comment[ja]=%{APPNAME} プログラム +Comment[nds]=En %{APPNAME}-Programm +Comment[ne]= %{APPNAME} कार्यक्रम +Comment[nl]=Een %{APPNAME} programma +Comment[pl]=Program %{APPNAME} +Comment[pt]=Um Programa %{APPNAME} +Comment[pt_BR]=Um Programa %{APPNAME} +Comment[ru]=Программа %{APPNAME} +Comment[sk]=%{APPNAME} program +Comment[sl]=Program %{APPNAME} +Comment[sr]=%{APPNAME} програм +Comment[sr@Latn]=%{APPNAME} program +Comment[sv]=Ett %{APPNAME}-program +Comment[ta]=ஒரு %{APPNAME} நிரல் +Comment[tg]=Барномаи %{APPNAME} +Comment[tr]=Bir %{APPNAME} Programı +Comment[zh_CN]=一个 %{APPNAME} 程序 +Comment[zh_TW]=一個 %{APPNAME} 程式 +Exec=%{APPNAMELC} +Icon=%{APPNAME} +Type=Application +Name=%{APPNAME} diff --git a/languages/cpp/app_templates/opieapp/example.h b/languages/cpp/app_templates/opieapp/example.h new file mode 100644 index 00000000..1ba8ead7 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/example.h @@ -0,0 +1,20 @@ +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H +#include "%{APPNAMELC}base.h" + +class %{APPNAME} : public %{APPNAME}Base +{ + Q_OBJECT + +public: + static QString appName() { + return QString::fromLatin1("%{APPNAMELC}" ); + } + %{APPNAME}( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~%{APPNAME}(); + +private slots: + void goodBye(); +}; + +#endif // %{APPNAMEUC}_H diff --git a/languages/cpp/app_templates/opieapp/examplebase.ui b/languages/cpp/app_templates/opieapp/examplebase.ui new file mode 100644 index 00000000..b6b81b11 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/examplebase.ui @@ -0,0 +1,49 @@ + +%{APPNAME}Base + + QWidget + + name + %{APPNAME}Base + + + geometry + + 0 + 0 + 196 + 245 + + + + caption + %{APPNAME} + + + + + QLabel + + name + TextLabel1 + + + text + <p>This is just an <i>%{APPNAMELC}</i>; it does not do anything interesting at all. + + + + QPushButton + + name + quit + + + text + Quit + + + + + + diff --git a/languages/cpp/app_templates/opieapp/opieapp.kdevtemplate b/languages/cpp/app_templates/opieapp/opieapp.kdevtemplate new file mode 100644 index 00000000..622ec9a6 --- /dev/null +++ b/languages/cpp/app_templates/opieapp/opieapp.kdevtemplate @@ -0,0 +1,149 @@ +# KDE Config File +[General] +Name=Opie Application +Name[br]=Meziant Opie +Name[ca]=Aplicació per a Opie +Name[da]=Opie-program +Name[de]=Opie-Anwendung +Name[el]=Εφαρμογή Opie +Name[es]=Aplicación para Opie +Name[et]=Opie rakendus +Name[eu]=Opie aplikazioa +Name[fa]=کاربرد Opie +Name[fr]=Application Opie +Name[ga]=Feidhmchlár Opie +Name[gl]=Aplicación Opie +Name[hu]=Opie-alkalmazás +Name[it]=Applicazione Opie +Name[ja]=Opie アプリケーション +Name[nds]=Opie-Programm +Name[ne]=ओपिइ अनुप्रयोग +Name[nl]=Opie-toepassing +Name[pl]=Program Opie +Name[pt]=Aplicação do Opie +Name[pt_BR]=Aplicação do Opie +Name[ru]=Приложение Opie +Name[sk]=Apie aplikácia +Name[sl]=Program za Opie +Name[sr]=Opie програм +Name[sr@Latn]=Opie program +Name[sv]=Opie-program +Name[tr]=Opie Uygulaması +Name[zh_CN]=Opie 应用程序 +Name[zh_TW]=Opie 應用程式 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie application. +Comment[ca]=Genera una aplicació per a Opie. +Comment[da]=Generér et Opie-program. +Comment[de]=Erstellt eine Opie-Anwendung +Comment[el]=Δημιουργία μιας εφαρμογής Opie. +Comment[es]=Genera una aplicación para Opie. +Comment[et]=Opie rakenduse loomine. +Comment[eu]=Sortu Opie aplikazio bat. +Comment[fa]=یک کاربرد Opie تولید می‌کند. +Comment[fr]=Génère une application Opie. +Comment[ga]=Cruthaigh feidhmchlár Opie. +Comment[hu]=Létrehoz egy Opie-alkalmazást. +Comment[it]=Genera un'applicazione Opie. +Comment[ja]=Opie アプリケーションを作成 +Comment[nds]=Stellt en Opie-Programm op. +Comment[ne]=ओपिइ अनुप्रयोग उत्पन्न गर्नुहोस् +Comment[nl]=Genereert een Opie-toepassing +Comment[pl]=Generuje program Opie. +Comment[pt]=Gera uma aplicação do Opie. +Comment[pt_BR]=Gera uma aplicação do Opie. +Comment[ru]=Создание приложение Opie. +Comment[sk]=Vygeneruje Opie aplikáciu. +Comment[sl]=Ustvari program za Opie +Comment[sr]=Прави Opie програм. +Comment[sr@Latn]=Pravi Opie program. +Comment[sv]=Skapa ett Opie-program. +Comment[tr]=Bir Opie uygulaması yarat +Comment[zh_CN]=生成一个 Opie 应用程序。 +Comment[zh_TW]=產生一個 Opie 應用程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opieapp.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/example.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/example.h +Dest=%{dest}/%{APPNAMELC}.h + +[FILE6] +Type=install +Source=%{src}/examplebase.ui +Dest=%{dest}/%{APPNAMELC}base.ui + +[MkDir2] +Type=mkdir +Dir=%{dest}/apps + +[FILE7] +Type=install +Source=%{src}/example.desktop +Dest=%{dest}/apps/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=An opie application was created in %{dest} +Comment[ca]=Una aplicació per a Opie ha estat creada en %{dest} +Comment[da]=Et opie-program blev oprettet i %{dest} +Comment[de]=Eine Opie-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή opie δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para Opie ha sido creada en %{dest} +Comment[et]=Opie rakendus loodi asukohta %{dest} +Comment[eu]=Opie aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد opie در %{dest} ایجاد شد +Comment[fr]=Une application Opie a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár opie i %{dest} +Comment[gl]=Creouse unha aplicación opie en %{dest} +Comment[hu]=Létrejött egy Opie-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Opie in %{dest} +Comment[ja]=Opie アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Opie-Programm opstellt +Comment[ne]=ओपिइ अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie-toepassing is aangemaakt in %{dest} +Comment[pl]=Program Opie został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do Opie em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do Opie em %{dest} +Comment[ru]=Приложение Opie создано в %{dest} +Comment[sk]=Opie aplikácia bola vytvorená v %{dest} +Comment[sl]=Program za opie je bil ustvarjen v %{dest} +Comment[sr]=Opie програм је направљен у %{dest} +Comment[sr@Latn]=Opie program je napravljen u %{dest} +Comment[sv]=Ett Opie-program skapades i %{dest} +Comment[tr]=Bir opie uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 应用程序 +Comment[zh_TW]=一個 opie 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/opieapp/opieapp.png b/languages/cpp/app_templates/opieapp/opieapp.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opieapp/opieapp.png differ diff --git a/languages/cpp/app_templates/opieapplet/.kdev_ignore b/languages/cpp/app_templates/opieapplet/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opieapplet/Example.png b/languages/cpp/app_templates/opieapplet/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opieapplet/Example.png differ diff --git a/languages/cpp/app_templates/opieapplet/Makefile.am b/languages/cpp/app_templates/opieapplet/Makefile.am new file mode 100644 index 00000000..8faf4e32 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = Makefile.am Example.png app.kdevelop app.pro \ + simpleimpl.cpp simpleimpl.h + +templateName = opieapplet + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opieapplet/app.kdevelop b/languages/cpp/app_templates/opieapplet/app.kdevelop new file mode 100644 index 00000000..eee2c55a --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/app.kdevelop @@ -0,0 +1,158 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + true + + + + + %{APPNAMELC} + 0 +
      opie/applets
      + %{AUTHOR} %{EMAIL} + arm + task-opie-minimal + %{VERSION} + Empty +
      + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi + + +
      + + + + + ./%{APPNAMELC} + -qws + + +
      + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
      diff --git a/languages/cpp/app_templates/opieapplet/app.pro b/languages/cpp/app_templates/opieapplet/app.pro new file mode 100644 index 00000000..e1cc1e3b --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/app.pro @@ -0,0 +1,38 @@ +TEMPLATE = lib +CONFIG = qt dll qtopia warn_on release zecke-libqpe zecke-libopie opie-applet +HEADERS = %{APPNAMELC}.h +SOURCES = %{APPNAMELC}.cpp +TARGET = %{APPNAMELC} + + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +QMAKE_LIBDIR= $$(OPIEDIR)/lib +OPIE-SPEC=6 + +zecke-libqpe { + INCLUDEPATH += $$(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $$(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $$(OPIEDIR)/include + DEPENDPATH += $$(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate b/languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate new file mode 100644 index 00000000..7be33a95 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate @@ -0,0 +1,135 @@ +# KDE Config File +[General] +Name=Opie Applet +Name[br]=Arloadig Opie +Name[ca]=Miniaplicació per a Opie +Name[da]=Opie-applet +Name[de]=Opie-Miniprogramm (Applet) +Name[el]=Μικροεφαρμογή Opie +Name[es]=Applet para Opie +Name[et]=Opie aplett +Name[eu]=Opie applet-a +Name[fa]=برنامک Opie +Name[fr]=Applet Opie +Name[ga]=Feidhmchláirín Opie +Name[gl]=Applet Opie +Name[hu]=Opie-s kisalkalmazás +Name[it]=Applet Opie +Name[ja]=Opie アプレット +Name[nds]=Opie-Lüttprogramm +Name[ne]=ओपिइ एप्लेट +Name[nl]=Opie-applet +Name[pl]=Aplet Opie +Name[pt]='Applet' do Opie +Name[pt_BR]='Applet' do Opie +Name[ru]=Аплет Opie +Name[sk]=Opie applet +Name[sl]=Vstavek za Opie +Name[sr]=Opie аплет +Name[sr@Latn]=Opie aplet +Name[sv]=Opie-miniprogram +Name[tr]=Opie Küçük Uygulaması +Name[zh_CN]=Opie 小程序 +Name[zh_TW]=Opie 小程式 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie applet. +Comment[ca]=Genera una miniaplicació per a Opie. +Comment[da]=Generér en Opie-applet. +Comment[de]=Erstellt ein Opie-Miniprogramm (Applet). +Comment[el]=Δημιουργία μίας μικροεφαρμογής Opie. +Comment[es]=Genera un applet para Opie. +Comment[et]=Opie apleti loomine. +Comment[eu]=Sortu Opie applet bat. +Comment[fa]=یک برنامک Opie تولید می‌کند. +Comment[fr]=Génère un applet Opie. +Comment[ga]=Cruthaigh feidhmchláirín Opie. +Comment[gl]=Xera un applet Opie. +Comment[hu]=Létrehoz egy Opie-s kisalkalmazást. +Comment[it]=Genera un'applet Opie. +Comment[ja]=Opie アプレットを作成 +Comment[nds]=Stellt en Opie-Lüttprogramm op. +Comment[ne]=ओपिइ एप्लेट उत्पन्न गर्दछ +Comment[nl]=Genereert een Opie-applet. +Comment[pl]=Generuje aplet Opie +Comment[pt]=Gera uma 'applet' do Opie. +Comment[pt_BR]=Gera uma 'applet' do Opie. +Comment[ru]=Создание аплета Opie. +Comment[sk]=Vygeneruje Opie applet. +Comment[sl]=Ustvari vstavek za Opie. +Comment[sr]=Прави Opie аплет. +Comment[sr@Latn]=Pravi Opie aplet. +Comment[sv]=Skapa ett Opie-miniprogram. +Comment[zh_CN]=生成一个 Opie 小程序。 +Comment[zh_TW]=產生一個 Opie 小程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opieapplet.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/simpleimpl.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/simpleimpl.h +Dest=%{dest}/%{APPNAMELC}.h + +[MSG] +Type=message +Comment=An opie applet was created in %{dest} +Comment[ca]=Una miniaplicació per a Opie ha estat creat en %{dest} +Comment[da]=En opie-applet blev oprettet i %{dest} +Comment[de]=Ein Opie-Miniprogramm (Applet) wurde in %{dest} erstellt. +Comment[el]=Μία μικροεφαρμογή opie δημιουργήθηκε στο %{dest} +Comment[es]=Un applet para Opie ha sido creado en %{dest} +Comment[et]=Opie aplett loodi asukohta %{dest} +Comment[eu]=Opie applet bat sortu da hemen: %{dest} +Comment[fa]=یک برنامک opie در %{dest} ایجاد شد +Comment[fr]=Un applet Opie a été créé dans %{dest} +Comment[ga]=Cruthaíodh feidhmchláirín opie i %{dest} +Comment[gl]=Creouse un applet opie en %{dset} +Comment[hu]=Létrejött egy Opie-s kisalkalmazás itt: %{dest} +Comment[it]=È stata creata un'applet Opie in %{dest} +Comment[ja]=Opie アプレットを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Opie-Lüttprogramm opstellt +Comment[ne]=ओपिइ एप्लेट %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie-applet is aangemaakt in %{dest} +Comment[pl]=Aplet Opie został utworzony w %{dest} +Comment[pt]=Foi criada uma 'applet' do Opie em %{dest} +Comment[pt_BR]=Foi criada uma 'applet' do Opie em %{dest} +Comment[ru]=Аплет Opie создан в %{dest} +Comment[sk]=Opie applet bol vytvorený v %{dest} +Comment[sl]=Vstavek za opie je bil ustvarjen v %{dest} +Comment[sr]=Opie аплет је направљен у %{dest} +Comment[sr@Latn]=Opie aplet je napravljen u %{dest} +Comment[sv]=Ett Opie-miniprogram skapades i %{dest} +Comment[tr]=Bir Opie küçük uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 小程序 +Comment[zh_TW]=一個 Opie 小程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/opieapplet/opieapplet.png b/languages/cpp/app_templates/opieapplet/opieapplet.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opieapplet/opieapplet.png differ diff --git a/languages/cpp/app_templates/opieapplet/simpleimpl.cpp b/languages/cpp/app_templates/opieapplet/simpleimpl.cpp new file mode 100644 index 00000000..1474a0e4 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/simpleimpl.cpp @@ -0,0 +1,162 @@ +#include +#include +#include + +#include // for AppLnk +#include // for Resource loading + +#include "%{APPNAMELC}.h" + + +%{APPNAME}::%{APPNAME}(QWidget *parent) + : QWidget( parent, "%{APPNAME} Applet" ) { +/* + * we will load an Image, scale it for the right usage + * remember your applet might be used by different + * resolutions. + * Then we will convert the image back to an Pixmap + * and draw this Pimxap. We need to use Image because its + * the only class that allows scaling. + */ + + QImage image = Resource::loadImage("%{APPNAMELC}/%{APPNAMELC}"); + /* + * smooth scale to AppLnk smallIconSize for applest + * smallIconSize gets adjusted to the resolution + * so on some displays like SIMpad and a C-750 the smallIconSize + * is greater than on a iPAQ h3870 + */ + image = image.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize() ); + + /* + * now we need to convert the Image to a Pixmap cause these + * can be drawn more easily + */ + m_pix = new QPixmap(); + m_pix->convertFromImage( image ); + + /* + * Now we will say that we don't want to be bigger than our + * Pixmap + */ + setFixedHeight(AppLnk::smallIconSize() ); + setFixedWidth( AppLnk::smallIconSize() ); + +} + +%{APPNAME}::~%{APPNAME}() { + delete m_pix; +} + + +/* + * here you would normal show or do something + * useful. If you want to show a widget at the top left + * of your icon you need to map your rect().topLeft() to + * global with mapToGlobal(). Then you might also need to + * move the widgets so it is visible + */ +void %{APPNAME}::mousePressEvent(QMouseEvent* ) { + QMessageBox::information(this, tr("No action taken"), + tr("This Plugin does not yet support anything usefule aye."), + QMessageBox::Ok ); + +} + +void %{APPNAME}::paintEvent( QPaintEvent* ) { + QPainter p(this); + + /* simpy draw the pixmap from the start of this widget */ + p.drawPixmap(0, 0, *m_pix ); +} + +/* + * Here comes the implementation of the interface + */ +%{APPNAME}Impl::%{APPNAME}Impl() { +} +/* needed cause until it is only pure virtual */ +%{APPNAME}Impl::~%{APPNAME}Impl() { + /* + * we will delete our applets as well + * setAUtoDelete makes the QList free + * the objects behind the pointers + */ + m_applets.setAutoDelete( true ); + m_applets.clear(); +} + +/* + * For the taskbar interface return a Widget + */ +QWidget* %{APPNAME}Impl::applet( QWidget* parent ) { + /* + * There are problems with ownership. So we add + * our ownlist and clear this; + */ + %{APPNAME}* ap = new %{APPNAME}( parent ); + m_applets.append( ap ); + + return ap; +} + +/* + * A small hint where the Applet Should be displayed + */ +int %{APPNAME}Impl::position()const { + return 1; +} + + +/* + * Now the important QUnkownInterface method without + * this one your applet won't load + * @param uuid The uuid of the interface + * @param iface The pointer to the interface ptr + */ +QRESULT %{APPNAME}Impl::queryInterface( const QUuid& uuid, QUnknownInterface** iface) { + /* set the pointer to the interface to 0 */ + *iface = 0; + + /* + * we check if we support the requested interface + * and then assign to the pointer. + * You may alos create another interface here so + * *iface = this is only in this simple case true you + * could also support more interfaces. + * But this example below is the most common use. + * Now the caller knows that the Interface Pointer + * is valid and the interface supported + */ + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_TaskbarApplet ) + *iface = this; + else + return QS_FALSE; + + if ( *iface ) + (*iface)->addRef(); + + return QS_OK; +} + + +/* + * Finally we need to export the Interface. + * CREATE_INSTANCE creates a interface and calls + * queryInterface for the QUnknownInterface once + * With out this function the applet can't be loaded. + * + * NOTE: If your applet does not load it's likely you've an + * unresolved symbol. Change the .pro TEMPLATE = lib to TEMPLATE= app + * and recompile. If the linker only complains about a missing + * main method the problem is more complex. In most cases it'll say + * you which symbols are missing and you can implement them. + * The main(int argc, char* argv[] ) does not need to be + * included in a library so it's ok that the linker complains + */ +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( %{APPNAME}Impl ) +} + diff --git a/languages/cpp/app_templates/opieapplet/simpleimpl.h b/languages/cpp/app_templates/opieapplet/simpleimpl.h new file mode 100644 index 00000000..19475367 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/simpleimpl.h @@ -0,0 +1,75 @@ +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + + +/** + * Opie and Qtopia uses a component system called QCOM + * which was first part of the Qt 3.0 API but was made + * prviate during the betas. Opie and Qtopia still use it + * and we're happy with it. + * Every starts with the QUnknownInterface. It supports functions + * for reference counting and the most important one + * is for a query. Every QCOM interface got a global unique id ( GUID,UUID ) + * query is used to see if a interface is supported by + * a dynamic shared object ( dso / plugin ) + * For tasks like loading Applications, InputMethods, Today, MenuButton, + * Taskbar, Style, Email Client there are specefic Interfaces you + * need to implement. The interfaces inherits from QUnknownInterface and + * you'll need inherit from the interface. + * As example we will use the Taskbar interface + */ + + +/* + * The taskbar applet interfaces wants us to implement position() and applet() + * additionally we need to implement add(), release() and queryInterface for QUnknownInterface + * luckiy there is a macro for the reference counting + * We provide an Implementation of the interface. + */ +#include +#include + +#include + + +/* + * Because we only draw an Icon in a fixed width and height + * we declare and define %{APPNAME} here and you could use QLabel + * setPixmap or use QWidget and draw yourself. + * You might also want to reimplement mouse*Event to use some simple actions + */ +class %{APPNAME} : public QWidget { + Q_OBJECT +public: + %{APPNAME}(QWidget *parent); + ~%{APPNAME}(); +private: + void mousePressEvent( QMouseEvent* ); + void paintEvent( QPaintEvent* ); + QPixmap *m_pix; +}; + +class %{APPNAME}Impl : public TaskbarAppletInterface { +public: + + %{APPNAME}Impl(); + virtual ~%{APPNAME}Impl(); + + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + + QWidget *applet( QWidget* parent ); + int position()const; + + /* + * macro for reference countint + * if reference drops to zero + * delete this is called + */ + Q_REFCOUNT + +private: + QList<%{APPNAME}> m_applets; +}; + + +#endif diff --git a/languages/cpp/app_templates/opieinput/.kdev_ignore b/languages/cpp/app_templates/opieinput/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opieinput/Example.png b/languages/cpp/app_templates/opieinput/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opieinput/Example.png differ diff --git a/languages/cpp/app_templates/opieinput/Makefile.am b/languages/cpp/app_templates/opieinput/Makefile.am new file mode 100644 index 00000000..d748092c --- /dev/null +++ b/languages/cpp/app_templates/opieinput/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = Makefile.am Example.png app.kdevelop app.pro \ + simpleimpl.cpp simpleimpl.h +templateName = opieinput + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opieinput/app.kdevelop b/languages/cpp/app_templates/opieinput/app.kdevelop new file mode 100644 index 00000000..639a3215 --- /dev/null +++ b/languages/cpp/app_templates/opieinput/app.kdevelop @@ -0,0 +1,159 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + false + + + + plugins/inputmethods + + %{APPNAMELC} + 0 +
      opie/inputmethods
      + %{AUTHOR} %{EMAIL} + arm + task-opie-minimal + %{VERSION} + Empty +
      + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()" +else + exit 0 +fi + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()" +else + exit 0 +fi + + +
      + + + + + qpe + -qws + + +
      + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
      diff --git a/languages/cpp/app_templates/opieinput/app.pro b/languages/cpp/app_templates/opieinput/app.pro new file mode 100644 index 00000000..1711c78f --- /dev/null +++ b/languages/cpp/app_templates/opieinput/app.pro @@ -0,0 +1,38 @@ +TEMPLATE = lib +CONFIG = qt dll qtopia warn_on release zecke-libqpe zecke-libopie opie-input +HEADERS = %{APPNAMELC}.h +SOURCES = %{APPNAMELC}.cpp +TARGET = %{APPNAMELC} + + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +QMAKE_LIBDIR= $$(OPIEDIR)/lib +OPIE-SPEC=6 + +zecke-libqpe { + INCLUDEPATH += $$(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $$(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $$(OPIEDIR)/include + DEPENDPATH += $$(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opieinput/opieinput.kdevtemplate b/languages/cpp/app_templates/opieinput/opieinput.kdevtemplate new file mode 100644 index 00000000..39250370 --- /dev/null +++ b/languages/cpp/app_templates/opieinput/opieinput.kdevtemplate @@ -0,0 +1,129 @@ +# KDE Config File +[General] +Name=Opie Input +Name[ca]=Entrada per a Opie +Name[da]=Opie-input +Name[de]=Opie-Eingabe +Name[el]=Μέθοδος εισαγωγής Opie +Name[es]=Entrada para Opie +Name[et]=Opie sisestus +Name[eu]=Opie sarrera +Name[fa]=ورودی Opie +Name[fr]=Entrée Opie +Name[ga]=Ionchur Opie +Name[gl]=Entrada Opie +Name[hu]=Opie-s bemeneti modul +Name[it]=Input di Opie +Name[ja]=Opie 入力 +Name[nds]=Opie-Ingaav +Name[ne]=ओपिइ आगत +Name[nl]=Opie-invoer +Name[pl]=Wejście Opie +Name[pt]=Introdução de Dados do Opie +Name[pt_BR]=Introdução de Dados do Opie +Name[ru]=Модуль ввода Opie +Name[sk]=Opie vstup +Name[sr]=Opie унос +Name[sr@Latn]=Opie unos +Name[sv]=Opie-inmatning +Name[tr]=Opie Girdisi +Name[zh_CN]=Opie 输入法 +Name[zh_TW]=Opie 輸入 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie input method plugin. +Comment[ca]=Genera un connector de mètode d'entrada per a Opie. +Comment[da]=Generér en Opie input-metode-plugin. +Comment[de]=Erstellt ein Eingabemethode-Modul für Opie. +Comment[el]=Δημιουργία ενός πρόσθετου μεθόδου εισαγωγής. +Comment[es]=Genera un complemento de método de entrada para Opie. +Comment[et]=Opie sisestusmeetodi plugina loomine. +Comment[eu]=Sortu Opie-ren sarrera-metodoaren plugin bat. +Comment[fa]=یک وصلۀ روش ورودی Opie تولید می‌کند. +Comment[fr]=Génère un module externe de méthode d'entrée Opie. +Comment[gl]=Xera unha extensión de método de entrada para Opie. +Comment[hu]=Létrehoz egy Opie-s bemeneti modult. +Comment[it]=Genera un plugin per il metodo di input Opie. +Comment[nds]=Stellt en Ingaavmetood-Moduul för Opie op. +Comment[ne]=ओपिइ आगत विधि प्लगइन उत्पन्न गर्नुहोस् +Comment[nl]=Genereert een Opie-invoermethode-plugin. +Comment[pl]=Generuje wtyczkę z metodą wejściową dla Opie. +Comment[pt]=Gera um 'plugin' de introdução de dados do Opie. +Comment[pt_BR]=Gera um 'plugin' de introdução de dados do Opie. +Comment[ru]=Создание модуля ввода данных для среды Opie. +Comment[sk]=Vygeneruje Opie vstupný modul. +Comment[sr]=Прави прикључак за Opie метод уноса. +Comment[sr@Latn]=Pravi priključak za Opie metod unosa. +Comment[sv]=Skapa ett insticksprogram för Opie-inmatning. +Comment[tr]=Bir Opie girdi yöntemi eklentisi yarat +Comment[zh_CN]=生成一个 Opie 输入法插件。 +Comment[zh_TW]=產生一個 Opie 輸入法外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opieinput.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/simpleimpl.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/simpleimpl.h +Dest=%{dest}/%{APPNAMELC}.h + +[MSG] +Type=message +Comment=An opie input method plugin was created in %{dest} +Comment[ca]=Un connector de mètode d'entrada per a Opie ha estat creat en %{dest} +Comment[da]=At opie input-metode-plugin blev oprettet i %{dest} +Comment[de]=Ein Eingabemethode-Modul für Opie wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο μεθόδου εισαγωγής opie δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento de método de entrada para Opie ha sido creado en %{dest} +Comment[et]=Opie sisestusmeetodi plugin loodi asukohta %{dest} +Comment[eu]=Opie-ren sarrera-metodoaren plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ روش ورودی opie در %{dest} ایجاد شد +Comment[fr]=Un module externe de méthode d'entrée Opie a été créé dans %{dest} +Comment[gl]=Creouse unha extensión de método de entrada para opie en %{dest} +Comment[hu]=Létrejött egy Opie-s bemeneti modul itt: %{dest} +Comment[it]=È stato creato un plugin per il metodo di input Opie in %{dest} +Comment[nds]=In %{dest} wöör en Opie-Ingaavmetoodmoduul opstellt +Comment[ne]=ओपिइ आगत विधि प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie-invoermethode-plugins is aangemaakt in %{dest} +Comment[pl]=Wtyczka z metodą wejściową dla Opie została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' de introdução de dados em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' de introdução de dados em %{dest} +Comment[ru]=Модуль ввода Opie создан в %{dest} +Comment[sk]=Opie vstupný modul bol vytvorený v %{dest} +Comment[sr]=Прикључак за Opie метод уноса направљен је у %{dest} +Comment[sr@Latn]=Priključak za Opie metod unosa napravljen je u %{dest} +Comment[sv]=Ett insticksprogram för Opie-inmatning skapades i %{dest} +Comment[tr]=Bir opie girdi yöntemi eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 输入法 +Comment[zh_TW]=一個 Opie 輸入法外掛程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/opieinput/opieinput.png b/languages/cpp/app_templates/opieinput/opieinput.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opieinput/opieinput.png differ diff --git a/languages/cpp/app_templates/opieinput/simpleimpl.cpp b/languages/cpp/app_templates/opieinput/simpleimpl.cpp new file mode 100644 index 00000000..6da986eb --- /dev/null +++ b/languages/cpp/app_templates/opieinput/simpleimpl.cpp @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include +#include + +#include "%{APPNAMELC}.h" + +%{APPNAME}::%{APPNAME}(QWidget* par, WFlags fl ) + : QHBox(par, "name", fl ) +{ + QCheckBox *box1 = new QCheckBox(tr("Alt"),this); + connect(box1,SIGNAL(toggled(bool)), + this,SLOT(slotAlt(bool))); + m_alt = box1; + box1 = new QCheckBox(tr("Shift"),this ); + connect(box1,SIGNAL(toggled(bool)), + this,SLOT(slotShift(bool))); + m_shi = box1; + box1 = new QCheckBox(tr("Ctrl","Control Shortcut on keyboard"),this ); + connect(box1,SIGNAL(toggled(bool)), + this,SLOT(slotCtrl(bool))); + m_ctrl = box1; + + QSignalMapper *map = new QSignalMapper(this); + QPushButton *btn = new QPushButton("a",this); + map->setMapping(btn,0); + connect(btn,SIGNAL(clicked()),map,SLOT(map())); + + btn = new QPushButton("b",this); + map->setMapping(btn,1); + connect(btn,SIGNAL(clicked()),map,SLOT(map())); + + btn = new QPushButton("c",this); + map->setMapping(btn,2); + connect(btn,SIGNAL(clicked()),map,SLOT(map())); + + connect(map,SIGNAL(mapped(int)), + this,SLOT(slotKey(int))); + resetState(); +} + +%{APPNAME}::~%{APPNAME}(){ +} + +void %{APPNAME}::resetState(){ + m_state = 0; + m_shi->setChecked(false); + m_ctrl->setChecked(false); + m_alt->setChecked(false); +} + +void %{APPNAME}::slotKey(int _ke){ + int ke = _ke + 0x61; // 0 + 65 = 0x41 == A + if(m_state & ShiftButton ) + ke -= 0x20; + + /* + * Send the key + * ke is the unicode + * _ke + 0x41 is the keycode + * m_state Normally the state + * down/up + * auto repeat + */ + emit key(ke, _ke +0x41,m_state,true,false); + emit key(ke, _ke + 0x41,m_state,false,false); +} + +void %{APPNAME}::slotShift(bool b){ + if(b) + m_state |= ShiftButton; + else + m_state &= ~ShiftButton; +} + +void %{APPNAME}::slotAlt(bool b){ + if(b) + m_state |= AltButton; + else + m_state &= ~AltButton; +} + +void %{APPNAME}::slotCtrl(bool b){ + if(b) + m_state |= ControlButton; + else + m_state &= ~ControlButton; +} + + + +%{APPNAME}Impl::%{APPNAME}Impl() + : m_pickboard(0), m_icn(0) +{ +} + +%{APPNAME}Impl::~%{APPNAME}Impl() +{ + delete m_pickboard; + delete m_icn; +} + +QWidget *%{APPNAME}Impl::inputMethod( QWidget *parent, Qt::WFlags f ) +{ + if ( !m_pickboard ) + m_pickboard = new %{APPNAME}( parent, f ); + return m_pickboard; +} + +void %{APPNAME}Impl::resetState() +{ + if ( m_pickboard ) + m_pickboard->resetState(); +} + +QPixmap *%{APPNAME}Impl::icon() +{ + if ( !m_icn ) + m_icn = new QPixmap(Resource::loadPixmap("Tux")); + return m_icn; +} + +QString %{APPNAME}Impl::name() +{ + return QObject::tr("Example Input"); +} + +void %{APPNAME}Impl::onKeyPress( QObject *receiver, const char *slot ) +{ + if ( m_pickboard ) + QObject::connect( m_pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); +} + +#ifndef QT_NO_COMPONENT +QRESULT %{APPNAME}Impl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_InputMethod ) + *iface = this; + else + return QS_FALSE; + + if ( *iface ) + (*iface)->addRef(); + return QS_OK; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( %{APPNAME}Impl ) +} +#endif + diff --git a/languages/cpp/app_templates/opieinput/simpleimpl.h b/languages/cpp/app_templates/opieinput/simpleimpl.h new file mode 100644 index 00000000..362e59b3 --- /dev/null +++ b/languages/cpp/app_templates/opieinput/simpleimpl.h @@ -0,0 +1,50 @@ +#ifndef %{APPNAME}IMPL_H +#define %{APPNAME}IMPL_H + +#include + +#include + +class QPixmap; +class QCheckBox; +class %{APPNAME} : public QHBox { + Q_OBJECT +public: + %{APPNAME}( QWidget *par, WFlags f ); + ~%{APPNAME}(); + void resetState(); +private slots: + void slotKey(int); + void slotShift(bool); + void slotAlt(bool); + void slotCtrl(bool); +signals: + void key(ushort,ushort,ushort,bool,bool); +private: + int m_state; + QCheckBox *m_alt,*m_shi,*m_ctrl; +}; + +class %{APPNAME}Impl : public InputMethodInterface +{ +public: + %{APPNAME}Impl(); + virtual ~%{APPNAME}Impl(); + +#ifndef QT_NO_COMPONENT + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + Q_REFCOUNT +#endif + + virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); + virtual void resetState(); + virtual QPixmap *icon(); + virtual QString name(); + virtual void onKeyPress( QObject *receiver, const char *slot ); + +private: + %{APPNAME} *m_pickboard; + QPixmap *m_icn; +}; + +#endif diff --git a/languages/cpp/app_templates/opiemenu/.kdev_ignore b/languages/cpp/app_templates/opiemenu/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opiemenu/Example.png b/languages/cpp/app_templates/opiemenu/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opiemenu/Example.png differ diff --git a/languages/cpp/app_templates/opiemenu/Makefile.am b/languages/cpp/app_templates/opiemenu/Makefile.am new file mode 100644 index 00000000..c44b3f96 --- /dev/null +++ b/languages/cpp/app_templates/opiemenu/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = Makefile.am Example.png app.kdevelop app.pro \ + simpleimpl.cpp simpleimpl.h + +templateName = opiemenu + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opiemenu/app.kdevelop b/languages/cpp/app_templates/opiemenu/app.kdevelop new file mode 100644 index 00000000..eee2c55a --- /dev/null +++ b/languages/cpp/app_templates/opiemenu/app.kdevelop @@ -0,0 +1,158 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + true + + + + + %{APPNAMELC} + 0 +
      opie/applets
      + %{AUTHOR} %{EMAIL} + arm + task-opie-minimal + %{VERSION} + Empty +
      + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi + + +
      + + + + + ./%{APPNAMELC} + -qws + + +
      + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
      diff --git a/languages/cpp/app_templates/opiemenu/app.pro b/languages/cpp/app_templates/opiemenu/app.pro new file mode 100644 index 00000000..71bc208c --- /dev/null +++ b/languages/cpp/app_templates/opiemenu/app.pro @@ -0,0 +1,38 @@ +TEMPLATE = lib +CONFIG = qt dll qtopia warn_on release zecke-libqpe zecke-libopie opie-menuapplet +HEADERS = %{APPNAMELC}.h +SOURCES = %{APPNAMELC}.cpp +TARGET = %{APPNAMELC} + + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +QMAKE_LIBDIR= $$(OPIEDIR)/lib +OPIE-SPEC=6 + +zecke-libqpe { + INCLUDEPATH += $$(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $$(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $$(OPIEDIR)/include + DEPENDPATH += $$(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opiemenu/opiemenu.kdevtemplate b/languages/cpp/app_templates/opiemenu/opiemenu.kdevtemplate new file mode 100644 index 00000000..b32b13ed --- /dev/null +++ b/languages/cpp/app_templates/opiemenu/opiemenu.kdevtemplate @@ -0,0 +1,132 @@ +# KDE Config File +[General] +Name=Opie Menu Applet +Name[ca]=Una miniaplicació de menú per a Opie +Name[da]=Opie menu-applet +Name[de]=Opie-Menü-Miniprogramm (Applet) +Name[el]=Μικροεφαρμογή μενού Opie +Name[es]=Applet de menú para Opie +Name[et]=Opie menüüaplett +Name[eu]=Opie-ren menu applet-a +Name[fa]=برنامک گزینگان Opie +Name[fr]=Applet de menu Opie +Name[ga]=Feidhmchláirín Roghchláir Opie +Name[gl]=Applet de menú Opie +Name[hu]=Opie-s menü-kisalkalmazás +Name[it]=Applet di menu Opie +Name[ja]=Opie メニューアプレット +Name[nds]=Menü-Lüttprogramm för Opie +Name[ne]=ओपिइ मेनु एप्लेट +Name[nl]=Opie-menuapplet +Name[pl]=Aplet menu Opie +Name[pt]='Applet' do Menu do Opie +Name[pt_BR]='Applet' do Menu do Opie +Name[ru]=Аплет меню Opie +Name[sk]=Opie menu pplet +Name[sr]=Opie аплет менија +Name[sr@Latn]=Opie aplet menija +Name[sv]=Opie-menyminiprogram +Name[tr]=Opie Menü Küçük Uygulaması +Name[zh_CN]=Opie 菜单小程序 +Name[zh_TW]=Opie 選單小程式 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie menu applet. +Comment[ca]=Genera una miniaplicació de menú per a Opie. +Comment[da]=Generér en Opie menu-applet. +Comment[de]=Erstellt ein Opie-Menü-Miniprogramm (Applet). +Comment[el]=Δημιουργία μίας μικροεφαρμογής μενού Opie. +Comment[es]=Genera un applet de menú para Opie. +Comment[et]=Opie menüüapleti loomine. +Comment[eu]=Sortu Opie-ren menu applet bat. +Comment[fa]=یک برنامک گزینگان Opie تولید می‌کند. +Comment[fr]=Génère un applet de menu Opie. +Comment[gl]=Xera un applet de menu para Opie. +Comment[hu]=Létrehoz egy Opie-s menü-kisalkalmazást. +Comment[it]=Genera un'applet di menu Opie. +Comment[ja]=Opie メニューアプレットを作成 +Comment[nds]=Stellt en Menü-Lüttprogramm för Opie op. +Comment[ne]=ओपिइ मेनु एप्लेट उत्पन्न गर्नुहोस् +Comment[nl]=Genereert een Opie-menuapplet. +Comment[pl]=Generuje aplet menu Opie +Comment[pt]=Gera uma 'applet' do menu do Opie. +Comment[pt_BR]=Gera uma 'applet' do menu do Opie. +Comment[ru]=Создание аплета меню Opie. +Comment[sk]=Vygeneruje Opie menu applet. +Comment[sr]=Прави Opie аплет менија. +Comment[sr@Latn]=Pravi Opie aplet menija. +Comment[sv]=Skapa ett Opie-menyminiprogram. +Comment[tr]=Bir Opie menü küçük uygulaması yarat +Comment[zh_CN]=生成一个 Opie 菜单小程序。 +Comment[zh_TW]=產生一個 Opie 選單小程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opiemenu.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/simpleimpl.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/simpleimpl.h +Dest=%{dest}/%{APPNAMELC}.h + +[MSG] +Type=message +Comment=An opie menu applet was created in %{dest} +Comment[ca]=Una miniaplicació de menú per a Opie ha estat creat en %{dest} +Comment[da]=En opie menu-applet blev oprettet i %{dest} +Comment[de]=Ein Opie-Menü-Miniprogramm (Applet) wurde in %{dest} erstellt. +Comment[el]=Μία μικροεφαρμογή μενού opie δημιουργήθηκε στο %{dest} +Comment[es]=Un applet de menú para Opie ha sido creado en %{dest} +Comment[et]=Opie menüüaplett loodi asukohta %{dest} +Comment[eu]= Opie-ren menu applet bat sortu da hemen: %{dest} +Comment[fa]=یک برنامک گزینگان opie در %{dest} ایجاد شد +Comment[fr]=Un applet de menu Opie a été créé dans %{dest} +Comment[ga]=Cruthaíodh feidhmchláirín roghchláir opie i %{dest} +Comment[gl]=Creouse un applet de menu para opie en %{dest} +Comment[hu]=Létrejött egy Opie-s menü-kisalkalmazás itt: %{dest} +Comment[it]=È stata creata un'applet di menu Opie in %{dest} +Comment[ja]=Opie メニューアプレットを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Menü-Lüttprogramm för Opie opstellt +Comment[ne]=ओपिइ मेनु एप्लेट %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie-menuapplet is aangemaakt in %{dest} +Comment[pl]=Aplet menu Opie został utworzony w %{dest} +Comment[pt]=Foi criada uma 'applet' do menu do Opie em %{dest} +Comment[pt_BR]=Foi criada uma 'applet' do menu do Opie em %{dest} +Comment[ru]=Аплет меню Opie создан в %{dest} +Comment[sk]=Opie menu applet bol vytvorený v %{dest} +Comment[sr]=Opie аплет менија направљен је у %{dest} +Comment[sr@Latn]=Opie aplet menija napravljen je u %{dest} +Comment[sv]=Ett Opie-menyprogram skapades i %{dest} +Comment[tr]=Bir opie menü küçük uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 菜单小程序 +Comment[zh_TW]=一個 Opie 選單小程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/opiemenu/opiemenu.png b/languages/cpp/app_templates/opiemenu/opiemenu.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opiemenu/opiemenu.png differ diff --git a/languages/cpp/app_templates/opiemenu/simpleimpl.cpp b/languages/cpp/app_templates/opiemenu/simpleimpl.cpp new file mode 100644 index 00000000..95245661 --- /dev/null +++ b/languages/cpp/app_templates/opiemenu/simpleimpl.cpp @@ -0,0 +1,78 @@ +#include "%{APPNAMELC}.h" + +#include +#include + +/* QT */ +#include +#include +#include + + +%{APPNAME}::%{APPNAME}() + :QObject( 0, "%{APPNAME}" ) +{ +} + +%{APPNAME}::~%{APPNAME} ( ) +{} + +int %{APPNAME}::position() const +{ + return 3; +} + +QString %{APPNAME}::name() const +{ + return tr( "MenuApplet Example Name" ); +} + +QString %{APPNAME}::text() const +{ + return tr( "Click the white rabbit" ); +} + + +QIconSet %{APPNAME}::icon() const +{ + QPixmap pix; + QImage img = Resource::loadImage( "Tux" ); + if ( !img.isNull() ) + pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + return pix; +} + +QPopupMenu* %{APPNAME}::popup(QWidget*) const +{ + /* no subdir */ + return 0; +} + +void %{APPNAME}::activated() +{ + QMessageBox::information(0,tr("No white rabbit found"), + tr("No white rabbit was seen near Opie." + "Only the beautiful OpieZilla is available" + "for your pleassure")); +} + + +QRESULT %{APPNAME}::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_MenuApplet ) + *iface = this; + else + return QS_FALSE; + + if ( *iface ) + (*iface)->addRef(); + return QS_OK; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( %{APPNAME} ) +} diff --git a/languages/cpp/app_templates/opiemenu/simpleimpl.h b/languages/cpp/app_templates/opiemenu/simpleimpl.h new file mode 100644 index 00000000..3961e3c4 --- /dev/null +++ b/languages/cpp/app_templates/opiemenu/simpleimpl.h @@ -0,0 +1,32 @@ +#ifndef %{APPNAME}_MENU_APPLET_H +#define %{APPNAME}_MENU_APPLET_H + +#include + +#include + +class %{APPNAME} : public QObject, public MenuAppletInterface +{ + + Q_OBJECT + +public: + %{APPNAME} ( ); + virtual ~%{APPNAME} ( ); + + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + Q_REFCOUNT + + virtual int position() const; + + virtual QString name ( ) const; + virtual QIconSet icon ( ) const; + virtual QString text ( ) const; + /* virtual QString tr( const char* ) const; + virtual QString tr( const char*, const char* ) const; + */ + virtual QPopupMenu *popup ( QWidget *parent ) const; + virtual void activated ( ); +}; + +#endif diff --git a/languages/cpp/app_templates/opienet/.kdev_ignore b/languages/cpp/app_templates/opienet/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opienet/Example.png b/languages/cpp/app_templates/opienet/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opienet/Example.png differ diff --git a/languages/cpp/app_templates/opienet/Makefile.am b/languages/cpp/app_templates/opienet/Makefile.am new file mode 100644 index 00000000..47dc4231 --- /dev/null +++ b/languages/cpp/app_templates/opienet/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = Makefile.am Example.png app.kdevelop app.pro \ + simpleiface.cpp simpleiface.h simplemodule.h \ + simplemodule.cpp + +templateName = opienet + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opienet/app.kdevelop b/languages/cpp/app_templates/opienet/app.kdevelop new file mode 100644 index 00000000..660b7bee --- /dev/null +++ b/languages/cpp/app_templates/opienet/app.kdevelop @@ -0,0 +1,143 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + false + + + + plugins/networksettings + + %{APPNAMELC} + 0 +
      opie/settings
      + %{AUTHOR} %{EMAIL} + arm + opie-networksettings + %{VERSION} + Empty +
      +
      + + + + + qpe + -qws + + +
      + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
      diff --git a/languages/cpp/app_templates/opienet/app.pro b/languages/cpp/app_templates/opienet/app.pro new file mode 100644 index 00000000..53fb6eea --- /dev/null +++ b/languages/cpp/app_templates/opienet/app.pro @@ -0,0 +1,39 @@ +TEMPLATE = lib +CONFIG = qt dll qtopia warn_on release zecke-libqpe zecke-libopie opie-network +HEADERS = %{APPNAMELC}module.h %{APPNAMELC}iface.h +SOURCES = %{APPNAMELC}module.cpp %{APPNAMELC}iface.cpp +TARGET = %{APPNAMELC} +LIBS += -linterfaces + + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +QMAKE_LIBDIR= $$(OPIEDIR)/lib +OPIE-SPEC=6 + +zecke-libqpe { + INCLUDEPATH += $$(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $$(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $$(OPIEDIR)/include + DEPENDPATH += $$(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opienet/opienet.kdevtemplate b/languages/cpp/app_templates/opienet/opienet.kdevtemplate new file mode 100644 index 00000000..4ab9ebbe --- /dev/null +++ b/languages/cpp/app_templates/opienet/opienet.kdevtemplate @@ -0,0 +1,142 @@ +# KDE Config File +[General] +Name=Opie Networksettings +Name[br]=Kefluniadur rouedad Opie +Name[ca]=Connector de preferències de xarxa per a Opie +Name[da]=Opie netværksopsætning +Name[de]=Opie-Netzwerkeinstellungen +Name[el]=Ρυθμίσεις δικτύου Opie +Name[es]=Preferencias de red para Opie +Name[et]=Opie võrguseadustused +Name[eu]=Opie-ren sare-ezarpenak +Name[fa]=تنظیمات شبکۀ Opie +Name[fr]=Paramètres réseau pour Opie +Name[ga]=Socruithe Líonra Opie +Name[hu]=Opie-s hálózati beállítómodul +Name[it]=Impostazioni di rete di Opie +Name[ja]=Opie ネットワーク設定 +Name[nds]=Opie-Nettwarkinstellen +Name[ne]=ओपिइ सञ्जाल सेटिङ +Name[nl]=Opie-netwerkinstellingen +Name[pl]=Ustawienia sieciowe Opie +Name[pt]=Configuração de rede do Opie +Name[pt_BR]=Configuração de rede do Opie +Name[ru]=Параметры сети Opie +Name[sk]=Opie sieťové nastavenia +Name[sr]=Opie мрежна подешавања +Name[sr@Latn]=Opie mrežna podešavanja +Name[sv]=Opie nätverksinställningar +Name[tr]=Opie Ağ Ayarları +Name[zh_CN]=Opie 网络设置 +Name[zh_TW]=Opie 網路設定 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie network config plugin. +Comment[ca]=Genera un connector de preferències de xarxa per a Opie. +Comment[da]=Generér en Opie netværks-config-plugin. +Comment[de]=Erstellt ein Modul für Opie-Netzwerkeinstellungen. +Comment[el]=Δημιουργία ενός πρόσθετου ρύθμισης δικτύου Opie. +Comment[es]=Genera un complemento de configuración de red para Opie. +Comment[et]=Opie võrguseadistuste plugina loomine. +Comment[eu]=Sortu Opie-ren sare-ezarpenetarako plugin bat. +Comment[fa]=یک وصلۀ پیکربندی شبکۀ Opie تولید می‌کند. +Comment[fr]=Génère un module externe de configuration réseau pour Opie. +Comment[ga]=Cruthaigh breiseán cumraíochta líonra Opie. +Comment[gl]=Xera unha extensión de configuración da rede para Opie. +Comment[hu]=Létrehoz egy Opie-s hálózati beállítómodult. +Comment[it]=Genera un plugin di configurazione di rete Opie. +Comment[ja]=Opie ネットワーク設定プラグインを作成 +Comment[nds]=Stellt en Moduul för Opie-Nettwarkinstellen op. +Comment[ne]=ओपिइ सञ्जाल कन्फिग प्लगइन उत्पन्न गर्नुहोस् +Comment[nl]=Genereert een Opie netwerkconfiguratieplugin. +Comment[pl]=Generuje wtyczkę do ustawień sieciowych Opie +Comment[pt]=Gera um 'plugin' de configuração da rede do Opie. +Comment[pt_BR]=Gera um 'plugin' de configuração da rede do Opie. +Comment[ru]=Создание модуля настройки сети Opie. +Comment[sk]=Vygeneruje Opie modul pre sieťovú konfiguráciu. +Comment[sr]=Прави прикључак за Opie мрежна подешавања. +Comment[sr@Latn]=Pravi priključak za Opie mrežna podešavanja. +Comment[sv]=Skapa ett Opie-insticksprogram för nätverksinställning. +Comment[tr]=Opie ağ ayar eklentisi yarat. +Comment[zh_CN]=生成一个 Opie 网络配置插件。 +Comment[zh_TW]=產生一個 Opie 網路設定外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opienet.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/simplemodule.cpp +Dest=%{dest}/%{APPNAMELC}module.cpp + +[FILE5] +Type=install +Source=%{src}/simpleiface.cpp +Dest=%{dest}/%{APPNAMELC}iface.cpp + +[FILE6] +Type=install +Source=%{src}/simplemodule.h +Dest=%{dest}/%{APPNAMELC}module.h + +[FILE7] +Type=install +Source=%{src}/simpleiface.h +Dest=%{dest}/%{APPNAMELC}iface.h + +[MSG] +Type=message +Comment=An opie network settings plugin was created in %{dest} +Comment[ca]=Un connector de preferències de xarxa per a Opie ha estat creat en %{dest} +Comment[da]=En opie netværksopsætning-plugin blev oprettet i %{dest} +Comment[de]=Ein Modul für Opie-Netzwerkeinstellungen wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο ρύθμισης δικτύου του opie δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento de preferencias de red para Opie ha sido creado en %{dest} +Comment[et]=Opie võrguseadistuste plugin loodi asukohta %{dest} +Comment[eu]=Opie-ren sare-ezarpenetarako plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ تنظیمات شبکۀ opie در %{dest} ایجاد شد +Comment[fr]=Un module externe de configuration réseau pour Opie a été créé dans %{dest} +Comment[gl]=Creouse unha extensión de configuración da rede para opie en %{dest} +Comment[hu]=Létrejött egy Opie-s hálózati beállítómodul itt: %{dest} +Comment[it]=È stato creato un plugin per le impostazioni di rete di Opie in %{dest} +Comment[ja]=Opie ネットワーク設定プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Nettwarkinstellenmoduul för Opie opstellt +Comment[ne]=ओपिइ सञ्जाल सेटिङ प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie netwerkconfiguratieplugin is aangemaakt in %{dest} +Comment[pl]=Wtyczka ustawień sieciowych Opie została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' de configuração da rede do Opie em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' de configuração da rede do Opie em %{dest} +Comment[ru]=Модуль настройки сети Opie создан в %{dest} +Comment[sk]=Opie module pre sieťové nastavenia bol vytvorený v %{dest} +Comment[sr]=Прикључак за Opie мрежна подешавања направљен је у %{dest} +Comment[sr@Latn]=Priključak za Opie mrežna podešavanja napravljen je u %{dest} +Comment[sv]=Ett Opie-insticksprogram för nätverksinställning skapades i %{dest} +Comment[tr]=Bir opie ağ ayar eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 网络设置插件 +Comment[zh_TW]=一個 Opie 網路設定外掛程式已建立於 %{dest} + diff --git a/languages/cpp/app_templates/opienet/opienet.png b/languages/cpp/app_templates/opienet/opienet.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opienet/opienet.png differ diff --git a/languages/cpp/app_templates/opienet/simmplemodule.h b/languages/cpp/app_templates/opienet/simmplemodule.h new file mode 100644 index 00000000..9158a7c8 --- /dev/null +++ b/languages/cpp/app_templates/opienet/simmplemodule.h @@ -0,0 +1,36 @@ +#ifndef %{APPNAME}_NETWORK_MODULE_H +#define %{APPNAME}_NETWORK_MODULE_H + +#include + +class VirtualModule : Module { + +signals: + void updateInterface(Interface* i ); + +public: + VirtualModule(); + ~VirtualModule(); + + const QString type() {return QString::fromLatin1("vpn" );} + void setProfile( const QString& ) {} + bool isOwner( Interface* ); + QWidget *configure( Interface* ); + QWidget *information( Interface* ); + QList getInterfaces(); + void possibleNewInterfaces( QMap& ); + Interface *addNewInterface( const QString& ); + bool remove( Interface* iface ); + QString getPixmapName( Interface* ) {return QString::fromLatin1("Tux"); } + void receive( const QCString&, const QByteArray& ar ) {} // don't listen +private: + QList m_interfaces; +}; + +extern "C" { + void* create_plugin() { + return new VirtualModule(); + } +}; + +#endif diff --git a/languages/cpp/app_templates/opienet/simpleiface.cpp b/languages/cpp/app_templates/opienet/simpleiface.cpp new file mode 100644 index 00000000..9182a2f9 --- /dev/null +++ b/languages/cpp/app_templates/opienet/simpleiface.cpp @@ -0,0 +1,43 @@ +#include "%{APPNAMELC}iface.h" + +%{APPNAME}Interface::%{APPNAME}Interface( QObject* parent, + const char* name, + bool status ) + : Interface(parent, name, status ) +{ +} + +%{APPNAME}Interface::~%{APPNAME}Interface() { +} + +bool %{APPNAME}Interface::refresh() { +/* we do VPN over ppp + * so replace the interfaceName with + * something actual existing + * I take wlan0 in my case + */ + QString old = getInterfaceName(); + qWarning("Interface name was " + old ); + setInterfaceName( "wlan0" ); + + bool b =Interface::refresh(); + setInterfaceName( old ); + +/* new and old interface name */ + emit updateInterface(this); + return b; +} + + +void %{APPNAME}Interface::start() { +// call pptp + setStatus(true); + refresh(); + emit updateMessage("VPN started"); +} + +void %{APPNAME}Interface::stop() { + setStatus(false ); + refresh(); + emit updateMessage("VPN halted"); +} diff --git a/languages/cpp/app_templates/opienet/simpleiface.h b/languages/cpp/app_templates/opienet/simpleiface.h new file mode 100644 index 00000000..f235c160 --- /dev/null +++ b/languages/cpp/app_templates/opienet/simpleiface.h @@ -0,0 +1,22 @@ +#ifndef EXAMPLE_IFACE_VPN_H +#define EXAMPLE_IFACE_VPN_H + +#include + +class %{APPNAME}Interface : public Interface { + Q_OBJECT + +public: + %{APPNAME}Interface(QObject* parent, const char* name = "vpn", bool up = false ); + ~%{APPNAME}Interface(); + +public slots: + bool refresh(); // refresh information + void start(); + void stop(); + +private: + bool m_isUp : 1; +}; + +#endif diff --git a/languages/cpp/app_templates/opienet/simplemodule.cpp b/languages/cpp/app_templates/opienet/simplemodule.cpp new file mode 100644 index 00000000..a67974a8 --- /dev/null +++ b/languages/cpp/app_templates/opienet/simplemodule.cpp @@ -0,0 +1,71 @@ +#include + +#include + +#include "%{APPNAMELC}iface.h" +#include "%{APPNAMELC}module.h" + +%{APPNAME}Module::%{APPNAME}Module() { + Interface* iface = new %{APPNAME}Interface( 0 ); + iface->setHardwareName( "vpn" ); + iface->setInterfaceName( "Test VPN" ); + m_interfaces.append( iface ); + +// If we set up VPN via pptp +// and networksettins was closed and now opened +// we need to hide the ppp device behind us +// One can do this by calling setHandledInterfaceNames +// setHandledInterfaceNames(); +} + +%{APPNAME}Module::~%{APPNAME}Module() { + m_interfaces.setAutoDelete( true ); + m_interfaces.clear(); +} + + +/* + * We're a VPN module + */ +bool %{APPNAME}Module::isOwner( Interface* iface ) { + /* check if it is our device */ + return m_interfaces.find( iface ) != -1; +} + +QWidget* %{APPNAME}Module::configure( Interface* ) { +/* We don't have any Config for now */ + return 0l; +} + +QWidget* %{APPNAME}Module::information( Interface* iface ) { + return new InterfaceInformationImp(0, "Interface info", iface ); +} + +QList %{APPNAME}Module::getInterfaces() { + return m_interfaces; +} + +void %{APPNAME}Module::possibleNewInterfaces( QMap& map) { + map.insert( QObject::tr("VPN PPTP"), + QObject::tr("Add new Point to Point Tunnel Protocol connection" ) ); +} + + +Interface* %{APPNAME}Module::addNewInterface( const QString& ) { + /* check the str if we support more interfaces */ +/* + Interface* iface = new %{APPNAME}Interface( 0 ); + iface->setModuleOwner( this ); + return iface;*/ + +// if we would support saving interfaces we could add +// them here + + return 0; +} + + +bool %{APPNAME}Module::remove( Interface* ) { +/* we do not support removing our interface */ + return false; +} diff --git a/languages/cpp/app_templates/opienet/simplemodule.h b/languages/cpp/app_templates/opienet/simplemodule.h new file mode 100644 index 00000000..1b02b688 --- /dev/null +++ b/languages/cpp/app_templates/opienet/simplemodule.h @@ -0,0 +1,36 @@ +#ifndef %{APPNAME}_NETWORK_MODULE_H +#define %{APPNAME}_NETWORK_MODULE_H + +#include + +class %{APPNAME}Module : Module { + +signals: + void updateInterface(Interface* i ); + +public: + %{APPNAME}Module(); + ~%{APPNAME}Module(); + + const QString type() {return QString::fromLatin1("vpn" );} + void setProfile( const QString& ) {} + bool isOwner( Interface* ); + QWidget *configure( Interface* ); + QWidget *information( Interface* ); + QList getInterfaces(); + void possibleNewInterfaces( QMap& ); + Interface *addNewInterface( const QString& ); + bool remove( Interface* iface ); + QString getPixmapName( Interface* ) {return QString::fromLatin1("Tux"); } + void receive( const QCString&, const QByteArray& ar ) {} // don't listen +private: + QList m_interfaces; +}; + +extern "C" { + void* create_plugin() { + return new %{APPNAME}Module(); + } +}; + +#endif diff --git a/languages/cpp/app_templates/opietoday/.kdev_ignore b/languages/cpp/app_templates/opietoday/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opietoday/Example.png b/languages/cpp/app_templates/opietoday/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opietoday/Example.png differ diff --git a/languages/cpp/app_templates/opietoday/Makefile.am b/languages/cpp/app_templates/opietoday/Makefile.am new file mode 100644 index 00000000..8854404d --- /dev/null +++ b/languages/cpp/app_templates/opietoday/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = Makefile.am Example.png app.kdevelop app.pro exampleplugin.cpp \ + examplepluginimpl.cpp examplepluginwidget.cpp exampleplugin.h \ + examplepluginimpl.h examplepluginwidget.h + +templateName = opietoday + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opietoday/app.kdevelop b/languages/cpp/app_templates/opietoday/app.kdevelop new file mode 100644 index 00000000..f6e57207 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/app.kdevelop @@ -0,0 +1,143 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + false + + + + plugins/today + + %{APPNAMELC} + 0 +
      opie/plugins
      + %{AUTHOR} %{EMAIL} + arm + opie-today + %{VERSION} + Empty +
      +
      + + + + + + -qws + + +
      + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
      diff --git a/languages/cpp/app_templates/opietoday/app.pro b/languages/cpp/app_templates/opietoday/app.pro new file mode 100644 index 00000000..152dc6f6 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/app.pro @@ -0,0 +1,38 @@ +TEMPLATE = lib +CONFIG = qt dll qtopia warn_on release zecke-libqpe zecke-libopie opie-todayplugin +HEADERS = %{APPNAMELC}.h %{APPNAMELC}widget.h %{APPNAMELC}impl.h +SOURCES = %{APPNAMELC}.cpp %{APPNAMELC}widget.cpp %{APPNAMELC}impl.cpp +TARGET = %{APPNAMELC} + + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +QMAKE_LIBDIR= $$(OPIEDIR)/lib +OPIE-SPEC=6 + +zecke-libqpe { + INCLUDEPATH += $$(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $$(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $$(OPIEDIR)/include + DEPENDPATH += $$(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opietoday/exampleplugin.cpp b/languages/cpp/app_templates/opietoday/exampleplugin.cpp new file mode 100644 index 00000000..3d32b274 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/exampleplugin.cpp @@ -0,0 +1,60 @@ + +#include "%{APPNAMELC}.h" + +%{APPNAME}::%{APPNAME}() { + m_widget = 0l; +} + +%{APPNAME}::~%{APPNAME}() { + delete (%{APPNAME}Widget*)m_widget; +} + +QString %{APPNAME}::pluginName() const { + return QObject::tr( "%{APPNAME}" ); +} + +double %{APPNAME}::versionNumber() const { + return 0.1; +} + +// this sets the image that will be shown on the left side of the plugin +QString %{APPNAME}::pixmapNameWidget() const { + return QString::fromLatin1("%{APPNAMELC}/%{APPNAMELC}"); +} + +QWidget* %{APPNAME}::widget( QWidget * wid ) { + if(!m_widget) { + m_widget = new %{APPNAME}Widget( wid, "%{APPNAME}" ); + } + return m_widget; +} + + +// that would be the icon of the config widget in todays config view +QString %{APPNAME}::pixmapNameConfig() const { + return 0l; +} + +// No config widget yet, look at the datebook plugin for an example of that +TodayConfigWidget* %{APPNAME}::configWidget( QWidget* /*parent*/ ) { + return 0l; +} + +// add the binary name of the app to launch here +QString %{APPNAME}::appName() const { + return QString::null; +} + +// if the plugin should be excluded form the refresh cycles that can be set in the today app +bool %{APPNAME}::excludeFromRefresh() const { + return false; +} + +void %{APPNAME}::refresh() { + if ( m_widget ) { + m_widget->refresh(); + } +} + +void %{APPNAME}::reinitialize() { +} diff --git a/languages/cpp/app_templates/opietoday/exampleplugin.h b/languages/cpp/app_templates/opietoday/exampleplugin.h new file mode 100644 index 00000000..b321f434 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/exampleplugin.h @@ -0,0 +1,34 @@ +#ifndef %{APPNAME}_PLUGIN_H +#define %{APPNAME}_PLUGIN_H + +#include +#include + +#include +#include + +#include "%{APPNAMELC}widget.h" + +// implementation of the today plugin interface +class %{APPNAME} : public TodayPluginObject { + +public: + %{APPNAME}(); + ~%{APPNAME}(); + + QString pluginName() const; + double versionNumber() const; + QString pixmapNameWidget() const; + QWidget* widget(QWidget *); + QString pixmapNameConfig() const; + TodayConfigWidget* configWidget(QWidget *); + QString appName() const; + bool excludeFromRefresh() const; + void refresh(); + void reinitialize(); + + private: + QGuardedPtr<%{APPNAME}Widget> m_widget; +}; + +#endif diff --git a/languages/cpp/app_templates/opietoday/examplepluginimpl.cpp b/languages/cpp/app_templates/opietoday/examplepluginimpl.cpp new file mode 100644 index 00000000..3a9481f1 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/examplepluginimpl.cpp @@ -0,0 +1,30 @@ +#include "%{APPNAMELC}.h" +#include "%{APPNAMELC}impl.h" + +%{APPNAME}Impl::%{APPNAME}Impl() { + examplePlugin = new %{APPNAME}(); +} + +%{APPNAME}Impl::~%{APPNAME}Impl() { + delete examplePlugin; +} + + +TodayPluginObject* %{APPNAME}Impl::guiPart() { + return examplePlugin; +} + +QRESULT %{APPNAME}Impl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + }else + return QS_FALSE; + + return QS_OK; + +} + +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( %{APPNAME}Impl ); +} diff --git a/languages/cpp/app_templates/opietoday/examplepluginimpl.h b/languages/cpp/app_templates/opietoday/examplepluginimpl.h new file mode 100644 index 00000000..ccb7c3b3 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/examplepluginimpl.h @@ -0,0 +1,23 @@ +#ifndef %{APPNAME}_PLUGIN_IMPL_H +#define %{APPNAME}_PLUGIN_IMPL_H + +#include + +class %{APPNAME}; + +class %{APPNAME}Impl : public TodayPluginInterface{ + +public: + %{APPNAME}Impl(); + virtual ~%{APPNAME}Impl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + Q_REFCOUNT + + virtual TodayPluginObject *guiPart(); + +private: + %{APPNAME} *examplePlugin; +}; + +#endif diff --git a/languages/cpp/app_templates/opietoday/examplepluginwidget.cpp b/languages/cpp/app_templates/opietoday/examplepluginwidget.cpp new file mode 100644 index 00000000..b0cb0dcc --- /dev/null +++ b/languages/cpp/app_templates/opietoday/examplepluginwidget.cpp @@ -0,0 +1,55 @@ +#include +#include + +#include "%{APPNAMELC}widget.h" + +%{APPNAME}Widget::%{APPNAME}Widget( QWidget *parent, const char* name) + : QWidget(parent, name ) { + + m_exampleLabel = 0l; + m_layout = 0l; + + if ( m_exampleLabel ) { + delete m_exampleLabel; + } + + // since here a OClickableLabel is used, the plugin part will be clickable, and the actions + // that should be triggered when clicked are defined in slotClicked() + // of course also normal widgets can be used. + m_exampleLabel = new OClickableLabel( this ); + connect( m_exampleLabel, SIGNAL( clicked() ), this, SLOT( slotClicked() ) ); + + if ( m_layout ) { + delete m_layout; + } + m_layout = new QHBoxLayout( this ); + m_layout->setAutoAdd( true ); + + readConfig(); + getInfo(); +} + + +%{APPNAME}Widget::~%{APPNAME}Widget() { + delete m_exampleLabel; + delete m_layout; +} + + +void %{APPNAME}Widget::readConfig() { +// we dont have any config entries in this plugin +// normally this method is used after today config was used +} + + +void %{APPNAME}Widget::refresh() { + +} + +void %{APPNAME}Widget::getInfo() { + m_exampleLabel->setText( tr("%{APPNAME} text") ); +} + +void %{APPNAME}Widget::slotClicked() { + getInfo(); +} diff --git a/languages/cpp/app_templates/opietoday/examplepluginwidget.h b/languages/cpp/app_templates/opietoday/examplepluginwidget.h new file mode 100644 index 00000000..26a72128 --- /dev/null +++ b/languages/cpp/app_templates/opietoday/examplepluginwidget.h @@ -0,0 +1,28 @@ +#ifndef %{APPNAME}_PLUGIN_WIDGET_H +#define %{APPNAME}_PLUGIN_WIDGET_H + +#include + +#include + +class %{APPNAME}Widget : public QWidget { + + Q_OBJECT + +public: + %{APPNAME}Widget( QWidget *parent, const char *name ); + ~%{APPNAME}Widget(); + + void refresh(); + +private slots: + void slotClicked(); + +private: + OClickableLabel* m_exampleLabel; + QHBoxLayout* m_layout; + void readConfig(); + void getInfo(); +}; + +#endif diff --git a/languages/cpp/app_templates/opietoday/opietoday.kdevtemplate b/languages/cpp/app_templates/opietoday/opietoday.kdevtemplate new file mode 100644 index 00000000..25d8f42d --- /dev/null +++ b/languages/cpp/app_templates/opietoday/opietoday.kdevtemplate @@ -0,0 +1,151 @@ +# KDE Config File +[General] +Name=Opie Today Plugin +Name[ca]=Connector de tasques pendents per a Opie +Name[da]=Opie Today-plugin +Name[de]=Opie-Today-Modul +Name[el]=Πρόσθετο Σήμερα του Opie +Name[es]=Complemento de tareas pendientes para Opie +Name[et]=Opie Today plugin +Name[eu]=Opie-ren gaur-plugina +Name[fa]=وصلۀ Opie Today +Name[fr]=Module externe Opie « Today » +Name[ga]=Breiseán Inniu Opie +Name[gl]=Extensión 'today' para Opie +Name[hu]=Opie Today-modul +Name[it]=Plugin today di Opie +Name[ja]=Opie Today プラグイン +Name[nds]=Moduul för Opie-Today +Name[ne]=ओपिइ टुडे प्लगइन +Name[nl]=Opie Today-plugin +Name[pl]=Wtyczka Opie Dzisiaj +Name[pt]='Plugin' de Dados de Hoje do Opie +Name[pt_BR]='Plugin' de Dados de Hoje do Opie +Name[ru]=Модуль задач Opie +Name[sk]=Opie dnešný modul +Name[sr]=Прикључак за Opie данас +Name[sr@Latn]=Priključak za Opie danas +Name[sv]=Opie Idag-insticksprogram +Name[tr]=Opie Bugün Eklentisi +Name[zh_CN]=Opie 今日插件 +Name[zh_TW]=Opie 今天外掛程式 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie today plugin. +Comment[ca]=Genera un connector de tasques pendents per a Opie. +Comment[da]=Generér et Opie today-plugin. +Comment[de]=Erstellt ein Opie-Today-Modul +Comment[el]=Δημιουργία ενός πρόσθετου Σήμερα του Opie. +Comment[es]=Genera un complemento de tareas pendientes para Opie. +Comment[et]=Opie Today plugina loomine. +Comment[eu]=Sortu Opie-ren gaur plugin bat. +Comment[fa]=یک وصلۀ Opie today تولید می‌کند. +Comment[fr]=Génère un module externe Opie « Today ». +Comment[gl]=Xera unha extensión 'today' para Opie +Comment[hu]=Létrehoz egy Opie Today-modult. +Comment[it]=Genera un plugin today di Opie. +Comment[ja]=Opie today プラグインを作成 +Comment[nds]=Stellt en Moduul för Opie-Today op. +Comment[ne]=ओपिइ टुडे प्लगइन उत्पन्न गर्नुहोस् +Comment[nl]=Genereert een Opie today-plugin. +Comment[pl]=Generuje wtyczkę Opie "Dzisiaj". +Comment[pt]=Gera um 'plugin' para dados de hoje do Opie. +Comment[pt_BR]=Gera um 'plugin' para dados de hoje do Opie. +Comment[ru]=Создание модуля задач Opie. +Comment[sk]=Vygeneruje Opie dnešný modul. +Comment[sr]=Прави прикључак за Opie данас. +Comment[sr@Latn]=Pravi priključak za Opie danas. +Comment[sv]=Skapar ett Opie Idag-insticksprogram. +Comment[tr]=Bir Opie bugün eklentisi yarat +Comment[zh_CN]=生成一个 Opie 今日插件。 +Comment[zh_TW]=產生一個 Opie 今天外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opietoday.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/exampleplugin.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/examplepluginwidget.cpp +Dest=%{dest}/%{APPNAMELC}widget.cpp + +[FILE6] +Type=install +Source=%{src}/examplepluginimpl.cpp +Dest=%{dest}/%{APPNAMELC}impl.cpp + +[FILE7] +Type=install +Source=%{src}/exampleplugin.h +Dest=%{dest}/%{APPNAMELC}.h + +[FILE8] +Type=install +Source=%{src}/examplepluginwidget.h +Dest=%{dest}/%{APPNAMELC}widget.h + +[FILE9] +Type=install +Source=%{src}/examplepluginimpl.h +Dest=%{dest}/%{APPNAMELC}impl.h + +[MSG] +Type=message +Comment=An opie today plugin was created in %{dest} +Comment[ca]=Un connector de tasques pendents per a Opie ha estat creat en %{dest} +Comment[da]=Et opie today-plugin blev oprettet i %{dest} +Comment[de]=Ein Opie-Today-Modul wurde in %{dest} erstellt. +Comment[el]=Ένα πρόσθετο Σήμερα του opie δημιουργήθηκε στο %{dest} +Comment[es]=Un complemento de tareas pendientes para Opie ha sido creado en %{dest} +Comment[et]=Opie Today plugin loodi asukohta %{dest} +Comment[eu]=Opie-ren gaur plugin bat sortu da hemen %{dest} +Comment[fa]=یک وصلۀ opie today در %{dest} ایجاد شد +Comment[fr]=Un module externe Opie « Today » a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán inniu opie i %{dest} +Comment[gl]=Creouse unha extensión 'today' para opie en %{dest} +Comment[hu]=Létrejött egy Opie Today-modul itt: %{dest} +Comment[it]=È stato creato un plugin today di Opie in %{dest} +Comment[ja]=Opie today プラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Moduul för Opie-Today opstellt +Comment[ne]=ओपिइ टुडे प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie today-plugins is aangemaakt in %{dest} +Comment[pl]=Wtyczka Opie Dzisiaj została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' para dados de hoje do Opie em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' para dados de hoje do Opie em %{dest} +Comment[ru]=Модуль задач Opie создан в %{dest} +Comment[sk]=Opie dnešný modul bol vytvorený v %{dest} +Comment[sr]=Прикључак за opie данас направљен је у %{dest} +Comment[sr@Latn]=Priključak za opie danas napravljen je u %{dest} +Comment[sv]=Ett Opie Idag-insticksprogram skapades i %{dest} +Comment[tr]=Bir Opie bugün eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 今日插件 +Comment[zh_TW]=一個 Opie 今天外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/opietoday/opietoday.png b/languages/cpp/app_templates/opietoday/opietoday.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opietoday/opietoday.png differ diff --git a/languages/cpp/app_templates/prc-tool/.kdev_ignore b/languages/cpp/app_templates/prc-tool/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/prc-tool/Makefile.am b/languages/cpp/app_templates/prc-tool/Makefile.am new file mode 100644 index 00000000..3d4b5610 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = prc-tool.png src-Makefile prc-tool.kdevelop callback.h \ + palmhello.c palmhello.pbitm palmhello.rcp palmhelloRsc.h +templateName = prc-tool + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/prc-tool/callback.h b/languages/cpp/app_templates/prc-tool/callback.h new file mode 100644 index 00000000..bf0ead45 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/callback.h @@ -0,0 +1,24 @@ +#ifndef __CALLBACK_H__ +#define __CALLBACK_H__ + +/* This is a workaround for a bug in the current version of gcc: + + gcc assumes that no one will touch %a4 after it is set up in crt0.o. + This isn't true if a function is called as a callback by something + that wasn't compiled by gcc (like FrmCloseAllForms()). It may also + not be true if it is used as a callback by something in a different + shared library. + + We really want a function attribute "callback" which will insert this + progloue and epilogoue automatically. + + - Ian */ + +register void *reg_a4 asm("%a4"); + +#define CALLBACK_PROLOGUE \ + void *save_a4 = reg_a4; asm("move.l %%a5,%%a4; sub.l #edata,%%a4" : :); + +#define CALLBACK_EPILOGUE reg_a4 = save_a4; + +#endif diff --git a/languages/cpp/app_templates/prc-tool/palmhello.c b/languages/cpp/app_templates/prc-tool/palmhello.c new file mode 100644 index 00000000..0a34b6c4 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/palmhello.c @@ -0,0 +1,117 @@ + +/* Main code for PalmHello */ + +#include +#include +#include "callback.h" + +#include "palmhelloRsc.h" + +static Boolean MainFormHandleEvent (EventPtr e) +{ + Boolean handled = false; + FormPtr frm; + + CALLBACK_PROLOGUE + + switch (e->eType) { + case frmOpenEvent: + frm = FrmGetActiveForm(); + FrmDrawForm(frm); + handled = true; + break; + + case menuEvent: + MenuEraseStatus(NULL); + + switch(e->data.menu.itemID) { + } + + handled = true; + break; + + case ctlSelectEvent: + switch(e->data.ctlSelect.controlID) { + } + break; + + default: + break; + } + + CALLBACK_EPILOGUE + + return handled; +} + +static Boolean ApplicationHandleEvent(EventPtr e) +{ + FormPtr frm; + Word formId; + Boolean handled = false; + + if (e->eType == frmLoadEvent) { + formId = e->data.frmLoad.formID; + frm = FrmInitForm(formId); + FrmSetActiveForm(frm); + + switch(formId) { + case MainForm: + FrmSetEventHandler(frm, MainFormHandleEvent); + break; + } + handled = true; + } + + return handled; +} + +/* Get preferences, open (or create) app database */ +static Word StartApplication(void) +{ + FrmGotoForm(MainForm); + return 0; +} + +/* Save preferences, close forms, close app database */ +static void StopApplication(void) +{ + FrmSaveAllForms(); + FrmCloseAllForms(); +} + +/* The main event loop */ +static void EventLoop(void) +{ + Word err; + EventType e; + + do { + EvtGetEvent(&e, evtWaitForever); + if (! SysHandleEvent (&e)) + if (! MenuHandleEvent (NULL, &e, &err)) + if (! ApplicationHandleEvent (&e)) + FrmDispatchEvent (&e); + } while (e.eType != appStopEvent); +} + +/* Main entry point; it is unlikely you will need to change this except to + handle other launch command codes */ +DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags) +{ + Word err; + + if (cmd == sysAppLaunchCmdNormalLaunch) { + + err = StartApplication(); + if (err) return err; + + EventLoop(); + StopApplication(); + + } else { + return sysErrParamErr; + } + + return 0; +} diff --git a/languages/cpp/app_templates/prc-tool/palmhello.pbitm b/languages/cpp/app_templates/prc-tool/palmhello.pbitm new file mode 100644 index 00000000..5291d5a4 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/palmhello.pbitm @@ -0,0 +1,32 @@ +------------#######------------- +----------###########----------- +---------#############---------- +--------###############--------- +-------#################-------- +------###################------- +------###################------- +-----#####################------ +-----#####################------ +-----#####################------ +-----#####################------ +-----#####################------ +-----#####################------ +-----#####################------ +------###################------- +------###################------- +-------#################-------- +--------###############--------- +---------#############---------- +----------###########----------- +------------#######------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- +-------------------------------- diff --git a/languages/cpp/app_templates/prc-tool/palmhello.rcp b/languages/cpp/app_templates/prc-tool/palmhello.rcp new file mode 100644 index 00000000..0b37e81d --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/palmhello.rcp @@ -0,0 +1,11 @@ +#include "palmhelloRsc.h" + +FORM MainForm 1 1 158 158 +BEGIN + TITLE "PalmHello" +END + +APPLICATIONICONNAME 1000 "palmhello" +ICON "palmhello.pbitm" + +VERSION 1 "0.0.1" diff --git a/languages/cpp/app_templates/prc-tool/palmhelloRsc.h b/languages/cpp/app_templates/prc-tool/palmhelloRsc.h new file mode 100644 index 00000000..6dde2ec7 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/palmhelloRsc.h @@ -0,0 +1 @@ +#define MainForm 1000 diff --git a/languages/cpp/app_templates/prc-tool/prc-tool b/languages/cpp/app_templates/prc-tool/prc-tool new file mode 100644 index 00000000..d856c80b --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/prc-tool @@ -0,0 +1,11 @@ +# KDE Config File +[General] +Name=Hello world program +Name[fr]=Un simple programme de test Hello world +Icon=chellogba.png +Category=C/PalmOS +Comment=Generates a template for palm application +Comment[fr]=Gnre un modle d'application pour l'environnement PALM. +#tShowFileAfterGeneration=README.devel +FileTemplates=h,CStyle,c,CStyle +ShowFilesAfterGeneration=APPNAME.c diff --git a/languages/cpp/app_templates/prc-tool/prc-tool.kdevelop b/languages/cpp/app_templates/prc-tool/prc-tool.kdevelop new file mode 100644 index 00000000..2c5a6c0a --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/prc-tool.kdevelop @@ -0,0 +1,51 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevCustomProject + C + + KDevDebugger + + + C + PalmOS + + + + + + + + + + + make test + + true + + + + + make + + + + true + 1 + false + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/prc-tool/prc-tool.kdevtemplate b/languages/cpp/app_templates/prc-tool/prc-tool.kdevtemplate new file mode 100644 index 00000000..4216c466 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/prc-tool.kdevtemplate @@ -0,0 +1,136 @@ +# KDE Config File +[General] +Name=Hello world program +Name[ca]=Programa Hello world +Name[da]=Goddag verden program +Name[de]="Hello World"-Programm +Name[el]=Πρόγραμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» +Name[et]="Tere,maailm" programm +Name[eu]="Kaixo mundua" programa +Name[fa]=برنامۀ Hello world +Name[fr]=Programme « Bonjour monde » +Name[ga]=Ríomhchlár "Hello world" +Name[gl]=Programa Ola mundo +Name[it]=Programma di "Hello world" +Name[ja]=Hello world プログラム +Name[nds]="Moin Welt"-Programm +Name[ne]=हेल्डो वोल्ड कार्यक्रम +Name[nl]=Hello World-programma +Name[pl]=Program 'Witaj świecie' +Name[pt]=Programa 'Olá mundo' +Name[pt_BR]=Programa 'Olá mundo' +Name[ru]=Программа Hello world +Name[sk]=Ahoj svet program +Name[sl]=Program Hello world +Name[sr]=Програм „Здраво свете“ +Name[sr@Latn]=Program „Zdravo svete“ +Name[sv]=Hello world-program +Name[tr]=Merhaba Dünya Programı +Name[zh_CN]=Hello world 程序 +Name[zh_TW]=Hello world 程式 +Icon= # got none +Category=C/PalmOS +Comment=Generates a template for palm application +Comment[ca]=Genera una plantilla d'aplicació per a Palm +Comment[da]=Genererer en skabelon for et palm-program +Comment[de]=Erstellt das Gerüst für eine Palm-Anwendung +Comment[el]=Δημιουργία ενός προτύπου εφαρμογής για palm +Comment[es]=Genera una plantilla para una aplicación Palm +Comment[et]=Palmi rakenduse malli loomine. +Comment[eu]=Palm aplikazio baten txantiloi bat sortzen du +Comment[fa]=قالبی برای کاربرد palm تولید می‌کند +Comment[fr]=Génère un modèle pour une application Palm +Comment[gl]=Xera un modelo para aplicación palm +Comment[hu]=Létrehoz egy Palm-os alkalmazássablont +Comment[it]=Genera un modello per un'applicazione palm +Comment[ja]=Palm アプリケーションのためのテンプレートを作成します +Comment[nds]=Stellt dat Rahmenwark för en Palm-Programm op +Comment[ne]=पाम अनुप्रयोगका लागि टेम्प्लेट उत्पन्न गर्दछ +Comment[nl]=Genereert een sjabloon voor een Palm-toepassing +Comment[pl]=Generuje szablon programu dla Palma +Comment[pt]=Gera um modelo para aplicações do Palm +Comment[pt_BR]=Gera um modelo para aplicações do Palm +Comment[ru]=Создание простого приложения Palm +Comment[sk]=Vygeneruje šablónu pre Palm aplikáciu +Comment[sr]=Прави шаблон за palm програм +Comment[sr@Latn]=Pravi šablon za palm program +Comment[sv]=Skapar en mall för ett Palm-program +Comment[tr]=Bir avuçiçi uygulaması için bir şablon yaratır +Comment[zh_CN]=生成一个 Palm 应用程序的模板 +Comment[zh_TW]=產生一個 palm 應用程式樣本 +FileTemplates=h,CStyle,c,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAME}.c +Archive=prc-tool.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/prc-tool.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/src-Makefile +Dest=%{dest}/Makefile + +[FILE3] +Type=install +Source=%{src}/palmhello.c +Dest=%{dest}/%{APPNAME}.c + +[FILE4] +Type=install +Source=%{src}/palmhello.pbitm +Dest=%{dest}/%{APPNAME}.pbitm + +[FILE5] +Type=install +Source=%{src}/palmhello.rcp +Dest=%{dest}/%{APPNAME}.rcp + +[FILE6] +Type=install +Source=%{src}/palmhelloRsc.h +Dest=%{dest}/%{APPNAME}Rsc.h + +[FILE7] +Type=install +Source=%{src}/callback.h +Dest=%{dest}/callback.h + +[MSG] +Type=message +Comment=A palm application was created in %{dest} +Comment[ca]=Una aplicació per a Palm ha estat creada en %{dest} +Comment[da]=Et palm-program blev oprettet i %{dest} +Comment[de]=Eine Palm-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή palm δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación Palm ha sido creada en %{dest} +Comment[et]=Palmi rakendus loodi asukohta %{dest} +Comment[eu]=Palm aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد palm در %{dest} ایجاد شد +Comment[fr]=Une application Palm a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár Palm i %{dest} +Comment[gl]=Creouse unha aplicación palm en %{dest} +Comment[hu]=Létrejött egy Palmos alkalmazássablon itt: %{dest} +Comment[it]=È stata creata un'applicazione palm in %{dest} +Comment[ja]=Palm アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Palm-Programm opstellt +Comment[ne]=पाम अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Palm-toepassing is aangemaakt in %{dest} +Comment[pl]=Program dla Palma został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do Palm em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do Palm em %{dest} +Comment[ru]=Приложение Palm создано в %{dest} +Comment[sk]=Palm aplikácia bola vytvorená v %{dest} +Comment[sr]=Palm програм је направљен у %{dest} +Comment[sr@Latn]=Palm program je napravljen u %{dest} +Comment[sv]=Ett Palm-program skapades i %{dest} +Comment[tr]=Bir avuçiçi uygulaması %{dest} içinde yaratıldı +Comment[zh_CN]=在 %{dest} 中创建了一个 Palme 应用程序 +Comment[zh_TW]=一個 palm 應用程式樣本已建立於 %{dest} diff --git a/languages/cpp/app_templates/prc-tool/src-Makefile b/languages/cpp/app_templates/prc-tool/src-Makefile new file mode 100644 index 00000000..a64d5cfa --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/src-Makefile @@ -0,0 +1,63 @@ +## Makefile for PalmHello + +TARGET = palmhello +APPNAME = "PalmHello" +APPID = "0000" + +OBJS = $(TARGET).o +LIBS = + +target=m68k-palmos- + +CC = $(target)gcc + +CFLAGS = -Wall -g -O2 + +PILRC = pilrc +OBJRES = $(target)obj-res +NM = $(target)nm +BUILDPRC = build-prc +PILOTXFER = pilot-xfer + +all: $(TARGET).prc + +.S.o: + $(CC) $(TARGETFLAGS) -c $< + +.c.s: + $(CC) $(CSFLAGS) $< + +$(TARGET).prc: code0000.$(TARGET).grc code0001.$(TARGET).grc data0000.$(TARGET).grc pref0000.$(TARGET).grc rloc0000.$(TARGET).grc bin.res + $(BUILDPRC) $(TARGET).prc $(APPNAME) $(APPID) code0001.$(TARGET).grc code0000.$(TARGET).grc data0000.$(TARGET).grc *.bin pref0000.$(TARGET).grc rloc0000.$(TARGET).grc + +code0000.$(TARGET).grc: $(TARGET) + $(OBJRES) $(TARGET) + +code0001.$(TARGET).grc: code0000.$(TARGET).grc + +data0000.$(TARGET).grc: code0000.$(TARGET).grc + +pref0000.$(TARGET).grc: code0000.$(TARGET).grc + +rloc0000.$(TARGET).grc: code0000.$(TARGET).grc + +bin.res: $(TARGET).rcp $(TARGET).pbitm + $(PILRC) $(TARGET).rcp . + touch bin.res + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS) + ! $(NM) -u $(TARGET) | grep . + +send: $(TARGET).prc + $(PILOTXFER) -i $(TARGET).prc + +depend: + makedepend -Y -I. *.c + +clean: + -rm -f *.[oa] $(TARGET) *.bin bin.res *.grc Makefile.bak + +veryclean: clean + -rm -f $(TARGET).prc pilot.ram pilot.scratch + diff --git a/languages/cpp/app_templates/qmakeapp/.kdev_ignore b/languages/cpp/app_templates/qmakeapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/qmakeapp/Makefile.am b/languages/cpp/app_templates/qmakeapp/Makefile.am new file mode 100644 index 00000000..c70050fa --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = main.cpp qmakeapp.cpp qmakeapp.h qmakeapp.png qmakeapp.kdevelop \ + qmakeapp.pro src.pro filesave.xpm fileopen.xpm fileprint.xpm + +templateName = qmakeapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/qmakeapp/fileopen.xpm b/languages/cpp/app_templates/qmakeapp/fileopen.xpm new file mode 100644 index 00000000..880417ee --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/fileopen.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *fileopen[] = { +" 16 13 5 1", +". c #040404", +"# c #808304", +"a c None", +"b c #f3f704", +"c c #f3f7f3", +"aaaaaaaaa...aaaa", +"aaaaaaaa.aaa.a.a", +"aaaaaaaaaaaaa..a", +"a...aaaaaaaa...a", +".bcb.......aaaaa", +".cbcbcbcbc.aaaaa", +".bcbcbcbcb.aaaaa", +".cbcb...........", +".bcb.#########.a", +".cb.#########.aa", +".b.#########.aaa", +"..#########.aaaa", +"...........aaaaa" +}; diff --git a/languages/cpp/app_templates/qmakeapp/fileprint.xpm b/languages/cpp/app_templates/qmakeapp/fileprint.xpm new file mode 100644 index 00000000..6ada912f --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/fileprint.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static const char *fileprint[] = { +" 16 14 6 1", +". c #000000", +"# c #848284", +"a c #c6c3c6", +"b c #ffff00", +"c c #ffffff", +"d c None", +"ddddd.........dd", +"dddd.cccccccc.dd", +"dddd.c.....c.ddd", +"ddd.cccccccc.ddd", +"ddd.c.....c....d", +"dd.cccccccc.a.a.", +"d..........a.a..", +".aaaaaaaaaa.a.a.", +".............aa.", +".aaaaaa###aa.a.d", +".aaaaaabbbaa...d", +".............a.d", +"d.aaaaaaaaa.a.dd", +"dd...........ddd" +}; diff --git a/languages/cpp/app_templates/qmakeapp/filesave.xpm b/languages/cpp/app_templates/qmakeapp/filesave.xpm new file mode 100644 index 00000000..bd6870f4 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/filesave.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *filesave[] = { +" 14 14 4 1", +". c #040404", +"# c #808304", +"a c #bfc2bf", +"b c None", +"..............", +".#.aaaaaaaa.a.", +".#.aaaaaaaa...", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".##........##.", +".############.", +".##.........#.", +".##......aa.#.", +".##......aa.#.", +".##......aa.#.", +"b............." +}; diff --git a/languages/cpp/app_templates/qmakeapp/main.cpp b/languages/cpp/app_templates/qmakeapp/main.cpp new file mode 100644 index 00000000..bd26f19a --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/main.cpp @@ -0,0 +1,13 @@ +%{CPP_TEMPLATE} + +#include +#include "%{APPNAMELC}.h" + +int main( int argc, char ** argv ) { + QApplication a( argc, argv ); + %{APPNAME} * mw = new %{APPNAME}(); + mw->setCaption( "%{APPNAME}" ); + mw->show(); + a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); + return a.exec(); +} diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp b/languages/cpp/app_templates/qmakeapp/qmakeapp new file mode 100644 index 00000000..51d73e69 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/qmakeapp @@ -0,0 +1,11 @@ +# QMake application +[General] +Name=Application +Name[fr]=Une Application Qt / QMake +Icon=qmakeapp.png +Category=C++/QMake project +Category[fr]=C++/QMake +Comment=Generate a QMake/Qt based application (crossplatform compatible) +Comment[fr]=Gnre une application base sur Qt / QMake. Ce programme est multi platte-forme. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp.cpp b/languages/cpp/app_templates/qmakeapp/qmakeapp.cpp new file mode 100644 index 00000000..841f88d4 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/qmakeapp.cpp @@ -0,0 +1,283 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "filesave.xpm" +#include "fileopen.xpm" +#include "fileprint.xpm" + +%{APPNAME}::%{APPNAME}() + : QMainWindow( 0, "%{APPNAME}", WDestructiveClose ) +{ + printer = new QPrinter; + QPixmap openIcon, saveIcon, printIcon; + + QToolBar * fileTools = new QToolBar( this, "file operations" ); + fileTools->setLabel( tr("File Operations") ); + + openIcon = QPixmap( fileopen ); + QToolButton * fileOpen + = new QToolButton( openIcon, tr("Open File"), QString::null, + this, SLOT(choose()), fileTools, "open file" ); + + saveIcon = QPixmap( filesave ); + QToolButton * fileSave + = new QToolButton( saveIcon, tr("Save File"), QString::null, + this, SLOT(save()), fileTools, "save file" ); + + printIcon = QPixmap( fileprint ); + QToolButton * filePrint + = new QToolButton( printIcon, tr("Print File"), QString::null, + this, SLOT(print()), fileTools, "print file" ); + + + (void)QWhatsThis::whatsThisButton( fileTools ); + + QString fileOpenText = tr("

      " + "Click this button to open a new file.
      " + "You can also select the Open command " + "from the File menu.

      "); + + QWhatsThis::add( fileOpen, fileOpenText ); + + QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon ); + + QString fileSaveText = tr("

      Click this button to save the file you " + "are editing. You will be prompted for a file name.\n" + "You can also select the Save command " + "from the File menu.

      "); + + QWhatsThis::add( fileSave, fileSaveText ); + + QString filePrintText = tr("Click this button to print the file you " + "are editing.\n You can also select the Print " + "command from the File menu."); + + QWhatsThis::add( filePrint, filePrintText ); + + + QPopupMenu * file = new QPopupMenu( this ); + menuBar()->insertItem( tr("&File"), file ); + + + file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N ); + + int id; + id = file->insertItem( openIcon, tr("&Open..."), + this, SLOT(choose()), CTRL+Key_O ); + file->setWhatsThis( id, fileOpenText ); + + id = file->insertItem( saveIcon, tr("&Save"), + this, SLOT(save()), CTRL+Key_S ); + file->setWhatsThis( id, fileSaveText ); + + id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) ); + file->setWhatsThis( id, fileSaveText ); + + file->insertSeparator(); + + id = file->insertItem( printIcon, tr("&Print..."), + this, SLOT(print()), CTRL+Key_P ); + file->setWhatsThis( id, filePrintText ); + + file->insertSeparator(); + + file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W ); + + file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); + + menuBar()->insertSeparator(); + + QPopupMenu * help = new QPopupMenu( this ); + menuBar()->insertItem( tr("&Help"), help ); + + help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 ); + help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) ); + help->insertSeparator(); + help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 ); + + e = new QTextEdit( this, "editor" ); + e->setFocus(); + setCentralWidget( e ); + statusBar()->message( tr("Ready"), 2000 ); + + resize( 450, 600 ); +} + + +%{APPNAME}::~%{APPNAME}() +{ + delete printer; +} + + + +void %{APPNAME}::newDoc() +{ + %{APPNAME} *ed = new %{APPNAME}; + ed->setCaption(tr("Qt Example - Application")); + ed->show(); +} + +void %{APPNAME}::choose() +{ + QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, + this); + if ( !fn.isEmpty() ) + load( fn ); + else + statusBar()->message( tr("Loading aborted"), 2000 ); +} + + +void %{APPNAME}::load( const QString &fileName ) +{ + QFile f( fileName ); + if ( !f.open( IO_ReadOnly ) ) + return; + + QTextStream ts( &f ); + e->setText( ts.read() ); + e->setModified( FALSE ); + setCaption( fileName ); + statusBar()->message( tr("Loaded document %1").arg(fileName), 2000 ); +} + + +void %{APPNAME}::save() +{ + if ( filename.isEmpty() ) { + saveAs(); + return; + } + + QString text = e->text(); + QFile f( filename ); + if ( !f.open( IO_WriteOnly ) ) { + statusBar()->message( tr("Could not write to %1").arg(filename), + 2000 ); + return; + } + + QTextStream t( &f ); + t << text; + f.close(); + + e->setModified( FALSE ); + + setCaption( filename ); + + statusBar()->message( tr( "File %1 saved" ).arg( filename ), 2000 ); +} + + +void %{APPNAME}::saveAs() +{ + QString fn = QFileDialog::getSaveFileName( QString::null, QString::null, + this ); + if ( !fn.isEmpty() ) { + filename = fn; + save(); + } else { + statusBar()->message( tr("Saving aborted"), 2000 ); + } +} + + +void %{APPNAME}::print() +{ + // ###### Rewrite to use QSimpleRichText to print here as well + const int Margin = 10; + int pageNo = 1; + + if ( printer->setup(this) ) { // printer dialog + statusBar()->message( tr("Printing...") ); + QPainter p; + if( !p.begin( printer ) ) // paint on printer + return; + + p.setFont( e->font() ); + int yPos = 0; // y-position for each line + QFontMetrics fm = p.fontMetrics(); + QPaintDeviceMetrics metrics( printer ); // need width/height + // of printer surface + for( int i = 0 ; i < e->lines() ; i++ ) { + if ( Margin + yPos > metrics.height() - Margin ) { + QString msg( "Printing (page " ); + msg += QString::number( ++pageNo ); + msg += ")..."; + statusBar()->message( msg ); + printer->newPage(); // no more room on this page + yPos = 0; // back to top of page + } + p.drawText( Margin, Margin + yPos, + metrics.width(), fm.lineSpacing(), + ExpandTabs | DontClip, + e->text( i ) ); + yPos = yPos + fm.lineSpacing(); + } + p.end(); // send job to printer + statusBar()->message( tr("Printing completed"), 2000 ); + } else { + statusBar()->message( tr("Printing aborted"), 2000 ); + } +} + +void %{APPNAME}::closeEvent( QCloseEvent* ce ) +{ + if ( !e->isModified() ) { + ce->accept(); + return; + } + + switch( QMessageBox::information( this, tr("Qt Application Example"), + tr("Do you want to save the changes" + " to the document?"), + tr("Yes"), tr("No"), tr("Cancel"), + 0, 1 ) ) { + case 0: + save(); + ce->accept(); + break; + case 1: + ce->accept(); + break; + case 2: + default: // just for sanity + ce->ignore(); + break; + } +} + + +void %{APPNAME}::about() +{ + QMessageBox::about( this, tr("Qt Application Example"), + tr("This example demonstrates simple use of " + "QMainWindow,\nQMenuBar and QToolBar.")); +} + + +void %{APPNAME}::aboutQt() +{ + QMessageBox::aboutQt( this, tr("Qt Application Example") ); +} diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp.h b/languages/cpp/app_templates/qmakeapp/qmakeapp.h new file mode 100644 index 00000000..2d372da9 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/qmakeapp.h @@ -0,0 +1,39 @@ +%{H_TEMPLATE} + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + +#include + +class QTextEdit; + +class %{APPNAME}: public QMainWindow +{ + Q_OBJECT + +public: + %{APPNAME}(); + ~%{APPNAME}(); + +protected: + void closeEvent( QCloseEvent* ); + +private slots: + void newDoc(); + void choose(); + void load( const QString &fileName ); + void save(); + void saveAs(); + void print(); + + void about(); + void aboutQt(); + +private: + QPrinter *printer; + QTextEdit *e; + QString filename; +}; + + +#endif diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp.kdevelop b/languages/cpp/app_templates/qmakeapp/qmakeapp.kdevelop new file mode 100644 index 00000000..ef24a34b --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/qmakeapp.kdevelop @@ -0,0 +1,112 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + true + 3 + 3 + EmbeddedKDevDesigner + %{QTDIR} + %{QMAKE} + + + + + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + + + + /usr/bin/gdb + true + false + false + + + false + true + + + + + + ./bin/%{APPNAMELC} + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp.kdevtemplate b/languages/cpp/app_templates/qmakeapp/qmakeapp.kdevtemplate new file mode 100644 index 00000000..2fab0758 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/qmakeapp.kdevtemplate @@ -0,0 +1,182 @@ +# KDE Config File +[General] +Name=Qt3 Application +Name[br]=Meziant Qt3 +Name[ca]=Aplicació Qt3 +Name[da]=Qt3-Program +Name[de]=Qt3-Anwendung +Name[el]=Εφαρμογή Qt3 +Name[es]=Aplicación Qt3 +Name[et]=Qt3 rakendus +Name[fr]=Application Qt3 +Name[hu]=Qt3-alapú alkalmazások +Name[it]=Applicazione Qt3 +Name[ja]=Qt3 アプリケーション +Name[nds]=Qt3-Programm +Name[nl]=Qt3-toepassing +Name[pl]=Program Qt3 +Name[pt]=Aplicação do Qt3 +Name[pt_BR]=Aplicação do Qt3 +Name[ru]=Приложение Qt 3 +Name[sk]=Qt3 aplikácia +Name[sr]=Qt3 програм +Name[sr@Latn]=Qt3 program +Name[sv]=Qt3-program +Name[zh_TW]=Qt3 應用程式 +Icon=qmakeapp.png +Category=C++/QMake project +Category[fr]=C++/QMake +Comment=Generate a QMake/Qt3 based application (crossplatform compatible) +Comment[ca]=Genera una aplicació basada en QMake/Qt3 (multi plataforma) +Comment[da]=Generér et QMake/Qt3 baseret program (krydsplatform kompatibel) +Comment[de]=Erstellt eine auf QMake/Qt3 basierende Anwendung (plattformunabhängig) +Comment[el]=Δημιουργία μια εφαρμογής βασισμένης στα QMake/Qt3 (συμβατή με πολλαπλές πλατφόρμες) +Comment[es]=Genera una aplicación basada en QMake/Qt3 (con compatibilidad multiplataforma) +Comment[et]=Rakenduse loomine QMake'i/Qt3 põhjal (multiplatvormne) +Comment[fr]=Génère une application basée sur QMake / Qt3 (compatible multi-plateforme) +Comment[hu]=Létrehoz egy QMake/Qt3-alapú, keresztfordításra is alkalmas alkalmazást +Comment[it]=Genera un'applicazione basata su QMake/Qt3 (compatibile multipiattaforma) +Comment[ja]=QMake/Qt3 ベースのアプリケーションを作成 (クロスプラットフォーム) +Comment[nds]=Stellt en op QMake/Qt3 opbuut Programm op (över Bedriefümgeven weg kompatibel) +Comment[nl]=Genereert een Qmake/Qt3-gebaseerde toepassing (crossplatform compatible) +Comment[pl]=Generuje program używający QMake i Qt3 (wieloplatformowy) +Comment[pt]=Gera uma aplicação baseada no QMake/Qt3 (compatível com várias plataformas) +Comment[pt_BR]=Gera uma aplicação baseada no QMake/Qt3 (compatível com várias plataformas) +Comment[ru]=Создание использующее QMake кроссплатформенное приложение Qt 3 +Comment[sk]=Vygeneruje aplikáciu založenú na QMake/Qt3 (multiplatformovo kompatibilnú) +Comment[sr]=Прави програм на основи QMake/Qt3 (прекоплатформски компатибилан) +Comment[sr@Latn]=Pravi program na osnovi QMake/Qt3 (prekoplatformski kompatibilan) +Comment[sv]=Skapar ett Qmake/Qt3-baserat program (fungerar på andra plattformar) +Comment[zh_TW]=產生一個 QMake/Qt3 為基礎的應用程式(跨平台相容) +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=qmakeapp.tar.gz + +[FILE1] +Type=install +Source=%{src}/qmakeapp.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/qmakeapp.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE3] +Type=install +Source=%{src}/src.pro +Dest=%{dest}/src/src.pro + +[FILE4] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE5] +Type=install +Source=%{src}/qmakeapp.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE6] +Type=install +Source=%{src}/qmakeapp.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE7] +Type=install +Source=%{src}/fileopen.xpm +Dest=%{dest}/src/fileopen.xpm + +[FILE8] +Type=install +Source=%{src}/filesave.xpm +Dest=%{dest}/src/filesave.xpm + +[FILE9] +Type=install +Source=%{src}/fileprint.xpm +Dest=%{dest}/src/fileprint.xpm + +[MSG] +Type=message +Comment=A Qt3/Qmake based application was created in %{dest} +Comment[ca]=Una aplicació basada en Qt3/Qmake ha estat creada en %{dest} +Comment[da]=Et Qt3/Qmake baseret program blev oprettet i %{dest} +Comment[de]=Eine auf QMake/Qt3 basierende Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή βασισμένη στα Qt3/Qmake δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación basada en Qt3/Qmake ha sido creada en %{dest} +Comment[et]=Rakendus QMake'i põhjal loodi asukohta %{dest} +Comment[fr]=Une application basée sur Qt3 / Qmake a été créée dans %{dest} +Comment[hu]=Létrejött egy Qt3/Qmake-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione basata su Qt3/Qmake in %{dest} +Comment[ja]=Qt3/QMake ベースのアプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op Qt3/Qmake opbuut Programm opstellt +Comment[nl]=Een Qt3/Qmake-gebaseerde toepassing is aangemaakt in %{dest} +Comment[pl]=Program używający QMake i Qt3 został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação baseada no Qt3/Qmake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação baseada no Qt3/Qmake em %{dest} +Comment[ru]=Использующее QMake приложение Qt 3 создано в %{dest} +Comment[sk]=Aplikácia založená na Qt3/Qmake bola vytvorená v %{dest} +Comment[sr]=Програм на основи Qt3/Qmake направљен је у %{dest} +Comment[sr@Latn]=Program na osnovi Qt3/Qmake napravljen je u %{dest} +Comment[sv]=Ett Qmake/Qt3-baserat program skapades i %{dest} +Comment[zh_TW]=一個 QMake/Qt3 為基礎的應用程式已建立於 %{dest} + +[QTDIR] +Type=value +ValueType=QString +Value=QTDIR +Comment=Directory where Qt3 is installed. +Comment[ca]=Directori a on està instal·lat Qt3. +Comment[da]=Katalog hvor Qt3 er installeret. +Comment[de]=Qt3-Verzeichnis +Comment[el]=Κατάλογος εγκατάστασης του Qt3. +Comment[es]=Carpeta donde se ha instalado Qt3. +Comment[et]=Kataloog, kuhu on paigaldatud Qt3. +Comment[fr]=Dossier où Qt3 est installé. +Comment[hu]=A Qt3 telepítési könyvtára +Comment[it]=Cartella in cui è installato Qt3. +Comment[ja]=Qt3 がインストールされているディレクトリ +Comment[nds]=Orner, woneem Qt3 installeert is. +Comment[nl]=Map waarin Qt3 is geïnstalleerd. +Comment[pl]=Katalog, w którym zainstalowane jest Qt3. +Comment[pt]=A pasta onde está instalado o Qt3. +Comment[pt_BR]=A pasta onde está instalado o Qt3. +Comment[ru]=Каталог с установленным Qt 3 +Comment[sk]=Priečinok kde je nainštalované Qt3. +Comment[sr]=Директоријум у коме је Qt3 инсталиран. +Comment[sr@Latn]=Direktorijum u kome je Qt3 instaliran. +Comment[sv]=Katalog där Qt3 är installerat. +Comment[zh_TW]=Qt3 的安裝目錄 +Default= +[QMAKE] +Type=value +ValueType=QString +Value=QMAKE +Comment=Absolute Path for QMake (Qt3). +Comment[ca]=Ruta absoluta per a QMake (Qt3). +Comment[da]=Absolut søgesti til QMake (Qt3). +Comment[de]=Absoluter Pfad für QMake (Qt3). +Comment[el]=Απόλυτη διαδρομή για το QMake (Qt3). +Comment[es]=Ruta completa para QMake (Qt3). +Comment[et]=QMake'i (Qt3) absoluutne asukoht. +Comment[fr]=Chemin absolu pour QMake (Qt3). +Comment[hu]=A QMake (Qt3) teljes elérési útja. +Comment[it]=Percorso assoluto per QMake (Qt3). +Comment[ja]= QMake (Qt3) の絶対パス +Comment[nds]=Afsluut Padd för QMake (Qt3) +Comment[nl]=Absoluut pad naar QMake (Qt3) +Comment[pl]=Ścieżka bezwzględna do QMake (Qt3). +Comment[pt]=Localização Absoluta do QMake (Qt3). +Comment[pt_BR]=Localização Absoluta do QMake (Qt3). +Comment[ru]=Абсолютный путь к QMake (Qt 3) +Comment[sk]=Absolútna cesta ku QMake (Qt3). +Comment[sr]=Апсолутна путања до QMake-ва (Qt3). +Comment[sr@Latn]=Apsolutna putanja do QMake-va (Qt3). +Comment[sv]=Absolut sökväg till Qmake (Qt3). +Comment[zh_TW]=QMake (Qt3) 的絕對路徑 +Default= diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp.png b/languages/cpp/app_templates/qmakeapp/qmakeapp.png new file mode 100644 index 00000000..dda0a10b Binary files /dev/null and b/languages/cpp/app_templates/qmakeapp/qmakeapp.png differ diff --git a/languages/cpp/app_templates/qmakeapp/qmakeapp.pro b/languages/cpp/app_templates/qmakeapp/qmakeapp.pro new file mode 100644 index 00000000..20f1cba4 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/qmakeapp.pro @@ -0,0 +1,6 @@ +SUBDIRS += src +TEMPLATE = subdirs +CONFIG += release \ + warn_on \ + qt \ + thread diff --git a/languages/cpp/app_templates/qmakeapp/src.pro b/languages/cpp/app_templates/qmakeapp/src.pro new file mode 100644 index 00000000..d72522f9 --- /dev/null +++ b/languages/cpp/app_templates/qmakeapp/src.pro @@ -0,0 +1,10 @@ +SOURCES += %{APPNAMELC}.cpp \ + main.cpp +HEADERS += %{APPNAMELC}.h +TEMPLATE = app +CONFIG += release \ + warn_on \ + thread \ + qt +TARGET = %{APPNAMELC} +DESTDIR = ../bin diff --git a/languages/cpp/app_templates/qmakeempty/Makefile.am b/languages/cpp/app_templates/qmakeempty/Makefile.am new file mode 100644 index 00000000..57677d88 --- /dev/null +++ b/languages/cpp/app_templates/qmakeempty/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = qmakeempty.kdevelop \ + qmakeempty.pro qmakeempty.png + +templateName = qmakeempty + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/qmakeempty/qmakeempty.kdevelop b/languages/cpp/app_templates/qmakeempty/qmakeempty.kdevelop new file mode 100644 index 00000000..cd633ede --- /dev/null +++ b/languages/cpp/app_templates/qmakeempty/qmakeempty.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + true + 4 + 4 + ExternalDesigner + %{QMAKE} + %{DESIGNER} + + + + + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + + + + /usr/bin/gdb + true + false + false + + + false + true + + + + + + ./bin/%{APPNAMELC} + + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/qmakeempty/qmakeempty.kdevtemplate b/languages/cpp/app_templates/qmakeempty/qmakeempty.kdevtemplate new file mode 100644 index 00000000..cb108705 --- /dev/null +++ b/languages/cpp/app_templates/qmakeempty/qmakeempty.kdevtemplate @@ -0,0 +1,131 @@ +# KDE Config File +[General] +Name=Empty QMake Template +Name[ca]=Plantilla QMake buida +Name[da]=Tom QMake-skabelon +Name[de]=Leere QMake-Vorlage +Name[el]=Κενό πρότυπο του QMake +Name[es]=Plantilla QMake vacía +Name[et]=Tühi QMake'i mall +Name[hu]=Üres QMake-alapú sablon +Name[it]=Modello di QMake vuoto +Name[nds]=Leddig QMake-Vörlaag +Name[nl]=Leeg QMake-sjabloon +Name[pl]=Pusty szablon QMake +Name[pt]=Modelo do QMake Vazio +Name[pt_BR]=Modelo do QMake Vazio +Name[ru]=Пустой шаблон QMake +Name[sk]=Prázdna šablóna založená na QMake +Name[sr]=Празан шаблон QMake-а +Name[sr@Latn]=Prazan šablon QMake-a +Name[sv]=Tom Qmake-mall +Name[zh_TW]=空的 QMake 樣本 +Icon=qmakeempty.png +Category=C++/QMake project +Comment=Generate an empty QMake based application (crossplatform compatible) - Needs Qt +Comment[ca]=Genera una aplicació buida basada en QMake (compatible plataforma creuada) - Necessita Qt +Comment[da]=Genererer et tomt QMake-baseret program (krydsplatformskompatibelt) - kræver Qt +Comment[de]=Erstellt eine leere auf QMake basierende Anwendung (plattformunabhängig). - Benötigt Qt +Comment[el]=Δημιουργία μιας κενής εφαρμογής βασισμένης στο QMake (crossplatform) - Βασίζεται στην Qt +Comment[es]=Genera una aplicación vacía basada en QMake (con compatibilidad multiplataforma) - Necesita Qt +Comment[et]=Tühja rakenduse loomine QMake'i põhjal (multiplatvormne) - vajalik on Qt +Comment[hu]=Létrehoz egy üres QMake-alapú, keresztfordításra is alkalmas alkalmazást - Qt-t igényel +Comment[it]=Genera un'applicazione basata su QMake vuoto (compatibile multipiattaforma) - serve Qt +Comment[nds]=Stellt en op QMake opbuut Programm op (över Bedriefümgeven weg kompatibel) - Qt deit noot +Comment[nl]=Genereer een leeg QMake-gebaseerd programma (crossplatform-compatible) - Heeft Qt nodig +Comment[pl]=Generuje program używający QMake (wieloplatformowy) - wymaga biblioteki Qt +Comment[pt]=Gera uma aplicação vazia baseada no QMake (compatível com várias plataformas) - Necessita do Qt4 +Comment[pt_BR]=Gera uma aplicação vazia baseada no QMake (compatível com várias plataformas) - Necessita do Qt4 +Comment[ru]=Создание каркаса кроссплатформенного приложения Qt, использующего QMake. +Comment[sk]=Vygeneruje aplikáciu založenú na QMake (multiplatformovo kompatibilnú) - vyžaduje Qt +Comment[sr]=Прави празан шаблон на основи QMake-а (прекоплатформски компатибилан) — захтева Qt +Comment[sr@Latn]=Pravi prazan šablon na osnovi QMake-a (prekoplatformski kompatibilan) — zahteva Qt +Comment[sv]=Skapar ett tomt Qmake-baserat program (fungerar på andra plattformar). Kräver Qt. +Comment[zh_TW]=產生一個空的以 QMake 為基礎的(跨平台相容)應用程式─需要 Qt +FileTemplates=h,CStyle,cpp,CStyle +Archive=qmakeempty.tar.gz + +[FILE1] +Type=install +Source=%{src}/qmakeempty.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/qmakeempty.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[MSG] +Type=message +Comment=A Qmake based application was created in %{dest} +Comment[ca]=Una aplicació basada en QMake ha estat creada en %{dest} +Comment[da]=Et Qmake-baseret program blev oprettet i %{dest} +Comment[de]=Eine auf Qmake basierende Anwendung wurde in %{dest} erstellt. +Comment[el]=Δημιουργήθηκε μια εφαρμογή βασισμένη σε Qmake στο %{dest} +Comment[es]=Una aplicación basada en QMake ha sido creada en %{dest} +Comment[et]=Rakendus QMake'i põhjal loodi asukohta %{dest} +Comment[hu]=Létrejött egy Qmake-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione basata su Qmake in %{dest} +Comment[nds]=In %{dest} wöör en op QMake opbuut Programm opstellt +Comment[nl]=Een Qmake-gebaseerd programma is aangemaakt in %{dest} +Comment[pl]=Program oparty na QMake został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação baseada no Qmake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação baseada no Qmake em %{dest} +Comment[ru]=Использующее QMake приложение создано в %{dest} +Comment[sk]=Aplikácia založená na QMake bola vytvorená v %{dest} +Comment[sr]=Програм на основу QMake-а направљен је у %{dest} +Comment[sr@Latn]=Program na osnovu QMake-a napravljen je u %{dest} +Comment[sv]=Ett Qmake-baserat program skapades i %{dest} +Comment[zh_TW]=一個以 Qmake 為基礎的應用程式已建立於 %{dest} + +[QMAKE] +Type=value +ValueType=QString +Value=QMAKE +Comment=Absolute Path for QMake. +Comment[ca]=Ruta absoluta per a QMake. +Comment[da]=Absolut søgesti til QMake. +Comment[de]=Absoluter Pfad für QMake. +Comment[el]=Απόλυτη διαδρομή του QMake. +Comment[es]=Ruta completa para QMake. +Comment[et]=QMake absoluutne asukoht. +Comment[hu]=A QMake teljes elérési útja. +Comment[it]=Percorso assoluto per QMake. +Comment[nds]=Afsluut Padd för QMake +Comment[nl]=Absoluut pad voor Qmake. +Comment[pl]=Ścieżka bezwzględna do QMake. +Comment[pt]=Localização Absoluta do QMake. +Comment[pt_BR]=Localização Absoluta do QMake. +Comment[ru]=Полный путь к QMake. +Comment[sk]=Absolútna cesta ku QMake. +Comment[sr]=Апсолутна путања до QMake-а. +Comment[sr@Latn]=Apsolutna putanja do QMake-a. +Comment[sv]=Absolut sökväg till Qmake. +Comment[zh_TW]=QMake 的絕對路徑 +Default= + +[DESIGNER] +Type=value +ValueType=QString +Value=DESIGNER +Comment=Absolute Path for Designer. +Comment[ca]=Ruta absoluta per a Designer. +Comment[da]=Absolut søgesti til Designer +Comment[de]=Absoluter Pfad für Designer. +Comment[el]=Απόλυτη διαδρομή του Designer. +Comment[es]=Ruta completa para Designer. +Comment[et]=Disaineri absoluutne asukoht. +Comment[hu]=A Designer teljes elérési útja. +Comment[it]=Percorso assoluto per Designer. +Comment[nds]=Afsluut Padd för Designer +Comment[nl]=Absoluut pad voor Designer. +Comment[pl]=Ścieżka bezwzględna do Projektanta. +Comment[pt]=Localização Absoluta do Designer. +Comment[pt_BR]=Localização Absoluta do Designer. +Comment[ru]=Полный путь к Designer. +Comment[sk]=Absolútna cesta ku Designer. +Comment[sr]=Апсолутна путања до Designer-а. +Comment[sr@Latn]=Apsolutna putanja do Designer-a. +Comment[sv]=Absolut sökväg till Designer. +Comment[zh_TW]=設計家(Designer)的絕對路徑 +Default= diff --git a/languages/cpp/app_templates/qmakeempty/qmakeempty.png b/languages/cpp/app_templates/qmakeempty/qmakeempty.png new file mode 100644 index 00000000..332ea1c0 Binary files /dev/null and b/languages/cpp/app_templates/qmakeempty/qmakeempty.png differ diff --git a/languages/cpp/app_templates/qmakeempty/qmakeempty.pro b/languages/cpp/app_templates/qmakeempty/qmakeempty.pro new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/qmakesimple/.kdev_ignore b/languages/cpp/app_templates/qmakesimple/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/qmakesimple/Makefile.am b/languages/cpp/app_templates/qmakesimple/Makefile.am new file mode 100644 index 00000000..a187172f --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.cpp qmakesimple.png app.kdevelop app.pro src.pro +templateName = qmakesimple + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/qmakesimple/app.kdevelop b/languages/cpp/app_templates/qmakesimple/app.kdevelop new file mode 100644 index 00000000..a77f86f3 --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/app.kdevelop @@ -0,0 +1,100 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + + + + + + + + + 3 + true + 3 + EmbeddedKDevDesigner + %{QTDIR} + %{QMAKE} + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + + /usr/bin/gdb + true + false + false + + + + + + ./bin/%{APPNAMELC} + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/qmakesimple/app.pro b/languages/cpp/app_templates/qmakesimple/app.pro new file mode 100644 index 00000000..8feb4aa4 --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/app.pro @@ -0,0 +1,2 @@ +TEMPLATE=subdirs +SUBDIRS=src diff --git a/languages/cpp/app_templates/qmakesimple/main.cpp b/languages/cpp/app_templates/qmakesimple/main.cpp new file mode 100644 index 00000000..e91f9f22 --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/main.cpp @@ -0,0 +1,15 @@ +%{CPP_TEMPLATE} + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/qmakesimple/qmakesimple b/languages/cpp/app_templates/qmakesimple/qmakesimple new file mode 100644 index 00000000..e476a7bf --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/qmakesimple @@ -0,0 +1,11 @@ +# KDE Config File +[General] +Name=Hello world program +Name[fr]=Un simple programme de test Hello world +Icon=qmakesimple.png +Category=C++/QMake project +Category[fr]=C++/QMake +Comment=Generates a simple Hello world program in C++ using QMake based project manager +Comment[fr]=Gnre un simple programme de test du type Hello world en utilisant QMake. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/qmakesimple/qmakesimple.kdevtemplate b/languages/cpp/app_templates/qmakesimple/qmakesimple.kdevtemplate new file mode 100644 index 00000000..1d7cc7b1 --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/qmakesimple.kdevtemplate @@ -0,0 +1,158 @@ +# KDE Config File +[General] +Name=Qt3 Hello world program +Name[ca]=Programa Hello world per a Qt3 +Name[da]=Qt3 Goddag verden program +Name[de]="Hello World"-Programm (Qt3) +Name[el]=Πρόγραμμα 'Γεια σου Κόσμε' για το Qt3 +Name[es]=Programa Qt3 «Hola mundo» +Name[et]=Qt3 "Tere,maailm" programm +Name[fr]=Programme « Bonjour monde » en Qt3 +Name[hu]=Qt3-alapú 'Hello world' program +Name[it]=Programma di "Hello world" fatto in Qt3 +Name[ja]=Qt3 Hello world プログラム +Name[nds]=Qt3-"Moin Welt"-Programm +Name[nl]=Qt3 Hello world-programma +Name[pl]=Program 'Witaj świecie' w Qt3 +Name[pt]=Programa 'Olá mundo' em Qt3 +Name[pt_BR]=Programa 'Olá mundo' em Qt3 +Name[ru]=Программа Qt 3 +Name[sk]=Qt3 Ahoj svet program +Name[sr]=Програм „Здраво свете“ за Qt3 +Name[sr@Latn]=Program „Zdravo svete“ za Qt3 +Name[sv]=Qt3 Hello world-program +Name[zh_TW]=Qt3 的 Hello world 程式 +Icon=qmakesimple.png +Category=C++/QMake project +Category[fr]=C++/QMake +Comment=Generates a simple Hello world program in C++ using QMake/Qt3 based project manager +Comment[ca]=Genera un simple programa de Hello world en C++ usant el gestor de projectes basat en QMake/Qt3 +Comment[da]=Genererer et simpelt Goddag verden program in C++ ved brug af QMake/Qt3 baseret projekthåndtering +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in C++ basierend auf dem QMake-Projektmanager und Qt3. +Comment[el]=Δημιουργεί ένα απλό πρόγραμμα 'Γεια σου Κόσμε' σε C++ χρησιμοποιώντας διαχειριστή έργου βασισμένο στο QMake/Qt3 +Comment[es]=Genera un sencillo programa «Hola mundo» en C++ que usa un gestor de proyecto basado en QMake/Qt3 +Comment[et]=Lihtsa "Tere, maailm" programmi loomine C++-s projektihalduriga QMake'i/Qt3 põhjal +Comment[fr]=Génère un programme « Bonjour monde » simple en C++ utilisant un gestionnaire de projet basé sur QMake / Qt3 +Comment[hu]=Létrehoz egy egyszerű 'Hello world' programot C++-ban, QMake/Qt3-alapú projektkezelővel +Comment[it]=Genera un semplice programma di "Hello world" in C++ usando il gestore di progetto QMake/Qt3 +Comment[ja]=QMake/Qt3 ベースのプロジェクトマネージャを使って簡単な Hello World プログラムを C++ で作成します +Comment[nds]=Stellt mit den op Qt3 un QMake opbuut Projektpleger en eenfach "Moin Welt"-Programm in C++ op +Comment[nl]=Genereert een eenvoudig Hello World-programma in C++ met behulp van de QMake/Qt3-gebaseerde projectbeheerder +Comment[pl]=Generuje prosty program "Witaj świecie" w C++ używając menedżera projektów QMake i Qt3 +Comment[pt]=Gera um programa simples Olá Mundo em C++, usando o gestor de projectos QMake/Qt3 +Comment[pt_BR]=Gera um programa simples Olá Mundo em C++, usando o gestor de projectos QMake/Qt3 +Comment[ru]=Создание простой программы на C++ с использованием QMake (Qt 3) +Comment[sk]=Vygeneruje jednoduchý Ahoj svet program v C++ s použitím QMake/Qt3 projektového manažéra +Comment[sr]=Прави једноставан „Здраво свете“ програм у C++-у помоћу менаџера пројекта на основу QMake/Qt3 +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u C++-u pomoću menadžera projekta na osnovu QMake/Qt3 +Comment[sv]=Skapar ett enkelt Hello world-program i C++ baserat på QMake/Qt3 projekthantering +Comment[zh_TW]=產生一個使用 QMake/Qt3 專案管理員的簡單 C++ Hello world 程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=qmakesimple.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE3] +Type=install +Source=%{src}/src.pro +Dest=%{dest}/src/src.pro + +[FILE4] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=A Qmake/Qt3 based hello world program was created in %{dest} +Comment[ca]=Una programa de hello world basat en QMake/Qt3 ha estat creat en %{dest} +Comment[da]=et Qmake/Qt3 baseret Goddag verden program blev oprettet i %{dest} +Comment[de]=Ein auf QMake basierendes "Hello World"-Programm wurde in %{dest} erstellt. +Comment[el]=Ένα πρόγραμμα 'Γεια σου Κόσμε' βασισμένο στο Qmake/Qt3 δημιουργήθηκε στο %{dest} +Comment[es]=Un programa «Hola mundo» basado en QMake/Qt3 ha sido creado en %{dest} +Comment[et]="Tere, maailm" programm QMake'i/Qt3 põhjal loodi asukohta %{dest} +Comment[fr]=Un programme « Bonjour monde » basé sur QMake / Qt3 a été créé dans %{dest} +Comment[hu]=Létrejött egy Qmake/Qt3-alapú 'Hello world' program itt: %{dest} +Comment[it]=È stato creato un programma di "hello world" basato su Qmake/Qt3 in %{dest} +Comment[ja]=QMake/Qt3 ベースの hello world プログラムを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op Qt3 un QMake opbuut "Moin Welt"-Programm opstellt +Comment[nl]=Een Qmake/Qt3-gebaseerd Hello World-programma is aangemaakt in %{dest} +Comment[pl]=Prosty program używający Qmake/Qt3 został utworzony w %{dest} +Comment[pt]=Foi criado um programa Olá Mundo, baseado no Qmake/Qt3, em %{dest} +Comment[pt_BR]=Foi criado um programa Olá Mundo, baseado no Qmake/Qt3, em %{dest} +Comment[ru]=Программа на Qt 3, использующая QMake, создана в %{dest} +Comment[sk]=Ahoj svet program založený na Qmake/Qt3 bol vytvorený v %{dest} +Comment[sr]=„Здраво свете“ на основу Qmake/Qt3 направљен је у %{dest} +Comment[sr@Latn]=„Zdravo svete“ na osnovu Qmake/Qt3 napravljen je u %{dest} +Comment[sv]=Ett Qmake/Qt3-baserat Hello world-program skapades i %{dest} +Comment[zh_TW]=一個 Qmake/Qt3 為基礎的 hello world 程式已建立於 %{dest} + + +[QTDIR] +Type=value +ValueType=QString +Value=QTDIR +Comment=Directory where Qt3 is installed. +Comment[ca]=Directori a on està instal·lat Qt3. +Comment[da]=Katalog hvor Qt3 er installeret. +Comment[de]=Qt3-Verzeichnis +Comment[el]=Κατάλογος εγκατάστασης του Qt3. +Comment[es]=Carpeta donde se ha instalado Qt3. +Comment[et]=Kataloog, kuhu on paigaldatud Qt3. +Comment[fr]=Dossier où Qt3 est installé. +Comment[hu]=A Qt3 telepítési könyvtára +Comment[it]=Cartella in cui è installato Qt3. +Comment[ja]=Qt3 がインストールされているディレクトリ +Comment[nds]=Orner, woneem Qt3 installeert is. +Comment[nl]=Map waarin Qt3 is geïnstalleerd. +Comment[pl]=Katalog, w którym zainstalowane jest Qt3. +Comment[pt]=A pasta onde está instalado o Qt3. +Comment[pt_BR]=A pasta onde está instalado o Qt3. +Comment[ru]=Каталог с установленным Qt 3 +Comment[sk]=Priečinok kde je nainštalované Qt3. +Comment[sr]=Директоријум у коме је Qt3 инсталиран. +Comment[sr@Latn]=Direktorijum u kome je Qt3 instaliran. +Comment[sv]=Katalog där Qt3 är installerat. +Comment[zh_TW]=Qt3 的安裝目錄 +Default= +[QMAKE] +Type=value +ValueType=QString +Value=QMAKE +Comment=Absolute Path for QMake (Qt3). +Comment[ca]=Ruta absoluta per a QMake (Qt3). +Comment[da]=Absolut søgesti til QMake (Qt3). +Comment[de]=Absoluter Pfad für QMake (Qt3). +Comment[el]=Απόλυτη διαδρομή για το QMake (Qt3). +Comment[es]=Ruta completa para QMake (Qt3). +Comment[et]=QMake'i (Qt3) absoluutne asukoht. +Comment[fr]=Chemin absolu pour QMake (Qt3). +Comment[hu]=A QMake (Qt3) teljes elérési útja. +Comment[it]=Percorso assoluto per QMake (Qt3). +Comment[ja]= QMake (Qt3) の絶対パス +Comment[nds]=Afsluut Padd för QMake (Qt3) +Comment[nl]=Absoluut pad naar QMake (Qt3) +Comment[pl]=Ścieżka bezwzględna do QMake (Qt3). +Comment[pt]=Localização Absoluta do QMake (Qt3). +Comment[pt_BR]=Localização Absoluta do QMake (Qt3). +Comment[ru]=Абсолютный путь к QMake (Qt 3) +Comment[sk]=Absolútna cesta ku QMake (Qt3). +Comment[sr]=Апсолутна путања до QMake-ва (Qt3). +Comment[sr@Latn]=Apsolutna putanja do QMake-va (Qt3). +Comment[sv]=Absolut sökväg till Qmake (Qt3). +Comment[zh_TW]=QMake (Qt3) 的絕對路徑 +Default= diff --git a/languages/cpp/app_templates/qmakesimple/qmakesimple.png b/languages/cpp/app_templates/qmakesimple/qmakesimple.png new file mode 100644 index 00000000..494d83da Binary files /dev/null and b/languages/cpp/app_templates/qmakesimple/qmakesimple.png differ diff --git a/languages/cpp/app_templates/qmakesimple/src.pro b/languages/cpp/app_templates/qmakesimple/src.pro new file mode 100644 index 00000000..e7a46a76 --- /dev/null +++ b/languages/cpp/app_templates/qmakesimple/src.pro @@ -0,0 +1,4 @@ +SOURCES=%{APPNAMELC}.cpp +TARGET=%{APPNAMELC} +DESTDIR=../bin +TEMPLATE = app diff --git a/languages/cpp/app_templates/qt4hello/Makefile.am b/languages/cpp/app_templates/qt4hello/Makefile.am new file mode 100644 index 00000000..b285f781 --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = main.cpp qt4hello.png qt4hello.kdevelop \ + qt4hello.pro src.pro ReadMe + +templateName = qt4hello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/qt4hello/ReadMe b/languages/cpp/app_templates/qt4hello/ReadMe new file mode 100644 index 00000000..87d23f71 --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/ReadMe @@ -0,0 +1,11 @@ +READ THIS IN ORDER TO COMPILE THE Qt4 TEMPLATE +---------------------------------------------- + +Before compiling, check the Qt Options, go to +Project->Project Options->C++ Support and open the Qt Options tab. + +Check that the Qt installation directory is correct for the Qt version you've chosen. + +------------------ +Andreas Pakulat +July 2006 diff --git a/languages/cpp/app_templates/qt4hello/main.cpp b/languages/cpp/app_templates/qt4hello/main.cpp new file mode 100644 index 00000000..cbff1d3c --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/main.cpp @@ -0,0 +1,11 @@ +%{CPP_TEMPLATE} + +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + qDebug("Hello from Qt 4!"); + return 0; +} + diff --git a/languages/cpp/app_templates/qt4hello/qt4hello.kdevelop b/languages/cpp/app_templates/qt4hello/qt4hello.kdevelop new file mode 100644 index 00000000..cd633ede --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/qt4hello.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + true + 4 + 4 + ExternalDesigner + %{QMAKE} + %{DESIGNER} + + + + + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + + + + /usr/bin/gdb + true + false + false + + + false + true + + + + + + ./bin/%{APPNAMELC} + + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/qt4hello/qt4hello.kdevtemplate b/languages/cpp/app_templates/qt4hello/qt4hello.kdevtemplate new file mode 100644 index 00000000..d1796a14 --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/qt4hello.kdevtemplate @@ -0,0 +1,160 @@ +# KDE Config File +[General] +Name=Basic Qt4 Application +Name[ca]=Aplicació en Qt4 bàsica +Name[da]=Basalt Qt4-program +Name[de]=Einfache Qt4-Anwendung +Name[el]=Βασική εφαρμογή Qt4 +Name[es]=Aplicación Qt4 básica +Name[et]=Elementaarne Qt4 rakendus +Name[fr]=Application Qt4 de base +Name[hu]=Egyszerű Qt4-alapú alkalmazás +Name[it]=Applicazione Qt4 base +Name[ja]=基本的な Qt4 アプリケーション +Name[nds]=Eenfach Qt4-Programm +Name[nl]=Basis Qt4-toepassing +Name[pl]=Prosty program w Qt4 +Name[pt]=Aplicação Básica em Qt4 +Name[pt_BR]=Aplicação Básica em Qt4 +Name[ru]=Простое приложение Qt 4 +Name[sk]=Základná Qt4 aplikácia +Name[sr]=Основни Qt4 програм +Name[sr@Latn]=Osnovni Qt4 program +Name[sv]=Grundläggande Qt4-program +Name[zh_TW]=基本 Qt4 應用程式 +Icon=qt4hello.png +Category=C++/QMake project +Comment=Generate a very simple QMake/Qt4 based application (crossplatform compatible) - Needs Qt4 +Comment[ca]=Genera una aplicació molt simple basada en QMake/Qt4 (multi plataforma) -requereix Qt4- +Comment[da]=Generér et meget enkelt QMake/Qt4 baseret program (krydsplatform kompatibel) - behøver Qt4 +Comment[de]=Erstellt eine sehr einfache, auf QMake/Qt4 basierende Anwendung (plattformunabhängig). - Benötigt Qt4. +Comment[el]=Δημιουργία μια εφαρμογής βασισμένης στα QMake/Qt4 (συμβατή με πολλαπλές πλατφόρμες) -Απαιτεί το Qt4 +Comment[es]=Genera una aplicación muy sencilla basada en QMake/Qt4 (con compatibilidad multiplataforma) - Necesita Qt4 +Comment[et]=Väga lihtsa rakenduse loomine QMake'i/Qt4 põhjal (multiplatvormne) - vajalik on Qt4 +Comment[fr]=Génère une application basée sur QMake / Qt4 très simple (compatible multi-plateforme) - Nécessite Qt4 +Comment[hu]=Létrehoz egy QMake/Qt4-alapú, keresztfordításra is alkalmas alkalmazást - Qt4-et igényel +Comment[it]=Genera una semplice applicazione basata su QMake/Qt4 (compatibile multipiattaforma) - serve Qt4 +Comment[nds]=Stellt en op QMake un Qt4 opbuut Programm op (över Bedriefümgeven weg kompatibel) - Qt4 deit noot +Comment[nl]=Genereert een heel eenvoudig Qmake/Qt4-gebaseerde toepassing (crossplatform compatible) - heeft Qt4 nodig +Comment[pl]=Generuje program używający QMake i Qt4 (wieloplatformowy) +Comment[pt]=Gera uma aplicação baseada no QMake/Qt4 (compatível com várias plataformas) - Necessita do Qt4 +Comment[pt_BR]=Gera uma aplicação baseada no QMake/Qt4 (compatível com várias plataformas) - Necessita do Qt4 +Comment[ru]=Создание простого кроссплатформенного приложения Qt 4, использующего QMake. +Comment[sk]=Vygeneruje veľmi jednoduchú aplikáciu založenú na QMake/Qt4 (multiplatformovo kompatibilnú) - vyžaduje Qt4 +Comment[sr]=Прави једноставан програм на основи QMake/Qt4 (прекоплатформски компатибилан) — захтева Qt4 +Comment[sr@Latn]=Pravi jednostavan program na osnovi QMake/Qt4 (prekoplatformski kompatibilan) — zahteva Qt4 +Comment[sv]=Skapar ett mycket enkelt QMake/Qt4-baserat program (fungerar på andra plattformar). Kräver Qt4. +Comment[zh_TW]=產生一個以 QMake/Qt4 為基礎的簡單應用程式(跨平台相容)─需要使用 Qt4 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/main.cpp,%{dest}/src/ReadMe +Archive=qt4hello.tar.gz + +[FILE1] +Type=install +Source=%{src}/qt4hello.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/qt4hello.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE3] +Type=install +Source=%{src}/src.pro +Dest=%{dest}/src/src.pro + +[FILE4] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE5] +Type=install +Source=%{src}/ReadMe +Dest=%{dest}/src/ReadMe + +[MSG] +Type=message +Comment=A Qt4/Qmake based application was created in %{dest} +Comment[ca]=Una aplicació basada en Qt4/Qmake ha estat creada en %{dest} +Comment[da]=Et Qt4/Qmake baseret program blev oprettet i %{dest} +Comment[de]=Eine auf QMake/Qt4 basierende Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή βασισμένη στα Qt4/Qmake δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación basada en Qt4/Qmake ha sido creada en %{dest} +Comment[et]=Rakendus Qt4/QMake'i põhjal loodi asukohta %{dest} +Comment[fr]=Une application basée sur Qt4 / Qmake a été créée dans %{dest} +Comment[hu]=Létrejött egy Qt4/Qmake-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione basata su Qt4/Qmake in %{dest} +Comment[ja]=Qt4/QMake ベースのアプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op Qt4 un Qmake opbuut Programm opstellt +Comment[nl]=Een Qt4/Qmake gebaseerde toepassing is aangemaakt in %{dest} +Comment[pl]=Program używający QMake i Qt4 został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação baseada no Qt4/Qmake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação baseada no Qt4/Qmake em %{dest} +Comment[ru]=Приложение Qt 4, использующее Qmake, создано в %{dest} +Comment[sk]=Aplikácia založená na Qt4/Qmake bola vytvorená v %{dest} +Comment[sr]=Програм на основу Qt4/Qmake направљен је у %{dest} +Comment[sr@Latn]=Program na osnovu Qt4/Qmake napravljen je u %{dest} +Comment[sv]=Ett QMake/Qt4-baserat program skapades i %{dest} +Comment[zh_TW]=一個 QMake/Qt4 為基礎的應用程式已建立於 %{dest} + +[QMAKE] +Type=value +ValueType=QString +Value=QMAKE +Comment=Absolute Path for QMake (Qt4). +Comment[ca]=Ruta absoluta per a QMake (Qt4). +Comment[da]=Absolut søgesti til QMake (Qt4). +Comment[de]=Absoluter Pfad für QMake (Qt4). +Comment[el]=Απόλυτη διαδρομή για το QMake (Qt4). +Comment[es]=Ruta completa para QMake (Qt4). +Comment[et]=QMake (Qt4) absoluutne asukoht. +Comment[fr]=Chemin absolu pour QMake (Qt4). +Comment[hu]=A QMake (Qt4) teljes elérési útja. +Comment[it]=Percorso assoluto per QMake (Qt4). +Comment[ja]=QMake (Qt4) の絶対パス +Comment[nds]=Afsluut Padd för QMake (Qt4) +Comment[nl]=Absoluut pad naar QMake (Qt4). +Comment[pl]=Ścieżka bezwzględna do QMake (Qt4). +Comment[pt]=Localização Absoluta do QMake (Qt4). +Comment[pt_BR]=Localização Absoluta do QMake (Qt4). +Comment[ru]=Полный путь к QMake (Qt 4). +Comment[sk]=Absolútna cesta ku QMake (Qt4). +Comment[sr]=Апсолутна путања до QMake-а (Qt4). +Comment[sr@Latn]=Apsolutna putanja do QMake-a (Qt4). +Comment[sv]=Absolut sökväg till QMake (Qt4). +Comment[zh_TW]=QMake(Qt4)的絕對路徑 +Default= + +[DESIGNER] +Type=value +ValueType=QString +Value=DESIGNER +Comment=Absolute Path for Designer (Qt4). +Comment[ca]=Ruta absoluta per a Designer (Qt4). +Comment[da]=Absolut søgesti til Designer (Qt4). +Comment[de]=Absoluter Pfad für Designer (Qt4). +Comment[el]=Απόλυτη διαδρομή για τον Σχεδιαστή (Qt4). +Comment[es]=Ruta completa para Designer (Qt4). +Comment[et]=Disaineri (Qt4) absoluutne asukoht. +Comment[fr]=Chemin absolu pour Designer (Qt4). +Comment[hu]=A Designer (Qt4) teljes elérési útja +Comment[it]=Percorso assoluto del Designer (Qt4). +Comment[ja]=Designer (Qt4) の絶対パス +Comment[nds]=Afsluut Padd för Designer (Qt4) +Comment[nl]=Absoluut pad naar Designer (Qt4). +Comment[pl]=Ścieżka bezwzględna do Designera (Qt4). +Comment[pt]=Localização Absoluta do Designer (Qt4). +Comment[pt_BR]=Localização Absoluta do Designer (Qt4). +Comment[ru]=Полный путь к Designer (Qt 4). +Comment[sk]=Absolútna cesta ku Designer (Qt4). +Comment[sr]=Апсолутна путања до Designer-а (Qt4). +Comment[sr@Latn]=Apsolutna putanja do Designer-a (Qt4). +Comment[sv]=Absolut sökväg till Designer (Qt4). +Comment[zh_TW]=設計家(Qt4)的絕對路徑 +Default= diff --git a/languages/cpp/app_templates/qt4hello/qt4hello.png b/languages/cpp/app_templates/qt4hello/qt4hello.png new file mode 100644 index 00000000..332ea1c0 Binary files /dev/null and b/languages/cpp/app_templates/qt4hello/qt4hello.png differ diff --git a/languages/cpp/app_templates/qt4hello/qt4hello.pro b/languages/cpp/app_templates/qt4hello/qt4hello.pro new file mode 100644 index 00000000..7177d225 --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/qt4hello.pro @@ -0,0 +1,5 @@ +SUBDIRS += src +TEMPLATE = subdirs +CONFIG += warn_on \ + qt \ + thread \ No newline at end of file diff --git a/languages/cpp/app_templates/qt4hello/src.pro b/languages/cpp/app_templates/qt4hello/src.pro new file mode 100644 index 00000000..ae5bac37 --- /dev/null +++ b/languages/cpp/app_templates/qt4hello/src.pro @@ -0,0 +1,8 @@ +SOURCES += main.cpp +TEMPLATE = app +CONFIG += warn_on \ + thread \ + qt +TARGET = %{APPNAMELC} +DESTDIR = ../bin +QT -= gui diff --git a/languages/cpp/app_templates/qt4makeapp/Makefile.am b/languages/cpp/app_templates/qt4makeapp/Makefile.am new file mode 100644 index 00000000..62c4c120 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = main.cpp qt4makeapp.cpp qt4makeapp.h qt4makeapp.png qt4makeapp.kdevelop \ + qt4makeapp.pro src.pro application.qrc ReadMe filesave.xpm fileopen.xpm filenew.xpm \ + editcopy.xpm editpaste.xpm editcut.xpm + +templateName = qt4makeapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/qt4makeapp/ReadMe b/languages/cpp/app_templates/qt4makeapp/ReadMe new file mode 100644 index 00000000..87d23f71 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/ReadMe @@ -0,0 +1,11 @@ +READ THIS IN ORDER TO COMPILE THE Qt4 TEMPLATE +---------------------------------------------- + +Before compiling, check the Qt Options, go to +Project->Project Options->C++ Support and open the Qt Options tab. + +Check that the Qt installation directory is correct for the Qt version you've chosen. + +------------------ +Andreas Pakulat +July 2006 diff --git a/languages/cpp/app_templates/qt4makeapp/application.qrc b/languages/cpp/app_templates/qt4makeapp/application.qrc new file mode 100644 index 00000000..c35b0695 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/application.qrc @@ -0,0 +1,10 @@ + + + editcopy.xpm + editcut.xpm + filenew.xpm + fileopen.xpm + editpaste.xpm + filesave.xpm + + \ No newline at end of file diff --git a/languages/cpp/app_templates/qt4makeapp/editcopy.xpm b/languages/cpp/app_templates/qt4makeapp/editcopy.xpm new file mode 100644 index 00000000..8350ed0e --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/editcopy.xpm @@ -0,0 +1,193 @@ +/* XPM */ +static char *editcopy[] = { +/* columns rows colors chars-per-pixel */ +"32 32 155 2", +" c black", +". c #191000", +"X c #221700", +"o c #2E2300", +"O c #452E00", +"+ c #433200", +"@ c #493000", +"# c #553800", +"$ c #5D4600", +"% c #6B5000", +"& c #724B00", +"* c #7D5E00", +"= c #6E694F", +"- c #7E795F", +"; c #865900", +": c #8A5C00", +"> c #8B6800", +", c #936200", +"< c #926D00", +"1 c #926B1A", +"2 c #967000", +"3 c #9B721D", +"4 c #9B7625", +"5 c #9E792A", +"6 c #A47C00", +"7 c #AA7D00", +"8 c #A1761A", +"9 c #A57816", +"0 c #A4791D", +"q c #AD8200", +"w c #B28500", +"e c #AE8530", +"r c #B99626", +"t c #97906D", +"y c #B18D48", +"u c #B49049", +"i c #B89542", +"p c #BA9C4D", +"a c #BD9E52", +"s c #BFA053", +"d c #B8AE78", +"f c #BEB47E", +"g c #C49300", +"h c #C89600", +"j c #C19D2C", +"k c #C1A43F", +"l c #C09E4E", +"z c #CFB457", +"x c #C9B159", +"c c #CAB573", +"v c #D4BF7C", +"b c #FFDF62", +"n c #FFE064", +"m c #FFE16D", +"M c #FFE372", +"N c #FFE479", +"B c #A19D8E", +"V c #ABA89A", +"C c #BEB580", +"Z c #BDB488", +"A c #B8B496", +"S c #AEADAA", +"D c #B3AFA1", +"F c #BCBBB6", +"G c #BFBFB9", +"H c #C0B680", +"J c #C4BA85", +"K c #C6BD8B", +"L c #CBB589", +"P c #C8BE88", +"I c #C3BC90", +"U c #CBC18C", +"Y c #CCC493", +"T c #D7CB8C", +"R c #DAC786", +"E c #D8C789", +"W c #DAC98B", +"Q c #D0C690", +"! c #D4CA94", +"~ c #D4CC9B", +"^ c #D8CE98", +"/ c #DCD29C", +"( c #C6C3B7", +") c #C8C6BE", +"_ c #D5C5A5", +"` c #DBC8A1", +"' c #DBD4A2", +"] c #DED9AE", +"[ c #D9D5B1", +"{ c #E0CC82", +"} c #E8D98B", +"| c #E8D991", +" . c #E1D7A1", +".. c #E5DBA5", +"X. c #E4DCAB", +"o. c #E8DDAA", +"O. c #E1DCB2", +"+. c #E1DCB8", +"@. c #FFE683", +"#. c #FFE78A", +"$. c #FFE885", +"%. c #FFE88D", +"&. c #FFE992", +"*. c #FFEC9D", +"=. c #FFF09F", +"-. c #ECE2AC", +";. c #E5E0B6", +":. c #E5E1B8", +">. c #EBE4B6", +",. c #EAE5BC", +"<. c #F0E5A8", +"1. c #FFEDA3", +"2. c #FFEDA9", +"3. c #F1E8B8", +"4. c #FFEFB1", +"5. c #FFF1A5", +"6. c #FFF2AD", +"7. c #FFF2B4", +"8. c #FFF2BC", +"9. c #CAC8C2", +"0. c #D6D4CB", +"q. c #DFDAC5", +"w. c #D4D2D0", +"e. c #E0D7C5", +"r. c #E4DAC3", +"t. c #E8DEC7", +"y. c #E0DFD3", +"u. c #E6E2C2", +"i. c #E8E1C5", +"p. c #EBE3CB", +"a. c #EEE9C2", +"s. c #E8E6DC", +"d. c #F3EDC3", +"f. c #F2EDCB", +"g. c #F7F2CD", +"h. c #FFF3C3", +"j. c #FFF4CA", +"k. c #FFF8C5", +"l. c #FFF8CD", +"z. c #FDF5D2", +"x. c #FFF7D8", +"c. c #FFF9D4", +"v. c #FFF9DC", +"b. c #E9E8E7", +"n. c #F3EFE3", +"m. c #F2F0E3", +"M. c #F4F2EA", +"N. c #FBF7E6", +"B. c #FEF9E3", +"V. c #FFFBEC", +"C. c #F4F4F3", +"Z. c #F8F7F6", +"A. c #FEFCF4", +"S. c #FEFEFC", +"D. c None", +/* pixels */ +"D.D.D.D.D.D.D.D.D.D.D.D.h g g g g g g g g g g w * D.D.D.D.D.", +"D.D.D.D.D.D.D.D.D.D.D.D.g z.z.g.g.g.g.g.g.z.g.R 2 D.D.D.D.D.", +"D.D.D.D.D.D.D.D.D.D.D.D.g z.d.3.3.3.3.3.3.>.f.g.z < D.D.D.D.", +"D.D.D.D.D., : ; , : : : 7 a i a R -.-.-.-.' m.u.g.j > D.D.D.", +"D.D.D.D., u y y L L L L ` t.t.e.e v -.-.-.Y b.S.+.d.q D.D.D.", +"D.D.D.D., S.S.S.S.S.S.S.S.Z.b.S.e.i W o.o.K w.S.A.u.q D.D.D.", +"D.D.D.D., S.S.S.A.S.S.S.S.M.w.S.S._ a E ..K 0.S.S.q.7 D.D.D.", +"D.D.D.D., S.A.V.A.A.A.V.A.n.9.S.S.C._ a ..Y t = - A 6 D.D.D.", +"D.D.D.D., A.A.V.A.V.V.V.A.n.9.S.S.S.Z.3 ' ' K Z A ] 7 D.D.D.", +"D.D.D.D., A.V.B.V.V.B.V.V.n.( F S S G 5 ' | / / X.f.q D.D.D.", +"D.D.D.D., A.V.x.B.x.V.B.N.B.e.D B V ) 3 / / ^ ^ ' a.q D.D.D.", +"D.D.D.D., V.N.N.B.B.B.v.v.N.z.p.i.p.n.8 ^ / ! Q ' a.q D.D.D.", +"D.D.D.D., B.B.x.v.x.z.j.j.x.z.z.c.B.B.0 ! ! ! ^ ' ,.q D.D.D.", +"D.D.D.D., B.h.h.z.z.x.x.z.z.z.h.j.x.v.0 ! Q Y ! ~ ,.q D.D.D.", +"D.D.D.D., v.c.k.x.h.j.j.j.z.8.h.k.j.v.0 U T U U ~ ,.q D.D.D.", +"D.D.D.D., v.k.z.h.h.h.j.8.j.h.h.j.k.v.0 U U U U Y ;.q D.D.D.", +"D.D.D.D., x.h.8.8.h.j.8.8.4.h.4.8.h.x.8 P H P P ~ ;.q D.D.D.", +"D.D.D.D., v.h.4.4.8.8.4.1.z.h.8.4.h.c.8 H J H J Y ;.q D.D.D.", +"D.D.D.D., c.2.z.j.4.*.1.1.8.2.2.*.2.l.8 J J H J U ] q D.D.D.", +"D.D.D.D., l.h.2.4.4.1.%.1.&.2.4.8.7.k.8 f d f H U ] q D.D.D.", +"D.D.D.D., z.8.#.1.4.1.*.1.1.1.*.N 4.l.8 f f C K ~ :.q D.D.D.", +"D.D.D.D., 8.&.4.#.%.4.&.@.#.%.%.&.2.l.8 K K Y ~ ] ,.6 D.D.D.", +"D.D.D.D., h.&.#.*.1.1.%.N N #.&.*.1.l.0 ' ] T x r 6 % D.D.D.", +"D.D.D.D., 4.4.%.*.#.b &.N M b M 2.1.k.9 k 7 > $ o D.D.D.", +"D.D.D.D., 7.&.N 5.&.N @.*.b N M N =.k., + D.D.D.", +"D.D.D.D., 6.N N M M &.#.N 2.$.%.8.6.<.& D.D.D.D.D.", +"D.D.D.D., 5.&.7.n $.m M 1.7.7.o.c 5 & @ D.D.D.D.D.D.D.D.D.", +"D.D.D.D., 7.*.m %.=.&.7.} p 1 % # X D.D.D.D.D.D.D.D.D.D.", +"D.D.D.D., 6.5.5.5.| a 1 & + . D.D.D.D.D.D.D.D.D.D.", +"D.D.D.D., 6.-.a 1 & O . D.D.D.D.D.D.D.D.D.D.D.D.", +"D.D.D.D.; : % O . D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.", +"D.D.D.D. D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D." +}; diff --git a/languages/cpp/app_templates/qt4makeapp/editcut.xpm b/languages/cpp/app_templates/qt4makeapp/editcut.xpm new file mode 100644 index 00000000..9a118931 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/editcut.xpm @@ -0,0 +1,252 @@ +/* XPM */ +static char *editcut[] = { +/* columns rows colors chars-per-pixel */ +"32 32 214 2", +" c #000000", +". c #0B0B0B", +"X c #181300", +"o c #1D190B", +"O c #131313", +"+ c #1B1B1B", +"@ c #211E11", +"# c #26231A", +"$ c #2A2513", +"% c #2E2912", +"& c #2E2A19", +"* c #372E0B", +"= c #302A12", +"- c #312C1B", +"; c #3A320F", +": c #3C3415", +"> c #3C351B", +", c #232323", +"< c #2B2922", +"1 c #2C2C2C", +"2 c #302E26", +"3 c #353120", +"4 c #3F3B2D", +"5 c #313131", +"6 c #3A3A3A", +"7 c #423814", +"8 c #493E17", +"9 c #413D2F", +"0 c #423F32", +"q c #4F4319", +"w c #5C4A00", +"e c #5F4F0D", +"r c #514410", +"t c #554813", +"y c #4E472C", +"u c #444136", +"i c #4A483F", +"p c #534B2B", +"a c #504B37", +"s c #514C3A", +"d c #654F04", +"f c #604F0B", +"g c #665200", +"h c #675509", +"j c #6B5405", +"k c #6C5807", +"l c #6C590B", +"z c #745B04", +"x c #715D0A", +"c c #7B5B02", +"v c #625B3B", +"b c #7E6815", +"n c #6C643E", +"m c #4D4B42", +"M c #494949", +"N c #504D43", +"B c #54534C", +"V c #515151", +"C c #5D5B54", +"Z c #656048", +"A c #736A44", +"S c #726C54", +"D c #77725B", +"F c #696968", +"G c gray50", +"H c #826203", +"J c #806609", +"K c #836907", +"L c #8D6A03", +"P c #9A6F00", +"I c #9B7005", +"U c #9E730E", +"Y c #9C7511", +"T c #85732C", +"R c #88783B", +"E c #AE7C00", +"W c #A87B13", +"Q c #847B53", +"! c #827D64", +"~ c #9C862E", +"^ c #A98A1F", +"/ c #B28D0A", +"( c #B88D00", +") c #B2821A", +"_ c #B18E1B", +"` c #B3941C", +"' c #A88E2C", +"] c #A28C36", +"[ c #AE9224", +"{ c #89815E", +"} c #87826D", +"| c #858174", +" . c #888370", +".. c #8E8A7D", +"X. c #928C71", +"o. c #A28E44", +"O. c #AA9F74", +"+. c #B9A456", +"@. c #BDA85B", +"#. c #B2A068", +"$. c #C28700", +"%. c #CC8E00", +"&. c #C29A00", +"*. c #C4962F", +"=. c #CCA100", +"-. c #D6A800", +";. c #D1AC1B", +":. c #DDB31A", +">. c #D2A922", +",. c #D4AE2B", +"<. c #DBA12E", +"1. c #DBA433", +"2. c #DDB428", +"3. c #D2B23B", +"4. c #E6A200", +"5. c #E8A509", +"6. c #EAAF00", +"7. c #EFAC1E", +"8. c #F5A100", +"9. c #FFAD02", +"0. c #FCAF0D", +"q. c #FCB005", +"w. c #FFB60C", +"e. c #FFBD00", +"r. c #FFBD16", +"t. c #E3B432", +"y. c #E8BF3C", +"u. c #F6BE2F", +"i. c #C6A949", +"p. c #D9A948", +"a. c #D8AB52", +"s. c #DBBA45", +"d. c #C5B162", +"f. c #ECB74D", +"g. c #EFB841", +"h. c #EFBE4A", +"j. c #EABA55", +"k. c #FDC006", +"l. c #FFC10B", +"z. c #FFC800", +"x. c #FFC90D", +"c. c #FAC113", +"v. c #FBC11C", +"b. c #FDC910", +"n. c #EDC233", +"m. c #F5C32D", +"M. c #FFC728", +"N. c #F4C537", +"B. c #F6C63A", +"V. c #F5CB36", +"C. c #FFD73D", +"Z. c #E9C659", +"A. c #EAC85A", +"S. c #FFDA4B", +"D. c #FFDD5D", +"F. c #E9CD6B", +"G. c #FFD560", +"H. c #FFE06C", +"J. c gray56", +"K. c #959595", +"L. c gray62", +"P. c #A6A18A", +"I. c #A8A69E", +"U. c #AEA895", +"Y. c #B3AC8F", +"T. c #B8AF8B", +"R. c #B4AD96", +"E. c #B8B199", +"W. c #A4A4A4", +"Q. c #AAAAAA", +"!. c #B0ADA3", +"~. c #BBB6A3", +"^. c #B1B1B1", +"/. c #B9B9B6", +"(. c #BBBBBA", +"). c #C5BC9D", +"_. c #C2BCA2", +"`. c #C1BEB5", +"'. c #D2C38E", +"]. c #DCC78C", +"[. c #C7C0A7", +"{. c #C7C2AE", +"}. c #C7C3B2", +"|. c #C5C2B8", +" X c #CAC6B6", +".X c #CBC9BE", +"XX c #D9D3BB", +"oX c #E6D08A", +"OX c #E7DEBD", +"+X c #ECDEB3", +"@X c #FFF0B9", +"#X c #C5C5C5", +"$X c #CECCC7", +"%X c #D0CEC5", +"&X c #D0CFC8", +"*X c #D2D1CB", +"=X c #DBD6C5", +"-X c #DBD7C9", +";X c #D3D3D1", +":X c #DBDBDB", +">X c #E5E1D6", +",X c #E5E3DA", +".9.U r . . , T B.*.x qX + , Q !.Q. . + 1 [ m.p.k . qXqXqXqX , u O.W.;X! + ", +"4 8.j.` p 5 y ;.u.a.d % qXqXqXqXqXqX O , A P._., ", +"1 x <.f.m.x.b.y.a.g ; qXqXqXqXqXqXqXqX + 0 v O ", +" - h c W W W W z : qXqXqXqXqXqXqXqXqXqX . . ", +" * e l l f X qXqXqXqXqXqXqXqXqXqXqXqXqX ", +"qX qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX qX", +"qXqXqX qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX", +"qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX", +"qXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqXqX" +}; diff --git a/languages/cpp/app_templates/qt4makeapp/editpaste.xpm b/languages/cpp/app_templates/qt4makeapp/editpaste.xpm new file mode 100644 index 00000000..c29ad36b --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/editpaste.xpm @@ -0,0 +1,295 @@ +/* XPM */ +static char *editpaste[] = { +/* columns rows colors chars-per-pixel */ +"32 32 257 2", +" c black", +". c #0D0900", +"X c #191000", +"o c #221700", +"O c #2A1B00", +"+ c #332200", +"@ c #3E2900", +"# c #3A2804", +"$ c #4D3300", +"% c #4B3E15", +"& c #44391B", +"* c #543800", +"= c #5A3B00", +"- c #4D4015", +"; c #524E25", +": c #5A4F2C", +"> c #524E3D", +", c #58562F", +"< c #53503E", +"1 c #5E623B", +"2 c #634100", +"3 c #684500", +"4 c #6E4900", +"5 c #614F11", +"6 c #685416", +"7 c #734C00", +"8 c #784F00", +"9 c #755B00", +"0 c #7C5200", +"q c #7C5A00", +"w c #7B570F", +"e c #69562F", +"r c #786600", +"t c #7F6A00", +"y c #766300", +"u c #60613F", +"i c #7C6422", +"p c #545143", +"a c #54524B", +"s c gray32", +"d c #5D5D57", +"f c #616641", +"g c #67695D", +"h c #6B734D", +"j c #6C7553", +"k c #616261", +"l c #686A64", +"z c #6B7162", +"x c #727272", +"c c #003DFF", +"v c #0043FF", +"b c #004BFF", +"n c #0053FF", +"m c #015AFF", +"M c #0063FF", +"N c #046DFF", +"B c #0865FF", +"V c #0378FF", +"C c #1663FF", +"Z c #1576FF", +"A c #2678FF", +"S c #6F7B84", +"D c #77856D", +"F c #7B8B75", +"G c #0083FF", +"H c #0197FF", +"J c #0B92FF", +"K c #1385FF", +"L c #01A5FF", +"P c #0DB5FF", +"I c #3096FF", +"U c #2DADFF", +"Y c #2FBCFF", +"T c #22C6FF", +"R c #2AC5FF", +"E c #30D0FF", +"W c #38D5FF", +"Q c #4493F1", +"! c #5F83FF", +"~ c #5F8AFF", +"^ c #5290E4", +"/ c #5F92FF", +"( c #4CAAFE", +") c #40B8FF", +"_ c #779DCB", +"` c #6693E2", +"' c #6290FF", +"] c #649DFF", +"[ c #71A6E5", +"{ c #79A4FF", +"} c #7FB3FF", +"| c #68B8F3", +" . c #42DCFF", +".. c #47E0FF", +"X. c #58E9FF", +"o. c #64C0EB", +"O. c #6ADFEF", +"+. c #825600", +"@. c #845A00", +"#. c #8B5C00", +"$. c #905F00", +"%. c #8C6103", +"&. c #876807", +"*. c #8A6111", +"=. c #886E1B", +"-. c #887600", +";. c #8C7A00", +":. c #936200", +">. c #986800", +",. c #926C22", +"<. c #987A3F", +"1. c #A07200", +"2. c #A27511", +"3. c #A97D15", +"4. c #A77B14", +"5. c #998712", +"6. c #A68000", +"7. c #A78F00", +"8. c #AD8016", +"9. c #AC9600", +"0. c #BB8F00", +"q. c #A99B2A", +"w. c #B9A000", +"e. c #B3A63C", +"r. c #958D43", +"t. c #988F44", +"y. c #9A9346", +"u. c #9F9948", +"i. c #8B897C", +"p. c #958F6F", +"a. c #98937B", +"s. c #A68443", +"d. c #B08C41", +"f. c #AF9462", +"g. c #B39864", +"h. c #B2A850", +"j. c #BDB355", +"k. c #C3972F", +"l. c #C5A400", +"z. c #CCAC00", +"x. c #D7BB00", +"c. c #CCA030", +"v. c #CBB43E", +"b. c #E4AD0C", +"n. c #ECB600", +"m. c #EDB900", +"M. c #F2BB00", +"N. c #C1B84C", +"B. c #C1B757", +"V. c #C5BB58", +"C. c #C9BE5A", +"Z. c #C2A978", +"A. c #DFC000", +"S. c #FDCB00", +"D. c #F6C300", +"F. c #FFD100", +"G. c #FEDB00", +"H. c #FFDF0E", +"J. c #F5D500", +"K. c #FBCD39", +"L. c #FFE832", +"P. c #FFE432", +"I. c #CEC25C", +"U. c #D7C648", +"Y. c #DDC74B", +"T. c #D0C55E", +"R. c #D3C85F", +"E. c #D5C960", +"W. c #DDD264", +"Q. c #E0CA4C", +"!. c #E7D14E", +"~. c #EFDA51", +"^. c #F4D050", +"/. c #F9D452", +"(. c #FEDD53", +"). c #E2D765", +"_. c #E9DD69", +"`. c #E6DD68", +"'. c #FDDB6E", +"]. c #FFEE4F", +"[. c #FEE354", +"{. c #FEEA55", +"}. c #F7E153", +"|. c #FFF056", +" X c #ECE16A", +".X c #F1E56D", +"XX c #F7EA6F", +"oX c #F7EB70", +"OX c #F9EC70", +"+X c #FEF372", +"@X c #979486", +"#X c gray60", +"$X c #969596", +"%X c #8AA193", +"&X c #82A89B", +"*X c #8CAEA3", +"=X c #86A7A9", +"-X c #8BA2B1", +";X c #ACA580", +":X c #A5A291", +">X c #B3AF98", +",X c #B8B7AF", +".k.c.6 FXkXkXkXDXkXkXkXx i b.>.+ YXYXYXYXYXYXYXYXYXYX", +"YXYXYX:.'.K.=.hX1X1X1X1X1X1X1Xd &.0.%.* 7 #.#.:.$.#.2 YXYXYX", +"YXYXYX:./.M.%.$Xk k d s s s e w >.2.d.s.Z.9XrXlXxX0X7 YXYXYX", +"YXYXYX:.^.M.1.: % % - % 5 6 &.GXIXIXPXPXPXPXPXLXIXIXg.3 YXYX", +"YXYX#X:.^.m.v.y.r.r.r.r.h.h.2.IXPXPXKXKXPXKXHXxXUXIXIXf.4 YX", +"YXYX#X:.^.m.Y.I.B.j.j.j.V.I.4.PXKXJXKXJXKXKXmXjXFXIXIXUX+. YX", +"YXYX#X:.^.m.Y.E.I.j.j.j.I.R.8.PXKXSXJXJXJXSXnXeXDXIXIXUX<. YX", +"YXYXYX:./.M.!.W.R.I.T.R.E.W.8.UXJXJXSXSXSXSXnXeX:X@Xi.X@X@X,X4 ", +"YXYXYX:.(.S.}..X X X X X X X8.PXSXAXAXAXAXAXNXzXpXwXwXjX7 ", +"YXYXYX:.(.S.[.OXOXOXoXoXt.; O s a p p p p a.AXMXvXaXzXGX+. ", +"YXYXYX:.(.S.[.+X+X+XOX+X; 7X2X] / / ~ ! 2Xp MXNXNXNXSXKX+. YX", +"YXYXYX:.(.F.|.+X+X+X+X+Xy., _ A m b v c ! p MXMXgXMXAXKX+. YX", +"YXYXYX:.(.F.|.+X+X+X+X+X+Xj.& ^ B n b v ' < gXMXgXgXNXKX+. YX", +"YXYXYX:.(.F.U.W.+X+X+X+X).y.g Q N m n b ~ < gXgXgXgXAXJXq YX", +"YXYXYX:.[.l.j j y.I.j.r.1 =X( K N M m b ~ < gXgXgXgXNXKX+. YX", +"YXYXYX:.[.t 5X4X&XD F =X| U J G V Z A C / < fXgXgXgXMXHX+. YX", +"YXYXYX:.[.l.h 3XX...W T P L H K I [ S ` { < fXfXfXfXMXKX+. YX", +"YXYXYX:.[.G.e.1 *XO...E R Y Y | -Xd Z.k 6X> fXfXfXfXBXJX+. YX", +"YXYXYX:.[.G.{.`.u.1 F &X*X%Xz l a.uXfXp.> p.sXsXsXfXBXJX+. YX", +"YXYXYX:.{.G.|.+X+X XN.q.5.7.q cXvXsXsXsXsXsXsXsXsXsXBXKX+. YX", +"YXYXYX:.|.G.].|.L.H.G.G.G.A.1.JXvXsXsXsXsXsXsXsXfXdXCXPX+. YX", +"YXYXYX:.{.G.G.G.G.G.x.w.;.t :.HXdXsXsXsXsXsXdXvXBXZXLXtX= YX", +"YXYXYX:.{.G.J.x.9.;.r 9 q 0 #.KXvXsXaXsXvXBXCXHXiXg.*.= O YX", +"YXYXYX:.L.9.-.y 9 q 0 = + #.HXbXdXbXVXZXcX8X,.3 $ . YX", +"YXYXYX%.z.9 q 7 * o $.PXZXmXmX0Xs.0 $ X YX", +"YXYXYX8 0 = o :.IXpXg.*.= O YXYXYXYX", +"YXYXYX YXYX@.#.2 @ . YXYXYXYXYXYX", +"YXYXYX YXYXYXYXYX YXYXYXYXYXYXYXYXYX", +"YXYXYXYXYXYXYXYXYXYXYXYXYXYX YXYXYXYXYXYXYXYXYXYXYXYX" +}; diff --git a/languages/cpp/app_templates/qt4makeapp/filenew.xpm b/languages/cpp/app_templates/qt4makeapp/filenew.xpm new file mode 100644 index 00000000..85efceb2 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/filenew.xpm @@ -0,0 +1,216 @@ +/* XPM */ +static char *filenew[] = { +/* columns rows colors chars-per-pixel */ +"32 32 178 2", +" c black", +". c #191000", +"X c #221700", +"o c #452E00", +"O c #4A3100", +"+ c #4E3400", +"@ c #553800", +"# c #604000", +"$ c #6A4600", +"% c #6D4800", +"& c #704A00", +"* c #724C00", +"= c #744C00", +"- c #764E00", +"; c #785000", +": c #805500", +"> c #815500", +", c #835700", +"< c #865900", +"1 c #875A00", +"2 c #8A5B00", +"3 c #8A5C00", +"4 c #8B5C00", +"5 c #8C5D00", +"6 c #8D5D00", +"7 c #8F5E00", +"8 c #805911", +"9 c #905F00", +"0 c #906000", +"q c #926000", +"w c #946200", +"e c #956300", +"r c #966400", +"t c #976400", +"y c #956913", +"u c #926C22", +"i c #9B7732", +"p c #B18D48", +"a c #B28E49", +"s c #B4904A", +"d c #BAA373", +"f c #A1A195", +"g c #ABAB9F", +"h c #ADADAB", +"j c #AFAFAB", +"k c #B3B3A6", +"l c #BCBCB8", +"z c #BFBFBC", +"x c #CBB489", +"c c #CBB58A", +"v c #CDB78B", +"b c #CAB891", +"n c #C9BB9E", +"m c #CEBEA2", +"M c #C6C6BC", +"N c #D9C8A8", +"B c #E8E1BA", +"V c #E8E1BB", +"C c #FEFFA1", +"Z c #FFFFA0", +"A c #FEFFA3", +"S c #FEFFA4", +"D c #FEFFA6", +"F c #FEFFA8", +"G c #FEFFA9", +"H c #FFFFA8", +"J c #FEFFAA", +"K c #FEFFAB", +"L c #FFFFAB", +"P c #FEFFAC", +"I c #FFFFAC", +"U c #FEFFAE", +"Y c #FEFFAF", +"T c #FEFFB0", +"R c #FEFFB1", +"E c #FFFFB0", +"W c #FEFFB4", +"Q c #FEFFB5", +"! c #FFFFB4", +"~ c #FEFFB8", +"^ c #FEFFB9", +"/ c #FFFFB8", +"( c #FFFFB9", +") c #FEFFBB", +"_ c #FFFFBA", +"` c #FEFFBD", +"' c #FFFFBD", +"] c #FEFFBE", +"[ c #FFFFBE", +"{ c #C8C8C1", +"} c #CACAC4", +"| c #CBCBC6", +" . c #DBD2C1", +".. c #DEDFCF", +"X. c #D4D4D1", +"o. c #E1D5C1", +"O. c #E3D9C3", +"+. c #E5DCCC", +"@. c #E8E8D3", +"#. c #ECECD7", +"$. c #F0EBDA", +"%. c #FEFFC2", +"&. c #FEFFC3", +"*. c #FFFFC2", +"=. c #FEFFC7", +"-. c #FFFFC7", +";. c #FEFFCB", +":. c #FEFFCC", +">. c #FFFFCC", +",. c #FEFFCE", +"<. c #FEFFD0", +"1. c #FEFFD1", +"2. c #FFFFD0", +"3. c #FFFFD1", +"4. c #FFFFD3", +"5. c #FEFFD5", +"6. c #FFFFD5", +"7. c #FEFFD6", +"8. c #FEFFD7", +"9. c #FFFFD6", +"0. c #FFFFD8", +"q. c #FEFFDA", +"w. c #FFFFDA", +"e. c #FFFFDB", +"r. c #FFFFDC", +"t. c #FEFFDE", +"y. c #FEFFDF", +"u. c #FFFFDE", +"i. c #FFFFDF", +"p. c #E9E9E7", +"a. c #F3F3E9", +"s. c #F3F3EB", +"d. c #F5F5E8", +"f. c #F8F8E3", +"g. c #FEFFE0", +"h. c LightYellow", +"j. c #FFFFE1", +"k. c #FEFFE3", +"l. c #FFFFE3", +"z. c #FDFEE7", +"x. c #FEFFE4", +"c. c #FEFFE5", +"v. c #FFFFE4", +"b. c #FBFBE9", +"n. c #FEFFE8", +"m. c #FFFFE8", +"M. c #FFFFE9", +"N. c #FFFFEA", +"B. c #FEFFEC", +"V. c #FEFFED", +"C. c #FFFFEC", +"Z. c #FFFFED", +"A. c #FEFFEF", +"S. c #F4F4F0", +"D. c #F4F4F3", +"F. c #F5F5F4", +"G. c #F8F8F6", +"H. c ivory", +"J. c #FFFFF1", +"K. c #FEFFF3", +"L. c #FFFFF3", +"P. c #FEFFF4", +"I. c #FFFFF4", +"U. c #FEFFF7", +"Y. c #FFFFF6", +"T. c #FFFFF7", +"R. c #FBFBFB", +"E. c #FFFFF8", +"W. c #FFFFF9", +"Q. c #FFFFFA", +"!. c #FFFFFB", +"~. c gray99", +"^. c #FEFFFD", +"/. c #FFFFFC", +"(. c #FFFFFD", +"). c #FFFFFE", +"_. c gray100", +"`. c None", +/* pixels */ +"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.`.w 2 1 w 4 4 4 6 w 9 6 - `.`.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.r s p p c c c c N O.+.o.y # `.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.r ).).).).).).).).F.p.). .& o `.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w ).E.).E.).E.E.E.S.X.).R.n $ + `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w E.Y.Y.E.Y.E.E.E.a.| ).).D.m % `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w E.Y.Y.J.Y.J.Y.Y.a.| ).).).D.> `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w Y.J.J.J.J.J.J.J.a.M l h h { ; `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w Y.B.B.B.N.N.B.B.b...k f h } ; `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w J.N.N.N.N.N.N.N.l.f.#.@.#.a.> `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w J.l.l.l.l.l.l.l.l.l.l.l.l.J.> `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w J.r.l.l.r.l.r.l.r.l.r.l.r.J.1 `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w B.r.r.q.q.q.q.q.q.r.q.q.r.B.> `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w N.5.5.5.5.q.5.5.5.5.5.5.5.B., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w N.<.<.<.<.<.<.<.5.<.<.<.<.N., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w l.,.;.;.;.,.;.,.;.,.;.;.;.l., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w l.-.-.-.-.-.-.;.-.-.-.-.;.l.> `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w l.-.%.%.%.%.%.%.%.%.%.%.%.l., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w r.' ' ' ' ' ) ' ' ' ' ' ' r., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w r.) ) W ) ) ) ) ) ) W ) ) q., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w q.W W W W W W W W W W W W q., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w 5.Y Y W Y Y Y Y Y Y Y Y Y 5., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w 5.J J J Y J Y Y J Y J J Y q., `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w 5.J J D J J D J D J W ) ,.$.- `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w <.Z D D Z D J Y ' ,.B b i - O `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w <.Z Z Z Y ) <.B d u & @ X `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w ,.J ) ,.B d y & o . `.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.w Y.V d u & o . `.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`.1 4 & o . `.`.`.`.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`. `.`.`.`.`.`.`.`.`.`.`.`.`.`.", +"`.`.`.`.`.`.`.`. `.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`." +}; diff --git a/languages/cpp/app_templates/qt4makeapp/fileopen.xpm b/languages/cpp/app_templates/qt4makeapp/fileopen.xpm new file mode 100644 index 00000000..a6c33b62 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/fileopen.xpm @@ -0,0 +1,295 @@ +/* XPM */ +static char *fileopen[] = { +/* columns rows colors chars-per-pixel */ +"32 32 257 2", +" c black", +". c #0B0900", +"X c #130E00", +"o c #161100", +"O c #231A00", +"+ c #352600", +"@ c #3B311C", +"# c #433100", +"$ c #4F3B00", +"% c #4A3E16", +"& c #4A3D22", +"* c #4D421A", +"= c #54420D", +"- c #4E4529", +"; c #484338", +": c #484233", +"> c #5B4B24", +", c #624500", +"< c #674D00", +"1 c #6D4D00", +"2 c #6E4F17", +"3 c #6D5200", +"4 c #775500", +"5 c #745B0F", +"6 c #795200", +"7 c #7A5A00", +"8 c #715C18", +"9 c #764B0A", +"0 c #6C5423", +"q c #6D592E", +"w c #785E27", +"e c #735626", +"r c #665736", +"t c #7A631D", +"y c #7A672E", +"u c #776535", +"i c #5C5956", +"p c #78704F", +"a c #75726E", +"s c #8D4F00", +"d c #815700", +"f c #835A00", +"g c #8A5C00", +"h c #866400", +"j c #966100", +"k c #956F00", +"l c #9C6100", +"z c #9D7500", +"x c #856B2A", +"c c #8C752A", +"v c #8C723B", +"b c #977939", +"n c #A45D00", +"m c #A26100", +"M c #AA680D", +"N c #AB6700", +"B c #A07700", +"V c #A57B00", +"C c #AB7A00", +"Z c #AA7300", +"A c #AF721A", +"S c #B87E00", +"D c #B57B00", +"F c #B0731A", +"G c #B47C26", +"H c #B77E28", +"J c #897F59", +"K c #977C40", +"L c #927F58", +"P c #807A6C", +"I c #9C821D", +"U c #9F8A35", +"Y c #AC8000", +"T c #B28500", +"R c #B68800", +"E c #BB8B00", +"W c #A78337", +"Q c #A28B31", +"! c #AF9535", +"~ c #B58E3A", +"^ c #B88633", +"/ c #B49936", +"( c #BCA039", +") c #998445", +"_ c #978657", +"` c #8B8264", +"' c #8E8572", +"] c #978864", +"[ c #978C75", +"{ c #9F9072", +"} c #A38845", +"| c #A48952", +" . c #AA965C", +".. c #A89156", +"X. c #B5934D", +"o. c #B39D45", +"O. c #B49755", +"+. c #AB984A", +"@. c #AD9A65", +"#. c #A79778", +"$. c #A59874", +"%. c #A29B7A", +"&. c #A79775", +"*. c #BDA959", +"=. c #B3A46C", +"-. c #B1A07F", +";. c #B5A97A", +":. c #BEB37B", +">. c #C49200", +",. c #C89500", +"<. c #CC9800", +"1. c #C69812", +"2. c #D2A31C", +"3. c #C2A63E", +"4. c #D7AE37", +"5. c #C29840", +"6. c #C29B4E", +"7. c #C2A641", +"8. c #C6AA43", +"9. c #C8AC45", +"0. c #CBAF49", +"q. c #CAA746", +"w. c #C4A158", +"e. c #CAA65D", +"r. c #CEA857", +"t. c #CFA95A", +"y. c #C5AC50", +"u. c #CDB14B", +"i. c #CBB358", +"p. c #CAB152", +"a. c #D2AB59", +"s. c #D1B54D", +"d. c #D4B951", +"f. c #D6BC5B", +"g. c #DDB45E", +"h. c #D9BD56", +"j. c #D2B753", +"k. c #DAAB48", +"l. c #CEAE69", +"z. c #CCAD67", +"x. c #CCB662", +"c. c #CAB26B", +"v. c #C8B66B", +"b. c #CEB775", +"n. c #CEBE7F", +"m. c #D3AD66", +"M. c #D5BE64", +"N. c #D4BF6D", +"B. c #E4B34B", +"V. c #E0B75F", +"C. c #E1B85F", +"Z. c #E4BA61", +"A. c #E9BE63", +"S. c #DDC159", +"D. c #DAC269", +"F. c #D4C176", +"G. c #D8C67F", +"H. c #E1C55D", +"J. c #EFC05D", +"K. c #F1C15E", +"L. c #E0C264", +"P. c #E5C961", +"I. c #EDC164", +"U. c #E9CD65", +"Y. c #EFD36B", +"T. c #F2C564", +"R. c #F6C868", +"E. c #F8C760", +"W. c #FBCC6A", +"Q. c #FDCB63", +"!. c #F1D56D", +"~. c #FFD06C", +"^. c #F5D972", +"/. c #FED175", +"(. c #FADE77", +"). c #E4C87A", +"_. c #FEE27C", +"`. c #8F9192", +"'. c #9A9A96", +"]. c #A79F83", +"[. c #ADA583", +"{. c #A7A399", +"}. c #BBAC86", +"|. c #BDB088", +" X c #BBB298", +".X c #A7A8A6", +"XX c #ADAEB0", +"oX c #B5B6B4", +"OX c #BABCBC", +"+X c #C6B38E", +"@X c #D3BE80", +"#X c #D0BC95", +"$X c #C6BFA6", +"%X c #C5C29D", +"&X c #D2C283", +"*X c #DAC789", +"=X c #DBCA8B", +"-X c #D5C489", +";X c #DBCD94", +":X c #D6C699", +">X c #CFC8B1", +",X c #C8C6B7", +".L.ZXyXT.K.E.wX ..XKXKXR YXYX", +"YXYXYXYXYXYXYXYXYXYXYXYX V E 4.ZXsXW.K.I.Z.O.{.KXUXUXMXk YXYX", +"YXYXYXYXYXYX R E 7 YX< E 2.aXsX6XC.T.Z.w.[ xXUXUXUXUX2X3 YXYX", +"YXYXYXYX R >.).5X,.T ,.5XCX8XK.T.A.a.] OXUXUXUXUXUXUX2.O YXYX", +"YXYX Y E Z.ZXsX7XsX0XCXyXR.K.I.V._ .XUXUXUXUXUXLXKXJXV D N S 7 ", +" z E 4.fXsX/.K.~./.6X~.I.I.C...'.KXUXPXPXPXLXKXGXbXl.N m.SXm.D ", +" E 0XgX7XE.W.W.~.~.R.I.Z.w.' bXUXUXUXPXPXLXmXbX$X) ~ aXSXpXBXn ", +" <.CXT.Q.~.W.W.R.I.A.t._ hXUXUXUXUXPXLXGXnX,X .t XAXSXeX4Xl.Z ", +" <.sXB.W.W.W.T.A.g._ oXUXUXUXUXUXLXLXmXcX=.5 $.BXgXeX!.D.3Xm + ", +" <.sXB.R.R.A.V.| {.KXUXUXUXUXLXKXGXvX|.c u qXdXgX^.U.f.3XH f ", +" <.sXB.T.Z.m.[ nXUXUXUXUXPXKXHXbX,X) e X) y >XAXAX_.S.h.h.u.s.d.F.6.g YX", +" >.9X~ } u '.LXKXmXxX .5 [.IXAX_.!.S.h.h.d.8.s.D.n.j YXYX", +" >.:XW v & kXmXvX;.t ] BXAXrX!.U.u.S.9.u.3.7.i.;XM 1 YXYXYX", +" E #Xb u : nXcX_ u 1XSXgX^.U.H.S.d.8.s.d.u.b.-XG g YXYXYXYX", +" R +Xc r a zX[.= -XdX_.U.d.P.h.d.u.3.8.N.=Xw.l 1 YXYXYXYX", +" T }.x > `.oX> %.*.S.S.h.S.7.d.h.0.p.n.c.M d . YXYXYXYXYX", +" C ].w @ XXu p *.( h.S.s.u.u.u.p.N.*X^ g + YXYXYXYXYXYX", +" Z &.e ; ` * :.o.S.S.S.u.( 9.x.&XX.j , YXYXYXYXYXYX", +" B { 0 i % [.o.u.S.d.h.9.M.&Xz.M 6 YXYXYXYXYXYXYXYX", +" z { 0 - J *./ S.9.d.i.G.&XF g O YXYXYXYXYXYXYXYXYXYX", +" z $.2 w =.! s.d.p.N.;X^ l , YXYXYXYXYXYXYXYXYXYXYX", +" B &.9 ;.Q / j.x.@Xl.m 6 YXYXYXYXYXYXYXYXYXYXYXYXYX", +" h W @.+.I y.&Xb.F 7 O YXYXYXYXYXYXYXYXYXYXYXYXYXYXYX", +" $ s %XU F.=X^ j # YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX", +" g O. c #23224B", +", c #262353", +"< c #292655", +"1 c #2B2C54", +"2 c #2C2C5B", +"3 c #293746", +"4 c #2D304F", +"5 c #243243", +"6 c #2E315D", +"7 c #363647", +"8 c #303E4A", +"9 c #30325E", +"0 c #3C3C53", +"q c #2E2E60", +"w c #2F3160", +"e c #302E63", +"r c #313164", +"t c #363861", +"y c #353868", +"u c #384650", +"i c #284F6B", +"p c #2D547B", +"a c #3B486A", +"s c #36597D", +"d c #3D5D7C", +"f c #4C4C4C", +"g c #40405A", +"h c #414E56", +"j c #4B585E", +"k c #49545E", +"l c #555555", +"z c #4D4D6B", +"x c #434675", +"c c #4B5660", +"v c #4F5962", +"b c #41517E", +"n c #4B507D", +"m c #515C67", +"M c #505D6E", +"N c #5C5D7D", +"B c #546066", +"V c #54626D", +"C c #5B646D", +"Z c #55677A", +"A c #556B78", +"S c #5D6772", +"D c #6B6B6B", +"F c #646464", +"G c #616C73", +"H c #63707D", +"J c #6B7679", +"K c gray45", +"L c #00418E", +"P c #004494", +"I c #004894", +"U c #044F98", +"Y c #03509B", +"T c #0A5198", +"R c #13579C", +"E c #185DA1", +"W c #285888", +"Q c #2B6094", +"! c #396D9A", +"~ c #336A96", +"^ c #3D719B", +"/ c #226EB8", +"( c #326EA8", +") c #326BA3", +"_ c #3673AE", +"` c #3A76B4", +"' c #0B6FD1", +"] c #0F75D8", +"[ c #1479DA", +"{ c #1B7CDC", +"} c #466481", +"| c #42749C", +" . c #4A799E", +".. c #506A84", +"X. c #5F678D", +"o. c #576391", +"O. c #5A6592", +"+. c #5F6893", +"@. c #5B738B", +"#. c #507DA1", +"$. c #626283", +"%. c #636A94", +"&. c #656F98", +"*. c #657A8F", +"=. c #6B7299", +"-. c #717191", +";. c #797998", +":. c #687BA6", +">. c #2281DC", +",. c #3F81C0", +"<. c #3988D7", +"1. c #2785E1", +"2. c #2E8AE3", +"3. c #368FE5", +"4. c #3690E6", +"5. c #3D93E7", +"6. c #3D94E9", +"7. c #57839E", +"8. c #4787BC", +"9. c #5480A1", +"0. c #5B84A3", +"q. c #6E8496", +"w. c #6E8B9A", +"e. c #7D848E", +"r. c #728597", +"t. c #738598", +"y. c #768899", +"u. c #7B8B9B", +"i. c #6489A5", +"p. c #698EA7", +"a. c #6D8FA9", +"s. c #6E81AB", +"d. c #7683A6", +"f. c #768CB7", +"g. c #7395AD", +"h. c #7C96B0", +"j. c #4086CA", +"k. c #4986C3", +"l. c #4284C3", +"z. c #498ED2", +"x. c #4D95DB", +"c. c #548DC5", +"v. c #5D92C8", +"b. c #5593C9", +"n. c #5097DE", +"m. c #5198DE", +"M. c #4296E7", +"N. c #4895E2", +"B. c #4B99E5", +"V. c #4A9CEB", +"C. c #4599EB", +"Z. c #529DE6", +"A. c #589EE2", +"S. c #54A1EB", +"D. c #5AA1E6", +"F. c #5AA5EB", +"G. c #5EA8EF", +"H. c #53A3F1", +"J. c #5EAAF2", +"K. c #6699CB", +"L. c #799BC8", +"P. c #7EA6C9", +"I. c #60A2E5", +"U. c #65A7E8", +"Y. c #6BABE9", +"T. c #68ADF2", +"R. c #67B0F5", +"E. c #6DB3F6", +"W. c #70ADEA", +"Q. c #75B0E9", +"!. c #7CB5EB", +"~. c #73B9F8", +"^. c #7BBDFB", +"/. c #7CBAF6", +"(. c gray55", +"). c #828899", +"_. c #84949E", +"`. c #918E8A", +"'. c #949494", +"]. c #8F8FA9", +"[. c #8997A5", +"{. c #8A9AA9", +"}. c #9A9BAF", +"|. c #9399A9", +" X c #9FAAB5", +".X c #A29E9B", +"XX c #A7A7A7", +"oX c #ABABAB", +"OX c #A3A3B4", +"+X c #A8A8B7", +"@X c #A3ABB3", +"#X c #B4B5B5", +"$X c #B0B0BC", +"%X c #B7B9BC", +"&X c #BBB7B3", +"*X c #BBBBBB", +"=X c #82B1DB", +"-X c #81B7EC", +";X c #88BBED", +":X c #86BAED", +">X c #AEBBC8", +",X c #A6BDCD", +".U i 9 YXYX", +"YXYXYXo.2X] L C UXDXcXzXkXkXkXjXjXdXdX%X%X&X%X*XN.' ~ 6 YXYX", +"YXYXYXo.1X] P k hXoXXXXXoXoX#X#X*X%X&X%X%XdXkXxXx.[ ~ 6 YXYX", +"YXYXYXO.3X[ I m FXkXjXjXkXkXkXkXkXkXzXzXzXcXZXSXx.{ ! 6 YXYX", +"YXYXYXo.3X{ I S UXvXxXzXkXkXkXkXkXjXdX*X%X#X&X%XZ.1.^ 9 YXYX", +"YXYXYXO.4X>.U j jX#X#X#X%XdXdXkXzXkXzXzXcXvXDXJXA.1.| 6 YXYX", +"YXYXYXO.6X>.T V PXZXZXZXAXSXDXDXFXHXDXHXHXHXHXSXI.2.| 9 YXYX", +"YXYXYXO.6X2.T G UXLXDXDXAXZXZXAXZXvXcXzXkXkXkXgXY.3. .6 YXYX", +"YXYXYXO.9X4.R m zXdXdXkXzXvXAXDXHXLXPXPXIXUXUXUXQ.6. .9 YXYX", +"YXYXYXO.9X5.R H UXIXUXUXUXUXUXUXUXUXUXUXIXKXJXBX-XC.#.9 YXYX", +"YXYXYXO.eXM./ h.UXUXIXKXBXNXnXuXyXwX5X:X!.Y.Y.Y.D.H.9.6 YXYX", +"YXYXYX+.rXB.<.x.Q.;X-XQ.Y.U.U.D.Z.Z.B.B.C.V.V.B.B.T.0.9 YXYX", +"YXYXYX+.tXB.N.B.B.B.B.C.V.V.H.H.H.D.N.z.8._ ( <.D.R.0.9 YXYX", +"YXYXYX+.tXS.Z.F.D.m.z.l.` ) Q W p s } @.r.[. X>XG.E.0.9 YXYX", +"YXYXYX+.pXU.m.) p d ..*.u.|.+X @ o YXYXYXYXYXYXYXYXYXYXYXYX", +"YXYXYX YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX", +"YXYXYX YXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYXYX" +}; diff --git a/languages/cpp/app_templates/qt4makeapp/main.cpp b/languages/cpp/app_templates/qt4makeapp/main.cpp new file mode 100644 index 00000000..3416347e --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/main.cpp @@ -0,0 +1,14 @@ +%{CPP_TEMPLATE} + +#include +#include "%{APPNAMELC}.h" + +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(application); + QApplication app(argc, argv); + %{APPNAME} * mw = new %{APPNAME}(); + mw->show(); + return app.exec(); +} + diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp b/languages/cpp/app_templates/qt4makeapp/qt4makeapp new file mode 100644 index 00000000..9c856e8e --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/qt4makeapp @@ -0,0 +1,11 @@ +# QMake application +[General] +Name=Qt4/QMake Application +Name[fr]=Une Application Qt4 / QMake +Icon=qt4makeapp.png +Category=C++/QMake project +Category[fr]=C++/QMake +Comment=Generate a QMake/Qt4 based application (crossplatform compatible)- Needs Qt4 +Comment[fr]=G��e une application bas� sur Qt / QMake. Ce programme est multi platte-forme. Nécessite Qt4. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/APPNAMELC.cpp diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp.cpp b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.cpp new file mode 100644 index 00000000..af16391f --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.cpp @@ -0,0 +1,285 @@ +%{CPP_TEMPLATE} + +#include +#include "%{APPNAMELC}.h" + +#include +#include +#include +#include + +%{APPNAME}::%{APPNAME}() +{ + textEdit = new QTextEdit; + setCentralWidget(textEdit); + + createActions(); + createMenus(); + createToolBars(); + createStatusBar(); + + readSettings(); + + connect(textEdit->document(), SIGNAL(contentsChanged()), + this, SLOT(documentWasModified())); + + setCurrentFile(""); +} + +void %{APPNAME}::closeEvent(QCloseEvent *event) +{ + if (maybeSave()) { + writeSettings(); + event->accept(); + } else { + event->ignore(); + } +} + +void %{APPNAME}::newFile() +{ + if (maybeSave()) { + textEdit->clear(); + setCurrentFile(""); + } +} + +void %{APPNAME}::open() +{ + if (maybeSave()) { + QString fileName = QFileDialog::getOpenFileName(this); + if (!fileName.isEmpty()) + loadFile(fileName); + } +} + +bool %{APPNAME}::save() +{ + if (curFile.isEmpty()) { + return saveAs(); + } else { + return saveFile(curFile); + } +} + +bool %{APPNAME}::saveAs() +{ + QString fileName = QFileDialog::getSaveFileName(this); + if (fileName.isEmpty()) + return false; + + return saveFile(fileName); +} + +void %{APPNAME}::about() +{ + QMessageBox::about(this, tr("About Application"), + tr("The Application example demonstrates how to " + "write modern GUI applications using Qt, with a menu bar, " + "toolbars, and a status bar.")); +} + +void %{APPNAME}::documentWasModified() +{ + setWindowModified(true); +} + +void %{APPNAME}::createActions() +{ + newAct = new QAction(QIcon(":/filenew.xpm"), tr("&New"), this); + newAct->setShortcut(tr("Ctrl+N")); + newAct->setStatusTip(tr("Create a new file")); + connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); + + openAct = new QAction(QIcon(":/fileopen.xpm"), tr("&Open..."), this); + openAct->setShortcut(tr("Ctrl+O")); + openAct->setStatusTip(tr("Open an existing file")); + connect(openAct, SIGNAL(triggered()), this, SLOT(open())); + + saveAct = new QAction(QIcon(":/filesave.xpm"), tr("&Save"), this); + saveAct->setShortcut(tr("Ctrl+S")); + saveAct->setStatusTip(tr("Save the document to disk")); + connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); + + saveAsAct = new QAction(tr("Save &As..."), this); + saveAsAct->setStatusTip(tr("Save the document under a new name")); + connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); + + exitAct = new QAction(tr("E&xit"), this); + exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setStatusTip(tr("Exit the application")); + connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); + + cutAct = new QAction(QIcon(":/editcut.xpm"), tr("Cu&t"), this); + cutAct->setShortcut(tr("Ctrl+X")); + cutAct->setStatusTip(tr("Cut the current selection's contents to the " + "clipboard")); + connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut())); + + copyAct = new QAction(QIcon(":/editcopy.xpm"), tr("&Copy"), this); + copyAct->setShortcut(tr("Ctrl+C")); + copyAct->setStatusTip(tr("Copy the current selection's contents to the " + "clipboard")); + connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy())); + + pasteAct = new QAction(QIcon(":/editpaste.xpm"), tr("&Paste"), this); + pasteAct->setShortcut(tr("Ctrl+V")); + pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current " + "selection")); + connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste())); + + aboutAct = new QAction(tr("&About"), this); + aboutAct->setStatusTip(tr("Show the application's About box")); + connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); + + aboutQtAct = new QAction(tr("About &Qt"), this); + aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); + connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + + cutAct->setEnabled(false); + copyAct->setEnabled(false); + connect(textEdit, SIGNAL(copyAvailable(bool)), + cutAct, SLOT(setEnabled(bool))); + connect(textEdit, SIGNAL(copyAvailable(bool)), + copyAct, SLOT(setEnabled(bool))); +} + +void %{APPNAME}::createMenus() +{ + fileMenu = menuBar()->addMenu(tr("&File")); + fileMenu->addAction(newAct); + fileMenu->addAction(openAct); + fileMenu->addAction(saveAct); + fileMenu->addAction(saveAsAct); + fileMenu->addSeparator(); + fileMenu->addAction(exitAct); + + editMenu = menuBar()->addMenu(tr("&Edit")); + editMenu->addAction(cutAct); + editMenu->addAction(copyAct); + editMenu->addAction(pasteAct); + + menuBar()->addSeparator(); + + helpMenu = menuBar()->addMenu(tr("&Help")); + helpMenu->addAction(aboutAct); + helpMenu->addAction(aboutQtAct); +} + +void %{APPNAME}::createToolBars() +{ + fileToolBar = addToolBar(tr("File")); + fileToolBar->addAction(newAct); + fileToolBar->addAction(openAct); + fileToolBar->addAction(saveAct); + + editToolBar = addToolBar(tr("Edit")); + editToolBar->addAction(cutAct); + editToolBar->addAction(copyAct); + editToolBar->addAction(pasteAct); +} + +void %{APPNAME}::createStatusBar() +{ + statusBar()->showMessage(tr("Ready")); +} + +void %{APPNAME}::readSettings() +{ + QSettings settings("Trolltech", "Application Example"); + QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); + QSize size = settings.value("size", QSize(400, 400)).toSize(); + resize(size); + move(pos); +} + +void %{APPNAME}::writeSettings() +{ + QSettings settings("Trolltech", "Application Example"); + settings.setValue("pos", pos()); + settings.setValue("size", size()); +} + +bool %{APPNAME}::maybeSave() +{ + if (textEdit->document()->isModified()) { + int ret = QMessageBox::warning(this, tr("Application"), + tr("The document has been modified.\n" + "Do you want to save your changes?"), + QMessageBox::Yes | QMessageBox::Default, + QMessageBox::No, + QMessageBox::Cancel | QMessageBox::Escape); + if (ret == QMessageBox::Yes) + return save(); + else if (ret == QMessageBox::Cancel) + return false; + } + return true; +} + +void %{APPNAME}::loadFile(const QString &fileName) +{ + QFile file(fileName); + if (!file.open(QFile::ReadOnly | QFile::Text)) { + QMessageBox::warning(this, tr("Application"), + tr("Cannot read file %1:\n%2.") + .arg(fileName) + .arg(file.errorString())); + return; + } + + QTextStream in(&file); + QApplication::setOverrideCursor(Qt::WaitCursor); + textEdit->setPlainText(in.readAll()); + QApplication::restoreOverrideCursor(); + + setCurrentFile(fileName); + statusBar()->showMessage(tr("File loaded"), 2000); +} + +bool %{APPNAME}::saveFile(const QString &fileName) +{ + QFile file(fileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) { + QMessageBox::warning(this, tr("Application"), + tr("Cannot write file %1:\n%2.") + .arg(fileName) + .arg(file.errorString())); + return false; + } + + QTextStream out(&file); + QApplication::setOverrideCursor(Qt::WaitCursor); + out << textEdit->toPlainText(); + QApplication::restoreOverrideCursor(); + + setCurrentFile(fileName); + statusBar()->showMessage(tr("File saved"), 2000); + return true; +} + +void %{APPNAME}::setCurrentFile(const QString &fileName) +{ + curFile = fileName; + textEdit->document()->setModified(false); + setWindowModified(false); + + QString shownName; + if (curFile.isEmpty()) + shownName = "untitled.txt"; + else + shownName = strippedName(curFile); + + setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Application"))); +} + +QString %{APPNAME}::strippedName(const QString &fullFileName) +{ + return QFileInfo(fullFileName).fileName(); +} + +%{APPNAME}::~%{APPNAME}() +{ + +} + diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp.h b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.h new file mode 100644 index 00000000..cd470d00 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.h @@ -0,0 +1,65 @@ +%{H_TEMPLATE} + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + +#include +#include + +class QAction; +class QMenu; +class QTextEdit; + +class %{APPNAME}:public QMainWindow +{ + Q_OBJECT + +public: + %{APPNAME}(); + ~%{APPNAME}(); + +protected: + void closeEvent(QCloseEvent *event); + +private slots: + void newFile(); + void open(); + bool save(); + bool saveAs(); + void about(); + void documentWasModified(); + +private: + void createActions(); + void createMenus(); + void createToolBars(); + void createStatusBar(); + void readSettings(); + void writeSettings(); + bool maybeSave(); + void loadFile(const QString &fileName); + bool saveFile(const QString &fileName); + void setCurrentFile(const QString &fileName); + QString strippedName(const QString &fullFileName); + + QTextEdit *textEdit; + QString curFile; + + QMenu *fileMenu; + QMenu *editMenu; + QMenu *helpMenu; + QToolBar *fileToolBar; + QToolBar *editToolBar; + QAction *newAct; + QAction *openAct; + QAction *saveAct; + QAction *saveAsAct; + QAction *exitAct; + QAction *cutAct; + QAction *copyAct; + QAction *pasteAct; + QAction *aboutAct; + QAction *aboutQtAct; +}; + +#endif diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevelop b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevelop new file mode 100644 index 00000000..cd633ede --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevelop @@ -0,0 +1,113 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + true + 4 + 4 + ExternalDesigner + %{QMAKE} + %{DESIGNER} + + + + + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + + + + /usr/bin/gdb + true + false + false + + + false + true + + + + + + ./bin/%{APPNAMELC} + + + + + + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevtemplate b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevtemplate new file mode 100644 index 00000000..ff91d477 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.kdevtemplate @@ -0,0 +1,207 @@ +# KDE Config File +[General] +Name=Qt4 Application +Name[br]=Meziant Qt4 +Name[ca]=Aplicació Qt4 +Name[da]=Qt4-Program +Name[de]=Qt4-Anwendung +Name[el]=Εφαρμογή Qt4 +Name[es]=Aplicación Qt4 +Name[et]=Qt4 rakendus +Name[fr]=Application Qt4 +Name[hu]=Qt4-alapú alkalmazás +Name[it]=Applicazione Qt4 +Name[ja]=Qt4 アプリケーション +Name[nds]=Qt4-Programm +Name[nl]=Qt4-toepassing +Name[pl]=Program Qt4 +Name[pt]=Aplicação do Qt4 +Name[pt_BR]=Aplicação do Qt4 +Name[ru]=Приложение Qt 4 +Name[sk]=Qt4 aplikácia +Name[sr]=Qt4 програм +Name[sr@Latn]=Qt4 program +Name[sv]=Qt4-program +Name[zh_TW]=Qt4 應用程式 +Icon=qt4makeapp.png +Category=C++/QMake project +Category[fr]=C++/QMake +Comment=Generate a QMake/Qt4 based application (crossplatform compatible) - Needs Qt4 +Comment[ca]=Genera una aplicació basada en QMake/Qt4 (multi plataforma) -Necessita Qt4- +Comment[da]=Generér et QMake/Qt4 baseret program (krydsplatform kompatibel) - behøver Qt4 +Comment[de]=Erstellt eine auf QMake/Qt4 basierende Anwendung (plattformunabhängig). - Benötigt Qt4. +Comment[el]=Δημιουργία μια εφαρμογής βασισμένης στα QMake/Qt4 (συμβατή με πολλαπλές πλατφόρμες) +Comment[es]=Genera una aplicación basada en QMake/Qt4 (con compatibilidad multiplataforma) - Necesita Qt4 +Comment[et]=Rakenduse loomine QMake'i/Qt4 põhjal (multiplatvormne) +Comment[fr]=Génère une application basée sur QMake / Qt4 (compatible multi-plateforme) - Nécessite Qt4 +Comment[hu]=Létrehoz egy QMake/Qt4-alapú, keresztfordításra is alkalmas alkalmazást - Qt4-et igényel +Comment[it]=Genera un'applicazione basata su QMake/Qt4 (compatibile multipiattaforma) - serve Qt4 +Comment[nds]=Stellt en op QMake un Qt4 opbuut Programm op (över Bedriefümgeven weg kompatibel) - Qt4 deit noot +Comment[nl]=Genereer een Qmake/Qt4-gebaseerde toepassing (crossplatform compatible) - heeft Qt4 nodig +Comment[pl]=Generuje program używający QMake i Qt4 (wieloplatformowy) - wymaga biblioteki Qt4 +Comment[pt]=Gera uma aplicação baseada no QMake/Qt4 (compatível com várias plataformas) - Necessita do Qt4 +Comment[pt_BR]=Gera uma aplicação baseada no QMake/Qt4 (compatível com várias plataformas) - Necessita do Qt4 +Comment[ru]=Создание кроссплатформенного приложения Qt 4, использующего QMake +Comment[sk]=Vygeneruje aplikáciu založenú na QMake/Qt4 (multiplatformovo kompatibilnú) - vyžaduje Qt4 +Comment[sr]=Прави програм на основи QMake/Qt4 (прекоплатформски компатибилан) — захтева Qt4 +Comment[sr@Latn]=Pravi program na osnovi QMake/Qt4 (prekoplatformski kompatibilan) — zahteva Qt4 +Comment[sv]=Skapar ett QMake/Qt4-baserat program (fungerar på andra plattformar). Kräver Qt4. +Comment[zh_TW]=產生一個 QMake/Qt4 為基礎的應用程式(跨平台相容)─需要 Qt4 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp,%{dest}/src/ReadMe +Archive=qt4makeapp.tar.gz + +[FILE1] +Type=install +Source=%{src}/qt4makeapp.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/qt4makeapp.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE3] +Type=install +Source=%{src}/src.pro +Dest=%{dest}/src/src.pro + +[FILE4] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/src/main.cpp + +[FILE5] +Type=install +Source=%{src}/qt4makeapp.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE6] +Type=install +Source=%{src}/qt4makeapp.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE7] +Type=install +Source=%{src}/fileopen.xpm +Dest=%{dest}/src/fileopen.xpm + +[FILE8] +Type=install +Source=%{src}/filesave.xpm +Dest=%{dest}/src/filesave.xpm + +[FILE9] +Type=install +Source=%{src}/filenew.xpm +Dest=%{dest}/src/filenew.xpm + +[FILE10] +Type=install +Source=%{src}/editcopy.xpm +Dest=%{dest}/src/editcopy.xpm + +[FILE11] +Type=install +Source=%{src}/editpaste.xpm +Dest=%{dest}/src/editpaste.xpm + +[FILE12] +Type=install +Source=%{src}/editcut.xpm +Dest=%{dest}/src/editcut.xpm + +[FILE13] +Type=install +Source=%{src}/application.qrc +Dest=%{dest}/src/application.qrc + +[FILE14] +Type=install +Source=%{src}/ReadMe +Dest=%{dest}/src/ReadMe + +[MSG] +Type=message +Comment=A Qt4/Qmake based application was created in %{dest} +Comment[ca]=Una aplicació basada en Qt4/Qmake ha estat creada en %{dest} +Comment[da]=Et Qt4/Qmake baseret program blev oprettet i %{dest} +Comment[de]=Eine auf QMake/Qt4 basierende Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή βασισμένη στα Qt4/Qmake δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación basada en Qt4/Qmake ha sido creada en %{dest} +Comment[et]=Rakendus Qt4/QMake'i põhjal loodi asukohta %{dest} +Comment[fr]=Une application basée sur Qt4 / Qmake a été créée dans %{dest} +Comment[hu]=Létrejött egy Qt4/Qmake-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione basata su Qt4/Qmake in %{dest} +Comment[ja]=Qt4/QMake ベースのアプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en op Qt4 un Qmake opbuut Programm opstellt +Comment[nl]=Een Qt4/Qmake gebaseerde toepassing is aangemaakt in %{dest} +Comment[pl]=Program używający QMake i Qt4 został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação baseada no Qt4/Qmake em %{dest} +Comment[pt_BR]=Foi criada uma aplicação baseada no Qt4/Qmake em %{dest} +Comment[ru]=Приложение Qt 4, использующее Qmake, создано в %{dest} +Comment[sk]=Aplikácia založená na Qt4/Qmake bola vytvorená v %{dest} +Comment[sr]=Програм на основу Qt4/Qmake направљен је у %{dest} +Comment[sr@Latn]=Program na osnovu Qt4/Qmake napravljen je u %{dest} +Comment[sv]=Ett QMake/Qt4-baserat program skapades i %{dest} +Comment[zh_TW]=一個 QMake/Qt4 為基礎的應用程式已建立於 %{dest} + +Comment= +[QMAKE] +Type=value +ValueType=QString +Value=QMAKE +Comment=Absolute Path for QMake (Qt4). +Comment[ca]=Ruta absoluta per a QMake (Qt4). +Comment[da]=Absolut søgesti til QMake (Qt4). +Comment[de]=Absoluter Pfad für QMake (Qt4). +Comment[el]=Απόλυτη διαδρομή για το QMake (Qt4). +Comment[es]=Ruta completa para QMake (Qt4). +Comment[et]=QMake (Qt4) absoluutne asukoht. +Comment[fr]=Chemin absolu pour QMake (Qt4). +Comment[hu]=A QMake (Qt4) teljes elérési útja. +Comment[it]=Percorso assoluto per QMake (Qt4). +Comment[ja]=QMake (Qt4) の絶対パス +Comment[nds]=Afsluut Padd för QMake (Qt4) +Comment[nl]=Absoluut pad naar QMake (Qt4). +Comment[pl]=Ścieżka bezwzględna do QMake (Qt4). +Comment[pt]=Localização Absoluta do QMake (Qt4). +Comment[pt_BR]=Localização Absoluta do QMake (Qt4). +Comment[ru]=Полный путь к QMake (Qt 4). +Comment[sk]=Absolútna cesta ku QMake (Qt4). +Comment[sr]=Апсолутна путања до QMake-а (Qt4). +Comment[sr@Latn]=Apsolutna putanja do QMake-a (Qt4). +Comment[sv]=Absolut sökväg till QMake (Qt4). +Comment[zh_TW]=QMake(Qt4)的絕對路徑 +Default= +[DESIGNER] +Type=value +ValueType=QString +Value=DESIGNER +Comment=Absolute Path for Designer (Qt4). +Comment[ca]=Ruta absoluta per a Designer (Qt4). +Comment[da]=Absolut søgesti til Designer (Qt4). +Comment[de]=Absoluter Pfad für Designer (Qt4). +Comment[el]=Απόλυτη διαδρομή για τον Σχεδιαστή (Qt4). +Comment[es]=Ruta completa para Designer (Qt4). +Comment[et]=Disaineri (Qt4) absoluutne asukoht. +Comment[fr]=Chemin absolu pour Designer (Qt4). +Comment[hu]=A Designer (Qt4) teljes elérési útja +Comment[it]=Percorso assoluto del Designer (Qt4). +Comment[ja]=Designer (Qt4) の絶対パス +Comment[nds]=Afsluut Padd för Designer (Qt4) +Comment[nl]=Absoluut pad naar Designer (Qt4). +Comment[pl]=Ścieżka bezwzględna do Designera (Qt4). +Comment[pt]=Localização Absoluta do Designer (Qt4). +Comment[pt_BR]=Localização Absoluta do Designer (Qt4). +Comment[ru]=Полный путь к Designer (Qt 4). +Comment[sk]=Absolútna cesta ku Designer (Qt4). +Comment[sr]=Апсолутна путања до Designer-а (Qt4). +Comment[sr@Latn]=Apsolutna putanja do Designer-a (Qt4). +Comment[sv]=Absolut sökväg till Designer (Qt4). +Comment[zh_TW]=設計家(Qt4)的絕對路徑 +Default= diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp.png b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.png new file mode 100644 index 00000000..96a7e0bf Binary files /dev/null and b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.png differ diff --git a/languages/cpp/app_templates/qt4makeapp/qt4makeapp.pro b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.pro new file mode 100644 index 00000000..7177d225 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/qt4makeapp.pro @@ -0,0 +1,5 @@ +SUBDIRS += src +TEMPLATE = subdirs +CONFIG += warn_on \ + qt \ + thread \ No newline at end of file diff --git a/languages/cpp/app_templates/qt4makeapp/src.pro b/languages/cpp/app_templates/qt4makeapp/src.pro new file mode 100644 index 00000000..fa8baae6 --- /dev/null +++ b/languages/cpp/app_templates/qt4makeapp/src.pro @@ -0,0 +1,10 @@ +SOURCES += %{APPNAMELC}.cpp \ + main.cpp +HEADERS += %{APPNAMELC}.h +TEMPLATE = app +CONFIG += warn_on \ + thread \ + qt +TARGET = %{APPNAMELC} +DESTDIR = ../bin +RESOURCES = application.qrc diff --git a/languages/cpp/app_templates/qtopia4app/Example.png b/languages/cpp/app_templates/qtopia4app/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/qtopia4app/Example.png differ diff --git a/languages/cpp/app_templates/qtopia4app/Makefile.am b/languages/cpp/app_templates/qtopia4app/Makefile.am new file mode 100644 index 00000000..57785690 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = Example.png app.kdevelop example.desktop \ + example.html main.cpp Makefile.am app.pro example.cpp \ + example.h examplebase.ui + +templateName = qtopia4app + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + gzip -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/qtopia4app/app.kdevelop b/languages/cpp/app_templates/qtopia4app/app.kdevelop new file mode 100644 index 00000000..465fd677 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/app.kdevelop @@ -0,0 +1,163 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + libtool + + + true + false + false + + + false + true + + + + + + + + ./%{APPNAMELC} + -qws + + + + + + + + + + + true + false + 1 + false + + 0 + + + + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + + + true + 4 + 4 + /usr/lib/qt3 + ExternalDesigner + /opt/Qtopia/SDK/4.2.4/x86/bin/qtopiamake + /opt/Qtopia/SDK/4.2.4/x86/bin/designer + + + + diff --git a/languages/cpp/app_templates/qtopia4app/app.pro b/languages/cpp/app_templates/qtopia4app/app.pro new file mode 100644 index 00000000..05a0bb9c --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/app.pro @@ -0,0 +1,31 @@ +qtopia_project(qtopia app) # see buildsystem.html for more project keywords +TARGET=%{APPNAMELC} +CONFIG+=qtopia_main +CONFIG+=no_singleexec +CONFIG+=no_quicklaunch +CONFIG+=no_tr + +FORMS=%{APPNAMELC}base.ui +HEADERS=%{APPNAMELC}.h +SOURCES=main.cpp %{APPNAMELC}.cpp + +desktop.files=%{APPNAMELC}.desktop +desktop.path=/apps/Applications +desktop.hint=desktop + +pics.files=pics/* +pics.path=/pics/%{APPNAMELC} +pics.hint=pics + +help.source=help +help.files=%{APPNAME}.html +help.hint=help + +INSTALLS+=desktop pics help + +pkg.name=%{APPNAME} +pkg.desc=%{APPNAME} Application +pkg.version=1.0.0-1 +pkg.maintainer=%{AUTHOR} %{EMAIL} +pkg.license=GPL +pkg.domain=window diff --git a/languages/cpp/app_templates/qtopia4app/example.cpp b/languages/cpp/app_templates/qtopia4app/example.cpp new file mode 100644 index 00000000..a35d57cb --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/example.cpp @@ -0,0 +1,40 @@ + +#include "%{APPNAMELC}.h" +#include + +%{APPNAME}Base::%{APPNAME}Base( QWidget *parent, Qt::WFlags f ) + : QWidget( parent, f ) +{ + setupUi( this ); +} + +%{APPNAME}Base::~%{APPNAME}Base() +{ +} + +/* + * Constructs a %{APPNAME} which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +%{APPNAME}::%{APPNAME}( QWidget *parent, Qt::WFlags f ) + : %{APPNAME}Base( parent, f ) +{ + connect(quit, SIGNAL(clicked()), this, SLOT(goodBye())); +} + +/* + * Destroys the object and frees any allocated resources + */ +%{APPNAME}::~%{APPNAME}() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * A simple slot... not very interesting. + */ +void %{APPNAME}::goodBye() +{ + close(); +} + diff --git a/languages/cpp/app_templates/qtopia4app/example.desktop b/languages/cpp/app_templates/qtopia4app/example.desktop new file mode 100644 index 00000000..f6f04194 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/example.desktop @@ -0,0 +1,37 @@ +[Desktop Entry] +Comment=An %{APPNAME} Program +Comment[ca]=Un programa per a %{APPNAME} +Comment[da]=Et %{APPNAME} program +Comment[de]=Ein %{APPNAME}-Program +Comment[el]=Ένα πρόγραμμα %{APPNAME} +Comment[es]=Un programa %{APPNAME} +Comment[et]=%{APPNAME} programm +Comment[eu]=%{APPNAME} programa bat +Comment[fa]=برنامۀ %{APPNAME} +Comment[fr]=Un programme %{APPNAME} +Comment[ga]=Clár %{APPNAME} +Comment[gl]=Un programa %{APPNAME} +Comment[hu]=%{APPNAME} program +Comment[it]=Un programma per %{APPNAME} +Comment[ja]=%{APPNAME} プログラム +Comment[nds]=En %{APPNAME}-Programm +Comment[ne]= %{APPNAME} कार्यक्रम +Comment[nl]=Een %{APPNAME} programma +Comment[pl]=Program %{APPNAME} +Comment[pt]=Um Programa %{APPNAME} +Comment[pt_BR]=Um Programa %{APPNAME} +Comment[ru]=Программа %{APPNAME} +Comment[sk]=%{APPNAME} program +Comment[sl]=Program %{APPNAME} +Comment[sr]=%{APPNAME} програм +Comment[sr@Latn]=%{APPNAME} program +Comment[sv]=Ett %{APPNAME}-program +Comment[ta]=ஒரு %{APPNAME} நிரல் +Comment[tg]=Барномаи %{APPNAME} +Comment[tr]=Bir %{APPNAME} Programı +Comment[zh_CN]=一个 %{APPNAME} 程序 +Comment[zh_TW]=一個 %{APPNAME} 程式 +Exec=%{APPNAMELC} +Icon=%{APPNAME} +Type=Application +Name=%{APPNAME} diff --git a/languages/cpp/app_templates/qtopia4app/example.h b/languages/cpp/app_templates/qtopia4app/example.h new file mode 100644 index 00000000..7d58c7d8 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/example.h @@ -0,0 +1,24 @@ + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H +#include "ui_%{APPNAMELC}base.h" + +class %{APPNAME}Base : public QWidget, public Ui_%{APPNAME}Base +{ +public: + %{APPNAME}Base( QWidget *parent = 0, Qt::WFlags f = 0 ); + virtual ~%{APPNAME}Base(); +}; + +class %{APPNAME} : public %{APPNAME}Base +{ + Q_OBJECT +public: + %{APPNAME}( QWidget *parent = 0, Qt::WFlags f = 0 ); + virtual ~%{APPNAME}(); + +private slots: + void goodBye(); +}; + +#endif // %{APPNAMEUC}_H diff --git a/languages/cpp/app_templates/qtopia4app/example.html b/languages/cpp/app_templates/qtopia4app/example.html new file mode 100644 index 00000000..279a6106 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/example.html @@ -0,0 +1,15 @@ + +

      %{APPNAME}

      + +

      This is the help for the %{APPNAME} program. + +

      To user this application: + +

        +
      1. Press the icon in the Qtopia launcher. +
      2. Read the label. +
      3. Press the button. +
      4. Read the source code provided. +
      + +Now you know how to make a Qtopia application! diff --git a/languages/cpp/app_templates/qtopia4app/examplebase.ui b/languages/cpp/app_templates/qtopia4app/examplebase.ui new file mode 100644 index 00000000..17d6bc20 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/examplebase.ui @@ -0,0 +1,44 @@ + + + + + %{APPNAME}Base + + + + 0 + 0 + 196 + 245 + + + + %{APPNAME} + + + + 11 + + + 6 + + + + + This is just an %{APPNAME}. It doesn't do anything interesting at all. + + + true + + + + + + + Quit + + + + + + diff --git a/languages/cpp/app_templates/qtopia4app/main.cpp b/languages/cpp/app_templates/qtopia4app/main.cpp new file mode 100644 index 00000000..43dbb4ac --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/main.cpp @@ -0,0 +1,7 @@ + +#include "%{APPNAMELC}.h" +#include + +QTOPIA_ADD_APPLICATION("%{APPNAMELC}", %{APPNAME}) +QTOPIA_MAIN + diff --git a/languages/cpp/app_templates/qtopia4app/qtopia4app.kdevtemplate b/languages/cpp/app_templates/qtopia4app/qtopia4app.kdevtemplate new file mode 100644 index 00000000..298407f5 --- /dev/null +++ b/languages/cpp/app_templates/qtopia4app/qtopia4app.kdevtemplate @@ -0,0 +1,193 @@ +# KDE Config File +[General] +Name=Qtopia 4 Application +Name[ca]=Aplicació per a Qtopia 4 +Name[da]=Qtopia4-program +Name[de]=Qtopia 4-Anwendung +Name[el]=Εφαρμογή Qtopia 4 +Name[es]=Aplicación para Qtopia 4 +Name[et]=Qtopia 4 rakendus +Name[hu]=Qtopia 4-alapú alkalmazás +Name[it]=Applicazione Qtopia 4 +Name[nds]=Qtopia 4-Programm +Name[nl]=Qtopia4-programma +Name[pl]=Program wykorzystujący Qtopię 4 +Name[pt]=Aplicação do Qtopia 4 +Name[pt_BR]=Aplicação do Qtopia 4 +Name[ru]=Приложение Qtopia 4 +Name[sk]=Qtopia 4 aplikácia +Name[sr]=Qtopia 4 програм +Name[sr@Latn]=Qtopia 4 program +Name[sv]=Qtopia 4-program +Name[zh_TW]=Qtopia 4 應用程式 +Icon=qmakeapp4.png +Category=C++/Embedded +Comment=Generate a Qmake/Qt based application for Qtopia 4.x +Comment[ca]=Genera una aplicació basada en Qmake/Qt per a Qtopia 4.x +Comment[da]=Genererer et QMake-/Qt-baseret program til Qtopia 4.x +Comment[de]=Erstellt eine auf QMake/Qt basierende Anwendung für Qtopia 4.x +Comment[el]=Δημιουργία μιας εφαρμογής βασισμένης στο Qmake/Qt για το Qtopia 4.x +Comment[es]=Genera una aplicación basada en Qmake/Qt para Qtopia 4.x +Comment[et]=Qtopia 4.x rakenduse loomine QMake'i/Qt põhjal +Comment[hu]=Létrehoz egy QMake/Qt-alapú alkalmazást a Qtopia 4.x rendszerhez +Comment[it]=Genera un'applicazione basata su QMake/Qt per Qtopia 4.x +Comment[nds]=Stellt en op QMake/Qt opbuut Programm för Qtopia 4.x op +Comment[nl]=Genereer een Qmake/Qt-gebaseerd programma voor Qtopia 4.x +Comment[pl]=Generuje program wykorzystujący QMake/Qt dla Qtopii 4.x +Comment[pt]=Gera uma aplicação, baseada no QMake/Qt, para o Qtopia 4.x +Comment[pt_BR]=Gera uma aplicação, baseada no QMake/Qt, para o Qtopia 4.x +Comment[ru]=Создание приложения Qt, использующего QMake, для Qtopia 4.x +Comment[sk]=Vygeneruje aplikáciu založenú na QMake/Qt pre Qtopia 4.x +Comment[sr]=Прави програм за Qtopia-у 4.x на основу QMake-а/Qt-а +Comment[sr@Latn]=Pravi program za Qtopia-u 4.x na osnovu QMake-a/Qt-a +Comment[sv]=Skapa ett Qmake/Qt-baserat program för Qtopia 4.x +Comment[zh_TW]=產生一個以 Qmake/Qt 為基礎的 Qtopia 4.x 應用程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=qtopia4app.tar.gz + +[MkDir0] +Type=mkdir +Dir=%{dest}/help + +[MkDir1] +Type=mkdir +Dir=%{dest}/help/html + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/%{APPNAME}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/example.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/example.h +Dest=%{dest}/%{APPNAMELC}.h + +[FILE6] +Type=install +EscapeXML=true +Source=%{src}/examplebase.ui +Dest=%{dest}/%{APPNAMELC}base.ui + +[FILE7] +Type=install +Source=%{src}/example.desktop +Dest=%{dest}/%{APPNAMELC}.desktop + +[FILE8] +Type=install +EscapeXML=true +Source=%{src}/example.html +Dest=%{dest}/%{APPNAMELC}.html + +[FILE9] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/main.cpp + +[MSG] +Type=message +Comment=A Qtopia application was created in %{dest} +Comment[ca]=Una aplicació basada en Qtopia ha estat creada en %{dest} +Comment[da]=Et Qtopia program blev oprettet i %{dest} +Comment[de]=Eine Qtopia-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή Qtopia δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para Qtopia ha sido creada en %{dest} +Comment[et]=Qtopia rakendus loodi asukohta %{dest} +Comment[eu]=Qtopia aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد Qtopia در %{dest} ایجاد شد +Comment[fr]=Une application Qtopia a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár Qtopia i %{dest} +Comment[gl]=Creouse unha aplicación Qtopia en %{dest} +Comment[hu]=Létrejött egy Qtopia-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Qtopia in %{dest} +Comment[ja]=Qtopia アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Qtopia-Programm opstellt +Comment[ne]=Qtopia अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Qtopia-toepassing is aangemaakt in %{dest} +Comment[pl]=Program wykorzystujący Qtopię został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do Qtopia em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do Qtopia em %{dest} +Comment[ru]=Приложение Qtopia создано в %{dest} +Comment[sk]=Qtopia aplikácia bola vytvorená v %{dest} +Comment[sr]=Qtopia програм је направљен у %{dest} +Comment[sr@Latn]=Qtopia program je napravljen u %{dest} +Comment[sv]=Ett Qtopia-program skapades i %{dest} +Comment[tr]=Bir Qtopia uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了 Qtopia 应用程序 +Comment[zh_TW]=一個 Qtopia 應用程式已建立於 %{dest} + +[QMAKE] +Type=value +ValueType=QString +Value=QMAKE +Comment=Absolute Path for QMake (Qt4). +Comment[ca]=Ruta absoluta per a QMake (Qt4). +Comment[da]=Absolut søgesti til QMake (Qt4). +Comment[de]=Absoluter Pfad für QMake (Qt4). +Comment[el]=Απόλυτη διαδρομή για το QMake (Qt4). +Comment[es]=Ruta completa para QMake (Qt4). +Comment[et]=QMake (Qt4) absoluutne asukoht. +Comment[fr]=Chemin absolu pour QMake (Qt4). +Comment[hu]=A QMake (Qt4) teljes elérési útja. +Comment[it]=Percorso assoluto per QMake (Qt4). +Comment[ja]=QMake (Qt4) の絶対パス +Comment[nds]=Afsluut Padd för QMake (Qt4) +Comment[nl]=Absoluut pad naar QMake (Qt4). +Comment[pl]=Ścieżka bezwzględna do QMake (Qt4). +Comment[pt]=Localização Absoluta do QMake (Qt4). +Comment[pt_BR]=Localização Absoluta do QMake (Qt4). +Comment[ru]=Полный путь к QMake (Qt 4). +Comment[sk]=Absolútna cesta ku QMake (Qt4). +Comment[sr]=Апсолутна путања до QMake-а (Qt4). +Comment[sr@Latn]=Apsolutna putanja do QMake-a (Qt4). +Comment[sv]=Absolut sökväg till QMake (Qt4). +Comment[zh_TW]=QMake(Qt4)的絕對路徑 +Default=/opt/Qtopia/SDK/4.2.4/x86/bin/qtopiamake +[DESIGNER] +Type=value +ValueType=QString +Value=DESIGNER +Comment=Absolute Path for Designer (Qt4). +Comment[ca]=Ruta absoluta per a Designer (Qt4). +Comment[da]=Absolut søgesti til Designer (Qt4). +Comment[de]=Absoluter Pfad für Designer (Qt4). +Comment[el]=Απόλυτη διαδρομή για τον Σχεδιαστή (Qt4). +Comment[es]=Ruta completa para Designer (Qt4). +Comment[et]=Disaineri (Qt4) absoluutne asukoht. +Comment[fr]=Chemin absolu pour Designer (Qt4). +Comment[hu]=A Designer (Qt4) teljes elérési útja +Comment[it]=Percorso assoluto del Designer (Qt4). +Comment[ja]=Designer (Qt4) の絶対パス +Comment[nds]=Afsluut Padd för Designer (Qt4) +Comment[nl]=Absoluut pad naar Designer (Qt4). +Comment[pl]=Ścieżka bezwzględna do Designera (Qt4). +Comment[pt]=Localização Absoluta do Designer (Qt4). +Comment[pt_BR]=Localização Absoluta do Designer (Qt4). +Comment[ru]=Полный путь к Designer (Qt 4). +Comment[sk]=Absolútna cesta ku Designer (Qt4). +Comment[sr]=Апсолутна путања до Designer-а (Qt4). +Comment[sr@Latn]=Apsolutna putanja do Designer-a (Qt4). +Comment[sv]=Absolut sökväg till Designer (Qt4). +Comment[zh_TW]=設計家(Qt4)的絕對路徑 +Default=/opt/Qtopia/SDK/4.2.4/x86/bin/designer + + diff --git a/languages/cpp/app_templates/qtopia4app/qtopia4app.png b/languages/cpp/app_templates/qtopia4app/qtopia4app.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/qtopia4app/qtopia4app.png differ diff --git a/languages/cpp/app_templates/qtopiaapp/.kdev_ignore b/languages/cpp/app_templates/qtopiaapp/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/qtopiaapp/Example.png b/languages/cpp/app_templates/qtopiaapp/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/qtopiaapp/Example.png differ diff --git a/languages/cpp/app_templates/qtopiaapp/Makefile.am b/languages/cpp/app_templates/qtopiaapp/Makefile.am new file mode 100644 index 00000000..c250d5fa --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/Makefile.am @@ -0,0 +1,19 @@ +dataFiles = Example.png app.kdevelop example.control example.desktop \ + example.html main.cpp Makefile.am app.pro example.cpp \ + example.h examplebase.ui qtopiaapp + +templateName = qtopiaapp + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/qtopiaapp/app.kdevelop b/languages/cpp/app_templates/qtopiaapp/app.kdevelop new file mode 100644 index 00000000..9db37db3 --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/app.kdevelop @@ -0,0 +1,131 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTMakeProject + C++ + + Qt + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + KDE Libraries (Doxygen) + + + + + libtool + + + true + false + false + + + false + true + + + + + + + + ./%{APPNAMELC} + -qws + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/qtopiaapp/app.pro b/languages/cpp/app_templates/qtopiaapp/app.pro new file mode 100644 index 00000000..c625020d --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/app.pro @@ -0,0 +1,10 @@ +TEMPLATE = app +CONFIG = qt warn_on release +HEADERS = %{APPNAMELC}.h +SOURCES = main.cpp %{APPNAMELC}.cpp +INTERFACES = %{APPNAMELC}base.ui +TARGET = %{APPNAMELC} +INCLUDEPATH += $(QPEDIR)/include +DEPENDPATH += $(QPEDIR)/include +LIBS += -lqpe + diff --git a/languages/cpp/app_templates/qtopiaapp/example.control b/languages/cpp/app_templates/qtopiaapp/example.control new file mode 100644 index 00000000..d04f87ec --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/example.control @@ -0,0 +1,11 @@ +Files: bin/%{APPNAMELC} apps/Applications/%{APPNAMELC}.desktop pics/%{APPNAME}.png help/html/%{APPNAMELC}.html +Priority: optional +Section: qpe/applications +Maintainer: Your Name +Architecture: $CPU_ARCH +Arch: $DEVICE_ARCH +Version: 1.0.0 +License: Public Domain +Description: %{APPNAME} program + An %{APPNAMELC} program for the Qtopia environment. + Does nothing interesting. diff --git a/languages/cpp/app_templates/qtopiaapp/example.cpp b/languages/cpp/app_templates/qtopiaapp/example.cpp new file mode 100644 index 00000000..939f708e --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/example.cpp @@ -0,0 +1,29 @@ + +#include "%{APPNAMELC}.h" +#include + +/* + * Constructs a %{APPNAME} which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +%{APPNAME}::%{APPNAME}( QWidget* parent, const char* name, WFlags fl ) + : %{APPNAME}Base( parent, name, fl ) +{ + connect(quit, SIGNAL(clicked()), this, SLOT(goodBye())); +} + +/* + * Destroys the object and frees any allocated resources + */ +%{APPNAME}::~%{APPNAME}() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * A simple slot... not very interesting. + */ +void %{APPNAME}::goodBye() +{ + close(); +} diff --git a/languages/cpp/app_templates/qtopiaapp/example.desktop b/languages/cpp/app_templates/qtopiaapp/example.desktop new file mode 100644 index 00000000..f6f04194 --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/example.desktop @@ -0,0 +1,37 @@ +[Desktop Entry] +Comment=An %{APPNAME} Program +Comment[ca]=Un programa per a %{APPNAME} +Comment[da]=Et %{APPNAME} program +Comment[de]=Ein %{APPNAME}-Program +Comment[el]=Ένα πρόγραμμα %{APPNAME} +Comment[es]=Un programa %{APPNAME} +Comment[et]=%{APPNAME} programm +Comment[eu]=%{APPNAME} programa bat +Comment[fa]=برنامۀ %{APPNAME} +Comment[fr]=Un programme %{APPNAME} +Comment[ga]=Clár %{APPNAME} +Comment[gl]=Un programa %{APPNAME} +Comment[hu]=%{APPNAME} program +Comment[it]=Un programma per %{APPNAME} +Comment[ja]=%{APPNAME} プログラム +Comment[nds]=En %{APPNAME}-Programm +Comment[ne]= %{APPNAME} कार्यक्रम +Comment[nl]=Een %{APPNAME} programma +Comment[pl]=Program %{APPNAME} +Comment[pt]=Um Programa %{APPNAME} +Comment[pt_BR]=Um Programa %{APPNAME} +Comment[ru]=Программа %{APPNAME} +Comment[sk]=%{APPNAME} program +Comment[sl]=Program %{APPNAME} +Comment[sr]=%{APPNAME} програм +Comment[sr@Latn]=%{APPNAME} program +Comment[sv]=Ett %{APPNAME}-program +Comment[ta]=ஒரு %{APPNAME} நிரல் +Comment[tg]=Барномаи %{APPNAME} +Comment[tr]=Bir %{APPNAME} Programı +Comment[zh_CN]=一个 %{APPNAME} 程序 +Comment[zh_TW]=一個 %{APPNAME} 程式 +Exec=%{APPNAMELC} +Icon=%{APPNAME} +Type=Application +Name=%{APPNAME} diff --git a/languages/cpp/app_templates/qtopiaapp/example.h b/languages/cpp/app_templates/qtopiaapp/example.h new file mode 100644 index 00000000..883cb27d --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/example.h @@ -0,0 +1,18 @@ + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H +#include "%{APPNAMELC}base.h" + +class %{APPNAME} : public %{APPNAME}Base +{ + Q_OBJECT + +public: + %{APPNAME}( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~%{APPNAME}(); + +private slots: + void goodBye(); +}; + +#endif // %{APPNAMEUC}_H diff --git a/languages/cpp/app_templates/qtopiaapp/example.html b/languages/cpp/app_templates/qtopiaapp/example.html new file mode 100644 index 00000000..279a6106 --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/example.html @@ -0,0 +1,15 @@ + +

      %{APPNAME}

      + +

      This is the help for the %{APPNAME} program. + +

      To user this application: + +

        +
      1. Press the icon in the Qtopia launcher. +
      2. Read the label. +
      3. Press the button. +
      4. Read the source code provided. +
      + +Now you know how to make a Qtopia application! diff --git a/languages/cpp/app_templates/qtopiaapp/examplebase.ui b/languages/cpp/app_templates/qtopiaapp/examplebase.ui new file mode 100644 index 00000000..b6b81b11 --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/examplebase.ui @@ -0,0 +1,49 @@ + +%{APPNAME}Base + + QWidget + + name + %{APPNAME}Base + + + geometry + + 0 + 0 + 196 + 245 + + + + caption + %{APPNAME} + + + + + QLabel + + name + TextLabel1 + + + text + <p>This is just an <i>%{APPNAMELC}</i>; it does not do anything interesting at all. + + + + QPushButton + + name + quit + + + text + Quit + + + + + + diff --git a/languages/cpp/app_templates/qtopiaapp/main.cpp b/languages/cpp/app_templates/qtopiaapp/main.cpp new file mode 100644 index 00000000..0311a32e --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/main.cpp @@ -0,0 +1,13 @@ + +#include "%{APPNAMELC}.h" +#include + +int main( int argc, char ** argv ) +{ + QPEApplication a( argc, argv ); + + %{APPNAME} mw; + a.showMainWidget( &mw ); + + return a.exec(); +} diff --git a/languages/cpp/app_templates/qtopiaapp/qtopiaapp b/languages/cpp/app_templates/qtopiaapp/qtopiaapp new file mode 100644 index 00000000..e07d8627 --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/qtopiaapp @@ -0,0 +1,11 @@ +# TMake application +[General] +Name=Qtopia Application +Name[fr]=Une Application Qtopia +Icon=qmakeapp.png +Category=C++/Embedded +Category[fr]=C++/Environnement embarqu +Comment=Generate a TMake/Qt based application for Qtopia 1.x +Comment[fr]=Gnre une application base sur Qt / TMake pour l'environnement Qtopia 1.x. +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=APPNAMELC.cpp diff --git a/languages/cpp/app_templates/qtopiaapp/qtopiaapp.kdevtemplate b/languages/cpp/app_templates/qtopiaapp/qtopiaapp.kdevtemplate new file mode 100644 index 00000000..45479b04 --- /dev/null +++ b/languages/cpp/app_templates/qtopiaapp/qtopiaapp.kdevtemplate @@ -0,0 +1,153 @@ +# KDE Config File +[General] +Name=Qtopia Application +Name[ca]=Aplicació per a Qtopia +Name[da]=Qtopia-program +Name[de]=Qtopia-Anwendung +Name[el]=Εφαρμογή Qtopia +Name[es]=Aplicación para Qtopia +Name[et]=Qtopia rakendus +Name[eu]=Qtopia aplikazioa +Name[fa]=کاربرد Qtopia +Name[fr]=Application Qtopia +Name[ga]=Feidhmchlár Qtopia +Name[gl]=Aplicación Qtopia +Name[hu]=Qtopia-alkalmazás +Name[it]=Applicazione Qtopia +Name[ja]=Qtopia アプリケーション +Name[nds]=Qtopia-Programm +Name[ne]=Qtopia अनुप्रयोग +Name[nl]=Qtopia-toepassing +Name[pl]=Program wykorzystujący Qtopię +Name[pt]=Aplicação do Qtopia +Name[pt_BR]=Aplicação do Qtopia +Name[ru]=Приложение Qtopia +Name[sk]=Qtopia aplikácia +Name[sl]=Program za Qtopio +Name[sr]=Qtopia програм +Name[sr@Latn]=Qtopia program +Name[sv]=Qtopia-program +Name[tr]=Qtopia Uygulaması +Name[zh_CN]=Qtopia 应用程序 +Name[zh_TW]=Qtopia 應用程式 +Icon=qmakeapp.png +Category=C++/Embedded +Category[fr]=C++/Environnement embarqu +Comment=Generate a TMake/Qt based application for Qtopia 1.x +Comment[ca]=Genera una aplicació basada en TMake/Qt per a Qtopia 1.x +Comment[da]=Generér et TMake/Qt baseret program for Qtopia 1.x +Comment[de]=Erstellt eine auf TMake/Qt basierende Anwendung für Qtopia 1.x +Comment[el]=Δημιουργία μιας εφαρμογής βασισμένης στα TMake/Qt για το Qtopia 1.x +Comment[es]=Genera una aplicación basada en TMake/Qt para Qtopia 1.x +Comment[et]=Qtopia 1.x rakenduse loomine TMake'i/Qt põhjal +Comment[eu]= Sortu TMake/Qt software-ean oinarritutako Qtopia 1.x aplikazio bat +Comment[fa]=یک کاربرد بر مبنای TMake/Qt برای Qtopia 1.x تولید می‌کند +Comment[fr]=Génère une application basée sur TMake / Qt pour Qtopia 1.x +Comment[ga]=Cruthaigh feidhmchlár bunaithe ar TMake/Qt le haghaidh Qtopia 1.x +Comment[gl]=Xera unha aplicación baseada en TMake/Qt para Qtopia 1.x +Comment[hu]=Létrehoz egy TMake/Qt-alapú alkalmazást a Qtopia 1.x rendszerhez +Comment[it]=Genera un'applicazione basata su TMake/Qt per Qtopia 1.x +Comment[ja]=Qtopia 1.x 用の TMake/Qt ベースのアプリケーションを作成 +Comment[nds]=Stellt en op TMake/Qt opbuut Programm för Qtopia 1.x op +Comment[ne]= Qtopia 1.x का लागि TMake/Qt आधारित अनुप्रयोग उत्पन्न गर्नुहोस् +Comment[nl]=Genereert een Tmake/Qt-gebaseerde toepassing voor Qtopie 1.x +Comment[pl]=Generuje program wykorzystujący TMake i Qt dla Qtopii 1.x +Comment[pt]=Gera uma aplicação, baseada no TMake/Qt, para o Qtopia 1.x +Comment[pt_BR]=Gera uma aplicação, baseada no TMake/Qt, para o Qtopia 1.x +Comment[ru]=Создание приложения Qt со сборкой посредством TMake для Qtopia 1.x +Comment[sk]=Vygeneruje aplikáciu založenú na TMake/Qt pre Qtopia 1.x +Comment[sr]=Прави програм за Qtopia-у 1.x на основуTMake-а/Qt-а +Comment[sr@Latn]=Pravi program za Qtopia-u 1.x na osnovuTMake-a/Qt-a +Comment[sv]=Skapa ett TMake/Qt-baserat program för Qtopia 1.x +Comment[tr]=Qtopia 1.x için TMake/Qt tabanlı bir uygulama yarat +Comment[zh_CN]=生成适用于 Qtopia 1.x 基于 TMake/Qt 的应用程序 +Comment[zh_TW]=產生一個 Qtopia 1.x 的 TMake/Qt 應用程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=qtopiaapp.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/%{APPNAME}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/example.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/example.h +Dest=%{dest}/%{APPNAMELC}.h + +[FILE6] +Type=install +EscapeXML=true +Source=%{src}/examplebase.ui +Dest=%{dest}/%{APPNAMELC}base.ui + +[FILE7] +Type=install +Source=%{src}/example.control +Dest=%{dest}/%{APPNAMELC}.control + +[FILE8] +Type=install +Source=%{src}/example.desktop +Dest=%{dest}/%{APPNAMELC}.desktop + +[FILE9] +Type=install +EscapeXML=true +Source=%{src}/example.html +Dest=%{dest}/%{APPNAMELC}.html + +[FILE10] +Type=install +Source=%{src}/main.cpp +Dest=%{dest}/main.cpp + +[MSG] +Type=message +Comment=A Qtopia application was created in %{dest} +Comment[ca]=Una aplicació basada en Qtopia ha estat creada en %{dest} +Comment[da]=Et Qtopia program blev oprettet i %{dest} +Comment[de]=Eine Qtopia-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή Qtopia δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para Qtopia ha sido creada en %{dest} +Comment[et]=Qtopia rakendus loodi asukohta %{dest} +Comment[eu]=Qtopia aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد Qtopia در %{dest} ایجاد شد +Comment[fr]=Une application Qtopia a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár Qtopia i %{dest} +Comment[gl]=Creouse unha aplicación Qtopia en %{dest} +Comment[hu]=Létrejött egy Qtopia-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Qtopia in %{dest} +Comment[ja]=Qtopia アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Qtopia-Programm opstellt +Comment[ne]=Qtopia अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Qtopia-toepassing is aangemaakt in %{dest} +Comment[pl]=Program wykorzystujący Qtopię został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do Qtopia em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do Qtopia em %{dest} +Comment[ru]=Приложение Qtopia создано в %{dest} +Comment[sk]=Qtopia aplikácia bola vytvorená v %{dest} +Comment[sr]=Qtopia програм је направљен у %{dest} +Comment[sr@Latn]=Qtopia program je napravljen u %{dest} +Comment[sv]=Ett Qtopia-program skapades i %{dest} +Comment[tr]=Bir Qtopia uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了 Qtopia 应用程序 +Comment[zh_TW]=一個 Qtopia 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/qtopiaapp/qtopiaapp.png b/languages/cpp/app_templates/qtopiaapp/qtopiaapp.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/qtopiaapp/qtopiaapp.png differ diff --git a/languages/cpp/app_templates/win32gui/.kdev_ignore b/languages/cpp/app_templates/win32gui/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/win32gui/Makefile.am b/languages/cpp/app_templates/win32gui/Makefile.am new file mode 100644 index 00000000..66931bfd --- /dev/null +++ b/languages/cpp/app_templates/win32gui/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = app.cpp src-Makefile.am win32gui-Makefile.am win32gui-Makefile.cvs \ + win32gui-configure.in win32gui.png app.kdevelop + +templateName = win32gui + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/win32gui/app.cpp b/languages/cpp/app_templates/win32gui/app.cpp new file mode 100644 index 00000000..a875b28b --- /dev/null +++ b/languages/cpp/app_templates/win32gui/app.cpp @@ -0,0 +1,12 @@ +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +int STDCALL +WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) +{ + MessageBox (NULL, "Hello, Windows!", "Hello", MB_OK); + return 0; +} + diff --git a/languages/cpp/app_templates/win32gui/app.kdevelop b/languages/cpp/app_templates/win32gui/app.kdevelop new file mode 100644 index 00000000..f9dc8145 --- /dev/null +++ b/languages/cpp/app_templates/win32gui/app.kdevelop @@ -0,0 +1,192 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + + . + false + + + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC}.exe + false + executable + / + + true + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + + + + + + + + + + + + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + + + + + + + + + + kdevgccoptions + kdevgppoptions + kdevpgf77options + + + + + + + + + + + + + + true + 1 + false + + 0 + + + + + clanlib + opengl + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + false + false + + + *.o,*.lo,CVS + false + + + + + .h + .cpp + + + + + true + true + true + false + true + true + true + 250 + 400 + 250 + + + Qt + KDElibs + ksjembed + + + + + + + + + + + true + false + false + + + false + true + 10 + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/win32gui/src-Makefile.am b/languages/cpp/app_templates/win32gui/src-Makefile.am new file mode 100644 index 00000000..21f6d7c8 --- /dev/null +++ b/languages/cpp/app_templates/win32gui/src-Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = -mwindows $(all_libraries) diff --git a/languages/cpp/app_templates/win32gui/win32gui-Makefile.am b/languages/cpp/app_templates/win32gui/win32gui-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/win32gui/win32gui-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/win32gui/win32gui-Makefile.cvs b/languages/cpp/app_templates/win32gui/win32gui-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/win32gui/win32gui-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/win32gui/win32gui-configure.in b/languages/cpp/app_templates/win32gui/win32gui-configure.in new file mode 100644 index 00000000..612ce0d5 --- /dev/null +++ b/languages/cpp/app_templates/win32gui/win32gui-configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/win32gui/win32gui.kdevtemplate b/languages/cpp/app_templates/win32gui/win32gui.kdevtemplate new file mode 100644 index 00000000..0a600294 --- /dev/null +++ b/languages/cpp/app_templates/win32gui/win32gui.kdevtemplate @@ -0,0 +1,137 @@ +# KDE Config File +[General] +Name=Simple Win32 GUI App. +Name[ca]=Simple aplicació per a Win32. +Name[da]=Simpelt Win32 GUI-program. +Name[de]=Einfache Win32-GUI-Anwendung +Name[el]=Απλή εφαρμογή γραφικού περιβάλλοντος Win32. +Name[es]=Aplicación sencilla para Win32 +Name[et]=Lihtne Win32 graafilise kasutajaliidese rakendus +Name[eu]=Win32 GUI aplikazio sinplea. +Name[fa]=کاربرد سادۀ ونک Win32 +Name[fr]=Interface graphique Win32 simple. +Name[ga]=Feidhmchlár Simplí Win32 le Comhéadan Grafach +Name[gl]=Aplicación sinxela Win32. +Name[hu]=Egyszerű Win32-alapú, grafikus felületű alkalmazás +Name[it]=Semplice applicazione GUI Win32. +Name[ja]=簡単な Win32 GUI アプリケーション +Name[nds]=Eenfach Win32-Böversietprogramm. +Name[ne]=साधारण Win32 GUI अनुप्रयोग +Name[nl]=Eenvoudige Win32 GUI-toepassing +Name[pl]=Prosty program Win32 +Name[pt]=Aplicação gráfica simples em Win32. +Name[pt_BR]=Aplicação gráfica simples em Win32. +Name[ru]=Простое графическое приложение Windows +Name[sk]=Jednoduchá Win32 GUI aplikácia +Name[sr]=Једноставан Win32 програм са GUI-јем. +Name[sr@Latn]=Jednostavan Win32 program sa GUI-jem. +Name[sv]=Enkelt Win32-program med grafiskt gränssnitt +Name[tr]=Basit Win32 Grafik Arayüz Uygulaması +Name[zh_CN]=简单的 Win32 GUI 应用程序 +Name[zh_TW]=簡單的 Win32 使用者介面應用程式 +Icon=win32gui.png +Category=C++ +Comment=Generates a shell project for crosscompiling Win32 projects. +Comment[ca]=Genera un projecte d'intèrpret de comandaments per a la compilació multi plataforma de projectes per a Win32. +Comment[da]=Genererer et skalprojekt for krydskompilering af Win32-projekter. +Comment[de]=Erstellt ein Shell-Projekt für plattformunabhängige Win32-Projekte. +Comment[el]=Δημιουργία ενός έργου κελύφους για μεταγλώττιση έργων Win32 σε διαφορετικές πλατφόρμες. +Comment[es]=Genera un proyecto de intérprete de órdenes para compilación multiplataforma de proyectos Win32. +Comment[et]=Shelliprojekti loomine Win32 projektide kompileerimiseks. +Comment[eu]=Win32 proiektuak konpilazio gurutzaturako shell proiektu bat sortzen du. +Comment[fa]=یک پروژۀ پوسته برای پروژه‌های Win32 ترجمۀ بین سکویی تولید می‌کند. +Comment[fr]=Génère un projet shell pour la compilation croisée de projets Win32. +Comment[gl]=Xera un proxecto shell para a compilación cruzada de proxectos Win32. +Comment[hu]=Létrehoz egy konzolos projektet Win32-projektek keresztfordításához. +Comment[it]=Genera un progetto di shell per progetti Win32 multi compilanti. +Comment[nds]=Stellt en Konsoolprojekt för't Krüüzkompileren vun Win32-Projekten op. +Comment[ne]=क्रसकम्पाइलिङ Win32 परियोजनाका लागि शेल परियोजना उत्पन्न गर्दछ +Comment[nl]=Genereert een shellproject voor crosscompilerende Win32-projecten. +Comment[pl]=Generuje powłokę do kompilacji projektów dla Win32. +Comment[pt]=Gera um projecto para poder compilar projectos em Win32. +Comment[pt_BR]=Gera um projecto para poder compilar projectos em Win32. +Comment[ru]=Создание проекта для кросс-компиляции проектов Win32. +Comment[sk]=Vygenruje shell projekt pre kompiláciu Win32 projektov. +Comment[sr]=Прави пројекат за прекопревођење Win32 пројеката. +Comment[sr@Latn]=Pravi projekat za prekoprevođenje Win32 projekata. +Comment[sv]=Skapar ett skalprojekt för korskompilering av Win32-projekt. +Comment[tr]=Win32 projelerini karşıderlemek için bir kabul projesi yarat. +Comment[zh_CN]=生成跨平台编译的 Win32 工程的外壳工程。 +Comment[zh_TW]=產生一個 shell 專案,可在 Win32 跨平台編譯。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/%{APPNAMELC}.cpp +Archive=win32gui.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/win32gui-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/win32gui-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/win32gui-configure.in +Dest=%{dest}/configure.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE6] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=For this project to compile and run you need both Wine and MinGW installed. +Comment[ca]=Per a compilar i executar aquest projecte us caldrà instal·lar Wine i MinGW. +Comment[da]=For at dette projekt skal kompilere og køre har du brug for at have både Wine og MinGW installeret. +Comment[de]=Um dieses Projekt kompilieren und ausführen zu können, muss sowohl Wine als auch MinGW installiert sein. +Comment[el]=Για να μεταγλωττιστεί και να εκτελεστεί αυτό το έργο χρειάζεστε τόσο το Wine όσο και το MinGW εγκατεστημένα. +Comment[es]=Para compilar y ejecutar este proyecto necesitará tener instalados Wine y MinGW. +Comment[et]=Selle projekti kompileerimiseks ja käivitamiseks peab olema paigaldatud nii Wine kui MinGW. +Comment[eu]=Proiektu hau konpilatzeko eta exekutatzeko Wine eta MinGw instalatuta izan behar dituzu. +Comment[fa]=برای ترجمه و اجرای این پروژه، هم نیاز به نصب Wine و هم نیاز به MinGW دارید. +Comment[fr]=Pour que ce projet compile et s'exécute, vous devez installer Wine et MinGW. +Comment[gl]=Para poder compilar e executar este proxecto necesita ter instalados Wine e MinGW. +Comment[hu]=A projekt lefordításához és futtatásához szükség van a Wine és a MinGW telepítésére. +Comment[it]=Per compilare ed eseguire questo progetto dei avere sia Wine che MinGW installati. +Comment[nds]=Wine un MinGW mööt installeert wesen, wenn Du dit Projekt kompileren un utföhren wullt. +Comment[ne]=यो परियोजनाका लागि कम्पाइल गर्न र चलाउन तपाईँले वाइन र MinGW स्थापना गरेको हुनुपर्दछ । +Comment[nl]=Om dit project te kunnen compileren en uitvoeren hebt u Wine en MinGW nodig. +Comment[pl]=Do kompilacji takiego projektu potrzebne są Wine oraz MinGW. +Comment[pt]=Para este projecto poder ser compilado e executado é necessário ter tanto o Wine como o MinGW instalados. +Comment[pt_BR]=Para este projecto poder ser compilado e executado é necessário ter tanto o Wine como o MinGW instalados. +Comment[ru]=Для сборки и запуска этого проекта вам необходимо установить Wine и MinGW . +Comment[sk]=Na kompiláciu tohoto projektu potrebujete mať nainštalované Wine a MinGW. +Comment[sr]=Да би се овај пројекат превео и покренуо, и Wine и MinGW морају бити инсталирани. +Comment[sr@Latn]=Da bi se ovaj projekat preveo i pokrenuo, i Wine i MinGW moraju biti instalirani. +Comment[sv]=För att projektet ska kompileras och köras behöver du ha installerat både Wine och MinGW. +Comment[tr]=Bu projenin derlenmesi için Wine ve MinGW'nin kurulu olması lazım. +Comment[zh_CN]=要让此工程能够编译并运行,您需要同时安装 Wine 和 MinGW。 +Comment[zh_TW]=這個專案要編譯,您需要安裝 Wine 與 MinGW。 + diff --git a/languages/cpp/app_templates/win32gui/win32gui.png b/languages/cpp/app_templates/win32gui/win32gui.png new file mode 100644 index 00000000..901ee474 Binary files /dev/null and b/languages/cpp/app_templates/win32gui/win32gui.png differ diff --git a/languages/cpp/app_templates/win32hello/.kdev_ignore b/languages/cpp/app_templates/win32hello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/win32hello/Makefile.am b/languages/cpp/app_templates/win32hello/Makefile.am new file mode 100644 index 00000000..d6c7dfad --- /dev/null +++ b/languages/cpp/app_templates/win32hello/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = app.cpp src-Makefile.am win32-Makefile.am win32-Makefile.cvs \ + win32-configure.in win32hello.png app.kdevelop + +templateName = win32hello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/win32hello/app.cpp b/languages/cpp/app_templates/win32hello/app.cpp new file mode 100644 index 00000000..10b02750 --- /dev/null +++ b/languages/cpp/app_templates/win32hello/app.cpp @@ -0,0 +1,16 @@ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +using namespace std; + +int main(int argc, char *argv[]) +{ + cout << "Hello, from Win32!" << endl; + + return EXIT_SUCCESS; +} diff --git a/languages/cpp/app_templates/win32hello/app.kdevelop b/languages/cpp/app_templates/win32hello/app.kdevelop new file mode 100644 index 00000000..33c1e97e --- /dev/null +++ b/languages/cpp/app_templates/win32hello/app.kdevelop @@ -0,0 +1,164 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + + . + false + + + + + + + src/%{APPNAMELC} + default + + + src/%{APPNAMELC}.exe + true + executable + / + + true + + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + + + + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + + + + + + + true + 1 + false + + 0 + + + + + clanlib + opengl + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + + + + + false + false + + + *.o,*.lo,CVS + false + + + + + .h + .cpp + + + + + true + true + true + false + true + true + true + 250 + 400 + 250 + + + Qt + KDElibs + ksjembed + + + + + + + + + + + true + false + false + + + false + true + 10 + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/win32hello/src-Makefile.am b/languages/cpp/app_templates/win32hello/src-Makefile.am new file mode 100644 index 00000000..21f6d7c8 --- /dev/null +++ b/languages/cpp/app_templates/win32hello/src-Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +%{APPNAMELC}_LDFLAGS = -mwindows $(all_libraries) diff --git a/languages/cpp/app_templates/win32hello/win32-Makefile.am b/languages/cpp/app_templates/win32hello/win32-Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/languages/cpp/app_templates/win32hello/win32-Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/languages/cpp/app_templates/win32hello/win32-Makefile.cvs b/languages/cpp/app_templates/win32hello/win32-Makefile.cvs new file mode 100644 index 00000000..d1607023 --- /dev/null +++ b/languages/cpp/app_templates/win32hello/win32-Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/languages/cpp/app_templates/win32hello/win32-configure.in b/languages/cpp/app_templates/win32hello/win32-configure.in new file mode 100644 index 00000000..612ce0d5 --- /dev/null +++ b/languages/cpp/app_templates/win32hello/win32-configure.in @@ -0,0 +1,10 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile src/Makefile) diff --git a/languages/cpp/app_templates/win32hello/win32hello.kdevtemplate b/languages/cpp/app_templates/win32hello/win32hello.kdevtemplate new file mode 100644 index 00000000..b6fb54d2 --- /dev/null +++ b/languages/cpp/app_templates/win32hello/win32hello.kdevtemplate @@ -0,0 +1,136 @@ +# KDE Config File +[General] +Name=Simple Win32 Hello World +Name[ca]=Simple Hello World per a Win32 +Name[da]=Simpelt Win32 Goddag verden +Name[de]=Einfaches Win32-"Hello World"-Programm +Name[el]=Απλό Γεια σου Κόσμε Win32 +Name[es]=Sencillo programa «Hola mundo» para Win32 +Name[et]=Lihtne Win32 "Tere, maailm" +Name[eu]=Win32 "Kaixo mundua" aplikazio sinple bat +Name[fa]=Hello World سادۀ Win32 +Name[fr]=« Bonjour monde » Win32 simple +Name[ga]=Ríomhchlár simplí "Hello World" le haghaidh Win32 +Name[gl]=Aplicación Win32 sinxela Ola mundo +Name[hu]=Win32-alapú Hello world program +Name[it]=Semplice "Hello World" Win32 +Name[nds]=Eenfach Win32-"Moin Welt"-Programm +Name[ne]=साधारण Win32 हेल्लो वोल्ड +Name[nl]=Eenvoudige Win32 Hello World +Name[pl]=Prosty program Witaj świecie dla Win32 +Name[pt]=Olá Mundo Simples em Win32 +Name[pt_BR]=Olá Mundo Simples em Win32 +Name[ru]=Простое приложение Hello World для Windows +Name[sk]=Jenoduchý Ahoj svet Win32 program +Name[sr]=Једноставан Win32 „Здраво свете“ +Name[sr@Latn]=Jednostavan Win32 „Zdravo svete“ +Name[sv]=Enkelt Win32 Hello World +Name[tr]=Basit Win32 Merhaba Dünya +Name[zh_CN]=简单的 Win32 Hello World +Name[zh_TW]=簡單的 Win32 Hello World +Icon=win32hello.png +Category=C++ +Comment=Generates a shell project for crosscompiling Win32 projects. +Comment[ca]=Genera un projecte d'intèrpret de comandaments per a la compilació multi plataforma de projectes per a Win32. +Comment[da]=Genererer et skalprojekt for krydskompilering af Win32-projekter. +Comment[de]=Erstellt ein Shell-Projekt für plattformunabhängige Win32-Projekte. +Comment[el]=Δημιουργία ενός έργου κελύφους για μεταγλώττιση έργων Win32 σε διαφορετικές πλατφόρμες. +Comment[es]=Genera un proyecto de intérprete de órdenes para compilación multiplataforma de proyectos Win32. +Comment[et]=Shelliprojekti loomine Win32 projektide kompileerimiseks. +Comment[eu]=Win32 proiektuak konpilazio gurutzaturako shell proiektu bat sortzen du. +Comment[fa]=یک پروژۀ پوسته برای پروژه‌های Win32 ترجمۀ بین سکویی تولید می‌کند. +Comment[fr]=Génère un projet shell pour la compilation croisée de projets Win32. +Comment[gl]=Xera un proxecto shell para a compilación cruzada de proxectos Win32. +Comment[hu]=Létrehoz egy konzolos projektet Win32-projektek keresztfordításához. +Comment[it]=Genera un progetto di shell per progetti Win32 multi compilanti. +Comment[nds]=Stellt en Konsoolprojekt för't Krüüzkompileren vun Win32-Projekten op. +Comment[ne]=क्रसकम्पाइलिङ Win32 परियोजनाका लागि शेल परियोजना उत्पन्न गर्दछ +Comment[nl]=Genereert een shellproject voor crosscompilerende Win32-projecten. +Comment[pl]=Generuje powłokę do kompilacji projektów dla Win32. +Comment[pt]=Gera um projecto para poder compilar projectos em Win32. +Comment[pt_BR]=Gera um projecto para poder compilar projectos em Win32. +Comment[ru]=Создание проекта для кросс-компиляции проектов Win32. +Comment[sk]=Vygenruje shell projekt pre kompiláciu Win32 projektov. +Comment[sr]=Прави пројекат за прекопревођење Win32 пројеката. +Comment[sr@Latn]=Pravi projekat za prekoprevođenje Win32 projekata. +Comment[sv]=Skapar ett skalprojekt för korskompilering av Win32-projekt. +Comment[tr]=Win32 projelerini karşıderlemek için bir kabul projesi yarat. +Comment[zh_CN]=生成跨平台编译的 Win32 工程的外壳工程。 +Comment[zh_TW]=產生一個 shell 專案,可在 Win32 跨平台編譯。 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/%{APPNAMELC}.cpp +Archive=win32hello.tar.gz + +[INCADMIN] +Type=include +File=%{kdevelop}/template-common/incadmin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/win32-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE3] +Type=install +Source=%{src}/win32-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE4] +Type=install +Source=%{src}/win32-configure.in +Dest=%{dest}/configure.in + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE5] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE6] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[MSG] +Type=message +Comment=For this project to compile and run you need both Wine and MinGW installed. +Comment[ca]=Per a compilar i executar aquest projecte us caldrà instal·lar Wine i MinGW. +Comment[da]=For at dette projekt skal kompilere og køre har du brug for at have både Wine og MinGW installeret. +Comment[de]=Um dieses Projekt kompilieren und ausführen zu können, muss sowohl Wine als auch MinGW installiert sein. +Comment[el]=Για να μεταγλωττιστεί και να εκτελεστεί αυτό το έργο χρειάζεστε τόσο το Wine όσο και το MinGW εγκατεστημένα. +Comment[es]=Para compilar y ejecutar este proyecto necesitará tener instalados Wine y MinGW. +Comment[et]=Selle projekti kompileerimiseks ja käivitamiseks peab olema paigaldatud nii Wine kui MinGW. +Comment[eu]=Proiektu hau konpilatzeko eta exekutatzeko Wine eta MinGw instalatuta izan behar dituzu. +Comment[fa]=برای ترجمه و اجرای این پروژه، هم نیاز به نصب Wine و هم نیاز به MinGW دارید. +Comment[fr]=Pour que ce projet compile et s'exécute, vous devez installer Wine et MinGW. +Comment[gl]=Para poder compilar e executar este proxecto necesita ter instalados Wine e MinGW. +Comment[hu]=A projekt lefordításához és futtatásához szükség van a Wine és a MinGW telepítésére. +Comment[it]=Per compilare ed eseguire questo progetto dei avere sia Wine che MinGW installati. +Comment[nds]=Wine un MinGW mööt installeert wesen, wenn Du dit Projekt kompileren un utföhren wullt. +Comment[ne]=यो परियोजनाका लागि कम्पाइल गर्न र चलाउन तपाईँले वाइन र MinGW स्थापना गरेको हुनुपर्दछ । +Comment[nl]=Om dit project te kunnen compileren en uitvoeren hebt u Wine en MinGW nodig. +Comment[pl]=Do kompilacji takiego projektu potrzebne są Wine oraz MinGW. +Comment[pt]=Para este projecto poder ser compilado e executado é necessário ter tanto o Wine como o MinGW instalados. +Comment[pt_BR]=Para este projecto poder ser compilado e executado é necessário ter tanto o Wine como o MinGW instalados. +Comment[ru]=Для сборки и запуска этого проекта вам необходимо установить Wine и MinGW . +Comment[sk]=Na kompiláciu tohoto projektu potrebujete mať nainštalované Wine a MinGW. +Comment[sr]=Да би се овај пројекат превео и покренуо, и Wine и MinGW морају бити инсталирани. +Comment[sr@Latn]=Da bi se ovaj projekat preveo i pokrenuo, i Wine i MinGW moraju biti instalirani. +Comment[sv]=För att projektet ska kompileras och köras behöver du ha installerat både Wine och MinGW. +Comment[tr]=Bu projenin derlenmesi için Wine ve MinGW'nin kurulu olması lazım. +Comment[zh_CN]=要让此工程能够编译并运行,您需要同时安装 Wine 和 MinGW。 +Comment[zh_TW]=這個專案要編譯,您需要安裝 Wine 與 MinGW。 + diff --git a/languages/cpp/app_templates/win32hello/win32hello.png b/languages/cpp/app_templates/win32hello/win32hello.png new file mode 100644 index 00000000..3f33a1b5 Binary files /dev/null and b/languages/cpp/app_templates/win32hello/win32hello.png differ diff --git a/languages/cpp/app_templates/wxhello/.kdev_ignore b/languages/cpp/app_templates/wxhello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/wxhello/Makefile.am b/languages/cpp/app_templates/wxhello/Makefile.am new file mode 100644 index 00000000..5f1a213a --- /dev/null +++ b/languages/cpp/app_templates/wxhello/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = src-Makefile.am app.cpp app.h app.kdevelop subdirs \ + app.desktop wxhello.png + +templateName = wxhello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/cpp/app_templates/wxhello/app.cpp b/languages/cpp/app_templates/wxhello/app.cpp new file mode 100644 index 00000000..6bcb3d47 --- /dev/null +++ b/languages/cpp/app_templates/wxhello/app.cpp @@ -0,0 +1,52 @@ +#include +#include "%{APPNAMELC}.h" + +BEGIN_EVENT_TABLE( %{APPNAME}Frame, wxFrame ) + EVT_MENU( Menu_File_Quit, %{APPNAME}Frame::OnQuit ) + EVT_MENU( Menu_File_About, %{APPNAME}Frame::OnAbout ) +END_EVENT_TABLE() + +IMPLEMENT_APP(%{APPNAME}app) + + +bool +%{APPNAME}app::OnInit() +{ + %{APPNAME}Frame *frame = new %{APPNAME}Frame( wxT( "Hello World" ), wxPoint(50,50), wxSize(450,340) ); + + frame->Show(TRUE); + SetTopWindow(frame); + return TRUE; +} + +%{APPNAME}Frame::%{APPNAME}Frame( const wxString& title, const wxPoint& pos, const wxSize& size ) + : wxFrame((wxFrame *)NULL, -1, title, pos, size) +{ + wxMenu *menuFile = new wxMenu; + + menuFile->Append( Menu_File_About, wxT( "&About..." ) ); + menuFile->AppendSeparator(); + menuFile->Append( Menu_File_Quit, wxT( "E&xit" ) ); + + wxMenuBar *menuBar = new wxMenuBar; + menuBar->Append( menuFile, wxT( "&File" ) ); + + SetMenuBar( menuBar ); + + CreateStatusBar(); + SetStatusText( wxT( "Welcome to Kdevelop wxWidgets app!" ) ); +} + +void +%{APPNAME}Frame::OnQuit( wxCommandEvent& WXUNUSED( event ) ) +{ + Close(TRUE); +} + +void +%{APPNAME}Frame::OnAbout( wxCommandEvent& WXUNUSED( event ) ) +{ + wxMessageBox( wxT( "This is a wxWidgets Hello world sample" ), + wxT( "About Hello World" ), wxOK | wxICON_INFORMATION, this ); +} + diff --git a/languages/cpp/app_templates/wxhello/app.desktop b/languages/cpp/app_templates/wxhello/app.desktop new file mode 100644 index 00000000..e87774fa --- /dev/null +++ b/languages/cpp/app_templates/wxhello/app.desktop @@ -0,0 +1,39 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} +Icon=%{APPNAMELC} +Type=Application +Comment=A simple wxWidgets Application +Comment[ca]=Una simple aplicació per a wxWidgets +Comment[da]=Et simpelt wxWidgets program +Comment[de]=Eine einfache wxWidgets-Anwendung +Comment[el]=Μια απλή εφαρμογή wxWidgets +Comment[es]=Una aplicación wxWidgets sencilla +Comment[et]=Lihtne wxWidgets rakendus +Comment[eu]=wxWidgets aplikazio sinple bat +Comment[fa]=یک کاربرد سادۀ wxWidgets +Comment[fr]=Une application avec wxWidgets simple +Comment[ga]=Feidhmchlár Simplí wxWidgets +Comment[gl]=Unha aplicación sinxela wxWidgets +Comment[hi]=एक सादा डब्ल्यूएक्स-विज़ेट्स अनुप्रयोग +Comment[hu]=Egyszerű wxWidgets-alkalmazás +Comment[is]=Einfalt wxWidgets forrit +Comment[it]=Semplice applicazione wxWidgets +Comment[ja]=シンプルな wxWidget アプリケーション +Comment[nds]=En eenfach wxWidgets-Programm +Comment[ne]=साधारण wxWidgets अनुप्रयोग +Comment[nl]=Een eenvoudige wxWidgets-toepassing +Comment[pl]=Prosty program wxWidgets +Comment[pt]=Uma aplicação simples de wxWidgets +Comment[pt_BR]=Um simples Aplicativo wxWidgets +Comment[ru]=Создание простого приложения wxWidgets +Comment[sk]=Jednoduchá wxWidgets aplikácia +Comment[sl]=Preprost program za wxWidgets +Comment[sr]=Једноставан wxWindows програм +Comment[sr@Latn]=Jednostavan wxWindows program +Comment[sv]=Ett enkelt wxWidgets-program +Comment[ta]=சாதாரண wxசாளரங்கள் பயன்பாடு +Comment[tg]=Гузориши оддии wxWidgets +Comment[tr]=Basit bir Merhaba wmWidgets Uygulaması +Comment[zh_CN]=一个简单的 wxWidgets 应用程序 +Comment[zh_TW]=簡單的 wxWidgets 應用程式 diff --git a/languages/cpp/app_templates/wxhello/app.h b/languages/cpp/app_templates/wxhello/app.h new file mode 100644 index 00000000..cb4be988 --- /dev/null +++ b/languages/cpp/app_templates/wxhello/app.h @@ -0,0 +1,36 @@ + +#ifndef _%{APPNAMEUC}_H_ +#define _%{APPNAMEUC}_H_ + +/** + * @short Application Main Window + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ + +class +%{APPNAME}app : public wxApp +{ + public: + virtual bool OnInit(); +}; + +class +%{APPNAME}Frame : public wxFrame +{ + public: + %{APPNAME}Frame( const wxString& title, const wxPoint& pos, const wxSize& size ); + void OnQuit( wxCommandEvent& event ); + void OnAbout( wxCommandEvent& event ); + + private: + DECLARE_EVENT_TABLE() +}; + +enum +{ + Menu_File_Quit = 100, + Menu_File_About +}; + +#endif // _%{APPNAMEUC}_H_ diff --git a/languages/cpp/app_templates/wxhello/app.kdevelop b/languages/cpp/app_templates/wxhello/app.kdevelop new file mode 100644 index 00000000..77835163 --- /dev/null +++ b/languages/cpp/app_templates/wxhello/app.kdevelop @@ -0,0 +1,114 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + C++ + + C++ + Code + wxWidgets + + + + + src/%{APPNAMELC} + debug + + + src/%{APPNAMELC} + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -O0 -g3 + + + + + + + + + + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + libtool + + + + + + + + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + + diff --git a/languages/cpp/app_templates/wxhello/src-Makefile.am b/languages/cpp/app_templates/wxhello/src-Makefile.am new file mode 100644 index 00000000..f93393e6 --- /dev/null +++ b/languages/cpp/app_templates/wxhello/src-Makefile.am @@ -0,0 +1,14 @@ +# these are the headers for your project +noinst_HEADERS = %{APPNAMELC}.h + +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = %{APPNAMELC} + +# the application source, library search path, and link libraries +%{APPNAMELC}_SOURCES = %{APPNAMELC}.cpp +%{APPNAMELC}_LDFLAGS = $(WX_LIBS) + diff --git a/languages/cpp/app_templates/wxhello/subdirs b/languages/cpp/app_templates/wxhello/subdirs new file mode 100644 index 00000000..85de9cf9 --- /dev/null +++ b/languages/cpp/app_templates/wxhello/subdirs @@ -0,0 +1 @@ +src diff --git a/languages/cpp/app_templates/wxhello/wxhello b/languages/cpp/app_templates/wxhello/wxhello new file mode 100644 index 00000000..2e0d224f --- /dev/null +++ b/languages/cpp/app_templates/wxhello/wxhello @@ -0,0 +1,105 @@ +# wxWidgets Config File +[General] +Name=Simple Hello wxWidgets Application +Name[fr]=Un simple programme de test Hello world +Category=C++/wxWidgets +Comment=Generates a simple wxWidgets Hello application. +Comment[fr]=Gnre un simple programme de test du type Hello world en utilisant la bibliothque wxWidgets. +FileTemplates=h,CStyle,cpp,CStyle +Icon=wxhello.png +ShowFilesAfterGeneration=src/APPNAMELC.cpp + +[LICENSE] +Type=install +Source=%{src}/template-common/%{LICENSEFILE} +Dest=%{dest}/%{LICENSEFILE} + +[GNU] +Type=install archive +Source=%{src}/template-common/gnu.tar.gz +Dest=%{dest} + +[SRC] +Type= mkdir +Dir=%{dest}/src + +[DOCSDIR] +Type=mkdir +Dir=%{dest}/doc + +[DOCSDIREN] +Type=mkdir +Dir=%{dest}/doc/en + +[DOCSMAKEFILE.AM1] +Type=install +Source=%{src}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am +Option=INSTALL_DOCS + +[DOCSMAKEFILE.AM2] +Type=install +Source=%{src}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am +Option=INSTALL_DOCS + +[DOCS] +Type=install +Source=%{src}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook +Option=INSTALL_DOCS + +[PROJECT] +Type=install +Source=%{src}/template-wxhello/app.kdevelop +Dest=%{dest}/${APPNAMELC}.kdevelop + +[WXMAKEFILE.AM] +Type=install +Source=%${src}/template-common/wx-Makefile.am +Dest=%{dest}/Makefile.am + +[WXMAKEFILE.CVS] +Type=install +Source=%${src}/template-common/wx-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[WXCONFIGURE.IN] +Type=install +Source=%${src}/template-common/wx-configure.in +Dest=%{dest}/configure.in + +[APPICON.16] +Type=install +Source=%${src}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-${APPNAMELC}.png + +[APPICON.32] +Type=install +Source=%${src}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-${APPNAMELC}.png + +[SUBDIRS] +Type=install +Source=%${src}/template-wxhello/subdirs +Dest=%{dest}/subdirs + +[SRC.MAKEFILE.AM] +Type=install +Source=%${src}/template-wxhello/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[APP.CPP] +Type=install +Source=%${src}/template-wxhello/app.cpp +Dest=%{dest}/src/${APPNAMELC}.cpp + +[APP.H] +Type=install +Source=%${src}/template-wxhello/app.h +Dest=%{dest}/src/${APPNAMELC}.h + +[APP.DESKTOP] +Type=install +Source=%${src}/template-wxhello/app.desktop +Dest=%{dest}/src/${APPNAMELC}.desktop \ No newline at end of file diff --git a/languages/cpp/app_templates/wxhello/wxhello.kdevtemplate b/languages/cpp/app_templates/wxhello/wxhello.kdevtemplate new file mode 100644 index 00000000..48e605e1 --- /dev/null +++ b/languages/cpp/app_templates/wxhello/wxhello.kdevtemplate @@ -0,0 +1,192 @@ +# KDE Config File +[General] +Name=Simple Hello wxWidgets Application +Name[ca]=Simple aplicació de Hello per a wxWidgets +Name[da]=Simpelt Goddag wxWidgets program +Name[de]=Einfache wxWidgets-Anwendung +Name[el]=Απλή εφαρμογή Γεια σου wxWidgets +Name[es]=Una sencilla aplicación «Hola mundo» con wxWidgets +Name[et]=Lihtne wxWidgets'i tervitusrakendus +Name[eu]=wxWidgets-en "Kaixo mundua" aplikazio sinple bat +Name[fa]=کاربرد سادۀ Hello wxWidgets +Name[fr]=Application « Bonjour monde » simple avec wxWidgets +Name[gl]=Aplicación sinxela Ola en wxWidgets +Name[hu]=wxWidgets-alapú Hello world program +Name[it]=Semplice applicazione wxWidgets di "Hello" +Name[ja]=簡単な wxWidget アプリケーション +Name[nds]=Eenfach wxWidgets-Programm "Moin" +Name[ne]=साधारण हेल्लो wxWidgets अनुप्रयोग +Name[nl]=Eenvoudige Hello wxWidgets-toepassing +Name[pl]=Prosty program Witaj używający wxWidgets +Name[pt]=Aplicação Olá Mundo Simples do wxWidgets +Name[pt_BR]=Aplicação Olá Mundo Simples do wxWidgets +Name[ru]=Простое приложение wxWidgets +Name[sk]=Jednoduchá wxWidgets Ahoj svet aplikácia +Name[sr]=Једноставан „Здраво“ wxWidgets програм +Name[sr@Latn]=Jednostavan „Zdravo“ wxWidgets program +Name[sv]=Enkelt Hello-program för wxWidgets +Name[tr]=Basit Merhaba wxWidgets Uygulaması +Name[zh_CN]=一个简单的 wxWidgets 应用程序 +Name[zh_TW]=簡單的 Hello wxWidgets 應用程式 +Category=C++/wxWidgets +Comment=Generates a simple wxWidgets Hello application. +Comment[ca]=Genera una simple aplicació de Hello per a wxWidgets. +Comment[da]=Genererer et simpelt wxWidgets Goddag-program. +Comment[de]=Erstellt eine einfache wxWidgets-Anwendung +Comment[el]=Δημιουργεί μια απλή εφαρμογή Γεια σου wxWidgets. +Comment[es]=Genera una sencilla aplicación «Hola mundo» con wxWidgets +Comment[et]=Lihtsa wxWidgets'i tervitusrakenduse loomine. +Comment[eu]=wxWidgets-en "Kaixo mundua"aplikazio sinple bat sortzen du. +Comment[fa]=یک کاربرد سادۀ wxWidgets Hello تولید می‌کند. +Comment[fr]=Une application « Bonjour monde » simple avec wxWidgets. +Comment[gl]=Xera unha aplicación sinxela Ola en wxWidgets. +Comment[hu]=Létrehoz egy egyszerű wxWidgets-alkalmazást. +Comment[it]=Genera una semplice applicazione wxWidgets di "Hello". +Comment[ja]=簡単な wxWidget アプリケーションを作成します +Comment[nds]=Stellt mit wxWidgets en eenfach "Moin"-Programm op. +Comment[ne]=साधारण wxWidgets हेल्लो अनुप्रयोग उत्पन्न गर्दछ +Comment[nl]=Genereert een eenvoudige wxWidget Hello-toepassing. +Comment[pl]=Generuje prosty program Witaj wykorzystujący wxWidgets +Comment[pt]=Gera uma aplicação simples de Olá Mundo do wxWidgets. +Comment[pt_BR]=Gera uma aplicação simples de Olá Mundo do wxWidgets. +Comment[ru]=Создание простого приложения wxWidgets. +Comment[sk]=Vygeneruje jednoduchú wxWidgets Ahoj svet aplikáciu. +Comment[sr]=Прави једноставан „Здраво“ wxWidgets програм. +Comment[sr@Latn]=Pravi jednostavan „Zdravo“ wxWidgets program. +Comment[sv]=Skapar ett enkelt Hello-program för wxWidgets. +Comment[tr]=Basit bir wxWidgets Merhaba uygulaması yaratır. +Comment[zh_CN]=生成一个简单的 wxWidgets Hello 应用程序。 +Comment[zh_TW]=產生一個簡單的 wxWidgets Hello 應用程式。 +FileTemplates=h,CStyle,cpp,CStyle +Icon=wxhello.png +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.cpp +Archive=wxhello.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[WXARCH] +Type=install archive +Source=%{kdevelop}/template-common/wxwidgets.tar.gz +Dest=%{dest} + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[WX] +Type=include +File=%{kdevelop}/template-common/wx.kdevtemplate + +[FILE4] +Type=install +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/wx-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/wx-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/wx-configure.in +Dest=%{dest}/configure.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +#[FILE10] +#Type=install +#Source=%{src}/subdirs +#Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/app.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/app.h +Dest=%{dest}/src/%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[MSG] +Type=message +Comment=Simple hello wxWidgets application was created in %{dest} +Comment[ca]=Simple aplicació de Hello per a wxWidgets ha estat creada en %{dest} +Comment[da]=Simpelt Goddag wxWidgets program blev oprettet i %{dest} +Comment[de]=Eine einfache wxWidgets-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια απλή εφαρμογή Γεια σου wxWidgets δημιουργήθηκε στο %{dest} +Comment[es]=Una sencilla aplicación «Hola mundo» con wxWidgets ha sido creada en %{dest} +Comment[et]=Lihtne wxWidgets'i tervitusrakendus loodi asukohta %{dest} +Comment[eu]=wxWidgets "Kaixo mundua" aplikazio sinple bat sortu da hemen: %{dest} +Comment[fa]=کاربرد سادۀ hello wxWidgets در %{dest} ایجاد شد +Comment[fr]=Une application « Bonjour monde » simple en wxWidgets a été créée dans %{dest} +Comment[gl]=Creouse unha aplicación sinxela Ola en wxWidgets en %{dest} +Comment[hu]=Létrejött egy egyszerű wxWidgets-alkalmazás itt: %{dest} +Comment[it]=È stata creata una semplice applicazione wxWidgets di "hello" in %{dest} +Comment[ja]=簡単な wxWidget アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach wxWidgets-Programm opstellt +Comment[ne]=साधारण हेल्लो wxWidgets अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Eenvoudige hello wxWidget-toepassing is aangemaakt in %{dest} +Comment[pl]=Prosty program Witaj wykorzystujący wxWidgets został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação simples de wxWidgets em %{dest} +Comment[pt_BR]=Foi criada uma aplicação simples de wxWidgets em %{dest} +Comment[ru]=Простое приложение wxWidgets создано в %{dest} +Comment[sk]=Jedniduchá wxWidgets Ahoj svet aplikácia bola vytvorená v %{dest} +Comment[sr]=Једноставан „Здраво“ wxWidgets програм направљен је у %{dest} +Comment[sr@Latn]=Jednostavan „Zdravo“ wxWidgets program napravljen je u %{dest} +Comment[sv]=Ett enkelt Hello-program för wxWidgets.skapades i %{dest} +Comment[tr]=Basit merhaba wxWidgets uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个简单的 wxWidgets Hello 应用程序 +Comment[zh_TW]=一個簡單的 hello wxWidgets 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/wxhello/wxhello.png b/languages/cpp/app_templates/wxhello/wxhello.png new file mode 100644 index 00000000..fbe48423 Binary files /dev/null and b/languages/cpp/app_templates/wxhello/wxhello.png differ diff --git a/languages/cpp/ast_utils.cpp b/languages/cpp/ast_utils.cpp new file mode 100644 index 00000000..d21f4782 --- /dev/null +++ b/languages/cpp/ast_utils.cpp @@ -0,0 +1,190 @@ +/*************************************************************************** +* Copyright (C) 2002 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "ast_utils.h" +#include "ast.h" + +#include +#include + +#include +#include +#include + +#include + +#include "cppsupport_utils.h" + +AST* findNodeAt( AST* node, int line, int column ) +{ + // kdDebug(9007) << "findNodeAt(" << node << ")" << endl; + + if ( !node ) + return 0; + + int startLine, startColumn; + int endLine, endColumn; + + node->getStartPosition( &startLine, &startColumn ); + node->getEndPosition( &endLine, &endColumn ); + + if ( ( line > startLine || ( line == startLine && column >= startColumn ) ) && + ( line < endLine || ( line == endLine && column < endColumn ) ) ) + { + + QPtrList children = node->children(); + QPtrListIterator it( children ); + while ( it.current() ) + { + AST * a = it.current(); + ++it; + + AST* r = findNodeAt( a, line, column ); + if ( r ) + return r; + } + + return node; + } + + return 0; +} + +void scopeOfNode( AST* ast, QStringList& scope ) +{ + if ( !ast ) + return ; + + if ( ast->parent() ) + scopeOfNode( ast->parent(), scope ); + + QString s; + switch ( ast->nodeType() ) + { + case NodeType_ClassSpecifier: + if ( ( ( ClassSpecifierAST* ) ast ) ->name() ) + { + s = ( ( ClassSpecifierAST* ) ast ) ->name() ->text(); + s = s.isEmpty() ? QString::fromLatin1( "" ) : s; + scope.push_back( s ); + } + break; + + case NodeType_Namespace: + { + AST* namespaceName = ( ( NamespaceAST* ) ast ) ->namespaceName(); + s = namespaceName ? namespaceName->text() : QString::fromLatin1( "" ); + scope.push_back( s ); + } + break; + + case NodeType_FunctionDefinition: + { + FunctionDefinitionAST* funDef = static_cast( ast ); + DeclaratorAST* d = funDef->initDeclarator() ->declarator(); + + // hotfix for bug #68726 + if ( !d->declaratorId() ) + break; + + QPtrList l = d->declaratorId() ->classOrNamespaceNameList(); + QPtrListIterator nameIt( l ); + while ( nameIt.current() ) + { + AST * name = nameIt.current() ->name(); + scope.push_back( name->text() ); + + ++nameIt; + } + } + break; + + default: + break; + } +} + + +QString typeSpecToString( TypeSpecifierAST* typeSpec ) /// @todo remove +{ + if ( !typeSpec ) + return QString::null; + + return typeSpec->text().replace( QRegExp( " :: " ), "::" ); +} + +QString declaratorToString( DeclaratorAST* declarator, const QString& scope, bool skipPtrOp ) +{ + if ( !declarator ) + return QString::null; + + QString text; + + if ( !skipPtrOp ) + { + QPtrList ptrOpList = declarator->ptrOpList(); + for ( QPtrListIterator it( ptrOpList ); it.current(); ++it ) + { + text += it.current() ->text(); + } + text += " "; + } + + text += scope; + + if ( declarator->subDeclarator() ) + text += QString::fromLatin1( "(" ) + declaratorToString( declarator->subDeclarator() ) + QString::fromLatin1( ")" ); + + if ( declarator->declaratorId() ) + text += declarator->declaratorId() ->text(); + + QPtrList arrays = declarator->arrayDimensionList(); + QPtrListIterator it( arrays ); + while ( it.current() ) + { + text += "[]"; + ++it; + } + + if ( declarator->parameterDeclarationClause() ) + { + text += formattedOpeningParenthesis(); + + ParameterDeclarationListAST* l = declarator->parameterDeclarationClause() ->parameterDeclarationList(); + if ( l != 0 ) + { + QPtrList params = l->parameterList(); + QPtrListIterator it( params ); + + while ( it.current() ) + { + QString type = typeSpecToString( it.current() ->typeSpec() ); + text += type; + if ( !type.isEmpty() ) + text += " "; + text += declaratorToString( it.current() ->declarator() ); + + ++it; + + if ( it.current() ) + text += ", "; + } + } + + text += formattedClosingParenthesis(); + + if ( declarator->constant() != 0 ) + text += " const"; + } + + return text.replace( QRegExp( " :: " ), "::" ).simplifyWhiteSpace(); +} +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/ast_utils.h b/languages/cpp/ast_utils.h new file mode 100644 index 00000000..ce9ec99f --- /dev/null +++ b/languages/cpp/ast_utils.h @@ -0,0 +1,34 @@ +/*************************************************************************** +* Copyright (C) 2002 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef __ast_utils_h +#define __ast_utils_h + +#include + +class AST; +class DeclaratorAST; +class TypeSpecifierAST; +class QStringList; + +namespace KTextEditor +{ + class EditInterface; +} + +AST* findNodeAt( AST* unit, int line, int column ); +void scopeOfNode( AST* ast, QStringList& ); +QString typeSpecToString( TypeSpecifierAST* typeSpec ); +QString declaratorToString( DeclaratorAST* declarator, const QString& scope = QString::null, bool skipPtrOp = false ); + +#endif // __ast_utils_h +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/backgroundparser.cpp b/languages/cpp/backgroundparser.cpp new file mode 100644 index 00000000..ed51d0c6 --- /dev/null +++ b/languages/cpp/backgroundparser.cpp @@ -0,0 +1,552 @@ +/*************************************************************************** +* Copyright (C) 2002 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "backgroundparser.h" +#include "cppsupportpart.h" +#include "cppsupport_events.h" +#include "codeinformationrepository.h" +#include "cppcodecompletion.h" +#include "ast_utils.h" +#include "kdevdeepcopy.h" +#include "kdevdriver.h" + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + + +class BackgroundKDevDriver : public KDevDriver { +public: + BackgroundKDevDriver( CppSupportPart* cppSupport, BackgroundParser* bp ) : KDevDriver( cppSupport, false ), m_backgroundParser(bp) { + } + virtual void fileParsed( ParsedFile& fileName ); + virtual void addDependence( const QString& fileName, const Dependence& dep ); +private: + BackgroundParser* m_backgroundParser; +}; + + +class KDevSourceProvider: public SourceProvider +{ +public: + //Deadlock is a mutex that is locked when KDevSourceProvider::contents(..) is used, and that should be unlocked before QApplication is locked(that way a deadlock where the thread that holds the QApplication-mutex and tries to lock the given mutex, while the thread that calls contents(..) and holds the given mutex and tries to lock the QApplication-mutex, cannot happen) + KDevSourceProvider( CppSupportPart* cppSupport, QMutex& deadlock ) + : m_cppSupport( cppSupport ), + m_readFromDisk( false ), + m_deadlock(deadlock) + {} + + void setReadFromDisk( bool b ) + { + m_readFromDisk = b; + } + bool readFromDisk() const + { + return m_readFromDisk; + } + + virtual QString contents( const QString& fileName ) + { + QString contents = QString::null; + + if ( !m_readFromDisk ) + { + m_deadlock.unlock(); + // GET LOCK + kapp->lock (); + + //kdDebug(9007) << "-------> kapp locked" << endl; + + QPtrList parts( *m_cppSupport->partController() ->parts() ); + QPtrListIterator it( parts ); + while ( it.current() ) + { + KTextEditor::Document * doc = dynamic_cast( it.current() ); + ++it; + + KTextEditor::EditInterface* editIface = dynamic_cast( doc ); + if ( !doc || !editIface || doc->url().path() != fileName ) + continue; + + contents = QString( editIface->text().ascii() ); // deep copy + + //kdDebug(9007) << "-------> kapp unlocked" << endl; + + break; + } + + // RELEASE LOCK + kapp->unlock(); + m_deadlock.lock(); + //kdDebug(9007) << "-------> kapp unlocked" << endl; + } + + if( m_readFromDisk || contents == QString::null ) + { + QFile f( fileName ); + if ( f.open( IO_ReadOnly ) ) + { + QTextStream stream( &f ); + contents = stream.read(); + f.close(); + } + } + + return contents; + } + + virtual bool isModified( const QString& fileName ) + { + bool ret = false; + m_deadlock.unlock(); + kapp->lock (); + + KParts::ReadOnlyPart *part = m_cppSupport->partController()->partForURL( KURL(fileName) ); + KTextEditor::Document * doc = dynamic_cast( part ); + + if ( doc ) + ret = doc->isModified(); + + kapp->unlock(); + m_deadlock.lock(); + return ret; + } + +private: + CppSupportPart* m_cppSupport; + bool m_readFromDisk; + QMutex& m_deadlock; +private: + KDevSourceProvider( const KDevSourceProvider& source ); + void operator = ( const KDevSourceProvider& source ); +}; + +typedef std::string SafeString; + +class SynchronizedFileList +{ + typedef std::list< QPair > ListType; +public: + SynchronizedFileList() + {} + + bool isEmpty() const + { + QMutexLocker locker( &m_mutex ); + return m_fileList.empty(); + } + + uint count() const + { + QMutexLocker locker( &m_mutex ); + return m_fileList.size(); + } + + QPair front() const + { + QMutexLocker locker( &m_mutex ); + return m_fileList.front(); + } + + void clear() + { + QMutexLocker locker( &m_mutex ); + m_fileList.clear(); + } + + void push_front( const QString& fileName, bool readFromDisk = false ) + { + SafeString s( fileName.ascii() ); + QMutexLocker locker( &m_mutex ); + m_fileList.push_front( qMakePair( s, readFromDisk ) ); + } + + void push_back( const QString& fileName, bool readFromDisk = false ) + { + SafeString s( fileName.ascii() ); + QMutexLocker locker( &m_mutex ); + m_fileList.push_back( qMakePair( s, readFromDisk ) ); + } + + void pop_front() + { + QMutexLocker locker( &m_mutex ); + m_fileList.pop_front(); + } + + int count( const QString& fileName ) const { + int c = 0; + + QMutexLocker locker( &m_mutex ); + ListType::const_iterator it = m_fileList.begin(); + while ( it != m_fileList.end() ) + { + if ( ( *it ).first.compare( fileName.ascii() ) == 0 ) + ++c; + ++it; + } + return c; + } + + QPair takeFront() + { + QMutexLocker locker( &m_mutex ); + QPair ret = m_fileList.front(); + m_fileList.pop_front(); + return ret; + } + + bool contains( const QString& fileName ) const + { + QMutexLocker locker( &m_mutex ); + ListType::const_iterator it = m_fileList.begin(); + while ( it != m_fileList.end() ) + { + if ( ( *it ).first.compare( fileName.ascii() ) == 0 ) + return true; + ++it; + } + return false; + } + + void remove( const QString& fileName ) + { + QMutexLocker locker( &m_mutex ); + ListType::iterator it = m_fileList.begin(); + while ( it != m_fileList.end() ) + { + if ( ( *it ).first.compare(fileName.ascii() ) == 0 ) + m_fileList.erase( it++ ); + else + ++it; + } + } + +private: + mutable QMutex m_mutex; + ListType m_fileList; +}; + +BackgroundParser::BackgroundParser( CppSupportPart* part, QWaitCondition* consumed ) +: m_consumed( consumed ), m_cppSupport( part ), m_close( false ), m_saveMemory( false ) +{ + m_fileList = new SynchronizedFileList(); + m_driver = new BackgroundKDevDriver( m_cppSupport, this ); + m_driver->setSourceProvider( new KDevSourceProvider( m_cppSupport, m_mutex ) ); + + QString conf_file_name = m_cppSupport->specialHeaderName(); + m_mutex.lock(); + if ( QFile::exists( conf_file_name ) ) + m_driver->parseFile( conf_file_name, true, true, true ); + m_mutex.unlock(); + + //disabled for now m_driver->setResolveDependencesEnabled( true ); +} + +BackgroundParser::~BackgroundParser() +{ + removeAllFiles(); + + delete( m_driver ); + m_driver = 0; + + delete m_fileList; + m_fileList = 0; +} + +void BackgroundParser::addFile( const QString& fileName, bool readFromDisk ) +{ + QString fn = deepCopy( fileName ); + + //bool added = false; + /*if ( !m_fileList->contains( fn ) ) + { + m_fileList->push_back( fn, readFromDisk ); + added = true; + }*/ + m_fileList->push_back( fn, readFromDisk ); + + //if ( added ) + m_canParse.wakeAll(); +} + +void BackgroundParser::addFileFront( const QString& fileName, bool readFromDisk ) +{ + QString fn = deepCopy( fileName ); + + bool added = false; + /*if ( m_fileList->contains( fn ) ) + m_fileList->remove( fn );*/ + + m_fileList->push_front( fn, readFromDisk ); + added = true; + + if ( added ) + m_canParse.wakeAll(); +} + +void BackgroundParser::removeAllFiles() +{ + kdDebug( 9007 ) << "BackgroundParser::removeAllFiles()" << endl; + QMutexLocker locker( &m_mutex ); + + QMap::Iterator it = m_unitDict.begin(); + while ( it != m_unitDict.end() ) + { + Unit * unit = it.data(); + ++it; + delete( unit ); + unit = 0; + } + m_unitDict.clear(); + m_driver->reset(); + m_fileList->clear(); + + m_isEmpty.wakeAll(); +} + +void BackgroundParser::removeFile( const QString& fileName ) +{ + QMutexLocker locker( &m_mutex ); + + Unit* unit = findUnit( fileName ); + if ( unit ) + { + m_driver->remove + ( fileName ); + m_unitDict.remove( fileName ); + delete( unit ); + unit = 0; + } + + if ( m_fileList->isEmpty() ) + m_isEmpty.wakeAll(); +} + +void BackgroundKDevDriver::addDependence( const QString& fileName, const Dependence& dep ) { + //give waiting threads a chance to perform their actions + m_backgroundParser->m_mutex.unlock(); + m_backgroundParser->m_mutex.lock(); + KDevDriver::addDependence( fileName, dep ); +} + +void BackgroundKDevDriver::fileParsed( ParsedFile& fileName ) { + m_backgroundParser->fileParsed( fileName ); +} + +void BackgroundParser::parseFile( const QString& fileName, bool readFromDisk, bool lock ) +{ + if( lock ) + m_mutex.lock(); + m_readFromDisk = readFromDisk; + static_cast( m_driver->sourceProvider() ) ->setReadFromDisk( readFromDisk ); + + m_driver->remove( fileName ); + m_driver->parseFile( fileName , false, true ); + if( !m_driver->isResolveDependencesEnabled() ) + m_driver->removeAllMacrosInFile( fileName ); // romove all macros defined by this + // translation unit. + if ( lock ) + m_mutex.unlock(); +} + +QValueList cloneProblemList( const QValueList& list ) { + QValueList ret; + for( QValueList::const_iterator it = list.begin(); it != list.end(); ++it ) { + ret << Problem( *it, true ); + } + return ret; +} + +void BackgroundParser::fileParsed( ParsedFile& file ) { + + ParsedFilePointer translationUnitUnsafe = m_driver->takeTranslationUnit( file.fileName() ); + //now file and translationUnitUnsafe are the same + ParsedFilePointer translationUnit; + //Since the lexer-cache keeps many QStrings like macro-names used in the background, everything must be copied here. The safest solution is just + //serializing and deserializing the whole thing(the serialization does not respect the AST, but that can be copied later because that's safe) + QMemArray data; + { + QDataStream stream( data, IO_WriteOnly ); + translationUnitUnsafe->write( stream ); + } + { + QDataStream stream( data, IO_ReadOnly ); + translationUnit = new ParsedFile( stream ); + } + + translationUnit->setTranslationUnit( translationUnitUnsafe->operator TranslationUnitAST *() ); //Copy the AST, doing that is thread-safe + translationUnitUnsafe->setTranslationUnit( 0 ); //Move the AST completely out of this thread's scope. Else it might crash on dual-core machines + file.setTranslationUnit(0); //just to be sure, set to zero on both + + Unit* unit = new Unit; + unit->fileName = file.fileName(); + unit->translationUnit = translationUnit; + unit->problems = cloneProblemList( m_driver->problems( file.fileName() ) ); + + static_cast( m_driver->sourceProvider() ) ->setReadFromDisk( false ); + + if ( m_unitDict.find( file.fileName() ) != m_unitDict.end() ) + { + Unit * u = m_unitDict[ file.fileName() ]; + m_unitDict.remove( file.fileName() ); + delete( u ); + u = 0; + } + + m_unitDict.insert( file.fileName(), unit ); + + KApplication::postEvent( m_cppSupport, new FileParsedEvent( file.fileName(), unit->problems, m_readFromDisk ) ); + + m_currentFile = QString::null; + + if ( m_fileList->isEmpty() ) + m_isEmpty.wakeAll(); +} + +Unit* BackgroundParser::findUnit( const QString& fileName ) +{ + QMap::Iterator it = m_unitDict.find( fileName ); + return it != m_unitDict.end() ? *it : 0; +} + +bool BackgroundParser::hasTranslationUnit( const QString& fileName ) { + QMap::Iterator it = m_unitDict.find( fileName ); + return it != m_unitDict.end(); +} + +ParsedFilePointer BackgroundParser::translationUnit( const QString& fileName ) +{ + Unit * u = findUnit( fileName ); + if ( u == 0 ) + { + return 0; + /*m_fileList->remove + ( fileName ); + u = parseFile( fileName, false );*/ + } + + return u->translationUnit; +} + +QValueList BackgroundParser::problems( const QString& fileName, bool readFromDisk, bool forceParse ) +{ + Q_UNUSED(readFromDisk); + Unit * u = findUnit( fileName ); + if ( u == 0 || forceParse ) + { + /* + m_fileList->remove + ( fileName ); + u = parseFile( fileName, readFromDisk ); */ + } + + return u ? u->problems : QValueList(); +} + +void BackgroundParser::close() +{ + { + QMutexLocker locker( &m_mutex ); + m_close = true; + m_canParse.wakeAll(); + } + kapp->unlock(); + + while ( running() ) + sleep( 1 ); + kapp->lock(); +} + +bool BackgroundParser::filesInQueue() +{ + QMutexLocker locker( &m_mutex ); + + return m_fileList->count() || !m_currentFile.isEmpty(); +} + +int BackgroundParser::countInQueue( const QString& file ) const { + return m_fileList->count( file ); +} + +void BackgroundParser::updateParserConfiguration() +{ + QMutexLocker locker( &m_mutex ); + + m_driver->setup(); + QString conf_file_name = m_cppSupport->specialHeaderName(); + m_driver->removeAllMacrosInFile( conf_file_name ); + m_driver->parseFile( conf_file_name, true, true, true ); +} + +void BackgroundParser::run() +{ + // (void) m_cppSupport->codeCompletion()->repository()->getEntriesInScope( QStringList(), false ); + + while ( !m_close ) + { + + while ( m_fileList->isEmpty() ) + { + if( m_saveMemory ) { + m_saveMemory = false; + m_driver->lexerCache()->saveMemory(); + } + + m_canParse.wait(); + + if ( m_close ) + break; + } + + if ( m_close ) + break; + + QPair entry = m_fileList->takeFront(); + QString fileName = entry.first.c_str(); + bool readFromDisk = entry.second; + m_currentFile = deepCopy(fileName); + + ( void ) parseFile( fileName, readFromDisk, true ); + + + m_currentFile = QString::null; + } + + kdDebug( 9007 ) << "!!!!!!!!!!!!!!!!!! BG PARSER DESTROYED !!!!!!!!!!!!" << endl; + +// adymo: commented to fix #88091 +// QThread::exit(); +} + +void BackgroundParser::saveMemory() { + m_saveMemory = true; //Delay the operation + m_canParse.wakeAll(); +} + + +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/backgroundparser.h b/languages/cpp/backgroundparser.h new file mode 100644 index 00000000..2bbf1173 --- /dev/null +++ b/languages/cpp/backgroundparser.h @@ -0,0 +1,122 @@ +/*************************************************************************** +* Copyright (C) 2002 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef BACKGROUNDPARSER_H +#define BACKGROUNDPARSER_H + +#include "ast.h" +#include "driver.h" + +#include +#include +#include +#include +#include + +class CppSupportPart; +class TranslationUnitAST; +class SynchronizedFileList; +class BackgroundKDevDriver; +class Unit +{ +public: + Unit() : translationUnit( 0 ) + {} + ~Unit() + { + translationUnit = 0; + } + + QString fileName; + QValueList problems; + ParsedFilePointer translationUnit; + +protected: + Unit( const Unit& source ); + void operator = ( const Unit& source ); +}; + +class BackgroundParser: public QThread +{ +public: + BackgroundParser( CppSupportPart*, QWaitCondition* consumed ); + virtual ~BackgroundParser(); + + QMutex& mutex() + { + return m_mutex; + } + void lock () + { + m_mutex.lock(); + } + void unlock() + { + m_mutex.unlock(); + } + + QWaitCondition& canParse() + { + return m_canParse; + } + QWaitCondition& isEmpty() + { + return m_isEmpty; + } + + bool filesInQueue(); + + int countInQueue( const QString& file ) const; + + void addFile( const QString& fileName, bool readFromDisk = false ); + void addFileFront( const QString& fileName, bool readFromDisk = false ); + void removeFile( const QString& fileName ); + void removeAllFiles(); + + bool hasTranslationUnit( const QString& fileName ); + ParsedFilePointer translationUnit( const QString& fileName ); + QValueList problems( const QString& fileName , bool readFromDisk = false, bool forceParse = false ); + void updateParserConfiguration(); + + ///Should be run on a regular basis(every X minutes). It reduces some caches etc. BackgroundParser must be locked before. + void saveMemory(); + + void close(); + + virtual void run(); + +protected: + friend class BackgroundKDevDriver; + void fileParsed( ParsedFile& fileName ); + Unit* findUnit( const QString& fileName ); + void parseFile( const QString& fileName, bool readFromDisk, bool lock = false ) + ; + +private: + class KDevDriver* m_driver; + QString m_currentFile; + QWaitCondition m_canParse; + QWaitCondition m_isEmpty; + QWaitCondition* m_consumed; + QMutex m_mutex; + SynchronizedFileList* m_fileList; + CppSupportPart* m_cppSupport; + bool m_close; + QMap m_unitDict; + bool m_saveMemory; //used to prevent blocking + + //State of parseFile(..): + bool m_readFromDisk; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/bithelpers.h b/languages/cpp/bithelpers.h new file mode 100644 index 00000000..3cb74420 --- /dev/null +++ b/languages/cpp/bithelpers.h @@ -0,0 +1,37 @@ + +/*************************************************************************** + copyright : (C) 2006 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __BITHELPERS_H__ +#define __BITHELPERS_H__ + +namespace BitHelpers { +template +inline Type addFlag( Type loc, Type add ) { + return (Type)( loc | add ); +} + +template +inline Type remFlag( Type loc, Type rem ) { + return (Type)( loc & (rem ^ 0xffffffff) ); +} + +template +inline Type bitInvert( Type val ) { + return (Type)(0xffffffff - (unsigned int)val); +} +} +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/ccconfigwidget.cpp b/languages/cpp/ccconfigwidget.cpp new file mode 100644 index 00000000..09b13938 --- /dev/null +++ b/languages/cpp/ccconfigwidget.cpp @@ -0,0 +1,590 @@ +/*************************************************************************** +* Copyright (C) 2001 by Daniel Engelschalt * +* daniel.engelschalt@gmx.net * +* Copyright (C) 2004 Jonas Jacobi * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ +// qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// kde includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// kdevelop includes +#include +#include +#include +#include +#include +// std includes +#include + +#include "cppsupportfactory.h" +#include "ccconfigwidget.h" +#include "qtbuildconfig.h" +#include "cppsupportpart.h" +#include "cppcodecompletionconfig.h" +#include "cppsplitheadersourceconfig.h" +#include "createpcsdialog.h" +#include "creategettersetterconfiguration.h" + +using namespace std; + + +CCConfigWidget::CCConfigWidget( CppSupportPart* part, QWidget* parent, const char* name ) + : CCConfigWidgetBase( parent, name ) +{ + m_pPart = part; + connect( m_pPart->codeRepository(), SIGNAL( catalogRegistered( Catalog* ) ), + this, SLOT( catalogRegistered( Catalog* ) ) ); + connect( m_pPart->codeRepository(), SIGNAL( catalogUnregistered( Catalog* ) ), + this, SLOT( catalogUnregistered( Catalog* ) ) ); + + connect( m_qtDir, SIGNAL(urlSelected(const QString &)), + this, SLOT(isValidQtDir(const QString &))); + connect( m_qtDir, SIGNAL(textChanged(const QString &)), + this, SLOT(isValidQtDir(const QString &))); + + initGeneralTab( ); + initQtTab(); + initCodeCompletionTab( ); + initGetterSetterTab( ); + initSplitTab(); + inputCodeCompletion->setRange( 0, 2000, 100, false ); + inputArgumentsHint->setRange( 0, 2000, 100, false ); +} + +void CCConfigWidget::initGeneralTab( ) +{ + QDomDocument dom = *m_pPart->projectDom(); + interface_suffix->setText( DomUtil::readEntry( dom, "/cppsupportpart/filetemplates/interfacesuffix", ".h" ) ); + implementation_suffix->setText( DomUtil::readEntry( dom, "/cppsupportpart/filetemplates/implementationsuffix", ".cpp" ) ); + + KConfig *config = CppSupportFactory::instance() ->config(); + if ( config ) + { + config->setGroup( "General" ); + m_switchShouldMatch->setChecked( config->readBoolEntry( "SwitchShouldMatch", true ) ); + m_showContextMenuExplosion->setChecked( config->readBoolEntry( "ShowContextMenuExplosion", false ) ); + } +} + +CCConfigWidget::~CCConfigWidget( ) +{} + +void CCConfigWidget::accept( ) +{ + saveFileTemplatesTab(); + saveQtTab(); + saveCodeCompletionTab(); + saveGetterSetterTab(); + saveSplitTab(); +} + +void CCConfigWidget::saveFileTemplatesTab( ) +{ + QDomDocument dom = *m_pPart->projectDom(); + DomUtil::writeEntry( dom, "/cppsupportpart/filetemplates/interfacesuffix", interface_suffix->text() ); + DomUtil::writeEntry( dom, "/cppsupportpart/filetemplates/implementationsuffix", implementation_suffix->text() ); + + KConfig *config = CppSupportFactory::instance() ->config(); + if ( config ) + { + config->setGroup( "General" ); + config->writeEntry( "SwitchShouldMatch", m_switchShouldMatch->isChecked() ); + config->writeEntry( "ShowContextMenuExplosion", m_showContextMenuExplosion->isChecked() ); + } +} + +void CCConfigWidget::initCodeCompletionTab( ) +{ + advancedOptions->header() ->hide(); + + CppCodeCompletionConfig* c = m_pPart->codeCompletionConfig(); + + inputCodeCompletion->setValue( c->codeCompletionDelay() ); + inputArgumentsHint->setValue( c->argumentsHintDelay() ); + checkAutomaticCodeCompletion->setChecked( c->automaticCodeCompletion() ); + checkAutomaticArgumentsHint->setChecked( c->automaticArgumentsHint() ); + + checkCompleteArgumentType->setChecked( c->processFunctionArguments() ); + checkCompleteReturnType->setChecked( c->processPrimaryTypes() ); + //checkShowOnlyAccessible->setChecked( c->showOnlyAccessibleItems() ); + + editNamespaceAlias->setText( c->namespaceAliases() ); + checkBox18->setChecked( c->showEvaluationContextMenu() ); + checkShowTypeEvaluationInStatusBar->setChecked( c->statusBarTypeEvaluation() ); + checkShowCommentInArgumentHint->setChecked( c->showCommentWithArgumentHint() ); + /* + switch( c->completionBoxItemOrder() ) { + case CppCodeCompletionConfig::ByAccessLevel: + radioGroupByAccess->setChecked( true ); + break; + case CppCodeCompletionConfig::ByClass: + radioGroupByClass->setChecked( true ); + break; + case CppCodeCompletionConfig::ByAlphabet: + radioGroupByAlphabet->setChecked( true ); + break; + }*/ + + QValueList catalogs = m_pPart->codeRepository() ->registeredCatalogs(); + for ( QValueList::Iterator it = catalogs.begin(); it != catalogs.end(); ++it ) + { + Catalog* c = *it; + QFileInfo dbInfo( c->dbName() ); + QCheckListItem* item = new QCheckListItem( advancedOptions, KURL::decode_string( dbInfo.baseName(true) ), QCheckListItem::CheckBox ); + item->setOn( c->enabled() ); + + m_catalogs[ item ] = c; + } + + checkPreprocessIncludedHeaders->setChecked( c->preProcessAllHeaders() && !c->parseMissingHeaders() ); + checkParseMissingHeaders->setChecked( c->parseMissingHeaders() ); + checkListGlobalItems->setChecked( c->alwaysIncludeNamespaces() ); + checkResolveIncludePaths->setChecked( c->resolveIncludePaths() ); + editIncludePaths->setText( c->customIncludePaths() ); +} + +void CCConfigWidget::saveCodeCompletionTab( ) +{ + CppCodeCompletionConfig * c = m_pPart->codeCompletionConfig(); + + c->setCodeCompletionDelay( inputCodeCompletion->value() ); + c->setArgumentsHintDelay( inputArgumentsHint->value() ); + + c->setAutomaticCodeCompletion( checkAutomaticCodeCompletion->isChecked() ); + c->setAutomaticArgumentsHint( checkAutomaticArgumentsHint->isChecked() ); + + c->setProcessFunctionArguments( checkCompleteArgumentType->isChecked() ); + c->setProcessPrimaryTypes( checkCompleteReturnType->isChecked() ); + //c->setShowOnlyAccessibleItems( checkShowOnlyAccessible->isChecked() ); + + c->setNamespaceAliases( editNamespaceAlias->text() ); + c->setShowEvaluationContextMenu( checkBox18->isChecked() ); + c->setStatusBarTypeEvaluation( checkShowTypeEvaluationInStatusBar->isChecked() ); + c->setShowCommentWithArgumentHint( checkShowCommentInArgumentHint->isChecked() ); + + /*if( radioGroupByAccess->isChecked() ) + c->setCompletionBoxItemOrder( CppCodeCompletionConfig::ByAccessLevel ); + + if( radioGroupByClass->isChecked() ) + c->setCompletionBoxItemOrder( CppCodeCompletionConfig::ByClass ); + + if( radioGroupByAlphabet->isChecked() ) + c->setCompletionBoxItemOrder( CppCodeCompletionConfig::ByAlphabet );*/ + + for ( QMap::Iterator it = m_catalogs.begin(); it != m_catalogs.end(); ++it ) + { + it.data() ->setEnabled( it.key() ->isOn() ); + } + + c->setPreProcessAllHeaders( checkPreprocessIncludedHeaders->isChecked() || checkParseMissingHeaders->isChecked() ); + c->setParseMissingHeaders( checkParseMissingHeaders->isChecked() ); + c->setAlwaysIncludeNamespaces( checkListGlobalItems->isChecked() ); + c->setResolveIncludePaths( checkResolveIncludePaths->isChecked() ); + c->setCustomIncludePaths( editIncludePaths->text() ); + + c->store(); +} + +void CCConfigWidget::slotNewPCS( ) +{ + CreatePCSDialog dlg( m_pPart, m_pPart->mainWindow() ->main() ); + dlg.importerListView->setFocus(); + dlg.exec(); +} + +void CCConfigWidget::slotRemovePCS() +{ + if ( !advancedOptions->selectedItem() ) + return ; + + QString db = advancedOptions->selectedItem() ->text( 0 ); + QString question = i18n( "Are you sure you want to delete the \"%1\" database?" ).arg( db ); + + KStandardDirs *dirs = m_pPart->instance() ->dirs(); + QString dbName = dirs->saveLocation( "data", "kdevcppsupport/pcs" ) + KURL::encode_string_no_slash( db ) + ".db"; + + if ( KMessageBox::Continue == KMessageBox::warningContinueCancel( 0, question, i18n( "Delete Database" ), KStdGuiItem::del() ) ) + { + m_pPart->removeCatalog( dbName ); + } +} + +void CCConfigWidget::catalogRegistered( Catalog * c ) +{ + QFileInfo dbInfo( c->dbName() ); + QCheckListItem* item = new QCheckListItem( advancedOptions, KURL::decode_string( dbInfo.baseName(true) ), QCheckListItem::CheckBox ); + item->setOn( c->enabled() ); + + m_catalogs[ item ] = c; +} + +void CCConfigWidget::catalogUnregistered( Catalog * c ) +{ + for ( QMap::Iterator it = m_catalogs.begin(); it != m_catalogs.end(); ++it ) + { + if ( it.data() == c ) + { + QCheckListItem * item = it.key(); + delete( item ); + m_catalogs.remove( it ); + break; + } + } +} + +void CCConfigWidget::initGetterSetterTab( ) +{ + CreateGetterSetterConfiguration * config = m_pPart->createGetterSetterConfiguration(); + + if ( config == 0 ) + return ; + + m_edtGet->setText( config->prefixGet() ); + m_edtSet->setText( config->prefixSet() ); + m_edtRemovePrefix->setText( config->prefixVariable().join( "," ) ); + m_edtParameterName->setText( config->parameterName() ); + + slotGetterSetterValuesChanged(); +} + +void CCConfigWidget::slotGetterSetterValuesChanged( ) +{ + bool hasError = false; + if ( m_edtParameterName->text().isEmpty() ) + { + m_lblParameterName->setPaletteForegroundColor( QColor( "red" ) ); + m_edtExampleGet->setText( "error, missing parametername" ); + m_edtExampleSet->setText( "error, missing parametername" ); + hasError = true; + } + + QString name = m_edtVariableName->text(); + if ( name.isEmpty() ) + { + m_lblVariableName->setPaletteForegroundColor( QColor( "red" ) ); + m_edtExampleGet->setText( "error, missing variablename" ); + m_edtExampleSet->setText( "error, missing variablename" ); + hasError = true; + } + + if ( hasError ) + { + m_edtExampleGet->setPaletteForegroundColor( QColor( "red" ) ); + m_edtExampleSet->setPaletteForegroundColor( QColor( "red" ) ); + + return ; + } + else + { + m_lblVariableName->setPaletteForegroundColor( QColor( "black" ) ); + m_lblParameterName->setPaletteForegroundColor( QColor( "black" ) ); + m_edtExampleGet->setPaletteForegroundColor( QColor( "black" ) ); + m_edtExampleSet->setPaletteForegroundColor( QColor( "black" ) ); + } + + QStringList prefixes = QStringList::split( ",", m_edtRemovePrefix->text().replace( " ", "" ) ); + unsigned int len = 0; + QStringList::ConstIterator theend = prefixes.end(); + for ( QStringList::ConstIterator ci = prefixes.begin(); ci != theend; ++ci ) + { + if ( name.startsWith( *ci ) && ( *ci ).length() > len ) + len = ( *ci ).length(); + } + + if ( len > 0 ) + name.remove( 0, len ); + + QString getName = name; + if ( !m_edtGet->text().isEmpty() ) + { + getName[ 0 ] = getName[ 0 ].upper(); + getName.prepend( m_edtGet->text() ); + } + + QString setName = name; + if ( !m_edtSet->text().isEmpty() ) + { + setName[ 0 ] = setName[ 0 ].upper(); + setName.prepend( m_edtSet->text() ); + } + + m_edtExampleGet->setText( "string " + getName + "() const;" ); + m_edtExampleSet->setText( "void " + setName + "(const string& " + m_edtParameterName->text() + ");" ); +} + +void CCConfigWidget::saveGetterSetterTab( ) +{ + if ( m_edtParameterName->text().isEmpty() || m_edtGet->text() == m_edtSet->text() ) + return ; + + CreateGetterSetterConfiguration* config = m_pPart->createGetterSetterConfiguration(); + if ( config == 0 ) + return ; + + config->setPrefixGet( m_edtGet->text() ); + config->setPrefixSet( m_edtSet->text() ); + config->setPrefixVariable( QStringList::split( ",", m_edtRemovePrefix->text().replace( " ", "" ) ) ); + config->setParameterName( m_edtParameterName->text() ); + config->store(); +} + +void CCConfigWidget::initSplitTab( ) +{ + CppSplitHeaderSourceConfig * config = m_pPart->splitHeaderSourceConfig(); + + if ( config == 0 ) + return ; + + m_splitEnable->setChecked( config->splitEnabled() ); + m_splitSync->setChecked( config->autoSync() ); + + QString o = config->orientation(); + m_splitVertical->setChecked( o == "Vertical" ); + m_splitHorizontal->setChecked( o == "Horizontal" ); +} + +void CCConfigWidget::saveSplitTab( ) +{ + CppSplitHeaderSourceConfig * config = m_pPart->splitHeaderSourceConfig(); + + if ( config == 0 ) + return ; + + config->setSplitEnable( m_splitEnable->isChecked() ); + config->setAutoSync( m_splitSync->isChecked() ); + + if ( m_splitVertical->isChecked() ) + config->setOrientation( "Vertical" ); + else if ( m_splitHorizontal->isChecked() ) + config->setOrientation( "Horizontal" ); + + config->store(); +} + +void CCConfigWidget::initQtTab() +{ + m_qtDir->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); + + QtBuildConfig* c = m_pPart->qtBuildConfig(); + c->init(); + + m_qtUsed->setChecked( c->isUsed() ); + if( c->version() == 4 ) + { + m_versionQt4->setChecked( true ); + m_kdevembedded->setEnabled( false ); + m_kdevexternal->setEnabled( false ); + m_qtStyleVersion4->setEnabled( true ); + m_designerPath->setEnabled( true ); + m_qmakePath->setEnabled( true ); + m_qtDir->setEnabled( false ); + m_txtQtDir->setEnabled( false ); + m_txtDesigner->setEnabled( true ); + pluginPaths->setEnabled( true ); + } + else + { + m_versionQt3->setChecked( true ); + m_kdevembedded->setEnabled( true ); + m_kdevexternal->setEnabled( true ); + m_qtStyleVersion4->setEnabled( false ); + m_designerPath->setEnabled( true ); + m_qmakePath->setEnabled( true ); + m_qtDir->setEnabled( true ); + m_txtQtDir->setEnabled( true ); + m_txtDesigner->setEnabled( true ); + pluginPaths->setEnabled( false ); + } + if( c->includeStyle() == 4 ) + { + m_qtStyleVersion4->setChecked( true ); + }else + { + m_qtStyleVersion3->setChecked( true ); + } + m_qtDir->setURL( c->root() ); + isValidQtDir(m_qtDir->url()); + m_qmakePath->setURL( c->qmakePath() ); + isExecutable( m_qmakePath->url() ); + m_designerPath->setURL( c->designerPath() ); + isExecutable( m_designerPath->url() ); + if ( c->designerIntegration() == "EmbeddedKDevDesigner" ) + { + m_kdevembedded->setChecked( true ); + } + else if ( c->designerIntegration() == "ExternalKDevDesigner" ) + { + m_kdevexternal->setChecked( true ); + }else + { + m_qtdesigner->setChecked( true ); + } +} + +bool CCConfigWidget::isExecutable( const QString& path ) +{ + QFileInfo fi(path); + + return ( fi.exists() && fi.isExecutable() ); +} + +void CCConfigWidget::isQMakeExecutable( const QString& path ) +{ + if( !isExecutable( path ) ) + { + m_qmakePath->lineEdit()->setPaletteForegroundColor(QColor("#ff0000")); + }else + { + m_qmakePath->lineEdit()->unsetPalette(); + } +} + +void CCConfigWidget::isDesignerExecutable( const QString& path ) +{ + if( !isExecutable( path ) ) + { + m_designerPath->lineEdit()->setPaletteForegroundColor(QColor("#ff0000")); + }else + { + m_designerPath->lineEdit()->unsetPalette(); + } +} + +void CCConfigWidget::saveQtTab() +{ + QtBuildConfig* c = m_pPart->qtBuildConfig(); + + c->setUsed( m_qtUsed->isChecked() ); + if( m_versionQt4->isChecked() ) + { + c->setVersion( 4 ); + } + else + { + c->setVersion( 3 ); + } + if( m_qtStyleVersion4->isChecked() ) + { + c->setIncludeStyle( 4 ); + }else + { + c->setIncludeStyle( 3 ); + } + c->setRoot( m_qtDir->url() ); + c->setQMakePath( m_qmakePath->url() ); + c->setDesignerPath( m_designerPath->url() ); + if( m_kdevembedded->isChecked() ) + { + c->setDesignerIntegration( "EmbeddedKDevDesigner" ); + } + else if ( m_kdevexternal->isChecked() ) + { + c->setDesignerIntegration( "ExternalKDevDesigner" ); + }else + { + c->setDesignerIntegration( "ExternalDesigner" ); + } + c->store(); +} + +void CCConfigWidget::isValidQtDir( const QString &dir ) +{ + QFileInfo inc( dir + QString( QChar( QDir::separator() ) )+ + "include"+QString( QChar( QDir::separator() ) )+ + "qt.h" ); + if ( !m_versionQt4->isChecked() && !inc.exists() ) + { + m_qtDir->lineEdit()->setPaletteForegroundColor(QColor("#ff0000")); + }else + { + m_qtDir->lineEdit()->unsetPalette(); + } +} + +void CCConfigWidget::toggleQtVersion( bool ) +{ + if ( m_versionQt3->isChecked() ) + { + m_qtStyleVersion4->setEnabled( false ); + m_qtStyleVersion3->setChecked( true ); + m_kdevembedded->setEnabled( true ); + m_kdevexternal->setEnabled( true ); + pluginPaths->setEnabled( false ); + } + if ( m_versionQt4->isChecked() ) + { + m_qtStyleVersion4->setEnabled( true ); + m_qtdesigner->setChecked( true ); + m_kdevembedded->setEnabled( false ); + m_kdevexternal->setEnabled( false ); + pluginPaths->setEnabled( true ); + } + isValidQtDir( m_qtDir->url() ); + isQMakeExecutable( m_qmakePath->url() ); + isDesignerExecutable( m_designerPath->url() ); +} + +void CCConfigWidget::openPluginPaths() +{ + kdDebug(9024) << "Plugin paths opened" << endl; + QtBuildConfig* c = m_pPart->qtBuildConfig(); + KDialog d( this ); + QVBoxLayout* mainlayout = new QVBoxLayout( &d ); + KPushButton* ok = new KPushButton( KStdGuiItem::ok(), &d ); + connect( ok, SIGNAL(clicked()), &d, SLOT(accept())); + KPushButton* cancel = new KPushButton( KStdGuiItem::cancel(), &d ); + connect( cancel, SIGNAL(clicked()), &d, SLOT(reject())); + QHBoxLayout* btns = new QHBoxLayout( &d ); + btns->addItem( new QSpacerItem(10,10,QSizePolicy::Expanding) ); + btns->addWidget(ok); + btns->addWidget(cancel); + + d.setCaption( i18n( "Edit Qt4 Designer Plugin Paths" ) ); + KURLRequester * req = new KURLRequester( &d ); + req->setMode( KFile::Directory ); + KEditListBox* p = new KEditListBox( i18n( "Plugin Paths" ), req->customEditor(), &d ); + p->insertStringList( c->designerPluginPaths() ); + mainlayout->addWidget( p ); + mainlayout->addLayout( btns ); + d.resize( 450, 250 ); + if( d.exec() == QDialog::Accepted) + { + c->setDesignerPluginPaths( p->items() ); + } +} + +#include "ccconfigwidget.moc" + +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/ccconfigwidget.h b/languages/cpp/ccconfigwidget.h new file mode 100644 index 00000000..b8874ed2 --- /dev/null +++ b/languages/cpp/ccconfigwidget.h @@ -0,0 +1,74 @@ +/*************************************************************************** +* Copyright (C) 2001 by Daniel Engelschalt * +* daniel.engelschalt@gmx.net * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _CCCONFIGWIDGET_H_ +#define _CCCONFIGWIDGET_H_ + +#include "ccconfigwidgetbase.h" +#include + +class CppSupportPart; +class Catalog; +class QCheckListItem; +class KEditListBox; + +class CCConfigWidget : public CCConfigWidgetBase +{ + Q_OBJECT + +public: + CCConfigWidget( CppSupportPart* part, QWidget* parent = 0, const char* name = 0 ); + virtual ~CCConfigWidget( ); + +public slots: + void accept( ); + void slotNewPCS(); + +protected slots: + void slotGetterSetterValuesChanged(); + virtual void slotRemovePCS(); + +private slots: + void catalogRegistered( Catalog* c ); + void catalogUnregistered( Catalog* c ); + void isValidQtDir( const QString & ); + void isDesignerExecutable( const QString& ); + void isQMakeExecutable( const QString& ); + void toggleQtVersion( bool ); + void openPluginPaths( ); + +private: + bool isExecutable( const QString & ); + + void initGeneralTab(); + void saveFileTemplatesTab(); + + void initQtTab(); + void saveQtTab(); + + void initCodeCompletionTab(); + void saveCodeCompletionTab(); + + void initGetterSetterTab(); + void saveGetterSetterTab(); + + void initSplitTab(); + void saveSplitTab(); + +private: + CppSupportPart* m_pPart; + QMap m_catalogs; + KEditListBox* m_designerPluginPaths; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/ccconfigwidgetbase.ui b/languages/cpp/ccconfigwidgetbase.ui new file mode 100644 index 00000000..b7efc7d0 --- /dev/null +++ b/languages/cpp/ccconfigwidgetbase.ui @@ -0,0 +1,1798 @@ + +CCConfigWidgetBase + + + CCConfigWidgetBase + + + + 0 + 0 + 839 + 622 + + + + C++ Options + + + + unnamed + + + + cpp_options + + + + codeCompletionPage + + + &Code Completion + + + + unnamed + + + + layout11 + + + + unnamed + + + + groupBox4 + + + Code Completion Options + + + + unnamed + + + + checkAutomaticCodeCompletion + + + + 1 + 0 + 1 + 0 + + + + A&utomatic code completion: + + + true + + + Offer options to complete what you are typing. + + + + + layout13 + + + + unnamed + + + + spacer14 + + + Horizontal + + + Fixed + + + + 30 + 20 + + + + + + inputCodeCompletion + + + + 1 + 0 + 0 + 0 + + + + How long after a key press to offer suggestions + + + + + textLabel1 + + + + 1 + 5 + 0 + 0 + + + + msec + + + + + + + checkListGlobalItems + + + List &global items when +performing automatic completion + + + When this is checked, members of all +higher namespaces will be included in +the completion-list while performing +automatic completion. + +This may bloat the completion-list +and create a significant delay. + + + When this is checked, members of all +higher namespaces will be included in +the completion-list while performing +automatic completion. + +This may bloat the completion-list +and create a significant delay. + + + + + checkCompleteReturnType + + + &Do complete member-type-evaluation + + + Completely evaluate member-types of +template-classes (this includes types +of member-variables and return-types +of member-functions) in the +completion-box. + + + Completely evaluate member-types of +template-classes (this includes types +of member-variables and return-types +of member-functions) in the +completion-box. + + + + + checkCompleteArgumentType + + + Do complete argument-type-e&valuation + + + Completely evaluate the function-argument-types +of template-class member-functions in the +completion-box. + + + Completely evaluate the function-argument-types +of template-class member-functions in the +completion-box. + + + + + + + groupBox8_2 + + + Argument Hint Options + + + + unnamed + + + + checkAutomaticArgumentsHint + + + Auto&matic arguments hint: + + + true + + + + + layout14 + + + + unnamed + + + + spacer15 + + + Horizontal + + + Fixed + + + + 30 + 20 + + + + + + inputArgumentsHint + + + + 1 + 0 + 0 + 0 + + + + + + textLabel1_2 + + + + 1 + 5 + 0 + 0 + + + + msec + + + + + + + checkShowCommentInArgumentHint + + + Show comment with +argument hint + + + + + + + + + + + + layout12 + + + + unnamed + + + + buttonGroup6 + + + Incremental Parsing + + + + unnamed + + + + radioButton13 + + + Do not process included headers + + + true + + + + + checkParseMissingHeaders + + + Preprocess and parse included +headers into a database(experimental) + + + Parse preprocessed headers that are not part of this project +into a special completion-database. To reparse the headers delete +the database and reopen the project. + + + + + checkPreprocessIncludedHeaders + + + Preprocess included headers +(collect macros and visibility-information) + + + Try to locate all included files and preprocess them. +This makes macros and imported namespaces work correctly, and allows KDevelop +to know what code-items are visible from within which file. +Note: Parsing may become very slow when this is enabled +(It will become faster after some time). + + + + + + + groupBox5 + + + Code Completion Databases + + + <b>Code Completion Databases</b> are used to store the parsed headers for external libraries, to allow code completion for non-project classes and methods. + + + + unnamed + + + + + Column 1 + + + true + + + true + + + + advancedOptions + + + true + + + LastColumn + + + + + layout6 + + + + unnamed + + + + spacer12 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + newPCSButton + + + &Add... + + + Click to start the Code Completion database creation wizard. + + + + + removePCSButton + + + &Delete + + + + + spacer13 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + + + + + + + groupBox9_2 + + + Misc + + + + unnamed + + + + checkResolveIncludePaths + + + + 4 + 0 + 0 + 0 + + + + Advanced include-path resolution using make(e&xperimental) + + + Try to resolve the include-path by getting the command that would be used +for compiling the file and parsing the gcc-options. The build-system needs to be working, +test for problems by running "make -n -W myfile.cpp myfile.o" in the directory. +This also works with cmake, and maybe some other build-systems that build on make. +The project needs to be compiled or at least configured before this system may work. + + + + + checkShowTypeEvaluationInStatusBar + + + Show t&ype evaluation in status bar + + + + + editIncludePaths + + + src; + + + A semicolon-separated list of include-paths to be used while searching for headers. +Paths not starting with '/' will be interpreted as relative to the project-folder. + + + + + editNamespaceAlias + + + std=_GLIBCXX_STD + + + This line may contain a semicolon-separated list of namespace-aliases and namespace-imports. +example: "std<<_GLIBCXX_STD;NewNamespaceName=OldNamespaceName; << SomeGloballyImportedNamespace" (without paratheses). +"<<" means that the right namespace is imported into the left, while "=" means that both namespaces are treated as +if they were one("a=b" is equivalent to "a<<b;b<<a") + + + + + textLabel1_6 + + + Custom include paths: + + + + + textLabel1_3 + + + Namespace alias list: + + + + + + + spacer15_2 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + + navigationTab + + + &Navigation + + + + unnamed + + + + groupBox12 + + + Header/Source split (Highly Experimental) + + + + unnamed + + + + m_splitEnable + + + Enable split of Header/So&urce files + + + Check to have header and source appear in the same page. + + + Check to have header and source appear in the same page. + + + + + layout6 + + + + unnamed + + + + m_splitSync + + + false + + + Automatic S&ynchronize + + + Check to have the source file scroll as you +navigate the header and vice versa + + + Check to have the source file scroll as you +navigate the header and vice versa + + + + + + + m_splitOrientationBox + + + false + + + Orientation + + + true + + + Select which Qt version your project is using. + + + + unnamed + + + + m_splitVertical + + + &Vertical + + + true + + + Select this if your project is using Qt version 3.x. + + + + + m_splitHorizontal + + + Hori&zontal + + + Select this if your project is using Qt version 4.x. + + + + + + + + + spacer12_2_2 + + + Vertical + + + Expanding + + + + 20 + 400 + + + + + + groupBox21 + + + Context Menu + + + + unnamed + + + + m_switchShouldMatch + + + Switch Header/Implementation &matches current function + + + true + + + Check to have the <b>Switch Header/Implementation</b> +feature attempt to match the function under the +cursor with the matching declaration/definition. + + + + Check to have the <b>Switch Header/Implementation</b> +feature attempt to match the function under the +cursor with the matching declaration/definition. + + + + + + m_showContextMenuExplosion + + + Show Go To &Declaration/Definition submenus + + + Check to show two additional submenus +in the editor context menu containing +all the declarations and definitions +for the current file and its matching +header/implementation file. + + + Check to show two additional submenus +in the editor context menu containing +all the declarations and definitions +for the current file and its matching +header/implementation file. + + + + + checkBox18 + + + Show type evaluation &based navigation menus + + + Menus appear on the right mouse click context menu, +hows menu items to navigate. Needs the "Class View" +plugin enabled to have use all options. + + + Menus appear on the right mouse click context menu, +hows menu items to navigate. Needs the "Class View" +plugin enabled to have use all options. + + + + + + + + + classWizardPage + + + Class Wi&zard + + + + unnamed + + + + options + + + + 5 + 5 + 0 + 0 + + + + Filename options + + + These are the suffixes used by the Class Wizard when creating new classes.<br>Should be in the format: ".suffix" + + + + unnamed + + + + interface_suffix + + + + + implementation_suffix + + + + + TextLabel3 + + + &Interface suffix: + + + interface_suffix + + + + + TextLabel4 + + + I&mplementation suffix: + + + implementation_suffix + + + + + + + spacer12_2 + + + Vertical + + + Expanding + + + + 20 + 337 + + + + + + + + qtPage + + + &Qt Options + + + + unnamed + + + + m_qtUsed + + + Enable Qt opt&ions + + + + + m_qtVersionDirectoryBox + + + false + + + Qt Version, Directory and QMake Binary + + + true + + + Select which Qt version your project is using and where that Qt version is installed to. + +This option only applies to QMake projects. + + + + unnamed + + + + layout9 + + + + unnamed + + + + m_versionQt3 + + + Qt 3 + + + true + + + Use Qt version 3 (When this is changed the project needs to be closed and re-opened.) + + + Select this if your project is using Qt version 3.x.<br>When this is changed the project needs to be closed and re-opened. + + + + + m_versionQt4 + + + Qt 4 + + + Use Qt version 4 (When this is changed the project needs to be closed and re-opened.) + + + Select this if your project is using Qt version 4.x.<br>When this is changed the project needs to be closed and re-opened. + + + + + textLabel1_5 + + + (After changing the project needs to be re-opened) + + + AlignVCenter + + + + + spacer13_2 + + + Horizontal + + + Expanding + + + + 470 + 20 + + + + + + + + layout9 + + + + unnamed + + + + m_txtQtDir + + + Qt3 Directory: + + + This setting is only needed for Qt3 programs, for Qt4 just make sure the QMake Binary is set properly + + + + + m_qtDir + + + The Qt directory, will be red if it is not a valid Qt directory. This setting is only needed for Qt3 programs. + + + Choose the directory that Qt was installed to. If this is shown in red the directory is not a valid Qt directory. + + + + + + + layout8 + + + + unnamed + + + + m_txtQMake + + + QMake Binary: + + + + + m_qmakePath + + + The full path to the QMake executable to be used + + + + + + + + + m_qtStyleBox + + + false + + + Qt include syntax + + + true + + + Select which include style your project is using. + + + + unnamed + + + + m_qtStyleVersion3 + + + Qt &3 style (#include <qwidget.h>) + + + Alt+3 + + + true + + + Select this if your project is using include style as known from Qt version 3.x. + + + + + m_qtStyleVersion4 + + + Qt &4 style (#include <QWidget>) + + + Alt+4 + + + Select this if your project is using include style as known from Qt version 4.x. + + + + + + + m_designerBox + + + false + + + UI Designer Integration + + + false + + + true + + + + unnamed + + + + m_kdevembedded + + + &Use KDevelop's embedded designer + + + Start KDevelop's own designer embedded within KDevelop + + + KDevelop comes with its own UI designer that can either be embedded or be run as a separate program. Check this button if you wish to integrate the UI designer into KDevelop. + + + + + m_kdevexternal + + + Run &KDevelop's designer as a separate application + + + Start KDevelop's own designer externally + + + KDevelop comes with its own UI designer that can either be embedded or be run as a separate program. Check this button if you wish to run KDevelop's UI designer as a separate program. + + + + + m_qtdesigner + + + Run Qt &Designer + + + Use Qt Designer externally + + + Check this button if you wish to use Qt Designer rather than KDevelop's integrated designer. + + + + + layout9 + + + + unnamed + + + + m_txtDesigner + + + Designer Binary: + + + m_designerPath + + + + + m_designerPath + + + The full path to the Designer executable to be used + + + + + + + layout10 + + + + unnamed + + + + textLabel1_4 + + + Extra Plugin Paths for Qt4 Designer: + + + m_designerPrefix + + + + + pluginPaths + + + Change Plugin Paths + + + + + + + + + spacer14_2 + + + Vertical + + + Expanding + + + + 20 + 70 + + + + + + + + accessorPage + + + &Accessors + + + + unnamed + + + + groupBox8 + + + E&xample for Member Variable of Type String + + + + unnamed + + + + layout5_2 + + + + unnamed + + + + m_lblVariableName + + + Variable name: + + + + + m_edtVariableName + + + m_x + + + + + spacer4_3 + + + Horizontal + + + Expanding + + + + 61 + 20 + + + + + + + + m_edtExampleGet + + + int x() const; + + + true + + + + + m_edtExampleSet + + + void setX(const string& theValue); + + + true + + + + + textLabel7 + + + Get method: + + + + + textLabel8 + + + Set method: + + + + + + + groupBox9 + + + Settings + + + Will show as "Create Accessor Methods" in the +right mouse button context menu only when +you right click on a variable in a header file. + + + Will show as "Create Accessor Methods" in the +right mouse button context menu only when +you right click on a variable in a header file. + + + + unnamed + + + + m_edtGet + + + Will show as "Create Accessor Methods" in the +right mouse button context menu only when +you right click on a variable in a header file. + + + Will show as "Create Accessor Methods" in the +right mouse button context menu only when +you right click on a variable in a header file. + + + + + m_lblGet + + + Prefix for <b>get</b> methods: + + + + + m_edtSet + + + set + + + Will show as "Create Accessor Methods" in the +right mouse button context menu only when +you right click on a variable in a header file. + + + Will show as "Create Accessor Methods" in the +right mouse button context menu only when +you right click on a variable in a header file. + + + + + m_lblSet + + + Prefix for <b>set</b> methods: + + + + + m_edtRemovePrefix + + + m_ + + + + + m_lblRemovePrefix + + + Member <b>variable</b> prefix to remove: + + + + + m_edtParameterName + + + theValue + + + + + spacer5_2 + + + Horizontal + + + Expanding + + + + 87 + 20 + + + + + + m_lblParameterName + + + <b>Parametername</b> in set method: + + + + + spacer5 + + + Horizontal + + + Expanding + + + + 87 + 20 + + + + + + spacer8 + + + Horizontal + + + Expanding + + + + 92 + 20 + + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 92 + 20 + + + + + + + + spacer36 + + + Vertical + + + Expanding + + + + 20 + 91 + + + + + + + + + + + + + newPCSButton + clicked() + CCConfigWidgetBase + slotNewPCS() + + + m_edtVariableName + textChanged(const QString&) + CCConfigWidgetBase + slotGetterSetterValuesChanged() + + + m_edtRemovePrefix + textChanged(const QString&) + CCConfigWidgetBase + slotGetterSetterValuesChanged() + + + m_edtGet + textChanged(const QString&) + CCConfigWidgetBase + slotGetterSetterValuesChanged() + + + m_edtSet + textChanged(const QString&) + CCConfigWidgetBase + slotGetterSetterValuesChanged() + + + m_edtParameterName + textChanged(const QString&) + CCConfigWidgetBase + slotGetterSetterValuesChanged() + + + checkAutomaticCodeCompletion + toggled(bool) + inputCodeCompletion + setEnabled(bool) + + + checkAutomaticArgumentsHint + toggled(bool) + inputArgumentsHint + setEnabled(bool) + + + removePCSButton + clicked() + CCConfigWidgetBase + slotRemovePCS() + + + m_splitEnable + toggled(bool) + CCConfigWidgetBase + slotEnableSplit(bool) + + + m_splitEnable + toggled(bool) + m_splitSync + setEnabled(bool) + + + m_qtUsed + toggled(bool) + m_qtStyleBox + setEnabled(bool) + + + m_qtUsed + toggled(bool) + m_qtVersionDirectoryBox + setEnabled(bool) + + + m_qtUsed + toggled(bool) + m_designerBox + setEnabled(bool) + + + m_splitEnable + toggled(bool) + m_splitOrientationBox + setEnabled(bool) + + + m_versionQt3 + toggled(bool) + CCConfigWidgetBase + toggleQtVersion(bool) + + + m_versionQt4 + toggled(bool) + CCConfigWidgetBase + toggleQtVersion(bool) + + + m_qtdesigner + toggled(bool) + m_txtDesigner + setEnabled(bool) + + + m_qtdesigner + toggled(bool) + m_designerPath + setEnabled(bool) + + + m_kdevexternal + toggled(bool) + m_txtDesigner + setDisabled(bool) + + + m_kdevembedded + toggled(bool) + m_txtDesigner + setDisabled(bool) + + + m_kdevexternal + toggled(bool) + m_designerPath + setDisabled(bool) + + + m_kdevembedded + toggled(bool) + m_designerPath + setDisabled(bool) + + + m_versionQt4 + toggled(bool) + m_qtDir + setDisabled(bool) + + + m_versionQt4 + toggled(bool) + m_txtQtDir + setDisabled(bool) + + + m_versionQt3 + toggled(bool) + m_txtQtDir + setEnabled(bool) + + + m_versionQt3 + toggled(bool) + m_qtDir + setEnabled(bool) + + + m_qtDir + textChanged(const QString&) + CCConfigWidgetBase + isValidQtDir(const QString&) + + + m_qmakePath + textChanged(const QString&) + CCConfigWidgetBase + isQMakeExecutable(const QString&) + + + m_qmakePath + urlSelected(const QString&) + CCConfigWidgetBase + isQMakeExecutable(const QString&) + + + m_qtDir + urlSelected(const QString&) + CCConfigWidgetBase + isValidQtDir(const QString&) + + + m_designerPath + textChanged(const QString&) + CCConfigWidgetBase + isDesignerExecutable(const QString&) + + + m_designerPath + urlSelected(const QString&) + CCConfigWidgetBase + isDesignerExecutable(const QString&) + + + m_versionQt4 + toggled(bool) + textLabel1_4 + setEnabled(bool) + + + pluginPaths + clicked() + CCConfigWidgetBase + openPluginPaths() + + + m_versionQt4 + toggled(bool) + pluginPaths + setEnabled(bool) + + + + cpp_options + checkAutomaticCodeCompletion + inputCodeCompletion + checkAutomaticArgumentsHint + inputArgumentsHint + newPCSButton + advancedOptions + + + kurlrequester.h + kdialog.h + + + implementationFile() + interfaceFile() + slotAddPPPath() + slotEnableCC() + slotEnableCH() + slotEnableChooseFiles( bool ) + slotEnablePCS() + slotEnablePP() + slotRemovePPPath() + slotSelectTemplateGroup( const QString & ) + slotSetCHWindow() + slotNewPCS() + slotGetterSetterValuesChanged() + slotRemovePCS() + slotEnableSplit( bool ) + toggleQtVersion(bool) + isDesignerExecutable(const QString&) + isQMakeExecutable(const QString&) + isValidQtDir(const QString&) + openPluginPaths() + + + + + knuminput.h + knuminput.h + knuminput.h + knuminput.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kurlrequester.h + kpushbutton.h + kpushbutton.h + + diff --git a/languages/cpp/classgeneratorconfig.cpp b/languages/cpp/classgeneratorconfig.cpp new file mode 100644 index 00000000..c6049801 --- /dev/null +++ b/languages/cpp/classgeneratorconfig.cpp @@ -0,0 +1,236 @@ +/*************************************************************************** +* Copyright (C) 2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#include "cppsupportfactory.h" +#include "classgeneratorconfig.h" + +ClassGeneratorConfig::ClassGeneratorConfig( QWidget* parent, const char* name, WFlags fl ) + : ClassGeneratorConfigBase( parent, name, fl ) +{ + readConfig(); + currTemplate = &cppHeaderText; + template_edit->setText( *currTemplate ); +} + +ClassGeneratorConfig::ClassGeneratorConfig( QString v_cppHeaderText, QString v_cppSourceText, + QString v_objcHeaderText, QString v_objcSourceText, + QString v_gtkHeaderText, QString v_gtkSourceText, + NameCase v_fileCase, NameCase v_defCase, NameCase v_superCase, + bool v_showAuthor, bool v_genDoc, bool v_reformat, + QWidget* parent, const char* name, WFlags fl ) + : ClassGeneratorConfigBase( parent, name, fl ), + cppHeaderText( v_cppHeaderText ), cppSourceText( v_cppSourceText ), + objcHeaderText( v_objcHeaderText ), objcSourceText( v_objcSourceText ), + gtkHeaderText( v_gtkHeaderText ), gtkSourceText( v_gtkSourceText ) +{ + filecase_box->setCurrentItem( ( int ) v_fileCase ); + defcase_box->setCurrentItem( ( int ) v_defCase ); + supercase_box->setCurrentItem( ( int ) v_superCase ); + author_box->setChecked( v_showAuthor ); + doc_box->setChecked( v_genDoc ); + reformat_box->setChecked( v_reformat ); + + currTemplate = &cppHeaderText; +} + +ClassGeneratorConfig::~ClassGeneratorConfig() +{} + +/*$SPECIALIZATION$*/ +void ClassGeneratorConfig::templateTypeChanged( int type ) +{ + *currTemplate = template_edit->text(); + + currTemplate = identifyTemplate( type ); + template_edit->setText( *currTemplate ); +} + +QString ClassGeneratorConfig::cppHeader() +{ + if ( currTemplate == &cppHeaderText ) + * currTemplate = template_edit->text(); + return cppHeaderText; +} + +QString ClassGeneratorConfig::cppSource() +{ + if ( currTemplate == &cppSourceText ) + * currTemplate = template_edit->text(); + return cppSourceText; +} + +QString ClassGeneratorConfig::objcHeader() +{ + if ( currTemplate == &objcHeaderText ) + * currTemplate = template_edit->text(); + return objcHeaderText; +} + +QString ClassGeneratorConfig::objcSource() +{ + if ( currTemplate == &objcSourceText ) + * currTemplate = template_edit->text(); + return objcSourceText; +} + +QString ClassGeneratorConfig::gtkHeader() +{ + if ( currTemplate == >kHeaderText ) + * currTemplate = template_edit->text(); + return gtkHeaderText; +} + +QString ClassGeneratorConfig::gtkSource() +{ + if ( currTemplate == >kSourceText ) + * currTemplate = template_edit->text(); + return gtkSourceText; +} + +ClassGeneratorConfig::NameCase ClassGeneratorConfig::fileCase() +{ + return ( NameCase ) filecase_box->currentItem(); +} + +ClassGeneratorConfig::NameCase ClassGeneratorConfig::defCase() +{ + return ( NameCase ) defcase_box->currentItem(); +} + +ClassGeneratorConfig::NameCase ClassGeneratorConfig::superCase() +{ + return ( NameCase ) supercase_box->currentItem(); +} + +bool ClassGeneratorConfig::showAuthor() +{ + return author_box->isChecked(); +} + +bool ClassGeneratorConfig::genDoc() +{ + return doc_box->isChecked(); +} + +QString *ClassGeneratorConfig::identifyTemplate( int value ) +{ + switch ( value ) + { + case 0: + return & cppHeaderText; + case 1: + return &cppSourceText; + case 2: + return &objcHeaderText; + case 3: + return &objcSourceText; + case 4: + return >kHeaderText; + case 5: + return >kSourceText; + } + return 0; +} + +void ClassGeneratorConfig::readConfig() +{ + KConfig * config = CppSupportFactory::instance() ->config(); + if ( config ) + { + config->setGroup( "Class Generator" ); + + filecase_box->setCurrentItem( config->readNumEntry( "File Name Case", 0 ) ); + defcase_box->setCurrentItem( config->readNumEntry( "Defines Case", 1 ) ); + supercase_box->setCurrentItem( config->readNumEntry( "Superclasss Name Case", 0 ) ); + + author_box->setChecked( config->readBoolEntry( "Show Author Name", 1 ) ); + doc_box->setChecked( config->readBoolEntry( "Generate Empty Documentation", 1 ) ); + + reformat_box->setChecked( config->readBoolEntry( "Reformat Source", 0 ) ); + + KStandardDirs *dirs = CppSupportFactory::instance() ->dirs(); + + cppHeaderText = templateText( dirs->findResource( "newclasstemplates", "cpp_header" ) ); + cppSourceText = templateText( dirs->findResource( "newclasstemplates", "cpp_source" ) ); + objcHeaderText = templateText( dirs->findResource( "newclasstemplates", "objc_header" ) ); + objcSourceText = templateText( dirs->findResource( "newclasstemplates", "objc_source" ) ); + gtkHeaderText = templateText( dirs->findResource( "newclasstemplates", "gtk_header" ) ); + gtkSourceText = templateText( dirs->findResource( "newclasstemplates", "gtk_source" ) ); + } +} + + +QString ClassGeneratorConfig::templateText( QString path ) +{ + QFileInfo f( path ); + if ( f.exists() ) + { + QFile file( path ); + if ( file.open( IO_ReadOnly ) ) + { + QTextStream stream( &file ); + return stream.read(); + } + else + return ""; + } + else + return ""; +} + +void ClassGeneratorConfig::storeConfig() +{ + KConfig * config = CppSupportFactory::instance() ->config(); + if ( config ) + { + config->setGroup( "Class Generator" ); + + config->writeEntry( "File Name Case", filecase_box->currentItem() ); + config->writeEntry( "Defines Case", defcase_box->currentItem() ); + config->writeEntry( "Superclasss Name Case", supercase_box->currentItem() ); + + config->writeEntry( "Show Author Name", author_box->isChecked() ); + config->writeEntry( "Generate Empty Documentation", doc_box->isChecked() ); + + config->writeEntry( "Reformat Source", reformat_box->isChecked() ); + + KStandardDirs *dirs = CppSupportFactory::instance() ->dirs(); + + saveTemplateText( dirs->saveLocation( "newclasstemplates" ) + "cpp_header", cppHeader() ); + saveTemplateText( dirs->saveLocation( "newclasstemplates" ) + "cpp_source", cppSource() ); + saveTemplateText( dirs->saveLocation( "newclasstemplates" ) + "objc_header", objcHeader() ); + saveTemplateText( dirs->saveLocation( "newclasstemplates" ) + "objc_source", objcSource() ); + saveTemplateText( dirs->saveLocation( "newclasstemplates" ) + "gtk_header", gtkHeader() ); + saveTemplateText( dirs->saveLocation( "newclasstemplates" ) + "gtk_source", gtkSource() ); + } +} + +void ClassGeneratorConfig::saveTemplateText( QString path, QString content ) +{ + QFile f( path ); + if ( f.open( IO_WriteOnly ) ) + { + QTextStream stream( &f ); + stream << content; + f.close(); + } +} + +#include "classgeneratorconfig.moc" diff --git a/languages/cpp/classgeneratorconfig.h b/languages/cpp/classgeneratorconfig.h new file mode 100644 index 00000000..b9cb08a3 --- /dev/null +++ b/languages/cpp/classgeneratorconfig.h @@ -0,0 +1,81 @@ +/*************************************************************************** +* Copyright (C) 2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef CLASSGENERATORCONFIG_H +#define CLASSGENERATORCONFIG_H + +#include "classgeneratorconfigbase.h" + +class ClassGeneratorConfig : public ClassGeneratorConfigBase +{ + Q_OBJECT + +public: + enum NameCase { LowerCase, UpperCase, SameAsClassCase, SameAsFileCase }; + + ClassGeneratorConfig( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + + ClassGeneratorConfig( QString v_cppHeaderText, QString v_cppSourceText, + QString v_objcHeaderText, QString v_objcSourceText, + QString v_gtkHeaderText, QString v_gtkSourceText, + NameCase v_fileCase, NameCase v_defCase, NameCase v_superCase, + bool v_showAuthor, bool v_genDoc, bool v_reformat, + QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + + ~ClassGeneratorConfig(); + /*$PUBLIC_FUNCTIONS$*/ + + void readConfig(); + + QString cppHeader(); + QString cppSource(); + QString objcHeader(); + QString objcSource(); + QString gtkHeader(); + QString gtkSource(); + + NameCase fileCase(); + NameCase defCase(); + NameCase superCase(); + + bool showAuthor(); + bool genDoc(); + +public slots: + /*$PUBLIC_SLOTS$*/ + void storeConfig(); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void templateTypeChanged( int type ); + +private: + QString *identifyTemplate( int value ); + QString templateText( QString path ); + void saveTemplateText( QString path, QString content ); + + QString cppHeaderText; + QString cppSourceText; + QString objcHeaderText; + QString objcSourceText; + QString gtkHeaderText; + QString gtkSourceText; + + QString *currTemplate; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + + diff --git a/languages/cpp/classgeneratorconfigbase.ui b/languages/cpp/classgeneratorconfigbase.ui new file mode 100644 index 00000000..566e9eb2 --- /dev/null +++ b/languages/cpp/classgeneratorconfigbase.ui @@ -0,0 +1,261 @@ + +ClassGeneratorConfigBase + + + ClassGeneratorConfigBase + + + + 0 + 0 + 576 + 528 + + + + + unnamed + + + 0 + + + + groupBox7_2 + + + Class &Templates + + + + unnamed + + + + + Cpp Header + + + + + Cpp Source + + + + + Objective-C Header + + + + + Objective-C Source + + + + + GTK C Header + + + + + GTK C Source + + + + templatename_box + + + + + template_edit + + + + + + + groupBox10 + + + + 5 + 5 + 0 + 0 + + + + Names + + + + unnamed + + + + textLabel3_2 + + + #ifndef - #&define names: + + + defcase_box + + + + + textLabel3 + + + &File names: + + + filecase_box + + + + + + Lowercase + + + + + Uppercase + + + + + Same as Class Names + + + + filecase_box + + + + + + Lowercase + + + + + Uppercase + + + + + Same as Class Names + + + + + Same as File Names + + + + defcase_box + + + 1 + + + + + + Lowercase + + + + + Uppercase + + + + + Same as Class Names + + + + supercase_box + + + + + textLabel3_3 + + + &Superclass file names: + + + supercase_box + + + + + + + groupBox9 + + + Class Documentation + + + + unnamed + + + + author_box + + + Include &author name in class documentation + + + + + doc_box + + + Generate &empty documentation strings + + + + + + + reformat_box + + + &Reformat source before creating files + + + + + + + templatename_box + activated(int) + ClassGeneratorConfigBase + templateTypeChanged(int) + + + + templatename_box + template_edit + filecase_box + defcase_box + supercase_box + author_box + doc_box + + + kdialog.h + + + templateTypeChanged(int type) + + + + diff --git a/languages/cpp/codecompletionentry.h b/languages/cpp/codecompletionentry.h new file mode 100644 index 00000000..60042004 --- /dev/null +++ b/languages/cpp/codecompletionentry.h @@ -0,0 +1,57 @@ +/*************************************************************************** + cppcodecompletion.cpp - description + ------------------- + begin : Sat Jul 21 2001 + copyright : (C) 2001 by Victor R�er + email : victor_roeder@gmx.de + copyright : (C) 2002,2003 by Roberto Raggi + email : roberto@kdevelop.org + copyright : (C) 2005 by Adam Treat + email : manyoso@yahoo.com + copyright : (C) 2006 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __CODECOMPLETIONENTRY_H__ +#define __CODECOMPLETIONENTRY_H__ + +#include + +//this is just a little helper-class to allow custom sorting, it must stay binary compatible with KTextEditor::CompletionEntry!! +class CodeCompletionEntry : public KTextEditor::CompletionEntry +{ +public: + CodeCompletionEntry() : KTextEditor::CompletionEntry() { + } + CodeCompletionEntry( const CodeCompletionEntry& rhs ) : KTextEditor::CompletionEntry( rhs ) { + } + CodeCompletionEntry( const KTextEditor::CompletionEntry& rhs ) : KTextEditor::CompletionEntry( rhs ) { + } + + bool operator < ( const CodeCompletionEntry& rhs ) { + return userdata < rhs.userdata; + } + bool operator == ( const CodeCompletionEntry& rhs ) { + return userdata == rhs.userdata; + } + bool operator > ( const CodeCompletionEntry& rhs ) { + return userdata > rhs.userdata; + } + + CodeCompletionEntry& operator = ( const KTextEditor::CompletionEntry& rhs ) { + (*(KTextEditor::CompletionEntry*)this) = rhs; + return *this; + } +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/codeinformationrepository.cpp b/languages/cpp/codeinformationrepository.cpp new file mode 100644 index 00000000..5bb22a68 --- /dev/null +++ b/languages/cpp/codeinformationrepository.cpp @@ -0,0 +1,339 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "codeinformationrepository.h" +#include "cpp_tags.h" + +#include +#include + +/// @todo move in utils.cpp +static QValueList +my_unique( const QValueList& entryList ) +{ + + QValueList< KTextEditor::CompletionEntry > l; + QMap map; + QValueList< KTextEditor::CompletionEntry >::ConstIterator it = entryList.begin(); + while ( it != entryList.end() ) + { + KTextEditor::CompletionEntry e = *it++; + QString key = e.type + " " + + e.text + " " + + e.prefix + " " + + e.postfix + " "; + if ( map.find( key ) == map.end() ) + { + map[ key ] = TRUE; + l << e; + } + } + return l; +} + +CodeInformationRepository::CodeInformationRepository( KDevCodeRepository* rep ) + : m_rep( rep ) +{} + +CodeInformationRepository::~CodeInformationRepository() +{} + +QValueList CodeInformationRepository::query( const QValueList & args ) +{ +// kdDebug( 9007 ) << "CodeInformationRepository::query()" << endl; + + QValueList tags; + + QValueList catalogs = m_rep->registeredCatalogs(); + QValueList::Iterator it = catalogs.begin(); + while ( it != catalogs.end() ) + { + Catalog * catalog = *it; + ++it; + + if ( !catalog->enabled() ) + continue; + + tags += catalog->query( args ); + } + + return tags; +} + +QValueList CodeInformationRepository::getTagsInFile( const QString & fileName ) +{ + kdDebug( 9007 ) << "CodeInformationRepository::getTagsInFile()" << endl; + + QValueList args; + args << Catalog::QueryArgument( "fileName", fileName ); + + QValueList catalogs = m_rep->registeredCatalogs(); + QValueList::Iterator it = catalogs.begin(); + while ( it != catalogs.end() ) + { + Catalog * catalog = *it; + ++it; + + QValueList tags = catalog->query( args ); + + if ( tags.size() ) + return tags; + } + + return QValueList(); +} + +QValueList CodeInformationRepository::getTagsInScope( const QStringList & scope, bool // isInstance + ) +{ + kdDebug( 9007 ) << "CodeInformationRepository::getTagsInScope()" << endl; + + QValueList tags; + QValueList args; + +#if 0 + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Namespace ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Class ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); +#endif + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_FunctionDeclaration ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Variable ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); + + if ( true /*!isInstance*/ ) + { + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Enumerator ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); + } + + return tags; +} + +QValueList CodeInformationRepository::getEntriesInScope( const QStringList & scope, bool isInstance, bool recompute ) +{ + kdDebug( 9007 ) << "CodeInformationRepository::getEntriesInScope()" << endl; + + if ( !recompute && !scope.size() && m_globalEntries.size() ) + return m_globalEntries; + else if ( scope.size() == 0 ) + { + m_globalEntries = my_unique( toEntryList( getTagsInScope( scope, isInstance ) ) ); + return m_globalEntries; + } + + return toEntryList( getTagsInScope( scope, isInstance ) ); +} + + +QValueList CodeInformationRepository::getBaseClassList( const QString& className ) +{ +// kdDebug( 9007 ) << "CodeInformationRepository::getBaseClassList()" << endl; + + if ( className.isEmpty() ) + return QValueList(); + + QValueList args; + args << Catalog::QueryArgument( "kind", Tag::Kind_Base_class ); + /* if( className.length() >= 2 ) + args << Catalog::QueryArgument( "prefix", className.left(2) );*/ + args << Catalog::QueryArgument( "name", className ); + return query( args ); +} + +QValueList CodeInformationRepository::getClassOrNamespaceList( const QStringList & scope ) +{ + kdDebug( 9007 ) << "CodeInformationRepository::getClassOrNamespaceList()" << endl; + + QValueList tags; + QValueList args; + + args << Catalog::QueryArgument( "kind", Tag::Kind_Namespace ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Class ) + << Catalog::QueryArgument( "scope", scope ); + tags += query( args ); + + return tags; +} + +QValueList CodeInformationRepository::getTagsInScope( const QString & name, const QStringList & scope ) +{ + QValueList tags; + QValueList args; + + args.clear(); + args << Catalog::QueryArgument( "scope", scope ); + /* if( name.length() >= 2 ) + args << Catalog::QueryArgument( "prefix", name.left(2) ); */ + args << Catalog::QueryArgument( "name", name ); + + tags += query( args ); + + return tags; +} + +KTextEditor::CompletionEntry CodeInformationRepository::toEntry( Tag & tag, CppCodeCompletion::CompletionMode completionMode, TypeProcessor* proc ) +{ + KTextEditor::CompletionEntry entry; + + if ( tag.name().isEmpty() ) + return entry; + + switch ( tag.kind() ) + { + case Tag::Kind_Typedef: + entry.prefix = "typedef"; + entry.text = tag.name(); + break; + + case Tag::Kind_Class: + entry.prefix = "class"; + entry.text = tag.name(); + break; + + case Tag::Kind_Struct: + entry.prefix = "struct"; + entry.text = tag.name(); + break; + + case Tag::Kind_Namespace: + entry.prefix = "namespace"; + entry.text = tag.name(); + break; + + case Tag::Kind_FunctionDeclaration: + //case Tag::Kind_Function: + { + + CppFunction tagInfo( tag ); + QStringList arguments = tagInfo.arguments(); + QStringList argumentNames = tagInfo.argumentNames(); + + if ( completionMode == CppCodeCompletion::VirtualDeclCompletion ) + { + //Ideally the type info would be a entry.prefix, but we need them to be + //inserted upon completion so they have to be part of entry.text + entry.text = tagInfo.type(); + entry.text += " "; + entry.text += tag.name(); + } + else + entry.text = tag.name(); + + if ( !arguments.size() ) + entry.text += "("; + else + entry.text += "( "; + + QString signature; + for ( uint i = 0; i < arguments.size(); ++i ) + { + if( !proc ) + signature += arguments[ i ]; + else + signature += proc->processType( arguments[ i ] ); + + if ( completionMode == CppCodeCompletion::NormalCompletion || + completionMode == CppCodeCompletion::VirtualDeclCompletion ) + { + QString argName = argumentNames[ i ]; + if ( !argName.isEmpty() ) + signature += QString::fromLatin1( " " ) + argName; + + } + + if ( i != ( arguments.size() - 1 ) ) + { + signature += ", "; + } + } + + if ( signature.isEmpty() ) + entry.text += ")"; + else + entry.postfix = signature + " )"; + + if ( tagInfo.isConst() ) + entry.postfix += " const"; + + if ( completionMode == CppCodeCompletion::VirtualDeclCompletion ) + { + entry.text += entry.postfix + ";"; + entry.postfix = QString::null; + } + else if ( completionMode != CppCodeCompletion::NormalCompletion ) + { + entry.text += entry.postfix; + entry.postfix = QString::null; + } + + QString comment = tag.attribute( "description" ).toString(); + if ( !comment.isNull() ) + entry.comment = comment; + //else + //entry.comment = "no documentation available!"; + } + + break; + + case Tag::Kind_Enumerator: + case Tag::Kind_Variable: + entry.text = tag.name(); + break; + + default: + ; + } + + entry.comment = tag.comment(); + + return entry; +} + +QValueList CodeInformationRepository::toEntryList( const QValueList & tags, CppCodeCompletion::CompletionMode completionMode ) +{ + QValueList entryList; + QMap ns; + + QValueList::ConstIterator it = tags.begin(); + while ( it != tags.end() ) + { + Tag tag = *it; + ++it; + + KTextEditor::CompletionEntry entry = toEntry( tag, completionMode ); + if ( !entry.text.isEmpty() ) + entryList << entry; + } + + return entryList; +} + + diff --git a/languages/cpp/codeinformationrepository.h b/languages/cpp/codeinformationrepository.h new file mode 100644 index 00000000..f7fa712a --- /dev/null +++ b/languages/cpp/codeinformationrepository.h @@ -0,0 +1,58 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef CODEINFORMATIONREPOSITORY_H +#define CODEINFORMATIONREPOSITORY_H + +#include "catalog.h" +#include "cppcodecompletion.h" +#include + +#include + +struct TypeProcessor { + virtual QString processType( const QString& type ) = 0; + virtual QString parentType() = 0; +}; + +class KDevCodeRepository; + +class CodeInformationRepository +{ +public: + CodeInformationRepository( KDevCodeRepository* rep ); + virtual ~CodeInformationRepository(); + + static QValueList toEntryList( const QValueList& tags, + CppCodeCompletion::CompletionMode mode = CppCodeCompletion::NormalCompletion ); + static KTextEditor::CompletionEntry toEntry( Tag& tag, CppCodeCompletion::CompletionMode mode = CppCodeCompletion::NormalCompletion, TypeProcessor* proc = 0 ); + QValueList getEntriesInScope( const QStringList& scope, bool isInstance, bool recompute = false ); + + QValueList query( const QValueList& args ); + QValueList getTagsInScope( const QStringList& scope, bool isInstance ); + QValueList getTagsInScope( const QString& name, const QStringList& scope ); + + QValueList getTagsInFile( const QString& fileName ); + QValueList getBaseClassList( const QString& className ); + QValueList getClassOrNamespaceList( const QStringList& scope ); + +private: + QValueList m_globalEntries; + KDevCodeRepository* m_rep; + +private: + CodeInformationRepository( const CodeInformationRepository& source ); + void operator = ( const CodeInformationRepository& source ); +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/compiler/Makefile.am b/languages/cpp/compiler/Makefile.am new file mode 100644 index 00000000..128e715f --- /dev/null +++ b/languages/cpp/compiler/Makefile.am @@ -0,0 +1,6 @@ +# This is the collection of plugins. In contrast to the parts +# directory, these are 'transient' in a sense and don't +# share the complete KDevComponent interface. + +SUBDIRS = gccoptions + diff --git a/languages/cpp/compiler/gccoptions/Makefile.am b/languages/cpp/compiler/gccoptions/Makefile.am new file mode 100644 index 00000000..3e801ae4 --- /dev/null +++ b/languages/cpp/compiler/gccoptions/Makefile.am @@ -0,0 +1,20 @@ +# Here resides the gcc option dialog plugin. + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extras \ + -I$(top_srcdir)/lib/widgets $(all_includes) + +kde_module_LTLIBRARIES = libkdevgccoptions.la +libkdevgccoptions_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +libkdevgccoptions_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/widgets/libkdevwidgets.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(LIB_KHTML) + +libkdevgccoptions_la_SOURCES = gccoptionsplugin.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevgccoptions.desktop kdevgppoptions.desktop kdevg77options.desktop + + + + diff --git a/languages/cpp/compiler/gccoptions/gccoptionsplugin.cpp b/languages/cpp/compiler/gccoptions/gccoptionsplugin.cpp new file mode 100644 index 00000000..ac547fc7 --- /dev/null +++ b/languages/cpp/compiler/gccoptions/gccoptionsplugin.cpp @@ -0,0 +1,705 @@ +/*************************************************************************** +* Copyright (C) 2000-2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "flagboxes.h" +#include "gccoptionsplugin.h" + +K_EXPORT_COMPONENT_FACTORY( libkdevgccoptions, KGenericFactory( "kdevgccoptions" ) ) + +class GeneralTab : public QWidget +{ +public: + GeneralTab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 ); + ~GeneralTab(); + + void readFlags( QStringList *str ); + void writeFlags( QStringList *str ); + +private: + FlagCheckBoxController *controller; +}; + + +class OptimizationTab : public QWidget +{ +public: + OptimizationTab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 ); + ~OptimizationTab(); + + void readFlags( QStringList *str ); + void writeFlags( QStringList *str ); + +private: + QRadioButton *Odefault, *O0, *O1, *O2; + FlagListBox *optBox; +}; + + +class G77Tab : public QWidget +{ +public: + G77Tab( QWidget *parent = 0, const char *name = 0 ); + ~G77Tab(); + + void readFlags( QStringList *str ); + void writeFlags( QStringList *str ); + +private: + FlagCheckBoxController *controller; +}; + + +class Warnings1Tab : public QWidget +{ +public: + Warnings1Tab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 ); + ~Warnings1Tab(); + + void readFlags( QStringList *str ); + void writeFlags( QStringList *str ); + +private: + FlagCheckBoxController *controller; + FlagListBox *wallBox; +}; + + +class Warnings2Tab : public QWidget +{ +public: + Warnings2Tab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 ); + ~Warnings2Tab(); + + void readFlags( QStringList *str ); + void writeFlags( QStringList *str ); + +private: + FlagListBox *wrestBox; +}; + + +GeneralTab::GeneralTab( GccOptionsPlugin::Type type, QWidget *parent, const char *name ) + : QWidget( parent, name ), controller( new FlagCheckBoxController ) +{ + QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + layout->addSpacing( 10 ); + + QVButtonGroup *output_group = new QVButtonGroup( i18n( "Output" ), this ); + new FlagCheckBox( output_group, controller, + "-fsyntax-only", i18n( "Only check the code for syntax errors, do not produce object code" ) ); + new FlagCheckBox( output_group, controller, + "-pg", i18n( "Generate extra code to write profile information for gprof" ) ); + new FlagCheckBox( output_group, controller, + "-save-temps", i18n( "Do not delete intermediate output like assembler files" ) ); + + QApplication::sendPostedEvents( this, QEvent::ChildInserted ); + layout->addSpacing( 10 ); + + QVButtonGroup *codegen_group = new QVButtonGroup( i18n( "Code Generation" ), this ); + if ( type != GccOptionsPlugin::GPP ) + { + new FlagCheckBox( codegen_group, controller, + "-fexceptions", i18n( "Enable exception handling" ), + "-fno-exception" ); + } + else + { + new FlagCheckBox( codegen_group, controller, + "-fno-exceptions", i18n( "Disable exception handling" ), + "-fexception" ); + } + // The following two are somehow mutually exclusive, but the default is + // platform-dependent, so if we would leave out one of them, we wouldn't + // know how to set the remaining one. + new FlagCheckBox( codegen_group, controller, + "-fpcc-struct-return", i18n( "Return certain struct and union values in memory rather than in registers" ) ); + new FlagCheckBox( codegen_group, controller, + "-freg-struct-return", i18n( "Return certain struct and union values in registers when possible" ) ); + new FlagCheckBox( codegen_group, controller, + "-short-enums", i18n( "For an enum, choose the smallest possible integer type" ) ); + new FlagCheckBox( codegen_group, controller, + "-short-double", i18n( "Make 'double' the same as 'float'" ) ); + + QApplication::sendPostedEvents( this, QEvent::ChildInserted ); + layout->addStretch(); +} + + +GeneralTab::~GeneralTab() +{ + delete controller; +} + + +void GeneralTab::readFlags( QStringList *list ) +{ + controller->readFlags( list ); +} + + +void GeneralTab::writeFlags( QStringList *list ) +{ + controller->writeFlags( list ); +} + + +OptimizationTab::OptimizationTab( GccOptionsPlugin::Type type, QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + + QVButtonGroup *group = new QVButtonGroup( i18n( "Optimization Level" ), this ); + Odefault = new QRadioButton( i18n( "Default" ), group ); + Odefault->setChecked( true ); + O0 = new QRadioButton( i18n( "No optimization" ), group ); + O1 = new QRadioButton( i18n( "Level 1" ), group ); + O2 = new QRadioButton( i18n( "Level 2" ), group ); + + optBox = new FlagListBox( this ); + + new FlagListItem( optBox, + "-ffloat-store", i18n( "Do not store floating point variables in registers" ), + "-fno-float-store" ); + new FlagListItem( optBox, + "-fno-defer-pop", i18n( "Pop the arguments to each function call directly " + "after the function returns" ), + "-fdefer-pop" ); + new FlagListItem( optBox, + "-fforce-mem", i18n( "Force memory operands to be copied into registers before " + "doing arithmetic on them" ), + "-fno-force-mem" ); + new FlagListItem( optBox, + "-fforce-addr", i18n( "Force memory address constants to be copied into registers before " + "doing arithmetic on them" ), + "-fno-force-addr" ); + new FlagListItem( optBox, + "-fomit-frame-pointer", i18n( "Do not keep the frame pointer in a register for functions that " + "do not need one" ), + "-fno-omit-frame-pointer" ); + new FlagListItem( optBox, + "-fno-inline", i18n( "Ignore the inline keyword" ), + "-finline" ); + + if ( type == GccOptionsPlugin::GPP ) + { + new FlagListItem( optBox, + "-fno-default-inline", i18n( "Do not make member functions inline merely because they " + "are defined inside the class scope" ), + "-fdefault-inline" ); + } + + QApplication::sendPostedEvents( this, QEvent::ChildInserted ); + layout->addStretch(); +} + + +OptimizationTab::~OptimizationTab() +{} + + +void OptimizationTab::readFlags( QStringList *list ) +{ + optBox->readFlags( list ); + + QStringList::Iterator sli; + sli = list->find( "-O0" ); + if ( sli != list->end() ) + { + O0->setChecked( true ); + list->remove + ( sli ); + } + sli = list->find( "-O1" ); + if ( sli != list->end() ) + { + O1->setChecked( true ); + list->remove + ( sli ); + } + sli = list->find( "-O2" ); + if ( sli != list->end() ) + { + O2->setChecked( true ); + list->remove + ( sli ); + } +} + + +void OptimizationTab::writeFlags( QStringList *list ) +{ + optBox->writeFlags( list ); + + if ( O0->isChecked() ) + ( *list ) << "-O0"; + else if ( O1->isChecked() ) + ( *list ) << "-O1"; + else if ( O2->isChecked() ) + ( *list ) << "-O2"; +} + + +G77Tab::G77Tab( QWidget *parent, const char *name ) + : QWidget( parent, name ), controller( new FlagCheckBoxController ) +{ + QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + layout->addSpacing( 10 ); + + QVButtonGroup *dialect_group = new QVButtonGroup( i18n( "Dialect" ), this ); + new FlagCheckBox( dialect_group, controller, + "-ffree-form", i18n( "Interpret source code as Fortran 90 free form" ), + "-fno-exception" ); + new FlagCheckBox( dialect_group, controller, + "-ff90", i18n( "Allow certain Fortran 90 constructs" ) ); + new FlagCheckBox( dialect_group, controller, + "-fdollar-ok", i18n( "Allow '$' in symbol names" ) ); + new FlagCheckBox( dialect_group, controller, + "-fbackslash", i18n( "Allow '\' in character constants to escape special characters" ), + "-fno-backslah" ); + new FlagCheckBox( dialect_group, controller, + "-fonetrip", i18n( "DO loops are executed at least once" ) ); + + QApplication::sendPostedEvents( this, QEvent::ChildInserted ); + layout->addSpacing( 10 ); + + QVButtonGroup *codegen_group = new QVButtonGroup( i18n( "Code Generation" ), this ); + new FlagCheckBox( codegen_group, controller, + "-fno-automatic", i18n( "Treat local variables as if SAVE statement had been specified" ) ); + new FlagCheckBox( codegen_group, controller, + "-finit-local-zero", i18n( "Init local variables to zero" ) ); + new FlagCheckBox( codegen_group, controller, + "-fbounds-check", i18n( "Generate run-time checks for array subscripts" ) ); + + QApplication::sendPostedEvents( this, QEvent::ChildInserted ); + layout->addStretch(); +} + + +G77Tab::~G77Tab() +{ + delete controller; +} + + +void G77Tab::readFlags( QStringList *list ) +{ + controller->readFlags( list ); +} + + +void G77Tab::writeFlags( QStringList *list ) +{ + controller->writeFlags( list ); +} + + +Warnings1Tab::Warnings1Tab( GccOptionsPlugin::Type type, QWidget *parent, const char *name ) + : QWidget( parent, name ), controller( new FlagCheckBoxController ) +{ + QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + + new FlagCheckBox( this, controller, + "-w", i18n( "Inhibit all warnings" ) ); + new FlagCheckBox( this, controller, + "-Wno-import", i18n( "Inhibit warnings about the use of #import" ) ); + new FlagCheckBox( this, controller, + "-Werror", i18n( "Make all warnings into errors" ) ); + new FlagCheckBox( this, controller, + "-pedantic", i18n( "Issue all warnings demanded by strict ANSI C or ISO C++" ) ); + new FlagCheckBox( this, controller, + "-pedantic-errors", i18n( "Like -pedantic, but errors are produced instead of warnings" ) ); + new FlagCheckBox( this, controller, + "-Wall", i18n( "All warnings below, combined (-Wall):" ) ); + + wallBox = new FlagListBox( this ); + + new FlagListItem( wallBox, + "-Wchar-subscripts", i18n( "Warn if an array subscript has type char" ) ); + new FlagListItem( wallBox, + "-Wcomment", i18n( "Warn when a comment-start sequence /* appears inside a comment" ) ); + new FlagListItem( wallBox, + "-Wformat", i18n( "Check calls to printf(), scanf() etc\n" + "to make sure that the arguments supplied have types appropriate\n" + "to the format string specified, and that the conversions specified\n" + "in the format string make sense" ) ); + new FlagListItem( wallBox, + "-Wformat=2", i18n( "Enable -Wformat plus format checks not \n" + "included in -Wformat. Currently equivalent to \n" + "`-Wformat -Wformat-nonliteral -Wformat-security \n" + "-Wformat-y2k'." ) ); + new FlagListItem( wallBox, + "-Wimplicit-int", i18n( "Warn when a declaration does not specify a type" ) ); + new FlagListItem( wallBox, + "-Wimplicit-funtion-declaration", + i18n( "Issue a warning when a non-declared function is used" ) ); + new FlagListItem( wallBox, + "-Werror-implicit-function-declaration", + i18n( "Issue an error when a non-declared function is used" ) ); + new FlagListItem( wallBox, + "-Wmain", i18n( "Warn if the type of main() is suspicious" ) ); + new FlagListItem( wallBox, + "-Wmultichar", i18n( "Warn when multicharacter constants are encountered" ) ); + new FlagListItem( wallBox, + "-Wmissing-braces", i18n( "Warn if an aggregate or union initializer is not fully bracketed" ) ); + new FlagListItem( wallBox, + "-Wparentheses", i18n( "Warn when parentheses are omitted in certain contexts" ) ); + new FlagListItem( wallBox, + "-Wsequence-point", i18n( "Warn about code that may have undefined semantics because of\n" + "violations of sequence point rules in the C standard" ) ); + new FlagListItem( wallBox, + "-Wreturn-type", i18n( "Warn when a function without explicit return type is defined" ) ); + new FlagListItem( wallBox, + "-Wswitch", i18n( "Warn whenever a switch statement has an index of enumeral type\n" + "and lacks a case for one or more of the named codes of that enumeration" ) ); + new FlagListItem( wallBox, + "-Wtrigraphs", i18n( "Warn when trigraphs are encountered" ) ); + new FlagListItem( wallBox, + "-Wunused", i18n( "Warn when a variable is declared but not used" ) ); + new FlagListItem( wallBox, + "-Wuninitialized", i18n( "Warn when a variable is used without being initialized first" ) ); + new FlagListItem( wallBox, + "-Wunknown-pragmas", i18n( "Warn when an unknown #pragma statement is encountered" ) ); + new FlagListItem( wallBox, + "-Wdiv-by-zero", i18n( "Warn when a division by zero occurs." ) ); + if ( type == GccOptionsPlugin::GPP ) + { + new FlagListItem( wallBox, + "-Wreorder", i18n( "Warn when the order of member initializers is different from\n" + "the order in the class declaration" ) ); + } +} + + +Warnings1Tab::~Warnings1Tab() +{ + delete controller; +} + + +void Warnings1Tab::readFlags( QStringList *list ) +{ + controller->readFlags( list ); + wallBox->readFlags( list ); +} + + +void Warnings1Tab::writeFlags( QStringList *list ) +{ + controller->writeFlags( list ); + wallBox->writeFlags( list ); +} + + +Warnings2Tab::Warnings2Tab( GccOptionsPlugin::Type type, QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + + wrestBox = new FlagListBox( this ); + + new FlagListItem( wrestBox, + "-W", i18n( "Set options not included in -Wall which are very specific" ) ); + new FlagListItem( wrestBox, + "-Wfloat-equal", i18n( "Warn if floating point values are used in equality comparisons" ) ); + new FlagListItem( wrestBox, + "-Wundef", i18n( "Warn if an undefined identifier is evaluated in an #if directive" ) ); + new FlagListItem( wrestBox, + "-Wshadow", i18n( "Warn whenever a local variable shadows another local variable" ) ); + new FlagListItem( wrestBox, + "-Wpointer-arith", i18n( "Warn about anything that depends on the sizeof a\n" + "function type or of void" ) ); + new FlagListItem( wrestBox, + "-Wcast-qual", i18n( "Warn whenever a pointer is cast so as to remove a type\n" + "qualifier from the target type" ) ); + new FlagListItem( wrestBox, + "-Wcast-align", i18n( "Warn whenever a pointer is cast such that the required\n" + "alignment of the target is increased" ) ); + new FlagListItem( wrestBox, + "-Wwrite-strings", i18n( "Warn when the address of a string constant is cast\n" + "into a non-const char * pointer" ) ); + new FlagListItem( wrestBox, + "-Wconversion", i18n( "Warn if a prototype causes a type conversion that is different\n" + "from what would happen to the same argument in the absence\n" + "of a prototype" ) ); + new FlagListItem( wrestBox, + "-Wsign-compare", i18n( "Warn when a comparison between signed and unsigned values\n" + "could produce an incorrect result when the signed value\n" + "is converted to unsigned" ) ); + new FlagListItem( wrestBox, + "-Wmissing-noreturn", i18n( "Warn about functions which might be candidates for attribute 'noreturn'" ) ); + new FlagListItem( wrestBox, + "-Waggregate-return", i18n( "Warn if any functions that return structures or unions are\n" + "defined or called" ) ); + new FlagListItem( wrestBox, + "-Wmissing-declarations", i18n( "Warn if a global function is defined without a previous declaration" ) ); + new FlagListItem( wrestBox, + "-Wno-deprecated-declarations", + i18n( "Do not warn about uses of functions, variables, and types marked as\n" + "deprecated by using the 'deprecated' attribute" ) ); + new FlagListItem( wrestBox, + "-Wpacked", i18n( "Warn if a structure is given the packed attribute, but the packed\n" + "attribute has no effect on the layout or size of the structure" ) ); + new FlagListItem( wrestBox, + "-Wpadded", i18n( "Warn if padding is included in a structure, either to align an\n" + "element of the structure or to align the whole structure" ) ); + new FlagListItem( wrestBox, + "-Wredundant-decls", i18n( "Warn if anything is declared more than once in the same scope" ) ); + new FlagListItem( wrestBox, + "-Wunreachable-code", i18n( "Warn if the compiler detects that code will never be executed" ) ); + new FlagListItem( wrestBox, + "-Winline", i18n( "Warn if an inline function cannot be inlined" ) ); + new FlagListItem( wrestBox, + "-Wlong-long", i18n( "Warn if the long long type is used" ) ); + new FlagListItem( wrestBox, + "-Wdisabled-optimization", i18n( "Warn if a requested optimization pass is disabled" ) ); + new FlagListItem( wrestBox, + "-Wno-div-by-zero", i18n( "Do not warn if there is a division by zero" ) ); + + if ( type == GccOptionsPlugin::GCC ) + { + new FlagListItem( wrestBox, + "-Wtraditional", i18n( "Warn about certain constructs that behave differently\n" + "in traditional and ANSI C" ) ); + new FlagListItem( wrestBox, + "-Wbad-function-cast", i18n( "Warn whenever a function call is cast to a non-matching type" ) ); + new FlagListItem( wrestBox, + "-Wstrict-prototypes", i18n( "Warn if a function is declared or defined without specifying\n" + "the argument types" ) ); + new FlagListItem( wrestBox, + "-Wmissing-prototypes", i18n( "Warn if a global function is defined without a previous prototype declaration" ) ); + new FlagListItem( wrestBox, + "-Wnested-externs", i18n( "Warn if an extern declaration is encountered within a function" ) ); + } + + + if ( type == GccOptionsPlugin::GPP ) + { + new FlagListItem( wrestBox, + "-Woverloaded-virtual", i18n( "Warn when a function declaration hides virtual\n" + "functions from a base class" ) ); + new FlagListItem( wrestBox, + "-Wsynth", i18n( "Warn when g++'s synthesis behavior does\n" + "not match that of cfront" ) ); + new FlagListItem( wrestBox, + "-Wctor-dtor-privacy", i18n( "Warn when a class seems unusable, because all the constructors or\n" + "destructors in a class are private and the class has no friends or\n" + "public static member functions" ) ); + new FlagListItem( wrestBox, + "-Wnon-virtual-dtor", i18n( "Warn when a class declares a non-virtual destructor that should\n" + "probably be virtual, because it looks like the class will be used\n" + "polymorphically" ) ); + new FlagListItem( wrestBox, + "-Wsign-promo", i18n( "Warn when overload resolution chooses a promotion from unsigned or\n" + "enumeral type to a signed type over a conversion to an unsigned\n" + "type of the same size. Previous versions of G++ would try to\n" + "preserve unsignedness, but the standard mandates the current behavior" ) ); + new FlagListItem( wrestBox, + "-Wabi", i18n( "Warn when G++ generates code that is probably not compatible with\n" + "the vendor-neutral C++ ABI" ) ); + /* new FlagListItem(wrestBox, + "-Wreorder", i18n("Warn when the order of member initializers given in the code does\n" + "not match the order in which they must be executed."));*/ + new FlagListItem( wrestBox, + "-Weffc++", i18n( "Warn about violations of the following style guidelines from Scott\n" + "Meyers' 'Effective C++' book:\n" + "* Item 11: Define a copy constructor and an assignment\n" + " operator for classes with dynamically allocated memory;\n" + "* Item 12: Prefer initialization to assignment in constructors;\n" + "* Item 14: Make destructors virtual in base classes;\n" + "* Item 15: Have `operator=' return a reference to `*this';\n" + "* Item 23: Do not try to return a reference when you must\n" + " return an object\n" + "\n" + "and about violations of the following style guidelines from Scott\n" + "Meyers' 'More Effective C++' book:\n" + "* Item 6: Distinguish between prefix and postfix forms of\n" + " increment and decrement operators;\n" + "* Item 7: Never overload '&&', '||', or ','" ) ); + new FlagListItem( wrestBox, + "-Wno-deprecated", i18n( "Do not warn about usage of deprecated features" ) ); + new FlagListItem( wrestBox, + "-Wno-non-template-friend", i18n( "Disable warnings when non-templatized friend functions are declared\n" + "within a template" ) ); + new FlagListItem( wrestBox, + "-Wold-style-cast", i18n( "Warn if an old-style (C-style) cast to a non-void type is used\n" + "within a C++ program" ) ); + new FlagListItem( wrestBox, + "-Wno-pmf-conversions", i18n( "Disable the diagnostic for converting a bound pointer to member\n" + "function to a plain pointer" ) ); + } +} + + +Warnings2Tab::~Warnings2Tab() +{} + + +void Warnings2Tab::readFlags( QStringList *list ) +{ + wrestBox->readFlags( list ); +} + + +void Warnings2Tab::writeFlags( QStringList *list ) +{ + wrestBox->writeFlags( list ); +} + + +// Last but not least... :-) +GccOptionsDialog::GccOptionsDialog( GccOptionsPlugin::Type type, QWidget *parent, const char *name ) + : KDialogBase( Tabbed, GccOptionsPlugin::captionForType( type ), Ok | Cancel, Ok, parent, name, true ) +{ + QVBox * vbox; + + vbox = addVBoxPage( i18n( "General" ) ); + general = new GeneralTab( type, vbox, "general tab" ); + + vbox = addVBoxPage( i18n( "Optimization" ) ); + optimization = new OptimizationTab( type, vbox, "optimization tab" ); + + if ( type == GccOptionsPlugin::G77 ) + { + vbox = addVBoxPage( i18n( "Fortran Specifics" ) ); + g77 = new G77Tab( vbox, "g77 tab" ); + } + else + g77 = 0; + + vbox = addVBoxPage( i18n( "Warnings (safe)" ) ); + warnings1 = new Warnings1Tab( type, vbox, "warnings1 tab" ); + + vbox = addVBoxPage( i18n( "Warnings (unsafe)" ) ); + warnings2 = new Warnings2Tab( type, vbox, "warnings2 tab" ); +} + + +GccOptionsDialog::~GccOptionsDialog() +{} + + +void GccOptionsDialog::setFlags( const QString &flags ) +{ + QStringList flaglist = QStringList::split( " ", flags ); + + // Hand them to 'general' at last, so it can make a line edit + // with the unprocessed items + if ( g77 ) + g77->readFlags( &flaglist ); + optimization->readFlags( &flaglist ); + warnings1->readFlags( &flaglist ); + warnings2->readFlags( &flaglist ); + general->readFlags( &flaglist ); + unrecognizedFlags = flaglist; +} + + +QString GccOptionsDialog::flags() const +{ + QStringList flaglist; + + if ( g77 ) + g77->writeFlags( &flaglist ); + optimization->writeFlags( &flaglist ); + warnings1->writeFlags( &flaglist ); + warnings2->writeFlags( &flaglist ); + general->writeFlags( &flaglist ); + + QString flags; + QStringList::ConstIterator li; + for ( li = flaglist.begin(); li != flaglist.end(); ++li ) + { + flags += ( *li ); + flags += " "; + } + + for ( li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li ) + { + flags += ( *li ); + flags += " "; + } + + flags.truncate( flags.length() - 1 ); + return flags; +} + + +GccOptionsPlugin::GccOptionsPlugin( QObject *parent, const char *name, const QStringList &args ) + : KDevCompilerOptions( parent, name ) +{ + gcctype = Unknown; + + if ( args.count() == 0 ) + return ; + + QString typeStr = args[ 0 ]; + + if ( typeStr == "gcc" ) + gcctype = GccOptionsPlugin::GCC; + else if ( typeStr == "g++" ) + gcctype = GccOptionsPlugin::GPP; + else if ( typeStr == "g77" ) + gcctype = GccOptionsPlugin::G77; +} + + +GccOptionsPlugin::~GccOptionsPlugin() +{} + + +QString GccOptionsPlugin::captionForType( Type type ) +{ + switch ( type ) + { + case GCC: + return i18n( "GNU C Compiler Options" ); + case GPP: + return i18n( "GNU C++ Compiler Options" ); + case G77: + return i18n( "GNU Fortran 77 Compiler Options" ); + default: + return QString::null; + } +} + + +QString GccOptionsPlugin::exec( QWidget *parent, const QString &flags ) +{ + if ( gcctype == Unknown ) + return QString::null; + GccOptionsDialog *dlg = new GccOptionsDialog( gcctype, parent, "gcc options dialog" ); + QString newFlags = flags; + dlg->setFlags( flags ); + if ( dlg->exec() == QDialog::Accepted ) + newFlags = dlg->flags(); + delete dlg; + return newFlags; +} + +#include "gccoptionsplugin.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/compiler/gccoptions/gccoptionsplugin.h b/languages/cpp/compiler/gccoptions/gccoptionsplugin.h new file mode 100644 index 00000000..a3b8cd70 --- /dev/null +++ b/languages/cpp/compiler/gccoptions/gccoptionsplugin.h @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2000-2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _GCCOPTIONSPLUGIN_H_ +#define _GCCOPTIONSPLUGIN_H_ + +#include + +#include "kdevcompileroptions.h" + + +class GeneralTab; +class OptimizationTab; +class G77Tab; +class Warnings1Tab; +class Warnings2Tab; + + +class GccOptionsPlugin : public KDevCompilerOptions +{ + Q_OBJECT + +public: + enum Type { GCC, GPP, G77, Unknown }; + GccOptionsPlugin( QObject *parent, const char *name, const QStringList &args ); + ~GccOptionsPlugin(); + + static QString captionForType(Type type); + + virtual QString exec(QWidget *parent, const QString &flags); + +private: + Type gcctype; +}; + + +class GccOptionsDialog : public KDialogBase +{ +public: + GccOptionsDialog( GccOptionsPlugin::Type type, QWidget *parent=0, const char *name=0 ); + ~GccOptionsDialog(); + + void setFlags(const QString &flags); + QString flags() const; + +private: + GeneralTab *general; + OptimizationTab *optimization; + G77Tab *g77; + Warnings1Tab *warnings1; + Warnings2Tab *warnings2; + QStringList unrecognizedFlags; +}; + +#endif diff --git a/languages/cpp/compiler/gccoptions/kdevg77options.desktop b/languages/cpp/compiler/gccoptions/kdevg77options.desktop new file mode 100644 index 00000000..4f7941b7 --- /dev/null +++ b/languages/cpp/compiler/gccoptions/kdevg77options.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Type=Service +Exec=g77 +Comment=GNU Fortran 77 Compiler +Comment[br]=Dastumer Fortran 77 GNU +Comment[ca]=Compilador Fortran 77 de GNU +Comment[da]=GNU Fortran 77 compiler +Comment[el]=Μεταγλωττιστής GNU Fortran 77 +Comment[es]=Compilador GNU de Fortran 77 +Comment[et]=GNU Fortran 77 kompilaator +Comment[eu]=GNU Fortran 77 konpiladorea +Comment[fa]=مترجم فرترن ۷۷ گنو +Comment[fr]=Compilateur pour Fortran 77 du GNU +Comment[ga]=Tiomsaitheoir Fortran 77 GNU +Comment[gl]=Compilador GNU Fortran 77 +Comment[hi]=जीएनयू फ़ोरट्रॉन 77 कम्पायलर +Comment[hu]=GNU Fortran 77 fordítóprogram +Comment[is]=GNU Fortran 77 þýðandi +Comment[it]=Compilatore per GNU Fortran 77 +Comment[ja]=GNU Fortran 77 コンパイラ +Comment[nds]=GNU Fortran 77-Kompilerer +Comment[ne]=GNU Fortran 77 कम्पाइलर +Comment[nl]=GNU Fortran 77-compiler +Comment[pl]=Kompilator GNU Fortran 77 +Comment[pt]=Compilador GNU Fortran 77 +Comment[pt_BR]=Compilador GNU Fortran 77 +Comment[ru]=Компилятор GNU Fortran 77 +Comment[sk]=GNU Fortran 77 kompilátor +Comment[sl]=Prevajalnik za GNU Fortran 77 +Comment[sr]=GNU-ов преводилац Fortran-а 77 +Comment[sr@Latn]=GNU-ov prevodilac Fortran-a 77 +Comment[sv]=GNU Fortran 77-compilator +Comment[ta]=GNU Fortran 77 தொகுப்பி +Comment[tg]=Талфифгари GNU Fortran 77 +Comment[tr]=GNU Fortran 77 Derleyicisi +Comment[zh_CN]=GNU Fortran 77 编译器 +Comment[zh_TW]=GNU Fortran 77 編譯器 +Name=G77Options +Name[de]=G77-Einstellungen (KDevelop) +Name[el]=G77Επιλογές +Name[hi]=जी77विकल्प +Name[nds]=G77-Optschonen (KDevelop) +Name[pl]=Opcje G77 +Name[sk]=G77 možnosti +Name[sl]=Možnosti G77 +Name[sv]=Alternativ för g77 +Name[ta]=G77விருப்பங்கள் +Name[tg]=G77Интихобҳо +Name[tr]=G77Seçenekleri +Name[zh_TW]=G77 選項 +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevgccoptions +X-KDevelop-Version=5 +X-KDevelop-Language=Fortran +X-KDevelop-Args=g77 +X-KDevelop-Default=true diff --git a/languages/cpp/compiler/gccoptions/kdevgccoptions.desktop b/languages/cpp/compiler/gccoptions/kdevgccoptions.desktop new file mode 100644 index 00000000..5d135cb1 --- /dev/null +++ b/languages/cpp/compiler/gccoptions/kdevgccoptions.desktop @@ -0,0 +1,54 @@ +[Desktop Entry] +Type=Service +Exec=gcc +Comment=GNU C Compiler +Comment[br]=Dastumer C GNU +Comment[ca]=Compilador C de GNU +Comment[da]=GNU C compiler +Comment[el]=Μεταγλωττιστής GNU C +Comment[es]=Compilador GNU de C +Comment[et]=GNU C kompilaator +Comment[eu]=GNU C konpiladorea +Comment[fa]=مترجم سی گنو +Comment[fr]=Compilateur C du GNU +Comment[ga]=Tiomsaitheoir C GNU +Comment[gl]=Compilador GNU C +Comment[hi]=जीएनयू सी कम्पायलर +Comment[hu]=GNU C fordítóprogram +Comment[is]=GNU C þýðandi +Comment[it]=Compilatore GNU C +Comment[ja]=GNU C コンパイラ +Comment[nds]=GNU C-Kompilerer +Comment[ne]=GNU C कम्पाइलर +Comment[pl]=Kompilator GNU C +Comment[pt]=Compilador GNU C +Comment[pt_BR]=Compilador GNU C +Comment[ru]=Компилятор GNU C +Comment[sk]=GNU C kompilátor +Comment[sl]=Prevajalnik za GNU C +Comment[sr]=GNU-ов C преводилац +Comment[sr@Latn]=GNU-ov C prevodilac +Comment[sv]=GNU C-kompilator +Comment[ta]=GNU Cதொகுப்பி +Comment[tg]=Талфифгари GNU C +Comment[zh_CN]=GNU C 编译器 +Comment[zh_TW]=GNU C 編譯器 +Name=GccOptions +Name[de]=GCC-Einstellungen (KDevelop) +Name[el]=GccΕπιλογές +Name[hi]=जीसीसी-विकल्प +Name[nds]=GCC-Instellen +Name[pl]=Opcje Gcc +Name[sk]=Gcc možnosti +Name[sl]=Možnosti Gcc +Name[sv]=Alternativ för gcc +Name[ta]=Gccவிருப்பங்கள் +Name[tr]=GccSeçenekleri +Name[zh_TW]=Gcc 選項 +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevgccoptions +X-KDevelop-Version=5 +X-KDevelop-Language=C +X-KDevelop-Args=gcc +X-KDevelop-Default=true + diff --git a/languages/cpp/compiler/gccoptions/kdevgppoptions.desktop b/languages/cpp/compiler/gccoptions/kdevgppoptions.desktop new file mode 100644 index 00000000..ad12fa4c --- /dev/null +++ b/languages/cpp/compiler/gccoptions/kdevgppoptions.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Type=Service +Exec=g++ +Comment=GNU C++ Compiler +Comment[br]=Dastumer C++ GNU +Comment[ca]=Compilador C++ de GNU +Comment[da]=GNU C++ compiler +Comment[el]=Μεταγλωττιστής GNU C++ +Comment[es]=Compilador GNU de C++ +Comment[et]=GNU C++ kompilaator +Comment[eu]=GNU C++ konpiladorea +Comment[fa]=مترجم C++ گنو +Comment[fr]=Compilateur C++ de GNU +Comment[ga]=Tiomsaitheoir C++ GNU +Comment[gl]=Compilador GNU C++ +Comment[hi]=जीएनयू सी++ कम्पायलर +Comment[hu]=GNU C++ fordítóprogram +Comment[is]=GNU C++ þýðandi +Comment[it]=Compilatore GNU C++ +Comment[ja]=GNU C++ コンパイラ +Comment[nds]=GNU C++-Kompilerer +Comment[ne]=GNU C++ कम्पाइलर +Comment[nl]=GNU C++ compiler +Comment[pl]=Kompilator GNU C++ +Comment[pt]=Compilador GNU C++ +Comment[pt_BR]=Compilador GNU C++ +Comment[ru]=Компилятор GNU C++ +Comment[sk]=GNU C++ kompilátor +Comment[sl]=Prevajalnik za GNU C++ +Comment[sr]=GNU-ов C++ преводилац +Comment[sr@Latn]=GNU-ov C++ prevodilac +Comment[sv]=GNU C++ kompilator +Comment[ta]=GNU C++தொகுப்பி +Comment[tg]=Талфифгари GNU C++ +Comment[tr]=GNU C++ Derleyicisi +Comment[zh_CN]=GNU C++ 编译器 +Comment[zh_TW]=GNU C++ 編譯器 +Name=GppOptions +Name[de]=GPP-Einstellungen (KDevelop) +Name[el]=GppΕπιλογές +Name[hi]=जीपीपी-विकल्प +Name[nds]=GPP-Instellen +Name[pl]=Opcje Gpp +Name[sk]=Gpp možnosti +Name[sl]=Možnosti Gpp +Name[sv]=Alternativ för g++ +Name[ta]=Gppவிருப்பங்கள் +Name[tr]=GppSeçenekleri +Name[zh_TW]=Gpp 選項 +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevgccoptions +X-KDevelop-Version=5 +X-KDevelop-Language=C++ +X-KDevelop-Args=g++ +X-KDevelop-Default=true + diff --git a/languages/cpp/completiondebug.cpp b/languages/cpp/completiondebug.cpp new file mode 100644 index 00000000..dc73329e --- /dev/null +++ b/languages/cpp/completiondebug.cpp @@ -0,0 +1,56 @@ + +/*************************************************************************** + copyright : (C) 2006 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "completiondebug.h" + +namespace CompletionDebug { + +DBGStreamType dbgState; + +const int completionMaxDepth = 50; + +DBGStreamType::KStreamType& dbg() { + return dbgState.dbg(); +} + +bool dbgActive() { + return true; +} + +#ifndef NDEBUG +kdbgstream dbgMajor() { + kdbgstream ret = kdDebug( 9007 ); + dbgState.outputPrefix( ret ); + return ret; +} +#else +kndbgstream dbgMajor() { + return kndDebug(); +}; + +#endif + +#ifndef NDEBUG +template<> + KDDebugState::KDDebugState() : m_stream ( kdDebug( 9007 ) ) { + } +#endif + +template<> + KDDebugState::KDDebugState() { + } +} + +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/completiondebug.h b/languages/cpp/completiondebug.h new file mode 100644 index 00000000..088b3b99 --- /dev/null +++ b/languages/cpp/completiondebug.h @@ -0,0 +1,221 @@ +/*************************************************************************** +copyright : (C) 2006 by David Nolden +email : david.nolden.kdevelop@art-master.de +***************************************************************************/ +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef __COMPLETIONDEBUG_H__ +#define __COMPLETIONDEBUG_H__ + +///With verbose shut on, the whole type-resolution-process is nicely traced for easy debugging(at cost of speed). +//#define VERBOSE +//#define VERBOSEMAJOR + +///When defined, a backtrace is printed the first time the maximum depth is reached for the first time. +//#define DEPTHBACKTRACE + +#include +#include + +namespace CompletionDebug { +template +class KDDebugState { + private: + StreamType m_stream; + kndbgstream m_nstream; + QStringList m_prefixStack; + int m_counter; + int m_depth; + bool m_enabled; + bool m_hadWarning; + + public: + typedef StreamType KStreamType; + KDDebugState(); + + KDDebugState( StreamType stream ) : m_stream( stream ), m_counter( 0 ), m_depth( 0 ), m_enabled( true ), m_hadWarning( false ) {} + + void push( const QString & txt ) { + m_prefixStack.push_back( txt ); + pushDepth(); + } + + void pop() { + m_prefixStack.pop_back(); + popDepth(); + }; + + inline void pushDepth() { + m_depth++; + } + + inline void popDepth() { + m_depth--; + } + + bool hadWarning() { + return m_hadWarning; + } + + void setHadWarning( bool had ) { + m_hadWarning = had; + } + + StreamType& dbg() { +#ifndef VERBOSE + if ( !m_enabled ) + return m_nstream; +#endif + + m_stream << "(" << m_counter << ")"; + for ( QStringList::iterator it = m_prefixStack.begin(); it != m_prefixStack.end() ; ++it ) + m_stream << *it; + + m_counter++; + return m_stream; + } + + void setState( bool enabled ) { + m_enabled = enabled; + } + + bool state() { + return m_enabled; + } + +#ifndef NDEBUG + void outputPrefix( kdbgstream& target ) { + target << "(" << m_counter << ")"; + for ( QStringList::iterator it = m_prefixStack.begin(); it != m_prefixStack.end() ; ++it ) + target << *it; + + m_counter++; + } +#endif + + void clearCounter() { + m_counter = 0; + } + + int depth() { + return m_depth; + } +}; +#ifndef NDEBUG +template <> +KDDebugState::KDDebugState(); +#endif +template <> +KDDebugState::KDDebugState(); +#if defined(VERBOSE) && !defined(NDEBUG) +typedef KDDebugState DBGStreamType; +#else +typedef KDDebugState DBGStreamType; +#endif +///Class to help indent the debug-output correctly +extern DBGStreamType dbgState; +extern const int completionMaxDepth; +class LogDebug { + private: + DBGStreamType& m_state; + int m_max; + public: + LogDebug( const char* prefix = "#", int max = completionMaxDepth, DBGStreamType& st = dbgState ) : m_state( st ), m_max( max ) { + m_state.push( prefix ); + }; + ~LogDebug() { + m_state.pop(); + } + + DBGStreamType::KStreamType& dbg() { + return m_state.dbg(); + } + + int depth() { + return m_state.depth(); + } + + operator bool() { + bool r = depth() < m_max; + + if ( !r && !m_state.hadWarning() ) { + m_state.setHadWarning( true ); + dbg() << "recursion is too deep" << endl; +#ifdef DEPTHBACKTRACE + kdDebug( 9007 ) << kdBacktrace() << endl; +#endif + } + return r; + } +}; + + +///does not care about the logging, but still counts the depth +class DepthDebug { + DBGStreamType& m_state; + int m_max; + public: + DepthDebug( const char* prefix = "#", int max = completionMaxDepth, DBGStreamType& st = dbgState ) : m_state( st ), m_max( max ) { + Q_UNUSED( prefix ); + m_state.pushDepth(); + }; + + ~DepthDebug() { + m_state.popDepth(); + } + + kndbgstream dbg() { + return kndDebug(); + } + + int depth() { + return m_state.depth(); + } + + operator bool() { + bool r = depth() < m_max; + + if ( !r && !m_state.hadWarning() ) { + m_state.setHadWarning( true ); + dbg() << "recursion is too deep" << endl; +#ifdef DEPTHBACKTRACE + kdDebug( 9007 ) << kdBacktrace() << endl; +#endif + } + return r; + } +}; + +#ifndef VERBOSEMAJOR +#define ifVerboseMajor(x) /**/ +#else +#define ifVerboseMajor(x) x +#endif + +bool dbgActive(); + +#ifdef VERBOSE + +typedef LogDebug Debug; +DBGStreamType::KStreamType& dbg(); +#define ifVerbose( x) {if( dbgActive() ) {x;}} +#else + +DBGStreamType::KStreamType& dbg(); +typedef DepthDebug Debug; +#define ifVerbose(x) /**/ +#endif +#ifndef NDEBUG +kdbgstream dbgMajor(); +#else +kndbgstream dbgMajor(); +#endif +} +#endif +// kate: indent-mode csands; tab-width 2; diff --git a/languages/cpp/computerecoverypoints.h b/languages/cpp/computerecoverypoints.h new file mode 100644 index 00000000..eccd44f6 --- /dev/null +++ b/languages/cpp/computerecoverypoints.h @@ -0,0 +1,190 @@ +/*************************************************************************** + begin : Sat Jul 21 2001 + copyright : (C) 2001 by Victor R�er + email : victor_roeder@gmx.de + copyright : (C) 2002,2003 by Roberto Raggi + email : roberto@kdevelop.org + copyright : (C) 2005 by Adam Treat + email : manyoso@yahoo.com + copyright : (C) 2006 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __COMPUTERECOVERYPOINTS_H__ +#define __COMPUTERECOVERYPOINTS_H__ + +#include + +#include "simpletype.h" +#include "simpletypenamespace.h" +#include "tree_parser.h" + +static QString toSimpleName( NameAST* name ) +{ + if ( !name ) + return QString::null; + + QString s; + QPtrList l = name->classOrNamespaceNameList(); + QPtrListIterator nameIt( l ); + while ( nameIt.current() ) + { + if ( nameIt.current() ->name() ) + { + s += nameIt.current() ->name() ->text() + "::"; + } + ++nameIt; + } + + if ( name->unqualifiedName() && name->unqualifiedName() ->name() ) + s += name->unqualifiedName() ->name() ->text(); + + return s; +} + + +struct RecoveryPoint +{ + int kind; + QStringList scope; + QValueList imports; + + int startLine, startColumn; + int endLine, endColumn; + + RecoveryPoint() + : kind( 0 ), startLine( 0 ), startColumn( 0 ), + endLine( 0 ), endColumn( 0 ) + {} + + ///Registers the recovery-points imports into the given namespace + void registerImports( SimpleType ns, QString hardCodedAliases ) { + SimpleTypeNamespace* n = dynamic_cast( &(*ns) ); + if( !n ) { + kdDebug( 9007 ) << "the global namespace was not resolved correctly " << endl; + } else { + ///put the imports into the global namespace + for( QValueList::iterator it = imports.begin(); it != imports.end(); ++it ) { + kdDebug( 9007 ) << "inserting import " << *it << " into the global scope" << endl; + n->addAliasMap( QString(""), (*it).join("::"), IncludeFiles() ); ///@TODO: remove this + } + n->addAliases( hardCodedAliases ); + } + } + +private: + RecoveryPoint( const RecoveryPoint& source ); + void operator = ( const RecoveryPoint& source ); +}; + + +// namespace? +class ComputeRecoveryPoints: public TreeParser +{ +public: + ComputeRecoveryPoints( QPtrList& points ) + : recoveryPoints( points ) + {} + + virtual void parseTranslationUnit( const ParsedFile& ast ) + { + QValueList dummy; + + m_imports.push( dummy ); + TreeParser::parseTranslationUnit( ast ); + m_imports.pop(); + + kdDebug( 9007 ) << "found " << recoveryPoints.count() << " recovery points" << endl; + } + + virtual void parseUsingDirective( UsingDirectiveAST* ast ) + { + if ( !ast->name() ) + return ; + + //QStringList type = CppCodeCompletion::typeName( ast->name() ->text() ).scope(); + m_imports.top().push_back( ast->name() ->text() ); + } + + virtual void parseNamespace( NamespaceAST* ast ) + { + m_currentScope.push_back( ast->namespaceName() ->text() ); + insertRecoveryPoint( ast ); + + m_imports.push( m_imports.top() ); // dup + // m_imports.top().push_back( m_currentScope ); + + TreeParser::parseNamespace( ast ); + + m_imports.pop(); + m_currentScope.pop_back(); + } + + void parseTemplateDeclaration( TemplateDeclarationAST* ast ) + { + if ( ast->declaration() ) + parseDeclaration( ast->declaration() ); + + TreeParser::parseTemplateDeclaration( ast ); + } + + + virtual void parseSimpleDeclaration( SimpleDeclarationAST* ast ) + { + TypeSpecifierAST * typeSpec = ast->typeSpec(); + //InitDeclaratorListAST* declarators = ast->initDeclaratorList(); + + if ( typeSpec ) + parseTypeSpecifier( typeSpec ); + + //insertRecoveryPoint( ast ); + TreeParser::parseSimpleDeclaration( ast ); + } + + virtual void parseFunctionDefinition( FunctionDefinitionAST* ast ) + { + m_imports.push( m_imports.top() ); // dup + insertRecoveryPoint( ast ); + m_imports.pop(); + } + + virtual void parseClassSpecifier( ClassSpecifierAST* ast ) + { + insertRecoveryPoint( ast ); + m_currentScope.push_back( toSimpleName( ast->name() ) ); + TreeParser::parseClassSpecifier( ast ); + m_currentScope.pop_back(); + } + + void insertRecoveryPoint( AST* ast ) + { + if ( !ast ) + return ; + + RecoveryPoint* pt = new RecoveryPoint(); + pt->kind = ast->nodeType(); + pt->scope = m_currentScope; + ast->getStartPosition( &pt->startLine, &pt->startColumn ); + ast->getEndPosition( &pt->endLine, &pt->endColumn ); + pt->imports = m_imports.top(); + + recoveryPoints.append( pt ); + } + +private: + QPtrList& recoveryPoints; + QValueStack< QValueList > m_imports; + QStringList m_currentScope; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/configproblemreporter.ui b/languages/cpp/configproblemreporter.ui new file mode 100644 index 00000000..164d6693 --- /dev/null +++ b/languages/cpp/configproblemreporter.ui @@ -0,0 +1,189 @@ + +ConfigureProblemReporter + + + ConfigureProblemReporter + + + + 0 + 0 + 588 + 492 + + + + + unnamed + + + + groupBox3_2 + + + Problem Reporter + + + If enabled, the C++ parser will report any syntax errors it detects. +They will be displayed in the 'Problems' output view and as markers in the editor. + + + + unnamed + + + + problemReporterCheckbox + + + &Use Problem Reporter + + + + + + + groupBox1 + + + Sunken + + + Parsing + + + If enabled, the C++ parser will run on the active file after the stated timeout, after there has been any changes to the text. + +If disabled, the parser will typically only run when the file is saved. + + + + unnamed + + + + layout2 + + + + unnamed + + + + bgParserCheckbox + + + Enable &background parsing + + + + + delayLabel + + + + 7 + 5 + 0 + 0 + + + + msec + + + AlignVCenter|AlignLeft + + + + + + + delaySlider + + + 250 + + + 2000 + + + 250 + + + 500 + + + Horizontal + + + NoMarks + + + 250 + + + + + + + groupBox3 + + + Special &Headers + + + Often a macro that the C++ parser must understand in order to correctly parse a piece of code is defined somewhere in a non-standard header file that the parser does not look at. This textbox can be used to define those macros locally so that the C++ parser can understand them. + + + + unnamed + + + + specialHeader + + + + + + + + + delaySlider + valueChanged(int) + ConfigureProblemReporter + setDelayLabel(int) + + + bgParserCheckbox + toggled(bool) + ConfigureProblemReporter + bgParserCheckbox_toggled(bool) + + + + bgParserCheckbox + delaySlider + + + kdialog.h + configproblemreporter.ui.h + + + class CppSupportPart; + + + CppSupportPart* m_part; + + + init() + destroy() + setPart( CppSupportPart * part ) + accept() + bgParserCheckbox_toggled( bool b ) + setDelayLabel( int delay ) + + + + diff --git a/languages/cpp/configproblemreporter.ui.h b/languages/cpp/configproblemreporter.ui.h new file mode 100644 index 00000000..d5952b95 --- /dev/null +++ b/languages/cpp/configproblemreporter.ui.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + +#include "cppsupportpart.h" + +#include + +#include +#include +#include +#include + +#include +#include + +void ConfigureProblemReporter::init() +{ + m_part = 0; + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + problemReporterCheckbox->setChecked( config->readBoolEntry( "EnableProblemReporter", true ) ); + bgParserCheckbox->setChecked( config->readBoolEntry( "EnableCppBgParser", true ) ); + delaySlider->setEnabled( bgParserCheckbox->isChecked() ); + delaySlider->setValue( config->readNumEntry( "BgParserDelay", 500 ) ); + setDelayLabel( delaySlider->value() ); +} + +void ConfigureProblemReporter::destroy() +{} + +void ConfigureProblemReporter::setPart( CppSupportPart* part ) +{ + m_part = part; + if ( !m_part ) + return ; + + QString conf_file_name = m_part->specialHeaderName(); + if ( QFile::exists( conf_file_name ) ) + { + QFile f( conf_file_name ); + if ( f.open( IO_ReadOnly ) ) + { + QTextStream stream( &f ); + specialHeader->setText( stream.read() ); + f.close(); + } + } +} + +void ConfigureProblemReporter::accept() +{ + KConfig * config = kapp->config(); + config->setGroup( "General Options" ); + config->writeEntry( "EnableProblemReporter", problemReporterCheckbox->isChecked() ); + config->writeEntry( "EnableCppBgParser", bgParserCheckbox->isChecked() ); + if ( bgParserCheckbox->isChecked() ) + config->writeEntry( "BgParserDelay", delaySlider->value() ); + config->sync(); + + m_part->updateBackgroundParserConfig(); + + + if ( m_part && specialHeader->isModified() ) + { + QString conf_file_name = m_part->specialHeaderName( true ); + QFile f( conf_file_name ); + if ( f.open( IO_WriteOnly ) ) + { + QTextStream stream( &f ); + stream << specialHeader->text(); + f.close(); + + m_part->updateParserConfiguration(); + } + } +} + +void ConfigureProblemReporter::bgParserCheckbox_toggled( bool b ) +{ + delaySlider->setEnabled( b ); + if ( b == TRUE ) + delayLabel->show(); + else + delayLabel->hide(); +} + + +void ConfigureProblemReporter::setDelayLabel( int delay ) +{ + delayLabel->setText( i18n( "delay: %1 msec" ).arg( delay ) ); +} +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/configuration b/languages/cpp/configuration new file mode 100644 index 00000000..bbdc5f4f --- /dev/null +++ b/languages/cpp/configuration @@ -0,0 +1,2 @@ +// add your favorite macros here + diff --git a/languages/cpp/cpp_tags.h b/languages/cpp/cpp_tags.h new file mode 100644 index 00000000..077fbd82 --- /dev/null +++ b/languages/cpp/cpp_tags.h @@ -0,0 +1,432 @@ +// +// +// C++ Interface: cpp_tags +// +// Description: +// +// +// Author: KDevelop Authors , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef CPP_TAGS_H +#define CPP_TAGS_H + +#include +#include + +template +class CppBaseClass +{ +public: + CppBaseClass( Tag& tag ) + : m_tag( tag ) + { + m_info.flags = tag.flags(); + } + + operator Tag& () + { + return asTag(); + } + Tag& asTag() + { + return m_tag; + } + + operator const Tag& () const + { + return asTag(); + } + const Tag& asTag() const + { + return m_tag; + } + + static QString format( const Tag& tag ) + { + return QString::null; + } + + int access() const + { + return m_info.data.access; + } + + void setAccess( int access ) + { + m_info.data.access = access; + m_tag.setFlags( m_info.flags ); + } + + bool isVirtual() const + { + return m_info.data.isVirtual; + } + + void setVirtual( bool b ) + { + m_info.data.isVirtual = b; + m_tag.setFlags( m_info.flags ); + } + + QString name() const + { + return m_tag.name(); + } + + void setName( const QString& name ) + { + m_tag.setName( name ); + } + + QString baseClass() const + { + return m_tag.attribute( "b" ).toString(); + } + + void setBaseClass( const QString& baseClass ) + { + m_tag.setAttribute( "b", baseClass ); + } + +private: + Tag& m_tag; + union + { + unsigned long flags; + struct + { + unsigned long access: + 3; + unsigned long isVirtual: + 1; + } + data; + } m_info; +}; + +template +class CppVariable +{ +public: + CppVariable( Tag& tag ) + : m_tag( tag ) + { + m_info.flags = tag.flags(); + } + + operator Tag& () + { + return asTag(); + } + Tag& asTag() + { + return m_tag; + } + + operator const Tag& () const + { + return asTag(); + } + const Tag& asTag() const + { + return m_tag; + } + + static QString format( const Tag& tag ) + { + return QString::null; + } + + int access() const + { + return m_info.data.access; + } + + void setAccess( int access ) + { + m_info.data.access = access; + m_tag.setFlags( m_info.flags ); + } + + bool isFriend() const + { + return m_info.data.isFriend; + } + + void setFriend( bool b ) + { + m_info.data.isFriend = b; + m_tag.setFlags( m_info.flags ); + } + + bool isStatic() const + { + return m_info.data.isStatic; + } + + void setStatic( bool b ) + { + m_info.data.isStatic = b; + m_tag.setFlags( m_info.flags ); + } + + QString type() const + { + return m_tag.attribute( "t" ).toString(); + } + + void setType( const QString& type ) + { + m_tag.setAttribute( "t", type ); + } + + QString name() const + { + return m_tag.name(); + } + + void setName( const QString& name ) + { + m_tag.setName( name ); + } + +private: + Tag& m_tag; + union + { + unsigned long flags; + struct + { + unsigned long access: + 3; + unsigned long isStatic: + 1; + unsigned long isFriend: + 1; + } + data; + } m_info; +}; + +template +class CppFunction +{ +public: + CppFunction( Tag& tag ) + : m_tag( tag ) + { + m_info.flags = tag.flags(); + } + + operator Tag& () + { + return asTag(); + } + Tag& asTag() + { + return m_tag; + } + + operator const Tag& () const + { + return asTag(); + } + const Tag& asTag() const + { + return m_tag; + } + + static QString format( const Tag& tag ) + { + return QString::null; + } + + int access() const + { + return m_info.data.access; + } + + void setAccess( int access ) + { + m_info.data.access = access; + m_tag.setFlags( m_info.flags ); + } + + bool isSignal() const + { + return bool( m_info.data.isSignal ); + } + + void setSignal( bool isSignal ) + { + m_info.data.isSignal = isSignal; + m_tag.setFlags( m_info.flags ); + } + + bool isSlot() const + { + return bool( m_info.data.isSlot ); + } + + void setSlot( bool isSlot ) + { + m_info.data.isSlot = isSlot; + m_tag.setFlags( m_info.flags ); + } + + bool isInline() const + { + return m_info.data.isInline; + } + + void setInline( bool b ) + { + m_info.data.isInline = b; + m_tag.setFlags( m_info.flags ); + } + + bool isPure() const + { + return m_info.data.isPure; + } + + void setPure( bool b ) + { + m_info.data.isPure = b; + m_tag.setFlags( m_info.flags ); + } + + bool isFriend() const + { + return m_info.data.isFriend; + } + + void setFriend( bool b ) + { + m_info.data.isFriend = b; + m_tag.setFlags( m_info.flags ); + } + + bool isConst() const + { + return m_info.data.isConst; + } + + void setConst( bool b ) + { + m_info.data.isConst = b; + m_tag.setFlags( m_info.flags ); + } + + bool isVolatile() const + { + return m_info.data.isVolatile; + } + + void setVolatile( bool b ) + { + m_info.data.isVolatile = b; + m_tag.setFlags( m_info.flags ); + } + + bool isVirtual() const + { + return m_info.data.isVirtual; + } + + void setVirtual( bool b ) + { + m_info.data.isVirtual = b; + m_tag.setFlags( m_info.flags ); + } + + bool isStatic() const + { + return m_info.data.isStatic; + } + + void setStatic( bool b ) + { + m_info.data.isStatic = b; + m_tag.setFlags( m_info.flags ); + } + + + QString type() const + { + return m_tag.attribute( "t" ).toString(); + } + + void setType( const QString& type ) + { + m_tag.setAttribute( "t", type ); + } + + QString name() const + { + return m_tag.name(); + } + + void setName( const QString& name ) + { + m_tag.setName( name ); + } + + QStringList arguments() const + { + return m_tag.attribute( "a" ).toStringList(); + } + + void setArguments( const QStringList args ) + { + m_tag.setAttribute( "a", args ); + } + + QStringList argumentNames() const + { + return m_tag.attribute( "an" ).toStringList(); + } + + void setArgumentNames( const QStringList args ) + { + m_tag.setAttribute( "an", args ); + } + +private: + Tag& m_tag; + union + { + unsigned long flags; + struct + { + unsigned long access: + 3; + unsigned long isInline: + 1; + unsigned long isVirtual: + 1; + unsigned long isStatic: + 1; + unsigned long isPure: + 1; + unsigned long isFriend: + 1; + unsigned long isConst: + 1; + unsigned long isValile: + 1; + unsigned long isSlot: + 1; + unsigned long isSignal: + 1; + } + data; + } m_info; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/cppcodecompletion.cpp b/languages/cpp/cppcodecompletion.cpp new file mode 100644 index 00000000..27cc9009 --- /dev/null +++ b/languages/cpp/cppcodecompletion.cpp @@ -0,0 +1,4492 @@ +/*************************************************************************** + cppcodecompletion.cpp - description + ------------------- +begin : Sat Jul 21 2001 +copyright : (C) 2001 by Victor R�er +email : victor_roeder@gmx.de +copyright : (C) 2002,2003 by Roberto Raggi +email : roberto@kdevelop.org +copyright : (C) 2005 by Adam Treat +email : manyoso@yahoo.com +copyright : (C) 2006,2007 by David Nolden +email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "cppcodecompletion.h" + + +#include "cppcodecompletionconfig.h" +#include "backgroundparser.h" +#include "ast.h" +#include "ast_utils.h" +#include "codeinformationrepository.h" +#include "parser.h" +#include "lexer.h" +#include "tree_parser.h" +#include "cpp_tags.h" +#include "cppsupport_utils.h" +#include "tag_creator.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "codecompletionentry.h" +#include "typedesc.h" +#include "computerecoverypoints.h" +#include "completiondebug.h" +#include "bithelpers.h" +#include "stringhelpers.h" +#include "simpletype.h" +#include "simpletypecachebinder.h" +#include "safetycounter.h" +#include "cppevaluation.h" +#include "simplecontext.h" +#include "simpletypefunction.h" + +//#define DISABLE_TRACING + +CppCodeCompletion* CppCodeCompletion::m_instance = 0; + +const bool disableVerboseForCompletionList = false; +const bool disableVerboseForContextMenu = false; +const bool contextMenuEntriesAtTop = false; +bool showNamespaceAppearances = true; + +const char* constructorPrefix = ""; +const char* destructorPrefix = ""; +///This enables-disables the automatic processing of the expression under the mouse-cursor +//#define DISABLETOOLTIPS + +/** +-- TODO: Does not yet correctly search for overloaded functions and select the right one +-- TODO: The documentation shown in the calltips looks very bad, a better solution must be found(maybe an additional tooltip) +*/ + + void statusBarText( const QString& str, int time ) { + CppCodeCompletion* c = CppCodeCompletion::instance(); + if( c ) + c->addStatusText( str, time ); + } + +TypePointer CppCodeCompletion::createGlobalNamespace() { + KSharedPtr n = new SimpleTypeCachedNamespace( QStringList(), QStringList() ); + n->addAliases(m_pSupport->codeCompletionConfig()->namespaceAliases() ); + return n.data(); +} + +template +class ItemLocker { + public: + ItemLocker( Item& it ) : item( it ) { + it.lock(); + } + ~ItemLocker() { + item.unlock(); + } + private: + Item& item; +}; + +ParsedFilePointer getParsedFile( CodeModelItem* i ) { + if( !i || !i->file() || !i->file()->parseResult() ) return 0; + return dynamic_cast( i->file()->parseResult().data()); +} + +SafetyCounter safetyCounter; +CppCodeCompletion* cppCompletionInstance = 0; + +//file global functions, must be before any "using namespace" +QString cleanForMenu( QString txt ) { + return txt.replace( "&", "&&" ).replace( " ", " " ); +} + +QString buildSignature( TypePointer currType ) { + SimpleTypeFunctionInterface * f = currType->asFunction(); + if ( !f ) + return ""; + + QString ret; + LocateResult rtt = currType->locateDecType( f->getReturnType() ); + if ( rtt->resolved() || rtt.resolutionCount() > 1 ) + ret = rtt->fullNameChain(); + else + ret = f->getReturnType().fullNameChain(); + + + TypeDesc desc = currType->desc(); + desc.decreaseFunctionDepth(); + + QString sig = ret + " " + desc.fullNameChain() + f->signature(); + if ( f->isConst() ) + sig += " const"; + return sig; +} + +uint PopupTracker::pendingPopups = 0; +PopupTracker* PopupTracker::pt = 0; + +/** Multiple empty lines are reduced to one, too long lines wrapped over, and the beginnings of the lines are normalized +*/ +QStringList maximumLength( const QStringList& in, int length ) { + QStringList ret; + uint firstNonSpace = 50000; + for ( QStringList::const_iterator it = in.begin(); it != in.end(); ++it ) + for ( uint a = 0; a < ( *it ).length(); a++ ) + if ( !( *it ) [ a ].isSpace() ) { + if ( firstNonSpace > a ) + firstNonSpace = a; + break; + } + if ( firstNonSpace == 50000 ) + return QStringList(); + + bool hadEmptyLine = false; + for ( QStringList::const_iterator it = in.begin(); it != in.end(); ++it ) { + if ( ( *it ).length() <= firstNonSpace ) { + if ( !hadEmptyLine ) + ret << " "; + hadEmptyLine = true; + } else { + hadEmptyLine = false; + QString str = ( *it ).mid( firstNonSpace ); + while ( !str.isEmpty() ) { + if ( (int)str.length() < length ) { + ret << str; + break; + } else { + ret << str.left( length ) + "\\"; + str = str.mid( length ); + } + } + } + } + return ret; +} + +QStringList prepareTextForMenu( const QString& comment, int maxLines, int maxLength ) { + QStringList in = QStringList::split( "\n", comment ); + QStringList out; + for ( QStringList::iterator it = in.begin(); it != in.end(); ++it ) { + out << cleanForMenu( *it ); + if ( (int)out.count() >= maxLines ) { + out << "[...]"; + break; + } + } + + return maximumLength( out, maxLength ); +} + +QStringList formatComment( const QString& comment, int maxCols = 120 ) { + QStringList ret; + SafetyCounter s( 14 ); ///maximum of 14 lines + + QStringList lines = QStringList::split( "\n", comment ); + for ( QStringList::iterator it = lines.begin(); it != lines.end(); ++it ) { + QStringList words = QStringList::split( " ", *it ); + while ( !words.isEmpty() && s ) { + QString line = "? "; + int len = 0; + while ( !words.isEmpty() && len < maxCols ) { + len += words.front().length(); + line += words.front() + " "; + words.pop_front(); + } + ret << line; + } + } + if ( !s ) + ret << "? comment has too many lines"; + + return ret; +} + +bool operator < ( const CodeCompletionEntry& e1, const CodeCompletionEntry& e2 ) { + return e1.text < e2.text; +} + +template +static QValueList unique( const QValueList& entryList ) { + + QValueList< ItemType > l; + QMap map; + typename QValueList< ItemType >::ConstIterator it = entryList.begin(); + while ( it != entryList.end() ) { + CodeCompletionEntry e = *it++; + QString key = ( e.type + " " + + e.prefix + " " + + e.text + " " + + e.postfix + " " ).simplifyWhiteSpace().stripWhiteSpace(); + if ( map.find( key ) == map.end() ) { + map[ key ] = TRUE; + l << e; + } + } + return l; +} + +static QStringList unique( const QStringList& entryList ) { + + QStringList l; + QMap map; + QStringList::ConstIterator it = entryList.begin(); + while ( it != entryList.end() ) { + QString e = *it++; + if ( map.find( e ) == map.end() ) { + map[ e ] = TRUE; + l << e; + } + } + return l; +} + +static QStringList unique( const QValueList& entryList ) { + + QStringList l; + QMap map; + QValueList::ConstIterator it = entryList.begin(); + while ( it != entryList.end() ) { + QStringList li = ( *it++ ); + QString e = li.join( "\n" ); + if ( map.find( e ) == map.end() ) { + map[ e ] = TRUE; + l += li; + } + } + + return l; +} + + +bool tokenAt( const QString& text, const QString& token, int textPos ) { + if ( text.isEmpty() ) + return false; + + int tokenPos = token.length() - 1; + if ( tokenPos <= 0 || textPos <= 0 ) + return false; + + while ( text[ textPos ] == token[ tokenPos ] ) { + + --tokenPos; + --textPos; + + if ( tokenPos == 0 || textPos == 0 ) { + if ( tokenPos == 0 ) { + if ( textPos >= 1 && text[ textPos ] == token[ tokenPos ] ) { + QChar c = text[ textPos - 1 ]; + return c.isSpace() || c == '{' || c == '}' || c == ';'; + } else { + return false; + } + } else { + return false; + } + } + } + return false; +} + +CppSupportPart* CppCodeCompletion::cppSupport() const { + return m_pSupport; +} + +using namespace CompletionDebug; +using namespace StringHelpers; +using namespace BitHelpers; +using namespace CppEvaluation; + +struct PopupFillerHelpStruct { + CppCodeCompletion* receiver; + FileList files; + CppCodeCompletion::PopupActions& m_popupActions; + PopupFillerHelpStruct( CppCodeCompletion* rec ) : m_popupActions( rec->m_popupActions ) { + receiver = rec; + files = receiver->cppSupport()->codeModel()->fileList(); + } + + bool shouldShowIncludeMenu() const { + return true; + } + + QMap m_namespacePopupCache; + + void insertItem( QPopupMenu* parent, SimpleTypeImpl::MemberInfo d , QString prefix ) { + Q_UNUSED(prefix); + + QString memType = d.memberTypeToString(); + + if ( d.memberType == SimpleTypeImpl::MemberInfo::Typedef && d.type->fullName() == "const int" ) + memType = "enum"; + + QString txt = i18n( "Jump to %1 %2" ).arg( memType ).arg( cleanForMenu( d.name ) ); + int id = parent->insertItem( txt, receiver, SLOT( popupAction( int ) ) ); + + receiver->m_popupActions.insert( id, d.decl ); + } + + void insertItem ( QPopupMenu* parent, TypeDesc d , QString prefix ) { + Debug dbg( "#insert# ", 10 ); + + QString txt1, txt2; + + if ( d.resolved() && d.resolved() ->isNamespace() ) { + SimpleTypeCachedNamespace * ns = dynamic_cast( d.resolved().data() ); + if ( ns ) { + SimpleTypeNamespace::SlaveList slaves = ns->getSlaves( receiver->getIncludeFiles() ); + for ( SimpleTypeNamespace::SlaveList::iterator it = slaves.begin(); it != slaves.end(); ++it ) { + SimpleTypeCodeModel* cm = dynamic_cast( ( *it ).first.first.resolved().data() ); + if ( cm && cm->item() ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + QString scope = cm->scope().join("::"); + QMap< QString, QPopupMenu* >::iterator it = m_namespacePopupCache.find( scope ); + if( it != m_namespacePopupCache.end() ) { + parent->insertItem( "Imported Namespace " + scope, *it ); + delete m; + } else { + parent->insertItem( "Imported Namespace " + scope, m ); + + insertItem( m, ( new SimpleTypeCachedCodeModel( cm->item() ) ) ->desc(), prefix ); + m_namespacePopupCache.insert( scope, m ); + } + } else { + SimpleTypeNamespace* cn = dynamic_cast( ( *it ).first.first.resolved().data() ); + if( cn ) { + TypePointer t = new SimpleTypeNamespace( cn ); //To avoid endless recursion, this needs to be done(the dynamic-cast above fails) + insertItem( parent, t->desc(), prefix ); + } + } + } + return ; + } + } + + if ( d.resolved() && receiver->cppSupport() ->codeCompletionConfig() ->showNamespaceAppearances() ) { + if ( SimpleTypeCachedCodeModel * item = dynamic_cast( d.resolved().data() ) ) { ///(1) + if ( item->item() && item->item() ->isNamespace() ) { + NamespaceModel* ns = dynamic_cast( item->item().data() ); + QStringList wholeScope = ns->scope(); + wholeScope << ns->name(); + for( FileList::iterator it = files.begin(); it != files.end(); ++it ) { + // if( !safetyCounter ) break; + NamespaceModel* ns = (*it).data(); + + for( QStringList::iterator it2 = wholeScope.begin(); it2 != wholeScope.end(); ++it2 ) { + if( ns->hasNamespace( (*it2) ) ) { + ns = ns->namespaceByName( *it2 ); + if( !ns ) break; + } else { + ns = 0; + break; + } + } + + if( ns ) { + ItemDom i(ns); + int sLine, sCol, eLine, eCol; + i->getStartPosition( &sLine, &sCol ); + i->getEndPosition( &eLine, &eCol ); + insertItem( parent, (new SimpleTypeCodeModel( i ))->desc(), prefix + " " + (*it)->name() + QString(" (%1 Lines): ").arg( eLine - sLine ) ); ///SimpleTypeCodeModel is used instead of SimpleTypeCachedNodeModel, so the detection at (1) does not trigger, this avoids endless recursion. + } + + } + return; + } + } + } + + if ( d.resolved() ) { + if ( d.resolved() ->asFunction() ) { + txt1 = prefix + i18n( "Jump to declaration of %1(...)" ).arg( d.resolved() ->scope().join( "::" ) ); + txt2 = prefix + i18n( "Jump to definition of %1(...)" ).arg( d.resolved() ->scope().join( "::" ) ); + } else { + txt1 = prefix + i18n( "Jump to %1" ).arg( cleanForMenu( d.resolved() ->scope().join( "::" ) ) ); + } + } else { + if( !BuiltinTypes::isBuiltin( d ) ) { + txt1 = prefix + d.name() + i18n( " is unresolved" ); + } else { + txt1 = prefix + d.name() + i18n( " (builtin " ) + BuiltinTypes::comment( d ) + ")"; + } + } + + int id = parent->insertItem( txt1, receiver, SLOT( popupAction( int ) ) ); + if ( d.resolved() ) + receiver->m_popupActions.insert( id, d.resolved() ->getDeclarationInfo() ); + + if ( !txt2.isEmpty() ) { + int id2 = parent->insertItem( txt2, receiver, SLOT( popupDefinitionAction( int ) ) ); + if ( d.resolved() ) + receiver->m_popupDefinitionActions.insert( id2, d.resolved() ->getDeclarationInfo() ); + } + } +}; + +ItemDom itemFromScope( const QStringList& scope, NamespaceDom startNamespace ) { + if ( scope.isEmpty() ) + return ItemDom(); + + NamespaceDom glob = startNamespace; + if ( !glob ) + return ItemDom(); + + ClassModel* curr = glob ; + + QStringList::const_iterator mit = scope.begin(); + + while ( curr->isNamespace() && mit != scope.end() && ( ( NamespaceModel* ) curr ) ->hasNamespace( *mit ) ) { + curr = &( *( ( ( NamespaceModel* ) curr ) ->namespaceByName( *mit ) ) ); + ++mit; + } + + while ( ( curr->isNamespace() || curr->isClass() ) && mit != scope.end() && curr->hasClass( *mit ) ) { + ClassList cl = curr->classByName( *mit ); + curr = &( **cl.begin() ); + ++mit; + } + + if ( mit != --scope.end() ) + return ItemDom(); + + TypeAliasList l = curr->typeAliasByName( *mit ); + if ( !l.isEmpty() ) + return model_cast( l.front() ); + + VariableDom v = curr->variableByName( *mit ); + if ( v ) + return model_cast( v ); + + ClassList c = curr->classByName( *mit ); + if ( !c.isEmpty() ) + return model_cast( c.front() ); + + EnumDom en = curr->enumByName( *mit ); + if ( en ) + return model_cast( en ); + + FunctionList f = curr->functionByName( *mit ); + if ( !f.isEmpty() ) + return model_cast( f.front() ); + + FunctionDefinitionList fd = curr->functionDefinitionByName( *mit ); + if ( !fd.isEmpty() ) + return model_cast( fd.front() ); + + return ItemDom(); +} + +struct PopupClassViewFillerHelpStruct { + CppCodeCompletion* receiver; + CppCodeCompletion::PopupActions& m_popupActions; + PopupClassViewFillerHelpStruct( CppCodeCompletion* rec ) : m_popupActions( rec->m_popupActions ) { + receiver = rec; + } + + bool shouldShowIncludeMenu() const { + return false; + } + + void insertItem( QPopupMenu* parent, SimpleTypeImpl::MemberInfo d , QString prefix ) { + Q_UNUSED(prefix); + FileDom f = receiver->m_pSupport->codeModel() ->fileByName( d.decl.file ); + if ( !f ) + return ; + + ItemDom dom = itemFromScope( QStringList::split( "::", d.name ), model_cast( f ) ); + + QString memType = d.memberTypeToString(); + + if ( d.memberType == SimpleTypeImpl::MemberInfo::Typedef && d.type->fullName() == "const int" ) + memType = "enum"; + + QString txt = i18n( "Show %1 %2" ).arg( memType ).arg( cleanForMenu( d.name ) ); + int id = parent->insertItem( txt, receiver, SLOT( popupClassViewAction( int ) ) ); + + receiver->m_popupClassViewActions.insert( id, dom ); + } + + void insertItem ( QPopupMenu* parent, TypeDesc d , QString prefix ) { + Debug dbg( "#insert# ", 10 ); + + QString txt; + if ( !d.resolved() ) + return ; + + ItemDom dom; + + if ( d.resolved() ) { + SimpleTypeCodeModel * cm = dynamic_cast( d.resolved().data() ); + if ( cm ) + dom = cm->item(); + } + + if ( d.resolved() ) { + if ( !dom && d.resolved() ->isNamespace() ) { + SimpleTypeCachedNamespace * ns = dynamic_cast( d.resolved().data() ); + if ( ns ) { + SimpleTypeNamespace::SlaveList slaves = ns->getSlaves( receiver->getIncludeFiles() ); + for ( SimpleTypeNamespace::SlaveList::iterator it = slaves.begin(); it != slaves.end(); ++it ) { + SimpleTypeCodeModel* cm = dynamic_cast( ( *it ).first.first.resolved().data() ); + if ( cm && cm->item() ) { + insertItem( parent, ( new SimpleTypeCachedCodeModel( cm->item() ) ) ->desc(), prefix ); + } else { + SimpleTypeNamespace* cn = dynamic_cast( ( *it ).first.first.resolved().data() ); + if( cn ) { + TypePointer t = new SimpleTypeNamespace( cn ); //to avoid endless recursion (caching would be better) + insertItem( parent, t->desc(), prefix ); + } + } + } + return ; + } + } else { + if ( dom ) { + QString n = d.resolved() ->scope().join( "::" ); + //QString n = d.fullNameChain(); + if ( d.resolved() ->asFunction() ) { + n = buildSignature( d.resolved() ); + } + txt = prefix + i18n( "Show %1" ).arg( cleanForMenu( n ) ); + } else { + txt = prefix + d.name() + " not in code-model"; + } + } + } else { + if( !BuiltinTypes::isBuiltin( d ) ) { + txt = prefix + d.name() + i18n( " is unresolved" ); + } else { + txt = prefix + d.name() + i18n( " (builtin " ) + BuiltinTypes::comment( d ) + ")"; + } + } + + int id = parent->insertItem( txt, receiver, SLOT( popupClassViewAction( int ) ) ); + + if ( dom ) + receiver->m_popupClassViewActions.insert( id, dom ); + } +}; + +template +class PopupFiller { + HelpStruct struk; + QString depthAdd; + SafetyCounter s; + public: + PopupFiller( HelpStruct str , QString dAdd, int maxCount = 100 ) : struk( str ), depthAdd( dAdd ), s( maxCount ) {} + + + void fillIncludes( const DeclarationInfo& decl, QPopupMenu* parent, bool& needSeparator ) { + if( !struk.receiver->getIncludeFiles()[ HashedString( decl.file ) ] ) { + QString file = decl.file; + //The include-file seems to be missing + if( needSeparator ) { + needSeparator = false; + parent->insertSeparator(); + } + + QString includeFile = file; + QFileInfo info( file ); + + Driver* driver = struk.receiver->cppSupport()->driver(); + if( driver ) { + QStringList elements = QStringList::split( "/", file ); + includeFile = elements.back(); + elements.pop_back(); + + Dependence d; + d.first = includeFile; + d.second = Dep_Local; + while( driver->findIncludeFile( d, struk.receiver->activeFileName() ) != file && !elements.empty() ) { + //kdDebug( 9007 ) << "could not find include-file \"" << d.first << "\"" << endl; + includeFile = elements.back() + "/" + includeFile; + d.first = includeFile; + elements.pop_back(); + } + if( elements.empty() ) + includeFile = "/" + includeFile; + + //kdDebug( 9007 ) << "found include-file \"" << includeFile << "\"" << endl; + } + int id = parent->insertItem( i18n( "#include \"%1\" ( defines %2 )" ).arg ( includeFile ).arg( decl.name ), struk.receiver, SLOT( popupAction( int ) ) ); + DeclarationInfo fakeDec; + fakeDec.name = decl.name; + fakeDec.file = includeFile; + fakeDec.startLine = -1; //Use startline -1 to indicate that instead of jumping to the file, the file should be included. + struk.m_popupActions.insert( id, fakeDec ); + } + } + + void fill( QPopupMenu * parent, LocateResult d, QString prefix = "", const DeclarationInfo & sourceVariable = DeclarationInfo() ) { + Debug dbg( "#fl# ", 10 ) + ; + + + if ( !s || !dbg ) { + //dbgMajor() << "safety-counter triggered while filling \"" << d.fullNameChain() << "\"" << endl; + return ; + } + + if ( !sourceVariable.name.isEmpty() && sourceVariable.name != "this" ) { + SimpleTypeImpl::MemberInfo f; + f.decl = sourceVariable; + f.name = sourceVariable.name; + f.type = d.desc(); + f.memberType = SimpleTypeImpl::MemberInfo::Variable; + + /*int id = m->insertItem( i18n("jump to variable-declaration \"%1\"").arg( type.sourceVariable.name ) , this, SLOT( popupAction( int ) ) ); + + m_popupActions.insert( id, type.sourceVariable );*/ + struk.insertItem( parent, f, prefix ); + + parent->insertSeparator(); + + if ( !sourceVariable.comment.isEmpty() ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Comment on %1" ).arg( sourceVariable.name ), m ); + QStringList ls = prepareTextForMenu( sourceVariable.comment, 15, 100 ); + for ( QStringList::iterator it = ls.begin(); it != ls.end(); ++it ) { + m->insertItem( *it, 0, SLOT( popupClassViewAction( int ) ) ); + } + parent->insertSeparator(); + } + } + + struk.insertItem( parent, d, prefix ); + + if( d->resolved() && !d->resolved()->specialization().isEmpty() ) { + SimpleType p = d->resolved()->parent(); + LocateResult r = p->locateDecType( d->name() ); + if( r ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Specialized from \"%1\"" ).arg( cleanForMenu( r->fullNameChain() ) ), m ); + fill( m, r ); + } + } + + TypeDesc::TemplateParams p = d->templateParams(); + for ( TypeDesc::TemplateParams::iterator it = p.begin(); it != p.end(); ++it ) { + //if( (*it)->resolved() ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Template-param \"%1\"" ).arg( cleanForMenu( ( *it ) ->fullNameChain() ) ), m ); + fill( m, **it ); + /*} else { + fill( parent, **it, prefix + depthAdd ); + }*/ + } + + if ( d->resolved() ) { + if ( d->resolved() ->asFunction() ) { + LocateResult rt = d->resolved() ->locateDecType( d->resolved() ->asFunction() ->getReturnType() ); + if ( rt ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Return-type \"%1\"" ).arg( cleanForMenu( rt->fullNameChain() ) ), m ); + fill( m, rt ); + } + + QValueList args = d->resolved() ->asFunction() ->getArgumentTypes(); + QStringList argNames = d->resolved() ->asFunction() ->getArgumentNames(); + if ( !args.isEmpty() ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Argument-types" ), m ); + QStringList::iterator it2 = argNames.begin(); + for ( QValueList::iterator it = args.begin(); it != args.end(); ++it ) { + LocateResult at = d->resolved() ->locateDecType( *it ); + QString name = ""; + if ( it2 != argNames.end() ) { + name = *it2; + ++it2; + } + QPopupMenu * mo = PopupTracker::createPopup( m ); + m->insertItem( i18n( "Argument \"%1\"" ).arg( cleanForMenu( at->fullNameChain() + " " + name ) ), mo ); + fill( mo, at ); + + } + } + } + } +#ifndef DISABLE_TRACING + if ( d.trace() ) { + QValueList > trace = d.trace() ->trace(); + if ( !trace.isEmpty() ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Trace" ), m ); + + for ( QValueList >::iterator it = trace.begin(); it != trace.end(); ++it ) { + QPopupMenu * mo = PopupTracker::createPopup( m ); + QString tail = ( *it ).second.fullNameChain(); + if ( !tail.isEmpty() ) + tail = "::" + tail; + m->insertItem( i18n( "%1 -> %2" ).arg( cleanForMenu( ( *it ).first.name + tail ) ).arg( cleanForMenu( ( *it ).first.type->fullNameChain() + tail ) ), mo ); + + struk.insertItem( mo, ( *it ).first, prefix ); + + if ( !( *it ).first.decl.comment.isEmpty() ) { + mo->insertSeparator(); + QPopupMenu * m = PopupTracker::createPopup( mo ); + mo->insertItem( i18n( "Comment" ), m ); + QStringList ls = prepareTextForMenu( ( *it ).first.decl.comment, 15, 100 ); + for ( QStringList::iterator it = ls.begin(); it != ls.end(); ++it ) { + m->insertItem( *it, 0, SLOT( popupClassViewAction( int ) ) ); + } + } + + /*bool needSeparator = true; + if( struk.shouldShowIncludeMenu() && struk.receiver->cppSupport()->codeCompletionConfig()->preProcessAllHeaders() && !(*it).first.decl.file.operator QString().isEmpty() ) + fillIncludes( (*it).first.decl, mo, needSeparator );*/ + } + } + } +#endif + + if ( d->resolved() ) { + QValueList bases = d->resolved() ->getBases(); + for ( QValueList::iterator it = bases.begin(); it != bases.end(); ++it ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Base-class \"%1\"" ).arg( cleanForMenu( ( *it ) ->fullNameChain() ) ), m ); + fill( m, *it ); + } + + if ( d->resolved() ->parent() && d->resolved() ->parent() ->desc() ) { + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Nested in \"%1\"" ).arg( cleanForMenu( d->resolved() ->parent() ->fullTypeResolved() ) ), m ); + fill( m, d->resolved() ->parent() ->desc() ); + } + + if ( !d->resolved() ->comment().isEmpty() ) { + parent->insertSeparator(); + QPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Comment on %1" ).arg( cleanForMenu( d->name() ) ), m ); + QStringList ls = prepareTextForMenu( d->resolved() ->comment(), 15, 100 ); + for ( QStringList::iterator it = ls.begin(); it != ls.end(); ++it ) { + m->insertItem( *it, 0, SLOT( popupClassViewAction( int ) ) ); + } + } + } + + //Add entries for including missing include-files + if( struk.shouldShowIncludeMenu() && struk.receiver->cppSupport()->codeCompletionConfig()->preProcessAllHeaders() ) { + bool needSeparator = true; + //Show the include-files for the whole trace, because usually the first in the trace should be the one to include + if ( d.trace() ) { + QValueList > trace = d.trace() ->trace(); + if ( !trace.isEmpty() ) { + for ( QValueList >::iterator it = trace.begin(); it != trace.end(); ++it ) { + if( struk.shouldShowIncludeMenu() && struk.receiver->cppSupport()->codeCompletionConfig()->preProcessAllHeaders() && !(*it).first.decl.file.operator QString().isEmpty() ) + fillIncludes( (*it).first.decl, parent, needSeparator ); + } + } + } + + //Show the include-file for the item itself + if( d->resolved() && !d->resolved()->isNamespace() && struk.receiver->cppSupport() ) { + fillIncludes( d->resolved()->getDeclarationInfo(), parent, needSeparator ); + } + } + } +}; + +struct CompTypeProcessor : public TypeProcessor { + SimpleType m_scope; + bool m_processArguments; + + CompTypeProcessor( SimpleType scope, bool processArguments ) : m_scope( scope ), m_processArguments( processArguments ) {} + + virtual QString parentType() { + return m_scope->fullType(); + } + + virtual QString processType( const QString& type ) { + if ( !m_processArguments ) + return type; + LocateResult t = m_scope->locateDecType( type ); + if ( t ) + return t->fullNameChain(); + else + return type; + } +}; + +struct CppCodeCompletionData { + QPtrList recoveryPoints; + //QStringList classNameList; + + CppCodeCompletionData() { + recoveryPoints.setAutoDelete( true ); + } + + RecoveryPoint* findRecoveryPoint( int line, int column ) { + if ( recoveryPoints.count() == 0 ) + return 0; + + QPair pt = qMakePair( line, column ); + + QPtrListIterator it( recoveryPoints ); + RecoveryPoint* recPt = 0; + + while ( it.current() ) { + QPair startPt = qMakePair( it.current() ->startLine, it.current() ->startColumn ); + QPair endPt = qMakePair( it.current() ->endLine, it.current() ->endColumn ); + + if ( pt < startPt ) { + break; + } + + if ( startPt < pt && pt < endPt ) + recPt = it.current(); + + ++it; + } + + return recPt; + } + +}; + +CppCodeCompletion::CppCodeCompletion( CppSupportPart* part ) + : d( new CppCodeCompletionData ), + //Matches on includes + m_includeRx( "^\\s*#\\s*include\\s+[\"<]" ), + //Matches on C++ and C style comments as well as literal strings + m_cppCodeCommentsRx( "(//([^\n]*)(\n|$)|/\\*.*\\*/|\"([^\\\\]|\\\\.)*\")" ), + //Matches on alpha chars and '.' + m_codeCompleteChRx( "([A-Z])|([a-z])|(\\.)" ), + //Matches on "->" and "::" +m_codeCompleteCh2Rx( "(->)|(\\:\\:)" ) { + m_instance = this; + cppCompletionInstance = this; + m_cppCodeCommentsRx.setMinimal( true ); + + m_pSupport = part; + + connect( m_pSupport->codeCompletionConfig(), SIGNAL( stored() ), this, SLOT( emptyCache() ) ); + + m_activeCursor = 0; + m_activeEditor = 0; + m_activeCompletion = 0; + m_activeHintInterface = 0; + m_activeView = 0; + m_ccTimer = new QTimer( this ); + m_showStatusTextTimer = new QTimer( this ); + + m_ccLine = 0; + m_ccColumn = 0; + connect( m_ccTimer, SIGNAL( timeout() ), this, SLOT( slotTimeout() ) ); + connect( m_showStatusTextTimer, SIGNAL( timeout() ), this, SLOT( slotStatusTextTimeout() ) ); + + computeFileEntryList(); + + CppSupportPart* cppSupport = m_pSupport; + connect( cppSupport->project(), SIGNAL( addedFilesToProject( const QStringList& ) ), + this, SLOT( computeFileEntryList() ) ); + connect( cppSupport->project(), SIGNAL( removedFilesFromProject( const QStringList& ) ), + this, SLOT( computeFileEntryList() ) ); + connect( cppSupport, SIGNAL( synchronousParseReady( const QString&, ParsedFilePointer ) ), this, SLOT( synchronousParseReady( const QString&, ParsedFilePointer ) ) ); + + m_bArgHintShow = false; + m_bCompletionBoxShow = false; + m_blockForKeyword = false; + m_demandCompletion = false; + m_completionMode = NormalCompletion; + + m_repository = new CodeInformationRepository( cppSupport->codeRepository() ); + + connect( cppSupport->codeRepository(), SIGNAL(catalogRegistered( Catalog* )), this, SLOT( emptyCache() ) ); + connect( cppSupport->codeRepository(), SIGNAL(catalogUnregistered( Catalog* )), this, SLOT( emptyCache() ) ); + connect( cppSupport->codeRepository(), SIGNAL(catalogChanged( Catalog* )), this, SLOT( emptyCache() ) ); + + setupCodeInformationRepository(); + + if ( part->partController() ->parts() ) { + QPtrListIterator it( *part->partController() ->parts() ); + while ( KParts::Part * part = it.current() ) { + integratePart( part ); + ++it; + } + } + + if ( part->partController() ->activePart() ) + slotActivePartChanged( part->partController() ->activePart() ); + + connect( part->partController( ), SIGNAL( partAdded( KParts::Part* ) ), + this, SLOT( slotPartAdded( KParts::Part* ) ) ); + connect( part->partController( ), SIGNAL( activePartChanged( KParts::Part* ) ), + this, SLOT( slotActivePartChanged( KParts::Part* ) ) ); + + connect( part, SIGNAL( fileParsed( const QString& ) ), + this, SLOT( slotFileParsed( const QString& ) ) ); + connect( part, SIGNAL( codeModelUpdated( const QString& ) ), + this, SLOT( slotCodeModelUpdated( const QString& ) ) ); + + KAction * action = new KAction( i18n("Jump to declaration under cursor"), 0, CTRL + Key_Comma, + this, SLOT(slotJumpToDeclCursorContext()), part->actionCollection(), "jump_to_declaration_cursor_context" ); + action->plug( &m_DummyActionWidget ); + + action = new KAction( i18n("Jump to definition under cursor"), 0, CTRL + Key_Period, + this, SLOT(slotJumpToDefCursorContext()), part->actionCollection(), "jump_to_defintion_cursor_context" ); + action->plug( &m_DummyActionWidget ); +} + +CppCodeCompletion::~CppCodeCompletion( ) { + delete m_repository; + delete d; +} + +void CppCodeCompletion::addStatusText( QString text, int timeout ) { + m_statusTextList.append( QPair( timeout, text ) ); + if ( !m_showStatusTextTimer->isActive() ) { + slotStatusTextTimeout(); + } +} + +void CppCodeCompletion::clearStatusText() { + m_statusTextList.clear(); + m_showStatusTextTimer->stop(); +} + +void CppCodeCompletion::slotStatusTextTimeout() { + if ( m_statusTextList.isEmpty() || !m_pSupport ) + return ; +// m_pSupport->mainWindow() ->statusBar() ->message( m_statusTextList.front().second, m_statusTextList.front().first ); + m_showStatusTextTimer->start( m_statusTextList.front().first , true ); + m_statusTextList.pop_front(); +} + +void CppCodeCompletion::slotTimeout() { + if ( !m_activeCursor || !m_activeEditor || !m_activeCompletion ) + return ; + + uint nLine, nCol; + m_activeCursor->cursorPositionReal( &nLine, &nCol ); + + if ( nLine != m_ccLine || nCol != m_ccColumn ) + return ; + + QString textLine = m_activeEditor->textLine( nLine ); + QChar ch = textLine[ nCol ]; + if ( ch.isLetterOrNumber() || ch == '_' ) + return ; + + completeText(); +} + +void CppCodeCompletion::slotArgHintHidden() { + //kdDebug(9007) << "CppCodeCompletion::slotArgHintHidden()" << endl; + m_bArgHintShow = false; +} + +void CppCodeCompletion::slotCompletionBoxHidden() { + //kdDebug( 9007 ) << "CppCodeCompletion::slotCompletionBoxHidden()" << endl; + m_bCompletionBoxShow = false; +} + + +void CppCodeCompletion::integratePart( KParts::Part * part ) { + if ( !part || !part->widget() ) + return ; + + KTextEditor::Document* doc = dynamic_cast( part ); + if ( doc ) { + kdDebug( 9007 ) << k_funcinfo << "integrate document: " << doc << endl; + + if ( m_pSupport ) { //The slot should connected even when automatic completion is disabled, so it can be enabled any time + kdDebug( 9007 ) << k_funcinfo << "enabling code completion" << endl; + connect( part, SIGNAL( textChanged() ), this, SLOT( slotTextChanged() ) ); + connect( part->widget(), SIGNAL( completionDone() ), this, + SLOT( slotCompletionBoxHidden() ) ); + connect( part->widget(), SIGNAL( completionAborted() ), this, + SLOT( slotCompletionBoxHidden() ) ); + connect( part->widget(), SIGNAL( argHintHidden() ), this, + SLOT( slotArgHintHidden() ) ); + } + } +} + +void CppCodeCompletion::slotPartAdded( KParts::Part * part ) { + integratePart( part ); +} + +void CppCodeCompletion::slotActivePartChanged( KParts::Part * part ) { + emptyCache(); + this->d->recoveryPoints.clear(); + if ( m_activeHintInterface && m_activeView ) { + disconnect( m_activeView , SIGNAL( needTextHint( int, int, QString & ) ), this, SLOT( slotTextHint( int, int, QString& ) ) ); + + m_activeHintInterface = 0; + } + if ( !part ) + return ; + + kdDebug( 9007 ) << k_funcinfo << endl; + + m_activeFileName = QString::null; + + KTextEditor::Document* doc = dynamic_cast( part ); + if ( !doc ) + return ; + + m_activeFileName = doc->url().path(); + + // if the interface stuff fails we should disable codecompletion automatically + m_activeEditor = dynamic_cast( part ); + if ( !m_activeEditor ) { + kdDebug( 9007 ) << "Editor doesn't support the EditDocumentIface" << endl; + return ; + } + + m_activeCursor = dynamic_cast( part->widget() ); + if ( !m_activeCursor ) { + kdDebug( 9007 ) << "The editor doesn't support the CursorDocumentIface!" << endl; + return ; + } + + m_activeCompletion = dynamic_cast( part->widget() ); + if ( !m_activeCompletion ) { + kdDebug( 9007 ) << "Editor doesn't support the CompletionIface" << endl; + return ; + } + + m_activeView = part ? dynamic_cast( part->widget() ) : 0; + + if ( m_activeView ) + m_activeHintInterface = dynamic_cast( m_activeView ); + + char* q = 0; + kdDebug() << q << endl; + + if ( m_activeHintInterface ) { +#ifndef DISABLETOOLTIPS + m_activeHintInterface->enableTextHints( 500 ); + connect( m_activeView, SIGNAL( needTextHint( int, int, QString & ) ), this, SLOT( slotTextHint( int, int, QString& ) ) ); +#endif + + } else { + kdDebug( 9007 ) << "editor has no text-hint-interface" << endl; + } + + kdDebug( 9007 ) << k_funcinfo << "-- end" << endl; +} + +void CppCodeCompletion::slotTextChanged() { + m_ccTimer->stop(); + + if ( !m_activeCursor ) + return ; + + unsigned int nLine, nCol; + m_activeCursor->cursorPositionReal( &nLine, &nCol ); + + QString strCurLine = m_activeEditor->textLine( nLine ); + QString ch = strCurLine.mid( nCol - 1, 1 ); + QString ch2 = strCurLine.mid( nCol - 2, 2 ); + + // Tell the completion box to _go_away_ when the completion char + // becomes empty or whitespace and the box is already showing. + // !!WARNING!! This is very hackish, but KTE doesn't offer a way + // to tell the completion box to _go_away_ + if ( ch.simplifyWhiteSpace().isEmpty() && + !strCurLine.simplifyWhiteSpace().contains( "virtual" ) && + m_bCompletionBoxShow ) { + QValueList entryList; + m_bCompletionBoxShow = true; + m_activeCompletion->showCompletionBox( entryList, 0 ); + } + + m_ccLine = 0; + m_ccColumn = 0; + + bool argsHint = m_pSupport->codeCompletionConfig() ->automaticArgumentsHint(); + bool codeComplete = m_pSupport->codeCompletionConfig() ->automaticCodeCompletion(); + bool headComplete = codeComplete; //m_pSupport->codeCompletionConfig() ->automaticHeaderCompletion(); + + // m_codeCompleteChRx completes on alpha chars and '.' + // m_codeCompleteCh2Rx completes on "->" and "::" + + if ( ( argsHint && ch == "(" ) || + ( codeComplete && strCurLine.simplifyWhiteSpace().contains( "virtual" ) ) || + ( codeComplete && ( m_codeCompleteChRx.search( ch ) != -1 || + m_codeCompleteCh2Rx.search( ch2 ) != -1 ) ) || + ( headComplete && ( ch == "\"" || ch == "<" ) && m_includeRx.search( strCurLine ) != -1 ) ) { + int time; + m_ccLine = nLine; + m_ccColumn = nCol; + if ( ch == "(" ) + time = m_pSupport->codeCompletionConfig() ->argumentsHintDelay(); + else + time = m_pSupport->codeCompletionConfig() ->codeCompletionDelay(); + m_ccTimer->start( time, true ); + } + + fitContextItem( nLine, nCol ); +} + +void CppCodeCompletion::fitContextItem( int nLine, int nCol ) { + if( !SimpleType::globalNamespace() ) { + kdDebug( 9007 ) << "no global namespace was set, clearing cache" << endl; + emptyCache(); + } + ///Find out whether the cache may be used on, or has to be cleared. + if ( m_cachedFromContext ) { + int sLine, sCol, eLine, eCol; + m_cachedFromContext->getStartPosition( &sLine, &sCol ); + m_cachedFromContext->getEndPosition( &eLine, &eCol ); + + if ( ( nLine < sLine || ( nLine == sLine && nCol < sCol ) ) || ( nLine > eLine || ( nLine == eLine && nCol >= eCol ) ) ) { + ///The stored item was left. First check whether the item was expanded. + FileDom file = m_pSupport->codeModel() ->fileByName( m_activeFileName ); + + if ( file ) { + CodeModelUtils::CodeModelHelper fileModel( m_pSupport->codeModel(), file ); + if ( m_cachedFromContext->isClass() ) { + ClassDom klass = fileModel.classAt( nLine, nCol ); + if ( klass ) { + ClassDom oldClass = dynamic_cast( m_cachedFromContext.data() ); + if ( oldClass && oldClass->name() == klass->name() && oldClass->scope() == klass->scope() ) { + m_cachedFromContext = klass.data(); + } else { + emptyCache(); + } + } else { + emptyCache(); + } + } else if ( m_cachedFromContext->isFunction() ) { + FunctionDom function = fileModel.functionAt( nLine, nCol ); + if ( function ) { + FunctionDom oldFunction = dynamic_cast( m_cachedFromContext.data() ); + if ( oldFunction && oldFunction->name() == function->name() && function->scope() == oldFunction->scope() && oldFunction->argumentList().count() == function->argumentList().count() ) { + ArgumentList l1 = oldFunction->argumentList(); + ArgumentList l2 = function->argumentList(); + ArgumentList::iterator it = l1.begin(); + ArgumentList::iterator it2 = l2.begin(); + bool match = true; + while ( it != l1.end() ) { + if ( ( *it ) ->type() != ( *it2 ) ->type() ) { + match = false; + break; + } + ++it; + ++it2; + } + if ( match ) { + m_cachedFromContext = function.data(); + } else { + emptyCache(); + } + + } else { + emptyCache(); + } + } else { + emptyCache(); + } + } else { + emptyCache(); + } + } else { + emptyCache(); + } + } + } +} + +enum { T_ACCESS, T_PAREN, T_BRACKET, T_IDE, T_UNKNOWN, T_TEMP }; + +QString CppCodeCompletion::replaceCppComments( const QString& contents ) { + QString text = contents; + + int pos = 0; + while ( ( pos = m_cppCodeCommentsRx.search( text, pos ) ) != -1 ) { + if ( m_cppCodeCommentsRx.cap( 1 ).startsWith( "//" ) ) { + QString before = m_cppCodeCommentsRx.cap( 1 ); + QString after; + after.fill( ' ', before.length() - 5 ); + after.prepend( "/*" ); + after.append( "*/" ); + text.replace( pos, before.length() - 1, after ); + pos += after.length(); + } else { + pos += m_cppCodeCommentsRx.matchedLength(); + } + } + return text; +} + +int CppCodeCompletion::expressionAt( const QString& contents, int index ) { + kdDebug( 9007 ) << k_funcinfo << endl; + + /* C++ style comments present issues with finding the expr so I'm + matching for them and replacing them with empty C style comments + of the same length for purposes of finding the expr. */ + + QString text = clearComments( contents ); + + int last = T_UNKNOWN; + int start = index; + --index; + + while ( index > 0 ) { + while ( index > 0 && text[ index ].isSpace() ) { + --index; + } + + QChar ch = text[ index ]; + QString ch2 = text.mid( index - 1, 2 ); + if ( ( last != T_IDE ) && ( ch.isLetterOrNumber() || ch == '_' ) ) { + while ( index > 0 && ( text[ index ].isLetterOrNumber() || text[ index ] == '_' ) ) { + --index; + } + last = T_IDE; + } else if ( last != T_IDE && ch == ')' ) { + int count = 0; + while ( index > 0 ) { + QChar ch = text[ index ]; + if ( ch == '(' ) { + ++count; + } else if ( ch == ')' ) { + --count; + } else if ( count == 0 ) { + //index; + last = T_PAREN; + break; + } + --index; + } + } else if ( last != T_IDE && ch == '>' && ch2 != "->" ) { + int count = 0; + while ( index > 0 ) { + QChar ch = text[ index ]; + if ( ch == '<' ) { + ++count; + } else if ( ch == '>' ) { + --count; + } else if ( count == 0 ) { + //--index; + last = T_TEMP; + break; + } + --index; + } + } else if ( ch == ']' ) { + int count = 0; + while ( index > 0 ) { + QChar ch = text[ index ]; + if ( ch == '[' ) { + ++count; + } else if ( ch == ']' ) { + --count; + } else if ( count == 0 ) { + //--index; + last = T_BRACKET; + break; + } + --index; + } + } else if ( ch == '.' ) { + --index; + last = T_ACCESS; + } else if ( ch2 == "::" ) { + index -= 2; + last = T_ACCESS; + } else if ( ch2 == "->" ) { + index -= 2; + last = T_ACCESS; + } else { + if ( start > index ) { + ++index; + } + last = T_UNKNOWN; + break; + } + } + + ///If we're at the first item, the above algorithm cannot be used safely, + ///so just determine whether the sign is valid for the beginning of an expression, if it isn't reject it. + if ( index == 0 && start > index && !( text[ index ].isLetterOrNumber() || text[ index ] == '_' || text[ index ] == ':' ) ) { + ++index; + } + + return index; +} + +QStringList CppCodeCompletion::splitExpression( const QString& text ) { +#define ADD_CURRENT()\ + if( current.length() ) { l << current; /*kdDebug(9007) << "add word " << current << endl;*/ current = ""; } + + QStringList l; + uint index = 0; + QString current; + while ( index < text.length() ) { + QChar ch = text[ index ]; + QString ch2 = text.mid( index, 2 ); + + if ( ch == '.' ) { + current += ch; + ADD_CURRENT(); + ++index; + } else if ( ch == '(' ) { + int count = 0; + while ( index < text.length() ) { + QChar ch = text[ index ]; + if ( ch == '(' ) { + ++count; + } else if ( ch == ')' ) { + --count; + } else if ( count == 0 ) { + break; + } + current += ch; + ++index; + } + } else if ( ch == '[' ) { + int count = 0; + while ( index < text.length() ) { + QChar ch = text[ index ]; + if ( ch == '[' ) { + ++count; + } else if ( ch == ']' ) { + --count; + } else if ( count == 0 ) { + break; + } + current += ch; + ++index; + } + } else if ( ch2 == "->" ) { + current += ch2; + ADD_CURRENT(); + index += 2; + } /*else if ( ch2 == "::" ) + { + current += ch2; + ADD_CURRENT(); + index += 2; + }*/ + else { + current += text[ index ]; + ++index; + } + } + ADD_CURRENT(); + return l; +} + +///Before calling this, a SimpleTypeConfiguration-object should be created, so that the ressources will be freed when that object is destroyed +EvaluationResult CppCodeCompletion::evaluateExpressionAt( int line, int column , SimpleTypeConfiguration& conf, bool ifUnknownSetType ) { + kdDebug( 9007 ) << "CppCodeCompletion::evaluateExpressionAt( " << line << ", " << column << " )" << endl; + + if ( !m_pSupport || !m_activeEditor ) + return EvaluationResult(); + if ( line < 0 || line >= ( int ) m_activeEditor->numLines() ) + return EvaluationResult(); + if ( column < 0 || column >= m_activeEditor->lineLength( line ) ) + return EvaluationResult(); + + { + QString curLine = m_activeEditor->textLine( line ); + + ///move column to the last letter of the pointed word + while ( column + 1 < ( int ) curLine.length() && isValidIdentifierSign( curLine[ column ] ) && isValidIdentifierSign( curLine[ column + 1 ] ) ) + column++; + + //if( column > 0 ) column--; + + if ( column >= ( int ) curLine.length() || curLine[ column ].isSpace() ) + return EvaluationResult(); + + QString expr = curLine.left( column + 1 ); + kdDebug( 9007 ) << "evaluating line \"" << expr.stripWhiteSpace() << "\"" << endl; + + if ( curLine[ column ] == '-' || curLine[ column ] == ';' ) + --column; + + EvaluationResult type = evaluateExpressionType( line, column + 1, conf, ifUnknownSetType ? addFlag( DefaultEvaluationOptions, DefaultAsTypeExpression ) : DefaultEvaluationOptions ); + + kdDebug( 9007 ) << "type: " << type->fullNameChain() << endl; + + return type; + } +} + +void CppCodeCompletion::popupAction( int number ) { + PopupActions::iterator it = m_popupActions.find( number ); + if ( it != m_popupActions.end() ) { + QString fileName = ( *it ).file == "current_file" ? m_activeFileName : ( *it ).file.operator QString(); + if( (*it).startLine == -1 ) { + //startLine -1 indicates that the file should be added to the include-files + m_activeEditor->insertLine( 0, QString("#include \"%1\" /* defines %2 */").arg( fileName ).arg( (*it).name ) ); + } else { + m_pSupport->partController() ->editDocument( fileName, ( *it ).startLine ); + } + } else { + kdDebug( 9007 ) << "error" << endl; + } +} + +void CppCodeCompletion::popupDefinitionAction( int number ) { + PopupActions::iterator it = m_popupDefinitionActions.find( number ); + if ( it != m_popupDefinitionActions.end() ) { + QString fileName = ( *it ).file == "current_file" ? m_activeFileName : ( *it ).file.operator QString(); + if ( !m_pSupport->switchHeaderImpl( fileName, ( *it ).startLine, ( *it ).startCol ) ) + m_pSupport->partController() ->editDocument( fileName, ( *it ).startLine ); + } else { + kdDebug( 9007 ) << "error" << endl; + } +} + +void CppCodeCompletion::selectItem( ItemDom item ) { + Extensions::KDevCodeBrowserFrontend * f = m_pSupport->extension< Extensions::KDevCodeBrowserFrontend > ( "KDevelop/CodeBrowserFrontend" ); + + if ( f != 0 ) { + ItemDom itemDom( &( *item ) ); + f->jumpedToItem( itemDom ); + } else { + kdDebug() << "could not find the proper extension" << endl; + } +} + +void CppCodeCompletion::popupClassViewAction( int number ) { + PopupClassViewActions::iterator it = m_popupClassViewActions.find( number ); + if ( it != m_popupClassViewActions.end() ) { + if ( ( *it ) ) + selectItem( *it ); + } else { + kdDebug( 9007 ) << "error" << endl; + } +} + +void CppCodeCompletion::contextEvaluationMenus ( QPopupMenu *popup, const Context *context, int line, int column ) { + clearStatusText(); + Q_UNUSED(context); + if ( !m_pSupport->codeCompletionConfig() ->showEvaluationContextMenu() ) + return ; + + kdDebug( 9007 ) << "CppCodeCompletion::contextEvaluationMenu()" << endl; + + PopupTracker::print(); + + m_popupActions.clear(); + m_popupDefinitionActions.clear(); + m_popupClassViewActions.clear(); + + if ( !m_pSupport || !m_activeEditor ) + return ; + + struct SetDbgState { + DBGStreamType& st; + bool oldState; + SetDbgState( DBGStreamType& targ, bool state ) : st( targ ) { + oldState = targ.state(); + targ.setState( state ); + } + ~SetDbgState() { + st.setState( oldState ); + } + }; + + int cpos = 0; + + SetDbgState stt( dbgState, disableVerboseForContextMenu ); + + SimpleTypeConfiguration conf( m_activeFileName ); + + EvaluationResult type = evaluateExpressionAt( line, column, conf ); + + ///Test if it is a macro + if( type.isMacro ) { + QPopupMenu * m = PopupTracker::createPopup( popup ); + int gid; + if ( contextMenuEntriesAtTop ) + gid = popup->insertItem( i18n( "Navigate by Macro \"%1\"" ).arg( cleanForMenu( type.macro.name() ) ), m, 5, cpos++ ); + else + gid = popup->insertItem( i18n( "Navigate by Macro \"%1\"" ).arg( cleanForMenu( type.macro.name() ) ), m ); + + int id = m->insertItem( i18n( "Jump to %1" ).arg( cleanForMenu( type.macro.name() ) ), this, SLOT( popupAction( int ) ) ); + QPopupMenu * b = PopupTracker::createPopup( m ); + m->insertItem( i18n( "Body" ), b ); + + DeclarationInfo i; + i.file = type.macro.fileName(); + i.startCol = type.macro.column(); + i.startLine = type.macro.line(); + i.endCol = type.macro.column(); + i.endLine = type.macro.line(); + m_popupActions.insert( id, i ); + + QStringList ls = prepareTextForMenu( type.macro.body(), 20, 100 ); + for ( QStringList::iterator it = ls.begin(); it != ls.end(); ++it ) { + b->insertItem( *it, 0, SLOT( popupClassViewAction( int ) ) ); + } + } + + ///Test if it is an include-directive + QString includeFileName, includeFilePath; + bool simpleAlgorithm = false; + bool isIncludeDirective = getIncludeInfo( line, includeFileName, includeFilePath, simpleAlgorithm ); + if( isIncludeDirective ) { + ///Add menu entry + if( !includeFilePath.isEmpty() ) { + int gid; + QPopupMenu * m = PopupTracker::createPopup( popup ); + if ( contextMenuEntriesAtTop ) + gid = popup->insertItem( i18n( "Goto Include File: %1" ).arg( cleanForMenu( includeFileName ) ), m, 5, cpos++ ); + else + gid = popup->insertItem( i18n( "Goto Include File: %1" ).arg( cleanForMenu( includeFileName ) ), m ); + + int id = m->insertItem( i18n( "Jump to %1" ).arg( cleanForMenu( includeFilePath ) ), this, SLOT( popupAction( int ) ) ); + + DeclarationInfo i; + i.file = includeFilePath; + i.startCol = 0; + i.startLine = 0; + i.endCol = 0; + i.endLine = 0; + m_popupActions.insert( id, i ); + + if( simpleAlgorithm && cppSupport()->codeCompletionConfig()->resolveIncludePaths() ) { + //Add a notification that the correct algorithm failed in finding the include-file correctly + m->insertItem( i18n( "This include-file could not be located regularly, and was selected from the project file list." ) ); + } + } else { + ///Could not find include-file + if ( contextMenuEntriesAtTop ) + popup->insertItem( i18n( "Not Found: \"%1\"" ).arg( includeFileName ), 5, cpos++ ); + else + popup->insertItem( i18n( "Not Found: \"%1\"" ).arg( includeFileName ) ); + } + } + + ///Break if we cannot show additional information + if ( isIncludeDirective || (!type->resolved() && !type.sourceVariable && ( !type.resultType.trace() || type.resultType.trace() ->trace().isEmpty() ) && !BuiltinTypes::isBuiltin( type.resultType ) ) ) + return ; + + QString name = type->fullNameChain(); + if ( type.sourceVariable ) + name += " " + type.sourceVariable.name; + if ( type.resultType->resolved() && type.resultType->resolved() ->asFunction() ) + name = buildSignature( type.resultType->resolved() ); + + ///Fill the jump-menu + { + PopupFillerHelpStruct h( this ); + PopupFiller filler( h, "" ); + + QPopupMenu * m = PopupTracker::createPopup( popup ); + int gid; + if ( contextMenuEntriesAtTop ) + gid = popup->insertItem( i18n( "Navigate by \"%1\"" ).arg( cleanForMenu( name ) ), m, 5, cpos++ ); + else + gid = popup->insertItem( i18n( "Navigate by \"%1\"" ).arg( cleanForMenu( name ) ), m ); + + popup->setWhatsThis( gid, i18n( "Navigation

      Provides a menu to navigate to positions of items that are involved in this expression" ) ); + + /*if( type.sourceVariable && type.sourceVariable.name != "this" ) { + int id = m->insertItem( i18n("jump to variable-declaration \"%1\"").arg( type.sourceVariable.name ) , this, SLOT( popupAction( int ) ) ); + + m_popupActions.insert( id, type.sourceVariable ); + }*/ + + filler.fill( m, type, "", type.sourceVariable ); + } + if ( type->resolved() ) { + ///Now fill the class-view-browsing-stuff + { + QPopupMenu * m = PopupTracker::createPopup( popup ); + int gid; + if ( contextMenuEntriesAtTop ) + gid = popup->insertItem( i18n( "Navigate Class-View by \"%1\"" ).arg( cleanForMenu( name ) ), m, 6, cpos++ ); + else + gid = popup->insertItem( i18n( "Navigate Class-View by \"%1\"" ).arg( cleanForMenu( name ) ), m ); + + popup->setWhatsThis( gid, i18n( "Navigation

      Provides a menu to show involved items in the class-view " ) ); + + PopupClassViewFillerHelpStruct h( this ); + PopupFiller filler( h, "" ); + + filler.fill( m, type ); + } + } + + if ( contextMenuEntriesAtTop ) + popup->insertSeparator( cpos ); +} + +void CppCodeCompletion::slotTextHint( int line, int column, QString &text ) { + if ( ! m_pSupport->codeCompletionConfig() ->statusBarTypeEvaluation() ) + return ; + + kdDebug( 9007 ) << "CppCodeCompletion::slotTextHint()" << endl; + + clearStatusText(); + + if ( m_lastHintTime.msecsTo( QTime::currentTime() ) < 300 ) { + kdDebug( 9007 ) << "slotNeedTextHint called too often" << endl; + return ; + } + + m_lastHintTime = QTime::currentTime(); + + clearStatusText(); + text = ""; + if ( !m_pSupport || !m_activeEditor ) + return ; + + SimpleTypeConfiguration conf( m_activeFileName ); + + EvaluationResult type = evaluateExpressionAt( line, column, conf ); + + if ( type.expr.expr().stripWhiteSpace().isEmpty() ) + return ; ///Expression could not be found + + if ( type.sourceVariable ) { + text += type.sourceVariable.toText() + "\n"; + } + + if ( type->resolved() ) { + /*SimpleTypeFunctionInterface* f = type->resolved()->asFunction(); + if( f ) { + text += "function: \"" + buildSignature( type->resolved() ) + "\""; + } else { + QValueList trace = type.resultType->trace(); + if( !trace.isEmpty() ) { + for( QValueList::iterator it = trace.begin(); it != trace.end(); ++it ) { + text += (*it).fullNameChain() + " --> "; + } + text += "\n"; + } + text += "type: \"" + type.resultType->fullTypeResolved() + "\""; + } + if( type.resultType->parent()) text += "\nnested in: \"" + type.resultType->parent()->fullTypeResolvedWithScope() + "\""; + DeclarationInfo i = type.resultType->getDeclarationInfo(); + if( i ) text += "\n" + i.locationToText(); + + if( !type.resultType->comment().isEmpty() ) text += "\n\n" + type.resultType->comment() + "";*/ + + } else {} + + kdDebug( 9007 ) << "showing: \n" << text << endl; + const int timeout = 2000; + + if ( type->resolved() ) { + addStatusText( i18n( "Type of \"%1\" is \"%2\"" ).arg( type.expr.expr() ).arg( type->fullNameChain() ), timeout ); + if ( type.sourceVariable && !type.sourceVariable.comment.isEmpty() ) { + addStatusText( i18n( "Comment on variable \"%1\": \"%2\"" ).arg( type.sourceVariable.name ).arg( type.sourceVariable.comment ) , 10000 ); + } + if ( !type->resolved() ->comment().isEmpty() ) { + addStatusText( i18n( "Comment on \"%1\": \"%2\"" ).arg( type->name() ).arg( type->resolved() ->comment() ) , 10000 ); + } + if ( type->resolved() ->comment().isEmpty() ) { + addStatusText( i18n( "\"%1\" has no comment" ).arg( type->name() ) , timeout ); + } + } else { + if ( type ) { + if( !BuiltinTypes::isBuiltin( type.resultType ) ) { + addStatusText( i18n( "Type of \"%1\" is unresolved, name: \"%2\"" ).arg( type.expr.expr() ).arg( type->fullNameChain() ), 2 * timeout ); + } else { + addStatusText( i18n( "\"%1\" is of builtin type \"%2\", a %3" ).arg( type.expr.expr() ).arg( type->fullNameChain() ).arg(BuiltinTypes::comment( type.resultType )), 2 * timeout ); + } + + + } else { + addStatusText( i18n( "Type of \"%1\" could not be evaluated: tried to evaluate expression as \"%2\"" ).arg( type.expr.expr() ).arg( type.expr.typeAsString() ), 2 * timeout ); + } + } + + text = ""; ///Don't really use tooltips since those are not implemented in katepart, and don't work right in the qt-designer based part +} + +///not good.. +bool CppCodeCompletion::isTypeExpression( const QString& expr ) { + TypeDesc d( expr ); + if ( !d.isValidType() ) + return false; + + QString ex = d.fullNameChain(); + QStringList lex = QStringList::split( " ", ex ); + QStringList lexpr = QStringList::split( " ", expr ); + return lex.join( " " ) == lexpr.join( " " ); +} + +bool CppCodeCompletion::mayBeTypeTail( int line, int column, QString& append, bool inFunction ) { + QString tail = clearComments( m_activeEditor->text( line, column + 1, line + 10 > ( int ) m_activeEditor->numLines() ? ( int ) m_activeEditor->numLines() : line + 10, 0 ) ); + tail.replace( "\n", " " ); + SafetyCounter s ( 100 ); + bool hadSpace = false; + while ( !tail.isEmpty() && s ) { + if ( tail[ 0 ] == ';' ) { + return false; + } else if ( ( !inFunction && tail[ 0 ] == ',' ) || tail[ 0 ] == '&' || tail[ 0 ] == '*' || tail[ 0 ] == '{' || tail[ 0 ] == ':' ) { + return true; + } else if ( isTypeOpenParen( tail[ 0 ] ) ) { + ///TODO: use findClose to make the whole expression include template-params + int to = findClose( tail, 0 ); + if ( to != -1 ) { + append = tail.left( to + 1 ); + tail = tail.mid( to + 1 ); + } else { + return false; + } + } else if ( isTypeCloseParen( tail[ 0 ] ) ) { + return true; + } else if ( tail[ 0 ].isSpace() ) { + tail = tail.mid( 1 ); + hadSpace = true; + } else if ( tail[ 0 ].isLetter() ) { + return hadSpace; + } else { + break; + } + } + + return false; +} + +bool CppCodeCompletion::canBeTypePrefix( const QString& prefix, bool inFunction ) { + + for ( int p = prefix.length() - 1 ; p >= 0; --p ) { + if ( prefix[ p ].isSpace() ) { + continue; + } + + if ( prefix[ p ] == ';' || prefix[ p ] == '<' || prefix[ p ] == ':' || ( !inFunction && ( prefix[ p ] == '(' || prefix[ p ] == ',' ) ) || prefix[ p ] == '}' || prefix[ p ] == '{' ) { + return true; + } + + ///@todo: make this a simple regex + if ( prefix[ p ].isLetterOrNumber() && ( tokenAt( prefix, "class", p ) || tokenAt( prefix, "struct", p ) || tokenAt( prefix, "const", p ) || tokenAt( prefix, "typedef", p ) || tokenAt( prefix, "public", p ) || tokenAt( prefix, "protected", p ) || tokenAt( prefix, "private", p ) || tokenAt( prefix, "virtual", p ) || tokenAt( prefix, "static", p ) || tokenAt( prefix, "virtual", p ) ) ) + return true; + else { + return false; + } + } + + return true; +} + +///This function is just a litte hack und should be remade, it doesn't work for all cases +ExpressionInfo CppCodeCompletion::findExpressionAt( int line, int column, int startLine, int startCol, bool inFunction ) { + ExpressionInfo ret; + + QString contents = clearComments( getText( startLine, startCol, line, column ) ); + + + int start_expr = expressionAt( contents, contents.length() ); + + if ( start_expr != int( contents.length() ) ) { + QString str = contents.mid( start_expr, contents.length() - start_expr ).stripWhiteSpace(); + if ( str.startsWith( "new " ) ) { + str = str.mid( 4 ).stripWhiteSpace(); + } + ret.setExpr( str ); + if ( !ret.expr().isEmpty() ) + ret.t = ExpressionInfo::NormalExpression; + } + + if ( ret ) { + ///Check whether it may be a type-expression + bool mayBeType = true; + QString append; + if ( !mayBeTypeTail( line, column - 1, append, inFunction ) ) + mayBeType = false; + if ( mayBeType ) { + if ( !canBeTypePrefix( contents.left( start_expr ), inFunction ) ) + mayBeType = false; + } + + //make this a regexp + QString e = ret.expr(); + if ( e.contains( "." ) || e.contains( "->" ) || e.contains( "(" ) || e.contains( ")" ) || e.contains( "=" ) || e.contains( "-" ) ) + mayBeType = false; + + if ( mayBeType ) { + ret.setExpr( ret.expr() + append ); + ret.t = ExpressionInfo::TypeExpression; + } + } + + return ret; +} + +void macrosToDriver( Driver& d, FileDom file ) { + return; //Deactivate this for now, because macros can cause inconsistency of line/column-numbers between processed text and the not-processed text of the buffer + ParseResultPointer p; + if( file ) + p = file->parseResult(); + ParsedFile* pf = dynamic_cast( p.data() ); + if( pf ) { + d.insertMacros( pf->usedMacros() ); ///Add macros + } +} + +SimpleContext* CppCodeCompletion::computeFunctionContext( FunctionDom f, int line, int col, SimpleTypeConfiguration& conf ) { + Q_UNUSED(conf); + if ( !f ) + return 0; + int modelStartLine, modelStartColumn; + int modelEndLine, modelEndColumn; + + f->getStartPosition( &modelStartLine, &modelStartColumn ); + f->getEndPosition( &modelEndLine, &modelEndColumn ); + + QString textLine = m_activeEditor->textLine( modelStartLine ); + kdDebug( 9007 ) << "startLine = " << textLine << endl; + + QString contents = getText( modelStartLine, modelStartColumn, line, col ); + + Driver d; + Lexer lexer( &d ); + macrosToDriver( d, f->file() ); + + lexer.setSource( contents ); + Parser parser( &d, &lexer ); + + DeclarationAST::Node recoveredDecl; + RecoveryPoint* recoveryPoint = this->d->findRecoveryPoint( line, col );///@todo recovery-points are not needed anymore + + parser.parseDeclaration( recoveredDecl ); + if ( recoveredDecl.get() ) { + bool isFunDef = recoveredDecl->nodeType() == NodeType_FunctionDefinition; + kdDebug( 9007 ) << "is function definition= " << isFunDef << endl; + + int startLine, startColumn; + int endLine, endColumn; + recoveredDecl->getStartPosition( &startLine, &startColumn ); + recoveredDecl->getEndPosition( &endLine, &endColumn ); + /*if( startLine != modelStartLine || endLine != modelEndLine || startColumn != modelStartColumn || endColumn != modelEndColumn ) { + kdDebug( 9007 ) << "code-model and real file are out of sync \nfunction-bounds in code-model: " << endl; + kdDebug( 9007 ) << "(l " << modelStartLine << ", c " << modelStartColumn << ") - (l " << modelEndLine << ", c " << modelEndColumn << ") " << "parsed function-bounds: " << endl; + kdDebug( 9007 ) << "(l " << startLine << ", c " << startColumn << ") - (l " << endLine << ", c " << endColumn << ") " << endl; + }*/ + + if ( isFunDef ) { + FunctionDefinitionAST * def = static_cast( recoveredDecl.get() ); + + SimpleContext* ctx = computeContext( def, endLine, endColumn, modelStartLine, modelStartColumn ); + if ( !ctx ) + return 0; + + QStringList scope = f->scope(); + + + if ( !scope.isEmpty() ) { + SimpleType parentType; + /* if( !m_cachedFromContext ) { + TypePointer t = SimpleType(QStringList())->locateDecType( scope.join("") ).desc().resolved();; + if( t ) + parentType = SimpleType( t.data() ); + else + parentType = SimpleType( scope ); + } else {*/ + parentType = SimpleType( scope, getIncludeFiles() ); + //} + parentType->descForEdit().setTotalPointerDepth( 1 ); + ctx->setContainer( parentType ); + } + + SimpleType global = ctx->global(); + + if( dynamic_cast( &(*global) ) ) { + SimpleTypeNamespace* globalNs = static_cast ( &(*global) ); + QValueList > localImports = ctx->imports(); + for( QValueList >::const_iterator it = localImports.begin(); it != localImports.end(); ++it ) + globalNs->addAliasMap( (*it).first, (*it).second ); + } + + /* //Should not be necessary any more + if( !getParsedFile( f->file().data() ) || getParsedFile( f->file().data() )->includeFiles().size() <= 1 ) { + if ( !m_cachedFromContext ) { + conf.setGlobalNamespace( &( *global ) ); + if ( recoveryPoint ) { + recoveryPoint->registerImports( global, m_pSupport->codeCompletionConfig() ->namespaceAliases() ); + } else { + kdDebug( 9007 ) << "no recovery-point, cannot use imports" << endl; + } + } + }*/ + + ///Insert the "this"-type(container) and correctly resolve it using imported namespaces + if ( ctx->container() ) { + if ( !m_cachedFromContext ) { + TypeDesc td = ctx->container() ->desc(); + td.setIncludeFiles( getIncludeFiles() ); + td.makePrivate(); + + td.resetResolved( ); + TypePointer tt = ctx->container() ->locateDecType( td, SimpleTypeImpl::LocateBase ) ->resolved(); + if ( tt ) { + ctx->setContainer( SimpleType( tt ) ); + } else { + kdDebug( 9007 ) << "could not resolve local this-type \"" << td.fullNameChain() << "\"" << endl; + } + } + + SimpleType this_type = ctx->container(); + + this_type->descForEdit().setTotalPointerDepth( 1 ); + + SimpleVariable var; + var.type = this_type->desc(); + var.name = "this"; + var.comment = this_type->comment(); + ctx->add + ( var ); + ctx->setContainer( this_type ); + } + + return ctx; + } else { + kdDebug( 9007 ) << "computeFunctionContext: context is no function-definition" << endl; + } + } else { + kdDebug( 9007 ) << "computeFunctionContext: could not find a valid declaration to recover" << endl; + } + return 0; +} + +bool CppCodeCompletion::functionContains( FunctionDom f , int line, int col ) { + if ( !f ) + return false; + int sl, sc, el, ec; + f->getStartPosition( &sl, &sc ); + f->getEndPosition( &el, &ec ); + QString t = clearComments( getText( sl, sc, el, ec ) ); + if ( t.isEmpty() ) + return false; + + //int i = t.find( '{' ); + int i = t.find( '(' ); //This now includes the argument-list + if ( i == -1 ) + return false; + int lineCols = 0; + for ( int a = 0; a < i; a++ ) { + if ( t[ a ] == '\n' ) { + sl++; + lineCols = 0; + } else { + lineCols++; + } + } + + sc += lineCols; + + return ( line > sl || ( line == sl && col >= sc ) ) && ( line < el || ( line == el && col < ec ) ); +} + +void CppCodeCompletion::getFunctionBody( FunctionDom f , int& line, int& col ) { + if ( !f ) + return; + int sl, sc, el, ec; + f->getStartPosition( &sl, &sc ); + f->getEndPosition( &el, &ec ); + QString t = clearComments( getText( sl, sc, el, ec ) ); + if ( t.isEmpty() ) + return; + + int i = t.find( '{' ); + if ( i == -1 ) + return; + i++; + if( (uint)i >= t.length() ) + return; + int lineCols = 0; + for ( int a = 0; a < i; a++ ) { + if ( t[ a ] == '\n' ) { + sl++; + lineCols = 0; + } else { + lineCols++; + } + } + + sc += lineCols; + + line = sl; + col = sc; +} + +void CppCodeCompletion::emptyCache() { + m_cachedFromContext = 0; + SimpleTypeConfiguration c; ///Will automatically destroy the type-store when the function is closed + kdDebug( 9007 ) << "completion-cache emptied" << endl; +} + +void CppCodeCompletion::needRecoveryPoints() { + + if ( this->d->recoveryPoints.isEmpty() ) { + kdDebug( 9007 ) << "missing recovery-points for file " << m_activeFileName << " they have to be computed now" << endl; + m_pSupport->backgroundParser() ->lock () + ; + + std::vector vec; + + TranslationUnitAST * ast = *m_pSupport->backgroundParser() ->translationUnit( m_activeFileName ); + m_pSupport->backgroundParser() ->unlock(); + if ( !ast ) { + kdDebug( 9007 ) << "background-parser is missing the translation-unit. The file needs to be reparsed." << endl; + m_pSupport->parseFileAndDependencies( m_activeFileName, true ); +// m_pSupport->mainWindow() ->statusBar() ->message( i18n( "Background-parser is missing the necessary translation-unit. It will be computed, but this completion will fail." ).arg( m_activeFileName ), 2000 ); + return; + } else { + computeRecoveryPointsLocked(); + } + if ( this->d->recoveryPoints.isEmpty() ) { + kdDebug( 9007 ) << "Failed to compute recovery-points for " << m_activeFileName << endl; +// m_pSupport->mainWindow() ->statusBar() ->message( i18n( "Failed to compute recovery-points for %1" ).arg( m_activeFileName ), 1000 ); + } else { + kdDebug( 9007 ) << "successfully computed recovery-points for " << m_activeFileName << endl; + } + } +} + +EvaluationResult CppCodeCompletion::evaluateExpressionType( int line, int column, SimpleTypeConfiguration& conf, EvaluateExpressionOptions opt ) { + EvaluationResult ret; + safetyCounter.init(); + + FileDom file = m_pSupport->codeModel() ->fileByName( m_activeFileName ); + + if ( !file ) { +// m_pSupport->mainWindow() ->statusBar() ->message( i18n( "File %1 does not exist in the code-model" ).arg( m_activeFileName ), 1000 ); + kdDebug( 9007 ) << "Error: file " << m_activeFileName << " could not be located in the code-model, code-completion stopped\n"; + return SimpleType(); + } + + needRecoveryPoints(); + + CodeModelUtils::CodeModelHelper fileModel( m_pSupport->codeModel(), file ); + ItemDom contextItem; + + int nLine = line, nCol = column; + + // emptyCache(); + fitContextItem( line, column ); + + QString strCurLine = m_activeEditor->textLine( nLine ); + + QString ch = strCurLine.mid( nCol - 1, 1 ); + QString ch2 = strCurLine.mid( nCol - 2, 2 ); + + while ( ch[ 0 ].isSpace() && nCol >= 3 ) { + nCol -= 1; + ch = strCurLine.mid( nCol - 1, 1 ); + ch2 = strCurLine.mid( nCol - 2, 2 ); + } + + if ( ch2 == "->" || ch == "." || ch == "(" ) { + int pos = ch2 == "->" ? nCol - 3 : nCol - 2; + QChar c = strCurLine[ pos ]; + while ( pos > 0 && c.isSpace() ) + c = strCurLine[ --pos ]; + + if ( !( c.isLetterOrNumber() || c == '_' || c == ')' || c == ']' || c == '>' ) ) { + conf.invalidate(); + return SimpleType(); + } + } + bool showArguments = false; + + if ( ch == "(" ) { + --nCol; + while ( nCol > 0 && strCurLine[ nCol ].isSpace() ) + --nCol; + showArguments = true; + } + + QString word; + + { + ExpressionInfo exp_ = findExpressionAt( line, column , line, 0 ); + + if( file->parseResult() ) { + ParsedFilePointer p = dynamic_cast( file->parseResult().data()); + if( p ) { + if( p->usedMacros().hasMacro( exp_.expr() ) ) { + //It is a macro, return it + ret.expr = exp_.expr(); + ret.isMacro = true; + ret.macro = p->usedMacros().macro( exp_.expr() ); + return ret; + } + } + } + } + + if ( !m_cachedFromContext ) + conf.setGlobalNamespace( createGlobalNamespace() ); + + ItemLocker block( *m_pSupport->backgroundParser() ); + + FunctionDom currentFunction = fileModel.functionAt( line, column ); + + bool functionFailed = true; + + if ( opt & SearchInFunctions ) { + //currentFunction = fileModel.functionAt( line, column ); + + if ( currentFunction && functionContains( currentFunction, line, column ) ) { + ///Evaluate the context of the function-body if we're in the argument-list + int realLine = line, realColumn = column; + getFunctionBody( currentFunction, realLine, realColumn ); + if( realLine < line || ( realLine == line && realColumn < column ) ) { + realLine = line; + realColumn = column; + } + + SimpleContext * ctx = computeFunctionContext( currentFunction, realLine, realColumn, conf ); + contextItem = currentFunction.data(); + + if ( ctx ) { + opt = remFlag( opt, SearchInClasses ); + int startLine, endLine; + currentFunction->getStartPosition( &startLine, &endLine ); + ExpressionInfo exp = findExpressionAt( line, column , startLine, endLine, true ); + if ( ( opt & DefaultAsTypeExpression ) && ( !exp.canBeNormalExpression() && !exp.canBeTypeExpression() ) && !exp.expr().isEmpty() ) + exp.t = ExpressionInfo::TypeExpression; + + if ( exp.canBeTypeExpression() ) { + { + if ( ! ( opt & IncludeTypeExpression ) ) { + kdDebug( 9007 ) << "recognized a type-expression, but another expression-type is desired" << endl; + } else { + TypeDesc d( exp.expr() ); + d.setIncludeFiles( getIncludeFiles() ); + ret.resultType = ctx->container() ->locateDecType( d ); + ret.expr = exp; + } + } + } + if ( /*exp.canBeNormalExpression() &&*/ !ret.resultType->resolved() ) { ///It is not cleary possible to recognize the kind of an expression from the syntax as long as it's not written completely + { + if ( ! ( opt & IncludeStandardExpressions ) ) { + kdDebug( 9007 ) << "recognized a standard-expression, but another expression-type is desired" << endl; + } else { + ///Remove the not completely typed last word while normal completion + if ( !showArguments && ( opt & CompletionOption ) ) { + QString e = exp.expr(); + int idx = e.length() - 1; + while ( e[ idx ].isLetterOrNumber() || e[ idx ] == '_' ) + --idx; + + if ( idx != int( e.length() ) - 1 ) { + ++idx; + word = e.mid( idx ).stripWhiteSpace(); + exp.setExpr( e.left( idx ).stripWhiteSpace() ); + } + } + + functionFailed = false; + ret = evaluateExpression( exp, ctx ); + } + } + } + } else { + kdDebug( 9007 ) << "could not compute context" << endl; + } + if ( ctx ) + delete ctx; + } else { + kdDebug( 9007 ) << "could not find context-function in code-model" << endl; + } + } + + if ( ( opt & SearchInClasses ) && !ret->resolved() && functionFailed ) { + ClassDom currentClass = fileModel.classAt( line, column ); + int startLine = 0, startCol = 0; + + RecoveryPoint* recoveryPoint = this->d->findRecoveryPoint( line, column ); + + QStringList scope; + + if ( !currentClass ) { + kdDebug( 9007 ) << "no container-class found" << endl; + if ( !recoveryPoint ) { + kdDebug( 9007 ) << "no recovery-point found" << endl; + } else { + startLine = recoveryPoint->startLine; + startCol = recoveryPoint->startColumn; + scope = recoveryPoint->scope; + } + } else { + contextItem = currentClass.data(); + scope = currentClass->scope(); + scope << currentClass->name(); + currentClass->getStartPosition( &startLine, &startCol ); + } + + SimpleType container; + if ( m_cachedFromContext ) { + TypeDesc d( scope.join( "::" ) ); + d.setIncludeFiles( getIncludeFiles() ); + SimpleTypeImpl * i = SimpleType( QStringList(), getIncludeFiles() ) ->locateDecType( d ).desc().resolved().data(); + if ( i ) + container = i; + else + container = SimpleType( scope, getIncludeFiles() ); + } else { + container = SimpleType( scope, getIncludeFiles() ); + } + + ExpressionInfo exp = findExpressionAt( line, column , startLine, startCol ); + exp.t = ExpressionInfo::TypeExpression; ///Outside of functions, we can only handle type-expressions + ret.expr = exp; + + if ( exp && ( exp.t & ExpressionInfo::TypeExpression ) ) { + kdDebug( 9007 ) << "locating \"" << exp.expr() << "\" in " << container->fullTypeResolvedWithScope() << endl; + TypeDesc d( exp.expr() ); + d.setIncludeFiles( getIncludeFiles() ); + ret.resultType = container->locateDecType( d ); + } else { + if ( exp ) { + kdDebug( 9007 ) << "wrong expression-type recognized" << endl; + } else { + kdDebug( 9007 ) << "expression could not be recognized" << endl; + } + } + } + + CppCodeCompletionConfig * cfg = m_pSupport->codeCompletionConfig(); + if( cfg->usePermanentCaching() && contextItem ) { + conf.invalidate(); + m_cachedFromContext = contextItem; + } + + return ret; +} + +bool isAfterKeyword( const QString& str, int column ) { + QStringList keywords; + keywords << "new"; + keywords << "throw"; + keywords << "return"; + keywords << "emit"; ///This could be done even better by only showing signals for completion.. + for ( QStringList::iterator it = keywords.begin(); it != keywords.end(); ++it ) { + int len = ( *it ).length(); + if ( column >= len && str.mid( column - len, len ) == *it ) + return true; + } + return false; +} + +void CppCodeCompletion::setMaxComments( int count ) { + m_maxComments = count; +} + +///TODO: make this use findExpressionAt etc. (like the other expression-evaluation-stuff) +void CppCodeCompletion::completeText( bool invokedOnDemand /*= false*/ ) { + kdDebug( 9007 ) << "CppCodeCompletion::completeText()" << endl; + clearStatusText(); + + if ( !m_pSupport || !m_activeCursor || !m_activeEditor || !m_activeCompletion ) + return ; + + setMaxComments( 1000 ); + + needRecoveryPoints(); + + CppCodeCompletionConfig * cfg = m_pSupport->codeCompletionConfig(); + m_demandCompletion = invokedOnDemand; + + FileDom file = m_pSupport->codeModel() ->fileByName( m_activeFileName ); + + if ( !file ) { +// m_pSupport->mainWindow() ->statusBar() ->message( i18n( "File %1 does not exist in the code-model" ).arg( m_activeFileName ), 1000 ); + kdDebug( 9007 ) << "Error: file " << m_activeFileName << " could not be located in the code-model, code-completion stopped\n"; + return ; + } + + CodeModelUtils::CodeModelHelper fileModel( m_pSupport->codeModel(), file ); + + ItemDom contextItem; + + unsigned int line, column; + m_activeCursor->cursorPositionReal( &line, &column ); + + fitContextItem( line, column ); + + ///Check whether the cursor is within a comment + int surroundingStartLine = line - 10, surroundingEndLine = line + 10; + if ( surroundingStartLine < 0 ) + surroundingStartLine = 0; + if ( surroundingEndLine > m_activeEditor->numLines() - 1 ) + surroundingEndLine = m_activeEditor->numLines() - 1; + int surroundingEndCol = m_activeEditor->lineLength( surroundingEndLine ); + + QString pre = getText( surroundingStartLine, 0, line, column ); + int pos = pre.length(); + pre += getText( line, column, surroundingEndLine, surroundingEndCol ); + QString cleared = clearComments( pre ); + if ( cleared[ pos ] != pre[ pos ] ) { + kdDebug( 9007 ) << "stopping completion because we're in a coment" << endl; + return ; + } + + int nLine = line, nCol = column; + + QString strCurLine = clearComments( m_activeEditor->textLine( nLine ) ); + + QString ch = strCurLine.mid( nCol - 1, 1 ); + QString ch2 = strCurLine.mid( nCol - 2, 2 ); + + while ( ch[ 0 ].isSpace() && nCol >= 3 ) { + nCol -= 1; + ch = strCurLine.mid( nCol - 1, 1 ); + ch2 = strCurLine.mid( nCol - 2, 2 ); + } + + if ( m_includeRx.search( strCurLine ) != -1 ) { + if ( !m_fileEntryList.isEmpty() ) { + m_bCompletionBoxShow = true; + m_activeCompletion->showCompletionBox( m_fileEntryList, column - m_includeRx.matchedLength() ); + } + return ; + } + + bool showArguments = false; + bool isInstance = true; + m_completionMode = NormalCompletion; + + if ( ch2 == "->" || ch == "." || ch == "(" ) { + int pos = ch2 == "->" ? nCol - 3 : nCol - 2; + QChar c = strCurLine[ pos ]; + while ( pos > 0 && c.isSpace() ) + c = strCurLine[ --pos ]; + + if ( !( c.isLetterOrNumber() || c == '_' || c == ')' || c == ']' || c == '>' ) ) + return ; + } + + if ( ch == "(" ) { + --nCol; + while ( nCol > 0 && strCurLine[ nCol - 1 ].isSpace() ) + --nCol; + + ///check whether it is a value-definition using constructor + int column = nCol; + bool s1 = false, s2 = false; + while ( column > 0 && isValidIdentifierSign( strCurLine[ column - 1 ] ) ) { + column--; + s1 = true; + } + + ///skip white space + while ( column > 0 && strCurLine[ column - 1 ].isSpace() ) { + --column; + s2 = true; + } + + if ( s1 && s2 && isValidIdentifierSign( strCurLine[ column - 1 ] ) ) { + if ( isAfterKeyword( strCurLine, column ) ) { + ///Maybe a constructor using "new", or "throw", "return", ... + } else { + ///it is a local constructor like "QString name("David");" + nCol = column; + } + } + + + + showArguments = TRUE; + } + + EvaluationResult type; + SimpleType this_type; + QString expr, word; + + DeclarationAST::Node recoveredDecl; + TypeSpecifierAST::Node recoveredTypeSpec; + + SimpleContext* ctx = 0; + SimpleTypeConfiguration conf( m_activeFileName ); + + if ( !m_cachedFromContext ) + conf.setGlobalNamespace( createGlobalNamespace() ); + + ItemLocker block( *m_pSupport->backgroundParser() ); + + FunctionDom currentFunction = fileModel.functionAt( line, column ); + + RecoveryPoint * recoveryPoint = d->findRecoveryPoint( line, column ); + if ( recoveryPoint || currentFunction ) { + contextItem = currentFunction.data(); + QStringList scope; + + int startLine, startColumn; + if ( currentFunction ) { ///maybe change the priority of these + kdDebug( 9007 ) << "using code-model for completion" << endl; + currentFunction->getStartPosition( &startLine, &startColumn ); + scope = currentFunction->scope(); + } else { + kdDebug( 9007 ) << "recovery-point, node-kind = " << nodeTypeToString( recoveryPoint->kind ) << endl; + startLine = recoveryPoint->startLine; + startColumn = recoveryPoint->startColumn; + scope = recoveryPoint->scope; + } + + QString textLine = m_activeEditor->textLine( startLine ); + kdDebug( 9007 ) << "startLine = " << textLine << endl; + + if ( currentFunction || recoveryPoint->kind == NodeType_FunctionDefinition ) { + + QString textToReparse = clearComments( getText( startLine, startColumn, line, showArguments ? nCol : column ) ); + + kdDebug( 9007 ) << "-------------> reparse text" << endl << textToReparse << endl + << "--------------------------------------------" << endl; + + Driver d; + Lexer lexer( &d ); + + macrosToDriver( d, file ); + + lexer.setSource( textToReparse ); + Parser parser( &d, &lexer ); + + parser.parseDeclaration( recoveredDecl ); + /* kdDebug(9007) << "recoveredDecl = " << recoveredDecl.get() << endl;*/ + if ( recoveredDecl.get() ) { + + bool isFunDef = recoveredDecl->nodeType() == NodeType_FunctionDefinition; + kdDebug( 9007 ) << "is function definition= " << isFunDef << endl; + + int endLine, endColumn; + recoveredDecl->getEndPosition( &endLine, &endColumn ); + kdDebug( 9007 ) << "endLine = " << endLine << ", endColumn " << endColumn << endl; + + /// @todo check end position + + if ( isFunDef ) { + FunctionDefinitionAST * def = static_cast( recoveredDecl.get() ); + + /// @todo remove code duplication + + QString contents = textToReparse; + int start_expr = expressionAt( contents, contents.length() ); + + // kdDebug(9007) << "start_expr = " << start_expr << endl; + if ( start_expr != int( contents.length() ) ) + expr = contents.mid( start_expr, contents.length() - start_expr ).stripWhiteSpace(); + + if ( expr.startsWith( "SIGNAL" ) || expr.startsWith( "SLOT" ) ) { + m_completionMode = expr.startsWith( "SIGNAL" ) ? SignalCompletion : SlotCompletion; + + showArguments = false; + int end_expr = start_expr - 1; + while ( end_expr > 0 && contents[ end_expr ].isSpace() ) + --end_expr; + + if ( contents[ end_expr ] != ',' ) { + expr = QString::null; + } else { + start_expr = expressionAt( contents, end_expr ); + expr = contents.mid( start_expr, end_expr - start_expr ).stripWhiteSpace(); + } + } else { + if ( !showArguments ) { + int idx = expr.length() - 1; + while ( expr[ idx ].isLetterOrNumber() || expr[ idx ] == '_' ) + --idx; + + if ( idx != int( expr.length() ) - 1 ) { + ++idx; + word = expr.mid( idx ).stripWhiteSpace(); + expr = expr.left( idx ).stripWhiteSpace(); + } + } + } + + ctx = computeContext( def, endLine, endColumn, startLine, startColumn ); + DeclaratorAST* d = def->initDeclarator() ->declarator(); + NameAST* name = d->declaratorId(); + + QStringList nested; + + QPtrList l; + if ( name ) { + l = name->classOrNamespaceNameList(); + } + // QPtrList l = name->classOrNamespaceNameList(); + QPtrListIterator nameIt( l ); + while ( nameIt.current() ) { + if ( nameIt.current() ->name() ) { + nested << nameIt.current() ->name() ->text(); + } + ++nameIt; + } + + if ( currentFunction ) { + scope = currentFunction->scope(); + if ( !scope.isEmpty() ) { + //scope.pop_back(); + } else { + kdDebug( 9007 ) << "scope is empty" << endl; + } + if( dynamic_cast( SimpleType::globalNamespace().data() ) ) { + SimpleTypeNamespace* globalNs = static_cast ( SimpleType::globalNamespace().data() ); + QValueList > localImports = ctx->imports(); + for( QValueList >::const_iterator it = localImports.begin(); it != localImports.end(); ++it ) + globalNs->addAliasMap( (*it).first, (*it).second ); + } + } else { + scope += nested; + } + + if ( !scope.isEmpty() ) { + SimpleType parentType; + + /*if( !m_cachedFromContext ) { + TypePointer t = createGlobalNamespace(); + conf.setGlobalNamespace( t ); + SimpleTypeNamespace * n = dynamic_cast( t.data() ); + if ( !n ) { + QString str = QString( "the global namespace was not resolved correctly , real type: " ) + typeid( n ).name() + QString( " name: " ) + n->scope().join( "::" ) + " scope-size: " + n->scope().count(); + kdDebug( 9007 ) << str << endl; + m_pSupport->mainWindow() ->statusBar() ->message( str , 1000 ); + } else { + } + this_type = SimpleType(t); + }*/ + + if ( m_cachedFromContext ) { + TypeDesc d( scope.join( "::" ) ); + d.setIncludeFiles( getIncludeFiles() ); + SimpleTypeImpl * i = SimpleType( QStringList(), getIncludeFiles() ) ->locateDecType( d ).desc().resolved().data(); + if ( i ) { + parentType = i; + } else { + parentType = SimpleType( scope, getIncludeFiles() ); + } + } else { + parentType = SimpleType( scope, getIncludeFiles() ); + } + this_type = parentType; + this_type->descForEdit().setTotalPointerDepth( 1 ); + ctx->setContainer( this_type ); + } + + ///Now locate the local type using the imported namespaces + if ( !scope.isEmpty() ) { + if ( !m_cachedFromContext ) { + TypeDesc td = ctx->container() ->desc(); + td.makePrivate(); + td.resetResolved( ); + td.setIncludeFiles( getIncludeFiles() ); + TypePointer tt = ctx->container() ->locateDecType( td, SimpleTypeImpl::LocateBase ) ->resolved(); + if ( tt ) { + ctx->setContainer( SimpleType( tt ) ); + } else { + kdDebug( 9007 ) << "could not resolve local this-type \"" << td.fullNameChain() << "\"" << endl; + } + } + + SimpleType this_type = ctx->container(); + + this_type->descForEdit().setTotalPointerDepth( 1 ); + + SimpleVariable var; + var.type = this_type->desc(); + var.name = "this"; + var.comment = this_type->comment(); + ctx->add + ( var ); + ctx->setContainer( this_type ); + } + + ExpressionInfo exp( expr ); + exp.t = ( ExpressionInfo::Type ) ( ExpressionInfo::NormalExpression | ExpressionInfo::TypeExpression ); + type = evaluateExpression( exp, ctx ); + } + + } else { + kdDebug( 9007 ) << "no valid declaration to recover!!!" << endl; + } + } else if ( recoveryPoint->kind == NodeType_ClassSpecifier ) { + QString textToReparse = getText( recoveryPoint->startLine, recoveryPoint->startColumn, + recoveryPoint->endLine, recoveryPoint->endColumn, line ); + // kdDebug(9007) << "-------------> please reparse only text" << endl << textToReparse << endl + // << "--------------------------------------------" << endl; + + Driver d; + Lexer lexer( &d ); + macrosToDriver( d, file ); + + lexer.setSource( textToReparse ); + Parser parser( &d, &lexer ); + + parser.parseClassSpecifier( recoveredTypeSpec ); + /* kdDebug(9007) << "recoveredDecl = " << recoveredTypeSpec.get() << endl;*/ + if ( recoveredTypeSpec.get() ) { + + //ClassSpecifierAST * clazz = static_cast( recoveredTypeSpec.get() ); + + QString keyword = getText( line, 0, line, column ).simplifyWhiteSpace(); + + kdDebug( 9007 ) << "===========================> keyword is: " << keyword << endl; + + if ( keyword == "virtual" ) { /* + BaseClauseAST *baseClause = clazz->baseClause(); + if ( baseClause ) + { + QPtrList baseList = baseClause->baseSpecifierList(); + QPtrList::iterator it = baseList.begin(); + + for ( ; it != baseList.end(); ++it ) + type.append( ( *it )->name()->text() ); + + ctx = new SimpleContext(); + + showArguments = false; + m_completionMode = VirtualDeclCompletion; + + kdDebug(9007) << "------> found virtual keyword for class specifier '" + << clazz->text() << "'" << endl; + }*/ + } else if ( QString( "virtual" ).find( keyword ) != -1 ) + m_blockForKeyword = true; + else + m_blockForKeyword = false; + } + } + } + + ///@todo is all this necessary? + if ( !recoveredDecl.get() && !recoveredTypeSpec.get() ) { + TranslationUnitAST * ast = *m_pSupport->backgroundParser() ->translationUnit( m_activeFileName ); + if ( AST * node = findNodeAt( ast, line, column ) ) { + kdDebug( 9007 ) << "------------------- AST FOUND --------------------" << endl; + kdDebug( 9007 ) << "node-kind = " << nodeTypeToString( node->nodeType() ) << endl; + + if ( FunctionDefinitionAST * def = functionDefinition( node ) ) { + kdDebug( 9007 ) << "------> found a function definition" << endl; + + int startLine, startColumn; + def->getStartPosition( &startLine, &startColumn ); + + QString contents = getText( startLine, startColumn, line, showArguments ? nCol : column ); + + + /// @todo remove code duplication + int start_expr = expressionAt( contents, contents.length() ); + + // kdDebug(9007) << "start_expr = " << start_expr << endl; + if ( start_expr != int( contents.length() ) ) + expr = contents.mid( start_expr, contents.length() - start_expr ).stripWhiteSpace(); + + if ( expr.startsWith( "SIGNAL" ) || expr.startsWith( "SLOT" ) ) { + m_completionMode = expr.startsWith( "SIGNAL" ) ? SignalCompletion : SlotCompletion; + + showArguments = false; + int end_expr = start_expr - 1; + while ( end_expr > 0 && contents[ end_expr ].isSpace() ) + --end_expr; + + if ( contents[ end_expr ] != ',' ) { + expr = QString::null; + } else { + start_expr = expressionAt( contents, end_expr ); + expr = contents.mid( start_expr, end_expr - start_expr ).stripWhiteSpace(); + } + } else { + int idx = expr.length() - 1; + while ( expr[ idx ].isLetterOrNumber() || expr[ idx ] == '_' ) + --idx; + + if ( idx != int( expr.length() ) - 1 ) { + ++idx; + word = expr.mid( idx ).stripWhiteSpace(); + expr = expr.left( idx ).stripWhiteSpace(); + } + } + + ctx = computeContext( def, line, column, startLine, startColumn ); + + QStringList scope; + scopeOfNode( def, scope ); + this_type = SimpleType( scope, getIncludeFiles() ); + + if ( scope.size() ) { /* + SimpleVariable var; + var.type = scope; + var.name = "this"; + ctx->add( var );*/ + //kdDebug(9007) << "add variable " << var.name << " with type " << var.type << endl; + } + + ExpressionInfo exp( expr ); + exp.t = ( ExpressionInfo::Type ) ( ExpressionInfo::NormalExpression | ExpressionInfo::TypeExpression ); + type = evaluateExpression( exp, ctx ); + } + } + } + + if ( !ctx ) + return ; + + if ( ch2 == "::" ) { + QString str = clearComments( expr ); + if ( !str.contains( '.' ) && !str.contains( "->" ) ) ///Necessary, because the expression may also be like user->BaseUser:: + isInstance = false; + } + + QString resolutionType = "(resolved)"; + if( !type->resolved() ) { + if( BuiltinTypes::isBuiltin( type.resultType ) ) { + resolutionType = "(builtin " + BuiltinTypes::comment( type.resultType ) + ")"; + } else { + resolutionType = "(unresolved)"; + } + } + + kdDebug( 9007 ) << "===========================> type is: " << type->fullNameChain() << resolutionType << endl; + kdDebug( 9007 ) << "===========================> word is: " << word << endl; + + if ( !showArguments ) { + QValueList entryList; + + if ( !type && this_type && ( expr.isEmpty() || expr.endsWith( ";" ) ) ) { + + bool alwaysIncludeNamespaces = cfg->alwaysIncludeNamespaces(); + { + SimpleType t = this_type; + ///First, all static data. + bool ready = false; + SafetyCounter cnt( 20 ); + int depth = 0; + while ( !ready & cnt ) { + if ( t->scope().isEmpty() ) { + ready = true; + } + if( !t->isNamespace() || invokedOnDemand || alwaysIncludeNamespaces ) + computeCompletionEntryList( t, entryList, t->scope(), false, depth ); + t = t->parent(); + depth++; + } + } + { + SimpleType t = this_type; + ///Now find non-static(if we have an instance) and global data + bool ready = false; + SafetyCounter cnt( 20 ); + int depth = 0; + bool first = true; + while ( !ready & cnt ) { + if ( t->scope().isEmpty() ) { + ready = true; + } + if ( ( (t->isNamespace() && invokedOnDemand) || alwaysIncludeNamespaces ) || ( first && isInstance ) ) + computeCompletionEntryList( t, entryList, t->scope(), t->isNamespace() ? true : isInstance, depth ); + t = t->parent(); + depth++; + first = false; + } + } + if( ctx ) computeCompletionEntryList( entryList, ctx, isInstance ); + } else if ( type->resolved() && expr.isEmpty() ) { + if( ctx ) computeCompletionEntryList( entryList, ctx, isInstance ); + + // if ( m_pSupport->codeCompletionConfig() ->includeGlobalFunctions() ) + // computeCompletionEntryList( type, entryList, QStringList(), false ); + + computeCompletionEntryList( type, entryList, QStringList(), false ); + + if ( this_type.scope().size() ) + computeCompletionEntryList( this_type, entryList, this_type.scope(), isInstance ); + computeCompletionEntryList( type, entryList, type->resolved() ->scope() , isInstance ); + } else if ( type->resolved() ) { + if ( type->resolved() ) + computeCompletionEntryList( type, entryList, type->resolved() ->scope() , isInstance ); + } + + QStringList trueMatches; + + if ( invokedOnDemand ) { + // find matching words + QValueList::Iterator it; + for ( it = entryList.begin(); it != entryList.end(); ++it ) { + if ( ( *it ).text.startsWith( word ) ) { + trueMatches << ( *it ).text; + + // if more than one entry matches, abort immediately + if ( trueMatches.size() > 1 ) + break; + } + } + } + + if ( invokedOnDemand && trueMatches.size() == 1 ) { + // erbsland: get the cursor position now, because m_ccLine and m_ccColumn + // are not set until the first typed char. + unsigned int nLine, nCol; + m_activeCursor->cursorPositionReal( &nLine, &nCol ); + // there is only one entry -> complete immediately + m_activeEditor->insertText( nLine, nCol, + trueMatches[ 0 ].right( trueMatches[ 0 ].length() - word.length() ) ); + } else if ( entryList.size() ) { + entryList = unique( entryList ); + qHeapSort( entryList ); + + m_bCompletionBoxShow = true; + ///Warning: the conversion is only possible because CodeCompletionEntry is binary compatible with KTextEditor::CompletionEntry, + ///never change that! + m_activeCompletion->showCompletionBox( *( ( QValueList* ) ( &entryList ) ), word.length() ); + } + } else { + QValueList signatureList; + + signatureList = computeSignatureList( type ); + + QString methodName = type->name(); + + ///Search for variables with ()-operator in the context + if ( ctx ) { + SimpleVariable var = ctx->findVariable( methodName ); + if ( !var.name.isEmpty() ) { + signatureList += computeSignatureList( ctx->container() ->locateDecType( var.type ) ); + } + } + + ///search for fitting methods/classes in the current context + SimpleType t = this_type; + bool ready = false; + SafetyCounter s( 20 ); + do { + if ( !t ) + ready = true; + TypeDesc d( methodName ); + d.setIncludeFiles( getIncludeFiles() ); + SimpleType method = t->typeOf( d ); + if ( method ) + signatureList += computeSignatureList( method ); + if ( t ) + t = t->parent(); + } while ( !ready && s ); + + if ( !signatureList.isEmpty() ) { + //signatureList = unique( signatureList ); + //qHeapSort( signatureList ); + m_bArgHintShow = true; + m_activeCompletion->showArgHint( unique( signatureList ), "()", "," ); + } + } + + delete( ctx ); + ctx = 0; + + if ( cfg->usePermanentCaching() ) { + conf.invalidate(); + m_cachedFromContext = contextItem; + } +} + + +QValueList CppCodeCompletion::computeSignatureList( EvaluationResult result ) { + SimpleType type = result; + + if ( result.expr.t == ExpressionInfo::TypeExpression ) { + TypeDesc d( result->name() ); + d.setIncludeFiles( getIncludeFiles() ); + type = type->typeOf( d, SimpleTypeImpl::MemberInfo::Function ); ///Compute the signature of the constructor + } + + QValueList retList; + SimpleTypeFunctionInterface* f = type->asFunction(); + SimpleType currType = type; + + if ( !f && !type->isNamespace() ) { + SimpleType t = type->typeOf( TypeDesc("operator ( )"), SimpleTypeImpl::MemberInfo::Function ); + + if ( t ) { + f = t->asFunction(); + currType = t; + } + } + + while ( f ) { + QStringList lst; + QString sig = buildSignature( currType.get() ); + QString comment = currType->comment(); + QStringList commentList; + if ( m_pSupport->codeCompletionConfig() ->showCommentWithArgumentHint() ) { + + if ( !comment.isEmpty() ) { + if ( sig.length() + comment.length() < 130 ) { + sig += ": \"" + currType->comment() + "\""; + } else { + commentList = formatComment( comment ); + } + } + } + + lst << sig; + lst += commentList; + + currType = f->nextFunction(); + + ///Maybe try to apply implicit template-params in this place + + retList << lst; + f = currType->asFunction(); + } + return retList; +} + +void CppCodeCompletion::synchronousParseReady( const QString& file, ParsedFilePointer unit ) { + if ( file == m_activeFileName ) { + computeRecoveryPoints( unit ); + } +} + +void CppCodeCompletion::slotCodeModelUpdated( const QString& fileName ) { + if ( fileName != m_activeFileName || !m_pSupport || !m_activeEditor ) + return ; + +// m_pSupport->mainWindow() ->statusBar() ->message( i18n( "Current file updated %1" ).arg( m_activeFileName ), 1000 ); + + computeRecoveryPointsLocked(); +} + +void CppCodeCompletion::slotFileParsed( const QString& fileName ) { + if ( fileName != m_activeFileName || !m_pSupport || !m_activeEditor ) + return ; + +// m_pSupport->mainWindow() ->statusBar() ->message( i18n( "Current file parsed %1 (cache emptied)" ).arg( m_activeFileName ), 1000 ); + + emptyCache(); ///The cache has to be emptied, because the code-model changed. @todo Better: Only refresh the code-model(tell all code-model-types to refresh themselves on demand) + + computeRecoveryPointsLocked(); +} + +void CppCodeCompletion::setupCodeInformationRepository( ) {} + +SimpleContext* CppCodeCompletion::computeContext( FunctionDefinitionAST * ast, int line, int col, int lineOffset, int colOffset ) { + kdDebug( 9007 ) << "CppCodeCompletion::computeContext() -- main" << endl; + + SimpleContext* ctx = new SimpleContext(); + + if ( ast && ast->initDeclarator() && ast->initDeclarator() ->declarator() ) { + DeclaratorAST * d = ast->initDeclarator() ->declarator(); + if ( ParameterDeclarationClauseAST * clause = d->parameterDeclarationClause() ) { + if ( ParameterDeclarationListAST * params = clause->parameterDeclarationList() ) { + QPtrList l( params->parameterList() ); + QPtrListIterator it( l ); + while ( it.current() ) { + ParameterDeclarationAST * param = it.current(); + ++it; + + SimpleVariable var; + + QStringList ptrList; + QPtrList ptrOpList = param->declarator() ->ptrOpList(); + QPtrList::iterator it = ptrOpList.begin(); + for ( ; it != ptrOpList.end(); ++it ) { + ptrList.append( ( *it ) ->text() ); + } + + var.ptrList = ptrList; + var.type = param->typeSpec() ->text() + ptrList.join( "" ); + var.name = declaratorToString( param->declarator(), QString::null, true ); + var.comment = param->comment(); + param->getStartPosition( &var.startLine, &var.startCol ); + param->getEndPosition( &var.endLine, &var.endCol ); + + if ( var.type ) { + ctx->add + ( var ); + //kdDebug(9007) << "add argument " << var.name << " with type " << var.type << endl; + } + } + } + } + } + + + if ( ast ) + computeContext( ctx, ast->functionBody(), line, col ); + + if ( ctx ) { + ctx->offset( lineOffset, colOffset ); + } + + return ctx; +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, StatementAST* stmt, int line, int col ) { + if ( !stmt ) + return ; + + switch ( stmt->nodeType() ) { + case NodeType_IfStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_WhileStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_DoStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_ForStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_SwitchStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_TryBlockStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_DeclarationStatement: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_StatementList: + computeContext( ctx, static_cast( stmt ), line, col ); + break; + case NodeType_ExpressionStatement: + break; + } +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, StatementListAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col, false, true ) ) + return ; + + QPtrList l( ast->statementList() ); + QPtrListIterator it( l ); + while ( it.current() ) { + StatementAST * stmt = it.current(); + ++it; + + computeContext( ctx, stmt, line, col ); + } +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, IfStatementAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col ) ) + return ; + + computeContext( ctx, ast->condition(), line, col ); + computeContext( ctx, ast->statement(), line, col ); + computeContext( ctx, ast->elseStatement(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, ForStatementAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col ) ) + return ; + + computeContext( ctx, ast->initStatement(), line, col ); + computeContext( ctx, ast->condition(), line, col ); + computeContext( ctx, ast->statement(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, DoStatementAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col ) ) + return ; + + //computeContext( ctx, ast->condition(), line, col ); + computeContext( ctx, ast->statement(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, WhileStatementAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col ) ) + return ; + + computeContext( ctx, ast->condition(), line, col ); + computeContext( ctx, ast->statement(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, SwitchStatementAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col ) ) + return ; + + computeContext( ctx, ast->condition(), line, col ); + computeContext( ctx, ast->statement(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, TryBlockStatementAST* ast, int line, int col ) { + if ( !inContextScope( ast, line, col ) ) + return ; + + computeContext( ctx, ast->statement(), line, col ); + computeContext( ctx, ast->catchStatementList(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, CatchStatementListAST* ast, int line, int col ) { + /*if ( !inContextScope( ast, line, col, false, true ) ) + return;*/ + + QPtrList l( ast->statementList() ); + QPtrListIterator it( l ); + while ( it.current() ) { + CatchStatementAST * stmt = it.current(); + ++it; + + computeContext( ctx, stmt, line, col ); + } +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, CatchStatementAST* ast, int line, int col ) { + if ( !ast->statement() ) + return ; + if ( !inContextScope( ast->statement(), line, col ) ) + return ; + + computeContext( ctx, ast->condition(), line, col ); + computeContext( ctx, ast->statement(), line, col ); +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, DeclarationStatementAST* ast, int line, int col ) { + ///@todo respect NodeType_Typedef + if( ast->declaration() && ast->declaration() ->nodeType() == NodeType_UsingDirective ) { + UsingDirectiveAST* usingDecl = static_cast( ast->declaration() ); + QString name; + if( usingDecl->name() ) { + name = usingDecl->name()->text(); + + if( !name.isNull() ) + ctx->addImport( QPair( "", name ) ); + } + } + + if( ast->declaration() && ast->declaration() ->nodeType() == NodeType_NamespaceAlias ) { + NamespaceAliasAST* namespaceAlias = static_cast( ast->declaration() ); + QString name; + + if( namespaceAlias ->namespaceName() && namespaceAlias->aliasName() ) { + ctx->addImport( QPair( namespaceAlias->namespaceName()->text(), namespaceAlias->aliasName()->text() ) ); + } + } + + if ( !ast->declaration() || ast->declaration() ->nodeType() != NodeType_SimpleDeclaration ) + return ; + + if ( !inContextScope( ast, line, col, true, false ) ) + return ; + + SimpleDeclarationAST* simpleDecl = static_cast( ast->declaration() ); + TypeSpecifierAST* typeSpec = simpleDecl->typeSpec(); + + InitDeclaratorListAST* initDeclListAST = simpleDecl->initDeclaratorList(); + if ( !initDeclListAST ) + return ; + + QPtrList l = initDeclListAST->initDeclaratorList(); + QPtrListIterator it( l ); + while ( it.current() ) { + DeclaratorAST * d = it.current() ->declarator(); + ++it; + + if ( d->declaratorId() ) { + SimpleVariable var; + + QStringList ptrList; + QPtrList ptrOpList = d->ptrOpList(); + QPtrList::iterator it = ptrOpList.begin(); + for ( ; it != ptrOpList.end(); ++it ) { + ptrList.append( ( *it ) ->text() ); + } + + for( int a = 0; a < d->arrayDimensionList().count(); a++ ) + ptrList.append("*"); + + var.ptrList = ptrList; + var.type = typeSpec->text() + ptrList.join( "" ); + var.name = toSimpleName( d->declaratorId() ); + var.comment = d->comment(); + d->getStartPosition( &var.startLine, &var.startCol ); + d->getEndPosition( &var.endLine, &var.endCol ); + + ctx->add + ( var ); + //kdDebug(9007) << "add variable " << var.name << " with type " << var.type << endl; + } + } +} + +void CppCodeCompletion::computeContext( SimpleContext*& ctx, ConditionAST* ast, int line, int col ) { + if ( !ast->typeSpec() || !ast->declarator() || !ast->declarator() ->declaratorId() ) + return ; + + if ( !inContextScope( ast, line, col, true, false ) ) + return ; + + SimpleVariable var; + + QStringList ptrList; + QPtrList ptrOpList = ast->declarator() ->ptrOpList(); + QPtrList::iterator it = ptrOpList.begin(); + for ( ; it != ptrOpList.end(); ++it ) { + ptrList.append( ( *it ) ->text() ); + } + + var.ptrList = ptrList; + var.type = ast->typeSpec() ->text() + ptrList.join( "" ); + var.name = toSimpleName( ast->declarator() ->declaratorId() ); + var.comment = ast->comment(); + ast->getStartPosition( &var.startLine, &var.startCol ); + ast->getEndPosition( &var.endLine, &var.endCol ); + ctx->add + ( var ); + //kdDebug(9007) << "add variable " << var.name << " with type " << var.type << endl; +} + +bool CppCodeCompletion::inContextScope( AST* ast, int line, int col, bool checkStart, bool checkEnd ) { + int startLine, startColumn; + int endLine, endColumn; + ast->getStartPosition( &startLine, &startColumn ); + ast->getEndPosition( &endLine, &endColumn ); + + // kdDebug(9007) << k_funcinfo << endl; + // kdDebug(9007) << "current char line: " << line << " col: " << col << endl; + // + // kdDebug(9007) << nodeTypeToString( ast->nodeType() ) + // << " start line: " << startLine + // << " col: " << startColumn << endl; + // kdDebug(9007) << nodeTypeToString( ast->nodeType() ) + // << " end line: " << endLine + // << " col: " << endColumn << endl; + + bool start = line > startLine || ( line == startLine && col >= startColumn ); + bool end = line < endLine || ( line == endLine && col <= endColumn ); + + if ( checkStart && checkEnd ) + return start && end; + else if ( checkStart ) + return start; + else if ( checkEnd ) + return end; + + return false; +} + +FunctionDefinitionAST * CppCodeCompletion::functionDefinition( AST* node ) { + + while ( node ) { + if ( node->nodeType() == NodeType_FunctionDefinition ) + return static_cast( node ); + node = node->parent(); + } + return 0; +} + +QString CppCodeCompletion::getText( int startLine, int startColumn, int endLine, int endColumn, int omitLine ) { + if ( startLine == endLine ) { + QString textLine = m_activeEditor->textLine( startLine ); + return textLine.mid( startColumn, endColumn - startColumn ); + } + + QStringList contents; + + for ( int line = startLine; line <= endLine; ++line ) { + if ( line == omitLine ) + continue; + + QString textLine = m_activeEditor->textLine( line ); + + if ( line == startLine ) + textLine = textLine.mid( startColumn ); + if ( line == endLine ) + textLine = textLine.left( endColumn ); + + contents << textLine; + } + return contents.join( "\n" ); +} + +void CppCodeCompletion::computeRecoveryPointsLocked() { + m_pSupport->backgroundParser() ->lock () + ; + ParsedFilePointer unit = m_pSupport->backgroundParser() ->translationUnit( m_activeFileName ); + computeRecoveryPoints( unit ); + m_pSupport->backgroundParser() ->unlock(); +} + +void CppCodeCompletion::computeRecoveryPoints( ParsedFilePointer unit ) { + if ( m_blockForKeyword ) + return ; + + kdDebug( 9007 ) << "CppCodeCompletion::computeRecoveryPoints" << endl; + + d->recoveryPoints.clear(); + if ( !unit ) + return ; + + ComputeRecoveryPoints walker( d->recoveryPoints ); + walker.parseTranslationUnit( *unit ); +} + +QString codeModelAccessToString( CodeModelItem::Access access ) { + switch ( access ) { + case CodeModelItem::Public: + return "public"; + case CodeModelItem::Protected: + return "protected"; + case CodeModelItem::Private: + return "private"; + default: + return "unknown"; + } +} + +#define MAXCOMMENTCOLUMNS 45 + + +QString CppCodeCompletion::commentFromItem( const SimpleType& parent, const ItemDom& item ) { + --m_maxComments; + static QString maxReached = " "; + if( m_maxComments < 0 ) { + return maxReached; + } + QString ret; + int line, col; + item->getStartPosition( &line, &col ); + + + if ( !parent->scope().isEmpty() ) { + ret += "Container: " + parent->fullTypeResolvedWithScope(); + } + + if ( item->isEnum() ) { + ret += "\nKind: Enum"; + ret += "\nValues:"; + const EnumModel* en = dynamic_cast( item.data() ); + if ( en ) { + EnumeratorList values = en->enumeratorList(); + for ( EnumeratorList::iterator it = values.begin(); it != values.end(); ++it ) { + ret += "\n " + ( *it ) ->name(); + if ( !( *it ) ->value().isEmpty() ) { + ret + " = " + ( *it ) ->value(); + } + } + + ret += "\n\nAccess: " + codeModelAccessToString( ( CodeModelItem::Access ) en->access() ); + } else {} + + } + + if ( item->isFunction() || item->isFunctionDefinition() ) { + const FunctionModel * f = dynamic_cast( item.data() ); + ret += "\nKind: Function"; + if ( f ) { + QString state; + if ( f->isStatic() ) + state += "static "; + if ( f->isVirtual() ) + state += "virtual "; + if ( f->isAbstract() ) + state += "abstract "; + //if( f->isTemplateable() ) state += "template "; + if ( f->isConstant() ) + state += "const "; + if ( f->isSlot() ) + state += "slot "; + if ( f->isSignal() ) + state += "signal "; + + if ( !state.isEmpty() ) + ret += "\nModifiers: " + state; + + ret += "\nAccess: " + codeModelAccessToString( ( CodeModelItem::Access ) f->access() ); + } + } + + if ( item->isEnumerator() ) { + const EnumeratorModel * f = dynamic_cast( item.data() ); + ret += "\nKind: Enumerator"; + if ( f ) { + if ( !f->value().isEmpty() ) + ret += "\nValue: " + f->value(); + + //ret += "\nAccess: " + codeModelAccessToString( f->() ); + } + } else { + if ( item->isVariable() ) { + const VariableModel * f = dynamic_cast( item.data() ); + if ( f ) { + if ( !f->isEnumeratorVariable() ) { + ret += "\nKind: Variable"; + if ( f->isStatic() ) + ret += "\nModifiers: static"; + } else { + ret += "\nKind: Enumerator"; + ret += "\nEnum: " + f->type(); + } + + ret += "\nAccess: " + codeModelAccessToString( ( CodeModelItem::Access ) f->access() ); + } + } + } + + if ( item->isTypeAlias() ) { + const TypeAliasModel * t = dynamic_cast( item.data() ); + ret += "\nKind: Typedef"; + if ( t ) { + ret += "\nType: " + t->type(); + LocateResult r = parent->locateDecType( t->type() ); + if ( r.desc().resolved() ) + ret += "\nResolved type: " + r.desc().resolved() ->fullTypeResolvedWithScope(); + else + ret += "\nPartially resolved type: " + r.desc().fullNameChain(); + } + } + + if ( item->isClass() ) { + ret += "\nKind: Class"; + } + + ret += QString( "\nFile: %1\nLine: %2 Column: %3" ).arg( prepareTextForMenu( item->fileName(), 3, MAXCOMMENTCOLUMNS ).join( "\n" ) ).arg( line ).arg( col ); + if ( !item->comment().isEmpty() ) + ret += "\n\n" + prepareTextForMenu( item->comment(), 3, MAXCOMMENTCOLUMNS ).join( "\n" ); + return ret; +} + +QString CppCodeCompletion::commentFromTag( const SimpleType& parent, Tag& tag ) { + --m_maxComments; + static QString maxReached = " "; + if( m_maxComments < 0 ) { + return maxReached; + } + + int line, col; + tag.getStartPosition( &line, &col ); + QString ret; // = tag.comment(); + + if ( !parent->scope().isEmpty() ) { + ret += "Container: " + parent->fullTypeResolvedWithScope(); + } + /* + if( tag.kind() == Tag::Kind_Enum ) { + ret += "\nKind: Enum"; + ret += "\nValues:"; + EnumModel* en = dynamic_cast( item.data() ); + if( en ) { + EnumeratorList values =en->enumeratorList(); + for( EnumeratorList::iterator it = values.begin(); it != values.end(); ++it ) + { + ret += "\n " + (*it)->name(); + if( !(*it)->value().isEmpty() ) { + ret + " = " + (*it)->value(); + } + } + + ret += "\n\nAccess: " + codeModelAccessToString( (CodeModelItem::Access)en->access() ); + } else { + } + }*/ + + if ( tag.kind() == Tag::Kind_Function || tag.kind() == Tag::Kind_FunctionDeclaration ) { + CppFunction function( tag ); + + ret += "\nKind: Function"; + + QString state; + if ( function.isStatic() ) + state += "static "; + if ( function.isVirtual() ) + state += "virtual "; + //if( function.isVolatile() ) state += "volatile "; + if ( function.isConst() ) + state += "const "; + if ( function.isSlot() ) + state += "slot "; + if ( function.isSignal() ) + state += "signal "; + if ( !state.isEmpty() ) + ret += "\nModifiers: " + state; + + ret += "\nAccess: " + TagUtils::accessToString( function.access() ); + } + + /*if( item->isEnumerator() ) { + EnumeratorModel* f = dynamic_cast( item.data() ); + ret += "\nKind: Enumerator"; + if( f ) { + if( !f->value().isEmpty() ) + ret += "\nValue: " + f->value(); + + //ret += "\nAccess: " + codeModelAccessToString( f->() ); + } + } else { + if( item->isVariable() ) { + VariableModel* f = dynamic_cast( item.data() ); + ret += "\nKind: Variable"; + if( f ) { + ret += "\nAccess: " + codeModelAccessToString( (CodeModelItem::Access)f->access() ); + } + } + }*/ + + if ( tag.kind() == Tag::Kind_Enum ) { + CppVariable var( tag ); + + ret += "\nKind: Enum"; + } + + if ( tag.kind() == Tag::Kind_Enumerator ) { + CppVariable var( tag ); + + ret += "\nKind: Enumerator"; + if ( tag.hasAttribute( "enum" ) && tag.attribute( "enum" ).asString() != "int" ) + ret += "\nEnum: " + tag.attribute( "enum" ).asString(); + } + + if ( tag.kind() == Tag::Kind_Variable ) { + CppVariable var( tag ); + + ret += "\nKind: Variable"; + if ( var.isStatic() ) + ret += "\nModifiers: static"; + ret += "\nAccess: " + TagUtils::accessToString( var.access() ); + } + + if ( tag.kind() == Tag::Kind_Typedef ) { + ret += "\nKind: Typedef"; + ret += "\nType: " + tagType( tag ); + LocateResult r = parent->locateDecType( tagType( tag ) ); + if ( r.desc().resolved() ) + ret += "\nResolved type: " + r.desc().resolved() ->fullTypeResolvedWithScope(); + else + ret += "\nPartially resolved type: " + r.desc().fullNameChain(); + } + + if ( tag.kind() == Tag::Kind_Class ) { + ret += "\nKind: Class"; + } + if ( tag.kind() == Tag::Kind_Struct ) { + ret += "\nKind: Struct"; + } + + ret += QString( "\nFile: %1\nLine: %2 Column: %3" ).arg( prepareTextForMenu( tag.fileName(), 3, MAXCOMMENTCOLUMNS ).join( "\n" ) ).arg( line ).arg( col ); + if ( !tag.comment().isEmpty() ) { + ret += "\n\n" + prepareTextForMenu( tag.comment(), 20, MAXCOMMENTCOLUMNS ).join( "\n" ); + } + return ret; +} + +void CppCodeCompletion::computeCompletionEntryList( SimpleType typeR, QValueList& entryList, const QStringList& type, SimpleTypeNamespace* ns, std::set& ignore, bool isInstance, int depth ) { + HashedString myName = HashedString( ns->scope().join("::") +"%"+typeid(*ns).name() ); + if ( ignore.find( myName ) != ignore.end() ) + return ; + ignore.insert( myName ); + SimpleTypeNamespace::SlaveList slaves = ns->getSlaves( getIncludeFiles() ); + for ( SimpleTypeNamespace::SlaveList::iterator it = slaves.begin(); it != slaves.end(); ++it ) { + SimpleTypeNamespace* nns = dynamic_cast( (*it).first.first.resolved().data() ); + if ( !nns ) { + if( ( *it ).first.first.resolved() ) computeCompletionEntryList( SimpleType((*it).first.first.resolved()), entryList, ( *it ).first.first.resolved()->scope(), isInstance, depth ); + } else { + if( ( *it ).first.first.resolved() ) computeCompletionEntryList( SimpleType(( *it ).first.first.resolved()), entryList, ( *it ).first.first.resolved()->scope(), nns, ignore, isInstance, depth ); + } + } +} + +void CppCodeCompletion::computeCompletionEntryList( SimpleType typeR, QValueList< CodeCompletionEntry > & entryList, const QStringList & type, bool isInstance, int depth ) { + dbgState.setState( disableVerboseForCompletionList ); + + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + SimpleTypeImpl* m = &( *typeR ) ; + + if ( SimpleTypeNamespace * ns = dynamic_cast( m ) ) { + std::set ignore; + computeCompletionEntryList( typeR, entryList, type, ns, ignore, isInstance, depth ); + } else if ( dynamic_cast( m ) ) { + ItemDom item = ( dynamic_cast( m ) ) ->item(); + if ( item ) + if ( ClassModel * mod = dynamic_cast ( &( *item ) ) ) + computeCompletionEntryList( typeR, entryList, ClassDom( mod ) , isInstance, depth ); + } else { + QValueList args; + QValueList tags; + + QStringList ts = type; + if( !ts.isEmpty() ) { + QString s = ts.back() + typeR->specialization(); + ts.pop_back(); + ts.push_back( s ); + } + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_FunctionDeclaration ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Variable ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + + if ( !isInstance ) { + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Enumerator ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Enum ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Typedef ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Class ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Struct ) + << Catalog::QueryArgument( "scope", ts ); + tags = m_repository->query( args ); + computeCompletionEntryList( typeR, entryList, tags, isInstance, depth ); + } + + args.clear(); + args << Catalog::QueryArgument( "kind", Tag::Kind_Base_class ); + QString fullname = type.join( "::" )+typeR->specialization(); + /* if( fullname.length() >=2 ) + args << Catalog::QueryArgument( "prefix", fullname.left(2) );*/ + args << Catalog::QueryArgument( "name", fullname ); + + + QValueList parents = typeR->getBases( ); + for ( QValueList::Iterator it = parents.begin(); it != parents.end(); ++it ) { + if ( !( *it ) ->resolved() ) + continue; + SimpleType tp = SimpleType( ( *it ) ->resolved() ); + if ( tp ) + computeCompletionEntryList( tp, entryList, tp.scope(), isInstance, depth + 1 ); + } + } + dbgState.setState( true ); +} + + +void CppCodeCompletion::computeCompletionEntryList( SimpleType type, QValueList< CodeCompletionEntry > & entryList, QValueList< Tag > & tags, bool isInstance, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + QString className = type->desc().name(); + + bool isNs = type->isNamespace(); + + CompTypeProcessor proc( type, m_pSupport->codeCompletionConfig() ->processFunctionArguments() && type->usingTemplates() ); + bool resolve = m_pSupport->codeCompletionConfig() ->processPrimaryTypes() && type->usingTemplates(); + + QValueList::Iterator it = tags.begin(); + while ( it != tags.end() ) { + Tag & tag = *it; + ++it; + + int subSorting = 0; + + if ( tag.name().isEmpty() ) { + continue; + } else if ( m_completionMode != NormalCompletion ) { + if ( tag.kind() != Tag::Kind_FunctionDeclaration ) + continue; + } + + if ( tag.kind() == Tag::Kind_Function || tag.kind() == Tag::Kind_FunctionDeclaration ) { + CppFunction info( tag ); + + if ( m_completionMode == SlotCompletion && !info.isSlot() ) + continue; + else if ( m_completionMode == SignalCompletion && !info.isSignal() ) + continue; + else if ( m_completionMode == VirtualDeclCompletion && !info.isVirtual() ) + continue; + + if ( info.isConst() ) + subSorting = 1; + if ( info.isSlot() ) + subSorting = 2; + if ( info.isSignal() ) + subSorting = 3; + if ( info.isVirtual() ) + subSorting = 4; + if ( info.isStatic() ) + subSorting = 5; + } + + CodeCompletionEntry e = CodeInformationRepository::toEntry( tag, m_completionMode, &proc ); + + TagFlags fl; + fl.flags = tag.flags(); + int num = fl.data.access; + + QString str = "public"; + if ( num != 0 ) { + str = TagUtils::accessToString( num ); + } else { + num = 0; + } + // 0 = protected, 1 = public, 2 = private + + if ( str == "public" ) + num = 0; + else if ( str == "protected" ) + num = 1; + else if ( str == "private" ) + num = 2; + + int sortPosition = 0; + + switch ( tag.kind() ) { + case Tag::Kind_Enum: + sortPosition = 3; + if ( isInstance ) + continue; + break; + case Tag::Kind_Enumerator: + sortPosition = 4; + if ( isInstance ) + continue; + break; + case Tag::Kind_Struct: + case Tag::Kind_Union: + case Tag::Kind_Class: + sortPosition = 5; + if ( isInstance ) + continue; + break; + case Tag::Kind_VariableDeclaration: + case Tag::Kind_Variable: + sortPosition = 2; + if ( !isInstance && !CppVariable( tag ).isStatic() && !isNs ) + continue; + break; + case Tag::Kind_FunctionDeclaration: + case Tag::Kind_Function: + sortPosition = 1; + if ( !isInstance && !CppFunction( tag ).isStatic() && !isNs ) + continue; + break; + case Tag::Kind_Typedef: + sortPosition = 6; + if ( isInstance ) + continue; + break; + } + + e.userdata = QString( "%1%2%3%4%5" ).arg( num ).arg( depth ).arg( className ).arg( sortPosition ).arg( subSorting ); + + if ( m_completionMode != SignalCompletion ) { + if ( !type->isNamespace() ) { + if ( num == 1 ) + e.postfix += "; (protected)"; // in " + proc.parentType() + ")"; + if ( num == 2 ) + e.postfix += "; (private)"; // in " + proc.parentType() + ")"; + } + } + + + QString prefix = tagType( tag ).stripWhiteSpace(); + + if ( tag.kind() == Tag::Kind_Enumerator && tag.hasAttribute( "enum" ) ) { + prefix = tag.attribute( "enum" ).asString(); + e.userdata += prefix; ///Sort enumerators together + } else if ( tag.kind() == Tag::Kind_Enum ) { + prefix = "enum"; + } else { + + if ( tag.kind() == Tag::Kind_FunctionDeclaration || tag.kind() == Tag::Kind_Function || tag.kind() == Tag::Kind_Variable || tag.kind() == Tag::Kind_Typedef ) { + if ( !prefix.isEmpty() && resolve ) { + LocateResult et = type->locateDecType( prefix ); + + if ( et ) + prefix = et->fullNameChain(); + } + } + + if ( tag.kind() == Tag::Kind_FunctionDeclaration || tag.kind() == Tag::Kind_Function ) { + if ( prefix.isEmpty() ) { + if ( tag.name() == className ) + prefix = constructorPrefix; + else if ( tag.name().startsWith( "~" ) ) + prefix = destructorPrefix; + } + } + + if ( tag.kind() == Tag::Kind_Class || tag.kind() == Tag::Kind_Function ) + prefix = ""; + } + + e.comment = commentFromTag( type, tag ); + + if ( e.prefix.isEmpty() ) + e.prefix = prefix; + else + e.prefix += " " + prefix; + + e.prefix = e.prefix.stripWhiteSpace(); + e.prefix = stringMult( depth, " " ) + e.prefix.stripWhiteSpace(); + + e.text = e.text.stripWhiteSpace(); + + if ( str != "private" ) + entryList << e; + } +} + +void CppCodeCompletion::computeCompletionEntryList( SimpleType type, QValueList< CodeCompletionEntry > & entryList, ClassDom klass, bool isInstance, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + + computeCompletionEntryList( type, entryList, klass->functionList(), isInstance, depth ); + + ///Find all function-definitions that have no functions. Those may be inlined functions and need to be treated too. + FunctionDefinitionList definitions = klass->functionDefinitionList(); + FunctionList l; + + QStringList classScope = klass->scope(); + classScope << klass->name(); + + for ( FunctionDefinitionList::iterator it = definitions.begin(); it != definitions.end(); ++it ) { + FunctionList fl = klass->functionByName( ( *it ) ->name() ); + + ArgumentList args = ( *it ) ->argumentList(); + + if ( !l.isEmpty() ) { + bool matched = false; + for ( FunctionList::iterator it = fl.begin(); it != fl.end(); ++it ) { + ArgumentList fArgs = ( *it ) ->argumentList(); + if ( fArgs.count() != args.count() ) + continue; + ArgumentList::iterator it = args.begin(); + ArgumentList::iterator it2 = fArgs.begin(); + bool hit = true; + while ( it != args.end() ) { + if ( ( *it ) ->type() != ( *it2 ) ->type() ) { + hit = false; + break; + } + ++it; + ++it2; + } + if ( hit ) { + matched = true; + break; + } + + } + + if ( matched ) + continue; + } + + ///The function-definition belongs to some sub-class + if( (*it)->scope() != classScope && !(*it)->scope().isEmpty() ) continue; + l << ( FunctionModel* ) ( *it ).data(); + } + + if ( !l.isEmpty() ) + computeCompletionEntryList( type, entryList, l, isInstance, depth ); + + if ( m_completionMode == NormalCompletion ) + computeCompletionEntryList( type, entryList, klass->variableList(), isInstance, depth ); + + if ( !isInstance ) { + computeCompletionEntryList( klass->name(), type, entryList, klass->classList(), isInstance, depth ); + computeCompletionEntryList( klass->name(), type, entryList, klass->typeAliasList(), isInstance, depth ); + } + + QValueList parents = type->getBases( ); + + for ( QValueList::Iterator it = parents.begin(); it != parents.end(); ++it ) { + if ( !( *it ) ->resolved() ) + continue; + + SimpleTypeImpl* i = ( *it ) ->resolved(); + computeCompletionEntryList( i, entryList, i->scope(), isInstance, depth + 1 ); + /* + SimpleTypeCodeModel* m = dynamic_cast ( i ); + if ( m ) { + ItemDom item = m->item(); + ClassModel* kl = dynamic_cast ( &( *item ) ); + if ( kl ) { + computeCompletionEntryList( SimpleType( ( *it ) ->resolved() ), entryList, ClassDom ( kl ), isInstance, depth + 1 ); + } + }*/ + } +} + +void CppCodeCompletion::computeCompletionEntryList( SimpleType type, QValueList< CodeCompletionEntry > & entryList, NamespaceDom scope, bool isInstance, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + + CppCodeCompletionConfig * cfg = m_pSupport->codeCompletionConfig(); + + computeCompletionEntryList( type, entryList, ClassDom( scope.data() ), isInstance, depth ); + if ( !isInstance ) + computeCompletionEntryList( type, entryList, scope->namespaceList(), isInstance, depth ); +} + +void CppCodeCompletion::computeCompletionEntryList( QString parent, SimpleType type, QValueList< CodeCompletionEntry > & entryList, const ClassList & lst, bool isInstance, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + + + ClassList::ConstIterator it = lst.begin(); + while ( it != lst.end() ) { + ClassDom klass = *it; + ++it; + + CodeCompletionEntry entry; + entry.prefix = "class"; + entry.prefix = stringMult( depth, " " ) + entry.prefix.stripWhiteSpace(); + entry.text = klass->name(); + entry.comment = commentFromItem( type, klass.data() ); + if ( isInstance ) + continue; + + entry.userdata = QString( "%1%2%3%4%5" ).arg( CodeModelItem::Public ).arg( depth ).arg( parent ).arg( 6 ); + + entryList << entry; + + + // if ( cfg->includeTypes() ) + /*{ + computeCompletionEntryList( type, entryList, klass->classList(), isInstance, depth ); + }*/ + } +} + +void CppCodeCompletion::computeCompletionEntryList( QString parent, SimpleType type, QValueList< CodeCompletionEntry > & entryList, const TypeAliasList & lst, bool isInstance, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + + + TypeAliasList::ConstIterator it = lst.begin(); + while ( it != lst.end() ) { + TypeAliasDom klass = *it; + ++it; + + CodeCompletionEntry entry; + + LocateResult et = type->locateDecType( klass->type() ); + if ( et ) + entry.prefix = "typedef " + et->fullNameChain(); + else + entry.prefix = "typedef " + klass->type(); + + entry.prefix = stringMult( depth, " " ) + entry.prefix.stripWhiteSpace(); + entry.text = klass->name(); + entry.comment = commentFromItem( type, klass.data() ); + entry.userdata = QString( "%1%2%3%4%5" ).arg( CodeModelItem::Public ).arg( depth ).arg( parent ).arg( 5 ); + entryList << entry; + } +} +void CppCodeCompletion::computeCompletionEntryList( SimpleType type, QValueList< CodeCompletionEntry > & entryList, const NamespaceList & lst, bool /*isInstance*/, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + + NamespaceList::ConstIterator it = lst.begin(); + while ( it != lst.end() ) { + NamespaceDom scope = *it; + ++it; + + CodeCompletionEntry entry; + entry.prefix = "namespace"; + entry.prefix = stringMult( depth, " " ) + entry.prefix.stripWhiteSpace(); + entry.text = scope->name(); + entry.comment = commentFromItem( type, scope.data() ); + entryList << entry; + } +} + +void CppCodeCompletion::computeCompletionEntryList( SimpleType type, QValueList< CodeCompletionEntry > & entryList, const FunctionList & methods, bool isInstance, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + QString className = type->desc().name(); + bool isNs = type->isNamespace(); + + bool resolve = type->usingTemplates() && m_pSupport->codeCompletionConfig() ->processPrimaryTypes(); + + CompTypeProcessor proc( type, m_pSupport->codeCompletionConfig() ->processFunctionArguments() && type->usingTemplates() ); + + FunctionList::ConstIterator it = methods.begin(); + while ( it != methods.end() ) { + FunctionDom meth = *it; + ++it; + + if ( isInstance && meth->isStatic() ) + continue; + else if ( m_completionMode == SignalCompletion && !meth->isSignal() ) + continue; + else if ( m_completionMode == SlotCompletion && !meth->isSlot() ) + continue; + else if ( m_completionMode == VirtualDeclCompletion && !meth->isVirtual() ) + continue; + + if ( !isInstance && !meth->isStatic() && !isNs ) + continue; + + CodeCompletionEntry entry; + + entry.comment = commentFromItem( type, model_cast( meth ) ); + + if ( ! resolve ) { + entry.prefix = meth->resultType(); + } else { + QString tt = meth->resultType(); + LocateResult t = type->locateDecType( tt ); + if ( t ) { + entry.prefix = t->fullNameChain(); + } else + entry.prefix = meth->resultType(); + } + + if ( entry.prefix.isEmpty() && meth->name() == className ) + entry.prefix = constructorPrefix; + if ( entry.prefix.isEmpty() && meth->name().startsWith( "~" ) ) + entry.prefix = destructorPrefix; + + entry.prefix = stringMult( depth, " " ) + entry.prefix.stripWhiteSpace(); + QString text; + + ArgumentList args = meth->argumentList(); + ArgumentList::Iterator argIt = args.begin(); + /* + if ( m_completionMode == VirtualDeclCompletion ) + { + //Ideally the type info would be a entry.prefix, but we need them to be + //inserted upon completion so they have to be part of entry.text + entry.text = meth->resultType(); + entry.text += " "; + entry.text += meth->name(); + } + else*/ + entry.text = meth->name(); + + entry.text += formattedOpeningParenthesis( args.size() == 0 ); + + while ( argIt != args.end() ) { + ArgumentDom arg = *argIt; + ++argIt; + + text += proc.processType( arg->type() ); + if ( m_completionMode == NormalCompletion || + m_completionMode == VirtualDeclCompletion ) + text += QString( " " ) + arg->name(); + + if ( argIt != args.end() ) + text += ", "; + } + + if ( args.size() == 0 ) { + entry.text += formattedClosingParenthesis( true ); + } else { + text += formattedClosingParenthesis( false ); + } + + int subSorting = 0; + if ( meth->isConstant() ) + subSorting = 1; + if ( meth->isSlot() ) + subSorting = 2; + if ( meth->isSignal() ) + subSorting = 3; + if ( meth->isVirtual() ) + subSorting = 4; + if ( meth->isStatic() ) + subSorting = 5; + + entry.userdata += QString( "%1%2%3%4%5" ).arg( meth->access() ).arg( depth ).arg( className ).arg( 1 ).arg( subSorting ); + + if ( m_completionMode == VirtualDeclCompletion ) + entry.text += text + ";"; + if ( m_completionMode != NormalCompletion ) + entry.text += text; + else + entry.postfix = text; + + if ( meth->isConstant() ) + entry.postfix += " const"; + if ( m_completionMode != SignalCompletion ) { + if ( !type->isNamespace() ) { + if ( meth->access() == CodeModelItem::Protected ) + entry.postfix += "; (protected)"; // in " + type->fullType() + ")"; + if ( meth->access() == CodeModelItem::Private ) + entry.postfix += "; (private)"; // in " + type->fullType() + ")"; + } + } + + entry.text = entry.text.stripWhiteSpace(); + + entryList << entry; + } +} + +void CppCodeCompletion::computeCompletionEntryList( SimpleType type, QValueList< CodeCompletionEntry > & entryList, const VariableList & attributes, bool isInstance, int depth ) { + Debug d( "#cel#" ); + QString className = type->desc().name(); + bool isNs = type->isNamespace(); + + if ( !safetyCounter || !d ) + return ; + + if ( m_completionMode != NormalCompletion ) + return ; + bool resolve = type->usingTemplates() && m_pSupport->codeCompletionConfig() ->processPrimaryTypes(); + + VariableList::ConstIterator it = attributes.begin(); + while ( it != attributes.end() ) { + VariableDom attr = *it; + ++it; + + if ( isInstance && attr->isStatic() ) + continue; + if ( !isInstance && !attr->isStatic() && !isNs ) + continue; + + CodeCompletionEntry entry; + entry.text = attr->name(); + entry.comment = commentFromItem( type, model_cast( attr ) ); + entry.userdata += QString( "%1%2%3%4" ).arg( attr->access() ).arg( depth ).arg( className ).arg( 2 ); + + + if ( !attr->isEnumeratorVariable() ) { + if ( ! resolve ) { + entry.prefix = attr->type(); + } else { + QString tt = attr->type(); + LocateResult t = type->locateDecType( tt ); + //SimpleType t = type->typeOf( attr->name() ); + if ( t ) + entry.prefix = t->fullNameChain(); + else + entry.prefix = attr->type(); + } + } else { + entry.prefix = attr->type(); + entry.userdata += attr->type(); ///Sort enumerators by their enum + } + if ( attr->access() == CodeModelItem::Protected ) + entry.postfix += "; (protected)"; // in " + type->fullType() + ")"; + if ( attr->access() == CodeModelItem::Private ) + entry.postfix += "; (private)"; // in " + type->fullType() + ")"; + + entry.prefix = stringMult( depth, " " ) + entry.prefix.stripWhiteSpace(); + + entryList << entry; + } +} + +void CppCodeCompletion::computeCompletionEntryList( QValueList< CodeCompletionEntry > & entryList, SimpleContext * ctx, bool /*isInstance*/, int depth ) { + Debug d( "#cel#" ); + if ( !safetyCounter || !d ) + return ; + + while ( ctx ) { + QValueList vars = ctx->vars(); + QValueList::ConstIterator it = vars.begin(); + while ( it != vars.end() ) { + const SimpleVariable & var = *it; + ++it; + + CodeCompletionEntry entry; + entry.prefix = var.type.fullNameChain(); + entry.text = var.name; + entry.userdata = "000"; + entry.comment = "Local variable"; + entryList << entry; + + } + ctx = ctx->prev(); + } + +} + +EvaluationResult CppCodeCompletion::evaluateExpression( ExpressionInfo expr, SimpleContext* ctx ) { + safetyCounter.init(); + + //d->classNameList = typeNameList( m_pSupport->codeModel() ); + + CppEvaluation::ExpressionEvaluation obj( this, expr, AllOperators, getIncludeFiles(), ctx ); + + EvaluationResult res; + res = obj.evaluate(); + + QString resolutionType = "(resolved)"; + if( !res->resolved() ) { + if( BuiltinTypes::isBuiltin( res.resultType ) ) { + resolutionType = "(builtin " + BuiltinTypes::comment( res.resultType ) + ")"; + } else { + resolutionType = "(unresolved)"; + } + } + + addStatusText( i18n( "Type of \"%1\" is \"%2\", %3" ).arg( expr.expr() ).arg( res->fullNameChain() ).arg( resolutionType ), 5000 ); + + return res; +} + +void CppCodeCompletion::computeFileEntryList( ) { + m_fileEntryList.clear(); + + QStringList fileList = m_pSupport->project() ->allFiles(); + for ( QStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it ) { + if ( !m_pSupport->isHeader( *it ) ) + continue; + + CodeCompletionEntry entry; + entry.text = QFileInfo( *it ).fileName(); + + m_fileEntryList.push_back( entry ); + } + + m_fileEntryList = unique( m_fileEntryList ); +} + +HashedStringSet CppCodeCompletion::getIncludeFiles( const QString& fi ) { + QString file = fi; + if( file.isEmpty() ) + file = m_activeFileName; + + FileDom f = m_pSupport->codeModel() ->fileByName( file ); + if( f ) { + ParseResultPointer p = f->parseResult(); + if( p ) { + ParsedFilePointer pp = dynamic_cast( p.data() ); + if( pp ) { + return pp->includeFiles(); + } + } + } + return HashedStringSet(); +} + +void CppCodeCompletion::slotJumpToDeclCursorContext() +{ + kdDebug(9007) << k_funcinfo << endl; + jumpCursorContext( Declaration ); +} + +void CppCodeCompletion::slotJumpToDefCursorContext() +{ + kdDebug(9007) << k_funcinfo << endl; + jumpCursorContext( Definition ); +} + +void CppCodeCompletion::jumpCursorContext( FunctionType f ) +{ + if ( !m_activeCursor ) return; + + SimpleTypeConfiguration conf( m_activeFileName ); + + unsigned int line; + unsigned int column; + m_activeCursor->cursorPositionReal( &line, &column ); + + EvaluationResult result = evaluateExpressionAt( line, column, conf ); + + // Determine the declaration info based on the type of item we are dealing with. + DeclarationInfo d; + + QString includeFileName, includeFilePath; + bool unused; + + if ( result.isMacro ) { + d.name = result.macro.name(); + d.file = result.macro.fileName(); + d.startLine = d.endLine = result.macro.line(); + d.startCol = d.endCol = result.macro.column(); + } else if ( getIncludeInfo( line, includeFileName, includeFilePath, unused ) ) { + d.name = includeFileName; + d.file = includeFilePath; + } else { + d = result.sourceVariable; + } + if ( !d ) { + LocateResult type = result.resultType; + if ( type && type->resolved() ) { + // Is it a namespace? + if ( type->resolved()->isNamespace() ) { + SimpleTypeCachedNamespace * ns = dynamic_cast( type->resolved().data() ); + if ( ns ) { + SimpleTypeNamespace::SlaveList slaves = ns->getSlaves( getIncludeFiles() ); + if ( slaves.begin() != slaves.end() ) { + SimpleTypeCachedCodeModel * item = dynamic_cast( ( *slaves.begin() ).first.first.resolved().data() ); + if ( item && item->item() && item->item()->isNamespace() ) { + NamespaceModel* ns = dynamic_cast( item->item().data() ); + QStringList wholeScope = ns->scope(); + wholeScope << ns->name(); + FileList files = cppSupport()->codeModel()->fileList(); + for ( FileList::iterator it = files.begin(); it != files.end(); ++it ) { + NamespaceModel* ns = (*it).data(); + for ( QStringList::iterator it2 = wholeScope.begin(); it2 != wholeScope.end(); ++it2 ) { + if ( ns->hasNamespace( (*it2) ) ) { + ns = ns->namespaceByName( *it2 ); + if ( !ns ) break; + } else { + ns = 0; + break; + } + } + if ( ns ) { + d.name = ns->name(); + ns->getStartPosition( &d.startLine, &d.startCol ); + ns->getEndPosition( &d.endLine, &d.endCol ); + d.file = ns->fileName(); + break; + } + } + } + } + } + } else { + // Not a namespace, we can get the declaration info straight from the type description. + d = type->resolved()->getDeclarationInfo(); + } + } + // Unresolved, maybe its a named enumeration? + else if ( type && type.trace() ) { + QValueList< QPair > trace = type.trace()->trace(); + if ( !trace.isEmpty() ) { + if ( trace.begin() != trace.end() ) { + d = ( *trace.begin() ).first.decl; + } + } + } + } + if ( d ) { + QString fileName = d.file == "current_file" ? m_activeFileName : d.file.operator QString(); + if ( f == Definition && cppSupport()->switchHeaderImpl( fileName, d.startLine, d.startCol ) ) + return; + cppSupport()->partController()->editDocument( fileName, d.startLine ); + } +} + +QString CppCodeCompletion::createTypeInfoString( int line, int column ) +{ + QString typeInfoString; + + SimpleTypeConfiguration conf( m_activeFileName ); + EvaluationResult type = evaluateExpressionAt( line, column, conf ); + + if ( type.expr.expr().stripWhiteSpace().isEmpty() ) + return typeInfoString; + + typeInfoString += type.expr.expr() + QString(" : " ); + + if ( type->resolved() ) + { + QString scope = type->resolved()->scope().join("::"); + int pos = scope.findRev("::"); + if ( scope.isEmpty() || pos == -1 ) + { + scope = "::"; + } + else + { + scope.truncate( pos + 2 ); + } + + typeInfoString += scope + type->fullNameChain() + QString( i18n(" (resolved) ") ); + } + else + { + if ( type ) + { + if( !BuiltinTypes::isBuiltin( type.resultType ) ) + { + typeInfoString += type->fullNameChain() + QString( i18n(" (unresolved) ") ); + } + else + { + typeInfoString += type->fullNameChain() + ", " + BuiltinTypes::comment( type.resultType ) + QString( i18n(" (builtin type) ") ); + } + } + else + { + typeInfoString += QString( i18n(" (unresolved) ") ); + } + } + + if( cppSupport() && type->resolved() && cppSupport()->codeCompletionConfig()->preProcessAllHeaders() ) { + DeclarationInfo decl = type->resolved()->getDeclarationInfo(); + if( !getIncludeFiles()[ HashedString( decl.file ) ] ) { + typeInfoString += " [header not included] "; + } + } + + return typeInfoString; +} + +bool CppCodeCompletion::getIncludeInfo( int line, QString& includeFileName, QString& includeFilePath, bool& usedProjectFiles ) +{ + bool isIncludeDirective = false; + QString lineText = getText( line, 0, line+1, 0 ); + QRegExp includeRx( "(?:#include[\\s]*(?:\\\"|\\<))([^\\n]*)(\\\"|\\>)" ); + if( includeRx.search( lineText ) != -1 ) { + //It is an include-directive. The regular expression captures the string, and the closing sign('"' or '>'). + isIncludeDirective = true; + usedProjectFiles = false; + QStringList captured = includeRx.capturedTexts(); + if( captured.size() == 3 ) { + Dependence d; + d.first = captured[1]; + d.second = captured[2] == "\"" ? Dep_Local : Dep_Global; + includeFilePath = cppSupport()->driver()->findIncludeFile( d, activeFileName() ); + if( includeFilePath.isEmpty() ) { + //A simple backup-algorithm that can only find files within the same project + includeFilePath = cppSupport()->findHeaderSimple( d.first ); + usedProjectFiles = true; + } + includeFileName = d.first; + } else { + kdDebug( 9007 ) << "wrong count of captured items" << endl; + } + } + return isIncludeDirective; +} + + +#include "cppcodecompletion.moc" +//kate: indent-mode csands; tab-width 2; space-indent off; + diff --git a/languages/cpp/cppcodecompletion.h b/languages/cpp/cppcodecompletion.h new file mode 100644 index 00000000..0eb49908 --- /dev/null +++ b/languages/cpp/cppcodecompletion.h @@ -0,0 +1,324 @@ +/*************************************************************************** + cppcodecompletion.h - description + ------------------- + begin : Sat Jul 21 2001 + copyright : (C) 2001 by Victor R�er + email : victor_roeder@gmx.de + copyright : (C) 2002,2003 by Roberto Raggi + email : roberto@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __CPPCODECOMPLETION_H__ +#define __CPPCODECOMPLETION_H__ + +#include "cppsupportpart.h" +#include "declarationinfo.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "driver.h" +///A little debugging class +#include +class PopupTracker : public QObject { + Q_OBJECT +public: + static PopupTracker* pt; + + static uint pendingPopups; + + static QPopupMenu* createPopup( QWidget* parent ) { + if( !pt ) pt = new PopupTracker(); + QPopupMenu* m = new QPopupMenu( parent ); + ++pendingPopups; + connect( m, SIGNAL(destroyed()), pt, SLOT(destroyedPopup()) ); + return m; + } + + static void print() { + if( pendingPopups ) + kdDebug( 9007 ) << "PopupTracker: " << pendingPopups << " popups are still alive" << endl; + } + +public slots: + void destroyedPopup() { + --pendingPopups; + } +}; + + +class CodeCompletionEntry; +class CodeInformationRepository; +class SimpleContext; +class SimpleType; +class SimpleTypeNamespace; +class CppCodeCompletionData; +class SimpleTypeConfiguration; +class TypeDesc; +struct PopupFillerHelpStruct; +struct PopupClassViewFillerHelpStruct; +class SimpleTypeImpl; +class TranslationUnitAST; +namespace CppEvaluation +{ + class EvaluationResult; +} +struct ExpressionInfo; + +typedef KSharedPtr TypePointer; + +class CppCodeCompletion : public QObject +{ + Q_OBJECT +public: + friend class SimpleType; + enum CompletionMode + { + NormalCompletion, + SignalCompletion, + SlotCompletion, + VirtualDeclCompletion + }; + enum MemberAccessOp + { + NoOp, + DotOp, + ArrowOp + }; + +public: + CppCodeCompletion( CppSupportPart* part ); + virtual ~CppCodeCompletion(); + + CodeInformationRepository* repository() + { + return m_repository; + } + CompletionMode completionMode() const + { + return m_completionMode; + } + + QString createTypeInfoString( int line, int column ); + + QString replaceCppComments( const QString& contents ); + int expressionAt( const QString& text, int index ); + QStringList splitExpression( const QString& text ); + + CppEvaluation::EvaluationResult evaluateExpression( ExpressionInfo expr, SimpleContext* ctx ); + + CppEvaluation::EvaluationResult evaluateExpressionAt( int line, int column, SimpleTypeConfiguration& conf, bool ifUnknownSetType = false ); + + void contextEvaluationMenus ( QPopupMenu *popup, const Context *context, int line, int col ); + + CppSupportPart* cppSupport() const; + + HashedStringSet getIncludeFiles( const QString& file = QString() ); + + static CppCodeCompletion* instance() { + return m_instance; + } + + ///Adds a string that will be ticked through the status-bar + void addStatusText( QString text, int timeout ); + void clearStatusText(); + + QString activeFileName() const { + return m_activeFileName; + } + +public slots: + /** + * @param invokedOnDemand if true and there is exactly one matching entry + * complete the match immediately without showing the completion box. + * This is only true, when the users invokes the completion himself + * (eg presses the completion shortcut CTRL+space) + */ + void completeText( bool invokedOnDemand = false ); +private slots: + void emptyCache(); + void slotPartAdded( KParts::Part *part ); + void slotActivePartChanged( KParts::Part *part ); + void slotArgHintHidden(); + void slotCompletionBoxHidden(); + void slotTextChanged(); + void slotFileParsed( const QString& fileName ); + void slotCodeModelUpdated( const QString& fileName ); + void slotTimeout(); + void slotStatusTextTimeout(); + void computeFileEntryList(); + bool isTypeExpression( const QString& expr ); + void slotTextHint( int line, int col, QString &text ); + void popupAction( int number ); + void popupDefinitionAction( int number ); + void popupClassViewAction( int number ); + void synchronousParseReady( const QString& file, ParsedFilePointer unit ); + void slotJumpToDefCursorContext(); + void slotJumpToDeclCursorContext(); + +private: + enum FunctionType { Declaration, Definition }; + + TypePointer createGlobalNamespace(); + bool functionContains( FunctionDom f , int line, int col ); + void getFunctionBody( FunctionDom f , int& line, int& col ); + void selectItem( ItemDom item ); + void addTypePopups( QPopupMenu* parent, TypeDesc d, QString depthAdd, QString prefix = "" ); + void addTypeClassPopups( QPopupMenu* parent, TypeDesc d, QString depthAdd, QString prefix = "" ); + QValueList computeSignatureList( CppEvaluation::EvaluationResult function ); + void integratePart( KParts::Part* part ); + void setupCodeInformationRepository(); + FunctionDefinitionAST* functionDefinition( AST* node ); + void computeRecoveryPoints( ParsedFilePointer unit ); + void computeRecoveryPointsLocked(); + void jumpCursorContext( FunctionType ); + bool getIncludeInfo( int line, QString& includeFileName, QString& includeFilePath, bool& usedProjectFiles ); + + enum EvaluateExpressionOptions { + IncludeStandardExpressions = 1, + IncludeTypeExpression = 2, + CompletionOption = 4, ///Cut off the last word because it is incomplete + SearchInFunctions = 8, + SearchInClasses = 16, + DefaultAsTypeExpression = 32, ///This makes the evaluation interpret any unidentified expression as a type-expression + DefaultEvaluationOptions = 1 | 2 | 8 | 16, + DefaultCompletionOptions = 1 | 4 | 8 | 16 + }; + + bool mayBeTypeTail( int line, int column, QString& append, bool inFunction = false ); + bool canBeTypePrefix( const QString& prefix, bool inFunction = false ); + + + ExpressionInfo findExpressionAt( int line, int col, int startLine, int startCol, bool inFunction = false ); + SimpleContext* computeFunctionContext( FunctionDom f, int line, int col, SimpleTypeConfiguration& conf ); + + CppEvaluation::EvaluationResult evaluateExpressionType( int line, int column, SimpleTypeConfiguration& conf, EvaluateExpressionOptions opt = DefaultCompletionOptions ); + SimpleType unTypeDef( SimpleType scope , QMap& typedefs ); + + // QString buildSignature( TypePointer currType ); + SimpleType typeOf( QValueList& tags, MemberAccessOp accessOp ); + + /// @todo remove isInstance + void computeCompletionEntryList( QValueList& entryList, SimpleContext* ctx, bool isInstance, int depth = 0 ); + void computeCompletionEntryList( SimpleType type, QValueList& + entryList, const QStringList& typeList, SimpleTypeNamespace* ns, std::set& ignore, bool isInstance, int depth = 0 ); + void computeCompletionEntryList( SimpleType type, QValueList& + entryList, const QStringList& typeList, bool isInstance, int depth = 0 ); + void computeCompletionEntryList( SimpleType type, QValueList& entryList, QValueList& tags, bool isInstance, int depth ); + void computeCompletionEntryList( SimpleType type, QValueList& entryList, ClassDom klass, bool isInstance, int depth ); + void computeCompletionEntryList( SimpleType type, QValueList& entryList, NamespaceDom scope, bool isInstance, int depth ); + void computeCompletionEntryList( SimpleType type, QValueList& entryList, const FunctionList& methods, bool isInstance, int depth ); + void computeCompletionEntryList( SimpleType type, QValueList& entryList, const VariableList& attributes, bool isInstance, int depth ); + void computeCompletionEntryList( QString parent, SimpleType type, QValueList& entryList, const ClassList& lst, bool isInstance, int depth ); + void computeCompletionEntryList( QString parent, SimpleType type, QValueList& entryList, const TypeAliasList& lst, bool isInstance, int depth ); + void computeCompletionEntryList( SimpleType type, QValueList& entryList, const NamespaceList& lst, bool isInstance, int depth ); + + SimpleContext* computeContext( FunctionDefinitionAST* ast, int line, int col, int lineOffset, int colOffset ); + void computeContext( SimpleContext*& ctx, StatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, StatementListAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, IfStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, ForStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, DoStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, WhileStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, SwitchStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, TryBlockStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, CatchStatementListAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, CatchStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, DeclarationStatementAST* ast, int line, int col ); + void computeContext( SimpleContext*& ctx, ConditionAST* ast, int line, int col ); + bool inContextScope( AST* ast, int line, int col, bool checkStart = true, bool checkEnd = true ); + + QString getText( int startLine, int startColumn, int endLine, int endColumn, int omitLine = -1 ); + + +private: + + friend class SimpleTypeCatalog; + friend class SimpleTypeCodeModel; + friend class SimpleTypeImpl; + friend class ExpressionEvaluation; + friend class PopupFillerHelpStruct; + friend class PopupClassViewFillerHelpStruct; + QGuardedPtr m_pSupport; + QTimer* m_ccTimer; + QTimer* m_showStatusTextTimer; + QValueList > m_statusTextList; + + void fitContextItem( int nLine, int nColumn ); + void needRecoveryPoints(); + + QString m_activeFileName; + KTextEditor::ViewCursorInterface* m_activeCursor; + KTextEditor::EditInterface* m_activeEditor; + KTextEditor::TextHintInterface* m_activeHintInterface; + KTextEditor::CodeCompletionInterface* m_activeCompletion; + KTextEditor::View* m_activeView; + + bool m_bArgHintShow; + bool m_bCompletionBoxShow; + bool m_blockForKeyword; + bool m_demandCompletion; + + unsigned int m_ccLine; + unsigned int m_ccColumn; + static CppCodeCompletion* m_instance; + + CodeInformationRepository* m_repository; + CppCodeCompletionData* d; + CompletionMode m_completionMode; + + QTime m_lastHintTime; + + //If more then the given count of comments were requested, all following ones will be blank.(Performance-reasons) + void setMaxComments( int count ); + + QString commentFromItem( const SimpleType& parent, const ItemDom& item ); + QString commentFromTag( const SimpleType& parent, Tag& tag ); + + ItemDom m_cachedFromContext; ///Can be a function or a class, representing the position from where the last completion was started. Necessary as long as all imports are put into the global namespace. + + QRegExp m_includeRx; + QRegExp m_cppCodeCommentsRx; + QRegExp m_codeCompleteChRx; + QRegExp m_codeCompleteCh2Rx; + QValueList m_fileEntryList; + + int m_maxComments; + + typedef QMap PopupActions; + typedef QMap PopupClassViewActions; + PopupActions m_popupActions; + PopupActions m_popupDefinitionActions; + PopupClassViewActions m_popupClassViewActions; + + // we need something to plug actions that are not in any menu + // into in order for their shortcuts to work + QWidget m_DummyActionWidget; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/cppcodecompletionconfig.cpp b/languages/cpp/cppcodecompletionconfig.cpp new file mode 100644 index 00000000..2c394858 --- /dev/null +++ b/languages/cpp/cppcodecompletionconfig.cpp @@ -0,0 +1,151 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Roberto Raggi , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "cppcodecompletionconfig.h" +#include "cppsupportpart.h" + +#include + +#include +#include + +QString CppCodeCompletionConfig::defaultPath = QString::fromLatin1( "/kdevcppsupport/codecompletion" ); + +CppCodeCompletionConfig::CppCodeCompletionConfig( CppSupportPart * part, QDomDocument* dom ) + : QObject( part ), m_part( part ), m_dom( dom ) +{ + init(); +} + +CppCodeCompletionConfig::~CppCodeCompletionConfig() +{} + +void CppCodeCompletionConfig::init( ) +{ +/* m_includeGlobalFunctions = DomUtil::readBoolEntry( *m_dom, defaultPath + "/includeGlobalFunctions", true ); + m_includeTypes = DomUtil::readBoolEntry( *m_dom, defaultPath + "/includeTypes", true ); + m_includeEnums = DomUtil::readBoolEntry( *m_dom, defaultPath + "/includeEnums", true ); + m_includeTypedefs = DomUtil::readBoolEntry( *m_dom, defaultPath + "/includeTypedefs", false );*/ + m_automaticCodeCompletion = DomUtil::readBoolEntry( *m_dom, defaultPath + "/automaticCodeCompletion", false ); + m_automaticArgumentsHint = DomUtil::readBoolEntry( *m_dom, defaultPath + "/automaticArgumentsHint", true ); + m_automaticHeaderCompletion = DomUtil::readBoolEntry( *m_dom, defaultPath + "/automaticHeaderCompletion", true ); + m_codeCompletionDelay = DomUtil::readIntEntry( *m_dom, defaultPath + "/codeCompletionDelay", 250 ); + m_argumentsHintDelay = DomUtil::readIntEntry( *m_dom, defaultPath + "/argumentsHintDelay", 400 ); + m_headerCompletionDelay = DomUtil::readIntEntry( *m_dom, defaultPath + "/headerCompletionDelay", 250 ); + + m_showOnlyAccessibleItems = DomUtil::readBoolEntry( *m_dom, defaultPath + "/showOnlyAccessibleItems", false ); + m_completionBoxItemOrder = (CompletionBoxItemOrder)DomUtil::readIntEntry( *m_dom, defaultPath + "/completionBoxItemOrder", ByAccessLevel ); + m_showEvaluationContextMenu = DomUtil::readBoolEntry( *m_dom, defaultPath + "/howEvaluationContextMenu", true ); + m_showCommentWithArgumentHint = DomUtil::readBoolEntry( *m_dom, defaultPath + "/showCommentWithArgumentHint", true ); + m_statusBarTypeEvaluation = DomUtil::readBoolEntry( *m_dom, defaultPath + "/statusBarTypeEvaluation", false ); + m_namespaceAliases = DomUtil::readEntry( *m_dom, defaultPath + "/namespaceAliases", "std=_GLIBCXX_STD;__gnu_cxx=std" ); + m_processPrimaryTypes = DomUtil::readBoolEntry( *m_dom, defaultPath + "/processPrimaryTypes", true ); + m_processFunctionArguments = DomUtil::readBoolEntry( *m_dom, defaultPath + "/processFunctionArguments", false ); + + m_preProcessAllHeaders = DomUtil::readBoolEntry( *m_dom, defaultPath + "/preProcessAllHeaders", false ); + m_parseMissingHeaders = DomUtil::readBoolEntry( *m_dom, defaultPath + "/parseMissingHeadersExperimental", false ); + m_resolveIncludePaths = DomUtil::readBoolEntry( *m_dom, defaultPath + "/resolveIncludePathsUsingMakeExperimental", false ); + m_alwaysParseInBackground = DomUtil::readBoolEntry( *m_dom, defaultPath + "/alwaysParseInBackground", true ); + m_usePermanentCaching = DomUtil::readBoolEntry( *m_dom, defaultPath + "/usePermanentCaching", true ); + m_alwaysIncludeNamespaces = DomUtil::readBoolEntry( *m_dom, defaultPath + "/alwaysIncludeNamespaces", false ); + m_includePaths = DomUtil::readEntry( *m_dom, defaultPath + "/includePaths", ".;" ); + + +} + +void CppCodeCompletionConfig::store( ) +{ +/* DomUtil::writeBoolEntry( *m_dom, defaultPath + "/includeGlobalFunctions", m_includeGlobalFunctions ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/includeTypes", m_includeTypes ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/includeEnums", m_includeEnums ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/includeTypedefs", m_includeTypedefs );*/ + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/automaticCodeCompletion", m_automaticCodeCompletion ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/automaticArgumentsHint", m_automaticArgumentsHint ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/automaticHeaderCompletion", m_automaticHeaderCompletion ); + DomUtil::writeIntEntry( *m_dom, defaultPath + "/codeCompletionDelay", m_codeCompletionDelay ); + DomUtil::writeIntEntry( *m_dom, defaultPath + "/argumentsHintDelay", m_argumentsHintDelay ); + DomUtil::writeIntEntry( *m_dom, defaultPath + "/headerCompletionDelay", m_headerCompletionDelay ); + + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/showOnlyAccessibleItems", m_showOnlyAccessibleItems ); + DomUtil::writeIntEntry( *m_dom, defaultPath + "/completionBoxItemOrder", m_completionBoxItemOrder ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/howEvaluationContextMenu", m_showEvaluationContextMenu ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/showCommentWithArgumentHint", m_showCommentWithArgumentHint ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/statusBarTypeEvaluation", m_statusBarTypeEvaluation ); + DomUtil::writeEntry( *m_dom, defaultPath + "/namespaceAliases", m_namespaceAliases ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/processPrimaryTypes", m_processPrimaryTypes ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/processFunctionArguments", m_processFunctionArguments ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/preProcessAllHeaders", m_preProcessAllHeaders ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/parseMissingHeadersExperimental", m_parseMissingHeaders ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/resolveIncludePathsUsingMakeExperimental", m_resolveIncludePaths ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/alwaysParseInBackground", m_alwaysParseInBackground ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/usePermanentCaching", m_usePermanentCaching ); + DomUtil::writeBoolEntry( *m_dom, defaultPath + "/alwaysIncludeNamespaces", m_alwaysIncludeNamespaces ); + DomUtil::writeEntry( *m_dom, defaultPath + "/includePaths", m_includePaths ); + + emit stored(); +} + +// void CppCodeCompletionConfig::setIncludeTypes( bool b ) +// { +// m_includeTypes = b; +// } +// +// void CppCodeCompletionConfig::setIncludeEnums( bool b ) +// { +// m_includeEnums = b; +// } +// +// void CppCodeCompletionConfig::setIncludeTypedefs( bool b ) +// { +// m_includeTypedefs = b; +// } + +void CppCodeCompletionConfig::setAutomaticCodeCompletion( bool b ) +{ + m_automaticCodeCompletion = b; +} + +void CppCodeCompletionConfig::setAutomaticArgumentsHint( bool b ) +{ + m_automaticArgumentsHint = b; +} + +void CppCodeCompletionConfig::setCodeCompletionDelay( int delay ) +{ + m_codeCompletionDelay = delay; +} + +void CppCodeCompletionConfig::setArgumentsHintDelay( int delay ) +{ + m_argumentsHintDelay = delay; +} + +// void CppCodeCompletionConfig::setIncludeGlobalFunctions( bool b ) +// { +// m_includeGlobalFunctions = b; +// } + +void CppCodeCompletionConfig::setHeaderCompletionDelay( int delay ) +{ + m_headerCompletionDelay = delay; +} + +void CppCodeCompletionConfig::setAutomaticHeaderCompletion( bool b ) +{ + m_automaticHeaderCompletion = b; +} + +bool CppCodeCompletionConfig::showNamespaceAppearances() const { + return true; +} + +#include "cppcodecompletionconfig.moc" diff --git a/languages/cpp/cppcodecompletionconfig.h b/languages/cpp/cppcodecompletionconfig.h new file mode 100644 index 00000000..13b23ccf --- /dev/null +++ b/languages/cpp/cppcodecompletionconfig.h @@ -0,0 +1,310 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Roberto Raggi , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef CPPCODECOMPLETIONCONFIG_H +#define CPPCODECOMPLETIONCONFIG_H + +#include + +class CppSupportPart; +class QDomDocument; + + +/** +@author Roberto Raggi +*/ +class CppCodeCompletionConfig : public QObject +{ + Q_OBJECT +public: + CppCodeCompletionConfig( CppSupportPart* part, QDomDocument* dom ); + virtual ~CppCodeCompletionConfig(); + +// bool includeGlobalFunctions() const +// { +// return m_includeGlobalFunctions; +// } +// +// void setIncludeGlobalFunctions( bool b ); +// +// bool includeTypes() const +// { +// return m_includeTypes; +// } +// +// void setIncludeTypes( bool b ); +// +// bool includeEnums() const +// { +// return m_includeEnums; +// } +// +// void setIncludeEnums( bool b ); +// +// bool includeTypedefs() const +// { +// return m_includeTypedefs; +// } +// +// void setIncludeTypedefs( bool b ); + + enum CompletionBoxItemOrder { + ByAccessLevel, + ByClass, + ByAlphabet + }; + + ///Whether the completion-cache should be kept alive as long as the context does not change + bool usePermanentCaching() const { + return m_usePermanentCaching; + } + + void setUsePermanentCaching(bool b) { + m_usePermanentCaching = b; + } + + ///Whether higher namespaces(like the global one) should be included while computing the + ///completion-list when using automatic code-completion. Should get an option in the interface(slows down the completion). + bool alwaysIncludeNamespaces() const { + return m_alwaysIncludeNamespaces; + } + + void setAlwaysIncludeNamespaces(bool b) { + m_alwaysIncludeNamespaces = b; + } + + ///Whether all included headers should be processed by the preprocessor(makes macros work across header-files) + void setPreProcessAllHeaders(bool b) { + m_preProcessAllHeaders = b; + } + + ///Whether headers that were found and were not yet parsed in their active state should be parsed into the code-model + void setParseMissingHeaders(bool b) { + m_parseMissingHeaders = b; + } + + ///Additional include-paths defined by the user + void setCustomIncludePaths(QString str) { + m_includePaths = str; + } + + ///Whether we should try to automatically find out the used include-path from Makefiles etc. + void setResolveIncludePaths(bool b) { + m_resolveIncludePaths = b; + } + + ///Whether higher namespaces(like the global one) should be included while computing the + ///completion-list when using automatic code-completion. Should get an option in the interface(slows down the completion). + + ///Whether all included headers should be processed by the preprocessor(makes macros work across header-files) + bool preProcessAllHeaders() const { + return m_preProcessAllHeaders; + } + + ///Whether headers that were found and were not yet parsed in their active state should be parsed into the code-model + bool parseMissingHeaders() const { + return m_parseMissingHeaders; + } + + ///Additional include-paths defined by the user + QString customIncludePaths() const { + return m_includePaths; + } + + ///Whether we should try to automatically find out the used include-path from Makefiles etc. + bool resolveIncludePaths() const { + return m_resolveIncludePaths; + } + + bool alwaysParseInBackground() const { + return m_alwaysParseInBackground; + } + + void setAlwaysParseInBackground(bool b) { + m_alwaysParseInBackground = b; + } + + bool showNamespaceAppearances() const; + + bool showOnlyAccessibleItems() const { + ///not yet used + return m_showOnlyAccessibleItems; + } + + CompletionBoxItemOrder completionBoxItemOrder() const { + ///not yet used + return m_completionBoxItemOrder; + } + + bool showEvaluationContextMenu() const { + ///used + return m_showEvaluationContextMenu; + } + + bool showCommentWithArgumentHint() const { + ///used + return m_showCommentWithArgumentHint; + } + + bool statusBarTypeEvaluation() const { + ///used + return m_statusBarTypeEvaluation; + } + + QString namespaceAliases() const { + ///used + return m_namespaceAliases; + } + + bool processPrimaryTypes() const { ///The "do complete return-type-evaluation" entry. However it should be renamed, because it also covers Variable-types and typedefs! + ///used + return m_processPrimaryTypes; + } + + bool processFunctionArguments() const { ///The "do complete argument-type-evaluation" entry + ///used + return m_processFunctionArguments; + } + + + void setShowOnlyAccessibleItems( bool b ) { + ///not yet used + m_showOnlyAccessibleItems = b; + } + + void setCompletionBoxItemOrder( CompletionBoxItemOrder b ) { + ///not yet used + m_completionBoxItemOrder = b; + } + + void setShowEvaluationContextMenu( bool b ) { + ///used + m_showEvaluationContextMenu = b; + } + + void setShowCommentWithArgumentHint( bool b ) { + ///used + m_showCommentWithArgumentHint = b; + } + + void setStatusBarTypeEvaluation( bool b ) { + ///used + m_statusBarTypeEvaluation = b; + } + + void setNamespaceAliases( QString n ) { + ///used + m_namespaceAliases = n; + } + + void setProcessPrimaryTypes( bool b ) { ///The "do complete return-type-evaluation" entry. However it should be renamed, because it also covers Variable-types and typedefs! + ///used + m_processPrimaryTypes = b; + } + + void setProcessFunctionArguments( bool b ) { ///The "do complete argument-type-evaluation" entry + ///used + m_processFunctionArguments = b; + } + + bool automaticCodeCompletion() const { + return m_automaticCodeCompletion; + } + + + void setAutomaticCodeCompletion( bool b ); + + bool automaticArgumentsHint() const + { + ///used + return m_automaticArgumentsHint; + } + + void setAutomaticArgumentsHint( bool b ); + + bool automaticHeaderCompletion() const + { + ///used + return m_automaticHeaderCompletion; + } + + void setAutomaticHeaderCompletion( bool b ); + + int codeCompletionDelay() const + { + ///used + return m_codeCompletionDelay; + } + + void setCodeCompletionDelay( int delay ); + + int argumentsHintDelay() const + { + ///used + return m_argumentsHintDelay; + } + + void setArgumentsHintDelay( int delay ); + + int headerCompletionDelay() const + { + ///used + return m_headerCompletionDelay; + } + + void setHeaderCompletionDelay( int delay ); + +public slots: + void store(); + +signals: + void stored(); + +private: + void init(); + +private: + CppSupportPart* m_part; + QDomDocument* m_dom; +/* bool m_includeGlobalFunctions; + bool m_includeTypes; + bool m_includeEnums; + bool m_includeTypedefs;*/ + bool m_automaticCodeCompletion; + bool m_automaticArgumentsHint; + bool m_automaticHeaderCompletion; + int m_codeCompletionDelay; + int m_argumentsHintDelay; + int m_headerCompletionDelay; + + bool m_preProcessAllHeaders; + bool m_parseMissingHeaders; + bool m_resolveIncludePaths; + bool m_alwaysIncludeNamespaces; + bool m_alwaysParseInBackground; + bool m_usePermanentCaching; + QString m_includePaths; + + bool m_showOnlyAccessibleItems; + CompletionBoxItemOrder m_completionBoxItemOrder; + bool m_showEvaluationContextMenu; + bool m_showCommentWithArgumentHint; + bool m_statusBarTypeEvaluation; + QString m_namespaceAliases; + bool m_processPrimaryTypes; + bool m_processFunctionArguments; + + static QString defaultPath; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/cppevaluation.cpp b/languages/cpp/cppevaluation.cpp new file mode 100644 index 00000000..ff1f4ab9 --- /dev/null +++ b/languages/cpp/cppevaluation.cpp @@ -0,0 +1,483 @@ +/*************************************************************************** + begin : Sat Jul 21 2001 + copyright : (C) 2001 by Victor R�er + email : victor_roeder@gmx.de + copyright : (C) 2002,2003 by Roberto Raggi + email : roberto@kdevelop.org + copyright : (C) 2005 by Adam Treat + email : manyoso@yahoo.com + copyright : (C) 2006 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "cppevaluation.h" +#include "simplecontext.h" +#include "safetycounter.h" + +extern SafetyCounter safetyCounter; + +namespace CppEvaluation { + +void statusLog( const QString& str ) { + ifVerboseMajor( dbgMajor() << str << endl ); + statusBarText( str, 2000 ); +} +OperatorSet AllOperators; + +///These lines register the operators to the list of all operators +RegisterOperator< DotOperator > DotReg( AllOperators ); +RegisterOperator< NestedTypeOperator > NestedReg( AllOperators ); +RegisterOperator< ArrowOperator > ArrowReg( AllOperators ); +RegisterOperator< StarOperator > StarReg( AllOperators ); +RegisterOperator< AddressOperator > AddressReg( AllOperators ); +RegisterOperator< IndexOperator > IndexReg( AllOperators ); +RegisterOperator< ParenOperator > ParenReg( AllOperators ); + +template +QValueList convertList( const QValueList& from ) { + QValueList ret; + for( typename QValueList::const_iterator it = from.begin(); it != from.end(); ++it ) { + ret << (To)*it; + } + return ret; +} + +QString nameFromType( SimpleType t ) { + return t->fullTypeResolved(); +} + +QString Operator::printTypeList( QValueList& lst ) +{ + QString ret; + for( QValueList::iterator it = lst.begin(); it != lst.end(); ++it ) { + ret += "\"" + (*it)->fullNameChain() + "\", "; + } + ret.truncate( ret.length() - 3 ); + return ret; +} + +void Operator::log( const QString& msg ) { + statusLog( "\"" + name() + "\": " + msg ); + //ifVerboseMajor( dbgMajor() << "\"" << name() << "\": " << msg << endl ); +} + +OperatorSet::~OperatorSet() { + for( QValueList< Operator* >::iterator it = m_operators.begin(); it != m_operators.end(); ++it ) { + delete *it; + } +} + +OperatorIdentification OperatorSet::identifyOperator( const QString& str_ , Operator::BindingSide allowedBindings) { + QString str = str_.stripWhiteSpace(); + for( OperatorList::iterator it = m_operators.begin(); it != m_operators.end(); ++it ) { + if( ((*it)->binding() & allowedBindings) == (*it)->binding() ) { + if( OperatorIdentification ident = (*it)->identify( str ) ) { + return ident; + } + } + } + + return OperatorIdentification(); +} + +OperatorIdentification UnaryOperator::identify( QString& str ) { + OperatorIdentification ret; + if( str.startsWith( m_identString ) ) { + ret.start = 0; + ret.end = m_identString.length(); + ret.found = true; + ret.op = this; + } + return ret; +} + +EvaluationResult UnaryOperator::apply( QValueList params, QValueList innerParams ) { + if( !checkParams( params ) ) { + log( QString("parameter-check failed: %1 params: ").arg( params.size() ) + printTypeList( params ) ); + return EvaluationResult(); + } else { + EvaluationResult t = unaryApply( params.front(), innerParams ); + if( !t ) { + if( params.front() ) + log( "could not apply \"" + name() + "\" to \"" + nameFromType( params.front() ) + "\""); + else + log( "operator \"" + name() + "\" applied on \"" + nameFromType( params.front() ) + "\": returning unresolved type \"" + nameFromType( t ) + "\""); + } + return t; + } +} + +EvaluationResult NestedTypeOperator::unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ) { + return param; +} + +EvaluationResult DotOperator::unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ) { + if( param->totalPointerDepth() == 0 ) { + return param; + } else { + log( "failed to apply dot-operator to " + param->fullNameChain() + " because the pointer-depth is wrong" ); + return EvaluationResult(); + } +} + + +EvaluationResult ArrowOperator::unaryApply( EvaluationResult param, const QValueList& innerParams ) { + if( param->totalPointerDepth() == 1 ) { + param->setTotalPointerDepth( param->totalPointerDepth() - 1 ); + return param; + } else { + if( param->resolved() ) { + if( param->totalPointerDepth() == 0 ) { + return param->resolved()->applyOperator( SimpleTypeImpl::ArrowOp , convertList(innerParams) ); + } else { + log("failed to apply arrow-operator to " + param->fullNameChain() + " because the pointer-depth is wrong" ); + return EvaluationResult(); + } + } else { + log( "failed to apply arrow-operator to unresolved type" ); + return EvaluationResult(); + } + }; +} + +EvaluationResult StarOperator::unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ) { + if( param->totalPointerDepth() > 0 ) { + param->setTotalPointerDepth( param->totalPointerDepth() - 1 ); + return param; + } else { + if( param->resolved() ) { + return param->resolved()->applyOperator( SimpleTypeImpl::StarOp ); + } else { + log( "failed to apply star-operator to unresolved type" ); + return EvaluationResult(); + } + }; +} + +EvaluationResult AddressOperator::unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ) { + param->setTotalPointerDepth( param->totalPointerDepth() + 1 ); + return param; +} + +OperatorIdentification UnaryParenOperator::identify( QString& str ) { + OperatorIdentification ret; + if( str.startsWith( QString( identString()[0] ) ) ) { + ret.start = 0; + ret.end = findClose( str, 0 ); + if( ret.end == -1 ) { + ret.found = false; + ret.end = 0; + } else { + if( str[ret.end] == identString()[1] ) { + ret.found = true; + ret.end += 1; + ret.op = this; + + ///Try to extract the parameter-strings. + ParamIterator it( identString(), str.mid( ret.start, ret.end - ret.start ) ); + + while( it ) { + ret.innerParams << (*it).stripWhiteSpace(); + + ++it; + } + + } else { + ret.end = 0; + } + } + } + return ret; +} + + +EvaluationResult IndexOperator::unaryApply( EvaluationResult param, const QValueList& innerParams ) { + if( param->totalPointerDepth() > 0 ) { + param->setTotalPointerDepth( param->totalPointerDepth() - 1 ); + return param; + } else { + if( param->resolved() ) { + return param->resolved()->applyOperator( SimpleTypeImpl::IndexOp, convertList( innerParams ) ); + } else { + log( "failed to apply index-operator to unresolved type" ); + return EvaluationResult(); + } + }; +} + +EvaluationResult ParenOperator::unaryApply( EvaluationResult param, const QValueList& innerParams ) { + if( param ) { + if( param->resolved() ) { + return param->resolved()->applyOperator( SimpleTypeImpl::ParenOp, convertList(innerParams) ); + } else { + log( "failed to apply paren-operator to unresolved type" ); + return EvaluationResult(); + } + + } else { + return innerParams[0]; + } +} + +ExpressionEvaluation::ExpressionEvaluation( CppCodeCompletion* data, ExpressionInfo expr, OperatorSet& operators, const HashedStringSet& includeFiles, SimpleContext* ctx ) : m_data( data ), m_ctx( ctx ), m_expr( expr ), m_global(false), m_operators( operators ), m_includeFiles( includeFiles ) { + safetyCounter.init(); + + ifVerboseMajor( dbgMajor( ) << "Initializing evaluation of expression " << expr << endl ); + + if ( expr.expr().startsWith( "::" ) ) + { + expr.setExpr( expr.expr().mid( 2 ) ); + m_global = true; + } + + //m_expr = m_data->splitExpression( expr.expr() ).join(""); +} + +EvaluationResult ExpressionEvaluation::evaluate() { + EvaluationResult res; + res = evaluateExpressionInternal( m_expr.expr(), m_ctx->global(), m_ctx, m_ctx, /*m_expr.canBeTypeExpression() cannot be safely determined*/true ); + + ExpressionInfo ex = res.expr; ///backup and set the type which was chosen while the evaluation-process + res.expr = m_expr; + res.expr.t = ex.t; + + return res; +} + +EvaluationResult ExpressionEvaluation::evaluateExpressionInternal( QString expr, EvaluationResult scope, SimpleContext * ctx, SimpleContext* innerCtx , bool canBeTypeExpression) { + LogDebug d( "#evl#" ); + if( expr.isEmpty() || !safetyCounter ) { + scope.expr.t = ExpressionInfo::NormalExpression; + return scope; + } + + /*if( !scope->resolved() ) { + ifVerboseMajor( dbgMajor() << "evaluateExpressionInternal(\"" << expr << "\") scope: \"" << scope->fullTypeStructure() << "\" is unresolved " << endl ); + return EvaluationResult(); + }*/ + + ifVerboseMajor( dbgMajor() << "evaluateExpressionInternal(\"" << expr << "\") scope: \"" << scope->fullNameChain() << "\" context: " << ctx << endl ); + + expr = expr.stripWhiteSpace(); + + ///Find the rightmost operator with the lowest priority, for the first split. + QValueList idents; + for( uint a = 0; a < expr.length(); ++a ) { + QString part = expr.mid( a ); + OperatorIdentification ident = m_operators.identifyOperator( part ); + if( ident ) { + ifVerboseMajor( dbgMajor() << "identified \"" << ident.op->name() << "\" in string " << part << endl ); + ident.start += a; + ident.end += a; + idents << ident; + a += ident.end; + } else { + if( isLeftParen( part[0] ) ) { + int jump = findClose( part, 0 ); + if( jump != -1 ) + a += jump; + } + } + } + + if( !idents.isEmpty() ) { + OperatorIdentification lowest; + + for( QValueList::iterator it = idents.begin(); it != idents.end(); ++it ) { + if( lowest ) { + if( lowest.op->priority() >= (*it).op->priority() ) + lowest = *it; + } else { + lowest = *it; + } + } + + if( lowest ) { + QString leftSide = expr.left( lowest.start ).stripWhiteSpace(); + QString rightSide = expr.right( expr.length() - lowest.end ).stripWhiteSpace(); + + EvaluationResult left, right; + if( !leftSide.isEmpty() ) { + left = evaluateExpressionInternal( leftSide, scope, ctx, innerCtx, lowest.op->canBeType( Operator::Left ) ); + } else { + left = scope; + } + + if( !left && (lowest.op->binding() & Operator::Left) ) { + ifVerboseMajor( dbgMajor() << "problem while evaluating expression \"" << expr << "\", the operator \"" << lowest.op->name() << "\" has a binding to the left side, but no left side could be evaluated: \"" << leftSide << "\"" << endl ); + } + + if( !rightSide.isEmpty() && (lowest.op->binding() & Operator::Right) ) + right = evaluateExpressionInternal( rightSide, SimpleType(), ctx, innerCtx, lowest.op->canBeType( Operator::Right ) ); + + if( !right && (lowest.op->binding() & Operator::Right) ) { + ifVerboseMajor( dbgMajor() << "problem while evaluating expression \"" << expr << "\", the operator \"" << lowest.op->name() << "\" has a binding to the right side, but no right side could be evaluated: \"" << rightSide << "\"" << endl ); + } + + QValueList innerParams; + QValueList params; + if( lowest.op->binding() & Operator::Left ) params << left; + if( lowest.op->binding() & Operator::Right ) params << right; + + for( QValueList::iterator it = lowest.innerParams.begin(); it != lowest.innerParams.end(); ++it ) { + ifVerboseMajor(dbgMajor() << "evaluating inner parameter \"" + *it + "\"" ); + innerParams << evaluateExpressionInternal( (*it), SimpleType(), innerCtx, innerCtx, lowest.op->canBeType( Operator::Neutral ) ); + } + + EvaluationResult applied = lowest.op->apply( params, innerParams ); + if( !applied ) { + statusLog( "\"" + expr + "\": failed to apply the operator \"" + lowest.op->name() + "\"" ); + } + + if( ! (lowest.op->binding() & Operator::Left) && !leftSide.isEmpty() ) { + ///When the operator has no binding to the left, the left side should be empty. + statusLog( "\"" + expr + "\": problem with the operator \"" + lowest.op->name() + ", it has no binding to the left side, but the left side is \""+ leftSide + "\"" ); + } + + if( ! (lowest.op->binding() & Operator::Right) && !rightSide.isEmpty() ) { + ///When the operator has no binding to the right, we should continue evaluating the right side, using the left type as scope. + ///Think about this. + return evaluateExpressionInternal( rightSide, applied, 0, innerCtx, lowest.op->canBeType( Operator::Right ) ); + } + + return applied; + } else { + ifVerboseMajor( dbgMajor() << " could not find an operator in " << expr << endl ); + return evaluateAtomicExpression( expr, scope, ctx ); + } + } + + //dbgMajor() << " could not evaluate " << expr << endl; + ifVerboseMajor( dbgMajor() << "evaluating \"" << expr << "\" as atomic expression" << endl ); + + TypeDesc exp = m_ctx->container()->resolveTemplateParams( TypeDesc(expr) ); + + ifVerboseMajor( dbgMajor() << "after template-parameter resolution: \"" << exp.fullNameChain() << "\"" << endl ); + + EvaluationResult res = evaluateAtomicExpression( exp, scope, ctx, canBeTypeExpression ); + return res; +} + +/**This function needs a clean workover. + * An atomic expression is one that only consists of a type-, function- or variable-name(may include '::') + */ +EvaluationResult ExpressionEvaluation::evaluateAtomicExpression( TypeDesc expr, EvaluationResult scope, SimpleContext * ctx, bool canBeTypeExpression ) { + LogDebug d( "#evt#"); + if( !safetyCounter || !d ) return SimpleType(); + bool canBeItemExpression = true; ///To be implemented + + if( scope ) { + expr.setIncludeFiles( scope.resultType->includeFiles() ); + } else { + expr.setIncludeFiles( m_includeFiles ); + } + + + ifVerboseMajor( dbgMajor() << "evaluateAtomicExpression(\"" << expr.name() << "\") scope: \"" << scope->fullNameChain() << "\" context: " << ctx << endl ); + + EvaluationResult bestRet; + int bestDepth = 0; + + if( expr.name().isEmpty() ) + return scope; + + TypePointer searchIn = scope->resolved(); + if( !searchIn ) { + statusLog( "scope-type is not resolved" ); + return EvaluationResult(); + } + + if( ctx ) + searchIn = ctx->container().get(); + + if( ctx && canBeItemExpression ) { + ///Search for variables and functions, first in the current context, and then through the container-classes upwards. + // find the variable in the current context + SimpleVariable var = ctx->findVariable( expr.name() ); + + if ( var.type ) { + TypeDesc d( var.type ); + d.setIncludeFiles( m_includeFiles ); + EvaluationResult ret = EvaluationResult( ctx->container()->locateDecType( d ), var.toDeclarationInfo( "current_file" )); + ret.expr.t = ExpressionInfo::NormalExpression; + return ret; + } + + SimpleType current = ctx->container(); + + SimpleTypeImpl::TypeOfResult type; + + SafetyCounter s( 20 ); + bool ready = false; + int depth = 0; + + while( !ready && s ) + { + if( !current ) ready = true; + + type = current->typeOf( expr ); + if ( type) { + bestRet = EvaluationResult( type.type, type.decl ); + bestDepth = depth; + bestRet.expr = expr.fullNameChain(); + bestRet.expr.t = ExpressionInfo::NormalExpression; + } + + depth++; + if( !ready ) current = current->parent(); + } + } + /* + if( scope.expr.t & ExpressionInfo::TypeExpression ) + canBeTypeExpression = true;*/ + + if( canBeItemExpression && (!bestRet || bestDepth > 0 ) ) { + //SimpleTypeImpl:: + SimpleTypeImpl::TypeOfResult res = searchIn->typeOf( expr ); + + if( res ) { + bestRet = EvaluationResult( res.type, res.decl ); + bestDepth = 0; + } + } + if( canBeTypeExpression ) { + ///Search for Types + LocateResult type = searchIn->locateDecType( expr ); + + if( !bestRet || + /** Did we find a constructor within a class? */ + (type->resolved() && ( bestRet->resolved() && type->resolved()->desc() == bestRet->resolved()->parent()->desc() && bestRet->resolved()->asFunction() ) ) ) { + /*if ( type && type->resolved() ) + {*/ + EvaluationResult ret = type; + ret.expr = expr.fullNameChain(); + ret.expr.t = ExpressionInfo::TypeExpression; + bestRet = ret; + } + /*} else { + bestRet = EvaluationResult( type ); + QStringList s = split+exprList; + s.pop_front(); + if( !s.isEmpty() ) + bestRet->append( new TypeDescShared( s.join("::") ) ); + }*/ + } + + if( bestRet ) + return bestRet; + + ifVerboseMajor( dbgMajor() << "evaluateAtomicExpression: \"" << scope.resultType->fullNameChain() << "\"could not locate " << expr.fullNameChain() << endl ); + return bestRet; +} +} + +// kate: indent-mode csands; tab-width 2; diff --git a/languages/cpp/cppevaluation.h b/languages/cpp/cppevaluation.h new file mode 100644 index 00000000..e4adeb28 --- /dev/null +++ b/languages/cpp/cppevaluation.h @@ -0,0 +1,367 @@ +/*************************************************************************** + begin : Sat Jul 21 2001 + copyright : (C) 2001 by Victor R�er + email : victor_roeder@gmx.de + copyright : (C) 2002,2003 by Roberto Raggi + email : roberto@kdevelop.org + copyright : (C) 2005 by Adam Treat + email : manyoso@yahoo.com + copyright : (C) 2006 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * 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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef CPPEVALUATION_H +#define CPPEVALUATION_H + +#include + +#include "expressioninfo.h" +#include "simpletype.h" +#include "declarationinfo.h" +#include + +class SimpleContext; + +void statusBarText( const QString& str, int time = 1000 ); + +namespace CppEvaluation { + +template +extern QValueList convertList( const QValueList& from ); + +extern QString nameFromType( SimpleType t ); + +class Operator; + +struct OperatorIdentification { + QValueList innerParams; /** Inner parameters of the operator( for the vec["hello"] the "hello" ) */ + int start, end; /** Range the operator occupies */ + bool found; + Operator* op; ///Can be 0 ! + + OperatorIdentification() : start( 0 ), end( 0 ), found( false ), op( 0 ) {} + + operator bool() { + return found; + } +}; + + +class EvaluationResult { + public: + EvaluationResult& operator = ( const EvaluationResult& rhs ) { + resultType = rhs.resultType; + sourceVariable = rhs.sourceVariable; + expr = rhs.expr; + isMacro = rhs.isMacro; + macro = rhs.macro; + return *this; + } + + EvaluationResult( const EvaluationResult& rhs ) : resultType( rhs.resultType ), expr( rhs.expr ), sourceVariable( rhs.sourceVariable ), isMacro( rhs.isMacro ), macro( rhs.macro ) {} + + LocateResult resultType; ///The resulting type + + ExpressionInfo expr; ///Information about the expression that was processed + + DeclarationInfo sourceVariable; ///If the type comes from a variable, this stores Information about it + + bool isMacro; + Macro macro; + + ///should be removed + EvaluationResult( SimpleType rhs ) : isMacro( false ) { + if ( rhs.get() != 0 ) + resultType = rhs->desc(); + } + + EvaluationResult( LocateResult tp = TypeDesc(), DeclarationInfo var = DeclarationInfo() ) : resultType( tp ), sourceVariable( var ), isMacro( false ) {} + + /*operator TypeDesc () const { + return (TypeDesc)resultType; + }*/ + + ///This must be removed + operator SimpleType() const { + if ( resultType->resolved() ) { + return SimpleType( resultType->resolved() ); + } else { + return SimpleType( new SimpleTypeImpl( ( TypeDesc ) resultType ) ); + } + } + + TypeDesc* operator -> () { + return & resultType.desc(); + } + + operator LocateResult () const { + return resultType; + } + + operator bool() const { + return ( bool ) resultType; + } +}; + + + +class Operator { + public: + enum BindingSide { + Neutral = 0, + Left = 1, + Right = 2 + }; + enum Type { + Unary = 1, + Binary = 2, + Ternary = 3 + }; + + virtual ~Operator() {} + + virtual int priority() = 0; + + virtual Type type() = 0; + virtual int paramCount() = 0; + + ///"binding" means that the operator needs the evaluated type of the expression on that side + ///The types of all bound sides will later be sent in the "params"-list of the apply-function + virtual BindingSide binding() = 0; ///The side to which the operator binds + + ///When this returns true, the ident-structure must be filled correctly + virtual OperatorIdentification identify( QString& str ) = 0; + + ///params + virtual EvaluationResult apply( QValueList params, QValueList innerParams ) = 0; + + virtual QString name() = 0; + + ///Should return whether the item it the given side can be a type(Neutral stands for the inner paremeters) + virtual bool canBeType( BindingSide side ) { + return true; + } + + protected: + void log( const QString& msg ); + QString printTypeList( QValueList& lst ); +}; + + +class OperatorSet { + private: + typedef QValueList< Operator* > OperatorList; + OperatorList m_operators; + public: + OperatorSet() {} + + ~OperatorSet(); + + void registerOperator( Operator* op ) { + m_operators << op; + } + + OperatorIdentification identifyOperator( const QString& str_ , Operator::BindingSide allowedBindings = ( Operator::BindingSide ) ( Operator::Left | Operator::Right | Operator::Neutral ) ); + +}; +extern OperatorSet AllOperators; + + +template +class RegisterOperator { + public: + RegisterOperator( OperatorSet& set + ) { + set.registerOperator( new OperatorType() ); + } + ~RegisterOperator() {} +} +; + + +class UnaryOperator : public Operator { + public: + UnaryOperator( int priority , QString identString, QString description, Operator::BindingSide binding ) : Operator(), m_priority( priority ), m_identString( identString ), m_name( description ), m_binding( binding ) {} + + virtual int priority() { + return m_priority; + } + + virtual Operator::Type type() { + return Operator::Unary; + } + + virtual Operator::BindingSide binding() { + return m_binding; + } + + virtual int paramCount() { + return 1; + } + + virtual OperatorIdentification identify( QString& str ); + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& innerParams ) = 0; + + virtual bool checkParams( const QValueList& params ) { + return !params.isEmpty() && params[ 0 ]; + } + + virtual EvaluationResult apply( QValueList params, QValueList innerParams ); + + virtual QString name() { + return m_name; + } + + private: + int m_priority; + QString m_identString; + QString m_name; + Operator::BindingSide m_binding; + protected: + + QString identString() const { + return m_identString; + } + +}; + + +class NestedTypeOperator : public UnaryOperator { + public: + NestedTypeOperator() : UnaryOperator( 18, "::", "nested-type-operator", Operator::Left ) {} + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ); +}; + +//RegisterOperator< NestedTypeOperator > NestedTypeReg( AllOperators ); ///This registers the operator to the list of all operators + +class DotOperator : public UnaryOperator { + public: + DotOperator() : UnaryOperator( 17, ".", "dot-operator", Operator::Left ) {} + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + +class ArrowOperator : public UnaryOperator { + public: + ArrowOperator() : UnaryOperator( 17, "->", "arrow-operator", Operator::Left ) {} + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& innerParams ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + + +class StarOperator : public UnaryOperator { + public: + StarOperator() : UnaryOperator( 15, "*", "star-operator", Operator::Right ) { ///Normally this should have a priority of 16, but that would need changes to the expression-parsin g-loop + } + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + + +class AddressOperator : public UnaryOperator { + public: + AddressOperator() : UnaryOperator( 16, "&", "address-operator", Operator::Right ) {} + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& /*innerParams*/ ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + + +class UnaryParenOperator : public UnaryOperator { + public: + ///Identstring should be both parens, for Example "[]" or "()" + UnaryParenOperator( int priority , QString identString, QString description, Operator::BindingSide binding ) : UnaryOperator( priority, identString, description, binding ) {} + + virtual OperatorIdentification identify( QString& str ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + +class IndexOperator : public UnaryParenOperator { + public: + IndexOperator() : UnaryParenOperator( 17, "[]", "index-operator", Operator::Left ) {} + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& innerParams ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + + +class ParenOperator : public UnaryParenOperator { + public: + ParenOperator() : UnaryParenOperator( 16, "()", "paren-operator", Operator::Left ) {} + + virtual bool checkParams( const QValueList& params ) { + return !params.isEmpty(); + } + + virtual EvaluationResult unaryApply( EvaluationResult param, const QValueList& innerParams ); + + virtual bool canBeType( BindingSide side ) { + return false; + } +}; + +//This is used in CppCodeCompletion::evaluateExpression(..) +class ExpressionEvaluation { + private: + CppCodeCompletion* m_data; + SimpleContext* m_ctx; + ExpressionInfo m_expr; + bool m_global; + OperatorSet& m_operators; + HashedStringSet m_includeFiles; + + public: + ExpressionEvaluation( CppCodeCompletion* data, ExpressionInfo expr, OperatorSet& operators, const HashedStringSet& includeFiles, SimpleContext* ctx = 0 ); + + EvaluationResult evaluate(); + + private: + /** + recursion-method: + 1. Find the rightmost operator with the lowest priority, split the expression + + vector[ (*it)->position ](). + */ + virtual EvaluationResult evaluateExpressionInternal( QString expr, EvaluationResult scope, SimpleContext * ctx, SimpleContext* innerCtx , bool canBeTypeExpression = true ); + + ///Locates types or members + EvaluationResult evaluateAtomicExpression( TypeDesc expr, EvaluationResult scope, SimpleContext * ctx = 0, bool canBeTypeExpression = true ); +}; + + +} + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/cppimplementationwidget.cpp b/languages/cpp/cppimplementationwidget.cpp new file mode 100644 index 00000000..c00c9b05 --- /dev/null +++ b/languages/cpp/cppimplementationwidget.cpp @@ -0,0 +1,100 @@ +/*************************************************************************** +* Copyright (C) 2004 by Alexander Dymo * +* adymo@kdevelop.org * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License as * +* published by the Free Software Foundation; either version 2 of the * +* License, or (at your option) any later version. * +* * +* 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 Library General Public * +* License along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ +#include "cppimplementationwidget.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +CppImplementationWidget::CppImplementationWidget( KDevLanguageSupport *part, + QWidget *parent, const char *name, bool modal ) + : ImplementationWidget( part, parent, name, modal ) +{} + +QStringList CppImplementationWidget::createClassFiles() +{ + QString template_h = "#ifndef $DEFTEXT$_H\n#define $DEFTEXT$_H\n\n#include \"$BASEINCLUDE$\"\n\nclass $CLASSNAME$: public $BASECLASSNAME$ {\nQ_OBJECT\npublic:\n $CLASSNAME$(QWidget *parent = 0, const char *name = 0);\n};\n\n#endif\n"; + QString template_cpp = "#include \"$CLASSINCLUDE$\"\n\n$CLASSNAME$::$CLASSNAME$(QWidget *parent, const char *name)\n :$BASECLASSNAME$(parent, name)\n{\n}\n"; + if ( m_part->project() ->options() == KDevProject::UsesAutotoolsBuildSystem ) + template_cpp += "\n#include \"$MOCINCLUDE$\"\n"; + + QFileInfo formInfo( m_formName ); + template_h.replace( QRegExp( "\\$BASEINCLUDE\\$" ), formInfo.baseName() + ".h" ); + template_h.replace( QRegExp( "\\$CLASSNAME\\$" ), classNameEdit->text() ); + template_h.replace( QRegExp( "\\$BASECLASSNAME\\$" ), m_baseClassName ); + template_h.replace( QRegExp( "\\$DEFTEXT\\$" ), fileNameEdit->text().upper() ); + + template_cpp.replace( QRegExp( "\\$CLASSINCLUDE\\$" ), fileNameEdit->text() + ".h" ); + template_cpp.replace( QRegExp( "\\$CLASSNAME\\$" ), classNameEdit->text() ); + template_cpp.replace( QRegExp( "\\$BASECLASSNAME\\$" ), m_baseClassName ); + template_cpp.replace( QRegExp( "\\$MOCINCLUDE\\$" ), fileNameEdit->text() + ".moc" ); + + template_h = FileTemplate::read( m_part, "h" ) + template_h; + template_cpp = FileTemplate::read( m_part, "cpp" ) + template_cpp; + + QString file_h = fileNameEdit->text() + ".h"; + QString file_cpp = fileNameEdit->text() + ".cpp"; + if ( !m_part->project() ->activeDirectory().isEmpty() ) + { + file_h = m_part->project() ->activeDirectory() + "/" + file_h; + file_cpp = m_part->project() ->activeDirectory() + "/" + file_cpp; + } + + QFile ifile( QDir::cleanDirPath( m_part->project() ->projectDirectory() + "/" + file_cpp ) ); + if ( !ifile.open( IO_WriteOnly ) ) + { + KMessageBox::error( this, i18n( "Cannot write to implementation file" ) ); + return QStringList(); + } + QTextStream istream( &ifile ); + istream << template_cpp; + ifile.close(); + + QFile hfile( QDir::cleanDirPath( m_part->project() ->projectDirectory() + "/" + file_h ) ); + if ( !hfile.open( IO_WriteOnly ) ) + { + KMessageBox::error( this, i18n( "Cannot write to header file" ) ); + return QStringList(); + } + QTextStream hstream( &hfile ); + hstream << template_h; + hfile.close(); + + QStringList fileList; + fileList.append( file_h ); + fileList.append( file_cpp ); + + return fileList; +} + +#include "cppimplementationwidget.moc" diff --git a/languages/cpp/cppimplementationwidget.h b/languages/cpp/cppimplementationwidget.h new file mode 100644 index 00000000..d10045db --- /dev/null +++ b/languages/cpp/cppimplementationwidget.h @@ -0,0 +1,43 @@ +/*************************************************************************** +* Copyright (C) 2004 by Alexander Dymo * +* adymo@kdevelop.org * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License as * +* published by the Free Software Foundation; either version 2 of the * +* License, or (at your option) any later version. * +* * +* 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 Library General Public * +* License along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ +#ifndef CPPIMPLEMENTATIONWIDGET_H +#define CPPIMPLEMENTATIONWIDGET_H + +#include + +#include + +class KListViewItem; +class CppSupportPart; + +class CppImplementationWidget : public ImplementationWidget +{ + Q_OBJECT +public: + CppImplementationWidget( KDevLanguageSupport *part, QWidget* parent = 0, const char* name = 0, bool modal = false ); + +protected: + virtual QStringList createClassFiles(); +}; + +#endif +// kate: indent-mode csands; tab-width 4; + + diff --git a/languages/cpp/cppnewclassdlg.cpp b/languages/cpp/cppnewclassdlg.cpp new file mode 100644 index 00000000..b941b46e --- /dev/null +++ b/languages/cpp/cppnewclassdlg.cpp @@ -0,0 +1,2242 @@ +/*************************************************************************** +* Copyright (C) 1998 by Sandy Meier * +* smeier@rz.uni-potsdam.de * +* Copyright (C) 1999 by Benoit.Cerrina * +* Benoit.Cerrina@writeme.com * +* Copyright (C) 2002 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2003 by Eray Ozkural * +* * +* Copyright (C) 2003-2004 by Alexander Dymo * +* adymo@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "cppnewclassdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cppsupportpart.h" +#include "kdevproject.h" +#include "kdevsourceformatter.h" +#include "kdevcoderepository.h" +#include "kdevpartcontroller.h" +#include "backgroundparser.h" +#include "domutil.h" +#include "filetemplate.h" +#include "storeconverter.h" +#include "qtbuildconfig.h" + +#include "classgeneratorconfig.h" + +QString QRegExp_escape( const QString& str ) +{ +#if QT_VERSION >= 0x030100 + return QRegExp::escape( str ); +#else + // this block is copyrighted by Trolltech AS (GPL) + static const char meta[] = "$()*+.?[\\]^{|}"; + QString quoted = str; + int i = 0; + + while ( i < ( int ) quoted.length() ) + { + if ( strchr( meta, quoted[ i ].latin1() ) != 0 ) + quoted.insert( i++, "\\" ); + i++; + } + return quoted; +#endif +} + +CppNewClassDialog::CppNewClassDialog( CppSupportPart *part, QWidget *parent, const char *name ) + : CppNewClassDialogBase( parent, name ), myModel( 0 ) +{ + headerModified = false; + baseincludeModified = false; + implementationModified = false; + m_part = part; + // read file template configuration + // KDevProject *project = part->project(); + QDomDocument &dom = *part->projectDom(); + interface_url = DomUtil::readEntry( dom, "/cppsupportpart/filetemplates/interfaceURL" ); + implementation_url = DomUtil::readEntry( dom, "/cppsupportpart/filetemplates/implementationURL" ); + interface_suffix = DomUtil::readEntry( dom, "/cppsupportpart/filetemplates/interfacesuffix", ".h" ); + implementation_suffix = DomUtil::readEntry( dom, "/cppsupportpart/filetemplates/implementationsuffix", ".cpp" ); + lowercase_filenames = DomUtil::readBoolEntry( dom, "/cppsupportpart/filetemplates/lowercasefilenames", true ); + m_parse = DomUtil::readEntry( *m_part->projectDom(), "/cppsupportpart/newclass/filenamesetting", "none" ); + // name_handler_combo->setCurrentText(m_parse); + baseclasses_view->setSorting( -1 ); + constructors_view->setSorting( -1 ); + + accessMenu = new QPopupMenu( this ); + accessMenu->insertItem( i18n( "Use as Private" ), + this, SLOT( changeToPrivate() ), 0, 1 ); + accessMenu->insertItem( i18n( "Use as Protected" ), + this, SLOT( changeToProtected() ), 0, 2 ); + accessMenu->insertItem( i18n( "Use as Public" ), + this, SLOT( changeToPublic() ), 0, 3 ); + accessMenu->insertSeparator(); + accessMenu->insertItem( i18n( "Unset" ), + this, SLOT( changeToInherited() ), 0, 5 ); + + overMenu = new QPopupMenu( this ); + overMenu->insertItem( i18n( "Extend Base Class Functionality" ), + this, SLOT( extendFunctionality() ), 0, 11 ); + overMenu->insertItem( i18n( "Replace Base Class Method" ), + this, SLOT( replaceFunctionality() ), 0, 12 ); + + compBasename = basename_edit->completionObject(); + setCompletionBasename( m_part->codeModel() ); + compNamespace = namespace_edit->completionObject(); + setCompletionNamespaceRecursive( m_part->codeModel() ->globalNamespace() ); + classname_edit->setFocus(); + + // enable/disable qt options for non qt projects + childclass_box->setEnabled( m_part->qtBuildConfig()->isUsed() ); + qobject_box->setEnabled( m_part->qtBuildConfig()->isUsed() ); +} + + +CppNewClassDialog::~CppNewClassDialog() +{ + delete compBasename; + delete compNamespace; + delete myModel; +} + +void CppNewClassDialog::setCompletionBasename( CodeModel *model ) +{ + compBasename->clear(); + + // Import selected namespace without qualifier + NamespaceDom namespaceDom = model->globalNamespace(); + + QStringList::const_iterator it = currNamespace.begin(); + for ( ; it != currNamespace.end() ; ++it ) + { + if ( ! namespaceDom->hasNamespace( *it ) ) + break; + namespaceDom = namespaceDom->namespaceByName( *it ); + } + + if ( it == currNamespace.end() ) + // complete namespace has been found (not breaked) + compBasename->insertItems( sortedNameList( namespaceDom -> classList() ) ); + + addCompletionBasenameNamespacesRecursive( model->globalNamespace() ); + + QStringList compItems = compBasename->items(); + it = compItems.begin(); + for ( int i = 0; + it != compItems.end(); ++it, ++i ) + kdDebug( 9007 ) << "compBasename->items()[" << i << "] = \"" << *it << "\"" << endl; +} + +QStringList& gres( QStringList &list, const QRegExp & rx, const QString & after ) +{ + QStringList::Iterator it = list.begin(); + while ( it != list.end() ) + { + ( *it ).replace( rx, after ); + ++it; + } + return list; +} + +void CppNewClassDialog::addCompletionBasenameNamespacesRecursive( const NamespaceDom & namespaceDom, + const QString & namespaceParent ) +{ + // Add classes of this namespace + QStringList classList = sortedNameList( namespaceDom -> classList() ); + + if ( ! namespaceParent.isEmpty() ) + { +#if QT_VERSION >= 0x030200 + classList.gres( QRegExp( "^" ), namespaceParent + "::" ); +#else + + gres( classList, QRegExp( "^" ), namespaceParent + "::" ); +#endif + + } + + compBasename -> insertItems( classList ); + + + // Recursion + NamespaceList namespaceList = namespaceDom->namespaceList(); + NamespaceList::const_iterator it = namespaceList.begin(); + + for ( ; it != namespaceList.end() ; ++it ) + { + QString fullNamespace; + + if ( ! namespaceParent.isEmpty() ) + fullNamespace = namespaceParent + "::"; + + fullNamespace += ( *it ) -> name(); + addCompletionBasenameNamespacesRecursive( *it, fullNamespace ); + } +} + + +void CppNewClassDialog::setCompletionNamespaceRecursive( const NamespaceDom & namespaceDom, const QString & namespaceParent ) +{ + NamespaceList namespaceList = namespaceDom->namespaceList(); + NamespaceList::const_iterator it = namespaceList.begin(); + for ( ; it != namespaceList.end() ; ++it ) + { + QString fullNamespace; + + if ( ! namespaceParent.isEmpty() ) + fullNamespace = namespaceParent + "::"; + + fullNamespace += ( *it ) -> name(); + kdDebug( 9007 ) << "compNamespace -> addItem( \"" << fullNamespace << "\" )" << endl; + compNamespace -> addItem( fullNamespace ); + setCompletionNamespaceRecursive( *it, fullNamespace ); + } +} + +void CppNewClassDialog::nameHandlerChanged( const QString &text ) +{ + DomUtil::writeEntry( *m_part->projectDom(), "/cppsupportpart/newclass/filenamesetting", text ); + m_parse = text; + classNameChanged( classname_edit->text() ); +} + +void CppNewClassDialog::classNameChanged( const QString &text ) +{ + QString str = text; + + if ( !headerModified ) + { + QString header = str + interface_suffix; + switch ( gen_config->fileCase() ) + { + case ClassGeneratorConfig::LowerCase: + header = header.lower(); + break; + case ClassGeneratorConfig::UpperCase: + header = header.upper(); + break; + default: + ; + } + header = header.replace( QRegExp( "(template *<.*> *)?(class +)?" ), "" ); + header_edit->setText( header ); + } + if ( !implementationModified ) + { + QString implementation; + if ( str.contains( "template" ) ) + implementation = str + "_impl" + interface_suffix; + else + implementation = str + implementation_suffix; + switch ( gen_config->fileCase() ) + { + case ClassGeneratorConfig::LowerCase: + implementation = implementation.lower(); + break; + case ClassGeneratorConfig::UpperCase: + implementation = implementation.upper(); + break; + default: + ; + } + implementation = implementation.replace( QRegExp( "(template *<.*> *)?(class +)?" ), "" ); + implementation_edit->setText( implementation ); + } +} + +void CppNewClassDialog::classNamespaceChanged( const QString &text ) +{ + currNamespace = QStringList::split( QString( "::" ), text ); + setCompletionBasename( m_part -> codeModel() ); + reloadAdvancedInheritance( true ); +} + +void CppNewClassDialog::baseclassname_changed( const QString &text ) +{ + if ( ( basename_edit->hasFocus() ) && ( !baseincludeModified ) ) + { + QString header = text; + + // handle Qt classes in a special way. + if( m_part->qtBuildConfig()->isUsed() && header.startsWith( "Q" ) ) + { + if( m_part->qtBuildConfig()->version() == 3 ) + { + header = header.lower() + ".h"; + } + else if( m_part->qtBuildConfig()->version() == 4 ) + { + // 1:1, e.g QObject is #include + } + } + else + { + if ( header.contains( QRegExp( "::" ) ) ) + header = header.mid( header.findRev( QRegExp( "::" ) ) + 2 ); + header = header.replace( QRegExp( " *<.*>" ), "" ); + header += interface_suffix; + + switch ( gen_config->superCase() ) + { + case ClassGeneratorConfig::LowerCase: + header = header.lower(); + break; + case ClassGeneratorConfig::UpperCase: + header = header.upper(); + break; + default: + ; + } + } + + baseinclude_edit->setText( header ); + } +} + +void CppNewClassDialog::baseIncludeChanged( const QString &text ) +{ + if ( baseinclude_edit->hasFocus() ) + { + baseincludeModified = true; + if ( baseclasses_view->selectedItem() ) + baseclasses_view->selectedItem() ->setText( 4, "true" ); + } + if ( baseclasses_view->selectedItem() ) + { + baseclasses_view->selectedItem() ->setText( 3, text ); + } +} + +void CppNewClassDialog::headerChanged() +{ + // Only if a change caused by the user himself + if ( header_edit->hasFocus() ) + headerModified = true; +} + + +void CppNewClassDialog::implementationChanged() +{ + // Only if a change caused by the user himself + if ( implementation_edit->hasFocus() ) + implementationModified = true; +} + +void CppNewClassDialog::checkObjCInheritance( int val ) +{ + childclass_box->setEnabled( !val && m_part->qtBuildConfig()->isUsed() ); + gtk_box->setEnabled( !val ); + qobject_box->setEnabled( !val && m_part->qtBuildConfig()->isUsed() ); + namespace_edit->setEnabled( !val ); + class_tabs->setTabEnabled( tab2, !val ); + /* virtual_box->setEnabled(!val); + public_button->setEnabled(!val); + protected_button->setEnabled(!val); + private_button->setEnabled(!val);*/ + if ( val && ( baseclasses_view->childCount() > 1 ) ) + if ( KMessageBox::warningContinueCancel( this, + i18n( "Objective C does not support multiple inheritance.\nOnly the first base class in the list will be taken into account." ), + i18n( "Warning" ), KStdGuiItem::cont(), "Check Objective C inheritance rules" ) == KMessageBox::Cancel ) + objc_box->setChecked( false ); +} + +void CppNewClassDialog::checkQWidgetInheritance( int val ) +{ + if ( val ) + { + qobject_box->setEnabled( val && m_part->qtBuildConfig()->isUsed() ); + qobject_box->setChecked( val && m_part->qtBuildConfig()->isUsed() ); + objc_box->setEnabled( !val ); + gtk_box->setEnabled( !val ); + } + else if ( qobject_box->isChecked() ) + { + objc_box->setEnabled( false ); + gtk_box->setEnabled( false ); + } + else + { + objc_box->setEnabled( !val ); + gtk_box->setEnabled( !val ); + } + + + if ( val ) + { + if ( baseclasses_view->childCount() == 0 ) + { + addBaseClass(); + basename_edit->setText( "QWidget" ); + } + /* constructors_cpp_edit->append(classname_edit->text() + "::" + classname_edit->text() + + "(QWidget *parent, const char *name):\n QWidget(parent, name)\n{\n}\n"); + constructors_h_edit->append(classname_edit->text() + "(QWidget *parent, const char *name);\n");*/ + } + + if ( val && ( baseclasses_view->childCount() > 1 ) ) + if ( KMessageBox::warningContinueCancel( this, + i18n( "Multiple inheritance requires QObject derivative to be first and unique in base class list." ), + i18n( "Warning" ), KStdGuiItem::cont(), "Check QWidget inheritance rules" ) == KMessageBox::Cancel ) + childclass_box->setChecked( false ); +} + +void CppNewClassDialog::qobject_box_stateChanged( int val ) +{ + if ( childclass_box->isChecked() ) + return ; + + if ( baseclasses_view->childCount() == 0 ) + { + addBaseClass(); + basename_edit->setText( "QObject" ); + } + + + objc_box->setEnabled( !val ); + gtk_box->setEnabled( !val ); +} + +void CppNewClassDialog::gtk_box_stateChanged( int val ) +{ + class_tabs->setTabEnabled( tab2, !val ); + childclass_box->setEnabled( !val && m_part->qtBuildConfig()->isUsed() ); + objc_box->setEnabled( !val ); + qobject_box->setEnabled( !val && m_part->qtBuildConfig()->isUsed() ); + namespace_edit->setEnabled( !val ); + + basename_edit->setEnabled( !val ); + virtual_box->setEnabled( !val ); + public_button->setEnabled( !val ); + protected_button->setEnabled( !val ); + private_button->setEnabled( !val ); + addbaseclass_button->setEnabled( !val ); + rembaseclass_button->setEnabled( !val ); + upbaseclass_button->setEnabled( !val ); + downbaseclass_button->setEnabled( !val ); + baseclasses_view->setEnabled( !val ); + baseinclude_edit->setEnabled( !val ); +} + + +void CppNewClassDialog::accept() +{ + ClassGenerator generator( *this ); + if ( generator.generate() ) + QDialog::accept(); + +} + +void CppNewClassDialog::setStateOfInheritanceEditors( bool state, bool hideList ) +{ + basename_edit->setEnabled( state ); + virtual_box->setEnabled( state ); + public_button->setEnabled( state ); + protected_button->setEnabled( state ); + private_button->setEnabled( state ); + scope_box->setEnabled( state ); + baseinclude_edit->setEnabled( state ); + if ( state ) + baseclasses_view->setEnabled( state ); + else + baseclasses_view->setEnabled( hideList ? state : true ); + rembaseclass_button->setEnabled( state ); + if ( !state ) + { + upbaseclass_button->setEnabled( state ); + downbaseclass_button->setEnabled( state ); + } +} + +void CppNewClassDialog::addBaseClass() +{ + baseincludeModified = false; + if ( baseclasses_view->selectedItem() ) + baseclasses_view->selectedItem() ->setSelected( false ); + QListViewItem* it = new QListViewItem( baseclasses_view, baseclasses_view->lastItem(), + QString::null, "public", QString( "%1" ).arg( scope_box->currentItem() ), QString::null, "false" ); + setStateOfInheritanceEditors( true ); + public_button->setChecked( true ); + virtual_box->setChecked( false ); + basename_edit->setText( QString::null ); + basename_edit->setFocus(); + baseclasses_view->setSelected( it, true ); +} + +void CppNewClassDialog::remBaseClass() +{ + bool basename_focused = false; + if ( basename_edit->hasFocus() ) + { + basename_focused = true; + basename_edit->clearFocus(); + } + if ( baseclasses_view->selectedItem() ) + { + QListViewItem * it = baseclasses_view->selectedItem(); + remClassFromAdv( it->text( 0 ) ); + baseclasses_view->selectedItem() ->setSelected( false ); + if ( it->itemBelow() ) + baseclasses_view->setSelected( it->itemBelow(), true ); + else if ( it->itemAbove() ) + baseclasses_view->setSelected( it->itemAbove(), true ); + delete it; + if ( baseclasses_view->childCount() == 0 ) + setStateOfInheritanceEditors( false ); + baseincludeModified = false; + } + if ( basename_focused ) + basename_edit->setFocus(); +} + +void CppNewClassDialog::remBaseClassOnly() +{ + if ( baseclasses_view->selectedItem() ) + { + QListViewItem * it = baseclasses_view->selectedItem(); + baseclasses_view->selectedItem() ->setSelected( false ); + if ( it->itemBelow() ) + baseclasses_view->setSelected( it->itemBelow(), true ); + else if ( it->itemAbove() ) + baseclasses_view->setSelected( it->itemAbove(), true ); + delete it; + if ( baseclasses_view->childCount() == 0 ) + setStateOfInheritanceEditors( false ); + baseincludeModified = true; + } +} + +void CppNewClassDialog::remClassFromAdv( QString text ) +{ + // Strip off namespace qualification + if ( text.contains( "::" ) ) + text = text.mid( text.findRev( "::" ) + 2 ); + + removeTemplateParams( text ); + QListViewItem *it = 0; + if ( ( it = access_view->findItem( text, 0 ) ) ) + delete it; + if ( ( it = methods_view->findItem( text, 0 ) ) ) + delete it; + if ( ( it = constructors_view->findItem( text, 0 ) ) ) + { + /// @todo changing constructors text in constructors_cpp_edit + // and constructors_h_edit must be implemented + + /* int *para = new int(1); + int *index = new int(1); + if (constructors_cpp_edit->find(text + "(", true, false, true, para, index)) + { + qWarning("%s( found", text.latin1()); + if (para) constructors_cpp_edit->removeParagraph(*para); + }*/ + delete it; + } +} + +void CppNewClassDialog::currBaseNameChanged( const QString &text ) +{ + if ( baseclasses_view->selectedItem() && ( basename_edit->hasFocus() ) ) + { + if ( class_tabs->isTabEnabled( tab2 ) ) + { + //check for this class in the adv. inheritance lists + //and delete if it exists + remClassFromAdv( baseclasses_view->selectedItem() ->text( 0 ) ); + //parse new base class + parseClass( text, baseclasses_view->selectedItem() ->text( 1 ) ); + } + baseclasses_view->selectedItem() ->setText( 0, text ); + updateConstructorsOrder(); + } +} + +void CppNewClassDialog::currBasePrivateSet() +{ + if ( baseclasses_view->selectedItem() ) + { + setAccessForBase( baseclasses_view->selectedItem() ->text( 0 ), "private" ); + baseclasses_view->selectedItem() ->setText( 1, ( virtual_box->isChecked() ? "virtual " : "" ) + QString( "private" ) ); + } +} + +void CppNewClassDialog::currBaseProtectedSet() +{ + if ( baseclasses_view->selectedItem() ) + { + setAccessForBase( baseclasses_view->selectedItem() ->text( 0 ), "protected" ); + baseclasses_view->selectedItem() ->setText( 1, ( virtual_box->isChecked() ? "virtual " : "" ) + QString( "protected" ) ); + } +} + +void CppNewClassDialog::currBasePublicSet() +{ + if ( baseclasses_view->selectedItem() ) + { + setAccessForBase( baseclasses_view->selectedItem() ->text( 0 ), "public" ); + baseclasses_view->selectedItem() ->setText( 1, ( virtual_box->isChecked() ? "virtual " : "" ) + QString( "public" ) ); + } +} + +void CppNewClassDialog::scopeboxActivated( int value ) +{ + if ( baseclasses_view->selectedItem() ) + { + baseclasses_view->selectedItem() ->setText( 2, QString( "%1" ).arg( value ) ); + } +} + +void CppNewClassDialog::currBaseVirtualChanged( int val ) +{ + if ( baseclasses_view->selectedItem() ) + { + baseclasses_view->selectedItem() ->setText( 1, QString( val ? "virtual " : "" ) + + QString( private_button->isChecked() ? "private" : "" ) + + QString( protected_button->isChecked() ? "protected" : "" ) + + QString( public_button->isChecked() ? "public" : "" ) ); + } +} + +void CppNewClassDialog::currBaseSelected( QListViewItem *it ) +{ + if ( it == 0 ) + { + setStateOfInheritanceEditors( false, false ); + return ; + } + setStateOfInheritanceEditors( true ); + basename_edit->setText( it->text( 0 ) ); + baseinclude_edit->setText( it->text( 3 ) ); + scope_box->setCurrentItem( it->text( 2 ).toInt() ); + if ( it->text( 1 ).contains( "private" ) ) + private_button->setChecked( true ); + else + private_button->setChecked( false ); + if ( it->text( 1 ).contains( "protected" ) ) + protected_button->setChecked( true ); + else + protected_button->setChecked( false ); + if ( it->text( 1 ).contains( "public" ) ) + public_button->setChecked( true ); + else + public_button->setChecked( false ); + if ( it->text( 1 ).contains( "virtual" ) ) + virtual_box->setChecked( true ); + else + virtual_box->setChecked( false ); + checkUpButtonState(); + checkDownButtonState(); + + if ( it->text( 4 ) == "true" ) + baseincludeModified = true; + else + baseincludeModified = false; +} + +void CppNewClassDialog::upbaseclass_button_clicked() +{ + bool basename_focused = false; + if ( basename_edit->hasFocus() ) + { + basename_focused = true; + basename_edit->clearFocus(); + } + if ( baseclasses_view->selectedItem() ) + { + QListViewItem * it = baseclasses_view->selectedItem(); + if ( it->itemAbove() ) + { + QListViewItem * newit; + if ( it->itemAbove() ->itemAbove() ) + newit = new QListViewItem( baseclasses_view, it->itemAbove() ->itemAbove(), + it->text( 0 ), it->text( 1 ), it->text( 2 ), it->text( 3 ), it->text( 4 ) ); + else + newit = new QListViewItem( baseclasses_view, it->text( 0 ), it->text( 1 ), + it->text( 2 ), it->text( 3 ), it->text( 4 ) ); + remBaseClassOnly(); + baseclasses_view->setSelected( newit, true ); + checkUpButtonState(); + updateConstructorsOrder(); + } + } + if ( basename_focused ) + basename_edit->setFocus(); +} + +void CppNewClassDialog::downbaseclass_button_clicked() +{ + bool basename_focused = false; + if ( basename_edit->hasFocus() ) + { + basename_focused = true; + basename_edit->clearFocus(); + } + if ( baseclasses_view->selectedItem() ) + { + QListViewItem * it = baseclasses_view->selectedItem(); + if ( it->itemBelow() ) + { + QListViewItem * newit = new QListViewItem( baseclasses_view, it->itemBelow(), + it->text( 0 ), it->text( 1 ), it->text( 2 ), it->text( 3 ), it->text( 3 ) ); + remBaseClassOnly(); + baseclasses_view->setSelected( newit, true ); + setStateOfInheritanceEditors( true ); + checkDownButtonState(); + updateConstructorsOrder(); + } + } + if ( basename_focused ) + basename_edit->setFocus(); +} + +void CppNewClassDialog::updateConstructorsOrder() +{ + QListViewItemIterator it( baseclasses_view ); + QListViewItem *c_it; + QListViewItem *fc_it = 0; + + while ( it.current() ) + { + if ( ( c_it = constructors_view->findItem( it.current() ->text( 0 ), 0 ) ) ) + { + c_it->moveItem( fc_it ); + fc_it = c_it; + } + ++it; + } +} + + +void CppNewClassDialog::checkUpButtonState() +{ + if ( baseclasses_view->selectedItem() ) + upbaseclass_button->setEnabled( baseclasses_view->selectedItem() ->itemAbove() ); +} + +void CppNewClassDialog::checkDownButtonState() +{ + if ( baseclasses_view->selectedItem() ) + downbaseclass_button->setEnabled( baseclasses_view->selectedItem() ->itemBelow() ); +} + +void CppNewClassDialog::baseclasses_view_selectionChanged() +{ + /* if (baseclasses_view->selectedItem()) + { + setStateOfInheritanceEditors(false, false); + }*/ +} + +void CppNewClassDialog::changeToPrivate() +{ + if ( access_view->selectedItem() ) + access_view->selectedItem() ->setText( 2, "private" ); +} + +void CppNewClassDialog::changeToProtected() +{ + if ( access_view->selectedItem() ) + access_view->selectedItem() ->setText( 2, "protected" ); +} + +void CppNewClassDialog::changeToPublic() +{ + if ( access_view->selectedItem() ) + access_view->selectedItem() ->setText( 2, "public" ); +} + +void CppNewClassDialog::changeToInherited() +{ + if ( access_view->selectedItem() ) + access_view->selectedItem() ->setText( 2, QString::null ); +} + +void CppNewClassDialog::newTabSelected( const QString& /*text*/ ) +{ + /* if (text == i18n("&Advanced Inheritance")) + reloadAdvancedInheritance(true);*/ +} + +void CppNewClassDialog::newTabSelected( QWidget* /*w*/ ) +{ + /* if ( QString(w->name()) == QString("tab2")) + { + reloadAdvancedInheritance(false); + }*/ +} + + +void CppNewClassDialog::reloadAdvancedInheritance( bool clean ) +{ + clearConstructorsList( clean ); + clearMethodsList( clean ); + clearUpgradeList( clean ); + + QListViewItemIterator it( baseclasses_view ); + while ( it.current() ) + { + if ( ! ( it.current() ->text( 0 ).isEmpty() ) ) + { + parseClass( it.current() ->text( 0 ), it.current() ->text( 1 ) ); + } + ++it; + } +} + +void CppNewClassDialog::parseClass( QString clName, QString inheritance ) +{ + // Determine namespace + QStringList clNamespace = currNamespace; + bool clFullQualified = false; + + if ( clName.contains( "::" ) ) + { + // Full qualified, override imported namespace + clFullQualified = true; + int splitpoint = clName.findRev( "::" ); + clNamespace = QStringList::split( "::", clName.left( splitpoint ) ); + clName = clName.mid( splitpoint + 2 ); + } + + kdDebug( 9007 ) << "clFullQualified = " << clFullQualified << endl; + kdDebug( 9007 ) << "clName = " << clName << endl; + QString debMsg = "clNamespace = "; + for ( QStringList::const_iterator it = clNamespace.begin(); + it != clNamespace.end(); ++it ) + debMsg += ( *it ) + "::"; + kdDebug( 9007 ) << debMsg << endl; + + QString templateAdd = templateActualParamsFormatted( clName ); + removeTemplateParams( clName ); + + ClassList myClasses; // = m_part->codeModel()->globalNamespace()->classByName(clName); + + NamespaceDom namespaceDom = m_part->codeModel() ->globalNamespace(); + + QStringList::const_iterator namespaceIt = clNamespace.begin(); + for ( ; namespaceIt != clNamespace.end(); ++namespaceIt ) + { + if ( ! namespaceDom -> hasNamespace( *namespaceIt ) ) + break; + namespaceDom = namespaceDom->namespaceByName( *namespaceIt ); + } + if ( namespaceIt == clNamespace.end() ) + { + // Found specified namespace + myClasses = namespaceDom->classByName( clName ); + // Fall back to global namespace if class was not fully qualified and is not found in selected namespace + if ( myClasses.empty() && ! clFullQualified ) + myClasses = m_part -> codeModel() -> globalNamespace() -> classByName( clName ); + } + + if ( myClasses.empty() ) + { + kdDebug() << "Trying persistent class store..." << endl; + parsePCSClass( clName, inheritance ); + } + + for ( ClassList::const_iterator classIt = myClasses.begin(); classIt != myClasses.end(); ++classIt ) + { + PCheckListItem *it = new PCheckListItem( *classIt, constructors_view, ( *classIt ) ->name() ); + it->templateAddition = templateAdd; + PListViewItem *over = new PListViewItem( *classIt, methods_view, ( *classIt ) ->name() ); + over->templateAddition = templateAdd; + QListViewItem *over_methods = new QListViewItem( over, i18n( "Methods" ) ); + QListViewItem *over_slots = new QListViewItem( over, i18n( "Slots (Qt-specific)" ) ); + PListViewItem *access = new PListViewItem( *classIt, access_view, ( *classIt ) ->name() ); + QListViewItem *access_methods = new QListViewItem( access, i18n( "Methods" ) ); + QListViewItem *access_slots = new QListViewItem( access, i18n( "Slots (Qt-specific)" ) ); + QListViewItem *access_attrs = new QListViewItem( access, i18n( "Attributes" ) ); + + FunctionList functionList = ( *classIt ) ->functionList(); + for ( FunctionList::const_iterator methodIt = functionList.begin(); + methodIt != functionList.end(); ++methodIt ) + { + if ( ( *methodIt ) ->isSignal() ) + { + // don't show signals as overridable methods + } + else if ( isConstructor( ( *classIt ) ->name(), *methodIt ) ) + { + addToConstructorsList( it, *methodIt ); + } + else if ( ( *methodIt ) ->isSlot() ) + { + if ( ( *methodIt ) ->access() != CodeModelItem::Private ) + { + addToMethodsList( over_slots, *methodIt ); + + QString inhModifier; + //protected inheritance gives protected attributes + if ( inheritance.contains( "protected" ) ) + inhModifier = "protected"; + //private inheritance gives private attributes + else if ( inheritance.contains( "private" ) ) + inhModifier = "private"; + //public inheritance gives protected and public attributes + else if ( inheritance.contains( "public" ) ) + inhModifier = ( *methodIt ) ->access() == CodeModelItem::Public ? "public" : "protected"; + addToUpgradeList( access_slots, *methodIt, inhModifier ); + } + } + else + { + // display only public and protected methods of the base class + if ( ( !isDestructor( ( *classIt ) ->name(), *methodIt ) ) && ( ( *methodIt ) ->access() != CodeModelItem::Private ) ) + { + addToMethodsList( over_methods, *methodIt ); + + // see what modifier is given for the base class + QString inhModifier; + //protected inheritance gives protected methods + if ( inheritance.contains( "protected" ) ) + inhModifier = "protected"; + //private inheritance gives private methods + else if ( inheritance.contains( "private" ) ) + inhModifier = "private"; + //public inheritance gives protected and public methods + else if ( inheritance.contains( "public" ) ) + inhModifier = ( *methodIt ) ->access() == CodeModelItem::Public ? "public" : "protected"; + addToUpgradeList( access_methods, *methodIt, inhModifier ); + } + } + } + + VariableList variableList = ( *classIt ) ->variableList(); + for ( VariableList::const_iterator varIt = variableList.begin(); + varIt != variableList.end(); ++varIt ) + { + if ( ( *varIt ) ->access() != CodeModelItem::Private ) + { + QString inhModifier; + //protected inheritance gives protected attributes + if ( inheritance.contains( "protected" ) ) + inhModifier = "protected"; + //private inheritance gives private attributes + else if ( inheritance.contains( "private" ) ) + inhModifier = "private"; + //public inheritance gives protected and public attributes + else if ( inheritance.contains( "public" ) ) + inhModifier = ( *varIt ) ->access() == CodeModelItem::Public ? "public" : "protected"; + addToUpgradeList( access_attrs, *varIt, inhModifier ); + } + } + } +} + +bool CppNewClassDialog::isConstructor( QString className, const FunctionDom &method ) +{ + // regexp: myclass\\s*\\(\\s*(const)?\\s*myclass\\s*&[A-Za-z_0-9\\s]*\\) is for copy constructors + if ( ( className == method->name() ) ) + { + qWarning( "1x" ); + if ( ( method->argumentList().count() == 1 ) && ( m_part->formatModelItem( method->argumentList() [ 0 ].data() ).contains( QRegExp( " *(const)? *" + className + " *& *" ) ) ) ) + // if ( method->asString().contains(QRegExp(className + "\\s*\\(\\s*(const)?\\s*" + className + "\\s*&[A-Za-z_0-9\\s]*\\)", true, false)) ) + return false; + else + return true; + } + else + return false; +} + +void CppNewClassDialog::addToConstructorsList( QCheckListItem *myClass, FunctionDom method ) +{ + new PCheckListItem( method, myClass, m_part->formatModelItem( method.data() ), QCheckListItem::RadioButton ); +} + +void CppNewClassDialog::addToMethodsList( QListViewItem *parent, FunctionDom method ) +{ + PCheckListItem *it = new PCheckListItem( method, parent, m_part->formatModelItem( method.data() ), QCheckListItem::CheckBox ); + method->isAbstract() ? it->setText( 1, i18n( "replace" ) ) : it->setText( 1, i18n( "extend" ) ); +} + +void CppNewClassDialog::addToUpgradeList( QListViewItem *parent, FunctionDom method, QString modifier ) +{ + PListViewItem *it = new PListViewItem( method, parent, m_part->formatModelItem( method.data() ) ); + it->setText( 1, modifier ); +} + +void CppNewClassDialog::addToUpgradeList( QListViewItem *parent, VariableDom attr, QString modifier ) +{ + PListViewItem *it = new PListViewItem( attr, parent, m_part->formatModelItem( attr.data() ) ); + it->setText( 1, modifier ); +} + + +void CppNewClassDialog::parsePCSClass( QString clName, QString inheritance ) +{ + // Determine namespace + QStringList clNamespace = currNamespace; + bool clFullQualified = false; + + if ( clName.contains( "::" ) ) + { + // Full qualified, override imported namespace + clFullQualified = true; + int splitpoint = clName.findRev( "::" ); + clNamespace = QStringList::split( "::", clName.left( splitpoint ) ); + clName = clName.mid( splitpoint + 2 ); + } + + kdDebug( 9007 ) << "clFullQualified = " << clFullQualified << endl; + kdDebug( 9007 ) << "clName = " << clName << endl; + kdDebug( 9007 ) << "clNamespace = " << clNamespace.join( "." ) << endl; + + QString templateAdd = templateActualParamsFormatted( clName ); + removeTemplateParams( clName ); + + myModel = new CodeModel(); + StoreConverter converter( m_part, myModel ); + converter.PCSClassToCodeModel( clName, clNamespace ); + + ClassList myClasses = myModel->globalNamespace() ->classByName( clName ); + // kdDebug() << " tag class count: " << myClasses.count() << endl; + + for ( ClassList::const_iterator classIt = myClasses.begin(); classIt != myClasses.end(); ++classIt ) + { + kdDebug() << " this is class " << ( *classIt ) ->name() << endl; + PCheckListItem *it = new PCheckListItem( *classIt, constructors_view, ( *classIt ) ->name() ); + it->templateAddition = templateAdd; + PListViewItem *over = new PListViewItem( *classIt, methods_view, ( *classIt ) ->name() ); + over->templateAddition = templateAdd; + QListViewItem *over_methods = new QListViewItem( over, i18n( "Methods" ) ); + QListViewItem *over_slots = new QListViewItem( over, i18n( "Slots (Qt-specific)" ) ); + PListViewItem *access = new PListViewItem( *classIt, access_view, ( *classIt ) ->name() ); + QListViewItem *access_methods = new QListViewItem( access, i18n( "Methods" ) ); + QListViewItem *access_slots = new QListViewItem( access, i18n( "Slots (Qt-specific)" ) ); + QListViewItem *access_attrs = new QListViewItem( access, i18n( "Attributes" ) ); + + FunctionList functionList = ( *classIt ) ->functionList(); + for ( FunctionList::const_iterator methodIt = functionList.begin(); + methodIt != functionList.end(); ++methodIt ) + { + if ( ( *methodIt ) ->isSignal() ) + { + //don't show signals as overridable methods + } + else if ( isConstructor( ( *classIt ) ->name(), *methodIt ) ) + { + addToConstructorsList( it, *methodIt ); + } + else if ( ( *methodIt ) ->isSlot() ) + { + if ( ( *methodIt ) ->access() != CodeModelItem::Private ) + { + addToMethodsList( over_slots, *methodIt ); + + QString inhModifier; + //protected inheritance gives protected attributes + if ( inheritance.contains( "protected" ) ) + inhModifier = "protected"; + //private inheritance gives private attributes + else if ( inheritance.contains( "private" ) ) + inhModifier = "private"; + //public inheritance gives protected and public attributes + else if ( inheritance.contains( "public" ) ) + inhModifier = ( *methodIt ) ->access() == CodeModelItem::Public ? "public" : "protected"; + addToUpgradeList( access_slots, *methodIt, inhModifier ); + } + } + else + { + //display only public and protected methods of the base class + if ( ( !isDestructor( ( *classIt ) ->name(), *methodIt ) ) && ( ( *methodIt ) ->access() != CodeModelItem::Private ) ) + { + addToMethodsList( over_methods, *methodIt ); + + //see what modifier is given for the base class + QString inhModifier; + //protected inheritance gives protected methods + if ( inheritance.contains( "protected" ) ) + inhModifier = "protected"; + //private inheritance gives private methods + else if ( inheritance.contains( "private" ) ) + inhModifier = "private"; + //public inheritance gives protected and public methods + else if ( inheritance.contains( "public" ) ) + inhModifier = ( *methodIt ) ->access() == CodeModelItem::Public ? "public" : "protected"; + addToUpgradeList( access_methods, *methodIt, inhModifier ); + } + } + } + + VariableList variableList = ( *classIt ) ->variableList(); + for ( VariableList::const_iterator varIt = variableList.begin(); + varIt != variableList.end(); ++varIt ) + { + if ( ( *varIt ) ->access() != CodeModelItem::Private ) + { + QString inhModifier; + //protected inheritance gives protected attributes + if ( inheritance.contains( "protected" ) ) + inhModifier = "protected"; + //private inheritance gives private attributes + else if ( inheritance.contains( "private" ) ) + inhModifier = "private"; + //public inheritance gives protected and public attributes + else if ( inheritance.contains( "public" ) ) + inhModifier = ( *varIt ) ->access() == CodeModelItem::Public ? "public" : "protected"; + addToUpgradeList( access_attrs, *varIt, inhModifier ); + } + } + } +} + +void CppNewClassDialog::clear_selection_button_clicked() +{ + QListViewItemIterator it( constructors_view ); + while ( it.current() ) + { + PCheckListItem *curr; + if ( ( curr = dynamic_cast* >( it.current() ) ) ) + curr->setOn( false ); + ++it; + } +} + +void CppNewClassDialog::clearConstructorsList( bool clean ) +{ + if ( clean ) + constructors_view->clear(); + /* else + { + QListViewItemIterator it( constructors_view ); + while ( it.current() ) + { + if ( ! currBaseClasses.contains(it.current().text(0)) ) + delete it.current(); + ++it; + } + }*/ +} + +void CppNewClassDialog::clearMethodsList( bool clean ) +{ + if ( clean ) + methods_view->clear(); +} + +void CppNewClassDialog::clearUpgradeList( bool clean ) +{ + if ( clean ) + access_view->clear(); +} + +void CppNewClassDialog::setAccessForItem( QListViewItem *curr, QString newAccess, bool isPublic ) +{ + if ( newAccess == "public" ) + curr->setText( 1, isPublic ? "public" : "protected" ); + else + curr->setText( 1, newAccess ); + if ( !curr->text( 2 ).isEmpty() ) + { + if ( ( curr->text( 2 ) == "private" ) && ( ( newAccess == "public" ) || ( newAccess == "protected" ) ) ) + curr->setText( 2, QString::null ); + if ( ( curr->text( 2 ) == "protected" ) && ( ( newAccess == "public" ) && ( isPublic ) ) ) + curr->setText( 2, QString::null ); + } +} + +void CppNewClassDialog::setAccessForBase( QString baseclass, QString newAccess ) +{ + QListViewItem * base; + + if ( ( base = access_view->findItem( baseclass, 0 ) ) ) + { + QListViewItemIterator it( base ); + while ( it.current() ) + { + if ( !it.current() ->text( 1 ).isEmpty() ) + { + PListViewItem *curr; + PListViewItem *curr_m; + if ( ( curr = dynamic_cast* >( it.current() ) ) ) + setAccessForItem( curr, newAccess, curr->item() ->access() == CodeModelItem::Public ); + else if ( ( curr_m = dynamic_cast* >( it.current() ) ) ) + setAccessForItem( curr_m, newAccess, curr_m->item() ->access() == CodeModelItem::Public ); + } + ++it; + } + } +} + + +void CppNewClassDialog::access_view_mouseButtonPressed( int button, QListViewItem * item, const QPoint &p, int /*c*/ ) +{ + if ( item && ( ( button == LeftButton ) || ( button == RightButton ) ) && ( item->depth() > 1 ) ) + { + accessMenu->setItemEnabled( 1, true ); + accessMenu->setItemEnabled( 2, true ); + accessMenu->setItemEnabled( 3, true ); + if ( item->text( 1 ) == "protected" ) + { + accessMenu->setItemEnabled( 1, false ); + } + if ( item->text( 1 ) == "public" ) + { + accessMenu->setItemEnabled( 1, false ); + accessMenu->setItemEnabled( 2, false ); + } + accessMenu->exec( p ); + + /* accessMenu->setItemEnabled(1, item->text(1) == "private" ? false : true ); + accessMenu->setItemEnabled(2, item->text(1) == "protected" ? false : true ); + accessMenu->setItemEnabled(3, item->text(1) == "public" ? false : true );*/ + } +} + + +void CppNewClassDialog::methods_view_mouseButtonPressed( int button , QListViewItem * item, const QPoint&p , int /*c*/ ) +{ + if ( item && ( button == RightButton ) && ( item->depth() > 1 ) && ( ! item->text( 1 ).isEmpty() ) ) + { + overMenu->exec( p ); + } +} + +void CppNewClassDialog::extendFunctionality() +{ + if ( methods_view->selectedItem() ) + methods_view->selectedItem() ->setText( 1, i18n( "extend" ) ); +} + +void CppNewClassDialog::replaceFunctionality() +{ + if ( methods_view->selectedItem() ) + methods_view->selectedItem() ->setText( 1, i18n( "replace" ) ); +} + +void CppNewClassDialog::selectall_button_clicked() +{ + QListViewItemIterator it( constructors_view ); + while ( it.current() ) + { + PCheckListItem *curr; + if ( ( curr = dynamic_cast* >( it.current() ) ) ) + curr->setOn( true ); + ++it; + } +} + +void CppNewClassDialog::to_constructors_list_clicked() +{ + QString templateAdd = templateStrFormatted().isEmpty() ? QString::null : templateStrFormatted() + "\n"; + QString constructor_h = classNameFormatted(); + QString constructor_cpp = templateAdd + classNameFormatted() + templateParamsFormatted() + "::" + classNameFormatted(); + constructor_h += "("; + constructor_cpp += "("; + QString params_h; + QString params_cpp; + QString base; + int unnamed = 1; + + QListViewItemIterator it( constructors_view ); + while ( it.current() ) + { + PCheckListItem *curr; + if ( ( curr = dynamic_cast* >( it.current() ) ) ) + { + if ( curr->isOn() && curr->parent() ) + { + //fill the base classes list + base += base.isEmpty() ? ": " : ", "; + base += curr->parent() ->text( 0 ); + PCheckListItem *p; + if ( ( p = dynamic_cast* >( curr->parent() ) ) ) + { + base += p->templateAddition; + } + params_h += params_h.isEmpty() ? "" : ", "; + + //fill arguments for both constructor and base class initializer + QString cparams; + QString bparams; + ArgumentList argumentList = curr->item() ->argumentList(); + for ( ArgumentList::const_iterator argIt = argumentList.begin(); + argIt != argumentList.end(); ++argIt ) + { + bparams += bparams.isEmpty() ? "" : ", "; + cparams += cparams.isEmpty() ? "" : ", "; + cparams += ( *argIt ) ->type() + " "; + if ( ( *argIt ) ->name().isEmpty() ) + { + cparams += QString( "arg%1" ).arg( unnamed ); + bparams += QString( "arg%1" ).arg( unnamed++ ); + } + else + { + bparams += ( *argIt ) ->name(); + cparams += ( *argIt ) ->name(); + } + if ( !( *argIt ) ->defaultValue().isEmpty() ) + bparams += " = " + ( *argIt ) ->defaultValue(); + } + params_h += cparams; + params_cpp = params_h; + base += "(" + bparams + ")"; + } + } + ++it; + } + + constructor_cpp += params_cpp + ")" + base + QString( "\n{\n}\n\n\n" ); + constructor_h += params_h + ");\n\n"; + + constructors_h_edit->append( constructor_h ); + constructors_cpp_edit->append( constructor_cpp ); +} + + + +/* ---------------------------------------------------------- + ---------------------------------------------------------- + ---------------------------------------------------------- + ---------------------------------------------------------- + + class CppNewClassDialog::ClassGenerator + + ---------------------------------------------------------- + ---------------------------------------------------------- + ---------------------------------------------------------- + ---------------------------------------------------------- */ + + +bool CppNewClassDialog::ClassGenerator::validateInput() +{ + className = dlg.classname_edit->text().simplifyWhiteSpace(); + QString temp = className; + className.replace( QRegExp( "template *<.*> *(class *)?" ), "" ); + templateStr = temp.replace( QRegExp( QRegExp_escape( className ) ), "" ); + templateStr.replace( QRegExp( " *class *$" ), "" ); + + templateParams = templateStr; + templateParams.replace( QRegExp( "^ *template *" ), "" ); + templateParams.replace( QRegExp( " *class *" ), "" ); + templateParams.simplifyWhiteSpace(); + + if ( className.isEmpty() ) + { + KMessageBox::error( &dlg, i18n( "You must enter a classname." ) ); + return false; + } + + header = dlg.header_edit->text().simplifyWhiteSpace(); + if ( header.isEmpty() ) + { + KMessageBox::error( &dlg, i18n( "You must enter a name for the header file." ) ); + return false; + } + implementation = dlg.implementation_edit->text().simplifyWhiteSpace(); + if ( (!headeronly) && implementation.isEmpty() ) + { + KMessageBox::error( &dlg, i18n( "You must enter a name for the implementation file." ) ); + return false; + } + + /// \FIXME + if ( ( header.find( '/' ) != -1 || implementation.find( '/' ) != -1 ) && !( dlg.m_part->project() ->options() & KDevProject::UsesQMakeBuildSystem) ) + { + KMessageBox::error( &dlg, i18n( "Generated files will always be added to the " + "active directory, so you must not give an " + "explicit subdirectory." ) ); + return false; + } + + return true; +} + + +bool CppNewClassDialog::ClassGenerator::generate() +{ + if ( !validateInput() ) + return false; + + project = dlg.m_part->project(); + subDir = project->projectDirectory() + "/"; + if ( !project->activeDirectory().isEmpty() ){ + subDir += project->activeDirectory(); + subDir = QDir::cleanDirPath(subDir); + subDir += "/"; + } + headerPath = subDir + header; + implementationPath = subDir + implementation; + + if ( QFileInfo( headerPath ).exists() || QFileInfo( implementationPath ).exists() ) + { + KMessageBox::error( &dlg, i18n( "KDevelop is not able to add classes " + "to existing header or implementation files." ) ); + return false; + } + + if( ( dlg.m_part->project() ->options() & KDevProject::UsesQMakeBuildSystem) ) + { + QDir dir( QFileInfo( project->projectDirectory()+QString( QChar( QDir::separator() ) )+project->activeDirectory() + QString( QChar( QDir::separator() ) ) + header ).dirPath() ); + kdDebug(9024) << "Dir for new file:" << dir.absPath() << endl; + if( dir.isRelative() ) + dir.convertToAbs(); + + QValueStack dirsToCreate; + while( !dir.exists() ) + { + dirsToCreate.push( dir.dirName() ); + dir.cdUp(); + } + + while( !dirsToCreate.isEmpty() ) + { + dir.mkdir( dirsToCreate.top() ); + dir.cd( dirsToCreate.pop() ); + } + } + common_text(); + + if(!headeronly) gen_implementation(); + + gen_interface(); + + QStringList fileList; + QString file; + if( project->activeDirectory().isEmpty() ) + file = header; + else + file = project->activeDirectory() + "/" + header; + fileList.append ( file ); + if (!headeronly) + { + if( project->activeDirectory().isEmpty() ) + file = implementation; + else + file = project->activeDirectory() + "/" + implementation; + fileList.append ( file ); + } + project->addFiles ( fileList ); + + return true; +} + +void CppNewClassDialog::ClassGenerator::common_text() +{ + + // common + + namespaceStr = dlg.namespace_edit->text(); + namespaces = QStringList::split( QString( "::" ), namespaceStr ); + + childClass = dlg.childclass_box->isChecked(); + objc = dlg.objc_box->isChecked(); + qobject = dlg.qobject_box->isChecked(); + gtk = dlg.gtk_box->isChecked(); + headeronly = dlg.headeronly_box->isChecked(); + + if ( ( dlg.baseclasses_view->childCount() == 0 ) && childClass ) + new QListViewItem( dlg.baseclasses_view, "QWidget", "public" ); + if ( objc && ( dlg.baseclasses_view->childCount() == 0 ) ) + new QListViewItem( dlg.baseclasses_view, "NSObject", "public" ); + + if ( dlg.documentation_edit->text().isEmpty() && ( !dlg.gen_config->doc_box->isChecked() ) ) + doc = ""; + else + { + doc = QString( "/**\n" ); + if ( !dlg.documentation_edit->text().isEmpty() ) + { + doc.append( dlg.documentation_edit->text() ); + if ( dlg.gen_config->author_box->isChecked() ) + doc.append( "\n\n" ); + } + QString author = DomUtil::readEntry( *dlg.m_part->projectDom(), "/general/author" ); + QString email = DomUtil::readEntry( *dlg.m_part->projectDom(), "/general/email" ); + if( !email.isEmpty() ) + author += QString( " <%1>" ).arg( email ); + + if ( dlg.gen_config->author_box->isChecked() ) + doc.append( "\t@author " + author + "\n" ); + doc.append( "*/" ); + } + + if ( !namespaceStr.isEmpty() ) + { + for ( QStringList::Iterator it = namespaces.begin(); it != namespaces.end(); ++it ) + { + if ( !namespaceBeg.isEmpty() ) + namespaceBeg += "\n\n"; + if ( !namespaceEnd.isEmpty() ) + namespaceEnd += "\n\n"; + namespaceBeg += "namespace " + ( *it ) + " {"; + namespaceEnd += "}"; + } + } + + //advanced constructor creation + + advConstructorsHeader = QString::null; + advConstructorsSource = QString::null; + if ( !dlg.constructors_h_edit->text().isEmpty() ) + { + advConstructorsHeader = " " + dlg.constructors_h_edit->text(); + advConstructorsHeader.replace( QRegExp( "\n" ), "\n " ); + } + if ( !dlg.constructors_cpp_edit->text().isEmpty() ) + { + advConstructorsSource = dlg.constructors_cpp_edit->text(); + } + advConstructorsHeader.replace( QRegExp( "[\\n ]*$" ), QString::null ); + advConstructorsSource.replace( QRegExp( "[\\n ]*$" ), QString::null ); + + //advanced method overriding + + advH_public = QString::null; + advH_public_slots = QString::null; + advH_protected = QString::null; + advH_protected_slots = QString::null; + advH_private = QString::null; + advH_private_slots = QString::null; + advCpp = QString::null; + + QListViewItemIterator it( dlg.methods_view ); + while ( it.current() ) + { + PCheckListItem *curr; + if ( ( curr = dynamic_cast* >( it.current() ) ) ) + { + if ( curr->isOn() && ( curr->parent() ) && ( curr->parent() ->parent() ) ) + { + QString * adv_h = 0; + if ( curr->item() ->access() == CodeModelItem::Private ) + adv_h = curr->item() ->isSlot() ? &advH_private_slots : &advH_private; + if ( curr->item() ->access() == CodeModelItem::Protected ) + adv_h = curr->item() ->isSlot() ? &advH_protected_slots : &advH_protected; + if ( curr->item() ->access() == CodeModelItem::Public ) + adv_h = curr->item() ->isSlot() ? &advH_public_slots : &advH_public; + + // if (advCpp.isEmpty()) advCpp += "\n\n"; + + QString bcName = curr->parent() ->parent() ->text( 0 ); + PListViewItem *bc; + if ( ( bc = dynamic_cast* >( curr->parent() ->parent() ) ) ) + { + bcName += bc->templateAddition; + } + genMethodDeclaration( curr->item(), className, templateStr, adv_h, &advCpp, + ( curr->text( 1 ) == i18n( "extend" ) ) ? true : false, bcName ); + } + } + ++it; + } + + //advanced access control and upgrading + QListViewItemIterator ita( dlg.access_view ); + while ( ita.current() ) + { + PListViewItem *curr; + PListViewItem *curr_m; + if ( ( curr = dynamic_cast* >( ita.current() ) ) ) + { + if ( ( !curr->text( 2 ).isEmpty() ) && ( curr->parent() ) && ( curr->parent() ->parent() ) ) + { + QString * adv_h = 0; + if ( curr->text( 2 ) == "private" ) + adv_h = &advH_private; + if ( curr->text( 2 ) == "public" ) + adv_h = &advH_public; + if ( curr->text( 2 ) == "protected" ) + adv_h = &advH_protected; + + /* if ((*adv_h).isEmpty()) + *adv_h += "\n\n";*/ + if ( adv_h ) + *adv_h += QString( " using " ) + curr->parent() ->parent() ->text( 0 ) + "::" + curr->item() ->name() + ";\n"; + } + } + else if ( ( curr_m = dynamic_cast* >( ita.current() ) ) ) + { + if ( ( !curr_m->text( 2 ).isEmpty() ) && ( curr_m->parent() ) && ( curr_m->parent() ->parent() ) ) + { + QString * adv_h = 0; + if ( curr_m->text( 2 ) == "private" ) + adv_h = &advH_private; + if ( curr_m->text( 2 ) == "public" ) + adv_h = &advH_public; + if ( curr_m->text( 2 ) == "protected" ) + adv_h = &advH_protected; + + /* if ((*adv_h).isEmpty()) + *adv_h += "\n\n";*/ + + QString methodName = curr_m->item() ->name(); + if ( !methodName.contains( QRegExp( "^[a-zA-z_]" ) ) ) + methodName = "operator" + methodName; + *adv_h += " using " + curr_m->parent() ->parent() ->text( 0 ) + "::" + methodName + ";\n"; + } + } + ++ita; + } + + QRegExp e( "[\\n ]*$" ); + advH_public.replace( e, QString::null ); + advH_public_slots.replace( e, QString::null ); + advH_protected.replace( e, QString::null ); + advH_protected_slots.replace( e, QString::null ); + advH_private.replace( e, QString::null ); + advH_private_slots.replace( e, QString::null ); + advCpp.replace( e, QString::null ); +} + +void CppNewClassDialog::ClassGenerator::genMethodDeclaration( FunctionDom method, + QString className, QString templateStr, QString *adv_h, QString *adv_cpp, bool extend, QString baseClassName ) +{ + /* if ((*adv_h).isEmpty()) + *adv_h += "\n\n";*/ + QString methodName = method->name(); + if ( !methodName.contains( QRegExp( "^[a-zA-z_]" ) ) ) + methodName = "operator" + methodName; + *adv_h += " " + ( method->isVirtual() ? QString( "virtual " ) : QString( "" ) ) + + ( method->isStatic() ? QString( "static " ) : QString( "" ) ) + + method->resultType() + " " + methodName + "("; + if ( !templateStr.isEmpty() ) + * adv_cpp += templateStr + "\n"; + *adv_cpp += method->resultType() + " " + className + templateParams + "::" + methodName + "("; + + QString bparams; + QString cparams; + int unnamed = 1; + + ArgumentList argumentList = method->argumentList(); + for ( ArgumentList::const_iterator argIt = argumentList.begin(); + argIt != argumentList.end(); ++argIt ) + { + bparams += bparams.isEmpty() ? "" : ", "; + cparams += cparams.isEmpty() ? "" : ", "; + cparams += ( *argIt ) ->type() + " "; + if ( ( *argIt ) ->name().isEmpty() ) + { + cparams += QString( "arg%1" ).arg( unnamed ); + bparams += QString( "arg%1" ).arg( unnamed++ ); + } + else + { + bparams += ( *argIt ) ->name(); + cparams += ( *argIt ) ->name(); + } + if ( !( *argIt ) ->defaultValue().isEmpty() ) + bparams += " " + ( *argIt ) ->defaultValue(); + } + *adv_h += cparams + ")" + ( method->isConstant() ? " const" : "" ) + ";\n"; + *adv_cpp += cparams + ")" + ( method->isConstant() ? " const" : "" ) + "\n{\n"; + if ( extend ) + * adv_cpp += ( ( method->resultType() == "void" ) ? " " : " return " ) + + baseClassName + "::" + methodName + "(" + bparams + ");\n"; + *adv_cpp += "}\n\n"; +} + + +void CppNewClassDialog::ClassGenerator::gen_implementation() +{ + + // implementation + + QString classImpl; + QFileInfo fi( implementationPath ); + QString module = fi.baseName(); + QString basefilename = fi.baseName( true ); + + if ( dlg.filetemplate_box->isChecked() ) + { + /* QDomDocument dom = *dlg.m_part->projectDom(); + if(DomUtil::readBoolEntry(dom,"/cppsupportpart/filetemplates/choosefiles",false)) + classImpl = FileTemplate::read(dlg.m_part, DomUtil::readEntry(dom,"/cppsupportpart/filetemplates/implementationURL",""), FileTemplate::Custom); + else*/ + classImpl = FileTemplate::read( dlg.m_part, fi.extension( true ) ); + } + + classImpl.replace( QRegExp( "\\$MODULE\\$" ), module ); + classImpl.replace( QRegExp( "\\$FILENAME\\$" ), basefilename ); + + if ( objc ) + { + classImpl += dlg.gen_config->objcSource(); + } + else if ( gtk ) + { + classImpl += dlg.gen_config->gtkSource(); + } + else + { + classImpl += dlg.gen_config->cppSource(); + /* classImpl += QString( + "#include \"$HEADER$\"\n" + "\n" + "\n") + + namespaceBeg + + ( advConstructorsSource.isEmpty() ? QString("$CLASSNAME$::$CLASSNAME$($ARGS$)\n" + "$BASEINITIALIZER$" + "{\n" + "}\n") : advConstructorsSource ) + + QString("\n" + "$CLASSNAME$::~$CLASSNAME$()\n" + "{\n" + "}\n") + + advCpp + + namespaceEnd;*/ + } + + QString relPath; + for ( int i = implementation.findRev( '/' ); i != -1; i = implementation.findRev( '/', --i ) ) + relPath += "../"; + + QString constructors = ( advConstructorsSource.isEmpty() ? QString( "$TEMPLATESTR$\n$CLASSNAME$$TEMPLATEPARAMS$::$CLASSNAME$($ARGS$)\n" + "$BASEINITIALIZER$" + "{\n" + "}" ) : advConstructorsSource ) + + QString( "\n\n\n" + "$TEMPLATESTR$\n$CLASSNAME$$TEMPLATEPARAMS$::~$CLASSNAME$()\n" + "{\n" + "}\n" ); + + qWarning( "NEW CLASS: constructors = %s", constructors.latin1() ); + + if ( childClass ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + { + argsH = "QWidget *parent = 0, const char *name = 0"; + argsCpp = "QWidget *parent, const char *name"; + } + else + { + argsH = "QWidget *parent = 0"; + argsCpp = "QWidget *parent"; + } + } + else if ( qobject ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + { + argsH = "QObject *parent = 0, const char *name = 0"; + argsCpp = "QObject *parent, const char *name"; + } + else + { + argsH = "QObject *parent = 0"; + argsCpp = "QObject *parent"; + } + } + else + { + argsH = ""; + argsCpp = ""; + } + QString baseInitializer; + + if ( childClass && ( dlg.baseclasses_view->childCount() == 0 ) ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + baseInitializer = " : QWidget(parent, name)"; + else + baseInitializer = " : QWidget(parent)"; + } + else if ( qobject && ( dlg.baseclasses_view->childCount() == 0 ) ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + baseInitializer = " : QObject(parent, name)"; + else + baseInitializer = " : QObject(parent)"; + } + else if ( dlg.baseclasses_view->childCount() != 0 ) + { + QListViewItemIterator it( dlg.baseclasses_view ); + baseInitializer += " : "; + while ( it.current() ) + { + if ( !it.current() ->text( 0 ).isEmpty() ) + { + if ( baseInitializer != " : " ) + { + baseInitializer += ", "; + } + + if ( childClass && ( baseInitializer == " : " ) ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + baseInitializer += it.current()->text( 0 ) + "(parent, name)"; + else + baseInitializer += it.current()->text( 0 ) + "(parent)"; + } + else if ( qobject && ( baseInitializer == " : " ) ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + baseInitializer += it.current()->text( 0 ) + "(parent, name)"; + else + baseInitializer += it.current()->text( 0 ) + "(parent)"; + } + else + { + baseInitializer += it.current()->text( 0 ) + "()"; + } + } + ++it; + } + baseInitializer += "\n"; + } + + constructors.replace( QRegExp( "\\$BASEINITIALIZER\\$" ), baseInitializer ); + constructors.replace( QRegExp( "\\$CLASSNAME\\$" ), className ); + // qWarning("NEW CLASS: constructors = %s", constructors.latin1()); + if ( templateStr.isEmpty() ) + { + constructors.replace( QRegExp( "\\$TEMPLATESTR\\$\\n" ), "" ); + constructors.replace( QRegExp( "\\$TEMPLATEPARAMS\\$" ), "" ); + } + else + { + constructors.replace( QRegExp( "\\$TEMPLATESTR\\$" ), templateStr ); + constructors.replace( QRegExp( "\\$TEMPLATEPARAMS\\$" ), templateParams ); + classImpl.replace( QRegExp( "#include \"\\$HEADER\\$\"\\n" ), "" ); + } + // qWarning("NEW CLASS: constructors = %s", constructors.latin1()); + constructors.replace( QRegExp( "\\$ARGS\\$" ), argsCpp ); + // qWarning("NEW CLASS: constructors = %s", constructors.latin1()); + + + //remove unnesessary carriadge returns + QString hp = relPath + header; + beautifySource( classImpl, hp, className, namespaceBeg, constructors, advCpp, namespaceEnd, implementation ); + + classImpl.replace( QRegExp( "\\$HEADER\\$" ), relPath + header ); + classImpl.replace( QRegExp( "\\$CLASSNAME\\$" ), className ); + classImpl.replace( QRegExp( "\\$NAMESPACEBEG\\$" ), namespaceBeg ); + classImpl.replace( QRegExp( "\\$CONSTRUCTORDEFINITIONS\\$" ), constructors ); + classImpl.replace( QRegExp( "\\$DEFINITIONS\\$" ), advCpp ); + classImpl.replace( QRegExp( "\\$NAMESPACEEND\\$" ), namespaceEnd ); + classImpl.replace( QRegExp( "\\$FILENAME\\$" ), implementation ); + + if ( ( dlg.m_part->project() ) && ( childClass || qobject ) && ( dlg.m_part->project() ->options() & KDevProject::UsesAutotoolsBuildSystem ) ) + { + QString moc = header; + moc.replace( QRegExp( "\\..*" ), ".moc" ); + classImpl += "#include \"" + moc + "\"\n"; + } + + if ( dlg.gen_config->reformat_box->isChecked() ) + { + KDevSourceFormatter * fmt = dlg.m_part->extension( "KDevelop/SourceFormatter" ); + if ( fmt ) + classImpl = fmt->formatSource( classImpl ); + } + + kdDebug( 9007 ) << "implementationPath = " << implementationPath << endl; + + QFile ifile( implementationPath ); + if ( !ifile.open( IO_WriteOnly ) ) + { + KMessageBox::error( &dlg, i18n( "Cannot write to implementation file" ) ); + return ; + } + QTextStream istream( &ifile ); + istream << classImpl; + ifile.close(); + + KURL u; + u.setPath( implementationPath ); + dlg.m_part->partController()->editDocument( u ); +} + + +void CppNewClassDialog::ClassGenerator::gen_interface() +{ + // interface + + QString classIntf; + QFileInfo fi( headerPath ); + QString module = fi.baseName(); + QString basefilename = fi.baseName( true ); + + if ( dlg.filetemplate_box->isChecked() ) + { + /* QDomDocument dom = *dlg.m_part->projectDom(); + if(DomUtil::readBoolEntry(dom,"/cppsupportpart/filetemplates/choosefiles",false)) + classIntf = FileTemplate::read(dlg.m_part, DomUtil::readEntry(dom,"/cppsupportpart/filetemplates/interfaceURL",""), FileTemplate::Custom); + else*/ + classIntf = FileTemplate::read( dlg.m_part, fi.extension( true ) ); + } + + classIntf.replace( QRegExp( "\\$MODULE\\$" ), module ); + classIntf.replace( QRegExp( "\\$FILENAME\\$" ), basefilename ); + + if ( objc ) + { + classIntf += dlg.gen_config->objcHeader(); + } + else if ( gtk ) + { + classIntf += dlg.gen_config->gtkHeader(); + } + else + { + classIntf += dlg.gen_config->cppHeader(); + /* classIntf = QString("\n" + "#ifndef $HEADERGUARD$\n" + "#define $HEADERGUARD$\n" + "\n" + "$INCLUDEBASEHEADER$\n" + "\n") + + namespaceBeg + + QString("class $CLASSNAME$$INHERITANCE$\n" + "{\n" + "$QOBJECT$" + "public:\n") + + ( advConstructorsHeader.isEmpty() ? QString(" $CLASSNAME$($ARGS$);\n") : advConstructorsHeader ) + + QString("\n ~$CLASSNAME$();\n") + + advH_public + + (advH_public_slots.isEmpty() ? QString::fromLatin1("") : ("\n\npublic slots:" + advH_public_slots)) + + (advH_protected.isEmpty() ? QString::fromLatin1("") : ("\n\nprotected:" + advH_protected)) + + (advH_protected_slots.isEmpty() ? QString::fromLatin1("") : ("\n\nprotected slots:" + advH_protected_slots)) + + (advH_private.isEmpty() ? QString::fromLatin1("") : ("\n\nprivate:" + advH_private)) + + (advH_private_slots.isEmpty() ? QString::fromLatin1("") : ("\n\nprivate slots:" + advH_private_slots)) + + QString("};\n" + "\n") + + namespaceEnd + + "#endif\n";*/ + } + + QString headerGuard; + switch ( dlg.gen_config->defCase() ) + { + case ClassGeneratorConfig::UpperCase: + headerGuard = namespaceStr.upper() + header.mid( header.findRev( "/" )+1 ).upper(); + break; + case ClassGeneratorConfig::LowerCase: + headerGuard = namespaceStr.lower() + header.mid( header.findRev( "/" )+1 ).lower(); + break; + case ClassGeneratorConfig::SameAsFileCase: + headerGuard = dlg.header_edit->text().mid( dlg.header_edit->text().findRev( "/" )+1 ); + break; + case ClassGeneratorConfig::SameAsClassCase: + headerGuard = namespaceStr + header.mid( header.findRev( "/" )+1 ); + break; + } + + headerGuard.replace( QRegExp( "\\." ), "_" ); + headerGuard.replace( QRegExp( "::" ), "_" ); + QString includeBaseHeader; + if( dlg.m_part->qtBuildConfig()->isUsed() ) + { + if( childClass && ( dlg.baseclasses_view->childCount() == 0 ) ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + includeBaseHeader = "#include "; + else + includeBaseHeader = "#include "; + } + else if( qobject && ( dlg.baseclasses_view->childCount() == 0 ) ) + { + if( dlg.m_part->qtBuildConfig()->version() == 3 ) + includeBaseHeader = "#include "; + else + includeBaseHeader = "#include "; + } + } + + if ( objc ) + { + if ( dlg.baseclasses_view->firstChild() ) + if ( dlg.baseclasses_view->firstChild() ->text( 0 ) != "NSObject" ) + if ( !dlg.baseclasses_view->firstChild() ->text( 3 ).isEmpty() ) + includeBaseHeader = "#include " + + ( dlg.baseclasses_view->firstChild() ->text( 2 ).toInt() == 0 ? QString( "<" ) : QString( "\"" ) ) + + dlg.baseclasses_view->firstChild() ->text( 3 ) + + ( dlg.baseclasses_view->firstChild() ->text( 2 ).toInt() == 0 ? QString( ">" ) : QString( "\"" ) ); + } + else + { + QListViewItemIterator it( dlg.baseclasses_view ); + while ( it.current() ) + { + if ( !it.current() ->text( 0 ).isEmpty() ) + if ( !it.current() ->text( 3 ).isEmpty() ) + // if ((!childClass) || (it.current()->text(0) != "QWidget")) + includeBaseHeader += ( includeBaseHeader.isEmpty() ? QString( "" ) : QString( "\n" ) ) + QString::fromLatin1( "#include " ) + + ( it.current() ->text( 2 ).toInt() == 0 ? QString( "<" ) : QString( "\"" ) ) + + it.current() ->text( 3 ) + + ( it.current() ->text( 2 ).toInt() == 0 ? QString( ">" ) : QString( "\"" ) ); + ++it; + } + } + + QString author = DomUtil::readEntry( *dlg.m_part->projectDom(), "/general/author" ); + QString email = DomUtil::readEntry( *dlg.m_part->projectDom(), "/general/email" ); + if( !email.isEmpty() ) + author += QString( " <%1>" ).arg( email ); + + QString inheritance; + if ( dlg.baseclasses_view->childCount() > 0 ) + { + inheritance += " : "; + + QListViewItemIterator it( dlg.baseclasses_view ); + while ( it.current() ) + { + if ( !it.current() ->text( 0 ).isEmpty() ) + { + if ( inheritance != " : " ) + inheritance += ", "; + if ( it.current() ->text( 1 ).contains( "virtual" ) ) + inheritance += "virtual "; + if ( it.current() ->text( 1 ).contains( "public" ) ) + inheritance += "public "; + if ( it.current() ->text( 1 ).contains( "protected" ) ) + inheritance += "protected "; + if ( it.current() ->text( 1 ).contains( "private" ) ) + inheritance += "private "; + inheritance += it.current() ->text( 0 ); + } + ++it; + } + } + else if ( qobject ) + inheritance += ": public QObject"; + + QString constructors = QString( advConstructorsHeader.isEmpty() ? + QString( " $CLASSNAME$($ARGS$);" ) : advConstructorsHeader ) + + QString( "\n\n ~$CLASSNAME$();" ); + + constructors.replace( QRegExp( "\\$CLASSNAME\\$" ), className ); + constructors.replace( QRegExp( "\\$ARGS\\$" ), argsH ); + + QString qobjectStr; + if ( childClass || qobject ) + qobjectStr = "Q_OBJECT"; + + + QString baseclass; + if ( dlg.baseclasses_view->childCount() > 0 ) + baseclass = dlg.baseclasses_view->firstChild() ->text( 0 ); + //remove unnesessary carriadge returns + beautifyHeader( classIntf, headerGuard, includeBaseHeader, author, doc, className, templateStr, + baseclass, inheritance, qobjectStr, argsH, + header, namespaceBeg, constructors, advH_public, advH_public_slots, + advH_protected, advH_protected_slots, advH_private, advH_private_slots, namespaceEnd ); + + + classIntf.replace( QRegExp( "\\$HEADERGUARD\\$" ), headerGuard ); + classIntf.replace( QRegExp( "\\$INCLUDEBASEHEADER\\$" ), includeBaseHeader ); + classIntf.replace( QRegExp( "\\$AUTHOR\\$" ), author ); + classIntf.replace( QRegExp( "\\$DOC\\$" ), doc ); + classIntf.replace( QRegExp( "\\$TEMPLATE\\$" ), templateStr ); + classIntf.replace( QRegExp( "\\$CLASSNAME\\$" ), className ); + if ( dlg.baseclasses_view->childCount() > 0 ) + classIntf.replace( QRegExp( "\\$BASECLASS\\$" ), dlg.baseclasses_view->firstChild() ->text( 0 ) ); + classIntf.replace( QRegExp( "\\$INHERITANCE\\$" ), inheritance ); + classIntf.replace( QRegExp( "\\$QOBJECT\\$" ), qobjectStr ); + classIntf.replace( QRegExp( "\\$ARGS\\$" ), argsH ); + classIntf.replace( QRegExp( "\\$FILENAME\\$" ), header ); + classIntf.replace( QRegExp( "\\$NAMESPACEBEG\\$" ), namespaceBeg ); + classIntf.replace( QRegExp( "\\$CONSTRUCTORDECLARATIONS\\$" ), constructors ); + classIntf.replace( QRegExp( "\\$PUBLICDECLARATIONS\\$" ), advH_public ); + classIntf.replace( QRegExp( "\\$PUBLICSLOTS\\$" ), advH_public_slots ); + classIntf.replace( QRegExp( "\\$PROTECTEDDECLARATIONS\\$" ), QString( "protected:\n" ) + advH_protected ); + classIntf.replace( QRegExp( "\\$PROTECTEDSLOTS\\$" ), QString( "protected slots:\n" ) + advH_protected_slots ); + classIntf.replace( QRegExp( "\\$PRIVATEDECLARATIONS\\$" ), QString( "private:\n" ) + advH_private ); + classIntf.replace( QRegExp( "\\$PRIVATESLOTS\\$" ), QString( "private slots:\n" ) + advH_private_slots ); + classIntf.replace( QRegExp( "\\$NAMESPACEEND\\$" ), namespaceEnd ); + + if ( !templateStr.isEmpty() && (!headeronly) ) + classIntf.replace( QRegExp( "#endif" ), "#include \"" + dlg.implementation_edit->text() + "\"\n\n#endif" ); + + if ( dlg.gen_config->reformat_box->isChecked() ) + { + KDevSourceFormatter * fmt = dlg.m_part->extension( "KDevelop/SourceFormatter" ); + if ( fmt ) + classIntf = fmt->formatSource( classIntf ); + } + + QFile hfile( headerPath ); + if ( !hfile.open( IO_WriteOnly ) ) + { + KMessageBox::error( &dlg, i18n( "Cannot write to header file" ) ); + return ; + } + QTextStream hstream( &hfile ); + hstream << classIntf; + hfile.close(); + + KURL u; + u.setPath( headerPath ); + dlg.m_part->partController()->editDocument( u ); +} + +void CppNewClassDialog::ClassGenerator::beautifyHeader( QString &templ, QString &headerGuard, + QString &includeBaseHeader, QString &author, QString &doc, QString &className, QString &templateStr, + QString &baseclass, QString &inheritance, QString &qobjectStr, QString &args, + QString &header, QString &namespaceBeg, QString &constructors, QString &advH_public, QString &advH_public_slots, + QString &advH_protected, QString &advH_protected_slots, QString &advH_private, QString &advH_private_slots, + QString &namespaceEnd ) +{ + if ( headerGuard.isEmpty() ) + templ.replace( QRegExp( "\\$HEADERGUARD\\$[\\n ]*" ), QString::null ); + if ( includeBaseHeader.isEmpty() ) + templ.replace( QRegExp( "\\$INCLUDEBASEHEADER\\$[\\n ]*" ), QString::null ); + if ( author.isEmpty() ) + templ.replace( QRegExp( "\\$AUTHOR\\$[\\n ]*" ), QString::null ); + if ( doc.isEmpty() ) + templ.replace( QRegExp( "\\$DOC\\$[\\n ]*" ), QString::null ); + if ( className.isEmpty() ) + templ.replace( QRegExp( "\\$CLASSNAME\\$[\\n ]*" ), QString::null ); + if ( templateStr.isEmpty() ) + templ.replace( QRegExp( "\\$TEMPLATE\\$[\\n ]*" ), QString::null ); + if ( baseclass.isEmpty() ) + templ.replace( QRegExp( "\\$BASECLASS\\$[\\n ]*" ), QString::null ); + if ( inheritance.isEmpty() ) + templ.replace( QRegExp( "\\$INHERITANCE\\$[\\n ]*" ), QString::null ); + if ( qobjectStr.isEmpty() ) + templ.replace( QRegExp( "\\$QOBJECT\\$[\\n ]*" ), QString::null ); + if ( args.isEmpty() ) + templ.replace( QRegExp( "\\$ARGS\\$[\\n ]*" ), QString::null ); + if ( header.isEmpty() ) + templ.replace( QRegExp( "\\$FILENAME\\$[\\n ]*" ), QString::null ); + if ( namespaceBeg.isEmpty() ) + templ.replace( QRegExp( "\\$NAMESPACEBEG\\$[\\n ]*" ), QString::null ); + if ( constructors.isEmpty() ) + templ.replace( QRegExp( "\\$CONSTRUCTORDECLARATIONS\\$[\\n ]*" ), QString::null ); + if ( advH_public.isEmpty() ) + templ.replace( QRegExp( "\\$PUBLICDECLARATIONS\\$[\\n ]*" ), QString::null ); + if ( advH_public_slots.isEmpty() ) + templ.replace( QRegExp( "\\$PUBLICSLOTS\\$[\\n ]*" ), QString::null ); + if ( advH_protected.isEmpty() ) + templ.replace( QRegExp( "\\$PROTECTEDDECLARATIONS\\$[\\n ]*" ), QString::null ); + if ( advH_protected_slots.isEmpty() ) + templ.replace( QRegExp( "\\$PROTECTEDSLOTS\\$[\\n ]*" ), QString::null ); + if ( advH_private.isEmpty() ) + templ.replace( QRegExp( "\\$PRIVATEDECLARATIONS\\$[\\n ]*" ), QString::null ); + if ( advH_private_slots.isEmpty() ) + templ.replace( QRegExp( "\\$PRIVATESLOTS\\$[\\n ]*" ), QString::null ); + if ( namespaceEnd.isEmpty() ) + templ.replace( QRegExp( "\\$NAMESPACEEND\\$[\\n ]*" ), QString::null ); +} + + +void CppNewClassDialog::ClassGenerator::beautifySource( QString &templ, QString &header, QString &className, QString &namespaceBeg, + QString &constructors, QString &advCpp, QString &namespaceEnd, QString &implementation ) +{ + if ( header.isEmpty() ) + templ.replace( QRegExp( "\\$HEADER\\$[\\n ]*" ), QString::null ); + if ( className.isEmpty() ) + templ.replace( QRegExp( "\\$CLASSNAME\\$[\\n ]*" ), QString::null ); + if ( namespaceBeg.isEmpty() ) + templ.replace( QRegExp( "\\$NAMESPACEBEG\\$[\\n ]*" ), QString::null ); + if ( constructors.isEmpty() ) + templ.replace( QRegExp( "\\$CONSTRUCTORDEFINITIONS\\$[\\n ]*" ), QString::null ); + if ( advCpp.isEmpty() ) + templ.replace( QRegExp( "\\$DEFINITIONS\\$[\\n ]*" ), QString::null ); + if ( namespaceEnd.isEmpty() ) + templ.replace( QRegExp( "\\$NAMESPACEEND\\$[\\n ]*" ), QString::null ); + if ( implementation.isEmpty() ) + templ.replace( QRegExp( "\\$FILENAME\\$[\\n ]*" ), QString::null ); +} + +QString CppNewClassDialog::classNameFormatted( ) +{ + return classNameFormatted( classname_edit->text() ); +} + +QString CppNewClassDialog::classNameFormatted( const QString &name ) +{ + QString temp = name.simplifyWhiteSpace(); + return temp.replace( QRegExp( "template *<.*> *(class *)?" ), "" ); +} + + +QString CppNewClassDialog::templateStrFormatted( ) +{ + return templateStrFormatted( classname_edit->text() ); +} + +QString CppNewClassDialog::templateStrFormatted( const QString &name ) +{ + QString className = name.simplifyWhiteSpace(); + QString temp = className; + className.replace( QRegExp( "template *<.*> *(class *)?" ), "" ); + QString templateStr = temp.replace( QRegExp( QRegExp_escape( className ) ), "" ); + templateStr.replace( QRegExp( " *class *$" ), "" ); + return templateStr; +} + +QString CppNewClassDialog::templateParamsFormatted( ) +{ + return templateParamsFormatted( classname_edit->text() ); +} + +QString CppNewClassDialog::templateParamsFormatted( const QString &name ) +{ + QString className = name.simplifyWhiteSpace(); + QString temp = className; + className.replace( QRegExp( "template *<.*> *(class *)?" ), "" ); + QString templateStr = temp.replace( QRegExp( QRegExp_escape( className ) ), "" ); + templateStr.replace( QRegExp( " *class *$" ), "" ); + + QString templateParams = templateStr; + templateParams.replace( QRegExp( "^ *template *" ), "" ); + templateParams.replace( QRegExp( " *class *" ), "" ); + templateParams.simplifyWhiteSpace(); + + return templateParams; +} + +QString CppNewClassDialog::templateActualParamsFormatted( const QString & name ) +{ + QString className = name.simplifyWhiteSpace(); + QString temp = className; + className.replace( QRegExp( "<.*> *" ), "" ); + QString templateStr = temp.replace( QRegExp( QRegExp_escape( className ) ), "" ); + return templateStr; +} + +void CppNewClassDialog::removeTemplateParams( QString & name ) +{ + name.replace( QRegExp( "<.*> *" ), "" ); +} + +bool CppNewClassDialog::isDestructor( QString className, const FunctionDom &method ) +{ + if ( m_part->formatModelItem( method.data() ).contains( QRegExp( " *~ *" + className ) ) ) + return true; + return false; +} + +void CppNewClassDialog::headeronly_box_stateChanged(int val) +{ + implementation_edit->setEnabled(!val); +} + +#include "cppnewclassdlg.moc" + +//kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/languages/cpp/cppnewclassdlg.h b/languages/cpp/cppnewclassdlg.h new file mode 100644 index 00000000..fb680921 --- /dev/null +++ b/languages/cpp/cppnewclassdlg.h @@ -0,0 +1,292 @@ +/*************************************************************************** +* Copyright (C) 1998 by Sandy Meier * +* smeier@rz.uni-potsdam.de * +* Copyright (C) 2002 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _CPPNEWCLASSDLG_H_ +#define _CPPNEWCLASSDLG_H_ + +#include +#include +#include + +#include "codemodel.h" +#include "cppnewclassdlgbase.h" + +class CppSupportPart; +class KDevProject; +class QPopupMenu; +class KCompletion; +class CodeModel; + + +template +class PCheckListItem: public QCheckListItem +{ +public: + + PCheckListItem ( T item, QCheckListItem * parent, const QString & text, Type tt = Controller ) : + QCheckListItem ( parent, text, tt ), m_item( item ) + {} + + PCheckListItem ( T item, QCheckListItem * parent, QListViewItem * after, const QString & text, Type tt = Controller ) : + QCheckListItem ( parent, after, text, tt ), m_item( item ) + {} + + PCheckListItem ( T item, QListViewItem * parent, const QString & text, Type tt = Controller ) : + QCheckListItem ( parent, text, tt ), m_item( item ) + {} + + PCheckListItem ( T item, QListViewItem * parent, QListViewItem * after, const QString & text, Type tt = Controller ) : + QCheckListItem ( parent, after, text, tt ), m_item( item ) + {} + + PCheckListItem ( T item, QListView * parent, const QString & text, Type tt = Controller ) : + QCheckListItem ( parent, text, tt ), m_item( item ) + {} + + PCheckListItem ( T item, QListView * parent, QListViewItem * after, const QString & text, Type tt = Controller ) : + QCheckListItem ( parent, after, text, tt ), m_item( item ) + {} + + PCheckListItem ( T item, QListViewItem * parent, const QString & text, const QPixmap & p ) : + QCheckListItem ( parent, text, p ), m_item( item ) + {} + + PCheckListItem ( T item, QListView * parent, const QString & text, const QPixmap & p ) : + QCheckListItem ( parent, text, p ), m_item( item ) + {} + + T item() + { + return m_item; + } + + QString templateAddition; + +private: + T m_item; +}; + +template +class PListViewItem: public QListViewItem +{ +public: + + PListViewItem ( T item, QListViewItem * parent, QListViewItem * after, const QString & text ) : + QListViewItem ( parent, after, text ), m_item( item ) + {} + + PListViewItem ( T item, QListViewItem * parent, const QString & text ) : + QListViewItem ( parent, text ), m_item( item ) + {} + + PListViewItem ( T item, QListView * parent, const QString & text ) : + QListViewItem ( parent, text ), m_item( item ) + {} + + PListViewItem ( T item, QListView * parent, QListViewItem * after, const QString & text ) : + QListViewItem ( parent, after, text ), m_item( item ) + {} + + T item() + { + return m_item; + } + + QString templateAddition; +private: + T m_item; +}; + + +class CppNewClassDialog : public CppNewClassDialogBase +{ + Q_OBJECT + +public: + CppNewClassDialog( CppSupportPart *part, QWidget *parent = 0, const char *name = 0 ); + ~CppNewClassDialog(); + +protected: + virtual void accept(); + virtual void classNameChanged( const QString &text ); + virtual void classNamespaceChanged( const QString &text ); + virtual void headerChanged(); + virtual void implementationChanged(); + virtual void nameHandlerChanged( const QString &text ); + virtual void baseclassname_changed( const QString &text ); + virtual void baseIncludeChanged( const QString &text ); + + virtual void addBaseClass(); + virtual void remBaseClass(); + virtual void remBaseClassOnly(); + virtual void currBaseNameChanged( const QString &text ); + virtual void currBasePrivateSet(); + virtual void currBaseProtectedSet(); + virtual void currBasePublicSet(); + virtual void currBaseVirtualChanged( int val ); + virtual void currBaseSelected( QListViewItem *it ); + virtual void scopeboxActivated( int value ); + + virtual void checkObjCInheritance( int val ); + virtual void checkQWidgetInheritance( int val ); + + virtual void upbaseclass_button_clicked(); + virtual void downbaseclass_button_clicked(); + virtual void baseclasses_view_selectionChanged(); + + virtual void newTabSelected( const QString &text ); + virtual void newTabSelected( QWidget *w ); + virtual void access_view_mouseButtonPressed( int button, QListViewItem * item, const QPoint &p, int c ); + virtual void changeToPrivate(); + virtual void changeToProtected(); + virtual void changeToPublic(); + virtual void changeToInherited(); + virtual void methods_view_mouseButtonPressed( int button , QListViewItem * item, const QPoint&p , int c ); + virtual void extendFunctionality(); + virtual void replaceFunctionality(); + virtual void to_constructors_list_clicked(); + virtual void clear_selection_button_clicked(); + virtual void selectall_button_clicked(); + virtual void gtk_box_stateChanged( int val ); + virtual void qobject_box_stateChanged( int val ); + virtual void headeronly_box_stateChanged(int val); + + void reloadAdvancedInheritance( bool clean = false ); + void parseClass( QString clName, QString inheritance ); + void parsePCSClass( QString clName, QString inheritance ); + void addToConstructorsList( QCheckListItem *myClass, FunctionDom method ); + void addToMethodsList( QListViewItem *parent, FunctionDom method ); + void addToUpgradeList( QListViewItem *parent, FunctionDom method, QString modifier ); + void addToUpgradeList( QListViewItem *parent, VariableDom attr, QString modifier ); + void clearConstructorsList( bool clean = false ); + void clearMethodsList( bool clean = false ); + void clearUpgradeList( bool clean = false ); + bool isConstructor( QString className, const FunctionDom &method ); + bool isDestructor( QString className, const FunctionDom &method ); + +private: + + bool headerModified; + bool baseincludeModified; + bool implementationModified; + QString m_parse; + QPopupMenu *accessMenu; + QPopupMenu *overMenu; + CppSupportPart *m_part; + CodeModel *myModel; + + // configuration variables + QString interface_url; + QString implementation_url; + QString interface_suffix; + QString implementation_suffix; + QStringList currNamespace; + bool lowercase_filenames; + QStringList currBaseClasses; + KCompletion * compBasename; + KCompletion * compNamespace; + + void setCompletionBasename( CodeModel *model ); + void addCompletionBasenameNamespacesRecursive( const NamespaceDom & namespaceDom, const QString & namespaceParent = "" ); + void setCompletionNamespaceRecursive( const NamespaceDom & namespaceDom, const QString & namespaceParent = "" ); + void setStateOfInheritanceEditors( bool state, bool hideList = true ); + void setAccessForBase( QString baseclass, QString newAccess ); + void setAccessForItem( QListViewItem *curr, QString newAccess, bool isPublic ); + void remClassFromAdv( QString text ); + void checkUpButtonState(); + void checkDownButtonState(); + void updateConstructorsOrder(); + + QString classNameFormatted(); + QString templateStrFormatted(); + QString templateParamsFormatted(); + QString classNameFormatted( const QString & ); + QString templateStrFormatted( const QString & ); + QString templateParamsFormatted( const QString & ); + QString templateActualParamsFormatted( const QString & ); + void removeTemplateParams( QString & ); + + friend class ClassGenerator; + + //! The class that translates UI input to a class + class ClassGenerator + { + + public: + ClassGenerator( CppNewClassDialog& _dlg ) : dlg( _dlg ) + {} + bool generate(); + + private: + bool validateInput(); + void common_text(); + void gen_implementation(); + void gen_interface(); + void genMethodDeclaration( FunctionDom method, QString className, QString templateStr, + QString *adv_h, QString *adv_cpp, bool extend, QString baseClassName ); + + void beautifyHeader( QString &templ, QString &headerGuard, + QString &includeBaseHeader, QString &author, QString &doc, QString &className, QString &templateStr, + QString &baseclass, QString &inheritance, QString &qobjectStr, QString &args, + QString &header, QString &namespaceBeg, QString &constructors, QString &advH_public, + QString &advH_public_slots, + QString &advH_protected, QString &advH_protected_slots, QString &advH_private, QString &advH_private_slots, + QString &namespaceEnd ); + void beautifySource( QString &templ, QString &header, QString &className, QString &namespaceBeg, + QString &constructors, QString &advCpp, QString &namespaceEnd, QString &implementation ); + + QString className; + QString templateStr; + QString templateParams; + QString header; + QString implementation; + + QString advConstructorsHeader; + QString advConstructorsSource; + + KDevProject *project; + QString subDir, headerPath, implementationPath; + QString doc; + QString namespaceStr; + bool childClass; + bool objc; + bool qobject; + bool gtk; + bool headeronly; + QStringList namespaces; + QString namespaceBeg, namespaceEnd; + QString argsH; + QString argsCpp; + + QString advH_public; + QString advH_public_slots; + QString advH_protected; + QString advH_protected_slots; + QString advH_private; + QString advH_private_slots; + QString advCpp; + + + CppNewClassDialog& dlg; + }; + + + //! workaround to make gcc 2.95.x happy + friend class CppNewClassDialog::ClassGenerator; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/cppnewclassdlgbase.ui b/languages/cpp/cppnewclassdlgbase.ui new file mode 100644 index 00000000..4f443eaf --- /dev/null +++ b/languages/cpp/cppnewclassdlgbase.ui @@ -0,0 +1,1290 @@ + +CppNewClassDialogBase + + + CppNewClassDlgBase + + + + 0 + 0 + 510 + 611 + + + + New Class + + + + + + + unnamed + + + + class_tabs + + + + tab1 + + + Class &Information + + + + unnamed + + + + Spacer6 + + + Horizontal + + + Preferred + + + + 10 + 20 + + + + + + Layout10 + + + + unnamed + + + 0 + + + + documentation_label_ + + + Docu&mentation: + + + documentation_edit + + + + + documentation_edit + + + Insert a short description for your new class +here for documentation purposes. This can be used +to create API documentation in HTML format with +doxygen or similar tools. + + + + + + + filenames_group + + + File Names + + + + unnamed + + + + header_label + + + &Header: + + + header_edit + + + + + header_edit + + + Insert your header file name here. +It is automatically inserted while +you select the classname, but you can +still edit it afterwards. + + + + + implementation_label + + + Im&plementation: + + + implementation_edit + + + + + implementation_edit + + + Insert your implementation filename here. +It is automatically inserted while +you select the classname, but you can +still edit it afterwards. + + + + + headeronly_box + + + Create only header + + + + + + + groupBox7 + + + Class + + + + unnamed + + + + classname_label + + + + 5 + 5 + 0 + 0 + + + + &Name: + + + classname_edit + + + + + classname_edit + + + Insert your new classname here. +You can also define template classes by specifying +template <params> classname + + + + + namespace_label + + + + 5 + 5 + 0 + 0 + + + + Name&space: + + + namespace_edit + + + + + namespace_edit + + + Insert a name of the namespace here. +You can define nested namespaces by specifying +Namespace1::Namespace2::...::NamespaceN + + + + + + + inheritance_group + + + Inheritance + + + + unnamed + + + + addbaseclass_button + + + + 1 + 0 + 0 + 0 + + + + &Add + + + true + + + + + rembaseclass_button + + + false + + + + 1 + 0 + 0 + 0 + + + + + 0 + 0 + + + + &Remove + + + true + + + + + upbaseclass_button + + + false + + + + 1 + 0 + 0 + 0 + + + + Move &Up + + + true + + + + + downbaseclass_button + + + false + + + + 1 + 0 + 0 + 0 + + + + + 0 + 0 + + + + Move &Down + + + true + + + + + basename_label + + + + 0 + 5 + 0 + 0 + + + + &Base class: + + + basename_edit + + + + + + Baseclass Name + + + true + + + true + + + + + Inheritance Type + + + true + + + true + + + + baseclasses_view + + + false + + + AutoOneFit + + + AllColumns + + + + + basename_edit + + + false + + + + 7 + 0 + 0 + 0 + + + + + 0 + 20 + + + + StrongFocus + + + Insert the base class which your new class will be derived from. If you have checked 'Generate QWidget child class' the new class will be derived from QWidget. If no base class is named, the new class will not have a parent class. You can also use template classes here (like BaseClass<int, int>) + + + + + baseinclude_edit + + + false + + + + 7 + 0 + 0 + 0 + + + + + 0 + 20 + + + + StrongFocus + + + + + + + + layout5 + + + + unnamed + + + + + Global + + + + + Local + + + + scope_box + + + false + + + + 1 + 1 + 0 + 0 + + + + + + virtual_box + + + false + + + Virtual + + + + + public_button + + + false + + + Public + + + true + + + + + protected_button + + + false + + + Protected + + + + + private_button + + + false + + + Private + + + + + + + + + optionsBox + + + Options + + + + unnamed + + + + filetemplate_box + + + Use file t&emplates + + + true + + + + + qobject_box + + + Generate QOb&ject child class + + + + + childclass_box + + + Generate Q&Widget child class + + + + + gtk_box + + + Generate G&TK+ class + + + + + objc_box + + + Use Objective-C + + + + + + + + + tab2 + + + Ad&vanced Information + + + + unnamed + + + + tabWidget4 + + + + tab + + + Constr&uctors + + + + unnamed + + + + + Base Class Constructors + + + true + + + true + + + + constructors_view + + + AutoOneFit + + + true + + + AllColumns + + + + + layout4 + + + + unnamed + + + + to_constructors_list + + + + 0 + 0 + 0 + 0 + + + + + 125 + 0 + + + + C&reate Constructor >> + + + + + clear_selection_button + + + + 0 + 0 + 0 + 0 + + + + + 125 + 0 + + + + C&lear Selection + + + + + spacer9_2_2 + + + Horizontal + + + Expanding + + + + 150 + 20 + + + + + + + + tabWidget3 + + + + tab_header + + + &Header + + + + unnamed + + + 2 + + + + constructors_h_edit + + + + 7 + 7 + 0 + 0 + + + + PlainText + + + NoWrap + + + + + + + tab_source + + + &Source + + + + unnamed + + + 2 + + + + constructors_cpp_edit + + + + 7 + 7 + 0 + 0 + + + + PlainText + + + NoWrap + + + + + + + + + + tab + + + Methods Ov&erriding + + + + unnamed + + + + + Methods + + + true + + + true + + + + + Extend Functionality + + + true + + + true + + + + methods_view + + + true + + + AutoOneFit + + + true + + + true + + + AllColumns + + + + + + + tab + + + &Access Control + + + + unnamed + + + + + Methods & Attributes + + + true + + + true + + + + + Implied Modifier + + + true + + + true + + + + + New Modifier + + + true + + + true + + + + access_view + + + + 7 + 7 + 0 + 0 + + + + AutoOneFit + + + true + + + true + + + AllColumns + + + + + + + + + + tab + + + &Generation Options + + + + unnamed + + + + gen_config + + + StrongFocus + + + + + + + + Layout3 + + + + unnamed + + + 0 + + + + Spacer7_2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + ok_button + + + &OK + + + true + + + + + cancel_button + + + &Cancel + + + + + + + + + ClassGeneratorConfig +

      classgeneratorconfig.h
      + + 0 + 0 + + 0 + + 5 + 5 + 0 + 0 + + image0 + + + + + 789c9d95594f32591086effd15c4ba3393fae895ee4ce6824540141011b7c95cf406a202caa6f065fefb549faaea0b24996fc623cb937aeb3d55754e871f67a587eb6ee9ecc7c96a1dada74929798e96a5b374339bedfefceb8f9f27a7b65da27fcb724bf6e96f27a783752929f516f32c070402289b3fc39d8203c3136157e276c1260eac0f0ade0907927f2d9c58261f929cad72be0cef8535ff5959e277c201ef0fa02cf1ae7022f9efca12ff301ca81e87c21a5f32db5acf95b0eebfcdd92e2be3a5b0fa7986435bfd6e981d99278c0ae6795c288b3e2b98e3036157d8f839961308af985df51b1b0e9dc0098ddf5a3811fd7dceaee52a370d475e28f9b7ca1c07539f67173c144e65be2fcae2d763f62d89df2acb7cc282393e57b6b9ff58d893fca632c7d1ccc78bbcd48b4c7cc2ec4bfdf0aa2cfbf50be6fa2c65d9af2aacfd2c94e53cccf9fa7645eb7794a59ebdb027fe5565895f09cb7e981a267f9febaf3117fab6702af599e7a5e2049e6dce1377c25affa6608e4786e34a58894dfc8b59f5f890731087e28f2de648fbdb16ccfd6c9465bf7365c732f12f61ed3f5016fd4a59f4e6790fddd00a5d137f638eb4bfa532df5ffc148ea4be5ac17c5ea9b2ecd72b98efff403893fa1accb12d5c5696fd4d7f6152c41f95c53f2a98f56b6597fbf3857da9b75e30fb5584b59fa78239de5596fd3e0be6fdccf311b99115f1fcdaccb12fe77927ac7e2365f1c382793e63e14cfccdf3132571e69b1f07e83327d23fbac2bee4d785d57f2a9c89de9c6fecaa1fce98135bf845b9e2189e2a07e6fee287b0cfcf3bce9525ff5d38927a1bcca9cc1b66ca528ff93d89d338e3f9e182b9c86f31a752ff609d2f847f5f83b5ea31c218137a4f8fac0cc738e10cd6d3b7189f718a2ff88a6f38c339ad05adfcf31d3f7089ab037d42ea356e708b9ff8853bdc6395de6b58c706ad736c1ee823f2de608b146dbcc08e8976f012afb04b3975ec1de853aa2457f749d5c16b1ce00d0ecdf75b1ce1dd11fd1b55d236cef7f8808ff88465b4d02676d03da29f51dd9e513fa28f150c3004246d07002288bfe9e7d45f0712f22635a490d15ef730361e3b389c67aedf2390ea3157e73dc333e9a6f042d13ebc7ed32f6882405d3ee1c678030ee10d6630a76f162c8ee8f37adeb14c0aaa0b3e68b725ac80a2b039a29f630db6e46bc127d5fd45de4b5226b0833d8ea07a445f871ae96dacc218ead08073c835136842eba8be016db830e77a419f21aca143f76c025b9ae7e5813ea35bd5a0731fd1c4877a7f614fde57d085deb7f31ad31dccf54fd087883ab7a88f6baabb45fdf760003707fa09ddd826f66048af1826f00a0bb3aa7009b73082bb03fd2faeffa7fff58cfffcbcfffdfbc93f7f7d62d7 + + + + + ok_button + clicked() + CppNewClassDlgBase + accept() + + + cancel_button + clicked() + CppNewClassDlgBase + reject() + + + classname_edit + textChanged(const QString&) + CppNewClassDlgBase + classNameChanged(const QString&) + + + header_edit + textChanged(const QString&) + CppNewClassDlgBase + headerChanged() + + + implementation_edit + textChanged(const QString&) + CppNewClassDlgBase + implementationChanged() + + + childclass_box + stateChanged(int) + CppNewClassDlgBase + checkQWidgetInheritance(int) + + + objc_box + stateChanged(int) + CppNewClassDlgBase + checkObjCInheritance(int) + + + virtual_box + stateChanged(int) + CppNewClassDlgBase + currBaseVirtualChanged(int) + + + public_button + clicked() + CppNewClassDlgBase + currBasePublicSet() + + + protected_button + clicked() + CppNewClassDlgBase + currBaseProtectedSet() + + + private_button + clicked() + CppNewClassDlgBase + currBasePrivateSet() + + + addbaseclass_button + clicked() + CppNewClassDlgBase + addBaseClass() + + + rembaseclass_button + clicked() + CppNewClassDlgBase + remBaseClass() + + + baseclasses_view + currentChanged(QListViewItem*) + CppNewClassDlgBase + currBaseSelected(QListViewItem*) + + + upbaseclass_button + clicked() + CppNewClassDlgBase + upbaseclass_button_clicked() + + + downbaseclass_button + clicked() + CppNewClassDlgBase + downbaseclass_button_clicked() + + + baseclasses_view + selectionChanged() + CppNewClassDlgBase + baseclasses_view_selectionChanged() + + + gtk_box + stateChanged(int) + CppNewClassDlgBase + gtk_box_stateChanged(int) + + + basename_edit + textChanged(const QString&) + CppNewClassDlgBase + currBaseNameChanged(const QString&) + + + qobject_box + stateChanged(int) + CppNewClassDlgBase + qobject_box_stateChanged(int) + + + access_view + mouseButtonPressed(int,QListViewItem*,const QPoint&,int) + CppNewClassDlgBase + access_view_mouseButtonPressed(int,QListViewItem*,const QPoint&,int) + + + methods_view + mouseButtonPressed(int,QListViewItem*,const QPoint&,int) + CppNewClassDlgBase + methods_view_mouseButtonPressed(int,QListViewItem*,const QPoint&,int) + + + clear_selection_button + clicked() + CppNewClassDlgBase + clear_selection_button_clicked() + + + to_constructors_list + clicked() + CppNewClassDlgBase + to_constructors_list_clicked() + + + class_tabs + selected(const QString&) + CppNewClassDlgBase + newTabSelected(const QString&) + + + class_tabs + currentChanged(QWidget*) + CppNewClassDlgBase + newTabSelected(QWidget*) + + + basename_edit + textChanged(const QString&) + CppNewClassDlgBase + baseclassname_changed(const QString&) + + + baseinclude_edit + textChanged(const QString&) + CppNewClassDlgBase + baseIncludeChanged(const QString&) + + + scope_box + activated(int) + CppNewClassDlgBase + scopeboxActivated(int) + + + namespace_edit + textChanged(const QString&) + CppNewClassDlgBase + classNamespaceChanged(const QString&) + + + headeronly_box + stateChanged(int) + CppNewClassDlgBase + headeronly_box_stateChanged(int) + + + + classname_edit + namespace_edit + addbaseclass_button + basename_edit + baseinclude_edit + scope_box + virtual_box + public_button + protected_button + private_button + baseclasses_view + rembaseclass_button + upbaseclass_button + downbaseclass_button + header_edit + implementation_edit + filetemplate_box + qobject_box + childclass_box + gtk_box + objc_box + documentation_edit + class_tabs + ok_button + cancel_button + tabWidget4 + constructors_view + to_constructors_list + clear_selection_button + tabWidget3 + constructors_h_edit + methods_view + access_view + gen_config + constructors_cpp_edit + + + kdialog.h + + + updateClassStore() + access_view_mouseButtonPressed( int button, QListViewItem * item, const QPoint & p, int c ) + classNameChanged( const QString & text ) + headerChanged() + implementationChanged() + nameHandlerChanged( const QString & text ) + addBaseClass() + remBaseClass() + currBaseNameChanged( const QString & text ) + currBasePrivateSet() + currBaseProtectedSet() + currBasePublicSet() + currBaseVirtualChanged( int val ) + currBaseSelected( QListViewItem * it ) + checkObjCInheritance( int val ) + checkQWidgetInheritance( int val ) + newTabSelected( const QString & text ) + changeToPrivate() + changeToProtected() + changeToPublic() + changeToInherited() + methods_view_mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) + newTabSelected( QWidget * w ) + extendFunctionality() + replaceFunctionality() + to_constructors_list_clicked() + from_constructors_list_clicked() + add_constructor_button_clicked() + rem_constructor_button_clicked() + clear_selection_button_clicked() + upbaseclass_button_clicked() + downbaseclass_button_clicked() + baseclasses_view_selectionChanged() + gtk_box_stateChanged( int ) + qobject_box_stateChanged( int ) + selectall_button_clicked() + baseclassname_changed( const QString & ) + baseIncludeChanged( const QString & ) + scopeboxActivated( int ) + classNamespaceChanged( const QString & ) + headeronly_box_stateChanged(int val) + + + + + classgeneratorconfig.h + + diff --git a/languages/cpp/cppsplitheadersourceconfig.cpp b/languages/cpp/cppsplitheadersourceconfig.cpp new file mode 100644 index 00000000..68253368 --- /dev/null +++ b/languages/cpp/cppsplitheadersourceconfig.cpp @@ -0,0 +1,82 @@ +/* + * KDevelop config for split header/source + * + * Copyright (c) 2005 Adam Treat + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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. + */ + +#include "cppsplitheadersourceconfig.h" +#include "cppsupportpart.h" + +#include + +#include +#include + +QString CppSplitHeaderSourceConfig::defaultPath = QString::fromLatin1( "/kdevcppsupport/splitheadersource" ); + +CppSplitHeaderSourceConfig::CppSplitHeaderSourceConfig( CppSupportPart * part, QDomDocument* dom ) + : QObject( part ), m_part( part ), m_dom( dom ) +{ + init(); +} + +CppSplitHeaderSourceConfig::~CppSplitHeaderSourceConfig() +{} + +void CppSplitHeaderSourceConfig::init( ) +{ + m_splitEnable = + DomUtil::readBoolEntry( *m_dom, defaultPath + "/enabled", false ); + m_splitSync = + DomUtil::readBoolEntry( *m_dom, defaultPath + "/synchronize", true ); + m_splitOrientation = + DomUtil::readEntry( *m_dom, defaultPath + "/orientation", "Vertical" ); +} + +void CppSplitHeaderSourceConfig::store( ) +{ + DomUtil::writeBoolEntry( *m_dom, + defaultPath + "/enabled", + m_splitEnable ); + DomUtil::writeBoolEntry( *m_dom, + defaultPath + "/synchronize", + m_splitSync ); + DomUtil::writeEntry( *m_dom, + defaultPath + "/orientation", + m_splitOrientation ); + + emit stored(); +} + +void CppSplitHeaderSourceConfig::setSplitEnable( bool b ) +{ + m_splitEnable = b; +} + +void CppSplitHeaderSourceConfig::setAutoSync( bool b ) +{ + m_splitSync = b; +} + +void CppSplitHeaderSourceConfig::setOrientation( const QString &o ) +{ + m_splitOrientation = o; +} + +#include "cppsplitheadersourceconfig.moc" +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/cppsplitheadersourceconfig.h b/languages/cpp/cppsplitheadersourceconfig.h new file mode 100644 index 00000000..d975bc2c --- /dev/null +++ b/languages/cpp/cppsplitheadersourceconfig.h @@ -0,0 +1,74 @@ +/* + * KDevelop config for split header/source + * + * Copyright (c) 2005 Adam Treat + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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. + */ +#ifndef CPPSPLITHEADERSOURCECONFIG_H +#define CPPSPLITHEADERSOURCECONFIG_H + +#include + +class CppSupportPart; +class QDomDocument; + +class CppSplitHeaderSourceConfig : public QObject +{ + Q_OBJECT +public: + CppSplitHeaderSourceConfig( CppSupportPart* part, QDomDocument* dom ); + virtual ~CppSplitHeaderSourceConfig(); + + bool splitEnabled() const + { + return m_splitEnable; + } + void setSplitEnable( bool b ); + + bool autoSync() const + { + return m_splitSync; + } + void setAutoSync( bool b ); + + QString orientation() const + { + return m_splitOrientation; + } + void setOrientation( const QString &o ); + +public slots: + void store(); + +private: + void init(); + +signals: + void stored(); + +private: + CppSupportPart* m_part; + QDomDocument* m_dom; + bool m_splitEnable; + bool m_splitSync; + QString m_splitOrientation; + + static QString defaultPath; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/languages/cpp/cppsupport_events.h b/languages/cpp/cppsupport_events.h new file mode 100644 index 00000000..0c266726 --- /dev/null +++ b/languages/cpp/cppsupport_events.h @@ -0,0 +1,75 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef __cppsupport_events_h +#define __cppsupport_events_h + +#include "kdevdeepcopy.h" + +#include +#include + +#if QT_VERSION < 0x030100 +#include +#else +#include +#endif + +enum +{ + Event_FileParsed = QEvent::User + 1000 +}; + + +class FileParsedEvent: public QCustomEvent +{ +public: + FileParsedEvent( const QString& fileName, const QValueList& problems, bool fromDisk = false ) + : QCustomEvent( Event_FileParsed ), m_fileName( deepCopy( fileName ) ), m_fromDisk( fromDisk ) + { + // the members are deep copies + QValueListConstIterator it = problems.begin(); + while ( it != problems.end() ) + { + Problem p = *it; + m_problems.append( Problem( deepCopy( p.text() ), p.line(), p.column(), p.level() ) ); + m_problems.back().setFileName( deepCopy( p.fileName() ) ); + ++it; + } + } + + QString fileName() const + { + return m_fileName; + } + QValueList problems() const + { + return m_problems; + } + + bool fromDisk() { + return m_fromDisk; + } + +private: + QString m_fileName; + QValueList m_problems; + bool m_fromDisk; + +private: + FileParsedEvent( const FileParsedEvent& source ); + void operator = ( const FileParsedEvent& source ); +}; + + +#endif // __cppsupport_events_h +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/cppsupport_utils.cpp b/languages/cpp/cppsupport_utils.cpp new file mode 100644 index 00000000..e6f80abc --- /dev/null +++ b/languages/cpp/cppsupport_utils.cpp @@ -0,0 +1,139 @@ +#include + +#include +#include +#include + +#include + +#include "cppsupport_utils.h" + +static void typeNameList( QStringList& path, QStringList & lst, const CodeModel * model ); +static void typeNameList( QStringList& path, QStringList & lst, NamespaceDom ns ); +static void typeNameList( QStringList & path, QStringList & lst, ClassDom klass ); + +QStringList typeNameList( const CodeModel* model ) +{ + QStringList lst; + QStringList path; + typeNameList( path, lst, model ); + return lst; +} + +static void typeNameList( QStringList& path, QStringList & lst, const CodeModel * model ) +{ + const FileList fileList = model->fileList(); + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ) + typeNameList( path, lst, model_cast(*it) ); +} + +static void typeNameList( QStringList& path, QStringList & lst, NamespaceDom ns ) +{ + if( !ns->isFile() ) + path.push_back( ns->name() ); + + const NamespaceList namespaceList = ns->namespaceList(); + for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it ) + typeNameList( path, lst, *it ); + + const ClassList classList = ns->classList(); + for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) + typeNameList( path, lst, *it ); + + if( !ns->isFile() ) + path.pop_back(); +} + +static void typeNameList( QStringList & path, QStringList & lst, ClassDom klass ) +{ + path.push_back( klass->name() ); + + lst << path.join( "::" ); + + const ClassList classList = klass->classList(); + for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) + typeNameList( path, lst, *it ); + + path.pop_back(); +} + +static void typedefMap( QMap & map, const CodeModel * model ); +static void typedefMap( QMap & map, NamespaceDom ns ); +static void typedefMap( QMap & map, ClassDom klass ); + +QMap typedefMap( const CodeModel* model ) +{ + QMap map; + typedefMap( map, model ); + + /*We need to flatten the typedefs to avoid circular aliases. + Example: + map["Foo"] = "int"; + map["Bar"] = "Foo"; + map["Baz"] = "Bar";*/ + + QMap::iterator it = map.begin(); + for ( ; it != map.end(); ++it ) + { + while ( map.contains( map[ it.key() ] ) && + it.key() != map[ it.key() ] ) + { + map[ it.key() ] = map[ map[ it.key() ] ]; + } + } + + return map; +} + +static void typedefMap( QMap & map, const CodeModel * model ) +{ + const FileList fileList = model->fileList(); + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ) + typedefMap( map, model_cast(*it) ); +} + +static void typedefMap( QMap & map, NamespaceDom ns ) +{ + const TypeAliasList aliasList = ns->typeAliasList(); + for( TypeAliasList::ConstIterator it=aliasList.begin(); it!=aliasList.end(); ++it ) + map[ ( *it )->name() ] = ( *it )->type(); + + const NamespaceList namespaceList = ns->namespaceList(); + for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it ) + typedefMap( map, *it ); + + const ClassList classList = ns->classList(); + for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) + typedefMap( map, *it ); +} + +static void typedefMap( QMap & map, ClassDom klass ) +{ + const TypeAliasList aliasList = klass->typeAliasList(); + for( TypeAliasList::ConstIterator it=aliasList.begin(); it!=aliasList.end(); ++it ) + map[ ( *it )->name() ] = ( *it )->type(); + + const ClassList classList = klass->classList(); + for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) + typedefMap( map, *it ); +} + +QString formattedOpeningParenthesis(bool suppressSpace) +{ + KConfig * config = kapp->config(); + config->setGroup("AStyle"); + bool use_spaces = config->readBoolEntry("PadParentheses", false); + if (not use_spaces or suppressSpace) return "("; + return "( "; +} + +QString formattedClosingParenthesis(bool suppressSpace) +{ + KConfig * config = kapp->config(); + config->setGroup("AStyle"); + bool use_spaces = config->readBoolEntry("PadParentheses", false); + if (not use_spaces or suppressSpace) return ")"; + return " )"; +} + +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/cppsupport_utils.h b/languages/cpp/cppsupport_utils.h new file mode 100644 index 00000000..9182dd08 --- /dev/null +++ b/languages/cpp/cppsupport_utils.h @@ -0,0 +1,28 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef __cppsupport_utils_h +#define __cppsupport_utils_h + +#include +#include + +#include "codemodel.h" + +QStringList typeNameList( const CodeModel* model ); +QMap typedefMap( const CodeModel* model ); + +QString formattedOpeningParenthesis(bool suppressSpace = false); +QString formattedClosingParenthesis(bool suppressSpace = false); + +#endif // __cppsupport_utils_h +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/cppsupportfactory.cpp b/languages/cpp/cppsupportfactory.cpp new file mode 100644 index 00000000..77a586c9 --- /dev/null +++ b/languages/cpp/cppsupportfactory.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2000-2001 by Bernd Gehrmann * + * bernd@kdevelop.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; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include "cppsupportfactory.h" + +K_EXPORT_COMPONENT_FACTORY( libkdevcppsupport, CppSupportFactory ) + +static const KDevPluginInfo data("kdevcppsupport"); + +CppSupportFactory::CppSupportFactory() +: KDevGenericFactory( data ) +{ +} + +KInstance *CppSupportFactory::createInstance() +{ + KInstance *instance = KDevGenericFactory::createInstance(); + KStandardDirs *dirs = instance->dirs(); + dirs->addResourceType( "newclasstemplates", KStandardDirs::kde_default("data") + "kdevcppsupport/newclass/" ); + dirs->addResourceType( "pcs", KStandardDirs::kde_default( "data" ) + "kdevcppsupport/pcs/" ); + + return instance; +} + +const KDevPluginInfo * CppSupportFactory::info() +{ + return &data; +} +//kate: indent-mode csands; tab-width 4; space-indent off; + + diff --git a/languages/cpp/cppsupportfactory.h b/languages/cpp/cppsupportfactory.h new file mode 100644 index 00000000..78f53a7f --- /dev/null +++ b/languages/cpp/cppsupportfactory.h @@ -0,0 +1,33 @@ +/*************************************************************************** +* Copyright (C) 2000-2001 by Bernd Gehrmann * +* bernd@kdevelop.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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _CPPSUPPORTFACTORY_H_ +#define _CPPSUPPORTFACTORY_H_ + +#include +#include "cppsupportpart.h" + +class KDevPluginInfo; + +class CppSupportFactory : public KDevGenericFactory +{ +public: + CppSupportFactory(); + + static const KDevPluginInfo *info(); + +protected: + virtual KInstance *createInstance(); +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/cppsupportpart.cpp b/languages/cpp/cppsupportpart.cpp new file mode 100644 index 00000000..f72b168c --- /dev/null +++ b/languages/cpp/cppsupportpart.cpp @@ -0,0 +1,3186 @@ +/*************************************************************************** +* Copyright (C) 1999 by Jonas Nordin * +* jonas.nordin@syncom.se * +* Copyright (C) 2000-2001 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2002-2003 by Roberto Raggi * +* roberto@kdevelop.org * +* Copyright (C) 2003-2004 by Alexander Dymo * +* adymo@mksat.net * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + + +#include "cppsupportpart.h" +#include "cppsupport_events.h" +#include "problemreporter.h" +#include "backgroundparser.h" +#include "store_walker.h" +#include "ast.h" +#include "ast_utils.h" +#include "cppcodecompletion.h" +#include "ccconfigwidget.h" +#include "KDevCppSupportIface.h" +#include "cppsupportfactory.h" +#include "catalog.h" +#include "cpp_tags.h" +#include "kdevdriver.h" +#include "cppcodecompletionconfig.h" +#include "cppsplitheadersourceconfig.h" +#include "tag_creator.h" +#include "cppsupport_utils.h" +#include "classgeneratorconfig.h" +#include "urlutil.h" +#include "creategettersetterconfiguration.h" +#include "kdevsourceformatter.h" +#include "kdevcreatefile.h" +#include "qtbuildconfig.h" +#include "kdeveditorutil.h" +#include +#include +// wizards +#include "cppnewclassdlg.h" +#include "subclassingdlg.h" +#include "addmethoddialog.h" +#include "addattributedialog.h" +#include "creategettersetterdialog.h" +// designer integration +#include "qtdesignercppintegration.h" +#include "cppimplementationwidget.h" +#include "configproblemreporter.h" +#include "codeinformationrepository.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +const bool alwaysParseInBackground = true; + +enum { KDEV_DB_VERSION = 21 }; +enum { KDEV_PCS_VERSION = 18 }; + +QStringList CppSupportPart::m_sourceMimeTypes = QStringList() << "text/x-csrc" << "text/x-c++src"; +QStringList CppSupportPart::m_headerMimeTypes = QStringList() << "text/x-chdr" << "text/x-c++hdr"; + +QStringList CppSupportPart::m_sourceExtensions = QStringList::split( ",", "c,C,cc,cpp,c++,cxx,m,mm,M" ); +QStringList CppSupportPart::m_headerExtensions = QStringList::split( ",", "h,H,hh,h++,hxx,hpp,inl,tlh,diff,ui.h" ); + +class CppDriver: public KDevDriver +{ +public: + CppDriver( CppSupportPart* cppSupport ) : KDevDriver( cppSupport, true ) + {} + + void fileParsed( ParsedFile& fileName ) + { + //kdDebug(9007) << "-----> file " << fileName << " parsed!" << endl; + + ParsedFilePointer ast = takeTranslationUnit( fileName.fileName() ); + + if ( cppSupport() ->problemReporter() ) + { + cppSupport() ->problemReporter() ->removeAllProblems( fileName.fileName() ); + + QValueList pl = problems( fileName.fileName() ); + QValueList::ConstIterator it = pl.begin(); + while ( it != pl.end() ) + { + const Problem & p = *it++; + cppSupport() ->problemReporter() ->reportProblem( fileName.fileName(), p ); + } + } + + StoreWalker walker( fileName.fileName(), cppSupport() ->codeModel() ); + + if ( cppSupport() ->codeModel() ->hasFile( fileName.fileName() ) ) + { + FileDom file = cppSupport() ->codeModel() ->fileByName( fileName.fileName() ); + cppSupport() ->removeWithReferences( fileName.fileName() ); + } + + walker.parseTranslationUnit( *ast ); + cppSupport() ->codeModel() ->addFile( walker.file() ); + remove + ( fileName.fileName() ); + + if( cppSupport()->_jd ) { + cppSupport()->_jd->backgroundState ++; + cppSupport()->_jd->lastParse = QTime::currentTime(); + } + + QFileInfo fileInfo( fileName.fileName() ); + QString path = URLUtil::canonicalPath( fileName.fileName() ); + + cppSupport()->m_timestamp[ path ] = fileInfo.lastModified(); + + cppSupport()->emitSynchronousParseReady( fileName.fileName(), ast ); + } +}; + +// ProblemReporter doesn't really depend on background parsing, so it's a bit of a mixup to +// handle them together, but it's the same config widget so... +class BackgroundParserConfig +{ + bool m_useProblemReporter; + bool m_useBackgroundParser; + int m_backgroundParseDelay; +public: + void readConfig() + { + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + m_useProblemReporter = config->readBoolEntry( "EnableProblemReporter", true ); + m_useBackgroundParser = config->readBoolEntry( "EnableCppBgParser", true ); + m_backgroundParseDelay = config->readNumEntry( "BgParserDelay", 500 ); + } + + bool useProblemReporter() { return m_useProblemReporter; } + bool useBackgroundParser() { return m_useBackgroundParser; } + int backgroudParseDelay() { return m_backgroundParseDelay; } +}; + + +CppSupportPart::CppSupportPart( QObject *parent, const char *name, const QStringList &args ) +: KDevLanguageSupport( CppSupportFactory::info(), parent, name ? name : "KDevCppSupport" ), m_backgroundParser(0), + m_activeDocument( 0 ), m_activeView( 0 ), m_activeSelection( 0 ), m_activeEditor( 0 ), m_activeViewCursor( 0 ), + m_projectClosed( true ), m_projectClosing( false ), m_valid( false ), m_isTyping( false ), m_hadErrors( false ), + _jd(0) +{ + setInstance( CppSupportFactory::instance() ); + + m_pCompletionConfig = new CppCodeCompletionConfig( this, projectDom() ); + m_pSplitHeaderSourceConfig = new CppSplitHeaderSourceConfig( this, projectDom() ); + m_pCreateGetterSetterConfiguration = new CreateGetterSetterConfiguration( this ); connect( m_pSplitHeaderSourceConfig, SIGNAL( stored() ), + this, SLOT( splitHeaderSourceConfigStored() ) ); + connect( m_pCompletionConfig, SIGNAL( stored() ), + this, SLOT( codeCompletionConfigStored() ) ); + m_qtBuildConfig = new QtBuildConfig( this, projectDom() ); + m_qtBuildConfig->store(); + + m_backgroundParserConfig = new BackgroundParserConfig; + m_backgroundParserConfig->readConfig(); + + m_driver = new CppDriver( this ); + m_problemReporter = 0; + + m_textChangedTimer = new QTimer( this ); + connect( m_textChangedTimer, SIGNAL(timeout()), this, SLOT(slotParseCurrentFile()) ); + + m_cursorMovedTimer = new QTimer( this ); + connect( m_cursorMovedTimer, SIGNAL(timeout()), this, SLOT(slotCursorPositionChanged()) ); + + +// m_deleteParserStoreTimer = new QTimer( this ); + m_saveMemoryTimer = new QTimer( this ); + m_buildSafeFileSetTimer = new QTimer( this ); +// m_functionHintTimer = new QTimer( this ); + connect( m_buildSafeFileSetTimer, SIGNAL(timeout()), this, SLOT(buildSafeFileSet()) ); + connect( m_saveMemoryTimer, SIGNAL(timeout()), this, SLOT(slotSaveMemory()) ); +// connect( m_deleteParserStoreTimer, SIGNAL(timeout()), this, SLOT(slotDeleteParserStore()) ); + resetParserStoreTimer(); + m_saveMemoryTimer->start( 240000, false ); //Free some memory every 4 minutes + // connect( m_functionHintTimer, SIGNAL(timeout()), this, SLOT(slotFunctionHint()) ); + + setXMLFile( "kdevcppsupport.rc" ); + + m_catalogList.setAutoDelete( true ); + + connect( core(), SIGNAL( projectOpened() ), this, SLOT( projectOpened() ) ); + connect( core(), SIGNAL( projectClosed() ), this, SLOT( projectClosed() ) ); + connect( core(), SIGNAL( languageChanged() ), this, SLOT( projectOpened() ) ); + connect( partController(), SIGNAL( savedFile( const KURL& ) ), + this, SLOT( savedFile( const KURL& ) ) ); + connect( core(), SIGNAL( contextMenu( QPopupMenu *, const Context * ) ), + this, SLOT( contextMenu( QPopupMenu *, const Context * ) ) ); + connect( partController(), SIGNAL( activePartChanged( KParts::Part* ) ), + this, SLOT( activePartChanged( KParts::Part* ) ) ); + connect( partController(), SIGNAL( partRemoved( KParts::Part* ) ), + this, SLOT( partRemoved( KParts::Part* ) ) ); + + connect( core(), SIGNAL( configWidget( KDialogBase* ) ), + this, SLOT( configWidget( KDialogBase* ) ) ); + + m_switchHeaderSourceAction = new KAction( i18n( "Switch Header/Implementation" ), SHIFT + Key_F12, + this, SLOT( slotSwitchHeader() ), + actionCollection(), "edit_switchheader" ); + m_switchHeaderSourceAction->setToolTip( i18n( "Switch between header and implementation files" ) ); + m_switchHeaderSourceAction->setWhatsThis( i18n( "Switch Header/Implementation

      " + "If you are currently looking at a header file, this " + "brings you to the corresponding implementation file. " + "If you are looking at an implementation file (.cpp etc.), " + "this brings you to the corresponding header file." ) ); + m_switchHeaderSourceAction->setEnabled( false ); + + KAction *action; + + action = new KAction( i18n( "Complete Text" ), CTRL + Key_Space, + this, SLOT( slotCompleteText() ), + actionCollection(), "edit_complete_text" ); + action->setToolTip( i18n( "Complete current expression" ) ); + action->setWhatsThis( i18n( "Complete Text

      Completes current expression using " + "memory class store for the current project and persistent class stores " + "for external libraries." ) ); + action->setEnabled( false ); + + m_createGetterSetterAction = new KAction( i18n( "Create Accessor Methods" ), 0, + this, SLOT( slotCreateAccessMethods() ), actionCollection(), + "edit_create_getter_setter" ); + + action = new KAction( i18n( "Make Member" ), 0, Key_F2, + this, SLOT( slotMakeMember() ), + actionCollection(), "edit_make_member" ); + action->setToolTip( i18n( "Make member" ) ); + action->setWhatsThis( i18n( "Make member

      Creates a class member function in implementation file " + "based on the member declaration at the current line." ) ); + action->plug( &m_DummyActionWidget ); + + action = new KAction( i18n( "Navigation Menu" ), 0, CTRL + ALT + Key_Space, + this, SLOT( slotNavigate() ), + actionCollection(), "edit_navigate" ); + action->setToolTip( i18n( "Show the navigation-menu" ) ); + action->setWhatsThis( i18n( "Navigate

      Shows a navigation-menu based on the type-evaluation of the item under the cursor." ) ); + action->plug( &m_DummyActionWidget ); + + + action = new KAction( i18n( "New Class..." ), "classnew", 0, + this, SLOT( slotNewClass() ), + actionCollection(), "project_newclass" ); + action->setToolTip( i18n( "Generate a new class" ) ); + action->setWhatsThis( i18n( "New Class

      Calls the New Class wizard." ) ); + + m_pCompletion = 0; + + withcpp = false; + if ( args.count() == 1 && args[ 0 ] == "Cpp" ) + withcpp = true; + + // daniel + connect( core( ), SIGNAL( projectConfigWidget( KDialogBase* ) ), this, + SLOT( projectConfigWidget( KDialogBase* ) ) ); + + new KDevCppSupportIface( this ); + //(void) dcopClient(); + + m_lockupTester = new UIBlockTester( 100 ); +} + + +CppSupportPart::~CppSupportPart() +{ + delete m_lockupTester; + + if ( !m_projectClosed ) + projectClosed(); + + delete( m_driver ); + m_driver = 0; + + if ( m_backgroundParser ) + { + m_backgroundParser->close(); + // m_backgroundParser->wait(); + delete m_backgroundParser; + m_backgroundParser = 0; + } + + codeRepository() ->setMainCatalog( 0 ); + + QPtrListIterator it( m_catalogList ); + while ( Catalog * catalog = it.current() ) + { + ++it; + codeRepository() ->unregisterCatalog( catalog ); + } + + + delete m_backgroundParserConfig; + m_backgroundParserConfig = 0; + + delete m_pCompletion; + m_pCompletion = 0; + +/* mainWindow()->removeView( m_problemReporter ); + delete m_problemReporter; + m_problemReporter = 0; +*/ + delete _jd; + _jd = 0; + + kdDebug( 9007 ) << k_funcinfo << endl; +} + + +void CppSupportPart::customEvent( QCustomEvent* ev ) +{ + kdDebug( 9007 ) << "CppSupportPart::customEvent(" << ev->type() << ")" << endl; + + QTime t; + t.start(); + bool fromDisk = false; + + if ( ev->type() == int( Event_FileParsed ) ) + { + resetParserStoreTimer(); + + FileParsedEvent * event = ( FileParsedEvent* ) ev; + fromDisk = event->fromDisk(); + QString fileName = event->fileName(); + bool hasErrors = false; + if ( m_problemReporter ) + { + m_problemReporter->removeAllProblems( fileName ); + + QValueList problems = event->problems(); + QValueList::ConstIterator it = problems.begin(); + while ( it != problems.end() ) + { + const Problem & p = *it++; + if ( p.level() == Problem::Level_Error ) + hasErrors = true; + + m_problemReporter->reportProblem( fileName, p ); + } + } + ParsedFilePointer p = m_backgroundParser->translationUnit( fileName ); + if( p && !p->includedFrom().isEmpty() ) { + kdDebug( 9007 ) << "customEvent() parsed included file \"" << fileName << "\" included from \"" << p->includedFrom() << "\"" << endl; + } else { + kdDebug( 9007 ) << "customEvent() parsed file \"" << fileName << "\"" << endl; + } + + if( p && !p->includedFrom().isEmpty() ) { + if( !project()->isProjectFile( fileName ) ) { + //The file was parsed to resolve a dependency, and is not a project file + addToRepository( p ); + } else { + //It is a project-file that was parsed for whatever reason to resolve a dependency(currently it isn't handled this way) + } + } else if( !project()->isProjectFile( fileName ) || !m_parseEmitWaiting.reject( fileName ) ) { + ParseEmitWaiting::Processed p = m_parseEmitWaiting.processFile( fileName, ( !m_hadErrors && hasErrors && !fromDisk && m_isTyping && fileName == m_activeFileName ) ? ParseEmitWaiting::HadErrors : ParseEmitWaiting::None ); + parseEmit( p ); + + //Increase status-bar + if( p.hasFlag( ParseEmitWaiting::Silent ) && _jd ) { + _jd->backgroundState ++; + _jd->lastParse = QTime::currentTime(); + } + + } else { + ParseEmitWaiting::Processed p = m_fileParsedEmitWaiting.processFile( fileName ); + if( !p.hasFlag( ParseEmitWaiting::Silent ) ) + emitFileParsed( p ); + + //Increase status-bar + if( p.hasFlag( ParseEmitWaiting::Silent ) && _jd ) { + _jd->backgroundState ++; + _jd->lastParse = QTime::currentTime(); + } + } + } +} + + +void CppSupportPart::projectConfigWidget( KDialogBase* dlg ) +{ + QVBox * vbox = 0; + + vbox = dlg->addVBoxPage( i18n( "C++ Support" ), i18n( "C++ Support" ), + BarIcon( info() ->icon(), KIcon::SizeMedium ) ); + CCConfigWidget* w = new CCConfigWidget( this, vbox ); + connect( dlg, SIGNAL( okClicked( ) ), w, SLOT( accept( ) ) ); +} + +void CppSupportPart::configWidget( KDialogBase *dlg ) +{ + QVBox * vbox = dlg->addVBoxPage( i18n( "C++ Class Generator" ), i18n( "C++ Class Generator" ), + BarIcon( info() ->icon(), KIcon::SizeMedium ) ); + ClassGeneratorConfig *w = new ClassGeneratorConfig( vbox, "classgenerator config widget" ); + connect( dlg, SIGNAL( okClicked() ), w, SLOT( storeConfig() ) ); + + vbox = dlg->addVBoxPage(i18n("C++ Parsing"), i18n("C++ Parsing"), + BarIcon( "source_cpp", KIcon::SizeMedium) ); + ConfigureProblemReporter* ww = new ConfigureProblemReporter( vbox ); + ww->setPart( this ); + connect(dlg, SIGNAL(okClicked()), ww, SLOT(accept())); +} + +void CppSupportPart::activePartChanged( KParts::Part *part ) +{ + kdDebug( 9032 ) << "CppSupportPart::activePartChanged()" << endl; + + bool enabled = false; + +// m_functionHintTimer->stop(); + + if ( m_activeView ) + { + disconnect( m_activeView, SIGNAL( cursorPositionChanged() ), this, 0 ); + } + if ( m_activeDocument ) + { + disconnect( m_activeDocument, SIGNAL(textChanged()), this, 0 ); + } + + m_isTyping = false; + m_hadErrors = true; + m_activeDocument = dynamic_cast( part ); + m_activeView = part ? dynamic_cast( part->widget() ) : 0; + m_activeEditor = dynamic_cast( part ); + m_activeSelection = dynamic_cast( part ); + m_activeViewCursor = dynamic_cast( m_activeView ); + + m_activeFileName = QString::null; + + if ( m_activeDocument ) + { + m_activeFileName = URLUtil::canonicalPath( m_activeDocument->url().path() ); + QFileInfo fi( m_activeFileName ); + QString ext = fi.extension(); + if ( isSource( m_activeFileName ) || isHeader( m_activeFileName ) ) + enabled = true; + } + + actionCollection() ->action( "edit_switchheader" ) ->setEnabled( enabled ); + actionCollection() ->action( "edit_complete_text" ) ->setEnabled( enabled ); + actionCollection() ->action( "edit_make_member" ) ->setEnabled( enabled ); + + if ( !part || !part->widget() ) + return ; + + if ( m_activeDocument ) + { + connect( m_activeDocument, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) ); + m_textChangedTimer->start( 250, true ); // kick the parse timer, we might want to parse the current file + } + + if ( m_activeViewCursor ) + { + connect( m_activeView, SIGNAL( cursorPositionChanged() ), this, SLOT(slotCursorMoved()) ); +// this, SLOT( slotCursorPositionChanged() ) ); + } + + +#if 0 + KTextEditor::TextHintInterface* textHintIface = dynamic_cast( m_activeView ); + if ( !textHintIface ) + return ; + + connect( view, SIGNAL( needTextHint( int, int, QString& ) ), + this, SLOT( slotNeedTextHint( int, int, QString& ) ) ); + + textHintIface->enableTextHints( 1000 ); +#endif +} + + +void CppSupportPart::setTyping( bool typing ) { + m_isTyping = typing; + if( m_problemReporter) { + m_hadErrors &= m_problemReporter->hasErrors(m_activeFileName);///m_hadErrors generally stores whether there was an error-free state of the file. + } +} + + +void CppSupportPart::projectOpened( ) +{ + kdDebug( 9007 ) << "projectOpened( )" << endl; + + m_backgroundParser = new BackgroundParser( this, &m_eventConsumed ); + m_backgroundParser->start( QThread::IdlePriority ); + + // setup the driver + QString conf_file_name = specialHeaderName(); + if ( QFile::exists( conf_file_name ) ) + m_driver->parseFile( conf_file_name, true, true, true ); + + m_projectDirectory = URLUtil::canonicalPath( project() ->projectDirectory() ); + m_projectFileList = project() ->allFiles(); + + setupCatalog(); + + embedProblemReporter(); + + connect( core(), SIGNAL( configWidget( KDialogBase* ) ), + m_problemReporter, SLOT( configWidget( KDialogBase* ) ) ); + + connect( project( ), SIGNAL( addedFilesToProject( const QStringList & ) ), + this, SLOT( addedFilesToProject( const QStringList & ) ) ); + connect( project( ), SIGNAL( removedFilesFromProject( const QStringList & ) ), + this, SLOT( removedFilesFromProject( const QStringList & ) ) ); + connect( project( ), SIGNAL( changedFilesInProject( const QStringList & ) ), + this, SLOT( changedFilesInProject( const QStringList & ) ) ); + connect( project(), SIGNAL( projectCompiled() ), + this, SLOT( slotProjectCompiled() ) ); + + m_timestamp.clear(); + m_parseEmitWaiting.clear(); + m_fileParsedEmitWaiting.clear(); + + m_pCompletion = new CppCodeCompletion( this ); + m_projectClosed = false; + + m_buildSafeFileSetTimer->start( 500, true ); + updateParserConfiguration(); //Necessary to respect custom include-paths and such + + QTimer::singleShot( 500, this, SLOT( initialParse( ) ) ); +} + +void CppSupportPart::embedProblemReporter( bool force ) +{ + if ( force || m_backgroundParserConfig->useProblemReporter() ) + { + m_problemReporter = new ProblemReporter( this, 0, "problemReporterWidget" ); + m_problemReporter->setIcon( SmallIcon( "info" ) ); + m_problemReporter->setCaption( i18n( "Problem Reporter" ) ); + mainWindow( ) ->embedOutputView( m_problemReporter, i18n( "Problems" ), i18n( "Problem reporter" ) ); + } +} + +void CppSupportPart::removeProblemReporter() +{ + mainWindow()->removeView( m_problemReporter ); + delete m_problemReporter; + m_problemReporter = 0; +} + + +void CppSupportPart::projectClosed( ) +{ + kdDebug( 9007 ) << "projectClosed( )" << endl; + + m_projectClosing = true; + + QStringList enabledPCSs; + QValueList catalogs = codeRepository() ->registeredCatalogs(); + for ( QValueList::Iterator it = catalogs.begin(); it != catalogs.end(); ++it ) + { + Catalog* c = *it; + if ( c->enabled() ) + enabledPCSs.push_back( QFileInfo( c->dbName() ).baseName(true) ); + } + DomUtil::writeListEntry( *project() ->projectDom(), "kdevcppsupport/references", "pcs", enabledPCSs ); + + for ( QMap::const_iterator it = m_designers.begin(); + it != m_designers.end(); ++it ) + { + kdDebug( 9007 ) << "calling save settings fro designer integration" << endl; + it.data() ->saveSettings( *project() ->projectDom(), "kdevcppsupport/designerintegration" ); + } + + saveProjectSourceInfo(); + + m_pCompletionConfig->store(); + + delete _jd; + _jd = 0; + + removeProblemReporter(); + + delete m_pCompletion; + m_parseEmitWaiting.clear(); + m_fileParsedEmitWaiting.clear(); + m_pCompletion = 0; + m_projectClosed = true; + m_projectClosing = false; +} + + +void CppSupportPart::slotNavigate() { + if( codeCompletion() && m_activeView && m_activeViewCursor ) { + unsigned int curLine = 0, curCol = 0; + m_activeViewCursor->cursorPositionReal( &curLine, &curCol ); + + if( m_navigationMenu ) delete (KPopupMenu*)m_navigationMenu; + + m_navigationMenu = new KPopupMenu( m_activeView ); + + codeCompletion()->contextEvaluationMenus( m_navigationMenu, 0, curLine, curCol ); + + m_navigationMenu->move( m_activeView->mapToGlobal( m_activeViewCursor->cursorCoordinates() ) ); + if ( m_navigationMenu->count() > 0 ) + { + m_navigationMenu->show(); + } + } +} + + +void CppSupportPart::contextMenu( QPopupMenu *popup, const Context *context ) +{ + m_activeClass = 0; + m_activeFunction = 0; + m_activeVariable = 0; + m_curAttribute = 0; + m_curClass = 0; + + if ( context->hasType( Context::EditorContext ) ) + { + int id; + + m_switchHeaderSourceAction->plug( popup ); + + // CodeModelItemContext + if ( context->type() == Context::EditorContext ) + { + m_curClass = currentClass(); + if ( m_curClass != 0 ) + { + m_curAttribute = currentAttribute( m_curClass ); + if ( m_curAttribute != 0 ) + m_createGetterSetterAction->plug( popup ); + } + } + + QString text; + int atline, atcol; + MakeMemberHelper( text, atline, atcol ); + if ( !text.isEmpty() ) + { + id = popup->insertItem( i18n( "Make Member" ), this, SLOT( slotMakeMember() ) ); + popup->setWhatsThis( id, i18n( "Make member

      Creates a class member function in implementation file " + "based on the member declaration at the current line." ) ); + } + + kdDebug( 9007 ) << "======> code model has the file: " << m_activeFileName << " = " << codeModel() ->hasFile( m_activeFileName ) << endl; + + bool showContextMenuExplosion = false; + bool showContextTypeEvaluation = false; + KConfig *config = CppSupportFactory::instance() ->config(); + if ( config ) + { + config->setGroup( "General" ); + showContextMenuExplosion = config->readBoolEntry( "ShowContextMenuExplosion", false ); + config->setGroup( "General" ); + showContextTypeEvaluation = config->readBoolEntry( "ShowContextTypeEvaluation", true ); + } + + + if( codeModel() ->hasFile( m_activeFileName ) ) { + + if( showContextTypeEvaluation && m_activeViewCursor != 0 ) { + if( codeCompletion() ) { + unsigned int curLine = 0, curCol = 0; + m_activeViewCursor->cursorPositionReal( &curLine, &curCol ); + + codeCompletion()->contextEvaluationMenus( popup, context, curLine, curCol ); + } + } + + + if ( showContextMenuExplosion ) + { + //kdDebug( 9007 ) << "CppSupportPart::contextMenu 1" << endl; + QString candidate; + if ( isSource( m_activeFileName ) ) + candidate = sourceOrHeaderCandidate(); + else + candidate = m_activeFileName; + + unsigned int curLine = 0, curCol = 0; + if ( m_activeViewCursor != 0 ) + m_activeViewCursor->cursorPositionReal( &curLine, &curCol ); + + //kdDebug( 9007 ) << "CppSupportPart::contextMenu 2: candidate: " << candidate << endl; + + if ( !candidate.isEmpty() && codeModel() ->hasFile( candidate ) ) + { + QPopupMenu * m2 = new QPopupMenu( popup ); + id = popup->insertItem( i18n( "Go to Declaration" ), m2 ); + popup->setWhatsThis( id, i18n( "Go to declaration

      Provides a menu to select available function declarations " + "in the current file and in the corresponding header (if the current file is an implementation) or source (if the current file is a header) file." ) ); + + FileDom file2 = codeModel() ->fileByName( candidate ); + //kdDebug( 9007 ) << "CppSupportPart::contextMenu 3: " << file2->name() << endl; + + FunctionList functionList2 = CodeModelUtils::allFunctions( file2 ); + for ( FunctionList::ConstIterator it = functionList2.begin(); it != functionList2.end(); ++it ) + { + QString text = ( *it ) ->scope().join( "::" ); + //kdDebug( 9007 ) << "CppSupportPart::contextMenu 3 text: " << text << endl; + if ( !text.isEmpty() ) + { + text += "::"; + } + text += formatModelItem( *it, true ); + text = text.replace( QString::fromLatin1( "&" ), QString::fromLatin1( "&&" ) ); + int id = m2->insertItem( text, this, SLOT( gotoDeclarationLine( int ) ) ); + int line, column; + ( *it ) ->getStartPosition( &line, &column ); + m2->setItemParameter( id, line ); + } + + if ( m2->count() == 0 ) + { + popup->removeItem( id ); + } + //kdDebug( 9007 ) << "CppSupportPart::contextMenu 4" << endl; + } + + QString candidate1; + if ( isHeader( m_activeFileName ) ) + { + candidate1 = sourceOrHeaderCandidate(); + } + else + { + candidate1 = m_activeFileName; + } + //kdDebug( 9007 ) << "CppSupportPart::go to definition in " << candidate1 << endl; + if ( codeModel() ->hasFile( candidate1 ) ) + { + QPopupMenu * m = new QPopupMenu( popup ); + id = popup->insertItem( i18n( "Go to Definition" ), m ); + popup->setWhatsThis( id, i18n( "Go to definition

      Provides a menu to select available function definitions " + "in the current file and in the corresponding header (if the current file is an implementation) or source (if the current file is a header) file." ) ); + + const FileDom file = codeModel() ->fileByName( candidate1 ); + const FunctionDefinitionList functionDefinitionList = CodeModelUtils::allFunctionDefinitionsDetailed( file ).functionList; + for ( FunctionDefinitionList::ConstIterator it = functionDefinitionList.begin(); it != functionDefinitionList.end(); ++it ) + { + QString text = ( *it ) ->scope().join( "::" ); + if ( !text.isEmpty() ) + { + text += "::"; + } + text += formatModelItem( *it, true ); + text = text.replace( QString::fromLatin1( "&" ), QString::fromLatin1( "&&" ) ); + int id = m->insertItem( text, this, SLOT( gotoLine( int ) ) ); + int line, column; + ( *it ) ->getStartPosition( &line, &column ); + m->setItemParameter( id, line ); + } + if ( m->count() == 0 ) + { + popup->removeItem( id ); + } + + } + } + } + + const EditorContext *econtext = static_cast( context ); + QString str = econtext->currentLine(); + if ( str.isEmpty() ) + return ; + } + else if ( context->hasType( Context::CodeModelItemContext ) ) + { + const CodeModelItemContext * mcontext = static_cast( context ); + + if ( mcontext->item() ->isClass() ) + { + m_activeClass = ( ClassModel* ) mcontext->item(); + int id = popup->insertItem( i18n( "Extract Interface..." ), this, SLOT( slotExtractInterface() ) ); + popup->setWhatsThis( id, i18n( "Extract interface

      Extracts interface from the selected class and creates a new class with this interface. " + "No implementation code is extracted and no implementation code is created." ) ); + } + else if ( mcontext->item() ->isFunction() ) + { + m_activeFunction = ( FunctionModel* ) mcontext->item(); + } + } + else if ( context->hasType( Context::FileContext ) ) + { + const FileContext * fc = static_cast( context ); + //this is a .ui file and only selection contains only one such file + KURL url = fc->urls().first(); + kdDebug( 9007 ) << "file context with " << url.path() << endl; + if ( url.fileName().endsWith( ".ui" ) ) + { + m_contextFileName = url.path(); + int id = popup->insertItem( i18n( "Create or Select Implementation..." ), this, SLOT( slotCreateSubclass() ) ); + popup->setWhatsThis( id, i18n( "Create or select implementation

      Creates or selects a subclass of selected form for use with integrated KDevDesigner." ) ); + } + } +} + + +QStringList makeListUnique( const QStringList& rhs ) { + QMap map; + QStringList ret; + for( QStringList::const_iterator it = rhs.begin(); it != rhs.end(); ++it ) { + if( map.find( *it ) == map.end() ) { + ret << *it; + map.insert( *it, true ); + } + } + return ret; +} + +// Makes sure that header files come first +QStringList CppSupportPart::reorder( const QStringList &list ) +{ + QStringList headers, others; + + QStringList headerExtensions = QStringList::split( ",", "h,H,hh,hxx,hpp,tlh" ); + + QString projectPath = project()->projectDirectory(); + + QStringList::ConstIterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + QString filePath = *it; + // brilliant stuff.. this method is apparently called both with + // relative and absolute paths.. + if ( !filePath.startsWith("/") ) + { + filePath = projectPath + "/" + filePath; + } + if( !isValidSource( filePath ) ) continue; + if ( headerExtensions.contains( QFileInfo( filePath ).extension() ) ) + headers << ( filePath ); + else + others << ( filePath ); + } + + return makeListUnique( headers + others ); +} + +void CppSupportPart::addedFilesToProject( const QStringList &fileList ) +{ + m_projectFileList = project() ->allFiles(); + QStringList files = reorder( fileList ); + + for ( QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) + { + QString path = *it; + if (!path.startsWith("/")) + path = URLUtil::canonicalPath( m_projectDirectory + "/" + ( *it ) ); + + maybeParse( path ); + //emit addedSourceInfo( path ); + } + m_buildSafeFileSetTimer->start( 500, true ); +} + +void CppSupportPart::removedFilesFromProject( const QStringList &fileList ) +{ + m_projectFileList = project() ->allFiles(); + for ( QStringList::ConstIterator it = fileList.begin(); it != fileList.end(); ++it ) + { + QString path = URLUtil::canonicalPath( m_projectDirectory + "/" + *it ); + kdDebug( 9007 ) << "=====================> remove file: " << path << endl; + + removeWithReferences( path ); + m_backgroundParser->removeFile( path ); + } + m_buildSafeFileSetTimer->start( 500, true ); +} + +void CppSupportPart::changedFilesInProject( const QStringList & fileList ) +{ + QStringList files = reorder( fileList ); + + for ( QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) + { + QString path = URLUtil::canonicalPath( m_projectDirectory + "/" + *it ); + + maybeParse( path ); + //emit addedSourceInfo( path ); + } +} + +void CppSupportPart::savedFile( const KURL &file ) +{ + if( file.path() == m_activeFileName ) { + m_isTyping = false; + m_hadErrors = false; + maybeParse( file.path() ); + } + + Q_UNUSED( file.path() ); + +#if 0 // not needed anymore + + kdDebug( 9007 ) << "savedFile(): " << fileName.mid ( m_projectDirectory.length() + 1 ) << endl; + + if ( m_projectFileList.contains( fileName.mid ( m_projectDirectory.length() + 1 ) ) ) + { + maybeParse( fileName ); + emit addedSourceInfo( fileName ); + } +#endif +} + +QString CppSupportPart::findSourceFile() +{ + // get the path of the currently active document + QFileInfo fi( m_activeFileName ); + QString path = fi.filePath(); + QString ext = fi.extension(); + // extract the base path (full path without '.' and extension) + QString base = path.left( path.length() - ext.length() - 1 ); + QStringList candidates; + if ( QStringList::split( ',', "h,H,hh,hxx,hpp,tlh" ).contains( ext ) ) + { + candidates << ( base + ".c" ); + candidates << ( base + ".cc" ); + candidates << ( base + ".cpp" ); + candidates << ( base + ".c++" ); + candidates << ( base + ".cxx" ); + candidates << ( base + ".C" ); + candidates << ( base + ".m" ); + candidates << ( base + ".mm" ); + candidates << ( base + ".M" ); + candidates << ( base + ".inl" ); + candidates << ( base + "_impl.h" ); + } + + QStringList::ConstIterator it; + for ( it = candidates.begin(); it != candidates.end(); ++it ) + { + kdDebug( 9007 ) << "Trying " << ( *it ) << endl; + if ( QFileInfo( *it ).exists() ) + { + return * it; + } + } + return m_activeFileName; +} + +QString CppSupportPart::sourceOrHeaderCandidate( const KURL &url ) +{ + QString urlPath; + if ( url.isEmpty() ) + { + KTextEditor::Document * doc = + dynamic_cast( partController() ->activePart() ); + if ( !doc ) + return QString::null; + urlPath = doc->url().path(); + } + else + { + urlPath = url.path(); + } + // get the path of the currently active document + QFileInfo fi( urlPath ); + QString path = fi.filePath(); + // extract the exension + QString ext = fi.extension(); + if ( ext.isEmpty() ) + return QString::null; + // extract the base path (full path without '.' and extension) + QString base = path.left( path.length() - ext.length() - 1 ); + //kdDebug( 9007 ) << "base: " << base << ", ext: " << ext << endl; + // just the filename without the extension + QString fileNameWoExt = fi.fileName(); + if ( !ext.isEmpty() ) + fileNameWoExt.replace( "." + ext, "" ); + QString possibleExts; + // depending on the current extension assemble a list of + // candidate files to look for + QStringList candidates; + // special case for template classes created by the new class dialog + if ( path.endsWith( "_impl.h" ) ) + { + QString headerpath = path; + headerpath.replace( "_impl.h", ".h" ); + candidates << headerpath; + fileNameWoExt.replace( "_impl", "" ); + possibleExts = "h"; + } + // if file is a header file search for implementation file + else if ( QStringList::split( ',', "h,H,hh,hxx,hpp,tlh" ).contains( ext ) ) + { + candidates << ( base + ".c" ); + candidates << ( base + ".cc" ); + candidates << ( base + ".cpp" ); + candidates << ( base + ".c++" ); + candidates << ( base + ".cxx" ); + candidates << ( base + ".C" ); + candidates << ( base + ".m" ); + candidates << ( base + ".mm" ); + candidates << ( base + ".M" ); + candidates << ( base + ".inl" ); + candidates << ( base + "_impl.h" ); + possibleExts = "c,cc,cpp,c++,cxx,C,m,mm,M,inl,_impl.h"; + } + // if file is an implementation file, search for header file + else if ( QStringList::split( ',', "c,cc,cpp,c++,cxx,C,m,mm,M,inl" ).contains( ext ) ) + { + candidates << ( base + ".h" ); + candidates << ( base + ".H" ); + candidates << ( base + ".hh" ); + candidates << ( base + ".hxx" ); + candidates << ( base + ".hpp" ); + candidates << ( base + ".tlh" ); + possibleExts = "h,H,hh,hxx,hpp,tlh"; + } + // search for files from the assembled candidate lists, return the first + // candidate file that actually exists or QString::null if nothing is found. + QStringList::ConstIterator it; + for ( it = candidates.begin(); it != candidates.end(); ++it ) + { + //kdDebug( 9007 ) << "Trying " << ( *it ) << endl; + if ( QFileInfo( *it ).exists() ) + { + kdDebug( 9007 ) << "using: " << *it << endl; + return * it; + } + } + //kdDebug( 9007 ) << "Now searching in project files." << endl; + // Our last resort: search the project file list for matching files + QStringList::iterator fileIt; + QFileInfo candidateFileWoExt; + QString candidateFileWoExtString; + QStringList possibleExtsList = QStringList::split( ',', possibleExts ); + for ( fileIt = m_projectFileList.begin(); fileIt != m_projectFileList.end(); ++fileIt ) + { + candidateFileWoExt.setFile(*fileIt); + //kdDebug( 9007 ) << "candidate file: " << *fileIt << endl; + if( !candidateFileWoExt.extension().isEmpty() ) + candidateFileWoExtString = candidateFileWoExt.fileName().replace( "." + candidateFileWoExt.extension(), "" ); + if ( candidateFileWoExtString == fileNameWoExt ) + { + if ( possibleExtsList.contains( candidateFileWoExt.extension() ) || candidateFileWoExt.extension().isEmpty() ) + { + //kdDebug( 9007 ) << "checking if " << *fileIt << " exists" << endl; + if ( QFileInfo( *fileIt ).exists() ) + kdDebug( 9007 ) << "using: " << *fileIt << endl; + return *fileIt; + } + } + } + return QString::null; +} + +void CppSupportPart::slotSaveMemory() { + if( m_backgroundParser ) { + ///This is done so the caches are completely empty after kdevelop was idle for some time(else it would be waste of memory). The background-parsers internal lexer-cache-manager just cares about keeping the count of cached files under a specific count, but doesn't decrease that count when kdevelop is idle. + m_backgroundParser->lock(); + m_backgroundParser->saveMemory(); + m_backgroundParser->unlock(); + } +} + +void CppSupportPart::slotSwitchHeader( bool scrollOnly ) +{ + bool attemptMatch = true; + KConfig *config = CppSupportFactory::instance() ->config(); + if ( config ) + { + config->setGroup( "General" ); + attemptMatch = config->readBoolEntry( "SwitchShouldMatch", true ); + } + + // ok, both files exist. Do the codemodel have them? + if ( codeModel() ->hasFile( m_activeFileName ) && m_activeViewCursor && attemptMatch ) + { + unsigned int currentline, column; + m_activeViewCursor->cursorPositionReal( ¤tline, &column ); + + if ( switchHeaderImpl( m_activeFileName, currentline, column, scrollOnly ) ) + return; + } + + // last chance + KURL url; + url.setPath( sourceOrHeaderCandidate() ); + + if ( scrollOnly ) + return; + else if ( !splitHeaderSourceConfig()->splitEnabled() ) + partController() ->editDocument( url ); + else + partController() ->splitCurrentDocument( url ); +} + +bool CppSupportPart::switchHeaderImpl( const QString& file, int line, int col, bool scrollOnly ) +{ + bool handled = false; + + FunctionDom d; + FileDom fd = codeModel() ->fileByName( file ); + if ( fd ) { + CodeModelUtils::CodeModelHelper h( codeModel(), fd ); + d = h.functionAt( line, col ); + } + if ( d ) { + if( d->isFunctionDefinition() ) { + FunctionDom decl = findFunction( d ); + if ( decl ) { + if ( (void*)&decl != (void*)d.data() && ( !scrollOnly || decl->fileName() != file ) ) { + jumpToCodeModelItem( model_cast(decl), scrollOnly ); + handled = true; + } + } + } else { + FunctionDom def = findFunctionDefinition( d ); + if ( def ) { + if ( def != d && ( !scrollOnly || def->fileName() != file ) ) { + jumpToCodeModelItem( model_cast(def), scrollOnly ); + handled = true; + } + } + } + } + + return handled; +} + +FunctionDom CppSupportPart::findFunction( const FunctionDom& def ) +{ + // We have a definition so we're looking for a declaration. The declaration will either be the child of a namespace node (non class members) + // or the child of a class node (class member). Search recursively until we find a declaration that matches. + FunctionDom bestMatch; + FunctionDom decl = findFunctionInNamespace( codeModel()->globalNamespace(), def, codeModel()->globalNamespace()->namespaceImports(), + sourceOrHeaderCandidate( def->fileName() ), 0, bestMatch ); + return decl ? decl : bestMatch; +} + +FunctionDom CppSupportPart::findFunctionInNamespace( const NamespaceDom& ns, const FunctionDom& def, const std::set& nsImports, + const QString& candidateFile, int scopeIndex, FunctionDom& bestMatch ) +{ + FunctionDom d; + QStringList scope = def->scope(); + if ( !(scopeIndex >= (signed) scope.size()) ) { + NamespaceDom ns_next = ns->namespaceByName( scope[ scopeIndex ] ); + if ( ns_next ) { + d = findFunctionInNamespace( ns_next, def, ns_next->namespaceImports(), candidateFile, scopeIndex+1, bestMatch ); + } + if ( !d ) { + for ( std::set::const_iterator it_ns = nsImports.begin(); it_ns != nsImports.end(); ++it_ns ) { + if ( (*it_ns).fileName().str() == def->fileName() ) { + ns_next = ns->namespaceByName( (*it_ns).name() ); + if ( ns_next ) { + if ( d = findFunctionInNamespace( ns_next, def, nsImports, candidateFile, scopeIndex, bestMatch ) ) break; + } + } + } + } + if ( !d ) { + ClassList classList = ns->classByName( scope[ scopeIndex ] ); + for ( ClassList::ConstIterator it_cs = classList.begin(); it_cs != classList.end(); ) { + if ( d = findFunctionInClass( *(it_cs++), def, nsImports, candidateFile, scopeIndex+1, bestMatch ) ) break; + } + } + } + if ( !d ) { + FunctionList functionList = ns->functionByName( def->name() ); + for ( FunctionList::ConstIterator it_decl = functionList.begin(); it_decl != functionList.end(); ++it_decl ) { + if ( CodeModelUtils::compareDeclarationToDefinition( *it_decl, (FunctionDefinitionModel*) def.data(), nsImports ) ) { + ParsedFile* p = dynamic_cast( def->file()->parseResult().data() ); + if ( p ) { + if ( p->includeFiles()[ (*it_decl)->fileName() ] ) { + d = *it_decl; + break; + } else if ( (*it_decl)->fileName() == candidateFile ) { + d = *it_decl; + break; + } + } + if ( !bestMatch ) { + bestMatch = *it_decl; + } + } + } + } + return d; +} + +FunctionDom CppSupportPart::findFunctionInClass( const ClassDom& cs, const FunctionDom& def, const std::set& nsImports, + const QString& candidateFile, int scopeIndex, FunctionDom& bestMatch ) +{ + FunctionDom d; + QStringList scope = def->scope(); + if ( !(scopeIndex >= (signed) scope.size()) ) { + ClassList classList = cs->classByName( scope[ scopeIndex ] ); + for ( ClassList::ConstIterator it_cs = classList.begin(); it_cs != classList.end(); ) { + if ( d = findFunctionInClass( *(it_cs++), def, nsImports, candidateFile, scopeIndex+1, bestMatch ) ) break; + } + } + if ( !d ) { + FunctionList functionList = cs->functionByName( def->name() ); + for ( FunctionList::ConstIterator it_decl = functionList.begin(); it_decl != functionList.end(); ++it_decl ) { + if ( CodeModelUtils::compareDeclarationToDefinition( *it_decl, (FunctionDefinitionModel*) def.data(), nsImports ) ) { + ParsedFile* p = dynamic_cast( def->file()->parseResult().data() ); + if ( p ) { + if ( p->includeFiles()[ (*it_decl)->fileName() ] ) { + d = *it_decl; + break; + } else if ( (*it_decl)->fileName() == candidateFile ) { + d = *it_decl; + break; + } + } + if ( !bestMatch ) { + bestMatch = *it_decl; + } + } + } + } + return d; +} + +FunctionDom CppSupportPart::findFunctionDefinition( const FunctionDom& decl ) +{ + // We have a declaration so we're looking for a definition. The definition will be the child of some namespace node (never a class node). + // Since the definition can be the child of any namespace in its scope depending on syntax, we have to check every one. + FunctionDom def, bestMatch; + NamespaceDom ns = codeModel()->globalNamespace(); + QString candidateFile = sourceOrHeaderCandidate( decl->fileName() ); + FunctionDefinitionList functionList = ns->functionDefinitionByName( decl->name() ); + for ( FunctionDefinitionList::ConstIterator it_def = functionList.begin(); it_def != functionList.end() && !def; ++it_def ) { + if ( CodeModelUtils::compareDeclarationToDefinition( decl, *it_def, ns->namespaceImports() ) ) { + ParsedFile* p = dynamic_cast( (*it_def)->file()->parseResult().data() ); + if ( p ) { + if ( p->includeFiles()[ decl->fileName() ] ) { + def = *it_def; + } else if ( (*it_def)->fileName() == candidateFile ) { + def = *it_def; + break; + } + } + if ( !bestMatch ) { + bestMatch = *it_def; + } + } + } + QStringList scope = decl->scope(); + for ( QStringList::ConstIterator it_scope = scope.begin(); it_scope != scope.end() && !def; ++it_scope ) { + NamespaceDom ns_next = ns->namespaceByName( *it_scope ); + if ( ns_next ) { + ns = ns_next; + FunctionDefinitionList functionList = ns->functionDefinitionByName( decl->name() ); + for ( FunctionDefinitionList::ConstIterator it_def = functionList.begin(); it_def != functionList.end() && !def; ++it_def ) { + if ( CodeModelUtils::compareDeclarationToDefinition( decl, *it_def, ns->namespaceImports() ) ) { + ParsedFile* p = dynamic_cast( (*it_def)->file()->parseResult().data() ); + if ( p ) { + if ( p->includeFiles()[ decl->fileName() ] ) { + def = *it_def; + } else if ( (*it_def)->fileName() == candidateFile ) { + def = *it_def; + break; + } + } + if ( !bestMatch ) { + bestMatch = *it_def; + } + } + } + } + } + return def ? def : bestMatch; +} + +void CppSupportPart::jumpToCodeModelItem( const ItemDom& item, bool scrollOnly ) +{ + static KURL lastSyncedUrl; + static int lastSyncedLine = -1; + + int line, col; + item->getStartPosition( &line, &col ); + + KURL url( item->fileName() ); + + if ( scrollOnly ) { + KParts::ReadOnlyPart* part = partController()->partForURL( url ); + int currentLine = lastSyncedLine; + if ( part ) { + KTextEditor::ViewCursorInterface *iface = dynamic_cast(part->widget()); + if( iface ) + iface->cursorPosition( (uint*) ¤tLine, (uint*) &col ); + } + partController() ->scrollToLineColumn( url, line, -1, lastSyncedLine != currentLine || lastSyncedUrl != url ); + } else if ( !splitHeaderSourceConfig()->splitEnabled() ) + partController() ->editDocument( url, line ); + else + partController() ->splitCurrentDocument( url, line ); + lastSyncedLine = line; + lastSyncedUrl = url; +} + +KDevLanguageSupport::Features CppSupportPart::features() +{ + if ( withcpp ) + return Features( Classes | Structs | Functions | Variables | Namespaces | Declarations + | Signals | Slots | AddMethod | AddAttribute | NewClass | CreateAccessMethods ); + else + return Features ( Structs | Functions | Variables | Declarations ); +} + +QString CppSupportPart::formatClassName( const QString &name ) +{ + QString n = name; + return n.replace( ".", "::" ); +} + +QString CppSupportPart::unformatClassName( const QString &name ) +{ + QString n = name; + return n.replace( "::", "." ); +} + +bool CppSupportPart::shouldSplitDocument(const KURL &url) +{ + if ( !splitHeaderSourceConfig()->splitEnabled() ) + return false; + + KURL::List list = partController()->openURLs(); + KURL::List::ConstIterator it = list.begin(); + while ( it != list.end() ) + { + QString candidate = sourceOrHeaderCandidate( ( *it ) ); + if ( candidate.isEmpty() ) + { + ++it; + continue; + } + + KURL urlCandidate; + urlCandidate.setPath( candidate ); + if ( url == urlCandidate ) + { + // It is already open, so switch to it so + // our split view will open with it + partController() ->editDocument( ( *it ) ); + return true; + } + ++it; + } + return false; +} + +Qt::Orientation CppSupportPart::splitOrientation() const +{ + QString o = splitHeaderSourceConfig()->orientation(); + if ( o == "Vertical" ) + return Qt::Vertical; + else + return Qt::Horizontal; +} + +void CppSupportPart::slotNewClass() +{ + CppNewClassDialog dlg( this ); + dlg.exec(); +} + +void CppSupportPart::addMethod( ClassDom klass ) +{ + if ( !klass ) + { + KMessageBox::error( 0, i18n( "Please select a class." ), i18n( "Error" ) ); + return ; + } + + AddMethodDialog dlg( this, klass, mainWindow() ->main() ); + dlg.exec(); +} + +void CppSupportPart::addAttribute( ClassDom klass ) +{ + if ( !klass ) + { + KMessageBox::error( 0, i18n( "Please select a class." ), i18n( "Error" ) ); + return ; + } + + AddAttributeDialog dlg( this, klass, mainWindow() ->main() ); + dlg.exec(); +} + +void CppSupportPart::slotCompleteText() +{ + if ( !m_pCompletion ) + return ; + m_pCompletion->completeText( true ); +} + +/** + * parsing stuff for project persistent classstore and code completion + */ +void CppSupportPart::initialParse( ) +{ + // For debugging + if ( !project( ) ) + { + // messagebox ? + kdDebug( 9007 ) << "No project" << endl; + return ; + } + + parseProject( ); + m_valid = true; + return ; +} + +bool CppSupportPart::parseProject( bool force ) +{ + if( _jd ) + delete _jd->progressBar; ///Make sure the progress-bar is open + + mainWindow() ->statusBar() ->message( i18n( "Updating..." ) ); + + kapp->setOverrideCursor( waitCursor ); + + _jd = new JobData; + if( QFileInfo( project() ->projectDirectory() + "/" + project()->projectName().lower() + + ".kdevelop.pcs" ).exists()) + { + QDir d( project() ->projectDirectory()); + d.rename(project() ->projectName().lower() + ".kdevelop.pcs", + project() ->projectName() +".kdevelop.pcs"); + } + _jd->file.setName( project() ->projectDirectory() + "/" + project()->projectName() + + ".kdevelop.pcs" ); + + QString skip_file_name = project() ->projectDirectory() + "/" + + project() ->projectName() + ".kdevelop.ignore_pcs"; + QString skip_lower_file_name = project() ->projectDirectory() + "/" + + project() ->projectName().lower() + ".kdevelop.ignore_pcs"; + + if ( !force && !QFile::exists( skip_file_name ) && + !QFile::exists( skip_lower_file_name ) && _jd->file.open( IO_ReadOnly ) ) + { + _jd->stream.setDevice( &( _jd->file ) ); + + createIgnorePCSFile(); + + QString sig; + int pcs_version = 0; + _jd->stream >> sig >> pcs_version; + if ( sig == "PCS" && pcs_version == KDEV_PCS_VERSION ) + { + + int numFiles = 0; + _jd->stream >> numFiles; + kdDebug( 9007 ) << "Read " << numFiles << " files from pcs" << endl; + + for ( int i = 0; i < numFiles; ++i ) + { + QString fn; + uint ts; + uint offset; + + _jd->stream >> fn >> ts >> offset; + _jd->pcs[ fn ] = qMakePair( ts, offset ); + } + } + } + + _jd->files = reorder( modifiedFileList() ); + + QProgressBar* bar = new QProgressBar( _jd->files.count( ), mainWindow( ) ->statusBar( ) ); + bar->setMinimumWidth( 120 ); + bar->setCenterIndicator( true ); + mainWindow( ) ->statusBar( ) ->addWidget( bar ); + bar->show( ); + + _jd->progressBar = bar; + _jd->dir.setPath( m_projectDirectory ); + _jd->it = _jd->files.begin(); + _jd->reparseList = QStringList(); + _jd->backgroundCount = 0; + _jd->cycle = 0; + + QTimer::singleShot( 0, this, SLOT( slotParseFiles() ) ); + + m_saveMemoryTimer->stop(); //Do not regularly remove cached files that may still be needed while parsing(the cache anyway be full for the whole parsing-process) + return true; +} + +void CppSupportPart::slotParseFiles() +{ + // NOTE: The checking for m_projectClosed is actually (currently) not needed. + // When the project is closed, the language support plugin is destroyed + // and as a consequence, the timer job signal never arrives at this method + + if ( !_jd ) return; // how can this possibly happen?! + + if ( _jd->cycle == 0 && !m_projectClosed && _jd->it != _jd->files.end() ) + { + _jd->progressBar->setProgress( _jd->progressBar->progress() + 1 ); + + QFileInfo fileInfo( _jd->dir, *( _jd->it ) ); + + if ( fileInfo.exists() && fileInfo.isFile() && fileInfo.isReadable() ) + { + QString absFilePath = URLUtil::canonicalPath( fileInfo.absFilePath() ); + + if ( isValidSource( absFilePath ) ) + { + QDateTime t = fileInfo.lastModified(); + + if ( ! ( m_timestamp.contains( absFilePath ) && m_timestamp[ absFilePath ] == t ) ) + { + if ( _jd->pcs.contains( absFilePath ) ) + { + _jd->stream.device() ->at( _jd->pcs[ absFilePath ].second ); + FileDom file = codeModel() ->create(); + file->read( _jd->stream ); + codeModel() ->addFile( file ); + + if( t.toTime_t() != _jd->pcs[ absFilePath ].first ) { + ///The FileDom had to be created first, so the dependencies are known + _jd->reparseList << file->name(); +/* kdDebug( 9007 ) << "File timestamp: " << ": " << t.toTime_t() << endl; + kdDebug( 9007 ) << "Stored timestamp: " << ": " << _jd->pcs[ absFilePath ].first << endl;*/ + } else { + m_timestamp[ absFilePath ] = t; +/* kdDebug( 9007 ) << "timestamp ok" << endl;*/ + } + } else { + _jd->reparseList << absFilePath; + /* kdDebug( 9007 ) << absFilePath << " put into reparse-list" << endl; + */ } + } else { +/* kdDebug( 9007 ) << absFilePath << " is already in code-model" << endl;*/ + } + } + } + + ++( _jd->it ); + QTimer::singleShot( 0, this, SLOT( slotParseFiles() ) ); + + if( _jd->it == _jd->files.end()) { + if( _jd->reparseList.isEmpty() ) { + _jd->backgroundCount = 0; + } else { + if( alwaysParseInBackground ) { + _jd->backgroundCount = parseFilesAndDependencies( _jd->reparseList, true, false, true ); + } else { + _jd->reparseList = reorder( _jd->reparseList ); + _jd->it = _jd->reparseList.begin(); + _jd->backgroundCount = _jd->reparseList.count(); + } + _jd->progressBar->setProgress( 0 ); ///restart progress-bar for reparsing + _jd->progressBar->setTotalSteps( _jd->backgroundCount ); + } + + _jd->lastBackgroundState = -1; + _jd->backgroundState = 0; + _jd->cycle = 1; + _jd->lastParse = QTime::currentTime(); + kapp->restoreOverrideCursor( ); + } + } + else // finished or interrupted + { + if( _jd->backgroundCount <= _jd->backgroundState || m_projectClosed ) { + mainWindow( ) ->statusBar( ) ->removeWidget( _jd->progressBar ); + + if ( !m_projectClosed ) + { + kdDebug( 9007 ) << "updating sourceinfo" << endl; + kapp->restoreOverrideCursor( ); + emit updatedSourceInfo(); + mainWindow( ) ->statusBar( ) ->message( i18n( "Done" ), 2000 ); + QFile::remove( project() ->projectDirectory() + + "/" + project() ->projectName() + + ".kdevelop.ignore_pcs" ); + QFile::remove( project() ->projectDirectory() + + "/" + project() ->projectName().lower() + + ".kdevelop.ignore_pcs" ); + + } + else + { + kdDebug( 9007 ) << "ABORT" << endl; + } + + delete _jd; + _jd = 0; + m_saveMemoryTimer->start( 240000, false ); + } else { + _jd->progressBar->setProgress( _jd->backgroundState ); ///restart + _jd->progressBar->setTotalSteps( _jd->backgroundCount ); + if( _jd->lastParse.msecsTo( QTime::currentTime()) > 60000 && !m_backgroundParser->filesInQueue()) { + _jd->backgroundCount = _jd->backgroundState; ///Stop waiting if there is no progress and no file in the background-parser + QTimer::singleShot( 0, this, SLOT( slotParseFiles() ) ); + } else { + int timeStep = 0; + if( alwaysParseInBackground ) { + QTimer::singleShot( 10, this, SLOT( slotParseFiles() ) ); + } else { + if( _jd->it == _jd->reparseList.end() ) { + /*_jd->it = _jd->files.end(); + _jd->backgroundCount = _jd->backgroundState; ///finish processing*/ + timeStep = 1; + } else { + /*///Parse the files one by one + if( _jd->lastParse.msecsTo( QTime::currentTime()) > 100 || _jd->backgroundState != _jd->lastBackgroundState ) {*/ + maybeParse( *_jd->it, false ); + ++(_jd->it); + _jd->lastBackgroundState = _jd->backgroundState; + /*}else{ + timeStep = 1; + }*/ + } + QTimer::singleShot( timeStep, this, SLOT( slotParseFiles() ) ); + } + } + } + } +} + +void CppSupportPart::maybeParse( const QString& fn, bool background ) +{ + if ( !isValidSource( fn ) ) + return ; + + QFileInfo fileInfo( fn ); + QString path = URLUtil::canonicalPath( fn ); + QDateTime t = fileInfo.lastModified(); + + if ( !fileInfo.exists() ) + return; + + QMap::Iterator it = m_timestamp.find( path ); + if ( codeModel()->hasFile( fn ) && it != m_timestamp.end() && *it == t ) + return; + + QStringList l; + l << fn; + parseFilesAndDependencies( l, background ); +} + +bool CppSupportPart::isQueued( const QString& file ) const { + //int c = m_backgroundParser->countInQueue( file ); + //if( c == 0 ) return false; + return m_parseEmitWaiting.waiting( file, ParseEmitWaiting::Silent, 2 ); //Since it may be possible that the background-parser is currently parsing the file(in an obselete state), it is allowed to have the file in the queue twice. +} + +void CppSupportPart::slotNeedTextHint( int line, int column, QString& textHint ) +{ + if ( 1 || !m_activeEditor ) + return ; + + m_backgroundParser->lock(); + TranslationUnitAST* ast = *m_backgroundParser->translationUnit( m_activeFileName ); + AST* node = 0; + if ( ast && ( node = findNodeAt( ast, line, column ) ) ) + { + + while ( node && node->nodeType() != NodeType_FunctionDefinition ) + node = node->parent(); + + if ( node ) + { + int startLine, startColumn; + int endLine, endColumn; + node->getStartPosition( &startLine, &startColumn ); + node->getEndPosition( &endLine, &endColumn ); + + if ( !node->text().isNull() ) + textHint = node->text(); + else + textHint = m_activeEditor->textLine( startLine ).simplifyWhiteSpace(); + } + } + m_backgroundParser->unlock(); +} + +void CppSupportPart::MakeMemberHelper( QString& text, int& atLine, int& atColumn ) +{ + if ( !m_activeViewCursor || !m_valid ) + return ; + + atLine = -2; + atColumn = 0; + + QString implFile = findSourceFile(); + + m_backgroundParser->lock(); + TranslationUnitAST* translationUnit = *m_backgroundParser->translationUnit( m_activeFileName ); + if ( translationUnit ) + { + bool fail = false; + unsigned int line, column; + m_activeViewCursor->cursorPositionReal( &line, &column ); + + AST* currentNode = findNodeAt( translationUnit, line, column ); + DeclaratorAST* declarator = 0; + while ( currentNode && currentNode->nodeType() != NodeType_SimpleDeclaration ) + { + if ( currentNode->nodeType() == NodeType_Declarator ) + declarator = ( DeclaratorAST* ) currentNode; + currentNode = currentNode->parent(); + } + SimpleDeclarationAST* decl = currentNode ? ( SimpleDeclarationAST* ) currentNode : 0; + + if ( decl && decl->storageSpecifier() && decl->storageSpecifier()->text().contains("friend") ) + { + kdDebug(9007) << "this is a friend declaration, don't create any definition" << endl; + fail = true; + } + + if ( !fail && decl && decl->initDeclaratorList() && !declarator ) + { + InitDeclaratorAST * i = decl->initDeclaratorList() ->initDeclaratorList().at( 0 ); + if ( i ) + declarator = i->declarator(); + } + + if ( !fail && decl && declarator && declarator->parameterDeclarationClause() ) + { + + QStringList scope; + scopeOfNode( decl, scope ); + + QString scopeStr = scope.join( "::" ); + if ( !scopeStr.isEmpty() ) + scopeStr += "::"; + + QString declStr = declaratorToString( declarator, scopeStr ).simplifyWhiteSpace(); + if ( declarator->exceptionSpecification() ) + { + declStr += QString::fromLatin1( " throw( " ); + QPtrList l = declarator->exceptionSpecification() ->nodeList(); + QPtrListIterator type_it( l ); + while ( type_it.current() ) + { + declStr += type_it.current() ->text(); + ++type_it; + + if ( type_it.current() ) + declStr += QString::fromLatin1( ", " ); + } + + declStr += QString::fromLatin1( " )" ); + } + + text += "\n\n"; + QString type = typeSpecToString( decl->typeSpec() ); + text += type; + if ( !type.isNull() ) + text += + " "; + + text += declStr + "\n{\n}"; + } + + if ( !fail ) + { + translationUnit = *m_backgroundParser->translationUnit( implFile ); + if ( translationUnit ) + translationUnit->getEndPosition( &atLine, &atColumn ); + } + + kdDebug( 9007 ) << "at line in mm: " << atLine << endl; + } + m_backgroundParser->unlock(); +} + +void CppSupportPart::slotMakeMember() +{ + QString text; + int atColumn, atLine; + MakeMemberHelper( text, atLine, atColumn ); + + if ( !text.isEmpty() ) + { + QString implFile = findSourceFile(); + + if ( !implFile.isEmpty() ) + { + partController() ->editDocument( KURL( implFile ) ); + kapp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput | QEventLoop::ExcludeSocketNotifiers, 500 ); + } + if ( atLine == -2 ) + atLine = m_activeEditor->numLines() - 1; + + m_backgroundParser->lock () + ; + + kdDebug( 9007 ) << "at line in mm: " << atLine << " atCol: " << atColumn << endl; + kdDebug( 9007 ) << "text: " << text << endl; + if ( m_activeEditor ) + m_activeEditor->insertText( atLine, atColumn, text ); + if ( m_activeViewCursor ) + m_activeViewCursor->setCursorPositionReal( atLine + 3, 1 ); + + m_backgroundParser->unlock(); + } +} + +QStringList CppSupportPart::subclassWidget( const QString& formName ) +{ + QStringList newFileNames; + SubclassingDlg *dlg = new SubclassingDlg( this, formName, newFileNames ); + dlg->exec(); + return newFileNames; +} + +QStringList CppSupportPart::updateWidget( const QString& formName, const QString& fileName ) +{ + QStringList dummy; + SubclassingDlg *dlg = new SubclassingDlg( this, formName, fileName, dummy ); + dlg->exec(); + return dummy; +} + +void CppSupportPart::partRemoved( KParts::Part* part ) +{ + kdDebug( 9032 ) << "CppSupportPart::partRemoved()" << endl; + + if ( KTextEditor::Document * doc = dynamic_cast( part ) ) + { + + QString fileName = doc->url().path(); + if ( !isValidSource( fileName ) ) + return ; + + QString canonicalFileName = URLUtil::canonicalPath( fileName ); + m_backgroundParser->removeFile( canonicalFileName ); + m_backgroundParser->addFile( canonicalFileName, true ); + } +} + +void CppSupportPart::slotProjectCompiled() +{ + kdDebug( 9007 ) << "CppSupportPart::slotProjectCompiled()" << endl; + parseProject(); +} + +QStringList CppSupportPart::modifiedFileList() +{ + QStringList lst; + + QStringList fileList = m_projectFileList; + QStringList::Iterator it = fileList.begin(); + while ( it != fileList.end() ) + { + QString fileName = *it; + ++it; + + QFileInfo fileInfo( m_projectDirectory, fileName ); + QString path = URLUtil::canonicalPath( fileInfo.absFilePath() ); + + if ( !( isSource( path ) || isHeader( path ) ) ) + continue; + + QDateTime t = fileInfo.lastModified(); + + QMap::Iterator dictIt = m_timestamp.find( path ); + if ( fileInfo.exists() && dictIt != m_timestamp.end() && *dictIt == t ) + continue; + + lst << fileName; + } + + return lst; +} + +KTextEditor::Document * CppSupportPart::findDocument( const KURL & url ) +{ + if ( !partController() ->parts() ) + return 0; + + QPtrList parts( *partController() ->parts() ); + QPtrListIterator it( parts ); + while ( KParts::Part * part = it.current() ) + { + KTextEditor::Document * doc = dynamic_cast( part ); + if ( doc && doc->url() == url ) + return doc; + ++it; + } + + return 0; +} + +void CppSupportPart::setupCatalog( ) +{ + kdDebug( 9007 ) << "CppSupportPart::setupCatalog()" << endl; + + KStandardDirs *dirs = CppSupportFactory::instance() ->dirs(); + QStringList pcsList = dirs->findAllResources( "pcs", "*.db", false, true ); + QStringList pcsIdxList = dirs->findAllResources( "pcs", "*.idx", false, true ); + + QStringList enabledPCSs; + if ( DomUtil::elementByPath( *project() ->projectDom(), "kdevcppsupport/references" ).isNull() ) + { + for ( QStringList::Iterator it = pcsList.begin(); it != pcsList.end(); ++it ) + { + kdDebug( 9007 ) << "CppSupportPart::setupCatalog()1 " << *it << endl; + enabledPCSs.push_back( QFileInfo( *it ).baseName(true) ); + } + } + else + { + enabledPCSs = DomUtil::readListEntry( *project() ->projectDom(), "kdevcppsupport/references", "pcs" ); + } + + QStringList indexList = QStringList() << "kind" << "name" << "scope" << "fileName" << "prefix"; + + if ( pcsList.size() && pcsVersion() < KDEV_DB_VERSION ) + { + QStringList l = pcsList + pcsIdxList; + int rtn = KMessageBox::questionYesNoList( 0, i18n( "Persistent class store will be disabled: you have a wrong version of pcs installed.\nRemove old pcs files?" ), l, i18n( "C++ Support" ), KStdGuiItem::del(), KStdGuiItem::cancel() ); + if ( rtn == KMessageBox::Yes ) + { + QStringList::Iterator it = l.begin(); + while ( it != l.end() ) + { + QFile::remove + ( *it ); + ++it; + } + // @todo regenerate the pcs list + pcsList.clear(); + } + else + { + return ; + } + } + + QStringList::Iterator it = pcsList.begin(); + while ( it != pcsList.end() ) + { + kdDebug( 9007 ) << "CppSupportPart::setupCatalog()2 " << *it << endl; + Catalog * catalog = new Catalog(); + catalog->open( *it ); + catalog->setEnabled( enabledPCSs.contains( QFileInfo( *it ).baseName(true) ) ); + ++it; + + for ( QStringList::Iterator idxIt = indexList.begin(); idxIt != indexList.end(); ++idxIt ) + catalog->addIndex( ( *idxIt ).utf8() ); + + m_catalogList.append( catalog ); + codeRepository() ->registerCatalog( catalog ); + } + + setPcsVersion( KDEV_DB_VERSION ); +} + +KMimeType::List CppSupportPart::mimeTypes( ) +{ + QStringList mimeList; + mimeList += m_headerMimeTypes; + mimeList += m_sourceMimeTypes; + + KMimeType::List list; + for ( QStringList::Iterator it = mimeList.begin(); it != mimeList.end(); ++it ) + { + if ( KMimeType::Ptr mime = KMimeType::mimeType( *it ) ) + list << mime; + } + + return list; +} + +int CppSupportPart::pcsVersion() +{ + KConfig * config = CppSupportFactory::instance() ->config(); + KConfigGroupSaver cgs( config, "PCS" ); + return config->readNumEntry( "Version", 0 ); +} + +void CppSupportPart::setPcsVersion( int version ) +{ + KConfig * config = CppSupportFactory::instance() ->config(); + KConfigGroupSaver cgs( config, "PCS" ); + config->writeEntry( "Version", version ); + config->sync(); +} + +QString CppSupportPart::formatTag( const Tag & inputTag ) +{ + Tag tag = inputTag; + + switch ( tag.kind() ) + { + case Tag::Kind_Namespace: + return QString::fromLatin1( "namespace " ) + tag.name(); + + case Tag::Kind_Class: + return QString::fromLatin1( "class " ) + tag.name(); + + case Tag::Kind_Function: + case Tag::Kind_FunctionDeclaration: + { + CppFunction tagInfo( tag ); + return tagInfo.name() + "( " + tagInfo.arguments().join( ", " ) + " ) : " + tagInfo.type(); + } + break; + + case Tag::Kind_Variable: + case Tag::Kind_VariableDeclaration: + { + CppVariable tagInfo( tag ); + return tagInfo.name() + " : " + tagInfo.type(); + } + break; + } + return tag.name(); +} + +void CppSupportPart::codeCompletionConfigStored( ) +{ + if ( m_projectClosing ) return; + updateParserConfiguration(); + /* + m_backgroundParser->updateParserConfiguration(); + + KDevDriver* d = dynamic_cast( m_driver ); //The foreground-parse isn't used anymore, and could be removed + if( d ) { + d->setup(); + d->makeMacrosPersistent(); + }*/ + partController() ->setActivePart( partController()->activePart() ); +} + +void CppSupportPart::splitHeaderSourceConfigStored( ) +{ + QString o = splitHeaderSourceConfig()->orientation(); + if ( o == "Vertical" ) + emit splitOrientationChanged( Qt::Vertical ); + else if ( o == "Horizontal" ) + emit splitOrientationChanged( Qt::Horizontal ); +} + +void CppSupportPart::removeWithReferences( const QString & fileName ) +{ +kdDebug( 9007 ) << "remove with references: " << fileName << endl; + m_timestamp.remove( fileName ); + if ( !codeModel() ->hasFile( fileName ) ) + return ; + + emit aboutToRemoveSourceInfo( fileName ); + + codeModel() ->removeFile( codeModel() ->fileByName( fileName ) ); +} + +bool CppSupportPart::isValidSource( const QString& fileName ) const +{ + QFileInfo fileInfo( fileName ); + QString path = URLUtil::canonicalPath( fileInfo.absFilePath() ); + + return /*project() && project() ->isProjectFile( path ) + &&*/ ( isSource( path ) || isHeader( path ) ) + && !QFile::exists( fileInfo.dirPath( true ) + "/.kdev_ignore" ); +} + +QString CppSupportPart::formatModelItem( const CodeModelItem *item, bool shortDescription ) +{ + if ( item->isFunction() || item->isFunctionDefinition() ) + { + const FunctionModel * model = static_cast( item ); + QString function; + QString args; + ArgumentList argumentList = model->argumentList(); + for ( ArgumentList::const_iterator it = argumentList.begin(); it != argumentList.end(); ++it ) + { + args.isEmpty() ? args += "" : args += ", " ; + args += formatModelItem( ( *it ).data() ); + } + if ( !shortDescription ) + function += ( model->isVirtual() ? QString( "virtual " ) : QString( "" ) ) + model->resultType() + " "; + + function += model->name() + "(" + args + ")" + ( model->isConstant() ? QString( " const" ) : QString( "" ) ) + + ( model->isAbstract() ? QString( " = 0" ) : QString( "" ) ); + + return function; + } + else if ( item->isVariable() ) + { + const VariableModel * model = static_cast( item ); + if ( shortDescription ) + return model->name(); + return model->type() + " " + model->name(); + } + else if ( item->isArgument() ) + { + const ArgumentModel * model = static_cast( item ); + QString arg; + if ( !shortDescription ) + arg += model->type() + " "; + arg += model->name(); + if ( !shortDescription ) + arg += model->defaultValue().isEmpty() ? QString( "" ) : QString( " = " ) + model->defaultValue(); + return arg.stripWhiteSpace(); + } + else + return KDevLanguageSupport::formatModelItem( item, shortDescription ); +} + +void CppSupportPart::addClass() +{ + slotNewClass(); +} + +void CppSupportPart::saveProjectSourceInfo() +{ + const FileList fileList = codeModel() ->fileList(); + + if ( !project() || fileList.isEmpty() ) + return ; + + QFile f( project() ->projectDirectory() + "/" + + project() ->projectName() + ".kdevelop.pcs" ); + if ( !f.open( IO_WriteOnly ) ) + return ; + + m_backgroundParser->lock(); + + createIgnorePCSFile(); + + QDataStream stream( &f ); + QMap offsets; + + QString pcs( "PCS" ); + stream << pcs << KDEV_PCS_VERSION; + + stream << int( fileList.size() ); + for ( FileList::ConstIterator it = fileList.begin(); it != fileList.end(); ++it ) + { + const FileDom dom = ( *it ); + stream << dom->name() << m_timestamp[ dom->name() ].toTime_t(); + if( m_timestamp.find( dom->name() ) == m_timestamp.end() ) { + kdDebug( 9007 ) << dom->name() << ": timestamp is missing " << endl; + } + offsets.insert( dom->name(), stream.device() ->at() ); + stream << ( uint ) 0; // dummy offset + } + + for ( FileList::ConstIterator it = fileList.begin(); it != fileList.end(); ++it ) + { + const FileDom dom = ( *it ); + int offset = stream.device() ->at(); + + dom->write( stream ); + + int end = stream.device() ->at(); + + stream.device() ->at( offsets[ dom->name() ] ); + stream << offset; + stream.device() ->at( end ); + } + + QFile::remove( project() ->projectDirectory() + "/" + + project() ->projectName() + ".kdevelop.ignore_pcs" ); + QFile::remove( project() ->projectDirectory() + "/" + + project() ->projectName().lower() + ".kdevelop.ignore_pcs" ); + + m_backgroundParser->unlock(); +} + +QString CppSupportPart::extractInterface( const ClassDom& klass ) +{ + QString txt; + QTextStream stream( &txt, IO_WriteOnly ); + + QString name = klass->name() + "Interface"; + QString ind; + ind.fill( QChar( ' ' ), 4 ); + + stream + << "class " << name << "\n" + << "{" << "\n" + << "public:" << "\n" + << ind << name << "() {}" << "\n" + << ind << "virtual ~" << name << "() {}" << "\n" + << "\n"; + + const FunctionList functionList = klass->functionList(); + for ( FunctionList::ConstIterator it = functionList.begin(); it != functionList.end(); ++it ) + { + const FunctionDom& fun = *it; + + if ( !fun->isVirtual() || fun->name().startsWith( "~" ) ) + continue; + + stream << ind << formatModelItem( fun ); + if ( !fun->isAbstract() ) + stream << " = 0"; + + stream << ";\n"; + } + + stream + << "\n" + << "private:" << "\n" + << ind << name << "( const " << name << "& source );" << "\n" + << ind << "void operator = ( const " << name << "& source );" << "\n" + << "};" << "\n\n"; + + return txt; +} + +void CppSupportPart::slotExtractInterface( ) +{ + if ( !m_activeClass ) + return ; + + QFileInfo fileInfo( m_activeClass->fileName() ); + QString ifaceFileName = fileInfo.dirPath( true ) + "/" + m_activeClass->name().lower() + "_interface.h"; + if ( QFile::exists( ifaceFileName ) ) + { + KMessageBox::error( mainWindow() ->main(), i18n( "File %1 already exists" ).arg( ifaceFileName ), + i18n( "C++ Support" ) ); + } + else + { + QString text = extractInterface( m_activeClass ); + + QFile f( ifaceFileName ); + if ( f.open( IO_WriteOnly ) ) + { + QTextStream stream( &f ); + stream + << "#ifndef __" << m_activeClass->name().upper() << "_INTERFACE_H" << "\n" + << "#define __" << m_activeClass->name().upper() << "_INTERFACE_H" << "\n" + << "\n" + << extractInterface( m_activeClass ) + << "\n" + << "#endif // __" << m_activeClass->name().upper() << "_INTERFACE_H" << "\n"; + f.close(); + + project() ->addFile( ifaceFileName ); + } + } + + m_activeClass = 0; +} + +void CppSupportPart::gotoLine( int line ) +{ + if ( isHeader( m_activeFileName ) ) + { + KURL url; + url.setPath( sourceOrHeaderCandidate() ); + partController() ->editDocument( url, line ); + } + else + m_activeViewCursor->setCursorPositionReal( line, 0 ); +} + +FileDom CppSupportPart::fileByName( const QString& name) { + return codeModel()->fileByName( name ); +} + + +int CppSupportPart::parseFilesAndDependencies( QStringList files, bool background, bool parseFirst, bool silent ) { + QMap fileGroups; + int nextGroup = 0; + + for( QStringList::iterator it = files.begin(); it != files.end(); ++it ) { + FileDom d = fileByName( *it ); + + QStringList lst; + if( !d ) { + lst << *it; + }else{ + lst = codeModel()->getGroupStrings( d->groupId() ); +/* kdDebug( 9007 ) << "adding group of: " << *it << ":\n" << " which is " << lst.join("\n") << "\n\n";*/ + if( lst.count() > 10 ) { + lst = codeModel()->getGroupStrings( d->groupId() ); + } + } + int cgroup = nextGroup; + nextGroup++; + + if( fileGroups.find( *it ) != fileGroups.end() ) + cgroup = fileGroups[*it]; + + for( QStringList::iterator lit = lst.begin(); lit != lst.end(); ++lit ) + fileGroups[*lit] = cgroup; + } + + QValueVector groups; + groups.resize( nextGroup ); + + ///put the groups together + for( QMap::iterator it = fileGroups.begin(); it != fileGroups.end(); ++it ) { + groups[*it] << it.key(); + } + + for( int a = 0; a < nextGroup; a++ ) { + QStringList group = reorder( groups[a] ); + + +/* kdDebug( 9007 ) << "reparsing the following group: " << ":\n" << group.join("\n") << "\n\n";*/ + if( background ) { + + m_backgroundParser->lock(); + + if( !group.isEmpty() ) { + if( !parseFirst ) + m_parseEmitWaiting.addGroup( group, silent ? ParseEmitWaiting::Silent : ParseEmitWaiting::None ); + else + m_parseEmitWaiting.addGroupFront( group, silent ? ParseEmitWaiting::Silent : ParseEmitWaiting::None ); + if( !silent ) { + if( !parseFirst ) + m_fileParsedEmitWaiting.addGroup( group, silent ? ParseEmitWaiting::Silent : ParseEmitWaiting::None ); + else + m_fileParsedEmitWaiting.addGroupFront( group, silent ? ParseEmitWaiting::Silent : ParseEmitWaiting::None ); + } + } + + if( parseFirst && !group.empty() ) { + for(QStringList::iterator it = --group.end(); it != group.end(); ) { + backgroundParser()->addFileFront(*it); + if( it == group.begin() ) { + it = group.end(); + } else { + --it; + } + } + } else { + for(QStringList::iterator it = group.begin(); it != group.end(); ++it) { + backgroundParser()->addFile(*it); + } + } + + m_backgroundParser->unlock(); + + } else { + for(QStringList::iterator it = group.begin(); it != group.end(); ++it) { + m_driver->parseFile( *it ); + } + } + } + + return fileGroups.count(); +} + +int CppSupportPart::parseFileAndDependencies( const QString & fileName, bool background, bool parseFirst, bool silent ) { + if(! isValidSource( fileName ) ) return 0; + +// kdDebug( 9007 ) << "reparsing dependencies of " << fileName << "\n"; + + return parseFilesAndDependencies( fileName, background, parseFirst, silent ); +} + +void CppSupportPart::parseEmit( ParseEmitWaiting::Processed files ) { + if( files.res.isEmpty() ) return; + + bool modelHasFiles = true; + + for( QStringList::iterator it = files.res.begin(); it != files.res.end(); ++it ) { + if( !codeModel()->hasFile( *it ) ) modelHasFiles = false; + } + + int oldFileCount = codeModel()->fileList().count(); + + if( (files.flag & ParseEmitWaiting::HadErrors) && modelHasFiles && !files.hasFlag( ParseEmitWaiting::Silent ) ) { + mainWindow() ->statusBar() ->message( "File parsed, but not updating code-model because of errors", 2000 ); + kdDebug( 9007 ) << "not updating code-model because at least one file has errors" << endl; + // for( QStringList::iterator it = files.res.begin(); it != files.res.end(); ++it ) + // m_backgroundParser->removeFile( *it ); + } else { + ///update timestamps + for( QStringList::iterator it = files.res.begin(); it != files.res.end(); ++it ) { + if( !codeModel()->hasFile( *it ) ) modelHasFiles = false; + QString& fileName = *it; + + QFileInfo fileInfo( fileName ); + QString path = URLUtil::canonicalPath( fileName ); + + if ( !fileInfo.exists() ) { + removeWithReferences( path ); + continue ; + } + + m_timestamp[ path ] = fileInfo.lastModified(); + } + + if( files.hasFlag( ParseEmitWaiting::Silent ) && !alwaysParseInBackground ) + return; + + m_backgroundParser->lock(); + + QStringList l = files.res; + + QMap wholeResult; + QStringList missing; + + QMap newFiles; + + while(!l.isEmpty() ) { + QString fileName = l.front(); + + if( !m_backgroundParser->hasTranslationUnit( fileName ) ) { + kdDebug( 9007 ) << "error: translation-unit is missing: " << fileName << endl; + missing << fileName; + } else { + if ( ParsedFilePointer ast = m_backgroundParser->translationUnit( fileName ) ) + { + if ( true /*!hasErrors*/ ) + { + FileDom oldFile = codeModel()->fileByName( fileName ); + + StoreWalker walker( fileName, codeModel() ); + walker.setOverrides( newFiles ); + + walker.parseTranslationUnit( *ast ); + + if( oldFile ) { + newFiles[fileName] = walker.file(); + + ///update timestamps + QFileInfo fileInfo( fileName ); + QString path = URLUtil::canonicalPath( fileName ); + + m_timestamp[ path ] = fileInfo.lastModified(); + } else { + codeModel() ->addFile( walker.file() ); + } + + if( walker.file() ) { + QStringList grp = walker.file()->wholeGroupStrings(); + for( QStringList::const_iterator it = grp.begin(); it != grp.end(); ++it ) + wholeResult[*it] = true; + } + } + } else { + kdDebug( 9007 ) << "failed to parse " << fileName << endl; + } + } + + + l.pop_front(); + } + + bool canUpdate = true; + for( QMap::const_iterator it = newFiles.begin(); it != newFiles.end(); ++it ) { + FileDom oldFile = codeModel()->fileByName( it.key() ); + + if( !oldFile || !oldFile->canUpdate( *it ) ) { + canUpdate = false; + break; + } + } + + if( canUpdate ) { + ///Update the code-model + for( QMap::const_iterator it = newFiles.begin(); it != newFiles.end(); ++it ) { + FileDom oldFile = codeModel()->fileByName( it.key() ); + oldFile->update( *it ); + codeModel()->mergeGroups( oldFile->groupId(), (*it)->groupId() ); ///Merge parsing-groups together + } + } else { + ///Remove the current files and replace them with the new ones + for( QMap::const_iterator it = newFiles.begin(); it != newFiles.end(); ++it ) { + removeWithReferences( it.key() ); + codeModel()->addFile( *it ); + } + } + /* + ///make the list unique + + l.clear(); + for( QMap::const_iterator it = wholeResult.begin(); it != wholeResult.end(); ++it ) + l << it.key();*/ + + m_backgroundParser->unlock(); + + if( !missing.isEmpty() ) { + kdDebug( 9007 ) << "error: translation-units were missing: " << missing << endl; + //don't reparse missing units, because it may cause the whole project to be reparsed + // parseFilesAndDependencies( missing, true, false, files.hasFlag( ParseEmitWaiting::Silent ) ); + } + + if( files.hasFlag( ParseEmitWaiting::Silent ) ) { + if( alwaysParseInBackground ) + for( QStringList::iterator it = files.res.begin(); it != files.res.end(); ++it ) + m_backgroundParser->removeFile( *it ); + } else { + if( !canUpdate ) { ///If the current model could be updated, do not emit addedSourceInfo(..) and remove the units from the parser, because nobody will be using them + QStringList l = files.res; + while(!l.isEmpty() ) { + emit aboutToRemoveSourceInfo( l.front() ); + emit removedSourceInfo( l.front() ); + emit addedSourceInfo( l.front() ); + l.pop_front(); + } + + if( !files.hasFlag( ParseEmitWaiting::Silent ) ) + emitFileParsed( files ); + } else { + QStringList l = files.res; + while( !l.isEmpty() ) { + emit codeModelUpdated( l.front() ); + emit aboutToRemoveSourceInfo( l.front() ); + emit removedSourceInfo( l.front() ); + emit addedSourceInfo( l.front() ); + l.pop_front(); + } + } + } + kdDebug( 9007 ) << "files in code-model after parseEmit: " << codeModel()->fileList().count() << " before: " << oldFileCount << endl; + } +} + +/*void CppSupportPart::recomputeCodeModel( const QString& fileName ) +{*/ + +//} + +void CppSupportPart::emitSynchronousParseReady( const QString& file, ParsedFilePointer unit ) { + emit synchronousParseReady( file, unit ); +} + +void CppSupportPart::emitFileParsed( QStringList l ) +{ + while( !l.isEmpty() ) { + emit fileParsed( l.front() ); + l.pop_front(); + } +} + +bool CppSupportPart::isHeader( const QString& fileName ) const +{ + /*KMimeType::Ptr ptr = KMimeType::findByPath( fileName ); + if ( ptr && m_headerMimeTypes.contains( ptr->name() ) ) + return true;*/ + + return ( m_headerExtensions.findIndex( QFileInfo( fileName ).extension() ) != -1 ); +} + +bool CppSupportPart::isSource( const QString& fileName ) const +{ + /*KMimeType::Ptr ptr = KMimeType::findByPath( fileName ); + if ( ptr && m_sourceMimeTypes.contains( ptr->name() ) ) + return true;*/ + + return ( m_sourceExtensions.findIndex( QFileInfo( fileName ).extension() ) != -1 ); +} + +void CppSupportPart::gotoDeclarationLine( int line ) +{ + if ( isHeader( m_activeFileName ) ) + m_activeViewCursor->setCursorPositionReal( line, 0 ); + else + { + KURL url; + url.setPath( sourceOrHeaderCandidate() ); + partController() ->editDocument( url, line ); + } +} + +void CppSupportPart::removeCatalog( const QString & dbName ) +{ + if ( !QFile::exists( dbName ) ) + return ; + + QValueList catalogs = codeRepository() ->registeredCatalogs(); + Catalog* c = 0; + for ( QValueList::Iterator it = catalogs.begin(); it != catalogs.end(); ++it ) + { + if ( ( *it ) ->dbName() == dbName ) + { + c = *it; + break; + } + } + + if ( c ) + { + codeRepository() ->unregisterCatalog( c ); + m_catalogList.remove( c ); + } + + QFileInfo fileInfo( dbName ); + QDir dir( fileInfo.dir( true ) ); + QStringList indexList = QStringList() << "kind" << "name" << "scope" << "fileName" << "prefix"; + for(QStringList::Iterator iter = indexList.begin(); iter != indexList.end(); iter++) + { + QStringList fileList = dir.entryList( fileInfo.baseName(true) +"." +(*iter) + ".idx" ); + for ( QStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it ) + { + QString idxName = fileInfo.dirPath( true ) + "/" + *it; + kdDebug( 9007 ) << "=========> remove db index: " << idxName << endl; + dir.remove( *it ); + } + } + dir.remove( fileInfo.fileName() ); +} + +void CppSupportPart::addCatalog( Catalog * catalog ) +{ + m_catalogList.append( catalog ); + codeRepository() ->registerCatalog( catalog ); +} + +FunctionDefinitionDom CppSupportPart::functionDefinitionAt( int line, int column ) +{ + if ( !codeModel() ->hasFile( m_activeFileName ) ) + return FunctionDefinitionDom(); + + CodeModelUtils::CodeModelHelper h( codeModel(), codeModel()->fileByName( m_activeFileName ) ); + + FunctionDom d = h.functionAt( line, column, CodeModelUtils::CodeModelHelper::Definition ); + if( d ) { + FunctionDefinitionModel* m = dynamic_cast( d.data() ); + if( m ) return FunctionDefinitionDom( m ); + } + return FunctionDefinitionDom(); +} + +FunctionDefinitionDom CppSupportPart::currentFunctionDefinition( ) +{ + if ( !this->m_activeViewCursor ) + return FunctionDefinitionDom(); + + unsigned int line, column; + this->m_activeViewCursor->cursorPositionReal( &line, &column ); + return functionDefinitionAt( line, column ); +} + +void CppSupportPart::slotCursorPositionChanged() +{ + if ( codeCompletion() ) + { + unsigned int line = 0; + unsigned int column = 0; + if ( KDevEditorUtil::currentPositionReal( &line, &column, dynamic_cast( partController()->activePart() ) ) ) + { + QString typeInfoString = codeCompletion()->createTypeInfoString( line, column ); + mainWindow()->statusBar()->message( typeInfoString ); + } + } + + // m_functionHintTimer->changeInterval( 1000 ); + if ( splitHeaderSourceConfig()->splitEnabled() + && splitHeaderSourceConfig()->autoSync() ) + slotSwitchHeader( true ); +} + +/* +void CppSupportPart::slotFunctionHint( ) +{ + kdDebug( 9007 ) << "=======> compute current function definition" << endl; +// m_functionHintTimer->stop(); + if ( FunctionDefinitionDom fun = currentFunctionDefinition() ) + { + QStringList scope = fun->scope(); + QString funName = scope.join( "::" ); + if ( !funName.isEmpty() ) + funName += "::"; + + funName += formatModelItem( fun, true ); + + mainWindow() ->statusBar() ->message( funName, 2000 ); + } +} +*/ + +void CppSupportPart::createIgnorePCSFile( ) +{ + static QCString skip_me( "ignore me\n" ); + + QString skip_file_name = project() ->projectDirectory() + "/" + + project() ->projectName() + ".kdevelop.ignore_pcs"; + QFile skip_pcs_file( skip_file_name ); + if ( skip_pcs_file.open( IO_WriteOnly ) ) + { + skip_pcs_file.writeBlock( skip_me ); + skip_pcs_file.close(); + } +} + +QString CppSupportPart::specialHeaderName( bool local ) const +{ + if ( local ) + return ::locateLocal( "data", "kdevcppsupport/configuration", CppSupportFactory::instance() ); + + return ::locate( "data", "kdevcppsupport/configuration", CppSupportFactory::instance() ); +} + +void CppSupportPart::updateParserConfiguration() +{ + m_backgroundParser->updateParserConfiguration(); + + QString conf_file_name = specialHeaderName(); + + m_driver->removeAllMacrosInFile( conf_file_name ); + dynamic_cast(m_driver)->setup(); + m_driver->parseFile( conf_file_name, true, true, true ); + + m_buildSafeFileSetTimer->start( 500, true ); + parseProject( true ); +} + +const Driver* CppSupportPart::driver() const { + return m_driver; +} + +Driver* CppSupportPart::driver() { + return m_driver; +} + +KDevDesignerIntegration * CppSupportPart::designer( KInterfaceDesigner::DesignerType type ) +{ + KDevDesignerIntegration * des = 0; + switch ( type ) + { + case KInterfaceDesigner::Glade: + case KInterfaceDesigner::QtDesigner: + des = m_designers[ type ]; + if ( des == 0 ) + { + CppImplementationWidget * impl = new CppImplementationWidget( this ); + des = new QtDesignerCppIntegration( this, impl ); + des->loadSettings( *project() ->projectDom(), "kdevcppsupport/designerintegration" ); + m_designers[ type ] = des; + } + break; + } + return des; +} + + +void CppSupportPart::resetParserStoreTimer() { + // m_deleteParserStoreTimer->start(10000); ///try to empty the store regularly +} + +void CppSupportPart::slotDeleteParserStore() { + /* if( !m_backgroundParser->filesInQueue() ) + m_backgroundParser->removeAllFiles(); + else + resetParserStoreTimer();*/ +} + + +void CppSupportPart::slotCreateSubclass() +{ + QFileInfo fi( m_contextFileName ); + if ( fi.extension( false ) != "ui" ) + return ; + QtDesignerCppIntegration *des = dynamic_cast( designer( KInterfaceDesigner::QtDesigner ) ); + if ( des ) + des->selectImplementation( m_contextFileName ); +} + +void CppSupportPart::addMethod( ClassDom aClass, const QString& name, const QString type, + const QString& parameters, CodeModelItem::Access accessType, + bool isConst, bool isInline, bool isVirtual, bool isPureVirtual, + const QString& implementation ) +{ + partController() ->editDocument( KURL( aClass->fileName() ) ); + KTextEditor::EditInterface* editIface = dynamic_cast( partController() ->activePart() ); + if ( !editIface ) + { + /// @fixme show messagebox + return ; + } + QString declarationString = type + " " + name + "(" + parameters + ")" + ( isConst ? " const" : "" ); + + KDevSourceFormatter* sourceFormatter = extension( "KDevelop/SourceFormatter" ); + + QString finalDeclaration = ( ( isVirtual || isPureVirtual ) ? "\nvirtual " : "\n" + declarationString + + ( isPureVirtual ? " = 0 " : "" ) + + ( isInline ? "\n{\n" + implementation + "\n}\n" : ";" ) ); + + if ( sourceFormatter != 0 ) + finalDeclaration = sourceFormatter->formatSource( finalDeclaration ); + + QString indentString = "\t"; + + if ( sourceFormatter != 0 ) + indentString = sourceFormatter->indentString(); + + editIface->insertText( findInsertionLineMethod( aClass, accessType ), 0, + finalDeclaration.replace( "\n", "\n\t" ) + "\n" ); + + backgroundParser() ->addFile( aClass->fileName() ); + if ( isInline || isPureVirtual ) + return ; + + // construct fully qualified name for method definition + QString fullyQualifiedName = aClass->scope().join("::"); + if (! fullyQualifiedName.isEmpty()) + { + fullyQualifiedName += "::"; + } + fullyQualifiedName += aClass->name() + "::" + name; + + QString definitionString = "\n" + type + " " + fullyQualifiedName + "(" + parameters + ")" + ( isConst ? " const" : "" ) + "\n{\n" + implementation + "\n}\n"; + + if ( sourceFormatter != 0 ) + definitionString = sourceFormatter->formatSource( definitionString ); + + QFileInfo info( aClass->fileName() ); + QString implementationFile = info.dirPath( true ) + "/" + info.baseName() + ".cpp" ; + QFileInfo fileInfo( implementationFile ); + KDevCreateFile* createFileSupport = extension( "KDevelop/CreateFile" ); + if ( !QFile::exists( fileInfo.absFilePath() ) && createFileSupport != 0 ) + createFileSupport->createNewFile( fileInfo.extension(), fileInfo.dirPath( true ), fileInfo.baseName() ); + + partController() ->editDocument( KURL( implementationFile ) ); + editIface = dynamic_cast( partController() ->activePart() ); + if ( !editIface ) + return ; //@fixme errorverdoedelung + + editIface->insertLine( editIface->numLines(), QString::fromLatin1( "" ) ); + editIface->insertText( editIface->numLines() - 1, 0, definitionString ); + backgroundParser() ->addFile( implementationFile ); +} + +ClassDom CppSupportPart::currentClass( ) const +{ + FileDom file = codeModel() ->fileByName( m_activeFileName ); + if ( file == 0 || m_activeViewCursor == 0 ) + return 0; + + unsigned int curLine, curCol; + m_activeViewCursor->cursorPositionReal( &curLine, &curCol ); + + CodeModelUtils::CodeModelHelper h( codeModel(), file ); + + return h.classAt( curLine, curCol ); +} + +VariableDom CppSupportPart::currentAttribute( ClassDom curClass ) const +{ + if ( m_activeViewCursor == 0 || curClass == 0 ) + return 0; + + unsigned int line, col; + m_activeViewCursor->cursorPositionReal( &line, &col ); + + VariableList vars = curClass->variableList(); + + for ( VariableList::iterator i = vars.begin(); i != vars.end(); ++i ) + { + int startLine, startCol; + ( *i ) ->getStartPosition( &startLine, &startCol ); + if ( startLine < (int)line || ( startLine == (int)line && startCol <= (int)col ) ) + { + int endLine, endCol; + ( *i ) ->getEndPosition( &endLine, &endCol ); + if ( endLine > (int)line || ( endLine == (int)line && endCol >= (int)col ) ) + return * i; + } + } + return 0; +} + +void CppSupportPart::slotCreateAccessMethods( ) +{ + if ( m_curAttribute == 0 || m_curClass == 0 ) + return ; + + CreateGetterSetterDialog dlg ( this, m_curClass, m_curAttribute ); + dlg.exec(); +} + +int CppSupportPart::findInsertionLineMethod( ClassDom aClass, CodeModelItem::Access access ) +{ + int line, column; + aClass->getEndPosition( &line, &column ); + + int point = CodeModelUtils::findLastMethodLine( aClass, access ); + + if ( point == -1 ) + { + KTextEditor::EditInterface * editIface = dynamic_cast( partController() ->activePart() ); + if ( !editIface ) + return -1; + + editIface->insertLine( line - 1, CodeModelUtils::accessSpecifierToString( access ) + ":\n" ); + return line; + } + + return point + 1; +} + +int CppSupportPart::findInsertionLineVariable( ClassDom aClass, CodeModelItem::Access access ) +{ + int line, column; + aClass->getEndPosition( &line, &column ); + + int point = CodeModelUtils::findLastVariableLine( aClass, access ); + + if ( point == -1 ) + { + KTextEditor::EditInterface * editIface = dynamic_cast( partController() ->activePart() ); + if ( !editIface ) + return -1; + + editIface->insertLine( line - 1, CodeModelUtils::accessSpecifierToString( access ) + ":\n" ); + return line; + } + + return point; +} + +void CppSupportPart::createAccessMethods( ClassDom theClass, VariableDom theVariable ) +{ + m_curClass = theClass; + m_curAttribute = theVariable; + + slotCreateAccessMethods(); +} + +void CppSupportPart::slotCursorMoved() +{ + m_cursorMovedTimer->start( 250, true ); +} + +void CppSupportPart::slotTextChanged() +{ + setTyping( true ); ///@todo check if this is really needed + + if ( m_backgroundParserConfig->useBackgroundParser() ) + { + m_textChangedTimer->start( m_backgroundParserConfig->backgroudParseDelay(), true ); + } +} + +void CppSupportPart::slotParseCurrentFile() +{ + if( isValid() && !isQueued( m_activeFileName ) ) + { + parseFileAndDependencies( m_activeFileName, true, true ); + } +} + +void CppSupportPart::updateBackgroundParserConfig() +{ + BackgroundParserConfig config; + config.readConfig(); + + if ( m_backgroundParserConfig->useProblemReporter() && !config.useProblemReporter() ) + { + removeProblemReporter(); + } + else if ( !m_backgroundParserConfig->useProblemReporter() && config.useProblemReporter() ) + { + embedProblemReporter( true ); + } + + *m_backgroundParserConfig = config; +} + +const SynchronizedFileSet& CppSupportPart::safeFileSet() const { + return m_safeProjectFiles; +} + +SynchronizedFileSet& CppSupportPart::safeFileSet() { + return m_safeProjectFiles; +} + +void CppSupportPart::buildSafeFileSet() { + if( codeCompletion() == 0 ) //probably the project has already been closed + return; + SynchronizedFileSet::SetType files; //everything that goes into this set must be deep-copied + + kdDebug( 9007 ) << "CppSupportPart:: rebuilding safe-file-set" << endl; + for( QStringList::const_iterator it = m_projectFileList.begin(); it != m_projectFileList.end(); ++it ) { + QFileInfo fi( *it ); + QString file = *it; + if( fi.isRelative() ) { + fi.setFile( QDir(m_projectDirectory), *it ); + file = fi.absFilePath(); + } + + //deep-copy + files.insert( QString::fromUtf8(file.utf8()) ); + } + + ///Now get all translation-units from the code-repository + QValueList args; + + args << Catalog::QueryArgument( "kind", Tag::Kind_TranslationUnit ); + + QValueList tags( codeCompletion()->repository()->query( args ) ); + + for( QValueList::const_iterator it = tags.begin(); it != tags.end(); ++it ) { + files.insert( (*it).fileName() + "||" + (*it).attribute("macroValueHash").toString() + "||" + (*it).attribute("macroIdHash").toString() ); + } + m_safeProjectFiles.setFiles( files ); +} + +void CppSupportPart::addToRepository( ParsedFilePointer file ) { + QString catalogString( "automatic_" + KURL::encode_string_no_slash(m_projectDirectory) ); + + KStandardDirs *dirs = CppSupportFactory::instance() ->dirs(); + + QString dbName = dirs->saveLocation( "data", "kdevcppsupport/pcs" ) + catalogString + ".db"; + + Catalog* catalog = 0; + ///First check if the catalog is already there + QValueList catalogs = codeRepository()->registeredCatalogs(); + for( QValueList::const_iterator it = catalogs.begin(); it != catalogs.end(); ++it ) { + if( (*it)->dbName() == dbName ) { + catalog = *it; + break; + } + } + + if( !catalog ) { + kdDebug( 9007 ) << "creating new catalog named " << catalogString << " for automatic filling" << endl; + //QStringList indexList = QStringList() << "kind" << "name" << "scope" << "fileName" << "prefix"; + catalog = new Catalog; + catalog->open( dbName ); + catalog->addIndex( "kind" ); + catalog->addIndex( "name" ); + catalog->addIndex( "scope" ); + catalog->addIndex( "prefix" ); + catalog->addIndex( "fileName" ); + /* + for ( QStringList::Iterator idxIt = indexList.begin(); idxIt != indexList.end(); ++idxIt ) + catalog->addIndex( ( *idxIt ).utf8() );*/ + addCatalog( catalog ); + } + catalog->setEnabled( true ); + + ///Now check if the file was already parsed with the same parameters, if yes don't parse again(auto-update is currently not supported, when major changes have been done in the libraries, the repository should be deleted) + QValueList args; + + bool compatibleParsed = false; + Tag compatibleParsedTag; + + args << Catalog::QueryArgument( "kind", Tag::Kind_TranslationUnit ); + args << Catalog::QueryArgument( "fileName", file->fileName() ); + QValueList tags( catalog->query( args ) ); + if( !tags.isEmpty() ) { + for( QValueList::const_iterator it = tags.begin(); it != tags.end(); ++it ) { + if( (*it).hasAttribute( "cppparsedfile" ) ) { + QVariant v = (*it).attribute( "cppparsedfile" ); + ///@todo reenable this + /*QByteArray b = v.toByteArray(); + if( !b.isEmpty() ) { + //Would be much more efficient not to do this deserialization + ParsedFile f(b); + if( f.usedMacros().valueHash() == file->usedMacros().valueHash() && f.usedMacros().idHash() == file->usedMacros().idHash() && f.includeFiles().hash() == file->includeFiles().hash() ) { + ///Do not reparse the file, it seems to already be in the repository in a similar state + if( (*it).attribute( "includedFrom" ).toString() == file->includedFrom() ) return; + + ///It is probable that the same state has already been parsed, but there seems to be no such tag yet(the tag will be added) + compatibleParsed = true; + compatibleParsedTag = *it; + break; + } + }*/ + } + } + } + + if( compatibleParsed ) { + ///Add a Tag that makes sure that the file will not be parsed again + compatibleParsedTag.setAttribute( "includedFrom", file->includedFrom() ); + QByteArray data; + QDataStream s( data, IO_WriteOnly ); + file->write( s ); + compatibleParsedTag.setAttribute( "cppparsedfile", data ); + catalog->addItem( compatibleParsedTag ); + return; + } + + kdDebug( 9007 ) << "parsing translation-unit " << file->fileName() << " into catalog " << catalogString << endl; + TagCreator w( file->fileName(), catalog ); + w.parseTranslationUnit( *file ); + codeRepository()->touchCatalog( catalog ); + + m_safeProjectFiles.insert( file->fileName() + "||" + QString("%1").arg(file->usedMacros().valueHash()) + "||" + QString("%1").arg(file->usedMacros().idHash()) ); +} + +QString CppSupportPart::findHeaderSimple( const QString &header ) +{ + QStringList::ConstIterator it; + for ( it = m_projectFileList.begin(); it != m_projectFileList.end(); ++it ) + { + QString s = *it; + if (s == header) + return s; + if ( ( s.right( header.length() ) == header ) && ( s[s.length() - header.length() - 1] == '/' ) ) + return s; + } + + return QString::null; +} + +UIBlockTester::UIBlockTesterThread::UIBlockTesterThread( UIBlockTester& parent ) : QThread(), m_parent( parent ), m_stop(false) { +} + +void UIBlockTester::UIBlockTesterThread::run() { + while(!m_stop) { + msleep( m_parent.m_msecs / 10 ); + m_parent.m_timeMutex.lock(); + QDateTime t = QDateTime::currentDateTime(); + uint msecs = m_parent.m_lastTime.time().msecsTo( t.time() ); + if( msecs > m_parent.m_msecs ) { + m_parent.lockup(); + m_parent.m_lastTime = t; + } + m_parent.m_timeMutex.unlock(); + } +} + +void UIBlockTester::UIBlockTesterThread::stop() { + m_stop = true; +} + +UIBlockTester::UIBlockTester( uint milliseconds ) : m_thread( *this ), m_msecs( milliseconds ) { + m_timer = new QTimer( this ); + m_timer->start( milliseconds/10 ); + connect( m_timer, SIGNAL(timeout()), this, SLOT(timer()) ); + timer(); + m_thread.start(); +} +UIBlockTester::~UIBlockTester() { + m_thread.stop(); + m_thread.wait(); +} + +void UIBlockTester::timer() { + m_timeMutex.lock(); + m_lastTime = QDateTime::currentDateTime(); + m_timeMutex.unlock(); +} + +void UIBlockTester::lockup() { + //std::cout << "UIBlockTester: lockup of the UI for " << m_msecs << endl; ///kdDebug(..) is not thread-safe.. + int a = 1; ///Place breakpoint here +} + +#include "cppsupportpart.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; + + diff --git a/languages/cpp/cppsupportpart.h b/languages/cpp/cppsupportpart.h new file mode 100644 index 00000000..e01d5115 --- /dev/null +++ b/languages/cpp/cppsupportpart.h @@ -0,0 +1,661 @@ +/*************************************************************************** +* Copyright (C) 1999 by Jonas Nordin * +* jonas.nordin@syncom.se * +* Copyright (C) 2000-2001 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2002-2003 by Roberto Raggi * +* roberto@kdevelop.org * +* Copyright (C) 2003-2004 by Alexander Dymo * +* adymo@mksat.net * +* * +* 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; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _CPPSUPPORTPART_H_ +#define _CPPSUPPORTPART_H_ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "driver.h" + + +///A class that helps detecting what exactly makes the UI block. To use it, just place a breakpoint on UIBlockTester::lockup() and inspect the execution-position of the main thread +class UIBlockTester : public QObject { + Q_OBJECT + class UIBlockTesterThread : public QThread { + public: + UIBlockTesterThread( UIBlockTester& parent ); + void run(); + void stop(); + private: + UIBlockTester& m_parent; + bool m_stop; + }; + friend class UIBlockTesterThread; +public: + + ///@param milliseconds when the ui locks for .. milliseconds, lockup() is called + UIBlockTester( uint milliseconds ); + ~UIBlockTester(); + +private slots: + void timer(); + +protected: + virtual void lockup(); + +private: + UIBlockTesterThread m_thread; + QDateTime m_lastTime; + QMutex m_timeMutex; + QTimer * m_timer; + uint m_msecs; +}; + +class Context; +class CppCodeCompletion; +class CppCodeCompletionConfig; +class CppSplitHeaderSourceConfig; +class CreateGetterSetterConfiguration; +class QtBuildConfig; +class ProblemReporter; +class BackgroundParser; +class Catalog; +class QLabel; +class QProgressBar; +class QStringList; +class QListViewItem; +class TranslationUnitAST; +class QTimer; +class KListView; +class Driver; +class KPopupMenu; +class BackgroundParserConfig; +class KAction; + +namespace KParts +{ + class Part; +} +namespace KTextEditor +{ + class Document; + class View; + class EditInterface; + class SelectionInterface; + class ViewCursorInterface; +} + + +class SynchronizedFileSet +{ +public: + typedef __gnu_cxx::hash_set< HashedString > SetType; + SynchronizedFileSet() + {} + + bool isEmpty() const + { + QMutexLocker locker( &m_mutex ); + return m_fileSet.empty(); + } + + uint count() const + { + QMutexLocker locker( &m_mutex ); + return m_fileSet.size(); + } + + void clear() + { + QMutexLocker locker( &m_mutex ); + m_fileSet.clear(); + } + + void setFiles( const SetType& files ) { + QMutexLocker locker( &m_mutex ); + m_fileSet = files; + } + + void insert( const HashedString& str ) + { + HashedString s( QString::fromUtf8(str.str().utf8()) ); + QMutexLocker locker( &m_mutex ); + + m_fileSet.insert( s ); + } + + bool contains( const HashedString& str ) const { + QMutexLocker locker( &m_mutex ); + return m_fileSet.find( str ) != m_fileSet.end(); + } + +private: + mutable QMutex m_mutex; + SetType m_fileSet; +}; + +class CppSupportPart : public KDevLanguageSupport +{ + Q_OBJECT + +public: + CppSupportPart( QObject *parent, const char *name, const QStringList &args ); + virtual ~CppSupportPart(); + + bool isValid() const + { + return m_valid; + } + + QString specialHeaderName( bool local = false ) const; + void updateParserConfiguration(); + void updateBackgroundParserConfig(); + + // @fixme - isValid is used to avoid using the problem reporter + // when a project is first parsed. This because the problem reporter + // is currently a great slowdown for large projects (see bug #73671) + ProblemReporter* problemReporter() const + { + return isValid() ? static_cast( m_problemReporter ) : 0; + } + + /** parses the file and all files that belong to it using the background-parser */ + int parseFileAndDependencies( const QString& fileName, bool background = true, bool parseFirst = false, bool silent = false ); + int parseFilesAndDependencies( QStringList files, bool background = true, bool parseFirst = false, bool silent = false ); + + BackgroundParser* backgroundParser() const + { + return m_backgroundParser; + } + CppCodeCompletion* codeCompletion() const + { + return m_pCompletion; + } + CppCodeCompletionConfig* codeCompletionConfig() const + { + return m_pCompletionConfig; + } + CppSplitHeaderSourceConfig* splitHeaderSourceConfig() const + { + return m_pSplitHeaderSourceConfig; + } + CreateGetterSetterConfiguration* createGetterSetterConfiguration() const + { + return m_pCreateGetterSetterConfiguration; + } + + /** + Get a pointer to the QtBuildConfig object + @return A pointer to the QtBuildConfig object. + */ + inline QtBuildConfig* qtBuildConfig() const { return m_qtBuildConfig; } + + const QPtrList& catalogList() const + { + return m_catalogList; + } + void addCatalog( Catalog* catalog ); + void removeCatalog( const QString& dbName ); + + bool isValidSource( const QString& fileName ) const; + + virtual void customEvent( QCustomEvent* ev ); + + virtual QStringList subclassWidget( const QString& formName ); + virtual QStringList updateWidget( const QString& formName, const QString& fileName ); + + FunctionDefinitionDom currentFunctionDefinition(); + FunctionDefinitionDom functionDefinitionAt( int line, int column ); + + + KTextEditor::Document* findDocument( const KURL& url ); + static KConfig *config(); + + virtual QString formatTag( const Tag& tag ); + virtual QString formatModelItem( const CodeModelItem *item, bool shortDescription = false ); + virtual void addClass(); + + QString extractInterface( const ClassDom& klass ); + + bool isHeader( const QString& fileName ) const; + bool isSource( const QString& fileName ) const; + + //uses the old simple algorithm to find the header + QString findHeaderSimple( const QString &header ); + + virtual KDevDesignerIntegration *designer( KInterfaceDesigner::DesignerType type ); + + void setTyping( bool typing ); + + /** + * Add a new method to a class. + * @param aClass The class to which the method should be added. + * @param name The name of the method. + * @param type The return type of the method. + * @param parameters A string containing the parameters + * (including names, default values, but no '(' , ')', e.g.: "int, const QString& aString"). + * @param accessType The access specifier e.g. CodeModelItem::PUBLIC. + * @param isConst true if method is const. + * @param isInline true if method should be declared inline. + * @param isVirtual true if method is virtual(this is ignored if isPureVirtual is true) + * @param isPureVirtual true if method is pure virtual (this overrides any value of isVirtual) + * @param implementation a optional implementation, if this is not set the method body will be empty. + * @author Jonas Jacobi + */ + virtual void addMethod( ClassDom aClass, const QString& name, const QString type, const QString& parameters, CodeModelItem::Access accessType, bool isConst, bool isInline, bool isVirtual, bool isPureVirtual, const QString& implementation = "" ); + + void createAccessMethods( ClassDom theClass, VariableDom theVariable ); + + bool isQueued( const QString& file ) const; + bool switchHeaderImpl( const QString& file, int line, int col, bool scrollOnly = false ); + + const Driver* driver() const; + + Driver* driver(); + + ///thread-safe, returns the thread-safe set of all files that do not need to be parsed when being included, either because they are part of the project and parsed anyway, or because they are already in the code-repository + const SynchronizedFileSet& safeFileSet() const; + SynchronizedFileSet& safeFileSet(); +signals: + void fileParsed( const QString& fileName ); + ///Emitted whenever a file was parsed, but the code-model could be updated(the file in the code-model did not have to be replaced) + void codeModelUpdated( const QString& fileName ); + ///Emitted whenever a translation-unit was parsed in the main thread + void synchronousParseReady( const QString& file, ParsedFilePointer unit ); + +protected: + virtual KDevLanguageSupport::Features features(); + virtual KMimeType::List mimeTypes(); + virtual QString formatClassName( const QString &name ); + virtual QString unformatClassName( const QString &name ); + virtual bool shouldSplitDocument( const KURL &url ); + virtual Qt::Orientation splitOrientation() const; + virtual void addMethod( ClassDom klass ); + virtual void addAttribute( ClassDom klass ); + +private slots: + void activePartChanged( KParts::Part *part ); + void partRemoved( KParts::Part* part ); + void projectOpened(); + void projectClosed(); + void savedFile( const KURL &fileName ); + void configWidget( KDialogBase *dlg ); + void projectConfigWidget( KDialogBase *dlg ); + void contextMenu( QPopupMenu *popup, const Context *context ); + void addedFilesToProject( const QStringList &fileList ); + void removedFilesFromProject( const QStringList &fileList ); + void changedFilesInProject( const QStringList & fileList ); + void slotProjectCompiled(); + void setupCatalog(); + void codeCompletionConfigStored(); + void splitHeaderSourceConfigStored(); + // void recomputeCodeModel( const QString& fileName ); + void slotNavigate(); + void slotNewClass(); + void slotSwitchHeader( bool scrollOnly = false ); + void slotCompleteText(); + void slotMakeMember(); + void slotExtractInterface(); + void slotCursorPositionChanged(); +// void slotFunctionHint(); + void gotoLine( int line ); + void gotoDeclarationLine( int line ); + void emitFileParsed( QStringList l ); + void slotParseFiles(); + void slotCreateSubclass(); + void slotCreateAccessMethods(); + void slotDeleteParserStore(); + void slotSaveMemory(); + void slotTextChanged(); + void slotCursorMoved(); + void slotParseCurrentFile(); + void embedProblemReporter( bool force = false ); + void removeProblemReporter(); + + + void slotNeedTextHint( int, int, QString& ); + + /** + * loads, parses and creates both classstores needed + */ + void initialParse( ); + + /** + * only parses the current project + */ + bool parseProject( bool force = false ); + +private: + + void resetParserStoreTimer(); + /** + * Get a linenumber in which a new method with a specific access specifier can be inserted. + * If there isn't a "section" with access, such a "section" gets inserted and the resulting place is returned. + * @param aClass the class one wants to insert a method to. + * @param access the access specifier the new method should have. + * @return A linenumber where the new method can be inserted + * or -1 if partController()->activePart() is no KTextEditorInterface. + * @author Jonas Jacobi + */ + int findInsertionLineMethod( ClassDom aClass, CodeModelItem::Access access ); + /** + * Same as above, just returns a insertion line for a variable instead of a method + */ + int findInsertionLineVariable( ClassDom aClass, CodeModelItem::Access access ); + + + /** + * Get a class declaration which is "around" the current cursor position. + * @return The class declaration which is "around" the current cursor position, + * in the case of nested classes this is the innermost fitting class. If there is no + * class declared at the current cursor position, 0 is returned. + * @author Jonas Jacobi + */ + ClassDom currentClass() const; + /** + * Get the class attribute of curClass, which is declared at the current cursor position. + * @param curClass the class to search for attributes. + * @return the attribute declared at the current cursor position or 0, if no attribute is declared there. + * @author Jonas Jacobi + */ + VariableDom currentAttribute( ClassDom curClass ) const; + + /** + * checks if a file has to be parsed + */ + FileDom fileByName( const QString& name); + void maybeParse( const QString& fileName, bool background = true ); + void removeWithReferences( const QString& fileName ); + void createIgnorePCSFile(); + + void MakeMemberHelper( QString& text, int& atline, int& atcol ); + + QString sourceOrHeaderCandidate( const KURL &url = KURL() ); + + FunctionDom findFunction( const FunctionDom& def ); + FunctionDom findFunctionInNamespace( const NamespaceDom& ns, const FunctionDom& def, const std::set& nsImports, + const QString& candidateFile, int scopeIndex, FunctionDom& bestMatch ); + FunctionDom findFunctionInClass( const ClassDom& cs, const FunctionDom& def, const std::set& nsImports, + const QString& candidateFile, int scopeIndex, FunctionDom& bestMatch ); + FunctionDom findFunctionDefinition( const FunctionDom& decl ); + + void jumpToCodeModelItem( const ItemDom& item, bool scrollOnly ); + + QStringList modifiedFileList(); + QString findSourceFile(); + int pcsVersion(); + void setPcsVersion( int version ); + + void saveProjectSourceInfo(); + QStringList reorder( const QStringList& list ); + + CppCodeCompletion* m_pCompletion; + CppCodeCompletionConfig* m_pCompletionConfig; + CppSplitHeaderSourceConfig* m_pSplitHeaderSourceConfig; + + CreateGetterSetterConfiguration* m_pCreateGetterSetterConfiguration; + KAction * m_createGetterSetterAction; + KAction * m_switchHeaderSourceAction; + + QtBuildConfig* m_qtBuildConfig; + + bool withcpp; + QString m_contextFileName; + + VariableDom m_curAttribute; + ClassDom m_curClass; + QGuardedPtr< ProblemReporter > m_problemReporter; + BackgroundParser* m_backgroundParser; + UIBlockTester* m_lockupTester; + + KTextEditor::Document* m_activeDocument; + KTextEditor::View* m_activeView; + KTextEditor::SelectionInterface* m_activeSelection; + KTextEditor::EditInterface* m_activeEditor; + KTextEditor::ViewCursorInterface* m_activeViewCursor; + QString m_activeFileName; + + QMap m_designers; + + QWaitCondition m_eventConsumed; + bool m_projectClosed; + bool m_projectClosing; + + QMap m_timestamp; + bool m_valid; + bool m_isTyping; + bool m_hadErrors; ///Whether there were already errors when the user started typing + + QPtrList m_catalogList; + Driver* m_driver; + QString m_projectDirectory; + QStringList m_projectFileList; + + ClassDom m_activeClass; + FunctionDom m_activeFunction; + VariableDom m_activeVariable; + + QGuardedPtr m_navigationMenu; + +// QTimer* m_functionHintTimer; +// QTimer* m_deleteParserStoreTimer; + QTimer* m_saveMemoryTimer; + QTimer * m_textChangedTimer; + QTimer * m_cursorMovedTimer; + QTimer* m_buildSafeFileSetTimer; + + class ParseEmitWaiting { + public: + enum Flags { + None = 0, + HadErrors = 1, + HadQueueProblem = 2, + Silent = 4 + }; + private: + struct Item { + QStringList first; + QStringList second; + Flags flags; + Item() : flags(None) { + } + Item( QStringList f, QStringList s, Flags fl = None ) : first( f ), second( s ), flags( fl ) + { + } + }; + //typedef QPair Item; ///The files we are waiting fore, and the files we already got + typedef QValueList< Item > List; + List m_waiting; + + + QStringList harvestUntil( List::iterator targIt ) { + List::iterator it = m_waiting.begin(); + QStringList ret; + while( it != targIt && it != m_waiting.end() ) { + ret += (*it).first; + it = m_waiting.erase( it ); + } + return ret; + } + + public: + void addGroup( QStringList& files, Flags flag = None ) { + m_waiting << Item(files, QStringList(), flag); + } + void addGroupFront( QStringList& files, Flags flag = None ) { + m_waiting.push_front( Item(files, QStringList(), flag) ); + } + void clear() { + m_waiting.clear(); + } + + ///files that were not requested must not be processed, since they maybe do not respect the group-relationships. + bool reject( QString file ) { + for( List::iterator it = m_waiting.begin(); it != m_waiting.end(); ++it) { + if( (*it).first.find( file ) != (*it).first.end() ) { + return false; + } + } + return true; + } + + bool waiting( QString file, Flags forbidFlags = None, int count = 1 ) const { + int hits = 0; + for( List::const_iterator it = m_waiting.begin(); it != m_waiting.end(); ++it) { + if( (*it).first.find( file ) != (*it).first.end() ) { + if( ((Flags)((*it).flags & forbidFlags )) == None ) { + hits++; + if( hits >= count ) return true; + } + } + } + return false; + } + + struct Processed { + QStringList res; + Flags flag; + Processed() : flag(None) { + } + Processed(const QStringList& l , Flags f = None ) : res( l ), flag( f ) { + } + operator QStringList() { + return res; + } + + bool hadQueueProblem() { + return flag & HadQueueProblem; + } + + bool hasFlag( Flags f ) const { + return f & flag; + } + // surely a copy paste implementation? +/* + bool hasFlag( Flags flag ) const { + return flag & HadQueueProblem; + } +*/ + }; + + + private: + ///Just return all files that have been parsed + Processed errorRecover( QString currentFile ) { + QStringList ret; + kdDebug( 9007 ) << "ParseEmitWaiting: error in the waiting-chain" << endl; + for( List::iterator it = m_waiting.begin(); it != m_waiting.end(); ++it) { + ret += (*it).second; + } + if( !currentFile.isEmpty() ) ret << currentFile; + m_waiting.clear(); + return Processed( ret, HadQueueProblem ); + } + public: + + ///returns the parsed-messages that should be emitted + Processed processFile( QString file, Flags flag = None ) { + QStringList ret; + for( List::iterator it = m_waiting.begin(); it != m_waiting.end(); ++it) { + if( (*it).first.find( file ) != (*it).first.end() ) { + if( (*it).second.find( file ) == (*it).second.end() ) { + (*it).flags = (Flags) ((*it).flags | flag); + (*it).second << file; + if( (*it).second.count() == (*it).first.count() ) { + Flags f = (*it).flags; + if( it != m_waiting.begin() ) { + kdDebug( 9007 ) << "ParseEmitWaiting: the chain has multiple groups waiting, they are flushed" << endl; + f = (Flags)(f | HadQueueProblem); + } + return Processed( harvestUntil( ++it ), f ); + } else { + ///The file was registered, now wait for the next + return QStringList(); + } + } else { + ///The file has already been parsed + kdDebug( 9007 ) << "ParseEmitWaiting: file has been parsed twice" << endl; + return errorRecover( file ); + } + } + } + + kdDebug( 9007 ) << "ParseEmitWaiting: file \"" << file << "\" has no group waiting for it" << endl; + ret << file; + return Processed( ret, HadQueueProblem ); + } + }; + + ParseEmitWaiting m_parseEmitWaiting; + ParseEmitWaiting m_fileParsedEmitWaiting; + +private slots: + void parseEmit( ParseEmitWaiting::Processed files ); + void buildSafeFileSet(); +private: + + SynchronizedFileSet m_safeProjectFiles; + BackgroundParserConfig * m_backgroundParserConfig; + + static QStringList m_sourceMimeTypes; + static QStringList m_headerMimeTypes; + + static QStringList m_sourceExtensions; + static QStringList m_headerExtensions; + + friend class KDevCppSupportIface; + friend class CppDriver; + + // we need something to plug actions that are not in any menu + // into in order for their shortcuts to work + QWidget m_DummyActionWidget; + + void addToRepository( ParsedFilePointer ); + void emitSynchronousParseReady( const QString& file, ParsedFilePointer unit ); + + struct JobData + { + QDir dir; + QGuardedPtr progressBar; + QStringList::Iterator it; + QStringList files; + int cycle; + int backgroundCount; + int lastBackgroundState; + int backgroundState; + QStringList reparseList; + QMap< QString, QPair > pcs; + QDataStream stream; + QFile file; + QTime lastParse; + + ~JobData() + { + delete progressBar; + } + }; + + JobData * _jd; +}; + +#endif +// kate: indent-mode csands; tab-width 4; + diff --git a/languages/cpp/cpptemplates b/languages/cpp/cpptemplates new file mode 100644 index 00000000..e55181c0 --- /dev/null +++ b/languages/cpp/cpptemplates @@ -0,0 +1,22 @@ + + +