1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

HexEditor: Save and load annotations to/from JSON files

This is a fairly simple JSON format: A single array, containing objects,
with the Annotation fields as key:value pairs.

When reading a file, we let invalid or missing keys fall back to the
default values. This is mostly intended to set a pattern so that if we
add new fields in the future, we won't fail to load old annotations
files. If loading the file fails though, we keep the previously loaded
set of annotations.
This commit is contained in:
Sam Atkins 2024-01-30 12:33:36 +00:00 committed by Sam Atkins
parent b2bb7d919d
commit 56caee44e3
4 changed files with 110 additions and 0 deletions

View file

@ -53,6 +53,7 @@ private:
ByteString m_path;
ByteString m_name;
ByteString m_extension;
ByteString m_annotations_path;
int m_goto_history { 0 };
String m_search_text;
@ -64,6 +65,9 @@ private:
RefPtr<GUI::Action> m_open_action;
RefPtr<GUI::Action> m_save_action;
RefPtr<GUI::Action> m_save_as_action;
RefPtr<GUI::Action> m_open_annotations_action;
RefPtr<GUI::Action> m_save_annotations_action;
RefPtr<GUI::Action> m_save_annotations_as_action;
RefPtr<GUI::Action> m_undo_action;
RefPtr<GUI::Action> m_redo_action;