summaryrefslogtreecommitdiffhomepage
path: root/logic/work.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/work.hpp')
-rw-r--r--logic/work.hpp52
1 files changed, 36 insertions, 16 deletions
diff --git a/logic/work.hpp b/logic/work.hpp
index f1d5e401..ef839257 100644
--- a/logic/work.hpp
+++ b/logic/work.hpp
@@ -10,12 +10,13 @@
#include "main-settings.hpp"
#include "api/plugin-support.hpp"
-#include "tracker.h"
+#include "pipeline.hpp"
#include "shortcuts.h"
#include "export.hpp"
#include "tracklogger.hpp"
-#include "logic/selected-libraries.hpp"
+#include "logic/runtime-libraries.hpp"
#include "api/plugin-support.hpp"
+#include "compat/tr.hpp"
#include <QObject>
#include <QFrame>
@@ -24,23 +25,42 @@
#include <tuple>
#include <functional>
-struct OTR_LOGIC_EXPORT Work
+class OTR_LOGIC_EXPORT Work final : public QObject
{
+ Q_OBJECT
+
+ using dylibptr = std::shared_ptr<dylib>;
+
+ static std::unique_ptr<TrackLogger> make_logger(main_settings &s);
+ static QString browse_datalogging_file(main_settings &s);
+
+public:
using fn_t = std::function<void(bool)>;
using key_tuple = std::tuple<key_opts&, fn_t, bool>;
- main_settings s; // tracker needs settings, so settings must come before it
- SelectedLibraries libs; // idem
- std::shared_ptr<TrackLogger> logger; // must come before tracker, since tracker depends on it
- std::shared_ptr<Tracker> tracker;
- std::shared_ptr<Shortcuts> sc;
- std::vector<key_tuple> keys;
-
- Work(Mappings& m, QFrame* frame, mem<dylib> tracker, mem<dylib> filter, mem<dylib> proto);
- ~Work();
+ main_settings s; // pipeline needs settings, so settings must come before it
+ runtime_libraries libs; // idem
+ std::unique_ptr<TrackLogger> logger { make_logger(s) }; // must come before pipeline, since pipeline depends on it
+ pipeline pipeline_;
+ Shortcuts sc;
+
+ std::vector<key_tuple> keys {
+ // third argument means "keydown only"
+ 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, [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, [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, QFrame* frame,
+ const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto);
void reload_shortcuts();
bool is_ok() const;
-
-private:
- static std::shared_ptr<TrackLogger> make_logger(main_settings &s);
- static QString browse_datalogging_file(main_settings &s);
};