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-rift-025 | |
parent | e89709a801e7874bc02c66848c638c6a0ccc85c1 (diff) |
api: add status check for modules
Diffstat (limited to 'tracker-rift-025')
-rw-r--r-- | tracker-rift-025/ftnoir_tracker_rift_025.cpp | 30 | ||||
-rw-r--r-- | tracker-rift-025/ftnoir_tracker_rift_025.h | 6 |
2 files changed, 15 insertions, 21 deletions
diff --git a/tracker-rift-025/ftnoir_tracker_rift_025.cpp b/tracker-rift-025/ftnoir_tracker_rift_025.cpp index 92ae36ea..8d4a6e8a 100644 --- a/tracker-rift-025/ftnoir_tracker_rift_025.cpp +++ b/tracker-rift-025/ftnoir_tracker_rift_025.cpp @@ -41,8 +41,10 @@ rift_tracker_025::~rift_tracker_025() System::Destroy(); } -void rift_tracker_025::start_tracker(QFrame*) +module_status rift_tracker_025::start_tracker(QFrame*) { + QString err; + System::Init(Log::ConfigureDefaultLog(LogMask_All)); pManager = DeviceManager::Create(); if (pManager != NULL) @@ -59,29 +61,19 @@ void rift_tracker_025::start_tracker(QFrame*) pSFusion->AttachToSensor(pSensor); } else - { - QMessageBox::warning(nullptr, - QCoreApplication::translate("rift_tracker_025", "Error"), - QCoreApplication::translate("rift_tracker_025", "Unable to create Rift sensor"), - QMessageBox::Ok,QMessageBox::NoButton); - } + err = tr("Unable to create Rift sensor"); } else - { - QMessageBox::warning(nullptr, - QCoreApplication::translate("rift_tracker_025", "Error"), - QCoreApplication::translate("rift_tracker_025", "Unable to enumerate Rift tracker"), - QMessageBox::Ok,QMessageBox::NoButton); - } + err = tr("Unable to enumerate Rift tracker"); } else - { - QMessageBox::warning(nullptr, - QCoreApplication::translate("rift_tracker_025", "Error"), - QCoreApplication::translate("rift_tracker_025", "Unable to start Rift tracker"), - QMessageBox::Ok,QMessageBox::NoButton); - } + err = tr("Unable to start Rift tracker"); + + if (err.isEmpty()) + return status_ok(); + else + return error(err); } diff --git a/tracker-rift-025/ftnoir_tracker_rift_025.h b/tracker-rift-025/ftnoir_tracker_rift_025.h index b65d3e56..37ffcdaa 100644 --- a/tracker-rift-025/ftnoir_tracker_rift_025.h +++ b/tracker-rift-025/ftnoir_tracker_rift_025.h @@ -21,12 +21,14 @@ struct settings : opts { {} }; -class rift_tracker_025 : public ITracker +class rift_tracker_025 : public QObject, public ITracker { + Q_OBJECT + public: rift_tracker_025(); virtual ~rift_tracker_025() override; - void start_tracker(QFrame *) override; + module_status start_tracker(QFrame *) override; void data(double *data) override; private: double old_yaw; |