summaryrefslogtreecommitdiffhomepage
path: root/tracker-steamvr
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-30 15:35:53 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-06 04:29:50 +0200
commitfb958d5418304995f04e997cc9df1bda14ebbd83 (patch)
tree1d4c6c05eafd806e7f48630f5f6fb7ac988e06c3 /tracker-steamvr
parenta9333a5d93caac8cd4cdcd1e49d632fd1c96a6b4 (diff)
tracker/steamvr: put serial number as userdata
Diffstat (limited to 'tracker-steamvr')
-rw-r--r--tracker-steamvr/steamvr.cpp8
-rw-r--r--tracker-steamvr/steamvr.hpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp
index b04ebd33..ecc738a0 100644
--- a/tracker-steamvr/steamvr.cpp
+++ b/tracker-steamvr/steamvr.cpp
@@ -54,7 +54,7 @@ void device_list::fill_device_specs(QList<device_spec>& list)
device_states, vr::k_unMaxTrackedDeviceCount);
static constexpr unsigned bufsiz = vr::k_unTrackingStringSize;
- char str[bufsiz] {};
+ static char str[bufsiz] {}; // vr_lock prevents reentrancy
for (unsigned k = 0; k < vr::k_unMaxTrackedDeviceCount; k++)
{
@@ -176,7 +176,7 @@ void steamvr::start_tracker(QFrame*)
return;
}
- const QString serial = s.device_serial;
+ const QString serial = s.device_serial().toString();
device_list d;
const QList<device_spec>& specs = d.devices();
const int sz = specs.count();
@@ -250,11 +250,11 @@ steamvr_dialog::steamvr_dialog()
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
ui.device->clear();
- ui.device->addItem("");
+ ui.device->addItem("First available", QVariant(QVariant::String));
device_list list;
for (const device_spec& spec : list.devices())
- ui.device->addItem(spec.serial);
+ ui.device->addItem(QStringLiteral("%1 [%2]").arg(spec.model).arg(spec.serial), QVariant(spec.serial));
tie_setting(s.device_serial, ui.device);
}
diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp
index 9db32904..62815a58 100644
--- a/tracker-steamvr/steamvr.hpp
+++ b/tracker-steamvr/steamvr.hpp
@@ -27,10 +27,10 @@ using origin = vr::ETrackingUniverseOrigin;
struct settings : opts
{
- value<QString> device_serial;
+ value<QVariant> device_serial;
settings() :
opts("valve-steamvr"),
- device_serial(b, "serial", "")
+ device_serial(b, "serial", QVariant(QVariant::String))
{}
};