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"
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
class BreakpointModel: public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
friend BreakpointWidget;
|
|
|
|
|
2018-06-22 08:45:00 +00:00
|
|
|
private:
|
|
|
|
QList<BreakpointDescription> *breakpoints;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Column { AddrColumn = 0, PermColumn, HwColumn, TraceColumn, EnabledColumn, ColumnCount };
|
|
|
|
enum Role { BreakpointDescriptionRole = Qt::UserRole };
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
BreakpointModel(QList<BreakpointDescription> *breakpoints, QObject *parent = nullptr);
|
2018-06-22 08:45:00 +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 BreakpointProxyModel : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
BreakpointProxyModel(BreakpointModel *sourceModel, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
|
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BreakpointWidget : public CutterDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit BreakpointWidget(MainWindow *main, QAction *action = nullptr);
|
|
|
|
~BreakpointWidget();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_breakpointTreeView_doubleClicked(const QModelIndex &index);
|
|
|
|
void showBreakpointContextMenu(const QPoint &pt);
|
|
|
|
void delBreakpoint();
|
|
|
|
void toggleBreakpoint();
|
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;
|
|
|
|
|
|
|
|
void setScrollMode();
|
2019-01-13 18:11:59 +00:00
|
|
|
|
|
|
|
RefreshDeferrer *refreshDeferrer;
|
2018-06-22 08:45:00 +00:00
|
|
|
};
|