| 1 | // |
| 2 | // heapallocatorbrowser.h: Memory heap allocation |
| 3 | // |
| 4 | // by Jean-Paul Mari |
| 5 | // |
| 6 | |
| 7 | #ifndef __HEAPALLOCATORBROWSER_H__ |
| 8 | #define __HEAPALLOCATORBROWSER_H__ |
| 9 | |
| 10 | //#define HA_LAYOUTTEXTS // Use a layout with just texts |
| 11 | |
| 12 | #include <QtWidgets> |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | // Error code definitions |
| 16 | #define HA_NOERROR 0x00 |
| 17 | #define HA_ERROR 0x80 |
| 18 | #define HA_WARNING 0x40 |
| 19 | #define HA_UNABLENEXTMEMORYALLOC (0x01 | HA_ERROR) |
| 20 | #define HA_UNABLEALLOCATEMEMORYUSAGE (0x02 | HA_ERROR) |
| 21 | #define HA_MEMORYBLOCKSIZEPROBLEM (0x03 | HA_ERROR) |
| 22 | #define HA_MEMORYALLOCATIONPROBLEM (0x04 | HA_ERROR) |
| 23 | #define HA_HAANDSPSHARESPACE (0x05 | HA_ERROR) |
| 24 | #define HA_MEMORYALLOCATORNOTEXIST (0x06 | HA_WARNING) |
| 25 | #define HA_MEMORYALLOCATORNOTCOMPATIBLE (0x07 | HA_WARNING) |
| 26 | #define HA_MEMORYALLOCATORNOTINITIALIZED (0x08 | HA_WARNING) |
| 27 | |
| 28 | |
| 29 | // |
| 30 | class HeapAllocatorBrowserWindow: public QWidget |
| 31 | { |
| 32 | Q_OBJECT |
| 33 | |
| 34 | typedef struct HeapAllocation |
| 35 | { |
| 36 | uint32_t nextalloc; |
| 37 | uint32_t size; |
| 38 | uint16_t used; |
| 39 | } |
| 40 | S_HeapAllocation; |
| 41 | |
| 42 | public: |
| 43 | HeapAllocatorBrowserWindow(QWidget *parent = 0); |
| 44 | ~HeapAllocatorBrowserWindow(void); |
| 45 | |
| 46 | public slots: |
| 47 | void RefreshContents(void); |
| 48 | void Reset(void); |
| 49 | |
| 50 | protected: |
| 51 | void keyPressEvent(QKeyEvent *); |
| 52 | |
| 53 | private: |
| 54 | QVBoxLayout *layout; |
| 55 | #ifdef HA_LAYOUTTEXTS |
| 56 | QTextBrowser *text; |
| 57 | #else |
| 58 | QTableView *TableView; |
| 59 | QStandardItemModel *model; |
| 60 | QSortFilterProxyModel *proxyModel; |
| 61 | #endif |
| 62 | QStatusBar *statusbar; |
| 63 | size_t Adr; |
| 64 | }; |
| 65 | |
| 66 | #endif // __HEAPALLOCATORBROWSER_H__ |