Debian Codegraph @

tests/manual/examples/sender/dialog.h

raw
1 // Copyright (C) 2012 Denis Shienkov <[email protected]>
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4 #ifndef DIALOG_H
5 #define DIALOG_H
6
7 #include <QDialog>
8 #include <QSerialPort>
9 #include <QTimer>
10
11 QT_BEGIN_NAMESPACE
12
13 class QLabel;
14 class QLineEdit;
15 class QSpinBox;
16 class QPushButton;
17 class QComboBox;
18
19 QT_END_NAMESPACE
20
21 class Dialog : public QDialog
22 {
23 Q_OBJECT
24
25 public:
26 explicit Dialog(QWidget *parent = nullptr);
27
28 private slots:
29 void sendRequest();
30 void readResponse();
31 void processTimeout();
32
33 private:
34 void setControlsEnabled(bool enable);
35 void processError(const QString &error);
36
37 private:
38 int m_transactionCount = 0;
39 QLabel *m_serialPortLabel = nullptr;
40 QComboBox *m_serialPortComboBox = nullptr;
41 QLabel *m_waitResponseLabel = nullptr;
42 QSpinBox *m_waitResponseSpinBox = nullptr;
43 QLabel *m_requestLabel = nullptr;
44 QLineEdit *m_requestLineEdit = nullptr;
45 QLabel *m_trafficLabel = nullptr;
46 QLabel *m_statusLabel = nullptr;
47 QPushButton *m_runButton = nullptr;
48
49 QSerialPort m_serial;
50 QByteArray m_response;
51 QTimer m_timer;
52 };
53
54 #endif // DIALOG_H