diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
commit | a374efce3a207b39514be3c52264091400ce297e (patch) | |
tree | 77bdf654b55826d4f59b53a5621310206bcaead1 /kig/filters/native-filter.cc | |
parent | f81a494f3957d5cf38c787973415597941934727 (diff) | |
download | tdeedu-a374efce3a207b39514be3c52264091400ce297e.tar.gz tdeedu-a374efce3a207b39514be3c52264091400ce297e.zip |
TQt4 port kdeedu
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kig/filters/native-filter.cc')
-rw-r--r-- | kig/filters/native-filter.cc | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/kig/filters/native-filter.cc b/kig/filters/native-filter.cc index a5378263..4a3d0a04 100644 --- a/kig/filters/native-filter.cc +++ b/kig/filters/native-filter.cc @@ -51,7 +51,7 @@ struct HierElem { int id; - std::vector<int> parents; + std::vector<int> tqparents; TQDomElement el; }; @@ -73,8 +73,8 @@ static void visitElem( std::vector<HierElem>& ret, { if ( !seen[i] ) { - for ( uint j = 0; j < elems[i].parents.size(); ++j ) - visitElem( ret, elems, seen, elems[i].parents[j] - 1); + for ( uint j = 0; j < elems[i].tqparents.size(); ++j ) + visitElem( ret, elems, seen, elems[i].tqparents[j] - 1); ret.push_back( elems[i] ); seen[i] = true; }; @@ -114,7 +114,7 @@ KigDocument* KigFilterNative::load( const TQString& file ) TQFile kigdoc( file ); #ifndef KIG_NO_COMPRESSED_FILES bool iscompressed = false; - if ( !file.endsWith( ".kig", false ) ) + if ( !file.tqendsWith( ".kig", false ) ) { // the file is compressed, so we have to decompress it and fetch the // kig file inside it... @@ -125,7 +125,7 @@ KigDocument* KigFilterNative::load( const TQString& file ) KIG_FILTER_PARSE_ERROR; TQString tempname = file.section( '/', -1 ); - if ( file.endsWith( ".kigz", false ) ) + if ( file.tqendsWith( ".kigz", false ) ) { tempname.remove( TQRegExp( "\\.[Kk][Ii][Gg][Zz]$" ) ); } @@ -193,7 +193,7 @@ KigDocument* KigFilterNative::load( const TQString& file ) if ( major > 0 || minor > 9 ) { notSupported( file, i18n( "This file was created by Kig version \"%1\", " - "which this version cannot open." ).arg( version ) ); + "which this version cannot open." ).tqarg( version ) ); return false; } else if ( major == 0 && minor <= 3 ) @@ -204,7 +204,7 @@ KigDocument* KigFilterNative::load( const TQString& file ) "You can try to open this file with an older Kig " "version (0.4 to 0.6),\n" "and then save it again, which will save it in the " - "new format." ).arg( version ) ); + "new format." ).tqarg( version ) ); return false; } else if ( major == 0 && minor <= 6 ) @@ -226,7 +226,7 @@ KigDocument* KigFilterNative::load04( const TQString& file, const TQDomElement& if ( e.tagName() == "CoordinateSystem" ) { const TQCString type = e.text().latin1(); - CoordinateSystem* s = CoordinateSystemFactory::build( type ); + CoordinateSystem* s = CoordinateSystemFactory::build( type.data() ); if ( ! s ) { warning( i18n( "This Kig file has a coordinate system " @@ -273,7 +273,7 @@ KigDocument* KigFilterNative::load04( const TQString& file, const TQDomElement& if ( ! ok ) KIG_FILTER_PARSE_ERROR; extendVect( elems, id ); - elems[id-1].parents.push_back( pid ); + elems[id-1].tqparents.push_back( pid ); } } }; @@ -315,14 +315,14 @@ KigDocument* KigFilterNative::load04( const TQString& file, const TQDomElement& propname = ec.text().latin1(); }; - if ( i->parents.size() != 1 ) KIG_FILTER_PARSE_ERROR; - ObjectCalcer* parent = retcalcers[i->parents[0] -1]; - QCStringList propnames = parent->imp()->propertiesInternalNames(); - int propid = propnames.findIndex( propname ); + if ( i->tqparents.size() != 1 ) KIG_FILTER_PARSE_ERROR; + ObjectCalcer* tqparent = retcalcers[i->tqparents[0] -1]; + QCStringList propnames = tqparent->imp()->propertiesInternalNames(); + int propid = propnames.tqfindIndex( propname ); if ( propid == -1 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectPropertyCalcer( parent, propid ); + o = new ObjectPropertyCalcer( tqparent, propid ); } else if ( e.tagName() == "Object" ) { @@ -331,23 +331,23 @@ KigDocument* KigFilterNative::load04( const TQString& file, const TQDomElement& KIG_FILTER_PARSE_ERROR; const ObjectType* type = - ObjectTypeFactory::instance()->find( tmp.latin1() ); + ObjectTypeFactory::instance()->tqfind( tmp.latin1() ); if ( !type ) { notSupported( file, i18n( "This Kig file uses an object of type \"%1\", " "which this Kig version does not support." "Perhaps you have compiled Kig without support " "for this object type," - "or perhaps you are using an older Kig version." ).arg( tmp ) ); + "or perhaps you are using an older Kig version." ).tqarg( tmp ) ); return false; }; - std::vector<ObjectCalcer*> parents; - for ( std::vector<int>::iterator j = i->parents.begin(); - j != i->parents.end(); ++j ) - parents.push_back( retcalcers[*j - 1] ); + std::vector<ObjectCalcer*> tqparents; + for ( std::vector<int>::iterator j = i->tqparents.begin(); + j != i->tqparents.end(); ++j ) + tqparents.push_back( retcalcers[*j - 1] ); - o = new ObjectTypeCalcer( type, parents ); + o = new ObjectTypeCalcer( type, tqparents ); } else continue; @@ -415,7 +415,7 @@ KigDocument* KigFilterNative::load07( const TQString& file, const TQDomElement& ret->setAxes( false ); } const TQCString type = tmptype.latin1(); - CoordinateSystem* s = CoordinateSystemFactory::build( type ); + CoordinateSystem* s = CoordinateSystemFactory::build( type.data() ); if ( ! s ) { warning( i18n( "This Kig file has a coordinate system " @@ -434,25 +434,25 @@ KigDocument* KigFilterNative::load07( const TQString& file, const TQDomElement& uint id = tmp.toInt( &ok ); if ( id <= 0 ) KIG_FILTER_PARSE_ERROR; - std::vector<ObjectCalcer*> parents; - for ( TQDomElement parentel = e.firstChild().toElement(); ! parentel.isNull(); - parentel = parentel.nextSibling().toElement() ) + std::vector<ObjectCalcer*> tqparents; + for ( TQDomElement tqparentel = e.firstChild().toElement(); ! tqparentel.isNull(); + tqparentel = tqparentel.nextSibling().toElement() ) { - if ( parentel.tagName() != "Parent" ) continue; - TQString tmp = parentel.attribute( "id" ); - uint parentid = tmp.toInt( &ok ); + if ( tqparentel.tagName() != "Parent" ) continue; + TQString tmp = tqparentel.attribute( "id" ); + uint tqparentid = tmp.toInt( &ok ); if ( ! ok ) KIG_FILTER_PARSE_ERROR; - if ( parentid == 0 || parentid > calcers.size() ) KIG_FILTER_PARSE_ERROR; - ObjectCalcer* parent = calcers[parentid - 1].get(); - if ( ! parent ) KIG_FILTER_PARSE_ERROR; - parents.push_back( parent ); + if ( tqparentid == 0 || tqparentid > calcers.size() ) KIG_FILTER_PARSE_ERROR; + ObjectCalcer* tqparent = calcers[tqparentid - 1].get(); + if ( ! tqparent ) KIG_FILTER_PARSE_ERROR; + tqparents.push_back( tqparent ); } ObjectCalcer* o = 0; if ( e.tagName() == "Data" ) { - if ( !parents.empty() ) KIG_FILTER_PARSE_ERROR; + if ( !tqparents.empty() ) KIG_FILTER_PARSE_ERROR; TQString tmp = e.attribute( "type" ); TQString error; ObjectImp* imp = ObjectImpFactory::instance()->deserialize( tmp, e, error ); @@ -465,42 +465,42 @@ KigDocument* KigFilterNative::load07( const TQString& file, const TQDomElement& } else if ( e.tagName() == "Property" ) { - if ( parents.size() != 1 ) KIG_FILTER_PARSE_ERROR; + if ( tqparents.size() != 1 ) KIG_FILTER_PARSE_ERROR; TQCString propname = e.attribute( "which" ).latin1(); - ObjectCalcer* parent = parents[0]; - int propid = parent->imp()->propertiesInternalNames().findIndex( propname ); + ObjectCalcer* tqparent = tqparents[0]; + int propid = tqparent->imp()->propertiesInternalNames().tqfindIndex( propname ); if ( propid == -1 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectPropertyCalcer( parent, propid ); + o = new ObjectPropertyCalcer( tqparent, propid ); } else if ( e.tagName() == "Object" ) { TQString tmp = e.attribute( "type" ); const ObjectType* type = - ObjectTypeFactory::instance()->find( tmp.latin1() ); + ObjectTypeFactory::instance()->tqfind( tmp.latin1() ); if ( ! type ) { notSupported( file, i18n( "This Kig file uses an object of type \"%1\", " "which this Kig version does not support." "Perhaps you have compiled Kig without support " "for this object type," - "or perhaps you are using an older Kig version." ).arg( tmp ) ); + "or perhaps you are using an older Kig version." ).tqarg( tmp ) ); return false; } // mp: (I take the responsibility for this!) explanation: the usual ObjectTypeCalcer - // constructor also "sortArgs" the parents. I believe that this *must not* be done + // constructor also "sortArgs" the tqparents. I believe that this *must not* be done // when loading from a saved kig file for the following reasons: // 1. the arguments should already be in their intended order, since the file was // saved from a working hierarchy; furthermore we actually want to restore the original // hierarchy, not really to also fix possible problems with the original hierarchy; // 2. calling sortArgs could have undesirable side effects in particular situations, // since kig actually allow an ObjectType to produce different type of ObjectImp's - // it may happen that the parents of an object do not satisfy the requirements + // it may happen that the tqparents of an object do not satisfy the requirements // enforced by sortArgs (while moving around the free objects) but still be // perfectly valid - o = new ObjectTypeCalcer( type, parents, false ); + o = new ObjectTypeCalcer( type, tqparents, false ); } else KIG_FILTER_PARSE_ERROR; @@ -604,8 +604,8 @@ bool KigFilterNative::save07( const KigDocument& kdoc, TQTextStream& stream ) const ObjectPropertyCalcer* o = static_cast<const ObjectPropertyCalcer*>( *i ); objectelem = doc.createElement( "Property" ); - TQCString propname = o->parent()->imp()->propertiesInternalNames()[o->propId()]; - objectelem.setAttribute( "which", propname ); + TQCString propname = o->tqparent()->imp()->propertiesInternalNames()[o->propId()]; + objectelem.setAttribute( TQString("which"), TQString(propname) ); } else if ( dynamic_cast<const ObjectTypeCalcer*>( *i ) ) { @@ -615,8 +615,8 @@ bool KigFilterNative::save07( const KigDocument& kdoc, TQTextStream& stream ) } else assert( false ); - const std::vector<ObjectCalcer*> parents = ( *i )->parents(); - for ( std::vector<ObjectCalcer*>::const_iterator i = parents.begin(); i != parents.end(); ++i ) + const std::vector<ObjectCalcer*> tqparents = ( *i )->tqparents(); + for ( std::vector<ObjectCalcer*>::const_iterator i = tqparents.begin(); i != tqparents.end(); ++i ) { std::map<const ObjectCalcer*,int>::const_iterator idp = idmap.find( *i ); assert( idp != idmap.end() ); @@ -642,7 +642,7 @@ bool KigFilterNative::save07( const KigDocument& kdoc, TQTextStream& stream ) TQDomElement drawelem = doc.createElement( "Draw" ); drawelem.setAttribute( "object", id ); drawelem.setAttribute( "color", d->color().name() ); - drawelem.setAttribute( "shown", TQString::fromLatin1( d->shown() ? "true" : "false" ) ); + drawelem.setAttribute( "shown", TQString::tqfromLatin1( d->shown() ? "true" : "false" ) ); drawelem.setAttribute( "width", TQString::number( d->width() ) ); drawelem.setAttribute( "style", d->styleToString() ); drawelem.setAttribute( "point-style", d->pointStyleToString() ); @@ -683,7 +683,7 @@ bool KigFilterNative::save07( const KigDocument& data, const TQString& outfile ) return save07( data, stdoutstream ); } #ifndef KIG_NO_COMPRESSED_FILES - if ( !outfile.endsWith( ".kig", false ) ) + if ( !outfile.tqendsWith( ".kig", false ) ) { // the user wants to save a compressed file, so we have to save our kig // file to a temp file and then compress it... @@ -693,7 +693,7 @@ bool KigFilterNative::save07( const KigDocument& data, const TQString& outfile ) return false; TQString tempname = outfile.section( '/', -1 ); - if ( outfile.endsWith( ".kigz", false ) ) + if ( outfile.tqendsWith( ".kigz", false ) ) tempname.remove( TQRegExp( "\\.[Kk][Ii][Gg][Zz]$" ) ); else return false; |