qt: Add signals for file-based and data-based progress
* lang/qt/src/decryptverifyarchivejob.h (DecryptVerifyArchiveJob): Add signals fileProgress and dataProgress. * lang/qt/src/encryptarchivejob.h (EncryptArchiveJob): Ditto. * lang/qt/src/signarchivejob.h (SignArchiveJob): Ditto. * lang/qt/src/signencryptarchivejob.h (SignEncryptArchiveJob): Ditto. * lang/qt/src/job_p.h (emitArchiveProgressSignals): New. * lang/qt/src/qgpgmedecryptverifyarchivejob.cpp (QGpgMEDecryptVerifyArchiveJob::QGpgMEDecryptVerifyArchiveJob): Emit appropriate signal when receiving Job::rawProgress signal. * lang/qt/src/qgpgmeencryptarchivejob.cpp (QGpgMEEncryptArchiveJob::QGpgMEEncryptArchiveJob): Ditto. * lang/qt/src/qgpgmesignarchivejob.cpp (QGpgMESignArchiveJob::QGpgMESignArchiveJob): Ditto. * lang/qt/src/qgpgmesignencryptarchivejob.cpp (QGpgMESignEncryptArchiveJob::QGpgMESignEncryptArchiveJob): Ditto. -- GnuPG-bug-id: 6342
This commit is contained in:
parent
ccff6a96fc
commit
73e46b3465
@ -80,6 +80,23 @@ public:
|
||||
virtual GpgME::Error start(const std::shared_ptr<QIODevice> &cipherText) = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the number of files. In the scanning phase (i.e. while gpgtar checks
|
||||
* which files to put into the archive), \a current is the current number of
|
||||
* files and \a total is 0. In the writing phase, \a current is the number
|
||||
* of processed files and \a total is the total number of files.
|
||||
*/
|
||||
void fileProgress(int current, int total);
|
||||
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the amount of processed data. It is only emitted in the writing phase.
|
||||
* \a current is the processed amount data and \a total is the total amount
|
||||
* of data to process. Both values never exceed 2^20.
|
||||
*/
|
||||
void dataProgress(int current, int total);
|
||||
|
||||
void result(const GpgME::DecryptionResult &decryptionResult,
|
||||
const GpgME::VerificationResult &verificationResult,
|
||||
const QString &auditLogAsHtml = {},
|
||||
|
@ -81,6 +81,23 @@ public:
|
||||
const GpgME::Context::EncryptionFlags flags) = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the number of files. In the scanning phase (i.e. while gpgtar checks
|
||||
* which files to put into the archive), \a current is the current number of
|
||||
* files and \a total is 0. In the writing phase, \a current is the number
|
||||
* of processed files and \a total is the total number of files.
|
||||
*/
|
||||
void fileProgress(int current, int total);
|
||||
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the amount of processed data. It is only emitted in the writing phase.
|
||||
* \a current is the processed amount data and \a total is the total amount
|
||||
* of data to process. Both values never exceed 2^20.
|
||||
*/
|
||||
void dataProgress(int current, int total);
|
||||
|
||||
void result(const GpgME::EncryptionResult &result,
|
||||
const QString &auditLogAsHtml = {},
|
||||
const GpgME::Error &auditLogError = {});
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include "job.h"
|
||||
|
||||
#include "qgpgme_debug.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace QGpgME
|
||||
@ -62,6 +64,25 @@ static T *jobPrivate(const Job *job) {
|
||||
return dynamic_cast<T *>(d);
|
||||
}
|
||||
|
||||
// Helper for the archive job classes
|
||||
template<class JobClass>
|
||||
void emitArchiveProgressSignals(JobClass *job, const QString &what, int type, int current, int total)
|
||||
{
|
||||
if (what != QLatin1String{"gpgtar"}) {
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case 'c':
|
||||
Q_EMIT job->fileProgress(current, total);
|
||||
break;
|
||||
case 's':
|
||||
Q_EMIT job->dataProgress(current, total);
|
||||
break;
|
||||
default:
|
||||
qCDebug(QGPGME_LOG) << job << __func__ << "Received progress for gpgtar with unknown type" << char(type);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // __QGPGME_JOB_P_H__
|
||||
|
@ -77,6 +77,9 @@ QGpgMEDecryptVerifyArchiveJob::QGpgMEDecryptVerifyArchiveJob(Context *context)
|
||||
{
|
||||
setJobPrivate(this, std::unique_ptr<QGpgMEDecryptVerifyArchiveJobPrivate>{new QGpgMEDecryptVerifyArchiveJobPrivate{this}});
|
||||
lateInitialization();
|
||||
connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
|
||||
emitArchiveProgressSignals(this, what, type, current, total);
|
||||
});
|
||||
}
|
||||
|
||||
static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify(Context *ctx,
|
||||
|
@ -78,6 +78,9 @@ QGpgMEEncryptArchiveJob::QGpgMEEncryptArchiveJob(Context *context)
|
||||
{
|
||||
setJobPrivate(this, std::unique_ptr<QGpgMEEncryptArchiveJobPrivate>{new QGpgMEEncryptArchiveJobPrivate{this}});
|
||||
lateInitialization();
|
||||
connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
|
||||
emitArchiveProgressSignals(this, what, type, current, total);
|
||||
});
|
||||
}
|
||||
|
||||
static QGpgMEEncryptArchiveJob::result_type encrypt(Context *ctx,
|
||||
|
@ -78,6 +78,9 @@ QGpgMESignArchiveJob::QGpgMESignArchiveJob(Context *context)
|
||||
{
|
||||
setJobPrivate(this, std::unique_ptr<QGpgMESignArchiveJobPrivate>{new QGpgMESignArchiveJobPrivate{this}});
|
||||
lateInitialization();
|
||||
connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
|
||||
emitArchiveProgressSignals(this, what, type, current, total);
|
||||
});
|
||||
}
|
||||
|
||||
static QGpgMESignArchiveJob::result_type sign(Context *ctx,
|
||||
|
@ -85,6 +85,9 @@ QGpgMESignEncryptArchiveJob::QGpgMESignEncryptArchiveJob(Context *context)
|
||||
{
|
||||
setJobPrivate(this, std::unique_ptr<QGpgMESignEncryptArchiveJobPrivate>{new QGpgMESignEncryptArchiveJobPrivate{this}});
|
||||
lateInitialization();
|
||||
connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
|
||||
emitArchiveProgressSignals(this, what, type, current, total);
|
||||
});
|
||||
}
|
||||
|
||||
static QGpgMESignEncryptArchiveJob::result_type sign_encrypt(Context *ctx,
|
||||
|
@ -80,6 +80,23 @@ public:
|
||||
const std::shared_ptr<QIODevice> &output) = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the number of files. In the scanning phase (i.e. while gpgtar checks
|
||||
* which files to put into the archive), \a current is the current number of
|
||||
* files and \a total is 0. In the writing phase, \a current is the number
|
||||
* of processed files and \a total is the total number of files.
|
||||
*/
|
||||
void fileProgress(int current, int total);
|
||||
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the amount of processed data. It is only emitted in the writing phase.
|
||||
* \a current is the processed amount data and \a total is the total amount
|
||||
* of data to process. Both values never exceed 2^20.
|
||||
*/
|
||||
void dataProgress(int current, int total);
|
||||
|
||||
void result(const GpgME::SigningResult &result,
|
||||
const QString &auditLogAsHtml = {},
|
||||
const GpgME::Error &auditLogError = {});
|
||||
|
@ -86,6 +86,23 @@ public:
|
||||
const GpgME::Context::EncryptionFlags flags) = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the number of files. In the scanning phase (i.e. while gpgtar checks
|
||||
* which files to put into the archive), \a current is the current number of
|
||||
* files and \a total is 0. In the writing phase, \a current is the number
|
||||
* of processed files and \a total is the total number of files.
|
||||
*/
|
||||
void fileProgress(int current, int total);
|
||||
|
||||
/**
|
||||
* This signal is emitted whenever gpgtar sends a progress status update for
|
||||
* the amount of processed data. It is only emitted in the writing phase.
|
||||
* \a current is the processed amount data and \a total is the total amount
|
||||
* of data to process. Both values never exceed 2^20.
|
||||
*/
|
||||
void dataProgress(int current, int total);
|
||||
|
||||
void result(const GpgME::SigningResult &signingResult,
|
||||
const GpgME::EncryptionResult &encryptionResult,
|
||||
const QString &auditLogAsHtml = {},
|
||||
|
Loading…
Reference in New Issue
Block a user