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

View File

@ -220,8 +220,8 @@ protected:
void AddJobToQueue(CBoxJob* pJob); void AddJobToQueue(CBoxJob* pJob);
void StartNextJob(); 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 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 = ""); 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); 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 "../Windows/BoxImageWindow.h"
#include "../MiscHelpers/Archive/Archive.h" #include "../MiscHelpers/Archive/Archive.h"
#include "../Windows/SettingsWindow.h" #include "../Windows/SettingsWindow.h"
#include "../Windows/CompressDialog.h"
#include "qt_windows.h" #include "qt_windows.h"
#include "qwindowdefs_win.h" #include "qwindowdefs_win.h"