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_protocol_mouse | |
parent | d6a54431d178632a2bf466c9904f74abd143afe6 (diff) |
move to subdirectory-based build system
Closes #224
Diffstat (limited to 'ftnoir_protocol_mouse')
-rw-r--r-- | ftnoir_protocol_mouse/ftnoir_mousecontrols.ui | 188 | ||||
-rw-r--r-- | ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 54 | ||||
-rw-r--r-- | ftnoir_protocol_mouse/ftnoir_protocol_mouse.h | 59 | ||||
-rw-r--r-- | ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp | 24 | ||||
-rw-r--r-- | ftnoir_protocol_mouse/images/mouse.png | bin | 1169 -> 0 bytes | |||
-rw-r--r-- | ftnoir_protocol_mouse/win32-mouse-protocol.qrc | 5 |
6 files changed, 0 insertions, 330 deletions
diff --git a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui deleted file mode 100644 index b1f4bcf8..00000000 --- a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui +++ /dev/null @@ -1,188 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICMOUSEControls</class> - <widget class="QWidget" name="UICMOUSEControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>280</width> - <height>106</height> - </rect> - </property> - <property name="windowTitle"> - <string>Mouse protocol settings</string> - </property> - <property name="windowIcon"> - <iconset resource="win32-mouse-protocol.qrc"> - <normaloff>:/images/mouse.png</normaloff>:/images/mouse.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel2_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Map mouse X to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QComboBox" name="cbxSelectMouse_X"> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="1" column="1" colspan="2"> - <widget class="QComboBox" name="cbxSelectMouse_Y"> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Map mouse Y to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources> - <include location="win32-mouse-protocol.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp deleted file mode 100644 index c0a0a868..00000000 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2015 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_protocol_mouse.h" -#include "opentrack/plugin-api.hpp" -#include <windows.h> - -#ifndef MOUSEEVENTF_MOVE_NOCOALESCE -# define MOUSEEVENTF_MOVE_NOCOALESCE 0x2000 -#endif - -void FTNoIR_Protocol::pose(const double *headpose ) { - RECT desktop; - const HWND hDesktop = GetDesktopWindow(); - if (hDesktop != NULL && GetWindowRect(hDesktop, &desktop)) { - // XXX TODO remove axis selector, use mapping window's - // axis selection. Mention in UI axis used. -sh 20140920 - int axis_x = s.Mouse_X; - int axis_y = s.Mouse_Y; - - int mouse_x = 0, mouse_y = 0; - - if (axis_x > 0 && axis_x <= 6) - mouse_x = headpose[axis_x-1] / (axis_x <= 3 ? 100 : 180) * 10 * desktop.right/2; - - if (axis_y > 0 && axis_y <= 6) - mouse_y = headpose[axis_y-1] / (axis_y <= 3 ? 100 : 180) * 10 * desktop.bottom/2; - - MOUSEINPUT mi; - mi.dx = mouse_x - last_x; - mi.dy = mouse_y - last_y; - mi.mouseData = 0; - mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE; - mi.time = 0; - mi.dwExtraInfo = 0; - INPUT input; - input.type = INPUT_MOUSE; - input.mi = mi; - (void) SendInput(1, &input, sizeof(INPUT)); - - last_x = mouse_x; - last_y = mouse_y; - } -} - -bool FTNoIR_Protocol::correct() -{ - return true; -} - -OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, MOUSEControls, FTNoIR_ProtocolDll) diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h deleted file mode 100644 index 595be393..00000000 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2015 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. - */ - -#pragma once - -#include "ui_ftnoir_mousecontrols.h" -#include <QDebug> -#include "opentrack/plugin-api.hpp" -#include "opentrack/options.hpp" -using namespace options; - -struct settings : opts { - value<int> Mouse_X, Mouse_Y; - settings() : - opts("mouse-proto"), - Mouse_X(b, "mouse-x", 0), - Mouse_Y(b, "mouse-y", 0) - {} -}; - -class FTNoIR_Protocol : public IProtocol -{ -public: - FTNoIR_Protocol() : last_x(0), last_y(0) {} - bool correct(); - void pose( const double *headpose); - QString game_name() { - return "Mouse tracker"; - } - int last_x, last_y; -private: - struct settings s; -}; - -class MOUSEControls: public IProtocolDialog -{ - Q_OBJECT -public: - MOUSEControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} -private: - Ui::UICMOUSEControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class FTNoIR_ProtocolDll : public Metadata -{ -public: - QString name() { return QString("mouse emulation"); } - QIcon icon() { return QIcon(":/images/mouse.png"); } -}; diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp deleted file mode 100644 index bb5fe3b8..00000000 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "ftnoir_protocol_mouse.h" -#include "opentrack/plugin-api.hpp" - -MOUSEControls::MOUSEControls() -{ - ui.setupUi( this ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.Mouse_X, ui.cbxSelectMouse_X); - tie_setting(s.Mouse_Y, ui.cbxSelectMouse_Y); -} - -void MOUSEControls::doOK() { - s.b->save(); - this->close(); -} - -void MOUSEControls::doCancel() { - s.b->reload(); - this->close(); -} - diff --git a/ftnoir_protocol_mouse/images/mouse.png b/ftnoir_protocol_mouse/images/mouse.png Binary files differdeleted file mode 100644 index c6f9ea26..00000000 --- a/ftnoir_protocol_mouse/images/mouse.png +++ /dev/null diff --git a/ftnoir_protocol_mouse/win32-mouse-protocol.qrc b/ftnoir_protocol_mouse/win32-mouse-protocol.qrc deleted file mode 100644 index ed6a71be..00000000 --- a/ftnoir_protocol_mouse/win32-mouse-protocol.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>images/mouse.png</file> - </qresource> -</RCC> |