diff --git a/compressed_archive/7z_includes.h b/compressed_archive/7z_includes.h index c0fcba78..34668e43 100644 --- a/compressed_archive/7z_includes.h +++ b/compressed_archive/7z_includes.h @@ -20,6 +20,10 @@ extern "C" { #include "lib7zip/CPP/7zip/IPassword.h" #include "lib7zip/CPP/7zip/MyVersion.h" +#include "lib7zip/CPP/Windows/FileDir.h" +#include "lib7zip/CPP/Windows/FileFind.h" +#include "lib7zip/CPP/Windows/FileName.h" +#include "lib7zip/CPP/Windows/NtCheck.h" #include "lib7zip/CPP/Windows/PropVariant.h" #include "lib7zip/CPP/Windows/PropVariantConv.h" diff --git a/compressed_archive/7z_precompiled_header.h b/compressed_archive/7z_precompiled_header.h deleted file mode 100644 index 4bf5402e..00000000 --- a/compressed_archive/7z_precompiled_header.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _7Z_PRECOMPILED_HEADER_H -#define _7Z_PRECOMPILED_HEADER_H - -#if defined __cplusplus - -#include "libp7zip/CPP/myWindows/StdAfx.h" - -#endif - -#endif // 7Z_PRECOMPILED_HEADER_H diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index fffc2119..b17dbf2f 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -1,7 +1,4 @@ #include -#ifndef Q_OS_WIN -#include "libp7zip/CPP/Common/MyInitGuid.h" -#endif #include "compressed_archive.h" #include "extract_delegate.h" @@ -15,12 +12,9 @@ #include "extract_callbacks.h" #include "7z_includes.h" +#include "lib7zip/CPP/Common/MyInitGuid.h" -#ifdef Q_OS_WIN #define _MY_WINAPI WINAPI -#else -#define _MY_WINAPI -#endif typedef quint32(_MY_WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *interfaceID, void **outObject); typedef quint32(_MY_WINAPI *GetMethodPropertyFunc)(quint32 index, PROPID propID, PROPVARIANT *value); @@ -57,22 +51,18 @@ DEFINE_GUID(CLSID_CFormatSplit, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, DEFINE_GUID(CLSID_CFormatWim, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0xe6, 0x00, 0x00); DEFINE_GUID(CLSID_CFormatZ, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x05, 0x00, 0x00);*/ -#ifdef Q_OS_WIN GUID _supportedFileFormats[] = { CLSID_CFormatRar, CLSID_CFormatZip, CLSID_CFormatTar, CLSID_CFormat7z, CLSID_CFormatArj, CLSID_CFormatRar5 }; -#else -GUID _supportedFileFormats[] = { CLSID_CFormatZip, CLSID_CFormatTar, CLSID_CFormat7z, CLSID_CFormatArj }; -#endif std::vector supportedFileFormats(_supportedFileFormats, _supportedFileFormats + sizeof(_supportedFileFormats) / sizeof(_supportedFileFormats[0])); DEFINE_GUID(IID_InArchive, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00); DEFINE_GUID(IID_ISetCompressCodecsInfoX, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x00); -/*#ifdef Q_OS_UNIX -DEFINE_GUID(IID_IOutStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00); -DEFINE_GUID(IID_IInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00); -DEFINE_GUID(IID_IStreamGetSize, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00); -DEFINE_GUID(IID_ISequentialInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00); -#endif*/ +//#ifdef Q_OS_UNIX +// Z7_DEFINE_GUID(IID_IOutStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00); +// Z7_DEFINE_GUID(IID_IInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00); +// Z7_DEFINE_GUID(IID_IStreamGetSize, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00); +// Z7_DEFINE_GUID(IID_ISequentialInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00); +//#endif struct SevenZipInterface { CreateObjectFunc createObjectFunc; @@ -82,13 +72,6 @@ struct SevenZipInterface { GetHandlerPropertyFunc getHandlerPropertyFunc; GetHandlerPropertyFunc2 getHandlerPropertyFunc2; SetLargePageModeFunc setLargePageModeFunc; - -#ifdef Q_OS_UNIX - CreateObjectFunc createObjectFuncRar; - GetMethodPropertyFunc getMethodPropertyFuncRar; - GetNumberOfMethodsFunc getNumberOfMethodsFuncRar; -#endif - CMyComPtr archive; }; @@ -103,10 +86,6 @@ const unsigned char arj[2] = { static_cast(0x60), static_castOpen((LPCTSTR)filePath.toStdWString().c_str())) -#else - if (!fileSpec->Open((LPCTSTR)filePath.toStdString().c_str())) -#endif - { - qDebug() << "unable to load" + filePath; - return; - } - - // GUID uuid = supportedFileFormats[i]; - // qDebug() << "trying : " << uuid << endl; - if (szInterface->createObjectFunc(&supportedFileFormats[i], &IID_InArchive, (void **)&szInterface->archive) == S_OK) { - // qDebug() << "Can not open archive file : " + filePath << Qt::endl; - - if (szInterface->archive->Open(file, 0, openCallback) == S_OK) { - valid = formatFound = true; - qDebug() << "Opened archive file : " + filePath << Qt::endl; - setupFilesNames(); - return; - } - } - -#ifdef Q_OS_WIN - if (!formatFound) { - qDebug() << "Can not open archive" << Qt::endl; - } - } - } -#else - } else { - // RAR in macos and unix - GUID clsidRar; - if (memcmp(magicNumber, rar5, 7) == 0) { - clsidRar = CLSID_CFormatRar5; - } else { - clsidRar = CLSID_CFormatRar; - } - - isRar = true; // tell the destructor we *tried* to open a rar file! - if (szInterface->createObjectFunc(&clsidRar, &IID_InArchive, (void **)&szInterface->archive) != S_OK) { - qDebug() << "Error creating rar archive :" + filePath; - return; - } - - CMyComPtr codecsInfo; - - if (szInterface->archive->QueryInterface(IID_ISetCompressCodecsInfoX, (void **)&codecsInfo) != S_OK) { - qDebug() << "Error getting rar codec :" + filePath; - return; - } - if (codecsInfo->SetCompressCodecsInfo(this) != S_OK) { - qDebug() << "Error setting rar codec"; - return; - } - -#ifdef UNICODE +#ifdef USE_UNICODE_FSTRING if (!fileSpec->Open((LPCTSTR)filePath.toStdWString().c_str())) #else if (!fileSpec->Open((LPCTSTR)filePath.toStdString().c_str())) #endif { - qDebug() << "Error opening rar file :" + filePath; + qDebug() << "unable to load" + filePath; return; } - // qDebug() << "Can not open archive file : " + filePath << Qt::endl; - if (szInterface->archive->Open(file, 0, openCallback) == S_OK) { - valid = formatFound = true; - setupFilesNames(); - // isRar = true; + // GUID uuid = supportedFileFormats[i]; + // qDebug() << "trying : " << uuid << endl; + if (szInterface->createObjectFunc(&supportedFileFormats[i], &IID_InArchive, (void **)&szInterface->archive) == S_OK) { + // qDebug() << "Can not open archive file : " + filePath << Qt::endl; + + if (szInterface->archive->Open(file, 0, openCallback) == S_OK) { + valid = formatFound = true; + qDebug() << "Opened archive file : " + filePath << Qt::endl; + setupFilesNames(); + return; + } + } + if (!formatFound) { + qDebug() << "Can not open archive" << Qt::endl; } } } -} -#endif - CompressedArchive::~CompressedArchive() - { - // always close the archive! - if (szInterface->archive) { - szInterface->archive->Close(); - } - -#ifdef Q_OS_UNIX - if (isRar) // TODO: Memory leak!!!! If AddRef is not used, a crash occurs in "delete szInterface" - { - szInterface->archive->AddRef(); - } -#endif - delete szInterface; - -#ifdef Q_OS_UNIX - delete rarLib; -#endif - delete sevenzLib; +CompressedArchive::~CompressedArchive() +{ + // always close the archive! + if (szInterface->archive) { + szInterface->archive->Close(); } - bool CompressedArchive::loadFunctions() - { - // LOAD library - // TODO check if this works in OSX (7z.so instead of 7z.dylib) - // fix1: try to load "7z.so" - // fix2: rename 7z.so to 7z.dylib - if (sevenzLib == 0) { -#if defined Q_OS_UNIX -#if defined Q_OS_MACOS - rarLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/Codecs/Rar"); -#else - // check if a yacreader specific version of p7zip exists on the system - QFileInfo rarCodec(QString(LIBDIR) + "/yacreader/Codecs/Rar.so"); - if (rarCodec.exists()) { - rarLib = new QLibrary(rarCodec.absoluteFilePath()); - } else { - rarLib = new QLibrary(QString(LIBDIR) + "/p7zip/Codecs/Rar.so"); - } -#endif - if (!rarLib->load()) { - qDebug() << "Error Loading Rar.so : " + rarLib->errorString() << Qt::endl; - QCoreApplication::exit(700); // TODO yacreader_global can't be used here, it is GUI dependant, YACReader::SevenZNotFound - return false; - } -#endif -#if defined Q_OS_UNIX && !defined Q_OS_MACOS - QFileInfo sevenzlibrary(QString(LIBDIR) + "/yacreader/7z.so"); - if (sevenzlibrary.exists()) { - sevenzLib = new QLibrary(sevenzlibrary.absoluteFilePath()); - } else { - sevenzLib = new QLibrary(QString(LIBDIR) + "/p7zip/7z.so"); - } -#else + delete szInterface; + delete sevenzLib; +} + +bool CompressedArchive::loadFunctions() +{ + // LOAD library + if (sevenzLib == 0) { sevenzLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/7z"); -#endif - } - if (!sevenzLib->load()) { - qDebug() << "Error Loading 7z.dll : " + sevenzLib->errorString() << Qt::endl; - QCoreApplication::exit(700); // TODO yacreader_global can't be used here, it is GUI dependant, YACReader::SevenZNotFound - return false; - } else { - qDebug() << "Loading functions" << Qt::endl; + } + if (!sevenzLib->load()) { + qDebug() << "Error Loading 7z.dll : " + sevenzLib->errorString() << Qt::endl; + QCoreApplication::exit(700); // TODO yacreader_global can't be used here, it is GUI dependant, YACReader::SevenZNotFound + return false; + } else { + qDebug() << "Loading functions" << Qt::endl; - if ((szInterface->createObjectFunc = (CreateObjectFunc)sevenzLib->resolve("CreateObject")) == 0) - qDebug() << "fail loading function : CreateObject" << Qt::endl; - if ((szInterface->getMethodPropertyFunc = (GetMethodPropertyFunc)sevenzLib->resolve("GetMethodProperty")) == 0) - qDebug() << "fail loading function : GetMethodProperty" << Qt::endl; - if ((szInterface->getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)sevenzLib->resolve("GetNumberOfMethods")) == 0) - qDebug() << "fail loading function : GetNumberOfMethods" << Qt::endl; - if ((szInterface->getNumberOfFormatsFunc = (GetNumberOfFormatsFunc)sevenzLib->resolve("GetNumberOfFormats")) == 0) - qDebug() << "fail loading function : GetNumberOfFormats" << Qt::endl; - if ((szInterface->getHandlerPropertyFunc = (GetHandlerPropertyFunc)sevenzLib->resolve("GetHandlerProperty")) == 0) - qDebug() << "fail loading function : GetHandlerProperty" << Qt::endl; - if ((szInterface->getHandlerPropertyFunc2 = (GetHandlerPropertyFunc2)sevenzLib->resolve("GetHandlerProperty2")) == 0) - qDebug() << "fail loading function : GetHandlerProperty2" << Qt::endl; - if ((szInterface->setLargePageModeFunc = (SetLargePageModeFunc)sevenzLib->resolve("SetLargePageMode")) == 0) - qDebug() << "fail loading function : SetLargePageMode" << Qt::endl; - -#ifdef Q_OS_UNIX - if ((szInterface->createObjectFuncRar = (CreateObjectFunc)rarLib->resolve("CreateObject")) == 0) - qDebug() << "fail loading function (rar) : CreateObject" << Qt::endl; - if ((szInterface->getMethodPropertyFuncRar = (GetMethodPropertyFunc)rarLib->resolve("GetMethodProperty")) == 0) - qDebug() << "fail loading function (rar) : GetMethodProperty" << Qt::endl; - if ((szInterface->getNumberOfMethodsFuncRar = (GetNumberOfMethodsFunc)rarLib->resolve("GetNumberOfMethods")) == 0) - qDebug() << "fail loading function (rar) : GetNumberOfMethods" << Qt::endl; -#endif - } - - return true; + if ((szInterface->createObjectFunc = (CreateObjectFunc)sevenzLib->resolve("CreateObject")) == 0) + qDebug() << "fail loading function : CreateObject" << Qt::endl; + if ((szInterface->getMethodPropertyFunc = (GetMethodPropertyFunc)sevenzLib->resolve("GetMethodProperty")) == 0) + qDebug() << "fail loading function : GetMethodProperty" << Qt::endl; + if ((szInterface->getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)sevenzLib->resolve("GetNumberOfMethods")) == 0) + qDebug() << "fail loading function : GetNumberOfMethods" << Qt::endl; + if ((szInterface->getNumberOfFormatsFunc = (GetNumberOfFormatsFunc)sevenzLib->resolve("GetNumberOfFormats")) == 0) + qDebug() << "fail loading function : GetNumberOfFormats" << Qt::endl; + if ((szInterface->getHandlerPropertyFunc = (GetHandlerPropertyFunc)sevenzLib->resolve("GetHandlerProperty")) == 0) + qDebug() << "fail loading function : GetHandlerProperty" << Qt::endl; + if ((szInterface->getHandlerPropertyFunc2 = (GetHandlerPropertyFunc2)sevenzLib->resolve("GetHandlerProperty2")) == 0) + qDebug() << "fail loading function : GetHandlerProperty2" << Qt::endl; + if ((szInterface->setLargePageModeFunc = (SetLargePageModeFunc)sevenzLib->resolve("SetLargePageMode")) == 0) + qDebug() << "fail loading function : SetLargePageMode" << Qt::endl; } - void CompressedArchive::setupFilesNames() - { - quint32 numItems = getNumEntries(); - quint32 p = 0; - for (quint32 i = 0; i < numItems; i++) { + return true; +} - // Get name of file - NWindows::NCOM::CPropVariant prop; - szInterface->archive->GetProperty(i, kpidIsDir, &prop); - bool isDir; - if (prop.vt == VT_BOOL) - isDir = VARIANT_BOOLToBool(prop.boolVal); - else if (prop.vt == VT_EMPTY) - isDir = false; - else - continue; +void CompressedArchive::setupFilesNames() +{ + quint32 numItems = getNumEntries(); + quint32 p = 0; + for (quint32 i = 0; i < numItems; i++) { - if (!isDir) { - szInterface->archive->GetProperty(i, kpidPath, &prop); - UString s = prop.bstrVal; - const wchar_t *chars = s.operator const wchar_t *(); - files.append(QString::fromWCharArray(chars)); - offsets.append(i); - indexesToPages.insert(i, p); - p++; - } + // Get name of file + NWindows::NCOM::CPropVariant prop; + szInterface->archive->GetProperty(i, kpidIsDir, &prop); + bool isDir; + if (prop.vt == VT_BOOL) + isDir = VARIANT_BOOLToBool(prop.boolVal); + else if (prop.vt == VT_EMPTY) + isDir = false; + else + continue; + + if (!isDir) { + szInterface->archive->GetProperty(i, kpidPath, &prop); + UString s = prop.bstrVal; + const wchar_t *chars = s.operator const wchar_t *(); + files.append(QString::fromWCharArray(chars)); + offsets.append(i); + indexesToPages.insert(i, p); + p++; } } +} - QVector CompressedArchive::translateIndexes(const QVector &indexes) - { - QVector translatedIndexes; +QVector CompressedArchive::translateIndexes(const QVector &indexes) +{ + QVector translatedIndexes; - foreach (quint32 i, indexes) { - if (i < (quint32)offsets.length()) - translatedIndexes.append(offsets.at(i)); - } - - return translatedIndexes; + foreach (quint32 i, indexes) { + if (i < (quint32)offsets.length()) + translatedIndexes.append(offsets.at(i)); } - QList CompressedArchive::getFileNames() - { - return files; + return translatedIndexes; +} + +QList CompressedArchive::getFileNames() +{ + return files; +} + +bool CompressedArchive::isValid() +{ + return valid; +} + +bool CompressedArchive::toolsLoaded() +{ + return tools; +} + +int CompressedArchive::getNumFiles() +{ + return files.length(); +} + +int CompressedArchive::getNumEntries() +{ + quint32 numItems = 0; + szInterface->archive->GetNumberOfItems(&numItems); + return numItems; +} + +QList CompressedArchive::getAllData(const QVector &indexes, ExtractDelegate *delegate) +{ + YCArchiveExtractCallback *extractCallbackSpec = new YCArchiveExtractCallback(indexesToPages, true, delegate); + CMyComPtr extractCallback(extractCallbackSpec); + extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path + extractCallbackSpec->PasswordIsDefined = false; + + QVector currentIndexes = translateIndexes(indexes); + + HRESULT result; + if (indexes.isEmpty()) + result = szInterface->archive->Extract(NULL, -1, false, extractCallback); + else + result = szInterface->archive->Extract(currentIndexes.data(), currentIndexes.count(), false, extractCallback); + if (result != S_OK) { + qDebug() << "Extract Error" << Qt::endl; } - bool CompressedArchive::isValid() - { - return valid; - } + return extractCallbackSpec->allFiles; +} - bool CompressedArchive::toolsLoaded() - { - return tools; - } - - int CompressedArchive::getNumFiles() - { - return files.length(); - } - - int CompressedArchive::getNumEntries() - { - quint32 numItems = 0; - szInterface->archive->GetNumberOfItems(&numItems); - return numItems; - } - - QList CompressedArchive::getAllData(const QVector &indexes, ExtractDelegate *delegate) - { - YCArchiveExtractCallback *extractCallbackSpec = new YCArchiveExtractCallback(indexesToPages, true, delegate); +QByteArray CompressedArchive::getRawDataAtIndex(int index) +{ + if (index >= 0 && index < getNumFiles()) { + YCArchiveExtractCallback *extractCallbackSpec = new YCArchiveExtractCallback(indexesToPages); CMyComPtr extractCallback(extractCallbackSpec); extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path extractCallbackSpec->PasswordIsDefined = false; - QVector currentIndexes = translateIndexes(indexes); + UInt32 indices[1]; - HRESULT result; - if (indexes.isEmpty()) - result = szInterface->archive->Extract(NULL, -1, false, extractCallback); + if (index < offsets.length()) + indices[0] = offsets.at(index); else - result = szInterface->archive->Extract(currentIndexes.data(), currentIndexes.count(), false, extractCallback); + indices[0] = index; + + HRESULT result = szInterface->archive->Extract(indices, 1, false, extractCallback); if (result != S_OK) { qDebug() << "Extract Error" << Qt::endl; } - return extractCallbackSpec->allFiles; + return QByteArray((char *)extractCallbackSpec->data, extractCallbackSpec->newFileSize); } - - QByteArray CompressedArchive::getRawDataAtIndex(int index) - { - if (index >= 0 && index < getNumFiles()) { - YCArchiveExtractCallback *extractCallbackSpec = new YCArchiveExtractCallback(indexesToPages); - CMyComPtr extractCallback(extractCallbackSpec); - extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path - extractCallbackSpec->PasswordIsDefined = false; - - UInt32 indices[1]; - - if (index < offsets.length()) - indices[0] = offsets.at(index); - else - indices[0] = index; - - HRESULT result = szInterface->archive->Extract(indices, 1, false, extractCallback); - if (result != S_OK) { - qDebug() << "Extract Error" << Qt::endl; - } - - return QByteArray((char *)extractCallbackSpec->data, extractCallbackSpec->newFileSize); - } - return QByteArray(); - } - -#ifdef Q_OS_UNIX - - STDMETHODIMP CompressedArchive::GetNumMethods(UInt32 * numMethods) - { - return szInterface->getNumberOfMethodsFuncRar(numMethods); - } - - STDMETHODIMP CompressedArchive::GetProperty(UInt32 index, PROPID propID, PROPVARIANT * value) - { - return szInterface->getMethodPropertyFuncRar(index, propID, value); - } - - int i = 0; - STDMETHODIMP CompressedArchive::CreateDecoder(UInt32 index, const GUID *interfaceID, void **coder) - { - NCOM::CPropVariant propVariant; - szInterface->getMethodPropertyFuncRar(index, NMethodPropID::kDecoder, &propVariant); - return szInterface->createObjectFuncRar((const GUID *)propVariant.bstrVal, interfaceID, coder); - } - - STDMETHODIMP CompressedArchive::CreateEncoder(UInt32 index, const GUID *interfaceID, void **coder) - { - return S_OK; // szInterface->createObjectFuncRar(&CLSID_CFormatRar,interfaceID,coder); - } - -#endif + return QByteArray(); +} diff --git a/compressed_archive/compressed_archive.h b/compressed_archive/compressed_archive.h index eb5914e6..b691527e 100644 --- a/compressed_archive/compressed_archive.h +++ b/compressed_archive/compressed_archive.h @@ -3,11 +3,6 @@ #include -#ifdef Q_OS_UNIX -#include "libp7zip/CPP/7zip/ICoder.h" -#include "libp7zip/CPP/Common/MyCom.h" -#endif - class ExtractDelegate; class QLibrary; @@ -19,32 +14,13 @@ struct SevenZipInterface; class MyCodecs; -#ifdef Q_OS_UNIX -class CompressedArchive : public QObject, public ICompressCodecsInfo, public CMyUnknownImp -#else class CompressedArchive : public QObject -#endif { Q_OBJECT public: explicit CompressedArchive(const QString &filePath, QObject *parent = 0); ~CompressedArchive(); -#ifdef Q_OS_UNIX - MY_UNKNOWN_IMP - - STDMETHOD(GetNumMethods) - (UInt32 *numMethods); - STDMETHOD(GetProperty) - (UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(CreateDecoder) - (UInt32 index, const GUID *iid, void **coder); - STDMETHOD(CreateEncoder) - (UInt32 index, const GUID *iid, void **coder); - - bool isRar; -#endif - signals: public slots: @@ -60,9 +36,6 @@ private: SevenZipInterface *szInterface; QLibrary *sevenzLib; -#ifdef Q_OS_UNIX - QLibrary *rarLib; -#endif bool loadFunctions(); bool tools; bool valid; diff --git a/compressed_archive/wrapper.pri b/compressed_archive/wrapper.pri index e9376921..162285f1 100644 --- a/compressed_archive/wrapper.pri +++ b/compressed_archive/wrapper.pri @@ -1,48 +1,39 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD -win32 { exists (../compressed_archive/lib7zip) { message(Using 7zip) } else { error(You\'ll need 7zip source code to compile YACReader. \ Please check the compressed_archive folder for further instructions.) } -} -unix { -exists (../compressed_archive/libp7zip) { - message(Found p7zip source code...) - #this is probably only needed in macos - system(patch -N -p0 -i libp7zip.patch) -} else { - error(You\'ll need 7zip source code to compile YACReader. \ - Please check the compressed_archive folder for further instructions.) -} -} - -win32 { INCLUDEPATH += \ - $$PWD/lib7zip/myWindows \ $$PWD/lib7zip/CPP \ - $$PWD/lib7zip/include_windows \ - -DEFINES += _UNICODE _WIN32 SOURCES += \ $$PWD/compressed_archive.cpp \ - $$PWD/lib7zip/CPP/Windows/FileIO.cpp \ - $$PWD/lib7zip/CPP/Windows/PropVariant.cpp \ - $$PWD/lib7zip/CPP/Windows/PropVariantConv.cpp \ $$PWD/lib7zip/CPP/Common/IntToString.cpp \ + $$PWD/lib7zip/CPP/Common/NewHandler.cpp \ $$PWD/lib7zip/CPP/Common/MyString.cpp \ $$PWD/lib7zip/CPP/Common/MyVector.cpp \ $$PWD/lib7zip/CPP/Common/StringConvert.cpp \ + $$PWD/lib7zip/CPP/Common/StringToInt.cpp \ $$PWD/lib7zip/CPP/Common/Wildcard.cpp \ + $$PWD/lib7zip/CPP/Windows/DLL.cpp \ + $$PWD/lib7zip/CPP/Windows/FileDir.cpp \ + $$PWD/lib7zip/CPP/Windows/FileFind.cpp \ + $$PWD/lib7zip/CPP/Windows/FileIO.cpp \ + $$PWD/lib7zip/CPP/Windows/FileName.cpp \ + $$PWD/lib7zip/CPP/Windows/PropVariant.cpp \ + $$PWD/lib7zip/CPP/Windows/PropVariantConv.cpp \ $$PWD/lib7zip/CPP/7zip/Common/FileStreams.cpp \ + $$PWD/lib7zip/CPP/7zip/Common/StreamObjects.cpp \ $$PWD/lib7zip/CPP/7zip/Common/StreamUtils.cpp \ $$PWD/lib7zip/C/Alloc.c \ - $$PWD/lib7zip/CPP/7zip/Common/StreamObjects.cpp + $$PWD/lib7zip/CPP/Windows/TimeUtils.cpp \ + $$PWD/lib7zip/CPP/Common/UTFConvert.cpp \ + $$PWD/lib7zip/CPP/Common/MyWindows.cpp \ HEADERS += \ $$PWD/lib7zip/CPP/Common/Common.h \ @@ -50,13 +41,7 @@ HEADERS += \ $$PWD/extract_delegate.h \ $$PWD/7z_includes.h \ $$PWD/open_callbacks.h \ - $$PWD/extract_callbacks.h -} - -!win32 { -CONFIG += precompile_header -PRECOMPILED_HEADER = $$PWD/7z_precompiled_header.h -} + $$PWD/extract_callbacks.h \ macx{ LIBS += -framework IOKit -framework CoreFoundation @@ -73,31 +58,3 @@ DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \ _7ZIP_LARGE_PAGES \ UNICODE _UNICODE UNIX_USE_WIN_FILE } - -!win32 { -INCLUDEPATH += $$PWD/libp7zip/CPP/myWindows/ \ - $$PWD/libp7zip/CPP/ \ - $$PWD/libp7zip/CPP/include_windows/ - -SOURCES += \ - $$PWD/compressed_archive.cpp \ - $$PWD/libp7zip/CPP/Windows/PropVariant.cpp \ - $$PWD/libp7zip/CPP/Windows/PropVariantConv.cpp \ - $$PWD/libp7zip/CPP/Windows/FileIO.cpp \ - $$PWD/libp7zip/CPP/Windows/FileFind.cpp \ - $$PWD/libp7zip/CPP/Common/IntToString.cpp \ - $$PWD/libp7zip/CPP/Common/MyString.cpp \ - $$PWD/libp7zip/CPP/Common/MyVector.cpp \ - $$PWD/libp7zip/CPP/Common/StringConvert.cpp \ - $$PWD/libp7zip/CPP/Common/Wildcard.cpp \ - $$PWD/libp7zip/CPP/7zip/Common/FileStreams.cpp \ - $$PWD/libp7zip/CPP/7zip/Common/StreamUtils.cpp \ - $$PWD/libp7zip/C/Alloc.c \ - $$PWD/libp7zip/CPP/7zip/Common/StreamObjects.cpp \ - $$PWD/libp7zip/CPP/myWindows/wine_date_and_time.cpp \ - $$PWD/libp7zip/CPP/Common/MyWindows.cpp - -HEADERS += \ - $$PWD/compressed_archive.h \ - $$PWD/7z_includes.h -}