diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-03 22:23:08 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-04 12:19:26 +0100 |
commit | b256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch) | |
tree | 4fa1e46de224cf834a05824dc1eb86001bdb3300 /tracker-steamvr/steamvr.cpp | |
parent | e89709a801e7874bc02c66848c638c6a0ccc85c1 (diff) |
api: add status check for modules
Diffstat (limited to 'tracker-steamvr/steamvr.cpp')
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 34 |
1 files changed, 14 insertions, 20 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); }); } |