summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/CMakeLists.txt6
-rw-r--r--logic/extensions.cpp74
-rw-r--r--logic/extensions.hpp44
-rw-r--r--logic/lang/de_DE.ts64
-rw-r--r--logic/lang/zh_CN.ts23
-rw-r--r--logic/main-settings.hpp12
-rw-r--r--logic/pipeline.cpp103
-rw-r--r--logic/pipeline.hpp16
-rw-r--r--logic/shortcuts.cpp35
-rw-r--r--logic/state.cpp22
-rw-r--r--logic/state.hpp3
-rw-r--r--logic/win32-shortcuts.cpp15
-rw-r--r--logic/work.cpp12
-rw-r--r--logic/work.hpp22
14 files changed, 229 insertions, 222 deletions
diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt
index f3f128af..f3344798 100644
--- a/logic/CMakeLists.txt
+++ b/logic/CMakeLists.txt
@@ -1,7 +1,7 @@
otr_module(logic BIN)
-target_link_libraries(opentrack-logic opentrack-spline)
+target_link_libraries(${self} opentrack-spline)
if(NOT WIN32)
- target_link_libraries(opentrack-logic opentrack-qxt-mini)
+ target_link_libraries(${self} opentrack-qxt-mini)
else()
- target_link_libraries(opentrack-logic opentrack-dinput winmm)
+ target_link_libraries(${self} opentrack-dinput winmm)
endif()
diff --git a/logic/extensions.cpp b/logic/extensions.cpp
deleted file mode 100644
index 03d03a83..00000000
--- a/logic/extensions.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "extensions.hpp"
-
-#include <functional>
-
-using namespace options;
-
-using ext_fun_type = void(IExtension::*)(Pose&);
-using ext_mask = IExtension::event_mask;
-using ext_ord = IExtension::event_ordinal;
-
-static constexpr struct event_type_mapping
-{
- ext_fun_type ptr;
- ext_mask mask;
- ext_ord idx;
-} ordinal_to_function[] = {
- { &IExtension::process_raw, ext_mask::on_raw, ext_ord::ev_raw, },
- { &IExtension::process_before_filter, ext_mask::on_before_filter, ext_ord::ev_before_filter, },
- { &IExtension::process_before_mapping, ext_mask::on_before_mapping, ext_ord::ev_before_mapping, },
- { &IExtension::process_finished, ext_mask::on_finished, ext_ord::ev_finished, },
-};
-
-bool event_handler::is_enabled(const QString& name)
-{
- (void)name;
-#if 1
- return true;
-#else
- if (!ext_bundle->contains(name))
- return false;
-
- return ext_bundle->get<bool>(name);
-#endif
-}
-
-event_handler::event_handler(Modules::dylib_list const& extensions) : ext_bundle(make_bundle("extensions"))
-{
- for (std::shared_ptr<dylib> const& lib : extensions)
- {
- std::shared_ptr<IExtension> ext(reinterpret_cast<IExtension*>(lib->Constructor()));
- std::shared_ptr<IExtensionDialog> dlg(reinterpret_cast<IExtensionDialog*>(lib->Dialog()));
- std::shared_ptr<Metadata_> m(lib->Meta());
-
- const ext_mask mask = ext->hook_types();
-
- if (!is_enabled(lib->module_name))
- continue;
-
-#if 0
- qDebug() << "extension" << lib->module_name << "mask" << (void*)mask;
-#endif
-
- for (event_type_mapping const& mapping : ordinal_to_function)
- {
- const unsigned i = mapping.idx;
- const ext_mask mask_ = mapping.mask;
-
- if (mask & mask_)
- extensions_for_event[i].push_back({ ext, dlg, m });
- }
- }
-}
-
-void event_handler::run_events(event_ordinal k, Pose& pose)
-{
-#if 0
- auto fun = std::mem_fn(ordinal_to_function[k].ptr);
-
- for (extension& x : extensions_for_event[k])
- fun(*x.logic, pose);
-#else
- (void)k; (void)pose;
-#endif
-}
diff --git a/logic/extensions.hpp b/logic/extensions.hpp
deleted file mode 100644
index 3368b118..00000000
--- a/logic/extensions.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-/* Copyright (c) 2017 Stanislaw Halik
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- */
-
-#include "api/plugin-support.hpp"
-#include "options/options.hpp"
-
-#include <vector>
-#include <array>
-
-#include "export.hpp"
-
-struct OTR_LOGIC_EXPORT event_handler final
-{
- using event_ordinal = IExtension::event_ordinal;
-
- struct extension
- {
- using ext = std::shared_ptr<IExtension>;
- using dlg = std::shared_ptr<IExtensionDialog>;
- using m = std::shared_ptr<Metadata_>;
-
- ext logic;
- dlg dialog;
- m metadata;
- };
-
- void run_events(event_ordinal k, Pose& pose);
- event_handler(Modules::dylib_list const& extensions);
-
-private:
- using ext_list = std::vector<extension>;
- std::array<ext_list, IExtension::event_count> extensions_for_event;
-
- options::bundle ext_bundle;
-
- bool is_enabled(const QString& name);
-};
-
diff --git a/logic/lang/de_DE.ts b/logic/lang/de_DE.ts
new file mode 100644
index 00000000..eca10616
--- /dev/null
+++ b/logic/lang/de_DE.ts
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="de_DE">
+<context>
+ <name>Work</name>
+ <message>
+ <source>Select filename</source>
+ <translation>Dateiname wählen</translation>
+ </message>
+ <message>
+ <source>CSV File (*.csv)</source>
+ <translation>CSV-Datei (*.csv)</translation>
+ </message>
+ <message>
+ <source>Logging error</source>
+ <translation>Protokollierungsfehler</translation>
+ </message>
+ <message>
+ <source>Unable to open file &apos;%1&apos;. Proceeding without logging.</source>
+ <translation>Datei &apos;%1&apos; kann nicht geöffnet werden. Es wird ohne Protokollierung fortgefahren.</translation>
+ </message>
+</context>
+<context>
+ <name>runtime_libraries</name>
+ <message>
+ <source>Library load failure</source>
+ <translation>Fehler beim Laden der Bibliothek</translation>
+ </message>
+ <message>
+ <source>Error occurred while loading protocol %1
+
+%2
+</source>
+ <translation>Ein Fehler trat auf beim Laden des Protokolls %1
+
+%2
+</translation>
+ </message>
+ <message>
+ <source>Error occurred while loading filter %1
+
+%2
+</source>
+ <translation>Fehler beim Laden des Filters %1
+
+%2
+</translation>
+ </message>
+ <message>
+ <source>Error occurred while loading tracker %1
+
+%2
+</source>
+ <translation>Fehler beim Laden des Trackers %1
+
+%2
+</translation>
+ </message>
+ <message>
+ <source>Startup failure</source>
+ <translation>Ausführungsfehler</translation>
+ </message>
+</context>
+</TS>
diff --git a/logic/lang/zh_CN.ts b/logic/lang/zh_CN.ts
index cc15f98a..000aff7c 100644
--- a/logic/lang/zh_CN.ts
+++ b/logic/lang/zh_CN.ts
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="zh_CN">
<context>
<name>Work</name>
<message>
<source>Select filename</source>
- <translation type="unfinished"></translation>
+ <translation>选择文件名</translation>
</message>
<message>
<source>CSV File (*.csv)</source>
@@ -17,35 +17,44 @@
</message>
<message>
<source>Unable to open file &apos;%1&apos;. Proceeding without logging.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">未能打开文件 &apos;%1&apos;. Proceeding without logging.</translation>
</message>
</context>
<context>
<name>runtime_libraries</name>
<message>
<source>Library load failure</source>
- <translation type="unfinished"></translation>
+ <translation>库加载失败</translation>
</message>
<message>
<source>Error occurred while loading protocol %1
%2
</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">加载协议 %1 时发生错误
+
+%2
+</translation>
</message>
<message>
<source>Error occurred while loading filter %1
%2
</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">加载滤波器 %1 时发生错误
+
+%2
+</translation>
</message>
<message>
<source>Error occurred while loading tracker %1
%2
</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">加载跟踪器 %1 时发生错误
+
+%2
+</translation>
</message>
<message>
<source>Startup failure</source>
diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp
index 8fef7ea7..fcd5e745 100644
--- a/logic/main-settings.hpp
+++ b/logic/main-settings.hpp
@@ -15,13 +15,21 @@
#include "export.hpp"
-enum reltrans_state
+enum reltrans_state : int
{
reltrans_disabled = 0,
reltrans_enabled = 1,
reltrans_non_center = 2,
};
+enum centering_state : int
+{
+ center_disabled = 0,
+ center_point = 1,
+ center_vr360 = 2,
+ center_roll_compensated = 3,
+};
+
namespace main_settings_impl {
using namespace options;
@@ -65,7 +73,7 @@ struct OTR_LOGIC_EXPORT main_settings final
value<bool> tray_start { b, "start-in-tray", false };
value<bool> center_at_startup { b, "center-at-startup", true };
- //value<int> center_method;
+ value<centering_state> centering_mode { b, "centering-mode", center_roll_compensated };
value<int> neck_z { b, "neck-depth", 0 };
value<bool> neck_enable { b, "neck-enable", false };
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index e6f82063..2e8efe55 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -15,7 +15,7 @@
#include "compat/sleep.hpp"
#include "compat/math.hpp"
#include "compat/meta.hpp"
-#include "compat/macros.hpp"
+#include "compat/macros.h"
#include "compat/thread-name.hpp"
#include "pipeline.hpp"
@@ -184,8 +184,8 @@ Pose_ reltrans::apply_neck(const rmat& R, int nz, bool disable_tz) const
return neck;
}
-pipeline::pipeline(const Mappings& m, const runtime_libraries& libs, event_handler& ev, TrackLogger& logger) :
- m(m), ev(ev), libs(libs), logger(logger)
+pipeline::pipeline(const Mappings& m, const runtime_libraries& libs, TrackLogger& logger) :
+ m(m), libs(libs), logger(logger)
{
}
@@ -272,7 +272,7 @@ bool pipeline::maybe_enable_center_on_tracking_started()
return false;
}
-void pipeline::maybe_set_center_pose(const Pose& value, bool own_center_logic)
+void pipeline::maybe_set_center_pose(const centering_state mode, const Pose& value, bool own_center_logic)
{
if (b.get(f_center | f_held_center))
{
@@ -283,34 +283,73 @@ void pipeline::maybe_set_center_pose(const Pose& value, bool own_center_logic)
if (own_center_logic)
{
- center.inv_R = rmat::eye();
- center.T = {};
+ center.P = {};
+ center.QC = QQuaternion(1,0,0,0);
+ center.QR = QQuaternion(1,0,0,0);
}
else
{
- center.inv_R = euler_to_rmat(Pose_(&value[Yaw]) * (M_PI / 180)).t();
- center.T = Pose_(&value[TX]);
+ if (mode)
+ {
+ center.P = value;
+ center.QC = QQuaternion::fromEulerAngles(value[Pitch], value[Yaw], -value[Roll]).conjugated();
+ center.QR = QQuaternion::fromEulerAngles(value[Pitch], value[Yaw], 0).conjugated();
+ }
+ else
+ {
+ // To reset the centering coordinates
+ // just select "Centering method [Disabled]" and then press [Center] button
+ center.P = {};
+ center.QC = QQuaternion(1,0,0,0);
+ center.QR = QQuaternion(1,0,0,0);
+ }
}
}
}
-Pose pipeline::apply_center(Pose value) const
+Pose pipeline::apply_center(const centering_state mode, Pose value) const
{
- {
- for (unsigned k = 0; k < 3; k++)
- value(k) -= center.T(k);
-
- Pose_ rot = rmat_to_euler(
- euler_to_rmat(Pose_(&value[Yaw]) * (M_PI / 180)) * center.inv_R
- );
- for (unsigned k = 0; k < 3; k++)
- value(k+3) = rot(k) * 180 / M_PI;
+ if (mode != center_disabled)
+ {
+ for (unsigned k = TX; k <= TZ; k++)
+ value(k) -= center.P(k);
+
+ QQuaternion q;
+ QVector3D v;
+
+ switch (mode)
+ {
+ case center_point:
+ for (unsigned k = Yaw; k <= Roll; k++)
+ {
+ value(k) -= center.P(k);
+ if (fabs(value[k]) > 180) value[k] -= copysign(360, value[k]);
+ }
+ break;
+ case center_vr360:
+ q = QQuaternion::fromEulerAngles(value[Pitch], value[Yaw], -value[Roll]);
+ q = center.QC * q;
+ v = q.toEulerAngles();
+ value[Pitch] = v.x();
+ value[Yaw] = v.y();
+ value[Roll] = -v.z();
+ break;
+ case center_roll_compensated:
+ q = QQuaternion::fromEulerAngles(value[Pitch], value[Yaw], center.P[Roll] - value[Roll]);
+ q = center.QR * q;
+ v = q.toEulerAngles();
+ value[Pitch] = v.x();
+ value[Yaw] = v.y();
+ value[Roll] = -v.z();
+ break;
+ case center_disabled: break;
+ }
}
for (int i = 0; i < 6; i++)
// don't invert after reltrans
// inverting here doesn't break centering
- if (m(i).opts.invert)
+ if (m(i).opts.invert_pre)
value(i) = -value(i);
return value;
@@ -352,7 +391,7 @@ Pose pipeline::maybe_apply_filter(const Pose& value) const
Pose pipeline::apply_zero_pos(Pose value) const
{
for (int i = 0; i < 6; i++)
- value(i) += m(i).opts.zero * (m(i).opts.invert ? -1 : 1);
+ value(i) += m(i).opts.zero * (m(i).opts.invert_pre ? -1 : 1);
return value;
}
@@ -383,7 +422,6 @@ Pose pipeline::apply_reltrans(Pose value, vec6_bool disabled, bool centerp)
void pipeline::logic()
{
using namespace euler;
- using EV = event_handler::event_ordinal;
logger.write_dt();
logger.reset_dt();
@@ -396,7 +434,6 @@ void pipeline::logic()
{
Pose tmp;
libs.pTracker->data(tmp);
- ev.run_events(EV::ev_raw, tmp);
newpose = tmp;
}
@@ -407,15 +444,14 @@ void pipeline::logic()
{
maybe_enable_center_on_tracking_started();
- maybe_set_center_pose(value, own_center_logic);
- value = apply_center(value);
+ maybe_set_center_pose(s.centering_mode, value, own_center_logic);
+ value = apply_center(s.centering_mode, value);
// "corrected" - after various transformations to account for camera position
logger.write_pose(value);
}
{
- ev.run_events(EV::ev_before_filter, value);
// we must proceed with all the filtering since the filter
// needs fresh values to prevent deconvergence
if (center_ordered)
@@ -427,7 +463,6 @@ void pipeline::logic()
}
{
- ev.run_events(EV::ev_before_mapping, value);
// CAVEAT rotation only, due to reltrans
for (int i = 3; i < 6; i++)
value(i) = map(value(i), m(i));
@@ -442,14 +477,13 @@ void pipeline::logic()
nan_check(value);
}
- if (!hold_ordered)
- goto ok;
+ goto ok;
error:
{
QMutexLocker foo(&mtx);
- value = output_pose;
+ value = last_value;
raw = raw_6dof;
// for widget last value display
@@ -465,9 +499,15 @@ ok:
for (int i = 0; i < 6; i++)
value(i) = 0;
+ if (hold_ordered)
+ value = last_value;
+ last_value = value;
value = apply_zero_pos(value);
- ev.run_events(EV::ev_finished, value);
+ for (int i = 0; i < 6; i++)
+ if (m(i).opts.invert_post)
+ value(i) = -value(i);
+
libs.pProtocol->pose(value, raw);
QMutexLocker foo(&mtx);
@@ -564,8 +604,7 @@ void pipeline::run()
backlog_time = {};
}
- const int sleep_ms = (int)clamp(interval - backlog_time,
- ms{0}, ms{10}).count();
+ const int sleep_ms = (int)std::clamp(interval - backlog_time, ms{0}, ms{10}).count();
#ifdef DEBUG_TIMINGS
debug_timings(backlog_time.count(), sleep_ms);
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 7775054e..a539525d 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -8,7 +8,6 @@
#include "compat/euler.hpp"
#include "compat/enum-operators.hpp"
#include "runtime-libraries.hpp"
-#include "extensions.hpp"
#include "spline/spline.hpp"
#include "main-settings.hpp"
@@ -20,6 +19,7 @@
#include <atomic>
#include <cmath>
+#include <QQuaternion>
#include "export.hpp"
@@ -84,10 +84,9 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
mutable QMutex mtx;
main_settings s;
const Mappings& m;
- event_handler& ev;
Timer t;
- Pose output_pose, raw_6dof;
+ Pose output_pose, raw_6dof, last_value;
Pose newpose;
runtime_libraries const& libs;
@@ -99,8 +98,9 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
reltrans rel;
struct {
- rmat inv_R = rmat::eye();
- Pose_ T;
+ Pose P;
+ QQuaternion QC = QQuaternion(1,0,0,0);
+ QQuaternion QR = QQuaternion(1,0,0,0);
} center;
time_units::ms backlog_time {};
@@ -111,8 +111,8 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
void logic();
void run() override;
bool maybe_enable_center_on_tracking_started();
- void maybe_set_center_pose(const Pose& value, bool own_center_logic);
- Pose apply_center(Pose value) const;
+ void maybe_set_center_pose(const centering_state mode, const Pose& value, bool own_center_logic);
+ Pose apply_center(const centering_state mode, Pose value) const;
std::tuple<Pose, Pose, vec6_bool> get_selected_axis_values(const Pose& newpose) const;
Pose maybe_apply_filter(const Pose& value) const;
Pose apply_reltrans(Pose value, vec6_bool disabled, bool centerp);
@@ -123,7 +123,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
bits b;
public:
- pipeline(const Mappings& m, const runtime_libraries& libs, event_handler& ev, TrackLogger& logger);
+ pipeline(const Mappings& m, const runtime_libraries& libs, TrackLogger& logger);
~pipeline() override;
void raw_and_mapped_pose(double* mapped, double* raw) const;
diff --git a/logic/shortcuts.cpp b/logic/shortcuts.cpp
index 377fa3e5..df21f7d2 100644
--- a/logic/shortcuts.cpp
+++ b/logic/shortcuts.cpp
@@ -51,6 +51,12 @@ void Shortcuts::bind_shortcut(K& key, const key_opts& k, bool held)
int idx = 0;
QKeySequence code(QKeySequence::UnknownKey);
+ if (k.guid == QStringLiteral("mouse"))
+ {
+ key.guid = k.guid;
+ key.keycode = k.button;
+ key.held = held;
+ }
if (!k.guid->isEmpty())
{
key.guid = k.guid;
@@ -70,7 +76,7 @@ void Shortcuts::bind_shortcut(K& key, const key_opts& k, bool held)
code != QKeySequence{ QKeySequence::UnknownKey } &&
win_key::from_qt(code, idx, mods))
{
- key.guid = "";
+ key.guid = QString{};
key.keycode = idx;
key.held = held;
key.ctrl = !!(mods & Qt::ControlModifier);
@@ -83,26 +89,27 @@ void Shortcuts::bind_shortcut(K& key, const key_opts& k, bool held)
#ifdef _WIN32
-void Shortcuts::receiver(const Key& k)
+void Shortcuts::receiver(const Key& key)
{
const unsigned sz = keys.size();
for (unsigned i = 0; i < sz; i++)
{
- K& k_ = std::get<0>(keys[i]);
- if (k.guid != k_.guid)
+ auto& [k, f, held] = keys[i];
+ if (key.guid != k.guid)
continue;
- if (k.keycode != k_.keycode)
+ if (key.keycode != k.keycode)
continue;
- if (k_.held && !k.held) continue;
- if (k_.alt != k.alt) continue;
- if (k_.ctrl != k.ctrl) continue;
- if (k_.shift != k.shift) continue;
- if (!k_.should_process())
- continue;
-
- fun& f = std::get<1>(keys[i]);
- f(k.held);
+ if (k.held && !key.held) continue;
+ if (key.held)
+ {
+ if (k.alt != key.alt) continue;
+ if (k.ctrl != key.ctrl) continue;
+ if (k.shift != key.shift) continue;
+ if (!k.should_process())
+ continue;
+ }
+ f(key.held);
}
}
diff --git a/logic/state.cpp b/logic/state.cpp
index afdf5b12..dc5e5a36 100644
--- a/logic/state.cpp
+++ b/logic/state.cpp
@@ -1,5 +1,5 @@
#include "state.hpp"
-
+#include "opentrack/defs.hpp"
#include <iterator>
using dylib_ptr = Modules::dylib_ptr;
@@ -22,13 +22,19 @@ std::tuple<dylib_ptr, int> State::module_by_name(const QString& name, dylib_list
State::State(const QString& library_path) :
modules(library_path),
- ev(modules.extensions()),
- pose(s.all_axis_opts)
+ pose(s.all_axis_opts),
+ library_path{library_path}
{}
dylib_ptr State::current_tracker()
{
- auto [ptr, idx] = module_by_name(m.tracker_dll, modules.trackers());
+ const QString& module =
+#ifdef UI_FORCED_TRACKER
+ UI_FORCED_TRACKER;
+#else
+ m.tracker_dll;
+#endif
+ auto [ptr, idx] = module_by_name(module, modules.trackers());
return ptr;
}
@@ -40,6 +46,12 @@ dylib_ptr State::current_protocol()
dylib_ptr State::current_filter()
{
- auto [ptr, idx] = module_by_name(m.filter_dll, modules.filters());
+ const QString& module =
+#ifdef UI_FORCED_FILTER
+ UI_FORCED_FILTER;
+#else
+ m.filter_dll;
+#endif
+ auto [ptr, idx] = module_by_name(module, modules.filters());
return ptr;
}
diff --git a/logic/state.hpp b/logic/state.hpp
index abce1daf..7fc06a5c 100644
--- a/logic/state.hpp
+++ b/logic/state.hpp
@@ -12,7 +12,6 @@
#include "api/plugin-support.hpp"
#include "main-settings.hpp"
#include "mappings.hpp"
-#include "extensions.hpp"
#include "work.hpp"
#include "export.hpp"
@@ -32,9 +31,9 @@ struct OTR_LOGIC_EXPORT State
dylib_ptr current_filter();
Modules modules;
- event_handler ev;
main_settings s;
module_settings m;
Mappings pose;
std::shared_ptr<Work> work;
+ QString library_path;
};
diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp
index c2920071..cb4f99b3 100644
--- a/logic/win32-shortcuts.cpp
+++ b/logic/win32-shortcuts.cpp
@@ -41,6 +41,9 @@ static const win_key windows_key_sequences[] {
{ DIK_F10, Qt::Key_F10 },
{ DIK_F11, Qt::Key_F11 },
{ DIK_F12, Qt::Key_F12 },
+ { DIK_F13, Qt::Key_F13 },
+ { DIK_F14, Qt::Key_F14 },
+ { DIK_F15, Qt::Key_F15 },
{ DIK_LEFT, Qt::Key_Left },
{ DIK_RIGHT, Qt::Key_Right },
{ DIK_UP, Qt::Key_Up },
@@ -63,18 +66,6 @@ static const win_key windows_key_sequences[] {
{ DIK_MINUS, Qt::Key_Minus },
{ DIK_EQUALS, Qt::Key_Equal },
{ DIK_PERIOD, Qt::Key_Period },
- { DIK_F1, Qt::Key_F1 },
- { DIK_F2, Qt::Key_F2 },
- { DIK_F3, Qt::Key_F3 },
- { DIK_F4, Qt::Key_F4 },
- { DIK_F5, Qt::Key_F5 },
- { DIK_F6, Qt::Key_F6 },
- { DIK_F7, Qt::Key_F7 },
- { DIK_F8, Qt::Key_F8 },
- { DIK_F9, Qt::Key_F9 },
- { DIK_F10, Qt::Key_F10 },
- { DIK_F11, Qt::Key_F11 },
- { DIK_F12, Qt::Key_F12 },
{ DIK_0, Qt::Key_0 },
{ DIK_1, Qt::Key_1 },
{ DIK_2, Qt::Key_2 },
diff --git a/logic/work.cpp b/logic/work.cpp
index 302414b8..8c6a3a62 100644
--- a/logic/work.cpp
+++ b/logic/work.cpp
@@ -36,12 +36,8 @@ std::unique_ptr<TrackLogger> Work::make_logger(main_settings &s)
if (s.tracklogging_enabled)
{
QString filename = browse_datalogging_file(s);
- if (filename.isEmpty())
- {
- // The user probably canceled the file dialog. In this case we don't want to do anything.
- return {};
- }
- else
+
+ if (!filename.isEmpty())
{
auto logger = std::make_unique<TrackLoggerCSV>(*s.tracklogging_filename);
@@ -61,10 +57,10 @@ std::unique_ptr<TrackLogger> Work::make_logger(main_settings &s)
}
-Work::Work(const Mappings& m, event_handler& ev, QFrame* frame,
+Work::Work(const Mappings& m, QFrame* frame,
const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto) :
libs(frame, tracker, filter, proto),
- pipeline_{ m, libs, ev, *logger }
+ pipeline_{ m, libs, *logger }
{
if (!is_ok())
return;
diff --git a/logic/work.hpp b/logic/work.hpp
index 82449e47..ef839257 100644
--- a/logic/work.hpp
+++ b/logic/work.hpp
@@ -45,21 +45,21 @@ public:
std::vector<key_tuple> keys {
// third argument means "keydown only"
- key_tuple(s.key_center1, [&](bool x) { pipeline_.set_held_center(x); }, false),
- key_tuple(s.key_center2, [&](bool x) { pipeline_.set_held_center(x); }, false),
+ key_tuple(s.key_center1, [this](bool x) { pipeline_.set_held_center(x); }, false),
+ key_tuple(s.key_center2, [this](bool x) { pipeline_.set_held_center(x); }, false),
- key_tuple(s.key_toggle1, [&](bool) { pipeline_.toggle_enabled(); }, true),
- key_tuple(s.key_toggle2, [&](bool) { pipeline_.toggle_enabled(); }, true),
- key_tuple(s.key_toggle_press1, [&](bool x) { pipeline_.set_enabled(!x); }, false),
- key_tuple(s.key_toggle_press2, [&](bool x) { pipeline_.set_enabled(!x); }, false),
+ key_tuple(s.key_toggle1, [this](bool) { pipeline_.toggle_enabled(); }, true),
+ key_tuple(s.key_toggle2, [this](bool) { pipeline_.toggle_enabled(); }, true),
+ key_tuple(s.key_toggle_press1, [this](bool x) { pipeline_.set_enabled(!x); }, false),
+ key_tuple(s.key_toggle_press2, [this](bool x) { pipeline_.set_enabled(!x); }, false),
- key_tuple(s.key_zero1, [&](bool) { pipeline_.toggle_zero(); }, true),
- key_tuple(s.key_zero2, [&](bool) { pipeline_.toggle_zero(); }, true),
- key_tuple(s.key_zero_press1, [&](bool x) { pipeline_.set_zero(x); }, false),
- key_tuple(s.key_zero_press2, [&](bool x) { pipeline_.set_zero(x); }, false),
+ key_tuple(s.key_zero1, [this](bool) { pipeline_.toggle_zero(); }, true),
+ key_tuple(s.key_zero2, [this](bool) { pipeline_.toggle_zero(); }, true),
+ key_tuple(s.key_zero_press1, [this](bool x) { pipeline_.set_zero(x); }, false),
+ key_tuple(s.key_zero_press2, [this](bool x) { pipeline_.set_zero(x); }, false),
};
- Work(const Mappings& m, event_handler& ev, QFrame* frame,
+ Work(const Mappings& m, QFrame* frame,
const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto);
void reload_shortcuts();
bool is_ok() const;