WebsocketServerWidget.hpp
1 #pragma once
2 #include <Device/Protocol/ProtocolSettingsWidget.hpp>
3 
4 #include <ossia/network/sockets/configuration.hpp>
5 
6 #include <QFormLayout>
7 #include <QSpinBox>
8 namespace Protocols
9 {
10 
11 class WebsocketServerWidget : public QWidget
12 {
13 public:
15  : QWidget{parent}
16  {
17  auto layout = new QFormLayout{this};
18  layout->setContentsMargins(0, 0, 0, 0);
19 
20  m_remotePort = new QSpinBox(this);
21  m_remotePort->setRange(0, 65535);
22  m_remotePort->setValue(9996);
23  proto.checkForChanges(m_remotePort);
24 
25  layout->addRow(tr("Port"), m_remotePort);
26  }
27 
28  ossia::net::ws_server_configuration settings() const noexcept
29  {
30  ossia::net::ws_server_configuration conf;
31  conf.port = m_remotePort->value();
32  return conf;
33  }
34 
35  void setSettings(const ossia::net::ws_server_configuration& conf)
36  {
37  m_remotePort->setValue(conf.port);
38  }
39 
40 private:
41  QSpinBox* m_remotePort{};
42 };
43 }
Definition: ProtocolSettingsWidget.hpp:22
Definition: WebsocketServerWidget.hpp:12