buffer = 0;
hashing = false;
setUp();
+ totalFileSize = 0;
+ hashedFileSize = 0;
}
Hash::~Hash()
tearDown();
}
-static Hash *Hash::instance()
+Hash *Hash::instance()
{
if (!m_instance)
m_instance = new Hash();
return m_instance;
}
-static void Hash::destroy()
+void Hash::destroy()
{
delete m_instance;
m_instance = 0;
emit fileHashed(f, hash);
qDebug() << "File:" << f.fileName() << "Hash:" << hash << "Time:" << fileElapsed;
+ hashedFileSize += f.size();
if (!fileQueue.isEmpty())
{
void Hash::reportProgress(qint64 read, qint64 total)
{
- emit fileProgress((read * 100) / total);
- hashedFileSize += fileQueue.first().size() - read;
- emit progress((hashedFileSize * 100) / totalFileSize);
+ int filePercent = (read * 100) / total;
+ emit fileProgress(filePercent);
+
+ int totalPercent = ((hashedFileSize + read) * 100) / totalFileSize;
+ emit progress(totalPercent);
}
void Hash::startHashing()