impr: Add auto backups to crash restore popup

This commit is contained in:
WerWolv
2025-11-29 09:06:49 +01:00
parent 95ff52b025
commit 2c7da65242
4 changed files with 106 additions and 49 deletions

View File

@@ -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();
/**