summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
commit4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch)
treeb0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp
parent1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff)
downloadtdesdk-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/tmx/tmxcompendium.cpp')
-rw-r--r--kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp164
1 files changed, 82 insertions, 82 deletions
diff --git a/kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp b/kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp
index 152bc536..415992bf 100644
--- a/kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp
+++ b/kbabel/kbabeldict/modules/tmx/tmxcompendium.cpp
@@ -41,8 +41,8 @@
#include <kinstance.h>
#include <kio/netaccess.h>
-#include <qtextstream.h>
-#include <qtimer.h>
+#include <tqtextstream.h>
+#include <tqtimer.h>
#include "tmxcompendiumdata.h"
#include "tmxcompendium.h"
@@ -55,10 +55,10 @@
#define NGRAM_LEN 3
#define LIM_NGRAM 50
-static KStaticDeleter< QDict<TmxCompendiumData> > compDataDeleter;
-QDict<TmxCompendiumData> *TmxCompendium::_compDict = 0;
+static KStaticDeleter< TQDict<TmxCompendiumData> > compDataDeleter;
+TQDict<TmxCompendiumData> *TmxCompendium::_compDict = 0;
-TmxCompendium::TmxCompendium(QObject *parent, const char *name)
+TmxCompendium::TmxCompendium(TQObject *parent, const char *name)
: SearchEngine(parent, name)
{
prefWidget=0;
@@ -81,8 +81,8 @@ TmxCompendium::TmxCompendium(QObject *parent, const char *name)
matchWords=true;
- loadTimer = new QTimer(this);
- connect(loadTimer,SIGNAL(timeout()),this,SLOT(slotLoadCompendium()));
+ loadTimer = new TQTimer(this);
+ connect(loadTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(slotLoadCompendium()));
}
TmxCompendium::~TmxCompendium()
@@ -137,7 +137,7 @@ void TmxCompendium::readSettings(KConfigBase *config)
matchWords = config->readBoolEntry("MatchWords",true);
matchNGram = config->readBoolEntry("MatchNGram",true);
- QString newPath = config->readEntry("Compendium","http://i18n.kde.org/po_overview/@LANG@.messages");
+ TQString newPath = config->readEntry("Compendium","http://i18n.kde.org/po_overview/@LANG@.messages");
if(!initialized)
{
url = newPath;
@@ -152,12 +152,12 @@ void TmxCompendium::readSettings(KConfigBase *config)
restoreSettings();
}
-PrefWidget *TmxCompendium::preferencesWidget(QWidget *parent)
+PrefWidget *TmxCompendium::preferencesWidget(TQWidget *parent)
{
prefWidget = new TmxCompendiumPreferencesWidget(parent,"tmxcompendium_prefwidget");
- connect(prefWidget, SIGNAL(applySettings()), this, SLOT(applySettings()));
- connect(prefWidget, SIGNAL(restoreSettings())
- , this, SLOT(restoreSettings()));
+ connect(prefWidget, TQT_SIGNAL(applySettings()), this, TQT_SLOT(applySettings()));
+ connect(prefWidget, TQT_SIGNAL(restoreSettings())
+ , this, TQT_SLOT(restoreSettings()));
restoreSettings();
@@ -170,23 +170,23 @@ const KAboutData *TmxCompendium::about() const
}
-QString TmxCompendium::name() const
+TQString TmxCompendium::name() const
{
return i18n("TMX Compendium");
}
-QString TmxCompendium::id() const
+TQString TmxCompendium::id() const
{
return "tmxcompendium";
}
-QString TmxCompendium::lastError()
+TQString TmxCompendium::lastError()
{
return errorMsg;
}
-bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const SearchFilter*)
+bool TmxCompendium::startSearch(const TQString& text, uint pluralForm, const SearchFilter*)
{
if(autoUpdate && prefWidget && prefWidget->settingsChanged())
{
@@ -223,8 +223,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
emit started();
- QValueList<int> foundIndices;
- QValueList<int> checkedIndices;
+ TQValueList<int> foundIndices;
+ TQValueList<int> checkedIndices;
uint checkCounter=0;
const int *index = data->exactDict(text);
@@ -240,8 +240,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
TranslationInfo *info = new TranslationInfo;
info->location = directory(realURL,0);
- info->translator = QString::null;
- info->description = QString::null;
+ info->translator = TQString::null;
+ info->description = TQString::null;
result->descriptions.append(info);
results.append(result);
@@ -250,7 +250,7 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
emit resultFound(result);
}
- QString searchStr=TmxCompendiumData::simplify(text);
+ TQString searchStr=TmxCompendiumData::simplify(text);
if(!caseSensitive)
@@ -258,13 +258,13 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
searchStr = searchStr.lower();
}
- QString temp = searchStr;
+ TQString temp = searchStr;
temp = temp.lower();
- const QValueList<int> *indexList = data->allDict(temp);
+ const TQValueList<int> *indexList = data->allDict(temp);
if(indexList)
{
- QValueList<int>::ConstIterator it;
+ TQValueList<int>::ConstIterator it;
for( it = indexList->begin(); it != indexList->end(); ++it )
{
if(foundIndices.contains(*it))
@@ -272,7 +272,7 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
continue;
}
- QString origStr = data->msgid(*it);
+ TQString origStr = data->msgid(*it);
origStr = TmxCompendiumData::simplify(origStr);
@@ -294,8 +294,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
TranslationInfo *info = new TranslationInfo;
info->location = directory(realURL,0);
- info->translator = QString::null;
- info->description = QString::null;
+ info->translator = TQString::null;
+ info->description = TQString::null;
result->descriptions.append(info);
addResult(result);
@@ -303,8 +303,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
}
}
- QStringList wList = TmxCompendiumData::wordList(searchStr);
- for ( QStringList::Iterator wit = wList.begin()
+ TQStringList wList = TmxCompendiumData::wordList(searchStr);
+ for ( TQStringList::Iterator wit = wList.begin()
; wit != wList.end(); ++wit )
{
if(stop)
@@ -313,7 +313,7 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
indexList = data->wordDict((*wit).lower());
if(indexList)
{
- QValueList<int>::ConstIterator it;
+ TQValueList<int>::ConstIterator it;
for( it = indexList->begin(); it != indexList->end(); ++it )
{
if(stop)
@@ -339,7 +339,7 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
kapp->processEvents(100);
- QString origStr = data->msgid(*it);
+ TQString origStr = data->msgid(*it);
origStr = TmxCompendiumData::simplify(origStr);
@@ -357,8 +357,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
}
else
{
- QString s=*wit;
- QString o=origStr;
+ TQString s=*wit;
+ TQString o=origStr;
if(wholeWords)
{
@@ -389,8 +389,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
if(!found && matchContains && !wholeWords)
{
- QString s=maskString(searchStr);
- QRegExp searchReg(s);
+ TQString s=maskString(searchStr);
+ TQRegExp searchReg(s);
if(searchReg.search(origStr) >= 0)
found=true;
@@ -398,8 +398,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
if(!found && matchIsContained && !wholeWords)
{
- QString s=maskString(origStr);
- QRegExp reg(s);
+ TQString s=maskString(origStr);
+ TQRegExp reg(s);
if(reg.search(searchStr) >= 0)
{
@@ -408,13 +408,13 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
}
if(!found && matchWords && !wholeWords)
{
- QStringList list = TmxCompendiumData::wordList(searchStr);
+ TQStringList list = TmxCompendiumData::wordList(searchStr);
- for ( QStringList::Iterator wit2 = list.begin()
+ for ( TQStringList::Iterator wit2 = list.begin()
; wit2 != list.end(); ++wit2 )
{
- QString s=maskString(*wit2);
- QRegExp reg(s);
+ TQString s=maskString(*wit2);
+ TQRegExp reg(s);
if(reg.search(origStr) >= 0)
{
@@ -436,8 +436,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
TranslationInfo *info = new TranslationInfo;
info->location = directory(realURL,0);
- info->translator = QString::null;
- info->description = QString::null;
+ info->translator = TQString::null;
+ info->description = TQString::null;
result->descriptions.append(info);
addResult(result);
@@ -451,10 +451,10 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
(!wholeWords && (matchContains || matchIsContained || matchWords))
)
{
- QRegExp searchReg;
+ TQRegExp searchReg;
if(matchContains)
{
- QString s=maskString(searchStr);
+ TQString s=maskString(searchStr);
searchReg.setPattern(s);
}
@@ -497,7 +497,7 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
emit progress( (100*(checkCounter+1))/data->numberOfEntries());
}
- QString origStr = data->msgid(i);
+ TQString origStr = data->msgid(i);
origStr = TmxCompendiumData::simplify(origStr);
if(!caseSensitive)
@@ -523,8 +523,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
if(!found && matchIsContained)
{
- QString s=maskString(origStr);
- QRegExp reg(s);
+ TQString s=maskString(origStr);
+ TQRegExp reg(s);
if(reg.search(searchStr) >= 0)
{
@@ -533,19 +533,19 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
}
if(!found && matchWords)
{
- QStringList list = TmxCompendiumData::wordList(searchStr);
+ TQStringList list = TmxCompendiumData::wordList(searchStr);
- for ( QStringList::Iterator wit2 = list.begin()
+ for ( TQStringList::Iterator wit2 = list.begin()
; wit2 != list.end(); ++wit2 )
{
- QString s=maskString(*wit2);
+ TQString s=maskString(*wit2);
if(wholeWords)
{
origStr = " "+origStr+" ";
s=" "+s+" ";
}
- QRegExp reg(s);
+ TQRegExp reg(s);
if(reg.search(origStr) >= 0)
{
@@ -577,8 +577,8 @@ bool TmxCompendium::startSearch(const QString& text, uint pluralForm, const Sear
TranslationInfo *info = new TranslationInfo;
info->location = directory(realURL,0);
- info->translator = QString::null;
- info->description = QString::null;
+ info->translator = TQString::null;
+ info->description = TQString::null;
result->descriptions.append(info);
addResult(result);
@@ -629,7 +629,7 @@ void TmxCompendium::applySettings()
bool needLoading=false;
- QString newPath = prefWidget->url();
+ TQString newPath = prefWidget->url();
if(!initialized)
{
url = newPath;
@@ -685,7 +685,7 @@ void TmxCompendium::slotLoadCompendium()
}
- QString path=url;
+ TQString path=url;
if(path.contains("@LANG@"))
{
@@ -718,7 +718,7 @@ void TmxCompendium::slotLoadCompendium()
}
else
{
- connect(data, SIGNAL(progressEnds()), this, SLOT(recheckData()));
+ connect(data, TQT_SIGNAL(progressEnds()), this, TQT_SLOT(recheckData()));
}
}
else
@@ -737,7 +737,7 @@ void TmxCompendium::recheckData()
{
if(data)
{
- disconnect(data, SIGNAL(progressEnds()), this, SLOT(recheckData()));
+ disconnect(data, TQT_SIGNAL(progressEnds()), this, TQT_SLOT(recheckData()));
error = data->hasErrors();
errorMsg = data->errorMsg();
@@ -746,7 +746,7 @@ void TmxCompendium::recheckData()
loading=false;
}
-QString TmxCompendium::maskString(QString s) const
+TQString TmxCompendium::maskString(TQString s) const
{
s.replace('\\',"\\\\");
s.replace('?',"\\?");
@@ -795,7 +795,7 @@ void TmxCompendium::addResult(SearchResult *result)
}
-void TmxCompendium::setLanguageCode(const QString& lang)
+void TmxCompendium::setLanguageCode(const TQString& lang)
{
if(initialized && url.contains("@LANG@") && lang!=langCode
&& !loadTimer->isActive() )
@@ -806,7 +806,7 @@ void TmxCompendium::setLanguageCode(const QString& lang)
langCode=lang;
}
-QString TmxCompendium::translate(const QString& text, uint pluralForm)
+TQString TmxCompendium::translate(const TQString& text, uint pluralForm)
{
if(!initialized)
{
@@ -818,7 +818,7 @@ QString TmxCompendium::translate(const QString& text, uint pluralForm)
if(error || !data || data->active())
{
- return QString::null;
+ return TQString::null;
}
@@ -829,10 +829,10 @@ QString TmxCompendium::translate(const QString& text, uint pluralForm)
return data->msgstr(*index);
}
- return QString::null;
+ return TQString::null;
}
-QString TmxCompendium::fuzzyTranslation(const QString& text, int &score, uint pluralForm)
+TQString TmxCompendium::fuzzyTranslation(const TQString& text, int &score, uint pluralForm)
{
if(!initialized)
{
@@ -844,7 +844,7 @@ QString TmxCompendium::fuzzyTranslation(const QString& text, int &score, uint pl
if(error || !data || data->active())
{
- return QString::null;
+ return TQString::null;
}
// try to find fuzzy string
@@ -855,7 +855,7 @@ QString TmxCompendium::fuzzyTranslation(const QString& text, int &score, uint pl
int best_match = 0;
int total = data->numberOfEntries();
- QString searchStr = TmxCompendiumData::simplify(text);
+ TQString searchStr = TmxCompendiumData::simplify(text);
//kdDebug(750) << "find best match for " << searchStr << endl;
@@ -883,7 +883,7 @@ QString TmxCompendium::fuzzyTranslation(const QString& text, int &score, uint pl
}
// get a message from the catalog
- QString origStr = data->msgid(i);
+ TQString origStr = data->msgid(i);
origStr = TmxCompendiumData::simplify(origStr);
// don't match too long strings for short search string
@@ -907,7 +907,7 @@ QString TmxCompendium::fuzzyTranslation(const QString& text, int &score, uint pl
return data->msgstr(best_matching);
}
- return QString::null;
+ return TQString::null;
}
@@ -915,14 +915,14 @@ void TmxCompendium::unregisterData()
{
if(data)
{
- disconnect(data, SIGNAL(progressStarts(const QString&)), this
- , SIGNAL(progressStarts(const QString&)));
- disconnect(data, SIGNAL(progressEnds()), this , SIGNAL(progressEnds()));
- disconnect(data, SIGNAL(progress(int)), this , SIGNAL(progress(int)));
+ disconnect(data, TQT_SIGNAL(progressStarts(const TQString&)), this
+ , TQT_SIGNAL(progressStarts(const TQString&)));
+ disconnect(data, TQT_SIGNAL(progressEnds()), this , TQT_SIGNAL(progressEnds()));
+ disconnect(data, TQT_SIGNAL(progress(int)), this , TQT_SIGNAL(progress(int)));
if(data->active())
{
- disconnect(data,SIGNAL(progressEnds()),this,SLOT(recheckData()));
+ disconnect(data,TQT_SIGNAL(progressEnds()),this,TQT_SLOT(recheckData()));
}
if(data->unregisterObject(this))
@@ -933,7 +933,7 @@ void TmxCompendium::unregisterData()
}
else
{
- connect(data,SIGNAL(progressEnds()),this,SLOT(removeData()));
+ connect(data,TQT_SIGNAL(progressEnds()),this,TQT_SLOT(removeData()));
}
}
@@ -957,21 +957,21 @@ void TmxCompendium::registerData()
emit progressStarts(i18n("Loading PO compendium"));
}
- connect(data, SIGNAL(progressStarts(const QString&)), this
- , SIGNAL(progressStarts(const QString&)));
- connect(data, SIGNAL(progressEnds()), this , SIGNAL(progressEnds()));
- connect(data, SIGNAL(progress(int)), this , SIGNAL(progress(int)));
+ connect(data, TQT_SIGNAL(progressStarts(const TQString&)), this
+ , TQT_SIGNAL(progressStarts(const TQString&)));
+ connect(data, TQT_SIGNAL(progressEnds()), this , TQT_SIGNAL(progressEnds()));
+ connect(data, TQT_SIGNAL(progress(int)), this , TQT_SIGNAL(progress(int)));
}
void TmxCompendium::removeData()
{
- const QObject *s=sender();
+ const TQObject *s=sender();
if(s && s->inherits("TmxCompendiumData"))
{
const TmxCompendiumData *d=static_cast<const TmxCompendiumData*>(s);
if(d)
{
- QDictIterator<TmxCompendiumData> it(*compendiumDict());
+ TQDictIterator<TmxCompendiumData> it(*compendiumDict());
while(it.current())
{
if(it.current() == d)
@@ -991,11 +991,11 @@ void TmxCompendium::removeData()
}
}
-QDict<TmxCompendiumData> *TmxCompendium::compendiumDict()
+TQDict<TmxCompendiumData> *TmxCompendium::compendiumDict()
{
if(!_compDict)
{
- _compDict=compDataDeleter.setObject( new QDict<TmxCompendiumData> );
+ _compDict=compDataDeleter.setObject( new TQDict<TmxCompendiumData> );
_compDict->setAutoDelete(true);
}