diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 11:22:52 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 11:22:52 +0100 |
commit | 4a5b7ff7ec97f9078780ffc44d923d11a0aa18c1 (patch) | |
tree | 5d69f32b72176fa79bb6d6ef242453312cad891e | |
parent | 0b155e6016d162e9ead045d9e9e862c96b7a61bd (diff) |
tracker/steamvr: better error messages
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 15 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.hpp | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 4c40d1a1..ff48ad3d 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -170,14 +170,19 @@ tt device_list::vr_init_() QString device_list::error_string(vr_error_t err) { - const char* str(vr::VR_GetVRInitErrorAsSymbol(err)); - return QString(str ? str : "No description"); -} + const char* str = vr::VR_GetVRInitErrorAsSymbol(err); + const char* desc = vr::VR_GetVRInitErrorAsEnglishDescription(err); -steamvr::steamvr() : device_index(-1) -{ + if (!desc) + desc = "No description"; + + if (str) + return QStringLiteral("%1: %2").arg(str, desc); + else + return { "Unknown error" }; } +steamvr::steamvr() = default; steamvr::~steamvr() = default; module_status steamvr::start_tracker(QFrame*) diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 1a16f002..88fa740a 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -76,7 +76,7 @@ class steamvr : public QObject, public ITracker static void matrix_to_euler(double& yaw, double& pitch, double& roll, const vr::HmdMatrix34_t& result); settings s; - int device_index; + unsigned device_index{UINT_MAX}; public: steamvr(); |