summaryrefslogtreecommitdiffstats
path: root/korundum/rubylib/rbkconfig_compiler
diff options
context:
space:
mode:
Diffstat (limited to 'korundum/rubylib/rbkconfig_compiler')
-rw-r--r--korundum/rubylib/rbkconfig_compiler/Makefile.am28
-rw-r--r--korundum/rubylib/rbkconfig_compiler/README.dox251
-rw-r--r--korundum/rubylib/rbkconfig_compiler/TODO1
-rw-r--r--korundum/rubylib/rbkconfig_compiler/autoexample.rb49
-rwxr-xr-xkorundum/rubylib/rbkconfig_compiler/checkkcfg.pl83
-rw-r--r--korundum/rubylib/rbkconfig_compiler/example.kcfg55
-rw-r--r--korundum/rubylib/rbkconfig_compiler/example.rb40
-rw-r--r--korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc18
-rw-r--r--korundum/rubylib/rbkconfig_compiler/general_base.ui46
-rw-r--r--korundum/rubylib/rbkconfig_compiler/kcfg.xsd191
-rw-r--r--korundum/rubylib/rbkconfig_compiler/myoptions_base.ui35
-rw-r--r--korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp1330
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/Makefile.am40
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb5
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg55
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc18
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test1main.rb4
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg78
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc11
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test2main.rb5
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg26
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc12
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test3main.rb4
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg42
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc11
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test4main.rb4
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg42
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc11
-rw-r--r--korundum/rubylib/rbkconfig_compiler/tests/test5main.rb4
29 files changed, 0 insertions, 2499 deletions
diff --git a/korundum/rubylib/rbkconfig_compiler/Makefile.am b/korundum/rubylib/rbkconfig_compiler/Makefile.am
deleted file mode 100644
index 276e32f7..00000000
--- a/korundum/rubylib/rbkconfig_compiler/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-SUBDIRS = . tests
-
-RBUIC=rbuic
-
-.ui.rb:
- $(RBUIC) -tr ${UIC_TR} -kde $*.ui -o $@
-
-exampleprefs_base.rb: $(srcdir)/example.kcfg rbkconfig_compiler $(srcdir)/exampleprefs_base.kcfgc
- ./rbkconfig_compiler $(srcdir)/example.kcfg $(srcdir)/exampleprefs_base.kcfgc
-
-AM_CPPFLAGS = -I$(top_srcdir)/tdecore -I$(top_srcdir) $(all_includes)
-
-bin_PROGRAMS = rbkconfig_compiler
-
-rbkconfig_compiler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
-rbkconfig_compiler_LDADD = $(LIB_TDECORE)
-rbkconfig_compiler_SOURCES = rbkconfig_compiler.cpp
-
-METASOURCES = AUTO
-
-TESTFILES = test1.kcfg test2.kcfg test3.kcfg test4.kcfg test5.kcfg
-
-check-local:
- for i in $(TESTFILES); \
- do xmllint --noout --schema $(srcdir)/kcfg.xsd $(srcdir)/tests/$$i; \
- perl $(top_srcdir)/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl \
- $(top_srcdir)/korundum/rubylib/rbkconfig_compiler/tests/$$i; done
-
diff --git a/korundum/rubylib/rbkconfig_compiler/README.dox b/korundum/rubylib/rbkconfig_compiler/README.dox
deleted file mode 100644
index 5eb9bd17..00000000
--- a/korundum/rubylib/rbkconfig_compiler/README.dox
+++ /dev/null
@@ -1,251 +0,0 @@
-/**
-\page rbkconfig_compiler The KDE Configuration Compiler for Ruby
-
-rbkconfig_compiler generates Ruby source code from an XML file containing
-information about configuration options (.kcfg) and a file that provides
-the code generation options (.kcfgc) The generated class is based on
-KDE::ConfigSkeleton and provides an API for the application to access its
-configuration data.
-
-<h2>XML description of the configuration options</h2>
-
-The structure of the .kcfg file is described by its DTD kcfg.dtd.
-
-The \<kcfgfile\> tag contains the name of the configuration file described.
-Omitting the name will make the generated class use the default configuration
-file ("<appname>rc").
-
-The remaining entries in the XML file are grouped by the tag \<group\>
-which describes the corresponding group in the configuration file.
-
-The individual entries must have at least a name or a key. The name is used to
-create accessor and modifier functions. It's also used as the key in the config
-file. If \<key\> is given, but not \<name\>, the name is constructed by removing
-all spaces from \<key\>.
-
-An entry must also have a type. The list of allowable types is
-specified in the DTD and loosely follows the list of types supported
-by the TQt::Variant with exception of the clearly binary types
-(e.g. Pixmap, Image...) which are not supported. Besides those basic
-type the following special types are supported:
-
-- Path This is a string that is specially treated as a file-path.
- In particular paths in the home directory are prefixed with $HOME in
- when being stored in the configuration file.
-
-- Enum This indicates an enumeration. The possible enum values should
- be provided via the \<choices\> tag. Enum values are accessed as integers
- by the application but stored as string in the configuration file. This
- makes it possible to add more values at a later date without breaking
- compatibility.
-
-- IntList This indicates a list of integers. This information is provided
- to the application as an Array of Integers. Useful for storing TQt::Splitter
- geometries.
-
-An entry can optionally have a default value which is used as default when
-the value isn't specified in any config file. Default values are interpreted
-as literal constant values. If a default value needs to be computed
-or if it needs to be obtained from a function call, the \<default\> tag
-should contain the code="true" attribute. The contents of the \<default\>
-tag is then considered to be a ruby expression.
-
-Additional code for computing default values can be provided via
-the \<code\> tag. The contents of the \<code\> tag is inserted as-is. A
-typical use for this is to compute a common default value which can
-then be referenced by multiple entries that follow.
-
-<h2>Code generation options</h2>
-
-The options for generating the Ruby sources are read from the file with the
-extension .kcfgc. To generate a class add the corresponding kcfgc file to the
-SOURCES line in the Makefile.am.
-
-The following options are read from the kcfgc file:
-
-<table>
-<tr>
- <td><b><i>Name</i></b></td>
- <td><b><i>Type</i></b></td>
- <td><b><i>Default</i></b></td>
- <td><b><i>Description</i></b></td>
-</tr>
-<tr>
- <td><b>File</b></td>
- <td>string</td>
- <td>programname.kcfg</td>
- <td>Name of kcfg file containing the options the class is generated for</td>
-</tr>
-<tr>
- <td><b>NameSpace</b></td>
- <td>string</td>
- <td>-</td>
- <td>Optional namespace for generated class</td>
-</tr>
-<tr>
- <td><b>ClassName</b></td>
- <td>string</td>
- <td>-</td>
- <td>Name of generated class (required)</td>
-</tr>
-<tr>
- <td><b>Inherits</b></td>
- <td>string</td>
- <td>TDEConfigSkeleton</td>
- <td>Class the generated class inherits from. This class must inherit
- TDEConfigSkeleton.</td>
-</tr>
-<tr>
- <td><b>Visibility</b></td>
- <td>string</td>
- <td>-</td>
- <td>Inserts visibility directive (for example KDE_EXPORT) between "class" keyword and class
- name in header file</td>
-</tr>
-<tr>
- <td><b>Singleton</b></td>
- <td>bool</td>
- <td>false</td>
- <td>Generated class is a singleton.</td>
-</tr>
-<tr>
- <td><b>CustomAdditions</b></td>
- <td>bool</td>
- <td>-</td>
- <td></td>
-</tr>
-<tr>
- <td><b>MemberVariables</b></td>
- <td>string: public|protected|private</td>
- <td>private</td>
- <td>C++ access modifier used for memeber variables holding the configuration
- valuse</td>
-</tr>
-<tr>
- <td><b>IncludeFiles</b></td>
- <td>comma separated list of strings</td>
- <td>-</td>
- <td>Names of files to be included in the header of the generated class</td>
-</tr>
-<tr>
- <td><b>Mutators</b></td>
- <td>true, false or a comma seperated list of options</td>
- <td>-</td>
- <td>If true, mutator functions for all configuration options are generated.
- If false, no mutator functions are generated. If a list is provided,
- mutator functions are generated for the options that are listed.</td>
-</tr>
-<tr>
- <td><b>ItemAccessors</b></td>
- <td>bool</td>
- <td>false</td>
- <td>Generate accessor functions for the TDEConfigSkeletonItem objects
- corresponding to the configuration options. If <b>SetUserTexts</b> is set,
- <b>ItemAccessors</b> also has to be set.</td>
-</tr>
-<tr>
- <td><b>SetUserTexts</b></td>
- <td>bool</td>
- <td>false</td>
- <td>Set the label and whatthis texts of the items from the kcfg file.If
- <b>SetUserTexts</b> is set, <b>ItemAccessors</b> also has to be set.</td>
-</tr>
-<tr>
- <td><b>GlobalEnums</b></td>
- <td>bool</td>
- <td>false</td>
- <td>If set to true all choices of Enum items will be created in the global
- scope of the generated class. If set to false, each Enum item will get an own
- namespace for its choices.</td>
-</tr>
-</table>
-
-
-<h2>Advanced options</h2>
-
-There are several possibilities to parameterize entries.
-
-- Parameterized entries
-
-An entry can be parameterized using a fixed range parameter specified with
-the \<parameter\> tag. Such parameter can either be an Enum or an int. An Enum
-parameter should specify the possible enumeration values with the \<choices\>
-tag. An int parameter should specify its maximum value. Its minimum value
-is always 0.
-
-A parameterized entry is expanded to a number of entries, one for each
-value in the parameter range. The name and key should contain a reference
-to the parameter in the form of $(parameter-name). When expanding the entries
-the $(parameter-name) part is replaced with the value of the parameter.
-In the case of an Enum parameter it is replaced with the name of the
-enumuration value. In the case of an int parameter it is replaced with
-the numeric value of the parameter.
-
-Parameterized entries all share the same default value unless different
-default values have been specified for specific parameter values.
-This can be done with the param= attribute of the \<default\>. When a
-param attribute is specified the default value only applies to that
-particular parameter value.
-
-Example 1:
-\verbatim
- <entry name="Color$(ColorIndex)" type="Color" key="color_$(ColorIndex)">
- <parameter name="ColorIndex" type="Int" max="3"/>
- <default param="0">#ff0000</default>
- <default param="1">#00ff00</default>
- <default param="2">#0000ff</default>
- <default param="3">#ffff00</default>
- </entry>
-\endverbatim
-
-The above describes 4 color configuration entries with the following defaults:
-
-color_0=#ff0000
-color_1=#00ff00
-color_2=#0000ff
-color_3=#ffff00
-
-The configuration options will be accessible to the application via
-a color(colorIndex) and a
-setColor(colorIndex, v) method.
-
-Example 2:
-\verbatim
- <entry name="Sound$(SoundEvent)" type="String" key="sound_$(SoundEvent)">
- <parameter name="SoundEvent" type="Enum">
- <values>
- <value>Explosion</value>
- <value>Crash</value>
- <value>Missile</value>
- </values>
- </parameter>
- <default param="Explosion">boom.wav</default>
- <default param="Crash">crash.wav</default>
- <default param="Missile">missile.wav</default>
- </entry>
-\endverbatim
-
-The above describes 3 string configuration entries with the following defaults:
-
-sound_Explosion=boom.wav
-sound_Crash=crash.wav
-sound_Missile=missile.wav
-
-The configuration options will be accessible to the application via
-a sound(soundEvent) and a
-setSound(soundEvent, v) method.
-
-- Parameterized groups
-
-...STILL TODO...
-
-
-
-
-
-If you have questions or comments please contact Cornelius Schumacher
-<schumacher@kde.org> or Waldo Bastian <bastian@kde.org>
-
-For Ruby specific questions please contact Richard Dale
-<Richard_Dale@tipitina.demon.co.uk>
-*/
diff --git a/korundum/rubylib/rbkconfig_compiler/TODO b/korundum/rubylib/rbkconfig_compiler/TODO
deleted file mode 100644
index db4137ed..00000000
--- a/korundum/rubylib/rbkconfig_compiler/TODO
+++ /dev/null
@@ -1 +0,0 @@
-- Support linebreaks in whasthis texts in the kcfg file.
diff --git a/korundum/rubylib/rbkconfig_compiler/autoexample.rb b/korundum/rubylib/rbkconfig_compiler/autoexample.rb
deleted file mode 100644
index 8526c93d..00000000
--- a/korundum/rubylib/rbkconfig_compiler/autoexample.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-=begin
- This file is part of KDE.
-
- Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
-
- 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-=end
-
-require 'Korundum'
-require 'exampleprefs_base.rb'
-require 'general_base.rb'
-require 'myoptions_base.rb'
-
- aboutData = KDE::AboutData.new( "example", I18N_NOOP("autoconfig example"), "0.1" )
- aboutData.addAuthor( "Cornelius Schumacher", nil, "schumacher@kde.org" )
-
- KDE::CmdLineArgs.init( ARGV, aboutData )
-
- app = KDE::Application.new
-
- configSkeleton = ExamplePrefsBase.new( "dummy1", "dummy2" )
- configSkeleton.readConfig()
-
- dialog = KDE::ConfigDialog.new( nil, "settings", configSkeleton )
-
- general = GeneralBase.new(nil)
- dialog.addPage( general, app.i18n("General"), "General", "" )
-
- myOptions = MyOptionsBase.new( nil )
- dialog.addPage( myOptions, app.i18n("MyOptions"), "MyOptions", "" )
-
- app.mainWidget = dialog
-
- dialog.show()
-
- app.exec
diff --git a/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl b/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl
deleted file mode 100755
index 2eddbeee..00000000
--- a/korundum/rubylib/rbkconfig_compiler/checkkcfg.pl
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/perl
-
-if ( @ARGV != 1 ) {
- print STDERR "Missing arg: filename\n";
- exit 1;
-}
-
-$file = $ARGV[0];
-
-$file =~ /^(.*)\.[^\.]*$/;
-$filebase = $1;
-
-$file_h = "$filebase.h";
-$file_cpp = "$filebase.cpp";
-
-$kcfgc = $file . "c";
-
-$cmd = "./kconfig_compiler $file $kcfgc";
-
-#print "CMD $cmd\n";
-
-if ( system( $cmd ) != 0 ) {
- print STDERR "Unable to run kconfig_compiler\n";
- exit 1;
-}
-
-checkfile( $file_h );
-checkfile( $file_cpp );
-
-exit 0;
-
-sub checkfile()
-{
- my $file = shift;
-
- $file =~ /\/([^\/]*)$/;
- my $filename = $1;
-
- print "Checking '$filename':\n";
-
- my @ref;
- if ( !open( REF, "$file.ref" ) ) {
- print STDERR "Unable to open $file.ref\n";
- exit 1;
- }
- while( <REF> ) {
- push @ref, $_;
- }
- close REF;
-
- if ( !open( READ, $filename ) ) {
- print STDERR "Unable to open $filename\n";
- exit 1;
- }
-
- $error = 0;
- $i = 0;
- $line = 1;
- while( <READ> ) {
- $out = $_;
- $ref = @ref[$i++];
-
- if ( $out ne $ref ) {
- $error++;
- print " Line $line: Expected : $ref";
- print " Line $line: Compiler output : $out";
- }
-
- $line++;
- }
-
- close READ;
-
- if ( $error > 0 ) {
- print "\n FAILED: $error errors found.\n";
- if ( $error > 5 ) {
- system( "diff -u $file.ref $filename" );
- }
- exit 1;
- } else {
- print " OK\n";
- }
-}
diff --git a/korundum/rubylib/rbkconfig_compiler/example.kcfg b/korundum/rubylib/rbkconfig_compiler/example.kcfg
deleted file mode 100644
index 055958b4..00000000
--- a/korundum/rubylib/rbkconfig_compiler/example.kcfg
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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" >
- <include>qdir.h</include>
- <kcfgfile name="examplerc">
- <parameter name="transport" />
- <parameter name="folder" />
- </kcfgfile>
- <group name="General-$(folder)">
- <entry name="OneOption" type="Bool">
- <label>One option</label>
- <default>true</default>
- </entry>
- <entry name="AnotherOption" type="Int" key="Another Option">
- <label>Another option</label>
- <default>5</default>
- </entry>
- <entry name="ListOption" type="Enum">
- <label>This is some funky option</label>
- <whatsthis>And this is a longer description of this option. Just wondering, how will the translations of those be handled?</whatsthis>
- <choices>
- <choice name="One"/>
- <choice name="Two"/>
- <choice name="Three"/>
- </choices>
- <default>One</default>
- </entry>
- </group>
- <group name="MyOptions">
- <entry name="MyString" type="String">
- <label>This is a string</label>
- <default>Default String</default>
- </entry>
- <entry name="MyPath" type="Path">
- <label>This is a path</label>
- <default code="true">TQt::Dir.homeDirPath()+".hidden_file"</default>
- </entry>
- <entry name="AnotherOption2" type="Int" key="Another Option">
- <label>Another option</label>
- <default>10</default>
- </entry>
- <entry name="MyStringList" type="StringList">
- <default>up,down</default>
- </entry>
- <entry name="MyStringListHidden" hidden="true" type="StringList">
- <default>up,down</default>
- </entry>
- <entry name="MyNumber" type="Int64" key="List-$(transport)-$(folder)">
- <label>List Number</label>
- <default>1</default>
- </entry>
- </group>
-</kcfg>
diff --git a/korundum/rubylib/rbkconfig_compiler/example.rb b/korundum/rubylib/rbkconfig_compiler/example.rb
deleted file mode 100644
index 9ed4d9c4..00000000
--- a/korundum/rubylib/rbkconfig_compiler/example.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-=begin
- This file is part of KDE.
-
- Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
-
- 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-=end
-
-require 'Korundum'
-require 'exampleprefs_base.rb'
-
- aboutData = KDE::AboutData.new( "example", I18N_NOOP("cfgc example"), "0.1" )
- aboutData.addAuthor( "Cornelius Schumacher", nil, "schumacher@kde.org" )
-
- KDE::CmdLineArgs.init( ARGV, aboutData )
-
- app = KDE::Application.new
-
- prefs = ExamplePrefsBase.new("Trans1", "Folder2")
-
- prefs.readConfig()
-
- prefs.setAnotherOption(17)
-
-
- tqWarning("Another Option = %d" % prefs.anotherOption())
- tqWarning("Another Option2 = %d" % prefs.anotherOption2())
diff --git a/korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc b/korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc
deleted file mode 100644
index a9ac98dc..00000000
--- a/korundum/rubylib/rbkconfig_compiler/exampleprefs_base.kcfgc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Code generation options for kconfig_compiler
-ClassName=ExamplePrefsBase
-#
-# Singleton=false
-#
-# Inherits=TDEConfigSkeleton
-#
-# IncludeFiles=libtdepim/kpimprefs.h
-#
-# MemberVariables=public
-#
-### The following line includes the file exampleprefs_base_addon.h
-### It can be used to add extra functions and variables to the
-### class.
-# CustomAdditions=true
-#
-### Provide setFooBar(int) style functions
-Mutators=true
diff --git a/korundum/rubylib/rbkconfig_compiler/general_base.ui b/korundum/rubylib/rbkconfig_compiler/general_base.ui
deleted file mode 100644
index 4a76cc34..00000000
--- a/korundum/rubylib/rbkconfig_compiler/general_base.ui
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
-<class>GeneralBase</class>
-<widget class="TQWidget">
- <property name="name">
- <cstring>GeneralBase</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>600</width>
- <height>486</height>
- </rect>
- </property>
- <property name="caption">
- <string>AutoExampleDialog</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQCheckBox" row="0" column="1">
- <property name="name">
- <cstring>kcfg_OneOption</cstring>
- </property>
- <property name="text">
- <string>OneOption</string>
- </property>
- </widget>
- <widget class="TQSpinBox" row="1" column="1">
- <property name="name">
- <cstring>kcfg_AnotherOption2</cstring>
- </property>
- </widget>
- <widget class="TQLabel" row="1" column="0">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>AnotherOption:</string>
- </property>
- </widget>
- </grid>
-</widget>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/korundum/rubylib/rbkconfig_compiler/kcfg.xsd b/korundum/rubylib/rbkconfig_compiler/kcfg.xsd
deleted file mode 100644
index d505a514..00000000
--- a/korundum/rubylib/rbkconfig_compiler/kcfg.xsd
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!-- kcfg XSD v1.0 -->
-<xsd:schema
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://www.kde.org/standards/kcfg/1.0"
- xmlns:kcfg="http://www.kde.org/standards/kcfg/1.0"
- targetNamespace="http://www.kde.org/standards/kcfg/1.0"
- version="1.0"
- elementFormDefault="qualified" >
-
- <xsd:annotation>
- <xsd:documentation>
-
- Copyright (c) 2003 Cornelius Schumacher &lt;schumacher@kde.org&gt;
- Copyright (c) 2003 Waldo Bastian &lt;bastian@kde.org&gt;
- Copyright (c) 2003 Zack Rusin &lt;zack@kde.org&gt;
- Copyright (c) 2004 Frans Englich &lt;frans.englich@telia.com&gt;
-
- Permission to use, copy, modify and distribute this DTD
- and its accompanying documentation for any purpose and without fee
- is hereby granted in perpetuity, provided that the above copyright
- notice and this paragraph appear in all copies. The copyright
- holders make no representation about the suitability of the DTD for
- any purpose. It is provided "as is" without expressed or implied
- warranty.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:annotation>
- <xsd:documentation>
-
- A Schema for KDE's TDEConfigXT XML format. It is similar to the DTD
- found at:
-
- http://www.kde.org/standards/kcfg/1.0/kcfg.dtd
-
- Documents valid against the Schema version are backwards compatible
- to the DTD. Validating against the Schema instead of the DTD is
- recommended, since the former provides better validation.
-
- A document instance of this Schema should have a declaration
- looking like this:
-
- <![CDATA[
-
- <?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" >
- <!-- the content -->
- </kcfg>
-
- ]]>
-
- </xsd:documentation>
- </xsd:annotation>
-
- <xsd:element name="kcfg">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="include" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
- <xsd:element name="kcfgfile" >
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="parameter" type="kcfg:parameter" minOccurs="0" maxOccurs="unbounded" />
- <!-- FIXME: Are really unbounded occurances of parameter allowed? -->
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="optional"/>
- <xsd:attribute name="arg" type="xsd:boolean" use="optional"/>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="group" maxOccurs="unbounded" >
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="entry" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="parameter" minOccurs="0" type="kcfg:parameter"/>
- <xsd:element name="label" minOccurs="0" type="xsd:string"/>
- <xsd:element name="whatsthis" minOccurs="0" type="xsd:string"/>
- <xsd:element name="choices" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="choice" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:all>
- <xsd:element minOccurs="0" name="label" type="xsd:string"/>
- <xsd:element minOccurs="0" name="whatsthis" type="xsd:string"/>
- </xsd:all>
- <xsd:attribute name="name" use="required" type="xsd:string"/>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="code" minOccurs="0" type="kcfg:code"/>
-
- <xsd:element name="default" maxOccurs="unbounded" minOccurs="0" >
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute use="optional" name="code" type="xsd:boolean"/>
- <xsd:attribute use="optional" name="param" type="xsd:string"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="min" minOccurs="0" >
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="code" type="xsd:boolean"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="max" minOccurs="0">
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="code" type="xsd:boolean"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
-
- </xsd:choice>
- <xsd:attribute name="name" use="optional" type="xsd:string"/>
- <xsd:attribute name="key" use="optional" type="xsd:string"/>
- <xsd:attribute name="hidden" use="optional" type="xsd:boolean"/>
- <xsd:attribute name="type" type="kcfg:datatype"/>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string"/>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:simpleType name="datatype">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="String"/>
- <xsd:enumeration value="StringList"/>
- <xsd:enumeration value="Font"/>
- <xsd:enumeration value="Rect"/>
- <xsd:enumeration value="Size"/>
- <xsd:enumeration value="Color"/>
- <xsd:enumeration value="Point"/>
- <xsd:enumeration value="Int"/>
- <xsd:enumeration value="UInt"/>
- <xsd:enumeration value="Bool"/>
- <xsd:enumeration value="Double"/>
- <xsd:enumeration value="DateTime"/>
- <xsd:enumeration value="Int64"/>
- <xsd:enumeration value="UInt64"/>
- <xsd:enumeration value="IntList"/>
- <xsd:enumeration value="Enum"/>
- <xsd:enumeration value="Path"/>
- <xsd:enumeration value="Password"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:complexType name="parameter">
- <xsd:sequence>
- <xsd:element minOccurs="0" name="values">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" maxOccurs="unbounded" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string"/>
- <xsd:attribute name="type" use="optional" type="kcfg:datatype" />
- <xsd:attribute name="max" use="optional" type="xsd:positiveInteger"/>
- </xsd:complexType>
-
- <xsd:complexType name="code">
- <xsd:simpleContent>
- <xsd:extension base="xsd:string"/>
- </xsd:simpleContent>
- </xsd:complexType>
-
-</xsd:schema>
-
diff --git a/korundum/rubylib/rbkconfig_compiler/myoptions_base.ui b/korundum/rubylib/rbkconfig_compiler/myoptions_base.ui
deleted file mode 100644
index aa3148a4..00000000
--- a/korundum/rubylib/rbkconfig_compiler/myoptions_base.ui
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
-<class>MyOptionsBase</class>
-<widget class="TQWidget">
- <property name="name">
- <cstring>MyOptionsBase</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>600</width>
- <height>486</height>
- </rect>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel" row="0" column="0">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>MyString:</string>
- </property>
- </widget>
- <widget class="TQLineEdit" row="0" column="1">
- <property name="name">
- <cstring>kcfg_MyString</cstring>
- </property>
- </widget>
- </grid>
-</widget>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp b/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp
deleted file mode 100644
index c29cb838..00000000
--- a/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp
+++ /dev/null
@@ -1,1330 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
-/*
- This file is part of KDE.
-
- Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
- Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
- Copyright (c) 2003 Zack Rusin <zack@kde.org>
-
- 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <tqfile.h>
-#include <tqtextstream.h>
-#include <tqdom.h>
-#include <tqregexp.h>
-
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kcmdlineargs.h>
-#include <kglobal.h>
-#include <kconfig.h>
-#include <ksimpleconfig.h>
-#include <kstandarddirs.h>
-
-#include <iostream>
-
-static const KCmdLineOptions options[] =
-{
- { "d", 0, 0 },
- { "directory <dir>", I18N_NOOP("Directory to generate files in"), "." },
- { "+file.kcfg", I18N_NOOP("Input kcfg XML file"), 0 },
- { "+file.kcfgc", I18N_NOOP("Code generation options file"), 0 },
- KCmdLineLastOption
-};
-
-
-bool globalEnums;
-bool itemAccessors;
-TQStringList allNames;
-TQRegExp *validNameRegexp;
-
-class CfgEntry
-{
- public:
- struct Choice
- {
- TQString name;
- TQString label;
- TQString whatsThis;
- };
-
- CfgEntry( const TQString &group, const TQString &type, const TQString &key,
- const TQString &name, const TQString &label,
- const TQString &whatsThis, const TQString &code,
- const TQString &defaultValue, const TQValueList<Choice> &choices,
- bool hidden )
- : mGroup( group ), mType( type ), mKey( key ), mName( name ),
- mLabel( label ), mWhatsThis( whatsThis ), mCode( code ),
- mDefaultValue( defaultValue ),
- mChoices( choices ), mHidden( hidden )
- {
- }
-
- void setGroup( const TQString &group ) { mGroup = group; }
- TQString group() const { return mGroup; }
-
- void setType( const TQString &type ) { mType = type; }
- TQString type() const { return mType; }
-
- void setKey( const TQString &key ) { mKey = key; }
- TQString key() const { return mKey; }
-
- void setName( const TQString &name ) { mName = name; }
- TQString name() const { return mName; }
-
- void setLabel( const TQString &label ) { mLabel = label; }
- TQString label() const { return mLabel; }
-
- void setWhatsThis( const TQString &whatsThis ) { mWhatsThis = whatsThis; }
- TQString whatsThis() const { return mWhatsThis; }
-
- void setDefaultValue( const TQString &d ) { mDefaultValue = d; }
- TQString defaultValue() const { return mDefaultValue; }
-
- void setCode( const TQString &d ) { mCode = d; }
- TQString code() const { return mCode; }
-
- void setMinValue( const TQString &d ) { mMin = d; }
- TQString minValue() const { return mMin; }
-
- void setMaxValue( const TQString &d ) { mMax = d; }
- TQString maxValue() const { return mMax; }
-
- void setParam( const TQString &d ) { mParam = d; }
- TQString param() const { return mParam; }
-
- void setParamName( const TQString &d ) { mParamName = d; }
- TQString paramName() const { return mParamName; }
-
- void setParamType( const TQString &d ) { mParamType = d; }
- TQString paramType() const { return mParamType; }
-
- void setChoices( const TQValueList<Choice> &d ) { mChoices = d; }
- TQValueList<Choice> choices() const { return mChoices; }
-
- void setParamValues( const TQStringList &d ) { mParamValues = d; }
- TQStringList paramValues() const { return mParamValues; }
-
- void setParamDefaultValues( const TQStringList &d ) { mParamDefaultValues = d; }
- TQString paramDefaultValue(int i) const { return mParamDefaultValues[i]; }
-
- void setParamMax( int d ) { mParamMax = d; }
- int paramMax() const { return mParamMax; }
-
- bool hidden() const { return mHidden; }
-
- void dump() const
- {
- kdDebug() << "<entry>" << endl;
- kdDebug() << " group: " << mGroup << endl;
- kdDebug() << " type: " << mType << endl;
- kdDebug() << " key: " << mKey << endl;
- kdDebug() << " name: " << mName << endl;
- kdDebug() << " label: " << mLabel << endl;
-// whatsthis
- kdDebug() << " code: " << mCode << endl;
-// kdDebug() << " values: " << mValues.join(":") << endl;
-
- if (!param().isEmpty())
- {
- kdDebug() << " param name: "<< mParamName << endl;
- kdDebug() << " param type: "<< mParamType << endl;
- kdDebug() << " paramvalues: " << mParamValues.join(":") << endl;
- }
- kdDebug() << " default: " << mDefaultValue << endl;
- kdDebug() << " hidden: " << mHidden << endl;
- kdDebug() << " min: " << mMin << endl;
- kdDebug() << " max: " << mMax << endl;
- kdDebug() << "</entry>" << endl;
- }
-
- private:
- TQString mGroup;
- TQString mType;
- TQString mKey;
- TQString mName;
- TQString mLabel;
- TQString mWhatsThis;
- TQString mCode;
- TQString mDefaultValue;
- TQString mParam;
- TQString mParamName;
- TQString mParamType;
- TQValueList<Choice> mChoices;
- TQStringList mParamValues;
- TQStringList mParamDefaultValues;
- int mParamMax;
- bool mHidden;
- TQString mMin;
- TQString mMax;
-};
-
-
-static TQString varName(const TQString &n)
-{
- TQString result = "@"+n;
- result[1] = result[1].lower();
- return result;
-}
-
-static TQString enumName(const TQString &n)
-{
- TQString result = "Enum"+n;
- result[4] = result[4].upper();
- return result;
-}
-
-static TQString enumValue(const TQString &n)
-{
- TQString result = n;
- result[0] = result[0].upper();
- return result;
-}
-
-static TQString setFunction(const TQString &n)
-{
- TQString result = "set"+n;
- result[3] = result[3].upper();
- return result;
-}
-
-
-static TQString getFunction(const TQString &n)
-{
- TQString result = n;
- result[0] = result[0].lower();
- return result;
-}
-
-
-static void addQuotes( TQString &s )
-{
- if ( s.left( 1 ) != "\"" ) s.prepend( "\"" );
- if ( s.right( 1 ) != "\"" ) s.append( "\"" );
-}
-
-static TQString quoteString( const TQString &s )
-{
- TQString r = s;
- r.replace( "\\", "\\\\" );
- r.replace( "\"", "\\\"" );
- r.replace( "\r", "" );
- r.replace( "\n", "\\n\"\n\"" );
- return "\"" + r + "\"";
-}
-
-static TQString literalString( const TQString &s )
-{
- bool isAscii = true;
- for(int i = s.length(); i--;)
- if (s[i].unicode() > 127) isAscii = false;
-
- return quoteString(s);
-
-// if (isAscii)
-// return "TQString::fromLatin1( " + quoteString(s) + " )";
-// else
-// return "TQString::fromUtf8( " + quoteString(s) + " )";
-}
-
-static TQString dumpNode(const TQDomNode &node)
-{
- TQString msg;
- TQTextStream s(&msg, IO_WriteOnly );
- node.save(s, 0);
-
- msg = msg.simplifyWhiteSpace();
- if (msg.length() > 40)
- return msg.left(37)+"...";
- return msg;
-}
-
-static TQString filenameOnly(TQString path)
-{
- int i = path.findRev('/');
- if (i >= 0)
- return path.mid(i+1);
- return path;
-}
-
-static void preProcessDefault( TQString &defaultValue, const TQString &name,
- const TQString &type,
- const TQValueList<CfgEntry::Choice> &choices,
- TQString &code )
-{
- if ( type == "String" && !defaultValue.isEmpty() ) {
- defaultValue = literalString(defaultValue);
-
- } else if ( type == "Path" && !defaultValue.isEmpty() ) {
- defaultValue = literalString( defaultValue );
-
- } else if ( type == "StringList" && !defaultValue.isEmpty() ) {
- TQTextStream rb( &code, IO_WriteOnly | IO_Append );
- if (!code.isEmpty())
- rb << endl;
-
-// rb << " TQStringList default" << name << ";" << endl;
- rb << " default" << name << " = []" << endl;
- TQStringList defaults = TQStringList::split( ",", defaultValue );
- TQStringList::ConstIterator it;
- for( it = defaults.begin(); it != defaults.end(); ++it ) {
- rb << " default" << name << " << \"" << *it << "\""
- << endl;
- }
- defaultValue = "default" + name;
-
- } else if ( type == "Color" && !defaultValue.isEmpty() ) {
- TQRegExp colorRe("\\d+,\\s*\\d+,\\s*\\d+");
- if (colorRe.exactMatch(defaultValue))
- {
- defaultValue = "TQt::Color.new( " + defaultValue + " )";
- }
- else
- {
- defaultValue = "TQt::Color.new( \"" + defaultValue + "\" )";
- }
-
- } else if ( type == "Enum" ) {
- if ( !globalEnums ) {
- TQValueList<CfgEntry::Choice>::ConstIterator it;
- for( it = choices.begin(); it != choices.end(); ++it ) {
- if ( (*it).name == defaultValue ) {
- defaultValue.prepend( enumName(name) + "_");
- break;
- }
- }
- }
-
- } else if ( type == "IntList" ) {
- TQTextStream rb( &code, IO_WriteOnly | IO_Append );
- if (!code.isEmpty())
- rb << endl;
-
- rb << " default" << name << " = []" << endl;
- TQStringList defaults = TQStringList::split( ",", defaultValue );
- TQStringList::ConstIterator it;
- for( it = defaults.begin(); it != defaults.end(); ++it ) {
- rb << " default" << name << " << " << *it << ""
- << endl;
- }
- defaultValue = "default" + name;
- }
-}
-
-
-CfgEntry *parseEntry( const TQString &group, const TQDomElement &element )
-{
- bool defaultCode = false;
- TQString type = element.attribute( "type" );
- TQString name = element.attribute( "name" );
- TQString key = element.attribute( "key" );
- TQString hidden = element.attribute( "hidden" );
- TQString label;
- TQString whatsThis;
- TQString defaultValue;
- TQString code;
- TQString param;
- TQString paramName;
- TQString paramType;
- TQValueList<CfgEntry::Choice> choices;
- TQStringList paramValues;
- TQStringList paramDefaultValues;
- TQString minValue;
- TQString maxValue;
- int paramMax = 0;
-
- TQDomNode n;
- for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- TQDomElement e = n.toElement();
- TQString tag = e.tagName();
- if ( tag == "label" ) label = e.text();
- else if ( tag == "whatsthis" ) whatsThis = e.text();
- else if ( tag == "min" ) minValue = e.text();
- else if ( tag == "max" ) maxValue = e.text();
- else if ( tag == "code" ) code = e.text();
- else if ( tag == "parameter" )
- {
- param = e.attribute( "name" );
- paramType = e.attribute( "type" );
- if ( param.isEmpty() ) {
- kdError() << "Parameter must have a name: " << dumpNode(e) << endl;
- return 0;
- }
- if ( paramType.isEmpty() ) {
- kdError() << "Parameter must have a type: " << dumpNode(e) << endl;
- return 0;
- }
- if ((paramType == "Int") || (paramType == "UInt"))
- {
- bool ok;
- paramMax = e.attribute("max").toInt(&ok);
- if (!ok)
- {
- kdError() << "Integer parameter must have a maximum (e.g. max=\"0\"): " << dumpNode(e) << endl;
- return 0;
- }
- }
- else if (paramType == "Enum")
- {
- TQDomNode n2;
- for ( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
- TQDomElement e2 = n2.toElement();
- if (e2.tagName() == "values")
- {
- TQDomNode n3;
- for ( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) {
- TQDomElement e3 = n3.toElement();
- if (e3.tagName() == "value")
- {
- paramValues.append( e3.text() );
- }
- }
- break;
- }
- }
- if (paramValues.isEmpty())
- {
- kdError() << "No values specified for parameter '" << param << "'." << endl;
- return 0;
- }
- paramMax = paramValues.count()-1;
- }
- else
- {
- kdError() << "Parameter '" << param << "' has type " << paramType << " but must be of type int, uint or Enum." << endl;
- return 0;
- }
- }
- else if ( tag == "default" )
- {
- if (e.attribute("param").isEmpty())
- {
- defaultValue = e.text();
- if (e.attribute( "code" ) == "true")
- defaultCode = true;
- }
- }
- else if ( tag == "choices" ) {
- TQDomNode n2;
- for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
- TQDomElement e2 = n2.toElement();
- if ( e2.tagName() == "choice" ) {
- TQDomNode n3;
- CfgEntry::Choice choice;
- choice.name = e2.attribute( "name" );
- if ( choice.name.isEmpty() ) {
- kdError() << "Tag <choice> requires attribute 'name'." << endl;
- }
- for( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) {
- TQDomElement e3 = n3.toElement();
- if ( e3.tagName() == "label" ) choice.label = e3.text();
- if ( e3.tagName() == "whatsthis" ) choice.whatsThis = e3.text();
- }
- choices.append( choice );
- }
- }
- }
- }
-
- bool nameIsEmpty = name.isEmpty();
- if ( nameIsEmpty && key.isEmpty() ) {
- kdError() << "Entry must have a name or a key: " << dumpNode(element) << endl;
- return 0;
- }
-
- if ( key.isEmpty() ) {
- key = name;
- }
-
- if ( nameIsEmpty ) {
- name = key;
- name.replace( " ", TQString::null );
- } else if ( name.contains( ' ' ) ) {
- kdWarning()<<"Entry '"<<name<<"' contains spaces! <name> elements can't contain speces!"<<endl;
- name.remove( ' ' );
- }
-
- if (name.contains("$("))
- {
- if (param.isEmpty())
- {
- kdError() << "Name may not be parameterized: " << name << endl;
- return 0;
- }
- }
- else
- {
- if (!param.isEmpty())
- {
- kdError() << "Name must contain '$(" << param << ")': " << name << endl;
- return 0;
- }
- }
-
- if ( label.isEmpty() ) {
- label = key;
- }
-
- if ( type.isEmpty() ) type = "String"; // XXX : implicit type might be bad
-
- if (!param.isEmpty())
- {
- // Adjust name
- paramName = name;
- name.replace("$("+param+")", TQString::null);
- // Lookup defaults for indexed entries
- for(int i = 0; i <= paramMax; i++)
- {
- paramDefaultValues.append(TQString::null);
- }
-
- TQDomNode n;
- for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- TQDomElement e = n.toElement();
- TQString tag = e.tagName();
- if ( tag == "default" )
- {
- TQString index = e.attribute("param");
- if (index.isEmpty())
- continue;
-
- bool ok;
- int i = index.toInt(&ok);
- if (!ok)
- {
- i = paramValues.findIndex(index);
- if (i == -1)
- {
- kdError() << "Index '" << index << "' for default value is unknown." << endl;
- return 0;
- }
- }
-
- if ((i < 0) || (i > paramMax))
- {
- kdError() << "Index '" << i << "' for default value is out of range [0, "<< paramMax<<"]." << endl;
- return 0;
- }
-
- TQString tmpDefaultValue = e.text();
-
- if (e.attribute( "code" ) != "true")
- preProcessDefault(tmpDefaultValue, name, type, choices, code);
-
- paramDefaultValues[i] = tmpDefaultValue;
- }
- }
- }
-
- if (!validNameRegexp->exactMatch(name))
- {
- if (nameIsEmpty)
- kdError() << "The key '" << key << "' can not be used as name for the entry because "
- "it is not a valid name. You need to specify a valid name for this entry." << endl;
- else
- kdError() << "The name '" << name << "' is not a valid name for an entry." << endl;
- return 0;
- }
-
- if (allNames.contains(name))
- {
- if (nameIsEmpty)
- kdError() << "The key '" << key << "' can not be used as name for the entry because "
- "it does not result in a unique name. You need to specify a unique name for this entry." << endl;
- else
- kdError() << "The name '" << name << "' is not unique." << endl;
- return 0;
- }
- allNames.append(name);
-
- if (!defaultCode)
- {
- preProcessDefault(defaultValue, name, type, choices, code);
- }
-
- CfgEntry *result = new CfgEntry( group, type, key, name, label, whatsThis,
- code, defaultValue, choices,
- hidden == "true" );
- if (!param.isEmpty())
- {
- result->setParam(param);
- result->setParamName(paramName);
- result->setParamType(paramType);
- result->setParamValues(paramValues);
- result->setParamDefaultValues(paramDefaultValues);
- result->setParamMax(paramMax);
- }
- result->setMinValue(minValue);
- result->setMaxValue(maxValue);
-
- return result;
-}
-
-/**
- Return parameter declaration for given type.
-*/
-TQString param( const TQString &type )
-{
- if ( type == "String" ) return "const TQString &";
- else if ( type == "StringList" ) return "const TQStringList &";
- else if ( type == "Font" ) return "const TQFont &";
- else if ( type == "Rect" ) return "const TQRect &";
- else if ( type == "Size" ) return "const TQSize &";
- else if ( type == "Color" ) return "const TQColor &";
- else if ( type == "Point" ) return "const TQPoint &";
- else if ( type == "Int" ) return "int";
- else if ( type == "UInt" ) return "uint";
- else if ( type == "Bool" ) return "bool";
- else if ( type == "Double" ) return "double";
- else if ( type == "DateTime" ) return "const TQDateTime &";
- else if ( type == "Int64" ) return "TQ_INT64";
- else if ( type == "UInt64" ) return "TQ_UINT64";
- else if ( type == "IntList" ) return "const TQValueList<int> &";
- else if ( type == "Enum" ) return "int";
- else if ( type == "Path" ) return "const TQString &";
- else if ( type == "Password" ) return "const TQString &";
- else {
- kdError() <<"rbkconfig_compiler does not support type \""<< type <<"\""<<endl;
- return "TQString"; //For now, but an assert would be better
- }
-}
-
-/**
- Actual Ruby initializer value to give a type.
-*/
-TQString rbType( const TQString &type )
-{
- if ( type == "String" ) return "\"\"";
- else if ( type == "StringList" ) return "[]";
- else if ( type == "Font" ) return "TQt::Font.new";
- else if ( type == "Rect" ) return "TQt::Rect.new";
- else if ( type == "Size" ) return "TQt::Size.new";
- else if ( type == "Color" ) return "TQt::Color.new";
- else if ( type == "Point" ) return "TQt::Point.new";
- else if ( type == "Int" ) return "0";
- else if ( type == "UInt" ) return "0";
- else if ( type == "Bool" ) return "false, 42";
- else if ( type == "Double" ) return "0.0";
- else if ( type == "DateTime" ) return "TQt::DateTime.new";
- else if ( type == "Int64" ) return "0";
- else if ( type == "UInt64" ) return "0";
- else if ( type == "IntList" ) return "[]";
- else if ( type == "Enum" ) return "0";
- else if ( type == "Path" ) return "\"\"";
- else if ( type == "Password" ) return "\"\"";
- else {
- kdError()<<"rbkconfig_compiler does not support type \""<< type <<"\""<<endl;
- return "nil"; //For now, but an assert would be better
- }
-}
-
-TQString defaultValue( const TQString &type )
-{
- if ( type == "String" ) return "\"\""; // Use empty string, not null string!
- else if ( type == "StringList" ) return "[]";
- else if ( type == "Font" ) return "KDE::GlobalSettings.generalFont()";
- else if ( type == "Rect" ) return "TQt::Rect.new()";
- else if ( type == "Size" ) return "TQt::Size.new()";
- else if ( type == "Color" ) return "TQt::Color.new(128, 128, 128)";
- else if ( type == "Point" ) return "TQt::Point.new()";
- else if ( type == "Int" ) return "0";
- else if ( type == "UInt" ) return "0";
- else if ( type == "Bool" ) return "false";
- else if ( type == "Double" ) return "0.0";
- else if ( type == "DateTime" ) return "TQt::DateTime.new()";
- else if ( type == "Int64" ) return "0";
- else if ( type == "UInt64" ) return "0";
- else if ( type == "IntList" ) return "[]";
- else if ( type == "Enum" ) return "0";
- else if ( type == "Path" ) return "\"\""; // Use empty string, not null string!
- else if ( type == "Password" ) return "\"\""; // Use empty string, not null string!
- else {
- kdWarning()<<"Error, rbkconfig_compiler doesn't support the \""<< type <<"\" type!"<<endl;
- return "String"; //For now, but an assert would be better
- }
-}
-
-TQString itemType( const TQString &type )
-{
- TQString t;
-
- t = type;
- t.replace( 0, 1, t.left( 1 ).upper() );
- return t;
-}
-
-static TQString itemVar(const CfgEntry *e)
-{
- if (itemAccessors)
- return varName( e->name() ) + "Item";
-
- return "item" + e->name();
-
-}
-
-TQString newItem( const TQString &type, const TQString &name, const TQString &key,
- const TQString &defaultValue, const TQString &param = TQString::null)
-{
- TQString t = "Item" + itemType( type ) +
- ".new( currentGroup(), " + key + ", " + varName( name ) + param;
- if ( type == "Enum" ) {
- t += ".toInt";
- t += ", values" + name;
- } else if ( type == "Path" ) {
- t += ".toString";
- } else if ( type == "Int64" ) {
- t += ".toLongLong";
- } else {
- t += ".to" + itemType( type );
- }
- if ( !defaultValue.isEmpty() ) {
- t += ", ";
- if ( type == "String" ) t += defaultValue;
- else t+= defaultValue;
- }
- t += " )";
-
- return t;
-}
-
-TQString addItem( const TQString &type, const TQString &name, const TQString &key,
- const TQString &defaultValue, const TQString &param = TQString::null,
- const TQString &paramName = TQString::null )
-{
- TQString t = "addItem" + itemType( type ) +
- "( " + key + ", " + varName( name ) + param;
- if ( type == "Enum" ) t += ", values" + name;
- if ( !defaultValue.isEmpty() ) {
- t += ", ";
- if ( type == "String" ) t += defaultValue;
- else if ( type == "Enum" ) t += enumValue(defaultValue);
- else t+= defaultValue;
- }
-
- if (!paramName.isNull()) {
- t += ", \"" + paramName + "\"";
- }
-
- t += " )";
-
- return t;
-}
-
-TQString paramString(const TQString &s, const CfgEntry *e, int i)
-{
- TQString result = s;
- TQString needle = "$("+e->param()+")";
- if (result.contains(needle))
- {
- TQString tmp;
- if (e->paramType() == "Enum")
- {
- tmp = e->paramValues()[i];
- }
- else
- {
- tmp = TQString::number(i);
- }
-
- result.replace(needle, tmp);
- }
- return result;
-}
-
-TQString paramString(const TQString &group, const TQStringList &parameters)
-{
- TQString paramString = group;
- TQString arguments;
- int i = 0;
- for( TQStringList::ConstIterator it = parameters.begin();
- it != parameters.end(); ++it)
- {
- if (paramString.contains("$("+*it+")"))
- {
- i++;
- paramString.replace("$("+*it+")", "%s");
- if (i > 1) {
- arguments += ", ";
- }
- arguments += " @param"+*it;
- }
- }
- if (arguments.isEmpty())
- return "\""+group+"\"";
-
- if (i == 1) {
- return "\""+paramString+"\" % "+arguments;
- } else {
- return "\""+paramString+"\" % ["+arguments+"]";
- }
-}
-
-/* int i is the value of the parameter */
-TQString userTextsFunctions( CfgEntry *e, TQString itemVarStr=TQString::null, TQString i=TQString::null )
-{
- TQString txt;
- if (itemVarStr.isNull()) itemVarStr=itemVar(e);
- if ( !e->label().isEmpty() ) {
- txt += " " + itemVarStr + ".setLabel( i18n(";
- if ( !e->param().isEmpty() )
- txt += quoteString(e->label().replace("$("+e->param()+")", i));
- else
- txt+= quoteString(e->label());
- txt+= ") )\n";
- }
- if ( !e->whatsThis().isEmpty() ) {
- txt += " " + itemVarStr + ".setWhatsThis( i18n(";
- if ( !e->param().isEmpty() )
- txt += quoteString(e->whatsThis().replace("$("+e->param()+")", i));
- else
- txt+= quoteString(e->whatsThis());
- txt+=") )\n";
- }
- return txt;
-}
-
-int main( int argc, char **argv )
-{
- TDEAboutData aboutData( "rbkconfig_compiler", I18N_NOOP("TDE .kcfg compiler"), "0.3",
- I18N_NOOP("Ruby TDEConfig Compiler") , TDEAboutData::License_LGPL );
- aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );
- aboutData.addAuthor( "Waldo Bastian", 0, "bastian@kde.org" );
- aboutData.addAuthor( "Zack Rusin", 0, "zack@kde.org" );
- aboutData.addCredit( "Reinhold Kainhofer", "Fix for parametrized entries",
- "reinhold@kainhofer.com", "http://reinhold.kainhofer.com" );
- aboutData.addCredit( "Richard Dale", "Ruby port",
- "Richard_Dale@tipitina.demon.co.uk", "" );
-
- TDECmdLineArgs::init( argc, argv, &aboutData );
- TDECmdLineArgs::addCmdLineOptions( options );
-
- TDEInstance app( &aboutData );
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
-
- if ( args->count() < 2 ) {
- kdError() << "Too few arguments." << endl;
- return 1;
- }
- if ( args->count() > 2 ) {
- kdError() << "Too many arguments." << endl;
- return 1;
- }
-
- validNameRegexp = new TQRegExp("[a-zA-Z_][a-zA-Z0-9_]*");
-
- TQString baseDir = TQFile::decodeName(args->getOption("directory"));
- if (!baseDir.endsWith("/"))
- baseDir.append("/");
-
- TQString inputFilename = args->url( 0 ).path();
- TQString codegenFilename = args->url( 1 ).path();
-
- if (!codegenFilename.endsWith(".kcfgc"))
- {
- kdError() << "Codegen options file must have extension .kcfgc" << endl;
- return 1;
- }
- TQString baseName = args->url( 1 ).fileName();
- baseName = baseName.left(baseName.length() - 6);
-
- KSimpleConfig codegenConfig( codegenFilename, true );
-
- TQString nameSpace = codegenConfig.readEntry("NameSpace");
- TQString className = codegenConfig.readEntry("ClassName");
- TQString inherits = codegenConfig.readEntry("Inherits");
- TQString visibility = codegenConfig.readEntry("Visibility");
- if (!visibility.isEmpty()) visibility+=" ";
- bool singleton = codegenConfig.readBoolEntry("Singleton", false);
- bool customAddons = codegenConfig.readBoolEntry("CustomAdditions");
- TQString memberVariables = codegenConfig.readEntry("MemberVariables");
- TQStringList headerIncludes = codegenConfig.readListEntry("IncludeFiles");
- TQStringList mutators = codegenConfig.readListEntry("Mutators");
- bool allMutators = false;
- if ((mutators.count() == 1) && (mutators[0].lower() == "true"))
- allMutators = true;
- itemAccessors = codegenConfig.readBoolEntry( "ItemAccessors", false );
- bool setUserTexts = codegenConfig.readBoolEntry( "SetUserTexts", false );
-
- globalEnums = codegenConfig.readBoolEntry( "GlobalEnums", false );
-
- TQFile input( inputFilename );
-
- TQDomDocument doc;
- TQString errorMsg;
- int errorRow;
- int errorCol;
- if ( !doc.setContent( &input, &errorMsg, &errorRow, &errorCol ) ) {
- kdError() << "Unable to load document." << endl;
- kdError() << "Parse error in " << args->url( 0 ).fileName() << ", line " << errorRow << ", col " << errorCol << ": " << errorMsg << endl;
- return 1;
- }
-
- TQDomElement cfgElement = doc.documentElement();
-
- if ( cfgElement.isNull() ) {
- kdError() << "No document in kcfg file" << endl;
- return 1;
- }
-
- TQString cfgFileName;
- bool cfgFileNameArg = false;
- TQStringList parameters;
- TQStringList includes;
-
- TQPtrList<CfgEntry> entries;
- entries.setAutoDelete( true );
-
- TQDomNode n;
- for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- TQDomElement e = n.toElement();
-
- TQString tag = e.tagName();
-
- if ( tag == "include" ) {
- TQString includeFile = e.text();
- if (!includeFile.isEmpty())
- includes.append(includeFile);
-
- } else if ( tag == "kcfgfile" ) {
- cfgFileName = e.attribute( "name" );
- cfgFileNameArg = e.attribute( "arg" ).lower() == "true";
- TQDomNode n2;
- for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
- TQDomElement e2 = n2.toElement();
- if ( e2.tagName() == "parameter" ) {
- parameters.append( e2.attribute( "name" ) );
- }
- }
-
- } else if ( tag == "group" ) {
- TQString group = e.attribute( "name" );
- if ( group.isEmpty() ) {
- kdError() << "Group without name" << endl;
- return 1;
- }
- TQDomNode n2;
- for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
- TQDomElement e2 = n2.toElement();
- if ( e2.tagName() != "entry" ) continue;
- CfgEntry *entry = parseEntry( group, e2 );
- if ( entry ) entries.append( entry );
- else {
- kdError() << "Can't parse entry." << endl;
- return 1;
- }
- }
- }
- }
-
- if ( inherits.isEmpty() ) inherits = "KDE::ConfigSkeleton";
-
- if ( className.isEmpty() ) {
- kdError() << "Class name missing" << endl;
- return 1;
- }
-
- if ( singleton && !parameters.isEmpty() ) {
- kdError() << "Singleton class can not have parameters" << endl;
- return 1;
- }
-
- if ( singleton && cfgFileNameArg)
- {
- kdError() << "Singleton class can not use filename as argument." << endl;
- return 1;
- }
-
- if ( !cfgFileName.isEmpty() && cfgFileNameArg)
- {
- kdError() << "Having both a fixed filename and a filename as argument is not possible." << endl;
- return 1;
- }
-
- if ( entries.isEmpty() ) {
- kdWarning() << "No entries." << endl;
- }
-
-#if 0
- CfgEntry *cfg;
- for( cfg = entries.first(); cfg; cfg = entries.next() ) {
- cfg->dump();
- }
-#endif
-
- TQString implementationFileName = baseName + ".rb";
-
- TQFile implementation( baseDir + implementationFileName );
- if ( !implementation.open( IO_WriteOnly ) ) {
- kdError() << "Can't open '" << implementationFileName << "for writing." << endl;
- return 1;
- }
-
- TQTextStream rb( &implementation );
-
- rb << "# This file is generated by rbkconfig_compiler from " << args->url(0).fileName() << "." << endl;
- rb << "# All changes you do to this file will be lost." << endl;
- rb << endl << "require 'Korundum'" << endl;
-
- if (singleton) {
- rb << "require 'singleton'" << endl;
- }
-
- rb << endl;
-
-// rb << "#ifndef " << ( !nameSpace.isEmpty() ? nameSpace.upper() + "_" : "" )
-// << className.upper() << "_H" << endl;
-// rb << "#define " << ( !nameSpace.isEmpty() ? nameSpace.upper() + "_" : "" )
-// << className.upper() << "_H" << endl << endl;
-
- // Includes
-// TQStringList::ConstIterator it;
-// for( it = headerIncludes.begin(); it != headerIncludes.end(); ++it ) {
-// rb << "#include <" << *it << ">" << endl;
-// }
-
- if ( headerIncludes.count() > 0 ) rb << endl;
-
-// rb << "#include <kconfigskeleton.h>" << endl << endl;
-
- if ( !nameSpace.isEmpty() )
- rb << "module " << nameSpace << endl << endl;
-
- // Class declaration header
- rb << "class " << className << " < " << inherits << endl;
-
- if (singleton) {
- rb << " include Singleton" << endl << endl;
- }
-
- // enums
- CfgEntry *e;
- for( e = entries.first(); e; e = entries.next() ) {
- TQValueList<CfgEntry::Choice> choices = e->choices();
- if ( !choices.isEmpty() ) {
- TQStringList values;
- TQValueList<CfgEntry::Choice>::ConstIterator itChoice;
- for( itChoice = choices.begin(); itChoice != choices.end(); ++itChoice ) {
- if (globalEnums) {
- values.append( enumValue((*itChoice).name) );
- } else {
- values.append( enumName(e->name()) + "_" + (*itChoice).name );
- }
- }
- if (!globalEnums) {
- values.append( enumName(e->name()) + "_COUNT" );
- }
- int count = 0;
- for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) {
- rb << " " << *it << " = " << count << endl;
- }
- rb << endl;
- }
-
- TQStringList values = e->paramValues();
- if ( !values.isEmpty() ) {
- int count = 0;
- for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) {
- if (globalEnums) {
- rb << " " << enumValue(*it) << " = " << count << endl;
- } else {
- rb << " " << enumName(e->param()) << "_" << *it << " = " << count << endl;
- }
- }
- if (!globalEnums) {
- rb << " " << enumName(e->param()) << "_COUNT = " << count << endl;
- }
- rb << endl;
-
- rb << " def " << enumName(e->param()) << "ToString(i)" << endl;
- rb << " [";
- count = 0;
- for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) {
- if (count > 0) {
- rb << ", ";
- }
-
- rb << "\"" << *it << "\"";
- }
-
- rb << "].at(i)" << endl;
- rb << " end" << endl;
- }
- }
-
- rb << endl;
-
- for( e = entries.first(); e; e = entries.next() ) {
- TQString n = e->name();
- TQString t = e->type();
-
- // Manipulator
- if (allMutators || mutators.contains(n))
- {
- rb << " #" << endl;
- rb << " # Set " << e->label() << endl;
- rb << " #" << endl;
- rb << " def " << setFunction(n) << "( ";
- if (!e->param().isEmpty())
- rb << " i, ";
- rb << " v )" << endl;
- rb << " item = findItem( \"";
- if (!e->param().isEmpty()) {
- rb << e->paramName().replace("$("+e->param()+")", "%s") << "\" % ";
- if ( e->paramType() == "Enum" ) {
- rb << " ";
- if (globalEnums)
- rb << enumName(e->param()) << "ToString(i)";
- else
- rb << enumName(e->param()) << "ToString(i)";
- } else {
- rb << "i";
- }
- } else {
- rb << n << "\"";
- }
- rb << " )" << endl;
- rb << " if !item.immutable? " << endl;
- rb << " item.property = " << varName(n);
- if (!e->param().isEmpty())
- rb << "[i]";
- rb << " = TQt::Variant.new( v )" << endl;
- rb << " end" << endl;
- rb << " end" << endl << endl;
- }
-
- // Accessor
- rb << " #" << endl;
- rb << " # Get " << e->label() << endl;
- rb << " #" << endl;
- rb << " def " << getFunction(n) << "(";
- if (!e->param().isEmpty())
- rb << " " <<" i ";
- rb << ")" << endl;
- rb << " " << varName(n);
- if (!e->param().isEmpty()) rb << "[i]";
- rb << " = findItem( \"";
- if (!e->param().isEmpty()) {
- rb << e->paramName().replace("$("+e->param()+")", "%s") << "\" % ";
- if ( e->paramType() == "Enum" ) {
- rb << " ";
- if (globalEnums)
- rb << enumName(e->param()) << "ToString(i)";
- else
- rb << enumName(e->param()) << "ToString(i)";
- } else {
- rb << "i";
- }
- } else {
- rb << n << "\"";
- }
- rb << " ).property" << endl;
- rb << " return " << varName(n);
- if (!e->param().isEmpty()) rb << "[i]";
- if ( e->type() == "Enum" ) {
- rb << ".toInt" << endl;
- } else if ( e->type() == "Int64" ) {
- rb << ".toLongLong" << endl;
- } else if ( e->type() == "Path" ) {
- rb << ".toString" << endl;
- } else {
- rb << ".to" << itemType( e->type() ) << endl;
- }
- rb << " end" << endl;
-
- // Item accessor
- if ( itemAccessors ) {
- rb << endl;
- rb << " #" << endl;
- rb << " # Get Item object corresponding to " << n << "()"
- << endl;
- rb << " #" << endl;
- rb << " def "
- << getFunction( n ) << "Item(";
- if (!e->param().isEmpty()) {
- rb << " " << " i ";
- }
- rb << ")" << endl;
- rb << " return " << itemVar(e);
- if (!e->param().isEmpty()) rb << "[i]";
- rb << endl << " end" << endl;
- }
-
- rb << endl;
- }
-
-
- if (customAddons)
- {
- rb << " # Include custom additions" << endl;
- }
-
-
- // Constructor
- rb << " def initialize( ";
- if (cfgFileNameArg)
- rb << " config" << (parameters.isEmpty() ? " " : ", ");
- for (TQStringList::ConstIterator it = parameters.begin();
- it != parameters.end(); ++it)
- {
- if (it != parameters.begin())
- rb << ",";
- rb << " " << *it;
- }
- rb << " )" << endl;
-
- rb << " super(";
- if ( !cfgFileName.isEmpty() ) rb << " \"" << cfgFileName << "\" ";
- if ( cfgFileNameArg ) rb << " config ";
-// if ( !cfgFileName.isEmpty() ) rb << ") ";
- rb << ")" << endl;
-
- // Store parameters
- for (TQStringList::ConstIterator it = parameters.begin();
- it != parameters.end(); ++it)
- {
- rb << " @param" << *it << " = TQt::Variant.new( " << *it << " )" << endl;
- }
-
- TQString group;
- for( e = entries.first(); e; e = entries.next() ) {
- if ( e->group() != group ) {
- group = e->group();
- rb << endl;
- rb << " # " << group << endl;
- }
- if (e->param().isEmpty()) {
- rb << " " << varName(e->name()) << " = TQt::Variant.new( " << rbType(e->type()) << " )";
- } else {
- rb << " " << varName(e->name()) << " = [ ";
- for (int i = 0; i < e->paramMax()+1; i++) {
- if (i > 0) {
- rb << ", ";
- }
- rb << "TQt::Variant.new( " << rbType(e->type()) << " )";
- }
- rb << " ]";
- }
- rb << endl;
- }
-
- rb << endl;
-
-
- group = TQString::null;
- for( e = entries.first(); e; e = entries.next() ) {
- if ( e->group() != group ) {
- if ( !group.isEmpty() ) rb << endl;
- group = e->group();
- rb << " setCurrentGroup( " << paramString(group, parameters) << " )" << endl << endl;
- }
-
- TQString key = paramString(e->key(), parameters);
- if ( !e->code().isEmpty())
- {
- rb << e->code() << endl;
- }
- if ( e->type() == "Enum" ) {
- rb << " values"
- << e->name() << " = []" << endl;
- TQValueList<CfgEntry::Choice> choices = e->choices();
- TQValueList<CfgEntry::Choice>::ConstIterator it;
- for( it = choices.begin(); it != choices.end(); ++it ) {
- rb << " choice = ItemEnum::Choice.new" << endl;
- rb << " choice.name = \"" << enumValue((*it).name) << "\" " << endl;
- if ( setUserTexts ) {
- if ( !(*it).label.isEmpty() )
- rb << " choice.label = i18n(" << quoteString((*it).label) << ")" << endl;
- if ( !(*it).whatsThis.isEmpty() )
- rb << " choice.whatsThis = i18n(" << quoteString((*it).whatsThis) << ")" << endl;
- }
- rb << " values" << e->name() << " << choice" << endl;
- }
- }
-
- if (e->param().isEmpty())
- {
- // Normal case
- rb << " " << itemVar(e) << " = "
- << newItem( e->type(), e->name(), key, e->defaultValue() ) << endl;
-
- rb << " " << itemVar(e) << ".property = " << varName(e->name()) << endl;
-
- if ( !e->minValue().isEmpty() )
- rb << " " << itemVar(e) << ".setMinValue(" << e->minValue() << ")" << endl;
- if ( !e->maxValue().isEmpty() )
- rb << " " << itemVar(e) << ".setMaxValue(" << e->maxValue() << ")" << endl;
-
- if ( setUserTexts )
- rb << userTextsFunctions( e );
-
- rb << " addItem( " << itemVar(e);
- TQString quotedName = e->name();
- addQuotes( quotedName );
- if ( quotedName != key ) rb << ", \"" << e->name() << "\"";
- rb << " )" << endl;
- }
- else
- {
- // Indexed
- rb << " " << itemVar(e) << " = Array.new(" << e->paramMax()+1 << ")" << endl;
- for(int i = 0; i <= e->paramMax(); i++)
- {
- TQString defaultStr;
- TQString itemVarStr(itemVar(e)+TQString("[%1]").arg(i));
-
- if ( !e->paramDefaultValue(i).isEmpty() )
- defaultStr = e->paramDefaultValue(i);
- else if ( !e->defaultValue().isEmpty() )
- defaultStr = paramString(e->defaultValue(), e, i);
- else
- defaultStr = defaultValue( e->type() );
-
- rb << " " << itemVarStr << " = "
- << newItem( e->type(), e->name(), paramString(key, e, i), defaultStr, TQString("[%1]").arg(i) )
- << endl;
-
- rb << " " << itemVarStr << ".property = " << varName(e->name())+TQString("[%1]").arg(i) << endl;
-
- if ( setUserTexts )
- rb << userTextsFunctions( e, itemVarStr, e->paramName() );
-
- // Make mutators for enum parameters work by adding them with $(..) replaced by the
- // param name. The check for isImmutable in the set* functions doesn't have the param
- // name available, just the corresponding enum value (int), so we need to store the
- // param names in a separate static list!.
- rb << " addItem( " << itemVarStr << ", \"";
- if ( e->paramType()=="Enum" )
- rb << e->paramName().replace( "$("+e->param()+")", "%1").arg(e->paramValues()[i] );
- else
- rb << e->paramName().replace( "$("+e->param()+")", "%1").arg(i);
- rb << "\" )" << endl;
-
- }
- }
- }
-
- rb << " end" << endl << endl;
-
- rb << "end" << endl << endl;
-
- if ( !nameSpace.isEmpty() ) rb << "end" << endl << endl;
-
- implementation.close();
-}
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/Makefile.am b/korundum/rubylib/rbkconfig_compiler/tests/Makefile.am
deleted file mode 100644
index ce61f658..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-check_PROGRAMS = test1 test2 test3 test4 test5
-
-CLEANFILES = test1.rb \
- test2.rb \
- test3.rb \
- test4.rb \
- test5.rb \
- md5sums
-
-all: $(SOURCES)
-
-# Splitting this with backslashses produces broken Makefiles
-SOURCES = test1main.rb test1.rb test2main.rb test2.rb test3main.rb test3.rb test4main.rb test4.rb test5main.rb test5.rb
-
-# avoid running the below command in parallel
-test1.rb: $(srcdir)/test1.kcfg ../rbkconfig_compiler $(srcdir)/test1.kcfgc
- ../rbkconfig_compiler $(srcdir)/test1.kcfg $(srcdir)/test1.kcfgc
-
-# avoid running the below command in parallel
-test2.rb: $(srcdir)/test2.kcfg ../rbkconfig_compiler $(srcdir)/test2.kcfgc
- ../rbkconfig_compiler $(srcdir)/test2.kcfg $(srcdir)/test2.kcfgc
-
-# avoid running the below command in parallel
-test3.rb: $(srcdir)/test3.kcfg ../rbkconfig_compiler $(srcdir)/test3.kcfgc
- ../rbkconfig_compiler $(srcdir)/test3.kcfg $(srcdir)/test3.kcfgc
-
-# avoid running the below command in parallel
-test4.rb: $(srcdir)/test4.kcfg ../rbkconfig_compiler $(srcdir)/test4.kcfgc
- ../rbkconfig_compiler $(srcdir)/test4.kcfg $(srcdir)/test4.kcfgc
-
-# avoid running the below command in parallel
-test5.rb: $(srcdir)/test5.kcfg ../rbkconfig_compiler $(srcdir)/test5.kcfgc
- ../rbkconfig_compiler $(srcdir)/test5.kcfg $(srcdir)/test5.kcfgc
-
-md5sums:
- $(MD5SUM) $(srcdir)/test*.ref | sed -e "s,$(srcdir)/,,; s,\.ref$$,," > md5sums
-
-md5check: test1.rb test2.rb test3.rb test4.rb test5.rb md5sums
- $(MD5SUM) --check md5sums
-
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb b/korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb
deleted file mode 100644
index a4f1f082..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/myprefs.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MyPrefs < KDE::ConfigSkeleton
- def initialize( a )
- super( a )
- end
-end
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg
deleted file mode 100644
index b8c23c15..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfg
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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" >
- <include>qdir.h</include>
- <kcfgfile name="examplerc">
- <parameter name="transport" />
- <parameter name="folder" />
- </kcfgfile>
- <group name="General-$(folder)">
- <entry name="OneOption" type="Bool">
- <label>One option</label>
- <default>true</default>
- </entry>
- <entry name="AnotherOption" type="Int" key="Another Option">
- <label>Another option</label>
- <default>5</default>
- </entry>
- <entry name="ListOption" type="Enum">
- <label>This is some funky option</label>
- <whatsthis>And this is a longer description of this option. Just wondering, how will the translations of those be handled?</whatsthis>
- <choices>
- <choice name="One"/>
- <choice name="Two"/>
- <choice name="Three"/>
- </choices>
- <default>One</default>
- </entry>
- </group>
- <group name="MyOptions">
- <entry name="MyString" type="String">
- <label>This is a string</label>
- <default>Default String</default>
- </entry>
- <entry name="MyPath" type="Path">
- <label>This is a path</label>
- <default code="true">TQt::Dir.homeDirPath()+".hidden_file"</default>
- </entry>
- <entry name="AnotherOption2" type="Int" key="Another Option">
- <label>Another option</label>
- <default>10</default>
- </entry>
- <entry name="MyStringList" type="StringList">
- <default>up,down</default>
- </entry>
- <entry name="MyStringListHidden" hidden="true" type="StringList">
- <default>up,down</default>
- </entry>
- <entry name="MyNumber" type="Int" key="List-$(transport)-$(folder)">
- <label>List Number</label>
- <default>1</default>
- </entry>
- </group>
-</kcfg>
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc
deleted file mode 100644
index ecab7b85..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test1.kcfgc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Code generation options for kconfig_compiler
-ClassName=Test1
-#
-# Singleton=false
-#
-# Inherits=TDEConfigSkeleton
-#
-# IncludeFiles=libtdepim/kpimprefs.h
-#
-# MemberVariables=public
-#
-### The following line includes the file exampleprefs_base_addon.h
-### It can be used to add extra functions and variables to the
-### class.
-# CustomAdditions=true
-#
-### Provide setFooBar(int) style functions
-Mutators=true
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test1main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test1main.rb
deleted file mode 100644
index 88a151a6..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test1main.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'Korundum'
-require 'test1.rb'
-
-t = Test1.new(nil, nil)
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg
deleted file mode 100644
index 3b19e270..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfg
+++ /dev/null
@@ -1,78 +0,0 @@
-<?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="korganizerrc"/>
-
- <group name="General">
- <entry type="Bool" key="Auto Save">
- <label>Enable automatic saving of calendar</label>
- <whatsthis>WhatsThis text for AutoSave option</whatsthis>
- <default>false</default>
- </entry>
- <entry type="Int" key="Auto Save Interval">
- <default>10</default>
- </entry>
- <entry type="Bool" key="Confirm Deletes" name="Confirm">
- <label>Confirm deletes</label>
- <default>true</default>
- </entry>
- <entry type="String" key="Archive File">
- </entry>
- <entry type="Enum" key="Destination" name="Destination">
- <label>New Events/Todos Should</label>
- <choices>
- <choice name="standardDestination">
- </choice>
- <choice name="askDestination">
- </choice>
- <choice name="argl1">
- <label>Argl1 Label</label>
- </choice>
- <choice name="argl2">
- <whatsthis>Argl2 Whatsthis</whatsthis>
- </choice>
- <choice name="argl3">
- <label>Argl3 Label</label>
- <whatsthis>Argl3 Whatsthis</whatsthis>
- </choice>
- </choices>
- <default>standardDestination</default>
- </entry>
- </group>
-
- <group name="Views">
- <entry type="Int" key="Hour Size">
- <default>10</default>
- </entry>
- <entry type="Bool" name="SelectionStartsEditor">
- <label>Time range selection in agenda view starts event editor</label>
- <default>false</default>
- </entry>
- </group>
-
- <group name="KOrganizer Plugins">
- <entry type="StringList" name="SelectedPlugins">
- <default>holidays,webexport</default>
- </entry>
- </group>
-
- <group name="Colors">
- <entry type="Color" key="Highlight Color">
- <label>Highlight color</label>
- <default>100, 100, 255</default>
- </entry>
- <entry type="Color" key="Agenda Background Color" name="AgendaBgColor">
- <label>Agenda view background color</label>
- <default>255, 255, 255</default>
- </entry>
- </group>
-
- <group name="Fonts">
- <entry type="Font" key="TimeBar Font">
- <label>Time bar</label>
- </entry>
- </group>
-
-</kcfg>
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc
deleted file mode 100644
index 56620d2f..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test2.kcfgc
+++ /dev/null
@@ -1,11 +0,0 @@
-# Code generation options for kconfig_compiler
-File=test2.kcfg
-ClassName=Test2
-Singleton=false
-Mutators=true
-Inherits=MyPrefs
-IncludeFiles=myprefs.h
-MemberVariables=public
-GlobalEnums=true
-ItemAccessors=true
-SetUserTexts=true
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test2main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test2main.rb
deleted file mode 100644
index 85d18f07..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test2main.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'Korundum'
-require 'myprefs.rb'
-require 'test2.rb'
-
-t = Test2.new()
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg
deleted file mode 100644
index 77916da4..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfg
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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="test3rc"/>
-
- <group name="General">
- <entry type="Bool" key="Auto Save">
- <label>Enable automatic saving of calendar</label>
- <whatsthis>WhatsThis text for AutoSave option</whatsthis>
- <default>false</default>
- </entry>
- </group>
-
- <group name="Blah">
- <entry type="Int" name="Blubb">
- <default>10</default>
- </entry>
- <entry type="String" name="BlahBlah">
- <default>a string</default>
- </entry>
- <entry type="Password" name="MyPassword"/>
- </group>
-
-</kcfg>
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc
deleted file mode 100644
index ca2c2205..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test3.kcfgc
+++ /dev/null
@@ -1,12 +0,0 @@
-# Code generation options for kconfig_compiler
-File=test3.kcfg
-NameSpace=TestNameSpace
-ClassName=Test3
-#Singleton=false
-Mutators=true
-#Inherits=MyPrefs
-#IncludeFiles=myprefs.h
-#MemberVariables=public
-GlobalEnums=true
-ItemAccessors=true
-#SetUserTexts=true
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test3main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test3main.rb
deleted file mode 100644
index 8c19b442..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test3main.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'Korundum'
-require 'test3.rb'
-
-t = TestNameSpace::Test3.new()
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg
deleted file mode 100644
index c834aa9f..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfg
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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="test4rc"/>
-
- <group name="Foo">
- <entry name="Color$(Number)" type="Color" key="color #$(Number)">
- <parameter name="Number" type="Int" max="3"/>
- <label>Block colors.</label>
- <code>defaultColor = [ TQt::red, TQt::blue, TQt::green, TQt::black ]</code>
- <default code="true">defaultColor[$(Number)]</default>
- </entry>
- <entry name="MouseAction$(Button)" type="Enum" key="$(Button)_mouse_action">
- <parameter name="Button" type="Enum">
- <values>
- <value>right</value>
- <value>mid</value>
- <value>left</value>
- </values>
- </parameter>
- <label>Mouse actions.</label>
- <choices>
- <choice name="Encrypt"/>
- <choice name="Decrypt"/>
- <choice name="CrashNBurn"/>
- <choice name="PumpNDump"/>
- </choices>
- <default param="right">Decrypt</default>
- <default param="mid">Encrypt</default>
- <default param="left">PumpNDump</default>
- </entry>
- <entry name="FooBar" key="foo bar" type="String"/>
- <entry name="Age" type="Int">
- <default>35</default>
- <min>8</min>
- <max>88</max>
- </entry>
- </group>
-
-</kcfg>
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc
deleted file mode 100644
index 754706df..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test4.kcfgc
+++ /dev/null
@@ -1,11 +0,0 @@
-# Code generation options for kconfig_compiler
-File=test4.kcfg
-ClassName=Test4
-Singleton=true
-Mutators=true
-#Inherits=MyPrefs
-#IncludeFiles=myprefs.h
-#MemberVariables=public
-GlobalEnums=false
-ItemAccessors=false
-#SetUserTexts=true
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test4main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test4main.rb
deleted file mode 100644
index c75f0995..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test4main.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'Korundum'
-require 'test4.rb'
-
-t = Test4.instance()
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg b/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg
deleted file mode 100644
index c834aa9f..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfg
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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="test4rc"/>
-
- <group name="Foo">
- <entry name="Color$(Number)" type="Color" key="color #$(Number)">
- <parameter name="Number" type="Int" max="3"/>
- <label>Block colors.</label>
- <code>defaultColor = [ TQt::red, TQt::blue, TQt::green, TQt::black ]</code>
- <default code="true">defaultColor[$(Number)]</default>
- </entry>
- <entry name="MouseAction$(Button)" type="Enum" key="$(Button)_mouse_action">
- <parameter name="Button" type="Enum">
- <values>
- <value>right</value>
- <value>mid</value>
- <value>left</value>
- </values>
- </parameter>
- <label>Mouse actions.</label>
- <choices>
- <choice name="Encrypt"/>
- <choice name="Decrypt"/>
- <choice name="CrashNBurn"/>
- <choice name="PumpNDump"/>
- </choices>
- <default param="right">Decrypt</default>
- <default param="mid">Encrypt</default>
- <default param="left">PumpNDump</default>
- </entry>
- <entry name="FooBar" key="foo bar" type="String"/>
- <entry name="Age" type="Int">
- <default>35</default>
- <min>8</min>
- <max>88</max>
- </entry>
- </group>
-
-</kcfg>
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc b/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc
deleted file mode 100644
index 663005e5..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test5.kcfgc
+++ /dev/null
@@ -1,11 +0,0 @@
-# Code generation options for kconfig_compiler
-File=test5.kcfg
-ClassName=Test5
-Singleton=true
-Mutators=true
-#Inherits=MyPrefs
-#IncludeFiles=myprefs.h
-#MemberVariables=public
-GlobalEnums=true
-ItemAccessors=false
-#SetUserTexts=true
diff --git a/korundum/rubylib/rbkconfig_compiler/tests/test5main.rb b/korundum/rubylib/rbkconfig_compiler/tests/test5main.rb
deleted file mode 100644
index cd0fbeb7..00000000
--- a/korundum/rubylib/rbkconfig_compiler/tests/test5main.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'Korundum'
-require 'test5.rb'
-
-t = Test5.instance()