blob: 8bd3a95a662e7ba16ecfaee92919c8495469e7c4 (
plain)
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
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef CONNECTDIALOG_H
#define CONNECTDIALOG_H
#include <QCanBusDevice>
#include <QCanBusDeviceInfo>
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class ConnectDialog;
}
class QSettings;
QT_END_NAMESPACE
class ConnectDialog : public QDialog
{
Q_OBJECT
public:
typedef QPair<QCanBusDevice::ConfigurationKey, QVariant> ConfigurationItem;
struct Settings {
QString pluginName;
QString deviceInterfaceName;
QList<ConfigurationItem> configurations;
bool useConfigurationEnabled = false;
bool useModelRingBuffer = true;
int modelRingBufferSize = 1000;
bool useAutoscroll = false;
};
explicit ConnectDialog(QWidget *parent = nullptr);
~ConnectDialog() override;
Settings settings() const;
private slots:
void pluginChanged(const QString &plugin);
void interfaceChanged(const QString &interface);
void ok();
void cancel();
private:
QString configurationValue(QCanBusDevice::ConfigurationKey key);
void restoreSettings();
void revertSettings();
void saveSettings();
void updateSettings();
Ui::ConnectDialog *m_ui = nullptr;
Settings m_currentSettings;
QList<QCanBusDeviceInfo> m_interfaces;
QSettings *m_settings = nullptr;
};
#endif // CONNECTDIALOG_H
|