diff options
Diffstat (limited to 'proto-udp')
-rw-r--r-- | proto-udp/ftnoir_protocol_ftn.cpp | 15 | ||||
-rw-r--r-- | proto-udp/ftnoir_protocol_ftn.h | 23 | ||||
-rw-r--r-- | proto-udp/lang/de_DE.ts | 37 | ||||
-rw-r--r-- | proto-udp/lang/nl_NL.ts | 11 | ||||
-rw-r--r-- | proto-udp/lang/ru_RU.ts | 11 | ||||
-rw-r--r-- | proto-udp/lang/stub.ts | 11 | ||||
-rw-r--r-- | proto-udp/lang/zh_CN.ts | 13 |
7 files changed, 104 insertions, 17 deletions
diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp index 4e846114..c67c39b8 100644 --- a/proto-udp/ftnoir_protocol_ftn.cpp +++ b/proto-udp/ftnoir_protocol_ftn.cpp @@ -16,18 +16,23 @@ udp::udp() { set_dest_address(); - QObject::connect(s.b.get(), &bundle_::changed, + QObject::connect(&*s.b, &bundle_::changed, this, &udp::set_dest_address, - Qt::QueuedConnection); + Qt::DirectConnection); } -void udp::pose(const double *headpose) { +void udp::pose(const double *headpose, const double*) +{ + QMutexLocker l(&lock); + outSocket.writeDatagram((const char *) headpose, sizeof(double[6]), dest_ip, dest_port); } void udp::set_dest_address() { - dest_port = s.port; + QMutexLocker l(&lock); + + dest_port = (unsigned short)s.port; dest_ip = QHostAddress((s.ip1.to<unsigned>() & 0xff) << 24 | (s.ip2.to<unsigned>() & 0xff) << 16 | (s.ip3.to<unsigned>() & 0xff) << 8 | @@ -42,4 +47,4 @@ module_status udp::initialize() return error(tr("Can't bind socket: %1").arg(outSocket.errorString())); } -OPENTRACK_DECLARE_PROTOCOL(udp, FTNControls, udpDll) +OPENTRACK_DECLARE_PROTOCOL(udp, FTNControls, udp_sender_dll) diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h index c0454699..ca387a37 100644 --- a/proto-udp/ftnoir_protocol_ftn.h +++ b/proto-udp/ftnoir_protocol_ftn.h @@ -11,10 +11,10 @@ #pragma once #include "ui_ftnoir_ftncontrols.h" -#include <QUdpSocket> #include "api/plugin-api.hpp" #include "options/options.hpp" using namespace options; +#include <QUdpSocket> struct settings : opts { value<int> ip1, ip2, ip3, ip4, port; @@ -35,14 +35,14 @@ class udp : public QObject, public IProtocol public: udp(); module_status initialize() override; - void pose(const double *headpose); - QString game_name() { - return otr_tr("UDP over network"); - } + void pose(const double *headpose, const double*) override; + QString game_name() override { return tr("UDP over network"); } private: QUdpSocket outSocket; settings s; + mutable QMutex lock; + QHostAddress dest_ip { 127u << 24 | 1u }; unsigned short dest_port = 65535; @@ -57,8 +57,8 @@ class FTNControls: public IProtocolDialog public: FTNControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} + void register_protocol(IProtocol *) override {} + void unregister_protocol() override {} private: Ui::UICFTNControls ui; settings s; @@ -67,9 +67,10 @@ private slots: void doCancel(); }; -class udpDll : public Metadata +class udp_sender_dll : public Metadata { -public: - QString name() { return otr_tr("UDP over network"); } - QIcon icon() { return QIcon(":/images/opentrack.png"); } + Q_OBJECT + + QString name() override { return tr("UDP over network"); } + QIcon icon() override { return QIcon(":/images/opentrack.png"); } }; diff --git a/proto-udp/lang/de_DE.ts b/proto-udp/lang/de_DE.ts new file mode 100644 index 00000000..442d8683 --- /dev/null +++ b/proto-udp/lang/de_DE.ts @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>UICFTNControls</name> + <message> + <source>UDP protocol settings</source> + <translation>UDP-Protokolleinstellungen</translation> + </message> + <message> + <source>Remote IP address</source> + <translation>Entfernte IP-Adresse</translation> + </message> + <message> + <source>Port</source> + <translation>Port</translation> + </message> +</context> +<context> + <name>udp</name> + <message> + <source>Can't bind socket: %1</source> + <translation>Kann nicht an Socket binden: %1</translation> + </message> + <message> + <source>UDP over network</source> + <translation>UDP über Netzwerk</translation> + </message> +</context> +<context> + <name>udp_sender_dll</name> + <message> + <source>UDP over network</source> + <translation>UDP über Netzwerk</translation> + </message> +</context> +</TS> diff --git a/proto-udp/lang/nl_NL.ts b/proto-udp/lang/nl_NL.ts index 069a0a74..d955c98f 100644 --- a/proto-udp/lang/nl_NL.ts +++ b/proto-udp/lang/nl_NL.ts @@ -22,5 +22,16 @@ <source>Can't bind socket: %1</source> <translation type="unfinished"></translation> </message> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>udp_sender_dll</name> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> </context> </TS> diff --git a/proto-udp/lang/ru_RU.ts b/proto-udp/lang/ru_RU.ts index 486d5707..b1ea5201 100644 --- a/proto-udp/lang/ru_RU.ts +++ b/proto-udp/lang/ru_RU.ts @@ -22,5 +22,16 @@ <source>Can't bind socket: %1</source> <translation type="unfinished"></translation> </message> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>udp_sender_dll</name> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> </context> </TS> diff --git a/proto-udp/lang/stub.ts b/proto-udp/lang/stub.ts index d415ef0e..ca1bc409 100644 --- a/proto-udp/lang/stub.ts +++ b/proto-udp/lang/stub.ts @@ -22,5 +22,16 @@ <source>Can't bind socket: %1</source> <translation type="unfinished"></translation> </message> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>udp_sender_dll</name> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> </context> </TS> diff --git a/proto-udp/lang/zh_CN.ts b/proto-udp/lang/zh_CN.ts index d415ef0e..b2a750b8 100644 --- a/proto-udp/lang/zh_CN.ts +++ b/proto-udp/lang/zh_CN.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> <context> <name>UICFTNControls</name> <message> @@ -22,5 +22,16 @@ <source>Can't bind socket: %1</source> <translation type="unfinished"></translation> </message> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>udp_sender_dll</name> + <message> + <source>UDP over network</source> + <translation type="unfinished"></translation> + </message> </context> </TS> |