2017-03-29 10:18:37 +00:00
|
|
|
#ifndef SECTIONSWIDGET_H
|
|
|
|
#define SECTIONSWIDGET_H
|
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
#include <memory>
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QSortFilterProxyModel>
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
#include "Cutter.h"
|
|
|
|
#include "CutterDockWidget.h"
|
|
|
|
|
2018-11-10 09:17:52 +00:00
|
|
|
class CutterTreeView;
|
2018-05-03 07:52:30 +00:00
|
|
|
class QAbstractItemView;
|
|
|
|
class MainWindow;
|
2018-10-10 11:33:55 +00:00
|
|
|
class SectionsWidget;
|
2018-10-20 18:20:06 +00:00
|
|
|
class QuickFilterView;
|
2017-05-03 09:09:57 +00:00
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
class SectionsModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
friend SectionsWidget;
|
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
private:
|
|
|
|
QList<SectionDescription> *sections;
|
|
|
|
|
|
|
|
public:
|
2018-05-05 10:11:44 +00:00
|
|
|
enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, EntropyColumn, ColumnCount };
|
2018-05-03 07:52:30 +00:00
|
|
|
enum Role { SectionDescriptionRole = Qt::UserRole };
|
|
|
|
|
2018-05-04 07:58:32 +00:00
|
|
|
SectionsModel(QList<SectionDescription> *sections, QObject *parent = nullptr);
|
2018-05-03 07:52:30 +00:00
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SectionsProxyModel : public QSortFilterProxyModel
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-05-04 07:58:32 +00:00
|
|
|
SectionsProxyModel(SectionsModel *sourceModel, QObject *parent = nullptr);
|
2017-04-13 15:14:02 +00:00
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
protected:
|
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SectionsWidget : public CutterDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-05-03 07:52:30 +00:00
|
|
|
public:
|
2018-05-04 07:58:32 +00:00
|
|
|
explicit SectionsWidget(MainWindow *main, QAction *action = nullptr);
|
2018-05-03 07:52:30 +00:00
|
|
|
~SectionsWidget();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void refreshSections();
|
2018-02-02 15:56:39 +00:00
|
|
|
void onSectionsDoubleClicked(const QModelIndex &index);
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private:
|
2018-05-03 07:52:30 +00:00
|
|
|
QList<SectionDescription> sections;
|
|
|
|
SectionsModel *sectionsModel;
|
2018-11-10 09:17:52 +00:00
|
|
|
CutterTreeView *sectionsTable;
|
2018-05-03 07:52:30 +00:00
|
|
|
MainWindow *main;
|
2018-10-20 18:20:06 +00:00
|
|
|
QWidget *dockWidgetContents;
|
|
|
|
QuickFilterView *quickFilterView;
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SECTIONSWIDGET_H
|