diff options
Diffstat (limited to 'proto-flightgear')
| -rw-r--r-- | proto-flightgear/ftnoir_protocol_fg.cpp | 13 | ||||
| -rw-r--r-- | proto-flightgear/ftnoir_protocol_fg.h | 24 | ||||
| -rw-r--r-- | proto-flightgear/ftnoir_protocol_fg_dialog.cpp | 10 | ||||
| -rw-r--r-- | proto-flightgear/lang/de_DE.ts | 37 | ||||
| -rw-r--r-- | proto-flightgear/lang/nl_NL.ts | 13 | ||||
| -rw-r--r-- | proto-flightgear/lang/ru_RU.ts | 13 | ||||
| -rw-r--r-- | proto-flightgear/lang/stub.ts | 13 | ||||
| -rw-r--r-- | proto-flightgear/lang/zh_CN.ts | 37 |
8 files changed, 119 insertions, 41 deletions
diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp index 3e0f955c..d777d801 100644 --- a/proto-flightgear/ftnoir_protocol_fg.cpp +++ b/proto-flightgear/ftnoir_protocol_fg.cpp @@ -13,7 +13,7 @@ // For Todd and Arda Kutlu -void flightgear::pose(const double* headpose) { +void flightgear::pose(const double* headpose, const double*) { FlightData.x = -headpose[TX] * 1e-2; FlightData.y = headpose[TY] * 1e-2; FlightData.z = headpose[TZ] * 1e-2; @@ -22,12 +22,17 @@ void flightgear::pose(const double* headpose) { FlightData.r = -headpose[Roll]; FlightData.status = 1; QHostAddress destIP(quint32(s.ip1 << 24 | s.ip2 << 16 | s.ip3 << 8 | s.ip4)); - (void) outSocket.writeDatagram(reinterpret_cast<const char*>(&FlightData), sizeof(FlightData), destIP, static_cast<quint16>(s.port)); + (void) outSocket.writeDatagram(reinterpret_cast<const char*>(&FlightData), sizeof(FlightData), destIP, quint16(s.port)); } -bool flightgear::correct() +module_status flightgear::initialize() { - return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); + if (outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) + return status_ok(); + else + return error(tr("Can't bind to [%1.%2.%3.%4]:%5") + .arg(s.ip1).arg(s.ip2).arg(s.ip3).arg(s.ip4) + .arg(s.port)); } OPENTRACK_DECLARE_PROTOCOL(flightgear, FGControls, flightgearDll) diff --git a/proto-flightgear/ftnoir_protocol_fg.h b/proto-flightgear/ftnoir_protocol_fg.h index 48e5f1c1..3a08b546 100644 --- a/proto-flightgear/ftnoir_protocol_fg.h +++ b/proto-flightgear/ftnoir_protocol_fg.h @@ -15,6 +15,7 @@ #include <QMessageBox> #include "api/plugin-api.hpp" #include "options/options.hpp" +#include "compat/tr.hpp" using namespace options; // x,y,z position in meters, heading, pitch and roll in degrees @@ -38,14 +39,14 @@ struct settings : opts { {} }; -class flightgear : public IProtocol +class flightgear : TR, public IProtocol { + Q_OBJECT + public: - bool correct(); - void pose(const double *headpose); - QString game_name() { - return QCoreApplication::translate("flightgear", "FlightGear"); - } + void pose(const double *headpose, const double*) override; + QString game_name() override { return tr("FlightGear"); } + module_status initialize() override; private: settings s; flightgear_datagram FlightData; @@ -58,8 +59,8 @@ class FGControls: public IProtocolDialog Q_OBJECT public: FGControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} + void register_protocol(IProtocol *) override {} + void unregister_protocol() override {} private: Ui::UICFGControls ui; settings s; @@ -70,7 +71,8 @@ private slots: class flightgearDll : public Metadata { -public: - QString name() { return QString(QCoreApplication::translate("flightgearDll", "FlightGear")); } - QIcon icon() { return QIcon(":/images/flightgear.png"); } + Q_OBJECT + + QString name() override { return tr("FlightGear"); } + QIcon icon() override { return QIcon(":/images/flightgear.png"); } }; diff --git a/proto-flightgear/ftnoir_protocol_fg_dialog.cpp b/proto-flightgear/ftnoir_protocol_fg_dialog.cpp index 43a702f6..d2098577 100644 --- a/proto-flightgear/ftnoir_protocol_fg_dialog.cpp +++ b/proto-flightgear/ftnoir_protocol_fg_dialog.cpp @@ -10,7 +10,7 @@ */ #include "ftnoir_protocol_fg.h" #include "api/plugin-api.hpp" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include <QString> #include <QUrl> @@ -37,10 +37,10 @@ FGControls::FGControls() connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.buttonBox, &QDialogButtonBox::helpRequested, - ui.buttonBox, []() - { - static const QString contrib_dir = "file:///" + QDir::toNativeSeparators(QStringLiteral("%1/%2/%3"). - arg(OPENTRACK_BASE_PATH, OPENTRACK_CONTRIB_PATH, "FlightGear")); + ui.buttonBox, [] { + static const QString contrib_dir = + "file:///" + QDir::toNativeSeparators(QStringLiteral("%1/%2/%3"). + arg(OPENTRACK_BASE_PATH, OPENTRACK_CONTRIB_PATH, "FlightGear")); QDesktopServices::openUrl(contrib_dir); }); } diff --git a/proto-flightgear/lang/de_DE.ts b/proto-flightgear/lang/de_DE.ts new file mode 100644 index 00000000..436087bc --- /dev/null +++ b/proto-flightgear/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>UICFGControls</name> + <message> + <source>FlightGear protocol settings</source> + <translation>FlightGear-Protokolleinstellungen</translation> + </message> + <message> + <source>IP address</source> + <translation>IP-Adresse</translation> + </message> + <message> + <source>Port</source> + <translation>Port</translation> + </message> +</context> +<context> + <name>flightgear</name> + <message> + <source>Can't bind to [%1.%2.%3.%4]:%5</source> + <translation>Konnte nicht an [%1.%2.%3.%4]:%5 binden</translation> + </message> + <message> + <source>FlightGear</source> + <translation>FlightGear</translation> + </message> +</context> +<context> + <name>flightgearDll</name> + <message> + <source>FlightGear</source> + <translation>FlightGear</translation> + </message> +</context> +</TS> diff --git a/proto-flightgear/lang/nl_NL.ts b/proto-flightgear/lang/nl_NL.ts index 35ab5431..d8c3d3ec 100644 --- a/proto-flightgear/lang/nl_NL.ts +++ b/proto-flightgear/lang/nl_NL.ts @@ -4,25 +4,25 @@ <context> <name>UICFGControls</name> <message> - <location filename="../ftnoir_fgcontrols.ui" line="+17"/> <source>FlightGear protocol settings</source> <translation type="unfinished"></translation> </message> <message> - <location line="+12"/> - <source>IP-address remote PC</source> + <source>IP address</source> <translation type="unfinished"></translation> </message> <message> - <location line="+71"/> - <source>Port-number</source> + <source>Port</source> <translation type="unfinished"></translation> </message> </context> <context> <name>flightgear</name> <message> - <location filename="../ftnoir_protocol_fg.h" line="+40"/> + <source>Can't bind to [%1.%2.%3.%4]:%5</source> + <translation type="unfinished"></translation> + </message> + <message> <source>FlightGear</source> <translation type="unfinished"></translation> </message> @@ -30,7 +30,6 @@ <context> <name>flightgearDll</name> <message> - <location line="+27"/> <source>FlightGear</source> <translation type="unfinished"></translation> </message> diff --git a/proto-flightgear/lang/ru_RU.ts b/proto-flightgear/lang/ru_RU.ts index 916f5e2d..c204410d 100644 --- a/proto-flightgear/lang/ru_RU.ts +++ b/proto-flightgear/lang/ru_RU.ts @@ -4,25 +4,25 @@ <context> <name>UICFGControls</name> <message> - <location filename="../ftnoir_fgcontrols.ui" line="+17"/> <source>FlightGear protocol settings</source> <translation type="unfinished"></translation> </message> <message> - <location line="+12"/> - <source>IP-address remote PC</source> + <source>IP address</source> <translation type="unfinished"></translation> </message> <message> - <location line="+71"/> - <source>Port-number</source> + <source>Port</source> <translation type="unfinished"></translation> </message> </context> <context> <name>flightgear</name> <message> - <location filename="../ftnoir_protocol_fg.h" line="+40"/> + <source>Can't bind to [%1.%2.%3.%4]:%5</source> + <translation type="unfinished"></translation> + </message> + <message> <source>FlightGear</source> <translation type="unfinished"></translation> </message> @@ -30,7 +30,6 @@ <context> <name>flightgearDll</name> <message> - <location line="+27"/> <source>FlightGear</source> <translation type="unfinished"></translation> </message> diff --git a/proto-flightgear/lang/stub.ts b/proto-flightgear/lang/stub.ts index e94d44f2..dc093c57 100644 --- a/proto-flightgear/lang/stub.ts +++ b/proto-flightgear/lang/stub.ts @@ -4,25 +4,25 @@ <context> <name>UICFGControls</name> <message> - <location filename="../ftnoir_fgcontrols.ui" line="+17"/> <source>FlightGear protocol settings</source> <translation type="unfinished"></translation> </message> <message> - <location line="+12"/> - <source>IP-address remote PC</source> + <source>IP address</source> <translation type="unfinished"></translation> </message> <message> - <location line="+71"/> - <source>Port-number</source> + <source>Port</source> <translation type="unfinished"></translation> </message> </context> <context> <name>flightgear</name> <message> - <location filename="../ftnoir_protocol_fg.h" line="+40"/> + <source>Can't bind to [%1.%2.%3.%4]:%5</source> + <translation type="unfinished"></translation> + </message> + <message> <source>FlightGear</source> <translation type="unfinished"></translation> </message> @@ -30,7 +30,6 @@ <context> <name>flightgearDll</name> <message> - <location line="+27"/> <source>FlightGear</source> <translation type="unfinished"></translation> </message> diff --git a/proto-flightgear/lang/zh_CN.ts b/proto-flightgear/lang/zh_CN.ts new file mode 100644 index 00000000..ba70f8a0 --- /dev/null +++ b/proto-flightgear/lang/zh_CN.ts @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="zh_CN"> +<context> + <name>UICFGControls</name> + <message> + <source>FlightGear protocol settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>IP address</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Port</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>flightgear</name> + <message> + <source>Can't bind to [%1.%2.%3.%4]:%5</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>FlightGear</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>flightgearDll</name> + <message> + <source>FlightGear</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> |
