summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-01-16 23:48:15 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-01-23 14:16:34 +0100
commit8a2116626fcc1e8a87f3152cbd1b3f260a71c14d (patch)
treec2cd7bd7a0f966e12ab43f73e708c31a45ac99c7
parentd48984e05638c3927a05b535c5c45e9750aef781 (diff)
add compact video feed
-rw-r--r--opentrack/defs.hpp4
-rw-r--r--opentrack/lang/nl_NL.ts8
-rw-r--r--opentrack/lang/ru_RU.ts8
-rw-r--r--opentrack/lang/stub.ts8
-rw-r--r--opentrack/lang/zh_CN.ts8
-rw-r--r--opentrack/main-window.cpp25
-rw-r--r--opentrack/main-window.hpp3
-rw-r--r--opentrack/main-window.ui101
-rw-r--r--pose-widget/pose-widget.cpp9
9 files changed, 142 insertions, 32 deletions
diff --git a/opentrack/defs.hpp b/opentrack/defs.hpp
index 891652ab..f7ccc197 100644
--- a/opentrack/defs.hpp
+++ b/opentrack/defs.hpp
@@ -11,7 +11,7 @@
#define UI_NO_RAW_DATA
#define UI_NO_GAME_DATA
-#define UI_NO_VIDEO_FEED
+//#define UI_NO_VIDEO_FEED
+#define UI_COMPACT_VIDEO_FEED
//define UI_ACCELA_OLD_STAIRCASE
-
diff --git a/opentrack/lang/nl_NL.ts b/opentrack/lang/nl_NL.ts
index 4e87d35a..b0e0072a 100644
--- a/opentrack/lang/nl_NL.ts
+++ b/opentrack/lang/nl_NL.ts
@@ -39,10 +39,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>🔨</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Output</source>
<translation type="unfinished"></translation>
</message>
@@ -134,6 +130,10 @@ Exiting now.</source>
<source>Don&apos;t run as root to remove these annoying messages.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Preview</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>new_file_dialog</name>
diff --git a/opentrack/lang/ru_RU.ts b/opentrack/lang/ru_RU.ts
index 62760343..6f202f4f 100644
--- a/opentrack/lang/ru_RU.ts
+++ b/opentrack/lang/ru_RU.ts
@@ -107,10 +107,6 @@ Exiting now.</source>
<translation>Остановить</translation>
</message>
<message>
- <source>🔨</source>
- <translation></translation>
- </message>
- <message>
<source>Output</source>
<translation>Выходной интерфейс</translation>
</message>
@@ -138,6 +134,10 @@ Exiting now.</source>
<source>Don&apos;t run as root to remove these annoying messages.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Preview</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>new_file_dialog</name>
diff --git a/opentrack/lang/stub.ts b/opentrack/lang/stub.ts
index 9a274581..cef43cb3 100644
--- a/opentrack/lang/stub.ts
+++ b/opentrack/lang/stub.ts
@@ -39,10 +39,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>🔨</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Output</source>
<translation type="unfinished"></translation>
</message>
@@ -134,6 +130,10 @@ Exiting now.</source>
<source>Don&apos;t run as root to remove these annoying messages.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Preview</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>new_file_dialog</name>
diff --git a/opentrack/lang/zh_CN.ts b/opentrack/lang/zh_CN.ts
index f88bb039..cfeb5f3e 100644
--- a/opentrack/lang/zh_CN.ts
+++ b/opentrack/lang/zh_CN.ts
@@ -39,10 +39,6 @@
<translation>停止</translation>
</message>
<message>
- <source>🔨</source>
- <translation></translation>
- </message>
- <message>
<source>Output</source>
<translation>输出</translation>
</message>
@@ -138,6 +134,10 @@ Exiting now.</source>
<source> :: </source>
<translation></translation>
</message>
+ <message>
+ <source>Preview</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>new_file_dialog</name>
diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp
index 71ab96f5..76b60faf 100644
--- a/opentrack/main-window.cpp
+++ b/opentrack/main-window.cpp
@@ -70,6 +70,8 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH)
#ifdef UI_NO_VIDEO_FEED
fake_video_frame.resize(640, 480);
fake_video_frame_parent.setVisible(false);
+#elif defined UI_COMPACT_VIDEO_FEED
+ connect(ui.preview_checkbox, &QCheckBox::toggled, this, &main_window::toggle_video_preview);
#endif
}
@@ -419,7 +421,12 @@ void main_window::update_button_state(bool running, bool inertialp)
ui.iconcomboTrackerSource->setEnabled(not_running);
#endif
ui.profile_button->setEnabled(not_running);
-#ifndef UI_NO_VIDEO_FEED
+#ifdef UI_COMPACT_VIDEO_FEED
+ ui.preview_checkbox->setChecked(false);
+ ui.preview_checkbox->raise();
+ ui.preview_checkbox->setVisible(running && !inertialp);
+ toggle_video_preview(false);
+#elif !defined UI_NO_VIDEO_FEED
ui.video_frame_label->setVisible(not_running || inertialp);
if(not_running)
{
@@ -431,6 +438,22 @@ void main_window::update_button_state(bool running, bool inertialp)
#endif
}
+#ifdef UI_COMPACT_VIDEO_FEED
+void main_window::toggle_video_preview(bool value)
+{
+ value &= ui.video_frame->layout() != nullptr;
+ ui.video_frame_parent->setVisible(value);
+ ui.video_frame_parent->raise();
+ ui.video_frame->raise();
+ ui.pose_display->setVisible(!value);
+ ui.preview_checkbox->raise();
+ if (value)
+ ui.preview_checkbox->setStyleSheet("QCheckBox { color: #32CD32 }");
+ else
+ ui.preview_checkbox->setStyleSheet("");
+}
+#endif
+
void main_window::start_tracker_()
{
if (work)
diff --git a/opentrack/main-window.hpp b/opentrack/main-window.hpp
index 1dcbd0eb..322c74c5 100644
--- a/opentrack/main-window.hpp
+++ b/opentrack/main-window.hpp
@@ -118,6 +118,9 @@ public:
void show_pose();
void show_pose_(const double* mapped, const double* raw);
void set_title(const QString& game_title = QString());
+#ifdef UI_COMPACT_VIDEO_FEED
+ void toggle_video_preview(bool value);
+#endif
void start_tracker_();
void stop_tracker_();
diff --git a/opentrack/main-window.ui b/opentrack/main-window.ui
index dd158302..0e6867e1 100644
--- a/opentrack/main-window.ui
+++ b/opentrack/main-window.ui
@@ -8,7 +8,7 @@
<x>0</x>
<y>0</y>
<width>466</width>
- <height>490</height>
+ <height>498</height>
</rect>
</property>
<property name="sizePolicy">
@@ -39,16 +39,10 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="pose_widget" name="pose_display" native="true">
+ <item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
+ <widget class="QWidget" name="frame_parent" native="true">
<property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -56,9 +50,94 @@
<property name="minimumSize">
<size>
<width>448</width>
- <height>315</height>
+ <height>320</height>
</size>
</property>
+ <widget class="pose_widget" name="pose_display" native="true">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>448</width>
+ <height>320</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>448</width>
+ <height>320</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QWidget" name="video_frame_parent" native="true">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>0</y>
+ <width>426</width>
+ <height>320</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>426</width>
+ <height>320</height>
+ </size>
+ </property>
+ <widget class="QFrame" name="video_frame">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>448</width>
+ <height>320</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>426</width>
+ <height>320</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QCheckBox" name="preview_checkbox">
+ <property name="geometry">
+ <rect>
+ <x>370</x>
+ <y>290</y>
+ <width>67</width>
+ <height>18</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Preview</string>
+ </property>
+ </widget>
+ <zorder>video_frame_parent</zorder>
+ <zorder>pose_display</zorder>
+ <zorder>preview_checkbox</zorder>
</widget>
</item>
<item>
diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp
index ac3aa74a..7c1f19c0 100644
--- a/pose-widget/pose-widget.cpp
+++ b/pose-widget/pose-widget.cpp
@@ -8,6 +8,7 @@
#include "pose-widget.hpp"
#include "compat/check-visible.hpp"
#include "compat/math.hpp"
+#include "opentrack/defs.hpp"
#include <QPainter>
#include <QtEvents>
@@ -38,17 +39,21 @@ pose_widget::pose_widget(QWidget* parent) : QWidget(parent)
shine.fill(QColor(255,255,255));
p.begin(&shine);
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
- p.drawImage(QPointF(0,0), front);
+ p.drawImage(QPointF(0,0), front);
p.end();
//draw Octopus shadow
shadow.fill(QColor(0,0,0));
p.begin(&shadow);
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
- p.drawImage(QPointF(0,0), front);
+ p.drawImage(QPointF(0,0), front);
p.end();
mirror.setFocusPolicy(Qt::NoFocus);
+
+#ifdef UI_COMPACT_VIDEO_FEED
+ mirror.setVisible(false);
+#endif
}
void pose_widget::present(double yaw, double pitch, double roll, double x, double y, double z)