summaryrefslogtreecommitdiffhomepage
path: root/tracker-steamvr
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-12-03 22:23:08 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-12-04 12:19:26 +0100
commitb256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch)
tree4fa1e46de224cf834a05824dc1eb86001bdb3300 /tracker-steamvr
parente89709a801e7874bc02c66848c638c6a0ccc85c1 (diff)
api: add status check for modules
Diffstat (limited to 'tracker-steamvr')
-rw-r--r--tracker-steamvr/steamvr.cpp34
-rw-r--r--tracker-steamvr/steamvr.hpp2
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;