cutter/src/widgets/ResourcesWidget.h
karliss 567f852c3a
Common behaviour for lists with items that have address part 2 (#1718)
* Seperate addressable item list widget from ListDockWidget.
* Convert ResourceWidget, strings widget, flags widget, search widget, MemoryMapWidget, xrefs dialog
* Don't silently overwrite comment in add comment action.
2019-09-02 00:30:25 +03:00

55 lines
1.4 KiB
C++

#ifndef RESOURCESWIDGET_H
#define RESOURCESWIDGET_H
#include "core/Cutter.h"
#include "CutterDockWidget.h"
#include "CutterTreeView.h"
#include "common/AddressableItemModel.h"
#include "widgets/ListDockWidget.h"
class MainWindow;
class ResourcesWidget;
class ResourcesModel : public AddressableItemModel<QAbstractListModel>
{
Q_OBJECT
friend ResourcesWidget;
private:
QList<ResourcesDescription> *resources;
public:
enum Columns { INDEX = 0, NAME, VADDR, TYPE, SIZE, LANG, COUNT };
explicit ResourcesModel(QList<ResourcesDescription> *resources, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
RVA address(const QModelIndex &index) const override;
};
class ResourcesWidget : public ListDockWidget
{
Q_OBJECT
private:
ResourcesModel *model;
AddressableFilterProxyModel *filterModel;
CutterTreeView *view;
QList<ResourcesDescription> resources;
public:
explicit ResourcesWidget(MainWindow *main, QAction *action = nullptr);
private slots:
void refreshResources();
};
#endif // RESOURCESWIDGET_H