OSCProtocolSettingsWidget.hpp
1 #pragma once
2 #include <Device/Protocol/DeviceSettings.hpp>
3 #include <Device/Protocol/ProtocolSettingsWidget.hpp>
4 
5 #include <Protocols/OSC/OSCSpecificSettings.hpp>
6 
7 #include <verdigris>
8 
9 class QStackedLayout;
10 class QLineEdit;
11 class QSpinBox;
12 class QWidget;
13 class QFormLayout;
14 
15 namespace Protocols
16 {
17 
18 class UDPWidget;
19 class TCPWidget;
20 class TCPServerWidget;
21 class UnixDatagramWidget;
22 class UnixStreamWidget;
23 class SerialWidget;
24 class WebsocketClientWidget;
25 class WebsocketServerWidget;
26 
27 class RateWidget;
28 
29 enum class OscProtocol
30 {
31  UDP = 0,
32  TCP = 1,
33  Serial = 2,
34  UnixDatagram = 3,
35  UnixStream = 4,
36  WSClient = 5,
37  WSServer = 6,
38  TCPServer = 7
39 };
40 
41 class OSCTransportWidget : public QWidget
42 {
43 public:
44  explicit OSCTransportWidget(
45  Device::ProtocolSettingsWidget& proto, QWidget* parent = nullptr);
46 
47  void setCurrentProtocol(OscProtocol index);
48  ossia::net::osc_protocol_configuration configuration(OscProtocol index) const noexcept;
49  OscProtocol setConfiguration(const ossia::net::osc_protocol_configuration& conf);
50 
51 private:
52  QStackedLayout* m_transportLayout{};
53 
54  UDPWidget* m_udp{};
55  TCPWidget* m_tcp{};
56  TCPServerWidget* m_tcp_server{};
57  SerialWidget* m_serial{};
58  UnixDatagramWidget* m_unix_dgram{};
59  UnixStreamWidget* m_unix_stream{};
60  WebsocketClientWidget* m_ws_client{};
61  WebsocketServerWidget* m_ws_server{};
62 };
63 
65 {
66 public:
67  explicit OSCProtocolSettingsWidget(QWidget* parent = nullptr);
68 
69  Device::DeviceSettings getSettings() const override;
70  Device::Node getDevice() const override;
71  void setSettings(const Device::DeviceSettings& settings) override;
72 
73  using Device::ProtocolSettingsWidget::checkForChanges;
74 
75 private:
76  void setDefaults();
77  QLineEdit* m_deviceNameEdit{};
78  RateWidget* m_rate{};
79  QCheckBox* m_bonjour{};
80  QComboBox* m_transport{};
81  QComboBox* m_oscVersion{};
82  QSpinBox* m_oscquery{};
83  OSCTransportWidget* m_transportWidget{};
84  OSCSpecificSettings m_settings;
85 };
86 }
Definition: ProtocolSettingsWidget.hpp:22
Definition: OSCProtocolSettingsWidget.hpp:65
Definition: OSCProtocolSettingsWidget.hpp:42
Definition: RateWidget.hpp:15
Definition: SerialWidget.hpp:15
Definition: TCPServerWidget.hpp:15
Definition: TCPWidget.hpp:62
Definition: UDPWidget.hpp:14
Definition: UnixDatagramWidget.hpp:12
Definition: UnixStreamWidget.hpp:15
Definition: WebsocketClientWidget.hpp:12
Definition: WebsocketServerWidget.hpp:12
Definition: DeviceSettings.hpp:20
Definition: OSCSpecificSettings.hpp:12