diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:18:13 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:18:13 -0600 |
commit | 2fb700f92bb787fab0845a63a541cd5640daa449 (patch) | |
tree | c6f769db55585dd47a9fd415a40ee8b86926f683 /languages/cpp/app_templates/kscons_tdemdi | |
parent | fd1d1e1064eb09ddbbd67d3597c39856f5c0bc76 (diff) | |
download | tdevelop-2fb700f92bb787fab0845a63a541cd5640daa449.tar.gz tdevelop-2fb700f92bb787fab0845a63a541cd5640daa449.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'languages/cpp/app_templates/kscons_tdemdi')
28 files changed, 2251 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/kscons_tdemdi/CMakeLists.txt b/languages/cpp/app_templates/kscons_tdemdi/CMakeLists.txt new file mode 100644 index 00000000..c05f1bb1 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/CMakeLists.txt @@ -0,0 +1,30 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_custom_target( kscons_tdemdi.tar.gz ALL + COMMAND tar zcf kscons_tdemdi.tar.gz -C ${CMAKE_CURRENT_SOURCE_DIR} + app.kcfg app.tdevelop apptdemdi.cpp apptdemdi.h apptdemdiView.cpp + apptdemdiView.h INSTALL tdemdikonsole.cpp tdemdikonsole.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 +) + + +install( FILES + ${CMAKE_CURRENT_BINARY_DIR}/kscons_tdemdi.tar.gz kscons_tdemdi.png + DESTINATION ${DATA_INSTALL_DIR}/kdevappwizard ) + + +install( FILES + kscons_tdemdi.kdevtemplate + DESTINATION ${DATA_INSTALL_DIR}/kdevappwizard/templates ) diff --git a/languages/cpp/app_templates/kscons_tdemdi/INSTALL b/languages/cpp/app_templates/kscons_tdemdi/INSTALL new file mode 100644 index 00000000..e61a3acc --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/INSTALL @@ -0,0 +1,83 @@ +REQUIREMENTS +------------ + +* TDE headers & libraries for tdelibs +* 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 tde-config program. +The programs tde-config, qmake, uic and moc must be accesssible +through your PATH. + +Qt and kde may not be installed as expected (in QTDIR and TDEDIR) +So until tde-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/tde/ +On Debian +$ scons configure qtincludes=/usr/include/qt/ kdeinclude=/usr/include/tde/ +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_tdemdi/Makefile.am b/languages/cpp/app_templates/kscons_tdemdi/Makefile.am new file mode 100644 index 00000000..191ea8ee --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/Makefile.am @@ -0,0 +1,21 @@ +dataFiles = app.kcfg app.tdevelop apptdemdi.cpp apptdemdi.h apptdemdiView.cpp \ +apptdemdiView.h INSTALL tdemdikonsole.cpp tdemdikonsole.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_tdemdi + +### 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_tdemdi/QUICKSTART b/languages/cpp/app_templates/kscons_tdemdi/QUICKSTART new file mode 100644 index 00000000..a5fbba33 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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 +Q_SIGNALS and Q_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 (TDEprogram, TDEshlib ..). + +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 <tnagyemail-mail@yahoo^fr> + diff --git a/languages/cpp/app_templates/kscons_tdemdi/README b/languages/cpp/app_templates/kscons_tdemdi/README new file mode 100644 index 00000000..e7aa2647 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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/trinity/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 TDEprogram, TDEshlib, 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 TDEConfig 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 : <myproject>.kcfg and a <settings>.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 tdegames 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-tdeparts/ +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 +TDEDIR=/where_your_TDE3_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_tdemdi/SConscript-doc b/languages/cpp/app_templates/kscons_tdemdi/SConscript-doc new file mode 100644 index 00000000..0c3e07e7 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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 TDEDOC/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 TDEDOC + + 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.TDEinstall('TDEDOC', 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.TDEinstall( 'TDEDOC', 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_tdemdi/SConscript-src b/languages/cpp/app_templates/kscons_tdemdi/SConscript-src new file mode 100644 index 00000000..97f5140c --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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}tdemdi.cpp +%{APPNAMELC}tdemdiView.cpp +tdemdikonsole.cpp +settings.kcfgc +prefs.ui +""" +# Now that we have our list of sources we can build the program +myenv.TDEprogram( '%{APPNAMELC}', %{APPNAMELC}_sources ) # main program +myenv.TDEaddpaths_includes( './ ../' ) # additional paths +myenv.TDEaddlibs( 'qt-mt tdecore kio tdeparts tdemdi' ) # additional libraries + +## Next, the kpart library +## using TDEshlib, the .so and .la are installed automatically when needed + +myenv2=env.Copy() +%{APPNAMELC}part_sources = '%{APPNAMELC}_part.cpp' +myenv2.TDEshlib( 'lib%{APPNAMELC}part', %{APPNAMELC}part_sources) +myenv2.TDEaddpaths_includes( './ #/' ) # the '#' means the top-level directory +myenv2.TDEaddlibs( 'qt-mt kio tdecore tdeprint tdeparts' ) +# myenv2.TDEaddflags_link( '-DQT_THREAD_SUPPORT' ) + +############################# +## Data files to install + +## NOTE: TDEinstall( resource_type, subdir, list of files ) + +## the .kcfg file +myenv.TDEinstall( 'TDEKCFG', '', '%{APPNAMELC}.kcfg' ) + +## the program .desktop file +myenv.TDEinstall( 'TDEMENU', '/Utilities', '%{APPNAMELC}.desktop' ) + +## the rc file - named *_shell.rc instead of *ui.rc for kpart apps +myenv.TDEinstall( 'TDEDATA', '/%{APPNAMELC}', '%{APPNAMELC}_shell.rc' ) + +## this servicetype desktop file goes in TDEXDG whether the other one goes in TDEMENU +myenv.TDEinstall( 'TDEXDG', '', '%{APPNAMELC}_part.desktop' ) + +## the kpart resource file +myenv.TDEinstall( 'TDEDATA', '/%{APPNAMELC}part', '%{APPNAMELC}_part.rc' ) + +## Installing icons is easy (hi-16-app-%{APPNAMELC}.png, hi-22-app-%{APPNAMELC}.png) +#myenv.TDEicon() + +## do not forget that this is a python script so even loops are allowed... :) diff --git a/languages/cpp/app_templates/kscons_tdemdi/SConstruct b/languages/cpp/app_templates/kscons_tdemdi/SConstruct new file mode 100644 index 00000000..3954247c --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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.TDEuse("environ rpath") +#env.TDEuse("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.TDElang('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_tdemdi/VERSION b/languages/cpp/app_templates/kscons_tdemdi/VERSION new file mode 100644 index 00000000..2e293c30 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/VERSION @@ -0,0 +1 @@ +%{VERSION} diff --git a/languages/cpp/app_templates/kscons_tdemdi/app.kcfg b/languages/cpp/app_templates/kscons_tdemdi/app.kcfg new file mode 100644 index 00000000..f2c46b64 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/app.kcfg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="%{APPNAMELC}rc"/> + <group name="Preferences"> + <entry name="showCloseTabsButton" type="Bool"> + <default>true</default> + </entry> + </group> +</kcfg> diff --git a/languages/cpp/app_templates/kscons_tdemdi/app.tdevelop b/languages/cpp/app_templates/kscons_tdemdi/app.tdevelop new file mode 100644 index 00000000..317a4cbc --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/app.tdevelop @@ -0,0 +1,169 @@ +<?xml version = '1.0'?> +<tdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevTDEAutoProject</projectmanagement> + <primarylanguage>C++</primarylanguage> + <keywords> + <keyword>C++</keyword> + <keyword>Code</keyword> + <keyword>Qt</keyword> + <keyword>TDE</keyword> + </keywords> + <projectdirectory>.</projectdirectory> + <absoluteprojectpath>false</absoluteprojectpath> + <description/> + <ignoreparts/> + </general> + <kdevcppsupport> + <qt> + <version>3</version> + <used>true</used> + <includestyle>3</includestyle> + <designerintegration>EmbeddedKDevDesigner</designerintegration> + </qt> + </kdevcppsupport> + + <kdevautoproject> + <general> + <activetarget>src/%{APPNAMELC}</activetarget> + <useconfiguration>debug</useconfiguration> + </general> + <run> + <mainprogram>src/%{APPNAMELC}</mainprogram> + <terminal>false</terminal> + </run> + <make> + <envvars> + <envvar value="1" name="WANT_AUTOCONF_2_5" /> + <envvar value="1" name="WANT_AUTOMAKE_1_6" /> + </envvars> + <abortonerror>false</abortonerror> + <numberofjobs>1</numberofjobs> + <dontact>false</dontact> + <makebin/> + </make> + <configurations> + <optimized> + <builddir>optimized</builddir> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <cxxflags>-O2 -g0</cxxflags> + </optimized> + <debug> + <configargs>--enable-debug=full</configargs> + <builddir>debug</builddir> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <cxxflags>-O0 -g3</cxxflags> + </debug> + </configurations> + </kdevautoproject> + <kdevfileview> + <groups> + <group pattern="*.cpp;*.cxx;*.h" name="Sources" /> + <group pattern="*.ui" name="User Interface" /> + <group pattern="*.png" name="Icons" /> + <group pattern="*.po;*.ts" name="Translations" /> + <group pattern="*" name="Others" /> + </groups> + <tree> + <hidenonprojectfiles>false</hidenonprojectfiles> + <hidepatterns>*.o,*.lo,CVS</hidepatterns> + </tree> + </kdevfileview> + <kdevdoctreeview> + <ignoretocs> + <toc>ada</toc> + <toc>ada_bugs_gcc</toc> + <toc>bash</toc> + <toc>bash_bugs</toc> + <toc>clanlib</toc> + <toc>w3c-dom-level2-html</toc> + <toc>fortran_bugs_gcc</toc> + <toc>gnome1</toc> + <toc>gnustep</toc> + <toc>gtk</toc> + <toc>gtk_bugs</toc> + <toc>haskell</toc> + <toc>haskell_bugs_ghc</toc> + <toc>java_bugs_gcc</toc> + <toc>java_bugs_sun</toc> + <toc>pascal_bugs_fp</toc> + <toc>php</toc> + <toc>php_bugs</toc> + <toc>perl</toc> + <toc>perl_bugs</toc> + <toc>python</toc> + <toc>python_bugs</toc> + <toc>ruby</toc> + <toc>ruby_bugs</toc> + <toc>sdl</toc> + <toc>w3c-svg</toc> + <toc>sw</toc> + <toc>w3c-uaag10</toc> + <toc>wxwidgets_bugs</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>qmake User Guide</toc> + </ignoreqt_xml> + </kdevdoctreeview> + <kdevdebugger> + <general> + <dbgshell>libtool</dbgshell> + <programargs/> + <gdbpath/> + <breakonloadinglibs>true</breakonloadinglibs> + <separatetty>false</separatetty> + <floatingtoolbar>false</floatingtoolbar> + <runappinappdirectory>true</runappinappdirectory> + </general> + <display> + <staticmembers>false</staticmembers> + <demanglenames>true</demanglenames> + </display> + </kdevdebugger> + <kdevfilecreate> + <filetypes/> + <useglobaltypes> + <type ext="ui" /> + <type ext="cpp" /> + <type ext="h" /> + </useglobaltypes> + </kdevfilecreate> + <kdevcvs> + <cvsoptions>-f</cvsoptions> + <commitoptions/> + <updateoptions>-dP</updateoptions> + <addoptions/> + <removeoptions>-f</removeoptions> + <diffoptions>-u3 -p</diffoptions> + <logoptions/> + <rshoptions/> + </kdevcvs> + <cppsupportpart> + <codecompletion/> + <filetemplates> + <choosefiles>false</choosefiles> + <interfaceURL/> + <implementationURL/> + <interfacesuffix>.h</interfacesuffix> + <implementationsuffix>.cpp</implementationsuffix> + <lowercasefilenames>true</lowercasefilenames> + </filetemplates> + </cppsupportpart> + <kdevclassview> + <folderhierarchy>true</folderhierarchy> + <depthoffolders>2</depthoffolders> + </kdevclassview> + <kdevdocumentation> + <projectdoc> + <docsystem>Doxygen Documentation Collection</docsystem> + <docurl>%{APPNAMELC}.tag</docurl> + </projectdoc> + </kdevdocumentation> +</tdevelop> diff --git a/languages/cpp/app_templates/kscons_tdemdi/app_part.cpp b/languages/cpp/app_templates/kscons_tdemdi/app_part.cpp new file mode 100644 index 00000000..2bdb725d --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/app_part.cpp @@ -0,0 +1,159 @@ +%{CPP_TEMPLATE} + +#include "%{APPNAMELC}_part.h" + +#include <tdeparts/genericfactory.h> +#include <kinstance.h> +#include <kaction.h> +#include <kstdaction.h> +#include <kfiledialog.h> +#include <kglobal.h> +#include <klocale.h> + +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqmultilineedit.h> + +typedef KParts::GenericFactory<%{APPNAMELC}Part> %{APPNAMELC}PartFactory; +K_EXPORT_COMPONENT_FACTORY( lib%{APPNAMELC}part, %{APPNAMELC}PartFactory ); + +%{APPNAMELC}Part::%{APPNAMELC}Part( TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name, const TQStringList & /*args*/) + : KParts::ReadWritePart(parent) +{ + // we need an instance + setInstance( %{APPNAMELC}PartFactory::instance() ); + + // this should be your custom internal widget + m_widget = new TQMultiLineEdit( parentWidget, widgetName ); + + // notify the part that this is our internal widget + setWidget(m_widget); + + // create our actions + KStdAction::open(this, TQT_SLOT(fileOpen()), actionCollection()); + KStdAction::saveAs(this, TQT_SLOT(fileSaveAs()), actionCollection()); + KStdAction::save(this, TQT_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() +{ +} + +TDEAboutData *%{APPNAMELC}Part::createAboutData() +{ + // The non-i18n name here must be the same as the directory in + // which the part's rc file is installed + TDEAboutData *aboutData = new TDEAboutData("%{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, TQT_SIGNAL(textChanged()), + this, TQT_SLOT(setModified())); + else + { + disconnect(m_widget, TQT_SIGNAL(textChanged()), + this, TQT_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 TQFile on it + TQFile file(m_file); + if (file.open(IO_ReadOnly) == false) + return false; + + // our example widget is text-based, so we use TQTextStream instead + // of a raw TQDataStream + TQTextStream stream(&file); + TQString 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 TQFile + TQFile file(m_file); + if (file.open(IO_WriteOnly) == false) + return false; + + // use TQTextStream to dump the text to the file + TQTextStream 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 + TQString 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, + TQString file_name = KFileDialog::getSaveFileName(); + if (file_name.isEmpty() == false) + saveAs(file_name); +} + +#include "%{APPNAMELC}_part.moc" diff --git a/languages/cpp/app_templates/kscons_tdemdi/app_part.h b/languages/cpp/app_templates/kscons_tdemdi/app_part.h new file mode 100644 index 00000000..13f773a1 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/app_part.h @@ -0,0 +1,75 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}PART_H_ +#define _%{APPNAMEUC}PART_H_ + +#include <tdeparts/part.h> +#include <tdeparts/factory.h> + +class TQMultiLineEdit; +class TQWidget; +class TQPainter; +class KURL; +class TDEAboutData; + +/** + * 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(TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name, const TQStringList & /*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 TDEAboutData *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: + TQMultiLineEdit *m_widget; +}; + +#endif // _%{APPNAMEUC}PART_H_ diff --git a/languages/cpp/app_templates/kscons_tdemdi/app_part.rc b/languages/cpp/app_templates/kscons_tdemdi/app_part.rc new file mode 100644 index 00000000..cec8ec5c --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/app_part.rc @@ -0,0 +1,17 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="%{APPNAMELC}_part" version="1"> +<MenuBar> + <Menu name="file"> + <Action name="file_open"/> + <Separator/> + <Action name="file_save"/> + <Action name="file_save_as"/> + </Menu> +</MenuBar> +<ToolBar name="mainToolBar"> + <Action name="file_open"/> + <Action name="file_save"/> + <Action name="file_print"/> + <Separator/> +</ToolBar> +</kpartgui> diff --git a/languages/cpp/app_templates/kscons_tdemdi/app_shell.rc b/languages/cpp/app_templates/kscons_tdemdi/app_shell.rc new file mode 100644 index 00000000..c8b2bb98 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/app_shell.rc @@ -0,0 +1,33 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="%{APPNAMELC}_shell" version="1"> +<MenuBar> + <Menu noMerge="1" name="file"><text>&File</text> + <Action name="file_new"/> + <Merge/> + <Separator/> + <Action name="file_close"/> + <Separator/> + <Action name="file_quit"/> + </Menu> + <Menu name="view" noMerge="1"><text>&View</text> + </Menu> + <Menu noMerge="1" name="settings"><text>&Settings</text> + <Action name="options_show_toolbar"/> + <Action name="options_show_statusbar"/> + <Merge name="show_merge"/> + <Separator/> + <Action name="options_configure_keybinding"/> + <Action name="options_configure_toolbars"/> + <Action name="options_configure"/> + <Merge name="configure_merge"/> + <Separator/> + <Merge/> + </Menu> +</MenuBar> +<ToolBar noMerge="1" name="mainToolBar"><text>Main Toolbar</text> + <Action name="file_new"/> + <Action name="file_close"/> + <Merge/> + <Action name="help"/> +</ToolBar> +</kpartgui> diff --git a/languages/cpp/app_templates/kscons_tdemdi/apptdemdi.cpp b/languages/cpp/app_templates/kscons_tdemdi/apptdemdi.cpp new file mode 100644 index 00000000..0ef16672 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/apptdemdi.cpp @@ -0,0 +1,394 @@ +%{CPP_TEMPLATE} + +#include <tqdragobject.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> +#include <tqdragobject.h> +#include <statusbar.h> +#include <tqtoolbutton.h> + +#include <kdebug.h> +#include <kglobal.h> +#include <ktip.h> +#include <tdeparts/part.h> +#include <tdeparts/partmanager.h> + +#include <kio/netaccess.h> +#include <kurl.h> +#include <kurldrag.h> +#include <kurlrequesterdlg.h> +#include <kconfig.h> +#include <kconfigdialog.h> +#include <klibloader.h> +#include <kaboutdata.h> +#include <kfiledialog.h> +#include <kactionclasses.h> +#include <kglobal.h> +#include <klocale.h> +#include <kiconloader.h> +#include <tdeversion.h> +#include <kmenubar.h> +#include <kstatusbar.h> +#include <kkeydialog.h> +#include <kmessagebox.h> +#include <ktabwidget.h> +#include <kedittoolbar.h> +#include <tdeversion.h> +#include <kstdaccel.h> +#include <kaction.h> +#include <kstdaction.h> + +#include "settings.h" +#include "prefs.h" +#include "%{APPNAMELC}tdemdiView.h" +#include "tdemdikonsole.h" +#include "%{APPNAMELC}tdemdi.h" + +%{APPNAMELC}tdemdi::%{APPNAMELC}tdemdi(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, TQT_SIGNAL(activePartChanged(KParts::Part*)), + this, TQT_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, TQT_SIGNAL( viewActivated( KMdiChildView * ) ), this, TQT_SLOT( currentChanged( KMdiChildView * ) ) ); + + m_console = new tdemdikonsole(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()) + { + TQToolButton *but = new TQToolButton(tabWidget()); + but->setIconSet(SmallIcon("tab_remove")); + but->adjustSize(); + but->hide(); + connect(but, TQT_SIGNAL(clicked()), actionCollection()->action( "file_close" ), TQT_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 - tdemdi is tricky + TDEConfig *cfg = new TDEConfig("%{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}tdemdi::~%{APPNAMELC}tdemdi() +{ + // Write the dock config on exit + TDEConfig *cfg = new TDEConfig("%{APPNAMELC}_dockposrc"); + manager()->writeConfig(cfg); + delete cfg; + delete m_console; +} + +void %{APPNAMELC}tdemdi::setupActions() +{ + setXMLFile("%{APPNAMELC}_shell.rc"); + + KStdAction::openNew(this, TQT_SLOT(slotFileNew()), actionCollection()); + + KStdAction::tipOfDay( this, TQT_SLOT( showTip() ), actionCollection() + )->setWhatsThis(i18n("This shows useful tips on the use of this application.")); + + KStdAction::close(this, TQT_SLOT(slotFileClose()), actionCollection()); + KStdAction::quit(this, TQT_SLOT(slotFileQuit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(this, TQT_SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(this, TQT_SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::keyBindings(this, TQT_SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::preferences(this, TQT_SLOT(optionsPreferences()), actionCollection()); + + KAction* action = KStdAction::configureToolbars(this, + TQT_SLOT(optionsConfigureToolbars()), actionCollection()); + + createGUI( NULL ); +} + +void %{APPNAMELC}tdemdi::showTip() +{ + KTipDialog::showTip(this,TQString(),true); +} + +void %{APPNAMELC}tdemdi::showTipOnStart() +{ + KTipDialog::showTip(this); +} + +void %{APPNAMELC}tdemdi::slotFileNew() +{ + %{APPNAMELC}tdemdiView *view = new %{APPNAMELC}tdemdiView(this); + m_manager->addPart( view->part() ); + + addWindow( view ); + + // add the tree view to the widget stack + m_views += view; + + currentChanged( view ); +} + +void %{APPNAMELC}tdemdi::openURL(const KURL & url) +{ + // check if the url is not already opened first + TQValueList<%{APPNAMELC}tdemdiView*>::iterator it = m_views.begin(); + TQValueList<%{APPNAMELC}tdemdiView*>::iterator end = m_views.end(); + for (; it != end; ++it) + { + %{APPNAMELC}tdemdiView *view = *it; + if (view->part()->url() == url) + { + activateView(view); + return; + } + } + + %{APPNAMELC}tdemdiView *view = new %{APPNAMELC}tdemdiView(this); + m_manager->addPart( view->part() ); + + addWindow( view ); + + m_views += view; + + view->part()->openURL(url); + currentChanged( view ); +} + +void %{APPNAMELC}tdemdi::currentChanged( KMdiChildView *current ) +{ + //kdWarning()<<"current view changed"<<endl; + if (!current) + { + m_manager->setActivePart(NULL); + //setCaption("()"); + return; + } + + // switch to the corresponding document + if ( m_views.contains( (%{APPNAMELC}tdemdiView*) current ) ) + { + %{APPNAMELC}tdemdiView *view = (%{APPNAMELC}tdemdiView*) current; + //view->updateCaption(); + m_manager->setActivePart( view->part() ); + } +} + +void %{APPNAMELC}tdemdi::slotFileClose() +{ + requestClose( activeWindow() ); +} + +bool %{APPNAMELC}tdemdi::requestClose(KMdiChildView* v) +{ + // kdWarning()<<"closing view"<<v<<endl; + // if (view == NULL) + // return; + + if (v == NULL) + { + if ( m_views.count() == 1) + { + %{APPNAMELC}tdemdiView *view = m_views[0]; + if (view->part()->queryClose()) + { + m_manager->removePart( view->part() ); + + closeWindow( view ); + m_views.clear(); + setCaption("kdissert"); + return true; + } + return false; + } + return true; + } + + %{APPNAMELC}tdemdiView *view = (%{APPNAMELC}tdemdiView*) 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}tdemdi::slotFileQuit() +{ + close(); +} + +void %{APPNAMELC}tdemdi::optionsShowToolbar() +{ + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void %{APPNAMELC}tdemdi::optionsShowStatusbar() +{ + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void %{APPNAMELC}tdemdi::optionsConfigureKeys() +{ + //KKeyDialog::configure(actionCollection()); + KKeyDialog dlg( false, this ); + TQPtrList<KXMLGUIClient> clients = guiFactory()->clients(); + + for( TQPtrListIterator<KXMLGUIClient> it( clients ); it.current(); ++it ) + dlg.insert ( (*it)->actionCollection(), (*it)->instance()->aboutData()->programName() ); + + dlg.configure(); + + for (int i=0; i<m_views.count(); i++) + { + m_views[i]->part()->reloadXML(); + } +} + +void %{APPNAMELC}tdemdi::optionsConfigureToolbars() +{ + //saveMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); +} + +void %{APPNAMELC}tdemdi::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(TDEGlobal::config(), autoSaveGroup()); +} + +void %{APPNAMELC}tdemdi::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 (TDEConfigDialog::showDialog("settings")) + return; + + TDEConfigDialog *dialog = new TDEConfigDialog(this, "settings", Settings::self(), KDialogBase::Swallow); + dialog->addPage(new prefs(), i18n("General"), "package_settings"); + connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(settingsChanged())); + dialog->show(); +} + +void %{APPNAMELC}tdemdi::settingsChanged() +{ + // propagate the changes to our views + /*TQValueList<%{APPNAMELC}tdemdiView*>::iterator it = m_views.begin(); + TQValueList<%{APPNAMELC}tdemdiView*>::iterator end = m_views.end(); + for (; it != end; ++it) + { + %{APPNAMELC}tdemdiView *view = *it; + view->settingsChanged(); + }*/ +} + +void %{APPNAMELC}tdemdi::changeStatusbar(const TQString& text) +{ + // display the text on the statusbar + statusBar()->message(text, 2000); +} + +void %{APPNAMELC}tdemdi::dragEnterEvent(TQDragEnterEvent *event) +{ + // accept uri drops only + event->accept(KURLDrag::canDecode(event)); +} + +void %{APPNAMELC}tdemdi::dropEvent(TQDropEvent *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}tdemdi::queryClose() +{ + TQValueList<%{APPNAMELC}tdemdiView*>::iterator it; + + // check if we can close all documents + for (it = m_views.begin(); it != m_views.end(); ++it) + { + // kdWarning()<<"searching for the part"<<endl; + %{APPNAMELC}tdemdiView *view = *it; + if (!view->part()->queryClose()) + { + return false; + } + } + + // and now close the documents + for (it = m_views.begin(); it != m_views.end(); ++it) + { + // now close all views + %{APPNAMELC}tdemdiView *view = *it; + + m_manager->removePart( view->part() ); + closeWindow( view ); + } + + return true; +} + +#include "%{APPNAMELC}tdemdi.moc" diff --git a/languages/cpp/app_templates/kscons_tdemdi/apptdemdi.h b/languages/cpp/app_templates/kscons_tdemdi/apptdemdi.h new file mode 100644 index 00000000..02d26d0c --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/apptdemdi.h @@ -0,0 +1,83 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}KMDI_H +#define _%{APPNAMEUC}KMDI_H + +#include <tqvaluelist.h> + +#include <kapplication.h> +#include <tdemdimainfrm.h> +#include <kurl.h> + +class KToggleAction; +class KRecentFilesAction; + +class tdemdikonsole; +class KMdiChildView; +class TQWidgetStack; +class %{APPNAMELC}tdemdiView; +class TextProperties; +class MiscProperties; + +/** + * This class serves as the main window for %{APPNAMELC}tdemdi. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + */ +class %{APPNAMELC}tdemdi : public KMdiMainFrm +{ + Q_OBJECT + + public: + %{APPNAMELC}tdemdi( KMdi::MdiMode mode ); + virtual ~%{APPNAMELC}tdemdi(); + void showTipOnStart(); + + public slots: + void openURL( const KURL& ); + + protected: + virtual void dragEnterEvent(TQDragEnterEvent *event); + virtual void dropEvent(TQDropEvent *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 TQString& text); + + void currentChanged( KMdiChildView *current ); + bool requestClose(KMdiChildView* view); + + void settingsChanged(); + + private: + void setupAccel(); + void setupActions(); + + TQValueList<%{APPNAMELC}tdemdiView*> m_views; + + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; + + KParts::PartManager *m_manager; + + tdemdikonsole *m_console; +}; + +#endif // _%{APPNAMEUC}KMDI_H + diff --git a/languages/cpp/app_templates/kscons_tdemdi/apptdemdiView.cpp b/languages/cpp/app_templates/kscons_tdemdi/apptdemdiView.cpp new file mode 100644 index 00000000..a9b9845e --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/apptdemdiView.cpp @@ -0,0 +1,63 @@ +%{CPP_TEMPLATE} + +#include <tqpixmap.h> +#include <tqlayout.h> + +#include <kiconloader.h> +#include <klocale.h> +#include <tdemdichildview.h> +#include <kdebug.h> +#include <klibloader.h> +#include <kmessagebox.h> + +#include "%{APPNAMELC}tdemdiView.h" + + + %{APPNAMELC}tdemdiView::%{APPNAMELC}tdemdiView( TQWidget *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<KParts::ReadWritePart *>(factory->create( + this, "katepart", "KParts::ReadWritePart" )); + + if (m_part) + { + part()->widget()->setFocus(); + setFocusProxy(part()->widget()); + + TQBoxLayout* layout = new TQHBoxLayout(this, 0, -1, "kdissertviewlayout" ); + part()->widget()->reparent( this, TQPoint(0, 0) ); + layout->addWidget( part()->widget() ); + + // connect( m_part, TQT_SIGNAL(stateChanged()), this, TQT_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}tdemdiView::~%{APPNAMELC}tdemdiView() +{ + delete m_part->widget(); +} + +#include "%{APPNAMELC}tdemdiView.moc" diff --git a/languages/cpp/app_templates/kscons_tdemdi/apptdemdiView.h b/languages/cpp/app_templates/kscons_tdemdi/apptdemdiView.h new file mode 100644 index 00000000..00109fdb --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/apptdemdiView.h @@ -0,0 +1,30 @@ +%{H_TEMPLATE} + +#ifndef _%{APPNAMEUC}KMDIVIEW_H +#define _%{APPNAMEUC}KMDIVIEW_H + +#include <tdeparts/part.h> +#include <tdemdichildview.h> +#include <tdemdichildfrm.h> + +/** + * This class serves as the %{APPNAMELC}tdemdi view. + * + * @short main view class + */ +class %{APPNAMELC}tdemdiView : public KMdiChildView +{ + Q_OBJECT + + public: + %{APPNAMELC}tdemdiView( TQWidget *parentWidget=0L, const char *name=0L ); + virtual ~%{APPNAMELC}tdemdiView(); + + KParts::ReadWritePart *part() { return m_part; } + + private: + KParts::ReadWritePart *m_part; +}; + +#endif // _%{APPNAMEUC}KMDIVIEW_H + diff --git a/languages/cpp/app_templates/kscons_tdemdi/kscons_tdemdi.kdevtemplate b/languages/cpp/app_templates/kscons_tdemdi/kscons_tdemdi.kdevtemplate new file mode 100644 index 00000000..635d40d8 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/kscons_tdemdi.kdevtemplate @@ -0,0 +1,271 @@ +# TDE 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]=Многооконное приложение TDE на базе 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++/TDE +Icon=kscons_tdemdi.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 TDE-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]=Создание полноценного многооконного приложения TDE. Для сборки и установки этого приложения будут использованы скрипты 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_tdemdi.tar.gz + +[SCONS] +Type=include +File=%{tdevelop}/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=%{tdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE3] +Type=install +EscapeXML=true +Source=%{src}/app.tdevelop +Dest=%{dest}/%{APPNAMELC}.tdevelop + +[FILE4] +Type=install +Source=%{src}/SConstruct +Dest=%{dest}/SConstruct + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE6] +Type=install +Source=%{tdevelop}/template-common/tde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE7] +Type=install +Source=%{tdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE8] +Type=install +Source=%{tdevelop}/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}/apptdemdi.cpp +Dest=%{dest}/src/%{APPNAMELC}tdemdi.cpp + +[FILE12] +Type=install +Source=%{src}/apptdemdi.h +Dest=%{dest}/src/%{APPNAMELC}tdemdi.h + +[FILE13] +Type=install +EscapeXML=true +Source=%{src}/prefs.ui +Dest=%{dest}/src/prefs.ui + +[FILE14] +Type=install +Source=%{src}/apptdemdiView.cpp +Dest=%{dest}/src/%{APPNAMELC}tdemdiView.cpp + +[FILE15] +Type=install +Source=%{src}/apptdemdiView.h +Dest=%{dest}/src/%{APPNAMELC}tdemdiView.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}/tdemdikonsole.cpp +Dest=%{dest}/src/tdemdikonsole.cpp + +[FILE32] +Type=install +Source=%{src}/tdemdikonsole.h +Dest=%{dest}/src/tdemdikonsole.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=%{tdevelop}/template-common/tde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE37] +Type=install +Source=%{tdevelop}/template-common/tde-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 TDE application with scons scripts was created in %{dest} +Comment[ca]=Una aplicació per al TDE amb scripts en Scons ha estat creada e n %{dest} +Comment[da]=Et TDE program med scons-scripter blev oprette i %{dest} +Comment[de]=Eine TDE-Anwendung mit Scons-Skripten wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή TDE με σενάρια scons δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación para TDE con guiones de Scons ha sido creada en %{dest} +Comment[et]=TDE rakendus Sconsi skriptidega loodi asukohta %{dest} +Comment[eu]=Scons script-dun TDE aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد TDE با دستنوشتههای scons در %{dest} ایجاد شد +Comment[fr]=Une application TDE comprenant des scripts Scons a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár TDE le scripteanna scons i %{dest} +Comment[gl]=Creouse unha aplicación TDE con scripts scons en %{dest} +Comment[hu]=Létrejött egy Scons-szkripteket használó TDE-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione TDE con gli script scons in %{dest} +Comment[ja]=Scons スクリプトを使った TDE アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en TDE-Programm mit scons-Skripten opstellt +Comment[ne]=स्कोन स्क्रिप्टसँग केडीई अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een TDE applicatie inclusief Scons-scripts is aangemaakt in %{dest} +Comment[pl]=Program TDE ze skryptami scons utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação do TDE com ficheiros do 'scons' em %{dest} +Comment[pt_BR]=Foi criada uma aplicação do TDE com ficheiros do 'scons' em %{dest} +Comment[ru]=Приложение TDE со скриптами Scons создано в %{dest} +Comment[sk]=TDE aplikácia so scons skriptom bola vytvorená v %{dest} +Comment[sr]=TDE програм са scons скриптама направљен је у %{dest} +Comment[sr@Latn]=TDE program sa scons skriptama napravljen je u %{dest} +Comment[sv]=Ett TDE-program med Scons-skript skapades i %{dest} +Comment[tr]=Scons betikleri olan bir TDE uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了带 scons 脚本的 TDE 应用程序 +Comment[zh_TW]=一個內含 scons 文稿的 TDE 應用程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/kscons_tdemdi/kscons_tdemdi.png b/languages/cpp/app_templates/kscons_tdemdi/kscons_tdemdi.png Binary files differnew file mode 100644 index 00000000..72a347ee --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/kscons_tdemdi.png diff --git a/languages/cpp/app_templates/kscons_tdemdi/main.cpp b/languages/cpp/app_templates/kscons_tdemdi/main.cpp new file mode 100644 index 00000000..ccfc4fac --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/main.cpp @@ -0,0 +1,60 @@ +%{CPP_TEMPLATE} + +#include <kurl.h> +#include <kapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <klocale.h> + +#include "%{APPNAMELC}tdemdi.h" + +static const char description[] = +I18N_NOOP("A simple tdemdi 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) +{ + TDEAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description, + TDEAboutData::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" ); + + TDECmdLineArgs::init(argc, argv, &about); + TDECmdLineArgs::addCmdLineOptions(options); + + TDEApplication app; + + // see if we are starting with session management + /*if (app.isRestored()) + { + RESTORE((%{APPNAME}); + } else */ + { + // no session.. just start up normally + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + %{APPNAMELC}tdemdi *widget = new %{APPNAMELC}tdemdi( 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_tdemdi/messages.sh b/languages/cpp/app_templates/kscons_tdemdi/messages.sh new file mode 100755 index 00000000..a0ce678a --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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 + +TDEDIR=`tde-config --prefix` +EXTRACTRC=extractrc +TDEPOT=`tde-config --prefix`/include/kde.pot +XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x $TDEPOT " + +## check that kde.pot is available +if ! test -e $TDEPOT; then + echo "$TDEPOT 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_tdemdi/prefs.ui b/languages/cpp/app_templates/kscons_tdemdi/prefs.ui new file mode 100644 index 00000000..7830280b --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/prefs.ui @@ -0,0 +1,30 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>prefs</class> +<widget class="TQWidget"> +<property name="name"> +<cstring>prefs</cstring> +</property> +<property name="geometry"> +<rect> +<x>0</x> +<y>0</y> +<width>241</width> +<height>47</height> +</rect> +</property> +<grid> +<property name="name"> +<cstring>unnamed</cstring> +</property> +<widget class="TQCheckBox" row="0" column="0"> +<property name="name"> +<cstring>kcfg_showCloseTabsButton</cstring> +</property> +<property name="text"> +<string>Show close buttons on the right of tabs</string> +</property> +</widget> +</grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/languages/cpp/app_templates/kscons_tdemdi/settings.kcfgc b/languages/cpp/app_templates/kscons_tdemdi/settings.kcfgc new file mode 100644 index 00000000..384510cd --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/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_tdemdi/tdemdikonsole.cpp b/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp new file mode 100644 index 00000000..0eab6525 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp @@ -0,0 +1,76 @@ +%{CPP_TEMPLATE} + +#include <tqfileinfo.h> +#include <tqframe.h> + +#include <tdeparts/part.h> +#include <kate/document.h> +#include <kate/view.h> +#include <klocale.h> +#include <klibloader.h> +#include <kurl.h> + +#include "tdemdikonsole.h" + +tdemdikonsole::tdemdikonsole(TQWidget *parent, const char *name) : TQVBox(parent, name) +{ + m_haskonsole = false; + respawn(); +} + +tdemdikonsole::~tdemdikonsole() +{ +} + +void tdemdikonsole::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(TQFRAME_OBJECT_NAME_STRING)) + ((TQFrame*)m_part->widget())->setFrameStyle(TQFrame::Panel|TQFrame::Sunken); + + m_haskonsole=true; + connect( m_part, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotDestroyed()) ); + + m_part->widget()->show(); + show(); +} + +void tdemdikonsole::setDirectory(const TQString &dirname) +{ + if (m_haskonsole) + { + KURL url(dirname); + if (m_part->url() != url) + m_part->openURL(url); + } +} + +void tdemdikonsole::showEvent(TQShowEvent *ev) +{ + TQWidget::showEvent(ev); + activate(); +} + +void tdemdikonsole::activate() +{ + if (m_haskonsole) + { + m_part->widget()->show(); + setFocusProxy(m_part->widget()); + m_part->widget()->setFocus(); + } +} + +void tdemdikonsole::slotDestroyed() +{ + m_haskonsole=false; + respawn(); +} + +#include "tdemdikonsole.moc" diff --git a/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.h b/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.h new file mode 100644 index 00000000..db4a4323 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.h @@ -0,0 +1,33 @@ +%{H_TEMPLATE} + +#ifndef KMDIKONSOLE_H +#define KMDIKONSOLE_H + +#include <tqvbox.h> + +class tdemdikonsole : public TQVBox +{ + Q_OBJECT + + + public: + tdemdikonsole( TQWidget* parent, const char* name=0); + ~tdemdikonsole(); + + public slots: + void setDirectory(const TQString & dir); + void activate(); + + private slots: + void slotDestroyed(); + void respawn(); + + protected: + void showEvent(TQShowEvent *ev); + + private: + KParts::ReadOnlyPart *m_part; + bool m_haskonsole; +}; + +#endif // KMDIKONSOLE_H diff --git a/languages/cpp/app_templates/kscons_tdemdi/tips b/languages/cpp/app_templates/kscons_tdemdi/tips new file mode 100644 index 00000000..b9618b42 --- /dev/null +++ b/languages/cpp/app_templates/kscons_tdemdi/tips @@ -0,0 +1,6 @@ +<tip category="help"> +<html> +<p>... that automake was not involved in building this kde application ?</p> +<p>The tdevelop template "kscons_kxt" was used instead.</p> +</html> +</tip> |