mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
ui: Added global running tasks progress bar
This commit is contained in:
@@ -71,8 +71,19 @@ namespace hex::plugin::builtin {
|
||||
std::thread([this]{
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
auto task = ImHexApi::Tasks::createTask("hex.builtin.view.information.analyzing", provider->getSize());
|
||||
|
||||
this->m_analyzedRegion = { provider->getBaseAddress(), provider->getBaseAddress() + provider->getSize() };
|
||||
|
||||
{
|
||||
magic::compile();
|
||||
|
||||
this->m_fileDescription = magic::getDescription(provider);
|
||||
this->m_mimeType = magic::getMIMEType(provider);
|
||||
}
|
||||
|
||||
this->m_dataValid = true;
|
||||
|
||||
{
|
||||
this->m_blockSize = std::max<u32>(std::ceil(provider->getSize() / 2048.0F), 256);
|
||||
std::vector<u8> buffer(this->m_blockSize, 0x00);
|
||||
@@ -90,22 +101,13 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
this->m_blockEntropy.push_back(calculateEntropy(blockValueCounts, this->m_blockSize));
|
||||
|
||||
this->m_bytesAnalyzed = i;
|
||||
task.update(i);
|
||||
}
|
||||
|
||||
this->m_averageEntropy = calculateEntropy(this->m_valueCounts, provider->getSize());
|
||||
this->m_highestBlockEntropy = *std::max_element(this->m_blockEntropy.begin(), this->m_blockEntropy.end());
|
||||
}
|
||||
|
||||
{
|
||||
magic::compile();
|
||||
|
||||
this->m_fileDescription = magic::getDescription(provider);
|
||||
this->m_mimeType = magic::getMIMEType(provider);
|
||||
this->m_dataValid = true;
|
||||
}
|
||||
|
||||
this->m_analyzing = false;
|
||||
}).detach();
|
||||
}
|
||||
@@ -127,10 +129,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (this->m_analyzing) {
|
||||
ImGui::TextSpinner("hex.builtin.view.information.analyzing"_lang);
|
||||
ImGui::ProgressBar(this->m_bytesAnalyzed / static_cast<double>(provider->getSize()));
|
||||
} else {
|
||||
ImGui::NewLine();
|
||||
ImGui::NewLine();
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
Reference in New Issue
Block a user