diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-03-25 22:16:12 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-03-25 22:16:12 +0000 |
commit | 8c1d114dcfcc8b3d47505e3139151eec43ebbdc4 (patch) | |
tree | 4925e1900520b0c89001c95c9da83f3533903d1e /rbutil/rbutilqt/base/zipinstaller.cpp | |
parent | 0258895faa9a18c0b620ae0a63ee3768ba62747a (diff) | |
download | rockbox-8c1d114dcfcc8b3d47505e3139151eec43ebbdc4.tar.gz rockbox-8c1d114dcfcc8b3d47505e3139151eec43ebbdc4.zip |
Rockbox Utility: Replace OSDaB Zip with QuaZip.
This change fixes problems with zip files created with newer zip utilities (a
known issue is the iLike theme). QuaZip also allows better feedback during
operations without changing the imported code. Additionally Rockbox Utility and
the Theme Editor are now both using QuaZip; currently Rockbox Utility uses a
copy of the sources, merging them later is planned.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29645 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/zipinstaller.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/zipinstaller.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/rbutil/rbutilqt/base/zipinstaller.cpp b/rbutil/rbutilqt/base/zipinstaller.cpp index 1822d3c9ed..07a901ddf4 100644 --- a/rbutil/rbutilqt/base/zipinstaller.cpp +++ b/rbutil/rbutilqt/base/zipinstaller.cpp @@ -19,8 +19,8 @@ #include <QtCore> #include "zipinstaller.h" -#include "rbunzip.h" #include "utils.h" +#include "ziputil.h" ZipInstaller::ZipInstaller(QObject* parent): QObject(parent) { @@ -132,39 +132,28 @@ void ZipInstaller::downloadDone(bool error) emit logItem(tr("Extracting file."), LOGINFO); QCoreApplication::processEvents(); - UnZip::ErrorCode ec; - RbUnZip uz; - connect(&uz, SIGNAL(unzipProgress(int, int)), this, SIGNAL(logProgress(int, int))); - connect(this, SIGNAL(internalAborted()), &uz, SLOT(abortUnzip())); - ec = uz.openArchive(m_file); - if(ec != UnZip::Ok) { - emit logItem(tr("Opening archive failed: %1.") - .arg(uz.formatError(ec)),LOGERROR); - emit logProgress(1, 1); - emit done(true); - return; - } - + ZipUtil zip(this); + connect(&zip, SIGNAL(logProgress(int, int)), this, SIGNAL(logProgress(int, int))); + connect(&zip, SIGNAL(logItem(QString, int)), this, SIGNAL(logItem(QString, int))); + zip.open(m_file, QuaZip::mdUnzip); // check for free space. Make sure after installation will still be // some room for operating (also includes calculation mistakes due to // cluster sizes on the player). - if(Utils::filesystemFree(m_mountpoint) < (uz.totalSize() + 1000000)) { + if(Utils::filesystemFree(m_mountpoint) + < (zip.totalUncompressedSize() + 1000000)) { emit logItem(tr("Not enough disk space! Aborting."), LOGERROR); emit logProgress(1, 1); emit done(true); return; } - ec = uz.extractArchive(m_mountpoint); - // TODO: better handling of aborted unzip operation. - if(ec != UnZip::Ok) { - emit logItem(tr("Extracting failed: %1.") - .arg(uz.formatError(ec)),LOGERROR); + zipContents = zip.files(); + if(!zip.extractArchive(m_mountpoint)) { + emit logItem(tr("Extraction failed!"), LOGERROR); emit logProgress(1, 1); emit done(true); return; } - // prepare file list for log - zipContents = uz.fileList(); + zip.close(); } else { // only copy the downloaded file to the output location / name @@ -185,7 +174,7 @@ void ZipInstaller::downloadDone(bool error) } // add file to log - zipContents.append( m_target); + zipContents.append(m_target); } emit logItem(tr("Creating installation log"),LOGINFO); |