1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef STEPSPANE_H |
6 | #define STEPSPANE_H |
7 | |
8 | #include "configutil.h" |
9 | |
10 | #include <QWidget> |
11 | #include <QAbstractTableModel> |
12 | |
13 | class StepsModelPrivate; |
14 | class StepsModel : public QAbstractTableModel |
15 | { |
16 | public: |
17 | enum ColumnType |
18 | { |
19 | kCheckBox, |
20 | kTarget, |
21 | kPath, |
22 | kColumnCount |
23 | }; |
24 | |
25 | explicit StepsModel(QObject *parent = nullptr); |
26 | ~StepsModel() override; |
27 | |
28 | int rowCount(const QModelIndex &) const override; |
29 | int columnCount(const QModelIndex &) const override; |
30 | QVariant data(const QModelIndex &index, int role) const override; |
31 | QVariant (int section, Qt::Orientation orientation, int role) const override; |
32 | Qt::ItemFlags flags(const QModelIndex &index) const override; |
33 | bool setData(const QModelIndex &index, const QVariant &value, int role) override; |
34 | |
35 | void setData(const QMap<QString, bool> &data); |
36 | QString getSelectedTarget(); |
37 | |
38 | private: |
39 | StepsModelPrivate *const d; |
40 | }; |
41 | |
42 | class StepsPanePrivate; |
43 | class StepsPane : public QWidget |
44 | { |
45 | Q_OBJECT |
46 | |
47 | public: |
48 | explicit StepsPane( QWidget *parent = nullptr); |
49 | ~StepsPane(); |
50 | |
51 | void setValues(const config::StepItem &item); |
52 | void getValues(config::StepItem &item); |
53 | |
54 | private: |
55 | void setupUi(); |
56 | QString getCombinedBuildText(); |
57 | void updateSummaryText(); |
58 | |
59 | void toolArgumentsEdited(); |
60 | void dataChanged(); |
61 | |
62 | StepsPanePrivate *const d; |
63 | }; |
64 | |
65 | |
66 | #endif // STEPSPANE_H |
67 | |