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."));
30 m_host =
new QLineEdit(
this);
31 m_host->setText(
"127.0.0.1");
33 tr(
"This is the IP address of the computer the OSC-compatible software is "
34 "located on. You can use 127.0.0.1 if the software runs on the same machine "
37 layout->addRow(tr(
"Port"), m_remotePort);
38 layout->addRow(tr(
"Host"), m_host);
41 ossia::net::tcp_configuration settings()
const noexcept
43 ossia::net::tcp_configuration conf;
44 conf.port = m_remotePort->value();
45 conf.host = m_host->text().toStdString();
49 void setSettings(
const ossia::net::tcp_configuration& conf)
51 m_remotePort->setValue(conf.port);
52 m_host->setText(QString::fromStdString(conf.host));
56 QSpinBox* m_remotePort{};
66 auto layout =
new QFormLayout{
this};
67 layout->setContentsMargins(0, 0, 0, 0);
69 m_remotePort =
new QSpinBox(
this);
70 m_remotePort->setRange(0, 65535);
71 m_remotePort->setValue(9996);
72 m_remotePort->setWhatsThis(
73 tr(
"This is the communication port used for the TCP connection."));
75 m_host =
new QLineEdit(
this);
76 m_host->setText(
"127.0.0.1");
78 tr(
"This is the IP address of the computer the OSC-compatible software is "
79 "located on. You can use 127.0.0.1 if the software runs on the same machine "
82 m_framing =
new QComboBox{
this};
83 m_framing->addItems({
"Size prefixing",
"SLIP"});
84 m_framing->setCurrentIndex(1);
86 layout->addRow(tr(
"Port"), m_remotePort);
87 layout->addRow(tr(
"Host"), m_host);
88 layout->addRow(tr(
"Framing"), m_framing);
91 framing_type framing()
const noexcept
93 return (framing_type)m_framing->currentIndex();
96 ossia::net::tcp_configuration settings()
const noexcept
98 ossia::net::tcp_configuration conf;
99 conf.port = m_remotePort->value();
100 conf.host = m_host->text().toStdString();
105 const ossia::net::osc_protocol_configuration& c,
106 const ossia::net::tcp_configuration& conf)
108 m_remotePort->setValue(conf.port);
109 m_framing->setCurrentIndex(c.framing);
110 m_host->setText(QString::fromStdString(conf.host));
114 QSpinBox* m_remotePort{};
115 QComboBox* m_framing{};