2018-06-22 08:45:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/Cutter.h"
|
2018-06-22 08:45:00 +00:00
|
|
|
#include "CutterDockWidget.h"
|
2019-12-26 20:51:55 +00:00
|
|
|
#include "AddressableItemModel.h"
|
2018-06-22 08:45:00 +00:00
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
class QTreeWidget;
|
|
|
|
|
2018-09-30 20:00:53 +00:00
|
|
|
namespace Ui {
|
|
|
|
class BreakpointWidget;
|
2018-06-22 08:45:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
class QTreeWidgetItem;
|
2018-10-10 11:33:55 +00:00
|
|
|
class BreakpointWidget;
|
2018-06-22 08:45:00 +00:00
|
|
|
|
2019-12-26 20:51:55 +00:00
|
|
|
class BreakpointModel: public AddressableItemModel<QAbstractListModel>
|
2018-06-22 08:45:00 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
friend BreakpointWidget;
|
|
|
|
|
2018-06-22 08:45:00 +00:00
|
|
|
private:
|
2019-12-26 20:51:55 +00:00
|
|
|
QList<BreakpointDescription> breakpoints;
|
2018-06-22 08:45:00 +00:00
|
|
|
|
|
|
|
public:
|
2020-11-19 18:17:28 +00:00
|
|
|
enum Column { AddrColumn = 0, NameColumn, TypeColumn, TraceColumn, EnabledColumn, CommentColumn, ColumnCount };
|
2018-06-22 08:45:00 +00:00
|
|
|
enum Role { BreakpointDescriptionRole = Qt::UserRole };
|
|
|
|
|
2019-12-26 20:51:55 +00:00
|
|
|
BreakpointModel(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
void refresh();
|
|
|
|
|
|
|
|
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 = Qt::EditRole) override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
2018-06-22 08:45:00 +00:00
|
|
|
|
|
|
|
|
2019-12-26 20:51:55 +00:00
|
|
|
RVA address(const QModelIndex &index) const override;
|
2018-06-22 08:45:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-12-26 20:51:55 +00:00
|
|
|
class BreakpointProxyModel : public AddressableFilterProxyModel
|
2018-06-22 08:45:00 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
BreakpointProxyModel(BreakpointModel *sourceModel, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BreakpointWidget : public CutterDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-05-22 11:49:34 +00:00
|
|
|
explicit BreakpointWidget(MainWindow *main);
|
2018-06-22 08:45:00 +00:00
|
|
|
~BreakpointWidget();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void delBreakpoint();
|
|
|
|
void toggleBreakpoint();
|
2020-01-04 18:05:49 +00:00
|
|
|
void editBreakpoint();
|
2018-06-26 07:38:44 +00:00
|
|
|
void addBreakpointDialog();
|
2018-06-22 08:45:00 +00:00
|
|
|
void refreshBreakpoint();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::BreakpointWidget> ui;
|
|
|
|
|
|
|
|
BreakpointModel *breakpointModel;
|
|
|
|
BreakpointProxyModel *breakpointProxyModel;
|
|
|
|
QList<BreakpointDescription> breakpoints;
|
|
|
|
QAction *actionDelBreakpoint = nullptr;
|
|
|
|
QAction *actionToggleBreakpoint = nullptr;
|
2020-01-04 18:05:49 +00:00
|
|
|
QAction *actionEditBreakpoint = nullptr;
|
2018-06-22 08:45:00 +00:00
|
|
|
|
|
|
|
void setScrollMode();
|
2019-12-26 20:51:55 +00:00
|
|
|
QVector<RVA> getSelectedAddresses() const;
|
2019-01-13 18:11:59 +00:00
|
|
|
|
|
|
|
RefreshDeferrer *refreshDeferrer;
|
2019-12-26 20:51:55 +00:00
|
|
|
bool editing = false;
|
2018-06-22 08:45:00 +00:00
|
|
|
};
|