Adds initial intermediate qt6 porting state
This commit is contained in:
11247 files changed
+1891537
No files matched your search
@@ -0,0 +1,140 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "nglcomp_export.h"
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFuture>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
class QIODevice;
|
||||
class TarFilter;
|
||||
class BZip2IODevice;
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class NGLCOMPRESSION_EXPORT Compress : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
struct FileInformations
|
||||
{
|
||||
QString inputFileName;
|
||||
QString outputFileName;
|
||||
QByteArray fileData;
|
||||
bool bAbsInputPath = true;
|
||||
FileInformations() = default;
|
||||
|
||||
FileInformations(const QString &name, bool isAbsolute)
|
||||
: inputFileName(name)
|
||||
, bAbsInputPath(isAbsolute)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
struct FileSizeInfo
|
||||
{
|
||||
qint64 realSize = 0;
|
||||
qint64 compressedSize = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
explicit Compress(QObject *parent = nullptr);
|
||||
|
||||
~Compress();
|
||||
|
||||
|
||||
|
||||
QVector<FileInformations> getMemFiles() const { return m_u2_memFiles; }
|
||||
|
||||
|
||||
FileSizeInfo getFileSizeInfo() const { return m_c_sizeInfo; }
|
||||
|
||||
|
||||
bool success() const;
|
||||
|
||||
|
||||
|
||||
void compress(QIODevice *out,
|
||||
const QString &sourceRootDir,
|
||||
const QVector<FileInformations> &files,
|
||||
const QVector<FileInformations> &memFiles,
|
||||
const QString &destRootDir);
|
||||
|
||||
|
||||
|
||||
void compress(QIODevice *out,
|
||||
const QString &sourceDir,
|
||||
const QString &destRootDir);
|
||||
|
||||
|
||||
void uncompress(QIODevice *in,
|
||||
const QString &outDir);
|
||||
|
||||
|
||||
void uncompress(QIODevice *in);
|
||||
|
||||
|
||||
QString lastError() const { return m_lastError; }
|
||||
|
||||
|
||||
|
||||
bool waitForFinished();
|
||||
|
||||
public Q_SLOTS:
|
||||
void abort();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
|
||||
void uncompressInfo(qint64 totalSize, qint64 curPos, const QString &curName);
|
||||
|
||||
|
||||
void compressInfo(qint64 totalFiles, qint64 curFile, const QString &curName);
|
||||
void compressInfoEx(qint64 totalFiles, qint64 curFile, qint64 totalSize, qint64 curPos, const QString &curName, const qint64 bytesTotal);
|
||||
|
||||
|
||||
|
||||
void error(const QString &errorString);
|
||||
|
||||
|
||||
|
||||
void finished();
|
||||
private:
|
||||
|
||||
bool _compress(QIODevice *output,
|
||||
const QString &filesRootDir,
|
||||
const QVector<FileInformations> &files,
|
||||
const QVector<FileInformations> &memFiles,
|
||||
const QString &_destRootDir);
|
||||
bool _uncompressDirectory(QIODevice *input, const QString &outDir);
|
||||
bool _uncompressBuffer(QIODevice *input);
|
||||
|
||||
void reset();
|
||||
void setupFutureWatcher(const QFuture<bool> &future);
|
||||
|
||||
QVector<FileInformations> directoryFileList(const QString &dir, bool recursive = false);
|
||||
|
||||
FileSizeInfo m_c_sizeInfo;
|
||||
QVector<FileInformations> m_u2_memFiles;
|
||||
|
||||
QString m_lastError;
|
||||
QAtomicInt m_aborted;
|
||||
|
||||
TarFilter *m_currentTarFilter { nullptr };
|
||||
BZip2IODevice *m_currentBzipDevice { nullptr };
|
||||
|
||||
QFuture<bool> m_future;
|
||||
bool m_success { false };
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
Q_DECLARE_TYPEINFO(NGL::Compress::FileInformations, Q_MOVABLE_TYPE);
|
||||
|
||||
Reference in new issue
Block a user