summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnar Thomsen <rthomsen6@gmail.com>2016-10-05 15:19:50 (GMT)
committerRagnar Thomsen <rthomsen6@gmail.com>2016-10-05 15:23:25 (GMT)
commit43008ab1f710b561a255914a528c2464fecec7ea (patch)
tree913e8736f508ac1da48931cf69e113e485d5b986
parent8cb82c361b1e856b94e06743310d0cc02a50d379 (diff)
libarchiveplugin: Show progress in percentage when listing archives
Use the archive_filter_bytes() function in libarchive to get number of read bytes. This enables us to calculate progress in percentage when listing an archive with this plugin. Differential Revision: D2939
-rw-r--r--plugins/libarchive/libarchiveplugin.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/libarchive/libarchiveplugin.cpp b/plugins/libarchive/libarchiveplugin.cpp
index 9c389a9..a7ce255 100644
--- a/plugins/libarchive/libarchiveplugin.cpp
+++ b/plugins/libarchive/libarchiveplugin.cpp
@@ -61,6 +61,7 @@ bool LibarchivePlugin::list()
m_cachedArchiveEntryCount = 0;
m_extractedFilesSize = 0;
+ qulonglong compressedArchiveSize = QFileInfo(filename()).size();
struct archive_entry *aentry;
int result = ARCHIVE_RETRY;
@@ -79,6 +80,8 @@ bool LibarchivePlugin::list()
m_extractedFilesSize += (qlonglong)archive_entry_size(aentry);
+ emit progress(float(archive_filter_bytes(m_archiveReader.data(), -1))/float(compressedArchiveSize));
+
m_cachedArchiveEntryCount++;
archive_read_data_skip(m_archiveReader.data());
}