cutter/src/widgets/ExportsWidget.h

76 lines
1.8 KiB
C
Raw Normal View History

#ifndef EXPORTSWIDGET_H
#define EXPORTSWIDGET_H
#include <memory>
#include "core/Cutter.h"
#include "CutterDockWidget.h"
#include "widgets/ListDockWidget.h"
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
class MainWindow;
class QTreeWidget;
class ExportsWidget;
2018-03-21 20:32:32 +00:00
namespace Ui {
class ExportsWidget;
}
class ExportsModel : public AddressableItemModel<QAbstractListModel>
{
Q_OBJECT
friend ExportsWidget;
private:
QList<ExportDescription> *exports;
public:
enum Column { OffsetColumn = 0, SizeColumn, TypeColumn, NameColumn, CommentColumn, ColumnCount };
enum Role { ExportDescriptionRole = Qt::UserRole };
ExportsModel(QList<ExportDescription> *exports, 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;
QString name(const QModelIndex &index) const override;
};
class ExportsProxyModel : public AddressableFilterProxyModel
{
Q_OBJECT
public:
ExportsProxyModel(ExportsModel *source_model, QObject *parent = nullptr);
protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
};
class ExportsWidget : public ListDockWidget
{
Q_OBJECT
public:
explicit ExportsWidget(MainWindow *main);
~ExportsWidget();
private slots:
void refreshExports();
private:
ExportsModel *exportsModel;
2018-04-24 18:40:40 +00:00
ExportsProxyModel *exportsProxyModel;
QList<ExportDescription> exports;
};
#endif // EXPORTSWIDGET_H