mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
impr: Add auto backups to crash restore popup
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <wolv/io/fs.hpp>
|
||||
#include <hex/ui/popup.hpp>
|
||||
|
||||
namespace hex::plugin::builtin::recent {
|
||||
|
||||
@@ -53,6 +54,31 @@ namespace hex::plugin::builtin::recent {
|
||||
|
||||
};
|
||||
|
||||
class PopupAutoBackups : public Popup<PopupAutoBackups> {
|
||||
private:
|
||||
struct BackupEntry {
|
||||
std::string displayName;
|
||||
std::fs::path path;
|
||||
std::tm time;
|
||||
|
||||
bool operator<(const BackupEntry& other) const {
|
||||
auto a = this->time;
|
||||
auto b = other.time;
|
||||
return std::mktime(&a) < std::mktime(&b);
|
||||
}
|
||||
};
|
||||
public:
|
||||
PopupAutoBackups();
|
||||
|
||||
void drawContent() override;
|
||||
[[nodiscard]] ImGuiWindowFlags getFlags() const override;
|
||||
|
||||
static std::vector<BackupEntry> getAutoBackups();
|
||||
|
||||
private:
|
||||
std::vector<BackupEntry> m_backups;
|
||||
};
|
||||
|
||||
void registerEventHandlers();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user