diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
commit | 4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch) | |
tree | b0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbabel/kbabeldict/modules/dbsearchengine2 | |
parent | 1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff) | |
download | tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbabel/kbabeldict/modules/dbsearchengine2')
16 files changed, 422 insertions, 422 deletions
diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.cpp index 5bf088b8..41f4319d 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.cpp @@ -35,19 +35,19 @@ #include "dbscan.h" #include <klineedit.h> #include <kapplication.h> -#include <qpushbutton.h> +#include <tqpushbutton.h> #include <kurlrequester.h> -#include <qcheckbox.h> +#include <tqcheckbox.h> #include <knuminput.h> #include <kstandarddirs.h> #include <kmessagebox.h> -#include <qmap.h> +#include <tqmap.h> #include <kdebug.h> #define i18n (const char *) -KDBSearchEngine2::KDBSearchEngine2(QObject *parent,const char*name) +KDBSearchEngine2::KDBSearchEngine2(TQObject *parent,const char*name) : SearchEngine(parent,name) { pw=0; @@ -55,7 +55,7 @@ KDBSearchEngine2::KDBSearchEngine2(QObject *parent,const char*name) di=0; //Database Interface is not yet initialized - connect(this,SIGNAL(hasError(QString)),SLOT(setLastError(QString))); + connect(this,TQT_SIGNAL(hasError(TQString)),TQT_SLOT(setLastError(TQString))); searching=false; // i'm not searching iAmReady=true; //there are no reason to say I'm not ready. @@ -69,11 +69,11 @@ KDBSearchEngine2::~KDBSearchEngine2() delete di; //delete database interface } -bool KDBSearchEngine2::startSearch(QString str) +bool KDBSearchEngine2::startSearch(TQString str) { kdDebug(0) << "Start a new search. Looking for: " << str << endl; - static QString queryString; + static TQString queryString; queryString=str; //set the latest query string (note: it is static) @@ -92,7 +92,7 @@ bool KDBSearchEngine2::startSearch(QString str) searching=true; //really start searching - QString searchingString; + TQString searchingString; do //Search loop, it stops only when finished and latest searched string is the actual query string. { @@ -134,8 +134,8 @@ bool KDBSearchEngine2::startSearch(QString str) strategy.addAlgorithm(&wbyw); - connect(&strategy,SIGNAL(newResult(QueryResult)),this,SLOT(receiveResult(QueryResult))); - strategy.exec(searchingString); disconnect(&strategy,SIGNAL(newResult(QueryResult)),this,SLOT(receiveResult(QueryResult))); + connect(&strategy,TQT_SIGNAL(newResult(QueryResult)),this,TQT_SLOT(receiveResult(QueryResult))); + strategy.exec(searchingString); disconnect(&strategy,TQT_SIGNAL(newResult(QueryResult)),this,TQT_SLOT(receiveResult(QueryResult))); kdDebug(0) << "End of search for " << searchingString << endl; @@ -158,7 +158,7 @@ bool KDBSearchEngine2::startSearch(QString str) -bool KDBSearchEngine2::startSearchInTranslation(QString str) +bool KDBSearchEngine2::startSearchInTranslation(TQString str) { if(autoupdate) { @@ -172,20 +172,20 @@ bool KDBSearchEngine2::startSearchInTranslation(QString str) -bool KDBSearchEngine2::messagesForPackage(const QString& package - , QValueList<Message>& resultList, QString& error) +bool KDBSearchEngine2::messagesForPackage(const TQString& package + , TQValueList<Message>& resultList, TQString& error) { //FIXME implement this (needs filters) return true; } -void KDBSearchEngine2::setLastError(QString er) +void KDBSearchEngine2::setLastError(TQString er) { lasterror=er; } -QString KDBSearchEngine2::translate(const QString text) +TQString KDBSearchEngine2::translate(const TQString text) { ExactSearchAlgorithm exact(di,&settings); @@ -212,14 +212,14 @@ void KDBSearchEngine2::receiveResult(QueryResult r) /* A SEARCH RESULT CONTAINS (see searchengine.h) - QString requested; - QString found; - QString translation; - QString plainTranslation; - QString plainFound; - QString plainRequested; + TQString requested; + TQString found; + TQString translation; + TQString plainTranslation; + TQString plainFound; + TQString plainRequested; int score; - QPtrList<TranslationInfo> descriptions; + TQPtrList<TranslationInfo> descriptions; */ @@ -230,7 +230,7 @@ bool KDBSearchEngine2::init() else { di = new DataBaseInterface(dbDirectory,&settings); - connect(di,SIGNAL(newResult(QueryResult)),this,SLOT(receiveResult(QueryResult))); + connect(di,TQT_SIGNAL(newResult(QueryResult)),this,TQT_SLOT(receiveResult(QueryResult))); //FIXME: what wbout ready() if(!di->mainOk()) return false; //check if the main DB is OK. @@ -243,8 +243,8 @@ const KAboutData *KDBSearchEngine2::about() const return DbSe2Factory::instance()->aboutData(); } -void KDBSearchEngine2::stringChanged( QString orig, QString translated - , QString description) +void KDBSearchEngine2::stringChanged( TQString orig, TQString translated + , TQString description) { if(!init()) return; @@ -255,22 +255,22 @@ void KDBSearchEngine2::stringChanged( QString orig, QString translated } -PrefWidget * KDBSearchEngine2::preferencesWidget(QWidget *parent) +PrefWidget * KDBSearchEngine2::preferencesWidget(TQWidget *parent) { pw = new KDB2PreferencesWidget(parent); kdDebug(0) << "new KDB2 preferences widget" << endl; setSettings(); - connect(pw,SIGNAL(restoreNow()),this,SLOT(setSettings())); - connect(pw,SIGNAL(applyNow()),this,SLOT(updateSettings())); - connect(pw,SIGNAL(destroyed()),this,SLOT(prefDestr())); + connect(pw,TQT_SIGNAL(restoreNow()),this,TQT_SLOT(setSettings())); + connect(pw,TQT_SIGNAL(applyNow()),this,TQT_SLOT(updateSettings())); + connect(pw,TQT_SIGNAL(destroyed()),this,TQT_SLOT(prefDestr())); - connect(pw->dbpw->scanAll,SIGNAL(clicked()),this,SLOT(scanAllPressed())); - connect(pw->dbpw->scanSource,SIGNAL(clicked()),this,SLOT(scanNowPressed())); - connect(pw->dbpw->addSource,SIGNAL(clicked()),this,SLOT(addSource())); - connect(pw->dbpw->editSource,SIGNAL(clicked()),this,SLOT(editSource())); - connect(pw->dbpw->removeSource,SIGNAL(clicked()),this,SLOT(removeSource())); + connect(pw->dbpw->scanAll,TQT_SIGNAL(clicked()),this,TQT_SLOT(scanAllPressed())); + connect(pw->dbpw->scanSource,TQT_SIGNAL(clicked()),this,TQT_SLOT(scanNowPressed())); + connect(pw->dbpw->addSource,TQT_SIGNAL(clicked()),this,TQT_SLOT(addSource())); + connect(pw->dbpw->editSource,TQT_SIGNAL(clicked()),this,TQT_SLOT(editSource())); + connect(pw->dbpw->removeSource,TQT_SIGNAL(clicked()),this,TQT_SLOT(removeSource())); return pw; @@ -309,10 +309,10 @@ void KDBSearchEngine2::saveSettings(KConfigBase *config) uint sourceNumber=0; config->writeEntry("NumberOfDBImportSources",sources.count()); - for(QMap<QString,MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); ++sourceIt) + for(TQMap<TQString,MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); ++sourceIt) { sourceNumber++; - config->setGroup("DBImportSource-"+QString::number(sourceNumber)); + config->setGroup("DBImportSource-"+TQString::number(sourceNumber)); config->writeEntry("Name",sourceIt.key()); sourceIt.data().writeConfig(config); } @@ -321,7 +321,7 @@ void KDBSearchEngine2::saveSettings(KConfigBase *config) void KDBSearchEngine2::readSettings(KConfigBase *config) { - /*QString defaultDir; + /*TQString defaultDir; KStandardDirs * dirs = KGlobal::dirs(); if(dirs) { @@ -361,8 +361,8 @@ void KDBSearchEngine2::readSettings(KConfigBase *config) kdDebug(0) << "Found "<< numberOfSources << " sources" << endl; for(uint sourceNumber=1;sourceNumber<=numberOfSources;sourceNumber++) { - config->setGroup("DBImportSource-"+QString::number(sourceNumber)); - QString name=config->readEntry("Name"); + config->setGroup("DBImportSource-"+TQString::number(sourceNumber)); + TQString name=config->readEntry("Name"); sources[name].readConfig(config); } if(pw) @@ -401,7 +401,7 @@ void KDBSearchEngine2::setSettings() //pw->dbpw->useFilters->setChecked(false); //pw->dbpw->dateToday->setChecked(false); pw->dbpw->sourceList->clear(); - for(QMap<QString,MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); ++sourceIt) + for(TQMap<TQString,MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); ++sourceIt) { pw->dbpw->sourceList->insertItem(sourceIt.key()); } @@ -413,7 +413,7 @@ void KDBSearchEngine2::updateSettings() { if(!pw) return; - QString newdb = pw->dbpw->dbDirectory->url(); + TQString newdb = pw->dbpw->dbDirectory->url(); if(newdb !=dbDirectory) { kdDebug(0) << "Recreate DB-Interface cause dbdir is changed" << endl; @@ -469,19 +469,19 @@ pw->dbpw->sourceList-> } -/*void KDBSearchEngine2::scanSource(QString sourceName) +/*void KDBSearchEngine2::scanSource(TQString sourceName) { //FIXME: an error here would be nice if(!init()) return; - for(QValueList<MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); sourceIt++) + for(TQValueList<MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); sourceIt++) { if((*sourceIt).getName()==sourceName) { - QValueList<KURL> urls=(*sourceIt).urls(); + TQValueList<KURL> urls=(*sourceIt).urls(); PoScanner ps(di); - for(QValueList<KURL>::iterator urlIt=urls.begin();urlIt!=urls.end();urlIt++) + for(TQValueList<KURL>::iterator urlIt=urls.begin();urlIt!=urls.end();urlIt++) ps.scanFile(*urlIt); //We suppose name are unique so no need for further scrolling @@ -496,14 +496,14 @@ void KDBSearchEngine2::scanNowPressed() kdDebug(0) << "We should not be here, scanNow called without a pw!" << endl; return; } - QString sourceName; + TQString sourceName; sourceName=pw->dbpw->sourceList->currentText(); if(!init()) return; if(sources.contains(sourceName)) { - QValueList<KURL> urls=sources[sourceName].urls(); + TQValueList<KURL> urls=sources[sourceName].urls(); PoScanner ps(di); - for(QValueList<KURL>::iterator urlIt=urls.begin();urlIt!=urls.end();++urlIt) + for(TQValueList<KURL>::iterator urlIt=urls.begin();urlIt!=urls.end();++urlIt) ps.scanURL(*urlIt); } @@ -520,10 +520,10 @@ void KDBSearchEngine2::scanAllPressed() PoScanner ps(di); - for(QMap<QString,MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); ++sourceIt) + for(TQMap<TQString,MessagesSource>::iterator sourceIt=sources.begin() ; sourceIt!=sources.end(); ++sourceIt) { - QValueList<KURL> urls=(*sourceIt).urls(); - for(QValueList<KURL>::iterator urlIt=urls.begin();urlIt!=urls.end();++urlIt) + TQValueList<KURL> urls=(*sourceIt).urls(); + for(TQValueList<KURL>::iterator urlIt=urls.begin();urlIt!=urls.end();++urlIt) ps.scanURL(*urlIt); } } @@ -535,18 +535,18 @@ void KDBSearchEngine2::editSource() kdDebug(0) << "We should not be here, editSource called without a pw!" << endl; return; } - QString sourceName; + TQString sourceName; sourceName=pw->dbpw->sourceList->currentText(); if(sources.contains(sourceName)) { bool nameIsNew; - QString newName; + TQString newName; SourceDialog sd; do{ sources[sourceName].setDialogValues(&sd); sd.sourceName->setText(sourceName); - if(sd.exec()==QDialog::Accepted) + if(sd.exec()==TQDialog::Accepted) { sources[sourceName].getDialogValues(&sd); newName= sd.sourceName->text(); @@ -586,7 +586,7 @@ void KDBSearchEngine2::removeSource() kdDebug(0) << "We should not be here, delteSource called without a pw!" << endl; return; } - QString sourceName; + TQString sourceName; sourceName=pw->dbpw->sourceList->currentText(); sources.remove(sourceName); pw->dbpw->sourceList->removeItem(pw->dbpw->sourceList->currentItem()); @@ -595,11 +595,11 @@ void KDBSearchEngine2::removeSource() void KDBSearchEngine2::addSource() { - QString newName; + TQString newName; SourceDialog sd; bool nameIsNew; do{ - if(sd.exec()==QDialog::Accepted) + if(sd.exec()==TQDialog::Accepted) { newName= sd.sourceName->text(); nameIsNew=!sources.contains(newName); @@ -625,7 +625,7 @@ void KDBSearchEngine2::addSource() } -QString KDBSearchEngine2::searchTranslation( const QString text, int & score ) +TQString KDBSearchEngine2::searchTranslation( const TQString text, int & score ) { GenericSearchAlgorithm strategy(di,&settings); strategy.setMaxResultNumber(1); @@ -644,7 +644,7 @@ QString KDBSearchEngine2::searchTranslation( const QString text, int & score ) } -QString KDBSearchEngine2::fuzzyTranslation( const QString text, int & score ) +TQString KDBSearchEngine2::fuzzyTranslation( const TQString text, int & score ) { GenericSearchAlgorithm strategy(di,&settings); strategy.setMaxResultNumber(1); diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.h b/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.h index 0db19c6c..fb9cff70 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/KDBSearchEngine2.h @@ -9,7 +9,7 @@ Andrea Rizzi #define DBSEARCH_ENGINE2_H #include <searchengine.h> -#include <qdialog.h> +#include <tqdialog.h> #include "database.h" #include "dbse2_factory.h" @@ -25,7 +25,7 @@ class KDBSearchEngine2 : public SearchEngine public: - KDBSearchEngine2(QObject *parent=0, const char *name=0); + KDBSearchEngine2(TQObject *parent=0, const char *name=0); virtual ~KDBSearchEngine2(); //init if needed. @@ -46,10 +46,10 @@ class KDBSearchEngine2 : public SearchEngine void readSettings(KConfigBase *config); - QString translate(const QString text); + TQString translate(const TQString text); - QString fuzzyTranslation(const QString text, int &score); - QString searchTranslation(const QString, int &score ); + TQString fuzzyTranslation(const TQString text, int &score); + TQString searchTranslation(const TQString, int &score ); /** * Finds all messages belonging to package package. If nothing is found, @@ -60,8 +60,8 @@ class KDBSearchEngine2 : public SearchEngine * * @return true, if successfull */ - bool messagesForPackage(const QString& package - , QValueList<Message>& resultList, QString& error); + bool messagesForPackage(const TQString& package + , TQValueList<Message>& resultList, TQString& error); /** * @returns true, if the searchresults are given as rich text @@ -79,19 +79,19 @@ class KDBSearchEngine2 : public SearchEngine * a tabbed widget. * @param parent the parent of the returned widget */ - virtual PrefWidget* preferencesWidget(QWidget *parent); + virtual PrefWidget* preferencesWidget(TQWidget *parent); /** @returns information about this SearchEngine */ virtual const KAboutData *about() const; /** @returns the i18n name of this search engine */ - QString name() const {return i18n("DB SearchEngine II");} + TQString name() const {return i18n("DB SearchEngine II");} /** @returns a untranslated name of this engine */ - QString id() const {return "dbse2";} + TQString id() const {return "dbse2";} /** @returns the last error message */ - QString lastError() {return lasterror;} + TQString lastError() {return lasterror;} /** @@ -114,14 +114,14 @@ class KDBSearchEngine2 : public SearchEngine * @returns false, if an error occured. Use @ref lastError * to get the last error message */ - bool startSearch(QString s); + bool startSearch(TQString s); /** * starts a search for string s in the translated text * @returns false, if an error occured. Use @ref lastError * to get the last error message */ - bool startSearchInTranslation(QString s); + bool startSearchInTranslation(TQString s); /** stops a search */ @@ -133,22 +133,22 @@ class KDBSearchEngine2 : public SearchEngine * on the edited file. The default implementation does nothing. * @param file The edited file with path */ - // virtual void setEditedFile(QString file); + // virtual void setEditedFile(TQString file); /** * This method allows a search engine to use different settings depending * on the edited package. The default implementation does nothing. * @param package The name of the package, that is currently translated. */ - // virtual void setEditedPackage(QString package); + // virtual void setEditedPackage(TQString package); /** * This method allows a search engine to use different settings depending * on the language code. The default implementation does nothing. * @param lang The current language code (e.g. de). */ - // virtual void setLanguageCode(QString lang); - // virtual void setLanguage(QString languageCode, QString languageName); + // virtual void setLanguageCode(TQString lang); + // virtual void setLanguage(TQString languageCode, TQString languageName); @@ -160,15 +160,15 @@ class KDBSearchEngine2 : public SearchEngine * @param translation the translated string */ - void stringChanged( QString orig, QString translated - , QString description); + void stringChanged( TQString orig, TQString translated + , TQString description); //void scan(); - void setLastError(QString er); + void setLastError(TQString er); //Slots for preference dialog - // void scanSource(QString sourceName); + // void scanSource(TQString sourceName); void scanNowPressed(); void scanAllPressed(); void editSource(); @@ -181,7 +181,7 @@ class KDBSearchEngine2 : public SearchEngine bool searching; bool iAmReady; bool autoupdate; - QString lasterror; + TQString lasterror; KDB2PreferencesWidget *pw; //PrefWidg -> DBSE @@ -190,11 +190,11 @@ class KDBSearchEngine2 : public SearchEngine void setSettings(); DBSESettings settings; - QString dbDirectory; + TQString dbDirectory; bool autoAdd,useSentence,useGlossary,useExact; bool useDivide,useAlpha,useWordByWord,useDynamic; uint numberOfResult; - QMap<QString,MessagesSource> sources; + TQMap<TQString,MessagesSource> sources; }; diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.cpp index 0ca040e8..466b68e5 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.cpp @@ -10,20 +10,20 @@ // // #include "algorithms.h" -#include <qstringlist.h> +#include <tqstringlist.h> #include <kdebug.h> //FIXME: remove #define i18n (const char*) -DataBaseInterface::ResultList ExactSearchAlgorithm::exec(const QString& query ) +DataBaseInterface::ResultList ExactSearchAlgorithm::exec(const TQString& query ) { DataBaseInterface::ResultList res; DataBaseInterface::MainEntry e=di->get(query,0); - QStringList trs=e.second.getTranslations(); + TQStringList trs=e.second.getTranslations(); - for(QStringList::iterator it=trs.begin();it!=trs.end();++it) + for(TQStringList::iterator it=trs.begin();it!=trs.end();++it) { emit newResult(QueryResult(*it,e.first.getString(),settings->scoreExact)); @@ -35,19 +35,19 @@ DataBaseInterface::ResultList ExactSearchAlgorithm::exec(const QString& query ) } -DataBaseInterface::ResultList GenericSearchAlgorithm::exec(const QString& query ) +DataBaseInterface::ResultList GenericSearchAlgorithm::exec(const TQString& query ) { DataBaseInterface::ResultList res; // ExactSearchAlgorithm exact(query,settings); uint countResults=0; - for(QValueList<AbstractSearchAlgorithm *>::iterator algoit = algoChain.begin(); algoit!=algoChain.end() && countResults < maxResults; algoit++) + for(TQValueList<AbstractSearchAlgorithm *>::iterator algoit = algoChain.begin(); algoit!=algoChain.end() && countResults < maxResults; algoit++) { - connect(*algoit,SIGNAL(newResult(QueryResult)),this,SIGNAL(newResult(QueryResult))); + connect(*algoit,TQT_SIGNAL(newResult(QueryResult)),this,TQT_SIGNAL(newResult(QueryResult))); kdDebug(0) << "Algo pointer" << (*algoit) << endl; res+=(*algoit)->exec(query); countResults=res.count(); kdDebug(0) << "Count = " << countResults << endl; - disconnect(*algoit,SIGNAL(newResult(QueryResult)),this,SIGNAL(newResult(QueryResult))); + disconnect(*algoit,TQT_SIGNAL(newResult(QueryResult)),this,TQT_SIGNAL(newResult(QueryResult))); } return res; } @@ -57,7 +57,7 @@ void GenericSearchAlgorithm::addAlgorithm( AbstractSearchAlgorithm * algo ) algoChain.append(algo); } -DataBaseInterface::ResultList AlphaSearchAlgorithm::exec( const QString & query ) +DataBaseInterface::ResultList AlphaSearchAlgorithm::exec( const TQString & query ) { DataBaseInterface::ResultList res; DBItemMultiIndex::IndexList il=di->getAlpha(query); @@ -65,8 +65,8 @@ DataBaseInterface::ResultList AlphaSearchAlgorithm::exec( const QString & query for(DBItemMultiIndex::IndexList::iterator it=il.begin();it!=il.end()&&!di->stopNow();++it) { DataBaseInterface::MainEntry e=di->getFromIndex(*it); - QStringList trs=e.second.getTranslations(); - for(QStringList::iterator it=trs.begin();it!=trs.end() && !di->stopNow();++it) + TQStringList trs=e.second.getTranslations(); + for(TQStringList::iterator it=trs.begin();it!=trs.end() && !di->stopNow();++it) { QueryResult r(di->format(di->simple(*it,true),query),e.first.getString(),settings->scoreAlpha); emit newResult(r); @@ -78,17 +78,17 @@ DataBaseInterface::ResultList AlphaSearchAlgorithm::exec( const QString & query return res; } -DataBaseInterface::ResultList SentenceArchiveSearchAlgorithm::exec( const QString & query ) +DataBaseInterface::ResultList SentenceArchiveSearchAlgorithm::exec( const TQString & query ) { DataBaseInterface::ResultList res; DataBaseInterface::MainEntry e = di->getSentence(query); - QStringList trs=e.second.getTranslations(); + TQStringList trs=e.second.getTranslations(); kdDebug(0) << "Count in sentence archive " << trs.count()<< endl; - for(QStringList::iterator it=trs.begin();it!=trs.end();++it) + for(TQStringList::iterator it=trs.begin();it!=trs.end();++it) { QueryResult r(di->format(di->simple(*it,true),query),e.first.getString(),settings->scoreSentence); emit newResult(r); @@ -100,31 +100,31 @@ DataBaseInterface::ResultList SentenceArchiveSearchAlgorithm::exec( const QStrin return res; } -DataBaseInterface::ResultList ChunkByChunkSearchAlgorithm::exec( const QString & query ) +DataBaseInterface::ResultList ChunkByChunkSearchAlgorithm::exec( const TQString & query ) { ResultList res; factory->setQuery(query); - QPtrList<AbstractChunk> chunks=factory->chunks(); + TQPtrList<AbstractChunk> chunks=factory->chunks(); kdDebug(0) << "Number of chunks " << chunks.count() << endl; chunks.setAutoDelete(true); //I should delete the chunks myself - QStringList querySeparators=factory->separators(); + TQStringList querySeparators=factory->separators(); //This prevents recursive loop. if (chunks.count()<=1) return res; - QStringList translations,tmpTranslations; + TQStringList translations,tmpTranslations; translations.push_back(""); //FIXME this is needed to start , but is not good int finalscore=0; int i=0; - QMap<QString,bool> translationUsed; + TQMap<TQString,bool> translationUsed; //Loop on all chunk for(AbstractChunk *it=chunks.first();it && !di->stopNow(); it=chunks.next()) { kdDebug(0) << "Process next chunk" << endl; int chunkscore=0; - QValueList<QueryResult> r=it->translations(); + TQValueList<QueryResult> r=it->translations(); kdDebug(0) << "Number of results for this chunk " << r.count() << endl; if(r.count()<1) { @@ -144,14 +144,14 @@ DataBaseInterface::ResultList ChunkByChunkSearchAlgorithm::exec( const QString & translationUsed.clear(); for(ResultList::iterator it1=r.begin();it1!=r.end() &&!di->stopNow(); ++it1) { - QString chunkTranslation= (*it1).result(); + TQString chunkTranslation= (*it1).result(); if(!translationUsed.contains(chunkTranslation)) { translationUsed[chunkTranslation]=true; kdDebug(0) << "a translation is: " << chunkTranslation << endl; - for(QStringList::iterator it2=translations.begin();it2!=translations.end() && !di->stopNow() ; it2++) + for(TQStringList::iterator it2=translations.begin();it2!=translations.end() && !di->stopNow() ; it2++) { - QString prevTranslation=*it2; + TQString prevTranslation=*it2; tmpTranslations.push_back(prevTranslation+chunkTranslation+querySeparators[i]); kdDebug(0) << "..appending it to " << prevTranslation << endl; } @@ -176,9 +176,9 @@ DataBaseInterface::ResultList ChunkByChunkSearchAlgorithm::exec( const QString & if (finalscore<50) return res; - for(QStringList::iterator it2=translations.begin();it2!=translations.end() && !di->stopNow() ; it2++) + for(TQStringList::iterator it2=translations.begin();it2!=translations.end() && !di->stopNow() ; it2++) { - QString theTranslation=*it2; + TQString theTranslation=*it2; QueryResult qr(di->format(theTranslation,query),i18n("CHUNK BY CHUNK"),finalscore); qr.setRichOriginal(i18n("<h3>Chunk by chunk</h3>CHANGE THIS TEXT!!!!This translation is" "obtained translating the sentences and using a" @@ -211,22 +211,22 @@ FuzzyChunkSearchAlgorithm::FuzzyChunkSearchAlgorithm( DataBaseInterface * dbi, D } -DataBaseInterface::ResultList FuzzyChunkSearchAlgorithm::exec( const QString & query ) +DataBaseInterface::ResultList FuzzyChunkSearchAlgorithm::exec( const TQString & query ) { //FIXME: this code is shit too ResultList res; factory->setQuery(query); - QPtrList<AbstractChunk> querychunks = factory->chunks(); + TQPtrList<AbstractChunk> querychunks = factory->chunks(); querychunks.setAutoDelete(true); - typedef QMap<QString,QValueList<unsigned int> > ResultMap; + typedef TQMap<TQString,TQValueList<unsigned int> > ResultMap; ResultMap rmap; //result of words index query unsigned int notfound=0,frequent=0,nchunks = querychunks.count(); //Get index list for each word for(AbstractChunk *it=querychunks.first(); it &&!di->stopNow() ; it=querychunks.next() ) { - QValueList<uint> locations = (*it).locationReferences(); + TQValueList<uint> locations = (*it).locationReferences(); if(locations.count()>0) { @@ -246,10 +246,10 @@ DataBaseInterface::ResultList FuzzyChunkSearchAlgorithm::exec( const QString & q //Now we have a map (rmap) "word in query->list of occurency" - QValueList<unsigned int>::iterator countpos[nchunks+1]; + TQValueList<unsigned int>::iterator countpos[nchunks+1]; - QValueList<unsigned int> il; + TQValueList<unsigned int> il; for(int i = 0;i<=nchunks&&!di->stopNow();i++) countpos[i]=il.end(); @@ -310,12 +310,12 @@ DataBaseInterface::ResultList FuzzyChunkSearchAlgorithm::exec( const QString & q int bestscore=0; for(unsigned int wf=nchunks;wf>0;wf-- ){ - for(QValueList<unsigned int>::iterator it=countpos[wf];it!=countpos[wf-1] ;++it) + for(TQValueList<unsigned int>::iterator it=countpos[wf];it!=countpos[wf-1] ;++it) { //loop on entries with same number of word found DataBaseInterface::MainEntry e; e=di->getFromIndex(*it); - QStringList trs=e.second.getTranslations(); - for(QStringList::iterator it=trs.begin();it!=trs.end()&&!di->stopNow();++it) + TQStringList trs=e.second.getTranslations(); + for(TQStringList::iterator it=trs.begin();it!=trs.end()&&!di->stopNow();++it) { unsigned int cinr=factory->chunks(*it).count(); //chunk in result //compute a score, lets kbabel sort now, it should be fast... @@ -326,11 +326,11 @@ DataBaseInterface::ResultList FuzzyChunkSearchAlgorithm::exec( const QString & q // kdDebug(0) << "s: "<<score << " wf: "<<wf<<" nwords: "<<nwords<<" winr: "<<winr // <<" 90*wf/nwords: "<<90*wf/nwords << " -:" << 90*(((nwords-winr)>0)?(nwords-winr):(winr-nwords))/(nwords*10)<< endl; // FIXME: format better the richtext - QString ori=e.first.getString(); - QString re=di->format(di->simple(*it,true),query); + TQString ori=e.first.getString(); + TQString re=di->format(di->simple(*it,true),query); QueryResult r(re,ori,score); - for(QPtrListIterator<AbstractChunk> it(querychunks); it.current() && di->stopNow() ; ++it){ - ori=ori.replace(QRegExp((*it)->chunkString(),false),"<font color=#000080><u><b>"+(*it)->chunkString()+"</b></u></font>"); + for(TQPtrListIterator<AbstractChunk> it(querychunks); it.current() && di->stopNow() ; ++it){ + ori=ori.replace(TQRegExp((*it)->chunkString(),false),"<font color=#000080><u><b>"+(*it)->chunkString()+"</b></u></font>"); } r.setRichOriginal(ori); if(!di->stopNow()) @@ -344,16 +344,16 @@ DataBaseInterface::ResultList FuzzyChunkSearchAlgorithm::exec( const QString & q } -DataBaseInterface::ResultList CorrelationSearchAlgorithm::exec( const QString & query ) +DataBaseInterface::ResultList CorrelationSearchAlgorithm::exec( const TQString & query ) { //FIXME, this code is shit. DataBaseInterface::ResultList res; if(di->words(query).count()>1) return res; - QMap<QString,float> corRes = di->correlation(query,0,false); + TQMap<TQString,float> corRes = di->correlation(query,0,false); float max=0,max1=0,max2=0; - QString best,best1,best2; + TQString best,best1,best2; - for(QMap<QString,float>::iterator it = corRes.begin(); it !=corRes.end(); ++it) + for(TQMap<TQString,float>::iterator it = corRes.begin(); it !=corRes.end(); ++it) { if(it.data()>max) { @@ -414,7 +414,7 @@ SingleWordSearchAlgorithm::SingleWordSearchAlgorithm( DataBaseInterface * dbi, D addAlgorithm(&corr); } -DataBaseInterface::ResultList SingleWordSearchAlgorithm::exec( const QString & query ) +DataBaseInterface::ResultList SingleWordSearchAlgorithm::exec( const TQString & query ) { if(di->words(query).count()>1) return ResultList(); diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.h b/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.h index 5f9ee682..aa049f85 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/algorithms.h @@ -14,14 +14,14 @@ #include "database.h" #include "chunk.h" -#include <qobject.h> +#include <tqobject.h> class AbstractSearchAlgorithm : public QObject { Q_OBJECT public: - typedef QValueList<QueryResult> ResultList; + typedef TQValueList<QueryResult> ResultList; AbstractSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets) { @@ -31,7 +31,7 @@ class AbstractSearchAlgorithm : public QObject /** * this contains the algo and return some results. */ - virtual DataBaseInterface::ResultList exec(const QString& query)=0; + virtual DataBaseInterface::ResultList exec(const TQString& query)=0; signals: void newResult(QueryResult); @@ -50,7 +50,7 @@ class ExactSearchAlgorithm : public AbstractSearchAlgorithm public: ExactSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets) : AbstractSearchAlgorithm(dbi,sets) {} - virtual DataBaseInterface::ResultList exec(const QString& query); + virtual DataBaseInterface::ResultList exec(const TQString& query); }; class AlphaSearchAlgorithm : public AbstractSearchAlgorithm @@ -59,7 +59,7 @@ class AlphaSearchAlgorithm : public AbstractSearchAlgorithm public: AlphaSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets) : AbstractSearchAlgorithm(dbi,sets) {} - virtual DataBaseInterface::ResultList exec(const QString& query); + virtual DataBaseInterface::ResultList exec(const TQString& query); }; class SentenceArchiveSearchAlgorithm : public AbstractSearchAlgorithm @@ -68,7 +68,7 @@ class SentenceArchiveSearchAlgorithm : public AbstractSearchAlgorithm public: SentenceArchiveSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets) ; - virtual DataBaseInterface::ResultList exec(const QString& query); + virtual DataBaseInterface::ResultList exec(const TQString& query); }; class ChunkByChunkSearchAlgorithm : public AbstractSearchAlgorithm @@ -77,7 +77,7 @@ class ChunkByChunkSearchAlgorithm : public AbstractSearchAlgorithm public: ChunkByChunkSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets); - virtual DataBaseInterface::ResultList exec(const QString& query); + virtual DataBaseInterface::ResultList exec(const TQString& query); void setChunkFactory(AbstractChunkFactory *_factory) { @@ -93,7 +93,7 @@ class FuzzyChunkSearchAlgorithm : public AbstractSearchAlgorithm public: FuzzyChunkSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets); - virtual DataBaseInterface::ResultList exec(const QString& query); + virtual DataBaseInterface::ResultList exec(const TQString& query); void setChunkFactory(AbstractChunkFactory *_factory) { factory=_factory; @@ -108,14 +108,14 @@ class GenericSearchAlgorithm : public AbstractSearchAlgorithm public: GenericSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets) ; - virtual ResultList exec(const QString& query); + virtual ResultList exec(const TQString& query); void addAlgorithm(AbstractSearchAlgorithm *algo); void setMaxResultNumber(uint num){maxResults=num;} protected: - QValueList<AbstractSearchAlgorithm *> algoChain; + TQValueList<AbstractSearchAlgorithm *> algoChain; uint maxResults; }; @@ -125,7 +125,7 @@ class CorrelationSearchAlgorithm : public AbstractSearchAlgorithm Q_OBJECT public: CorrelationSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets) : AbstractSearchAlgorithm(dbi,sets) {} - virtual ResultList exec(const QString& query); + virtual ResultList exec(const TQString& query); }; @@ -135,7 +135,7 @@ class SingleWordSearchAlgorithm : public GenericSearchAlgorithm Q_OBJECT public: SingleWordSearchAlgorithm(DataBaseInterface *dbi,DBSESettings *sets); - virtual DataBaseInterface::ResultList exec(const QString& query); + virtual DataBaseInterface::ResultList exec(const TQString& query); private: ExactSearchAlgorithm exact; diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/chunk.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/chunk.cpp index 7c62748a..ef426d53 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/chunk.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/chunk.cpp @@ -19,12 +19,12 @@ AbstractChunk::~AbstractChunk( ) { } -WordChunk::WordChunk( DataBaseInterface * di, QString _word ) : AbstractChunk(di) +WordChunk::WordChunk( DataBaseInterface * di, TQString _word ) : AbstractChunk(di) { word=_word; } -QValueList<QueryResult> WordChunk::translations( ) +TQValueList<QueryResult> WordChunk::translations( ) { DataBaseInterface::ResultList r; SingleWordSearchAlgorithm sa(di,di->getSettings()); @@ -32,13 +32,13 @@ QValueList<QueryResult> WordChunk::translations( ) return r; } -//QValueList<QueryResult> WordChunk::translationsFromReference( uint reference ) +//TQValueList<QueryResult> WordChunk::translationsFromReference( uint reference ) //{ //} -QValueList< uint > WordChunk::locationReferences( ) +TQValueList< uint > WordChunk::locationReferences( ) { - QValueList<uint> res=di->getWordIndex(word); + TQValueList<uint> res=di->getWordIndex(word); kdDebug(0) << "Number of locations " << res.count() <<endl ; return res; /* DBItemMainKey *k = new DBItemMainKey(word); @@ -46,20 +46,20 @@ QValueList< uint > WordChunk::locationReferences( ) if(wordsindex->get(k,d)!=DB_NOTFOUND) return d->getList(); else - return QValueList<uint> tmpList; + return TQValueList<uint> tmpList; */ } -void WordChunk::setLocationReferences( QValueList< uint > ) +void WordChunk::setLocationReferences( TQValueList< uint > ) { } -SentenceChunk::SentenceChunk( DataBaseInterface * di, QString _sentence ): AbstractChunk(di) +SentenceChunk::SentenceChunk( DataBaseInterface * di, TQString _sentence ): AbstractChunk(di) { sentence=_sentence; } -QValueList<QueryResult> SentenceChunk::translations( ) +TQValueList<QueryResult> SentenceChunk::translations( ) { GenericSearchAlgorithm g(di,di->getSettings()); @@ -75,29 +75,29 @@ QValueList<QueryResult> SentenceChunk::translations( ) } -//QValueList<QueryResult> SentenceChunk::translationsFromReference( uint reference ) +//TQValueList<QueryResult> SentenceChunk::translationsFromReference( uint reference ) //{ // //} -QValueList< uint > SentenceChunk::locationReferences( ) +TQValueList< uint > SentenceChunk::locationReferences( ) { } -void SentenceChunk::setLocationReferences( QValueList< uint > ) +void SentenceChunk::setLocationReferences( TQValueList< uint > ) { } -QPtrList< AbstractChunk> WordChunkFactory::chunks() +TQPtrList< AbstractChunk> WordChunkFactory::chunks() { - QString str=di->simple(string); - QPtrList<AbstractChunk> list; + TQString str=di->simple(string); + TQPtrList<AbstractChunk> list; if(str.isEmpty()) return list; _separators.clear(); kdDebug(0) << "Word chunks of:" <<str << endl; int pos; - QString sep; - QRegExp r("(\\s)"); + TQString sep; + TQRegExp r("(\\s)"); do { pos=r.search(str); @@ -120,10 +120,10 @@ QPtrList< AbstractChunk> WordChunkFactory::chunks() -QPtrList<AbstractChunk> SentenceChunkFactory::chunks() +TQPtrList<AbstractChunk> SentenceChunkFactory::chunks() { - QString str=string; - QPtrList<AbstractChunk> list; + TQString str=string; + TQPtrList<AbstractChunk> list; if(str.isEmpty()) return list; // kdDebug(0) << s << endl; @@ -132,9 +132,9 @@ QPtrList<AbstractChunk> SentenceChunkFactory::chunks() do { - QRegExp re("((\\.|;|\\?|\\!|:)( |$|\\\\n\\n))"); + TQRegExp re("((\\.|;|\\?|\\!|:)( |$|\\\\n\\n))"); pos=re.search(str); - QString sep=re.cap(1); + TQString sep=re.cap(1); if(!str.left(pos).isEmpty()) { @@ -154,14 +154,14 @@ QPtrList<AbstractChunk> SentenceChunkFactory::chunks() return list; } -QPtrList< AbstractChunk > CaseBasedWordChunkFactory::chunks( ) +TQPtrList< AbstractChunk > CaseBasedWordChunkFactory::chunks( ) { - QString str=string; - QPtrList<AbstractChunk> list; + TQString str=string; + TQPtrList<AbstractChunk> list; if(str.isEmpty()) return list; uint slen=str.length(); kdDebug(0) << "CaseWordChunk string:" << str << endl; - QString tmpWord; + TQString tmpWord; bool upcase; for(uint i=0;i<=slen;i++) { diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/chunk.h b/kbabel/kbabeldict/modules/dbsearchengine2/chunk.h index 5c5fcb93..2578e59e 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/chunk.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/chunk.h @@ -11,8 +11,8 @@ // #ifndef DBSE2_CHUNK_H #define DBSE2_CHUNK_H -#include <qstring.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqvaluelist.h> #include "database.h" /** @@ -29,13 +29,13 @@ class AbstractChunk /** * This function should return a list of translation for the current chunk. */ - virtual QValueList<QueryResult> translations()=0; + virtual TQValueList<QueryResult> translations()=0; //FIXME: is this in the right place, better in factory? check that stuff - //virtual QValueList<QueryResult> translationsFromReference(uint reference)=0; - virtual QValueList<uint> locationReferences()=0; - virtual void setLocationReferences(QValueList<uint>)=0; - virtual QString chunkString()=0; + //virtual TQValueList<QueryResult> translationsFromReference(uint reference)=0; + virtual TQValueList<uint> locationReferences()=0; + virtual void setLocationReferences(TQValueList<uint>)=0; + virtual TQString chunkString()=0; protected: DataBaseInterface *di; @@ -47,16 +47,16 @@ class AbstractChunk class WordChunk : public AbstractChunk { public: - WordChunk(DataBaseInterface *di,QString _word); - virtual QValueList<QueryResult> translations(); - //virtual QValueList<QueryResult> translationsFromReference(uint reference); - virtual QValueList<uint> locationReferences(); - virtual void setLocationReferences(QValueList<uint>); - virtual QString chunkString(){return word;} + WordChunk(DataBaseInterface *di,TQString _word); + virtual TQValueList<QueryResult> translations(); + //virtual TQValueList<QueryResult> translationsFromReference(uint reference); + virtual TQValueList<uint> locationReferences(); + virtual void setLocationReferences(TQValueList<uint>); + virtual TQString chunkString(){return word;} - //static QValueList<WordChunk> divide(QString); + //static TQValueList<WordChunk> divide(TQString); private: - QString word; + TQString word; }; /** @@ -65,17 +65,17 @@ class WordChunk : public AbstractChunk class SentenceChunk : public AbstractChunk { public: - SentenceChunk(DataBaseInterface *di,QString _sentence); - virtual QValueList<QueryResult> translations(); - //virtual QValueList<QueryResult> translationsFromReference(uint reference); - virtual QValueList<uint> locationReferences(); - virtual void setLocationReferences(QValueList<uint>); - virtual QString chunkString(){return sentence;} + SentenceChunk(DataBaseInterface *di,TQString _sentence); + virtual TQValueList<QueryResult> translations(); + //virtual TQValueList<QueryResult> translationsFromReference(uint reference); + virtual TQValueList<uint> locationReferences(); + virtual void setLocationReferences(TQValueList<uint>); + virtual TQString chunkString(){return sentence;} - // static QValueList<SentenceChunk> divide(QString); + // static TQValueList<SentenceChunk> divide(TQString); private: - QString sentence; + TQString sentence; }; @@ -92,11 +92,11 @@ class AbstractChunkFactory di=_di; } virtual ~AbstractChunkFactory(){} - virtual QPtrList<AbstractChunk> chunks()=0; + virtual TQPtrList<AbstractChunk> chunks()=0; /** Change th string and return the chunks */ - virtual QPtrList<AbstractChunk> chunks(const QString& s) + virtual TQPtrList<AbstractChunk> chunks(const TQString& s) { string=s; return chunks(); @@ -105,14 +105,14 @@ class AbstractChunkFactory * Returns the list of separators of last @ref chunks() call */ - virtual QStringList separators(){ return _separators;} - void setQuery(const QString& s) + virtual TQStringList separators(){ return _separators;} + void setQuery(const TQString& s) { string=s; } protected: - QString string; - QStringList _separators; + TQString string; + TQStringList _separators; DataBaseInterface *di; }; @@ -123,7 +123,7 @@ class WordChunkFactory : public AbstractChunkFactory /** YOU SHOULD DELETE THE CHUNKS!! */ - virtual QPtrList<AbstractChunk> chunks(); + virtual TQPtrList<AbstractChunk> chunks(); }; class CaseBasedWordChunkFactory : public AbstractChunkFactory @@ -133,7 +133,7 @@ class CaseBasedWordChunkFactory : public AbstractChunkFactory /** YOU SHOULD DELETE THE CHUNKS!! */ - virtual QPtrList<AbstractChunk> chunks(); + virtual TQPtrList<AbstractChunk> chunks(); }; class SentenceChunkFactory : public AbstractChunkFactory @@ -144,7 +144,7 @@ class SentenceChunkFactory : public AbstractChunkFactory /** YOU SHOULD DELETE THE CHUNKS!! */ - virtual QPtrList<AbstractChunk> chunks(); + virtual TQPtrList<AbstractChunk> chunks(); }; diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/database.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/database.cpp index ea0e8379..0631f7ad 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/database.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/database.cpp @@ -8,8 +8,8 @@ License: GPLv2 #include <math.h> #include "database.h" -#include <qregexp.h> -#include <qdict.h> +#include <tqregexp.h> +#include <tqdict.h> #include <kapplication.h> #include <kdebug.h> #include <kmessagebox.h> @@ -21,7 +21,7 @@ License: GPLv2 -DataBase::DataBase(QString dbpath,QString dbname, QString dblang) : Db(0,DB_CXX_NO_EXCEPTIONS) +DataBase::DataBase(TQString dbpath,TQString dbname, TQString dblang) : Db(0,DB_CXX_NO_EXCEPTIONS) { filename=dbpath+"."+dblang+".db"; @@ -59,11 +59,11 @@ unsigned int DataBase::getLast() -QueryResult::QueryResult(QString r) +QueryResult::QueryResult(TQString r) { res=r; } -QueryResult::QueryResult(QString r,QString o,int s) +QueryResult::QueryResult(TQString r,TQString o,int s) { res=r; richr=r; @@ -80,7 +80,7 @@ QueryResult::QueryResult() -DataBaseInterface::DataBaseInterface(QString dir, DBSESettings *sets) +DataBaseInterface::DataBaseInterface(TQString dir, DBSESettings *sets) { //FIXME Better db names!! @@ -125,7 +125,7 @@ DataBaseInterface::~DataBaseInterface() } -DataBase *DataBaseInterface::openMyDataBase(const QString& prefix,const QString& name,const QString& l,DBTYPE tt) +DataBase *DataBaseInterface::openMyDataBase(const TQString& prefix,const TQString& name,const TQString& l,DBTYPE tt) { DataBase *aDb = new DataBase(prefix,name,l); @@ -163,7 +163,7 @@ DataBase *DataBaseInterface::openMyDataBase(const QString& prefix,const QString& */ -DataBaseInterface::MainEntry DataBaseInterface::get(const QString& query,SearchFilter *filter) +DataBaseInterface::MainEntry DataBaseInterface::get(const TQString& query,SearchFilter *filter) { static int counter=1; counter++; @@ -184,11 +184,11 @@ DataBaseInterface::MainEntry DataBaseInterface::get(const QString& query,SearchF */ -bool DataBaseInterface::addEntry(QString original,QString translated,InputInfo *info) +bool DataBaseInterface::addEntry(TQString original,TQString translated,InputInfo *info) { DBItemMainKey mk(original); DBItemMainData md; - QMap<QString, int> correlationDiff; + TQMap<TQString, int> correlationDiff; bool newentry=false; //try to get kdDebug(0) << "Inserting the pair:" << endl; @@ -220,8 +220,8 @@ bool DataBaseInterface::addEntry(QString original,QString translated,InputInfo * alpha->put(&ka,&in); kdDebug(0) << "Updating the word index " << endl; //Update words index - QStringList ws=words(original); - for(QStringList::iterator it = ws.begin(); it!=ws.end(); ++it) + TQStringList ws=words(original); + for(TQStringList::iterator it = ws.begin(); it!=ws.end(); ++it) { DBItemMainKey word(*it); DBItemMultiIndex win; @@ -240,8 +240,8 @@ bool DataBaseInterface::addEntry(QString original,QString translated,InputInfo * //Update sentence index - QStringList so=sentences(original); - QStringList st=sentences(translated); + TQStringList so=sentences(original); + TQStringList st=sentences(translated); if(so.count()==st.count() && st.count() >1 ) //we already hav a database for single string. { kdDebug(0) << "inside sentence loop" << endl; @@ -276,11 +276,11 @@ bool DataBaseInterface::addEntry(QString original,QString translated,InputInfo * if(!translated.isEmpty()) { //loop on all translations to update correlation - QStringList tmpTranslations=md.getTranslations(); - for(QStringList::iterator otIt=tmpTranslations.begin(); otIt!=tmpTranslations.end();++otIt) + TQStringList tmpTranslations=md.getTranslations(); + for(TQStringList::iterator otIt=tmpTranslations.begin(); otIt!=tmpTranslations.end();++otIt) { - QStringList wt=words(*otIt); - for(QStringList::iterator it = wt.begin(); it!=wt.end(); ++it) + TQStringList wt=words(*otIt); + for(TQStringList::iterator it = wt.begin(); it!=wt.end(); ++it) { if(correlationDiff.contains(*it)) correlationDiff[*it]--; @@ -294,10 +294,10 @@ bool DataBaseInterface::addEntry(QString original,QString translated,InputInfo * md.addTranslation(translated,info->ref()); tmpTranslations=md.getTranslations(); - for(QStringList::iterator otIt=tmpTranslations.begin(); otIt!=tmpTranslations.end();++otIt) + for(TQStringList::iterator otIt=tmpTranslations.begin(); otIt!=tmpTranslations.end();++otIt) { - QStringList wt=words(*otIt); - for(QStringList::iterator it = wt.begin(); it!=wt.end(); ++it) + TQStringList wt=words(*otIt); + for(TQStringList::iterator it = wt.begin(); it!=wt.end(); ++it) { if(correlationDiff.contains(*it)) correlationDiff[*it]++; @@ -316,7 +316,7 @@ bool DataBaseInterface::addEntry(QString original,QString translated,InputInfo * } -bool DataBaseInterface::removeEntry(QString original) +bool DataBaseInterface::removeEntry(TQString original) { DBItemMainKey mk(original); DBItemMainData md; @@ -346,8 +346,8 @@ bool DataBaseInterface::removeEntry(QString original) alpha->put(&ka,&in); //Update words index - QStringList ws=words(original); - for(QStringList::iterator it = ws.begin(); it!=ws.end(); it++) + TQStringList ws=words(original); + for(TQStringList::iterator it = ws.begin(); it!=ws.end(); it++) { DBItemMainKey word(*it); DBItemMultiIndex win; @@ -357,8 +357,8 @@ bool DataBaseInterface::removeEntry(QString original) } //Update sentence index - QStringList so=sentences(original); - QStringList st=sentences(translated); + TQStringList so=sentences(original); + TQStringList st=sentences(translated); if(so.count()==st.count() && st.count() >1 ) //we already hav a database for single string. { for(int i=0; i< so.count() ; i++) @@ -380,16 +380,16 @@ bool DataBaseInterface::removeEntry(QString original) -QMap<QString,float> DataBaseInterface::correlation(QString word,SearchFilter *filter,bool notify, float minSign) +TQMap<TQString,float> DataBaseInterface::correlation(TQString word,SearchFilter *filter,bool notify, float minSign) { - QDict<unsigned int> res; + TQDict<unsigned int> res; // res.setAutoDelete(true); - QMap<QString, float>final; + TQMap<TQString, float>final; DBItemMultiIndex::IndexList il; unsigned int tot=0; unsigned int background=0; unsigned int nocck; - QString sword=simple(word); + TQString sword=simple(word); DBItemMainKey *k = new DBItemMainKey(sword); DBItemMultiIndex *d = new DBItemMultiIndex(); if(wordsindex->get(k,d)!=DB_NOTFOUND) @@ -398,29 +398,29 @@ QMap<QString,float> DataBaseInterface::correlation(QString word,SearchFilter *fi il=d->getList(); kdDebug(0) << il.count()<<endl; tot=0; - for(QValueList<unsigned int>::iterator it=il.begin();it!=il.end();++it) + for(TQValueList<unsigned int>::iterator it=il.begin();it!=il.end();++it) { numindex->get(*it,k); - // QValueList<QueryResult> trad=exactMatch(k->getString(),filter); + // TQValueList<QueryResult> trad=exactMatch(k->getString(),filter); MainEntry e=get(k->getString(),filter); - QStringList trad=e.second.getTranslations(); + TQStringList trad=e.second.getTranslations(); nocck=words(k->getString()).contains(sword); - for( QStringList::iterator it2=trad.begin();it2!=trad.end();++it2) + for( TQStringList::iterator it2=trad.begin();it2!=trad.end();++it2) { - QStringList w=words(*it2); + TQStringList w=words(*it2); unsigned int numWords = w.count()*10+1; unsigned int wei=100000/sqrt(numWords); //weight (is the best one?) background+=(numWords-nocck)*wei; - QDict<uint> count; + TQDict<uint> count; //count.setAutoDelete(true); //FIXME:SET AUTODELETE FOR ALL DICTS - for(QStringList::iterator it1=w.begin();it1!=w.end();it1++) + for(TQStringList::iterator it1=w.begin();it1!=w.end();it1++) { uint *ip; if(!(ip=count[*it1])) count.insert(*it1,new uint(1)); @@ -428,7 +428,7 @@ QMap<QString,float> DataBaseInterface::correlation(QString word,SearchFilter *fi (*ip)++; } - for(QStringList::iterator it1=w.begin();it1!=w.end();it1++) + for(TQStringList::iterator it1=w.begin();it1!=w.end();it1++) { uint *ip; if(*(count[*it1])==nocck) //add only if same number of entry (it cuts articles) @@ -442,7 +442,7 @@ QMap<QString,float> DataBaseInterface::correlation(QString word,SearchFilter *fi unsigned int sqrBG=sqrt((1.0*background+1)/10000); - for(QDictIterator<uint> it(res) ; it.current(); ++it) + for(TQDictIterator<uint> it(res) ; it.current(); ++it) { float sign=1.0*(*(it.current()))/(10000.0*sqrBG); if(sign >minSign){ @@ -457,15 +457,15 @@ QMap<QString,float> DataBaseInterface::correlation(QString word,SearchFilter *fi return final; } -QStringList DataBaseInterface::words(QString s) +TQStringList DataBaseInterface::words(TQString s) { - QString str=simple(s); - QStringList list; + TQString str=simple(s); + TQStringList list; int pos; do { - pos=str.find(QRegExp("\\s")); + pos=str.find(TQRegExp("\\s")); // if(!simple(str.left(pos)).isEmpty()) // list.append(simple(str.left(pos))); if(!str.left(pos).isEmpty()) @@ -476,24 +476,24 @@ QStringList DataBaseInterface::words(QString s) return list; } -QString DataBaseInterface::simple(QString str,bool ck) +TQString DataBaseInterface::simple(TQString str,bool ck) { - QString res; + TQString res; if(ck) res=str; //case keep else res=str.lower(); //lowercase //FIXME: uncoment the foll. line (check speed) - res=res.replace(QRegExp("(<(.*)>)(.*)(</\\2>)"),"\\3"); //remove enclosing tags + res=res.replace(TQRegExp("(<(.*)>)(.*)(</\\2>)"),"\\3"); //remove enclosing tags //Try to get rid of regexps. - // res=res.replace(QRegExp("(('|-|_|\\s|[^\\w%])+)")," "); //strip non-word char - // res=res.replace(QRegExp("(('|-|_)+)")," "); //strip non-word char - // res=res.replace(QRegExp("[^\\w\\s%]"),""); //strip non-word char + // res=res.replace(TQRegExp("(('|-|_|\\s|[^\\w%])+)")," "); //strip non-word char + // res=res.replace(TQRegExp("(('|-|_)+)")," "); //strip non-word char + // res=res.replace(TQRegExp("[^\\w\\s%]"),""); //strip non-word char - QString r; - QChar c; + TQString r; + TQChar c; bool wasSpace=true; uint len=res.length(); for(uint i=0; i<len;i++) @@ -540,10 +540,10 @@ QString DataBaseInterface::simple(QString str,bool ck) return res; } -QStringList DataBaseInterface::sentences(QString s) +TQStringList DataBaseInterface::sentences(TQString s) { - QString str=s; - QStringList list; + TQString str=s; + TQStringList list; // kdDebug(0) << s << endl; @@ -551,7 +551,7 @@ QStringList DataBaseInterface::sentences(QString s) do { - QRegExp re("((\\.|;|\\?|\\!|:)( |$|\\\\n\\n))"); + TQRegExp re("((\\.|;|\\?|\\!|:)( |$|\\\\n\\n))"); pos=re.search(str); if(!str.left(pos).isEmpty()) list.append(str.left(pos).stripWhiteSpace()); @@ -565,20 +565,20 @@ QStringList DataBaseInterface::sentences(QString s) return list; } -QStringList DataBaseInterface::sentencesSeparator(QString s) +TQStringList DataBaseInterface::sentencesSeparator(TQString s) { - QString str=s; - QStringList list; + TQString str=s; + TQStringList list; // kdDebug(0) << s << endl; int pos; do { - QRegExp re; + TQRegExp re; re.setPattern("([.:?!;]( |$|\\\\n\\n))"); pos = re.search(str); - QString separator=re.cap(1); + TQString separator=re.cap(1); if(pos!=-1){ list.append(separator); } @@ -589,26 +589,26 @@ QStringList DataBaseInterface::sentencesSeparator(QString s) return list; } -bool DataBaseInterface::isUpper(QChar s) +bool DataBaseInterface::isUpper(TQChar s) { return s==s.upper(); } -bool DataBaseInterface::isLower(QChar s) +bool DataBaseInterface::isLower(TQChar s) { return s==s.lower(); } -QString DataBaseInterface::format(QString _s,QString t) +TQString DataBaseInterface::format(TQString _s,TQString t) { //FIXME use settings //FIXME use regexp - QString s=_s; - QString noTagT=t.replace(QRegExp("(<(.*)>)(.*)(</\\2>)"),"\\3"); - QChar first=noTagT[noTagT.find(QRegExp("\\w"))]; + TQString s=_s; + TQString noTagT=t.replace(TQRegExp("(<(.*)>)(.*)(</\\2>)"),"\\3"); + TQChar first=noTagT[noTagT.find(TQRegExp("\\w"))]; bool firstCapital=isUpper(first); /* @@ -643,9 +643,9 @@ if(columnAtEnd) if(allupper) s=s.upper(); - int pos=t.find(QRegExp("&")); + int pos=t.find(TQRegExp("&")); if(pos>=0) { - QChar accel=t[t.find(QRegExp("&"))+1]; + TQChar accel=t[t.find(TQRegExp("&"))+1]; if(accel!='&') { @@ -667,32 +667,32 @@ if(columnAtEnd) } -QString DataBaseInterface::formatRegExp(QString _s, QString t, QString tre,QString stringSearch,QString stringReplace) +TQString DataBaseInterface::formatRegExp(TQString _s, TQString t, TQString tre,TQString stringSearch,TQString stringReplace) { - QString s=_s; - QRegExp templateRegExp(tre); - //QString stringSearch = "(.*)!@CAP1@$"; // use @CAP1.. fot caps in templates - //QString stringReplace = "\\1@CAP1@"; // use \1, \2 for caps in str and @CAP1 fot caps in template + TQString s=_s; + TQRegExp templateRegExp(tre); + //TQString stringSearch = "(.*)!@CAP1@$"; // use @CAP1.. fot caps in templates + //TQString stringReplace = "\\1@CAP1@"; // use \1, \2 for caps in str and @CAP1 fot caps in template if(templateRegExp.exactMatch(t)) { - QStringList caps=templateRegExp.capturedTexts(); + TQStringList caps=templateRegExp.capturedTexts(); int i=0; - for(QStringList::iterator capit=caps.begin();capit!=caps.end();++capit) + for(TQStringList::iterator capit=caps.begin();capit!=caps.end();++capit) { - QString phRegExp="(?!\\\\)@CAP"+QString::number(i)+"@"; + TQString phRegExp="(?!\\\\)@CAP"+TQString::number(i)+"@"; //kdDebug(0) << "phRegExp: " << phRegExp << endl; //kdDebug(0) << "cap[" << i << "]: "<< *capit<< endl; - stringReplace = stringReplace.replace(QRegExp(phRegExp),*capit); - stringSearch = stringSearch.replace(QRegExp(phRegExp),*capit); + stringReplace = stringReplace.replace(TQRegExp(phRegExp),*capit); + stringSearch = stringSearch.replace(TQRegExp(phRegExp),*capit); i++; } // kdDebug(0) << "stringSearch " << stringSearch << endl; // kdDebug(0) << "stringReplace " << stringReplace << endl; - QRegExp stringSearchRegExp = QRegExp(stringSearch); + TQRegExp stringSearchRegExp = TQRegExp(stringSearch); // kdDebug(0) << "before: "<<s<<endl; s = s.replace(stringSearchRegExp,stringReplace); // kdDebug(0) << "after: "<<s<<endl; @@ -702,7 +702,7 @@ QString DataBaseInterface::formatRegExp(QString _s, QString t, QString tre,QStri return s; } -DBItemMultiIndex::IndexList DataBaseInterface::getAlpha( const QString & query ) +DBItemMultiIndex::IndexList DataBaseInterface::getAlpha( const TQString & query ) { DBItemMainKey *k = new DBItemMainKey(simple(query)); DBItemMultiIndex *d = new DBItemMultiIndex(); @@ -718,7 +718,7 @@ DataBaseInterface::MainEntry DataBaseInterface::getFromIndex( uint i ) return get(k.getString(),0); //FIXME: this is a BUG right now but the filter should be removed } -DataBaseInterface::MainEntry DataBaseInterface::getSentence( const QString & query ) +DataBaseInterface::MainEntry DataBaseInterface::getSentence( const TQString & query ) { static int counter=1; @@ -731,7 +731,7 @@ DataBaseInterface::MainEntry DataBaseInterface::getSentence( const QString & que } -DBItemMultiIndex::IndexList DataBaseInterface::getWordIndex( const QString & query ) +DBItemMultiIndex::IndexList DataBaseInterface::getWordIndex( const TQString & query ) { DBItemMainKey k = DBItemMainKey(query); DBItemMultiIndex d = DBItemMultiIndex(); @@ -740,7 +740,7 @@ DBItemMultiIndex::IndexList DataBaseInterface::getWordIndex( const QString & que } else { - QValueList<unsigned int> tmpList; + TQValueList<unsigned int> tmpList; return tmpList; } diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/database.h b/kbabel/kbabeldict/modules/dbsearchengine2/database.h index c447fa59..d6ed3482 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/database.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/database.h @@ -8,11 +8,11 @@ #ifndef DATABASE_2_H #define DATABASE_2_H -#include <qstring.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqvaluelist.h> #include <db4/db_cxx.h> -#include <qobject.h> -#include <qregexp.h> +#include <tqobject.h> +#include <tqregexp.h> #include "dbentries.h" @@ -43,7 +43,7 @@ public: class DataBase : Db { public: - DataBase(QString dbpath, QString dbname, QString dblang); + DataBase(TQString dbpath, TQString dbname, TQString dblang); int open(DBTYPE type,unsigned int flags=0); @@ -105,12 +105,12 @@ int get(DBItem * key,DBItem *data){ int close(unsigned int i) {return Db::close( i); } //For scrolling - // int getFirst(DBItem *key,DBItem *data,QString table); - // int getNext(DBItem *key,DBItem *data,QString table); - // bool isEnd(QString table); + // int getFirst(DBItem *key,DBItem *data,TQString table); + // int getNext(DBItem *key,DBItem *data,TQString table); + // bool isEnd(TQString table); private: - QString filename; - QString database; + TQString filename; + TQString database; DBTYPE mytype; }; @@ -122,26 +122,26 @@ class QueryResult //from DBInterface to KDBSearchEngine { public: QueryResult(); - QueryResult(QString r); - QueryResult(QString r,QString o,int s); - void setRichResult(QString r) { richr=r; } - void setRichOriginal(QString r) { richo=r; } + QueryResult(TQString r); + QueryResult(TQString r,TQString o,int s); + void setRichResult(TQString r) { richr=r; } + void setRichOriginal(TQString r) { richo=r; } - QString richResult() {return richr;} - QString richOriginal() {return richo;} + TQString richResult() {return richr;} + TQString richOriginal() {return richo;} - QString result(){ return res; } - QString original() {return orig; } + TQString result(){ return res; } + TQString original() {return orig; } int score() {return sco;} //info contains originalkey,catalog,date,author etc... ResultInfo info(){ResultInfo i; i.info="no info"; return i;} private: - QString res; - QString orig; - QString richr; - QString richo; + TQString res; + TQString orig; + TQString richr; + TQString richo; int sco; }; @@ -158,34 +158,34 @@ class DataBaseInterface : public QObject public: //move result list typedef to AbstractAlgorthm or somewhere else - typedef QValueList<QueryResult> ResultList; + typedef TQValueList<QueryResult> ResultList; typedef QPair<DBItemMainKey,DBItemMainData> MainEntry; - DataBaseInterface( QString dir, DBSESettings *sets); + DataBaseInterface( TQString dir, DBSESettings *sets); ~DataBaseInterface(); //Ask the Database to stop now. void stop(bool b=true) {_stopNow=b;} //Search words - ResultList wordsMatch(QString query,SearchFilter *filter=0,bool notify=true); + ResultList wordsMatch(TQString query,SearchFilter *filter=0,bool notify=true); //Edit database functions. //addEntry and sync all the tables - bool addEntry(QString original,QString translated,InputInfo *info); + bool addEntry(TQString original,TQString translated,InputInfo *info); //FIXME:implement me! - bool removeEntry(QString original); + bool removeEntry(TQString original); //FIXME: go persistent! - QMap<QString,float> correlation(QString word,SearchFilter *filter=0,bool notify=true,float minSign=0.2); + TQMap<TQString,float> correlation(TQString word,SearchFilter *filter=0,bool notify=true,float minSign=0.2); // Read the database - MainEntry get(const QString& query,SearchFilter *filter=0); + MainEntry get(const TQString& query,SearchFilter *filter=0); MainEntry getFromIndex(uint i); - DBItemMultiIndex::IndexList getAlpha(const QString& query); - DBItemMultiIndex::IndexList getWordIndex(const QString& query); - MainEntry getSentence(const QString& query); + DBItemMultiIndex::IndexList getAlpha(const TQString& query); + DBItemMultiIndex::IndexList getWordIndex(const TQString& query); + MainEntry getSentence(const TQString& query); //Database status check functions bool mainOk() {return main!=0;} @@ -206,7 +206,7 @@ class DataBaseInterface : public QObject DBSESettings *getSettings() {return settings;} private: - DataBase * openMyDataBase(const QString& prefix,const QString& name,const QString& l,DBTYPE tt); + DataBase * openMyDataBase(const TQString& prefix,const TQString& name,const TQString& l,DBTYPE tt); DataBase *main; DataBase *numindex; DataBase *wordsindex; @@ -222,14 +222,14 @@ class DataBaseInterface : public QObject //FIXME:Move to KBabel common library. public: - QString format( QString _s,QString t); - QString formatRegExp(QString _s, QString t, QString tre,QString stringSearch,QString stringReplace); - static QStringList words(QString s); - static QStringList sentences(QString s); - static QStringList sentencesSeparator(QString s); - static QString simple(QString str,bool ck=false); - static bool isUpper(QChar s); - static bool isLower(QChar s); + TQString format( TQString _s,TQString t); + TQString formatRegExp(TQString _s, TQString t, TQString tre,TQString stringSearch,TQString stringReplace); + static TQStringList words(TQString s); + static TQStringList sentences(TQString s); + static TQStringList sentencesSeparator(TQString s); + static TQString simple(TQString str,bool ck=false); + static bool isUpper(TQChar s); + static bool isLower(TQChar s); }; diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.cpp index 4f048f9c..efa7e44d 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.cpp @@ -1,12 +1,12 @@ #include "dbentries.h" -#include <qdatastream.h> +#include <tqdatastream.h> void DBItem::set() { - QBuffer b(mydata); + TQBuffer b(mydata); b.open( IO_WriteOnly ); - QDataStream s(&b); + TQDataStream s(&b); write(&s); b.close(); set_data(mydata.data()); @@ -18,7 +18,7 @@ void DBItem::set() mydata.resize(get_size()); mydata.duplicate((const char *)get_data(),(unsigned int)get_size()); - QDataStream *s = new QDataStream(mydata,IO_ReadOnly); + TQDataStream *s = new TQDataStream(mydata,IO_ReadOnly); read(s); delete s; } @@ -31,18 +31,18 @@ DBItemMainKey::DBItemMainKey() //set(); } -DBItemMainKey::DBItemMainKey(QString searchstring) +DBItemMainKey::DBItemMainKey(TQString searchstring) { sstr=searchstring; //set(); } -void DBItemMainKey::read(QDataStream *s) +void DBItemMainKey::read(TQDataStream *s) { *s >> sstr; } -void DBItemMainKey::write(QDataStream *s) +void DBItemMainKey::write(TQDataStream *s) { *s << sstr; } @@ -64,17 +64,17 @@ void DBItemMainData::clear() //set(); } -void DBItemMainData::read(QDataStream *s) +void DBItemMainData::read(TQDataStream *s) { *s >> indexnumber >> translations; } -void DBItemMainData::write(QDataStream *s) +void DBItemMainData::write(TQDataStream *s) { *s << (Q_UINT32)indexnumber << translations; } -void DBItemMainData::addTranslation(QString str, unsigned int ref) +void DBItemMainData::addTranslation(TQString str, unsigned int ref) { //get(); if(translations[str].find(ref)==translations[str].end()) // If it do not exists @@ -87,7 +87,7 @@ void DBItemMainData::addTranslation(QString str, unsigned int ref) } -void DBItemMainData::removeTranslation(QString str, unsigned int ref) +void DBItemMainData::removeTranslation(TQString str, unsigned int ref) { //get(); translations[str].remove(ref); @@ -100,8 +100,8 @@ void DBItemMainData::removeTranslation(QString str, unsigned int ref) void DBItemMainData::removeRef( unsigned int ref) { //get(); -QMapIterator<QString,QValueList<unsigned int> > it2; - for(QMapIterator<QString,QValueList<unsigned int> > it = translations.begin(); +TQMapIterator<TQString,TQValueList<unsigned int> > it2; + for(TQMapIterator<TQString,TQValueList<unsigned int> > it = translations.begin(); it!= translations.end(); /* it++*/) { //Dirty hack it2=it; @@ -113,11 +113,11 @@ QMapIterator<QString,QValueList<unsigned int> > it2; //set(); } -QStringList DBItemMainData::getTranslations() +TQStringList DBItemMainData::getTranslations() { //get(); -QStringList result; - for(QMapIterator<QString,QValueList<unsigned int> > it = translations.begin(); +TQStringList result; + for(TQMapIterator<TQString,TQValueList<unsigned int> > it = translations.begin(); it!= translations.end(); it++) result.append(it.key()); @@ -125,7 +125,7 @@ return result; } -QValueList<unsigned int> DBItemMainData::getReferences(QString str) +TQValueList<unsigned int> DBItemMainData::getReferences(TQString str) { //get(); return translations[str]; //this also add a "str" entry but we do not call set()! @@ -160,12 +160,12 @@ void DBItemMultiIndex::removeEntry(unsigned int index) } -void DBItemMultiIndex::read(QDataStream *s) +void DBItemMultiIndex::read(TQDataStream *s) { *s >> list; } -void DBItemMultiIndex::write(QDataStream *s) +void DBItemMultiIndex::write(TQDataStream *s) { *s << list; } diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.h b/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.h index 0a40878c..c4410ade 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/dbentries.h @@ -2,19 +2,19 @@ #define DBENTRIES_H #include <db4/db_cxx.h> -#include <qstring.h> -#include <qbuffer.h> -#include <qmap.h> -#include <qstringlist.h> -#include <qdatetime.h> +#include <tqstring.h> +#include <tqbuffer.h> +#include <tqmap.h> +#include <tqstringlist.h> +#include <tqdatetime.h> class CatalogInfo { - QString author; - QDateTime datetime; - QString filename; - QString filepath; + TQString author; + TQDateTime datetime; + TQString filename; + TQString filepath; }; @@ -23,13 +23,13 @@ class ResultInfo { public: //Common info - QString original; //placeholder + TQString original; //placeholder // //Multi reference info - QValueList<CatalogInfo> catalogs; + TQValueList<CatalogInfo> catalogs; - QString info; + TQString info; }; @@ -54,9 +54,9 @@ public: protected: - virtual void read(QDataStream *s) = 0; - virtual void write(QDataStream *s) = 0; - QByteArray mydata; + virtual void read(TQDataStream *s) = 0; + virtual void write(TQDataStream *s) = 0; + TQByteArray mydata; bool empty; }; @@ -65,17 +65,17 @@ class DBItemMainKey : public DBItem { public: DBItemMainKey(); - DBItemMainKey(QString searchstring); + DBItemMainKey(TQString searchstring); - QString getString(){ return sstr;} + TQString getString(){ return sstr;} private: - virtual void read(QDataStream *s); - virtual void write(QDataStream *s); + virtual void read(TQDataStream *s); + virtual void write(TQDataStream *s); - QString sstr; + TQString sstr; }; @@ -84,21 +84,21 @@ class DBItemMainData : public DBItem { public: - typedef QMapIterator<QString,QValueList<unsigned int> > TranslationIterator; - typedef QMap<QString,QValueList<unsigned int> > TranslationMap; + typedef TQMapIterator<TQString,TQValueList<unsigned int> > TranslationIterator; + typedef TQMap<TQString,TQValueList<unsigned int> > TranslationMap; DBItemMainData(); - QStringList getTranslations(); - QValueList<unsigned int> getReferences(QString str); + TQStringList getTranslations(); + TQValueList<unsigned int> getReferences(TQString str); void clear(); //Add a translation with reference ref, if translation exists append // ref to the list of references - void addTranslation(QString str,unsigned int ref); - void removeTranslation(QString str,unsigned int ref); + void addTranslation(TQString str,unsigned int ref); + void removeTranslation(TQString str,unsigned int ref); //remove any reference to ref, if ref is the only reference of a translation // the translation is removed @@ -109,8 +109,8 @@ class DBItemMainData : public DBItem private: - virtual void read(QDataStream *s); - virtual void write(QDataStream *s); + virtual void read(TQDataStream *s); + virtual void write(TQDataStream *s); unsigned int indexnumber; TranslationMap translations; @@ -121,7 +121,7 @@ private: class DBItemMultiIndex : public DBItem { public: - typedef QValueList<unsigned int> IndexList; + typedef TQValueList<unsigned int> IndexList; DBItemMultiIndex(); // DBItemMultiIndex(IndexList l); @@ -134,8 +134,8 @@ class DBItemMultiIndex : public DBItem private: - virtual void read(QDataStream *s); - virtual void write(QDataStream *s); + virtual void read(TQDataStream *s); + virtual void write(TQDataStream *s); IndexList list; diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.cpp index b19b2db2..7c2d8564 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.cpp @@ -18,8 +18,8 @@ */ #include "dbscan.h" #include <kconfig.h> -#include <qdir.h> -#include <qfile.h> +#include <tqdir.h> +#include <tqfile.h> #include <kapplication.h> #include <kurl.h> #include <kdebug.h> @@ -69,9 +69,9 @@ void MessagesSource::getDialogValues(SourceDialog *sd) type=sd->type->currentItem(); } -QValueList<KURL> MessagesSource::urls() +TQValueList<KURL> MessagesSource::urls() { - QValueList<KURL> urlList; + TQValueList<KURL> urlList; if(type==0) urlList.append(location); if(type==1|| type==2) @@ -81,18 +81,18 @@ QValueList<KURL> MessagesSource::urls() } -QValueList<KURL> MessagesSource::filesInDir(KURL url,bool recursive) +TQValueList<KURL> MessagesSource::filesInDir(KURL url,bool recursive) { - QValueList<KURL> result; - QDir d(url.path()); + TQValueList<KURL> result; + TQDir d(url.path()); d.setMatchAllDirs(true); kdDebug(0) << d.count() << " files in dir "<< url.path()<<endl; const QFileInfoList* files = d.entryInfoList(); kdDebug(0) << files << endl; - // QPtrListIterator<QFileInfo> it(*files); + // TQPtrListIterator<TQFileInfo> it(*files); if(files){ - for (QPtrListIterator<QFileInfo> fileit(*files); !fileit.atLast(); ++fileit ) + for (TQPtrListIterator<TQFileInfo> fileit(*files); !fileit.atLast(); ++fileit ) { if ((*fileit)->isDir()) { @@ -120,14 +120,14 @@ QValueList<KURL> MessagesSource::filesInDir(KURL url,bool recursive) //FIXME: clean this class PoScanner::PoScanner(DataBaseInterface *dbi, - QObject *parent,const char *name):QObject(parent,name) + TQObject *parent,const char *name):TQObject(parent,name) { di=dbi; removeOldCatalogTranslation=true; count=0; } -bool PoScanner::scanPattern(QString pathName,QString pattern,bool rec) +bool PoScanner::scanPattern(TQString pathName,TQString pattern,bool rec) { int tot; //Only one progress bar!! @@ -138,18 +138,18 @@ if (!called) { pb=true; count=0;} called=true; -kdDebug(0) << QString("Scanning: %1, %2").arg(pathName).arg(pattern) << endl; +kdDebug(0) << TQString("Scanning: %1, %2").arg(pathName).arg(pattern) << endl; if(pb) { emit patternStarted(); emit patternProgress(0); } - QDir d(pathName,pattern); + TQDir d(pathName,pattern); d.setMatchAllDirs(true); const QFileInfoList* files = d.entryInfoList(); tot=files->count(); - QPtrListIterator<QFileInfo> it(*files); + TQPtrListIterator<TQFileInfo> it(*files); kdDebug(0) << tot << endl; for ( int i=0; i<tot; i++ ) { @@ -188,7 +188,7 @@ if(pb){called=false;count=0;} return true; } -bool PoScanner::scanFile(QString fileName) +bool PoScanner::scanFile(TQString fileName) { KURL u(fileName); return scanURL(u); @@ -202,10 +202,10 @@ emit fileStarted(); Catalog * catalog=new Catalog(this,"ScanPoCatalog"); -QString pretty=u.prettyURL(); -QString location=pretty.right(pretty.length()-pretty.findRev("/")-1); +TQString pretty=u.prettyURL(); +TQString location=pretty.right(pretty.length()-pretty.findRev("/")-1); -connect(catalog,SIGNAL(signalProgress(int)),this,SIGNAL(fileLoading(int))); +connect(catalog,TQT_SIGNAL(signalProgress(int)),this,TQT_SIGNAL(fileLoading(int))); emit filename(location); emit fileProgress(0); emit fileLoading(0); @@ -220,10 +220,10 @@ if(rr != OK && rr !=RECOVERED_PARSE_ERROR ) } emit fileLoading(100); -QString author; +TQString author; if(rr != HEADER_ERROR) author=catalog->lastTranslator(); -else author=QString(""); +else author=TQString(""); //int catnum=dm->catalogRef(location,author,fileName); InputInfo ii; @@ -253,7 +253,7 @@ for (i=0;i<tot;i++) //Skip header = ???? if(!fuzzy && !untra) { int res; - QString msgid,msgstr; + TQString msgid,msgstr; msgid=catalog->msgid(i,true).first(); msgstr=catalog->msgstr(i).first(); res=di->addEntry(msgid,msgstr,&ii); @@ -264,7 +264,7 @@ for (i=0;i<tot;i++) //Skip header = ???? } -// kdDebug(0) << QString("File finished") << endl; +// kdDebug(0) << TQString("File finished") << endl; emit fileProgress(0); emit fileLoading(0); diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.h b/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.h index 990d556c..e4cdf7da 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/dbscan.h @@ -48,10 +48,10 @@ class MessagesSource * It returns a list of urls to scan, the list contains single file if type is "SingleFile" * or a list of files if type is "SingleDir" or "RecDir" */ - QValueList<KURL> urls(); + TQValueList<KURL> urls(); private: - QValueList<KURL> filesInDir(KURL url,bool recursive); + TQValueList<KURL> filesInDir(KURL url,bool recursive); KURL location; // The source type "SingleFile" =0, "SingleDirectory"=1, "RecursiveDirectory"=2 @@ -63,9 +63,9 @@ class MessagesSource SearchFilter filter; - QString projectName; - QString projectKeywords; - QString status; + TQString projectName; + TQString projectKeywords; + TQString status; }; @@ -75,12 +75,12 @@ class PoScanner : public QObject public: - PoScanner(DataBaseInterface *dbi,QObject *parent=0,const char *name=0); + PoScanner(DataBaseInterface *dbi,TQObject *parent=0,const char *name=0); /* Scan a single PO file. */ - bool scanFile(QString fileName); + bool scanFile(TQString fileName); /* Scan a single URL file. @@ -91,7 +91,7 @@ class PoScanner : public QObject /* Scan a list of space separated files with possible MetaCharacters */ - bool scanPattern(QString pathName,QString pattern="*.po",bool rec=false); + bool scanPattern(TQString pathName,TQString pattern="*.po",bool rec=false); @@ -105,7 +105,7 @@ class PoScanner : public QObject void patternProgress(int); void patternFinished(); void added(int); - void filename(QString); + void filename(TQString); private: // If true when a translation is found in a CATALOG the old translation for this CATALOG diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.cpp index 9c286052..55f6a16f 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.cpp @@ -22,7 +22,7 @@ KInstance *DbSe2Factory::s_instance = 0; KAboutData *DbSe2Factory::s_about = 0; -DbSe2Factory::DbSe2Factory( QObject *parent, const char *name) +DbSe2Factory::DbSe2Factory( TQObject *parent, const char *name) : KLibFactory(parent,name) { } @@ -43,10 +43,10 @@ DbSe2Factory::~DbSe2Factory() } -QObject *DbSe2Factory::createObject( QObject *parent, const char *name, - const char *classname, const QStringList &) +TQObject *DbSe2Factory::createObject( TQObject *parent, const char *name, + const char *classname, const TQStringList &) { - if(QCString(classname) != "SearchEngine") + if(TQCString(classname) != "SearchEngine") { kdError() << "not a SearchEngine requested" << endl; return 0; diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.h b/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.h index 4285d53c..2b70184a 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/dbse2_factory.h @@ -9,12 +9,12 @@ class DbSe2Factory : public KLibFactory { Q_OBJECT public: - DbSe2Factory( QObject *parent=0, const char *name=0); + DbSe2Factory( TQObject *parent=0, const char *name=0); ~DbSe2Factory(); - virtual QObject *createObject( QObject *parent=0, const char *name=0, - const char *classname="QObject", - const QStringList &args = QStringList()); + virtual TQObject *createObject( TQObject *parent=0, const char *name=0, + const char *classname="TQObject", + const TQStringList &args = TQStringList()); static KInstance *instance(); diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.cpp b/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.cpp index 7634a799..76aef878 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.cpp +++ b/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.cpp @@ -1,13 +1,13 @@ -#include <qradiobutton.h> -#include <qslider.h> -#include <qspinbox.h> -#include <qcheckbox.h> -#include <qlabel.h> -#include <qlayout.h> +#include <tqradiobutton.h> +#include <tqslider.h> +#include <tqspinbox.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqlayout.h> #include <klocale.h> #include <kfiledialog.h> #include <kurlrequester.h> -#include <qtoolbutton.h> +#include <tqtoolbutton.h> #include <klineedit.h> #include <kstandarddirs.h> #include <knuminput.h> @@ -15,11 +15,11 @@ #include "dbse2.h" #include "preferenceswidget.h" -KDB2PreferencesWidget::KDB2PreferencesWidget(QWidget *parent, const char* name) +KDB2PreferencesWidget::KDB2PreferencesWidget(TQWidget *parent, const char* name) : PrefWidget(parent,name) { - QVBoxLayout *layout = new QVBoxLayout(this); -// QLabel *label = new QLabel(i18n("Settings for KDE Database Search Engine"),this); + TQVBoxLayout *layout = new TQVBoxLayout(this); +// TQLabel *label = new TQLabel(i18n("Settings for KDE Database Search Engine"),this); // layout->addWidget(label); dbpw = new DBSearchEnginePrefWidget(this); @@ -30,7 +30,7 @@ KDB2PreferencesWidget::KDB2PreferencesWidget(QWidget *parent, const char* name) standard(); -// connect(dbpw->browseTB_3,SIGNAL(clicked()),SLOT(browse1())); +// connect(dbpw->browseTB_3,TQT_SIGNAL(clicked()),TQT_SLOT(browse1())); emit restoreNow(); //Fill with actual params. @@ -52,7 +52,7 @@ emit restoreNow(); void KDB2PreferencesWidget::standard() { -QString defaultDir; +TQString defaultDir; KStandardDirs * dirs = KGlobal::dirs(); if(dirs) { diff --git a/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.h b/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.h index 4714fd13..1f706902 100644 --- a/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.h +++ b/kbabel/kbabeldict/modules/dbsearchengine2/preferenceswidget.h @@ -9,7 +9,7 @@ class KDB2PreferencesWidget : public PrefWidget Q_OBJECT public: - KDB2PreferencesWidget(QWidget *parent=0, const char* name=0); + KDB2PreferencesWidget(TQWidget *parent=0, const char* name=0); virtual ~KDB2PreferencesWidget(); virtual void apply(); |