diff options
Diffstat (limited to 'src/findduplicates.cpp')
-rw-r--r-- | src/findduplicates.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/findduplicates.cpp b/src/findduplicates.cpp index ddcf5a8..0fd937b 100644 --- a/src/findduplicates.cpp +++ b/src/findduplicates.cpp @@ -19,10 +19,10 @@ ***************************************************************************/ #include <math.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qapplication.h> +#include <ntqstring.h> +#include <ntqstringlist.h> +#include <ntqregexp.h> +#include <ntqapplication.h> #include <kdebug.h> #include <klocale.h> @@ -43,8 +43,8 @@ namespace KBibTeX { const unsigned int FindDuplicates::maxDistance = 0xffffff; - FindDuplicates::FindDuplicates( DuplicateCliqueList &result, unsigned int sensitivity, BibTeX::File *file, QWidget *parent ) - : QObject( NULL, NULL ), m_doCancel( false ) + FindDuplicates::FindDuplicates( DuplicateCliqueList &result, unsigned int sensitivity, BibTeX::File *file, TQWidget *parent ) + : TQObject( NULL, NULL ), m_doCancel( false ) { if ( file->count() < 2 ) return; @@ -52,9 +52,9 @@ namespace KBibTeX int len = file->count() * ( file->count() - 1 ) / 2; unsigned int *distVector = new unsigned int[len]; memset( distVector, 0xff, sizeof( unsigned int )*len ); - QMap<BibTeX::Element*, int> mapElementToIndex; + TQMap<BibTeX::Element*, int> mapElementToIndex; - QApplication::setOverrideCursor( Qt::waitCursor ); + TQApplication::setOverrideCursor( TQt::waitCursor ); KProgressDialog *progDlg = new KProgressDialog( parent, NULL, i18n( "Find Duplicates" ), i18n( "Searching for duplicates..." ), true ); connect( progDlg, SIGNAL( cancelClicked() ), this, SLOT( slotCancel() ) ); progDlg->progressBar()->setTotalSteps( len ); @@ -67,7 +67,7 @@ namespace KBibTeX delete progDlg; delete[] distVector; - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } /** @@ -79,7 +79,7 @@ namespace KBibTeX * @param mapElementToIndex map from elements to indices (will be written) * @param progDlg progress dialog to write status information to */ - void FindDuplicates::determineDistances( BibTeX::File *file, unsigned int *distVector, QMap<BibTeX::Element*, int> &mapElementToIndex, KProgressDialog *progDlg ) + void FindDuplicates::determineDistances( BibTeX::File *file, unsigned int *distVector, TQMap<BibTeX::Element*, int> &mapElementToIndex, KProgressDialog *progDlg ) { int progress = 0, i = 0; for ( BibTeX::File::ElementList::ConstIterator it1 = file->constBegin(); !m_doCancel && it1 != file->constEnd(); ++it1, ++i ) @@ -99,7 +99,7 @@ namespace KBibTeX distVector[arrayOffset( i, j )] = d; progDlg->progressBar()->setValue( ++progress ); - qApp->processEvents(); + tqApp->processEvents(); } } else @@ -118,7 +118,7 @@ namespace KBibTeX distVector[arrayOffset( i, j )] = macroDistance( macroA, macroB ); progDlg->progressBar()->setValue( ++progress ); - qApp->processEvents(); + tqApp->processEvents(); } } else @@ -137,7 +137,7 @@ namespace KBibTeX distVector[arrayOffset( i, j )] = preambleDistance( preambleA, preambleB ); progDlg->progressBar()->setValue( ++progress ); - qApp->processEvents(); + tqApp->processEvents(); } } } @@ -155,12 +155,12 @@ namespace KBibTeX * @param mapElementToIndex map from elements to indices * @param sensitivity sensitivity threshold value */ - void FindDuplicates::buildClique( DuplicateCliqueList &cliqueList, BibTeX::File *file, unsigned int *distVector, QMap<BibTeX::Element*, int> &mapElementToIndex, unsigned int sensitivity ) + void FindDuplicates::buildClique( DuplicateCliqueList &cliqueList, BibTeX::File *file, unsigned int *distVector, TQMap<BibTeX::Element*, int> &mapElementToIndex, unsigned int sensitivity ) { int usedLen = file->count(); bool* used = new bool[usedLen]; memset( used, false, sizeof( bool ) * usedLen ); - QValueList<BibTeX::Element*> queue; + TQValueList<BibTeX::Element*> queue; for ( BibTeX::File::ElementList::ConstIterator it1 = file->constBegin(); it1 != file->constEnd(); ++it1 ) { /** current element must be either entry, preamble, or macro */ @@ -258,11 +258,11 @@ namespace KBibTeX * @param t second sentence * @return distance between both sentences */ - double FindDuplicates::levenshteinDistance( const QString &s, const QString &t ) + double FindDuplicates::levenshteinDistance( const TQString &s, const TQString &t ) { - const QRegExp nonWordRegExp( "[^a-zA-Z']+" ); - if ( s == QString::null || t == QString::null ) return 1.0; - return levenshteinDistance( QStringList::split( nonWordRegExp, s ), QStringList::split( nonWordRegExp, t ) ); + const TQRegExp nonWordRegExp( "[^a-zA-Z']+" ); + if ( s == TQString::null || t == TQString::null ) return 1.0; + return levenshteinDistance( TQStringList::split( nonWordRegExp, s ), TQStringList::split( nonWordRegExp, t ) ); } /** @@ -272,9 +272,9 @@ namespace KBibTeX * @param t second word * @return distance between both words */ - double FindDuplicates::levenshteinDistanceWord( const QString &s, const QString &t ) + double FindDuplicates::levenshteinDistanceWord( const TQString &s, const TQString &t ) { - QString mys = s.lower(), myt = t.lower(); + TQString mys = s.lower(), myt = t.lower(); int m = s.length(), n = t.length(); if ( m < 1 && n < 1 ) return 0.0; if ( m < 1 || n < 1 ) return 1.0; @@ -309,7 +309,7 @@ namespace KBibTeX * @param t second sentence * @return distance between both sentences */ - double FindDuplicates::levenshteinDistance( const QStringList &s, const QStringList &t ) + double FindDuplicates::levenshteinDistance( const TQStringList &s, const TQStringList &t ) { int m = s.size(), n = t.size(); if ( m < 1 && n < 1 ) return 0.0; @@ -358,17 +358,17 @@ namespace KBibTeX /** * Determine title for a given entry */ - QString FindDuplicates::extractTitle( BibTeX::Entry *entry ) + TQString FindDuplicates::extractTitle( BibTeX::Entry *entry ) { /** retrieve field holding title information for entry */ BibTeX::EntryField *field = entry->getField( BibTeX::EntryField::ftTitle ); if ( field == NULL ) - return QString::null; /** no title field available */ + return TQString::null; /** no title field available */ /** *fetch value item holding title */ BibTeX::ValueItem *valueItem = field->value()->items.isEmpty() ? NULL : field->value()->items.first(); if ( valueItem == NULL ) - return QString::null; /** no value item found or is empty */ + return TQString::null; /** no value item found or is empty */ return valueItem->text(); // TODO: Perform some postprocessing? } @@ -376,9 +376,9 @@ namespace KBibTeX /** * Determine list of authors for a given entry */ - QStringList FindDuplicates::authorsLastName( BibTeX::Entry *entry ) + TQStringList FindDuplicates::authorsLastName( BibTeX::Entry *entry ) { - QStringList result; + TQStringList result; /** retrieve field holding authors information for entry */ BibTeX::EntryField *field = entry->getField( BibTeX::EntryField::ftAuthor ); @@ -391,7 +391,7 @@ namespace KBibTeX return result; /** container not found or is empty */ /** iterate through container and fetch each author's last name */ - for ( QValueList<BibTeX::Person*>::ConstIterator it = personContainer->persons.begin(); it != personContainer->persons.end(); ++it ) + for ( TQValueList<BibTeX::Person*>::ConstIterator it = personContainer->persons.begin(); it != personContainer->persons.end(); ++it ) result.append(( *it )->lastName() ); return result; @@ -414,7 +414,7 @@ namespace KBibTeX /** parse value item's text */ bool ok = FALSE; - int year = QString( valueItem->text() ).toInt( &ok ); + int year = TQString( valueItem->text() ).toInt( &ok ); if ( !ok ) year = -1; return year; @@ -423,7 +423,7 @@ namespace KBibTeX /** * Determine key from a given macro */ - QString FindDuplicates::extractMacroKey( BibTeX::Macro *macro ) + TQString FindDuplicates::extractMacroKey( BibTeX::Macro *macro ) { return macro->key(); } @@ -431,7 +431,7 @@ namespace KBibTeX /** * Determine key from a given macro */ - QString FindDuplicates::extractMacroValue( BibTeX::Macro *macro ) + TQString FindDuplicates::extractMacroValue( BibTeX::Macro *macro ) { return macro->value()->text(); } |