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

index c8acde73c83c0717e67b1f3632cc61a1d414fdef..1d056a4166dffad168e2268c42da5a0b889aec13 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 0d83544a835747323eb47cfa3902795cc0909be4..d850e204c91b8ebfb06b3d3f0fdf56c6c249f95c 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 3b2ada206d58a761da2e9148f7f7a3ff4a2d6773..97e6e9ddfa5778f93761fa3fb69bb02c8c062402 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 232a2aa9f7dbdc4a791ec6cccd47683abd68b1ab..48fa66e70a2fe5b56d3ab027fe0544f9edc6ceaa 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);