This commit is contained in:
DavidXanatos 2023-11-26 16:09:02 +01:00
parent affaba9b34
commit 6991284aa4
3 changed files with 17 additions and 12 deletions

View File

@ -189,7 +189,7 @@ protected:
CArchive* m_pArchive;
};
void CSandBoxPlus::ExportBoxAsync(const CSbieProgressPtr& pProgress, const QString& ExportPath, const QString& RootPath, const QString& Section, const QString& Password, struct SCompressParams* Params)
void CSandBoxPlus::ExportBoxAsync(const CSbieProgressPtr& pProgress, const QString& ExportPath, const QString& RootPath, const QString& Section, const QVariantMap& vParams)
{
//CArchive Archive(ExportPath + ".tmp");
CArchive Archive(ExportPath);
@ -229,11 +229,15 @@ void CSandBoxPlus::ExportBoxAsync(const CSbieProgressPtr& pProgress, const QStri
// this file is already present in the archive, this should not happen !!!
}
if (!Password.isEmpty())
Archive.SetPassword(Password);
if (vParams.contains("password"))
Archive.SetPassword(vParams["password"].toString());
SCompressParams Params;
Params.iLevel = vParams["level"].toInt();
Params.bSolid = vParams["solid"].toBool();
SB_STATUS Status = SB_OK;
if (!Archive.Update(&Files, true, Params)) // 0, 1 - 9
if (!Archive.Update(&Files, true, &Params))
Status = SB_ERR((ESbieMsgCodes)SBX_7zCreateFailed);
//if(!Status.IsError() && !pProgress->IsCanceled())
@ -243,8 +247,6 @@ void CSandBoxPlus::ExportBoxAsync(const CSbieProgressPtr& pProgress, const QStri
File.remove();
delete Params;
pProgress->Finish(Status);
}
@ -261,12 +263,14 @@ SB_PROGRESS CSandBoxPlus::ExportBox(const QString& FileName, const QString& Pass
QString Section = theAPI->SbieIniGetEx(m_Name, "");
SCompressParams* Params = new SCompressParams();
Params->iLevel = Level;
Params->bSolid = Solid;
QVariantMap vParams;
if (!Password.isEmpty())
vParams["password"] = Password;
vParams["level"] = Level;
vParams["solid"] = Solid;
CSbieProgressPtr pProgress = CSbieProgressPtr(new CSbieProgress());
QtConcurrent::run(CSandBoxPlus::ExportBoxAsync, pProgress, FileName, m_FilePath, Section, Password, Params);
QtConcurrent::run(CSandBoxPlus::ExportBoxAsync, pProgress, FileName, m_FilePath, Section, vParams);
return SB_PROGRESS(OP_ASYNC, pProgress);
}

View File

@ -220,8 +220,8 @@ protected:
void AddJobToQueue(CBoxJob* pJob);
void StartNextJob();
static void ExportBoxAsync(const CSbieProgressPtr& pProgress, const QString& ExportPath, const QString& RootPath, const QString& Section, const QString& Password = "", struct SCompressParams* Params = NULL);
static void ImportBoxAsync(const CSbieProgressPtr& pProgress, const QString& ImportPath, const QString& RootPath, const QString& BoxName, const QString& Password = "");
static void ExportBoxAsync(const CSbieProgressPtr& pProgress, const QString& ExportPath, const QString& RootPath, const QString& Section, const QVariantMap& Params);
static void ImportBoxAsync(const CSbieProgressPtr& pProgress, const QString& ImportPath, const QString& RootPath, const QString& BoxName, const QString& Password);
bool IsFileDeleted(const QString& RealPath, const QString& Snapshot, const QStringList& SnapshotList, const QMap<QString, QList<QString>>& DeletedPaths);

View File

@ -16,6 +16,7 @@
#include "../Windows/BoxImageWindow.h"
#include "../MiscHelpers/Archive/Archive.h"
#include "../Windows/SettingsWindow.h"
#include "../Windows/CompressDialog.h"
#include "qt_windows.h"
#include "qwindowdefs_win.h"