diff options
Diffstat (limited to 'korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp')
-rw-r--r-- | korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp | 440 |
1 files changed, 220 insertions, 220 deletions
diff --git a/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp b/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp index 6274e4bf..ee11862e 100644 --- a/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp +++ b/korundum/rubylib/rbkconfig_compiler/rbkconfig_compiler.cpp @@ -22,10 +22,10 @@ Boston, MA 02110-1301, USA. */ -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqregexp.h> #include <kaboutdata.h> #include <kapplication.h> @@ -51,23 +51,23 @@ static const KCmdLineOptions options[] = bool globalEnums; bool itemAccessors; -QStringList allNames; -QRegExp *validNameRegexp; +TQStringList allNames; +TQRegExp *validNameRegexp; class CfgEntry { public: struct Choice { - QString name; - QString label; - QString whatsThis; + TQString name; + TQString label; + TQString whatsThis; }; - CfgEntry( const QString &group, const QString &type, const QString &key, - const QString &name, const QString &label, - const QString &whatsThis, const QString &code, - const QString &defaultValue, const QValueList<Choice> &choices, + 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 ), @@ -76,53 +76,53 @@ class CfgEntry { } - void setGroup( const QString &group ) { mGroup = group; } - QString group() const { return mGroup; } + void setGroup( const TQString &group ) { mGroup = group; } + TQString group() const { return mGroup; } - void setType( const QString &type ) { mType = type; } - QString type() const { return mType; } + void setType( const TQString &type ) { mType = type; } + TQString type() const { return mType; } - void setKey( const QString &key ) { mKey = key; } - QString key() const { return mKey; } + void setKey( const TQString &key ) { mKey = key; } + TQString key() const { return mKey; } - void setName( const QString &name ) { mName = name; } - QString name() const { return mName; } + void setName( const TQString &name ) { mName = name; } + TQString name() const { return mName; } - void setLabel( const QString &label ) { mLabel = label; } - QString label() const { return mLabel; } + void setLabel( const TQString &label ) { mLabel = label; } + TQString label() const { return mLabel; } - void setWhatsThis( const QString &whatsThis ) { mWhatsThis = whatsThis; } - QString whatsThis() const { return mWhatsThis; } + void setWhatsThis( const TQString &whatsThis ) { mWhatsThis = whatsThis; } + TQString whatsThis() const { return mWhatsThis; } - void setDefaultValue( const QString &d ) { mDefaultValue = d; } - QString defaultValue() const { return mDefaultValue; } + void setDefaultValue( const TQString &d ) { mDefaultValue = d; } + TQString defaultValue() const { return mDefaultValue; } - void setCode( const QString &d ) { mCode = d; } - QString code() const { return mCode; } + void setCode( const TQString &d ) { mCode = d; } + TQString code() const { return mCode; } - void setMinValue( const QString &d ) { mMin = d; } - QString minValue() const { return mMin; } + void setMinValue( const TQString &d ) { mMin = d; } + TQString minValue() const { return mMin; } - void setMaxValue( const QString &d ) { mMax = d; } - QString maxValue() const { return mMax; } + void setMaxValue( const TQString &d ) { mMax = d; } + TQString maxValue() const { return mMax; } - void setParam( const QString &d ) { mParam = d; } - QString param() const { return mParam; } + void setParam( const TQString &d ) { mParam = d; } + TQString param() const { return mParam; } - void setParamName( const QString &d ) { mParamName = d; } - QString paramName() const { return mParamName; } + void setParamName( const TQString &d ) { mParamName = d; } + TQString paramName() const { return mParamName; } - void setParamType( const QString &d ) { mParamType = d; } - QString paramType() const { return mParamType; } + void setParamType( const TQString &d ) { mParamType = d; } + TQString paramType() const { return mParamType; } - void setChoices( const QValueList<Choice> &d ) { mChoices = d; } - QValueList<Choice> choices() const { return mChoices; } + void setChoices( const TQValueList<Choice> &d ) { mChoices = d; } + TQValueList<Choice> choices() const { return mChoices; } - void setParamValues( const QStringList &d ) { mParamValues = d; } - QStringList paramValues() const { return mParamValues; } + void setParamValues( const TQStringList &d ) { mParamValues = d; } + TQStringList paramValues() const { return mParamValues; } - void setParamDefaultValues( const QStringList &d ) { mParamDefaultValues = d; } - QString paramDefaultValue(int i) const { return mParamDefaultValues[i]; } + 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; } @@ -155,73 +155,73 @@ class CfgEntry } private: - QString mGroup; - QString mType; - QString mKey; - QString mName; - QString mLabel; - QString mWhatsThis; - QString mCode; - QString mDefaultValue; - QString mParam; - QString mParamName; - QString mParamType; - QValueList<Choice> mChoices; - QStringList mParamValues; - QStringList mParamDefaultValues; + 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; - QString mMin; - QString mMax; + TQString mMin; + TQString mMax; }; -static QString varName(const QString &n) +static TQString varName(const TQString &n) { - QString result = "@"+n; + TQString result = "@"+n; result[1] = result[1].lower(); return result; } -static QString enumName(const QString &n) +static TQString enumName(const TQString &n) { - QString result = "Enum"+n; + TQString result = "Enum"+n; result[4] = result[4].upper(); return result; } -static QString enumValue(const QString &n) +static TQString enumValue(const TQString &n) { - QString result = n; + TQString result = n; result[0] = result[0].upper(); return result; } -static QString setFunction(const QString &n) +static TQString setFunction(const TQString &n) { - QString result = "set"+n; + TQString result = "set"+n; result[3] = result[3].upper(); return result; } -static QString getFunction(const QString &n) +static TQString getFunction(const TQString &n) { - QString result = n; + TQString result = n; result[0] = result[0].lower(); return result; } -static void addQuotes( QString &s ) +static void addQuotes( TQString &s ) { if ( s.left( 1 ) != "\"" ) s.prepend( "\"" ); if ( s.right( 1 ) != "\"" ) s.append( "\"" ); } -static QString quoteString( const QString &s ) +static TQString quoteString( const TQString &s ) { - QString r = s; + TQString r = s; r.replace( "\\", "\\\\" ); r.replace( "\"", "\\\"" ); r.replace( "\r", "" ); @@ -229,7 +229,7 @@ static QString quoteString( const QString &s ) return "\"" + r + "\""; } -static QString literalString( const QString &s ) +static TQString literalString( const TQString &s ) { bool isAscii = true; for(int i = s.length(); i--;) @@ -238,15 +238,15 @@ static QString literalString( const QString &s ) return quoteString(s); // if (isAscii) -// return "QString::fromLatin1( " + quoteString(s) + " )"; +// return "TQString::fromLatin1( " + quoteString(s) + " )"; // else -// return "QString::fromUtf8( " + quoteString(s) + " )"; +// return "TQString::fromUtf8( " + quoteString(s) + " )"; } -static QString dumpNode(const QDomNode &node) +static TQString dumpNode(const TQDomNode &node) { - QString msg; - QTextStream s(&msg, IO_WriteOnly ); + TQString msg; + TQTextStream s(&msg, IO_WriteOnly ); node.save(s, 0); msg = msg.simplifyWhiteSpace(); @@ -255,7 +255,7 @@ static QString dumpNode(const QDomNode &node) return msg; } -static QString filenameOnly(QString path) +static TQString filenameOnly(TQString path) { int i = path.findRev('/'); if (i >= 0) @@ -263,10 +263,10 @@ static QString filenameOnly(QString path) return path; } -static void preProcessDefault( QString &defaultValue, const QString &name, - const QString &type, - const QValueList<CfgEntry::Choice> &choices, - QString &code ) +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); @@ -275,14 +275,14 @@ static void preProcessDefault( QString &defaultValue, const QString &name, defaultValue = literalString( defaultValue ); } else if ( type == "StringList" && !defaultValue.isEmpty() ) { - QTextStream rb( &code, IO_WriteOnly | IO_Append ); + TQTextStream rb( &code, IO_WriteOnly | IO_Append ); if (!code.isEmpty()) rb << endl; -// rb << " QStringList default" << name << ";" << endl; +// rb << " TQStringList default" << name << ";" << endl; rb << " default" << name << " = []" << endl; - QStringList defaults = QStringList::split( ",", defaultValue ); - QStringList::ConstIterator it; + TQStringList defaults = TQStringList::split( ",", defaultValue ); + TQStringList::ConstIterator it; for( it = defaults.begin(); it != defaults.end(); ++it ) { rb << " default" << name << " << \"" << *it << "\"" << endl; @@ -290,7 +290,7 @@ static void preProcessDefault( QString &defaultValue, const QString &name, defaultValue = "default" + name; } else if ( type == "Color" && !defaultValue.isEmpty() ) { - QRegExp colorRe("\\d+,\\s*\\d+,\\s*\\d+"); + TQRegExp colorRe("\\d+,\\s*\\d+,\\s*\\d+"); if (colorRe.exactMatch(defaultValue)) { defaultValue = "Qt::Color.new( " + defaultValue + " )"; @@ -302,7 +302,7 @@ static void preProcessDefault( QString &defaultValue, const QString &name, } else if ( type == "Enum" ) { if ( !globalEnums ) { - QValueList<CfgEntry::Choice>::ConstIterator it; + TQValueList<CfgEntry::Choice>::ConstIterator it; for( it = choices.begin(); it != choices.end(); ++it ) { if ( (*it).name == defaultValue ) { defaultValue.prepend( enumName(name) + "_"); @@ -312,13 +312,13 @@ static void preProcessDefault( QString &defaultValue, const QString &name, } } else if ( type == "IntList" ) { - QTextStream rb( &code, IO_WriteOnly | IO_Append ); + TQTextStream rb( &code, IO_WriteOnly | IO_Append ); if (!code.isEmpty()) rb << endl; rb << " default" << name << " = []" << endl; - QStringList defaults = QStringList::split( ",", defaultValue ); - QStringList::ConstIterator it; + TQStringList defaults = TQStringList::split( ",", defaultValue ); + TQStringList::ConstIterator it; for( it = defaults.begin(); it != defaults.end(); ++it ) { rb << " default" << name << " << " << *it << "" << endl; @@ -328,31 +328,31 @@ static void preProcessDefault( QString &defaultValue, const QString &name, } -CfgEntry *parseEntry( const QString &group, const QDomElement &element ) +CfgEntry *parseEntry( const TQString &group, const TQDomElement &element ) { bool defaultCode = false; - QString type = element.attribute( "type" ); - QString name = element.attribute( "name" ); - QString key = element.attribute( "key" ); - QString hidden = element.attribute( "hidden" ); - QString label; - QString whatsThis; - QString defaultValue; - QString code; - QString param; - QString paramName; - QString paramType; - QValueList<CfgEntry::Choice> choices; - QStringList paramValues; - QStringList paramDefaultValues; - QString minValue; - QString maxValue; + 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; - QDomNode n; + TQDomNode n; for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement e = n.toElement(); - QString tag = e.tagName(); + 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(); @@ -382,14 +382,14 @@ CfgEntry *parseEntry( const QString &group, const QDomElement &element ) } else if (paramType == "Enum") { - QDomNode n2; + TQDomNode n2; for ( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - QDomElement e2 = n2.toElement(); + TQDomElement e2 = n2.toElement(); if (e2.tagName() == "values") { - QDomNode n3; + TQDomNode n3; for ( n3 = e2.firstChild(); !n3.isNull(); n3 = n3.nextSibling() ) { - QDomElement e3 = n3.toElement(); + TQDomElement e3 = n3.toElement(); if (e3.tagName() == "value") { paramValues.append( e3.text() ); @@ -421,18 +421,18 @@ CfgEntry *parseEntry( const QString &group, const QDomElement &element ) } } else if ( tag == "choices" ) { - QDomNode n2; + TQDomNode n2; for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - QDomElement e2 = n2.toElement(); + TQDomElement e2 = n2.toElement(); if ( e2.tagName() == "choice" ) { - QDomNode n3; + 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() ) { - QDomElement e3 = n3.toElement(); + TQDomElement e3 = n3.toElement(); if ( e3.tagName() == "label" ) choice.label = e3.text(); if ( e3.tagName() == "whatsthis" ) choice.whatsThis = e3.text(); } @@ -454,7 +454,7 @@ CfgEntry *parseEntry( const QString &group, const QDomElement &element ) if ( nameIsEmpty ) { name = key; - name.replace( " ", QString::null ); + name.replace( " ", TQString::null ); } else if ( name.contains( ' ' ) ) { kdWarning()<<"Entry '"<<name<<"' contains spaces! <name> elements can't contain speces!"<<endl; name.remove( ' ' ); @@ -487,20 +487,20 @@ CfgEntry *parseEntry( const QString &group, const QDomElement &element ) { // Adjust name paramName = name; - name.replace("$("+param+")", QString::null); + name.replace("$("+param+")", TQString::null); // Lookup defaults for indexed entries for(int i = 0; i <= paramMax; i++) { - paramDefaultValues.append(QString::null); + paramDefaultValues.append(TQString::null); } - QDomNode n; + TQDomNode n; for ( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement e = n.toElement(); - QString tag = e.tagName(); + TQDomElement e = n.toElement(); + TQString tag = e.tagName(); if ( tag == "default" ) { - QString index = e.attribute("param"); + TQString index = e.attribute("param"); if (index.isEmpty()) continue; @@ -522,7 +522,7 @@ CfgEntry *parseEntry( const QString &group, const QDomElement &element ) return 0; } - QString tmpDefaultValue = e.text(); + TQString tmpDefaultValue = e.text(); if (e.attribute( "code" ) != "true") preProcessDefault(tmpDefaultValue, name, type, choices, code); @@ -579,36 +579,36 @@ CfgEntry *parseEntry( const QString &group, const QDomElement &element ) /** Return parameter declaration for given type. */ -QString param( const QString &type ) +TQString param( const TQString &type ) { - if ( type == "String" ) return "const QString &"; - else if ( type == "StringList" ) return "const QStringList &"; - else if ( type == "Font" ) return "const QFont &"; - else if ( type == "Rect" ) return "const QRect &"; - else if ( type == "Size" ) return "const QSize &"; - else if ( type == "Color" ) return "const QColor &"; - else if ( type == "Point" ) return "const QPoint &"; + 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 QDateTime &"; + else if ( type == "DateTime" ) return "const TQDateTime &"; else if ( type == "Int64" ) return "Q_INT64"; else if ( type == "UInt64" ) return "Q_UINT64"; - else if ( type == "IntList" ) return "const QValueList<int> &"; + else if ( type == "IntList" ) return "const TQValueList<int> &"; else if ( type == "Enum" ) return "int"; - else if ( type == "Path" ) return "const QString &"; - else if ( type == "Password" ) return "const QString &"; + 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 "QString"; //For now, but an assert would be better + return "TQString"; //For now, but an assert would be better } } /** Actual Ruby initializer value to give a type. */ -QString rbType( const QString &type ) +TQString rbType( const TQString &type ) { if ( type == "String" ) return "\"\""; else if ( type == "StringList" ) return "[]"; @@ -634,7 +634,7 @@ QString rbType( const QString &type ) } } -QString defaultValue( const QString &type ) +TQString defaultValue( const TQString &type ) { if ( type == "String" ) return "\"\""; // Use empty string, not null string! else if ( type == "StringList" ) return "[]"; @@ -660,16 +660,16 @@ QString defaultValue( const QString &type ) } } -QString itemType( const QString &type ) +TQString itemType( const TQString &type ) { - QString t; + TQString t; t = type; t.replace( 0, 1, t.left( 1 ).upper() ); return t; } -static QString itemVar(const CfgEntry *e) +static TQString itemVar(const CfgEntry *e) { if (itemAccessors) return varName( e->name() ) + "Item"; @@ -678,10 +678,10 @@ static QString itemVar(const CfgEntry *e) } -QString newItem( const QString &type, const QString &name, const QString &key, - const QString &defaultValue, const QString ¶m = QString::null) +TQString newItem( const TQString &type, const TQString &name, const TQString &key, + const TQString &defaultValue, const TQString ¶m = TQString::null) { - QString t = "Item" + itemType( type ) + + TQString t = "Item" + itemType( type ) + ".new( currentGroup(), " + key + ", " + varName( name ) + param; if ( type == "Enum" ) { t += ".toInt"; @@ -703,11 +703,11 @@ QString newItem( const QString &type, const QString &name, const QString &key, return t; } -QString addItem( const QString &type, const QString &name, const QString &key, - const QString &defaultValue, const QString ¶m = QString::null, - const QString ¶mName = QString::null ) +TQString addItem( const TQString &type, const TQString &name, const TQString &key, + const TQString &defaultValue, const TQString ¶m = TQString::null, + const TQString ¶mName = TQString::null ) { - QString t = "addItem" + itemType( type ) + + TQString t = "addItem" + itemType( type ) + "( " + key + ", " + varName( name ) + param; if ( type == "Enum" ) t += ", values" + name; if ( !defaultValue.isEmpty() ) { @@ -726,20 +726,20 @@ QString addItem( const QString &type, const QString &name, const QString &key, return t; } -QString paramString(const QString &s, const CfgEntry *e, int i) +TQString paramString(const TQString &s, const CfgEntry *e, int i) { - QString result = s; - QString needle = "$("+e->param()+")"; + TQString result = s; + TQString needle = "$("+e->param()+")"; if (result.contains(needle)) { - QString tmp; + TQString tmp; if (e->paramType() == "Enum") { tmp = e->paramValues()[i]; } else { - tmp = QString::number(i); + tmp = TQString::number(i); } result.replace(needle, tmp); @@ -747,12 +747,12 @@ QString paramString(const QString &s, const CfgEntry *e, int i) return result; } -QString paramString(const QString &group, const QStringList ¶meters) +TQString paramString(const TQString &group, const TQStringList ¶meters) { - QString paramString = group; - QString arguments; + TQString paramString = group; + TQString arguments; int i = 0; - for( QStringList::ConstIterator it = parameters.begin(); + for( TQStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it) { if (paramString.contains("$("+*it+")")) @@ -776,9 +776,9 @@ QString paramString(const QString &group, const QStringList ¶meters) } /* int i is the value of the parameter */ -QString userTextsFunctions( CfgEntry *e, QString itemVarStr=QString::null, QString i=QString::null ) +TQString userTextsFunctions( CfgEntry *e, TQString itemVarStr=TQString::null, TQString i=TQString::null ) { - QString txt; + TQString txt; if (itemVarStr.isNull()) itemVarStr=itemVar(e); if ( !e->label().isEmpty() ) { txt += " " + itemVarStr + ".setLabel( i18n("; @@ -827,35 +827,35 @@ int main( int argc, char **argv ) return 1; } - validNameRegexp = new QRegExp("[a-zA-Z_][a-zA-Z0-9_]*"); + validNameRegexp = new TQRegExp("[a-zA-Z_][a-zA-Z0-9_]*"); - QString baseDir = QFile::decodeName(args->getOption("directory")); + TQString baseDir = TQFile::decodeName(args->getOption("directory")); if (!baseDir.endsWith("/")) baseDir.append("/"); - QString inputFilename = args->url( 0 ).path(); - QString codegenFilename = args->url( 1 ).path(); + 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; } - QString baseName = args->url( 1 ).fileName(); + TQString baseName = args->url( 1 ).fileName(); baseName = baseName.left(baseName.length() - 6); KSimpleConfig codegenConfig( codegenFilename, true ); - QString nameSpace = codegenConfig.readEntry("NameSpace"); - QString className = codegenConfig.readEntry("ClassName"); - QString inherits = codegenConfig.readEntry("Inherits"); - QString visibility = codegenConfig.readEntry("Visibility"); + 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"); - QString memberVariables = codegenConfig.readEntry("MemberVariables"); - QStringList headerIncludes = codegenConfig.readListEntry("IncludeFiles"); - QStringList mutators = codegenConfig.readListEntry("Mutators"); + 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; @@ -864,10 +864,10 @@ int main( int argc, char **argv ) globalEnums = codegenConfig.readBoolEntry( "GlobalEnums", false ); - QFile input( inputFilename ); + TQFile input( inputFilename ); - QDomDocument doc; - QString errorMsg; + TQDomDocument doc; + TQString errorMsg; int errorRow; int errorCol; if ( !doc.setContent( &input, &errorMsg, &errorRow, &errorCol ) ) { @@ -876,52 +876,52 @@ int main( int argc, char **argv ) return 1; } - QDomElement cfgElement = doc.documentElement(); + TQDomElement cfgElement = doc.documentElement(); if ( cfgElement.isNull() ) { kdError() << "No document in kcfg file" << endl; return 1; } - QString cfgFileName; + TQString cfgFileName; bool cfgFileNameArg = false; - QStringList parameters; - QStringList includes; + TQStringList parameters; + TQStringList includes; - QPtrList<CfgEntry> entries; + TQPtrList<CfgEntry> entries; entries.setAutoDelete( true ); - QDomNode n; + TQDomNode n; for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); - QString tag = e.tagName(); + TQString tag = e.tagName(); if ( tag == "include" ) { - QString includeFile = e.text(); + TQString includeFile = e.text(); if (!includeFile.isEmpty()) includes.append(includeFile); } else if ( tag == "kcfgfile" ) { cfgFileName = e.attribute( "name" ); cfgFileNameArg = e.attribute( "arg" ).lower() == "true"; - QDomNode n2; + TQDomNode n2; for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - QDomElement e2 = n2.toElement(); + TQDomElement e2 = n2.toElement(); if ( e2.tagName() == "parameter" ) { parameters.append( e2.attribute( "name" ) ); } } } else if ( tag == "group" ) { - QString group = e.attribute( "name" ); + TQString group = e.attribute( "name" ); if ( group.isEmpty() ) { kdError() << "Group without name" << endl; return 1; } - QDomNode n2; + TQDomNode n2; for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - QDomElement e2 = n2.toElement(); + TQDomElement e2 = n2.toElement(); if ( e2.tagName() != "entry" ) continue; CfgEntry *entry = parseEntry( group, e2 ); if ( entry ) entries.append( entry ); @@ -968,15 +968,15 @@ int main( int argc, char **argv ) } #endif - QString implementationFileName = baseName + ".rb"; + TQString implementationFileName = baseName + ".rb"; - QFile implementation( baseDir + implementationFileName ); + TQFile implementation( baseDir + implementationFileName ); if ( !implementation.open( IO_WriteOnly ) ) { kdError() << "Can't open '" << implementationFileName << "for writing." << endl; return 1; } - QTextStream rb( &implementation ); + 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; @@ -994,7 +994,7 @@ int main( int argc, char **argv ) // << className.upper() << "_H" << endl << endl; // Includes -// QStringList::ConstIterator it; +// TQStringList::ConstIterator it; // for( it = headerIncludes.begin(); it != headerIncludes.end(); ++it ) { // rb << "#include <" << *it << ">" << endl; // } @@ -1016,10 +1016,10 @@ int main( int argc, char **argv ) // enums CfgEntry *e; for( e = entries.first(); e; e = entries.next() ) { - QValueList<CfgEntry::Choice> choices = e->choices(); + TQValueList<CfgEntry::Choice> choices = e->choices(); if ( !choices.isEmpty() ) { - QStringList values; - QValueList<CfgEntry::Choice>::ConstIterator itChoice; + TQStringList values; + TQValueList<CfgEntry::Choice>::ConstIterator itChoice; for( itChoice = choices.begin(); itChoice != choices.end(); ++itChoice ) { if (globalEnums) { values.append( enumValue((*itChoice).name) ); @@ -1031,16 +1031,16 @@ int main( int argc, char **argv ) values.append( enumName(e->name()) + "_COUNT" ); } int count = 0; - for ( QStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { + for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { rb << " " << *it << " = " << count << endl; } rb << endl; } - QStringList values = e->paramValues(); + TQStringList values = e->paramValues(); if ( !values.isEmpty() ) { int count = 0; - for ( QStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { + for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { if (globalEnums) { rb << " " << enumValue(*it) << " = " << count << endl; } else { @@ -1055,7 +1055,7 @@ int main( int argc, char **argv ) rb << " def " << enumName(e->param()) << "ToString(i)" << endl; rb << " ["; count = 0; - for ( QStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { + for ( TQStringList::Iterator it = values.begin(); it != values.end(); ++it, count++ ) { if (count > 0) { rb << ", "; } @@ -1071,8 +1071,8 @@ int main( int argc, char **argv ) rb << endl; for( e = entries.first(); e; e = entries.next() ) { - QString n = e->name(); - QString t = e->type(); + TQString n = e->name(); + TQString t = e->type(); // Manipulator if (allMutators || mutators.contains(n)) @@ -1180,7 +1180,7 @@ int main( int argc, char **argv ) rb << " def initialize( "; if (cfgFileNameArg) rb << " config" << (parameters.isEmpty() ? " " : ", "); - for (QStringList::ConstIterator it = parameters.begin(); + for (TQStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it) { if (it != parameters.begin()) @@ -1196,13 +1196,13 @@ int main( int argc, char **argv ) rb << ")" << endl; // Store parameters - for (QStringList::ConstIterator it = parameters.begin(); + for (TQStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it) { rb << " @param" << *it << " = Qt::Variant.new( " << *it << " )" << endl; } - QString group; + TQString group; for( e = entries.first(); e; e = entries.next() ) { if ( e->group() != group ) { group = e->group(); @@ -1227,7 +1227,7 @@ int main( int argc, char **argv ) rb << endl; - group = QString::null; + group = TQString::null; for( e = entries.first(); e; e = entries.next() ) { if ( e->group() != group ) { if ( !group.isEmpty() ) rb << endl; @@ -1235,7 +1235,7 @@ int main( int argc, char **argv ) rb << " setCurrentGroup( " << paramString(group, parameters) << " )" << endl << endl; } - QString key = paramString(e->key(), parameters); + TQString key = paramString(e->key(), parameters); if ( !e->code().isEmpty()) { rb << e->code() << endl; @@ -1243,8 +1243,8 @@ int main( int argc, char **argv ) if ( e->type() == "Enum" ) { rb << " values" << e->name() << " = []" << endl; - QValueList<CfgEntry::Choice> choices = e->choices(); - QValueList<CfgEntry::Choice>::ConstIterator it; + 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; @@ -1275,7 +1275,7 @@ int main( int argc, char **argv ) rb << userTextsFunctions( e ); rb << " addItem( " << itemVar(e); - QString quotedName = e->name(); + TQString quotedName = e->name(); addQuotes( quotedName ); if ( quotedName != key ) rb << ", \"" << e->name() << "\""; rb << " )" << endl; @@ -1286,8 +1286,8 @@ int main( int argc, char **argv ) rb << " " << itemVar(e) << " = Array.new(" << e->paramMax()+1 << ")" << endl; for(int i = 0; i <= e->paramMax(); i++) { - QString defaultStr; - QString itemVarStr(itemVar(e)+QString("[%1]").arg(i)); + TQString defaultStr; + TQString itemVarStr(itemVar(e)+TQString("[%1]").arg(i)); if ( !e->paramDefaultValue(i).isEmpty() ) defaultStr = e->paramDefaultValue(i); @@ -1297,10 +1297,10 @@ int main( int argc, char **argv ) defaultStr = defaultValue( e->type() ); rb << " " << itemVarStr << " = " - << newItem( e->type(), e->name(), paramString(key, e, i), defaultStr, QString("[%1]").arg(i) ) + << newItem( e->type(), e->name(), paramString(key, e, i), defaultStr, TQString("[%1]").arg(i) ) << endl; - rb << " " << itemVarStr << ".property = " << varName(e->name())+QString("[%1]").arg(i) << endl; + rb << " " << itemVarStr << ".property = " << varName(e->name())+TQString("[%1]").arg(i) << endl; if ( setUserTexts ) rb << userTextsFunctions( e, itemVarStr, e->paramName() ); |