mirror of
https://github.com/obhq/obliteration.git
synced 2024-11-23 11:19:56 +00:00
36 lines
821 B
C++
36 lines
821 B
C++
#include "pkg_extractor.hpp"
|
|
|
|
PkgExtractor::PkgExtractor(Rust<Pkg> &&pkg, std::string &&dst) :
|
|
m_pkg(std::move(pkg)),
|
|
m_dst(std::move(dst))
|
|
{
|
|
}
|
|
|
|
PkgExtractor::~PkgExtractor()
|
|
{
|
|
}
|
|
|
|
void PkgExtractor::exec()
|
|
{
|
|
Rust<RustError> e;
|
|
|
|
e = pkg_extract(
|
|
m_pkg,
|
|
m_dst.c_str(),
|
|
[](const char *status, std::size_t bar, std::uint64_t current, std::uint64_t total, void *ud) {
|
|
reinterpret_cast<PkgExtractor *>(ud)->update(status, bar, current, total);
|
|
},
|
|
this);
|
|
|
|
if (e) {
|
|
emit finished(error_message(e));
|
|
} else {
|
|
emit finished(QString());
|
|
}
|
|
}
|
|
|
|
void PkgExtractor::update(const char *status, std::size_t bar, std::uint64_t current, std::uint64_t total)
|
|
{
|
|
emit statusChanged(status ? QString(status) : QString(), bar, current, total);
|
|
}
|