From 4704f0f2ecd68fd0ec71f6a08f5a76d173ee43c7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 20 Jan 2023 05:51:56 +0100 Subject: cmake: recompile .rc on .ico change --- opentrack/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'opentrack') diff --git a/opentrack/CMakeLists.txt b/opentrack/CMakeLists.txt index 7a83beb6..9bf5cb9b 100644 --- a/opentrack/CMakeLists.txt +++ b/opentrack/CMakeLists.txt @@ -11,4 +11,6 @@ set_target_properties(opentrack-executable PROPERTIES PREFIX "" ) +set_source_files_properties(resources.rc OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/opentrack.ico") + target_link_libraries(${self} opentrack-user-interface opentrack-version) -- cgit v1.2.3 From 00b01a219f694ab8237e6e7be5776ff375a5c9d4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 4 Jan 2023 13:06:53 +0100 Subject: opentrack: add UI_NO_VIDEO_FRAME --- opentrack/defs.hpp | 2 ++ opentrack/main-window.cpp | 19 +++++++++++++++++-- opentrack/main-window.hpp | 6 ++++++ 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'opentrack') 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(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(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_widget; std::unique_ptr mapping_widget; -- cgit v1.2.3 From 4c11e0be17ff1a96630ec2d787cc7f6bed56abc7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 1 Mar 2023 19:13:27 +0100 Subject: opentrack: only run pose display at 30 Hz Running it at 60 Hz was using too much CPU time. --- opentrack/main-window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'opentrack') diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index 71ab96f5..59a01e00 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -471,7 +471,7 @@ void main_window::start_tracker_() options_widget->register_filter(&*work->libs.pFilter); } - pose_update_timer.start(15); + pose_update_timer.start(1000/30); // NB check valid since SelectedLibraries ctor called // trackers take care of layout state updates -- cgit v1.2.3 From e8c0b30ff2db91c60b26b90054c16b22dca28956 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 1 Mar 2023 23:50:31 +0100 Subject: fix some GCC warnings --- api/plugin-api.cpp | 6 +++--- gui/options-dialog.cpp | 2 +- opentrack/main-window.cpp | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'opentrack') diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp index 6a43b55d..4d8d90e9 100644 --- a/api/plugin-api.cpp +++ b/api/plugin-api.cpp @@ -21,7 +21,7 @@ void BaseDialog::done(int) bool BaseDialog::embeddable() noexcept { return false; } void BaseDialog::save() {} void BaseDialog::reload() {} -void BaseDialog::set_buttons_visible(bool x) {} +void BaseDialog::set_buttons_visible(bool) {} } // ns plugin_api::detail @@ -36,13 +36,13 @@ IFilter::IFilter() = default; IFilter::~IFilter() = default; IFilterDialog::IFilterDialog() = default; IFilterDialog::~IFilterDialog() = default; -void IFilterDialog::register_filter(IFilter* filter) {} +void IFilterDialog::register_filter(IFilter*) {} void IFilterDialog::unregister_filter() {} IProtocol::IProtocol() = default; IProtocol::~IProtocol() = default; IProtocolDialog::IProtocolDialog() = default; IProtocolDialog::~IProtocolDialog() = default; -void IProtocolDialog::register_protocol(IProtocol* protocol){} +void IProtocolDialog::register_protocol(IProtocol*){} void IProtocolDialog::unregister_protocol() {} ITracker::ITracker() = default; ITracker::~ITracker() = default; diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index ac4117bc..9cd416ee 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -172,7 +172,7 @@ options_dialog::options_dialog(std::unique_ptr& tracker_dialog_, val.label, [=](const QString&) { val.label->setText(kopts_to_string(val.opt)); }); { - connect(val.button, &QPushButton::clicked, this, [=] { bind_key(val.opt, val.label); }); + connect(val.button, &QPushButton::clicked, this, [=, this] { bind_key(val.opt, val.label); }); } } diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index 59a01e00..f449845b 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -683,7 +683,6 @@ static void show_module_settings(std::shared_ptr instance, void(Dialog::*register_fun)(Instance*), void(options_dialog::*switch_tab_fun)()) { - using BaseDialog = plugin_api::detail::BaseDialog; if (!lib || !lib->Dialog) return; -- cgit v1.2.3