2 #include <Device/Protocol/ProtocolSettingsWidget.hpp>
4 #include <ossia/network/sockets/configuration.hpp>
5 #include <ossia/protocols/osc/osc_factory.hpp>
14 using framing_type = decltype(ossia::net::osc_protocol_configuration::framing);
21 auto layout =
new QFormLayout{
this};
22 layout->setContentsMargins(0, 0, 0, 0);
24 m_remotePort =
new QSpinBox(
this);
25 m_remotePort->setRange(0, 65535);
26 m_remotePort->setValue(9996);
27 m_remotePort->setWhatsThis(
28 tr(
"This is the communication port used for the TCP connection."));
29 proto.checkForChanges(m_remotePort);
31 m_host =
new QLineEdit(
this);
32 m_host->setText(
"127.0.0.1");
34 tr(
"This is the IP address of the computer the OSC-compatible software is "
35 "located on. You can use 127.0.0.1 if the software runs on the same machine "
38 layout->addRow(tr(
"Port"), m_remotePort);
39 layout->addRow(tr(
"Host"), m_host);
42 ossia::net::tcp_client_configuration settings()
const noexcept
44 ossia::net::tcp_client_configuration conf;
45 conf.port = m_remotePort->value();
46 conf.host = m_host->text().toStdString();
50 void setSettings(
const ossia::net::tcp_client_configuration& conf)
52 m_remotePort->setValue(conf.port);
53 m_host->setText(QString::fromStdString(conf.host));
57 QSpinBox* m_remotePort{};
67 auto layout =
new QFormLayout{
this};
68 layout->setContentsMargins(0, 0, 0, 0);
70 m_remotePort =
new QSpinBox(
this);
71 m_remotePort->setRange(0, 65535);
72 m_remotePort->setValue(9996);
73 m_remotePort->setWhatsThis(
74 tr(
"This is the communication port used for the TCP connection."));
75 proto.checkForChanges(m_remotePort);
77 m_host =
new QLineEdit(
this);
78 m_host->setText(
"127.0.0.1");
80 tr(
"This is the IP address of the computer the OSC-compatible software is "
81 "located on. You can use 127.0.0.1 if the software runs on the same machine "
84 m_framing =
new QComboBox{
this};
85 m_framing->addItems({
"Size prefixing",
"SLIP"});
86 m_framing->setCurrentIndex(1);
88 layout->addRow(tr(
"Port"), m_remotePort);
89 layout->addRow(tr(
"Host"), m_host);
90 layout->addRow(tr(
"Framing"), m_framing);
93 framing_type framing()
const noexcept
95 return (framing_type)m_framing->currentIndex();
98 ossia::net::tcp_client_configuration settings()
const noexcept
100 ossia::net::tcp_client_configuration conf;
101 conf.port = m_remotePort->value();
102 conf.host = m_host->text().toStdString();
107 const ossia::net::osc_protocol_configuration& c,
108 const ossia::net::tcp_client_configuration& conf)
110 m_remotePort->setValue(conf.port);
111 m_framing->setCurrentIndex(c.framing);
112 m_host->setText(QString::fromStdString(conf.host));
116 QSpinBox* m_remotePort{};
117 QComboBox* m_framing{};