2018-02-26 22:26:18 +00:00
|
|
|
#ifndef VTABLESWIDGET_H
|
|
|
|
#define VTABLESWIDGET_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <QTreeView>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/Cutter.h"
|
2018-03-16 21:46:57 +00:00
|
|
|
#include "CutterDockWidget.h"
|
2018-10-10 12:34:46 +00:00
|
|
|
#include "CutterTreeWidget.h"
|
2018-02-26 22:26:18 +00:00
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
namespace Ui {
|
|
|
|
class VTablesWidget;
|
2018-02-26 22:26:18 +00:00
|
|
|
}
|
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
class MainWindow;
|
2018-10-10 11:33:55 +00:00
|
|
|
class VTablesWidget;
|
2018-03-16 21:46:57 +00:00
|
|
|
|
2018-02-26 22:26:18 +00:00
|
|
|
class VTableModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
friend VTablesWidget;
|
|
|
|
|
2018-02-26 22:26:18 +00:00
|
|
|
private:
|
|
|
|
QList<VTableDescription> *vtables;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Columns { NAME = 0, ADDRESS, COUNT };
|
2018-03-03 11:23:53 +00:00
|
|
|
static const int VTableDescriptionRole = Qt::UserRole;
|
2018-02-26 22:26:18 +00:00
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
VTableModel(QList<VTableDescription> *vtables, QObject *parent = nullptr);
|
2018-02-26 22:26:18 +00:00
|
|
|
|
|
|
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
QModelIndex parent(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
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 VTableSortFilterProxyModel : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
public:
|
2018-03-21 20:32:32 +00:00
|
|
|
VTableSortFilterProxyModel(VTableModel *model, QObject *parent = nullptr);
|
2018-02-26 22:26:18 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
|
|
|
};
|
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
class VTablesWidget : public CutterDockWidget
|
2018-02-26 22:26:18 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-03-16 21:46:57 +00:00
|
|
|
explicit VTablesWidget(MainWindow *main, QAction *action = nullptr);
|
2018-02-26 22:26:18 +00:00
|
|
|
~VTablesWidget();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void refreshVTables();
|
2018-03-03 11:23:53 +00:00
|
|
|
void on_vTableTreeView_doubleClicked(const QModelIndex &index);
|
2018-02-26 22:26:18 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::VTablesWidget> ui;
|
|
|
|
|
|
|
|
VTableModel *model;
|
|
|
|
QSortFilterProxyModel *proxy;
|
|
|
|
QList<VTableDescription> vtables;
|
2018-10-10 12:34:46 +00:00
|
|
|
CutterTreeWidget *tree;
|
2018-02-26 22:26:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTABLESWIDGET_H
|