diff options
Diffstat (limited to 'src/itemdocumentdata.cpp')
-rw-r--r-- | src/itemdocumentdata.cpp | 332 |
1 files changed, 166 insertions, 166 deletions
diff --git a/src/itemdocumentdata.cpp b/src/itemdocumentdata.cpp index a582231..a352b04 100644 --- a/src/itemdocumentdata.cpp +++ b/src/itemdocumentdata.cpp @@ -24,15 +24,15 @@ #include <klocale.h> #include <kmessagebox.h> #include <ktempfile.h> -#include <qbitarray.h> -#include <qfile.h> +#include <tqbitarray.h> +#include <tqfile.h> -// Converts the QBitArray into a string (e.g. "F289A9E") that can be stored in an xml file -static QString toAsciiHex( QBitArray _data ) +// Converts the TQBitArray into a string (e.g. "F289A9E") that can be stored in an xml file +static TQString toAsciiHex( TQBitArray _data ) { - QBitArray data = _data; -// data = qCompress(data); + TQBitArray data = _data; +// data = tqCompress(data); // Pad out the data to a nice size if ( (data.size() % 4) != 0 ) @@ -41,32 +41,32 @@ static QString toAsciiHex( QBitArray _data ) data.resize( data.size() + 4 - (data.size()%4) ); } - QString text; + TQString text; for ( unsigned i = 0; i < data.size()/4; ++i ) { unsigned val = 0; for ( unsigned j = 0; j < 4; ++j ) val += (data[4*i+j] ? 1:0) << j; - text += QString::number( val, 16 ); + text += TQString::number( val, 16 ); } return text; } -// Converts a string (e.g. "F289A9E") into a QBitArray, the opposite of the above function -static QBitArray toQBitArray( QString text ) +// Converts a string (e.g. "F289A9E") into a TQBitArray, the opposite of the above function +static TQBitArray toTQBitArray( TQString text ) { unsigned size = text.length(); - QBitArray data(size*4); + TQBitArray data(size*4); for ( unsigned i = 0; i < size; ++i ) { - unsigned val = QString(text[i]).toInt( 0l, 16 ); + unsigned val = TQString(text[i]).toInt( 0l, 16 ); for ( unsigned j = 0; j < 4; ++j ) data[4*i+j] = val & (1 << j); } -// data = qUncompress(data); +// data = tqUncompress(data); return data; } @@ -97,7 +97,7 @@ void ItemDocumentData::reset() bool ItemDocumentData::loadData( const KURL &url ) { - QString target; + TQString target; if ( !KIO::NetAccess::download( url, target, 0l ) ) { // If the file could not be downloaded, for example does not @@ -107,15 +107,15 @@ bool ItemDocumentData::loadData( const KURL &url ) return false; } - QFile file(target); + TQFile file(target); if ( !file.open( IO_ReadOnly ) ) { - KMessageBox::sorry( 0l, i18n("Could not open %1 for reading").arg(target) ); + KMessageBox::sorry( 0l, i18n("Could not open %1 for reading").tqarg(target) ); return false; } - QString xml; - QTextStream textStream( &file ); + TQString xml; + TQTextStream textStream( &file ); while ( !textStream.eof() ) xml += textStream.readLine() + '\n'; @@ -124,27 +124,27 @@ bool ItemDocumentData::loadData( const KURL &url ) } -bool ItemDocumentData::fromXML( const QString &xml ) +bool ItemDocumentData::fromXML( const TQString &xml ) { reset(); - QDomDocument doc( "KTechlab" ); - QString errorMessage; + TQDomDocument doc( "KTechlab" ); + TQString errorMessage; if ( !doc.setContent( xml, &errorMessage ) ) { - KMessageBox::sorry( 0l, i18n("Couldn't parse xml:\n%1").arg(errorMessage) ); + KMessageBox::sorry( 0l, i18n("Couldn't parse xml:\n%1").tqarg(errorMessage) ); return false; } - QDomElement root = doc.documentElement(); + TQDomElement root = doc.documentElement(); - QDomNode node = root.firstChild(); + TQDomNode node = root.firstChild(); while ( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if ( !element.isNull() ) { - const QString tagName = element.tagName(); + const TQString tagName = element.tagName(); if ( tagName == "item" ) elementToItemData(element); @@ -177,14 +177,14 @@ bool ItemDocumentData::saveData( const KURL &url ) if ( url.isLocalFile() ) { - QFile file( url.path() ); + TQFile file( url.path() ); if ( !file.open(IO_WriteOnly) ) { - KMessageBox::sorry( 0l, i18n("Could not open '%1' for writing. Check that you have write permissions").arg(url.path()), i18n("Saving File") ); + KMessageBox::sorry( 0l, i18n("Could not open '%1' for writing. Check that you have write permissions").tqarg(url.path()), i18n("Saving File") ); return false; } - QTextStream stream(&file); + TQTextStream stream(&file); stream << toXML(); file.close(); } @@ -205,12 +205,12 @@ bool ItemDocumentData::saveData( const KURL &url ) } -QString ItemDocumentData::toXML() +TQString ItemDocumentData::toXML() { - QDomDocument doc("KTechlab"); + TQDomDocument doc("KTechlab"); //TODO Add revision information to save file - QDomElement root = doc.createElement("document"); + TQDomElement root = doc.createElement("document"); root.setAttribute( "type", documentTypeString() ); doc.appendChild(root); @@ -218,7 +218,7 @@ QString ItemDocumentData::toXML() const ItemDataMap::iterator end = m_itemDataMap.end(); for ( ItemDataMap::iterator it = m_itemDataMap.begin(); it != end; ++it ) { - QDomElement node = itemDataToElement( doc, it.data() ); + TQDomElement node = itemDataToElement( doc, it.data() ); node.setAttribute( "id", it.key() ); root.appendChild(node); } @@ -227,7 +227,7 @@ QString ItemDocumentData::toXML() const ConnectorDataMap::iterator end = m_connectorDataMap.end(); for ( ConnectorDataMap::iterator it = m_connectorDataMap.begin(); it != end; ++it ) { - QDomElement node = connectorDataToElement( doc, it.data() ); + TQDomElement node = connectorDataToElement( doc, it.data() ); node.setAttribute( "id", it.key() ); root.appendChild(node); } @@ -236,14 +236,14 @@ QString ItemDocumentData::toXML() const NodeDataMap::iterator end = m_nodeDataMap.end(); for ( NodeDataMap::iterator it = m_nodeDataMap.begin(); it != end; ++it ) { - QDomElement node = nodeDataToElement( doc, it.data() ); + TQDomElement node = nodeDataToElement( doc, it.data() ); node.setAttribute( "id", it.key() ); root.appendChild(node); } } if ( m_documentType == Document::dt_flowcode ) { - QDomElement node = microDataToElement(doc); + TQDomElement node = microDataToElement(doc); root.appendChild(node); } @@ -252,19 +252,19 @@ QString ItemDocumentData::toXML() -//BEGIN functions for generating / reading QDomElements -QDomElement ItemDocumentData::microDataToElement( QDomDocument &doc ) +//BEGIN functions for generating / reading TQDomElements +TQDomElement ItemDocumentData::microDataToElement( TQDomDocument &doc ) { - QDomElement node = doc.createElement("micro"); + TQDomElement node = doc.createElement("micro"); node.setAttribute( "id", m_microData.id ); { const PinMappingMap::iterator end = m_microData.pinMappings.end(); for ( PinMappingMap::iterator it = m_microData.pinMappings.begin(); it != end; ++it ) { - QDomElement pinMapNode = doc.createElement("pinmap"); + TQDomElement pinMapNode = doc.createElement("pinmap"); - QString type; + TQString type; switch ( it.data().type() ) { case PinMapping::SevenSegment: @@ -295,7 +295,7 @@ QDomElement ItemDocumentData::microDataToElement( QDomDocument &doc ) const PinDataMap::iterator end = m_microData.pinMap.end(); for ( PinDataMap::iterator it = m_microData.pinMap.begin(); it != end; ++it ) { - QDomElement pinNode = doc.createElement("pin"); + TQDomElement pinNode = doc.createElement("pin"); pinNode.setAttribute( "id", it.key() ); pinNode.setAttribute( "type", (it.data().type == PinSettings::pt_input) ? "input" : "output" ); @@ -306,10 +306,10 @@ QDomElement ItemDocumentData::microDataToElement( QDomDocument &doc ) } { - const QStringMap::iterator end = m_microData.variableMap.end(); - for ( QStringMap::iterator it = m_microData.variableMap.begin(); it != end; ++it ) + const TQStringMap::iterator end = m_microData.variableMap.end(); + for ( TQStringMap::iterator it = m_microData.variableMap.begin(); it != end; ++it ) { - QDomElement variableNode = doc.createElement("variable"); + TQDomElement variableNode = doc.createElement("variable"); variableNode.setAttribute( "name", it.key() ); variableNode.setAttribute( "value", it.data() ); @@ -322,12 +322,12 @@ QDomElement ItemDocumentData::microDataToElement( QDomDocument &doc ) } -void ItemDocumentData::elementToMicroData( QDomElement element ) +void ItemDocumentData::elementToMicroData( TQDomElement element ) { - QString id = element.attribute( "id", QString::null ); + TQString id = element.attribute( "id", TQString() ); if ( id.isNull() ) - id = element.attribute( "pic", QString::null ); + id = element.attribute( "pic", TQString() ); if ( id.isNull() ) { @@ -338,18 +338,18 @@ void ItemDocumentData::elementToMicroData( QDomElement element ) m_microData.reset(); m_microData.id = id; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while ( !node.isNull() ) { - QDomElement childElement = node.toElement(); + TQDomElement childElement = node.toElement(); if ( !childElement.isNull() ) { - const QString tagName = childElement.tagName(); + const TQString tagName = childElement.tagName(); if ( tagName == "pinmap" ) { - QString id = childElement.attribute( "id", QString::null ); - QString typeString = childElement.attribute( "type", QString::null ); + TQString id = childElement.attribute( "id", TQString() ); + TQString typeString = childElement.attribute( "type", TQString() ); if ( !id.isEmpty() && !typeString.isEmpty() ) { @@ -365,7 +365,7 @@ void ItemDocumentData::elementToMicroData( QDomElement element ) type = PinMapping::Keypad_4x4; PinMapping pinMapping( type ); - pinMapping.setPins( QStringList::split( " ", childElement.attribute( "map", 0 ) ) ); + pinMapping.setPins( TQStringList::split( " ", childElement.attribute( "map", 0 ) ) ); m_microData.pinMappings[id] = pinMapping; } @@ -373,7 +373,7 @@ void ItemDocumentData::elementToMicroData( QDomElement element ) else if ( tagName == "pin" ) { - QString pinID = childElement.attribute( "id", QString::null ); + TQString pinID = childElement.attribute( "id", TQString() ); if ( !pinID.isEmpty() ) { m_microData.pinMap[pinID].type = (childElement.attribute( "type", "input" ) == "input" ) ? PinSettings::pt_input : PinSettings::pt_output; @@ -383,8 +383,8 @@ void ItemDocumentData::elementToMicroData( QDomElement element ) else if ( tagName == "variable" ) { - QString variableId = childElement.attribute( "name", QString::null ); - m_microData.variableMap[variableId] = childElement.attribute( "value", QString::null ); + TQString variableId = childElement.attribute( "name", TQString() ); + m_microData.variableMap[variableId] = childElement.attribute( "value", TQString() ); } else @@ -396,9 +396,9 @@ void ItemDocumentData::elementToMicroData( QDomElement element ) } -QDomElement ItemDocumentData::itemDataToElement( QDomDocument &doc, const ItemData &itemData ) +TQDomElement ItemDocumentData::itemDataToElement( TQDomDocument &doc, const ItemData &itemData ) { - QDomElement node = doc.createElement("item"); + TQDomElement node = doc.createElement("item"); node.setAttribute( "type", itemData.type ); node.setAttribute( "x", itemData.x ); node.setAttribute( "y", itemData.y ); @@ -423,13 +423,13 @@ QDomElement ItemDocumentData::itemDataToElement( QDomDocument &doc, const ItemDa node.setAttribute( "flip", itemData.flipped ); } - if ( !itemData.parentId.isEmpty() ) - node.setAttribute( "parent", itemData.parentId ); + if ( !itemData.tqparentId.isEmpty() ) + node.setAttribute( "tqparent", itemData.tqparentId ); - const QStringMap::const_iterator stringEnd = itemData.dataString.end(); - for ( QStringMap::const_iterator it = itemData.dataString.begin(); it != stringEnd; ++it ) + const TQStringMap::const_iterator stringEnd = itemData.dataString.end(); + for ( TQStringMap::const_iterator it = itemData.dataString.begin(); it != stringEnd; ++it ) { - QDomElement e = doc.createElement("data"); + TQDomElement e = doc.createElement("data"); node.appendChild(e); e.setAttribute( "id", it.key() ); e.setAttribute( "type", "string" ); @@ -439,27 +439,27 @@ QDomElement ItemDocumentData::itemDataToElement( QDomDocument &doc, const ItemDa const DoubleMap::const_iterator numberEnd = itemData.dataNumber.end(); for ( DoubleMap::const_iterator it = itemData.dataNumber.begin(); it != numberEnd; ++it ) { - QDomElement e = doc.createElement("data"); + TQDomElement e = doc.createElement("data"); node.appendChild(e); e.setAttribute( "id", it.key() ); e.setAttribute( "type", "number" ); - e.setAttribute( "value", QString::number(it.data()) ); + e.setAttribute( "value", TQString::number(it.data()) ); } - const QColorMap::const_iterator colorEnd = itemData.dataColor.end(); - for ( QColorMap::const_iterator it = itemData.dataColor.begin(); it != colorEnd; ++it ) + const TQColorMap::const_iterator colorEnd = itemData.dataColor.end(); + for ( TQColorMap::const_iterator it = itemData.dataColor.begin(); it != colorEnd; ++it ) { - QDomElement e = doc.createElement("data"); + TQDomElement e = doc.createElement("data"); node.appendChild(e); e.setAttribute( "id", it.key() ); e.setAttribute( "type", "color" ); e.setAttribute( "value", it.data().name() ); } - const QBitArrayMap::const_iterator rawEnd = itemData.dataRaw.end(); - for ( QBitArrayMap::const_iterator it = itemData.dataRaw.begin(); it != rawEnd; ++it ) + const TQBitArrayMap::const_iterator rawEnd = itemData.dataRaw.end(); + for ( TQBitArrayMap::const_iterator it = itemData.dataRaw.begin(); it != rawEnd; ++it ) { - QDomElement e = doc.createElement("data"); + TQDomElement e = doc.createElement("data"); node.appendChild(e); e.setAttribute( "id", it.key() ); e.setAttribute( "type", "raw" ); @@ -469,38 +469,38 @@ QDomElement ItemDocumentData::itemDataToElement( QDomDocument &doc, const ItemDa const BoolMap::const_iterator boolEnd = itemData.dataBool.end(); for ( BoolMap::const_iterator it = itemData.dataBool.begin(); it != boolEnd; ++it ) { - QDomElement e = doc.createElement("data"); + TQDomElement e = doc.createElement("data"); node.appendChild(e); e.setAttribute( "id", it.key() ); e.setAttribute( "type", "bool" ); - e.setAttribute( "value", QString::number(it.data()) ); + e.setAttribute( "value", TQString::number(it.data()) ); } const BoolMap::const_iterator buttonEnd = itemData.buttonMap.end(); for ( BoolMap::const_iterator it = itemData.buttonMap.begin(); it != buttonEnd; ++it ) { - QDomElement e = doc.createElement("button"); + TQDomElement e = doc.createElement("button"); node.appendChild(e); e.setAttribute( "id", it.key() ); - e.setAttribute( "state", QString::number(it.data()) ); + e.setAttribute( "state", TQString::number(it.data()) ); } const IntMap::const_iterator sliderEnd = itemData.sliderMap.end(); for ( IntMap::const_iterator it = itemData.sliderMap.begin(); it != sliderEnd; ++it ) { - QDomElement e = doc.createElement("slider"); + TQDomElement e = doc.createElement("slider"); node.appendChild(e); e.setAttribute( "id", it.key() ); - e.setAttribute( "value", QString::number(it.data()) ); + e.setAttribute( "value", TQString::number(it.data()) ); } return node; } -void ItemDocumentData::elementToItemData( QDomElement element ) +void ItemDocumentData::elementToItemData( TQDomElement element ) { - QString id = element.attribute( "id", QString::null ); + TQString id = element.attribute( "id", TQString() ); if ( id.isNull() ) { kdError() << k_funcinfo << "Could not find id in element" << endl; @@ -508,7 +508,7 @@ void ItemDocumentData::elementToItemData( QDomElement element ) } ItemData itemData; - itemData.type = element.attribute( "type", QString::null ); + itemData.type = element.attribute( "type", TQString() ); itemData.x = element.attribute( "x", "120" ).toInt(); itemData.y = element.attribute( "y", "120" ).toInt(); itemData.z = element.attribute( "z", "-1" ).toInt(); @@ -517,7 +517,7 @@ void ItemDocumentData::elementToItemData( QDomElement element ) element.hasAttribute("height") ) { itemData.setSize = true; - itemData.size = QRect( element.attribute( "offset-x", "0" ).toInt(), + itemData.size = TQRect( element.attribute( "offset-x", "0" ).toInt(), element.attribute( "offset-y", "0" ).toInt(), element.attribute( "width", "120" ).toInt(), element.attribute( "height", "120" ).toInt() ); @@ -528,45 +528,45 @@ void ItemDocumentData::elementToItemData( QDomElement element ) itemData.angleDegrees = element.attribute( "angle", "0" ).toInt(); itemData.flipped = element.attribute( "flip", "0" ).toInt(); itemData.orientation = element.attribute( "orientation", "-1" ).toInt(); - itemData.parentId = element.attribute( "parent", QString::null ); + itemData.tqparentId = element.attribute( "tqparent", TQString() ); m_itemDataMap[id] = itemData; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while ( !node.isNull() ) { - QDomElement childElement = node.toElement(); + TQDomElement childElement = node.toElement(); if ( !childElement.isNull() ) { - const QString tagName = childElement.tagName(); + const TQString tagName = childElement.tagName(); if ( tagName == "item" ) { // We're reading in a file saved in the older format, with // child items nestled, so we must specify that the new item - // has the currently parsed item as its parent. + // has the currently parsed item as its tqparent. elementToItemData(childElement); - QString childId = childElement.attribute( "id", QString::null ); + TQString childId = childElement.attribute( "id", TQString() ); if ( !childId.isNull() ) - m_itemDataMap[childId].parentId = id; + m_itemDataMap[childId].tqparentId = id; } else if ( tagName == "data" ) { - QString dataId = childElement.attribute( "id", QString::null ); + TQString dataId = childElement.attribute( "id", TQString() ); if ( !dataId.isNull() ) { - QString dataType = childElement.attribute( "type", QString::null ); - QString value = childElement.attribute( "value", QString::null ); + TQString dataType = childElement.attribute( "type", TQString() ); + TQString value = childElement.attribute( "value", TQString() ); if ( dataType == "string" || dataType == "multiline" ) m_itemDataMap[id].dataString[dataId] = value; else if ( dataType == "number" ) m_itemDataMap[id].dataNumber[dataId] = value.toDouble(); else if ( dataType == "color" ) - m_itemDataMap[id].dataColor[dataId] = QColor(value); + m_itemDataMap[id].dataColor[dataId] = TQColor(value); else if ( dataType == "raw" ) - m_itemDataMap[id].dataRaw[dataId] = toQBitArray(value); + m_itemDataMap[id].dataRaw[dataId] = toTQBitArray(value); else if ( dataType == "bool" ) m_itemDataMap[id].dataBool[dataId] = bool(value.toInt()); else @@ -576,14 +576,14 @@ void ItemDocumentData::elementToItemData( QDomElement element ) else if ( tagName == "button" ) { - QString buttonId = childElement.attribute( "id", QString::null ); + TQString buttonId = childElement.attribute( "id", TQString() ); if ( !buttonId.isNull() ) m_itemDataMap[id].buttonMap[buttonId] = childElement.attribute( "state", "0" ).toInt(); } else if ( tagName == "slider" ) { - QString sliderId = childElement.attribute( "id", QString::null ); + TQString sliderId = childElement.attribute( "id", TQString() ); if ( !sliderId.isNull() ) m_itemDataMap[id].sliderMap[sliderId] = childElement.attribute( "value", "0" ).toInt(); } @@ -600,18 +600,18 @@ void ItemDocumentData::elementToItemData( QDomElement element ) } -QDomElement ItemDocumentData::nodeDataToElement( QDomDocument &doc, const NodeData &nodeData ) +TQDomElement ItemDocumentData::nodeDataToElement( TQDomDocument &doc, const NodeData &nodeData ) { - QDomElement node = doc.createElement("node"); + TQDomElement node = doc.createElement("node"); node.setAttribute( "x", nodeData.x ); node.setAttribute( "y", nodeData.y ); return node; } -void ItemDocumentData::elementToNodeData( QDomElement element ) +void ItemDocumentData::elementToNodeData( TQDomElement element ) { - QString id = element.attribute( "id", QString::null ); + TQString id = element.attribute( "id", TQString() ); if ( id.isNull() ) { kdError() << k_funcinfo << "Could not find id in element" << endl; @@ -626,18 +626,18 @@ void ItemDocumentData::elementToNodeData( QDomElement element ) } -QDomElement ItemDocumentData::connectorDataToElement( QDomDocument &doc, const ConnectorData &connectorData ) +TQDomElement ItemDocumentData::connectorDataToElement( TQDomDocument &doc, const ConnectorData &connectorData ) { - QDomElement node = doc.createElement("connector"); + TQDomElement node = doc.createElement("connector"); node.setAttribute( "manual-route", connectorData.manualRoute ); - QString route; - const QPointList::const_iterator end = connectorData.route.end(); - for ( QPointList::const_iterator it = connectorData.route.begin(); it != end; ++it ) + TQString route; + const TQPointList::const_iterator end = connectorData.route.end(); + for ( TQPointList::const_iterator it = connectorData.route.begin(); it != end; ++it ) { - route.append( QString::number((*it).x())+"," ); - route.append( QString::number((*it).y())+"," ); + route.append( TQString::number((*it).x())+"," ); + route.append( TQString::number((*it).y())+"," ); } node.setAttribute( "route", route ); @@ -645,7 +645,7 @@ QDomElement ItemDocumentData::connectorDataToElement( QDomDocument &doc, const C { node.setAttribute( "start-node-is-child", 1 ); node.setAttribute( "start-node-cid", connectorData.startNodeCId ); - node.setAttribute( "start-node-parent", connectorData.startNodeParent ); + node.setAttribute( "start-node-tqparent", connectorData.startNodeParent ); } else { @@ -658,7 +658,7 @@ QDomElement ItemDocumentData::connectorDataToElement( QDomDocument &doc, const C { node.setAttribute( "end-node-is-child", 1 ); node.setAttribute( "end-node-cid", connectorData.endNodeCId ); - node.setAttribute( "end-node-parent", connectorData.endNodeParent ); + node.setAttribute( "end-node-tqparent", connectorData.endNodeParent ); } else { @@ -670,9 +670,9 @@ QDomElement ItemDocumentData::connectorDataToElement( QDomDocument &doc, const C } -void ItemDocumentData::elementToConnectorData( QDomElement element ) +void ItemDocumentData::elementToConnectorData( TQDomElement element ) { - QString id = element.attribute( "id", QString::null ); + TQString id = element.attribute( "id", TQString() ); if ( id.isNull() ) { kdError() << k_funcinfo << "Could not find id in element" << endl; @@ -682,47 +682,47 @@ void ItemDocumentData::elementToConnectorData( QDomElement element ) ConnectorData connectorData; connectorData.manualRoute = element.attribute( "manual-route", "0" ); - QString route = element.attribute( "route", "" ); + TQString route = element.attribute( "route", "" ); - QStringList points = QStringList::split( ",", route ); - const QStringList::iterator end = points.end(); - for ( QStringList::iterator it = points.begin(); it != end; ++it ) + TQStringList points = TQStringList::split( ",", route ); + const TQStringList::iterator end = points.end(); + for ( TQStringList::iterator it = points.begin(); it != end; ++it ) { int x = (*it).toInt(); it++; if ( it != end ) { int y = (*it).toInt(); - connectorData.route.append( QPoint(x,y) ); + connectorData.route.append( TQPoint(x,y) ); } } connectorData.startNodeIsChild = element.attribute( "start-node-is-child", "0" ).toInt(); if ( connectorData.startNodeIsChild ) { - connectorData.startNodeCId = element.attribute( "start-node-cid", QString::null ); - connectorData.startNodeParent = element.attribute( "start-node-parent", QString::null ); + connectorData.startNodeCId = element.attribute( "start-node-cid", TQString() ); + connectorData.startNodeParent = element.attribute( "start-node-tqparent", TQString() ); } else - connectorData.startNodeId = element.attribute( "start-node-id", QString::null ); + connectorData.startNodeId = element.attribute( "start-node-id", TQString() ); connectorData.endNodeIsChild = element.attribute( "end-node-is-child", "0" ).toInt(); if ( connectorData.endNodeIsChild ) { - connectorData.endNodeCId = element.attribute( "end-node-cid", QString::null ); - connectorData.endNodeParent = element.attribute( "end-node-parent", QString::null ); + connectorData.endNodeCId = element.attribute( "end-node-cid", TQString() ); + connectorData.endNodeParent = element.attribute( "end-node-tqparent", TQString() ); } else - connectorData.endNodeId = element.attribute( "end-node-id", QString::null ); + connectorData.endNodeId = element.attribute( "end-node-id", TQString() ); m_connectorDataMap[id] = connectorData; } -//END functions for generating / reading QDomElements +//END functions for generating / reading TQDomElements -QString ItemDocumentData::documentTypeString() const +TQString ItemDocumentData::documentTypeString() const { switch (m_documentType) { @@ -744,7 +744,7 @@ QString ItemDocumentData::documentTypeString() const } -QString ItemDocumentData::revisionString() const +TQString ItemDocumentData::revisionString() const { return "1"; } @@ -780,9 +780,9 @@ void ItemDocumentData::generateUniqueIDs( ItemDocument *itemDocument ) if (!itemDocument) return; - QStringMap replaced; - replaced[""] = QString::null; - replaced[QString::null] = QString::null; + TQStringMap replaced; + replaced[""] = TQString(); + replaced[TQString()] = TQString(); ItemDataMap newItemDataMap; ConnectorDataMap newConnectorDataMap; @@ -793,7 +793,7 @@ void ItemDocumentData::generateUniqueIDs( ItemDocument *itemDocument ) const ItemDataMap::iterator end = m_itemDataMap.end(); for ( ItemDataMap::iterator it = m_itemDataMap.begin(); it != end; ++it ) { - if ( !replaced.contains( it.key() ) ) + if ( !replaced.tqcontains( it.key() ) ) replaced[it.key()] = itemDocument->generateUID(it.key()); newItemDataMap[replaced[it.key()]] = it.data(); @@ -803,7 +803,7 @@ void ItemDocumentData::generateUniqueIDs( ItemDocument *itemDocument ) const NodeDataMap::iterator end = m_nodeDataMap.end(); for ( NodeDataMap::iterator it = m_nodeDataMap.begin(); it != end; ++it ) { - if ( !replaced.contains( it.key() ) ) + if ( !replaced.tqcontains( it.key() ) ) replaced[it.key()] = itemDocument->generateUID(it.key()); newNodeDataMap[replaced[it.key()]] = it.data(); @@ -813,7 +813,7 @@ void ItemDocumentData::generateUniqueIDs( ItemDocument *itemDocument ) const ConnectorDataMap::iterator end = m_connectorDataMap.end(); for ( ConnectorDataMap::iterator it = m_connectorDataMap.begin(); it != end; ++it ) { - if ( !replaced.contains( it.key() ) ) + if ( !replaced.tqcontains( it.key() ) ) replaced[it.key()] = itemDocument->generateUID(it.key()); newConnectorDataMap[replaced[it.key()]] = it.data(); @@ -826,7 +826,7 @@ void ItemDocumentData::generateUniqueIDs( ItemDocument *itemDocument ) const ItemDataMap::iterator end = newItemDataMap.end(); for ( ItemDataMap::iterator it = newItemDataMap.begin(); it != end; ++it ) { - it.data().parentId = replaced[it.data().parentId]; + it.data().tqparentId = replaced[it.data().tqparentId]; } } { @@ -872,10 +872,10 @@ void ItemDocumentData::translateContents( int dx, int dy ) const ConnectorDataMap::iterator end = m_connectorDataMap.end(); for ( ConnectorDataMap::iterator it = m_connectorDataMap.begin(); it != end; ++it ) { - const QPointList::iterator routeEnd = it.data().route.end(); - for ( QPointList::iterator routeIt = it.data().route.begin(); routeIt != routeEnd; ++routeIt ) + const TQPointList::iterator routeEnd = it.data().route.end(); + for ( TQPointList::iterator routeIt = it.data().route.begin(); routeIt != routeEnd; ++routeIt ) { - *routeIt += QPoint( dx/8, dy/8 ); + *routeIt += TQPoint( dx/8, dy/8 ); } } } @@ -966,12 +966,12 @@ void ItemDocumentData::mergeWithDocument( ItemDocument *itemDocument, bool selec { if ( !icnd->nodeWithID( it.key() ) ) { - QString id = it.key(); + TQString id = it.key(); if ( itemDocument->type() == Document::dt_circuit ) - new ECNode( icnd, Node::ec_junction, Node::dir_up, QPoint( int(it.data().x), int(it.data().y) ), &id ); + new ECNode( icnd, Node::ec_junction, Node::dir_up, TQPoint( int(it.data().x), int(it.data().y) ), &id ); else if ( itemDocument->type() == Document::dt_flowcode ) - new FPNode( icnd, Node::fp_junction, Node::dir_up, QPoint( int(it.data().x), int(it.data().y) ), &id ); + new FPNode( icnd, Node::fp_junction, Node::dir_up, TQPoint( int(it.data().x), int(it.data().y) ), &id ); } } for ( NodeDataMap::iterator it = m_nodeDataMap.begin(); it != nodeEnd; ++it ) @@ -1000,8 +1000,8 @@ void ItemDocumentData::mergeWithDocument( ItemDocument *itemDocument, bool selec } if (item) { - //HACK We move the item now before restoreFromItemData is called later, in case it is to be parented - //(as we don't want to move children)... + //HACK We move the item now before restoreFromItemData is called later, in case it is to be tqparented + //(as we don't want to move tqchildren)... item->move( it.data().x, it.data().y ); } } @@ -1029,7 +1029,7 @@ void ItemDocumentData::mergeWithDocument( ItemDocument *itemDocument, bool selec if ( icnd->connectorWithID( it.key() ) ) continue; - QString id = it.key(); + TQString id = it.key(); Node *startNode = 0l; Node *endNode = 0l; @@ -1037,7 +1037,7 @@ void ItemDocumentData::mergeWithDocument( ItemDocument *itemDocument, bool selec { CNItem *item = icnd->cnItemWithID( it.data().startNodeParent ); if (!item) - kdError() << k_funcinfo << "Unable to find node parent with id: "<<it.data().startNodeParent<<endl; + kdError() << k_funcinfo << "Unable to find node tqparent with id: "<<it.data().startNodeParent<<endl; else startNode = item->childNode( it.data().startNodeCId ); } @@ -1048,7 +1048,7 @@ void ItemDocumentData::mergeWithDocument( ItemDocument *itemDocument, bool selec { CNItem *item = icnd->cnItemWithID( it.data().endNodeParent ); if (!item) - kdError() << k_funcinfo << "Unable to find node parent with id: "<<it.data().endNodeParent<<endl; + kdError() << k_funcinfo << "Unable to find node tqparent with id: "<<it.data().endNodeParent<<endl; else endNode = item->childNode( it.data().endNodeCId ); } @@ -1139,19 +1139,19 @@ void ItemDocumentData::addNodes( const NodeList &nodeList ) } -void ItemDocumentData::addItemData( ItemData itemData, QString id ) +void ItemDocumentData::addItemData( ItemData itemData, TQString id ) { m_itemDataMap[id] = itemData; } -void ItemDocumentData::addConnectorData( ConnectorData connectorData, QString id ) +void ItemDocumentData::addConnectorData( ConnectorData connectorData, TQString id ) { m_connectorDataMap[id] = connectorData; } -void ItemDocumentData::addNodeData( NodeData nodeData, QString id ) +void ItemDocumentData::addNodeData( NodeData nodeData, TQString id ) { m_nodeDataMap[id] = nodeData; } @@ -1208,7 +1208,7 @@ MicroData::MicroData() void MicroData::reset() { - id = QString::null; + id = TQString(); pinMap.clear(); } //END class MicroData @@ -1229,7 +1229,7 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) generateUniqueIDs( ecSubcircuit->itemDocument() ); // Generate a list of the External Connections, sorting by x coordinate - std::multimap< double, QString > extCon; + std::multimap< double, TQString > extCon; ItemDataMap::iterator itemEnd = m_itemDataMap.end(); for ( ItemDataMap::iterator it = m_itemDataMap.begin(); it != itemEnd; ++it ) { @@ -1241,12 +1241,12 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) ecSubcircuit->setNumExtCon(extCon.size()); // Sort the connections into the pins of the subcircuit by y coordinate - std::multimap< double, QString > leftPins; - std::multimap< double, QString > rightPins; + std::multimap< double, TQString > leftPins; + std::multimap< double, TQString > rightPins; int at = 0; int size = (extCon.size()/2) + (extCon.size()%2); - const std::multimap< double, QString >::iterator extConEnd = extCon.end(); - for ( std::multimap< double, QString >::iterator it = extCon.begin(); it != extConEnd; ++it ) + const std::multimap< double, TQString >::iterator extConEnd = extCon.end(); + for ( std::multimap< double, TQString >::iterator it = extCon.begin(); it != extConEnd; ++it ) { if ( at < size ) leftPins.insert( std::make_pair( m_itemDataMap[it->second].y, it->second ) ); @@ -1257,22 +1257,22 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) // Remove the external connections (recording their names and associated numerical position) int nodeId = 0; - typedef QMap<QString,int> IntMap; + typedef TQMap<TQString,int> IntMap; IntMap nodeMap; - const std::multimap< double, QString >::iterator leftPinsEnd = leftPins.end(); - for ( std::multimap< double, QString >::iterator it = leftPins.begin(); it != leftPinsEnd; ++it ) + const std::multimap< double, TQString >::iterator leftPinsEnd = leftPins.end(); + for ( std::multimap< double, TQString >::iterator it = leftPins.begin(); it != leftPinsEnd; ++it ) { nodeMap[ it->second ] = nodeId; - ecSubcircuit->setExtConName( nodeId, m_itemDataMap[ it->second ].dataString["name"].data() ); + ecSubcircuit->setExtConName( nodeId, m_itemDataMap[ it->second ].dataString["name"] ); nodeId++; m_itemDataMap.remove( it->second ); } nodeId = extCon.size()-1; - const std::multimap< double, QString >::iterator rightPinsEnd = rightPins.end(); - for ( std::multimap< double, QString >::iterator it = rightPins.begin(); it != rightPinsEnd; ++it ) + const std::multimap< double, TQString >::iterator rightPinsEnd = rightPins.end(); + for ( std::multimap< double, TQString >::iterator it = rightPins.begin(); it != rightPinsEnd; ++it ) { nodeMap[ it->second ] = nodeId; - ecSubcircuit->setExtConName( nodeId, m_itemDataMap[ it->second ].dataString["name"].data() ); + ecSubcircuit->setExtConName( nodeId, m_itemDataMap[ it->second ].dataString["name"] ); nodeId--; m_itemDataMap.remove( it->second ); } @@ -1281,15 +1281,15 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) const ConnectorDataMap::iterator connectorEnd = m_connectorDataMap.end(); for ( ConnectorDataMap::iterator it = m_connectorDataMap.begin(); it != connectorEnd; ++it ) { - if ( it.data().startNodeIsChild && nodeMap.contains(it.data().startNodeParent ) ) + if ( it.data().startNodeIsChild && nodeMap.tqcontains(it.data().startNodeParent ) ) { - it.data().startNodeCId = QString::number( nodeMap[it.data().startNodeParent] ); + it.data().startNodeCId = TQString::number( nodeMap[it.data().startNodeParent] ); it.data().startNodeParent = ecSubcircuit->id(); } - if ( it.data().endNodeIsChild && nodeMap.contains(it.data().endNodeParent ) ) + if ( it.data().endNodeIsChild && nodeMap.tqcontains(it.data().endNodeParent ) ) { - it.data().endNodeCId = QString::number( nodeMap[it.data().endNodeParent] ); + it.data().endNodeCId = TQString::number( nodeMap[it.data().endNodeParent] ); it.data().endNodeParent = ecSubcircuit->id(); } } @@ -1308,7 +1308,7 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) component->updateConnectorPoints(false); component->setVisible(false); component->setCanvas(0l); - ecSubcircuit->connect( ecSubcircuit, SIGNAL(subcircuitDeleted()), component, SLOT(removeItem()) ); + ecSubcircuit->connect( ecSubcircuit, TQT_SIGNAL(subcircuitDeleted()), component, TQT_SLOT(removeItem()) ); } } for ( ConnectorDataMap::iterator it = m_connectorDataMap.begin(); it != connectorEnd; ++it ) @@ -1319,7 +1319,7 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) connector->updateConnectorPoints(false); connector->setVisible(false); connector->setCanvas(0l); - ecSubcircuit->connect( ecSubcircuit, SIGNAL(subcircuitDeleted()), connector, SLOT(removeConnector()) ); + ecSubcircuit->connect( ecSubcircuit, TQT_SIGNAL(subcircuitDeleted()), connector, TQT_SLOT(removeConnector()) ); } } const NodeDataMap::iterator nodeEnd = m_nodeDataMap.end(); @@ -1330,7 +1330,7 @@ void SubcircuitData::initECSubcircuit( ECSubcircuit * ecSubcircuit ) { node->setVisible(false); node->setCanvas(0l); - ecSubcircuit->connect( ecSubcircuit, SIGNAL(subcircuitDeleted()), node, SLOT(removeNode()) ); + ecSubcircuit->connect( ecSubcircuit, TQT_SIGNAL(subcircuitDeleted()), node, TQT_SLOT(removeNode()) ); } } |