From 8a2116626fcc1e8a87f3152cbd1b3f260a71c14d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 16 Jan 2023 23:48:15 +0100 Subject: add compact video feed --- opentrack/defs.hpp | 4 +- opentrack/lang/nl_NL.ts | 8 ++-- opentrack/lang/ru_RU.ts | 8 ++-- opentrack/lang/stub.ts | 8 ++-- opentrack/lang/zh_CN.ts | 8 ++-- opentrack/main-window.cpp | 25 ++++++++++- opentrack/main-window.hpp | 3 ++ opentrack/main-window.ui | 101 +++++++++++++++++++++++++++++++++++++++----- pose-widget/pose-widget.cpp | 9 +++- 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 @@ -38,10 +38,6 @@ Stop - - 🔨 - - Output @@ -134,6 +130,10 @@ Exiting now. Don't run as root to remove these annoying messages. + + Preview + + new_file_dialog 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 @@ -106,10 +106,6 @@ Exiting now. Stop Остановить - - 🔨 - - Output Выходной интерфейс @@ -138,6 +134,10 @@ Exiting now. Don't run as root to remove these annoying messages. + + Preview + + new_file_dialog 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 @@ -38,10 +38,6 @@ Stop - - 🔨 - - Output @@ -134,6 +130,10 @@ Exiting now. Don't run as root to remove these annoying messages. + + Preview + + new_file_dialog 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 @@ -38,10 +38,6 @@ Stop 停止 - - 🔨 - - Output 输出 @@ -138,6 +134,10 @@ Exiting now. :: + + Preview + + new_file_dialog 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 @@ 0 0 466 - 490 + 498 @@ -39,16 +39,10 @@ - - 6 - - - 6 - - - + + - + 0 0 @@ -56,9 +50,94 @@ 448 - 315 + 320 + + + + 0 + 0 + 448 + 320 + + + + + 0 + 0 + + + + + 448 + 320 + + + + + + + 11 + 0 + 426 + 320 + + + + + 0 + 0 + + + + + 426 + 320 + + + + + + 0 + 0 + 448 + 320 + + + + + 0 + 0 + + + + + 426 + 320 + + + + QFrame::NoFrame + + + + + + + 370 + 290 + 67 + 18 + + + + Preview + + + video_frame_parent + pose_display + preview_checkbox 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 #include @@ -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) -- cgit v1.2.3