diff options
Diffstat (limited to 'tracker-steamvr')
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 34 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.hpp | 2 |
2 files changed, 15 insertions, 21 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index d250197b..82a38fb7 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -183,16 +183,16 @@ steamvr::~steamvr() { } -void steamvr::start_tracker(QFrame*) +module_status steamvr::start_tracker(QFrame*) { - with_vr_lock([this](vr_t v, error_t e) + return with_vr_lock([this](vr_t v, error_t e) { + QString err; + if (!v) { - QMessageBox::warning(nullptr, - tr("SteamVR init error"), device_list::strerror(e), - QMessageBox::Close, QMessageBox::NoButton); - return; + err = device_list::strerror(e); + return error(err); } const QString serial = s.device_serial().toString(); @@ -201,13 +201,7 @@ void steamvr::start_tracker(QFrame*) const int sz = specs.count(); if (sz == 0) - { - QMessageBox::warning(nullptr, - tr("SteamVR init error"), - tr("No HMD connected"), - QMessageBox::Close, QMessageBox::NoButton); - return; - } + err = tr("No HMD connected"); device_index = -1; @@ -220,13 +214,13 @@ void steamvr::start_tracker(QFrame*) } } - if (device_index == -1) - { - QMessageBox::warning(nullptr, - tr("SteamVR init error"), - tr("Can't find device with that serial"), - QMessageBox::Close, QMessageBox::NoButton); - } + if (device_index == -1 && err.isEmpty()) + err = tr("Can't find device with that serial"); + + if (err.isEmpty()) + return status_ok(); + else + return error(err); }); } diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 0592dec9..c8712b20 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -76,7 +76,7 @@ class steamvr : public QObject, public ITracker public: steamvr(); ~steamvr() override; - void start_tracker(QFrame *) override; + module_status start_tracker(QFrame *) override; void data(double *data) override; bool center() override; |