From 87a016680e3677da3993f333561e79eb0cead7d5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 29 Jun 2011 16:05:55 +0000 Subject: TQt4 port ktechlab This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/languages/flowcode.cpp | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/languages/flowcode.cpp') diff --git a/src/languages/flowcode.cpp b/src/languages/flowcode.cpp index d19d17e..9fad28d 100644 --- a/src/languages/flowcode.cpp +++ b/src/languages/flowcode.cpp @@ -20,10 +20,10 @@ #include // #include -#include +#include -FlowCode::FlowCode( ProcessChain *processChain, KTechlab *parent ) - : Language( processChain, parent, i18n("FlowCode") ) +FlowCode::FlowCode( ProcessChain *processChain, KTechlab *tqparent ) + : Language( processChain, tqparent, i18n("FlowCode") ) { m_successfulMessage = i18n("*** Microbe generation successful ***"); m_failedMessage = i18n("*** Microbe generation failed ***"); @@ -41,11 +41,11 @@ void FlowCode::processInput( ProcessOptions options ) if ( !options.p_flowCodeDocument ) { - options.p_flowCodeDocument = new FlowCodeDocument( QString::null, 0l ); + options.p_flowCodeDocument = new FlowCodeDocument( TQString(), 0l ); options.p_flowCodeDocument->openURL( options.inputFiles().first() ); - connect( this, SIGNAL(processSucceeded( Language *)), options.p_flowCodeDocument, SLOT(deleteLater()) ); - connect( this, SIGNAL(processFailed( Language *)), options.p_flowCodeDocument, SLOT(deleteLater()) ); + connect( this, TQT_SIGNAL(processSucceeded( Language *)), options.p_flowCodeDocument, TQT_SLOT(deleteLater()) ); + connect( this, TQT_SIGNAL(processFailed( Language *)), options.p_flowCodeDocument, TQT_SLOT(deleteLater()) ); } if ( !options.p_flowCodeDocument->microSettings() ) @@ -54,7 +54,7 @@ void FlowCode::processInput( ProcessOptions options ) return; } - QFile file(options.intermediaryOutput()); + TQFile file(options.intermediaryOutput()); if ( file.open(IO_WriteOnly | IO_ReadOnly) == false ) { finish(false); @@ -68,14 +68,14 @@ void FlowCode::processInput( ProcessOptions options ) return; } - const QString code = generateMicrobe( options.p_flowCodeDocument->itemList(), options.p_flowCodeDocument->microSettings() ); + const TQString code = generateMicrobe( options.p_flowCodeDocument->itemList(), options.p_flowCodeDocument->microSettings() ); if (code.isEmpty()) { finish(false); return; } - QTextStream stream(&file); + TQTextStream stream(&file); stream << code; file.close(); finish(true); @@ -88,7 +88,7 @@ void FlowCode::setStartPart( FlowPart *startPart ) } -void FlowCode::addCode( const QString& code ) +void FlowCode::addCode( const TQString& code ) { m_code += code; if ( !m_code.endsWith("\n") ) m_code += '\n'; @@ -96,7 +96,7 @@ void FlowCode::addCode( const QString& code ) bool FlowCode::isValidBranch( FlowPart *flowPart ) { - return flowPart && (flowPart->level() >= m_curLevel) && !m_stopParts.contains(flowPart); + return flowPart && (flowPart->level() >= m_curLevel) && !m_stopParts.tqcontains(flowPart); } void FlowCode::addCodeBranch( FlowPart * flowPart ) @@ -107,9 +107,9 @@ void FlowCode::addCodeBranch( FlowPart * flowPart ) if ( !isValidBranch(flowPart) ) return; - if ( m_addedParts.contains(flowPart) ) + if ( m_addedParts.tqcontains(flowPart) ) { - const QString labelName = genLabel(flowPart->id()); + const TQString labelName = genLabel(flowPart->id()); addCode( "goto "+labelName ); m_gotos.append(labelName); return; @@ -120,7 +120,7 @@ void FlowCode::addCodeBranch( FlowPart * flowPart ) int prevLevel = m_curLevel; m_curLevel = flowPart->level(); - const QString labelName = genLabel(flowPart->id()); + const TQString labelName = genLabel(flowPart->id()); addCode(labelName+':'); m_labels.append(labelName); @@ -129,7 +129,7 @@ void FlowCode::addCodeBranch( FlowPart * flowPart ) } } -QString FlowCode::genLabel( const QString &id ) +TQString FlowCode::genLabel( const TQString &id ) { return "__label_"+id; } @@ -145,11 +145,11 @@ void FlowCode::removeStopPart( FlowPart *part ) // We only want to remove one instance of the FlowPart, in case it has been // used as a StopPart for more than one FlowPart - FlowPartList::iterator it = m_stopParts.find(part); + FlowPartList::iterator it = m_stopParts.tqfind(part); if ( it != m_stopParts.end() ) m_stopParts.remove(it); } -QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *settings ) +TQString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *settings ) { bool foundStart = false; const ItemList::const_iterator end = itemList.end(); @@ -173,7 +173,7 @@ QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *sett continue; if ( !startPart->outputPart( nodeMapIt.key() ) ) - outputWarning( i18n("Warning: Floating connection for %1").arg( startPart->id() ) ); + outputWarning( i18n("Warning: Floating connection for %1").tqarg( startPart->id() ) ); } FlowContainer * fc = dynamic_cast((Item*)*it); @@ -199,25 +199,25 @@ QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *sett m_stopParts.clear(); m_gotos.clear(); m_labels.clear(); - m_code = QString::null; + m_code = TQString(); // PIC type { - const QString codeString = settings->microInfo()->id() + "\n"; + const TQString codeString = settings->microInfo()->id() + "\n"; addCode(codeString); } // Initial variables { - QStringList vars = settings->variableNames(); + TQStringList vars = settings->variableNames(); // If "inited" is true at the end, we comment at the insertion point bool inited = false; - const QString codeString = "// Initial variable values:\n"; + const TQString codeString = "// Initial variable values:\n"; addCode(codeString); - const QStringList::iterator end = vars.end(); - for ( QStringList::iterator it = vars.begin(); it != end; ++it ) + const TQStringList::iterator end = vars.end(); + for ( TQStringList::iterator it = vars.begin(); it != end; ++it ) { VariableInfo *info = settings->variableInfo(*it); if ( info /*&& info->initAtStart*/ ) @@ -239,7 +239,7 @@ QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *sett PinMappingMap::const_iterator end = pinMappings.end(); for ( PinMappingMap::const_iterator it = pinMappings.begin(); it != end; ++it ) { - QString type; + TQString type; switch ( it.data().type() ) { @@ -259,17 +259,17 @@ QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *sett if ( type.isEmpty() ) continue; - addCode( QString("%1 %2 %3").arg( type ).arg( it.key() ).arg( it.data().pins().join(" ") ) ); + addCode( TQString("%1 %2 %3").tqarg( type ).tqarg( it.key() ).tqarg( it.data().pins().join(" ") ) ); } } // Initial port settings { - QStringList portNames = settings->microInfo()->package()->portNames(); - const QStringList::iterator end = portNames.end(); + TQStringList portNames = settings->microInfo()->package()->portNames(); + const TQStringList::iterator end = portNames.end(); // TRIS registers (remember that this is set to ..11111 on all resets) - for ( QStringList::iterator it = portNames.begin(); it != end; ++it ) + for ( TQStringList::iterator it = portNames.begin(); it != end; ++it ) { const int portType = settings->portType(*it); const int pinCount = settings->microInfo()->package()->pinCount( 0, *it ); @@ -277,17 +277,17 @@ QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *sett // We don't need to reset it if portType == 2^(pinCount-1) if ( portType != (1<parentItem() || !dynamic_cast(part) ) return; + if ( !part || m_subroutines.tqcontains(part) || part->tqparentItem() || !dynamic_cast(part) ) return; m_subroutines.append(part); } -- cgit v1.2.1