summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-12-16 15:27:03 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-03-29 00:04:49 +0200
commitfc056782d0d7bf567602e167c57ed60bfe6d511d (patch)
treef7f95af0ce43377dcee16bd1bf9635210be06cbf
parent08ce6fe24cec5d67d6da1a4d4c6ebac5f07fc7d9 (diff)
tracker/trackhat: show raw data in the tracker settings ui
-rw-r--r--tracker-trackhat/dialog.cpp19
-rw-r--r--tracker-trackhat/dialog.hpp1
-rw-r--r--tracker-trackhat/dialog.ui95
3 files changed, 113 insertions, 2 deletions
diff --git a/tracker-trackhat/dialog.cpp b/tracker-trackhat/dialog.cpp
index 9e3f9655..c6144a4c 100644
--- a/tracker-trackhat/dialog.cpp
+++ b/tracker-trackhat/dialog.cpp
@@ -6,7 +6,7 @@ trackhat_dialog::trackhat_dialog()
{
ui.setupUi(this);
poll_tracker_info();
- poll_timer.setInterval(250);
+ poll_timer.setInterval(100);
const std::tuple<QString, model_type> model_types[] = {
{ tr("Cap"), model_cap },
@@ -98,6 +98,7 @@ void trackhat_dialog::unregister_tracker()
tracker = nullptr;
poll_tracker_info();
poll_timer.stop();
+ update_raw_data();
}
void trackhat_dialog::save()
@@ -127,6 +128,7 @@ void trackhat_dialog::poll_tracker_info()
ui.status_label->setText(tr("Status: %1 points detected. Good!").arg(tracker->get_n_points()));
else
ui.status_label->setText(tr("Status: %1 points detected. BAD!").arg(tracker->get_n_points()));
+ update_raw_data();
}
void trackhat_dialog::set_buttons_visible(bool x)
@@ -134,3 +136,18 @@ void trackhat_dialog::set_buttons_visible(bool x)
ui.buttonBox->setVisible(x);
adjustSize();
}
+void trackhat_dialog::update_raw_data()
+{
+ QLabel* labels[] = { ui.label_x, ui.label_y, ui.label_z, ui.label_yaw, ui.label_pitch, ui.label_roll };
+ if (tracker)
+ {
+ QString str; str.reserve(16);
+ double data[6] {};
+ tracker->data(data);
+ for (unsigned i = 0; i < std::size(labels); i++)
+ labels[i]->setText(str.sprintf("%.2f%s", data[i], i >= 3 ? "°" : " mm"));
+ }
+ else
+ for (QLabel* x : labels)
+ x->setText(QStringLiteral("-"));
+}
diff --git a/tracker-trackhat/dialog.hpp b/tracker-trackhat/dialog.hpp
index 49c23753..35ca866b 100644
--- a/tracker-trackhat/dialog.hpp
+++ b/tracker-trackhat/dialog.hpp
@@ -18,6 +18,7 @@ protected:
trackhat_settings t;
void set_buttons_visible(bool x) override;
+ void update_raw_data();
public:
trackhat_dialog();
diff --git a/tracker-trackhat/dialog.ui b/tracker-trackhat/dialog.ui
index 92f96f93..73c67a06 100644
--- a/tracker-trackhat/dialog.ui
+++ b/tracker-trackhat/dialog.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>365</width>
- <height>392</height>
+ <height>485</height>
</rect>
</property>
<property name="minimumSize">
@@ -467,6 +467,99 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>Raw data</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>X</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_y">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_z">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>Yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Roll</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_x">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Z</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="label_yaw">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="label_pitch">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QLabel" name="label_roll">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>