From ce5a1091d31e0c76372b2ec7476991414ca85f81 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 13 Apr 2020 22:05:38 +0200 Subject: [PATCH] Remove Minizip submodule for Linux and Mac, for bzip2 - Select dependencies from platforms - Remove minizip in linux and mac installation - Add Process Extractor in sources that extract file with bzip2 --- CMakeLists.txt | 41 +++-- linphone-app/CMakeLists.txt | 49 +++-- .../linphone_package/CMakeLists.txt | 9 - .../components/codecs/VideoCodecsModel.cpp | 6 +- .../components/file/FileProcessExtractor.cpp | 168 ++++++++++++++++++ .../components/file/FileProcessExtractor.hpp | 99 +++++++++++ 6 files changed, 320 insertions(+), 52 deletions(-) create mode 100644 linphone-app/src/components/file/FileProcessExtractor.cpp create mode 100644 linphone-app/src/components/file/FileProcessExtractor.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5197cdb96..2dcb90c5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,38 +148,46 @@ ExternalProject_Add_Step(sdk force_build DEPENDERS build ALWAYS 1 ) -#Don't use minizip as target name because it can be a conflict with link libraries names -ExternalProject_Add(miniziplib PREFIX "${CMAKE_BINARY_DIR}/minizip" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/submodules/externals/minizip" - INSTALL_DIR "${MINIZIP_OUTPUT_DIR}" - DEPENDS sdk - BUILD_COMMAND ${CMAKE_COMMAND} --build --config $ ${PROJECT_BUILD_COMMAND} - LIST_SEPARATOR | # Use the alternate list separator - CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_PREFIX_PATH=${PREFIX_PATH} -) include(FindPkgConfig) +if( WIN32) + #Don't use minizip as target name because it can be a conflict with link libraries names + ExternalProject_Add(miniziplib PREFIX "${CMAKE_BINARY_DIR}/minizip" + SOURCE_DIR "${CMAKE_SOURCE_DIR}/submodules/externals/minizip" + INSTALL_DIR "${MINIZIP_OUTPUT_DIR}" + DEPENDS sdk + BUILD_COMMAND ${CMAKE_COMMAND} --build --config $ ${PROJECT_BUILD_COMMAND} + LIST_SEPARATOR | # Use the alternate list separator + CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_PREFIX_PATH=${PREFIX_PATH} + ) + if(ENABLE_BUILD_VERBOSE) + message("MINIZIP from superbuild :${MINIZIP_PREFIX}, ${MINIZIP_INCLUDE_DIRS} => ${MINIZIP_LIBRARIES}") + endif() + find_package(minizip QUIET) + set(NEED_MINIZIP NOT(MINIZIP_FOUND)) + set(APP_DEPENDS miniziplib sdk) +else() + set(NEED_MINIZIP FALSE) + set(APP_DEPENDS sdk) +endif() find_package(LinphoneCxx CONFIG QUIET) find_package(Linphone CONFIG QUIET) find_package(bctoolbox CONFIG QUIET) find_package(belcard CONFIG QUIET) find_package(Mediastreamer2 CONFIG QUIET) find_package(ortp CONFIG QUIET) -find_package(minizip QUIET) -if(ENABLE_BUILD_VERBOSE) - message("MINIZIP from superbuild :${MINIZIP_PREFIX}, ${MINIZIP_INCLUDE_DIRS} => ${MINIZIP_LIBRARIES}") -endif() -if(NOT (LinphoneCxx_FOUND) OR NOT (Linphone_FOUND) OR NOT (bctoolbox_FOUND) OR NOT (belcard_FOUND) OR NOT (Mediastreamer2_FOUND) OR NOT (ortp_FOUND) OR NOT(MINIZIP_FOUND) OR FORCE_APP_EXTERNAL_PROJECTS) + +if(NOT (LinphoneCxx_FOUND) OR NOT (Linphone_FOUND) OR NOT (bctoolbox_FOUND) OR NOT (belcard_FOUND) OR NOT (Mediastreamer2_FOUND) OR NOT (ortp_FOUND) OR NEED_MINIZIP OR FORCE_APP_EXTERNAL_PROJECTS) message("Projects are set as External projects. You can start building them by using for example : cmake --build . --target all") ExternalProject_Add(linphone-qt PREFIX "${CMAKE_BINARY_DIR}/linphoneqt" SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app" INSTALL_DIR "${APPLICATION_OUTPUT_DIR}" - DEPENDS miniziplib sdk + DEPENDS ${APP_DEPENDS} BUILD_COMMAND ${CMAKE_COMMAND} --build --config $ ${PROJECT_BUILD_COMMAND} # INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time." LIST_SEPARATOR | # Use the alternate list separator CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_PREFIX_PATH=${PREFIX_PATH} - # ${APP_OPTIONS} + # ${APP_OPTIONS} BUILD_ALWAYS ON ) set(AUTO_REGENERATION auto_regeneration) @@ -190,6 +198,7 @@ else() message("Adding Linphone Desktop in an IDE-friendly state") set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}") add_subdirectory(${CMAKE_SOURCE_DIR}/linphone-app) + add_dependencies(app-library ${APP_DEPENDS}) endif() ExternalProject_Add(linphone-qt-only PREFIX "${CMAKE_BINARY_DIR}/linphoneqt" SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app" diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index fdd15d68d..6d81f0550 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -62,12 +62,16 @@ find_package(Linphone CONFIG) find_package(belcard CONFIG) find_package(Mediastreamer2 CONFIG) find_package(ortp CONFIG) -find_package(minizip) find_package(bctoolbox CONFIG) -set(MINIZIP_INCLUDE_DIRS "${MINIZIP_PREFIX}/${MINIZIP_INCLUDE_DIRS}") +if(WIN32) + find_package(minizip) + set(MINIZIP_INCLUDE_DIRS "${MINIZIP_PREFIX}/${MINIZIP_INCLUDE_DIRS}") + if(ENABLE_BUILD_VERBOSE) + message("MINIZIP : ${MINIZIP_PREFIX}, ${MINIZIP_INCLUDE_DIRS} => ${MINIZIP_LIBRARIES}") + endif() +endif() if(ENABLE_BUILD_VERBOSE) - message("MINIZIP : ${MINIZIP_PREFIX}, ${MINIZIP_INCLUDE_DIRS} => ${MINIZIP_LIBRARIES}") message("INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} FRAMEWORK_PATH=${CMAKE_FRAMEWORK_PATH}, PREFIX_PATH=${CMAKE_PREFIX_PATH}") message("LINPHONE : ${LINPHONE_INCLUDE_DIRS} => ${LINPHONE_LIBRARIES}") message("LINPHONECXX : ${LINPHONECXX_INCLUDE_DIRS} => ${LINPHONECXX_LIBRARIES}") @@ -128,7 +132,6 @@ set(SOURCES src/components/core/CoreManager.cpp src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp src/components/file/FileDownloader.cpp - src/components/file/FileExtractor.cpp src/components/notifier/Notifier.cpp src/components/other/clipboard/Clipboard.cpp src/components/other/colors/Colors.cpp @@ -187,7 +190,6 @@ set(HEADERS src/components/core/CoreManager.hpp src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp src/components/file/FileDownloader.hpp - src/components/file/FileExtractor.hpp src/components/notifier/Notifier.hpp src/components/other/clipboard/Clipboard.hpp src/components/other/colors/Colors.hpp @@ -210,7 +212,13 @@ set(HEADERS src/utils/QExifImageHeader.hpp src/utils/Utils.hpp ) - +if(WIN32) + list(APPEND SOURCES src/components/file/FileExtractor.cpp) + list(APPEND HEADERS src/components/file/FileExtractor.hpp) +else() + list(APPEND SOURCES src/components/file/FileProcessExtractor.cpp) + list(APPEND HEADERS src/components/file/FileProcessExtractor.hpp) +endif() set(MAIN_FILE src/app/main.cpp) if (APPLE) @@ -356,8 +364,9 @@ list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_F # Build and dependencies -link_directories("${MINIZIP_PREFIX}/${MINIZIP_LIBRARY_DIRS}") -#link_directories("${MINIZIP_PREFIX}/${MINIZIP_LIBRARY_DIRS}") +if(WIN32) + link_directories("${MINIZIP_PREFIX}/${MINIZIP_LIBRARY_DIRS}") +endif() @@ -405,11 +414,12 @@ set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "${EXECUTABLE_NAME}" #target_link_libraries(project_b_exe ${install_dir}/lib/alib.lib) -set(INCLUDED_DIRECTORIES "${LINPHONECXX_INCLUDE_DIRS}" "${MINIZIP_INCLUDE_DIRS}") -set(LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${OPUS_LIBRARIES} ${MINIZIP_LIBRARIES}) -#if(NOT APPLE) -# list(APPEND LIBRARIES ${MINIZIP_LIBRARIES}) -#endif() +set(INCLUDED_DIRECTORIES "${LINPHONECXX_INCLUDE_DIRS}" ) +set(LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${OPUS_LIBRARIES}) +if(WIN32) + list(APPEND INCLUDED_DIRECTORIES "${MINIZIP_INCLUDE_DIRS}") + list(APPEND LIBRARIES ${MINIZIP_LIBRARIES}) +endif() if(ENABLE_BUILD_VERBOSE) message("LIBRARIES : ${LIBRARIES}") endif() @@ -485,16 +495,3 @@ source_group( source_group( "Svg" REGULAR_EXPRESSION ".+\.svg$" ) - - -# ------------------------------ -# Installation -# ------------------------------ -#if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.15.0") -# add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR}) -#endif() -if(APPLE) - # target_link_libraries(${TARGET_NAME} "${MINIZIP_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libminizip.dylib") -elseif(NOT WIN32) - # target_link_libraries(${TARGET_NAME} "${MINIZIP_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}/libminizip.so") -endif() diff --git a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt index 8321a2bc1..9e01c35c7 100644 --- a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt +++ b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt @@ -143,9 +143,6 @@ elseif (APPLE) if (EXISTS "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}/mediastreamer") file(COPY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}/mediastreamer" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_LIBDIR}" USE_SOURCE_PERMISSIONS) endif () - if(ENABLE_BUILD_VERBOSE) - message("Take Minizip from ${MINIZIP_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libminizip.dylib") - endif() file(GLOB GRAMMAR_FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/Belr/grammars/*") install(FILES ${GRAMMAR_FILES} DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}/belr/grammars/") install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/images" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS OPTIONAL) @@ -158,14 +155,9 @@ elseif (APPLE) foreach (LIBRARY ${SHARED_LIBRARIES}) get_filename_component(LIBRARY_FILENAME ${LIBRARY} NAME) - if(NOT ("${LIBRARY_FILENAME}" STREQUAL "libminizip.dylib")) message("Changing RPATH of ${LIBRARY_FILENAME} from '${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}' to '@executable_path/../Frameworks'") execute_process(COMMAND install_name_tool -rpath "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}" "@executable_path/../Frameworks" "${LIBRARY}") - endif() endforeach () - install(FILES "${MINIZIP_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libminizip.dylib" DESTINATION "${APPLICATION_NAME}.app/Contents/Frameworks/") - install( CODE "execute_process(COMMAND install_name_tool -id \"@executable_path/../Frameworks/libminizip.dylib\" \"\${CMAKE_INSTALL_PREFIX}/${APPLICATION_NAME}.app/Contents/Frameworks/libminizip.dylib\")") - install( CODE "execute_process(COMMAND install_name_tool -change libminizip.dylib \"@executable_path/../Frameworks/libminizip.dylib\" \"\${CMAKE_INSTALL_PREFIX}/${APPLICATION_NAME}.app/Contents/MacOS/${EXECUTABLE_NAME}\")") install( CODE "execute_process(COMMAND install_name_tool -add_rpath \"@executable_path/../Frameworks/\" \"\${CMAKE_INSTALL_PREFIX}/${APPLICATION_NAME}.app/Contents/MacOS/${EXECUTABLE_NAME}\")") install( CODE "execute_process(COMMAND install_name_tool -add_rpath \"@executable_path/../lib/\" \"\${CMAKE_INSTALL_PREFIX}/${APPLICATION_NAME}.app/Contents/MacOS/${EXECUTABLE_NAME}\")") if(ENABLE_APP_PACKAGING) @@ -217,7 +209,6 @@ else()# Not Windows and Apple foreach (DIR ${ICON_DIRS}) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/icons/hicolor/${DIR}/apps/icon.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${DIR}/apps/" RENAME "${EXECUTABLE_NAME}.png") endforeach () - install(FILES "${MINIZIP_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libminizip.so" DESTINATION "${CMAKE_INSTALL_LIBDIR}") install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../../${EXECUTABLE_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}") endif () diff --git a/linphone-app/src/components/codecs/VideoCodecsModel.cpp b/linphone-app/src/components/codecs/VideoCodecsModel.cpp index 052a949f6..50ad7ff5a 100644 --- a/linphone-app/src/components/codecs/VideoCodecsModel.cpp +++ b/linphone-app/src/components/codecs/VideoCodecsModel.cpp @@ -25,7 +25,11 @@ #include "app/paths/Paths.hpp" #include "components/core/CoreManager.hpp" #include "components/file/FileDownloader.hpp" -#include "components/file/FileExtractor.hpp" +#ifdef _WIN32 + #include "components/file/FileExtractor.hpp" +#else + #include "components/file/FileProcessExtractor.hpp" +#endif #include "utils/Utils.hpp" #include "VideoCodecsModel.hpp" diff --git a/linphone-app/src/components/file/FileProcessExtractor.cpp b/linphone-app/src/components/file/FileProcessExtractor.cpp new file mode 100644 index 000000000..68242dc12 --- /dev/null +++ b/linphone-app/src/components/file/FileProcessExtractor.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2010-2020 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "FileProcessExtractor.hpp" + +// ============================================================================= + +using namespace std; + + +FileExtractor::FileExtractor (QObject *parent) : QObject(parent) {} + +FileExtractor::~FileExtractor () {} + +void FileExtractor::extract () { + if (mExtracting) { + qWarning() << "Unable to extract file. Already extracting!"; + return; + } + setExtracting(true); + QFileInfo fileInfo(mFile); + if(!fileInfo.isReadable()){ + emitExtractFailed(-1); + return; + } + + mDestinationFile = QDir::cleanPath(mExtractFolder) + QDir::separator() + (mExtractName.isEmpty() ? fileInfo.completeBaseName() : mExtractName); + if(QFile::exists(mDestinationFile) && !QFile::remove(mDestinationFile)){ + emitOutputError(); + return; + } + + mTimer = new QTimer(this); + QObject::connect(mTimer, &QTimer::timeout, this, &FileExtractor::handleExtraction); + mTimer->start(); +} + +bool FileExtractor::remove () { + return QFile::exists(mDestinationFile) && QFile::remove(mDestinationFile); +} + +QString FileExtractor::getFile () const { + return mFile; +} + +void FileExtractor::setFile (const QString &file) { + if (mExtracting) { + qWarning() << QStringLiteral("Unable to set file, a file is extracting."); + return; + } + if (mFile != file) { + mFile = file; + emit fileChanged(mFile); + } +} + +QString FileExtractor::getExtractFolder () const { + return mExtractFolder; +} + +void FileExtractor::setExtractFolder (const QString &extractFolder) { + if (mExtracting) { + qWarning() << QStringLiteral("Unable to set extract folder, a file is extracting."); + return; + } + if (mExtractFolder != extractFolder) { + mExtractFolder = extractFolder; + emit extractFolderChanged(mExtractFolder); + } +} + +QString FileExtractor::getExtractName () const { + return mExtractName; +} + +void FileExtractor::setExtractName (const QString &extractName) { + if (mExtracting) { + qWarning() << QStringLiteral("Unable to set extract name, a file is extracting."); + return; + } + if (mExtractName != extractName) { + mExtractName = extractName; + emit extractNameChanged(mExtractName); + } +} + +bool FileExtractor::getExtracting () const { + return mExtracting; +} + +void FileExtractor::setExtracting (bool extracting) { + if (mExtracting != extracting) { + mExtracting = extracting; + emit extractingChanged(extracting); + } +} +qint64 FileExtractor::getReadBytes () const { + return mReadBytes; +} +qint64 FileExtractor::getTotalBytes () const { + return mTotalBytes; +} +void FileExtractor::clean () { + if (mTimer) { + mTimer->stop(); + mTimer->deleteLater(); + mTimer = nullptr; + } + setExtracting(false); +} + +void FileExtractor::emitExtractFailed (int error) { + qWarning() << QStringLiteral("Unable to extract file with bzip2: `%1` (code: %2).") + .arg(mFile).arg(error); + clean(); + emit extractFailed(); +} + +void FileExtractor::emitExtractFinished () { + clean(); + emit extractFinished(); +} + +void FileExtractor::emitOutputError () { + qWarning() << QStringLiteral("Could not write into `%1`.") + .arg(mDestinationFile); + clean(); + emit extractFailed(); +} + +void FileExtractor::handleExtraction () { + QString tempDestination = mDestinationFile+"."+QFileInfo(mFile).suffix(); + QStringList args; + args.push_back("-dq"); + args.push_back(tempDestination); + QFile::copy(mFile, tempDestination); + int result = QProcess::execute("bzip2", args); + if(QFile::exists(tempDestination)) + QFile::remove(tempDestination); + if (result == 0) + emitExtractFinished(); + else if (result > 0) + emitExtractFailed(result); + else + emitOutputError(); +} diff --git a/linphone-app/src/components/file/FileProcessExtractor.hpp b/linphone-app/src/components/file/FileProcessExtractor.hpp new file mode 100644 index 000000000..2469335ff --- /dev/null +++ b/linphone-app/src/components/file/FileProcessExtractor.hpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2010-2020 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef FILE_EXTRACTOR_H_ +#define FILE_EXTRACTOR_H_ + +#include + +// ============================================================================= + +class QTimer; + +// Supports only bzip file. +class FileExtractor : public QObject { + + Q_OBJECT; + + // TODO: Add an error property to use in UI. + + Q_PROPERTY(QString file READ getFile WRITE setFile NOTIFY fileChanged); + Q_PROPERTY(QString extractFolder READ getExtractFolder WRITE setExtractFolder NOTIFY extractFolderChanged); + Q_PROPERTY(QString extractName READ getExtractName WRITE setExtractName NOTIFY extractNameChanged); + Q_PROPERTY(bool extracting READ getExtracting NOTIFY extractingChanged); + Q_PROPERTY(qint64 readBytes READ getReadBytes NOTIFY readBytesChanged); + Q_PROPERTY(qint64 totalBytes READ getTotalBytes NOTIFY totalBytesChanged); +public: + FileExtractor (QObject *parent = nullptr); + ~FileExtractor (); + + Q_INVOKABLE void extract (); + Q_INVOKABLE bool remove (); + + QString getFile () const; + void setFile (const QString &file); + + QString getExtractFolder () const; + void setExtractFolder (const QString &extractFolder); + + QString getExtractName () const; + void setExtractName (const QString &extractName); + +signals: + void fileChanged (const QString &file); + + void extractFolderChanged (const QString &extractFolder); + void extractNameChanged (const QString &extractName); + + void readBytesChanged (qint64 readBytes); + void totalBytesChanged (qint64 totalBytes); + + void extractingChanged (bool extracting); + void extractFinished (); + void extractFailed (); + +private: + qint64 getReadBytes () const; + qint64 getTotalBytes () const; + + bool getExtracting () const; + void setExtracting (bool extracting); + + void clean (); + + void emitExtractFinished (); + void emitExtractFailed (int error); + void emitOutputError (); + + void handleExtraction (); + + QString mFile; + QString mExtractFolder; + QString mExtractName; + QString mDestinationFile; + + bool mExtracting = false; + qint64 mReadBytes = 0; + qint64 mTotalBytes = 0; + + QTimer *mTimer = nullptr; +}; + +#endif // FILE_EXTRACTOR_H_