summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-17 08:28:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-17 08:28:51 +0200
commite3a5755b1c675e66163a879ee5e5290bf0b01251 (patch)
tree4de6d67c1b157459d92653e201b0a3846d40d8f7
parentfe8fa2db6a8b01e06d6fa7129a38211ce164895e (diff)
parent45b346cc1a4a7b7e6716ec8ee0f58ad03c60d865 (diff)
Merge branch 'unstable' into trackhat-ui
-rw-r--r--facetracknoir/ui.cpp23
-rw-r--r--facetracknoir/ui.h9
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp5
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp5
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma2.h2
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp5
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp7
-rwxr-xr-xftnoir_filter_kalman/ftnoir_filter_kalman.h8
-rw-r--r--ftnoir_filter_kalman/kalman.cpp14
-rw-r--r--ftnoir_protocol_fg/ftnoir_protocol_fg.cpp5
-rw-r--r--ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp4
-rw-r--r--ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp32
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp5
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp4
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp31
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp5
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp4
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp7
-rw-r--r--ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp5
-rw-r--r--ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp5
-rw-r--r--ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp31
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp5
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp5
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp8
-rw-r--r--ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp5
-rw-r--r--ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp4
-rw-r--r--ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp31
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.cpp8
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp4
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp32
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp5
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp4
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp8
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine.cpp5
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp4
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp7
-rw-r--r--ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx8
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp28
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.h6
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h18
-rw-r--r--ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp5
-rw-r--r--ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp4
-rw-r--r--ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp7
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp8
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat.h17
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp3
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp102
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.cpp18
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.h6
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h7
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp5
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp4
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp9
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp5
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp5
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp7
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt.cpp10
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt.h6
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.cpp5
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp4
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp9
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp.cpp6
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp.h1
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp4
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp7
-rw-r--r--opentrack/plugin-api.hpp111
-rw-r--r--opentrack/plugin-qt-api.hpp61
67 files changed, 207 insertions, 640 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 88a44216..4d74aa07 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -175,11 +175,11 @@ extern "C" volatile const char* opentrack_version;
void MainWindow::fill_profile_combobox()
{
QStringList ini_list = group::ini_list();
- QString current = QFileInfo(group::ini_pathname()).fileName();
- setWindowTitle(QStringLiteral("TrackHat ") + QString( const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ")) + current);
+ set_title();
ui.iconcomboProfile->clear();
for (auto x : ini_list)
ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), x);
+ QString current = QFileInfo(group::ini_pathname()).fileName();
ui.iconcomboProfile->setCurrentText(current);
}
@@ -261,6 +261,8 @@ void MainWindow::stopTracker( ) {
display_pose(p, p);
}
updateButtonState(false, false);
+
+ set_title();
}
void MainWindow::display_pose(const double *mapped, const double *raw)
@@ -292,6 +294,20 @@ void MainWindow::display_pose(const double *mapped, const double *raw)
ui.pose_yaw->display(mapped_[Yaw]);
ui.pose_pitch->display(mapped_[Pitch]);
ui.pose_roll->display(mapped_[Roll]);
+
+ QString game_title;
+ if (libs.pProtocol)
+ game_title = libs.pProtocol->game_name();
+ set_title(game_title);
+}
+
+void MainWindow::set_title(const QString& game_title_)
+{
+ QString game_title;
+ if (game_title_ != "")
+ game_title = " :: " + game_title_;
+ QString current = QFileInfo(group::ini_pathname()).fileName();
+ setWindowTitle(QStringLiteral("TrackHat ") + const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ") + current + game_title);
}
void MainWindow::showHeadPose()
@@ -402,6 +418,9 @@ void MainWindow::profileSelected(int index)
settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" +
ui.iconcomboProfile->itemText(index)));
}
+
+ set_title();
+
load_settings();
}
diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h
index 1a4ce5cb..ccd82e5b 100644
--- a/facetracknoir/ui.h
+++ b/facetracknoir/ui.h
@@ -25,18 +25,12 @@
#pragma once
#include <QMainWindow>
-#include <QApplication>
-#include <QWidget>
-#include <QDialog>
-#include <QUrl>
-#include <QList>
#include <QKeySequence>
#include <QShortcut>
-#include <QLayout>
#include <QPixmap>
-#include <QLabel>
#include <QTimer>
#include <QSystemTrayIcon>
+#include <QString>
#if !defined(_WIN32)
# include "qxt-mini/QxtGlobalShortcut"
@@ -87,6 +81,7 @@ class MainWindow : public QMainWindow, private State
void fill_profile_combobox();
void display_pose(const double* mapped, const double* raw);
void ensure_tray();
+ void set_title(const QString& game_title = QStringLiteral(""));
public slots:
void shortcutRecentered();
void shortcutToggled();
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 86b65e1c..9e1b2415 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -30,8 +30,8 @@ static constexpr double trans_gains[][2] = {
{ 2, 150 },
{ 1.66, 60 },
{ 1.33, 20 },
- { 1, 4 },
- { .66, 1.5 },
+ { 1, 2 },
+ { .66, .6 },
{ .33, .2 },
{ 0, 0 },
{ -1, 0 }
@@ -103,4 +103,3 @@ void FTNoIR_Filter::filter(const double* input, double *output)
last_output[i] = output[i] = ret;
}
}
-
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
index 86cc2a96..c09fb912 100644
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
+++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
@@ -78,7 +78,4 @@ void FTNoIR_Filter::filter(const double *input, double *output)
}
}
-extern "C" OPENTRACK_EXPORT IFilter* GetConstructor()
-{
- return new FTNoIR_Filter;
-}
+OPENTRACK_DECLARE_FILTER(FTNoIR_Filter, FilterControls, FTNoIR_FilterDll)
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
index 9f603b25..bf4e83ad 100644
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
+++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
@@ -62,5 +62,5 @@ class FTNoIR_FilterDll : public Metadata
{
public:
QString name() { return QString("EWMA"); }
- QIcon icon() { return QIcon(":/images/filter-16.png"); }
+ QIcon icon() { return QIcon(":/images/filter-16.png"); }
};
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp
index 228bc086..30fb6003 100644
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp
+++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp
@@ -41,8 +41,3 @@ void FilterControls::save() {
if (pFilter)
pFilter->receiveSettings();
}
-
-extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog( )
-{
- return new FilterControls;
-}
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp
deleted file mode 100644
index 999dcd6f..00000000
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ftnoir_filter_ewma2.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_FilterDll;
-}
diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h
index e84ef347..a6f40bb7 100755
--- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h
+++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h
@@ -27,7 +27,7 @@ struct settings : opts {
{}
};
-class OPENTRACK_EXPORT FTNoIR_Filter : public IFilter
+class FTNoIR_Filter : public IFilter
{
public:
FTNoIR_Filter();
@@ -44,14 +44,14 @@ public:
int prev_slider_pos;
};
-class OPENTRACK_EXPORT FTNoIR_FilterDll : public Metadata
+class FTNoIR_FilterDll : public Metadata
{
public:
QString name() { return QString("Kalman"); }
- QIcon icon() { return QIcon(":/images/filter-16.png"); }
+ QIcon icon() { return QIcon(":/images/filter-16.png"); }
};
-class OPENTRACK_EXPORT FilterControls: public IFilterDialog
+class FilterControls: public IFilterDialog
{
Q_OBJECT
public:
diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp
index 08b46f0f..f0b9e261 100644
--- a/ftnoir_filter_kalman/kalman.cpp
+++ b/ftnoir_filter_kalman/kalman.cpp
@@ -124,16 +124,4 @@ void FilterControls::doCancel() {
close();
}
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_FilterDll;
-}
-
-extern "C" OPENTRACK_EXPORT IFilter* GetConstructor()
-{
- return new FTNoIR_Filter;
-}
-
-extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog() {
- return new FilterControls;
-}
+OPENTRACK_DECLARE_FILTER(FTNoIR_Filter, FilterControls, FTNoIR_FilterDll)
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp
index 85dd4684..ced1acf8 100644
--- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp
+++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp
@@ -52,7 +52,4 @@ bool FTNoIR_Protocol::correct()
return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FGControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp
index d15c9466..04830c0b 100644
--- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp
+++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp
@@ -61,7 +61,3 @@ void FGControls::doCancel() {
this->close();
}
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
-{
- return new FGControls;
-}
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp
deleted file mode 100644
index aaaa1d63..00000000
--- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_protocol_fg.h"
-#include <QDebug>
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
index 20a39fbc..a7bb4a39 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
@@ -158,7 +158,4 @@ bool FTNoIR_Protocol::correct()
return true;
}
-extern "C" OPENTRACK_EXPORT FTNoIR_Protocol* GetConstructor(void)
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FSUIPCControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
index d38eae71..14fe54bf 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
@@ -55,7 +55,3 @@ void FSUIPCControls::getLocationOfDLL()
}
}
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog(void)
-{
- return new FSUIPCControls;
-}
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp
deleted file mode 100644
index 19ecf351..00000000
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_protocol_fsuipc.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata(void)
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
index 56ae061f..73bf834a 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
@@ -178,7 +178,4 @@ bool FTNoIR_Protocol::correct()
return true;
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FTControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
index 3e440607..db0165b5 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
@@ -72,7 +72,3 @@ void FTControls::selectDLL() {
}
}
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog()
-{
- return new FTControls;
-}
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp
deleted file mode 100644
index 13506022..00000000
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "opentrack/plugin-api.hpp"
-#include "ftnoir_protocol_ft/ftnoir_protocol_ft.h"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp
index f5911b2a..6aed5210 100644
--- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp
+++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp
@@ -48,7 +48,4 @@ bool FTNoIR_Protocol::correct()
return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FTNControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp
index 8104a9de..8a66f13b 100644
--- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp
+++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp
@@ -54,8 +54,3 @@ void FTNControls::doCancel() {
s.b->reload();
this->close();
}
-
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
-{
- return new FTNControls;
-}
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp
deleted file mode 100644
index d1fa3e33..00000000
--- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_protocol_ftn.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp
index f0479e0d..96805b39 100644
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp
+++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp
@@ -94,7 +94,4 @@ void FTNoIR_Protocol::pose(const double* headpose) {
(void) libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, LibevdevControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp
index 68a4610a..70495a8f 100644
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp
+++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp
@@ -19,8 +19,3 @@ void LibevdevControls::doCancel() {
void LibevdevControls::save() {
}
-
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
-{
- return new LibevdevControls;
-}
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp
deleted file mode 100644
index 9a16ea52..00000000
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "ftnoir_protocol_libevdev.h"
-#include <QDebug>
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp
index ebf1ad19..6b7c52b2 100644
--- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp
+++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp
@@ -72,7 +72,4 @@ bool FTNoIR_Protocol::correct()
return true;
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, MOUSEControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp
index f4ecaa48..6633ee8c 100644
--- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp
+++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp
@@ -61,7 +61,3 @@ void MOUSEControls::doCancel() {
this->close();
}
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
-{
- return new MOUSEControls;
-}
diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp
deleted file mode 100644
index 7bc2b85c..00000000
--- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_protocol_mouse.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
index 52db14f8..ef695623 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
@@ -41,9 +41,6 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
void FTNoIR_Protocol::run()
{
- (void) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
- (void) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
-
HANDLE event = CreateEvent(NULL, FALSE, FALSE, nullptr);
if (event == nullptr)
@@ -206,7 +203,4 @@ void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData
}
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, SCControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp
index 30f7d460..5aa6f5f9 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp
@@ -47,7 +47,3 @@ void SCControls::doCancel() {
close();
}
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
-{
- return new SCControls;
-}
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp
deleted file mode 100644
index 937ffe0c..00000000
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_protocol_sc.h"
-#include <QDebug>
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
index 63f75685..24148c63 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
@@ -30,7 +30,4 @@ void FTNoIR_Protocol::pose( const double *headpose ) {
VJoy_UpdateJoyState(0, state);
}
-extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
-{
- return new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, VJoyControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp
index 8da3ccfd..08c65558 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp
@@ -20,7 +20,3 @@ void VJoyControls::doCancel() {
void VJoyControls::save() {
}
-extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
-{
- return new VJoyControls;
-}
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
deleted file mode 100644
index fc30921d..00000000
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "ftnoir_protocol_vjoy.h"
-#include <QDebug>
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
index 5f80944a..99ad30a2 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
@@ -56,7 +56,4 @@ bool FTNoIR_Protocol::correct()
return lck_shm.success();
}
-extern "C" OPENTRACK_EXPORT void* GetConstructor()
-{
- return (IProtocol*) new FTNoIR_Protocol;
-}
+OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, FTControls, FTNoIR_ProtocolDll)
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp
index 81fc9560..e4027c73 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp
@@ -17,7 +17,3 @@ void FTControls::doCancel() {
this->close();
}
-extern "C" OPENTRACK_EXPORT void* GetDialog( )
-{
- return (IProtocolDialog*) new FTControls;
-}
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp
deleted file mode 100644
index 92faaa94..00000000
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ftnoir_protocol_wine.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_ProtocolDll;
-}
diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx
index 896d8078..b5906675 100644
--- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx
+++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx
@@ -2,9 +2,11 @@
#include <cstdio>
#include "freetrackclient/fttypes.h"
#include "ftnoir_protocol_wine/wine-shm.h"
+#include "opentrack/export.hpp"
-#define OPENTRACK_CROSS_ONLY
-#include "../opentrack/plugin-api.hpp"
+enum Axis {
+ TX = 0, TY, TZ, Yaw, Pitch, Roll
+};
#define OPENTRACK_COMPAT_BUNDLED
#include "compat/compat.h"
@@ -71,5 +73,5 @@ int main(void)
for (int i = 0; i < 8; i++)
shm_wine->table[i] = shm_posix->table[i];
(void) Sleep(4);
- }
+ }
}
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
index 6d87503f..f7e283f3 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
@@ -372,32 +372,6 @@ void Tracker::data(double *data)
data[TZ] = pose[TZ] * .1;
}
-class TrackerDll : public Metadata
-{
- QString name() { return QString("aruco -- paper marker tracker"); }
- QIcon icon() { return QIcon(":/images/aruco.png"); }
-};
-
-//-----------------------------------------------------------------------------
-//#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new TrackerDll;
-}
-
-//#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new Tracker;
-}
-
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( )
-{
- return new TrackerControls;
-}
-
TrackerControls::TrackerControls()
{
tracker = nullptr;
@@ -472,3 +446,5 @@ void TrackerControls::camera_settings()
{
open_camera_settings(tracker ? &tracker->camera : nullptr, s.camera_name, tracker ? &tracker->camera_mtx : nullptr);
}
+
+OPENTRACK_DECLARE_TRACKER(Tracker, TrackerControls, TrackerDll)
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
index 297fecdb..ae574338 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
@@ -90,3 +90,9 @@ private slots:
void update_tracker_calibration();
void camera_settings();
};
+
+class TrackerDll : public Metadata
+{
+ QString name() { return QString("aruco -- paper marker tracker"); }
+ QIcon icon() { return QIcon(":/images/aruco.png"); }
+};
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h
deleted file mode 100644
index ac393bfb..00000000
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2013 Stanisław 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 "opentrack/plugin-api.hpp"
-
-//-----------------------------------------------------------------------------
-class TrackerDll : public Metadata
-{
- // ITrackerDll interface
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
-};
diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp
index 540ef616..1525e3c4 100644
--- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp
+++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp
@@ -115,7 +115,4 @@ void TrackerImpl::data(double *data)
data[Roll] = pose[Roll];
}
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new TrackerImpl;
-}
+OPENTRACK_DECLARE_TRACKER(TrackerImpl, TrackerDialog, TrackerMeta)
diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp
index 1f17355f..55427d35 100644
--- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp
+++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp
@@ -28,7 +28,3 @@ void TrackerDialog::doCancel() {
this->close();
}
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog()
-{
- return new TrackerDialog;
-}
diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp
deleted file mode 100644
index 5b08f040..00000000
--- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ftnoir_tracker_freepie-udp.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new TrackerMeta;
-}
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp
index 5a4e9c74..72b7d3ed 100644
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp
+++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp
@@ -603,11 +603,13 @@ void FTNoIR_Tracker::Log(QString message)
// _GetTracker@0 - Common name decoration for __stdcall functions in C language.
////////////////////////////////////////////////////////////////////////////////
#ifdef OPENTRACK_API
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
+#include "ftnoir_tracker_hat_dialog.h"
+OPENTRACK_DECLARE_TRACKER(FTNoIR_Tracker, TrackerControls, TrackerDll)
#else
#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
-#endif
{
- return new FTNoIR_Tracker;
+ return new FTNoIR_Tracker;
}
+#endif
+
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h
index 9471ebfb..e3c5a26b 100644
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h
+++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h
@@ -123,36 +123,35 @@ private:
//*******************************************************************************************************
// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker
//*******************************************************************************************************
-class TrackerDll :
#if defined(OPENTRACK_API)
-public Metadata
+class TrackerDll : public Metadata
+{
+ QString name() { return QString("Hatire Arduino"); }
+ QIcon icon() { return QIcon(":/images/hatire.png"); }
+};
#else
+class TrackerDll :
+public Metadata
public ITrackerDll
-#endif
{
public:
TrackerDll();
~TrackerDll();
-#ifndef OPENTRACK_API
void Initialize();
-#endif
-#ifdef OPENTRACK_API
QString name();
QIcon icon();
-#else
void getFullName(QString *strToBeFilled);
void getShortName(QString *strToBeFilled);
void getDescription(QString *strToBeFilled);
void getIcon(QIcon *icon);
-#endif
private:
QString trackerFullName; // Trackers' name and description
QString trackerShortName;
QString trackerDescription;
};
-
+#endif
#endif // FTNOIR_TRACKER_HAT_H
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp
index b22e3b15..901f0ec9 100644
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp
+++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp
@@ -418,12 +418,11 @@ void TrackerControls::unRegisterTracker()
// Win32 API function.
// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language.
#ifdef OPENTRACK_API
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( )
#else
#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( )
-#endif
{
return new TrackerControls;
}
+#endif
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp
deleted file mode 100644
index 66fead4f..00000000
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* Homepage: http://facetracknoir.sourceforge.net/home/default.htm *
-* *
-* Copyright (C) 2012 FuraX49 (HAT Tracker plugins) *
-* Homepage: http://hatire.sourceforge.net *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-
-#include "ftnoir_tracker_hat.h"
-#include <QIcon>
-#include <QDebug>
-
-TrackerDll::TrackerDll() {
- //populate the description strings
- trackerFullName = "Hatire Arduino";
- trackerShortName = "HAT";
- trackerDescription = "FaceTrackNoIR HAT";
-}
-
-TrackerDll::~TrackerDll()
-{
-
-}
-
-#ifndef OPENTRACK_API
-void TrackerDll::Initialize()
-{
- return;
-}
-#endif
-
-#ifndef OPENTRACK_API
-void TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = trackerFullName;
-}
-
-void TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = trackerShortName;
-}
-
-void TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = trackerDescription;
-}
-
-void TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/hat.png");
-}
-#else
-
-QString TrackerDll::name()
-{
- return trackerFullName;
-}
-
-QIcon TrackerDll::icon()
-{
- return QIcon(":/images/hat.png");
-}
-
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Tracker object.
-
-// Export both decorated and undecorated names.
-// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language.
-
-#ifdef OPENTRACK_API
-# include "opentrack/plugin-support.hpp"
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-#else
-# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll()
-#endif
-{
- return new TrackerDll;
-}
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
index 577ae40d..86992911 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
@@ -1,7 +1,6 @@
#include "stdafx.h"
#include "headtracker-ftnoir.h"
#include "ftnoir_tracker_ht.h"
-#include "ftnoir_tracker_ht_dll.h"
#include "ui_ht-trackercontrols.h"
#include "opentrack/plugin-api.hpp"
#include <cmath>
@@ -182,21 +181,6 @@ void Tracker::data(double* data)
}
}
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new TrackerDll;
-}
-
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new Tracker;
-}
-
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( )
-{
- return new TrackerControls;
-}
-
TrackerControls::TrackerControls() : tracker(nullptr)
{
ui.setupUi(this);
@@ -235,3 +219,5 @@ void TrackerControls::camera_settings()
else
open_camera_settings(nullptr, s.camera_name, nullptr);
}
+
+OPENTRACK_DECLARE_TRACKER(Tracker, TrackerControls, TrackerDll)
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h
index b2fcb147..32fb6949 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h
@@ -81,3 +81,9 @@ private slots:
void doCancel();
void camera_settings();
};
+
+class TrackerDll : public Metadata
+{
+ QString name() { return QString("ht -- face tracker"); }
+ QIcon icon() { return QIcon(":/images/ht.png"); }
+};
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h
deleted file mode 100644
index 853d3181..00000000
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "opentrack/plugin-api.hpp"
-
-class TrackerDll : public Metadata
-{
- QString name() { return QString("ht -- face tracker"); }
- QIcon icon() { return QIcon(":/images/ht.png"); }
-};
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
index 826cecaa..8d0e6832 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
@@ -43,7 +43,4 @@ void Hydra_Tracker::data(double *data)
data[Roll] = ypr[2] * r2d;
}
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new Hydra_Tracker;
-}
+OPENTRACK_DECLARE_TRACKER(Hydra_Tracker, TrackerControls, FTNoIR_TrackerDll)
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp
index 83b48a8e..2c23ee46 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp
@@ -20,7 +20,3 @@ void TrackerControls::doCancel() {
close();
}
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( )
-{
- return new TrackerControls;
-}
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp
deleted file mode 100644
index 1faa1578..00000000
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */
-#include "ftnoir_tracker_hydra.h"
-#include <QDebug>
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_TrackerDll;
-}
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
index 264166fe..9fe382c3 100644
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
+++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
@@ -217,7 +217,4 @@ void FTNoIR_Tracker::data(double *data)
}
}
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new FTNoIR_Tracker;
-}
+OPENTRACK_DECLARE_TRACKER(FTNoIR_Tracker, TrackerControls, FTNoIR_TrackerDll)
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp
index b201f3f8..7200003c 100644
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp
+++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp
@@ -60,7 +60,4 @@ void TrackerControls::doCancel() {
this->close();
}
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( )
-{
- return new TrackerControls;
-}
+
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp
deleted file mode 100644
index 0dca6c9b..00000000
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ftnoir_tracker_joystick.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_TrackerDll;
-}
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
index d3cf18c1..a77d206a 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
@@ -250,3 +250,13 @@ void Tracker_PT::data(THeadPoseData *data)
data[TZ] = t[2] / 10.0;
}
}
+
+//-----------------------------------------------------------------------------
+#ifdef OPENTRACK_API
+#else
+#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
+OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker()
+{
+ return new Tracker_PT;
+}
+#endif
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h
index d0764933..21da9a2c 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h
@@ -83,6 +83,10 @@ private:
static constexpr double deg2rad = 3.14159265/180.0;
};
-#undef VideoWidget
+class TrackerDll : public Metadata
+{
+ QString name() { return QString("PointTracker 1.1"); }
+ QIcon icon() { return QIcon(":/Resources/Logo_IR.png"); }
+};
#endif // FTNOIR_TRACKER_PT_H
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
index 0328428f..74208272 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
@@ -68,7 +68,4 @@ void Rift_Tracker::data(double *data)
}
}
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new Rift_Tracker;
-}
+OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll)
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp
index 2439890b..6c8e9cd7 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp
@@ -24,7 +24,3 @@ void TrackerControls::doCancel() {
close();
}
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog()
-{
- return new TrackerControls;
-}
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp
deleted file mode 100644
index 2809ef29..00000000
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */
-#include "ftnoir_tracker_rift.h"
-#include <QDebug>
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_TrackerDll;
-}
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
index ab8c8c86..b60e7ccc 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
@@ -54,7 +54,5 @@ void FTNoIR_Tracker::data(double *data)
data[Yaw + i] += values[indices[i]];
}
-extern "C" OPENTRACK_EXPORT ITracker* GetConstructor()
-{
- return new FTNoIR_Tracker;
-}
+
+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
index 95a3fb4f..8dca3833 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h
@@ -57,3 +57,4 @@ 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
index bab88db0..5e7d5437 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp
@@ -24,7 +24,3 @@ void TrackerControls::doCancel() {
this->close();
}
-extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( )
-{
- return new TrackerControls;
-}
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp
deleted file mode 100644
index e2b10455..00000000
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ftnoir_tracker_udp.h"
-#include "opentrack/plugin-api.hpp"
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_TrackerDll;
-}
diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp
index a8996d63..714e69d9 100644
--- a/opentrack/plugin-api.hpp
+++ b/opentrack/plugin-api.hpp
@@ -1,11 +1,116 @@
#pragma once
#include "export.hpp"
+#include <QString>
+#include <QFrame>
+#include <QIcon>
enum Axis {
TX = 0, TY, TZ, Yaw, Pitch, Roll
};
-#ifndef OPENTRACK_CROSS_ONLY
-# include "plugin-qt-api.hpp"
-#endif \ No newline at end of file
+#define OPENTRACK_DECLARE_PLUGIN_INTERNAL(ctor_class, ctor_ret_class, metadata_class, dialog_class, dialog_ret_class) \
+ extern "C" OPENTRACK_EXPORT ctor_ret_class* GetConstructor() \
+ { \
+ return new ctor_class; \
+ } \
+ extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() \
+ { \
+ return new metadata_class; \
+ } \
+ extern "C" OPENTRACK_EXPORT dialog_ret_class* GetDialog() \
+ { \
+ return new dialog_class; \
+ }
+
+// implement this in all plugins
+struct Metadata
+{
+public:
+ // plugin name to be displayed in the interface
+ virtual QString name() = 0;
+ // plugin icon, you can return an empty QIcon()
+ virtual QIcon icon() = 0;
+ // optional destructor
+ virtual ~Metadata() {}
+};
+
+// implement this in filters
+struct IFilter
+{
+public:
+ // optional destructor
+ virtual ~IFilter() {}
+ // perform filtering step.
+ // you have to take care of dt on your own, try "opentrack/timer.hpp"
+ virtual void filter(const double *input, double *output) = 0;
+};
+
+struct IFilterDialog : public QWidget
+{
+ // optional destructor
+ virtual ~IFilterDialog() {}
+ // receive a pointer to the filter from ui thread
+ virtual void register_filter(IFilter* filter) = 0;
+ // received filter pointer is about to get deleted
+ virtual void unregister_filter() = 0;
+};
+
+// call once with your chosen class names in the plugin
+#define OPENTRACK_DECLARE_FILTER(filter_class, dialog_class, metadata_class) \
+ OPENTRACK_DECLARE_PLUGIN_INTERNAL(filter_class, IFilter, metadata_class, dialog_class, IFilterDialog)
+
+// implement this in protocols
+struct IProtocol
+{
+public:
+ // optional destructor
+ virtual ~IProtocol() {}
+ // return true if protocol was properly initialized
+ virtual bool correct() = 0;
+ // called 250 times a second with XYZ yaw pitch roll pose
+ // try not to perform intense computation here. if you must, use a thread.
+ virtual void pose(const double* headpose) = 0;
+ // return game name or placeholder text
+ virtual QString game_name() = 0;
+};
+
+struct IProtocolDialog : public QWidget
+{
+ // optional destructor
+ virtual ~IProtocolDialog() {}
+ // receive a pointer to the protocol from ui thread
+ virtual void register_protocol(IProtocol *protocol) = 0;
+ // received protocol pointer is about to get deleted
+ virtual void unregister_protocol() = 0;
+};
+
+// call once with your chosen class names in the plugin
+#define OPENTRACK_DECLARE_PROTOCOL(protocol_class, dialog_class, metadata_class) \
+ OPENTRACK_DECLARE_PLUGIN_INTERNAL(protocol_class, IProtocol, metadata_class, dialog_class, IProtocolDialog)
+
+// implement this in trackers
+struct ITracker
+{
+public:
+ // optional destructor
+ virtual ~ITracker() {}
+ // start tracking, and grab a frame to display webcam video in, optionally
+ virtual void start_tracker(QFrame* frame) = 0;
+ // return XYZ yaw pitch roll data. don't block here, use a separate thread for computation.
+ virtual void data(double *data) = 0;
+};
+
+struct ITrackerDialog : public QWidget
+{
+ // optional destructor
+ virtual ~ITrackerDialog() {}
+ // receive a pointer to the tracker from ui thread
+ virtual void register_tracker(ITracker *tracker) = 0;
+ // received tracker pointer is about to get deleted
+ virtual void unregister_tracker() = 0;
+};
+
+// call once with your chosen class names in the plugin
+#define OPENTRACK_DECLARE_TRACKER(tracker_class, dialog_class, metadata_class) \
+ OPENTRACK_DECLARE_PLUGIN_INTERNAL(tracker_class, ITracker, metadata_class, dialog_class, ITrackerDialog)
diff --git a/opentrack/plugin-qt-api.hpp b/opentrack/plugin-qt-api.hpp
deleted file mode 100644
index dd9cc280..00000000
--- a/opentrack/plugin-qt-api.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#pragma once
-
-#include <QString>
-#include <QFrame>
-#include <QIcon>
-
-struct Metadata
-{
-public:
- virtual QString name() = 0;
- virtual QIcon icon() = 0;
- virtual ~Metadata() {}
-};
-
-// XXX TODO get rid of QString/QFrame to fix ABI woes
-// will lead plugins from different C++ runtimes working -sh 20141004
-
-struct IFilter
-{
-public:
- virtual ~IFilter() {}
- virtual void filter(const double *input, double *output) = 0;
-};
-
-struct IFilterDialog : public QWidget
-{
- virtual ~IFilterDialog() {}
- virtual void register_filter(IFilter* filter) = 0;
- virtual void unregister_filter() = 0;
-};
-
-struct IProtocol
-{
-public:
- virtual ~IProtocol() {}
- virtual bool correct() = 0;
- virtual void pose(const double* headpose) = 0;
- virtual QString game_name() = 0;
-};
-
-struct IProtocolDialog : public QWidget
-{
- virtual ~IProtocolDialog() {}
- virtual void register_protocol(IProtocol *protocol) = 0;
- virtual void unregister_protocol() = 0;
-};
-
-struct ITracker
-{
-public:
- virtual ~ITracker() {}
- virtual void start_tracker(QFrame* frame) = 0;
- virtual void data(double *data) = 0;
-};
-
-struct ITrackerDialog : public QWidget
-{
- virtual ~ITrackerDialog() {}
- virtual void register_tracker(ITracker *tracker) = 0;
- virtual void unregister_tracker() = 0;
-};