diff options
Diffstat (limited to 'kipi-plugins/findimages/fuzzycompare.cpp')
-rw-r--r-- | kipi-plugins/findimages/fuzzycompare.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/kipi-plugins/findimages/fuzzycompare.cpp b/kipi-plugins/findimages/fuzzycompare.cpp index 50da23b..d588298 100644 --- a/kipi-plugins/findimages/fuzzycompare.cpp +++ b/kipi-plugins/findimages/fuzzycompare.cpp @@ -24,49 +24,49 @@ #include "fuzzycompare.h" #include "actions.h" -#include <qstringlist.h> -#include <qapplication.h> +#include <tqstringlist.h> +#include <tqapplication.h> #include <kdebug.h> #include "imagesimilaritydata.h" -#include <qdatetime.h> -#include <qfileinfo.h> +#include <tqdatetime.h> +#include <tqfileinfo.h> #include "finddupplicateimages.h" -#include <qimage.h> +#include <tqimage.h> #include <kimageio.h> #include <kimageeffect.h> #include <kstandarddirs.h> #include <math.h> -KIPIFindDupplicateImagesPlugin::FuzzyCompare::FuzzyCompare( QObject* parent, const QString& cacheDir ) - :m_parent( parent ), m_cacheDir( cacheDir ) +KIPIFindDupplicateImagesPlugin::FuzzyCompare::FuzzyCompare( TQObject* tqparent, const TQString& cacheDir ) + :m_parent( tqparent ), m_cacheDir( cacheDir ) { } -QDict < QPtrVector < QFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::compare( const QStringList& filesList ) +TQDict < TQPtrVector < TQFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::compare( const TQStringList& filesList ) { - sendMessage( m_parent, KIPIFindDupplicateImagesPlugin::Progress, QString::null, filesList.count()*2, true, false ); + sendMessage( m_parent, KIPIFindDupplicateImagesPlugin::Progress, TQString(), filesList.count()*2, true, false ); kdDebug( 51000 ) << filesList.count() << " images to parse with Almost method..." << endl; - QDict < QPtrVector < QFile > > res; + TQDict < TQPtrVector < TQFile > > res; - QPtrVector < ImageSimilarityData > *listRatW = new QPtrVector < ImageSimilarityData >; - QPtrVector < ImageSimilarityData > *listRatH = new QPtrVector < ImageSimilarityData >; - QPtrVector < ImageSimilarityData > *list; + TQPtrVector < ImageSimilarityData > *listRatW = new TQPtrVector < ImageSimilarityData >; + TQPtrVector < ImageSimilarityData > *listRatH = new TQPtrVector < ImageSimilarityData >; + TQPtrVector < ImageSimilarityData > *list; listRatW->setAutoDelete(true); listRatH->setAutoDelete(true); - QTime debut=QTime::currentTime (); + TQTime debut=TQTime::currentTime (); ImageSimilarityData *is; - for ( QStringList::ConstIterator item = filesList.begin() ; item != filesList.end() ; ++item ) + for ( TQStringList::ConstIterator item = filesList.begin() ; item != filesList.end() ; ++item ) { if ( m_stopRequested ) - return QDict < QPtrVector < QFile > >(); + return TQDict < TQPtrVector < TQFile > >(); - QString itemName(*item); - QFileInfo fi(itemName); - QString Temp = fi.dirPath(); - QString albumName = Temp.section('/', -1); + TQString itemName(*item); + TQFileInfo fi(itemName); + TQString Temp = fi.dirPath(); + TQString albumName = Temp.section('/', -1); sendMessage( m_parent, KIPIFindDupplicateImagesPlugin::Matrix, itemName, 0, true, false ); @@ -86,10 +86,10 @@ QDict < QPtrVector < QFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::co sendMessage( m_parent, KIPIFindDupplicateImagesPlugin::Matrix, itemName, 0, false, false ); } - kdDebug( 51000 ) << "Matrix creation time:" << debut.msecsTo(QTime::currentTime()) << endl; - debut = QTime::currentTime (); + kdDebug( 51000 ) << "Matrix creation time:" << debut.msecsTo(TQTime::currentTime()) << endl; + debut = TQTime::currentTime (); - QDict < QFile > *fait = new QDict < QFile >; + TQDict < TQFile > *fait = new TQDict < TQFile >; list = listRatW; bool done = false; @@ -100,12 +100,12 @@ QDict < QPtrVector < QFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::co for (unsigned int i = 0; i < list->size (); i++) { if ( m_stopRequested ) - return QDict < QPtrVector < QFile > >(); + return TQDict < TQPtrVector < TQFile > >(); // Create the 'ImageSimilarityData' data for the first image. ImageSimilarityData *i1 = list->at(i); - if (i1 && !fait->find(i1->filename)) + if (i1 && !fait->tqfind(i1->filename)) { sendMessage( m_parent, KIPIFindDupplicateImagesPlugin::Similar, i1->filename, 0, true, false ); @@ -119,21 +119,21 @@ QDict < QPtrVector < QFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::co if (eq >= m_approximateLevel) // the files are the same ! { - QPtrVector < QFile > *vect; + TQPtrVector < TQFile > *vect; // Add file to the list. - if (!res.find (i1->filename)) + if (!res.tqfind (i1->filename)) { - vect = new QPtrVector < QFile >; + vect = new TQPtrVector < TQFile >; vect->setAutoDelete(true); res.insert (i1->filename, vect); } else - vect = (QPtrVector < QFile > *)res.find(i1->filename); + vect = (TQPtrVector < TQFile > *)res.tqfind(i1->filename); vect->resize (vect->size () + 1); - vect->insert (vect->size () - 1, new QFile(i2->filename)); - fait->insert(i2->filename, new QFile(i2->filename)); + vect->insert (vect->size () - 1, new TQFile(i2->filename)); + fait->insert(i2->filename, new TQFile(i2->filename)); } } } @@ -151,7 +151,7 @@ QDict < QPtrVector < QFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::co list = NULL; } - kdDebug( 51000 ) << "Comparison time: " << debut.msecsTo(QTime::currentTime()) << endl; + kdDebug( 51000 ) << "Comparison time: " << debut.msecsTo(TQTime::currentTime()) << endl; // End of comparison process. @@ -166,7 +166,7 @@ QDict < QPtrVector < QFile > > KIPIFindDupplicateImagesPlugin::FuzzyCompare::co ///////////////////////////////////////////////////////////////////////////////////////////// // Nota: original source code from ShowImg ! -KIPIFindDupplicateImagesPlugin::ImageSimilarityData* KIPIFindDupplicateImagesPlugin::FuzzyCompare::image_sim_fill_data(QString filename) +KIPIFindDupplicateImagesPlugin::ImageSimilarityData* KIPIFindDupplicateImagesPlugin::FuzzyCompare::image_sim_fill_data(TQString filename) { int w, h; uchar *pix; @@ -178,18 +178,18 @@ KIPIFindDupplicateImagesPlugin::ImageSimilarityData* KIPIFindDupplicateImagesPlu int xs, ys; const int INC=1; - QImage *pixbuf; + TQImage *pixbuf; ImageSimilarityData *sd = new ImageSimilarityData(); sd->filename=filename; - QFileInfo info(m_cacheDir + QFileInfo(filename).absFilePath()+".dat"); + TQFileInfo info(m_cacheDir + TQFileInfo(filename).absFilePath()+".dat"); if(info.exists()) { - QFile f(m_cacheDir+QFileInfo(filename).absFilePath()+".dat"); + TQFile f(m_cacheDir+TQFileInfo(filename).absFilePath()+".dat"); if ( f.open(IO_ReadOnly) ) { - QDataStream s( &f ); + TQDataStream s( &f ); s >> sd->ratio; for(int i=0 ; i<PAS*PAS ; i++) s >> sd->avg_r[i]; for(int i=0 ; i<PAS*PAS ; i++) s >> sd->avg_g[i]; @@ -201,7 +201,7 @@ KIPIFindDupplicateImagesPlugin::ImageSimilarityData* KIPIFindDupplicateImagesPlu return sd; } - pixbuf = new QImage(filename); + pixbuf = new TQImage(filename); if ( !sd || !pixbuf ) return 0L; @@ -261,12 +261,12 @@ KIPIFindDupplicateImagesPlugin::ImageSimilarityData* KIPIFindDupplicateImagesPlu // Saving the data. - QFile f(m_cacheDir+QFileInfo(filename).absFilePath()+".dat"); - KStandardDirs::makeDir(QFileInfo(f).dirPath(true)); + TQFile f(m_cacheDir+TQFileInfo(filename).absFilePath()+".dat"); + KStandardDirs::makeDir(TQFileInfo(f).dirPath(true)); if ( f.open(IO_WriteOnly) ) { - QDataStream s( &f ); + TQDataStream s( &f ); s << sd->ratio; for(int i=0 ; i<PAS*PAS ; i++) s << sd->avg_r[i]; for(int i=0 ; i<PAS*PAS ; i++) s << sd->avg_g[i]; @@ -318,27 +318,27 @@ float KIPIFindDupplicateImagesPlugin::FuzzyCompare::image_sim_compare_fast(Image ///////////////////////////////////////////////////////////////////////////////////////////// // Nota: original source code from ShowImg ! -char KIPIFindDupplicateImagesPlugin::FuzzyCompare::getRed(QImage* im, int x, int y) +char KIPIFindDupplicateImagesPlugin::FuzzyCompare::getRed(TQImage* im, int x, int y) { - return qRed(im->pixel(x, y)); + return tqRed(im->pixel(x, y)); } ///////////////////////////////////////////////////////////////////////////////////////////// // Nota: original source code from ShowImg ! -char KIPIFindDupplicateImagesPlugin::FuzzyCompare::getGreen(QImage* im, int x, int y) +char KIPIFindDupplicateImagesPlugin::FuzzyCompare::getGreen(TQImage* im, int x, int y) { - return qGreen(im->pixel(x, y)); + return tqGreen(im->pixel(x, y)); } ///////////////////////////////////////////////////////////////////////////////////////////// // Nota: original source code from ShowImg ! -char KIPIFindDupplicateImagesPlugin::FuzzyCompare::getBlue(QImage* im, int x, int y) +char KIPIFindDupplicateImagesPlugin::FuzzyCompare::getBlue(TQImage* im, int x, int y) { - return qBlue(im->pixel(x, y)); + return tqBlue(im->pixel(x, y)); } |