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 score::setHelp(m_remotePort,
28 tr(
"Port the other software listens on: score sends to it."));
29 proto.checkForChanges(m_remotePort);
31 m_localPort =
new QSpinBox(
this);
32 m_localPort->setRange(0, 65535);
33 m_localPort->setValue(9997);
34 score::setHelp(m_localPort,
35 tr(
"Port score listens on for messages from the other software."));
36 proto.checkForChanges(m_localPort);
38 m_broadcast =
new QCheckBox{
this};
39 m_broadcast->setCheckState(Qt::Unchecked);
40 score::setHelp(m_broadcast, tr(
"Broadcast to every device in the IP broadcast range"));
42 m_host =
new QLineEdit(
this);
43 m_host->setText(
"127.0.0.1");
45 layout->addRow(tr(
"Device listening port"), m_remotePort);
46 layout->addRow(tr(
"Broadcast"), m_broadcast);
47 layout->addRow(tr(
"Device host"), m_host);
48 layout->addRow(tr(
"score listening port"), m_localPort);
51 ossia::net::udp_configuration settings()
const noexcept
53 ossia::net::udp_configuration conf;
54 conf.local = ossia::net::inbound_socket_configuration{
55 .bind =
"0.0.0.0", .port = (uint16_t)m_localPort->value()};
56 conf.remote = ossia::net::outbound_socket_configuration{
57 .host = m_host->text().toStdString(),
58 .port = (uint16_t)m_remotePort->value(),
59 .broadcast = m_broadcast->isChecked()};
63 void setSettings(
const ossia::net::udp_configuration& conf)
67 m_remotePort->setValue(conf.remote->port);
68 m_host->setText(QString::fromStdString(conf.remote->host));
69 m_broadcast->setChecked(conf.remote->broadcast);
73 m_localPort->setValue(conf.local->port);
78 QSpinBox* m_localPort{};
79 QSpinBox* m_remotePort{};
80 QCheckBox* m_broadcast{};