Loading...
Searching...
No Matches
DeviceEditDialog.hpp
1#pragma once
2
3#include <Device/Node/DeviceNode.hpp>
4#include <Device/Protocol/DeviceSettings.hpp>
5
6#include <QDialog>
7#include <QList>
8#include <QSplitter>
9
10#include <score_plugin_deviceexplorer_export.h>
11
12#include <verdigris>
13
14class QComboBox;
15class QFormLayout;
16class QWidget;
17class QListWidget;
18class QTreeWidget;
19class QVBoxLayout;
20class QLabel;
21class QDialogButtonBox;
22
23namespace Device
24{
25class ProtocolFactoryList;
26class ProtocolSettingsWidget;
27class DeviceEnumerator;
28}
29namespace Explorer
30{
31class DeviceExplorerModel;
32class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT DeviceEditDialog final : public QDialog
33{
34 W_OBJECT(DeviceEditDialog)
35
36public:
37 enum Mode
38 {
39 Creating,
40 Editing
41 };
42 explicit DeviceEditDialog(
43 const DeviceExplorerModel& model, const Device::ProtocolFactoryList& pl, Mode mode,
44 QWidget* parent);
46
47 Device::DeviceSettings getSettings() const;
48 Device::Node getDevice() const;
49
50 void setSettings(const Device::DeviceSettings& settings);
51
52 // This mode will display a warning to
53 // the user if he has to edit the device again.
54 void setAcceptEnabled(bool);
55
56 // enable protocol & device browsing
57 void setBrowserEnabled(bool);
58
59 void updateValidity();
60
61private:
62 void selectedProtocolChanged();
63 void selectedDeviceChanged();
64 void initAvailableProtocols();
65
66 const DeviceExplorerModel& m_model;
67 const Device::ProtocolFactoryList& m_protocolList;
68 Mode m_mode{};
69 std::vector<std::pair<QString, std::unique_ptr<Device::DeviceEnumerator>>>
70 m_enumerators;
71
72 QSplitter* m_splitter{};
73 QDialogButtonBox* m_buttonBox{};
74 QPushButton* m_okButton{};
75 QPushButton* m_helpButton{};
76 QTreeWidget* m_protocols{};
77 QTreeWidget* m_devices{};
78 // QWidget* m_main{};
79 QLabel* m_protocolsLabel{};
80 QLabel* m_devicesLabel{};
81 Device::ProtocolSettingsWidget* m_protocolWidget{};
82 // QFormLayout* m_settingsFormLayout{};
83 QVBoxLayout* m_column3Layout{};
84 QList<Device::DeviceSettings> m_previousSettings;
85 QLabel* m_invalidLabel{};
86 QLabel* m_protocolNameLabel{};
87
88 QString m_originalName{};
89 int m_index{};
90};
91}
Definition ProtocolList.hpp:10
Definition ProtocolSettingsWidget.hpp:22
Definition DeviceEditDialog.hpp:33
Definition DeviceExplorerModel.hpp:67
Manipulation of Devices from Qt.
Definition AddressSettings.cpp:14
Definition DeviceSettings.hpp:20