From 5f8ad4cb8199cb5f2ba921f828c32c734173eacd Mon Sep 17 00:00:00 2001 From: Thomas Pietrzak Date: Wed, 15 Feb 2012 13:39:26 +0000 Subject: [PATCH] First import Dwell buttons git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@45 47cf9a05-e0a8-4ed5-9e9b-101a649bc004 --- DwellCursor.sln | Bin 0 -> 4096 bytes DwellCursor.suo | Bin 0 -> 48128 bytes DwellCursor/DwellButton.cpp | 60 ++++++ DwellCursor/DwellButton.h | 33 +++ DwellCursor/DwellCursor.vcxproj | 260 ++++++++++++++++++++++++ DwellCursor/DwellCursor.vcxproj.filters | 148 ++++++++++++++ DwellCursor/DwellWidget.cpp | 181 +++++++++++++++++ DwellCursor/DwellWidget.h | 59 ++++++ DwellCursor/ExperimentSetup.cpp | 26 +++ DwellCursor/ExperimentSetup.h | 23 +++ DwellCursor/ExperimentSetup.ui | 235 +++++++++++++++++++++ DwellCursor/KinectInput.cpp | 99 +++++++++ DwellCursor/KinectInput.h | 29 +++ DwellCursor/MainScene.cpp | Bin 0 -> 5410 bytes DwellCursor/MainScene.h | 58 ++++++ DwellCursor/MainView.cpp | 18 ++ DwellCursor/MainView.h | 22 ++ DwellCursor/dwellcursor.cpp | 38 ++++ DwellCursor/dwellcursor.h | 36 ++++ DwellCursor/dwellcursor.qrc | 4 + DwellCursor/dwellcursor.ui | 23 +++ DwellCursor/main.cpp | 10 + 22 files changed, 1362 insertions(+) create mode 100644 DwellCursor.sln create mode 100644 DwellCursor.suo create mode 100644 DwellCursor/DwellButton.cpp create mode 100644 DwellCursor/DwellButton.h create mode 100644 DwellCursor/DwellCursor.vcxproj create mode 100644 DwellCursor/DwellCursor.vcxproj.filters create mode 100644 DwellCursor/DwellWidget.cpp create mode 100644 DwellCursor/DwellWidget.h create mode 100644 DwellCursor/ExperimentSetup.cpp create mode 100644 DwellCursor/ExperimentSetup.h create mode 100644 DwellCursor/ExperimentSetup.ui create mode 100644 DwellCursor/KinectInput.cpp create mode 100644 DwellCursor/KinectInput.h create mode 100644 DwellCursor/MainScene.cpp create mode 100644 DwellCursor/MainScene.h create mode 100644 DwellCursor/MainView.cpp create mode 100644 DwellCursor/MainView.h create mode 100644 DwellCursor/dwellcursor.cpp create mode 100644 DwellCursor/dwellcursor.h create mode 100644 DwellCursor/dwellcursor.qrc create mode 100644 DwellCursor/dwellcursor.ui create mode 100644 DwellCursor/main.cpp diff --git a/DwellCursor.sln b/DwellCursor.sln new file mode 100644 index 0000000000000000000000000000000000000000..fb993bc6d924409f98df8d0bcb665c6ee0318d79 GIT binary patch literal 4096 zcmeHJOKjuD8K&$cO|&(FBF*d2#<0_54MZ}BZ>n&xq$uiby)4Nx5(wlBDbu1vnGaFY zDhF>iK+$`#=rJvN2^MHj^pb9o1Vwsiu$Lk|wD+Xwp+M0D2wI?r4zspn?>fou!a!1> zBtUTHpZVwezxn5z{~tHrS&Ek}=sKQb`pYfL3p9JV;RncamK%;8_?9zVRxR6jVOe$D zfriHzt`~IzkR-{a`08zwC=%e_s_X0-(7(8HS&-9WIwK1SL1v@`01BB96aW$=DUoRr zU@Jqtva+_kvAm*$hHa+<*K^#J7fv-_I$=tV;ber}M?)@CA|=R_nofvZD^ixY(CY-12CXd%ijU#5bl?taXkMd zoV(*9c>-rr!jX@SwAs58|9yCq1ItE9^1gkYqUaR1Q%0{l-7pOR$w);DU>v?l*(djsTN7-e?)>^iaj+`nF5`|-O(Eb{XDyY=@Me?wgV8X3H& zrOm^Ly*RPv{WC>dzh}|S&Hy2)8{Qlx^ zqxZ}S-~7(l|19vu^C94Wku;4^JRS$=dH@L#tF0cr5G$!ok$^18s$P+&|%89K!oq7G@3 zVKu`bIRToGrFg{B4A7B?APu58Q-@5tI_3M8)`0gRF0tU8vHZV^c;$i|}nWbo*1vG<1fkPsv1BT@p!197l3j(Q; zB1s#FCry(=q5)XInH&!^22v){If3Ok-7rOp7ifS3GzE?kF_{d{VRWnr?nL+g4p+4a7M@*N(1}Ij z2C?W7Hx}PoeCvEN@+-XHHP1oHUj5#o0FN&aYmdLyK0|>^_}bAm*bhc?h`c%0Vtbdm zrN>?}EzP~8TF0NM6ZnB{%sp@JYj%GgYGbU`Ck0!n;oGa+!5;;6HV6ImXauYh$f`}g zHIgTryW2S*cmI85eXjXyU zN{9Q!dN|ru?d~|=DsmRwu4NcVH<(hz-DBixW7lWtVZrDW`RcxI_|xrdNAEe=ZVME4 zv|%;}xAfed_f~YsqkHR9eBQtF75VVR=7oj7o=2+S1wQ!VMefCN4sMPrrQpm;sS#C5 z8KeQloirO*!?+G#Ij)pq$J+VgXUYG;A0LPlKRBwl4)gf9;Bs}{4Pa+$B6r%l+VPLw zd?vw}e_ns{L97F~6j-<%)dLH$EV1wg{`~*BUk0vpu3h=jhadjpjpr^9iPfuzHyU!F zccLzA*YjJMQm2b|`j)OVv93t<9bO$45@i_9_Nv`N&sH)voHhG{T&LKVKt5nCL$32A ZtXZ?ZOlyP5u2=`4Z`QM{S#FzR;lHyDCN%&6 literal 0 HcmV?d00001 diff --git a/DwellCursor.suo b/DwellCursor.suo new file mode 100644 index 0000000000000000000000000000000000000000..9d0b21d360f65d89307040be8a38bcd7038d7dc0 GIT binary patch literal 48128 zcmeHQ34B!5xxWEH78Tr35Nkk`#Ux}SEP{|sg0cq^1IkoLCX-|!WMXE99Ti1fiip+< zsHh+=sI{oLZ`4|>Rzavst)fV+RrFctt3DNl_y6B>Pv*|d-6oky^gU00U(T6(&)n}U z-}$!lojY&rICjtahkJaaM5S|-w#uQy9hLUF>nSJ`)YMf`+Mv)DaOm*i!{VZ%p!jq8 z35~!HXzLM}yqt2aEum0~ilT1B?RX0}22xKoOt>FdA?!AR90dFcvTl zFbPlyU^}KDFV@QEYk4X1F@Q3_RKPUA1%L|y(*bS(zx!iKQxre`f|!pYr4D(6vH-1g zp1Of*WPdpRmg(Y&uYL0QYboRz>OdhY21dU!3m@y0DwK+p`Ie7}zS#|2NaAN6ec$Xe z>6fWgDOUo@Y|w-cc~ChY|Gj9FydD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w$q vV8l&lK + +QColor DwellButton::_bgcolor = Qt::gray; +QColor DwellButton::_hovercolor = Qt::lightGray; +QColor DwellButton::_validatedcolor = Qt::red; +QColor DwellButton::_targetcolor = Qt::green; +QColor DwellButton::_targethovercolor = Qt::yellow; + +DwellButton::DwellButton(QGraphicsItem *parent) +:QGraphicsRectItem(parent), _active(false) +{ + setBrush(QBrush(_bgcolor)); + setZValue(0); +} + +DwellButton::DwellButton(float posx, float posy, float width, float height, QGraphicsItem *parent) +:QGraphicsRectItem(posx, posy, width, height, parent), _active(false) +{ + setBrush(QBrush(_bgcolor)); + setZValue(0); +} + +DwellButton::DwellButton(QRect pos, QGraphicsItem *parent) +:QGraphicsRectItem(pos, parent), _active(false) +{ + setBrush(QBrush(_bgcolor)); + setZValue(0); +} + +void DwellButton::setActive() +{ + _active = true; + setBrush(QBrush(_targetcolor)); +} + +void DwellButton::hover() +{ + if (_active) + setBrush(QBrush(_targethovercolor)); + else + setBrush(QBrush(_hovercolor)); +} + +void DwellButton::press() +{ + setBrush(QBrush(_validatedcolor)); + emit clicked(); + _active = false; + //disconnect(this); +} + +void DwellButton::leave() +{ + if (_active) + setBrush(QBrush(_targetcolor)); + else + setBrush(QBrush(_bgcolor)); +} diff --git a/DwellCursor/DwellButton.h b/DwellCursor/DwellButton.h new file mode 100644 index 0000000..3af2928 --- /dev/null +++ b/DwellCursor/DwellButton.h @@ -0,0 +1,33 @@ +#ifndef __DWELLBUTTON__ +#define __DWELLBUTTON__ + +#include +#include + +class DwellButton: public QObject, public QGraphicsRectItem +{ + Q_OBJECT + + public: + DwellButton(QGraphicsItem *parent = 0); + DwellButton(float posx, float posy, float width, float height, QGraphicsItem *parent = 0); + DwellButton(QRect pos, QGraphicsItem *parent = 0); + + void setActive(); + + private: + static QColor _bgcolor, _hovercolor, _validatedcolor, _targetcolor, _targethovercolor; + bool _active; + + public slots: + void hover(); + void press(); + void leave(); + + private slots: + + signals: + void clicked(); +}; + +#endif diff --git a/DwellCursor/DwellCursor.vcxproj b/DwellCursor/DwellCursor.vcxproj new file mode 100644 index 0000000..b4d3a4d --- /dev/null +++ b/DwellCursor/DwellCursor.vcxproj @@ -0,0 +1,260 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2928B2FC-98F8-427E-B0D2-2CEA2DA1FFC9} + Qt4VSv1.0 + + + + Application + + + Application + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + + + AllRules.ruleset + + + $(SolutionDir)$(ConfigurationName) + $(SolutionDir)$(ConfigurationName) + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + $(KINECTSDK10_DIR)\inc;.\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(KINECTSDK10_DIR)\lib\x86;$(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + tactonplayer.lib;Kinect10.lib;qtmaind.lib;QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies) + + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + $(KINECTSDK10_DIR)\inc;.\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;%(AdditionalIncludeDirectories) + + + MultiThreadedDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(KINECTSDK10_DIR)\lib\x86;$(QTDIR)\lib;%(AdditionalLibraryDirectories) + false + tactonplayer.lib;Kinect10.lib;qtmain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies) + + + + + + + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + + + + + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "dwellcursor.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "dwellcursor.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "ExperimentSetup.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "ExperimentSetup.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "MainView.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "MainView.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "DwellWidget.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "DwellWidget.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "DwellButton.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "DwellButton.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "KinectInput.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "KinectInput.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "MainScene.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I$(KINECTSDK10_DIR)\inc" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "MainScene.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + + + Document + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + + + + + + + \ No newline at end of file diff --git a/DwellCursor/DwellCursor.vcxproj.filters b/DwellCursor/DwellCursor.vcxproj.filters new file mode 100644 index 0000000..b59ed00 --- /dev/null +++ b/DwellCursor/DwellCursor.vcxproj.filters @@ -0,0 +1,148 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;cxx;c;def + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + moc;h;cpp + False + + + {8395e438-d93a-41cb-9c3a-631bdb7f2df0} + cpp;moc + False + + + {d92c74f0-c1ab-4435-b7b0-32ae41c89011} + cpp;moc + False + + + + + Source Files + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files + + + Source Files + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + + + Header Files + + + Form Files + + + Resource Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Form Files + + + + + Generated Files + + + Generated Files + + + \ No newline at end of file diff --git a/DwellCursor/DwellWidget.cpp b/DwellCursor/DwellWidget.cpp new file mode 100644 index 0000000..7ca041c --- /dev/null +++ b/DwellCursor/DwellWidget.cpp @@ -0,0 +1,181 @@ +#include "DwellWidget.h" + +#include +#include + +#include + +float DwellWidget::_widgetsize = 0.1; +int DwellWidget::_activationduration = 300; +int DwellWidget::_dwellduration = 1500; +int DwellWidget::_validationduration = 200; +int DwellWidget::_hoverduration = 50; + +QColor DwellWidget::_colornormal = Qt::transparent; +QColor DwellWidget::_coloractivated = Qt::darkCyan; + +DwellWidget::DwellWidget(QGraphicsItem * parent) +:_tactonplayer(NULL), + _activationtimeline(_activationduration), + _validationtimeline(_validationduration), + _progressiontimeline(_dwellduration), + _center(0, 0, _widgetsize / 2, _widgetsize / 2, this), + _background(0.0, 0.0, _widgetsize / 2, _widgetsize / 2, this), + _progress(0.0, 0.0, _widgetsize, _widgetsize, this), + _activation(), _validation() +{ +/* + _activationtimeline.setFrameRange(0, 100); + _activation.setItem(&_center); + _activation.setTimeLine(&_activationtimeline); + _activation.setScaleAt(0, 1, 1); + _activation.setPosAt(0 , QPointF(-_widgetsize / 2, -_widgetsize / 2)); + _activation.setScaleAt(1 , 0.5, 0.5); + _activation.setPosAt(1 , QPointF(-_widgetsize / 4, -_widgetsize / 4)); + connect(&_activationtimeline, SIGNAL(finished()), this, SLOT(startdwell())); + */ + _activationtimeline.setFrameRange(0, 100); + _activation.setItem(&_background); + _activation.setTimeLine(&_activationtimeline); + _activation.setScaleAt(0, 1, 1); + _activation.setPosAt(0 , QPointF(-_widgetsize / 4, -_widgetsize / 4)); + _activation.setScaleAt(1 , 2, 2); + _activation.setPosAt(1 , QPointF(-_widgetsize / 2, -_widgetsize / 2)); + connect(&_activationtimeline, SIGNAL(finished()), this, SLOT(startdwell())); + +// _progressiontimeline.setUpdateInterval(_dwellduration / 5760); + _progressiontimeline.setFrameRange(0, 5760); + _progress.setBrush(QBrush(_coloractivated)); + _progress.setStartAngle(90 * 16); + _progress.setSpanAngle(0); + _progress.setPen(QPen(Qt::transparent)); + connect(&_progressiontimeline, SIGNAL(frameChanged(int)), this, SLOT(progress(int))); + connect(&_progressiontimeline, SIGNAL(finished()), this, SLOT(startvalidation())); +/* + _validationtimeline.setFrameRange(0, 300); + _validation.setItem(&_center); + _validation.setTimeLine(&_validationtimeline); + _validation.setScaleAt(0, 0.5, 0.5); + _validation.setPosAt(0 , QPointF(-_widgetsize / 4, -_widgetsize / 4)); + _validation.setScaleAt(0.5 , 1.5, 1.5); + _validation.setPosAt(0.5 , QPointF(-_widgetsize * 3 / 4, -_widgetsize * 3 / 4)); + _validation.setScaleAt(1 , 1, 1); + _validation.setPosAt(1 , QPointF(-_widgetsize / 2, -_widgetsize / 2)); + connect(&_validationtimeline, SIGNAL(finished()), this, SLOT(validation())); +*/ + _validationtimeline.setFrameRange(0, 300); + _validation.setItem(&_center); + _validation.setTimeLine(&_validationtimeline); + _validation.setScaleAt(0, 2, 2); + _validation.setPosAt(0 , QPointF(-_widgetsize / 2, -_widgetsize / 2)); + _validation.setScaleAt(0.5 , 2.5, 2.5); + _validation.setPosAt(0.5 , QPointF(-_widgetsize * 5 / 8, -_widgetsize * 5 / 8)); + _validation.setScaleAt(1 , 1, 1); + _validation.setPosAt(1 , QPointF(-_widgetsize / 4, -_widgetsize / 4)); + connect(&_validationtimeline, SIGNAL(finished()), this, SLOT(validation())); + + _center.setZValue(10); + _center.setPos(QPointF(-_widgetsize / 4, -_widgetsize / 4)); + _progress.setPos(QPointF(-_widgetsize / 2, -_widgetsize / 2)); + _progress.setZValue(1); + _background.setZValue(5); + _background.setPos(QPointF(-_widgetsize / 4, -_widgetsize / 4)); + _background.setBrush(QBrush(Qt::transparent)); +} + +DwellWidget::~DwellWidget() +{ + if (_tactonplayer) + _tactonplayer->stop(); +} + +void DwellWidget::init() +{ +// _tactonplayer = new TactonPlayer("COM4"); + //hover tacton + if (_tactonplayer) + { + _tactonplayer->regist(Tacton(0x0f, _hoverduration / 2, 100, 255)); + //activation tacton + _tactonplayer->regist(Tacton(0x0f, _activationduration / 2, 250, 255)); + //progression tacton + unsigned char animpatterns[8] = {POS2_UP, 0x00, POS2_RIGHT, 0x00, POS2_DOWN, 0x00, POS2_LEFT, 0x00}; + unsigned int animdurations[8] = {_dwellduration / 8, _dwellduration / 8, _dwellduration / 8, _dwellduration / 8, + _dwellduration / 8, _dwellduration / 8, _dwellduration / 8, _dwellduration / 8}; + unsigned int animfrequencies[8] = {250, 250, 250, 250, 250, 250, 250, 250}; + unsigned char animamplitudes[8] = {255, 255, 255, 255, 255, 255, 255, 255}; + _tactonplayer->regist(Tacton(8, animpatterns,animdurations, animfrequencies, animamplitudes)); + //validation tacton + _tactonplayer->regist(Tacton(0x0f, _validationduration / 2, 250, 255)); + } + _lasthover.restart(); +} + +void DwellWidget::hover() +{ + if (_lasthover.elapsed() > _hoverduration) + { + if (_tactonplayer) + _tactonplayer->play(0); + _lasthover.restart(); + } +} + +void DwellWidget::start() +{ +// _currentstate = ACTIVATED; + //_activationpos = + _center.setBrush(QBrush(_coloractivated)); + if (_tactonplayer) + _tactonplayer->play(1); + _activationtimeline.start(); +} + +void DwellWidget::startdwell() +{ + if (_tactonplayer) + _tactonplayer->play(2); + _progressiontimeline.start(); +} + +void DwellWidget::progress(int v) +{ + _progress.setSpanAngle(-v); +} + +void DwellWidget::startvalidation() +{ + if (_tactonplayer) + _tactonplayer->play(3); + _activationtimeline.setCurrentTime(0); + _progressiontimeline.setCurrentTime(0); + _validationtimeline.start(); +} + +void DwellWidget::validation() +{ + emit validated(); + reset(); +} + + +void DwellWidget::interrupt() +{ + _activationtimeline.stop(); + _progressiontimeline.stop(); + _validationtimeline.stop(); + reset(); +} + +void DwellWidget::reset() +{ + disconnect(this, 0, 0, 0); +// _validationtimeline.setCurrentTime(0); + _progressiontimeline.setCurrentTime(0); + _activationtimeline.setCurrentTime(0); + _center.setScale(1); + _background.setScale(1); + _center.setBrush(QBrush(_colornormal)); + _progress.setSpanAngle(0); + this->update(); +} \ No newline at end of file diff --git a/DwellCursor/DwellWidget.h b/DwellCursor/DwellWidget.h new file mode 100644 index 0000000..07bb1a4 --- /dev/null +++ b/DwellCursor/DwellWidget.h @@ -0,0 +1,59 @@ +#ifndef __DWELLWIDGET__ +#define __DWELLWIDGET__ + +#include +#include +#include +#include +#include +#include +#include + +#include + +class DwellWidget: public QObject, public QGraphicsItemGroup +{ + Q_OBJECT + + public: + DwellWidget(QGraphicsItem * parent = 0); + ~DwellWidget(); + + void init(); + + void hover(); + void start(); + void interrupt(); + void reset(); + + private: + TactonPlayer *_tactonplayer; + + QTimeLine _activationtimeline, _validationtimeline, _progressiontimeline; + QGraphicsEllipseItem _center, _background, _progress; + QGraphicsItemAnimation _activation, _validation; + QPointF _activationpos; + + QTime _lasthover; + + static float _widgetsize; + + static int _activationduration; + static int _dwellduration; + static int _validationduration; + static int _hoverduration; + + static QColor _colornormal; + static QColor _coloractivated; + + signals: + void validated(); + + private slots: + void startdwell(); + void startvalidation(); + void validation(); + void progress(int v); +}; + +#endif \ No newline at end of file diff --git a/DwellCursor/ExperimentSetup.cpp b/DwellCursor/ExperimentSetup.cpp new file mode 100644 index 0000000..1959a9e --- /dev/null +++ b/DwellCursor/ExperimentSetup.cpp @@ -0,0 +1,26 @@ +#include "ExperimentSetup.h" + +ExperimentSetup::ExperimentSetup(QWidget *parent, Qt::WFlags flags) + : QMainWindow(parent, flags) +{ + setupUi(this); + + this->layout()->setSizeConstraint(QLayout::SetFixedSize); + + QObject::connect(buttonstart, SIGNAL(clicked()), this, SLOT(runBlock())); +} + +ExperimentSetup::~ExperimentSetup() +{ + +} + +void ExperimentSetup::runBlock(void) +{ + this->hide(); + w.init(username->text(), condition->currentText(), repetitions->value(), + nbx->value(), nby->value(), + buttonssizex->value(), buttonssizey->value(), + spacex->value(), spacey->value()); + w.show(); +} diff --git a/DwellCursor/ExperimentSetup.h b/DwellCursor/ExperimentSetup.h new file mode 100644 index 0000000..522d756 --- /dev/null +++ b/DwellCursor/ExperimentSetup.h @@ -0,0 +1,23 @@ +#ifndef EXPERIMENTSETUP_H +#define EXPERIMENTSETUP_H + +#include +#include "ui_experimentsetup.h" + +#include "dwellcursor.h" +class ExperimentSetup : public QMainWindow, Ui::ExperimentSetupClass +{ + Q_OBJECT + +public: + ExperimentSetup(QWidget *parent = 0, Qt::WFlags flags = 0); + ~ExperimentSetup(); + +private: + DwellCursor w; + +private slots: + void runBlock(); +}; + +#endif diff --git a/DwellCursor/ExperimentSetup.ui b/DwellCursor/ExperimentSetup.ui new file mode 100644 index 0000000..fcec084 --- /dev/null +++ b/DwellCursor/ExperimentSetup.ui @@ -0,0 +1,235 @@ + + + ExperimentSetupClass + + + Qt::NonModal + + + + 0 + 0 + 324 + 277 + + + + Dwell Widgets + + + + + + + + + + + + User: + + + + + + + + + + Repetitions: + + + + + + + 1 + + + 100 + + + 1 + + + + + + + Space x: + + + + + + + Condition: + + + + + + + Nb x: + + + + + + + Nb y: + + + + + + + BtSize x: + + + + + + + BtSize y: + + + + + + + Space y: + + + + + + + 1 + + + 10 + + + 4 + + + + + + + 1 + + + 10 + + + 4 + + + + + + + + Visual only + + + + + Tactile + visual + + + + + + + + 1 + + + 0.100000000000000 + + + 1.600000000000000 + + + 0.100000000000000 + + + 0.200000000000000 + + + + + + + 1 + + + 0.100000000000000 + + + 1.000000000000000 + + + 0.100000000000000 + + + 0.100000000000000 + + + + + + + 1 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.600000000000000 + + + + + + + 1 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + + + + + + Start experiment + + + + + + + + + + + + diff --git a/DwellCursor/KinectInput.cpp b/DwellCursor/KinectInput.cpp new file mode 100644 index 0000000..dca9d65 --- /dev/null +++ b/DwellCursor/KinectInput.cpp @@ -0,0 +1,99 @@ +#include "KinectInput.h" + +#include + +#define TIMEOUT 100 + +KinectInput::KinectInput() +:_running(false), _skeletonid(-1) +{ + //creates the kinect sensor (id 0) + if(FAILED(NuiCreateSensorByIndex(0, &_kinect))) + { + qDebug() << "Cannot find a KINECT sensor" << endl; + //I should do something else, sucha as an exception + return; + } + + if (_kinect->NuiInitialize(NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX | NUI_INITIALIZE_FLAG_USES_SKELETON) == E_NUI_SKELETAL_ENGINE_BUSY) + { + qDebug() << "Cannot initialize the KINECT sensor" << endl; + return; + } + + //initialize the skeleton tracking + _skeletonEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if(!HasSkeletalEngine(_kinect) || FAILED(_kinect->NuiSkeletonTrackingEnable(_skeletonEvent, 0))) + { + qDebug() << "Cannot Initialize skeleton tracking" << endl; + return; + } +} + +KinectInput::~KinectInput() +{ + NuiShutdown(); + if( _skeletonEvent && ( _skeletonEvent != INVALID_HANDLE_VALUE ) ) + CloseHandle( _skeletonEvent ); +} + +//thread that manages the kinect events +void KinectInput::run() +{ + _running = true; + while(_running) + { + //wait for an event + if (WaitForSingleObject(_skeletonEvent, TIMEOUT) != 0) + continue; + + //get skeleton values + NUI_SKELETON_FRAME SkeletonFrame; + HRESULT hr = _kinect->NuiSkeletonGetNextFrame( 0, &SkeletonFrame ); +// qDebug() << "Kinect frame " << SkeletonFrame.dwFrameNumber; + + //if no skeleton already identified or not tracked anymore, search for one + if (_skeletonid < 0 || SkeletonFrame.SkeletonData[_skeletonid].eTrackingState != NUI_SKELETON_TRACKED) + { + for( int i = 0 ; i < NUI_SKELETON_COUNT ; i++ ) + { + if(SkeletonFrame.SkeletonData[i].eTrackingState == NUI_SKELETON_TRACKED) + { + _skeletonid = i; + break; + } + } + } + + //no skeleton found + if (_skeletonid < 0) + continue; + + //retrieve information on the skeleton + NUI_SKELETON_DATA &data = SkeletonFrame.SkeletonData[_skeletonid]; + + //checking if we have a skeleton +/* if (data.eTrackingState != NUI_SKELETON_TRACKED) + continue;*/ + + //smooth out the skeleton data + _kinect->NuiTransformSmooth(&SkeletonFrame, NULL); + + + if (data.eSkeletonPositionTrackingState[NUI_SKELETON_POSITION_HAND_RIGHT] == NUI_SKELETON_NOT_TRACKED) + continue; //right hand not detected + else + { +/* float posx, posy; + NuiTransformSkeletonToDepthImageF(data.SkeletonPositions[NUI_SKELETON_POSITION_HAND_RIGHT], &posx, &posy); + emit rightHandMove(posx, posy,0);*/ + Vector4 &skelpos = data.SkeletonPositions[NUI_SKELETON_POSITION_HAND_RIGHT]; + emit rightHandMove(skelpos.x, skelpos.y, skelpos.z); + } + } +} + +void KinectInput::stop() +{ + _running = false; +} \ No newline at end of file diff --git a/DwellCursor/KinectInput.h b/DwellCursor/KinectInput.h new file mode 100644 index 0000000..b4bf077 --- /dev/null +++ b/DwellCursor/KinectInput.h @@ -0,0 +1,29 @@ +#ifndef __KINECTINPUT__ +#define __KINECTINPUT__ + +#include +#include +#include +#include + +class KinectInput: public QThread +{ + Q_OBJECT + public: + KinectInput(); + ~KinectInput(); + + void run(); + void stop(); + + private: + INuiSensor* _kinect; + HANDLE _skeletonEvent; + bool _running; + int _skeletonid; + + signals: + void rightHandMove(float x, float y, float z); +}; + +#endif diff --git a/DwellCursor/MainScene.cpp b/DwellCursor/MainScene.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3bfdc32bd5818f27f8fb72906d8467c49deaa12e GIT binary patch literal 5410 zcmeHLTW{Mo6yB=>M7ptBY`=Zq zIizLD(Y9j4fITcgY>7OV?_7E4uXP$Ft5}K7WvJ74kxJEI+1cOQ-_xlT)!KMGjUQB! zSbeX=xi}e(MrTA+Bd8wb)tlL^imW&id042_cK7$jS1*b%U+T!P3h6g`Vw!};YOC(E zkE)Qbf4aEnVlhk#6~<*=C}UJC=V4-0x3|AHovp0RQd1G8GrzKyBVw%HOZOhF3PNBD z9VTwY=tUYP_hFtxpIvGLbf5S40($IE!Z>~fF!Iou`=H~6vR#-O)E5Ru*r`8L^$uy1F2u?xxMlMOx5aE* zPf&#vDp$x~*t$uiMxwAF4#uwfu&}HjP8<#+q`Orj$rfU+6NNReE{JLUTwFcJ_jv5n znOadG#K}TJg|JgXiVT{{4O5m=43+m?f0)oH#gi#o<&xp8Mu5l7AZVHho;^cB&#`(}ahpBl`McswI+8EJ1N6)fz zIrWPuw1fEUz?{)%{2_(cP=ORVm4rDRuBb)UghG90BCXLR7zmn7NShnoUN79k22f>I zJ$5|SX{^?7=HKz@Cu?UOPQtEWf$p4bE$eNyJ+3`pviT~q}CvoW{r|30x0i_p^$47zZ(~7q@+ih5~L-QmP}f1NJ(y6 zCtdIK&x)wt6Cd|Jr#R1m?OYfK^%$-B2pBeR47U$A0`uvB2E`!o#(|OWGATj4tr+Qz zJPSKOQe&*Tk@oZ@V!!K2Nr-xa#3N(rkz_f|&3UUu9MLhxX?+x-A@35s6C;3ZVM5Mq z@Hjn!{*dTARJAhr$%?xd6&{M~u%XhAIGBB~>7=68=wxZ_8TT2^XBy9bpiUv1Blab2 z@&;VYl>D;ET%P9LcuR)9#oW0iLbIof04+KgZKGW~`Cv^wqyGn+C2jIx%LeW5?N%rA zy`{1LpW4)ND%ILmn?WwMtJ<$h|C96CaJU)DaEPxha?sCAvU70qAw4+7|2LiPAS@Pg z?Y>I)^@&0W_9^j^x8LI%=kc0v76|ZgNY@`eynYe^hnj7!X}I+{kfS3YgnK9NTnw+WKN_e|Iy1T#$Dcdq_P ziWA}q#Bi8q@Ikr&>1QJ6v7mlqZ3ttMX5ip5RTQh-4M@<}xbOBSi3&FZm6u+hV`wUE z89Lk$#H={ZnOs^&&c!DpX8AC~QX&9ss#D@ed7$hvLZ&3_kI_qnp1H0H7^ad>;vFx64|i zt1g!x!$i~F#r0r{x$nIEgM;tAC|HC9d;N)DCesnYnnYY9H^VOx(@6cr@nhCU@gs#_ z61K|ytqy8}T=H)#T!B^OklOfdg0wZF@>jWC-~TUWFB!yPYDB5#03XrD$`^)>uO6JX ieWTCaxsl?v(hD9h_*h +#include +#include +#include +#include + +#include "DwellWidget.h" +#include "KinectInput.h" +#include "DwellButton.h" + +#include + +class MainScene: public QGraphicsScene +{ + Q_OBJECT + + public: + MainScene(QObject * parent = 0); + ~MainScene(); + + void init(QString user, QString condition, int repetitions); + + void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent); + void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent); + + void setButtonArray(int x, int y, float sx, float sy, float bsx, float bsy); + + void log(const QString &event, int button, int answer); + int indexOfButton(DwellButton *b) const; + + private: + DwellWidget _dwellwidget; + KinectInput _kinectsensor; + + QTime _enteredtime; + bool _alreadypressed; + DwellButton *_lastitemover; + DwellButton **_buttons; + int _nbbuttonsx, _nbbuttonsy; + QSignalMapper _signalmapper; + + static int _dwelltime; + + //experiment stuff + FILE *_logfile; + QTime _start; + QList _trials; + int _currenttrial; + + private slots: + void displayHandPosition(float x, float y, float z); + void buttonClicked(int n); +}; + +#endif \ No newline at end of file diff --git a/DwellCursor/MainView.cpp b/DwellCursor/MainView.cpp new file mode 100644 index 0000000..2e8c15a --- /dev/null +++ b/DwellCursor/MainView.cpp @@ -0,0 +1,18 @@ +#include "MainView.h" + +MainView::MainView(float sx, float sy, MainScene * scene, QWidget *parent) +:QGraphicsView(scene, parent), _width(sx), _height(sy) +{ + setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); + setMouseTracking(true); + setSceneRect(-sx / 2.0, -sy / 2.0, sx, sy); +} + +MainView::~MainView() +{ +} + +void MainView::resizeEvent(QResizeEvent * event) +{ + fitInView(-_width / 2.0, -_height / 2.0, _width, _height, Qt::KeepAspectRatio); +} diff --git a/DwellCursor/MainView.h b/DwellCursor/MainView.h new file mode 100644 index 0000000..0c6aaaa --- /dev/null +++ b/DwellCursor/MainView.h @@ -0,0 +1,22 @@ +#ifndef __MAINVIEW__ +#define __MAINVIEW__ + +#include + +#include "MainScene.h" + +class MainView: public QGraphicsView +{ + Q_OBJECT + + public: + MainView(float sx, float sy, MainScene * scene, QWidget * parent=0); + ~MainView(); + + private: + void resizeEvent(QResizeEvent * event); + + float _width, _height; +}; + +#endif diff --git a/DwellCursor/dwellcursor.cpp b/DwellCursor/dwellcursor.cpp new file mode 100644 index 0000000..2be2b47 --- /dev/null +++ b/DwellCursor/dwellcursor.cpp @@ -0,0 +1,38 @@ +#include "dwellcursor.h" + +#include + +DwellCursor::DwellCursor(QWidget *parent, Qt::WFlags flags) + : QMainWindow(parent, flags), _sound(new QSound("whitenoise05.wav")) +{ + setupUi(this); + if (_sound) + _sound->setLoops(-1); +} + +DwellCursor::~DwellCursor() +{ +} + +void DwellCursor::init(QString user, QString condition, int repetitions, int nbx, int nby, float bsx, float bsy,float spacex, float spacey) +{ + _user = user; + _condition = condition; + _repetitions = repetitions; + _nbx = nbx; + _nby = nby; + _bsx = bsx; + _bsy = bsy; + _spacex = spacex; + _spacey = spacey; + + if (_sound) + _sound->play(); + + _scene = new MainScene(); + _scene->setButtonArray(nbx, nby, spacex, spacey, bsx, bsy); + _scene->init(user, condition, repetitions); + + _view = new MainView(spacex, spacey, _scene); + setCentralWidget(_view); +} diff --git a/DwellCursor/dwellcursor.h b/DwellCursor/dwellcursor.h new file mode 100644 index 0000000..5fe27fd --- /dev/null +++ b/DwellCursor/dwellcursor.h @@ -0,0 +1,36 @@ +#ifndef DWELLCURSOR_H +#define DWELLCURSOR_H + +#include +#include "ui_dwellcursor.h" +#include +#include "DwellWidget.h" +#include "MainScene.h" +#include "MainView.h" + +class DwellCursor : public QMainWindow, Ui::DwellCursorClass +{ + Q_OBJECT + +public: + DwellCursor(QWidget *parent = 0, Qt::WFlags flags = 0); + ~DwellCursor(); + + void init(QString user, QString condition, int repetitions, int nbx, int nby, float bsx, float bsy, float spacex, float spacey); + void log(QString answer); + +private: + DwellWidget _dwellwidget; + MainScene *_scene; + QGraphicsView *_view; + QSound *_sound; + + QString _user, _condition; + int _repetitions; + int _nbx, _nby; + float _bsx, _bsy; + float _spacex, _spacey; + +}; + +#endif // DWELLCURSOR_H diff --git a/DwellCursor/dwellcursor.qrc b/DwellCursor/dwellcursor.qrc new file mode 100644 index 0000000..2d55f9f --- /dev/null +++ b/DwellCursor/dwellcursor.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/DwellCursor/dwellcursor.ui b/DwellCursor/dwellcursor.ui new file mode 100644 index 0000000..85d861c --- /dev/null +++ b/DwellCursor/dwellcursor.ui @@ -0,0 +1,23 @@ + + + DwellCursorClass + + + + 0 + 0 + 600 + 400 + + + + DwellCursor + + + + + + + + + diff --git a/DwellCursor/main.cpp b/DwellCursor/main.cpp new file mode 100644 index 0000000..5eaf6de --- /dev/null +++ b/DwellCursor/main.cpp @@ -0,0 +1,10 @@ +#include "ExperimentSetup.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ExperimentSetup w; + w.show(); + return a.exec(); +} \ No newline at end of file -- 2.30.2