Merge - 9.0.0 release

This commit is contained in:
Luis Ángel San Martín
2018-02-18 10:35:24 +01:00
parent 0b52310089
commit 2a136e3ea3
200 changed files with 19288 additions and 5108 deletions

View File

@ -1,6 +1,17 @@
To use unarr as a decompression engine when building YACReader, download https://github.com/zeniko/unarr/archive/master.zip and extract it in this folder.
This will build unarr as a part of YACReader (static build).
Starting with YACReader 9.0.0 all versions of YACReader use (lib)unarr >= 1.0.1
as decompression backend. For Windows and MacOSX precompiled libraries
are available in the dependencies folder (not included in the source tarballs!).
If you're on a Linux/Unix system and prefer to use unarr as a shared library, have a look at https://github.com/selmf/unarr/
This fork of unarr includes a CMake based build system that allows you to build and install unarr as a shared library. YACReader will detect and use
the installed library at build time if it is installed.
For all other operating systems or users who wish to compile unarr themselves,
source code and build instructions are available at https://github.com/selmf/unarr/
For best performance it is recommended to build and install unarr as a shared
library.
Users who prefer an embedded build can also download a snapshot from
https://github.com/selmf/unarr/archive/master.zip and extract it in this folder.
The build system will then detect the presence of the source code and include it
in the build process. However, as the embedded build option uses different
compiler flags and does not include any options to detect and make use of libraries
like zlib, bzip2 or lzma embedded builds will have slower extraction speed
and won't support zip files with bzip2 or xz compression.

View File

@ -4,21 +4,22 @@
#include <QDebug>
#include "extract_delegate.h"
extern"C" {
#include "unarr.h"
}
#include <unarr.h>
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :
QObject(parent),valid(false),tools(true),numFiles(0),ar(NULL),stream(NULL)
{
//open file
stream = ar_open_file(filePath.toStdString().c_str());
#ifdef Q_OS_WIN
stream = ar_open_file_w((wchar_t *)filePath.utf16());
#else
stream = ar_open_file(filePath.toLocal8Bit().constData());
#endif
if (!stream)
{
return;
}
//open archive
ar = ar_open_rar_archive(stream);
//TODO: build unarr with 7z support and test this!
@ -30,9 +31,9 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent)
{
return;
}
//initial parse
while (ar_parse_entry(ar))
while (ar_parse_entry(ar))
{
//make sure we really got a file header
if (ar_entry_get_size(ar) > 0)
@ -43,7 +44,7 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent)
}
}
if (!ar_at_eof(ar))
{
{
//fail if the initial parse didn't reach EOF
//this might be a bit too drastic
qDebug() << "Error while parsing archive";
@ -84,14 +85,19 @@ int CompressedArchive::getNumFiles()
void CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate)
{
if (indexes.isEmpty())
if (indexes.isEmpty())
return;
QByteArray buffer;
int i=0;
while (i < indexes.count())
{
if(delegate->isCancelled())
{
return;
}
//use the offset list so we generated so we're not getting any non-page files
ar_parse_entry_at(ar, offsets.at(indexes.at(i))); //set ar_entry to start of indexes
buffer.resize(ar_entry_get_size(ar));
@ -102,7 +108,7 @@ void CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDele
else
{
delegate->crcError(indexes.at(i)); //we could not extract it...
}
}
i++;
}
}

View File

@ -4,7 +4,7 @@
#include <QObject>
#include "extract_delegate.h"
extern"C" {
#include "unarr.h"
#include <unarr.h>
}
class CompressedArchive : public QObject

View File

@ -9,6 +9,7 @@ class ExtractDelegate
virtual void fileExtracted(int index, const QByteArray & rawData) = 0;
virtual void crcError(int index) = 0;
virtual void unknownError(int index) = 0;
virtual bool isCancelled() = 0;
};
#endif //EXTRACT_DELEGATE_H

View File

@ -2,35 +2,53 @@ INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/extract_delegate.h \
$$PWD/compressed_archive.h \
$$PWD/compressed_archive.h
SOURCES += $$PWD/compressed_archive.cpp \
SOURCES += $$PWD/compressed_archive.cpp
unix:!macx:exists (/usr/include/unarr.h) {
message(Using system provided unarr installation)
LIBS+=-lunarr
DEFINES+=use_unarr
}
else:macx:exists (../../dependencies/unarr/libunarr.dynlib) {
LIBS += -L../../dependencies/unarr/ -lunarr
DEFINES+=use_unarr
}
unix:!macx {
!contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) {
message(Using system provided unarr installation found by pkg-config.)
CONFIG += link_pkgconfig
PKGCONFIG += libunarr
DEFINES += use_unarr
}
else:exists(/usr/include/unarr.h):exists(/usr/lib/libunarr.so) {
message(Using system provided unarr installation.)
LIBS += -lunarr
DEFINES += use_unarr
}
}
else:win32:exists (../../dependencies/unarr/unarr.dll) {
LIBS += -L../../dependencies/unarr/ -lunarr
DEFINES+=use_unarr
}
else:macx:exists(../../dependencies/unarr/macx/libunarr.a) {
message(Found prebuilt unarr library in dependencies directory.)
INCLUDEPATH += $$PWD/../../dependencies/unarr/macx
LIBS += -L$$PWD/../../dependencies/unarr/macx -lunarr -lz -lbz2
DEFINES += use_unarr
}
else:win32:exists(../../dependencies/unarr/win/unarr.h) {
message(Found prebuilt unarr library in dependencies directory.)
INCLUDEPATH += $$PWD/../../dependencies/unarr/win
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../../dependencies/unarr/win/x64 -lunarr
} else {
LIBS += -L$$PWD/../../dependencies/unarr/win/x86 -lunarr
}
DEFINES += use_unarr UNARR_IS_SHARED_LIBRARY
}
else:exists ($$PWD/unarr-master) {
message(Found unarr source-code)
message(Unarr will be build as a part of YACReader)
#qmake based unarr build system
#this should only be used for testing or as a last resort
include(unarr.pro)
DEFINES+=use_unarr
}
else {
error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\
or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master)
}
message(Found unarr source-code)
message(Unarr will be build as a part of YACReader)
# qmake based unarr build system
# this should only be used for testing or as a last resort
include(unarr.pro)
DEFINES += use_unarr
}
else {
error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\
or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master)
}