summaryrefslogtreecommitdiff
path: root/src
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
parentb8a1365dacd7ffa8705bbb3dcaf2e2dc6613e6fb (diff)
Update following archive callback changes.
Diffstat (limited to 'src')
-rw-r--r--src/installationmanager.cpp16
-rw-r--r--src/selfupdater.cpp3
2 files changed, 11 insertions, 8 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);
};
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp
index dfe11880..1f56fd62 100644
--- a/src/selfupdater.cpp
+++ b/src/selfupdater.cpp
@@ -19,10 +19,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "selfupdater.h"
-#include "archive.h"
-#include "callback.h"
#include "utility.h"
-#include "installationmanager.h"
#include "iplugingame.h"
#include "messagedialog.h"
#include "downloadmanager.h"