diff options
Diffstat (limited to 'bibletime/backend/creferencemanager.cpp')
-rw-r--r-- | bibletime/backend/creferencemanager.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/bibletime/backend/creferencemanager.cpp b/bibletime/backend/creferencemanager.cpp index 7b41e7f..0a2eed3 100644 --- a/bibletime/backend/creferencemanager.cpp +++ b/bibletime/backend/creferencemanager.cpp @@ -15,14 +15,14 @@ #include "../frontend/cbtconfig.h" //QT includes -#include <qregexp.h> +#include <tqregexp.h> //stl includes #include <algorithm> // STL algorithms class library /** Returns a hyperlink used to be imbedded in the display windows. At the moment the format is sword://module/key */ -const QString CReferenceManager::encodeHyperlink( const QString moduleName, const QString key, const CReferenceManager::Type type) { - QString ret = QString::null; +const TQString CReferenceManager::encodeHyperlink( const TQString moduleName, const TQString key, const CReferenceManager::Type type) { + TQString ret = TQString::null; switch (type) { @@ -70,12 +70,12 @@ const QString CReferenceManager::encodeHyperlink( const QString moduleName, cons } if (type == GenericBook) { - const QString s = (!key.isEmpty() ? key : QString::null); - QString newKey = QString::null; + const TQString s = (!key.isEmpty() ? key : TQString::null); + TQString newKey = TQString::null; //replace all / of the key (e.g. of a CSwordTreeKey) with // the escape sequence \/ so we know it's a link internal divider (e.g. of CSwordTreeKey)! - QChar c; + TQChar c; for(unsigned int i = 0; i < s.length(); ++i) { c = s.at(i); @@ -120,15 +120,15 @@ const QString CReferenceManager::encodeHyperlink( const QString moduleName, cons } /** Decodes the given hyperlink to module and key. */ -const bool CReferenceManager::decodeHyperlink( const QString& hyperlink, QString& module, QString& key, CReferenceManager::Type& type ) { +const bool CReferenceManager::decodeHyperlink( const TQString& hyperlink, TQString& module, TQString& key, CReferenceManager::Type& type ) { /** * We have to decide between three types of URLS: sword://Type/Module/Key, morph://Testament/key and strongs://Testament/Key */ - module = QString::null; - key = QString::null; + module = TQString::null; + key = TQString::null; type = Unknown; //not yet known - QString ref = hyperlink; + TQString ref = hyperlink; //remove the trailing slash if (ref.right(1)=="/" && ref.right(2) != "\\/") //trailing slash, but not escaped @@ -188,7 +188,7 @@ const bool CReferenceManager::decodeHyperlink( const QString& hyperlink, QString // } //replace \/ escapes with / - key.replace(QRegExp("\\\\/"), "/"); + key.replace(TQRegExp("\\\\/"), "/"); } else if (ref.left(8).lower() == "morph://" || ref.left(10).lower() == "strongs://") { //strongs or morph URL have the same format enum PreType {IsMorph, IsStrongs}; @@ -207,7 +207,7 @@ const bool CReferenceManager::decodeHyperlink( const QString& hyperlink, QString const int pos = ref.find("/"); if (pos>0) { //found - const QString language = ref.mid(0,pos); + const TQString language = ref.mid(0,pos); if (language.lower() == "hebrew") { switch (preType) { @@ -247,14 +247,14 @@ const bool CReferenceManager::decodeHyperlink( const QString& hyperlink, QString return true; } -const QString CReferenceManager::encodeReference(const QString &module, const QString &reference) { - //return QString("(%1)%2").arg(module).arg(reference); - return QString("(").append(module).append(")").append(reference); +const TQString CReferenceManager::encodeReference(const TQString &module, const TQString &reference) { + //return TQString("(%1)%2").arg(module).arg(reference); + return TQString("(").append(module).append(")").append(reference); } -void CReferenceManager::decodeReference(QString &dragreference, QString &module, QString &reference) { +void CReferenceManager::decodeReference(TQString &dragreference, TQString &module, TQString &reference) { const int pos = dragreference.find(")"); - const QString fallbackModule = dragreference.mid( 1, pos - 1); + const TQString fallbackModule = dragreference.mid( 1, pos - 1); dragreference = dragreference.mid(pos+1); module = fallbackModule; @@ -262,15 +262,15 @@ void CReferenceManager::decodeReference(QString &dragreference, QString &module, } /** Returns true if the parameter is a hyperlink. */ -const bool CReferenceManager::isHyperlink( const QString& hyperlink ) { +const bool CReferenceManager::isHyperlink( const TQString& hyperlink ) { return ( hyperlink.left(8) == "sword://") || (hyperlink.left(10) == "strongs://") || (hyperlink.left(8) == "morph://"); } /** Returns the preferred module name for the given type. */ -const QString CReferenceManager::preferredModule( const CReferenceManager::Type type ) { - QString moduleName = QString::null; +const TQString CReferenceManager::preferredModule( const CReferenceManager::Type type ) { + TQString moduleName = TQString::null; CSwordModuleInfo* module = 0; switch (type) { @@ -324,7 +324,7 @@ const QString CReferenceManager::preferredModule( const CReferenceManager::Type break; } - return module ? module->name() : QString::null; + return module ? module->name() : TQString::null; } /** No descriptions */ @@ -349,7 +349,7 @@ CReferenceManager::Type CReferenceManager::typeFromModule( const CSwordModuleInf } /** Parses the given verse references using the given language and the module.*/ -const QString CReferenceManager::parseVerseReference( const QString& ref, const CReferenceManager::ParseOptions& options) { +const TQString CReferenceManager::parseVerseReference( const TQString& ref, const CReferenceManager::ParseOptions& options) { CSwordModuleInfo* const mod = CPointers::backend()->findModuleByName(options.refDestinationModule); Q_ASSERT(mod); @@ -361,11 +361,11 @@ const QString CReferenceManager::parseVerseReference( const QString& ref, const if ((mod->type() != CSwordModuleInfo::Bible) && (mod->type() != CSwordModuleInfo::Commentary)) { qDebug("CReferenceManager: Only verse based modules are supported as ref destination module"); - return QString::null; + return TQString::null; } - QString sourceLanguage = options.sourceLanguage; - QString destinationLanguage = options.destinationLanguage; + TQString sourceLanguage = options.sourceLanguage; + TQString destinationLanguage = options.destinationLanguage; StringList locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales(); if (/*options.sourceLanguage == "en" ||*/ std::find(locales.begin(), locales.end(), sourceLanguage) == locales.end()) { //sourceLanguage not available @@ -377,8 +377,8 @@ const QString CReferenceManager::parseVerseReference( const QString& ref, const } - QString ret; - QStringList refList = QStringList::split(";", ref); + TQString ret; + TQStringList refList = TQStringList::split(";", ref); CSwordVerseKey baseKey(0); baseKey.setLocale( sourceLanguage.latin1() ); @@ -387,7 +387,7 @@ const QString CReferenceManager::parseVerseReference( const QString& ref, const // CSwordVerseKey dummy(0); //HACK: We have to workaround a Sword bug, we have to set the default locale to the same as the sourceLanguage ! - const QString oldLocaleName = CPointers::backend()->booknameLanguage(); + const TQString oldLocaleName = CPointers::backend()->booknameLanguage(); CPointers::backend()->booknameLanguage(sourceLanguage); VerseKey dummy; @@ -396,7 +396,7 @@ const QString CReferenceManager::parseVerseReference( const QString& ref, const // qDebug("Parsing '%s' in '%s' using '%s' as base, source lang '%s', dest lang '%s'", ref.latin1(), options.refDestinationModule.latin1(), baseKey.key().latin1(), sourceLanguage.latin1(), destinationLanguage.latin1()); - for (QStringList::iterator it = refList.begin(); it != refList.end(); it++) { + for (TQStringList::iterator it = refList.begin(); it != refList.end(); it++) { //The listkey may contain more than one item, because a ref lik "Gen 1:3,5" is parsed into two single refs ListKey lk = dummy.ParseVerseList((const char*)(*it).utf8(), (const char*)baseKey.key().utf8(), true); Q_ASSERT(!dummy.Error()); @@ -413,7 +413,7 @@ const QString CReferenceManager::parseVerseReference( const QString& ref, const Q_ASSERT(k); k->setLocale( destinationLanguage.latin1() ); - ret.append( QString::fromUtf8(k->getRangeText()) ).append("; "); + ret.append( TQString::fromUtf8(k->getRangeText()) ).append("; "); } else { // a single ref VerseKey vk; @@ -421,7 +421,7 @@ const QString CReferenceManager::parseVerseReference( const QString& ref, const vk = lk.getElement(i)->getText(); vk.setLocale( destinationLanguage.latin1() ); - ret.append( QString::fromUtf8(vk.getText()) ).append("; "); + ret.append( TQString::fromUtf8(vk.getText()) ).append("; "); } } |