mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 13:05:25 -05:00
views: Add simple pattern, library and magics store
This commit is contained in:
@@ -2,24 +2,53 @@
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <hex/views/view.hpp>
|
||||
#include <hex/helpers/net.hpp>
|
||||
#include <hex/helpers/paths.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <future>
|
||||
#include <string>
|
||||
|
||||
namespace hex {
|
||||
|
||||
namespace prv { class Provider; }
|
||||
struct StoreEntry {
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string fileName;
|
||||
std::string link;
|
||||
std::string hash;
|
||||
|
||||
class ViewTools : public View {
|
||||
bool downloading;
|
||||
bool installed;
|
||||
bool hasUpdate;
|
||||
};
|
||||
|
||||
class ViewStore : public View {
|
||||
public:
|
||||
ViewTools();
|
||||
~ViewTools() override;
|
||||
ViewStore();
|
||||
~ViewStore() override;
|
||||
|
||||
void drawContent() override;
|
||||
void drawMenu() override;
|
||||
|
||||
bool isAvailable() override { return true; }
|
||||
bool hasViewMenuItemEntry() override { return false; }
|
||||
|
||||
private:
|
||||
Net m_net;
|
||||
std::future<Response<std::string>> m_apiRequest;
|
||||
std::future<Response<void>> m_download;
|
||||
|
||||
std::vector<StoreEntry> m_patterns, m_magics, m_includes;
|
||||
|
||||
void drawStore();
|
||||
|
||||
void refresh();
|
||||
void parseResponse();
|
||||
|
||||
void download(ImHexPath pathType, const std::string &fileName, const std::string &url, bool update);
|
||||
void remove(ImHexPath pathType, const std::string &fileName);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user