summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-20 08:25:07 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-20 08:25:07 +0200
commitc4c115aa8d7fea128cecdcf9d08ae1935907c1ec (patch)
tree52d7b5d4275ba6f86e41461f0b74e1032a55a834
parentfeb12bd0eecc9f09ef7a1ab7fc60858ea519edbe (diff)
declutter stuff outta UI class
-rw-r--r--facetracknoir/facetracknoir.cpp5
-rw-r--r--facetracknoir/facetracknoir.h17
-rw-r--r--opentrack/state.hpp48
-rw-r--r--opentrack/work.hpp26
4 files changed, 52 insertions, 44 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index 4c074e6e..c547f608 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -25,10 +25,7 @@
#include "opentrack/tracker.h"
#include <QFileDialog>
-FaceTrackNoIR::FaceTrackNoIR() : QMainWindow(nullptr),
- b(bundle("opentrack-ui")),
- s(b),
- pose(std::vector<axis_opts*>{&s.a_x, &s.a_y, &s.a_z, &s.a_yaw, &s.a_pitch, &s.a_roll}),
+FaceTrackNoIR::FaceTrackNoIR() :
timUpdateHeadPose(this),
kbd_quit(QKeySequence("Ctrl+Q"), this),
no_feed_pixmap(":/uielements/no-feed.png")
diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h
index 13c2bb59..c90b33f6 100644
--- a/facetracknoir/facetracknoir.h
+++ b/facetracknoir/facetracknoir.h
@@ -50,39 +50,28 @@
#include "opentrack/tracker.h"
#include "opentrack/shortcuts.h"
#include "opentrack/work.hpp"
+#include "opentrack/state.hpp"
#include "curve-config.h"
using namespace options;
-class FaceTrackNoIR : public QMainWindow
+class FaceTrackNoIR : public QMainWindow, private State
{
Q_OBJECT
-public:
- pbundle b;
- main_settings s;
-private:
- // XXX move the shit outta the _widget_, establish a class
- // for running tracker state, etc -sh 20141014
- Mappings pose;
Ui::OpentrackUI ui;
QTimer timUpdateHeadPose;
- SelectedLibraries libs;
- ptr<Work> work;
-
ptr<KeyboardShortcutDialog> shortcuts_widget;
ptr<MapWidget> mapping_widget;
QShortcut kbd_quit;
QPixmap no_feed_pixmap;
+
ptr<IFilterDialog> pFilterDialog;
ptr<IProtocolDialog> pProtocolDialog;
ptr<ITrackerDialog> pTrackerDialog;
- Modules modules;
- // XXX this shit stinks -sh 20141004
- // TODO move to separate class representing running tracker state
ptr<dylib> current_tracker()
{
return modules.trackers().value(ui.iconcomboTrackerSource->currentIndex(), nullptr);
diff --git a/opentrack/state.hpp b/opentrack/state.hpp
new file mode 100644
index 00000000..7fde64dc
--- /dev/null
+++ b/opentrack/state.hpp
@@ -0,0 +1,48 @@
+#include <vector>
+#include "opentrack/options.hpp"
+using namespace options;
+#include "opentrack/plugin-support.h"
+#include "opentrack/main-settings.hpp"
+#include "opentrack/mappings.hpp"
+
+struct Modules {
+ Modules() :
+ module_list(dylib::enum_libraries()),
+ filter_modules(filter(dylib::Filter)),
+ tracker_modules(filter(dylib::Tracker)),
+ protocol_modules(filter(dylib::Protocol))
+ {}
+ QList<ptr<dylib>>& filters() { return filter_modules; }
+ QList<ptr<dylib>>& trackers() { return tracker_modules; }
+ QList<ptr<dylib>>& protocols() { return protocol_modules; }
+private:
+ QList<ptr<dylib>> module_list;
+ QList<ptr<dylib>> filter_modules;
+ QList<ptr<dylib>> tracker_modules;
+ QList<ptr<dylib>> protocol_modules;
+
+ QList<ptr<dylib>> filter(dylib::Type t)
+ {
+ QList<ptr<dylib>> ret;
+ for (auto x : module_list)
+ if (x->type == t)
+ ret.push_back(x);
+ return ret;
+ }
+};
+
+struct Work;
+
+struct State {
+ State() :
+ b(bundle("opentrack-ui")),
+ s(b),
+ pose(std::vector<axis_opts*>{&s.a_x, &s.a_y, &s.a_z, &s.a_yaw, &s.a_pitch, &s.a_roll})
+ {}
+ Modules modules;
+ SelectedLibraries libs;
+ pbundle b;
+ main_settings s;
+ Mappings pose;
+ ptr<Work> work;
+};
diff --git a/opentrack/work.hpp b/opentrack/work.hpp
index 3e51b480..bd69f7ba 100644
--- a/opentrack/work.hpp
+++ b/opentrack/work.hpp
@@ -9,32 +9,6 @@
#include <QFrame>
#include <memory>
-struct Modules {
- Modules() :
- module_list(dylib::enum_libraries()),
- filter_modules(filter(dylib::Filter)),
- tracker_modules(filter(dylib::Tracker)),
- protocol_modules(filter(dylib::Protocol))
- {}
- QList<ptr<dylib>>& filters() { return filter_modules; }
- QList<ptr<dylib>>& trackers() { return tracker_modules; }
- QList<ptr<dylib>>& protocols() { return protocol_modules; }
-private:
- QList<ptr<dylib>> module_list;
- QList<ptr<dylib>> filter_modules;
- QList<ptr<dylib>> tracker_modules;
- QList<ptr<dylib>> protocol_modules;
-
- QList<ptr<dylib>> filter(dylib::Type t)
- {
- QList<ptr<dylib>> ret;
- for (auto x : module_list)
- if (x->type == t)
- ret.push_back(x);
- return ret;
- }
-};
-
struct Work
{
main_settings& s;