dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
darchivemanager.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef ARCHIVEMANAGER_H
6#define ARCHIVEMANAGER_H
7#include "dcompressornamespace.h"
8#include <QObject>
9#include <QMimeType>
10#include <QFileInfo>
11#include <QMutex>
12#include <QMap>
13class ReadOnlyArchiveInterface;
14
15DCOMPRESSOR_BEGIN_NAMESPACE
16class ArchiveJob;
17class DArchiveManagerPrivate;
18class DArchiveManager : public QObject
19{
20 Q_OBJECT
21 Q_DECLARE_PRIVATE(DArchiveManager)
22
23public:
31
47
49 PFT_Nomral = 0,
51 PFT_Error
52 };
53
72
74 {
75 void reset();
76 bool operator==(const MgrFileEntry &t) const;
77
78 QString strFullPath;
79 QString strFileName;
80 QString strAlias;
82 qlonglong qSize;
84 int iIndex;
86 };
87
89 {
91 void reset();
92
93 qlonglong qSize;
94 qlonglong qComressSize;
95 QString strComment;
96 QMap<QString, MgrFileEntry> mapFileEntry;
97 QList<MgrFileEntry> listRootEntry;
99 QString strPassword;
100 };
101
119
135
137 {
138 enum Type {
139 Delete,
140 Rename,
141 Add
142 };
143
145 void reset();
146
147 Type eType;
149 QList<MgrFileEntry> listEntry;
150 qint64 qSize;
151 };
152
154
156
157 bool createArchive(const QList<MgrFileEntry> &files, const QString &strDestination, const MgrCompressOptions &stOptions, ArchivePluginType eType);
158
159 bool loadArchive(const QString &strArchiveFullPath, ArchivePluginType eType = ArchivePluginType::APT_Auto);
160
162
163 bool addFiles(const QString &strArchiveFullPath, const QList<MgrFileEntry> &listAddEntry, const MgrCompressOptions &stOptions);
164
165 bool extractFiles(const QString &strArchiveFullPath, const QList<MgrFileEntry> &files, const MgrExtractionOptions &stOptions, ArchivePluginType eType = ArchivePluginType::APT_Auto);
166
167 bool extractFiles2Path(const QString &strArchiveFullPath, const QList<MgrFileEntry> &listSelEntry, const MgrExtractionOptions &stOptions);
168
169 bool deleteFiles(const QString &strArchiveFullPath, const QList<MgrFileEntry> &listSelEntry);
170
171 bool renameFiles(const QString &strArchiveFullPath, const QList<MgrFileEntry> &listSelEntry);
172
173 bool batchExtractFiles(const QStringList &listFiles, const QString &strTargetPath /*, bool bAutoCreatDir*/);
174
175 bool openFile(const QString &strArchiveFullPath, const MgrFileEntry &stEntry, const QString &strTempExtractPath, const QString &strProgram);
176
178
179 bool updateArchiveComment(const QString &strArchiveFullPath, const QString &strComment);
180
181 bool convertArchive(const QString &strOriginalArchiveFullPath, const QString &strTargetFullPath, const QString &strNewArchiveFullPath);
182
184
186
188
190
192
193Q_SIGNALS:
194
195 void signalError(MgrErrorType eErrorType);
196
197 void signalJobFinished(ArchiveJobType eJobType, MgrPluginFinishType eFinishType, MgrErrorType eErrorType);
198
199 void signalprogress(double dPercentage);
200
201 void signalCurFileName(const QString &strName);
202
203 void signalFileWriteErrorName(const QString &strName);
204
205 void signalCurArchiveName(const QString &strArchiveName);
206
207private:
208 explicit DArchiveManager(QObject *parent = nullptr);
209 ~DArchiveManager() override;
210
211protected:
212 QScopedPointer<DArchiveManagerPrivate> d_ptr;
213};
214DCOMPRESSOR_END_NAMESPACE
215#endif // ARCHIVEMANAGER_H
DArchiveManager类提供文档压缩解压功能
Definition darchivemanager.h:19
bool convertArchive(const QString &strOriginalArchiveFullPath, const QString &strTargetFullPath, const QString &strNewArchiveFullPath)
压缩包格式转换
void signalprogress(double dPercentage)
信号-进度信号
void signalCurFileName(const QString &strName)
信号-发送当前正在操作的文件名
bool deleteFiles(const QString &strArchiveFullPath, const QList< MgrFileEntry > &listSelEntry)
删除压缩包中的文件
bool currentStatus()
当前任务状态
bool updateArchiveComment(const QString &strArchiveFullPath, const QString &strComment)
更新压缩包注释信息
void signalJobFinished(ArchiveJobType eJobType, MgrPluginFinishType eFinishType, MgrErrorType eErrorType)
信号-操作结束信号
MgrErrorType
错误类型
Definition darchivemanager.h:54
@ ET_NeedPassword
Definition darchivemanager.h:58
@ ET_ArchiveDamaged
Definition darchivemanager.h:60
@ ET_InsufficientDiskSpace
Definition darchivemanager.h:67
@ ET_FileOpenError
Definition darchivemanager.h:61
@ ET_FileWriteError
Definition darchivemanager.h:63
@ ET_RenameError
Definition darchivemanager.h:65
@ ET_FileReadError
Definition darchivemanager.h:62
@ ET_PluginError
Definition darchivemanager.h:56
@ ET_MissingVolume
Definition darchivemanager.h:66
@ ET_WrongPassword
Definition darchivemanager.h:57
@ ET_LongNameError
Definition darchivemanager.h:59
@ ET_UserCancelOpertion
Definition darchivemanager.h:69
@ ET_DeleteError
Definition darchivemanager.h:64
bool cancelOperation()
取消操作
bool pauseOperation()
暂停操作
bool renameFiles(const QString &strArchiveFullPath, const QList< MgrFileEntry > &listSelEntry)
重命名压缩包中的文件
bool extractFiles2Path(const QString &strArchiveFullPath, const QList< MgrFileEntry > &listSelEntry, const MgrExtractionOptions &stOptions)
提取文件至指定目录
ArchivePluginType
插件类型
Definition darchivemanager.h:24
@ APT_Auto
Definition darchivemanager.h:25
@ APT_Cli7z
Definition darchivemanager.h:26
@ APT_Libarchive
Definition darchivemanager.h:27
@ APT_Libzip
Definition darchivemanager.h:28
bool createArchive(const QList< MgrFileEntry > &files, const QString &strDestination, const MgrCompressOptions &stOptions, ArchivePluginType eType)
创建压缩包
static DArchiveManager * get_instance(void)
获取单例实例对象
MgrPluginFinishType
插件结束类型
Definition darchivemanager.h:48
@ PFT_Cancel
Definition darchivemanager.h:50
void signalCurArchiveName(const QString &strArchiveName)
信号-当前正在操作的压缩包信号
ArchiveJobType
操作类型
Definition darchivemanager.h:32
@ JT_Add
Definition darchivemanager.h:35
@ JT_Open
Definition darchivemanager.h:41
@ JT_Convert
Definition darchivemanager.h:44
@ JT_Load
Definition darchivemanager.h:36
@ JT_Create
Definition darchivemanager.h:34
@ JT_Comment
Definition darchivemanager.h:43
@ JT_Extract
Definition darchivemanager.h:37
@ JT_Rename
Definition darchivemanager.h:39
@ JT_Update
Definition darchivemanager.h:42
@ JT_BatchExtract
Definition darchivemanager.h:40
@ JT_Delete
Definition darchivemanager.h:38
bool extractFiles(const QString &strArchiveFullPath, const QList< MgrFileEntry > &files, const MgrExtractionOptions &stOptions, ArchivePluginType eType=ArchivePluginType::APT_Auto)
解压文件
void destory_instance()
获取单例实例对象
bool batchExtractFiles(const QStringList &listFiles, const QString &strTargetPath)
批量解压
bool updateArchiveCacheData(const MgrUpdateOptions &stOptions)
更新本地压缩包缓存数据
void signalFileWriteErrorName(const QString &strName)
信号-发送创建失败的文件名
void signalError(MgrErrorType eErrorType)
信号-错误信号
bool loadArchive(const QString &strArchiveFullPath, ArchivePluginType eType=ArchivePluginType::APT_Auto)
加载压缩包数据
bool openFile(const QString &strArchiveFullPath, const MgrFileEntry &stEntry, const QString &strTempExtractPath, const QString &strProgram)
打开压缩包中文件
bool continueOperation()
继续操作
MgrArchiveData * archiveData()
获取压缩包数据
bool addFiles(const QString &strArchiveFullPath, const QList< MgrFileEntry > &listAddEntry, const MgrCompressOptions &stOptions)
向压缩包中添加文件
QString getCurFilePassword()
获取当前文件密码
压缩包数据
Definition darchivemanager.h:89
QString strPassword
Definition darchivemanager.h:99
bool isListEncrypted
Definition darchivemanager.h:98
qlonglong qSize
Definition darchivemanager.h:93
QList< MgrFileEntry > listRootEntry
Definition darchivemanager.h:97
QMap< QString, MgrFileEntry > mapFileEntry
Definition darchivemanager.h:96
qlonglong qComressSize
Definition darchivemanager.h:94
QString strComment
Definition darchivemanager.h:95
压缩选项
Definition darchivemanager.h:103
QString strCompressionMethod
Definition darchivemanager.h:108
int iCPUTheadNum
Definition darchivemanager.h:117
QString strPassword
Definition darchivemanager.h:106
bool bTar_7z
Definition darchivemanager.h:116
QString strDestination
Definition darchivemanager.h:112
bool bSplit
Definition darchivemanager.h:115
bool bHeaderEncryption
Definition darchivemanager.h:114
int iCompressionLevel
Definition darchivemanager.h:110
int iVolumeSize
Definition darchivemanager.h:109
qlonglong qTotalSize
Definition darchivemanager.h:111
bool bEncryption
Definition darchivemanager.h:113
QString strEncryptionMethod
Definition darchivemanager.h:107
解压选项
Definition darchivemanager.h:121
QString strTargetPath
Definition darchivemanager.h:124
QString strDestination
Definition darchivemanager.h:125
bool bTar_7z
Definition darchivemanager.h:132
bool bAllExtract
Definition darchivemanager.h:130
qint64 qSize
Definition darchivemanager.h:127
qint64 qComressSize
Definition darchivemanager.h:128
bool bBatchExtract
Definition darchivemanager.h:131
bool bExistList
Definition darchivemanager.h:129
QString password
Definition darchivemanager.h:126
bool bOpen
Definition darchivemanager.h:133
文件数据
Definition darchivemanager.h:74
int iIndex
Definition darchivemanager.h:84
QString strFileName
Definition darchivemanager.h:79
bool isDirectory
Definition darchivemanager.h:81
QString strAlias
Definition darchivemanager.h:80
uint uLastModifiedTime
Definition darchivemanager.h:83
QString strFullPath
Definition darchivemanager.h:78
qlonglong qSize
Definition darchivemanager.h:82
更新选项
Definition darchivemanager.h:137
Type eType
Definition darchivemanager.h:147
QList< MgrFileEntry > listEntry
Definition darchivemanager.h:149
QString strParentPath
Definition darchivemanager.h:148
qint64 qSize
Definition darchivemanager.h:150