summaryrefslogtreecommitdiff
path: root/src/installationmanager.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-06-02 23:30:03 +0200
committerMikaël Capelle <capelle.mikael@gmail.com>2020-06-02 23:30:03 +0200
commitb7a559c75c2f00616690714b5b55c4a9edac7d58 (patch)
treeeb551ef598185fbf1cf322d19b21c82ffdb1ae35 /src/installationmanager.cpp
parentb8a1365dacd7ffa8705bbb3dcaf2e2dc6613e6fb (diff)
Update following archive callback changes.
Diffstat (limited to 'src/installationmanager.cpp')
-rw-r--r--src/installationmanager.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp
index dad5b436..f4b19c71 100644
--- a/src/installationmanager.cpp
+++ b/src/installationmanager.cpp
@@ -86,7 +86,7 @@ InstallationManager::InstallationManager()
throw MyException(getErrorString(m_ArchiveHandler->getLastError()));
}
m_ArchiveHandler->setLogCallback([](auto level, auto const& message) {
- using LogLevel = ArchiveCallbacks::LogLevel;
+ using LogLevel = Archive::LogLevel;
switch (level) {
case LogLevel::Debug:
log::debug("{}", message);
@@ -165,11 +165,17 @@ bool InstallationManager::extractFiles(QString extractPath, QString title, bool
QString errorMessage;
// The callbacks:
- ArchiveCallbacks::ProgressCallback progressCallback = [&progress](float p) { progress = static_cast<int>(p * 100.0); };
- ArchiveCallbacks::FileChangeCallback fileChangeCallback = [&progressFile](std::wstring const& file) {
- progressFile = QString::fromStdWString(file);
+ auto progressCallback = [&progress](auto progressType, uint64_t current, uint64_t total) {
+ if (progressType == Archive::ProgressType::EXTRACTION) {
+ progress = static_cast<int>(100 * current / total);
+ }
+ };
+ Archive::FileChangeCallback fileChangeCallback = [&progressFile](auto changeType, std::wstring const& file) {
+ if (changeType == Archive::FileChangeType::EXTRACTION_START) {
+ progressFile = QString::fromStdWString(file);
+ }
};
- ArchiveCallbacks::ErrorCallback errorCallback = [&errorMessage, this](std::wstring const& message) {
+ auto errorCallback = [&errorMessage, this](std::wstring const& message) {
m_ArchiveHandler->cancel();
errorMessage = QString::fromStdWString(message);
};