diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-01-04 13:06:53 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-01 22:47:07 +0100 |
commit | 00b01a219f694ab8237e6e7be5776ff375a5c9d4 (patch) | |
tree | 5d9ee2fa36d61ca6b4a238f47cff3a5c67ece1b5 /opentrack | |
parent | bd90aaa53751610b5b49ab9042b4612af2816f88 (diff) |
opentrack: add UI_NO_VIDEO_FRAME
Diffstat (limited to 'opentrack')
-rw-r--r-- | opentrack/defs.hpp | 2 | ||||
-rw-r--r-- | opentrack/main-window.cpp | 19 | ||||
-rw-r--r-- | opentrack/main-window.hpp | 6 |
3 files changed, 25 insertions, 2 deletions
diff --git a/opentrack/defs.hpp b/opentrack/defs.hpp index e3826474..b2f0c467 100644 --- a/opentrack/defs.hpp +++ b/opentrack/defs.hpp @@ -11,4 +11,6 @@ //#define UI_NO_RAW_DATA //#define UI_NO_GAME_DATA +//#define UI_NO_VIDEO_FEED + //define UI_ACCELA_OLD_STAIRCASE diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index deccbc5a..71ab96f5 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -67,6 +67,10 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH) connect(&*s.b, &options::bundle_::saving, this, &main_window::register_shortcuts); ui.btnStartTracker->setFocus(); +#ifdef UI_NO_VIDEO_FEED + fake_video_frame.resize(640, 480); + fake_video_frame_parent.setVisible(false); +#endif } void main_window::init_shortcuts() @@ -303,7 +307,11 @@ bool main_window::profile_name_from_dialog(QString& ret) main_window::~main_window() { // stupid ps3 eye has LED issues +#ifndef UI_NO_VIDEO_FEED if (work && ui.video_frame->layout()) +#else + if (work) +#endif { hide(); stop_tracker_(); @@ -411,6 +419,7 @@ 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 ui.video_frame_label->setVisible(not_running || inertialp); if(not_running) { @@ -419,6 +428,7 @@ void main_window::update_button_state(bool running, bool inertialp) else { ui.video_frame_label->setPixmap(QPixmap(":/images/no-feed.png")); } +#endif } void main_window::start_tracker_() @@ -426,7 +436,12 @@ void main_window::start_tracker_() if (work) return; - work = std::make_shared<Work>(pose, ui.video_frame, current_tracker(), current_protocol(), current_filter()); +#ifndef UI_NO_VIDEO_FEED + auto* frame = ui.video_frame; +#else + auto* frame = &fake_video_frame; +#endif + work = std::make_shared<Work>(pose, frame, current_tracker(), current_protocol(), current_filter()); if (!work->is_ok()) { @@ -460,7 +475,7 @@ void main_window::start_tracker_() // NB check valid since SelectedLibraries ctor called // trackers take care of layout state updates - const bool is_inertial = ui.video_frame->layout() == nullptr; + const bool is_inertial = frame->layout() == nullptr; update_button_state(true, is_inertial); ui.btnStopTracker->setFocus(); diff --git a/opentrack/main-window.hpp b/opentrack/main-window.hpp index ddb6b725..1dcbd0eb 100644 --- a/opentrack/main-window.hpp +++ b/opentrack/main-window.hpp @@ -8,6 +8,7 @@ #pragma once +#include "opentrack/defs.hpp" #include "api/plugin-support.hpp" #include "gui/mapping-dialog.hpp" #include "gui/options-dialog.hpp" @@ -50,6 +51,11 @@ class main_window final : public QMainWindow, private State Shortcuts global_shortcuts; QShortcut kbd_quit { QKeySequence("Ctrl+Q"), this }; +#ifdef UI_NO_VIDEO_FEED + QWidget fake_video_frame_parent; + QFrame fake_video_frame{&fake_video_frame_parent}; +#endif + std::unique_ptr<options_dialog> options_widget; std::unique_ptr<mapping_dialog> mapping_widget; |