Mercurial > dedupe
changeset 8:d7b384b4a834
Fix compilation problems.
Fix printing issues.
Introduce raise function in Exception.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Wed, 22 Aug 2012 18:18:20 +0200 |
| parents | d6fdca3bf24e |
| children | b5943e4bf676 |
| files | CMakeLists.txt DataController.cpp Exception.hpp |
| diffstat | 3 files changed, 19 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Wed Aug 22 01:07:06 2012 +0200 +++ b/CMakeLists.txt Wed Aug 22 18:18:20 2012 +0200 @@ -24,9 +24,9 @@ DataController.cpp EditDistance.cpp IOException.cpp - FileDbLink.cpp - SqliteDbLink.cpp - MemoryDbLink.cpp + FileDBLink.cpp + SqliteDBLink.cpp + MemoryDBLink.cpp ) SET(MOC_HEADERS
--- a/DataController.cpp Wed Aug 22 01:07:06 2012 +0200 +++ b/DataController.cpp Wed Aug 22 18:18:20 2012 +0200 @@ -30,6 +30,7 @@ #include <QtGui/QProgressBar> #include "EditDistance.hpp" +#include <memory> void DataController::findFiles(const QDir& dir, QStringList& list) { @@ -38,7 +39,10 @@ findFiles(QDir(filename), list); } + qDebug() << dir.entryList(QDir::Files | QDir::NoSymLinks); + foreach(QString filename, dir.entryList(QDir::Files | QDir::NoSymLinks)) { + qDebug() << filename; list << dir.absoluteFilePath(filename); } } @@ -75,6 +79,7 @@ } int n = 0; + emit populateProgress(n); foreach(QString filename, findFiles(dir)) { try { dblink.updateIfModified(filename); @@ -84,7 +89,7 @@ } catch (Exception& e) { qDebug() << e.toString(); - exit(1); + e.raise(); } emit populateProgress(++n); @@ -169,7 +174,6 @@ foreach(QSharedPointer<FileDBLink::DBInfo> line, elems) { QTreeWidgetItem* item = 0; - bool anyAdded = false; if (showNameDups) { QTreeWidgetItem* topLevelItem = 0; @@ -181,7 +185,6 @@ if(!item) item = createItem(*line); item->addChild(topLevelItem); - anyAdded = true; } topLevelItem->addChild(createItem(*dup)); } @@ -198,7 +201,6 @@ if(!item) item = createItem(*line); item->addChild(topLevelItem); - anyAdded = true; } topLevelItem->addChild(createItem(*dup)); } @@ -215,7 +217,6 @@ if(!item) item = createItem(*line); item->addChild(topLevelItem); - anyAdded = true; } topLevelItem->addChild(createItem(*dup)); } @@ -232,7 +233,6 @@ if(!item) item = createItem(*line); item->addChild(topLevelItem); - anyAdded = true; } topLevelItem->addChild(createItem(*dup)); } @@ -260,7 +260,6 @@ if(!item) item = createItem(*line); item->addChild(topLevelItem); - anyAdded = true; } foreach(QSharedPointer<FileDBLink::DBInfo> dup, oList.values()) { @@ -395,8 +394,12 @@ QString str; if (p == 0) str.sprintf("Progress %6.2f%%", p * 100.0 / progressMax); - else - str.sprintf("\b\b\b\b\b\b%6.2f%%", p * 100.0 / progressMax); + else if (p == progressMax) { + str.sprintf("\b\b\b\b\b\b\b%6.2f%%\n", 100.0); + } + else { + str.sprintf("\b\b\b\b\b\b\b%6.2f%%", p * 100.0 / progressMax); + } std::cout<<str.toStdString(); std::cout.flush(); }
