-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcryptoworker.cpp
More file actions
35 lines (28 loc) · 814 Bytes
/
cryptoworker.cpp
File metadata and controls
35 lines (28 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "cryptoworker.h"
#include <QFile>
#include <QFileInfo>
#include <QSaveFile>
#include <QDebug>
QString CryptoWorker::getOutFileName(const QString &outPath)
{
QString base = QFileInfo(this->inFile).fileName();
if (this->encryption) {
base += ".crypto";
} else {
base = base.remove(".crypto");
}
return outPath + "/" + base;
}
CryptoWorker::CryptoWorker(const bool encryption, CryptoAlgorithm *alg, const QString &inPath,
const QString &outPath, QObject *parent)
{
this->encryption = encryption;
this->algorithm = alg;
this->inFile = inPath;
this->outFile = getOutFileName(outPath);
}
void CryptoWorker::run()
{
this->algorithm->runAlgo(this->inFile, this->outFile, this->encryption);
emit this->algorithmEnd();
}