1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef BREAKPOINTMODEL_H
6#define BREAKPOINTMODEL_H
7
8#include "breakpoint.h"
9#include "breakpointitem.h"
10#include "stackframemodel.h"
11
12#include <QAbstractItemModel>
13
14class BreakpointModel : public QAbstractTableModel
15{
16 Q_OBJECT
17
18public:
19 explicit BreakpointModel(QObject *parent = nullptr);
20 ~BreakpointModel() override;
21
22 void setBreakpoints(const Internal::Breakpoints &breakpoints, bool canExpand = false);
23 void insertBreakpoint(const Internal::Breakpoint &breakpoint);
24 void removeBreakpoint(const Internal::Breakpoint &breakpoint);
25
26 void setCurrentIndex(int index);
27 const Internal::Breakpoint &BreakpointAt(int index) const{ return bps.at(index).breakpoint(); }
28 int breakpointSize() const { return bps.size(); }
29 void removeAll();
30 QAbstractItemModel *model() { return this; }
31 bool isContentsValid() const { return contentsValid; }
32 Internal::Breakpoint currentBreakpoint() const;
33signals:
34 void breakpointChanged();
35 void currentIndexChanged();
36
37private:
38 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
39 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
40 QVariant data(const QModelIndex &index, int role) const override;
41 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
42 bool setData(const QModelIndex &idx, const QVariant &data, int role) override;
43
44// Internal::Breakpoints bps;
45 BreakpointItems bps;
46 int currentIndex = -1;
47 bool canExpand = false;
48 bool contentsValid = false;
49};
50
51#endif // BREAKPOINTMODEL_H
52