Loading...
Searching...
No Matches
WebsocketClientWidget.hpp
1#pragma once
2#include <Device/Protocol/ProtocolSettingsWidget.hpp>
3
4#include <ossia/network/sockets/configuration.hpp>
5
6#include <QFormLayout>
7#include <QLineEdit>
8namespace Protocols
9{
10
11class WebsocketClientWidget : public QWidget
12{
13public:
15 : QWidget{parent}
16 {
17 auto layout = new QFormLayout{this};
18 layout->setContentsMargins(0, 0, 0, 0);
19
20 m_host = new QLineEdit(this);
21 m_host->setText("ws://127.0.0.1:5567");
22
23 layout->addRow(tr("Url"), m_host);
24 }
25
26 ossia::net::ws_client_configuration settings() const noexcept
27 {
28 ossia::net::ws_client_configuration conf;
29 conf.url = m_host->text().toStdString();
30 return conf;
31 }
32
33 void setSettings(const ossia::net::ws_client_configuration& conf)
34 {
35 m_host->setText(QString::fromStdString(conf.url));
36 }
37
38private:
39 QLineEdit* m_host{};
40};
41}
Definition ProtocolSettingsWidget.hpp:22
Definition WebsocketClientWidget.hpp:12