From d20ff6c89151641dd454bcdeb139083d401cdad7 Mon Sep 17 00:00:00 2001 From: Eli Youngs Date: Sat, 16 Apr 2022 15:00:27 -0700 Subject: [PATCH] HexEditor: Show endianness in the value inspector --- Userland/Applications/HexEditor/HexEditorWidget.cpp | 2 +- Userland/Applications/HexEditor/ValueInspectorModel.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index adee507072..8698d7ebfe 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -275,7 +275,7 @@ void HexEditorWidget::update_inspector_values(size_t position) } // Populate the model - NonnullRefPtr value_inspector_model = make_ref_counted(); + NonnullRefPtr value_inspector_model = make_ref_counted(m_value_inspector_little_endian); if (byte_read_count >= 1) { u8 unsigned_byte_value = 0; if (m_value_inspector_little_endian) diff --git a/Userland/Applications/HexEditor/ValueInspectorModel.h b/Userland/Applications/HexEditor/ValueInspectorModel.h index b01e114708..de38cfd4fb 100644 --- a/Userland/Applications/HexEditor/ValueInspectorModel.h +++ b/Userland/Applications/HexEditor/ValueInspectorModel.h @@ -34,7 +34,8 @@ public: Value }; - explicit ValueInspectorModel() + explicit ValueInspectorModel(bool is_little_endian) + : m_is_little_endian(is_little_endian) { for (int i = 0; i < ValueType::__Count; i++) set_parsed_value(static_cast(i), ""); @@ -61,7 +62,7 @@ public: case Column::Type: return "Type"; case Column::Value: - return "Value"; + return m_is_little_endian ? "Value (Little Endian)" : "Value (Big Endian)"; } VERIFY_NOT_REACHED(); } @@ -131,5 +132,6 @@ public: } private: + bool m_is_little_endian = false; Array m_values = {}; };