diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-30 07:37:41 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-30 08:39:32 +0100 |
commit | aa066bdd4622d4f6824fee864f6be6806813f04d (patch) | |
tree | 3df328b8b364cba2373a85827191b259bd78d546 /ftnoir_tracker_udp | |
parent | d6a54431d178632a2bf466c9904f74abd143afe6 (diff) |
move to subdirectory-based build system
Closes #224
Diffstat (limited to 'ftnoir_tracker_udp')
-rw-r--r-- | ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui | 208 | ||||
-rw-r--r-- | ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 70 | ||||
-rw-r--r-- | ftnoir_tracker_udp/ftnoir_tracker_udp.h | 60 | ||||
-rw-r--r-- | ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 26 |
4 files changed, 0 insertions, 364 deletions
diff --git a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui deleted file mode 100644 index cb9362ca..00000000 --- a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICFTNClientControls</class> - <widget class="QWidget" name="UICFTNClientControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>195</width> - <height>224</height> - </rect> - </property> - <property name="windowTitle"> - <string>UDP tracker settings</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>../facetracknoir/images/facetracknoir.png</normaloff>../facetracknoir/images/facetracknoir.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string/> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Port</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="spinPortNumber"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Add to axis</string> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="add_yaw"> - <item> - <property name="text"> - <string>0</string> - </property> - </item> - <item> - <property name="text"> - <string>+90</string> - </property> - </item> - <item> - <property name="text"> - <string>-90</string> - </property> - </item> - <item> - <property name="text"> - <string>+180</string> - </property> - </item> - <item> - <property name="text"> - <string>-180</string> - </property> - </item> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="add_pitch"> - <item> - <property name="text"> - <string>0</string> - </property> - </item> - <item> - <property name="text"> - <string>+90</string> - </property> - </item> - <item> - <property name="text"> - <string>-90</string> - </property> - </item> - <item> - <property name="text"> - <string>+180</string> - </property> - </item> - <item> - <property name="text"> - <string>-180</string> - </property> - </item> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="add_roll"> - <item> - <property name="text"> - <string>0</string> - </property> - </item> - <item> - <property name="text"> - <string>+90</string> - </property> - </item> - <item> - <property name="text"> - <string>-90</string> - </property> - </item> - <item> - <property name="text"> - <string>+180</string> - </property> - </item> - <item> - <property name="text"> - <string>-180</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp deleted file mode 100644 index 1610f917..00000000 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2014, Stanislaw Halik <sthalik@misaki.pl> - - * 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 "ftnoir_tracker_udp.h" -#include "opentrack/plugin-api.hpp" - -FTNoIR_Tracker::FTNoIR_Tracker() : last_recv_pose { 0,0,0, 0,0,0 }, should_quit(false) {} - -FTNoIR_Tracker::~FTNoIR_Tracker() -{ - should_quit = true; - wait(); -} - -void FTNoIR_Tracker::run() { - QByteArray datagram; - datagram.resize(sizeof(last_recv_pose)); - (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); - for (;;) { - if (should_quit) - break; - { - QMutexLocker foo(&mutex); - while (sock.hasPendingDatagrams()) { - sock.readDatagram((char * ) last_recv_pose, sizeof(double[6])); - } - } - msleep(1); - } -} - -void FTNoIR_Tracker::start_tracker(QFrame*) -{ - start(); - sock.moveToThread(this); -} - -void FTNoIR_Tracker::data(double *data) -{ - QMutexLocker foo(&mutex); - for (int i = 0; i < 6; i++) - data[i] = last_recv_pose[i]; - - int values[] = { - 0, - 90, - -90, - 180, - -180, - }; - int indices[] = { - s.add_yaw, - s.add_pitch, - s.add_roll, - }; - - for (int i = 0; i < 3; i++) - { - int k = std::min<unsigned>(sizeof(values)/sizeof(values[0]), std::max(0, indices[i])); - data[Yaw + i] += values[k]; - } -} - - -OPENTRACK_DECLARE_TRACKER(FTNoIR_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h deleted file mode 100644 index 6de5b295..00000000 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include "ui_ftnoir_ftnclientcontrols.h" -#include <QUdpSocket> -#include <QThread> -#include <cmath> -#include "opentrack/plugin-api.hpp" -#include "opentrack/options.hpp" -using namespace options; - -struct settings : opts { - value<int> port; - value<int> add_yaw, add_pitch, add_roll; - settings() : - opts("udp-tracker"), - port(b, "port", 4242), - add_yaw(b, "add-yaw", 0), - add_pitch(b, "add-pitch", 0), - add_roll(b, "add-roll", 0) - {} -}; - -class FTNoIR_Tracker : public ITracker, protected QThread -{ -public: - FTNoIR_Tracker(); - ~FTNoIR_Tracker() override; - void start_tracker(QFrame *) override; - void data(double *data) override; -protected: - void run() override; -private: - QUdpSocket sock; - double last_recv_pose[6]; - QMutex mutex; - settings s; - volatile bool should_quit; -}; - -class TrackerControls: public ITrackerDialog -{ - Q_OBJECT -public: - TrackerControls(); - void register_tracker(ITracker *) override {} - void unregister_tracker() override {} -private: - Ui::UICFTNClientControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class FTNoIR_TrackerDll : public Metadata -{ -public: - QString name() { return QString("UDP sender"); } - QIcon icon() { return QIcon(":/images/facetracknoir.png"); } -}; - diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp deleted file mode 100644 index 5e7d5437..00000000 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "ftnoir_tracker_udp.h" -#include "opentrack/plugin-api.hpp" - -TrackerControls::TrackerControls() -{ - ui.setupUi( this ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.port, ui.spinPortNumber); - tie_setting(s.add_yaw, ui.add_yaw); - tie_setting(s.add_pitch, ui.add_pitch); - tie_setting(s.add_roll, ui.add_roll); -} - -void TrackerControls::doOK() { - s.b->save(); - this->close(); -} - -void TrackerControls::doCancel() { - s.b->reload(); - this->close(); -} - |