2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 19:07:46 +00:00

Additional usability features

This commit is contained in:
Jack Andersen
2018-01-09 20:19:48 -10:00
parent 00da24a134
commit f6195a64a6
22 changed files with 834 additions and 176 deletions

View File

@@ -1,5 +1,7 @@
#include "DownloadManager.hpp"
#include "Common.hpp"
#include <QBuffer>
#include <quazip.h>
static const char AxioDLPublicKeyPEM[] =
"-----BEGIN PUBLIC KEY-----\n"
@@ -119,19 +121,19 @@ void DownloadManager::binaryFinished()
if (m_progBar)
m_progBar->setValue(100);
QFile fp(m_outPath);
if (!fp.open(QIODevice::WriteOnly))
QByteArray all = m_binaryInProgress->readAll();
QBuffer buff(&all);
QuaZip zip(&buff);
if (!zip.open(QuaZip::mdUnzip))
{
setError(QNetworkReply::ContentAccessDenied, fp.errorString());
setError(QNetworkReply::UnknownContentError, "Unable to open zip archive.");
m_binaryInProgress->deleteLater();
m_binaryInProgress = nullptr;
return;
}
fp.write(m_binaryInProgress->readAll());
fp.close();
if (m_completionHandler)
m_completionHandler(m_outPath);
m_completionHandler(zip);
m_binaryInProgress->deleteLater();
m_binaryInProgress = nullptr;
@@ -147,7 +149,7 @@ void DownloadManager::binaryError(QNetworkReply::NetworkError error)
m_progBar->setEnabled(false);
if (m_failedHandler)
m_failedHandler(m_outPath);
m_failedHandler();
}
void DownloadManager::binaryValidateCert()