diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/languages/flowcode.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
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
Diffstat (limited to 'src/languages/flowcode.cpp')
-rw-r--r-- | src/languages/flowcode.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
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 <klocale.h> // #include <kmessagebox.h> -#include <qfile.h> +#include <tqfile.h> -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<FlowContainer*>((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<<pinCount)-1 ) { - QString name = *it; - name.replace("PORT","TRIS"); - addCode( name+" = "+QString::number(portType) ); + TQString name = *it; + name.tqreplace("PORT","TRIS"); + addCode( name+" = "+TQString::number(portType) ); } } // PORT registers - for ( QStringList::iterator it = portNames.begin(); it != end; ++it ) + for ( TQStringList::iterator it = portNames.begin(); it != end; ++it ) { const int portState = settings->portState(*it); - addCode( (*it)+" = "+QString::number(portState) ); + addCode( (*it)+" = "+TQString::number(portState) ); } } @@ -316,17 +316,17 @@ QString FlowCode::generateMicrobe( const ItemList &itemList, MicroSettings *sett void FlowCode::tidyCode() { // First, get rid of the unused labels - const QStringList::iterator end = m_labels.end(); - for ( QStringList::iterator it = m_labels.begin(); it != end; ++it ) + const TQStringList::iterator end = m_labels.end(); + for ( TQStringList::iterator it = m_labels.begin(); it != end; ++it ) { - if ( !m_gotos.contains(*it) ) m_code.remove(*it+':'); + if ( !m_gotos.tqcontains(*it) ) m_code.remove(*it+':'); } // And now on to handling indentation :-) if ( !m_code.endsWith("\n") ) m_code.append("\n"); - QString newCode; + TQString newCode; bool multiLineComment = false; // For "/*"..."*/" bool comment = false; // For "//" bool asmEmbed = false; @@ -444,7 +444,7 @@ void FlowCode::tidyCode() void FlowCode::addSubroutine( FlowPart *part ) { - if ( !part || m_subroutines.contains(part) || part->parentItem() || !dynamic_cast<FlowContainer*>(part) ) return; + if ( !part || m_subroutines.tqcontains(part) || part->tqparentItem() || !dynamic_cast<FlowContainer*>(part) ) return; m_subroutines.append(part); } |