summaryrefslogtreecommitdiffhomepage
path: root/proto-ft
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-04-06 17:35:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-04-06 17:35:18 +0200
commitbe1b4e083d3599d4e0ad1f483ff5fe1f7ee1178f (patch)
treeba5d4a508ac944b06b0de873677b45a7228b1048 /proto-ft
parent926b2b16c8df2e7c54de10780860176d2277e9b1 (diff)
proto/ft: only clear registry path on program exit
Clear registry path when opentrack exits, not merely tracking is stopped. This is still controlled by the checkbox, while checking for being the first instance happens always regardless. Also update dialog description. Issue: #332
Diffstat (limited to 'proto-ft')
-rwxr-xr-xproto-ft/ftnoir_ftcontrols.ui6
-rwxr-xr-xproto-ft/ftnoir_protocol_ft.cpp1
-rwxr-xr-xproto-ft/ftnoir_protocol_ft.h1
-rwxr-xr-xproto-ft/mutex.cpp29
4 files changed, 17 insertions, 20 deletions
diff --git a/proto-ft/ftnoir_ftcontrols.ui b/proto-ft/ftnoir_ftcontrols.ui
index b63d92a1..10c2c427 100755
--- a/proto-ft/ftnoir_ftcontrols.ui
+++ b/proto-ft/ftnoir_ftcontrols.ui
@@ -12,8 +12,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>511</width>
- <height>413</height>
+ <width>503</width>
+ <height>379</height>
</rect>
</property>
<property name="sizePolicy">
@@ -212,7 +212,7 @@ Starting tracking will again overwrite the DLL locations.</string>
</sizepolicy>
</property>
<property name="text">
- <string>Disable on protocol exit</string>
+ <string>Disable on program exit</string>
</property>
</widget>
</item>
diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp
index 121da494..42671b8f 100755
--- a/proto-ft/ftnoir_protocol_ft.cpp
+++ b/proto-ft/ftnoir_protocol_ft.cpp
@@ -32,7 +32,6 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
dummyTrackIR.terminate();
dummyTrackIR.kill();
dummyTrackIR.waitForFinished(50);
- runonce_check->try_exit();
}
void FTNoIR_Protocol::pose(const double* headpose) {
diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h
index b5b802bd..061504d9 100755
--- a/proto-ft/ftnoir_protocol_ft.h
+++ b/proto-ft/ftnoir_protocol_ft.h
@@ -43,7 +43,6 @@ typedef void (__stdcall *importTIRViewsStop)(void);
struct runonce
{
virtual void try_runonce() = 0;
- virtual void try_exit() = 0;
virtual bool is_first_run() = 0;
virtual ~runonce() {}
virtual void set_enabled(bool flag) = 0;
diff --git a/proto-ft/mutex.cpp b/proto-ft/mutex.cpp
index 34f5f518..88021810 100755
--- a/proto-ft/mutex.cpp
+++ b/proto-ft/mutex.cpp
@@ -7,7 +7,20 @@ class check_for_first_run : public runonce
bool is_first_instance;
bool enabled;
+ void try_exit()
+ {
+ if (is_first_instance && enabled)
+ {
+ qDebug() << "ft runonce: removing registry keys";
+ FTNoIR_Protocol::set_protocols(false, false);
+ }
+ }
+
public:
+ check_for_first_run() : checked_for_first_run(false), is_first_instance(false), enabled(false)
+ {
+ }
+
bool is_first_run() override
{
return checked_for_first_run && is_first_instance;
@@ -23,7 +36,7 @@ public:
{
constexpr const char* name = "opentrack-freetrack-runonce";
- if (checked_for_first_run || !enabled)
+ if (checked_for_first_run)
return;
// just leak it, no issue
@@ -49,20 +62,6 @@ public:
qDebug() << "ft runonce:" << "first-run" << is_first_instance << "checked" << checked_for_first_run;
}
- void try_exit() override
- {
- if (is_first_instance && enabled)
- {
- qDebug() << "ft runonce: removing registry keys";
- FTNoIR_Protocol::set_protocols(false, false);
- }
- }
-
-public:
- check_for_first_run() : checked_for_first_run(false), is_first_instance(false), enabled(false)
- {
- }
-
~check_for_first_run()
{
try_exit();