From: APTX Date: Tue, 1 Jun 2010 11:34:32 +0000 (+0200) Subject: HashRequest has now a signal that reports hashing progress. File can now report perce... X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=5533e8ddb202660c2e2371857dd8b1f0e492031d;p=anidbudpclient.git HashRequest has now a signal that reports hashing progress. File can now report percentage completion with statusUpdate. Currently only used for hashing progress. --- diff --git a/file.cpp b/file.cpp index c8acde7..1d056a4 100644 --- a/file.cpp +++ b/file.cpp @@ -271,6 +271,11 @@ void File::workOnFinished(Action action, ActionState actionState) } } +void File::updateHashProgress(int percent) +{ + emit statusUpdate(Hashing, InProgress, percent); +} + void File::startHashing() { qDebug() << "startHashing"; @@ -286,6 +291,7 @@ qDebug() << "startHashing"; hashResult = Hash::instance()->hashFile(m_file); connect(hashResult, SIGNAL(resultReady()), this, SLOT(finishHashing())); + connect(hashResult, SIGNAL(progress(int)), this, SLOT(updateHashProgress(int))); updateStatus(Hashing, InProgress); } diff --git a/file.h b/file.h index 0d83544..d850e20 100644 --- a/file.h +++ b/file.h @@ -76,7 +76,7 @@ public slots: bool markWatched(); signals: - void statusUpdate(AniDBUdpClient::File::Action action, AniDBUdpClient::File::ActionState state); + void statusUpdate(AniDBUdpClient::File::Action action, AniDBUdpClient::File::ActionState state, int percent = 0); void finished(); private slots: @@ -88,6 +88,8 @@ private slots: void work(); void workOnFinished(AniDBUdpClient::File::Action action, AniDBUdpClient::File::ActionState actionState); + void updateHashProgress(int percent); + private: void startHashing(); diff --git a/hash.cpp b/hash.cpp index 3b2ada2..97e6e9d 100644 --- a/hash.cpp +++ b/hash.cpp @@ -84,6 +84,7 @@ void Hash::reportProgress(qint64 read, qint64 total) { int filePercent = (read * 100) / total; emit fileProgress(filePercent); + emit fileQueue.first()->progress(filePercent); int totalPercent = ((hashedFileSize + read) * 100) / totalFileSize; emit progress(totalPercent); diff --git a/hash.h b/hash.h index 232a2aa..48fa66e 100644 --- a/hash.h +++ b/hash.h @@ -94,6 +94,7 @@ public: signals: void resultReady(); + void progress(int percent); private: void setHash(const QByteArray &hash);