2018-06-06 11:05:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <memory>
|
|
|
|
#include <QStandardItem>
|
|
|
|
#include <QTableView>
|
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/Cutter.h"
|
2018-06-06 11:05:20 +00:00
|
|
|
#include "CutterDockWidget.h"
|
2019-09-25 14:18:30 +00:00
|
|
|
#include "menus/AddressableItemContextMenu.h"
|
2018-06-06 11:05:20 +00:00
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class StackWidget;
|
|
|
|
}
|
|
|
|
|
2019-10-06 17:35:44 +00:00
|
|
|
class StackModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
struct Item {
|
|
|
|
RVA offset;
|
|
|
|
QString value;
|
|
|
|
QString description;
|
|
|
|
QVariant descriptionColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Column { OffsetColumn = 0, ValueColumn, DescriptionColumn, ColumnCount};
|
|
|
|
enum Role { StackDescriptionRole = Qt::UserRole };
|
|
|
|
|
|
|
|
StackModel(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
void reload();
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QVector<Item> values;
|
|
|
|
|
|
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(StackModel::Item)
|
|
|
|
|
2018-06-06 11:05:20 +00:00
|
|
|
class StackWidget : public CutterDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit StackWidget(MainWindow *main, QAction *action = nullptr);
|
|
|
|
~StackWidget();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void updateContents();
|
|
|
|
void setStackGrid();
|
2018-07-18 10:15:10 +00:00
|
|
|
void fontsUpdatedSlot();
|
2018-07-24 23:15:38 +00:00
|
|
|
void onDoubleClicked(const QModelIndex &index);
|
|
|
|
void customMenuRequested(QPoint pos);
|
|
|
|
void editStack();
|
2019-09-25 14:18:30 +00:00
|
|
|
void onCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
2018-06-06 11:05:20 +00:00
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::StackWidget> ui;
|
2019-10-06 17:35:44 +00:00
|
|
|
QTableView *viewStack = new QTableView(this);
|
|
|
|
StackModel *modelStack = new StackModel(this);
|
2018-07-24 23:15:38 +00:00
|
|
|
QAction *editAction;
|
2019-09-25 14:18:30 +00:00
|
|
|
QAction menuText;
|
2019-01-13 18:11:59 +00:00
|
|
|
RefreshDeferrer *refreshDeferrer;
|
2019-09-25 14:18:30 +00:00
|
|
|
AddressableItemContextMenu addressableItemContextMenu;
|
2019-10-06 17:35:44 +00:00
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
};
|