feat: Added file information command line option and fullscreen view

This commit is contained in:
WerWolv
2025-08-24 21:21:34 +02:00
parent 0178ba014a
commit 66efcf91d3
13 changed files with 323 additions and 132 deletions

View File

@@ -0,0 +1,28 @@
#pragma once
#include <content/providers/file_provider.hpp>
#include <hex/api/task_manager.hpp>
#include <hex/helpers/magic.hpp>
#include <hex/ui/view.hpp>
#include <ui/markdown.hpp>
namespace hex::plugin::builtin {
class ViewFullScreenFileInfo : public View::FullScreen {
public:
explicit ViewFullScreenFileInfo(std::fs::path filePath);
void drawContent() override;
private:
std::fs::path m_filePath;
FileProvider m_provider;
TaskHolder m_analysisTask;
std::string m_mimeType;
std::string m_fileDescription;
std::vector<magic::FoundPattern> m_foundPatterns;
std::optional<ui::Markdown> m_fullDescription;
};
}

View File

@@ -9,6 +9,7 @@
#include <ui/text_editor.hpp>
#include <content/text_highlighting/pattern_language.hpp>
#include <hex/helpers/magic.hpp>
#include <ui/pattern_drawer.hpp>
namespace pl::ptrn { class Pattern; }
@@ -114,16 +115,10 @@ namespace hex::plugin::builtin {
u32 color;
};
struct PossiblePattern {
std::fs::path path;
std::string author;
std::string description;
};
std::unique_ptr<pl::PatternLanguage> m_editorRuntime;
std::mutex m_possiblePatternFilesMutex;
PerProvider<std::vector<PossiblePattern>> m_possiblePatternFiles;
PerProvider<std::vector<magic::FoundPattern>> m_possiblePatternFiles;
bool m_runAutomatically = false;
bool m_triggerEvaluation = false;
std::atomic<bool> m_triggerAutoEvaluate = false;