]> Some of my projects - anidbudpclient.git/commitdiff
HashRequest has now a signal that reports hashing progress. File can now report perce...
authorAPTX <redacted>
Tue, 1 Jun 2010 11:34:32 +0000 (13:34 +0200)
committerAPTX <redacted>
Tue, 1 Jun 2010 11:34:32 +0000 (13:34 +0200)
file.cpp
file.h
hash.cpp
hash.h

index c8acde7..1d056a4 100644 (file)
--- 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 (file)
--- 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();
index 3b2ada2..97e6e9d 100644 (file)
--- 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 (file)
--- a/hash.h
+++ b/hash.h
@@ -94,6 +94,7 @@ public:
 
 signals:
        void resultReady();
+       void progress(int percent);
 
 private:
        void setHash(const QByteArray &hash);