-
Notifications
You must be signed in to change notification settings - Fork 83
/
DataProcessDialog.h
155 lines (107 loc) · 3.87 KB
/
DataProcessDialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//
// Created by chang on 2021/6/14.
//
#ifndef SERIALWIZARD_DATAPROCESSDIALOG_H
#define SERIALWIZARD_DATAPROCESSDIALOG_H
#include <QDialog>
class QLabel;
class QTextEdit;
class QLineEdit;
class QRadioButton;
class QCheckBox;
class QPushButton;
class DataProcessDialog : public QDialog {
Q_OBJECT
public:
explicit DataProcessDialog(const QString &text = "", QWidget *parent = nullptr,
Qt::WindowFlags f = Qt::WindowFlags());
~DataProcessDialog() override;
enum class MatchPositionType {
First = 0,
Last,
Middle,
};
enum class LineReturn {
RN = 0,
R,
N,
Space,
None,
Custom
};
QString text();
QString matchText();
int fromIndex();
bool includeMatchText();
int matchPosition();
MatchPositionType matchPositionType();
LineReturn lineReturn();
int matchLineCount();
QList<int> getMatchIndexList();
QStringList getMatchIndexTextList();
protected:
void keyPressEvent(QKeyEvent *) override;
void closeEvent(QCloseEvent *event) override;
void dropEvent(QDropEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
public Q_SLOT:
void replaceLineReturn();
void splitLine();
void deleteFrame();
private:
void createUi();
void readSettings();
void writeSettings();
void createConnect();
void processText(QString (*p)(DataProcessDialog *, const QString &));
void processDeleteLines(bool (*p)(DataProcessDialog *, const QString &));
void processKeepLines(bool (*p)(DataProcessDialog *, const QString &));
QTextEdit *textEdit{nullptr};
QLabel *lineCountLabel{nullptr};
QLabel *charCountLabel{nullptr};
QPushButton *simplifiedButton;
QLineEdit *fromIndexLineEdit{nullptr};
QRadioButton *matchFirstRadioButton{nullptr};
QRadioButton *matchLastRadioButton{nullptr};
QRadioButton *matchMiddleRadioButton{nullptr};
QLineEdit *matchPositionLineEdit{nullptr};
QCheckBox *includeMatchTextCheckBox{nullptr};
QLineEdit *matchTextLineEdit{nullptr};
QLineEdit *matchTextCountLineEdit{nullptr};
QPushButton *deleteTextButton{nullptr};
QPushButton *deletePrefixButton{nullptr};
QPushButton *deleteSuffixButton{nullptr};
QPushButton *deleteBeforeButton{nullptr};
QPushButton *deleteAfterButton{nullptr};
QPushButton *deleteMatchTextLineButton{nullptr};
QPushButton *keepMatchTextLineButton{nullptr};
QRadioButton *returnTypeRnRadioButton{nullptr};
QRadioButton *returnTypeRRadioButton{nullptr};
QRadioButton *returnTypeNRadioButton{nullptr};
QRadioButton *returnTypeSpaceRadioButton{nullptr};
QRadioButton *returnTypeNoneRadioButton{nullptr};
QRadioButton *returnTypeCustomRadioButton{nullptr};
QLineEdit *customReturnLineEdit{nullptr};
QPushButton *returnTypeReplaceButton{nullptr};
QLineEdit *framePrefixLineEdit{nullptr};
QLineEdit *frameSuffixLineEdit{nullptr};
QPushButton *frameSplitLineButton{nullptr};
QPushButton *frameDeleteButton{nullptr};
QPushButton *deleteShorterLineButton{nullptr};
QPushButton *deleteShorterOrEqualLineButton{nullptr};
QPushButton *deleteEqualLineButton{nullptr};
QPushButton *deleteLongerOrEqualLineButton{nullptr};
QPushButton *deleteLongerLineButton{nullptr};
QPushButton *keepShorterLineButton{nullptr};
QPushButton *keepShorterOrEqualLineButton{nullptr};
QPushButton *keepEqualLineButton{nullptr};
QPushButton *keepLongerOrEqualLineButton{nullptr};
QPushButton *keepLongerLineButton{nullptr};
QList<QLineEdit *> indexLineEditList;
QList<QLineEdit *> matchLineEditList;
QPushButton *deleteMatchLineButton{nullptr};
QPushButton *keepMatchLineButton{nullptr};
QPushButton *saveButton{nullptr};
QPushButton *cancelButton{nullptr};
};
#endif //SERIALWIZARD_DATAPROCESSDIALOG_H