summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--api/plugin-api.cpp6
-rw-r--r--api/plugin-api.hpp9
-rw-r--r--compat/macros.hpp2
-rw-r--r--logic/runtime-libraries.cpp6
-rw-r--r--proto-fsuipc/ftnoir_protocol_fsuipc.cpp2
-rw-r--r--proto-simconnect/ftnoir_protocol_sc.cpp12
-rw-r--r--proto-vjoystick/vjoystick.cpp21
-rw-r--r--tracker-hatire/ftnoir_tracker_hat.cpp2
8 files changed, 35 insertions, 25 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp
index eed377b0..6820ff2c 100644
--- a/api/plugin-api.cpp
+++ b/api/plugin-api.cpp
@@ -1,4 +1,5 @@
#include "plugin-api.hpp"
+#include "compat/macros.hpp"
using namespace plugin_api::detail;
@@ -66,4 +67,7 @@ module_status::module_status(const QString& error) : error(error) {}
module_status module_status_mixin::status_ok() { return module_status(); }
-module_status module_status_mixin::error(const QString& error) { return module_status(error); }
+module_status module_status_mixin::error(const QString& error)
+{
+ return module_status(error.isEmpty() ? QString(_("Unknown error")) : error);
+}
diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp
index 48a1f408..4a797f73 100644
--- a/api/plugin-api.hpp
+++ b/api/plugin-api.hpp
@@ -90,12 +90,15 @@ struct OTR_API_EXPORT module_status final
module_status(const QString& error = QString());
};
+/*
+ * implement in all module types
+ */
struct OTR_API_EXPORT module_status_mixin
{
- static module_status status_ok();
- static module_status error(const QString& error);
+ static module_status status_ok(); // return from initialize() if ok
+ static module_status error(const QString& error); // return error message on init failure
- virtual module_status initialize() = 0;
+ virtual module_status initialize() = 0; // where to return from
};
// implement this in filters
diff --git a/compat/macros.hpp b/compat/macros.hpp
index e27eb906..5a2f01e3 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -1,6 +1,8 @@
#pragma once
+#include <QCoreApplication>
#define otr_tr(str) (QCoreApplication::translate(OTR_MODULE_NAME, (str)))
+#define _(x) otr_tr(x)
#if defined _MSC_VER
# define never_inline __declspec(noinline)
diff --git a/logic/runtime-libraries.cpp b/logic/runtime-libraries.cpp
index 46a90b86..1dcff4a5 100644
--- a/logic/runtime-libraries.cpp
+++ b/logic/runtime-libraries.cpp
@@ -19,7 +19,7 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli
if(status = pProtocol->initialize(), !status.is_ok())
{
- status = otr_tr("Error occured while loading protocol %1\n\n%2\n")
+ status = _("Error occured while loading protocol %1\n\n%2\n")
.arg(p->name).arg(status.error);
goto end;
}
@@ -36,14 +36,14 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli
if (pFilter)
if(status = pFilter->initialize(), !status.is_ok())
{
- status = otr_tr("Error occured while loading filter %1\n\n%2\n")
+ status = _("Error occured while loading filter %1\n\n%2\n")
.arg(f->name).arg(status.error);
goto end;
}
if (status = pTracker->start_tracker(frame), !status.is_ok())
{
- status = otr_tr("Error occured while loading tracker %1\n\n%2\n")
+ status = _("Error occured while loading tracker %1\n\n%2\n")
.arg(t->name).arg(status.error);
goto end;
}
diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp
index 90a75f52..bdb67c3f 100644
--- a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp
+++ b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp
@@ -149,7 +149,7 @@ module_status fsuipc::initialize()
FSUIPCLib.setFileName( s.LocationOfDLL );
if (FSUIPCLib.load() != true)
- return error(otr_tr("Can't load fsuipc at '%1'").arg(s.LocationOfDLL));
+ return error(_("Can't load fsuipc at '%1'").arg(s.LocationOfDLL));
else
return status_ok();
}
diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp
index e84f85ec..1a844429 100644
--- a/proto-simconnect/ftnoir_protocol_sc.cpp
+++ b/proto-simconnect/ftnoir_protocol_sc.cpp
@@ -174,30 +174,30 @@ module_status simconnect::initialize()
return error(tr("dll load failed -- %1").arg(SCClientLib.errorString()));
}
else
- return error("can't load SDK -- check selected simconnect version");
+ return error(_("can't load SDK -- check selected simconnect version"));
}
simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open");
if (simconnect_open == NULL) {
- return error("simconnect: SimConnect_Open function not found in DLL!");
+ return error("Open function not found in DLL!");
}
simconnect_set6DOF = (importSimConnect_CameraSetRelative6DOF) SCClientLib.resolve("SimConnect_CameraSetRelative6DOF");
if (simconnect_set6DOF == NULL) {
- return error("simconnect: SimConnect_CameraSetRelative6DOF function not found in DLL!");
+ return error("CameraSetRelative6DOF function not found in DLL!");
}
simconnect_close = (importSimConnect_Close) SCClientLib.resolve("SimConnect_Close");
if (simconnect_close == NULL) {
- return error("simconnect: SimConnect_Close function not found in DLL!");
+ return error("Close function not found in DLL!");
}
simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch");
if (simconnect_calldispatch == NULL) {
- return error("simconnect: SimConnect_CallDispatch function not found in DLL!");
+ return error("CallDispatch function not found in DLL!");
}
simconnect_subscribetosystemevent = (importSimConnect_SubscribeToSystemEvent) SCClientLib.resolve("SimConnect_SubscribeToSystemEvent");
if (simconnect_subscribetosystemevent == NULL) {
- return error("simconnect: SimConnect_SubscribeToSystemEvent function not found in DLL!");
+ return error("SubscribeToSystemEvent function not found in DLL!");
}
start();
diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp
index 3da748bd..a0e5b5b9 100644
--- a/proto-vjoystick/vjoystick.cpp
+++ b/proto-vjoystick/vjoystick.cpp
@@ -95,6 +95,14 @@ LONG handle::to_axis_value(unsigned axis_id, double val)
vjoystick_proto::vjoystick_proto()
{
+}
+
+vjoystick_proto::~vjoystick_proto()
+{
+}
+
+module_status vjoystick_proto::initialize()
+{
if (h.get_state() != state_success)
{
QMessageBox msgbox;
@@ -119,24 +127,17 @@ vjoystick_proto::vjoystick_proto()
QDesktopServices::openUrl(QUrl(project_site_url, QUrl::StrictMode));
}
}
-}
-vjoystick_proto::~vjoystick_proto()
-{
-}
-
-module_status vjoystick_proto::initialize()
-{
switch (h.get_state())
{
case state_notent:
- return error("vjoystick #1 doesn't exist");
+ return error(_("vjoystick not installed or disabled"));
case state_fail:
- return error("can't initialize vjoystick");
+ return error(_("can't initialize vjoystick"));
case state_success:
return status_ok();
default:
- return error("unknown error");
+ return error(_("unknown error"));
}
}
diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp
index 29381eaa..a3f10d35 100644
--- a/tracker-hatire/ftnoir_tracker_hat.cpp
+++ b/tracker-hatire/ftnoir_tracker_hat.cpp
@@ -62,7 +62,7 @@ module_status hatire::start_tracker(QFrame*)
case result_open_error:
return error(tr("Unable to open ComPort: %1").arg(ret.error));
default:
- return error("Unknown error");
+ return error(tr("Unknown error"));
}
}