summaryrefslogtreecommitdiff
path: root/examples/triage/entropy.h
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2019-04-02 15:30:45 -0400
committerRusty Wagner <rusty@vector35.com>2019-04-02 15:36:40 -0400
commit73a9399f5d1d86c7e291498b7fe836550f2f76ab (patch)
treee7c7cfe9a2f27a93ddac41cf600e7bc1fc638a83 /examples/triage/entropy.h
parentc17af471c48ea092434917c803f9c88fe91022a6 (diff)
Add a C++ version of the triage plugin (no Makefile yet)
Diffstat (limited to 'examples/triage/entropy.h')
-rw-r--r--examples/triage/entropy.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/triage/entropy.h b/examples/triage/entropy.h
new file mode 100644
index 00000000..abe591b4
--- /dev/null
+++ b/examples/triage/entropy.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <QtWidgets/QWidget>
+#include <QtGui/QImage>
+#include <thread>
+#include "uitypes.h"
+
+
+class EntropyThread
+{
+ BinaryViewRef m_data;
+ QImage m_image;
+ size_t m_blockSize;
+ bool m_updated, m_running;
+ std::thread m_thread;
+
+public:
+ EntropyThread(BinaryViewRef data, int width, size_t blockSize);
+ ~EntropyThread();
+
+ void Run();
+ bool IsUpdated() { return m_updated; }
+ void ResetUpdated() { m_updated = false; }
+
+ const QImage& GetImage() { return m_image; }
+};
+
+
+class TriageView;
+
+class EntropyWidget: public QWidget
+{
+ TriageView* m_view;
+ BinaryViewRef m_data, m_rawData;
+ size_t m_blockSize;
+ int m_width;
+ EntropyThread* m_thread;
+
+public:
+ EntropyWidget(QWidget* parent, TriageView* view, BinaryViewRef data);
+ virtual ~EntropyWidget();
+
+ virtual QSize sizeHint() const override;
+
+protected:
+ virtual void paintEvent(QPaintEvent* event) override;
+ virtual void mousePressEvent(QMouseEvent* event) override;
+
+private Q_SLOTS:
+ void timerExpired();
+};