1 #ifndef RESOURCESWIDGET_H
2 #define RESOURCESWIDGET_H
3 
4 #include "core/Cutter.h"
5 #include "CutterDockWidget.h"
6 #include "CutterTreeView.h"
7 #include "common/AddressableItemModel.h"
8 #include "widgets/ListDockWidget.h"
9 
10 
11 class MainWindow;
12 class ResourcesWidget;
13 
14 class ResourcesModel : public AddressableItemModel<QAbstractListModel>
15 {
16     Q_OBJECT
17 
18     friend ResourcesWidget;
19 
20 private:
21     QList<ResourcesDescription> *resources;
22 
23 public:
24     enum Columns { INDEX = 0, NAME, VADDR, TYPE, SIZE, LANG, COMMENT, COUNT };
25     explicit ResourcesModel(QList<ResourcesDescription> *resources, QObject *parent = nullptr);
26 
27     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
28     int columnCount(const QModelIndex &parent = QModelIndex()) const override;
29 
30     QVariant data(const QModelIndex &index, int role) const override;
31     QVariant headerData(int section, Qt::Orientation orientation,
32                         int role = Qt::DisplayRole) const override;
33 
34     RVA address(const QModelIndex &index) const override;
35 };
36 
37 class ResourcesWidget : public ListDockWidget
38 {
39     Q_OBJECT
40 
41 private:
42     ResourcesModel *model;
43     AddressableFilterProxyModel *filterModel;
44     QList<ResourcesDescription> resources;
45 
46 public:
47     explicit ResourcesWidget(MainWindow *main);
48 
49 private slots:
50     void refreshResources();
51 };
52 
53 #endif // RESOURCESWIDGET_H
54