-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserialsettingsdialog.h
65 lines (54 loc) · 1.48 KB
/
serialsettingsdialog.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
#ifndef SERIALSETTINGSDIALOG_H
#define SERIALSETTINGSDIALOG_H
#include <QDialog>
#include <QComboBox>
#include <QSpinBox>
#include <QLabel>
#include <QPushButton>
#include <QGridLayout>
#include <QSerialPort>
#include <QMessageBox>
#include <QCheckBox>
#include <QMouseEvent>
class SerialSettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit SerialSettingsDialog(QWidget *parent = nullptr);
struct Settings {
int baudRate;
QSerialPort::DataBits dataBits;
QSerialPort::StopBits stopBits;
QSerialPort::Parity parity;
QSerialPort::FlowControl flowControl;
int bufferSize;
int packageDelay;
bool autoScroll;
};
Settings getSettings() const;
void setSettings(const Settings& settings);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private slots:
void handlePackageDelayChanged(int value);
void handleBufferSizeChanged(int value);
private:
QComboBox* m_baudRateBox;
QComboBox* m_dataBitsBox;
QComboBox* m_stopBitsBox;
QComboBox* m_parityBox;
QComboBox* m_flowControlBox;
QSpinBox* m_bufferSizeBox;
QSpinBox* m_packageDelayBox;
QPushButton* m_okButton;
QPushButton* m_cancelButton;
QPushButton* m_defaultButton;
QCheckBox* m_autoScrollBox;
void setupUi();
void loadDefaultSettings();
void applyStyle();
void setupComboBoxes();
void setupSpinBoxes();
QPoint m_dragPosition;
};
#endif // SERIALSETTINGSDIALOG_H