From fb958d5418304995f04e997cc9df1bda14ebbd83 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 30 Mar 2017 15:35:53 +0200 Subject: tracker/steamvr: put serial number as userdata --- tracker-steamvr/steamvr.cpp | 8 ++++---- tracker-steamvr/steamvr.hpp | 4 ++-- 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& 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& 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 device_serial; + value device_serial; settings() : opts("valve-steamvr"), - device_serial(b, "serial", "") + device_serial(b, "serial", QVariant(QVariant::String)) {} }; -- cgit v1.2.3