mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
ui: Added global running tasks progress bar
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <hex/helpers/concepts.hpp>
|
||||
#include <hex/api/task.hpp>
|
||||
|
||||
namespace hex {
|
||||
|
||||
@@ -15,7 +16,6 @@ namespace hex {
|
||||
namespace ImHexApi {
|
||||
namespace Common {
|
||||
|
||||
void sayHello();
|
||||
void closeImHex(bool noQuestions = false);
|
||||
void restartImHex();
|
||||
|
||||
@@ -55,6 +55,12 @@ namespace hex {
|
||||
|
||||
};
|
||||
|
||||
namespace Tasks {
|
||||
|
||||
Task createTask(const std::string &unlocalizedName, u64 maxValue);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
28
plugins/libimhex/include/hex/api/task.hpp
Normal file
28
plugins/libimhex/include/hex/api/task.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace hex {
|
||||
|
||||
class Task {
|
||||
public:
|
||||
Task(const std::string& unlocalizedName, u64 maxValue);
|
||||
~Task();
|
||||
|
||||
void update(u64 currValue);
|
||||
void finish();
|
||||
|
||||
[[nodiscard]]
|
||||
double getProgress() const;
|
||||
|
||||
[[nodiscard]]
|
||||
const std::string& getName() const;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
u64 m_maxValue, m_currValue;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/task.hpp>
|
||||
#include <hex/views/view.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
@@ -77,6 +79,9 @@ namespace hex {
|
||||
static std::vector<ContentRegistry::Interface::DrawCallback> footerItems;
|
||||
static std::vector<ContentRegistry::Interface::DrawCallback> toolbarItems;
|
||||
|
||||
static std::mutex tasksMutex;
|
||||
static std::list<Task*> runningTasks;
|
||||
|
||||
static std::vector<std::string> providerNames;
|
||||
|
||||
static std::vector<ContentRegistry::DataProcessorNode::impl::Entry> dataProcessorNodes;
|
||||
|
||||
Reference in New Issue
Block a user