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/electronics/components/piccomponent.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/electronics/components/piccomponent.cpp')
-rw-r--r-- | src/electronics/components/piccomponent.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/electronics/components/piccomponent.cpp b/src/electronics/components/piccomponent.cpp index 47320bb..5bfda22 100644 --- a/src/electronics/components/piccomponent.cpp +++ b/src/electronics/components/piccomponent.cpp @@ -29,13 +29,13 @@ #include <kiconloader.h> #include <klocale.h> #include <kmessagebox.h> -#include <qguardedptr.h> -#include <qstringlist.h> +#include <tqguardedptr.h> +#include <tqstringlist.h> #include "gpsim/ioports.h" #include "gpsim/pic-processor.h" -const QString _def_PICComponent_fileName = i18n("<Enter location of PIC Program>"); +const TQString _def_PICComponent_fileName = i18n("<Enter location of PIC Program>"); Item* PICComponent::construct( ItemDocument *itemDocument, bool newItem, const char *id ) @@ -46,7 +46,7 @@ Item* PICComponent::construct( ItemDocument *itemDocument, bool newItem, const c LibraryItem* PICComponent::libraryItem() { - QStringList IDs; + TQStringList IDs; IDs << "ec/pic" << "ec/picitem" << "ec/picitem_18pin"; return new LibraryItem( @@ -82,20 +82,20 @@ PICComponent::PICComponent( ICNDocument *icnDocument, bool newItem, const char * m_bLoadingProgram = false; m_pGpsim = 0L; - addButton( "run", QRect(), KGlobal::iconLoader()->loadIcon( "player_play", KIcon::Small ) ); - addButton( "pause", QRect(), KGlobal::iconLoader()->loadIcon( "player_pause", KIcon::Small ) ); - addButton( "reset", QRect(), KGlobal::iconLoader()->loadIcon( "stop", KIcon::Small ) ); - addButton( "reload", QRect(), KGlobal::iconLoader()->loadIcon( "reload", KIcon::Small ) ); + addButton( "run", TQRect(), KGlobal::iconLoader()->loadIcon( "player_play", KIcon::Small ) ); + addButton( "pause", TQRect(), KGlobal::iconLoader()->loadIcon( "player_pause", KIcon::Small ) ); + addButton( "reset", TQRect(), KGlobal::iconLoader()->loadIcon( "stop", KIcon::Small ) ); + addButton( "reload", TQRect(), KGlobal::iconLoader()->loadIcon( "reload", KIcon::Small ) ); if ( icnDocument->ktechlab() ) - connect( icnDocument->ktechlab(), SIGNAL(recentFileAdded(const KURL &)), this, SLOT(slotUpdateFileList()) ); + connect( icnDocument->ktechlab(), TQT_SIGNAL(recentFileAdded(const KURL &)), this, TQT_SLOT(slotUpdateFileList()) ); - connect( ProjectManager::self(), SIGNAL(projectOpened()), this, SLOT(slotUpdateFileList()) ); - connect( ProjectManager::self(), SIGNAL(projectClosed()), this, SLOT(slotUpdateFileList()) ); - connect( ProjectManager::self(), SIGNAL(projectCreated()), this, SLOT(slotUpdateFileList()) ); - connect( ProjectManager::self(), SIGNAL(subprojectCreated()), this, SLOT(slotUpdateFileList()) ); - connect( ProjectManager::self(), SIGNAL(filesAdded()), this, SLOT(slotUpdateFileList()) ); - connect( ProjectManager::self(), SIGNAL(filesRemoved()), this, SLOT(slotUpdateFileList()) ); + connect( ProjectManager::self(), TQT_SIGNAL(projectOpened()), this, TQT_SLOT(slotUpdateFileList()) ); + connect( ProjectManager::self(), TQT_SIGNAL(projectClosed()), this, TQT_SLOT(slotUpdateFileList()) ); + connect( ProjectManager::self(), TQT_SIGNAL(projectCreated()), this, TQT_SLOT(slotUpdateFileList()) ); + connect( ProjectManager::self(), TQT_SIGNAL(subprojectCreated()), this, TQT_SLOT(slotUpdateFileList()) ); + connect( ProjectManager::self(), TQT_SIGNAL(filesAdded()), this, TQT_SLOT(slotUpdateFileList()) ); + connect( ProjectManager::self(), TQT_SIGNAL(filesRemoved()), this, TQT_SLOT(slotUpdateFileList()) ); createProperty( "program", Variant::Type::FileName ); property("program")->setCaption( i18n("Program") ); @@ -146,7 +146,7 @@ void PICComponent::initPIC( bool forceReload ) initPackage( microInfo ); } - QString newProgram = KURL( dataString("program") ).path(); + TQString newProgram = KURL( dataString("program") ).path(); bool newFile = (m_picFile != newProgram); if ( !newFile && !forceReload ) return; @@ -159,15 +159,15 @@ void PICComponent::initPIC( bool forceReload ) case GpsimProcessor::DoesntExist: if ( newProgram == _def_PICComponent_fileName && !newProgram.isEmpty() ) break; - KMessageBox::sorry( 0l, i18n("The file \"%1\" does not exist.").arg( newProgram ) ); - m_picFile = QString::null; + KMessageBox::sorry( 0l, i18n("The file \"%1\" does not exist.").tqarg( newProgram ) ); + m_picFile = TQString(); break; case GpsimProcessor::IncorrectType: if ( newProgram == _def_PICComponent_fileName && !newProgram.isEmpty() ) break; - KMessageBox::sorry( 0L, i18n("\"%1\" is not a valid PIC program.\nThe file must exist, and the extension should be \".cod\", \".asm\", \".flowcode\", \".basic\", \".microbe\" or \".c\".\n\".hex\" is allowed, provided that there is a corresponding \".cod\" file.").arg(newProgram) ); - m_picFile = QString::null; + KMessageBox::sorry( 0L, i18n("\"%1\" is not a valid PIC program.\nThe file must exist, and the extension should be \".cod\", \".asm\", \".flowcode\", \".basic\", \".microbe\" or \".c\".\n\".hex\" is allowed, provided that there is a corresponding \".cod\" file.").tqarg(newProgram) ); + m_picFile = TQString(); break; case GpsimProcessor::Valid: @@ -198,14 +198,14 @@ void PICComponent::initPackage( MicroInfo * microInfo ) m_bCreatedInitialPackage = true; //BEGIN Get pin IDs - QStringList allPinIDs = microPackage->pinIDs(); - QStringList ioPinIDs = microPackage->pinIDs( PicPin::type_bidir | PicPin::type_input | PicPin::type_open ); + TQStringList allPinIDs = microPackage->pinIDs(); + TQStringList ioPinIDs = microPackage->pinIDs( PicPin::type_bidir | PicPin::type_input | PicPin::type_open ); // Now, we make the unwanted pin ids blank, so a pin is not created for them - const QStringList::iterator allPinIDsEnd = allPinIDs.end(); - for ( QStringList::iterator it = allPinIDs.begin(); it != allPinIDsEnd; ++it ) + const TQStringList::iterator allPinIDsEnd = allPinIDs.end(); + for ( TQStringList::iterator it = allPinIDs.begin(); it != allPinIDsEnd; ++it ) { - if ( !ioPinIDs.contains(*it) ) + if ( !ioPinIDs.tqcontains(*it) ) *it = ""; } //END Get pin IDs @@ -226,7 +226,7 @@ void PICComponent::initPackage( MicroInfo * microInfo ) const NodeMap::iterator nodeMapEnd = nodeMapCopy.end(); for ( NodeMap::iterator it = nodeMapCopy.begin(); it != nodeMapEnd; ++it ) { - if ( !ioPinIDs.contains(it.key()) ) + if ( !ioPinIDs.tqcontains(it.key()) ) removeNode( it.key() ); } @@ -247,7 +247,7 @@ void PICComponent::initPackage( MicroInfo * microInfo ) removeDisplayText( "no_file" ); - addDisplayText( "picid", QRect(offsetX(), offsetY()-16, width(), 16), microInfo->id() ); + addDisplayText( "picid", TQRect(offsetX(), offsetY()-16, width(), 16), microInfo->id() ); } else { @@ -259,10 +259,10 @@ void PICComponent::initPackage( MicroInfo * microInfo ) //BEGIN Update button positions int leftpos = (width()-88)/2+offsetX(); - button("run")->setOriginalRect( QRect( leftpos, height()+4+offsetY(), 20, 20 ) ); - button("pause")->setOriginalRect( QRect( leftpos+23, height()+4+offsetY(), 20, 20 ) ); - button("reset")->setOriginalRect( QRect( leftpos+46, height()+4+offsetY(), 20, 20 ) ); - button("reload")->setOriginalRect( QRect( leftpos+69, height()+4+offsetY(), 20, 20 ) ); + button("run")->setOriginalRect( TQRect( leftpos, height()+4+offsetY(), 20, 20 ) ); + button("pause")->setOriginalRect( TQRect( leftpos+23, height()+4+offsetY(), 20, 20 ) ); + button("reset")->setOriginalRect( TQRect( leftpos+46, height()+4+offsetY(), 20, 20 ) ); + button("reload")->setOriginalRect( TQRect( leftpos+69, height()+4+offsetY(), 20, 20 ) ); updateAttachedPositioning(); //END Update button positions } @@ -283,11 +283,11 @@ void PICComponent::attachPICComponentPins() void PICComponent::slotUpdateFileList() { - QStringList preFileList; + TQStringList preFileList; if ( p_icnDocument && p_icnDocument->ktechlab() ) preFileList += p_icnDocument->ktechlab()->recentFiles(); - QStringList fileList; + TQStringList fileList; if ( ProjectInfo * info = ProjectManager::self()->currentProject() ) { @@ -297,23 +297,23 @@ void PICComponent::slotUpdateFileList() fileList << (*it).path(); } - const QStringList::iterator end = preFileList.end(); - for ( QStringList::iterator it = preFileList.begin(); it != end; ++it ) + const TQStringList::iterator end = preFileList.end(); + for ( TQStringList::iterator it = preFileList.begin(); it != end; ++it ) { - QString file = KURL(*it).path(); - if ( (file.endsWith(".flowcode") || file.endsWith(".asm") || file.endsWith(".cod") || file.endsWith(".basic") || file.endsWith(".microbe") ) && !fileList.contains(file) ) { + TQString file = KURL(*it).path(); + if ( (file.endsWith(".flowcode") || file.endsWith(".asm") || file.endsWith(".cod") || file.endsWith(".basic") || file.endsWith(".microbe") ) && !fileList.tqcontains(file) ) { fileList.append(file); } } - QString fileName = dataString("program"); + TQString fileName = dataString("program"); property("program")->setAllowed(fileList); property("program")->setValue( fileName.isEmpty() ? _def_PICComponent_fileName : fileName ); } -void PICComponent::buttonStateChanged( const QString &id, bool state ) +void PICComponent::buttonStateChanged( const TQString &id, bool state ) { if (!state) return; @@ -359,12 +359,12 @@ bool PICComponent::mouseDoubleClickEvent ( const EventInfo &eventInfo ) } -QString PICComponent::createSymbolFile() +TQString PICComponent::createSymbolFile() { m_bLoadingProgram = true; slotUpdateBtns(); - return GpsimProcessor::generateSymbolFile( dataString("program"), this, SLOT(slotCODCreationSucceeded()), SLOT(slotCODCreationFailed()) ); + return GpsimProcessor::generateSymbolFile( dataString("program"), this, TQT_SLOT(slotCODCreationSucceeded()), TQT_SLOT(slotCODCreationFailed()) ); } @@ -375,19 +375,19 @@ void PICComponent::slotCODCreationSucceeded() delete m_pGpsim; m_pGpsim = new GpsimProcessor(m_symbolFile); - if ( m_pGpsim->codLoadStatus() == GpsimProcessor::CodSuccess ) + if ( m_pGpsim->codLoadtqStatus() == GpsimProcessor::CodSuccess ) { MicroInfo * microInfo = m_pGpsim->microInfo(); property("lastPackage")->setValue( microInfo->id() ); initPackage( microInfo ); - connect( m_pGpsim, SIGNAL(runningStatusChanged(bool )), this, SLOT(slotUpdateBtns()) ); + connect( m_pGpsim, TQT_SIGNAL(runningStatusChanged(bool )), this, TQT_SLOT(slotUpdateBtns()) ); attachPICComponentPins(); } else { - m_pGpsim->displayCodLoadStatus(); + m_pGpsim->displayCodLoadtqStatus(); delete m_pGpsim; m_pGpsim = 0l; } |